UNPKG

element-tree-grid

Version:
36 lines (35 loc) 1.48 kB
var ElTableInject = /** @class */ (function () { function ElTableInject() { this.Injected = {}; this.InjectedTable = {}; } ElTableInject.prototype.isInjected = function (scope) { return this.Injected[scope.store.table.tableId]; }; ElTableInject.prototype.Inject = function (context, scope) { if (this.isInjected(scope)) return; this.InjectedTable[scope.store.table.tableId] = scope.store.table; this.Injected[scope.store.table.tableId] = true; var key = context.props.treeKey, parentKey = context.props.parentKey; var table = scope.store.table; scope.store.table.$on("current-change", function () { validateAllExpanded(table, key); }); scope.store.states._treeRowExpanded = []; scope.store.states._treeRowLoading = []; scope.store.states._treeCachedExpanded = []; scope.store.states._treeInitedExpanded = []; // scope.store.mutations }; return ElTableInject; }()); export { ElTableInject }; var validateAllExpanded = function (table, key) { var data = table.store.states._data, _treeRowExpanded = table.store.states._treeRowExpanded; var IsDataListChanged = _treeRowExpanded.every(function (expanded) { return data.every(function (row) { return row[key] != expanded[key]; }); }); if (IsDataListChanged) { table.store.states._treeRowExpanded = []; } }; export default new ElTableInject();