@visactor/vtable 1.22.11-alpha.9 → 1.22.11

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 (103) hide show
  1. package/cjs/ListTable.d.ts +7 -34
  2. package/cjs/ListTable.js +18 -138
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable-all.js.map +1 -1
  5. package/cjs/components/index.js +1 -1
  6. package/cjs/core/BaseTable.d.ts +3 -0
  7. package/cjs/core/BaseTable.js +22 -6
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/core/TABLE_EVENT_TYPE.d.ts +0 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.js +0 -1
  11. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  12. package/cjs/core/record-helper.d.ts +2 -4
  13. package/cjs/core/record-helper.js +47 -120
  14. package/cjs/core/record-helper.js.map +1 -1
  15. package/cjs/data/DataSource.d.ts +4 -13
  16. package/cjs/data/DataSource.js +60 -174
  17. package/cjs/data/DataSource.js.map +1 -1
  18. package/cjs/dataset/dataset.js +92 -84
  19. package/cjs/dataset/dataset.js.map +1 -1
  20. package/cjs/edit/edit-manager.js +10 -9
  21. package/cjs/edit/edit-manager.js.map +1 -1
  22. package/cjs/event/event.d.ts +1 -2
  23. package/cjs/event/event.js +9 -20
  24. package/cjs/event/event.js.map +1 -1
  25. package/cjs/index.d.ts +1 -1
  26. package/cjs/index.js +1 -1
  27. package/cjs/index.js.map +1 -1
  28. package/cjs/layout/pivot-header-layout.js +1 -1
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/plugins/custom-cell-style.d.ts +5 -5
  31. package/cjs/plugins/custom-cell-style.js +64 -25
  32. package/cjs/plugins/custom-cell-style.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  34. package/cjs/scenegraph/layout/update-row.js +16 -1
  35. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  36. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  37. package/cjs/state/select/update-position.js +3 -3
  38. package/cjs/state/select/update-position.js.map +1 -1
  39. package/cjs/ts-types/base-table.d.ts +5 -2
  40. package/cjs/ts-types/base-table.js.map +1 -1
  41. package/cjs/ts-types/events.d.ts +0 -15
  42. package/cjs/ts-types/events.js.map +1 -1
  43. package/cjs/ts-types/new-data-set.d.ts +1 -0
  44. package/cjs/ts-types/new-data-set.js.map +1 -1
  45. package/cjs/ts-types/table-engine.d.ts +6 -33
  46. package/cjs/ts-types/table-engine.js.map +1 -1
  47. package/cjs/vrender.js.map +1 -1
  48. package/dist/vtable.js +332 -735
  49. package/dist/vtable.min.js +2 -2
  50. package/es/ListTable.d.ts +7 -34
  51. package/es/ListTable.js +18 -134
  52. package/es/ListTable.js.map +1 -1
  53. package/es/PivotTable-all.js.map +1 -1
  54. package/es/components/index.js +1 -1
  55. package/es/core/BaseTable.d.ts +3 -0
  56. package/es/core/BaseTable.js +22 -6
  57. package/es/core/BaseTable.js.map +1 -1
  58. package/es/core/TABLE_EVENT_TYPE.d.ts +0 -1
  59. package/es/core/TABLE_EVENT_TYPE.js +0 -1
  60. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  61. package/es/core/record-helper.d.ts +2 -4
  62. package/es/core/record-helper.js +43 -114
  63. package/es/core/record-helper.js.map +1 -1
  64. package/es/data/DataSource.d.ts +4 -13
  65. package/es/data/DataSource.js +60 -174
  66. package/es/data/DataSource.js.map +1 -1
  67. package/es/dataset/dataset.js +92 -84
  68. package/es/dataset/dataset.js.map +1 -1
  69. package/es/edit/edit-manager.js +10 -9
  70. package/es/edit/edit-manager.js.map +1 -1
  71. package/es/event/event.d.ts +1 -2
  72. package/es/event/event.js +9 -20
  73. package/es/event/event.js.map +1 -1
  74. package/es/index.d.ts +1 -1
  75. package/es/index.js +1 -1
  76. package/es/index.js.map +1 -1
  77. package/es/layout/pivot-header-layout.js +1 -1
  78. package/es/layout/pivot-header-layout.js.map +1 -1
  79. package/es/plugins/custom-cell-style.d.ts +5 -5
  80. package/es/plugins/custom-cell-style.js +62 -25
  81. package/es/plugins/custom-cell-style.js.map +1 -1
  82. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  83. package/es/scenegraph/layout/update-row.js +16 -1
  84. package/es/scenegraph/layout/update-row.js.map +1 -1
  85. package/es/scenegraph/select/update-select-border.js.map +1 -1
  86. package/es/state/select/update-position.js +4 -2
  87. package/es/state/select/update-position.js.map +1 -1
  88. package/es/ts-types/base-table.d.ts +5 -2
  89. package/es/ts-types/base-table.js.map +1 -1
  90. package/es/ts-types/events.d.ts +0 -15
  91. package/es/ts-types/events.js.map +1 -1
  92. package/es/ts-types/new-data-set.d.ts +1 -0
  93. package/es/ts-types/new-data-set.js.map +1 -1
  94. package/es/ts-types/table-engine.d.ts +6 -33
  95. package/es/ts-types/table-engine.js.map +1 -1
  96. package/es/vrender.js.map +1 -1
  97. package/package.json +3 -3
  98. package/cjs/core/index.d.ts +0 -1
  99. package/cjs/core/index.js +0 -30
  100. package/cjs/core/index.js.map +0 -1
  101. package/es/core/index.d.ts +0 -1
  102. package/es/core/index.js +0 -2
  103. package/es/core/index.js.map +0 -1
package/dist/vtable.js CHANGED
@@ -36410,7 +36410,6 @@
36410
36410
  AFTER_UPDATE_CELL_CONTENT_WIDTH: 'after_update_cell_content_width',
36411
36411
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: 'after_update_select_border_height',
36412
36412
  CHANGE_CELL_VALUE: 'change_cell_value',
36413
- CHANGE_CELL_VALUES: 'change_cell_values',
36414
36413
  DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
36415
36414
  MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
36416
36415
  DBLCLICK_FILL_HANDLE: 'dblclick_fill_handle',
@@ -38508,7 +38507,6 @@
38508
38507
  _sourceLength;
38509
38508
  _source;
38510
38509
  sortedIndexMap;
38511
- _forceVisibleRecords;
38512
38510
  lastSortStates;
38513
38511
  currentIndexedData = [];
38514
38512
  userPagination;
@@ -38934,48 +38932,6 @@
38934
38932
  }
38935
38933
  }
38936
38934
  }
38937
- changeFieldValueByRecordIndex(value, recordIndex, field, table) {
38938
- if (field === null) {
38939
- return undefined;
38940
- }
38941
- if (recordIndex === undefined || recordIndex === null) {
38942
- return;
38943
- }
38944
- const rawKey = recordIndex.toString();
38945
- if (!this.beforeChangedRecordsMap.has(rawKey)) {
38946
- const rawRecords = Array.isArray(this.dataSourceObj?.records)
38947
- ? this.dataSourceObj.records
38948
- : null;
38949
- const originRecord = rawRecords
38950
- ? Array.isArray(recordIndex)
38951
- ? getValueFromDeepArray(rawRecords, recordIndex)
38952
- : rawRecords[recordIndex]
38953
- : undefined;
38954
- this.beforeChangedRecordsMap.set(rawKey, cloneDeep(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {});
38955
- }
38956
- if (typeof field === 'string' || typeof field === 'number') {
38957
- const beforeChangedValue = this.beforeChangedRecordsMap.get(rawKey)?.[field];
38958
- const rawRecords = Array.isArray(this.dataSourceObj?.records)
38959
- ? this.dataSourceObj.records
38960
- : null;
38961
- const record = rawRecords
38962
- ? Array.isArray(recordIndex)
38963
- ? getValueFromDeepArray(rawRecords, recordIndex)
38964
- : rawRecords[recordIndex]
38965
- : undefined;
38966
- let formatValue = value;
38967
- if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {
38968
- formatValue = parseFloat(value);
38969
- }
38970
- if (record) {
38971
- record[field] = formatValue;
38972
- }
38973
- else if (rawRecords && typeof recordIndex === 'number') {
38974
- rawRecords[recordIndex] = this.addRecordRule === 'Array' ? [] : {};
38975
- rawRecords[recordIndex][field] = formatValue;
38976
- }
38977
- }
38978
- }
38979
38935
  cacheBeforeChangedRecord(dataIndex, table) {
38980
38936
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
38981
38937
  const originRecord = this.getOriginalRecord(dataIndex);
@@ -39001,165 +38957,69 @@
39001
38957
  }
39002
38958
  }
39003
38959
  }
