How to use the basis.data.index.sum function in basis

To help you get started, we’ve selected a few basis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smelukov / webpack-runtime-analyzer / src / ui / src / pages / details / index.js View on Github external
modules: {
                        dataSource: tableSourceWrapper,
                        instance: ModulesTable.subclass({
                            tableId: 'DetailedModuleTable',
                            sorting: 'data.index',
                            childClass: TableRow.subclass({
                                template: resource('./template/table/row.tmpl'),
                                binding: {
                                    occurrences: Value.query('data.reasons.itemCount'),

                                    retainedAmount: Value.query('data.retained.itemCount'),
                                    retainedSize: sum(Value.query('data.retained'), 'update', 'data.size')
                                        .as(utils.formatSize),

                                    exclusiveAmount: Value.query('data.exclusive.itemCount'),
                                    exclusiveSize: sum(Value.query('data.exclusive'), 'update', 'data.size')
                                        .as(utils.formatSize),
                                },
                                action: {
                                    gotoModule: function(e) {
                                        var resource = this.data.resource;
                                        var moduleLink;
                                        var position = { line: 1, column: 1 };

                                        e.die();

                                        switch (mode.value) {
                                            case 'require': {
                                                var from = sourceByChoice.value.pick();

                                                resource = from.data.resource;
                                                moduleLink = type.ModuleLink.get({
github smelukov / webpack-runtime-analyzer / src / ui / src / type / env.js View on Github external
return utils.mergeFromDataSource(dataSource, 'data.retained');
});
var exclusive = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.exclusive');
});

env.requiredAmount = Value.query(required, 'value.itemCount');
env.requiredSize = sum(required, 'update', 'data.size');
env.requiredFormattedSize = env.requiredSize.as(utils.formatSize);

env.occurrencesAmount = Value.query(occurrences, 'value.itemCount');
env.occurrencesSize = sum(occurrences, 'update', 'data.size');
env.occurrencesFormattedSize = env.occurrencesSize.as(utils.formatSize);

env.retainedAmount = Value.query(retained, 'value.itemCount');
env.retainedSize = sum(retained, 'update', 'data.size');
env.retainedFormattedSize = env.retainedSize.as(utils.formatSize);

env.exclusiveAmount = Value.query(exclusive, 'value.itemCount');
env.exclusiveSize = sum(exclusive, 'update', 'data.size');
env.exclusiveFormattedSize = env.exclusiveSize.as(utils.formatSize);

var statusText = new Expression(
    file,
    modules,
    Value.query(file, 'value.data.formattedSize'),
    sum(modules, 'update', 'data.size').as(utils.formatSize),

    env.requiredAmount,
    env.requiredFormattedSize,

    env.occurrencesAmount,
github smelukov / webpack-runtime-analyzer / src / ui / src / type / env.js View on Github external
var modules = Value.query(env, 'data.modules');
var required = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.dependencies');
});
var occurrences = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.reasons');
});
var retained = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.retained');
});
var exclusive = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.exclusive');
});

env.requiredAmount = Value.query(required, 'value.itemCount');
env.requiredSize = sum(required, 'update', 'data.size');
env.requiredFormattedSize = env.requiredSize.as(utils.formatSize);

env.occurrencesAmount = Value.query(occurrences, 'value.itemCount');
env.occurrencesSize = sum(occurrences, 'update', 'data.size');
env.occurrencesFormattedSize = env.occurrencesSize.as(utils.formatSize);

env.retainedAmount = Value.query(retained, 'value.itemCount');
env.retainedSize = sum(retained, 'update', 'data.size');
env.retainedFormattedSize = env.retainedSize.as(utils.formatSize);

env.exclusiveAmount = Value.query(exclusive, 'value.itemCount');
env.exclusiveSize = sum(exclusive, 'update', 'data.size');
env.exclusiveFormattedSize = env.exclusiveSize.as(utils.formatSize);

