@visactor/vtable-sheet 1.23.1-alpha.2 → 1.23.2

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.
Files changed (75) hide show
  1. package/cjs/components/sheet-tab-event-handler.js +3 -2
  2. package/cjs/components/sheet-tab-event-handler.js.map +1 -1
  3. package/cjs/components/vtable-sheet.d.ts +4 -1
  4. package/cjs/components/vtable-sheet.js +115 -17
  5. package/cjs/components/vtable-sheet.js.map +1 -1
  6. package/cjs/core/WorkSheet.d.ts +3 -1
  7. package/cjs/core/WorkSheet.js +45 -21
  8. package/cjs/core/WorkSheet.js.map +1 -1
  9. package/cjs/core/table-plugins.d.ts +5 -0
  10. package/cjs/core/table-plugins.js +10 -9
  11. package/cjs/core/table-plugins.js.map +1 -1
  12. package/cjs/event/table-event-relay.js +1 -0
  13. package/cjs/event/table-event-relay.js.map +1 -1
  14. package/cjs/formula/formula-engine.js +0 -1
  15. package/cjs/formula/formula-engine.js.map +1 -1
  16. package/cjs/index.d.ts +3 -3
  17. package/cjs/index.js +1 -1
  18. package/cjs/index.js.map +1 -1
  19. package/cjs/managers/formula-manager.d.ts +3 -1
  20. package/cjs/managers/formula-manager.js +39 -15
  21. package/cjs/managers/formula-manager.js.map +1 -1
  22. package/cjs/managers/menu-manager.d.ts +2 -0
  23. package/cjs/managers/menu-manager.js +3 -0
  24. package/cjs/managers/menu-manager.js.map +1 -1
  25. package/cjs/managers/sheet-manager.d.ts +1 -0
  26. package/cjs/managers/sheet-manager.js +7 -0
  27. package/cjs/managers/sheet-manager.js.map +1 -1
  28. package/cjs/managers/tab-drag-manager.d.ts +2 -2
  29. package/cjs/managers/tab-drag-manager.js.map +1 -1
  30. package/cjs/sheet-helper.d.ts +2 -0
  31. package/cjs/sheet-helper.js +15 -3
  32. package/cjs/sheet-helper.js.map +1 -1
  33. package/cjs/ts-types/index.d.ts +2 -1
  34. package/cjs/ts-types/index.js.map +1 -1
  35. package/cjs/ts-types/sheet.d.ts +12 -7
  36. package/cjs/ts-types/sheet.js.map +1 -1
  37. package/dist/vtable-sheet.js +867 -225
  38. package/dist/vtable-sheet.min.js +1 -1
  39. package/es/components/sheet-tab-event-handler.js +3 -2
  40. package/es/components/sheet-tab-event-handler.js.map +1 -1
  41. package/es/components/vtable-sheet.d.ts +4 -1
  42. package/es/components/vtable-sheet.js +117 -16
  43. package/es/components/vtable-sheet.js.map +1 -1
  44. package/es/core/WorkSheet.d.ts +3 -1
  45. package/es/core/WorkSheet.js +44 -21
  46. package/es/core/WorkSheet.js.map +1 -1
  47. package/es/core/table-plugins.d.ts +5 -0
  48. package/es/core/table-plugins.js +8 -7
  49. package/es/core/table-plugins.js.map +1 -1
  50. package/es/event/table-event-relay.js +1 -0
  51. package/es/event/table-event-relay.js.map +1 -1
  52. package/es/formula/formula-engine.js +0 -1
  53. package/es/formula/formula-engine.js.map +1 -1
  54. package/es/index.d.ts +3 -3
  55. package/es/index.js +1 -1
  56. package/es/index.js.map +1 -1
  57. package/es/managers/formula-manager.d.ts +3 -1
  58. package/es/managers/formula-manager.js +39 -15
  59. package/es/managers/formula-manager.js.map +1 -1
  60. package/es/managers/menu-manager.d.ts +2 -0
  61. package/es/managers/menu-manager.js +3 -0
  62. package/es/managers/menu-manager.js.map +1 -1
  63. package/es/managers/sheet-manager.d.ts +1 -0
  64. package/es/managers/sheet-manager.js +7 -0
  65. package/es/managers/sheet-manager.js.map +1 -1
  66. package/es/managers/tab-drag-manager.d.ts +2 -2
  67. package/es/managers/tab-drag-manager.js.map +1 -1
  68. package/es/sheet-helper.d.ts +2 -0
  69. package/es/sheet-helper.js +11 -0
  70. package/es/sheet-helper.js.map +1 -1
  71. package/es/ts-types/index.d.ts +2 -1
  72. package/es/ts-types/index.js.map +1 -1
  73. package/es/ts-types/sheet.d.ts +12 -7
  74. package/es/ts-types/sheet.js.map +1 -1
  75. package/package.json +8 -7
@@ -1439,9 +1439,6 @@
1439
1439
  if (sheetId === undefined) {
1440
1440
  return;
1441
1441
  }
1442
- if (this.sheets.size <= 1) {
1443
- throw new Error('Cannot remove the last sheet');
1444
- }
1445
1442
  this.sheetData.delete(sheetId);
1446
1443
  this.sheets.delete(sheetKey);
1447
1444
  this.reverseSheets.delete(sheetId);
@@ -2523,6 +2520,34 @@
2523
2520
  }
2524
2521
  return r;
2525
2522
  }
2523
+ function pluginIsChanged(prevPlugins, newPlugins) {
2524
+ if (!prevPlugins && !newPlugins) {
2525
+ return false;
2526
+ }
2527
+ if (!prevPlugins && newPlugins) {
2528
+ return true;
2529
+ }
2530
+ if (prevPlugins && !newPlugins) {
2531
+ return true;
2532
+ }
2533
+ return prevPlugins.some((prevPlugin, index) => {
2534
+ const newPlugin = newPlugins[index];
2535
+ return (newPlugin.module !== prevPlugin.module ||
2536
+ pluginOptionsIsChanged(newPlugin.moduleOptions, prevPlugin.moduleOptions));
2537
+ });
2538
+ }
2539
+ function pluginOptionsIsChanged(prevPluginOptions, newPluginOptions) {
2540
+ if (!prevPluginOptions && !newPluginOptions) {
2541
+ return false;
2542
+ }
2543
+ if (!prevPluginOptions && newPluginOptions) {
2544
+ return true;
2545
+ }
2546
+ if (prevPluginOptions && !newPluginOptions) {
2547
+ return true;
2548
+ }
2549
+ return JSON.stringify(prevPluginOptions) !== JSON.stringify(newPluginOptions);
2550
+ }
2526
2551
 
2527
2552
  class FormulaRangeSelector {
2528
2553
  formulaManager;
@@ -3020,7 +3045,8 @@
3020
3045
  this.element.value = void 0 !== value ? value : "";
3021
3046
  }
3022
3047
  getValue() {
3023
- return this.element.value;
3048
+ var _a;
3049
+ return null === (_a = this.element) || void 0 === _a ? void 0 : _a.value;
3024
3050
  }
3025
3051
  prepareEdit({
3026
3052
  referencePosition: referencePosition,
@@ -37452,7 +37478,7 @@
37452
37478
  }(IconPosition || (IconPosition = {}));
37453
37479
  var IconFuncTypeEnum;
37454
37480
  !function (IconFuncTypeEnum) {
37455
- IconFuncTypeEnum.frozen = "frozen", IconFuncTypeEnum.sort = "sort", IconFuncTypeEnum.dropDown = "dropDown", IconFuncTypeEnum.dropDownState = "dropDownState", IconFuncTypeEnum.play = "play", IconFuncTypeEnum.damagePic = "damagePic", IconFuncTypeEnum.expand = "expand", IconFuncTypeEnum.collapse = "collapse", IconFuncTypeEnum.drillDown = "drillDown", IconFuncTypeEnum.drillUp = "drillUp", IconFuncTypeEnum.dragReorder = "dragReorder";
37481
+ IconFuncTypeEnum.frozen = "frozen", IconFuncTypeEnum.sort = "sort", IconFuncTypeEnum.dropDown = "dropDown", IconFuncTypeEnum.dropDownState = "dropDownState", IconFuncTypeEnum.play = "play", IconFuncTypeEnum.damagePic = "damagePic", IconFuncTypeEnum.imageDamagePic = "imageDamagePic", IconFuncTypeEnum.videoDamagePic = "videoDamagePic", IconFuncTypeEnum.expand = "expand", IconFuncTypeEnum.collapse = "collapse", IconFuncTypeEnum.drillDown = "drillDown", IconFuncTypeEnum.drillUp = "drillUp", IconFuncTypeEnum.dragReorder = "dragReorder";
37456
37482
  }(IconFuncTypeEnum || (IconFuncTypeEnum = {}));
37457
37483
  var InternalIconName;
37458
37484
  !function (InternalIconName) {
@@ -38921,6 +38947,7 @@
38921
38947
  AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
38922
38948
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
38923
38949
  CHANGE_CELL_VALUE: "change_cell_value",
38950
+ CHANGE_CELL_VALUES: "change_cell_values",
38924
38951
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
38925
38952
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
38926
38953
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -39748,6 +39775,32 @@
39748
39775
  };
39749
39776
 
39750
39777
  const themes$2 = {};
39778
+ function isTableTheme(theme) {
39779
+ return !!theme && "function" == typeof theme.getExtendTheme;
39780
+ }
39781
+ function getThemeComparableConfig(theme) {
39782
+ if (isTableTheme(theme)) {
39783
+ const extend = theme.getExtendTheme(),
39784
+ internal = theme.internalTheme,
39785
+ superTheme = null == internal ? void 0 : internal.superTheme;
39786
+ return {
39787
+ name: theme.name,
39788
+ extend: extend,
39789
+ superTheme: superTheme ? getThemeComparableConfig(superTheme) : void 0
39790
+ };
39791
+ }
39792
+ return theme;
39793
+ }
39794
+ function tableThemeIsChanged(prevTableTheme, newTableTheme) {
39795
+ if (!prevTableTheme && !newTableTheme) return !1;
39796
+ if (!prevTableTheme && newTableTheme) return !0;
39797
+ if (prevTableTheme && !newTableTheme) return !0;
39798
+ if (prevTableTheme === newTableTheme) return !1;
39799
+ const next = newTableTheme,
39800
+ prevConfig = getThemeComparableConfig(prevTableTheme),
39801
+ newConfig = getThemeComparableConfig(next);
39802
+ return !isEqual(prevConfig, newConfig);
39803
+ }
39751
39804
 
39752
39805
  const DEFAULTFONTSIZE = 16;
39753
39806
  const DEFAULTFONTFAMILY = "Arial,sans-serif";
@@ -40717,6 +40770,7 @@
40717
40770
  default: themes,
40718
40771
  get: get$5,
40719
40772
  of: of$1,
40773
+ tableThemeIsChanged: tableThemeIsChanged,
40720
40774
  theme: theme$1
40721
40775
  });
40722
40776
 
@@ -41053,6 +41107,24 @@
41053
41107
  }
41054
41108
  }
41055
41109
  }
41110
+ changeFieldValueByRecordIndex(value, recordIndex, field, table) {
41111
+ var _a, _b, _c, _d;
41112
+ if (null === field) return;
41113
+ if (null == recordIndex) return;
41114
+ const rawKey = recordIndex.toString();
41115
+ if (!this.beforeChangedRecordsMap.has(rawKey)) {
41116
+ const rawRecords = Array.isArray(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) ? this.dataSourceObj.records : null,
41117
+ originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
41118
+ this.beforeChangedRecordsMap.set(rawKey, null !== (_b = cloneDeep$1(originRecord, void 0, ["vtable_gantt_linkedFrom", "vtable_gantt_linkedTo"])) && void 0 !== _b ? _b : {});
41119
+ }
41120
+ if ("string" == typeof field || "number" == typeof field) {
41121
+ const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field],
41122
+ rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null,
41123
+ record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
41124
+ let formatValue = value;
41125
+ "number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), record ? record[field] = formatValue : rawRecords && "number" == typeof recordIndex && (rawRecords[recordIndex] = "Array" === this.addRecordRule ? [] : {}, rawRecords[recordIndex][field] = formatValue);
41126
+ }
41127
+ }
41056
41128
  cacheBeforeChangedRecord(dataIndex, table) {
41057
41129
  var _a;
41058
41130
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
@@ -41068,41 +41140,92 @@
41068
41140
  Array.isArray(indexed) || this.records.splice(indexed, 1, record);
41069
41141
  }
41070
41142
  }
41071
- addRecord(record, index) {
41143
+ _getRawRecordsArray() {
41072
41144
  var _a;
41073
- if (Array.isArray(this.records)) {
41074
- this.records.splice(index, 0, record), this.adjustBeforeChangedRecordsMap(index, 1), this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1;
41075
- for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].push(record);
41076
- if ("tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) {
41077
- this.pagination.totalCount = this._sourceLength;
41078
- const {
41079
- perPageCount: perPageCount,
41080
- currentPage: currentPage
41081
- } = this.pagination;
41082
- index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
41083
- } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
41084
- (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, 1);
41145
+ const rawRecords = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records;
41146
+ return Array.isArray(rawRecords) ? rawRecords : null;
41147
+ }
41148
+ _hasFilterInEffect() {
41149
+ var _a, _b, _c, _d, _e;
41150
+ 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;
41151
+ }
41152
+ _normalizeInsertIndex(index, length) {
41153
+ return null == index || index > length ? length : index < 0 ? 0 : index;
41154
+ }
41155
+ _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
41156
+ if (0 === this.records.length) return rawRecords.length;
41157
+ if (viewIndex <= 0) {
41158
+ const firstVisibleRecord = this.records[0],
41159
+ rawIndex = rawRecords.indexOf(firstVisibleRecord);
41160
+ return rawIndex >= 0 ? rawIndex : 0;
41085
41161
  }
41162
+ if (viewIndex >= this.records.length) {
41163
+ const lastVisibleRecord = this.records[this.records.length - 1],
41164
+ rawIndex = rawRecords.indexOf(lastVisibleRecord);
41165
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
41166
+ }
41167
+ const prevRecord = this.records[viewIndex - 1],
41168
+ rawIndex = rawRecords.indexOf(prevRecord);
41169
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
41086
41170
  }