39004
- _getRawRecordsArray() {
39005
- const rawRecords = this.dataSourceObj?.records;
39006
- return Array.isArray(rawRecords) ? rawRecords : null;
39007
- }
39008
- _hasFilterInEffect() {
39009
- return (this.dataConfig?.filterRules?.length ?? 0) >= 1 || (this.lastFilterRules?.length ?? 0) >= 1;
39010
- }
39011
- _normalizeInsertIndex(index, length) {
39012
- if (index === undefined || index === null) {
39013
- return length;
39014
- }
39015
- if (index > length) {
39016
- return length;
39017
- }
39018
- if (index < 0) {
39019
- return 0;
39020
- }
39021
- return index;
39022
- }
39023
- _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
39024
- if (this.records.length === 0) {
39025
- return rawRecords.length;
39026
- }
39027
- if (viewIndex <= 0) {
39028
- const firstVisibleRecord = this.records[0];
39029
- const rawIndex = rawRecords.indexOf(firstVisibleRecord);
39030
- return rawIndex >= 0 ? rawIndex : 0;
39031
- }
39032
- if (viewIndex >= this.records.length) {
39033
- const lastVisibleRecord = this.records[this.records.length - 1];
39034
- const rawIndex = rawRecords.indexOf(lastVisibleRecord);
39035
- return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
39036
- }
39037
- const prevRecord = this.records[viewIndex - 1];
39038
- const rawIndex = rawRecords.indexOf(prevRecord);
39039
- return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
39040
- }
39041
- _resetIndexingFromViewRecords() {
39042
- this._sourceLength = this.records.length;
39043
- this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
39044
- if (this.rowHierarchyType === 'tree') {
39045
- this.initTreeHierarchyState();
39046
- }
39047
- if (this.userPagination) {
39048
- this.pagination.totalCount = this._sourceLength;
39049
- this.updatePagerData();
39050
- return;
39051
- }
39052
- this.pagination.perPageCount = this._sourceLength;
39053
- this.pagination.totalCount = this._sourceLength;
39054
- this.updatePagerData();
39055
- }
39056
- addRecord(record, index, syncToOriginalRecords = false) {
39057
- if (!syncToOriginalRecords) {
39058
- if (Array.isArray(this.records)) {
39059
- this.records.splice(index, 0, record);
39060
- this.adjustBeforeChangedRecordsMap(index, 1);
39061
- this.currentIndexedData.push(this.currentIndexedData.length);
39062
- this._sourceLength += 1;
39063
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39064
- this.fieldAggregators[i].push(record);
39065
- }
39066
- if (this.rowHierarchyType === 'tree') {
39067
- this.initTreeHierarchyState();
39068
- }
39069
- if (this.userPagination) {
39070
- this.pagination.totalCount = this._sourceLength;
39071
- const { perPageCount, currentPage } = this.pagination;
39072
- const startIndex = perPageCount * (currentPage || 0);
39073
- const endIndex = startIndex + perPageCount;
39074
- if (index < endIndex) {
39075
- this.updatePagerData();
39076
- }
39077
- }
39078
- else {
39079
- this.pagination.perPageCount = this._sourceLength;
39080
- this.pagination.totalCount = this._sourceLength;
38960
+ addRecord(record, index) {
38961
+ if (Array.isArray(this.records)) {
38962
+ this.records.splice(index, 0, record);
38963
+ this.adjustBeforeChangedRecordsMap(index, 1);
38964
+ this.currentIndexedData.push(this.currentIndexedData.length);
38965
+ this._sourceLength += 1;
38966
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
38967
+ this.fieldAggregators[i].push(record);
38968
+ }
38969
+ if (this.rowHierarchyType === 'tree') {
38970
+ this.initTreeHierarchyState();
38971
+ }
38972
+ if (this.userPagination) {
38973
+ this.pagination.totalCount = this._sourceLength;
38974
+ const { perPageCount, currentPage } = this.pagination;
38975
+ const startIndex = perPageCount * (currentPage || 0);
38976
+ const endIndex = startIndex + perPageCount;
38977
+ if (index < endIndex) {
39081
38978
  this.updatePagerData();
39082
38979
  }
39083
- if (this.dataSourceObj?.added) {
39084
- this.dataSourceObj.added(index, 1);
39085
- }
39086
38980
  }
39087
- return;
39088
- }
39089
- const rawRecords = this._getRawRecordsArray();
39090
- if (!rawRecords) {
39091
- return;
39092
- }
39093
- const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length);
39094
- const rawInsertIndex = this._hasFilterInEffect()
39095
- ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex)
39096
- : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
39097
- rawRecords.splice(rawInsertIndex, 0, record);
39098
- if (syncToOriginalRecords && this._hasFilterInEffect()) {
39099
- this.markForceVisibleRecord(record);
39100
- }
39101
- this.beforeChangedRecordsMap.clear();
39102
- this.sortedIndexMap.clear();
39103
- this.updateFilterRules(this.dataConfig?.filterRules);
39104
- if (this.dataSourceObj?.added) {
39105
- this.dataSourceObj.added(rawInsertIndex, 1);
38981
+ else {
38982
+ this.pagination.perPageCount = this._sourceLength;
38983
+ this.pagination.totalCount = this._sourceLength;
38984
+ this.updatePagerData();
38985
+ }
38986
+ if (this.dataSourceObj?.added) {
38987
+ this.dataSourceObj.added(index, 1);
38988
+ }
39106
38989
  }
39107
38990
  }
