@visactor/vtable 0.23.0-alpha.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +3 -3
- package/cjs/ListTable.js +45 -34
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +19 -17
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/style/Style.d.ts +3 -0
- package/cjs/body-helper/style/Style.js +22 -15
- package/cjs/body-helper/style/Style.js.map +1 -1
- package/cjs/components/legend/continue-legend/continue-legend.js +1 -1
- package/cjs/components/legend/continue-legend/continue-legend.js.map +1 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js +1 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +3 -1
- package/cjs/core/BaseTable.js +27 -17
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/tableHelper.js +1 -2
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +1 -0
- package/cjs/data/CachedDataSource.js +10 -6
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.d.ts +10 -3
- package/cjs/data/DataSource.js +159 -95
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/edit/edit-manager.js +10 -9
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/event.js +11 -5
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/table-group.js +2 -2
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +2 -1
- package/cjs/event/sparkline-event.js +1 -2
- package/cjs/header-helper/style/Style.d.ts +3 -0
- package/cjs/header-helper/style/Style.js +26 -19
- package/cjs/header-helper/style/Style.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +4 -2
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +3 -2
- package/cjs/layout/simple-header-layout.js +40 -25
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/table-component.js +13 -8
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +10 -6
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +3 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.d.ts +3 -2
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +20 -6
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +12 -8
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +72 -71
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +2 -2
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +18 -11
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +19 -13
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +3 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/cell-border-stroke-width.js +15 -10
- package/cjs/scenegraph/utils/cell-border-stroke-width.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +4 -4
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/scenegraph/utils/text-measure.js +6 -6
- package/cjs/scenegraph/utils/text-measure.js.map +1 -1
- package/cjs/state/cell-move/index.js +1 -1
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +1 -1
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/select/update-position.js +39 -8
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.d.ts +6 -0
- package/cjs/state/state.js +49 -17
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/theme.js +11 -3
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/util.d.ts +0 -1
- package/cjs/tools/util.js +3 -13
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +18 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/list-table/define/progressbar-define.d.ts +2 -2
- package/cjs/ts-types/list-table/define/progressbar-define.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +4 -4
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +1 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +935 -466
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +3 -3
- package/es/ListTable.js +46 -35
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +19 -17
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/style/Style.d.ts +3 -0
- package/es/body-helper/style/Style.js +22 -15
- package/es/body-helper/style/Style.js.map +1 -1
- package/es/components/legend/continue-legend/continue-legend.js +1 -1
- package/es/components/legend/continue-legend/continue-legend.js.map +1 -1
- package/es/components/legend/discrete-legend/discrete-legend.js +1 -1
- package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/es/core/BaseTable.d.ts +3 -1
- package/es/core/BaseTable.js +27 -17
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/es/core/TABLE_EVENT_TYPE.js +2 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/tableHelper.js +1 -2
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +1 -0
- package/es/data/CachedDataSource.js +9 -7
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.d.ts +10 -3
- package/es/data/DataSource.js +159 -95
- package/es/data/DataSource.js.map +1 -1
- package/es/edit/edit-manager.js +10 -9
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/event.js +11 -5
- package/es/event/event.js.map +1 -1
- package/es/event/listener/table-group.js +2 -2
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +2 -1
- package/es/event/sparkline-event.js +1 -2
- package/es/header-helper/style/Style.d.ts +3 -0
- package/es/header-helper/style/Style.js +26 -19
- package/es/header-helper/style/Style.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +4 -2
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +3 -2
- package/es/layout/simple-header-layout.js +40 -25
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/table-component.js +13 -8
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +10 -6
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.d.ts +3 -2
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +21 -5
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +11 -8
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +71 -70
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +2 -2
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +16 -9
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +19 -10
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.js +3 -3
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/cell-border-stroke-width.js +10 -7
- package/es/scenegraph/utils/cell-border-stroke-width.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.js +4 -4
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/scenegraph/utils/text-measure.js +6 -6
- package/es/scenegraph/utils/text-measure.js.map +1 -1
- package/es/state/cell-move/index.js +1 -1
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/resize/update-resize-column.js +1 -1
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/select/update-position.js +39 -8
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.d.ts +6 -0
- package/es/state/state.js +49 -17
- package/es/state/state.js.map +1 -1
- package/es/themes/theme.js +8 -2
- package/es/themes/theme.js.map +1 -1
- package/es/tools/util.d.ts +0 -1
- package/es/tools/util.js +0 -10
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +3 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +18 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/list-table/define/progressbar-define.d.ts +2 -2
- package/es/ts-types/list-table/define/progressbar-define.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +4 -4
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +1 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/es/data/DataSource.js
CHANGED
|
@@ -67,13 +67,13 @@ export class DataSource extends EventTarget {
|
|
|
67
67
|
return EVENT_TYPE;
|
|
68
68
|
}
|
|
69
69
|
constructor(dataSourceObj, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
|
|
70
|
-
var _a
|
|
70
|
+
var _a;
|
|
71
71
|
super(), this.currentIndexedData = [], this.hierarchyExpandLevel = 0, this.hasHierarchyStateExpand = !1,
|
|
72
72
|
this.beforeChangedRecordsMap = [], this.registedAggregators = {}, this.fieldAggregators = [],
|
|
73
73
|
this.layoutColumnObjects = [], this.registerAggregators(), this.dataSourceObj = dataSourceObj,
|
|
74
|
-
this.dataConfig = dataConfig, this._get =
|
|
75
|
-
this.layoutColumnObjects = columnObjs, this._source =
|
|
76
|
-
this._sourceLength = (null === (
|
|
74
|
+
this.dataConfig = dataConfig, this._get = null == dataSourceObj ? void 0 : dataSourceObj.get,
|
|
75
|
+
this.layoutColumnObjects = columnObjs, this._source = (null == dataSourceObj ? void 0 : dataSourceObj.records) ? this.processRecords(null == dataSourceObj ? void 0 : dataSourceObj.records) : dataSourceObj,
|
|
76
|
+
this._sourceLength = (null === (_a = this._source) || void 0 === _a ? void 0 : _a.length) || 0,
|
|
77
77
|
this.sortedIndexMap = new Map, this._currentPagerIndexedData = [], this.userPagination = pagination,
|
|
78
78
|
this.pagination = pagination || {
|
|
79
79
|
totalCount: this._sourceLength,
|
|
@@ -83,7 +83,7 @@ export class DataSource extends EventTarget {
|
|
|
83
83
|
this.currentIndexedData = Array.from({
|
|
84
84
|
length: this._sourceLength
|
|
85
85
|
}, ((_, i) => i)), "tree" === rowHierarchyType && this.initTreeHierarchyState(),
|
|
86
|
-
this.updatePagerData();
|
|
86
|
+
this.rowHierarchyType = rowHierarchyType, this.updatePagerData();
|
|
87
87
|
}
|
|
88
88
|
initTreeHierarchyState() {
|
|
89
89
|
var _a;
|
|
@@ -92,8 +92,8 @@ export class DataSource extends EventTarget {
|
|
|
92
92
|
}, ((_, i) => i));
|
|
93
93
|
let nodeLength = this._sourceLength;
|
|
94
94
|
for (let i = 0; i < nodeLength; i++) {
|
|
95
|
-
const indexKey = this.currentIndexedData[i], nodeData = this.getOriginalRecord(indexKey);
|
|
96
|
-
if ((null
|
|
95
|
+
const indexKey = this.currentIndexedData[i], nodeData = this.getOriginalRecord(indexKey), children = null !== (_a = nodeData.filteredChildren) && void 0 !== _a ? _a : nodeData.children;
|
|
96
|
+
if ((null == children ? void 0 : children.length) > 0) {
|
|
97
97
|
if (this.hierarchyExpandLevel > 1 ? !nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.expand) : !nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.collapse),
|
|
98
98
|
this.hasHierarchyStateExpand = !0, nodeData.hierarchyState === HierarchyState.collapse) continue;
|
|
99
99
|
const childrenLength = this.initChildrenNodeHierarchy(indexKey, this.hierarchyExpandLevel, 2, nodeData);
|
|
@@ -126,18 +126,29 @@ export class DataSource extends EventTarget {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
processRecords(records) {
|
|
129
|
-
var _a, _b;
|
|
129
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
130
130
|
this._generateFieldAggragations();
|
|
131
|
-
const filteredRecords = [], isHasAggregation = this.fieldAggregators.length >= 1
|
|
132
|
-
if (
|
|
131
|
+
const filteredRecords = [], isHasAggregation = this.fieldAggregators.length >= 1;
|
|
132
|
+
if ((null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) >= 1 || (null === (_c = this.lastFilterRules) || void 0 === _c ? void 0 : _c.length) >= 1 || isHasAggregation) {
|
|
133
133
|
for (let i = 0, len = records.length; i < len; i++) {
|
|
134
134
|
const record = records[i];
|
|
135
|
-
|
|
135
|
+
(null === (_e = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.filterRules) || void 0 === _e ? void 0 : _e.length) >= 1 ? this.filterRecord(record) && (filteredRecords.push(record),
|
|
136
|
+
"tree" === this.rowHierarchyType && record.children && (record.filteredChildren = this.filteredChildren(record.children)),
|
|
137
|
+
isHasAggregation && this.processRecord(record)) : (null === (_f = this.lastFilterRules) || void 0 === _f ? void 0 : _f.length) >= 1 ? (this.clearFilteredChildren(record),
|
|
138
|
+
isHasAggregation && this.processRecord(record)) : isHasAggregation && this.processRecord(record);
|
|
136
139
|
}
|
|
137
|
-
if (
|
|
140
|
+
if ((null === (_h = null === (_g = this.dataConfig) || void 0 === _g ? void 0 : _g.filterRules) || void 0 === _h ? void 0 : _h.length) >= 1) return filteredRecords;
|
|
138
141
|
}
|
|
139
142
|
return records;
|
|
140
143
|
}
|
|
144
|
+
filteredChildren(records) {
|
|
145
|
+
const filteredRecords = [];
|
|
146
|
+
for (let i = 0, len = records.length; i < len; i++) {
|
|
147
|
+
const record = records[i];
|
|
148
|
+
this.filterRecord(record) && (filteredRecords.push(record), record.children && (record.filteredChildren = this.filteredChildren(record.children)));
|
|
149
|
+
}
|
|
150
|
+
return filteredRecords;
|
|
151
|
+
}
|
|
141
152
|
processRecord(record) {
|
|
142
153
|
for (let i = 0; i < this.fieldAggregators.length; i++) {
|
|
143
154
|
this.fieldAggregators[i].push(record);
|
|
@@ -146,12 +157,12 @@ export class DataSource extends EventTarget {
|
|
|
146
157
|
initChildrenNodeHierarchy(indexKey, hierarchyExpandLevel, currentLevel, nodeData) {
|
|
147
158
|
var _a, _b, _c;
|
|
148
159
|
let childTotalLength = 0;
|
|
149
|
-
const nodeLength = null !== (_b = null === (_a = nodeData.children) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
160
|
+
const nodeLength = nodeData.filteredChildren ? nodeData.filteredChildren.length : null !== (_b = null === (_a = nodeData.children) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
150
161
|
for (let j = 0; j < nodeLength; j++) {
|
|
151
162
|
(currentLevel <= hierarchyExpandLevel || nodeData.hierarchyState === HierarchyState.expand) && (childTotalLength += 1);
|
|
152
|
-
const childNodeData = nodeData.children[j], childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [ indexKey, j ];
|
|
163
|
+
const childNodeData = nodeData.filteredChildren ? nodeData.filteredChildren[j] : nodeData.children[j], childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [ indexKey, j ];
|
|
153
164
|
(currentLevel <= hierarchyExpandLevel || nodeData.hierarchyState === HierarchyState.expand) && this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childTotalLength, 0, childIndexKey),
|
|
154
|
-
(null === (_c = childNodeData.children) || void 0 === _c ? void 0 : _c.length) > 0 && (currentLevel < hierarchyExpandLevel || childNodeData.hierarchyState === HierarchyState.expand ? (!childNodeData.hierarchyState && (childNodeData.hierarchyState = HierarchyState.expand),
|
|
165
|
+
(childNodeData.filteredChildren ? childNodeData.filteredChildren.length > 0 : (null === (_c = childNodeData.children) || void 0 === _c ? void 0 : _c.length) > 0) && (currentLevel < hierarchyExpandLevel || childNodeData.hierarchyState === HierarchyState.expand ? (!childNodeData.hierarchyState && (childNodeData.hierarchyState = HierarchyState.expand),
|
|
155
166
|
this.hasHierarchyStateExpand = !0) : !childNodeData.hierarchyState && (childNodeData.hierarchyState = HierarchyState.collapse)),
|
|
156
167
|
childNodeData.hierarchyState === HierarchyState.expand && (childTotalLength += this.initChildrenNodeHierarchy(childIndexKey, hierarchyExpandLevel, currentLevel + 1, childNodeData));
|
|
157
168
|
}
|
|
@@ -172,6 +183,9 @@ export class DataSource extends EventTarget {
|
|
|
172
183
|
firstLevelIndex >= startIndex && firstLevelIndex < endIndex) this._currentPagerIndexedData.push(currentIndexedData[i]); else if (firstLevelIndex >= endIndex) break;
|
|
173
184
|
} else if (this._sourceLength > 0) throw new Error("currentIndexedData should has values!");
|
|
174
185
|
}
|
|
186
|
+
get records() {
|
|
187
|
+
return Array.isArray(this._source) ? this._source : [];
|
|
188
|
+
}
|
|
175
189
|
get source() {
|
|
176
190
|
return this._source;
|
|
177
191
|
}
|
|
@@ -207,10 +221,12 @@ export class DataSource extends EventTarget {
|
|
|
207
221
|
this.pushChildrenNode(indexed, HierarchyState.expand, data), this.hasHierarchyStateExpand = !0; else if (state === HierarchyState.expand) {
|
|
208
222
|
let childrenLength = 0;
|
|
209
223
|
const computeChildrenNodeLength = (indexKey, hierarchyState, nodeData) => {
|
|
210
|
-
if (hierarchyState
|
|
224
|
+
if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return;
|
|
225
|
+
const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
|
|
226
|
+
if (children) for (let i = 0; i < children.length; i++) {
|
|
211
227
|
childrenLength += 1;
|
|
212
228
|
const childIndex = Array.isArray(indexKey) ? indexKey.concat([ i ]) : [ indexKey, i ];
|
|
213
|
-
computeChildrenNodeLength(childIndex,
|
|
229
|
+
computeChildrenNodeLength(childIndex, children[i].hierarchyState, children[i]);
|
|
214
230
|
}
|
|
215
231
|
};
|
|
216
232
|
computeChildrenNodeLength(indexed, state, data), this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength),
|
|
@@ -220,22 +236,24 @@ export class DataSource extends EventTarget {
|
|
|
220
236
|
return calculateArrayDiff(oldIndexedData, this.currentIndexedData);
|
|
221
237
|
}
|
|
222
238
|
pushChildrenNode(indexKey, hierarchyState, nodeData) {
|
|
239
|
+
var _a;
|
|
223
240
|
if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return 0;
|
|
224
241
|
let childrenLength = 0;
|
|
225
|
-
|
|
242
|
+
const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
|
|
243
|
+
if (children) {
|
|
226
244
|
const subNodeSortedIndexArray = Array.from({
|
|
227
|
-
length:
|
|
245
|
+
length: children.length
|
|
228
246
|
}, ((_, i) => i));
|
|
229
247
|
this.lastOrder && "normal" !== this.lastOrder && this.lastOrderField && sort.sort((index => isValid(subNodeSortedIndexArray[index]) ? subNodeSortedIndexArray[index] : subNodeSortedIndexArray[index] = index), ((index, rel) => {
|
|
230
248
|
subNodeSortedIndexArray[index] = rel;
|
|
231
|
-
}),
|
|
249
|
+
}), children.length, this.lastOrderFn, this.lastOrder, (index => this.getOriginalField(Array.isArray(indexKey) ? indexKey.concat([ index ]) : [ indexKey, index ], this.lastOrderField)));
|
|
232
250
|
for (let i = 0; i < subNodeSortedIndexArray.length; i++) {
|
|
233
251
|
childrenLength += 1;
|
|
234
252
|
const childIndex = Array.isArray(indexKey) ? indexKey.concat([ subNodeSortedIndexArray[i] ]) : [ indexKey, subNodeSortedIndexArray[i] ];
|
|
235
253
|
this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childrenLength, 0, childIndex);
|
|
236
254
|
const childData = this.getOriginalRecord(childIndex);
|
|
237
|
-
!
|
|
238
|
-
childrenLength += this.pushChildrenNode(childIndex,
|
|
255
|
+
!childData.hierarchyState && (null !== (_a = childData.filteredChildren) && void 0 !== _a ? _a : childData.children) && (childData.hierarchyState = HierarchyState.collapse),
|
|
256
|
+
childrenLength += this.pushChildrenNode(childIndex, childData.hierarchyState, children[subNodeSortedIndexArray[i]]);
|
|
239
257
|
}
|
|
240
258
|
}
|
|
241
259
|
return childrenLength;
|
|
@@ -258,74 +276,94 @@ export class DataSource extends EventTarget {
|
|
|
258
276
|
}
|
|
259
277
|
}
|
|
260
278
|
setRecord(record, index) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
279
|
+
var _a, _b;
|
|
280
|
+
let isAdd = !0;
|
|
281
|
+
if ((null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) >= 1 && (this.filterRecord(record) ? "tree" === this.rowHierarchyType && record.children && (record.filteredChildren = this.filteredChildren(record.children)) : isAdd = !1),
|
|
282
|
+
isAdd && Array.isArray(this.records)) {
|
|
283
|
+
const indexed = this.getIndexKey(index);
|
|
284
|
+
Array.isArray(indexed) || this.records.splice(indexed, 1, record);
|
|
285
|
+
}
|
|
266
286
|
}
|
|
267
287
|
addRecord(record, index) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
288
|
+
var _a;
|
|
289
|
+
if (Array.isArray(this.records)) {
|
|
290
|
+
if (this.records.splice(index, 0, record), this.currentIndexedData.push(this.currentIndexedData.length),
|
|
291
|
+
this._sourceLength += 1, "tree" === this.rowHierarchyType && this.initTreeHierarchyState(),
|
|
292
|
+
this.userPagination) {
|
|
293
|
+
this.pagination.totalCount = this._sourceLength;
|
|
294
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
295
|
+
index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
|
|
296
|
+
} else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
297
|
+
this.updatePagerData();
|
|
298
|
+
(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, 1);
|
|
299
|
+
}
|
|
275
300
|
}
|
|
276
301
|
addRecords(recordArr, index) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
302
|
+
var _a;
|
|
303
|
+
if (Array.isArray(this.records)) {
|
|
304
|
+
if (Array.isArray(recordArr)) {
|
|
305
|
+
this.records.splice(index, 0, ...recordArr);
|
|
306
|
+
for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
|
|
307
|
+
this._sourceLength += recordArr.length;
|
|
308
|
+
}
|
|
309
|
+
if (this.userPagination) {
|
|
310
|
+
this.pagination.totalCount = this._sourceLength;
|
|
311
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
312
|
+
index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
|
|
313
|
+
} else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
314
|
+
this.updatePagerData();
|
|
315
|
+
(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
|
|
281
316
|
}
|
|
282
|
-
if (this.userPagination) {
|
|
283
|
-
this.pagination.totalCount = this._sourceLength;
|
|
284
|
-
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
285
|
-
index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
|
|
286
|
-
} else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
287
|
-
this.updatePagerData();
|
|
288
317
|
}
|
|
289
318
|
addRecordForSorted(record) {
|
|
290
|
-
this.
|
|
319
|
+
Array.isArray(this.records) && (this.records.push(record), this.currentIndexedData.push(this.currentIndexedData.length),
|
|
291
320
|
this._sourceLength += 1, this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
292
|
-
this.pagination.totalCount = this._sourceLength);
|
|
321
|
+
this.pagination.totalCount = this._sourceLength));
|
|
293
322
|
}
|
|
294
323
|
addRecordsForSorted(recordArr) {
|
|
295
|
-
if (Array.isArray(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
324
|
+
if (Array.isArray(this.records)) {
|
|
325
|
+
if (Array.isArray(recordArr)) {
|
|
326
|
+
this.records.push(...recordArr);
|
|
327
|
+
for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
|
|
328
|
+
this._sourceLength += recordArr.length, this.sortedIndexMap.clear();
|
|
329
|
+
}
|
|
330
|
+
this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength);
|
|
299
331
|
}
|
|
300
|
-
this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength);
|
|
301
332
|
}
|
|
302
333
|
deleteRecords(recordIndexs) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
334
|
+
var _a;
|
|
335
|
+
if (Array.isArray(this.records)) {
|
|
336
|
+
const realDeletedRecordIndexs = [], recordIndexsMaxToMin = recordIndexs.sort(((a, b) => b - a));
|
|
337
|
+
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
338
|
+
const recordIndex = recordIndexsMaxToMin[index];
|
|
339
|
+
recordIndex >= this._sourceLength || recordIndex < 0 || (realDeletedRecordIndexs.push(recordIndex),
|
|
340
|
+
this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1);
|
|
341
|
+
}
|
|
342
|
+
return this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
343
|
+
this.pagination.totalCount = this._sourceLength), this.updatePagerData(), (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.deleted) && this.dataSourceObj.deleted(realDeletedRecordIndexs),
|
|
344
|
+
realDeletedRecordIndexs;
|
|
308
345
|
}
|
|
309
|
-
return
|
|
310
|
-
this.pagination.totalCount = this._sourceLength), this.updatePagerData(), realDeletedRecordIndexs;
|
|
346
|
+
return [];
|
|
311
347
|
}
|
|
312
348
|
deleteRecordsForSorted(recordIndexs) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
349
|
+
if (Array.isArray(this.records)) {
|
|
350
|
+
const recordIndexsMaxToMin = recordIndexs.sort(((a, b) => b - a));
|
|
351
|
+
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
352
|
+
const recordIndex = recordIndexsMaxToMin[index];
|
|
353
|
+
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
354
|
+
const rawIndex = this.currentIndexedData[recordIndex];
|
|
355
|
+
this.records.splice(rawIndex, 1), this._sourceLength -= 1;
|
|
356
|
+
}
|
|
357
|
+
this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
358
|
+
this.pagination.totalCount = this._sourceLength);
|
|
319
359
|
}
|
|
320
|
-
this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
321
|
-
this.pagination.totalCount = this._sourceLength);
|
|
322
360
|
}
|
|
323
361
|
updateRecords(records, recordIndexs) {
|
|
324
362
|
const realDeletedRecordIndexs = [];
|
|
325
363
|
for (let index = 0; index < recordIndexs.length; index++) {
|
|
326
364
|
const recordIndex = recordIndexs[index];
|
|
327
365
|
recordIndex >= this._sourceLength || recordIndex < 0 || (realDeletedRecordIndexs.push(recordIndex),
|
|
328
|
-
this.
|
|
366
|
+
this.records[recordIndex] = records[index]);
|
|
329
367
|
}
|
|
330
368
|
return this.userPagination && this.updatePagerData(), realDeletedRecordIndexs;
|
|
331
369
|
}
|
|
@@ -336,7 +374,7 @@ export class DataSource extends EventTarget {
|
|
|
336
374
|
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
337
375
|
const rawIndex = this.currentIndexedData[recordIndex];
|
|
338
376
|
if ("number" != typeof rawIndex) return;
|
|
339
|
-
realDeletedRecordIndexs.push(recordIndex), this.
|
|
377
|
+
realDeletedRecordIndexs.push(recordIndex), this.records[rawIndex] = records[index];
|
|
340
378
|
}
|
|
341
379
|
this.sortedIndexMap.clear();
|
|
342
380
|
}
|
|
@@ -364,18 +402,23 @@ export class DataSource extends EventTarget {
|
|
|
364
402
|
}, this.sortedIndexMap.set(field, filedMap)), filedMap[order] = sortedIndexArray,
|
|
365
403
|
this.updatePagerData(), this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);
|
|
366
404
|
}
|
|
367
|
-
|
|
405
|
+
clearFilteredChildren(record) {
|
|
368
406
|
var _a, _b;
|
|
407
|
+
record.filteredChildren = void 0;
|
|
408
|
+
for (let i = 0; null !== (_b = i < (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length)) && void 0 !== _b && _b; i++) this.clearFilteredChildren(record.children[i]);
|
|
409
|
+
}
|
|
410
|
+
filterRecord(record) {
|
|
411
|
+
var _a, _b, _c;
|
|
369
412
|
let isReserved = !0;
|
|
370
|
-
for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
|
|
371
|
-
const filterRule = null === (
|
|
413
|
+
for (let i = 0; i < (null === (_a = this.dataConfig.filterRules) || void 0 === _a ? void 0 : _a.length); i++) {
|
|
414
|
+
const filterRule = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules[i];
|
|
372
415
|
if (filterRule.filterKey) {
|
|
373
416
|
const filterValue = record[filterRule.filterKey];
|
|
374
417
|
if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
|
|
375
418
|
isReserved = !1;
|
|
376
419
|
break;
|
|
377
420
|
}
|
|
378
|
-
} else if (!(null === (
|
|
421
|
+
} else if (!(null === (_c = filterRule.filterFunc) || void 0 === _c ? void 0 : _c.call(filterRule, record))) {
|
|
379
422
|
isReserved = !1;
|
|
380
423
|
break;
|
|
381
424
|
}
|
|
@@ -384,7 +427,8 @@ export class DataSource extends EventTarget {
|
|
|
384
427
|
}
|
|
385
428
|
updateFilterRulesForSorted(filterRules) {
|
|
386
429
|
var _a, _b, _c;
|
|
387
|
-
this.
|
|
430
|
+
this.lastFilterRules = this.dataConfig.filterRules, this.dataConfig.filterRules = filterRules,
|
|
431
|
+
this._source = this.processRecords(null !== (_b = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSourceObj),
|
|
388
432
|
this._sourceLength = (null === (_c = this._source) || void 0 === _c ? void 0 : _c.length) || 0,
|
|
389
433
|
this.sortedIndexMap.clear(), this.currentIndexedData = Array.from({
|
|
390
434
|
length: this._sourceLength
|
|
@@ -393,12 +437,14 @@ export class DataSource extends EventTarget {
|
|
|
393
437
|
}
|
|
394
438
|
updateFilterRules(filterRules) {
|
|
395
439
|
var _a, _b, _c;
|
|
396
|
-
this.
|
|
440
|
+
this.lastFilterRules = this.dataConfig.filterRules, this.dataConfig.filterRules = filterRules,
|
|
441
|
+
this._source = this.processRecords(null !== (_b = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSourceObj),
|
|
397
442
|
this._sourceLength = (null === (_c = this._source) || void 0 === _c ? void 0 : _c.length) || 0,
|
|
398
443
|
this.currentIndexedData = Array.from({
|
|
399
444
|
length: this._sourceLength
|
|
400
445
|
}, ((_, i) => i)), this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
401
|
-
this.pagination.totalCount = this._sourceLength
|
|
446
|
+
this.pagination.totalCount = this._sourceLength, "tree" === this.rowHierarchyType && this.initTreeHierarchyState()),
|
|
447
|
+
this.updatePagerData();
|
|
402
448
|
}
|
|
403
449
|
clearSortedIndexMap() {
|
|
404
450
|
this.lastOrderField && this.lastOrder && this.sortedIndexMap.forEach(((sortMap, key) => {
|
|
@@ -424,7 +470,7 @@ export class DataSource extends EventTarget {
|
|
|
424
470
|
}
|
|
425
471
|
release() {
|
|
426
472
|
var _a;
|
|
427
|
-
null === (_a = super.release) || void 0 === _a || _a.call(this);
|
|
473
|
+
null === (_a = super.release) || void 0 === _a || _a.call(this), this.lastFilterRules = null;
|
|
428
474
|
}
|
|
429
475
|
clearSortedMap() {
|
|
430
476
|
this.currentIndexedData && (this.currentIndexedData.length = 0), this.currentIndexedData = null,
|
|
@@ -436,14 +482,18 @@ export class DataSource extends EventTarget {
|
|
|
436
482
|
this.currentIndexedData = null, this.currentPagerIndexedData.length = 0;
|
|
437
483
|
}
|
|
438
484
|
getOriginalRecord(dataIndex) {
|
|
439
|
-
|
|
440
|
-
return
|
|
485
|
+
let data;
|
|
486
|
+
return data = this.dataSourceObj.records ? Array.isArray(dataIndex) ? getValueFromDeepArray(this.records, dataIndex) : this.records[dataIndex] : this._get(dataIndex),
|
|
487
|
+
getValue(data, (val => {
|
|
441
488
|
this.recordPromiseCallBack(dataIndex, val);
|
|
442
489
|
}));
|
|
443
490
|
}
|
|
444
491
|
getRawRecord(dataIndex) {
|
|
445
492
|
var _a;
|
|
446
|
-
|
|
493
|
+
if (null === (_a = this.beforeChangedRecordsMap) || void 0 === _a ? void 0 : _a[dataIndex]) return this.beforeChangedRecordsMap[dataIndex];
|
|
494
|
+
let data;
|
|
495
|
+
return data = this.dataSourceObj.records ? Array.isArray(dataIndex) ? getValueFromDeepArray(this.records, dataIndex) : this.records[dataIndex] : this._get(dataIndex),
|
|
496
|
+
getValue(data, (val => {
|
|
447
497
|
this.recordPromiseCallBack(dataIndex, val);
|
|
448
498
|
}));
|
|
449
499
|
}
|
|
@@ -486,6 +536,7 @@ export class DataSource extends EventTarget {
|
|
|
486
536
|
return !0;
|
|
487
537
|
}
|
|
488
538
|
reorderRecord(sourceIndex, targetIndex) {
|
|
539
|
+
var _a;
|
|
489
540
|
if ("asc" !== this.lastOrder && "desc" !== this.lastOrder && this.isCanExchangeOrder(sourceIndex, targetIndex)) if (this.hasHierarchyStateExpand) {
|
|
490
541
|
let sourceI, targetI, sourceIndexs = this.currentPagerIndexedData[sourceIndex], targetIndexs = this.currentPagerIndexedData[targetIndex];
|
|
491
542
|
if (sourceIndexs = Array.isArray(sourceIndexs) ? [ ...sourceIndexs ] : [ sourceIndexs ],
|
|
@@ -498,37 +549,37 @@ export class DataSource extends EventTarget {
|
|
|
498
549
|
}
|
|
499
550
|
if (sourceI = sourceIndexs.splice(sourceIndexs.length - 1, 1)[0], targetI = targetIndexs.splice(targetIndexs.length - 1, 1)[0],
|
|
500
551
|
sourceIndexs.length >= 1) {
|
|
501
|
-
const parent = this.getOriginalRecord(sourceIndexs), sourceIds = parent.children.splice(sourceI, 1);
|
|
502
|
-
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(parent.children, sourceIds);
|
|
552
|
+
const parent = this.getOriginalRecord(sourceIndexs), sourceIds = parent.filteredChildren ? parent.filteredChildren.splice(sourceI, 1) : parent.children.splice(sourceI, 1);
|
|
553
|
+
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(null !== (_a = parent.filteredChildren) && void 0 !== _a ? _a : parent.children, sourceIds);
|
|
503
554
|
} else {
|
|
504
|
-
const sourceIds = this.
|
|
505
|
-
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(this.
|
|
555
|
+
const sourceIds = this.records.splice(sourceI, 1);
|
|
556
|
+
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(this.records, sourceIds);
|
|
506
557
|
}
|
|
507
558
|
} else {
|
|
508
559
|
sourceI = this.currentPagerIndexedData[sourceIndex], targetI = this.currentPagerIndexedData[targetIndex];
|
|
509
|
-
const records = this.
|
|
510
|
-
records.unshift(targetI, 0), Array.prototype.splice.apply(this.
|
|
560
|
+
const records = this.records.splice(sourceI, 1);
|
|
561
|
+
records.unshift(targetI, 0), Array.prototype.splice.apply(this.records, records);
|
|
511
562
|
}
|
|
512
563
|
this.restoreTreeHierarchyState(), this.updatePagerData();
|
|
513
564
|
} else {
|
|
514
|
-
const records = this.
|
|
515
|
-
records.unshift(targetIndex, 0), Array.prototype.splice.apply(this.
|
|
565
|
+
const records = this.records.splice(sourceIndex, 1);
|
|
566
|
+
records.unshift(targetIndex, 0), Array.prototype.splice.apply(this.records, records);
|
|
516
567
|
}
|
|
517
568
|
}
|
|
518
569
|
restoreTreeHierarchyState() {
|
|
519
|
-
var _a;
|
|
570
|
+
var _a, _b;
|
|
520
571
|
if (this.hierarchyExpandLevel) {
|
|
521
572
|
for (let i = 0; i < this._sourceLength; i++) {
|
|
522
573
|
const nodeData = this.getOriginalRecord(i);
|
|
523
|
-
nodeData.children && !nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.collapse);
|
|
574
|
+
(null !== (_a = nodeData.filteredChildren) && void 0 !== _a ? _a : nodeData.children) && !nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.collapse);
|
|
524
575
|
}
|
|
525
576
|
this.currentIndexedData = Array.from({
|
|
526
577
|
length: this._sourceLength
|
|
527
578
|
}, ((_, i) => i));
|
|
528
579
|
let nodeLength = this._sourceLength;
|
|
529
580
|
for (let i = 0; i < nodeLength; i++) {
|
|
530
|
-
const indexKey = this.currentIndexedData[i], nodeData = this.getOriginalRecord(indexKey);
|
|
531
|
-
if ((null
|
|
581
|
+
const indexKey = this.currentIndexedData[i], nodeData = this.getOriginalRecord(indexKey), children = null !== (_b = nodeData.filteredChildren) && void 0 !== _b ? _b : nodeData.children;
|
|
582
|
+
if ((null == children ? void 0 : children.length) > 0 && nodeData.hierarchyState === HierarchyState.expand) {
|
|
532
583
|
this.hasHierarchyStateExpand = !0;
|
|
533
584
|
const childrenLength = this.restoreChildrenNodeHierarchy(indexKey, nodeData);
|
|
534
585
|
i += childrenLength, nodeLength += childrenLength;
|
|
@@ -539,10 +590,10 @@ export class DataSource extends EventTarget {
|
|
|
539
590
|
restoreChildrenNodeHierarchy(indexKey, nodeData) {
|
|
540
591
|
var _a, _b;
|
|
541
592
|
let childTotalLength = 0;
|
|
542
|
-
const
|
|
593
|
+
const children = null !== (_a = nodeData.filteredChildren) && void 0 !== _a ? _a : nodeData.children, nodeLength = null !== (_b = null == children ? void 0 : children.length) && void 0 !== _b ? _b : 0;
|
|
543
594
|
for (let j = 0; j < nodeLength; j++) {
|
|
544
595
|
nodeData.hierarchyState === HierarchyState.expand && (childTotalLength += 1);
|
|
545
|
-
const childNodeData =
|
|
596
|
+
const childNodeData = children[j], childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [ indexKey, j ];
|
|
546
597
|
nodeData.hierarchyState === HierarchyState.expand && this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childTotalLength, 0, childIndexKey),
|
|
547
598
|
childTotalLength += this.restoreChildrenNodeHierarchy(childIndexKey, childNodeData);
|
|
548
599
|
}
|
|
@@ -550,8 +601,21 @@ export class DataSource extends EventTarget {
|
|
|
550
601
|
}
|
|
551
602
|
}
|
|
552
603
|
|
|
604
|
+
function getValueFromDeepArray(array, index) {
|
|
605
|
+
var _a;
|
|
606
|
+
let result = array;
|
|
607
|
+
for (let i = 0; i < index.length; i++) {
|
|
608
|
+
const currentIdx = index[i];
|
|
609
|
+
if (!result[currentIdx]) return;
|
|
610
|
+
result = result[currentIdx];
|
|
611
|
+
const children = null !== (_a = result.filteredChildren) && void 0 !== _a ? _a : null == result ? void 0 : result.children;
|
|
612
|
+
children && i + 1 < index.length && (result = children);
|
|
613
|
+
}
|
|
614
|
+
return result;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
//# sourceMappingURL=DataSource.js.map
|
|
553
618
|
DataSource.EMPTY = new DataSource({
|
|
554
619
|
get() {},
|
|
555
620
|
length: 0
|
|
556
|
-
});
|
|
557
|
-
//# sourceMappingURL=DataSource.js.map
|
|
621
|
+
});
|