41087
- addRecords(recordArr, index) {
41088
- var _a;
41089
- if (Array.isArray(this.records)) {
41090
- if (Array.isArray(recordArr)) {
41091
- this.records.splice(index, 0, ...recordArr), this.adjustBeforeChangedRecordsMap(index, recordArr.length);
41092
- for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
41093
- this._sourceLength += recordArr.length;
41094
- for (let i = 0; i < this.fieldAggregators.length; i++) for (let j = 0; j < recordArr.length; j++) this.fieldAggregators[i].push(recordArr[j]);
41171
+ _resetIndexingFromViewRecords() {
41172
+ if (this._sourceLength = this.records.length, this.currentIndexedData = Array.from({
41173
+ length: this._sourceLength
41174
+ }, (_, i) => i), "tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) return this.pagination.totalCount = this._sourceLength, void this.updatePagerData();
41175
+ this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
41176
+ }
41177
+ addRecord(record, index, syncToOriginalRecords = !1) {
41178
+ var _a, _b, _c;
41179
+ if (!syncToOriginalRecords) {
41180
+ if (Array.isArray(this.records)) {
41181
+ this.records.splice(index, 0, record), this.adjustBeforeChangedRecordsMap(index, 1), this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1;
41182
+ for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].push(record);
41183
+ if ("tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) {
41184
+ this.pagination.totalCount = this._sourceLength;
41185
+ const {
41186
+ perPageCount: perPageCount,
41187
+ currentPage: currentPage
41188
+ } = this.pagination;
41189
+ index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
41190
+ } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
41191
+ (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, 1);
41095
41192
  }
41096
- if (this.userPagination) {
41097
- this.pagination.totalCount = this._sourceLength;
41098
- const {
41099
- perPageCount: perPageCount,
41100
- currentPage: currentPage
41101
- } = this.pagination;
41102
- index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
41103
- } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
41104
- (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
41193
+ return;
41105
41194
  }
41195
+ const rawRecords = this._getRawRecordsArray();
41196
+ if (!rawRecords) return;
41197
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
41198
+ rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
41199
+ rawRecords.splice(rawInsertIndex, 0, record), syncToOriginalRecords && this._hasFilterInEffect() && this.markForceVisibleRecord(record), this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules), (null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.added) && this.dataSourceObj.added(rawInsertIndex, 1);
41200
+ }
41201
+ addRecords(recordArr, index, syncToOriginalRecords = !1) {
41202
+ var _a, _b, _c;
41203
+ if (!syncToOriginalRecords) {
41204
+ if (Array.isArray(this.records)) {
41205
+ if (Array.isArray(recordArr)) {
41206
+ this.records.splice(index, 0, ...recordArr), this.adjustBeforeChangedRecordsMap(index, recordArr.length);
41207
+ for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
41208
+ this._sourceLength += recordArr.length;
41209
+ for (let i = 0; i < this.fieldAggregators.length; i++) for (let j = 0; j < recordArr.length; j++) this.fieldAggregators[i].push(recordArr[j]);
41210
+ }
41211
+ if (this.userPagination) {
41212
+ this.pagination.totalCount = this._sourceLength;
41213
+ const {
41214
+ perPageCount: perPageCount,
41215
+ currentPage: currentPage
41216
+ } = this.pagination;
41217
+ index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
41218
+ } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
41219
+ (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
41220
+ }
41221
+ return;
41222
+ }
41223
+ const rawRecords = this._getRawRecordsArray();
41224
+ if (!rawRecords || !Array.isArray(recordArr) || 0 === recordArr.length) return;
41225
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
41226
+ rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
41227
+ if (rawRecords.splice(rawInsertIndex, 0, ...recordArr), syncToOriginalRecords && this._hasFilterInEffect()) for (let i = 0; i < recordArr.length; i++) this.markForceVisibleRecord(recordArr[i]);
41228
+ this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules), (null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.added) && this.dataSourceObj.added(rawInsertIndex, recordArr.length);
41106
41229
  }
41107
41230
  addRecordForSorted(record) {
41108
41231
  Array.isArray(this.records) && (this.beforeChangedRecordsMap.clear(), this.records.push(record), this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1, this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength));
@@ -41118,27 +41241,49 @@
41118
41241
  }
41119
41242
  }
41120
41243
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
41121
- for (let key = this.beforeChangedRecordsMap.size - 1; key >= insertIndex; key--) {
41122
- const record = this.beforeChangedRecordsMap.get(key.toString());
41123
- this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + ("add" === type ? insertCount : -insertCount)).toString(), record);
41124
- }
41125
- }
41126
- deleteRecords(recordIndexs) {
41127
- var _a;
41128
- if (Array.isArray(this.records)) {
41129
- const realDeletedRecordIndexs = [],
41130
- recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
41131
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
41132
- const recordIndex = recordIndexsMaxToMin[index];
41133
- if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
41134
- this.adjustBeforeChangedRecordsMap(recordIndex, 1, "delete"), realDeletedRecordIndexs.push(recordIndex);
41135
- const deletedRecord = this.records[recordIndex];
41136
- for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].deleteRecord(deletedRecord);
41137
- this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1;
41138
- }
41139
- return this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength), this.updatePagerData(), (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.deleted) && this.dataSourceObj.deleted(realDeletedRecordIndexs), realDeletedRecordIndexs;
41244
+ const delta = "add" === type ? insertCount : -insertCount,
41245
+ numericKeys = [];
41246
+ this.beforeChangedRecordsMap.forEach((_, key) => {
41247
+ const numKey = Number(key);
41248
+ Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex && numericKeys.push(numKey);
41249
+ }), numericKeys.sort((a, b) => "add" === type ? b - a : a - b);
41250
+ for (let i = 0; i < numericKeys.length; i++) {
41251
+ const key = numericKeys[i],
41252
+ record = this.beforeChangedRecordsMap.get(key.toString());
41253
+ this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
41254
+ }
41255
+ }
41256
+ deleteRecords(recordIndexs, syncToOriginalRecords = !1) {
41257
+ var _a, _b, _c;
41258
+ if (!syncToOriginalRecords) {
41259
+ if (Array.isArray(this.records)) {
41260
+ const realDeletedRecordIndexs = [],
41261
+ recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
41262
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
41263
+ const recordIndex = recordIndexsMaxToMin[index];
41264
+ if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
41265
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, "delete"), realDeletedRecordIndexs.push(recordIndex);
41266
+ const deletedRecord = this.records[recordIndex];
41267
+ for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].deleteRecord(deletedRecord);
41268
+ this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1;
41269
+ }
41270
+ return this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength), this.updatePagerData(), (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.deleted) && this.dataSourceObj.deleted(realDeletedRecordIndexs), realDeletedRecordIndexs;
41271
+ }
41272
+ return [];
41273
+ }
41274
+ const rawRecords = this._getRawRecordsArray();
41275
+ if (!rawRecords || !Array.isArray(this.records)) return [];
41276
+ const realDeletedRecordIndexs = [],
41277
+ recordIndexsMaxToMin = recordIndexs.slice().sort((a, b) => b - a),
41278
+ rawDeletedIndexs = [];
41279
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
41280
+ const viewIndex = recordIndexsMaxToMin[index];
41281
+ if (viewIndex >= this.records.length || viewIndex < 0) continue;
41282
+ const deletedRecord = this.records[viewIndex],
41283
+ rawIndex = rawRecords.indexOf(deletedRecord);
41284
+ rawIndex >= 0 && (rawRecords.splice(rawIndex, 1), rawDeletedIndexs.push(rawIndex)), realDeletedRecordIndexs.push(viewIndex);
41140
41285
  }
41141
- return [];
41286
+ return this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules), (null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.deleted) && this.dataSourceObj.deleted(rawDeletedIndexs), realDeletedRecordIndexs;
41142
41287
  }
41143
41288
  deleteRecordsForSorted(recordIndexs) {
41144
41289
  if (Array.isArray(this.records)) {
@@ -41152,18 +41297,34 @@
41152
41297
  this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength), this.beforeChangedRecordsMap.clear();
41153
41298
  }
41154
41299
  }
41155
- updateRecords(records, recordIndexs) {
41156
- const realDeletedRecordIndexs = [];
41300
+ updateRecords(records, recordIndexs, syncToOriginalRecords = !1) {
41301
+ var _a;
41302
+ if (!syncToOriginalRecords) {
41303
+ const realDeletedRecordIndexs = [];
41304
+ for (let index = 0; index < recordIndexs.length; index++) {
41305
+ const recordIndex = recordIndexs[index];
41306
+ if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce((acc, key) => (void 0 === acc[key] && (acc[key] = {}), acc[key].children), this.records)[recordIndex[recordIndex.length - 1]] = records[index];else {
41307
+ if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
41308
+ this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex);
41309
+ for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
41310
+ this.records[recordIndex] = records[index];
41311
+ }
41312
+ }
41313
+ return this.userPagination && this.updatePagerData(), realDeletedRecordIndexs;
41314
+ }
41315
+ const rawRecords = this._getRawRecordsArray();
41316
+ if (!rawRecords || !Array.isArray(this.records)) return [];
41317
+ const realUpdatedIndexs = [];
41157
41318
  for (let index = 0; index < recordIndexs.length; index++) {
41158
41319
  const recordIndex = recordIndexs[index];
41159
- if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce((acc, key) => (void 0 === acc[key] && (acc[key] = {}), acc[key].children), this.records)[recordIndex[recordIndex.length - 1]] = records[index];else {
41160
- if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
41161
- this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex);
41162
- for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
41163
- this.records[recordIndex] = records[index];
41320
+ if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()), realUpdatedIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce((acc, key) => (void 0 === acc[key] && (acc[key] = {}), acc[key].children), rawRecords)[recordIndex[recordIndex.length - 1]] = records[index];else {
41321
+ if (recordIndex >= this.records.length || recordIndex < 0) continue;
41322
+ const oldRecord = this.records[recordIndex],
41323
+ rawIndex = rawRecords.indexOf(oldRecord);
41324
+ rawIndex >= 0 && (rawRecords[rawIndex] = records[index]), realUpdatedIndexs.push(recordIndex);
41164
41325
  }
41165
41326
  }
41166
- return this.userPagination && this.updatePagerData(), realDeletedRecordIndexs;
41327
+ return this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules), realUpdatedIndexs;
41167
41328
  }
41168
41329
  updateRecordsForSorted(records, recordIndexs) {
41169
41330
  for (let index = 0; index < recordIndexs.length; index++) {
@@ -41231,23 +41392,30 @@
41231
41392
  setSortedIndexMap(field, filedMap) {
41232
41393
  this.sortedIndexMap.set(field, filedMap);
41233
41394
  }
41395
+ markForceVisibleRecord(record) {
41396
+ !record || "object" != typeof record && "function" != typeof record || (this._forceVisibleRecords || (this._forceVisibleRecords = new WeakSet()), this._forceVisibleRecords.add(record));
41397
+ }
41398
+ clearForceVisibleRecords() {
41399
+ this._forceVisibleRecords = void 0;
41400
+ }
41234
41401
  clearFilteredChildren(record) {
41235
41402
  var _a, _b;
41236
41403
  record.filteredChildren = void 0;
41237
41404
  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]);
41238
41405
  }
41239
41406
  filterRecord(record) {
41240
- var _a, _b, _c;
41407
+ var _a, _b, _c, _d;
41408
+ if (null === (_a = this._forceVisibleRecords) || void 0 === _a ? void 0 : _a.has(record)) return !0;
41241
41409
  let isReserved = !0;
41242
- for (let i = 0; i < (null === (_a = this.dataConfig.filterRules) || void 0 === _a ? void 0 : _a.length); i++) {
41243
- const filterRule = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules[i];
41410
+ for (let i = 0; i < (null === (_b = this.dataConfig.filterRules) || void 0 === _b ? void 0 : _b.length); i++) {
41411
+ const filterRule = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.filterRules[i];
41244
41412
  if (filterRule.filterKey) {
41245
41413
  const filterValue = record[filterRule.filterKey];
41246
41414
  if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
41247
41415
  isReserved = !1;
41248
41416
  break;
41249
41417
  }
41250
- } else if (!(null === (_c = filterRule.filterFunc) || void 0 === _c ? void 0 : _c.call(filterRule, record))) {
41418
+ } else if (!(null === (_d = filterRule.filterFunc) || void 0 === _d ? void 0 : _d.call(filterRule, record))) {
41251
41419
  isReserved = !1;
41252
41420
  break;
41253
41421
  }
@@ -45063,7 +45231,7 @@
45063
45231
  image: value,
45064
45232
  cursor: "pointer"
45065
45233
  });