39108
- addRecords(recordArr, index, syncToOriginalRecords = false) {
39109
- if (!syncToOriginalRecords) {
39110
- if (Array.isArray(this.records)) {
39111
- if (Array.isArray(recordArr)) {
39112
- this.records.splice(index, 0, ...recordArr);
39113
- this.adjustBeforeChangedRecordsMap(index, recordArr.length);
39114
- for (let i = 0; i < recordArr.length; i++) {
39115
- this.currentIndexedData.push(this.currentIndexedData.length);
39116
- }
39117
- this._sourceLength += recordArr.length;
39118
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39119
- for (let j = 0; j < recordArr.length; j++) {
39120
- this.fieldAggregators[i].push(recordArr[j]);
39121
- }
39122
- }
38991
+ addRecords(recordArr, index) {
38992
+ if (Array.isArray(this.records)) {
38993
+ if (Array.isArray(recordArr)) {
38994
+ this.records.splice(index, 0, ...recordArr);
38995
+ this.adjustBeforeChangedRecordsMap(index, recordArr.length);
38996
+ for (let i = 0; i < recordArr.length; i++) {
38997
+ this.currentIndexedData.push(this.currentIndexedData.length);
39123
38998
  }
39124
- if (this.userPagination) {
39125
- this.pagination.totalCount = this._sourceLength;
39126
- const { perPageCount, currentPage } = this.pagination;
39127
- const startIndex = perPageCount * (currentPage || 0);
39128
- const endIndex = startIndex + perPageCount;
39129
- if (index < endIndex) {
39130
- this.updatePagerData();
38999
+ this._sourceLength += recordArr.length;
39000
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39001
+ for (let j = 0; j < recordArr.length; j++) {
39002
+ this.fieldAggregators[i].push(recordArr[j]);
39131
39003
  }
39132
39004
  }
39133
- else {
39134
- this.pagination.perPageCount = this._sourceLength;
39135
- this.pagination.totalCount = this._sourceLength;
39005
+ }
39006
+ if (this.userPagination) {
39007
+ this.pagination.totalCount = this._sourceLength;
39008
+ const { perPageCount, currentPage } = this.pagination;
39009
+ const startIndex = perPageCount * (currentPage || 0);
39010
+ const endIndex = startIndex + perPageCount;
39011
+ if (index < endIndex) {
39136
39012
  this.updatePagerData();
39137
39013
  }
39138
- if (this.dataSourceObj?.added) {
39139
- this.dataSourceObj.added(index, recordArr.length);
39140
- }
39141
39014
  }
39142
- return;
39143
- }
39144
- const rawRecords = this._getRawRecordsArray();
39145
- if (!rawRecords || !Array.isArray(recordArr) || recordArr.length === 0) {
39146
- return;
39147
- }
39148
- const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length);
39149
- const rawInsertIndex = this._hasFilterInEffect()
39150
- ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex)
39151
- : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
39152
- rawRecords.splice(rawInsertIndex, 0, ...recordArr);
39153
- if (syncToOriginalRecords && this._hasFilterInEffect()) {
39154
- for (let i = 0; i < recordArr.length; i++) {
39155
- this.markForceVisibleRecord(recordArr[i]);
39015
+ else {
39016
+ this.pagination.perPageCount = this._sourceLength;
39017
+ this.pagination.totalCount = this._sourceLength;
39018
+ this.updatePagerData();
39019
+ }
39020
+ if (this.dataSourceObj?.added) {
39021
+ this.dataSourceObj.added(index, recordArr.length);
39156
39022
  }
39157
- }
39158
- this.beforeChangedRecordsMap.clear();
39159
- this.sortedIndexMap.clear();
39160
- this.updateFilterRules(this.dataConfig?.filterRules);
39161
- if (this.dataSourceObj?.added) {
39162
- this.dataSourceObj.added(rawInsertIndex, recordArr.length);
39163
39023
  }
39164
39024
  }
39165
39025
  addRecordForSorted(record) {
@@ -39193,84 +39053,46 @@
39193
39053
  }
39194
39054
  }
39195
39055
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
39196
- const delta = type === 'add' ? insertCount : -insertCount;
39197
- const numericKeys = [];
39198
- this.beforeChangedRecordsMap.forEach((_, key) => {
39199
- const numKey = Number(key);
39200
- if (Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex) {
39201
- numericKeys.push(numKey);
39202
- }
39203
- });
39204
- numericKeys.sort((a, b) => (type === 'add' ? b - a : a - b));
39205
- for (let i = 0; i < numericKeys.length; i++) {
39206
- const key = numericKeys[i];
39056
+ const length = this.beforeChangedRecordsMap.size;
39057
+ for (let key = length - 1; key >= insertIndex; key--) {
39207
39058
  const record = this.beforeChangedRecordsMap.get(key.toString());
39208
39059
  this.beforeChangedRecordsMap.delete(key.toString());
39209
- this.beforeChangedRecordsMap.set((key + delta).toString(), record);
39060
+ this.beforeChangedRecordsMap.set((key + (type === 'add' ? insertCount : -insertCount)).toString(), record);
39210
39061
  }
39211
39062
  }
39212
- deleteRecords(recordIndexs, syncToOriginalRecords = false) {
39213
- if (!syncToOriginalRecords) {
39214
- if (Array.isArray(this.records)) {
39215
- const realDeletedRecordIndexs = [];
39216
- const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
39217
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39218
- const recordIndex = recordIndexsMaxToMin[index];
39219
- if (recordIndex >= this._sourceLength || recordIndex < 0) {
39220
- continue;
39221
- }
39222
- this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
39223
- realDeletedRecordIndexs.push(recordIndex);
39224
- const deletedRecord = this.records[recordIndex];
39225
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39226
- this.fieldAggregators[i].deleteRecord(deletedRecord);
39227
- }
39228
- this.records.splice(recordIndex, 1);
39229
- this.currentIndexedData.pop();
39230
- this._sourceLength -= 1;
39231
- }
39232
- if (this.userPagination) {
39233
- this.updatePagerData();
39234
- }
39235
- else {
39236
- this.pagination.perPageCount = this._sourceLength;
39237
- this.pagination.totalCount = this._sourceLength;
39238
- this.updatePagerData();
39063
+ deleteRecords(recordIndexs) {
39064
+ if (Array.isArray(this.records)) {
39065
+ const realDeletedRecordIndexs = [];
39066
+ const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
39067
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39068
+ const recordIndex = recordIndexsMaxToMin[index];
39069
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
39070
+ continue;
39239
39071
  }
39240
- if (this.dataSourceObj?.deleted) {
39241
- this.dataSourceObj.deleted(realDeletedRecordIndexs);
39072
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
39073
+ realDeletedRecordIndexs.push(recordIndex);
39074
+ const deletedRecord = this.records[recordIndex];
39075
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39076
+ this.fieldAggregators[i].deleteRecord(deletedRecord);
39242
39077
  }
39243
- return realDeletedRecordIndexs;
39078
+ this.records.splice(recordIndex, 1);
39079
+ this.currentIndexedData.pop();
39080
+ this._sourceLength -= 1;
39244
39081
  }
39245
- return [];
39246
- }
39247
- const rawRecords = this._getRawRecordsArray();
39248
- if (!rawRecords || !Array.isArray(this.records)) {
39249
- return [];
39250
- }
39251
- const realDeletedRecordIndexs = [];
39252
- const recordIndexsMaxToMin = recordIndexs.slice().sort((a, b) => b - a);
39253
- const rawDeletedIndexs = [];
39254
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39255
- const viewIndex = recordIndexsMaxToMin[index];
39256
- if (viewIndex >= this.records.length || viewIndex < 0) {
39257
- continue;
39082
+ if (this.userPagination) {
39083
+ this.updatePagerData();
39258
39084
  }
39259
- const deletedRecord = this.records[viewIndex];
39260
- const rawIndex = rawRecords.indexOf(deletedRecord);
39261
- if (rawIndex >= 0) {
39262
- rawRecords.splice(rawIndex, 1);
39263
- rawDeletedIndexs.push(rawIndex);
39085
+ else {
39086
+ this.pagination.perPageCount = this._sourceLength;
39087
+ this.pagination.totalCount = this._sourceLength;
39088
+ this.updatePagerData();
39264
39089
  }
39265
- realDeletedRecordIndexs.push(viewIndex);
39266
- }
39267
- this.beforeChangedRecordsMap.clear();
39268
- this.sortedIndexMap.clear();
39269
- this.updateFilterRules(this.dataConfig?.filterRules);
39270
- if (this.dataSourceObj?.deleted) {
39271
- this.dataSourceObj.deleted(rawDeletedIndexs);
39090
+ if (this.dataSourceObj?.deleted) {
39091
+ this.dataSourceObj.deleted(realDeletedRecordIndexs);
39092
+ }
39093
+ return realDeletedRecordIndexs;
39272
39094
  }
39273
- return realDeletedRecordIndexs;
39095
+ return [];
39274
39096
  }
39275
39097
  deleteRecordsForSorted(recordIndexs) {
39276
39098
  if (Array.isArray(this.records)) {
@@ -39292,71 +39114,36 @@
39292
39114
  this.beforeChangedRecordsMap.clear();
39293
39115
  }
39294
39116
  }
39295
- updateRecords(records, recordIndexs, syncToOriginalRecords = false) {
39296
- if (!syncToOriginalRecords) {
39297
- const realDeletedRecordIndexs = [];
39298
- for (let index = 0; index < recordIndexs.length; index++) {
39299
- const recordIndex = recordIndexs[index];
39300
- if (Array.isArray(recordIndex)) {
39301
- this.beforeChangedRecordsMap.delete(recordIndex.toString());
39302
- realDeletedRecordIndexs.push(recordIndex);
39303
- recordIndex.slice(0, -1).reduce((acc, key) => {
39304
- if (acc[key] === undefined) {
39305
- acc[key] = {};
39306
- }
39307
- return acc[key].children;
39308
- }, this.records)[recordIndex[recordIndex.length - 1]] = records[index];
39309
- }
39310
- else {
39311
- if (recordIndex >= this._sourceLength || recordIndex < 0) {
39312
- continue;
39313
- }
39314
- this.beforeChangedRecordsMap.delete(recordIndex.toString());
39315
- realDeletedRecordIndexs.push(recordIndex);
39316
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39317
- this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
39318
- }
39319
- this.records[recordIndex] = records[index];
39320
- }
39321
- }
39322
- if (this.userPagination) {
39323
- this.updatePagerData();
39324
- }
39325
- return realDeletedRecordIndexs;
39326
- }
39327
- const rawRecords = this._getRawRecordsArray();
39328
- if (!rawRecords || !Array.isArray(this.records)) {
39329
- return [];
39330
- }
39331
- const realUpdatedIndexs = [];
39117
+ updateRecords(records, recordIndexs) {
39118
+ const realDeletedRecordIndexs = [];
39332
39119
  for (let index = 0; index < recordIndexs.length; index++) {
39333
39120
  const recordIndex = recordIndexs[index];
39334
39121
  if (Array.isArray(recordIndex)) {
39335
39122
  this.beforeChangedRecordsMap.delete(recordIndex.toString());
39336
- realUpdatedIndexs.push(recordIndex);
39123
+ realDeletedRecordIndexs.push(recordIndex);
39337
39124
  recordIndex.slice(0, -1).reduce((acc, key) => {
39338
39125
  if (acc[key] === undefined) {
39339
39126
  acc[key] = {};
39340
39127
  }
39341
39128
  return acc[key].children;
39342
- }, rawRecords)[recordIndex[recordIndex.length - 1]] = records[index];
39129
+ }, this.records)[recordIndex[recordIndex.length - 1]] = records[index];
39343
39130
  }
39344
39131
  else {
39345
- if (recordIndex >= this.records.length || recordIndex < 0) {
39132
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
39346
39133
  continue;
39347
39134
  }
39348
- const oldRecord = this.records[recordIndex];
39349
- const rawIndex = rawRecords.indexOf(oldRecord);
39350
- if (rawIndex >= 0) {
39351
- rawRecords[rawIndex] = records[index];
39135
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
39136
+ realDeletedRecordIndexs.push(recordIndex);
39137
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39138
+ this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
39352
39139
  }
39353
- realUpdatedIndexs.push(recordIndex);
39140
+ this.records[recordIndex] = records[index];
39354
39141
  }
39355
39142
  }
39356
- this.beforeChangedRecordsMap.clear();
39357
- this.sortedIndexMap.clear();
39358
- this.updateFilterRules(this.dataConfig?.filterRules);
39359
- return realUpdatedIndexs;
39143
+ if (this.userPagination) {
39144
+ this.updatePagerData();
39145
+ }
39146
+ return realDeletedRecordIndexs;
39360
39147
  }
39361
39148
  updateRecordsForSorted(records, recordIndexs) {
39362
39149
  for (let index = 0; index < recordIndexs.length; index++) {
@@ -39437,11 +39224,7 @@
39437
39224
  }
39438
39225
  }
39439
39226
  if (!filedMapArray.length) {
39440
- filedMapArray = states.map(() => ({
39441
- asc: [],
39442
- desc: [],
39443
- normal: []
39444
- }));
39227
+ filedMapArray = states.map(() => ({ asc: [], desc: [], normal: [] }));
39445
39228
  for (let index = 0; index < states.length; index++) {
39446
39229
  this.sortedIndexMap.set(states[index].field, filedMapArray[index]);
39447
39230
  }
@@ -39456,16 +39239,6 @@
39456
39239
  setSortedIndexMap(field, filedMap) {
39457
39240
  this.sortedIndexMap.set(field, filedMap);
39458
39241
  }
39459
- markForceVisibleRecord(record) {
39460
- if (!record || (typeof record !== 'object' && typeof record !== 'function')) {
39461
- return;
39462
- }
39463
- this._forceVisibleRecords ||= new WeakSet();
39464
- this._forceVisibleRecords.add(record);
39465
- }
39466
- clearForceVisibleRecords() {
39467
- this._forceVisibleRecords = undefined;
39468
- }
39469
39242
  clearFilteredChildren(record) {
39470
39243
  record.filteredChildren = undefined;
39471
39244
  for (let i = 0; i < (record.children?.length ?? 0); i++) {
@@ -39473,9 +39246,6 @@
39473
39246
  }
39474
39247
  }
39475
39248
  filterRecord(record) {
39476
- if (this._forceVisibleRecords?.has(record)) {
39477
- return true;
39478
- }
39479
39249
  let isReserved = true;
39480
39250
  for (let i = 0; i < this.dataConfig.filterRules?.length; i++) {
39481
39251
  const filterRule = this.dataConfig?.filterRules[i];
@@ -55806,6 +55576,7 @@
55806
55576
  rowUpdatePos = isValid$1(rowUpdatePos) ? (isValid$1(pos) ? Math.min(rowUpdatePos, pos) : rowUpdatePos) : pos;
55807
55577
  }
55808
55578
  scene.table._clearRowRangeHeightsMap();
55579
+ verifyProxyRowStatus(scene);
55809
55580
  let updateAfter;
55810
55581
  addRows.forEach(row => {
55811
55582
  const needUpdateAfter = addRow(row, scene, skipUpdateProxy);
@@ -56224,6 +55995,31 @@
56224
55995
  }
56225
55996
  }
56226
55997
  }
55998
+ function verifyProxyRowStatus(scene) {
55999
+ const proxy = scene.proxy;
56000
+ const { rowStart, rowEnd, rowLimit, totalRow } = proxy;
56001
+ if (rowStart > rowEnd) {
56002
+ proxy.rowStart = scene.table.columnHeaderLevelCount;
56003
+ proxy.rowEnd = Math.min(totalRow, proxy.rowStart + rowLimit - 1);
56004
+ proxy.currentRow = 0;
56005
+ return;
56006
+ }
56007
+ if (rowStart + rowLimit - 1 > totalRow) {
56008
+ const oldRowStart = proxy.rowStart;
56009
+ const newRowStart = Math.max(scene.table.columnHeaderLevelCount, totalRow - rowLimit + 1);
56010
+ if (newRowStart === oldRowStart) {
56011
+ return;
56012
+ }
56013
+ proxy.rowStart = newRowStart;
56014
+ proxy.rowEnd = Math.min(totalRow, newRowStart + rowLimit - 1);
56015
+ proxy.currentRow = proxy.rowEnd + 1;
56016
+ const addRowCount = oldRowStart - proxy.rowStart;
56017
+ for (let i = 0; i < addRowCount; i++) {
56018
+ addRowCellGroup(proxy.rowStart + i, scene);
56019
+ }
56020
+ proxy.rowUpdatePos = proxy.rowStart;
56021
+ }
56022
+ }
56227
56023
 
56228
56024
  function createReactContainer(table) {
56229
56025
  const { internalProps } = table;
@@ -60026,7 +59822,7 @@
60026
59822
  scenegraph.updateCellSelectBorder(currentRange);
60027
59823
  }
60028
59824
  else {
60029
- let extendSelectRange = true;
59825
+ let extendSelectRange = isValid$1(skipBodyMerge) ? !skipBodyMerge : true;
60030
59826
  if (cellPos.col !== -1 && cellPos.row !== -1 && !enableCtrlSelectMode) {
60031
59827
  state.select.ranges = [];
60032
59828
  scenegraph.deleteAllSelectBorder();
@@ -60194,7 +59990,7 @@
60194
59990
  }
60195
59991
  else if ((interactionState === InteractionState.grabing || table.eventManager.isDraging) &&
60196
59992
  !table.stateManager.isResizeCol()) {
60197
- let extendSelectRange = true;
59993
+ let extendSelectRange = isValid$1(skipBodyMerge) ? !skipBodyMerge : true;
60198
59994
  if (cellPos.col === -1) {
60199
59995
  cellPos.col = col;
60200
59996
  }
@@ -65685,7 +65481,6 @@
65685
65481
  cutOperationTime = 0;
65686
65482
  lastClipboardContent = '';
65687
65483
  cutCellRange = null;
65688
- cutRanges = null;
65689
65484
  copySourceRange = null;
65690
65485
  constructor(table) {
65691
65486
  this.table = table;
@@ -66205,10 +66000,6 @@
66205
66000
  this.handleCopy(e, true);
66206
66001
  this.cutWaitPaste = true;
66207
66002
  this.cutCellRange = this.table.getSelectedCellInfos();
66208
- this.cutRanges = this.table.stateManager.select.ranges?.map(r => ({
66209
- start: { col: r.start.col, row: r.start.row },
66210
- end: { col: r.end.col, row: r.end.row }
66211
- }));
66212
66003
  if (this.clipboardCheckTimer) {
66213
66004
  clearTimeout(this.clipboardCheckTimer);
66214
66005
  }
@@ -66216,7 +66007,6 @@
66216
66007
  if (this.cutWaitPaste) {
66217
66008
  this.cutWaitPaste = false;
66218
66009
  this.cutCellRange = null;
66219
- this.cutRanges = null;
66220
66010
  this.clipboardCheckTimer = null;
66221
66011
  }
66222
66012
  }, 30000);
@@ -66236,7 +66026,6 @@
66236
66026
  if (this.cutWaitPaste) {
66237
66027
  this.cutWaitPaste = false;
66238
66028
  this.cutCellRange = null;
66239
- this.cutRanges = null;
66240
66029
  if (this.clipboardCheckTimer) {
66241
66030
  clearTimeout(this.clipboardCheckTimer);
66242
66031
  this.clipboardCheckTimer = null;
@@ -66352,11 +66141,17 @@
66352
66141
  }
66353
66142
  clearCutArea(table) {
66354
66143
  try {
66355
- const ranges = this.cutRanges;
66356
- if (!ranges || ranges.length === 0) {
66144
+ const selectCells = this.cutCellRange;
66145
+ if (!selectCells || selectCells.length === 0) {
66357
66146
  return;
66358
66147
  }
66359
- table.changeCellValuesByIds(ranges, '');
66148
+ for (let i = 0; i < selectCells.length; i++) {
66149
+ for (let j = 0; j < selectCells[i].length; j++) {
66150
+ if (selectCells[i][j]) {
66151
+ table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, undefined);
66152
+ }
66153
+ }
66154
+ }
66360
66155
  }
66361
66156
  catch (error) {
66362
66157
  }
@@ -69873,19 +69668,56 @@
69873
69668
  table;
69874
69669
  customCellStyle;
69875
69670
  customCellStyleArrangement;
69671
+ _customCellStyleArrangementIndex;
69672
+ _customCellStyleArrangementTombstoneCount;
69876
69673
  constructor(table, customCellStyle, customCellStyleArrangement) {
69877
69674
  this.table = table;
69878
69675
  this.customCellStyle = customCellStyle;
69879
69676
  this.customCellStyleArrangement = customCellStyleArrangement;
69677
+ this._customCellStyleArrangementIndex = new Map();
69678
+ this._customCellStyleArrangementTombstoneCount = 0;
69679
+ this._rebuildCustomCellStyleArrangementIndex();
69880
69680
  }
69881
- clearCustomCellStyleArrangement() {
69882
- this.customCellStyleArrangement = [];
69681
+ _getCustomCellStyleArrangementKey(cellPos) {
69682
+ if (cellPos.range) {
69683
+ const { start, end } = cellPos.range;
69684
+ return `range:${start.col},${start.row},${end.col},${end.row}`;
69685
+ }
69686
+ if (cellPos.col === undefined || cellPos.row === undefined) {
69687
+ return undefined;
69688
+ }
69689
+ return `cell:${cellPos.col},${cellPos.row}`;
69883
69690
  }
69884
- addCustomCellStyleArrangement(cellPosition, customStyleId) {
69885
- this.customCellStyleArrangement.push({
69886
- cellPosition,
69887
- customStyleId
69888
- });
69691
+ _rebuildCustomCellStyleArrangementIndex() {
69692
+ this._customCellStyleArrangementIndex.clear();
69693
+ this._customCellStyleArrangementTombstoneCount = 0;
69694
+ for (let i = 0; i < this.customCellStyleArrangement.length; i++) {
69695
+ if (!isValid$1(this.customCellStyleArrangement[i].customStyleId)) {
69696
+ this._customCellStyleArrangementTombstoneCount++;
69697
+ continue;
69698
+ }
69699
+ const key = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[i].cellPosition);
69700
+ if (key) {
69701
+ this._customCellStyleArrangementIndex.set(key, i);
69702
+ }
69703
+ }
69704
+ }
69705
+ _compactCustomCellStyleArrangementIfNeeded() {
69706
+ const length = this.customCellStyleArrangement.length;
69707
+ if (this._customCellStyleArrangementTombstoneCount < 2048) {
69708
+ return;
69709
+ }
69710
+ if (this._customCellStyleArrangementTombstoneCount * 4 < length) {
69711
+ return;
69712
+ }
69713
+ const compacted = this.customCellStyleArrangement.filter(style => isValid$1(style.customStyleId));
69714
+ if (compacted.length === this.customCellStyleArrangement.length) {
69715
+ this._customCellStyleArrangementTombstoneCount = 0;
69716
+ return;
69717
+ }
69718
+ this.customCellStyleArrangement.length = 0;
69719
+ this.customCellStyleArrangement.push(...compacted);
69720
+ this._rebuildCustomCellStyleArrangementIndex();
69889
69721
  }
69890
69722
  getCustomCellStyle(col, row) {
69891
69723
  const customStyleIds = this.getCustomCellStyleIds(col, row);
@@ -69908,6 +69740,9 @@
69908
69740
  styles.push(styleOption.style);
69909
69741
  }
69910
69742
  });
69743
+ if (!styles.length) {
69744
+ return undefined;
69745
+ }
69911
69746
  return merge({}, ...styles);
69912
69747
  }
69913
69748
  return undefined;
@@ -69918,6 +69753,9 @@
69918
69753
  for (let c = range.start.col; c <= range.end.col; c++) {
69919
69754
  for (let r = range.start.row; r <= range.end.row; r++) {
69920
69755
  this.customCellStyleArrangement.forEach(style => {
69756
+ if (!isValid$1(style.customStyleId)) {
69757
+ return;
69758
+ }
69921
69759
  if (style.cellPosition.range) {
69922
69760
  if (style.cellPosition.range.start.col <= c &&
69923
69761
  style.cellPosition.range.end.col >= c &&
@@ -69969,15 +69807,40 @@
69969
69807
  this.table.scenegraph.updateNextFrame();
69970
69808
  }
69971
69809
  arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
69972
- const index = this.customCellStyleArrangement.findIndex(style => {
69973
- if (style.cellPosition.range && cellPos.range) {
69974
- return (style.cellPosition.range.start.col === cellPos.range.start.col &&
69975
- style.cellPosition.range.start.row === cellPos.range.start.row &&
69976
- style.cellPosition.range.end.col === cellPos.range.end.col &&
69977
- style.cellPosition.range.end.row === cellPos.range.end.row);
69978
- }
69979
- return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;
69980
- });
69810
+ const inputKey = this._getCustomCellStyleArrangementKey(cellPos);
69811
+ let index = inputKey ? this._customCellStyleArrangementIndex.get(inputKey) ?? -1 : -1;
69812
+ if (inputKey && index !== -1) {
69813
+ const item = this.customCellStyleArrangement[index];
69814
+ const itemKey = item ? this._getCustomCellStyleArrangementKey(item.cellPosition) : undefined;
69815
+ if (!item || !isValid$1(item.customStyleId) || itemKey !== inputKey) {
69816
+ index = this.customCellStyleArrangement.findIndex(style => {
69817
+ if (!isValid$1(style.customStyleId)) {
69818
+ return false;
69819
+ }
69820
+ return this._getCustomCellStyleArrangementKey(style.cellPosition) === inputKey;
69821
+ });
69822
+ if (index !== -1) {
69823
+ this._customCellStyleArrangementIndex.set(inputKey, index);
69824
+ }
69825
+ else {
69826
+ this._customCellStyleArrangementIndex.delete(inputKey);
69827
+ }
69828
+ }
69829
+ }
69830
+ if (index === -1 && !inputKey) {
69831
+ index = this.customCellStyleArrangement.findIndex(style => {
69832
+ if (!isValid$1(style.customStyleId)) {
69833
+ return false;
69834
+ }
69835
+ if (style.cellPosition.range && cellPos.range) {
69836
+ return (style.cellPosition.range.start.col === cellPos.range.start.col &&
69837
+ style.cellPosition.range.start.row === cellPos.range.start.row &&
69838
+ style.cellPosition.range.end.col === cellPos.range.end.col &&
69839
+ style.cellPosition.range.end.row === cellPos.range.end.row);
69840
+ }
69841
+ return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;
69842
+ });
69843
+ }
69981
69844
  if (index === -1 && !customStyleId) {
69982
69845
  return;
69983
69846
  }
@@ -69990,6 +69853,11 @@
69990
69853
  },
69991
69854
  customStyleId: customStyleId
69992
69855
  });
69856
+ const pushedIndex = this.customCellStyleArrangement.length - 1;
69857
+ const pushedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[pushedIndex].cellPosition);
69858
+ if (pushedKey) {
69859
+ this._customCellStyleArrangementIndex.set(pushedKey, pushedIndex);
69860
+ }
69993
69861
  }
69994
69862
  else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {
69995
69863
  return;
@@ -69998,9 +69866,17 @@
69998
69866
  this.customCellStyleArrangement[index].customStyleId = customStyleId;
69999
69867
  }
70000
69868
  else {
70001
- this.customCellStyleArrangement.splice(index, 1);
69869
+ const existedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[index].cellPosition);
69870
+ if (isValid$1(this.customCellStyleArrangement[index].customStyleId)) {
69871
+ this._customCellStyleArrangementTombstoneCount++;
69872
+ }
69873
+ this.customCellStyleArrangement[index].customStyleId = null;
69874
+ if (existedKey) {
69875
+ this._customCellStyleArrangementIndex.delete(existedKey);
69876
+ }
69877
+ this._compactCustomCellStyleArrangementIfNeeded();
70002
69878
  }
70003
- const style = this.getCustomCellStyleOption(customStyleId)?.style;
69879
+ const style = customStyleId ? this.getCustomCellStyleOption(customStyleId)?.style : undefined;
70004
69880
  if (style) {
70005
69881
  forceFastUpdate = true;
70006
69882
  for (const key in style) {
@@ -70030,6 +69906,8 @@
70030
69906
  updateCustomCell(customCellStyle, customCellStyleArrangement) {
70031
69907
  this.customCellStyle.length = 0;
70032
69908
  this.customCellStyleArrangement.length = 0;
69909
+ this._customCellStyleArrangementIndex.clear();
69910
+ this._customCellStyleArrangementTombstoneCount = 0;
70033
69911
  customCellStyle.forEach((cellStyle) => {
70034
69912
  this.registerCustomCellStyle(cellStyle.id, cellStyle.style);
70035
69913
  });
@@ -70415,7 +70293,7 @@
70415
70293
  return TABLE_EVENT_TYPE;
70416
70294
  }
70417
70295
  options;
70418
- version = "1.22.11-alpha.9";
70296
+ version = "1.22.11";
70419
70297
  pagination;
70420
70298
  id = `VTable${Date.now()}`;
70421
70299
  headerStyleCache;
@@ -72411,6 +72289,7 @@
72411
72289
  this.stateManager.updateSelectPos(startCol, startRow, enableShiftSelectMode, enableCtrlSelectMode, false, this.options.select?.makeSelectCellVisible ?? true, true);
72412
72290
  this.stateManager.updateInteractionState(InteractionState.grabing);
72413
72291
  this.stateManager.updateSelectPos(endCol, endRow, enableShiftSelectMode, enableCtrlSelectMode, false, this.options.select?.makeSelectCellVisible ?? true, true);
72292
+ this.stateManager.select.selecting = false;
72414
72293
  }
72415
72294
  dragSelectCol(colIndex, enableCtrlSelectMode) {
72416
72295
  const currentSelectRanges = this.stateManager.select.ranges;
@@ -72419,10 +72298,10 @@
72419
72298
  lastSelectRange.end.col = colIndex;
72420
72299
  }
72421
72300
  this.stateManager.updateSelectPos(colIndex, this.rowCount - 1, false, enableCtrlSelectMode, false, this.options.select?.makeSelectCellVisible ?? true, true);
72301
+ this.stateManager.select.selecting = false;
72422
72302
  }
72423
72303
  endDragSelect() {
72424
72304
  this.stateManager.updateInteractionState(InteractionState.default);
72425
- this.stateManager.endSelectCells(false, false);
72426
72305
  }
72427
72306
  startDragSelectRow(rowIndex, enableCtrlSelectMode, isShift) {
72428
72307
  const lastSelectRange = this.stateManager.select.ranges[this.stateManager.select.ranges.length - 1];
@@ -72433,6 +72312,7 @@
72433
72312
  this.stateManager.updateSelectPos(startCol, startRow, isShift, enableCtrlSelectMode, false, this.options.select?.makeSelectCellVisible ?? true, true);
72434
72313
  this.stateManager.updateInteractionState(InteractionState.grabing);
72435
72314
  this.stateManager.updateSelectPos(endCol, endRow, isShift, enableCtrlSelectMode, false, this.options.select?.makeSelectCellVisible ?? true, true);
72315
+ this.stateManager.select.selecting = false;
72436
72316
  }
72437
72317
  dragSelectRow(rowIndex, isCtrl) {
72438
72318
  const currentSelectRanges = this.stateManager.select.ranges;
@@ -72441,6 +72321,7 @@
72441
72321
  lastSelectRange.end.row = rowIndex;
72442
72322
  }
72443
72323
  this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, false, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
72324
+ this.stateManager.select.selecting = false;
72444
72325
  }
72445
72326
  get recordsCount() {
72446
72327
  return this.records?.length;
@@ -73654,6 +73535,22 @@
73654
73535
  }
73655
73536
  return false;
73656
73537
  }
73538
+ updateCellContent(col, row) {
73539
+ this.scenegraph.updateCellContent(col, row);
73540
+ }
73541
+ updateCellContentRange(startCol, startRow, endCol, endRow) {
73542
+ for (let i = startCol; i <= endCol; i++) {
73543
+ for (let j = startRow; j <= endRow; j++) {
73544
+ this.scenegraph.updateCellContent(i, j);
73545
+ }
73546
+ }
73547
+ }
73548
+ updateCellContentRanges(ranges) {
73549
+ for (let i = 0; i < ranges.length; i++) {
73550
+ const range = ranges[i];
73551
+ this.updateCellContentRange(range.start.col, range.start.row, range.end.col, range.end.row);
73552
+ }
73553
+ }
73657
73554
  }
