@visactor/vtable 1.22.11-alpha.6 → 1.22.11-alpha.7
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 +34 -7
- package/cjs/ListTable.js +134 -14
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +0 -3
- package/cjs/PivotChart.js +5 -12
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/body-helper/style.js +1 -2
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.js +2 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/index.d.ts +1 -0
- package/cjs/core/index.js +30 -0
- package/cjs/core/index.js.map +1 -0
- package/cjs/core/record-helper.d.ts +4 -2
- package/cjs/core/record-helper.js +120 -47
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +10 -4
- package/cjs/data/DataSource.js +155 -56
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/DataStatistics.js +1 -2
- package/cjs/dataset/dataset-pivot-table.js +2 -1
- package/cjs/event/event.d.ts +2 -1
- package/cjs/event/event.js +20 -9
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/table-group.js +6 -10
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/header-helper/style.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/index.js +2 -1
- package/cjs/layout/pivot-header-layout.d.ts +0 -6
- package/cjs/layout/pivot-header-layout.js +20 -39
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.d.ts +5 -0
- package/cjs/plugins/custom-cell-style.js +10 -1
- package/cjs/plugins/custom-cell-style.js.map +1 -1
- package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +2 -14
- package/cjs/scenegraph/graphic/active-cell-chart-list.js +75 -195
- package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +1 -9
- package/cjs/scenegraph/graphic/chart.js +20 -48
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +4 -3
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +1 -2
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -2
- package/cjs/scenegraph/scenegraph.js +12 -41
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/tools/util.d.ts +0 -5
- package/cjs/tools/util.js +4 -22
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +15 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +33 -13
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +862 -681
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +34 -7
- package/es/ListTable.js +130 -14
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +0 -3
- package/es/PivotChart.js +4 -13
- package/es/PivotChart.js.map +1 -1
- package/es/body-helper/style.js +1 -2
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.js +2 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/es/core/TABLE_EVENT_TYPE.js +1 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/index.d.ts +1 -0
- package/es/core/index.js +2 -0
- package/es/core/index.js.map +1 -0
- package/es/core/record-helper.d.ts +4 -2
- package/es/core/record-helper.js +114 -43
- package/es/core/record-helper.js.map +1 -1
- package/es/data/DataSource.d.ts +10 -4
- package/es/data/DataSource.js +155 -56
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/DataStatistics.js +1 -2
- package/es/dataset/dataset-pivot-table.js +2 -1
- package/es/event/event.d.ts +2 -1
- package/es/event/event.js +20 -9
- package/es/event/event.js.map +1 -1
- package/es/event/listener/table-group.js +6 -9
- package/es/event/listener/table-group.js.map +1 -1
- package/es/header-helper/style.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/index.js +2 -1
- package/es/layout/pivot-header-layout.d.ts +0 -6
- package/es/layout/pivot-header-layout.js +20 -39
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.d.ts +5 -0
- package/es/plugins/custom-cell-style.js +10 -1
- package/es/plugins/custom-cell-style.js.map +1 -1
- package/es/scenegraph/graphic/active-cell-chart-list.d.ts +2 -14
- package/es/scenegraph/graphic/active-cell-chart-list.js +68 -183
- package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +1 -9
- package/es/scenegraph/graphic/chart.js +19 -47
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +4 -3
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +1 -2
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -2
- package/es/scenegraph/scenegraph.js +11 -41
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/tools/util.d.ts +0 -5
- package/es/tools/util.js +0 -18
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +2 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +15 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +33 -13
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
package/cjs/data/DataSource.js
CHANGED
|
@@ -349,6 +349,23 @@ class DataSource extends EventTarget_1.EventTarget {
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
+
changeFieldValueByRecordIndex(value, recordIndex, field, table) {
|
|
353
|
+
var _a, _b, _c, _d;
|
|
354
|
+
if (null === field) return;
|
|
355
|
+
if (null == recordIndex) return;
|
|
356
|
+
const rawKey = recordIndex.toString();
|
|
357
|
+
if (!this.beforeChangedRecordsMap.has(rawKey)) {
|
|
358
|
+
const rawRecords = Array.isArray(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) ? this.dataSourceObj.records : null, originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
|
|
359
|
+
this.beforeChangedRecordsMap.set(rawKey, null !== (_b = (0, vutils_1.cloneDeep)(originRecord, void 0, [ "vtable_gantt_linkedFrom", "vtable_gantt_linkedTo" ])) && void 0 !== _b ? _b : {});
|
|
360
|
+
}
|
|
361
|
+
if ("string" == typeof field || "number" == typeof field) {
|
|
362
|
+
const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field], rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null, record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
|
|
363
|
+
let formatValue = value;
|
|
364
|
+
"number" == typeof beforeChangedValue && (0, util_1.isAllDigits)(value) && (formatValue = parseFloat(value)),
|
|
365
|
+
record ? record[field] = formatValue : rawRecords && "number" == typeof recordIndex && (rawRecords[recordIndex] = "Array" === this.addRecordRule ? [] : {},
|
|
366
|
+
rawRecords[recordIndex][field] = formatValue);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
352
369
|
cacheBeforeChangedRecord(dataIndex, table) {
|
|
353
370
|
var _a;
|
|
354
371
|
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
@@ -365,38 +382,82 @@ class DataSource extends EventTarget_1.EventTarget {
|
|
|
365
382
|
Array.isArray(indexed) || this.records.splice(indexed, 1, record);
|
|
366
383
|
}
|
|
367
384
|
}
|
|
368
|
-
|
|
385
|
+
_getRawRecordsArray() {
|
|
369
386
|
var _a;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
const rawRecords = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records;
|
|
388
|
+
return Array.isArray(rawRecords) ? rawRecords : null;
|
|
389
|
+
}
|
|
390
|
+
_hasFilterInEffect() {
|
|
391
|
+
var _a, _b, _c, _d, _e;
|
|
392
|
+
return (null !== (_c = null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) >= 1 || (null !== (_e = null === (_d = this.lastFilterRules) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0) >= 1;
|
|
393
|
+
}
|
|
394
|
+
_normalizeInsertIndex(index, length) {
|
|
395
|
+
return null == index || index > length ? length : index < 0 ? 0 : index;
|
|
396
|
+
}
|
|
397
|
+
_mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
|
|
398
|
+
if (viewIndex >= this.records.length) return rawRecords.length;
|
|
399
|
+
if (viewIndex <= 0) return 0;
|
|
400
|
+
const prevRecord = this.records[viewIndex - 1], rawIndex = rawRecords.indexOf(prevRecord);
|
|
401
|
+
return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
|
|
402
|
+
}
|
|
403
|
+
_resetIndexingFromViewRecords() {
|
|
404
|
+
if (this._sourceLength = this.records.length, this.currentIndexedData = Array.from({
|
|
405
|
+
length: this._sourceLength
|
|
406
|
+
}, ((_, i) => i)), "tree" === this.rowHierarchyType && this.initTreeHierarchyState(),
|
|
407
|
+
this.userPagination) return this.pagination.totalCount = this._sourceLength, void this.updatePagerData();
|
|
408
|
+
this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
409
|
+
this.updatePagerData();
|
|
410
|
+
}
|
|
411
|
+
addRecord(record, index, syncToOriginalRecords = !1) {
|
|
412
|
+
var _a, _b, _c;
|
|
413
|
+
if (!syncToOriginalRecords) {
|
|
414
|
+
if (Array.isArray(this.records)) {
|
|
415
|
+
this.records.splice(index, 0, record), this.adjustBeforeChangedRecordsMap(index, 1),
|
|
416
|
+
this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1;
|
|
417
|
+
for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].push(record);
|
|
418
|
+
if ("tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) {
|
|
419
|
+
this.pagination.totalCount = this._sourceLength;
|
|
420
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
421
|
+
index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
|
|
422
|
+
} else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
423
|
+
this.updatePagerData();
|
|
424
|
+
(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, 1);
|
|
391
425
|
}
|
|
392
|
-
|
|
393
|
-
this.pagination.totalCount = this._sourceLength;
|
|
394
|
-
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
395
|
-
index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
|
|
396
|
-
} else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
397
|
-
this.updatePagerData();
|
|
398
|
-
(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
|
|
426
|
+
return;
|
|
399
427
|
}
|
|
428
|
+
const rawRecords = this._getRawRecordsArray();
|
|
429
|
+
if (!rawRecords) return;
|
|
430
|
+
const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length), rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
|
|
431
|
+
rawRecords.splice(rawInsertIndex, 0, record), this.beforeChangedRecordsMap.clear(),
|
|
432
|
+
this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules),
|
|
433
|
+
(null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.added) && this.dataSourceObj.added(rawInsertIndex, 1);
|
|
434
|
+
}
|
|
435
|
+
addRecords(recordArr, index, syncToOriginalRecords = !1) {
|
|
436
|
+
var _a, _b, _c;
|
|
437
|
+
if (!syncToOriginalRecords) {
|
|
438
|
+
if (Array.isArray(this.records)) {
|
|
439
|
+
if (Array.isArray(recordArr)) {
|
|
440
|
+
this.records.splice(index, 0, ...recordArr), this.adjustBeforeChangedRecordsMap(index, recordArr.length);
|
|
441
|
+
for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
|
|
442
|
+
this._sourceLength += recordArr.length;
|
|
443
|
+
for (let i = 0; i < this.fieldAggregators.length; i++) for (let j = 0; j < recordArr.length; j++) this.fieldAggregators[i].push(recordArr[j]);
|
|
444
|
+
}
|
|
445
|
+
if (this.userPagination) {
|
|
446
|
+
this.pagination.totalCount = this._sourceLength;
|
|
447
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
448
|
+
index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
|
|
449
|
+
} else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength,
|
|
450
|
+
this.updatePagerData();
|
|
451
|
+
(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
|
|
452
|
+
}
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
const rawRecords = this._getRawRecordsArray();
|
|
456
|
+
if (!rawRecords || !Array.isArray(recordArr) || 0 === recordArr.length) return;
|
|
457
|
+
const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length), rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
|
|
458
|
+
rawRecords.splice(rawInsertIndex, 0, ...recordArr), this.beforeChangedRecordsMap.clear(),
|
|
459
|
+
this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules),
|
|
460
|
+
(null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.added) && this.dataSourceObj.added(rawInsertIndex, recordArr.length);
|
|
400
461
|
}
|
|
401
462
|
addRecordForSorted(record) {
|
|
402
463
|
Array.isArray(this.records) && (this.beforeChangedRecordsMap.clear(), this.records.push(record),
|
|
@@ -415,28 +476,48 @@ class DataSource extends EventTarget_1.EventTarget {
|
|
|
415
476
|
}
|
|
416
477
|
}
|
|
417
478
|
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
479
|
+
const delta = "add" === type ? insertCount : -insertCount, numericKeys = [];
|
|
480
|
+
this.beforeChangedRecordsMap.forEach(((_, key) => {
|
|
481
|
+
const numKey = Number(key);
|
|
482
|
+
Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex && numericKeys.push(numKey);
|
|
483
|
+
})), numericKeys.sort(((a, b) => "add" === type ? b - a : a - b));
|
|
484
|
+
for (let i = 0; i < numericKeys.length; i++) {
|
|
485
|
+
const key = numericKeys[i], record = this.beforeChangedRecordsMap.get(key.toString());
|
|
486
|
+
this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
|
|
421
487
|
}
|
|
422
488
|
}
|
|
423
|
-
deleteRecords(recordIndexs) {
|
|
424
|
-
var _a;
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
489
|
+
deleteRecords(recordIndexs, syncToOriginalRecords = !1) {
|
|
490
|
+
var _a, _b, _c;
|
|
491
|
+
if (!syncToOriginalRecords) {
|
|
492
|
+
if (Array.isArray(this.records)) {
|
|
493
|
+
const realDeletedRecordIndexs = [], recordIndexsMaxToMin = recordIndexs.sort(((a, b) => b - a));
|
|
494
|
+
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
495
|
+
const recordIndex = recordIndexsMaxToMin[index];
|
|
496
|
+
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
497
|
+
this.adjustBeforeChangedRecordsMap(recordIndex, 1, "delete"), realDeletedRecordIndexs.push(recordIndex);
|
|
498
|
+
const deletedRecord = this.records[recordIndex];
|
|
499
|
+
for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].deleteRecord(deletedRecord);
|
|
500
|
+
this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1;
|
|
501
|
+
}
|
|
502
|
+
return this.userPagination || (this.pagination.perPageCount = this._sourceLength,
|
|
503
|
+
this.pagination.totalCount = this._sourceLength), this.updatePagerData(), (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.deleted) && this.dataSourceObj.deleted(realDeletedRecordIndexs),
|
|
504
|
+
realDeletedRecordIndexs;
|
|
434
505
|
}
|
|
435
|
-
return
|
|
436
|
-
|
|
437
|
-
|
|
506
|
+
return [];
|
|
507
|
+
}
|
|
508
|
+
const rawRecords = this._getRawRecordsArray();
|
|
509
|
+
if (!rawRecords || !Array.isArray(this.records)) return [];
|
|
510
|
+
const realDeletedRecordIndexs = [], recordIndexsMaxToMin = recordIndexs.slice().sort(((a, b) => b - a)), rawDeletedIndexs = [];
|
|
511
|
+
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
512
|
+
const viewIndex = recordIndexsMaxToMin[index];
|
|
513
|
+
if (viewIndex >= this.records.length || viewIndex < 0) continue;
|
|
514
|
+
const deletedRecord = this.records[viewIndex], rawIndex = rawRecords.indexOf(deletedRecord);
|
|
515
|
+
rawIndex >= 0 && (rawRecords.splice(rawIndex, 1), rawDeletedIndexs.push(rawIndex)),
|
|
516
|
+
realDeletedRecordIndexs.push(viewIndex);
|
|
438
517
|
}
|
|
439
|
-
return
|
|
518
|
+
return this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules),
|
|
519
|
+
(null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.deleted) && this.dataSourceObj.deleted(rawDeletedIndexs),
|
|
520
|
+
realDeletedRecordIndexs;
|
|
440
521
|
}
|
|
441
522
|
deleteRecordsForSorted(recordIndexs) {
|
|
442
523
|
if (Array.isArray(this.records)) {
|
|
@@ -451,20 +532,38 @@ class DataSource extends EventTarget_1.EventTarget {
|
|
|
451
532
|
this.pagination.totalCount = this._sourceLength), this.beforeChangedRecordsMap.clear();
|
|
452
533
|
}
|
|
453
534
|
}
|
|
454
|
-
updateRecords(records, recordIndexs) {
|
|
455
|
-
|
|
535
|
+
updateRecords(records, recordIndexs, syncToOriginalRecords = !1) {
|
|
536
|
+
var _a;
|
|
537
|
+
if (!syncToOriginalRecords) {
|
|
538
|
+
const realDeletedRecordIndexs = [];
|
|
539
|
+
for (let index = 0; index < recordIndexs.length; index++) {
|
|
540
|
+
const recordIndex = recordIndexs[index];
|
|
541
|
+
if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()),
|
|
542
|
+
realDeletedRecordIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce(((acc, key) => (void 0 === acc[key] && (acc[key] = {}),
|
|
543
|
+
acc[key].children)), this.records)[recordIndex[recordIndex.length - 1]] = records[index]; else {
|
|
544
|
+
if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
|
|
545
|
+
this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex);
|
|
546
|
+
for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
|
|
547
|
+
this.records[recordIndex] = records[index];
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return this.userPagination && this.updatePagerData(), realDeletedRecordIndexs;
|
|
551
|
+
}
|
|
552
|
+
const rawRecords = this._getRawRecordsArray();
|
|
553
|
+
if (!rawRecords || !Array.isArray(this.records)) return [];
|
|
554
|
+
const realUpdatedIndexs = [];
|
|
456
555
|
for (let index = 0; index < recordIndexs.length; index++) {
|
|
457
556
|
const recordIndex = recordIndexs[index];
|
|
458
557
|
if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()),
|
|
459
|
-
|
|
460
|
-
acc[key].children)),
|
|
461
|
-
if (recordIndex >= this.
|
|
462
|
-
this.
|
|
463
|
-
|
|
464
|
-
this.records[recordIndex] = records[index];
|
|
558
|
+
realUpdatedIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce(((acc, key) => (void 0 === acc[key] && (acc[key] = {}),
|
|
559
|
+
acc[key].children)), rawRecords)[recordIndex[recordIndex.length - 1]] = records[index]; else {
|
|
560
|
+
if (recordIndex >= this.records.length || recordIndex < 0) continue;
|
|
561
|
+
const oldRecord = this.records[recordIndex], rawIndex = rawRecords.indexOf(oldRecord);
|
|
562
|
+
rawIndex >= 0 && (rawRecords[rawIndex] = records[index]), realUpdatedIndexs.push(recordIndex);
|
|
465
563
|
}
|
|
466
564
|
}
|
|
467
|
-
return this.
|
|
565
|
+
return this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules),
|
|
566
|
+
realUpdatedIndexs;
|
|
468
567
|
}
|
|
469
568
|
updateRecordsForSorted(records, recordIndexs) {
|
|
470
569
|
const realDeletedRecordIndexs = [];
|