45066
- return image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, keepAspectRatio || imageAutoSizing ? image.resources && image.resources.has(image.attribute.image) && "success" === image.resources.get(image.attribute.image).state ? (image.setAttribute("opacity", 0), setTimeout(() => {
45234
+ if (image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, keepAspectRatio || imageAutoSizing ? image.resources && image.resources.has(image.attribute.image) && "success" === image.resources.get(image.attribute.image).state ? (image.setAttribute("opacity", 0), setTimeout(() => {
45067
45235
  image.setAttribute("opacity", 1), updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table), table.scenegraph.updateNextFrame();
45068
45236
  }, 0)) : image.successCallback = () => {
45069
45237
  updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table), table.scenegraph.updateNextFrame();
@@ -45071,8 +45239,12 @@
45071
45239
  updateImageCellContentWhileResize(cellGroup, col, row, 0, 0, table);
45072
45240
  }, image.failCallback = () => {
45073
45241
  const regedIcons = get$2();
45074
- image.image = regedIcons.damage_pic.svg;
45075
- }, cellGroup.appendChild(image), cellGroup;
45242
+ image.image = regedIcons.image_damage_pic ? regedIcons.image_damage_pic.svg : regedIcons.damage_pic.svg;
45243
+ }, "string" == typeof value && !(value.startsWith("<svg") || isValidUrl$1(value) || value.includes("/") || isBase64$1(value))) {
45244
+ const regedIcons = get$2();
45245
+ image.image = regedIcons.image_damage_pic ? regedIcons.image_damage_pic.svg : regedIcons.damage_pic.svg;
45246
+ }
45247
+ return cellGroup.appendChild(image), cellGroup;
45076
45248
  }
45077
45249
  function _adjustWidthHeight(col, row, width, height, scene, padding, cellGroup) {
45078
45250
  let needInvalidate = !1,
@@ -45216,7 +45388,7 @@
45216
45388
  }
45217
45389
  function isDamagePic(image) {
45218
45390
  const regedIcons = get$2();
45219
- return image.attribute.image === regedIcons.damage_pic.svg;
45391
+ return image.attribute.image === regedIcons.damage_pic.svg || regedIcons.image_damage_pic && image.attribute.image === regedIcons.image_damage_pic.svg || regedIcons.video_damage_pic && image.attribute.image === regedIcons.video_damage_pic.svg;
45220
45392
  }
45221
45393
 
45222
45394
  function dealPromiseData(dataPromise, tabel, callback) {
@@ -45333,7 +45505,7 @@
45333
45505
  };
45334
45506
  }
45335
45507
  function updateCell$1(col, row, table, addNew, isShadow, forceFastUpdate) {
45336
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
45508
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
45337
45509
  const oldCellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0);
45338
45510
  if ("cell" !== oldCellGroup.role && !addNew) return;
45339
45511
  const cellLocation = table.getCellLocation(col, row);
@@ -45442,7 +45614,7 @@
45442
45614
  return oldCellGroup;
45443
45615
  }
45444
45616
  if (!addNew && "empty" === oldCellGroup.role) return;
45445
- const type = isVtableMerge || isCustomMerge ? "text" : table.isHeader(col, row) ? null !== (_s = table._getHeaderLayoutMap(col, row).headerType) && void 0 !== _s ? _s : "text" : null !== (_t = table.getBodyColumnType(col, row)) && void 0 !== _t ? _t : "text",
45617
+ const type = isVtableMerge || isCustomMerge ? "text" : table.getCellType(col, row),
45446
45618
  padding = cellTheme._vtable.padding,
45447
45619
  textAlign = cellTheme.text.textAlign,
45448
45620
  textBaseline = cellTheme.text.textBaseline;
@@ -45988,7 +46160,6 @@
45988
46160
  table.isPivotTable() && (layoutMap.disableUseGetBodyCache(), layoutMap.disableUseHeaderPathCache());
45989
46161
  }
45990
46162
  function computeRowHeight(row, startCol, endCol, table) {
45991
- var _a;
45992
46163
  if (!(table.isAutoRowHeight(row) || "adaptive" === table.heightMode && !1 !== table.options.autoHeightInAdaptiveMode) && "auto" !== table.getDefaultRowHeight(row)) return table.getDefaultRowHeight(row);
45993
46164
  let maxHeight;
45994
46165
  if (table.options.customComputeRowHeight) {
@@ -46031,7 +46202,7 @@
46031
46202
  }
46032
46203
  }
46033
46204
  if (table.isPivotChart() && (table.isLeftFrozenColumn(col) && table.isBottomFrozenRow(row) || table.isRightFrozenColumn(col) && table.isBottomFrozenRow(row))) continue;
46034
- const cellType = table.isHeader(col, row) ? null === (_a = table._getHeaderLayoutMap(col, row)) || void 0 === _a ? void 0 : _a.headerType : table.getBodyColumnType(col, row),
46205
+ const cellType = table.getCellType(col, row),
46035
46206
  textHeight = computeTextHeight(col, row, cellType, table);
46036
46207
  maxHeight = isValid$2(maxHeight) ? Math.max(textHeight, maxHeight) : textHeight;
46037
46208
  }
@@ -46278,12 +46449,12 @@
46278
46449
  cell && updateCellHeight(scene, cell, col, row, height, detaY);
46279
46450
  }
46280
46451
  function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader) {
46281
- var _a, _b, _c, _d, _e;
46452
+ var _a, _b, _c;
46282
46453
  if (cell.attribute.height === distHeight && !cell.needUpdateHeight) return;
46283
46454
  cell.needUpdateHeight = !1, cell.setAttribute("height", distHeight);
46284
46455
  const isVtableMerge = null === (_a = scene.table.getCellRawRecord(col, row)) || void 0 === _a ? void 0 : _a.vtableMerge,
46285
46456
  isCustomMerge = !!scene.table.getCustomMerge(col, row),
46286
- type = isVtableMerge || isCustomMerge ? "text" : scene.table.isHeader(col, row) ? null !== (_b = scene.table._getHeaderLayoutMap(col, row).headerType) && void 0 !== _b ? _b : "text" : null !== (_c = scene.table.getBodyColumnType(col, row)) && void 0 !== _c ? _c : "text";
46457
+ type = isVtableMerge || isCustomMerge ? "text" : scene.table.getCellType(col, row);
46287
46458
  if ("progressbar" === type) {
46288
46459
  const columnDefine = scene.table.getBodyColumnDefine(col, row),
46289
46460
  style = scene.table._getCellStyle(col, row),
@@ -46300,7 +46471,7 @@
46300
46471
  const headerStyle = scene.table._getCellStyle(col, row),
46301
46472
  padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
46302
46473
  Factory.getFunction("createSparkLineCellGroup")(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table, getStyleTheme(headerStyle, scene.table, col, row, getProp).theme, !1);
46303
- } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cell, col, row, 0, detaY, scene.table);else if ("axis" === (null === (_d = cell.firstChild) || void 0 === _d ? void 0 : _d.name)) null === (_e = cell.firstChild) || void 0 === _e || _e.originAxis.resize(cell.attribute.width, cell.attribute.height);else {
46474
+ } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cell, col, row, 0, detaY, scene.table);else if ("axis" === (null === (_b = cell.firstChild) || void 0 === _b ? void 0 : _b.name)) null === (_c = cell.firstChild) || void 0 === _c || _c.originAxis.resize(cell.attribute.width, cell.attribute.height);else {
46304
46475
  let renderDefault = !0;
46305
46476
  const customContainer = cell.getChildByName(CUSTOM_CONTAINER_NAME) || cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
46306
46477
  if (customContainer) {
@@ -46473,7 +46644,7 @@
46473
46644
  }
46474
46645
  }
46475
46646
  function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoWrapText) {
46476
- var _a, _b, _c, _d, _e, _f, _g;
46647
+ var _a, _b, _c, _d, _e;
46477
46648
  if (cell.attribute.width === distWidth && !cell.needUpdateWidth) return !1;
46478
46649
  cell.needUpdateWidth = !1, cell.setAttribute("width", distWidth);
46479
46650
  const cellGroup = cell;
@@ -46481,7 +46652,7 @@
46481
46652
  const autoRowHeight = scene.table.isAutoRowHeight(row),
46482
46653
  isVtableMerge = null === (_a = scene.table.getCellRawRecord(col, row)) || void 0 === _a ? void 0 : _a.vtableMerge,
46483
46654
  isCustomMerge = !!scene.table.getCustomMerge(col, row),
46484
- type = isVtableMerge || isCustomMerge ? "text" : scene.table.isHeader(col, row) ? null !== (_b = scene.table._getHeaderLayoutMap(col, row).headerType) && void 0 !== _b ? _b : "text" : null !== (_c = scene.table.getBodyColumnType(col, row)) && void 0 !== _c ? _c : "text";
46655
+ type = isVtableMerge || isCustomMerge ? "text" : scene.table.getCellType(col, row);
46485
46656
  let isHeightChange = !1;
46486
46657
  if ("progressbar" === type) {
46487
46658
  const columnDefine = scene.table.getBodyColumnDefine(col, row),
@@ -46501,15 +46672,15 @@
46501
46672
  const headerStyle = scene.table._getCellStyle(col, row),
46502
46673
  padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
46503
46674
  Factory.getFunction("createSparkLineCellGroup")(cellGroup, cellGroup.parent, cellGroup.attribute.x, cellGroup.attribute.y, col, row, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table, getStyleTheme(headerStyle, scene.table, col, row, getProp).theme, !1);
46504
- } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cellGroup, col, row, detaX, 0, scene.table);else if ("axis" === (null === (_d = cellGroup.firstChild) || void 0 === _d ? void 0 : _d.name)) {
46675
+ } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cellGroup, col, row, detaX, 0, scene.table);else if ("axis" === (null === (_b = cellGroup.firstChild) || void 0 === _b ? void 0 : _b.name)) {
46505
46676
  const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row),
46506
46677
  cellStyle = scene.table._getCellStyle(col, row),
46507
46678
  padding = getQuadProps(getProp("padding", cellStyle, col, row, scene.table));
46508
46679
  if (axisConfig) {
46509
- const axis = new (Factory.getComponent("axis"))(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, null !== (_e = axisConfig.__vtableBodyChartCellPadding) && void 0 !== _e ? _e : padding, scene.table);
46680
+ const axis = new (Factory.getComponent("axis"))(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, null !== (_c = axisConfig.__vtableBodyChartCellPadding) && void 0 !== _c ? _c : padding, scene.table);
46510
46681
  cellGroup.clear(), cellGroup.appendChild(axis.component), axis.overlap();
46511
46682
  }
46512
- } else if ("axis" === (null === (_f = cell.firstChild) || void 0 === _f ? void 0 : _f.name)) null === (_g = cell.firstChild) || void 0 === _g || _g.originAxis.resize(cell.attribute.width, cell.attribute.height);else {
46683
+ } else if ("axis" === (null === (_d = cell.firstChild) || void 0 === _d ? void 0 : _d.name)) null === (_e = cell.firstChild) || void 0 === _e || _e.originAxis.resize(cell.attribute.width, cell.attribute.height);else {
46513
46684
  let renderDefault = !0;
46514
46685
  const customContainer = cell.getChildByName(CUSTOM_CONTAINER_NAME) || cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
46515
46686
  if (customContainer) {
@@ -50047,7 +50218,7 @@
50047
50218
  return table.internalProps.transpose && "auto" === width && ("only-header" === table.columnWidthComputeMode && col >= table.rowHeaderLevelCount || "only-body" === table.columnWidthComputeMode && col < table.rowHeaderLevelCount) && (width = table.getDefaultColumnWidth(col)), forceCompute && !table.internalProps.transpose ? computeAutoColWidth(width, col, startRow, endRow, forceCompute, table) : "number" == typeof width ? width : "auto" !== width && "string" == typeof width ? table._adjustColWidth(col, table._colWidthDefineToPxWidth(width)) : computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
50048
50219
  }
50049
50220
  function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, table) {
50050
- var _a, _b, _c, _d, _e;
50221
+ var _a, _b, _c, _d;
50051
50222
  let maxWidth = 0,
50052
50223
  deltaRow = 1,
50053
50224
  prepareDeltaRow = 1;
@@ -50079,7 +50250,7 @@
50079
50250
  maxWidth = Math.max(indicatorWidth, maxWidth);
50080
50251
  continue;
50081
50252
  }