73658
73555
 
73659
73556
  var core = /*#__PURE__*/Object.freeze({
@@ -76273,7 +76170,7 @@
76273
76170
  }
76274
76171
  const editor = this.table.getEditor(col, row);
76275
76172
  if (editor) {
76276
- editElement && editor.setElement(editElement);
76173
+ editElement && editor.setElement?.(editElement);
76277
76174
  if (this.table.internalProps.layoutMap.isSeriesNumber(col, row)) {
76278
76175
  return;
76279
76176
  }
@@ -76453,10 +76350,9 @@
76453
76350
  return { addRecordRule };
76454
76351
  }
76455
76352
 
76456
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
76353
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
76457
76354
  if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
76458
- const recordShowIndex = table.getRecordShowIndexByCell(col, row);
76459
- const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76355
+ const recordIndex = table.getRecordShowIndexByCell(col, row);
76460
76356
  const { field } = table.internalProps.layoutMap.getBody(col, row);
76461
76357
  const beforeChangeValue = table.getCellRawValue(col, row);
76462
76358
  const oldValue = table.getCellOriginValue(col, row);
@@ -76464,7 +76360,7 @@
76464
76360
  table.internalProps.layoutMap.updateColumnTitle(col, row, value);
76465
76361
  }
76466
76362
  else {
76467
- table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
76363
+ table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
76468
76364
  }