var statusText = new Expression(
    file,
github smelukov / webpack-runtime-analyzer / src / ui / src / pages / home / index.js View on Github external
module.exports = new Page({
    className: 'Page.Home',
    satellite: {
        content: new Node({
            template: resource('./template/page.tmpl'),
            binding: {
                modules: 'satellite:'
            },
            satellite: {
                modules: new SplitView({
                    autoDelegate: true,
                    template: resource('./template/split.tmpl'),
                    binding: {
                        modulesCount: Value.query(type.Module.allWrapper, 'itemCount'),
                        modulesSize: sum(type.Module.allWrapper, 'update', 'data.size').as(utils.formatSize),

                        assetsCount: Value.query(type.Asset.all, 'itemCount'),
                        assetsSize: sum(type.Asset.all, 'update', 'data.size').as(utils.formatSize)
                    },
                    satellite: {
                        left: new ModulesTable({
                            dataSource: type.Module.allWrapper,
                        }),
                        right: new AssetsTable({
                            dataSource: type.Asset.all,
                        })
                    }
                })
            }
        })
    }
github smelukov / webpack-runtime-analyzer / src / ui / src / pages / home / modules / modules / table.js View on Github external
satellite: {
        head: TableHead.subclass({
            childNodes: [
                { data: { content: dict.token('id') } },
                { data: { content: dict.token('name') } },
                { data: { content: dict.token('size') } }
            ]
        }),
        foot: Node.subclass({
            template: resource('./template/foot.tmpl'),
            binding: {
                fileSizeCell: 'satellite:'
            },
            satellite: {
                fileSizeCell: FileSizeCell.subclass({
                    size: sum(Value.query('owner.owner.dataSource'), 'update', 'data.size')
                })
            }
        })
    }
});
github smelukov / webpack-runtime-analyzer / src / ui / src / pages / home / index.js View on Github external
satellite: {
        content: new Node({
            template: resource('./template/page.tmpl'),
            binding: {
                modules: 'satellite:'
            },
            satellite: {
                modules: new SplitView({
                    autoDelegate: true,
                    template: resource('./template/split.tmpl'),
                    binding: {
                        modulesCount: Value.query(type.Module.allWrapper, 'itemCount'),
                        modulesSize: sum(type.Module.allWrapper, 'update', 'data.size').as(utils.formatSize),

                        assetsCount: Value.query(type.Asset.all, 'itemCount'),
                        assetsSize: sum(type.Asset.all, 'update', 'data.size').as(utils.formatSize)
                    },
                    satellite: {
                        left: new ModulesTable({
                            dataSource: type.Module.allWrapper,
                        }),
                        right: new AssetsTable({
                            dataSource: type.Asset.all,
                        })
                    }
                })
            }
        })
    }
});
github smelukov / webpack-runtime-analyzer / src / ui / src / index.js View on Github external
}
                }),
                progress: new Progress(),
                page: Value.query('satellite.menu.selection.pick()').as(function(node) {
                    return node && routes[node.id] || routes.home;
                }),
                bottom: {
                    existsIf: Value.query(type.Env, 'data.connected'),
                    delegate: Value.query(type.Env, 'data.file'),
                    instance: BottomBar.subclass({
                        template: resource('./template/bottom.tmpl'),
                        binding: {
                            fileName: Value.query(type.Env, 'data.file.data.short'),
                            fileSize: Value.query(type.Env, 'data.file.data.formattedSize'),
                            outputAmount: Value.query(type.Env, 'data.modules.itemCount'),
                            outputSize: sum(Value.query(type.Env, 'data.modules'), 'update', 'data.size')
                                .as(utils.formatSize),
                            requiredAmount: type.Env.requiredAmount,
                            requiredSize: type.Env.requiredFormattedSize,
                            retainedAmount: type.Env.retainedAmount,
                            retainedSize: type.Env.retainedFormattedSize,
                            exclusiveAmount: type.Env.exclusiveAmount,
                            exclusiveSize: type.Env.exclusiveFormattedSize
                        },
                        action: {
                            fileStat: function() {
                                pageSwitcher.set('details');
                            }
                        }
                    })
                }
            }