50082
- const cellType = table.isHeader(col, row) ? null === (_a = table._getHeaderLayoutMap(col, row)) || void 0 === _a ? void 0 : _a.headerType : table.getBodyColumnType(col, row);
50253
+ const cellType = table.getCellType(col, row);
50083
50254
  if (isValid$2(cellType) && "text" !== cellType && "link" !== cellType && "progressbar" !== cellType && "checkbox" !== cellType && "radio" !== cellType && "switch" !== cellType && "button" !== cellType) {
50084
50255
  maxWidth = Math.max(maxWidth, table.getColWidthDefinedNumber(col) || 0);
50085
50256
  continue;
@@ -50088,14 +50259,14 @@
50088
50259
  const layoutMap = table.internalProps.layoutMap;
50089
50260
  if (layoutMap.isHeader(col, row)) {
50090
50261
  const hd = layoutMap.getHeader(col, row);
50091
- if ("only-body" === (null === (_b = null == hd ? void 0 : hd.define) || void 0 === _b ? void 0 : _b.columnWidthComputeMode)) continue;
50092
- isValid$2(null == hd ? void 0 : hd.hierarchyLevel) && (cellHierarchyIndent = (null !== (_c = hd.hierarchyLevel) && void 0 !== _c ? _c : 0) * ("tree" === layoutMap.rowHierarchyType && null !== (_d = layoutMap.rowHierarchyIndent) && void 0 !== _d ? _d : 0), layoutMap.rowHierarchyTextStartAlignment && !table.internalProps.headerHelper.getHierarchyIcon(col, row) && (cellHierarchyIndent += table.internalProps.headerHelper.getHierarchyIconWidth()));
50262
+ if ("only-body" === (null === (_a = null == hd ? void 0 : hd.define) || void 0 === _a ? void 0 : _a.columnWidthComputeMode)) continue;
50263
+ isValid$2(null == hd ? void 0 : hd.hierarchyLevel) && (cellHierarchyIndent = (null !== (_b = hd.hierarchyLevel) && void 0 !== _b ? _b : 0) * ("tree" === layoutMap.rowHierarchyType && null !== (_c = layoutMap.rowHierarchyIndent) && void 0 !== _c ? _c : 0), layoutMap.rowHierarchyTextStartAlignment && !table.internalProps.headerHelper.getHierarchyIcon(col, row) && (cellHierarchyIndent += table.internalProps.headerHelper.getHierarchyIconWidth()));
50093
50264
  } else if (table.isListTable()) {
50094
50265
  deltaRow = prepareDeltaRow;
50095
50266
  const define = table.getBodyColumnDefine(col, row);
50096
50267
  if (null == define ? void 0 : define.tree) {
50097
50268
  const indexArr = table.dataSource.getIndexKey(table.getRecordShowIndexByCell(col, row));
50098
- cellHierarchyIndent = Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none ? (indexArr.length - 1) * (null !== (_e = layoutMap.hierarchyIndent) && void 0 !== _e ? _e : 0) : 0, layoutMap.hierarchyTextStartAlignment && !table.internalProps.bodyHelper.getHierarchyIcon(col, row) && (cellHierarchyIndent += table.internalProps.headerHelper.getHierarchyIconWidth());
50269
+ cellHierarchyIndent = Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none ? (indexArr.length - 1) * (null !== (_d = layoutMap.hierarchyIndent) && void 0 !== _d ? _d : 0) : 0, layoutMap.hierarchyTextStartAlignment && !table.internalProps.bodyHelper.getHierarchyIcon(col, row) && (cellHierarchyIndent += table.internalProps.headerHelper.getHierarchyIconWidth());
50099
50270
  }
50100
50271
  }
50101
50272
  const textWidth = computeTextWidth(col, row, cellType, table);
@@ -50349,7 +50520,6 @@
50349
50520
  emptyGroup.role = "empty";
50350
50521
 
50351
50522
  function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, mergeMap, defaultRowHeight, table, rowLimit) {
50352
- var _a, _b;
50353
50523
  let padding,
50354
50524
  textAlign,
50355
50525
  textBaseline,
@@ -50403,7 +50573,7 @@
50403
50573
  } = null != rawRecord ? rawRecord : {};
50404
50574
  isVtableMerge = vtableMerge, vtableMerge && (mayHaveIcon = !0, table.internalProps.groupTitleCustomLayout && (customResult = dealWithCustom(table.internalProps.groupTitleCustomLayout, void 0, range.start.col, range.start.row, table.getColsWidth(range.start.col, range.end.col), table.getRowsHeight(range.start.row, range.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table)), table.internalProps.groupTitleFieldFormat ? value = table.internalProps.groupTitleFieldFormat(rawRecord, col, row, table) : void 0 !== vtableMergeName && (value = vtableMergeName));
50405
50575
  }
50406
- const type = isVtableMerge || isCustomMerge ? "text" : null !== (_b = table.isHeader(col, row) ? null !== (_a = table._getHeaderLayoutMap(col, row).headerType) && void 0 !== _a ? _a : "text" : table.getBodyColumnType(col, row)) && void 0 !== _b ? _b : "text";
50576
+ const type = isVtableMerge || isCustomMerge ? "text" : table.getCellType(col, row);
50407
50577
  if (isPromise(value)) {
50408
50578
  createEmptyCellGroup(col, row, 0, y, cellWidth, cellHeight, columnGroup), dealPromiseData(value, table, callCreateCellForPromiseValue.bind(null, {
50409
50579
  type: type,
@@ -53897,7 +54067,7 @@
53897
54067
  }
53898
54068
  updateCellContentWhileResize(col, row) {
53899
54069
  var _a;
53900
- const type = (null === (_a = this.table.getCellRawRecord(col, row)) || void 0 === _a ? void 0 : _a.vtableMerge) ? "text" : this.table.isHeader(col, row) ? this.table._getHeaderLayoutMap(col, row).headerType : this.table.getBodyColumnType(col, row),
54070
+ const type = (null === (_a = this.table.getCellRawRecord(col, row)) || void 0 === _a ? void 0 : _a.vtableMerge) ? "text" : this.table.getCellType(col, row),
53901
54071
  cellGroup = this.getCell(col, row);
53902
54072
  "image" !== type && "video" !== type || updateImageCellContentWhileResize(cellGroup, col, row, 0, 0, this.table);
53903
54073
  }
@@ -56222,9 +56392,8 @@
56222
56392
  row: row
56223
56393
  } = e;
56224
56394
  if ("image" === e.target.type && e.target.role && e.target.role.startsWith("icon")) return;
56225
- let cellType;
56226
- cellType = table.internalProps.layoutMap.isHeader(col, row) ? table.isPivotTable() ? table._getHeaderLayoutMap(col, row).headerType : table.getHeaderDefine(col, row).headerType : table.getBodyColumnType(col, row);
56227
- const columnDefine = table.isHeader(col, row) ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row),
56395
+ const cellType = table.getCellType(col, row),
56396
+ columnDefine = table.isHeader(col, row) ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row),
56228
56397
  cellValue = table.getCellValue(col, row),
56229
56398
  cellOriginValue = table.getCellOriginValue(col, row);
56230
56399
  if ("link" === cellType) {
@@ -56252,7 +56421,9 @@
56252
56421
  if (rowData && rowData.vtableMerge) return;
56253
56422
  const data = Object.assign({
56254
56423
  __value: cellValue,
56255
- __dataValue: cellOriginValue
56424
+ __dataValue: cellOriginValue,
56425
+ value: cellValue,
56426
+ dataValue: cellOriginValue
56256
56427
  }, rowData);
56257
56428
  if (isFunction$4(templateLink)) url = templateLink(data, col, row, table);else {
56258
56429
  const re = /\{\s*(\S+?)\s*\}/g;
@@ -56276,7 +56447,7 @@
56276
56447
  e.target === overlay && document.body.removeChild(overlay);
56277
56448
  });
56278
56449
  const image = new Image();
56279
- image.src = cellValue, image.style.maxWidth = "80%", image.style.maxHeight = "80%", overlay.appendChild(image), document.body.appendChild(overlay);
56450
+ image.src = cellValue, image.style.maxWidth = "80%", image.style.maxHeight = "80%", image.style.backgroundColor = "#FFF", overlay.appendChild(image), document.body.appendChild(overlay);
56280
56451
  } else if ("video" === cellType) {
56281
56452
  const {
56282
56453
  clickToPreview: clickToPreview
@@ -56714,7 +56885,7 @@
56714
56885
  }, 0);
56715
56886
  }
56716
56887
  }), table.scenegraph.tableGroup.addEventListener("rightdown", e => {
56717
- var _a, _b, _c, _d, _e, _f, _g;
56888
+ var _a, _b, _c, _d, _e, _f, _g, _h;
56718
56889
  const eventArgsSet = getCellEventArgsSet(e);
56719
56890
  if (eventArgsSet.eventArgs) {
56720
56891
  stateManager.triggerContextMenu(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
@@ -56737,11 +56908,11 @@
56737
56908
  }
56738
56909
  }
56739
56910
  const disableSelectOnContextMenu = null === (_a = table.options.select) || void 0 === _a ? void 0 : _a.disableSelectOnContextMenu;
56740
- if (cellInRange || disableSelectOnContextMenu || table.selectCell(col, row), table.hasListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL)) {
56911
+ if (cellInRange || disableSelectOnContextMenu || "chart" === (null === (_b = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target.type) || table.selectCell(col, row), table.hasListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL)) {
56741
56912
  const cellInfo = table.getCellInfo(col, row);
56742
56913
  let icon, position;
56743
- if (null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target) {
56744
- const iconInfo = getIconAndPositionFromTarget(null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target);
56914
+ if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
56915
+ const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
56745
56916
  iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
56746
56917
  }
56747
56918
  const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
@@ -56752,10 +56923,10 @@
56752
56923
  position: position,
56753
56924
  funcType: icon.attribute.funcType
56754
56925
  } : void 0,
56755
- target: null === (_d = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target,
56756
- mergeCellInfo: null === (_e = eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.mergeInfo
56926
+ target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
56927
+ mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
56757
56928
  });
56758
- (null === (_g = null === (_f = table.options.eventOptions) || void 0 === _f ? void 0 : _f.contextmenuReturnAllSelectedCells) || void 0 === _g || _g) && (cellInRanges(table.stateManager.select.ranges, col, row) ? cellsEvent.cells = table.getSelectedCellInfos() : cellsEvent.cells = [[cellInfo]]), table.fireListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, cellsEvent);
56929
+ (null === (_h = null === (_g = table.options.eventOptions) || void 0 === _g ? void 0 : _g.contextmenuReturnAllSelectedCells) || void 0 === _h || _h) && (cellInRanges(table.stateManager.select.ranges, col, row) ? cellsEvent.cells = table.getSelectedCellInfos() : cellsEvent.cells = [[cellInfo]]), table.fireListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, cellsEvent);
56759
56930
  }
56760
56931
  }
56761
56932
  }
@@ -57106,7 +57277,7 @@
57106
57277
  const relatedTarget = e.relatedTarget;
57107
57278
  if (relatedTarget) {
57108
57279
  const selectedRanges = table.stateManager.select.ranges,
57109
- editor = 1 === selectedRanges.length && selectedRanges[0].start.col === selectedRanges[0].end.col && selectedRanges[0].start.row === selectedRanges[0].end.row && table.getEditor(table.stateManager.select.cellPos.col, table.stateManager.select.cellPos.row);
57280
+ editor = 1 === selectedRanges.length && selectedRanges[0].start.col === selectedRanges[0].end.col && selectedRanges[0].start.row === selectedRanges[0].end.row && table.getEditor && table.getEditor(table.stateManager.select.cellPos.col, table.stateManager.select.cellPos.row);
57110
57281
  if ((null === (_a = null == editor ? void 0 : editor.getInputElement) || void 0 === _a ? void 0 : _a.call(editor)) === relatedTarget) return;
57111
57282
  }
57112
57283
  eventManager.dealTableHover();
@@ -57709,7 +57880,7 @@
57709
57880
  };
57710
57881
  class EventManager {
57711
57882
  constructor(table) {
57712
- this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env$1.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
57883
+ this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.cutRanges = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env$1.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
57713
57884
  this.bindSelfEvent();
57714
57885
  }, 0));
57715
57886
  }
@@ -58011,15 +58182,25 @@
58011
58182
  } catch (error) {}
58012
58183
  }
58013
58184
  handleCut(e) {
58185
+ var _a;
58014
58186
  return __awaiter$1(this, void 0, void 0, function* () {
58015
- this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
58016
- this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer = null);
58187
+ this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.cutRanges = null === (_a = this.table.stateManager.select.ranges) || void 0 === _a ? void 0 : _a.map(r => ({
58188
+ start: {
58189
+ col: r.start.col,
58190
+ row: r.start.row
58191
+ },
58192
+ end: {
58193
+ col: r.end.col,
58194
+ row: r.end.row
58195
+ }
58196
+ })), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
58197
+ this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer = null);
58017
58198
  }, 3e4), this.saveClipboardContent();
58018
58199
  });
58019
58200
  }
58020
58201
  handlePaste(e) {
58021
58202
  this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
58022
- this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
58203
+ this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
58023
58204
  }).catch(() => {
58024
58205
  this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
58025
58206
  }) : this.executePaste(e);
@@ -58096,9 +58277,9 @@
58096
58277
  }
58097
58278
  clearCutArea(table) {
58098
58279
  try {
58099
- const selectCells = this.cutCellRange;
58100
- if (!selectCells || 0 === selectCells.length) return;
58101
- for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, void 0);
58280
+ const ranges = this.cutRanges;
58281
+ if (!ranges || 0 === ranges.length) return;
58282
+ table.changeCellValuesByRanges(ranges, "");
58102
58283
  } catch (error) {}
58103
58284
  }
58104
58285
  checkClipboardChanged() {
@@ -60064,6 +60245,15 @@
60064
60245
  const compacted = this.customCellStyleArrangement.filter(style => isValid$2(style.customStyleId));
60065
60246
  compacted.length !== this.customCellStyleArrangement.length ? (this.customCellStyleArrangement.length = 0, this.customCellStyleArrangement.push(...compacted), this._rebuildCustomCellStyleArrangementIndex()) : this._customCellStyleArrangementTombstoneCount = 0;
60066
60247
  }