76469
76365
  const range = table.getCellRange(col, row);
76470
76366
  const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
@@ -76517,24 +76413,18 @@
76517
76413
  }
76518
76414
  const changedValue = table.getCellOriginValue(col, row);
76519
76415
  if (oldValue !== changedValue && triggerEvent) {
76520
- const changeValue = {
76416
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
76521
76417
  col,
76522
76418
  row,
76523
- recordIndex,
76524
- field,
76525
76419
  rawValue: beforeChangeValue,
76526
76420
  currentValue: oldValue,
76527
76421
  changedValue
76528
- };
76529
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
76530
- if (!silentChangeCellValuesEvent) {
76531
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
76532
- }
76422
+ });
76533
76423
  }
76534
76424
  table.scenegraph.updateNextFrame();
76535
76425
  }
76536
76426
  }
76537
- async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
76427
+ async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
76538
76428
  const changedCellResults = [];
76539
76429
  let pasteColEnd = startCol;
76540
76430
  let pasteRowEnd = startRow;
@@ -76561,7 +76451,6 @@
76561
76451
  oldRowValues.push(oldValue);
76562
76452
  }
76563
76453
  }
76564
- const resultChangeValues = [];
76565
76454
  for (let i = 0; i < values.length; i++) {
76566
76455
  if (startRow + i > table.rowCount - 1) {
76567
76456
  break;
@@ -76601,8 +76490,7 @@
76601
76490
  if (isCanChange) {
76602
76491
  changedCellResults[i][j] = true;
76603
76492
  const value = rowValues[j];
76604
- const recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
76605
- const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76493
+ const recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
76606
76494
  const { field } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i);
76607
76495
  const beforeChangeValue = beforeChangeValues[i][j];
76608
76496
  const oldValue = oldValues[i][j];
@@ -76610,21 +76498,17 @@
76610
76498
  table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value);
76611
76499
  }