github smelukov / webpack-runtime-analyzer / src / ui / src / type / env.js View on Github external
var occurrences = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.reasons');
});
var retained = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.retained');
});
var exclusive = modules.as(function(dataSource) {
    return utils.mergeFromDataSource(dataSource, 'data.exclusive');
});

env.requiredAmount = Value.query(required, 'value.itemCount');
env.requiredSize = sum(required, 'update', 'data.size');
env.requiredFormattedSize = env.requiredSize.as(utils.formatSize);

env.occurrencesAmount = Value.query(occurrences, 'value.itemCount');
env.occurrencesSize = sum(occurrences, 'update', 'data.size');
env.occurrencesFormattedSize = env.occurrencesSize.as(utils.formatSize);

env.retainedAmount = Value.query(retained, 'value.itemCount');
env.retainedSize = sum(retained, 'update', 'data.size');
env.retainedFormattedSize = env.retainedSize.as(utils.formatSize);

env.exclusiveAmount = Value.query(exclusive, 'value.itemCount');
env.exclusiveSize = sum(exclusive, 'update', 'data.size');
env.exclusiveFormattedSize = env.exclusiveSize.as(utils.formatSize);

var statusText = new Expression(
    file,
    modules,
    Value.query(file, 'value.data.formattedSize'),
    sum(modules, 'update', 'data.size').as(utils.formatSize),
github smelukov / webpack-runtime-analyzer / src / ui / src / pages / details / index.js View on Github external
},
        close: function() {
            domEvent.removeGlobalHandler('keydown', handleKeyEvent);
        }
    },
    satellite: {
        content: {
            instance: Node.subclass({
                template: resource('./template/template.tmpl'),
                binding: {
                    filterInput: 'satellite:',
                    modules: 'satellite:',
                    modeSwitcher: 'satellite:',
                    suggestionChoice: Value.query(suggestionChoice, 'target'),
                    modulesCount: Value.query(tableSourceWrapper, 'itemCount'),
                    modulesSize: sum(tableSourceWrapper, 'update', 'data.size').as(utils.formatSize),
                },
                satellite: {
                    filterInput: TextInput.subclass({
                        template: resource('./template/textInput.tmpl'),
                        binding: {
                            type: Value.query(suggestionChoice, 'target').as(function(target) {
                                if (target) {
                                    return typeMap[target.typeName];
                                }
                            })
                        },
                        action: {
                            keyup: function(event) {
                                if ([KEY_ENTER, KEY_ESCAPE, KEY_UP, KEY_DOWN].indexOf(event.keyCode) > -1) {
                                    return;
                                }
github smelukov / webpack-runtime-analyzer / src / ui / src / ui / modules / index.js View on Github external
}
});

var Head = TableHead.subclass({
    childNodes: [
        { data: { content: dict.token('id') }, columnId: 'id', sortingRule: 'data.index' },
        { data: { content: dict.token('name') }, columnId: 'name', sortingRule: 'data.name' },
        { data: { content: dict.token('size') }, columnId: 'size', sortingRule: 'data.size' }
    ]
});

var Foot = Node.subclass({
    template: resource('./template/foot.tmpl'),
    binding: {
        count: Value.query('owner.dataSource.itemCount'),
        size: sum(Value.query('owner.dataSource'), 'update', 'data.size').as(utils.formatSize),
    }
});

var ModuleTable = Table.subclass({
    tableId: 'ModuleTable',
    sorting: 'data.index',
    childClass: Row,
    satellite: {
        head: Head,
        foot: Foot
    }
});

module.exports = {
    Table: ModuleTable,
    Head: Head,