60248
+ clearCustomCellStyleArrangement() {
60249
+ this.customCellStyleArrangement = [];
60250
+ }
60251
+ addCustomCellStyleArrangement(cellPosition, customStyleId) {
60252
+ this.customCellStyleArrangement.push({
60253
+ cellPosition: cellPosition,
60254
+ customStyleId: customStyleId
60255
+ });
60256
+ }
60067
60257
  getCustomCellStyle(col, row) {
60068
60258
  const customStyleIds = this.getCustomCellStyleIds(col, row);
60069
60259
  if (customStyleIds.length) {
@@ -60199,7 +60389,7 @@
60199
60389
  paddingForAxis = null !== (_e = null === (_d = layoutMap.getBody(table.columnHeaderLevelCount, row).style) || void 0 === _d ? void 0 : _d.padding) && void 0 !== _e ? _e : table.theme.bodyStyle.padding;
60200
60390
  }
60201
60391
  if ((!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightBottomCorner(col, row) || layoutMap.isCornerHeader(col, row) || layoutMap.isRightTopCorner(col, row))) return EMPTY_STYLE;
60202
- const styleClass = table.internalProps.headerHelper.getStyleClass((null == hd ? void 0 : hd.headerType) || "text");
60392
+ const styleClass = table.internalProps.headerHelper.getStyleClass(table.getCellType(col, row));
60203
60393
  if (layoutMap.isBottomFrozenRow(col, row) && table.theme.bottomFrozenStyle) cacheStyle = of(paddingForAxis ? {
60204
60394
  padding: paddingForAxis
60205
60395
  } : {}, table.theme.bottomFrozenStyle, {
@@ -60384,7 +60574,7 @@
60384
60574
  }
60385
60575
  constructor(container, options = {}) {
60386
60576
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
60387
- if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.1-alpha.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60577
+ if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60388
60578
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60389
60579
  options: options,
60390
60580
  container: container
@@ -64065,8 +64255,8 @@
64065
64255
  col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1;
64066
64256
  const editor = this.table.getEditor(col, row);
64067
64257
  editor && setTimeout(() => {
64068
- var _a, _b;
64069
- editor && this.editingEditor !== editor && (null === (_b = (_a = editor).prepareEdit) || void 0 === _b || _b.call(_a, {
64258
+ var _a;
64259
+ editor && this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
64070
64260
  referencePosition: referencePosition,
64071
64261
  container: this.table.getElement(),
64072
64262
  table: this.table,
@@ -64215,15 +64405,16 @@
64215
64405
  step((generator = generator.apply(thisArg, _arguments || [])).next());
64216
64406
  });
64217
64407
  };
64218
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
64408
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
64219
64409
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
64220
- const recordIndex = table.getRecordShowIndexByCell(col, row),
64410
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row),
64411
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
64221
64412
  {
64222
64413
  field: field
64223
64414
  } = table.internalProps.layoutMap.getBody(col, row),
64224
64415
  beforeChangeValue = table.getCellRawValue(col, row),
64225
64416
  oldValue = table.getCellOriginValue(col, row);
64226
- table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
64417
+ table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
64227
64418
  const range = table.getCellRange(col, row),
64228
64419
  aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
64229
64420
  if (aggregators) {
@@ -64246,16 +64437,24 @@
64246
64437
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
64247
64438
  }
64248
64439
  const changedValue = table.getCellOriginValue(col, row);
64249
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
64250
- col: col,
64251
- row: row,
64252
- rawValue: beforeChangeValue,
64253
- currentValue: oldValue,
64254
- changedValue: changedValue
64255
- }), table.scenegraph.updateNextFrame();
64440
+ if (oldValue !== changedValue && triggerEvent) {
64441
+ const changeValue = {
64442
+ col: col,
64443
+ row: row,
64444
+ recordIndex: recordIndex,
64445
+ field: field,
64446
+ rawValue: beforeChangeValue,
64447
+ currentValue: oldValue,
64448
+ changedValue: changedValue
64449
+ };
64450
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), noTriggerChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64451
+ values: [changeValue]
64452
+ });
64453
+ }
64454
+ table.scenegraph.updateNextFrame();
64256
64455
  }
64257
64456
  }
64258
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
64457
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
64259
64458
  var _a, _b;
64260
64459
  return __awaiter(this, void 0, void 0, function* () {
64261
64460
  const changedCellResults = [];
@@ -64277,6 +64476,7 @@
64277
64476
  oldRowValues.push(oldValue);
64278
64477
  }
64279
64478
  }
64479
+ const resultChangeValues = [];
64280
64480
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
64281
64481
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
64282
64482
  const rowValues = values[i];
@@ -64300,25 +64500,34 @@
64300
64500
  if (isCanChange) {
64301
64501
  changedCellResults[i][j] = !0;
64302
64502
  const value = rowValues[j],
64303
- recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
64503
+ recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
64504
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
64304
64505
  {
64305
64506
  field: field
64306
64507
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
64307
64508
  beforeChangeValue = beforeChangeValues[i][j],
64308
64509
  oldValue = oldValues[i][j];
64309
- table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
64510
+ table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
64310
64511
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
64311
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
64312
- col: startCol + j,
64313
- row: startRow + i,
64314
- rawValue: beforeChangeValue,
64315
- currentValue: oldValue,
64316
- changedValue: changedValue
64317
- });
64512
+ if (oldValue !== changedValue && triggerEvent) {
64513
+ const changeValue = {
64514
+ col: startCol + j,
64515
+ row: startRow + i,
64516
+ recordIndex: recordIndex,
64517
+ field: field,
64518
+ rawValue: beforeChangeValue,
64519
+ currentValue: oldValue,
64520
+ changedValue: changedValue
64521
+ };
64522
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
64523
+ }
64318
64524
  } else changedCellResults[i][j] = !1;
64319
64525
  }
64320
64526
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
64321
64527
  }
64528
+ noTriggerChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64529
+ values: resultChangeValues
64530
+ });
64322
64531
  const startRange = table.getCellRange(startCol, startRow),
64323
64532
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
64324
64533
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -64352,6 +64561,58 @@
64352
64561
  return table.scenegraph.updateNextFrame(), changedCellResults;
64353
64562
  });
64354
64563
  }
64564
+ function listTableChangeCellValuesByRanges(ranges, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
64565
+ var _a, _b;
64566
+ return __awaiter(this, void 0, void 0, function* () {
64567
+ const resultChangeValues = [],
64568
+ processed = new Set(),
64569
+ nextValue = null != value ? value : "";
64570
+ for (let i = 0; i < (null !== (_a = null == ranges ? void 0 : ranges.length) && void 0 !== _a ? _a : 0); i++) {
64571
+ const range = ranges[i],
64572
+ startCol = Math.min(range.start.col, range.end.col),
64573
+ endCol = Math.max(range.start.col, range.end.col),
64574
+ startRow = Math.min(range.start.row, range.end.row),
64575
+ endRow = Math.max(range.start.row, range.end.row);
64576
+ if (startCol > endCol || startRow > endRow) continue;
64577
+ const values = [],
64578
+ oldValues = [];
64579
+ for (let row = startRow; row <= endRow; row++) {
64580
+ const rowValues = [],
64581
+ rowOldValues = [];
64582
+ for (let col = startCol; col <= endCol; col++) rowValues.push(nextValue), rowOldValues.push(table.getCellOriginValue(col, row));
64583
+ values.push(rowValues), oldValues.push(rowOldValues);
64584
+ }
64585
+ const changedCellResults = yield listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, !0);
64586
+ for (let r = 0; r < values.length; r++) for (let c = 0; c < values[r].length; c++) {
64587
+ const col = startCol + c,
64588
+ row = startRow + r,
64589
+ key = `${col},${row}`;
64590
+ if (processed.has(key)) continue;
64591
+ if (processed.add(key), !triggerEvent || !(null === (_b = null == changedCellResults ? void 0 : changedCellResults[r]) || void 0 === _b ? void 0 : _b[c])) continue;
64592
+ const oldValue = oldValues[r][c],
64593
+ changedValue = table.getCellOriginValue(col, row);
64594
+ if (oldValue === changedValue) continue;
64595
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row),
64596
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
64597
+ {
64598
+ field: field
64599
+ } = table.internalProps.layoutMap.getBody(col, row);
64600
+ resultChangeValues.push({
64601
+ col: col,
64602
+ row: row,
64603
+ recordIndex: recordIndex,
64604
+ field: field,
64605
+ rawValue: oldValue,
64606
+ currentValue: oldValue,
64607
+ changedValue: changedValue
64608
+ });
64609
+ }
64610
+ }
64611
+ !noTriggerChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64612
+ values: resultChangeValues
64613
+ });
64614
+ });
64615
+ }
64355
64616
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
64356
64617
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
64357
64618
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -64369,13 +64630,16 @@
64369
64630
  }), table.dataSource.sort(sortState));
64370
64631
  }
64371
64632
  function listTableAddRecord(record, recordIndex, table) {
64372
- var _a, _b, _c, _d;
64633
+ var _a, _b, _c, _d, _e, _f;
64373
64634
  try {
64374
64635
  if (!record) return !1;
64375
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
64636
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) {
64637
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.addRecord(record, table.dataSource.records.length, !0) : table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
64638
+ } else {
64376
64639
  (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
64377
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
64378
- table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
64640
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
64641
+ syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
64642
+ if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
64379
64643
  const oldRowCount = table.rowCount;
64380
64644
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
64381
64645
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -64444,13 +64708,16 @@
64444
64708
  }
64445
64709
  }
64446
64710
  function listTableAddRecords(records, recordIndex, table) {
64447
- var _a, _b, _c, _d;
64711
+ var _a, _b, _c, _d, _e, _f;
64448
64712
  try {
64449
64713
  if (!records || 0 === records.length) return !1;
64450
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
64714
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) {
64715
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.addRecords(records, table.dataSource.records.length, !0) : table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
64716
+ } else {
64451
64717
  void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
64452
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
64453
- table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
64718
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
64719
+ syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
64720
+ if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
64454
64721
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
64455
64722
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
64456
64723
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -64519,16 +64786,20 @@
64519
64786
  }
64520
64787
  }
64521
64788
  function listTableDeleteRecords(recordIndexs, table) {
64522
- var _a, _b, _c, _d, _e, _f, _g, _h;
64789
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
64523
64790
  if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).deleteRecordsForGroup) || void 0 === _b || _b.call(_a, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) {
64524
64791
  const deletedRecordIndexs = null === (_d = (_c = table.dataSource).deleteRecordsForTree) || void 0 === _d ? void 0 : _d.call(_c, recordIndexs);
64525
64792
  if (0 === deletedRecordIndexs.length) return;
64526
64793
  for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
64527
64794
  table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
64528
- } else if (table.sortState) table.dataSource.deleteRecordsForSorted(recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
64529
- const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);
64795
+ } else if (table.sortState) {
64796
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.deleteRecords(recordIndexs, !0) : table.dataSource.deleteRecordsForSorted(recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
64797
+ } else {
64798
+ const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
64799
+ deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
64530
64800
  if (0 === deletedRecordIndexs.length) return;
64531
64801
  for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
64802
+ if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
64532
64803
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
64533
64804
  table.refreshRowColCount();
64534
64805
  const newRowCount = table.transpose ? table.colCount : table.rowCount,
@@ -64566,7 +64837,7 @@
64566
64837
  col: 0,
64567
64838
  row: row
64568
64839
  });
64569
- null === (_e = table.reactCustomLayout) || void 0 === _e || _e.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_f = table.reactCustomLayout) || void 0 === _f || _f.updateAllCustomCell();
64840
+ null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
64570
64841
  }
64571
64842
  } else {
64572
64843
  const delRows = [],
@@ -64598,15 +64869,19 @@
64598
64869
  col: 0,
64599
64870
  row: row
64600
64871
  });
64601
- null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
64872
+ null === (_j = table.reactCustomLayout) || void 0 === _j || _j.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_k = table.reactCustomLayout) || void 0 === _k || _k.updateAllCustomCell();
64602
64873
  }
64603
64874
  }
64604
64875
  }
64605
64876
  function listTableUpdateRecords(records, recordIndexs, table) {
64606
- var _a, _b, _c, _d;
64607
- if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).updateRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).updateRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.updateRecordsForSorted(records, recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
64608
- const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);
64877
+ var _a, _b, _c, _d, _e, _f;
64878
+ if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).updateRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).updateRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) {
64879
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.updateRecords(records, recordIndexs, !0) : table.dataSource.updateRecordsForSorted(records, recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
64880
+ } else {
64881
+ const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
64882
+ updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
64609
64883
  if (0 === updateRecordIndexs.length) return;
64884
+ if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
64610
64885
  const recordIndexsMinToMax = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index)).sort((a, b) => a - b);
64611
64886
  if (table.pagination) {
64612
64887
  const {
@@ -65372,8 +65647,8 @@
65372
65647
  updateFilterRules(filterRules, options = {
65373
65648
  clearRowHeightCache: !0
65374
65649
  }) {
65375
- var _a;
65376
- this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), this.resize();
65650
+ var _a, _b, _c;
65651
+ this.scenegraph.clearCells(), null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
65377
65652
  }
65378
65653
  getFilteredRecords() {
65379
65654
  return this.dataSource.records;
@@ -65524,43 +65799,165 @@
65524
65799
  }
65525
65800
  return isValid$2(editorDefine);
65526
65801
  }