76612
76500
  else {
76613
- table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
76501
+ table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
76614
76502
  }
76615
76503
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
76616
76504
  if (oldValue !== changedValue && triggerEvent) {
76617
- const changeValue = {
76505
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
76618
76506
  col: startCol + j,
76619
76507
  row: startRow + i,
76620
- recordIndex,
76621
- field,
76622
76508
  rawValue: beforeChangeValue,
76623
76509
  currentValue: oldValue,
76624
76510
  changedValue
76625
- };
76626
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
76627
- resultChangeValues.push(changeValue);
76511
+ });
76628
76512
  }
76629
76513
  }
76630
76514
  else {
@@ -76633,9 +76517,6 @@
76633
76517
  }
76634
76518
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
76635
76519
  }
76636
- if (!silentChangeCellValuesEvent) {
76637
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
76638
- }
76639
76520
  const startRange = table.getCellRange(startCol, startRow);
76640
76521
  const range = table.getCellRange(pasteColEnd, pasteRowEnd);
76641
76522
  const aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -76708,68 +76589,6 @@
76708
76589
  table.scenegraph.updateNextFrame();
76709
76590
  return changedCellResults;
76710
76591
  }
76711
- async function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
76712
- const resultChangeValues = [];
76713
- const processed = new Set();
76714
- const nextValue = (value ?? '');
76715
- for (let i = 0; i < (ranges?.length ?? 0); i++) {
76716
- const range = ranges[i];
76717
- const startCol = Math.min(range.start.col, range.end.col);
76718
- const endCol = Math.max(range.start.col, range.end.col);
76719
- const startRow = Math.min(range.start.row, range.end.row);
76720
- const endRow = Math.max(range.start.row, range.end.row);
76721
- if (startCol > endCol || startRow > endRow) {
76722
- continue;
76723
- }
76724
- const values = [];
76725
- const oldValues = [];
76726
- for (let row = startRow; row <= endRow; row++) {
76727
- const rowValues = [];
76728
- const rowOldValues = [];
76729
- for (let col = startCol; col <= endCol; col++) {
76730
- rowValues.push(nextValue);
76731
- rowOldValues.push(table.getCellOriginValue(col, row));
76732
- }
76733
- values.push(rowValues);
76734
- oldValues.push(rowOldValues);
76735
- }
76736
- const changedCellResults = await listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, true);
76737
- for (let r = 0; r < values.length; r++) {
76738
- for (let c = 0; c < values[r].length; c++) {
76739
- const col = startCol + c;
76740
- const row = startRow + r;
76741
- const key = `${col},${row}`;
76742
- if (processed.has(key)) {
76743
- continue;
76744
- }
76745
- processed.add(key);
76746
- if (!triggerEvent || !changedCellResults?.[r]?.[c]) {
76747
- continue;
76748
- }
76749
- const oldValue = oldValues[r][c];
76750
- const changedValue = table.getCellOriginValue(col, row);
76751
- if (oldValue === changedValue) {
76752
- continue;
76753
- }
76754
- const recordShowIndex = table.getRecordShowIndexByCell(col, row);
76755
- const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76756
- const { field } = table.internalProps.layoutMap.getBody(col, row);
76757
- resultChangeValues.push({
76758
- col,
76759
- row,
76760
- recordIndex,
76761
- field,
76762
- rawValue: oldValue,
76763
- currentValue: oldValue,
76764
- changedValue
76765
- });
76766
- }
76767
- }
76768
- }
76769
- if (!silentChangeCellValuesEvent && triggerEvent) {
76770
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
76771
- }
76772
- }
76773
76592
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
76774
76593
  if (oldCellUpdateType === 'group') {
76775
76594
  return oldCellUpdateType;
@@ -76823,13 +76642,7 @@
76823
76642
  table.scenegraph.createSceneGraph();
76824
76643
  }
76825
76644
  else if (table.sortState) {
76826
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76827
- if (syncToOriginalRecords) {
76828
- table.dataSource.addRecord(record, table.dataSource.records.length, true);
76829
- }
76830
- else {
76831
- table.dataSource.addRecordForSorted(record);
76832
- }
76645
+ table.dataSource.addRecordForSorted(record);
76833
76646
  table.stateManager.checkedState.clear();
76834
76647
  sortRecords(table);
76835
76648
  table.refreshRowColCount();
@@ -76842,16 +76655,8 @@
76842
76655
  recordIndex = table.dataSource.sourceLength;
76843
76656
  }
76844
76657
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76845
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76846
- table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords);
76658
+ table.dataSource.addRecord(record, recordIndex);
76847
76659
  adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
76848
- if (syncToOriginalRecords) {
76849
- table.refreshRowColCount();
76850
- table.internalProps.layoutMap.clearCellRangeMap();
76851
- table.scenegraph.clearCells();
76852
- table.scenegraph.createSceneGraph();
76853
- return true;
76854
- }
76855
76660
  const oldRowCount = table.rowCount;
76856
76661
  table.refreshRowColCount();
76857
76662
  if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
@@ -76963,13 +76768,7 @@
76963
76768
  table.scenegraph.createSceneGraph();
76964
76769
  }
76965
76770
  else if (table.sortState) {
76966
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76967
- if (syncToOriginalRecords) {
76968
- table.dataSource.addRecords(records, table.dataSource.records.length, true);
76969
- }
76970
- else {
76971
- table.dataSource.addRecordsForSorted(records);
76972
- }
76771
+ table.dataSource.addRecordsForSorted(records);
76973
76772
  sortRecords(table);
76974
76773
  table.refreshRowColCount();
76975
76774
  table.scenegraph.clearCells();
@@ -76984,16 +76783,8 @@
76984
76783
  recordIndex = 0;
76985
76784
  }
76986
76785
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76987
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76988
- table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords);
76786
+ table.dataSource.addRecords(records, recordIndex);
76989
76787
  adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
76990
- if (syncToOriginalRecords) {
76991
- table.refreshRowColCount();
76992
- table.internalProps.layoutMap.clearCellRangeMap();
76993
- table.scenegraph.clearCells();
76994
- table.scenegraph.createSceneGraph();
76995
- return true;
76996
- }
76997
76788
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
76998
76789
  table.refreshRowColCount();
76999
76790
  if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
@@ -77109,34 +76900,20 @@
77109
76900
  table.scenegraph.createSceneGraph();
77110
76901
  }
77111
76902
  else if (table.sortState) {
77112
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77113
- if (syncToOriginalRecords) {
77114
- table.dataSource.deleteRecords(recordIndexs, true);
77115
- }
77116
- else {
77117
- table.dataSource.deleteRecordsForSorted(recordIndexs);
77118
- }
76903
+ table.dataSource.deleteRecordsForSorted(recordIndexs);
77119
76904
  sortRecords(table);
77120
76905
  table.refreshRowColCount();
77121
76906
  table.scenegraph.clearCells();
77122
76907
  table.scenegraph.createSceneGraph();
77123
76908
  }
77124
76909
  else {
77125
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77126
- const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
76910
+ const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);
77127
76911
  if (deletedRecordIndexs.length === 0) {
77128
76912
  return;
77129
76913
  }
77130
76914
  for (let index = 0; index < deletedRecordIndexs.length; index++) {
77131
76915
  adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
77132
76916
  }
