@visactor/vtable 1.15.1-alpha.1 → 1.15.2-alpha.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 +6 -8
- package/cjs/ListTable.js.map +1 -1
- package/cjs/components/empty-tip/empty-tip.d.ts +6 -0
- package/cjs/components/empty-tip/empty-tip.js +11 -2
- package/cjs/components/empty-tip/empty-tip.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +3 -2
- package/cjs/core/BaseTable.js +42 -10
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.d.ts +3 -3
- package/cjs/core/record-helper.js +24 -16
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js +5 -5
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/core/utils/get-cell-position.d.ts +2 -12
- package/cjs/core/utils/get-cell-position.js +6 -8
- package/cjs/core/utils/get-cell-position.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +13 -5
- package/cjs/data/CachedDataSource.js +106 -15
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.d.ts +16 -8
- package/cjs/data/DataSource.js +71 -33
- package/cjs/data/DataSource.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/simple-header-layout.js +1 -1
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +2 -2
- package/cjs/scenegraph/group-creater/column-helper.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-row-height.js +7 -13
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.js +1 -1
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/state/checkbox/checkbox.js +1 -1
- package/cjs/state/checkbox/checkbox.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +3 -2
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +406 -120
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +3 -3
- package/es/ListTable.js +7 -8
- package/es/ListTable.js.map +1 -1
- package/es/components/empty-tip/empty-tip.d.ts +6 -0
- package/es/components/empty-tip/empty-tip.js +11 -2
- package/es/components/empty-tip/empty-tip.js.map +1 -1
- package/es/core/BaseTable.d.ts +3 -2
- package/es/core/BaseTable.js +42 -10
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.d.ts +3 -3
- package/es/core/record-helper.js +24 -16
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js +5 -5
- package/es/core/tableHelper.js.map +1 -1
- package/es/core/utils/get-cell-position.d.ts +2 -12
- package/es/core/utils/get-cell-position.js +6 -8
- package/es/core/utils/get-cell-position.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +13 -5
- package/es/data/CachedDataSource.js +106 -17
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.d.ts +16 -8
- package/es/data/DataSource.js +75 -37
- package/es/data/DataSource.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/simple-header-layout.js +1 -1
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -2
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +2 -2
- package/es/scenegraph/group-creater/column-helper.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-row-height.js +7 -13
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/stick-text/index.js +1 -1
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/state/checkbox/checkbox.js +1 -1
- package/es/state/checkbox/checkbox.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +3 -2
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
package/es/data/DataSource.js
CHANGED
|
@@ -8,7 +8,7 @@ import { EventTarget } from "../event/EventTarget";
|
|
|
8
8
|
|
|
9
9
|
import { getValueByPath, isAllDigits } from "../tools/util";
|
|
10
10
|
|
|
11
|
-
import { arrayEqual, cloneDeep, isValid } from "@visactor/vutils";
|
|
11
|
+
import { arrayEqual, cloneDeep, isNumber, isValid } from "@visactor/vutils";
|
|
12
12
|
|
|
13
13
|
import { RecordAggregator, SumAggregator, CountAggregator, MaxAggregator, MinAggregator, AvgAggregator, NoneAggregator, CustomAggregator } from "../ts-types/dataset/aggregation";
|
|
14
14
|
|
|
@@ -25,7 +25,7 @@ const EVENT_TYPE = {
|
|
|
25
25
|
CHANGE_ORDER: "change_order"
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
function getValue(value, promiseCallBack) {
|
|
28
|
+
export function getValue(value, promiseCallBack) {
|
|
29
29
|
const maybePromiseOrValue = getOrApply(value);
|
|
30
30
|
if (isPromise(maybePromiseOrValue)) {
|
|
31
31
|
const promiseValue = maybePromiseOrValue.then((r => (promiseCallBack(r), r)));
|
|
@@ -67,7 +67,7 @@ export class DataSource extends EventTarget {
|
|
|
67
67
|
constructor(dataSourceObj, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
|
|
68
68
|
var _a;
|
|
69
69
|
super(), this.currentIndexedData = [], this.hierarchyExpandLevel = 0, this.hasHierarchyStateExpand = !1,
|
|
70
|
-
this.beforeChangedRecordsMap =
|
|
70
|
+
this.beforeChangedRecordsMap = new Map, this.registedAggregators = {}, this.fieldAggregators = [],
|
|
71
71
|
this.registerAggregators(), this.dataSourceObj = dataSourceObj, this.dataConfig = dataConfig,
|
|
72
72
|
this._get = null == dataSourceObj ? void 0 : dataSourceObj.get, this.columns = columns,
|
|
73
73
|
this._source = (null == dataSourceObj ? void 0 : dataSourceObj.records) ? this.processRecords(null == dataSourceObj ? void 0 : dataSourceObj.records) : dataSourceObj,
|
|
@@ -99,6 +99,20 @@ export class DataSource extends EventTarget {
|
|
|
99
99
|
} else !0 === nodeData.children && !nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.collapse);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
supplementConfig(pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
|
|
103
|
+
var _a;
|
|
104
|
+
this.columns = columns, this._sourceLength = (null === (_a = this._source) || void 0 === _a ? void 0 : _a.length) || 0,
|
|
105
|
+
this.sortedIndexMap = new Map, this._currentPagerIndexedData = [], this.userPagination = pagination,
|
|
106
|
+
this.pagination = pagination || {
|
|
107
|
+
totalCount: this._sourceLength,
|
|
108
|
+
perPageCount: this._sourceLength,
|
|
109
|
+
currentPage: 0
|
|
110
|
+
}, hierarchyExpandLevel >= 1 && (this.hierarchyExpandLevel = hierarchyExpandLevel),
|
|
111
|
+
this.currentIndexedData = Array.from({
|
|
112
|
+
length: this._sourceLength
|
|
113
|
+
}, ((_, i) => i)), "tree" === rowHierarchyType && this.initTreeHierarchyState(),
|
|
114
|
+
this.rowHierarchyType = rowHierarchyType, this.updatePagerData();
|
|
115
|
+
}
|
|
102
116
|
registerAggregator(type, aggregator) {
|
|
103
117
|
this.registedAggregators[type] = aggregator;
|
|
104
118
|
}
|
|
@@ -200,6 +214,9 @@ export class DataSource extends EventTarget {
|
|
|
200
214
|
firstLevelIndex >= startIndex && firstLevelIndex < endIndex) this._currentPagerIndexedData.push(currentIndexedData[i]); else if (firstLevelIndex >= endIndex) break;
|
|
201
215
|
} else if (this._sourceLength > 0) throw new Error("currentIndexedData should has values!");
|
|
202
216
|
}
|
|
217
|
+
getRecordIndexPaths(bodyShowIndex) {
|
|
218
|
+
return this._currentPagerIndexedData[bodyShowIndex];
|
|
219
|
+
}
|
|
203
220
|
get records() {
|
|
204
221
|
return Array.isArray(this._source) ? this._source : [];
|
|
205
222
|
}
|
|
@@ -230,7 +247,11 @@ export class DataSource extends EventTarget {
|
|
|
230
247
|
getHierarchyState(index) {
|
|
231
248
|
var _a;
|
|
232
249
|
const record = this.getOriginalRecord(this.currentPagerIndexedData[index]);
|
|
233
|
-
|
|
250
|
+
if (null == record ? void 0 : record.hierarchyState) {
|
|
251
|
+
const hierarchyState = record.hierarchyState;
|
|
252
|
+
if ((null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) > 0 || !0 === record.children) return hierarchyState;
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
234
255
|
}
|
|
235
256
|
toggleHierarchyState(index, bodyStartIndex, bodyEndIndex) {
|
|
236
257
|
const oldIndexedData = this.currentIndexedData.slice(0), indexed = this.getIndexKey(index), state = this.getHierarchyState(index), data = this.getOriginalRecord(indexed);
|
|
@@ -292,12 +313,8 @@ export class DataSource extends EventTarget {
|
|
|
292
313
|
var _a;
|
|
293
314
|
if (null !== field && index >= 0) {
|
|
294
315
|
const dataIndex = this.getIndexKey(index);
|
|
295
|
-
if (
|
|
296
|
-
const
|
|
297
|
-
this.beforeChangedRecordsMap[dataIndex] = null !== (_a = cloneDeep(originRecord, void 0, [ "vtable_gantt_linkedFrom", "vtable_gantt_linkedTo" ])) && void 0 !== _a ? _a : {};
|
|
298
|
-
}
|
|
299
|
-
if ("string" == typeof field || "number" == typeof field) {
|
|
300
|
-
const beforeChangedValue = this.beforeChangedRecordsMap[dataIndex][field], record = this.getOriginalRecord(dataIndex);
|
|
316
|
+
if (this.cacheBeforeChangedRecord(dataIndex, table), "string" == typeof field || "number" == typeof field) {
|
|
317
|
+
const beforeChangedValue = null === (_a = this.beforeChangedRecordsMap.get(dataIndex.toString())) || void 0 === _a ? void 0 : _a[field], record = this.getOriginalRecord(dataIndex);
|
|
301
318
|
let formatValue = value;
|
|
302
319
|
"number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)),
|
|
303
320
|
isPromise(record) ? record.then((record => {
|
|
@@ -307,6 +324,13 @@ export class DataSource extends EventTarget {
|
|
|
307
324
|
}
|
|
308
325
|
}
|
|
309
326
|
}
|
|
327
|
+
cacheBeforeChangedRecord(dataIndex, table) {
|
|
328
|
+
var _a;
|
|
329
|
+
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
330
|
+
const originRecord = this.getOriginalRecord(dataIndex);
|
|
331
|
+
this.beforeChangedRecordsMap.set(dataIndex.toString(), null !== (_a = cloneDeep(originRecord, void 0, [ "vtable_gantt_linkedFrom", "vtable_gantt_linkedTo" ])) && void 0 !== _a ? _a : {});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
310
334
|
setRecord(record, index) {
|
|
311
335
|
var _a, _b;
|
|
312
336
|
let isAdd = !0;
|
|
@@ -350,14 +374,14 @@ export class DataSource extends EventTarget {
|
|
|
350
374
|
}
|
|
351
375
|
}
|
|
352
376
|
addRecordForSorted(record) {
|
|
353
|
-
Array.isArray(this.records) && (this.beforeChangedRecordsMap
|
|
377
|
+
Array.isArray(this.records) && (this.beforeChangedRecordsMap.clear(), this.records.push(record),
|
|
354
378
|
this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1,
|
|
355
379
|
this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
356
380
|
this.pagination.totalCount = this._sourceLength));
|
|
357
381
|
}
|
|
358
382
|
addRecordsForSorted(recordArr) {
|
|
359
383
|
if (Array.isArray(this.records)) {
|
|
360
|
-
if (this.beforeChangedRecordsMap
|
|
384
|
+
if (this.beforeChangedRecordsMap.clear(), Array.isArray(recordArr)) {
|
|
361
385
|
this.records.push(...recordArr);
|
|
362
386
|
for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
|
|
363
387
|
this._sourceLength += recordArr.length, this.sortedIndexMap.clear();
|
|
@@ -365,10 +389,10 @@ export class DataSource extends EventTarget {
|
|
|
365
389
|
this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength);
|
|
366
390
|
}
|
|
367
391
|
}
|
|
368
|
-
adjustBeforeChangedRecordsMap(insertIndex, insertCount) {
|
|
369
|
-
for (let key = this.beforeChangedRecordsMap.
|
|
370
|
-
const record = this.beforeChangedRecordsMap
|
|
371
|
-
|
|
392
|
+
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
|
|
393
|
+
for (let key = this.beforeChangedRecordsMap.size - 1; key >= insertIndex; key--) {
|
|
394
|
+
const record = this.beforeChangedRecordsMap.get(key.toString());
|
|
395
|
+
this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + ("add" === type ? insertCount : -insertCount)).toString(), record);
|
|
372
396
|
}
|
|
373
397
|
}
|
|
374
398
|
deleteRecords(recordIndexs) {
|
|
@@ -378,7 +402,7 @@ export class DataSource extends EventTarget {
|
|
|
378
402
|
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
379
403
|
const recordIndex = recordIndexsMaxToMin[index];
|
|
380
404
|
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
381
|
-
|
|
405
|
+
this.adjustBeforeChangedRecordsMap(recordIndex, 1, "delete"), realDeletedRecordIndexs.push(recordIndex);
|
|
382
406
|
const deletedRecord = this.records[recordIndex];
|
|
383
407
|
for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].deleteRecord(deletedRecord);
|
|
384
408
|
this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1;
|
|
@@ -396,22 +420,21 @@ export class DataSource extends EventTarget {
|
|
|
396
420
|
const recordIndex = recordIndexsMaxToMin[index];
|
|
397
421
|
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
398
422
|
const rawIndex = this.currentIndexedData[recordIndex];
|
|
399
|
-
|
|
400
|
-
this._sourceLength -= 1;
|
|
423
|
+
this.records.splice(rawIndex, 1), this._sourceLength -= 1;
|
|
401
424
|
}
|
|
402
425
|
this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
403
|
-
this.pagination.totalCount = this._sourceLength);
|
|
426
|
+
this.pagination.totalCount = this._sourceLength), this.beforeChangedRecordsMap.clear();
|
|
404
427
|
}
|
|
405
428
|
}
|
|
406
429
|
updateRecords(records, recordIndexs) {
|
|
407
430
|
const realDeletedRecordIndexs = [];
|
|
408
431
|
for (let index = 0; index < recordIndexs.length; index++) {
|
|
409
432
|
const recordIndex = recordIndexs[index];
|
|
410
|
-
if (Array.isArray(recordIndex))
|
|
433
|
+
if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()),
|
|
411
434
|
realDeletedRecordIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce(((acc, key) => (void 0 === acc[key] && (acc[key] = {}),
|
|
412
435
|
acc[key].children)), this.records)[recordIndex[recordIndex.length - 1]] = records[index]; else {
|
|
413
436
|
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
414
|
-
|
|
437
|
+
this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex);
|
|
415
438
|
for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
|
|
416
439
|
this.records[recordIndex] = records[index];
|
|
417
440
|
}
|
|
@@ -425,7 +448,7 @@ export class DataSource extends EventTarget {
|
|
|
425
448
|
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
426
449
|
const rawIndex = this.currentIndexedData[recordIndex];
|
|
427
450
|
if ("number" != typeof rawIndex) return;
|
|
428
|
-
|
|
451
|
+
this.beforeChangedRecordsMap.delete(rawIndex.toString()), realDeletedRecordIndexs.push(recordIndex),
|
|
429
452
|
this.records[rawIndex] = records[index];
|
|
430
453
|
}
|
|
431
454
|
this.sortedIndexMap.clear();
|
|
@@ -477,7 +500,7 @@ export class DataSource extends EventTarget {
|
|
|
477
500
|
clearFilteredChildren(record) {
|
|
478
501
|
var _a, _b;
|
|
479
502
|
record.filteredChildren = void 0;
|
|
480
|
-
for (let i = 0; null !== (_b =
|
|
503
|
+
for (let i = 0; i < (null !== (_b = null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0); i++) this.clearFilteredChildren(record.children[i]);
|
|
481
504
|
}
|
|
482
505
|
filterRecord(record) {
|
|
483
506
|
var _a, _b, _c;
|
|
@@ -562,8 +585,8 @@ export class DataSource extends EventTarget {
|
|
|
562
585
|
}));
|
|
563
586
|
}
|
|
564
587
|
getRawRecord(dataIndex) {
|
|
565
|
-
var _a;
|
|
566
|
-
if (null === (_a = this.beforeChangedRecordsMap) || void 0 === _a ? void 0 : _a
|
|
588
|
+
var _a, _b;
|
|
589
|
+
if (null === (_a = this.beforeChangedRecordsMap) || void 0 === _a ? void 0 : _a.has(dataIndex.toString())) return null === (_b = this.beforeChangedRecordsMap) || void 0 === _b ? void 0 : _b.get(dataIndex.toString());
|
|
567
590
|
let data;
|
|
568
591
|
return data = this.dataSourceObj.records ? Array.isArray(dataIndex) ? getValueFromDeepArray(this.records, dataIndex) : this.records[dataIndex] : this._get(dataIndex),
|
|
569
592
|
getValue(data, (val => {
|
|
@@ -590,7 +613,9 @@ export class DataSource extends EventTarget {
|
|
|
590
613
|
}
|
|
591
614
|
fieldPromiseCallBack(_index, _field, _value) {}
|
|
592
615
|
recordPromiseCallBack(_index, _record) {}
|
|
593
|
-
|
|
616
|
+
canChangeOrder(sourceIndex, targetIndex) {
|
|
617
|
+
var _a;
|
|
618
|
+
if (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.canChangeOrder) return this.dataSourceObj.canChangeOrder(sourceIndex, targetIndex);
|
|
594
619
|
if (this.hasHierarchyStateExpand) {
|
|
595
620
|
let sourceIndexs = this.currentPagerIndexedData[sourceIndex], targetIndexs = this.currentPagerIndexedData[targetIndex];
|
|
596
621
|
if (sourceIndexs = Array.isArray(sourceIndexs) ? [ ...sourceIndexs ] : [ sourceIndexs ],
|
|
@@ -608,9 +633,9 @@ export class DataSource extends EventTarget {
|
|
|
608
633
|
}
|
|
609
634
|
return !0;
|
|
610
635
|
}
|
|
611
|
-
|
|
612
|
-
var _a, _b;
|
|
613
|
-
if (
|
|
636
|
+
changeOrder(sourceIndex, targetIndex) {
|
|
637
|
+
var _a, _b, _c;
|
|
638
|
+
if (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.changeOrder) this.dataSourceObj.changeOrder(sourceIndex, targetIndex); else if (!(null === (_b = this.lastSortStates) || void 0 === _b ? void 0 : _b.some((state => "asc" === state.order || "desc" === state.order))) && this.canChangeOrder(sourceIndex, targetIndex)) if (this.hasHierarchyStateExpand) {
|
|
614
639
|
let sourceI, targetI, sourceIndexs = this.currentPagerIndexedData[sourceIndex], targetIndexs = this.currentPagerIndexedData[targetIndex];
|
|
615
640
|
if (sourceIndexs = Array.isArray(sourceIndexs) ? [ ...sourceIndexs ] : [ sourceIndexs ],
|
|
616
641
|
targetIndexs = Array.isArray(targetIndexs) ? [ ...targetIndexs ] : [ targetIndexs ],
|
|
@@ -623,7 +648,7 @@ export class DataSource extends EventTarget {
|
|
|
623
648
|
if (sourceI = sourceIndexs.splice(sourceIndexs.length - 1, 1)[0], targetI = targetIndexs.splice(targetIndexs.length - 1, 1)[0],
|
|
624
649
|
sourceIndexs.length >= 1) {
|
|
625
650
|
const parent = this.getOriginalRecord(sourceIndexs), sourceIds = parent.filteredChildren ? parent.filteredChildren.splice(sourceI, 1) : parent.children.splice(sourceI, 1);
|
|
626
|
-
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(null !== (
|
|
651
|
+
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(null !== (_c = parent.filteredChildren) && void 0 !== _c ? _c : parent.children, sourceIds);
|
|
627
652
|
} else {
|
|
628
653
|
const sourceIds = this.records.splice(sourceI, 1);
|
|
629
654
|
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(this.records, sourceIds);
|
|
@@ -674,7 +699,12 @@ export class DataSource extends EventTarget {
|
|
|
674
699
|
}
|
|
675
700
|
}
|
|
676
701
|
|
|
677
|
-
|
|
702
|
+
DataSource.EMPTY = new DataSource({
|
|
703
|
+
get() {},
|
|
704
|
+
length: 0
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
export function getValueFromDeepArray(array, index) {
|
|
678
708
|
var _a;
|
|
679
709
|
let result = array;
|
|
680
710
|
for (let i = 0; i < index.length; i++) {
|
|
@@ -687,8 +717,16 @@ function getValueFromDeepArray(array, index) {
|
|
|
687
717
|
return result;
|
|
688
718
|
}
|
|
689
719
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
720
|
+
export function sortRecordIndexs(recordIndexs, sort) {
|
|
721
|
+
return recordIndexs.sort(((a, b) => {
|
|
722
|
+
var _a, _b;
|
|
723
|
+
isNumber(a) && (a = [ a ]), isNumber(b) && (b = [ b ]);
|
|
724
|
+
const length = Math.max(a.length, b.length);
|
|
725
|
+
for (let i = 0; i < length; i++) {
|
|
726
|
+
const aa = null !== (_a = a[i]) && void 0 !== _a ? _a : -1, bb = null !== (_b = b[i]) && void 0 !== _b ? _b : -1;
|
|
727
|
+
if (aa !== bb) return 1 === sort ? aa - bb : bb - aa;
|
|
728
|
+
}
|
|
729
|
+
return 0;
|
|
730
|
+
}));
|
|
731
|
+
}
|
|
732
|
+
//# sourceMappingURL=DataSource.js.map
|