65527
- changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
65528
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
65802
+ changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
65803
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
65804
+ }
65805
+ changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
65806
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
65807
+ }
65808
+ changeCellValuesByRanges(ranges, value, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
65809
+ return listTableChangeCellValuesByRanges(ranges, value, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
65810
+ }
65811
+ changeSourceCellValue(recordIndex, field, value) {
65812
+ const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
65813
+ cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
65814
+ if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
65815
+ this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
65816
+ const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
65817
+ oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
65818
+ changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
65819
+ if (oldValue !== changedValue) {
65820
+ const changeValue = {
65821
+ col: cellAddr.col,
65822
+ row: cellAddr.row,
65823
+ recordIndex: recordIndex,
65824
+ field: field,
65825
+ rawValue: beforeChangeValue,
65826
+ currentValue: oldValue,
65827
+ changedValue: changedValue
65828
+ };
65829
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65830
+ values: [changeValue]
65831
+ });
65832
+ }
65833
+ }
65834
+ changeCellValueByRecord(recordIndex, field, value, options) {
65835
+ var _a, _b, _c, _d, _e;
65836
+ const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
65837
+ noTriggerChangeCellValuesEvent = null == options ? void 0 : options.noTriggerChangeCellValuesEvent,
65838
+ autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
65839
+ records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
65840
+ let record, oldValue;
65841
+ if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), !triggerEvent) return;
65842
+ const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
65843
+ if (oldValue !== changedValue) {
65844
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
65845
+ changeValue = {
65846
+ col: null !== (_d = null == cellAddr ? void 0 : cellAddr.col) && void 0 !== _d ? _d : -1,
65847
+ row: null !== (_e = null == cellAddr ? void 0 : cellAddr.row) && void 0 !== _e ? _e : -1,
65848
+ recordIndex: recordIndex,
65849
+ field: field,
65850
+ rawValue: oldValue,
65851
+ currentValue: oldValue,
65852
+ changedValue: changedValue
65853
+ };
65854
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), noTriggerChangeCellValuesEvent || this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65855
+ values: [changeValue]
65856
+ });
65857
+ }
65858
+ autoRefresh && this.refreshAfterSourceChange();
65529
65859
  }
65530
- changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
65531
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
65860
+ changeCellValueBySource(recordIndex, field, value, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
65861
+ return this.changeCellValueByRecord(recordIndex, field, value, {
65862
+ triggerEvent: triggerEvent,
65863
+ noTriggerChangeCellValuesEvent: noTriggerChangeCellValuesEvent,
65864
+ autoRefresh: !0
65865
+ });
65532
65866
  }
65533
- addRecord(record, recordIndex) {
65867
+ changeCellValuesByRecords(changeValues, options) {
65868
+ var _a, _b, _c, _d, _e, _f, _g;
65869
+ const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
65870
+ noTriggerChangeCellValuesEvent = null == options ? void 0 : options.noTriggerChangeCellValuesEvent,
65871
+ autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
65872
+ resultChangeValues = [];
65873
+ for (let i = 0; i < changeValues.length; i++) {
65874
+ const {
65875
+ recordIndex: recordIndex,
65876
+ field: field,
65877
+ value: value
65878
+ } = changeValues[i],
65879
+ records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
65880
+ let record, oldValue;
65881
+ if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), triggerEvent) {
65882
+ const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
65883
+ if (oldValue !== changedValue) {
65884
+ const changeValue = {
65885
+ col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
65886
+ row: null !== (_g = null === (_f = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _f ? void 0 : _f.row) && void 0 !== _g ? _g : -1,
65887
+ recordIndex: recordIndex,
65888
+ field: field,
65889
+ rawValue: oldValue,
65890
+ currentValue: oldValue,
65891
+ changedValue: changedValue
65892
+ };
65893
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
65894
+ }
65895
+ }
65896
+ }
65897
+ !noTriggerChangeCellValuesEvent && resultChangeValues.length && triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65898
+ values: resultChangeValues
65899
+ }), autoRefresh && this.refreshAfterSourceChange();
65900
+ }
65901
+ changeCellValuesBySource(changeValues, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
65902
+ return this.changeCellValuesByRecords(changeValues, {
65903
+ triggerEvent: triggerEvent,
65904
+ noTriggerChangeCellValuesEvent: noTriggerChangeCellValuesEvent,
65905
+ autoRefresh: !0
65906
+ });
65907
+ }
65908
+ refreshAfterSourceChange(options) {
65909
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
65910
+ const reapplyFilter = null === (_a = null == options ? void 0 : options.reapplyFilter) || void 0 === _a || _a,
65911
+ reapplySort = null === (_b = null == options ? void 0 : options.reapplySort) || void 0 === _b || _b,
65912
+ clearRowHeightCache = null === (_c = null == options ? void 0 : options.clearRowHeightCache) || void 0 === _c || _c;
65913
+ this.scenegraph.clearCells(), this.sortState && reapplySort && (null === (_e = (_d = this.dataSource).clearSortedIndexMap) || void 0 === _e || _e.call(_d), null === (_g = null === (_f = this.dataSource.sortedIndexMap) || void 0 === _f ? void 0 : _f.clear) || void 0 === _g || _g.call(_f)), reapplyFilter ? this.sortState && reapplySort ? (this.dataSource.updateFilterRulesForSorted(null === (_h = this.dataSource.dataConfig) || void 0 === _h ? void 0 : _h.filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(null === (_j = this.dataSource.dataConfig) || void 0 === _j ? void 0 : _j.filterRules) : this.sortState && reapplySort && sortRecords(this);
65914
+ const traverseColumns = columns => {
65915
+ var _a, _b, _c, _d;
65916
+ for (let i = 0; i < (null !== (_a = null == columns ? void 0 : columns.length) && void 0 !== _a ? _a : 0); i++) {
65917
+ const column = columns[i],
65918
+ aggregators = null == column ? void 0 : column.vtable_aggregator;
65919
+ if (aggregators) if (Array.isArray(aggregators)) for (let j = 0; j < aggregators.length; j++) null === (_c = null === (_b = aggregators[j]) || void 0 === _b ? void 0 : _b.recalculate) || void 0 === _c || _c.call(_b);else null === (_d = null == aggregators ? void 0 : aggregators.recalculate) || void 0 === _d || _d.call(aggregators);
65920
+ (null == column ? void 0 : column.columns) && traverseColumns(column.columns);
65921
+ }
65922
+ };
65923
+ traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
65924
+ }
65925
+ addRecord(record, recordIndex, triggerEvent = !0) {
65534
65926
  var _a;
65535
65927
  const success = listTableAddRecord(record, recordIndex, this);
65536
- adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65928
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65537
65929
  records: [record],
65538
65930
  recordIndex: recordIndex,
65539
65931
  recordCount: 1
65540
65932
  });
65541
65933
  }
65542
- addRecords(records, recordIndex) {
65934
+ addRecords(records, recordIndex, triggerEvent = !0) {
65543
65935
  var _a;
65544
65936
  const success = listTableAddRecords(records, recordIndex, this);
65545
- "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65937
+ "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65546
65938
  records: records,
65547
65939
  recordIndex: recordIndex,
65548
65940
  recordCount: records.length
65549
65941
  });
65550
65942
  }
65551
- deleteRecords(recordIndexs) {
65943
+ deleteRecords(recordIndexs, triggerEvent = !0) {
65552
65944
  var _a;
65553
- listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65945
+ const deletedRecords = [];
65946
+ (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
65947
+ let record = null;
65948
+ record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
65949
+ }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65554
65950
  const rowIndexs = [];
65555
65951
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65556
- this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65952
+ triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65557
65953
  recordIndexs: recordIndexs,
65954
+ records: deletedRecords,
65558
65955
  rowIndexs: rowIndexs,
65559
65956
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
65560
65957
  });
65561
65958
  }
65562
- updateRecords(records, recordIndexs) {
65563
- listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65959
+ updateRecords(records, recordIndexs, triggerEvent = !0) {
65960
+ listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65564
65961
  records: records,
65565
65962
  recordIndexs: recordIndexs,
65566
65963
  updateCount: records.length
@@ -68739,7 +69136,8 @@
68739
69136
  });
68740
69137
  playIcon.name = "play-icon", cellGroup.appendChild(playIcon), table.scenegraph.updateNextFrame();
68741
69138
  }), video.onerror = () => {
68742
- image.image = regedIcons.damage_pic.svg;
69139
+ const regedIcons = get$2();
69140
+ image.image = regedIcons.video_damage_pic ? regedIcons.video_damage_pic.svg : regedIcons.damage_pic.svg;
68743
69141
  }, video.src = value, video.setAttribute("preload", "auto");
68744
69142
  const image = createImage({
68745
69143
  x: padding[3],
@@ -68749,7 +69147,9 @@
68749
69147
  image: video,
68750
69148
  cursor: "pointer"
68751
69149
  });
68752
- return image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, cellGroup.appendChild(image), cellGroup;
69150
+ return image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, cellGroup.appendChild(image), image.successCallback = () => {
69151
+ isDamagePic(image) && (updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table), table.scenegraph.updateNextFrame());
69152
+ }, cellGroup;
68753
69153
  }
68754
69154
 
68755
69155
  function createMark(marked, cellGroup, table) {
@@ -69780,8 +70180,8 @@
69780
70180
  }(ExcelEditCellKeyboardResponse || (ExcelEditCellKeyboardResponse = {}));
69781
70181
  class ExcelEditCellKeyboardPlugin {
69782
70182
  constructor(pluginOptions) {
69783
- var _a, _b;
69784
- this.id = "excel-edit-cell-keyboard", this.name = "Excel Edit Cell Keyboard", this.runTime = [TABLE_EVENT_TYPE.INITIALIZED], this.id = null !== (_a = null == pluginOptions ? void 0 : pluginOptions.id) && void 0 !== _a ? _a : this.id, this.pluginOptions = pluginOptions, this.responseKeyboard = null !== (_b = null == pluginOptions ? void 0 : pluginOptions.responseKeyboard) && void 0 !== _b ? _b : [ExcelEditCellKeyboardResponse.ENTER, ExcelEditCellKeyboardResponse.TAB, ExcelEditCellKeyboardResponse.ARROW_LEFT, ExcelEditCellKeyboardResponse.ARROW_RIGHT, ExcelEditCellKeyboardResponse.ARROW_DOWN, ExcelEditCellKeyboardResponse.ARROW_UP, ExcelEditCellKeyboardResponse.DELETE, ExcelEditCellKeyboardResponse.BACKSPACE], this.bindEvent();
70183
+ var _a, _b, _c;
70184
+ this.id = "excel-edit-cell-keyboard", this.name = "Excel Edit Cell Keyboard", this.runTime = [TABLE_EVENT_TYPE.INITIALIZED], this.id = null !== (_a = null == pluginOptions ? void 0 : pluginOptions.id) && void 0 !== _a ? _a : this.id, this.pluginOptions = pluginOptions, this.responseKeyboard = null !== (_b = null == pluginOptions ? void 0 : pluginOptions.responseKeyboard) && void 0 !== _b ? _b : [ExcelEditCellKeyboardResponse.ENTER, ExcelEditCellKeyboardResponse.TAB, ExcelEditCellKeyboardResponse.ARROW_LEFT, ExcelEditCellKeyboardResponse.ARROW_RIGHT, ExcelEditCellKeyboardResponse.ARROW_DOWN, ExcelEditCellKeyboardResponse.ARROW_UP, ExcelEditCellKeyboardResponse.DELETE, ExcelEditCellKeyboardResponse.BACKSPACE], this.batchCallChangeCellValuesApi = null !== (_c = null == pluginOptions ? void 0 : pluginOptions.batchCallChangeCellValuesApi) && void 0 !== _c && _c, this.bindEvent();
69785
70185
  }
69786
70186
  run(...args) {
69787
70187
  const table = args[2];
@@ -69812,7 +70212,7 @@
69812
70212
  (null == selectCells ? void 0 : selectCells.length) > 0 && (document.activeElement === this.table.getElement() || Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some(editor => {
69813
70213
  var _a;
69814
70214
  return (null === (_a = editor.getInputElement) || void 0 === _a ? void 0 : _a.call(editor)) === document.activeElement;
69815
- })) && (deleteSelectRange(selectCells, this.table, null === (_c = null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.deleteWorkOnEditableCell) || void 0 === _c || _c), event.stopPropagation(), event.preventDefault());
70215
+ })) && (deleteSelectRange(selectCells, this.table, null === (_c = null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.deleteWorkOnEditableCell) || void 0 === _c || _c, this.batchCallChangeCellValuesApi), event.stopPropagation(), event.preventDefault());
69816
70216
  }
69817
70217
  } else this.table.editorManager.completeEdit(), this.table.getElement().focus(), eventKey === ExcelEditCellKeyboardResponse.ENTER ? this.table.selectCell(col, row + 1) : eventKey === ExcelEditCellKeyboardResponse.TAB && this.table.selectCell(col + 1, row), event.stopPropagation(), event.preventDefault();
69818
70218
  }
@@ -69834,8 +70234,11 @@
69834
70234
  document.removeEventListener("keydown", this.handleKeyDown, !0);
69835
70235
  }
69836
70236
  }
69837
- function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1) {
69838
- for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "", workOnEditableCell);
70237
+ function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1, batchCallChangeCellValuesApi = !1) {
70238
+ if (batchCallChangeCellValuesApi) {
70239
+ const ranges = tableInstance.stateManager.select.ranges;
70240
+ (null == ranges ? void 0 : ranges.length) && tableInstance.changeCellValuesByRanges(ranges, "", workOnEditableCell, !0);
70241
+ } else for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "", workOnEditableCell);
69839
70242
  }
69840
70243
 
69841
70244
  const MENU_CONTAINER_CLASS = "vtable-context-menu-container";
@@ -86841,9 +87244,6 @@
86841
87244
  return;
86842
87245
  }
86843
87246
  try {
86844
- if (this.sheetMapping.size <= 1) {
86845
- throw new Error('Cannot remove the last sheet');
86846
- }
86847
87247
  this.formulaEngine.removeSheet(sheetKey);
86848
87248
  this.sheetMapping.delete(sheetKey);
86849
87249
  this.reverseSheetMapping.delete(sheetId);
@@ -86959,16 +87359,26 @@
86959
87359
  return null;
86960
87360
  }