77133
- if (syncToOriginalRecords) {
77134
- table.refreshRowColCount();
77135
- table.internalProps.layoutMap.clearCellRangeMap();
77136
- table.scenegraph.clearCells();
77137
- table.scenegraph.createSceneGraph();
77138
- return;
77139
- }
77140
76917
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
77141
76918
  table.refreshRowColCount();
77142
76919
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -77254,32 +77031,18 @@
77254
77031
  table.scenegraph.createSceneGraph();
77255
77032
  }
77256
77033
  else if (table.sortState) {
77257
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77258
- if (syncToOriginalRecords) {
77259
- table.dataSource.updateRecords(records, recordIndexs, true);
77260
- }
77261
- else {
77262
- table.dataSource.updateRecordsForSorted(records, recordIndexs);
77263
- }
77034
+ table.dataSource.updateRecordsForSorted(records, recordIndexs);
77264
77035
  sortRecords(table);
77265
77036
  table.refreshRowColCount();
77266
77037
  table.scenegraph.clearCells();
77267
77038
  table.scenegraph.createSceneGraph();
77268
77039
  }
77269
77040
  else {
77270
- const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77271
- const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
77041
+ const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);
77272
77042
  if (updateRecordIndexs.length === 0) {
77273
77043
  return;
77274
77044
  }
77275
- if (syncToOriginalRecords) {
77276
- table.refreshRowColCount();
77277
- table.internalProps.layoutMap.clearCellRangeMap();
77278
- table.scenegraph.clearCells();
77279
- table.scenegraph.createSceneGraph();
77280
- return;
77281
- }
77282
- const bodyRowIndex = updateRecordIndexs.map((index) => table.getBodyRowIndexByRecordIndex(index));
77045
+ const bodyRowIndex = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index));
77283
77046
  const recordIndexsMinToMax = bodyRowIndex.sort((a, b) => a - b);
77284
77047
  if (table.pagination) {
77285
77048
  const { perPageCount, currentPage } = table.pagination;
@@ -78456,7 +78219,6 @@
78456
78219
  }
78457
78220
  updateFilterRules(filterRules, options = { clearRowHeightCache: true }) {
78458
78221
  this.scenegraph.clearCells();
78459
- this.dataSource.clearForceVisibleRecords?.();
78460
78222
  if (this.sortState) {
78461
78223
  this.dataSource.updateFilterRulesForSorted(filterRules);
78462
78224
  sortRecords(this);
@@ -78677,182 +78439,17 @@
78677
78439
  }
78678
78440
  return isValid$1(editorDefine);
78679
78441
  }
78680
- changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
78681
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
78682
- }
78683
- changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
78684
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
78442
+ changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true) {
78443
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
78685
78444
  }
78686
- changeCellValuesByIds(ranges, value, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
78687
- return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
78445
+ changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true) {
78446
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
78688
78447
  }
78689
- changeSourceCellValue(recordIndex, field, value) {
78690
- const tableIndex = this.getTableIndexByRecordIndex(recordIndex);
78691
- const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
78692
- if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) {
78693
- return;
78694
- }
78695
- this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
78696
- const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row);
78697
- const oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
78698
- const changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
78699
- if (oldValue !== changedValue) {
78700
- const changeValue = {
78701
- col: cellAddr.col,
78702
- row: cellAddr.row,
78703
- recordIndex,
78704
- field,
78705
- rawValue: beforeChangeValue,
78706
- currentValue: oldValue,
78707
- changedValue
78708
- };
78709
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
78710
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
78711
- }
78712
- }
78713
- changeCellValueByRecord(recordIndex, field, value, options) {
78714
- const triggerEvent = options?.triggerEvent ?? true;
78715
- const silentChangeCellValuesEvent = options?.silentChangeCellValuesEvent;
78716
- const autoRefresh = options?.autoRefresh ?? true;
78717
- const records = this.dataSource.dataSourceObj?.records;
78718
- let record;
78719
- let oldValue;
78720
- if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
78721
- record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
78722
- oldValue = record?.[field];
78723
- }
78724
- this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
78725
- if (!triggerEvent) {
78726
- return;
78727
- }
78728
- const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
78729
- if (oldValue !== changedValue) {
78730
- const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
78731
- const changeValue = {
78732
- col: cellAddr?.col ?? -1,
78733
- row: cellAddr?.row ?? -1,
78734
- recordIndex,
78735
- field,
78736
- rawValue: oldValue,
78737
- currentValue: oldValue,
78738
- changedValue
78739
- };
78740
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
78741
- if (!silentChangeCellValuesEvent) {
78742
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
78743
- }
78744
- }
78745
- if (autoRefresh) {
78746
- this.refreshAfterSourceChange();
78747
- }
78748
- }
78749
- changeCellValueBySource(recordIndex, field, value, triggerEvent = true, silentChangeCellValuesEvent) {
78750
- return this.changeCellValueByRecord(recordIndex, field, value, {
78751
- triggerEvent,
78752
- silentChangeCellValuesEvent,
78753
- autoRefresh: true
78754
- });
78755
- }
78756
- changeCellValuesByRecords(changeValues, options) {
78757
- const triggerEvent = options?.triggerEvent ?? true;
78758
- const silentChangeCellValuesEvent = options?.silentChangeCellValuesEvent;
78759
- const autoRefresh = options?.autoRefresh ?? true;
78760
- const resultChangeValues = [];
78761
- for (let i = 0; i < changeValues.length; i++) {
78762
- const { recordIndex, field, value } = changeValues[i];
78763
- const records = this.dataSource.dataSourceObj?.records;
78764
- let record;
78765
- let oldValue;
78766
- if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
78767
- record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
78768
- oldValue = record?.[field];
78769
- }
78770
- this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
78771
- if (triggerEvent) {
78772
- const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
78773
- if (oldValue !== changedValue) {
78774
- const changeValue = {
78775
- col: (this.getCellAddrByFieldRecord(field, recordIndex)?.col ?? -1),
78776
- row: (this.getCellAddrByFieldRecord(field, recordIndex)?.row ?? -1),
78777
- recordIndex,
78778
- field,
78779
- rawValue: oldValue,
78780
- currentValue: oldValue,
78781
- changedValue
78782
- };
78783
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
78784
- resultChangeValues.push(changeValue);
78785
- }
78786
- }
78787
- }
78788
- if (!silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent) {
78789
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
78790
- }
78791
- if (autoRefresh) {
78792
- this.refreshAfterSourceChange();
78793
- }
78794
- }
78795
- changeCellValuesBySource(changeValues, triggerEvent = true, silentChangeCellValuesEvent) {
78796
- return this.changeCellValuesByRecords(changeValues, {
78797
- triggerEvent,
78798
- silentChangeCellValuesEvent,
78799
- autoRefresh: true
78800
- });
78801
- }
78802
- refreshAfterSourceChange(options) {
78803
- const reapplyFilter = options?.reapplyFilter ?? true;
78804
- const reapplySort = options?.reapplySort ?? true;
78805
- const clearRowHeightCache = options?.clearRowHeightCache ?? true;
78806
- this.scenegraph.clearCells();
78807
- if (this.sortState && reapplySort) {
78808
- this.dataSource.clearSortedIndexMap?.();
78809
- this.dataSource.sortedIndexMap?.clear?.();
78810
- }
78811
- if (reapplyFilter) {
78812
- if (this.sortState && reapplySort) {
78813
- this.dataSource.updateFilterRulesForSorted(this.dataSource.dataConfig?.filterRules);
78814
- sortRecords(this);
78815
- }
78816
- else {
78817
- this.dataSource.updateFilterRules(this.dataSource.dataConfig?.filterRules);
78818
- }
78819
- }
78820
- else if (this.sortState && reapplySort) {
78821
- sortRecords(this);
78822
- }
78823
- const traverseColumns = (columns) => {
78824
- for (let i = 0; i < (columns?.length ?? 0); i++) {
78825
- const column = columns[i];
78826
- const aggregators = column?.vtable_aggregator;
78827
- if (aggregators) {
78828
- if (Array.isArray(aggregators)) {
78829
- for (let j = 0; j < aggregators.length; j++) {
78830
- aggregators[j]?.recalculate?.();
78831
- }
78832
- }
78833
- else {
78834
- aggregators?.recalculate?.();
78835
- }
78836
- }
78837
- if (column?.columns) {
78838
- traverseColumns(column.columns);
78839
- }
78840
- }
78841
- };
78842
- traverseColumns(this.internalProps.columns);
78843
- this.refreshRowColCount();
78844
- this.internalProps.layoutMap.clearCellRangeMap();
78845
- this.internalProps.useOneRowHeightFillAll = false;
78846
- this.stateManager.initCheckedState(this.records);
78847
- this.scenegraph.createSceneGraph(!clearRowHeightCache);
78848
- this.internalProps.emptyTip?.resetVisible();
78849
- this.resize();
78850
- }
78851
- addRecord(record, recordIndex, triggerEvent = true) {
78448
+ addRecord(record, recordIndex) {
78852
78449
  const success = listTableAddRecord(record, recordIndex, this);
78853
78450
  adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]);
78854
78451
  this.internalProps.emptyTip?.resetVisible();
78855
- if (triggerEvent && success) {
78452
+ if (success) {
78856
78453
  this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78857
78454
  records: [record],
78858
78455
  recordIndex,
@@ -78860,13 +78457,13 @@
78860
78457
  });
78861
78458
  }
78862
78459
  }