86961
87361
  }
87362
+ creatingSheets = new Set();
86962
87363
  ensureSheetRegistered(sheetKey) {
86963
87364
  if (this.sheet.workSheetInstances.has(sheetKey)) {
86964
87365
  return;
86965
87366
  }
87367
+ if (this.creatingSheets.has(sheetKey)) {
87368
+ return;
87369
+ }
86966
87370
  const sheetDefine = this.sheet.getSheetManager().getSheet(sheetKey);
86967
87371
  if (!sheetDefine) {
86968
87372
  return;
86969
87373
  }
86970
- const instance = this.sheet.createWorkSheetInstance(sheetDefine);
86971
- this.sheet.workSheetInstances.set(sheetKey, instance);
87374
+ try {
87375
+ this.creatingSheets.add(sheetKey);
87376
+ const instance = this.sheet.createWorkSheetInstance(sheetDefine);
87377
+ this.sheet.workSheetInstances.set(sheetKey, instance);
87378
+ }
87379
+ finally {
87380
+ this.creatingSheets.delete(sheetKey);
87381
+ }
86972
87382
  }
86973
87383
  ensureAllSheetsRegisteredForCrossSheetFormula(formula) {
86974
87384
  try {
@@ -87029,7 +87439,7 @@
87029
87439
  worksheet = workSheetInstances.get(cell.sheet);
87030
87440
  }
87031
87441
  }
87032
- catch (e) {
87442
+ catch (_e) {
87033
87443
  return;
87034
87444
  }
87035
87445
  }
@@ -87070,6 +87480,7 @@
87070
87480
  throw new Error(`Cell coordinates out of bounds: row=${cell.row}, col=${cell.col}`);
87071
87481
  }
87072
87482
  try {
87483
+ this.formulaEngine.setActiveSheet(cell.sheet);
87073
87484
  const isFormula = typeof value === 'string' && value.startsWith('=');
87074
87485
  const oldFormula = this.getCellFormula(cell);
87075
87486
  if (isFormula && this.hasCrossSheetReference(value)) {
@@ -87108,6 +87519,7 @@
87108
87519
  return result;
87109
87520
  }
87110
87521
  this.ensureSheetRegistered(cell.sheet);
87522
+ this.formulaEngine.setActiveSheet(cell.sheet);
87111
87523
  return this.formulaEngine.getCellValue(cell);
87112
87524
  }
87113
87525
  catch (error) {
@@ -87176,7 +87588,7 @@
87176
87588
  });
87177
87589
  this.sheet
87178
87590
  .getActiveSheet()
87179
- .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
87591
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value, false, false);
87180
87592
  });
87181
87593
  }
87182
87594
  catch (error) {
@@ -87195,7 +87607,7 @@
87195
87607
  });
87196
87608
  this.sheet
87197
87609
  .getActiveSheet()
87198
- .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
87610
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value, false, false);
87199
87611
  });
87200
87612
  }
87201
87613
  catch (error) {
@@ -87214,7 +87626,7 @@
87214
87626
  });
87215
87627
  this.sheet
87216
87628
  .getActiveSheet()
87217
- .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
87629
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value, false, false);
87218
87630
  });
87219
87631
  }
87220
87632
  catch (error) {
@@ -87233,7 +87645,7 @@
87233
87645
  });
87234
87646
  this.sheet
87235
87647
  .getActiveSheet()
87236
- .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
87648
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value, false, false);
87237
87649
  });
87238
87650
  }
87239
87651
  catch (error) {
@@ -87255,7 +87667,7 @@
87255
87667
  const result = this.getCellValue(cell);
87256
87668
  this.sheet
87257
87669
  .getActiveSheet()
87258
- .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
87670
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value, false, false);
87259
87671
  }
87260
87672
  }
87261
87673
  catch (error) {
@@ -87275,7 +87687,7 @@
87275
87687
  const result = this.getCellValue(cell);
87276
87688
  this.sheet
87277
87689
  .getActiveSheet()
87278
- .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
87690
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value, false, false);
87279
87691
  }
87280
87692
  }
87281
87693
  catch (error) {
@@ -87295,7 +87707,7 @@
87295
87707
  try {
87296
87708
  return this.formulaEngine.sortFormulasByDependency(sheetKey, formulas);
87297
87709
  }
87298
- catch (error) {
87710
+ catch (_error) {
87299
87711
  return Object.entries(formulas);
87300
87712
  }
87301
87713
  }
@@ -87407,7 +87819,7 @@
87407
87819
  const validationResult = this.validateFormula(formula);
87408
87820
  return validationResult.isValid;
87409
87821
  }
87410
- catch (error) {
87822
+ catch (_error) {
87411
87823
  return false;
87412
87824
  }
87413
87825
  }
@@ -87429,6 +87841,40 @@
87429
87841
  }
87430
87842
  resumeEvaluation() {
87431
87843
  }
87844
+ rebuildFormulas(sheets) {
87845
+ try {
87846
+ if (this.formulaEngine) {
87847
+ try {
87848
+ this.formulaEngine.release();
87849
+ }
87850
+ catch (error) {
87851
+ }
87852
+ }
87853
+ this.sheetMapping.clear();
87854
+ this.reverseSheetMapping.clear();
87855
+ this.nextSheetId = 0;
87856
+ this.initializeFormulaEngine();
87857
+ if (this.crossSheetHandler) {
87858
+ try {
87859
+ this.crossSheetHandler.destroy();
87860
+ }
87861
+ catch (error) {
87862
+ }
87863
+ }
87864
+ this.crossSheetHandler = new CrossSheetFormulaHandler(this.formulaEngine, this.sheet.getSheetManager(), this);
87865
+ sheets.forEach((sheetDefine) => {
87866
+ const sheetKey = sheetDefine.sheetKey;
87867
+ const worksheetInstance = this.sheet.workSheetInstances.get(sheetKey);
87868
+ if (!worksheetInstance || !worksheetInstance.tableInstance) {
87869
+ return;
87870
+ }
87871
+ const normalizedData = this.normalizeSheetData(worksheetInstance.getData(), worksheetInstance.tableInstance);
87872
+ this.addSheet(sheetKey, normalizedData, sheetDefine.sheetTitle);
87873
+ });
87874
+ }
87875
+ catch (error) {
87876
+ }
87877
+ }
87432
87878
  rebuildAndRecalculate() {
87433
87879
  }
87434
87880
  clearContent() {
@@ -87707,6 +88153,18 @@
87707
88153
  getAllSheets() {
87708
88154
  return Array.from(this._sheets.values());
87709
88155
  }
88156
+ sortSheets(sheets) {
88157
+ const sheetsArray = Array.from(this._sheets.entries());
88158
+ sheetsArray.sort(([keyA], [keyB]) => {
88159
+ const aIndex = sheets.findIndex(s => s.sheetKey === keyA);
88160
+ const bIndex = sheets.findIndex(s => s.sheetKey === keyB);
88161
+ return aIndex - bIndex;
88162
+ });
88163
+ this._sheets.clear();
88164
+ sheetsArray.forEach(([key, sheet]) => {
88165
+ this._sheets.set(key, sheet);
88166
+ });
88167
+ }
87710
88168
  getSheet(sheetKey) {
87711
88169
  return this._sheets.get(sheetKey) || null;
87712
88170
  }
@@ -88284,11 +88742,35 @@
88284
88742
  showCopyCellBorder: true,
88285
88743
  cutSelected: true
88286
88744
  };
88745
+ return {
88746
+ ...this.options,
88747
+ dragOrder: {
88748
+ maintainArrayDataOrder: true
88749
+ },
88750
+ addRecordRule: 'Array',
88751
+ defaultCursor: 'cell',
88752
+ records: this.options.data,
88753
+ sortState: this.options.sortState,
88754
+ container: this.element,
88755
+ showHeader: isShowTableHeader,
88756
+ keyboardOptions,
88757
+ theme: this._adjustTheme(this.options.theme),
88758
+ excelOptions: {
88759
+ fillHandle: true
88760
+ },
88761
+ customConfig: {
88762
+ selectCellWhenCellEditorNotExists: true
88763
+ }
88764
+ };
88765
+ }
88766
+ _adjustTheme(theme) {
88287
88767
  let changedTheme;
88288
- if (!this.options?.theme) {
88768
+ if (!theme) {
88289
88769
  this.options.theme = DEFAULT;
88290
88770
  }
88291
- this.options.theme = this.options.theme;
88771
+ else {
88772
+ this.options.theme = theme;
88773
+ }
88292
88774
  if (this.options.theme.bodyStyle && !isPropertyWritable(this.options.theme, 'bodyStyle')) {
88293
88775
  changedTheme = this.options.theme.extends(this.options.theme.getExtendTheme());
88294
88776
  const extendThemeOption = changedTheme.getExtendTheme();
@@ -88309,26 +88791,7 @@
88309
88791
  });
88310
88792
  }
88311
88793
  }
88312
- return {
88313
- ...this.options,
88314
- dragOrder: {
88315
- maintainArrayDataOrder: true
88316
- },
88317
- addRecordRule: 'Array',
88318
- defaultCursor: 'cell',
88319
- records: this.options.data,
88320
- sortState: this.options.sortState,
88321
- container: this.element,
88322
- showHeader: isShowTableHeader,
88323
- keyboardOptions,
88324
- theme: changedTheme,
88325
- excelOptions: {
88326
- fillHandle: true
88327
- },
88328
- customConfig: {
88329
- selectCellWhenCellEditorNotExists: true
88330
- }
88331
- };
88794
+ return changedTheme;
88332
88795
  }
88333
88796
  _setupEventListeners() {
88334
88797
  if (this.tableInstance) {
@@ -88719,6 +89182,9 @@
88719
89182
  }
88720
89183
  else {
88721
89184
  col = coordOrCol;
89185
+ if (row === undefined) {
89186
+ throw new Error('row is required when coordOrCol is a number');
89187
+ }
88722
89188
  rowNum = row;
88723
89189
  }
88724
89190
  let colStr = '';
@@ -88781,13 +89247,23 @@
88781
89247
  }
88782
89248
  }
88783
89249
  data.shift();
89250
+ const { dragOrder: _omitSheetDragOrder, ...optionsRest } = this.options;
88784
89251
  this.tableInstance.updateOption({
88785
- ...this.options,
89252
+ ...optionsRest,
89253
+ dragOrder: { maintainArrayDataOrder: true },
88786
89254
  columns: this.options.columns,
88787
89255
  showHeader: true,
88788
89256
  records: data
88789
89257
  });
88790
89258
  }