78863
- addRecords(records, recordIndex, triggerEvent = true) {
78460
+ addRecords(records, recordIndex) {
78864
78461
  const success = listTableAddRecords(records, recordIndex, this);
78865
78462
  if (typeof recordIndex === 'number') {
78866
78463
  adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records);
78867
78464
  }
78868
78465
  this.internalProps.emptyTip?.resetVisible();
78869
- if (triggerEvent && success) {
78466
+ if (success) {
78870
78467
  this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78871
78468
  records,
78872
78469
  recordIndex,
@@ -78874,20 +78471,7 @@
78874
78471
  });
78875
78472
  }
78876
78473
  }
78877
- deleteRecords(recordIndexs, triggerEvent = true) {
78878
- const deletedRecords = [];
78879
- if (recordIndexs?.length > 0) {
78880
- recordIndexs.forEach(index => {
78881
- let record = null;
78882
- if (typeof index === 'number') {
78883
- record = this.dataSource.get(index);
78884
- }
78885
- else {
78886
- record = [];
78887
- }
78888
- deletedRecords.push(record);
78889
- });
78890
- }
78474
+ deleteRecords(recordIndexs) {
78891
78475
  listTableDeleteRecords(recordIndexs, this);
78892
78476
  adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs);
78893
78477
  this.internalProps.emptyTip?.resetVisible();
@@ -78895,26 +78479,21 @@
78895
78479
  for (let i = 0; i < recordIndexs.length; i++) {
78896
78480
  rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
78897
78481
  }
78898
- if (triggerEvent) {
78899
- this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
78900
- recordIndexs,
78901
- records: deletedRecords,
78902
- rowIndexs,
78903
- deletedCount: Array.isArray(recordIndexs[0])
78904
- ? recordIndexs.length
78905
- : recordIndexs.length
78906
- });
78907
- }
78482
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
78483
+ recordIndexs,
78484
+ rowIndexs,
78485
+ deletedCount: Array.isArray(recordIndexs[0])
78486
+ ? recordIndexs.length
78487
+ : recordIndexs.length
78488
+ });
78908
78489
  }
78909
- updateRecords(records, recordIndexs, triggerEvent = true) {
78490
+ updateRecords(records, recordIndexs) {
78910
78491
  listTableUpdateRecords(records, recordIndexs, this);
78911
- if (triggerEvent) {
78912
- this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
78913
- records,
78914
- recordIndexs,
78915
- updateCount: records.length
78916
- });
78917
- }
78492
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
78493
+ records,
78494
+ recordIndexs,
78495
+ updateCount: records.length
78496
+ });
78918
78497
  }
78919
78498
  _hasCustomRenderOrLayout() {
78920
78499
  const { headerObjects } = this.internalProps.layoutMap;
@@ -86636,7 +86215,11 @@
86636
86215
  const colHeaderPath = {};
86637
86216
  colHeaderPath.dimensionKey = colHeader.dimensionKey;
86638
86217
  colHeaderPath.indicatorKey = colHeader.indicatorKey;
86639
- colHeaderPath.value = colHeader.value ?? this.getIndicatorInfoByIndicatorKey(colHeader.indicatorKey)?.title ?? '';
86218
+ colHeaderPath.value =
86219
+ colHeader.value ??
86220
+ (colHeader.indicatorKey
86221
+ ? this.getIndicatorInfoByIndicatorKey(colHeader.indicatorKey)?.title ?? ''
86222
+ : colHeader.value);
86640
86223
  colHeaderPath.virtual = colHeader.virtual;
86641
86224
  colHeaderPath.role = colHeader.role;
86642
86225
  headerPaths.colHeaderPaths.push(colHeaderPath);
@@ -89460,10 +89043,11 @@
89460
89043
  }
89461
89044
  if (rowKey.length < this.rows.length && this.rowHierarchyType === 'grid-tree') {
89462
89045
  if (rowKey[0] === this.rowGrandTotalLabel) ;
89463
- else if (this.totals?.row?.subTotalsDimensions &&
89046
+ else if (((this.totals?.row?.subTotalsDimensions &&
89464
89047
  this.totals?.row?.subTotalsDimensions?.length >= 1 &&
89465
- rowKey[rowKey.length - 1] !== this.rowSubTotalLabel &&
89466
- this.totals.row.subTotalsDimensions.find((dimension) => dimension === rowDimensionKey)) {
89048
+ this.totals.row.subTotalsDimensions.find((dimension) => dimension === rowDimensionKey)) ||
89049
+ this.totals?.row?.showSubTotalsOnTreeNode) &&
89050
+ rowKey[rowKey.length - 1] !== this.rowSubTotalLabel) {
89467
89051
  rowKey.push(this.rowSubTotalLabel);
89468
89052
  }
89469
89053
  }
@@ -89482,10 +89066,11 @@
89482
89066
  }
89483
89067
  if (colKey.length < this.columns.length && this.columnHierarchyType === 'grid-tree') {
89484
89068
  if (colKey[0] === this.colGrandTotalLabel) ;
89485
- else if (this.totals?.column?.subTotalsDimensions &&
89069
+ else if (((this.totals?.column?.subTotalsDimensions &&
89486
89070
  this.totals?.column?.subTotalsDimensions?.length >= 1 &&
89487
- colKey[colKey.length - 1] !== this.colSubTotalLabel &&
89488
- this.totals.column.subTotalsDimensions.find((dimension) => dimension === colDimensionKey)) {
89071
+ this.totals.column.subTotalsDimensions.find((dimension) => dimension === colDimensionKey)) ||
89072
+ this.totals?.column?.showSubTotalsOnTreeNode) &&
89073
+ colKey[colKey.length - 1] !== this.colSubTotalLabel) {
89489
89074
  colKey.push(this.colSubTotalLabel);
89490
89075
  }
89491
89076
  }
@@ -89679,11 +89264,16 @@
89679
89264
  return;
89680
89265
  }
89681
89266
  const colKey = flatColKey.split(this.stringJoinChar);
89682
- if (that.totals?.column?.subTotalsDimensions &&
89267
+ if ((that.totals?.column?.subTotalsDimensions &&
89683
89268
  that.totals?.column?.subTotalsDimensions?.length > 0 &&
89684
- that.totals.column.showSubTotals !== false) {
89685
- for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
89686
- const dimension = that.totals.column.subTotalsDimensions[i];
89269
+ (that.totals?.column?.showSubTotals !== false || that.totals?.column?.showSubTotalsOnTreeNode)) ||
89270
+ (that.totals?.column?.showSubTotalsOnTreeNode && that.columns.length > 0)) {
89271
+ let colSubTotalDimensions = that.totals?.column?.subTotalsDimensions || [];
89272
+ if (that.totals?.column?.showSubTotalsOnTreeNode && colSubTotalDimensions.length === 0) {
89273
+ colSubTotalDimensions = that.columns.map(col => col);
89274
+ }
89275
+ for (let i = 0, len = colSubTotalDimensions.length; i < len; i++) {
89276
+ const dimension = colSubTotalDimensions[i];
89687
89277
  const dimensionIndex = that.columns.indexOf(dimension);
89688
89278
  if (dimensionIndex >= 0) {
89689
89279
  const colTotalKey = colKey.slice(0, dimensionIndex + 1);
@@ -89802,16 +89392,23 @@
89802
89392
  if ((that?.totals?.column?.subTotalsDimensions && that?.totals?.column?.subTotalsDimensions?.length >= 1) ||
89803
89393
  (that?.totals?.row?.subTotalsDimensions && that?.totals?.row?.subTotalsDimensions?.length >= 1) ||
89804
89394
  that?.totals?.column?.showGrandTotals ||
89805
- that?.totals?.row?.showGrandTotals) {
89395
+ that?.totals?.row?.showGrandTotals ||
89396
+ that?.totals?.row?.showSubTotalsOnTreeNode ||
89397
+ that?.totals?.column?.showSubTotalsOnTreeNode) {
89806
89398
  const rowTotalKeys = [];
89807
89399
  Object.keys(that.tree).forEach(flatRowKey => {
89808
89400
  const rowKey = flatRowKey.split(this.stringJoinChar);
89809
89401
  Object.keys(that.tree[flatRowKey]).forEach(flatColKey => {
89810
- if (that.totals?.row?.subTotalsDimensions &&
89402
+ if ((that.totals?.row?.subTotalsDimensions &&
89811
89403
  that.totals?.row?.subTotalsDimensions?.length > 0 &&
89812
- that.totals.row.showSubTotals !== false) {
89813
- for (let i = 0, len = that.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
89814
- const dimension = that.totals.row.subTotalsDimensions[i];
89404
+ (that.totals?.row?.showSubTotals !== false || that.totals?.row?.showSubTotalsOnTreeNode)) ||
89405
+ (that.totals?.row?.showSubTotalsOnTreeNode && that.rows.length > 0)) {
89406
+ let rowSubTotalDimensions = that.totals?.row?.subTotalsDimensions || [];
89407
+ if (that.totals?.row?.showSubTotalsOnTreeNode && rowSubTotalDimensions.length === 0) {
89408
+ rowSubTotalDimensions = that.rows.map(row => row);
89409
+ }
89410
+ for (let i = 0, len = rowSubTotalDimensions.length; i < len; i++) {
89411
+ const dimension = rowSubTotalDimensions[i];
89815
89412
  const dimensionIndex = that.rows.indexOf(dimension);
89816
89413
  if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
89817
89414
  const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
@@ -93879,7 +93476,7 @@
93879
93476
  }
93880
93477
 
93881
93478
  registerForVrender();
93882
- const version = "1.22.11-alpha.9";
93479
+ const version = "1.22.11";
93883
93480
  function getIcons() {
93884
93481
  return get$2();
93885
93482
  }