89259
+ updateSheetOption(sheetOption) {
89260
+ this.options = {
89261
+ ...this.options,
89262
+ ...sheetOption
89263
+ };
89264
+ const tableOptions = this._generateTableOptions();
89265
+ this.tableInstance.updateOption(tableOptions);
89266
+ }
88791
89267
  processFormulaPaste(formulas, sourceStartCol, _sourceStartRow, targetStartCol, _targetStartRow) {
88792
89268
  if (!formulas || formulas.length === 0) {
88793
89269
  return formulas;
@@ -89145,11 +89621,17 @@
89145
89621
  table.scenegraph.updateNextFrame();
89146
89622
  }
89147
89623
  function createFormulaDetectionOptions(sheetDefine, options, vtableSheet) {
89624
+ const getActiveSheetKey = () => {
89625
+ return (vtableSheet?.getActiveSheet?.()?.getKey?.() ||
89626
+ vtableSheet?.sheetManager?.getActiveSheet?.()?.sheetKey ||
89627
+ sheetDefine?.sheetKey ||
89628
+ 'Sheet1');
89629
+ };
89148
89630
  return {
89149
89631
  isFormulaCell: (col, row, cellData, table) => {
89150
89632
  if (vtableSheet?.formulaManager) {
89151
89633
  try {
89152
- const sheetName = vtableSheet.sheetManager?._activeSheetKey || 'Sheet1';
89634
+ const sheetName = getActiveSheetKey();
89153
89635
  return vtableSheet.formulaManager.isCellFormula({
89154
89636
  sheet: sheetName,
89155
89637
  row: row,
@@ -89168,7 +89650,7 @@
89168
89650
  getCellFormula: (col, row, cellData, table) => {
89169
89651
  if (vtableSheet?.formulaManager) {
89170
89652
  try {
89171
- const sheetName = vtableSheet.sheetManager?._activeSheetKey || 'Sheet1';
89653
+ const sheetName = getActiveSheetKey();
89172
89654
  return vtableSheet.formulaManager.getCellFormula({
89173
89655
  sheet: sheetName,
89174
89656
  row: row,
@@ -89187,7 +89669,7 @@
89187
89669
  setCellFormula: (col, row, formula, table) => {
89188
89670
  if (vtableSheet?.formulaManager) {
89189
89671
  try {
89190
- const sheetName = vtableSheet.sheetManager?._activeSheetKey || 'Sheet1';
89672
+ const sheetName = getActiveSheetKey();
89191
89673
  vtableSheet.formulaManager.setCellContent({
89192
89674
  sheet: sheetName,
89193
89675
  row: row,
@@ -89652,6 +90134,10 @@
89652
90134
  this.clickOutsideHandler = null;
89653
90135
  }
89654
90136
  }
90137
+ updateMainMenu(mainMenu) {
90138
+ this.release();
90139
+ this.createMainMenu();
90140
+ }
89655
90141
  }
89656
90142
 
89657
90143
  class SheetTabEventHandler {
@@ -89858,6 +90344,9 @@
89858
90344
  }, 100);
89859
90345
  }
89860
90346
  activeSheetMenuItem() {
90347
+ if (this.vTableSheet.getOptions()?.showSheetTab === false) {
90348
+ return;
90349
+ }
89861
90350
  const menuItems = this.vTableSheet
89862
90351
  .getSheetTabElement()
89863
90352
  ?.querySelectorAll('.vtable-sheet-main-menu-item');
@@ -89984,6 +90473,8 @@
89984
90473
  }
89985
90474
  });
89986
90475
  }
90476
+ this.boundSheets.delete(sheetKey);
90477
+ this.cleanupCallbacks.delete(sheetKey);
89987
90478
  }
89988
90479
  unbindFromAllSheets(eventType) {
89989
90480
  this.vtableSheet.workSheetInstances.forEach((worksheet, sheetKey) => {
@@ -90415,6 +90906,9 @@
90415
90906
  return sheetTab;
90416
90907
  }
90417
90908
  _activeSheetTab() {
90909
+ if (this.options.showSheetTab === false) {
90910
+ return;
90911
+ }
90418
90912
  this.sheetTabEventHandler.activeSheetTab();
90419
90913
  }
90420
90914
  updateSheetTabs(tabsContainer = this.sheetTabElement?.querySelector('.vtable-sheet-tabs-container')) {
@@ -90428,7 +90922,7 @@
90428
90922
  });
90429
90923
  this._activeSheetTab();
90430
90924
  }
90431
- createSheetTabItem(sheet, index) {
90925
+ createSheetTabItem(sheet, _index) {
90432
90926
  const tab = document.createElement('div');
90433
90927
  tab.className = 'vtable-sheet-tab';
90434
90928
  tab.dataset.key = sheet.sheetKey;
@@ -90440,6 +90934,9 @@
90440
90934
  return tab;
90441
90935
  }
90442
90936
  updateSheetMenu() {
90937
+ if (this.options.showSheetTab === false) {
90938
+ return;
90939
+ }
90443
90940
  this.sheetTabEventHandler.updateSheetMenu();
90444
90941
  }
90445
90942
  initSheets() {
@@ -90478,6 +90975,9 @@
90478
90975
  });
90479
90976
  if (this.workSheetInstances.has(sheetKey)) {
90480
90977
  const instance = this.workSheetInstances.get(sheetKey);
90978
+ if (!instance) {
90979
+ throw new Error(`Worksheet instance for key "${sheetKey}" not found`);
90980
+ }
90481
90981
  instance.getElement().style.display = 'block';
90482
90982
  this.activeWorkSheet = instance;
90483
90983
  if (instance.tableInstance) {
@@ -90553,18 +91053,14 @@
90553
91053
  select: {
90554
91054
  makeSelectCellVisible: false
90555
91055
  },
90556
- style: {
90557
- borderColor: ['#E1E4E8', '#E1E4E8', '#E1E4E8', '#E1E4E8'],
90558
- borderLineWidth: [1, 1, 1, 1],
90559
- borderLineDash: [null, null, null, null],
90560
- padding: [8, 8, 8, 8]
90561
- },
90562
91056
  editCellTrigger: ['api', 'keydown', 'doubleclick'],
90563
91057
  customMergeCell: sheetDefine.cellMerge,
90564
91058
  theme: sheetDefine.theme?.tableTheme || this.options.theme?.tableTheme
90565
91059
  });
90566
91060
  try {
90567
- const normalizedData = this.formulaManager.normalizeSheetData(sheetDefine.data, sheet.tableInstance);
91061
+ const normalizedData = sheetDefine.data
91062
+ ? this.formulaManager.normalizeSheetData(sheetDefine.data, sheet.tableInstance)
91063
+ : [];
90568
91064
  this.formulaManager.addSheet(sheetDefine.sheetKey, normalizedData, sheetDefine.sheetTitle);
90569
91065
  if (sheetDefine.formulas && Object.keys(sheetDefine.formulas).length > 0) {
90570
91066
  this.loadFormulas(sheetDefine.sheetKey, sheetDefine.formulas);
@@ -90584,7 +91080,6 @@
90584
91080
  const { row, col } = this.parseCellKey(cellRef);
90585
91081
  this.formulaManager.setCellContent({ sheet: sheetKey, row, col }, formula);
90586
91082
  }
90587
- this.formulaManager.rebuildAndRecalculate();
90588
91083
  }
90589
91084
  catch (error) {
90590
91085
  }
@@ -90725,7 +91220,7 @@
90725
91220
  currentSortState = sortState.map(item => ({
90726
91221
  field: item.field,
90727
91222
  order: item.order,
90728
- ...(item.orderFn != null && { orderFn: item.orderFn })
91223
+ ...(item.orderFn !== null && item.orderFn !== undefined && { orderFn: item.orderFn })
90729
91224
  }));
90730
91225
  }
90731
91226
  const formulas = this.formulaManager.exportFormulas(sheetDefine.sheetKey);
@@ -90744,7 +91239,7 @@
90744
91239
  sheets.push({
90745
91240
  ...sheetDefine,
90746
91241
  data,
90747
- columns,
91242
+ columns: columns,
90748
91243
  cellMerge: instance.tableInstance.options.customMergeCell,
90749
91244
  showHeader: instance.tableInstance.options.showHeader,
90750
91245
  frozenRowCount: instance.tableInstance.frozenRowCount,
@@ -90766,6 +91261,150 @@
90766
91261
  sheets
90767
91262
  };
90768
91263
  }
91264
+ updateMainMenu(mainMenu) {
91265
+ this.options.mainMenu = mainMenu;
91266
+ this.menuManager.updateMainMenu(mainMenu);
91267
+ }
91268
+ updateOption(options) {
91269
+ if (!options) {
91270
+ return;
91271
+ }
91272
+ const hasMainMenu = typeof options.mainMenu !== 'undefined';
91273
+ if (hasMainMenu) {
91274
+ this.updateMainMenu(options.mainMenu);
91275
+ }
91276
+ const pluginModulesChanged = pluginIsChanged(this.options.VTablePluginModules, options.VTablePluginModules);
91277
+ const tableThemeChanged = tableThemeIsChanged(this.options.theme?.tableTheme, options.theme?.tableTheme);
91278
+ this.options = {
91279
+ ...this.options,
91280
+ ...options
91281
+ };
91282
+ if (Array.isArray(options.sheets) || pluginModulesChanged || tableThemeChanged) {
91283
+ this.updateSheets(options);
91284
+ }
91285
+ }
91286
+ updateSheets(options) {
91287
+ const nextSheets = options.sheets || [];
91288
+ const prevSheets = this.sheetManager.getAllSheets();
91289
+ const prevMap = new Map();
91290
+ prevSheets.forEach(sheet => {
91291
+ prevMap.set(sheet.sheetKey, sheet);
91292
+ });
91293
+ const added = [];
91294
+ const updated = [];
91295
+ nextSheets.forEach(next => {
91296
+ const prev = prevMap.get(next.sheetKey);
91297
+ if (!prev) {
91298
+ added.push(next);
91299
+ }
91300
+ else {
91301
+ updated.push({ prev, next });
91302
+ prevMap.delete(next.sheetKey);
91303
+ }
91304
+ });
91305
+ const removedKeys = Array.from(prevMap.keys());
91306
+ removedKeys.forEach(sheetKey => {
91307
+ const instance = this.workSheetInstances.get(sheetKey);
91308
+ if (instance) {
91309
+ instance.release();
91310
+ this.workSheetInstances.delete(sheetKey);
91311
+ }
91312
+ try {
91313
+ this.sheetManager.removeSheet(sheetKey);
91314
+ this.formulaManager.removeSheet(sheetKey);
91315
+ }
91316
+ catch (error) {
91317
+ }
91318
+ });
91319
+ added.forEach(sheetDefine => {
91320
+ this.sheetManager.addSheet(sheetDefine);
91321
+ const instance = this.createWorkSheetInstance(sheetDefine);
91322
+ this.workSheetInstances.set(sheetDefine.sheetKey, instance);
91323
+ });
91324
+ updated.forEach(({ prev, next: next_sheetDefine }) => {
91325
+ const instance = this.workSheetInstances.get(next_sheetDefine.sheetKey);
91326
+ Object.assign(prev, next_sheetDefine);
91327
+ if (!instance) {
91328
+ const newInstance = this.createWorkSheetInstance(next_sheetDefine);
91329
+ this.workSheetInstances.set(next_sheetDefine.sheetKey, newInstance);
91330
+ return;
91331
+ }
91332
+ const sheetOption = {
91333
+ sheetTitle: next_sheetDefine.sheetTitle,
91334
+ sheetKey: next_sheetDefine.sheetKey,
91335
+ showHeader: next_sheetDefine.showHeader,
91336
+ frozenRowCount: next_sheetDefine.frozenRowCount,
91337
+ frozenColCount: next_sheetDefine.frozenColCount,
91338
+ filter: next_sheetDefine.filter,
91339
+ filterState: next_sheetDefine.filterState,
91340
+ sortState: next_sheetDefine.sortState,
91341
+ columnWidthConfig: next_sheetDefine.columnWidthConfig,
91342
+ rowHeightConfig: next_sheetDefine.rowHeightConfig,
91343
+ defaultRowHeight: this.options.defaultRowHeight,
91344
+ defaultColWidth: this.options.defaultColWidth,
91345
+ dragOrder: next_sheetDefine.dragOrder,
91346
+ plugins: getTablePlugins(next_sheetDefine, this.options, this),
91347
+ headerEditor: 'formula',
91348
+ editor: 'formula',
91349
+ select: {
91350
+ makeSelectCellVisible: false
91351
+ },
91352
+ editCellTrigger: ['api', 'keydown', 'doubleclick'],
91353
+ customMergeCell: next_sheetDefine.cellMerge,
91354
+ theme: next_sheetDefine.theme?.tableTheme || this.options.theme?.tableTheme,
91355
+ data: next_sheetDefine.data,
91356
+ columns: next_sheetDefine.columns
91357
+ };
91358
+ instance.updateSheetOption(sheetOption);
91359
+ });
91360
+ try {
91361
+ this.formulaManager.rebuildFormulas(nextSheets);
91362
+ nextSheets.forEach(sheetDefine => {
91363
+ const worksheetInstance = this.workSheetInstances.get(sheetDefine.sheetKey);
91364
+ if (!worksheetInstance || !worksheetInstance.tableInstance) {
91365
+ return;
91366
+ }
91367
+ const dataToUse = sheetDefine.data || worksheetInstance.getData();
91368
+ const normalizedData = this.formulaManager.normalizeSheetData(dataToUse, worksheetInstance.tableInstance);
91369
+ this.formulaManager.formulaEngine.updateSheetData(sheetDefine.sheetKey, normalizedData);
91370
+ if (sheetDefine.formulas && Object.keys(sheetDefine.formulas).length > 0) {
91371
+ this.loadFormulas(sheetDefine.sheetKey, sheetDefine.formulas);
91372
+ }
91373
+ });
91374
+ updated.forEach(({ prev, next: next_sheetDefine }) => {
91375
+ const hadFormulas = prev.formulas && Object.keys(prev.formulas).length > 0;
91376
+ const hasFormulas = next_sheetDefine.formulas && Object.keys(next_sheetDefine.formulas).length > 0;
91377
+ if (!hadFormulas || hasFormulas) {
91378
+ return;
91379
+ }
91380
+ const worksheetInstance = this.workSheetInstances.get(next_sheetDefine.sheetKey);
91381
+ if (!worksheetInstance) {
91382
+ return;
91383
+ }
91384
+ const data = next_sheetDefine.data || worksheetInstance.getData();
91385
+ Object.keys(prev.formulas).forEach(cellRef => {
91386
+ try {
91387
+ const { row, col } = this.parseCellKey(cellRef);
91388
+ const cellValue = data?.[row]?.[col];
91389
+ if (typeof cellValue !== 'undefined') {
91390
+ this.formulaManager.setCellContent({ sheet: next_sheetDefine.sheetKey, row, col }, cellValue);
91391
+ }
91392
+ }
91393
+ catch (error) {
91394
+ }
91395
+ });
91396
+ });
91397
+ }
91398
+ catch (error) {
91399
+ }
91400
+ this.sheetManager.sortSheets(this.options.sheets);
91401
+ this.updateSheetTabs();
91402
+ this.updateSheetMenu();
91403
+ const activeDefine = nextSheets.find(s => s.active) || nextSheets[0];
91404
+ if (activeDefine) {
91405
+ this.activateSheet(activeDefine.sheetKey);
91406
+ }
91407
+ }
90769
91408
  exportSheetToFile(fileType, allSheets = true) {
90770
91409
  try {
90771
91410
  this.spreadsheetEventManager.emitExportStart(fileType, allSheets);
@@ -90810,6 +91449,9 @@
90810
91449
  const allDefines = this.sheetManager.getAllSheets();
90811
91450
  const tables = allDefines.map(def => {
90812
91451
  const inst = this.workSheetInstances.get(def.sheetKey);
91452
+ if (!inst) {
91453
+ throw new Error(`Worksheet instance for key "${def.sheetKey}" not found during export`);
91454
+ }
90813
91455
  return { table: inst.tableInstance, name: def.sheetTitle || def.sheetKey };
90814
91456
  });
90815
91457
  this._exportMutipleTablesToExcel?.(tables);
@@ -92318,7 +92960,7 @@
92318
92960
  importStyle();
92319
92961
  }
92320
92962
 
92321
- const version = "1.23.1-alpha.2";
92963
+ const version = "1.23.2";
92322
92964
  importStyles();
92323
92965
 
92324
92966
  exports.TYPES = index;