@visactor/vtable 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 (189) hide show
  1. package/cjs/ListTable.d.ts +34 -7
  2. package/cjs/ListTable.js +138 -18
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/body-helper/body-helper.js +1 -2
  5. package/cjs/body-helper/style.js +2 -1
  6. package/cjs/core/BaseTable.js +1 -1
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
  9. package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
  10. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  11. package/cjs/core/index.d.ts +1 -0
  12. package/cjs/core/index.js +30 -0
  13. package/cjs/core/index.js.map +1 -0
  14. package/cjs/core/record-helper.d.ts +4 -2
  15. package/cjs/core/record-helper.js +120 -47
  16. package/cjs/core/record-helper.js.map +1 -1
  17. package/cjs/core/style-helper.js +1 -1
  18. package/cjs/core/style-helper.js.map +1 -1
  19. package/cjs/data/DataSource.d.ts +13 -4
  20. package/cjs/data/DataSource.js +174 -60
  21. package/cjs/data/DataSource.js.map +1 -1
  22. package/cjs/dataset/dataset-pivot-table.js +2 -1
  23. package/cjs/dataset/dataset.js +0 -1
  24. package/cjs/edit/edit-manager.js +2 -2
  25. package/cjs/edit/edit-manager.js.map +1 -1
  26. package/cjs/event/event.d.ts +2 -1
  27. package/cjs/event/event.js +20 -9
  28. package/cjs/event/event.js.map +1 -1
  29. package/cjs/event/listener/container-dom.js +1 -1
  30. package/cjs/event/listener/container-dom.js.map +1 -1
  31. package/cjs/event/listener/table-group.js +8 -7
  32. package/cjs/event/listener/table-group.js.map +1 -1
  33. package/cjs/event/media-click.js +5 -5
  34. package/cjs/event/media-click.js.map +1 -1
  35. package/cjs/header-helper/header-helper.d.ts +2 -2
  36. package/cjs/header-helper/header-helper.js.map +1 -1
  37. package/cjs/header-helper/style.js +1 -2
  38. package/cjs/icons.js +2 -2
  39. package/cjs/icons.js.map +1 -1
  40. package/cjs/index.d.ts +1 -1
  41. package/cjs/index.js +1 -1
  42. package/cjs/index.js.map +1 -1
  43. package/cjs/layout/index.js +2 -1
  44. package/cjs/plugins/custom-cell-style.d.ts +5 -0
  45. package/cjs/plugins/custom-cell-style.js +10 -1
  46. package/cjs/plugins/custom-cell-style.js.map +1 -1
  47. package/cjs/plugins/index.js +1 -1
  48. package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
  49. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  50. package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +3 -1
  51. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +12 -6
  52. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  53. package/cjs/scenegraph/group-creater/cell-type/video-cell.js +6 -2
  54. package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  55. package/cjs/scenegraph/group-creater/column-helper.js +1 -2
  56. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  57. package/cjs/scenegraph/layout/compute-col-width.js +5 -5
  58. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  59. package/cjs/scenegraph/layout/compute-row-height.js +1 -2
  60. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  61. package/cjs/scenegraph/layout/update-height.js +3 -3
  62. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  63. package/cjs/scenegraph/layout/update-width.js +5 -5
  64. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  65. package/cjs/scenegraph/scenegraph.js +2 -2
  66. package/cjs/scenegraph/scenegraph.js.map +1 -1
  67. package/cjs/themes/themes.d.ts +3 -1
  68. package/cjs/themes/themes.js +30 -1
  69. package/cjs/themes/themes.js.map +1 -1
  70. package/cjs/themes.d.ts +2 -0
  71. package/cjs/themes.js +11 -2
  72. package/cjs/themes.js.map +1 -1
  73. package/cjs/ts-types/base-table.d.ts +2 -2
  74. package/cjs/ts-types/base-table.js.map +1 -1
  75. package/cjs/ts-types/events.d.ts +15 -0
  76. package/cjs/ts-types/events.js.map +1 -1
  77. package/cjs/ts-types/icon.d.ts +2 -0
  78. package/cjs/ts-types/icon.js +4 -3
  79. package/cjs/ts-types/icon.js.map +1 -1
  80. package/cjs/ts-types/list-table/layout-map/api.d.ts +3 -3
  81. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  82. package/cjs/ts-types/pivot-table/dimension/composite-dimension.d.ts +17 -0
  83. package/cjs/ts-types/pivot-table/dimension/composite-dimension.js +6 -0
  84. package/cjs/ts-types/pivot-table/dimension/composite-dimension.js.map +1 -0
  85. package/cjs/ts-types/pivot-table/dimension/index.d.ts +3 -2
  86. package/cjs/ts-types/pivot-table/dimension/index.js.map +1 -1
  87. package/cjs/ts-types/pivot-table/indicator/composite-indicator.d.ts +14 -2
  88. package/cjs/ts-types/pivot-table/indicator/composite-indicator.js.map +1 -1
  89. package/cjs/ts-types/pivot-table/indicator/index.d.ts +2 -2
  90. package/cjs/ts-types/pivot-table/indicator/index.js.map +1 -1
  91. package/cjs/ts-types/table-engine.d.ts +33 -6
  92. package/cjs/ts-types/table-engine.js.map +1 -1
  93. package/cjs/vrender.js.map +1 -1
  94. package/dist/vtable.js +784 -194
  95. package/dist/vtable.min.js +2 -2
  96. package/es/ListTable.d.ts +34 -7
  97. package/es/ListTable.js +134 -18
  98. package/es/ListTable.js.map +1 -1
  99. package/es/body-helper/body-helper.js +1 -2
  100. package/es/body-helper/style.js +2 -1
  101. package/es/core/BaseTable.js +1 -1
  102. package/es/core/BaseTable.js.map +1 -1
  103. package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
  104. package/es/core/TABLE_EVENT_TYPE.js +1 -0
  105. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  106. package/es/core/index.d.ts +1 -0
  107. package/es/core/index.js +2 -0
  108. package/es/core/index.js.map +1 -0
  109. package/es/core/record-helper.d.ts +4 -2
  110. package/es/core/record-helper.js +114 -43
  111. package/es/core/record-helper.js.map +1 -1
  112. package/es/core/style-helper.js +1 -1
  113. package/es/core/style-helper.js.map +1 -1
  114. package/es/data/DataSource.d.ts +13 -4
  115. package/es/data/DataSource.js +174 -60
  116. package/es/data/DataSource.js.map +1 -1
  117. package/es/dataset/dataset-pivot-table.js +2 -1
  118. package/es/dataset/dataset.js +1 -2
  119. package/es/edit/edit-manager.js +2 -2
  120. package/es/edit/edit-manager.js.map +1 -1
  121. package/es/event/event.d.ts +2 -1
  122. package/es/event/event.js +20 -9
  123. package/es/event/event.js.map +1 -1
  124. package/es/event/listener/container-dom.js +1 -1
  125. package/es/event/listener/container-dom.js.map +1 -1
  126. package/es/event/listener/table-group.js +8 -7
  127. package/es/event/listener/table-group.js.map +1 -1
  128. package/es/event/media-click.js +5 -5
  129. package/es/event/media-click.js.map +1 -1
  130. package/es/header-helper/header-helper.d.ts +2 -2
  131. package/es/header-helper/header-helper.js.map +1 -1
  132. package/es/header-helper/style.js +1 -2
  133. package/es/icons.js +1 -3
  134. package/es/icons.js.map +1 -1
  135. package/es/index.d.ts +1 -1
  136. package/es/index.js +1 -1
  137. package/es/index.js.map +1 -1
  138. package/es/layout/index.js +2 -1
  139. package/es/plugins/custom-cell-style.d.ts +5 -0
  140. package/es/plugins/custom-cell-style.js +10 -1
  141. package/es/plugins/custom-cell-style.js.map +1 -1
  142. package/es/plugins/index.js +1 -1
  143. package/es/scenegraph/group-creater/cell-helper.js +2 -2
  144. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  145. package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +3 -1
  146. package/es/scenegraph/group-creater/cell-type/image-cell.js +11 -7
  147. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  148. package/es/scenegraph/group-creater/cell-type/video-cell.js +7 -3
  149. package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  150. package/es/scenegraph/group-creater/column-helper.js +1 -2
  151. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  152. package/es/scenegraph/layout/compute-col-width.js +5 -5
  153. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  154. package/es/scenegraph/layout/compute-row-height.js +1 -2
  155. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  156. package/es/scenegraph/layout/update-height.js +3 -3
  157. package/es/scenegraph/layout/update-height.js.map +1 -1
  158. package/es/scenegraph/layout/update-width.js +5 -5
  159. package/es/scenegraph/layout/update-width.js.map +1 -1
  160. package/es/scenegraph/scenegraph.js +2 -2
  161. package/es/scenegraph/scenegraph.js.map +1 -1
  162. package/es/themes/themes.d.ts +3 -1
  163. package/es/themes/themes.js +27 -0
  164. package/es/themes/themes.js.map +1 -1
  165. package/es/themes.d.ts +2 -0
  166. package/es/themes.js +3 -1
  167. package/es/themes.js.map +1 -1
  168. package/es/ts-types/base-table.d.ts +2 -2
  169. package/es/ts-types/base-table.js.map +1 -1
  170. package/es/ts-types/events.d.ts +15 -0
  171. package/es/ts-types/events.js.map +1 -1
  172. package/es/ts-types/icon.d.ts +2 -0
  173. package/es/ts-types/icon.js +4 -3
  174. package/es/ts-types/icon.js.map +1 -1
  175. package/es/ts-types/list-table/layout-map/api.d.ts +3 -3
  176. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  177. package/es/ts-types/pivot-table/dimension/composite-dimension.d.ts +17 -0
  178. package/es/ts-types/pivot-table/dimension/composite-dimension.js +2 -0
  179. package/es/ts-types/pivot-table/dimension/composite-dimension.js.map +1 -0
  180. package/es/ts-types/pivot-table/dimension/index.d.ts +3 -2
  181. package/es/ts-types/pivot-table/dimension/index.js.map +1 -1
  182. package/es/ts-types/pivot-table/indicator/composite-indicator.d.ts +14 -2
  183. package/es/ts-types/pivot-table/indicator/composite-indicator.js.map +1 -1
  184. package/es/ts-types/pivot-table/indicator/index.d.ts +2 -2
  185. package/es/ts-types/pivot-table/indicator/index.js.map +1 -1
  186. package/es/ts-types/table-engine.d.ts +33 -6
  187. package/es/ts-types/table-engine.js.map +1 -1
  188. package/es/vrender.js.map +1 -1
  189. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -33721,6 +33721,8 @@
33721
33721
  IconFuncTypeEnum["dropDownState"] = "dropDownState";
33722
33722
  IconFuncTypeEnum["play"] = "play";
33723
33723
  IconFuncTypeEnum["damagePic"] = "damagePic";
33724
+ IconFuncTypeEnum["imageDamagePic"] = "imageDamagePic";
33725
+ IconFuncTypeEnum["videoDamagePic"] = "videoDamagePic";
33724
33726
  IconFuncTypeEnum["expand"] = "expand";
33725
33727
  IconFuncTypeEnum["collapse"] = "collapse";
33726
33728
  IconFuncTypeEnum["drillDown"] = "drillDown";
@@ -36476,6 +36478,7 @@
36476
36478
  AFTER_UPDATE_CELL_CONTENT_WIDTH: 'after_update_cell_content_width',
36477
36479
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: 'after_update_select_border_height',
36478
36480
  CHANGE_CELL_VALUE: 'change_cell_value',
36481
+ CHANGE_CELL_VALUES: 'change_cell_values',
36479
36482
  DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
36480
36483
  MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
36481
36484
  DBLCLICK_FILL_HANDLE: 'dblclick_fill_handle',
@@ -37505,6 +37508,42 @@
37505
37508
  };
37506
37509
 
37507
37510
  const themes$2 = {};
37511
+ function isTableTheme(theme) {
37512
+ return !!theme && typeof theme.getExtendTheme === 'function';
37513
+ }
37514
+ function getThemeComparableConfig(theme) {
37515
+ if (isTableTheme(theme)) {
37516
+ const extend = theme.getExtendTheme();
37517
+ const internal = theme
37518
+ .internalTheme;
37519
+ const superTheme = internal?.superTheme;
37520
+ return {
37521
+ name: theme.name,
37522
+ extend,
37523
+ superTheme: superTheme ? getThemeComparableConfig(superTheme) : undefined
37524
+ };
37525
+ }
37526
+ return theme;
37527
+ }
37528
+ function tableThemeIsChanged(prevTableTheme, newTableTheme) {
37529
+ if (!prevTableTheme && !newTableTheme) {
37530
+ return false;
37531
+ }
37532
+ if (!prevTableTheme && newTableTheme) {
37533
+ return true;
37534
+ }
37535
+ if (prevTableTheme && !newTableTheme) {
37536
+ return true;
37537
+ }
37538
+ if (prevTableTheme === newTableTheme) {
37539
+ return false;
37540
+ }
37541
+ const prev = prevTableTheme;
37542
+ const next = newTableTheme;
37543
+ const prevConfig = getThemeComparableConfig(prev);
37544
+ const newConfig = getThemeComparableConfig(next);
37545
+ return !isEqual(prevConfig, newConfig);
37546
+ }
37508
37547
 
37509
37548
  const DEFAULTFONTSIZE = 16;
37510
37549
  const DEFAULTFONTFAMILY = 'Arial,sans-serif';
@@ -38439,6 +38478,7 @@
38439
38478
  default: themes,
38440
38479
  get: get$5,
38441
38480
  of: of$1,
38481
+ tableThemeIsChanged: tableThemeIsChanged,
38442
38482
  theme: theme$1
38443
38483
  });
38444
38484
 
@@ -38573,6 +38613,7 @@
38573
38613
  _sourceLength;
38574
38614
  _source;
38575
38615
  sortedIndexMap;
38616
+ _forceVisibleRecords;
38576
38617
  lastSortStates;
38577
38618
  currentIndexedData = [];
38578
38619
  userPagination;
@@ -38998,6 +39039,48 @@
38998
39039
  }
38999
39040
  }
39000
39041
  }
39042
+ changeFieldValueByRecordIndex(value, recordIndex, field, table) {
39043
+ if (field === null) {
39044
+ return undefined;
39045
+ }
39046
+ if (recordIndex === undefined || recordIndex === null) {
39047
+ return;
39048
+ }
39049
+ const rawKey = recordIndex.toString();
39050
+ if (!this.beforeChangedRecordsMap.has(rawKey)) {
39051
+ const rawRecords = Array.isArray(this.dataSourceObj?.records)
39052
+ ? this.dataSourceObj.records
39053
+ : null;
39054
+ const originRecord = rawRecords
39055
+ ? Array.isArray(recordIndex)
39056
+ ? getValueFromDeepArray(rawRecords, recordIndex)
39057
+ : rawRecords[recordIndex]
39058
+ : undefined;
39059
+ this.beforeChangedRecordsMap.set(rawKey, cloneDeep(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {});
39060
+ }
39061
+ if (typeof field === 'string' || typeof field === 'number') {
39062
+ const beforeChangedValue = this.beforeChangedRecordsMap.get(rawKey)?.[field];
39063
+ const rawRecords = Array.isArray(this.dataSourceObj?.records)
39064
+ ? this.dataSourceObj.records
39065
+ : null;
39066
+ const record = rawRecords
39067
+ ? Array.isArray(recordIndex)
39068
+ ? getValueFromDeepArray(rawRecords, recordIndex)
39069
+ : rawRecords[recordIndex]
39070
+ : undefined;
39071
+ let formatValue = value;
39072
+ if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {
39073
+ formatValue = parseFloat(value);
39074
+ }
39075
+ if (record) {
39076
+ record[field] = formatValue;
39077
+ }
39078
+ else if (rawRecords && typeof recordIndex === 'number') {
39079
+ rawRecords[recordIndex] = this.addRecordRule === 'Array' ? [] : {};
39080
+ rawRecords[recordIndex][field] = formatValue;
39081
+ }
39082
+ }
39083
+ }
39001
39084
  cacheBeforeChangedRecord(dataIndex, table) {
39002
39085
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
39003
39086
  const originRecord = this.getOriginalRecord(dataIndex);
@@ -39023,70 +39106,166 @@
39023
39106
  }
39024
39107
  }
39025
39108
  }
39026
- addRecord(record, index) {
39027
- if (Array.isArray(this.records)) {
39028
- this.records.splice(index, 0, record);
39029
- this.adjustBeforeChangedRecordsMap(index, 1);
39030
- this.currentIndexedData.push(this.currentIndexedData.length);
39031
- this._sourceLength += 1;
39032
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39033
- this.fieldAggregators[i].push(record);
39034
- }
39035
- if (this.rowHierarchyType === 'tree') {
39036
- this.initTreeHierarchyState();
39037
- }
39038
- if (this.userPagination) {
39039
- this.pagination.totalCount = this._sourceLength;
39040
- const { perPageCount, currentPage } = this.pagination;
39041
- const startIndex = perPageCount * (currentPage || 0);
39042
- const endIndex = startIndex + perPageCount;
39043
- if (index < endIndex) {
39109
+ _getRawRecordsArray() {
39110
+ const rawRecords = this.dataSourceObj?.records;
39111
+ return Array.isArray(rawRecords) ? rawRecords : null;
39112
+ }
39113
+ _hasFilterInEffect() {
39114
+ return (this.dataConfig?.filterRules?.length ?? 0) >= 1 || (this.lastFilterRules?.length ?? 0) >= 1;
39115
+ }
39116
+ _normalizeInsertIndex(index, length) {
39117
+ if (index === undefined || index === null) {
39118
+ return length;
39119
+ }
39120
+ if (index > length) {
39121
+ return length;
39122
+ }
39123
+ if (index < 0) {
39124
+ return 0;
39125
+ }
39126
+ return index;
39127
+ }
39128
+ _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
39129
+ if (this.records.length === 0) {
39130
+ return rawRecords.length;
39131
+ }
39132
+ if (viewIndex <= 0) {
39133
+ const firstVisibleRecord = this.records[0];
39134
+ const rawIndex = rawRecords.indexOf(firstVisibleRecord);
39135
+ return rawIndex >= 0 ? rawIndex : 0;
39136
+ }
39137
+ if (viewIndex >= this.records.length) {
39138
+ const lastVisibleRecord = this.records[this.records.length - 1];
39139
+ const rawIndex = rawRecords.indexOf(lastVisibleRecord);
39140
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
39141
+ }
39142
+ const prevRecord = this.records[viewIndex - 1];
39143
+ const rawIndex = rawRecords.indexOf(prevRecord);
39144
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
39145
+ }
39146
+ _resetIndexingFromViewRecords() {
39147
+ this._sourceLength = this.records.length;
39148
+ this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
39149
+ if (this.rowHierarchyType === 'tree') {
39150
+ this.initTreeHierarchyState();
39151
+ }
39152
+ if (this.userPagination) {
39153
+ this.pagination.totalCount = this._sourceLength;
39154
+ this.updatePagerData();
39155
+ return;
39156
+ }
39157
+ this.pagination.perPageCount = this._sourceLength;
39158
+ this.pagination.totalCount = this._sourceLength;
39159
+ this.updatePagerData();
39160
+ }
39161
+ addRecord(record, index, syncToOriginalRecords = false) {
39162
+ if (!syncToOriginalRecords) {
39163
+ if (Array.isArray(this.records)) {
39164
+ this.records.splice(index, 0, record);
39165
+ this.adjustBeforeChangedRecordsMap(index, 1);
39166
+ this.currentIndexedData.push(this.currentIndexedData.length);
39167
+ this._sourceLength += 1;
39168
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39169
+ this.fieldAggregators[i].push(record);
39170
+ }
39171
+ if (this.rowHierarchyType === 'tree') {
39172
+ this.initTreeHierarchyState();
39173
+ }
39174
+ if (this.userPagination) {
39175
+ this.pagination.totalCount = this._sourceLength;
39176
+ const { perPageCount, currentPage } = this.pagination;
39177
+ const startIndex = perPageCount * (currentPage || 0);
39178
+ const endIndex = startIndex + perPageCount;
39179
+ if (index < endIndex) {
39180
+ this.updatePagerData();
39181
+ }
39182
+ }
39183
+ else {
39184
+ this.pagination.perPageCount = this._sourceLength;
39185
+ this.pagination.totalCount = this._sourceLength;
39044
39186
  this.updatePagerData();
39045
39187
  }
39188
+ if (this.dataSourceObj?.added) {
39189
+ this.dataSourceObj.added(index, 1);
39190
+ }
39046
39191
  }
39047
- else {
39048
- this.pagination.perPageCount = this._sourceLength;
39049
- this.pagination.totalCount = this._sourceLength;
39050
- this.updatePagerData();
39051
- }
39052
- if (this.dataSourceObj?.added) {
39053
- this.dataSourceObj.added(index, 1);
39054
- }
39192
+ return;
39193
+ }
39194
+ const rawRecords = this._getRawRecordsArray();
39195
+ if (!rawRecords) {
39196
+ return;
39197
+ }
39198
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length);
39199
+ const rawInsertIndex = this._hasFilterInEffect()
39200
+ ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex)
39201
+ : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
39202
+ rawRecords.splice(rawInsertIndex, 0, record);
39203
+ if (syncToOriginalRecords && this._hasFilterInEffect()) {
39204
+ this.markForceVisibleRecord(record);
39205
+ }
39206
+ this.beforeChangedRecordsMap.clear();
39207
+ this.sortedIndexMap.clear();
39208
+ this.updateFilterRules(this.dataConfig?.filterRules);
39209
+ if (this.dataSourceObj?.added) {
39210
+ this.dataSourceObj.added(rawInsertIndex, 1);
39055
39211
  }
39056
39212
  }
39057
- addRecords(recordArr, index) {
39058
- if (Array.isArray(this.records)) {
39059
- if (Array.isArray(recordArr)) {
39060
- this.records.splice(index, 0, ...recordArr);
39061
- this.adjustBeforeChangedRecordsMap(index, recordArr.length);
39062
- for (let i = 0; i < recordArr.length; i++) {
39063
- this.currentIndexedData.push(this.currentIndexedData.length);
39213
+ addRecords(recordArr, index, syncToOriginalRecords = false) {
39214
+ if (!syncToOriginalRecords) {
39215
+ if (Array.isArray(this.records)) {
39216
+ if (Array.isArray(recordArr)) {
39217
+ this.records.splice(index, 0, ...recordArr);
39218
+ this.adjustBeforeChangedRecordsMap(index, recordArr.length);
39219
+ for (let i = 0; i < recordArr.length; i++) {
39220
+ this.currentIndexedData.push(this.currentIndexedData.length);
39221
+ }
39222
+ this._sourceLength += recordArr.length;
39223
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39224
+ for (let j = 0; j < recordArr.length; j++) {
39225
+ this.fieldAggregators[i].push(recordArr[j]);
39226
+ }
39227
+ }
39064
39228
  }
39065
- this._sourceLength += recordArr.length;
39066
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39067
- for (let j = 0; j < recordArr.length; j++) {
39068
- this.fieldAggregators[i].push(recordArr[j]);
39229
+ if (this.userPagination) {
39230
+ this.pagination.totalCount = this._sourceLength;
39231
+ const { perPageCount, currentPage } = this.pagination;
39232
+ const startIndex = perPageCount * (currentPage || 0);
39233
+ const endIndex = startIndex + perPageCount;
39234
+ if (index < endIndex) {
39235
+ this.updatePagerData();
39069
39236
  }
39070
39237
  }
39071
- }
39072
- if (this.userPagination) {
39073
- this.pagination.totalCount = this._sourceLength;
39074
- const { perPageCount, currentPage } = this.pagination;
39075
- const startIndex = perPageCount * (currentPage || 0);
39076
- const endIndex = startIndex + perPageCount;
39077
- if (index < endIndex) {
39238
+ else {
39239
+ this.pagination.perPageCount = this._sourceLength;
39240
+ this.pagination.totalCount = this._sourceLength;
39078
39241
  this.updatePagerData();
39079
39242
  }
39243
+ if (this.dataSourceObj?.added) {
39244
+ this.dataSourceObj.added(index, recordArr.length);
39245
+ }
39080
39246
  }
39081
- else {
39082
- this.pagination.perPageCount = this._sourceLength;
39083
- this.pagination.totalCount = this._sourceLength;
39084
- this.updatePagerData();
39085
- }
39086
- if (this.dataSourceObj?.added) {
39087
- this.dataSourceObj.added(index, recordArr.length);
39247
+ return;
39248
+ }
39249
+ const rawRecords = this._getRawRecordsArray();
39250
+ if (!rawRecords || !Array.isArray(recordArr) || recordArr.length === 0) {
39251
+ return;
39252
+ }
39253
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length);
39254
+ const rawInsertIndex = this._hasFilterInEffect()
39255
+ ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex)
39256
+ : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
39257
+ rawRecords.splice(rawInsertIndex, 0, ...recordArr);
39258
+ if (syncToOriginalRecords && this._hasFilterInEffect()) {
39259
+ for (let i = 0; i < recordArr.length; i++) {
39260
+ this.markForceVisibleRecord(recordArr[i]);
39088
39261
  }
39089
39262
  }
39263
+ this.beforeChangedRecordsMap.clear();
39264
+ this.sortedIndexMap.clear();
39265
+ this.updateFilterRules(this.dataConfig?.filterRules);
39266
+ if (this.dataSourceObj?.added) {
39267
+ this.dataSourceObj.added(rawInsertIndex, recordArr.length);
39268
+ }
39090
39269
  }
39091
39270
  addRecordForSorted(record) {
39092
39271
  if (Array.isArray(this.records)) {
@@ -39119,46 +39298,84 @@
39119
39298
  }
39120
39299
  }
39121
39300
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
39122
- const length = this.beforeChangedRecordsMap.size;
39123
- for (let key = length - 1; key >= insertIndex; key--) {
39301
+ const delta = type === 'add' ? insertCount : -insertCount;
39302
+ const numericKeys = [];
39303
+ this.beforeChangedRecordsMap.forEach((_, key) => {
39304
+ const numKey = Number(key);
39305
+ if (Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex) {
39306
+ numericKeys.push(numKey);
39307
+ }
39308
+ });
39309
+ numericKeys.sort((a, b) => (type === 'add' ? b - a : a - b));
39310
+ for (let i = 0; i < numericKeys.length; i++) {
39311
+ const key = numericKeys[i];
39124
39312
  const record = this.beforeChangedRecordsMap.get(key.toString());
39125
39313
  this.beforeChangedRecordsMap.delete(key.toString());
39126
- this.beforeChangedRecordsMap.set((key + (type === 'add' ? insertCount : -insertCount)).toString(), record);
39314
+ this.beforeChangedRecordsMap.set((key + delta).toString(), record);
39127
39315
  }
39128
39316
  }
39129
- deleteRecords(recordIndexs) {
39130
- if (Array.isArray(this.records)) {
39131
- const realDeletedRecordIndexs = [];
39132
- const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
39133
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39134
- const recordIndex = recordIndexsMaxToMin[index];
39135
- if (recordIndex >= this._sourceLength || recordIndex < 0) {
39136
- continue;
39317
+ deleteRecords(recordIndexs, syncToOriginalRecords = false) {
39318
+ if (!syncToOriginalRecords) {
39319
+ if (Array.isArray(this.records)) {
39320
+ const realDeletedRecordIndexs = [];
39321
+ const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
39322
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39323
+ const recordIndex = recordIndexsMaxToMin[index];
39324
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
39325
+ continue;
39326
+ }
39327
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
39328
+ realDeletedRecordIndexs.push(recordIndex);
39329
+ const deletedRecord = this.records[recordIndex];
39330
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39331
+ this.fieldAggregators[i].deleteRecord(deletedRecord);
39332
+ }
39333
+ this.records.splice(recordIndex, 1);
39334
+ this.currentIndexedData.pop();
39335
+ this._sourceLength -= 1;
39137
39336
  }
39138
- this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
39139
- realDeletedRecordIndexs.push(recordIndex);
39140
- const deletedRecord = this.records[recordIndex];
39141
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39142
- this.fieldAggregators[i].deleteRecord(deletedRecord);
39337
+ if (this.userPagination) {
39338
+ this.updatePagerData();
39143
39339
  }
39144
- this.records.splice(recordIndex, 1);
39145
- this.currentIndexedData.pop();
39146
- this._sourceLength -= 1;
39147
- }
39148
- if (this.userPagination) {
39149
- this.updatePagerData();
39340
+ else {
39341
+ this.pagination.perPageCount = this._sourceLength;
39342
+ this.pagination.totalCount = this._sourceLength;
39343
+ this.updatePagerData();
39344
+ }
39345
+ if (this.dataSourceObj?.deleted) {
39346
+ this.dataSourceObj.deleted(realDeletedRecordIndexs);
39347
+ }
39348
+ return realDeletedRecordIndexs;
39150
39349
  }
39151
- else {
39152
- this.pagination.perPageCount = this._sourceLength;
39153
- this.pagination.totalCount = this._sourceLength;
39154
- this.updatePagerData();
39350
+ return [];
39351
+ }
39352
+ const rawRecords = this._getRawRecordsArray();
39353
+ if (!rawRecords || !Array.isArray(this.records)) {
39354
+ return [];
39355
+ }
39356
+ const realDeletedRecordIndexs = [];
39357
+ const recordIndexsMaxToMin = recordIndexs.slice().sort((a, b) => b - a);
39358
+ const rawDeletedIndexs = [];
39359
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39360
+ const viewIndex = recordIndexsMaxToMin[index];
39361
+ if (viewIndex >= this.records.length || viewIndex < 0) {
39362
+ continue;
39155
39363
  }
39156
- if (this.dataSourceObj?.deleted) {
39157
- this.dataSourceObj.deleted(realDeletedRecordIndexs);
39364
+ const deletedRecord = this.records[viewIndex];
39365
+ const rawIndex = rawRecords.indexOf(deletedRecord);
39366
+ if (rawIndex >= 0) {
39367
+ rawRecords.splice(rawIndex, 1);
39368
+ rawDeletedIndexs.push(rawIndex);
39158
39369
  }
39159
- return realDeletedRecordIndexs;
39370
+ realDeletedRecordIndexs.push(viewIndex);
39160
39371
  }
39161
- return [];
39372
+ this.beforeChangedRecordsMap.clear();
39373
+ this.sortedIndexMap.clear();
39374
+ this.updateFilterRules(this.dataConfig?.filterRules);
39375
+ if (this.dataSourceObj?.deleted) {
39376
+ this.dataSourceObj.deleted(rawDeletedIndexs);
39377
+ }
39378
+ return realDeletedRecordIndexs;
39162
39379
  }
39163
39380
  deleteRecordsForSorted(recordIndexs) {
39164
39381
  if (Array.isArray(this.records)) {
@@ -39180,36 +39397,71 @@
39180
39397
  this.beforeChangedRecordsMap.clear();
39181
39398
  }
39182
39399
  }
39183
- updateRecords(records, recordIndexs) {
39184
- const realDeletedRecordIndexs = [];
39400
+ updateRecords(records, recordIndexs, syncToOriginalRecords = false) {
39401
+ if (!syncToOriginalRecords) {
39402
+ const realDeletedRecordIndexs = [];
39403
+ for (let index = 0; index < recordIndexs.length; index++) {
39404
+ const recordIndex = recordIndexs[index];
39405
+ if (Array.isArray(recordIndex)) {
39406
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
39407
+ realDeletedRecordIndexs.push(recordIndex);
39408
+ recordIndex.slice(0, -1).reduce((acc, key) => {
39409
+ if (acc[key] === undefined) {
39410
+ acc[key] = {};
39411
+ }
39412
+ return acc[key].children;
39413
+ }, this.records)[recordIndex[recordIndex.length - 1]] = records[index];
39414
+ }
39415
+ else {
39416
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
39417
+ continue;
39418
+ }
39419
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
39420
+ realDeletedRecordIndexs.push(recordIndex);
39421
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39422
+ this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
39423
+ }
39424
+ this.records[recordIndex] = records[index];
39425
+ }
39426
+ }
39427
+ if (this.userPagination) {
39428
+ this.updatePagerData();
39429
+ }
39430
+ return realDeletedRecordIndexs;
39431
+ }
39432
+ const rawRecords = this._getRawRecordsArray();
39433
+ if (!rawRecords || !Array.isArray(this.records)) {
39434
+ return [];
39435
+ }
39436
+ const realUpdatedIndexs = [];
39185
39437
  for (let index = 0; index < recordIndexs.length; index++) {
39186
39438
  const recordIndex = recordIndexs[index];
39187
39439
  if (Array.isArray(recordIndex)) {
39188
39440
  this.beforeChangedRecordsMap.delete(recordIndex.toString());
39189
- realDeletedRecordIndexs.push(recordIndex);
39441
+ realUpdatedIndexs.push(recordIndex);
39190
39442
  recordIndex.slice(0, -1).reduce((acc, key) => {
39191
39443
  if (acc[key] === undefined) {
39192
39444
  acc[key] = {};
39193
39445
  }
39194
39446
  return acc[key].children;
39195
- }, this.records)[recordIndex[recordIndex.length - 1]] = records[index];
39447
+ }, rawRecords)[recordIndex[recordIndex.length - 1]] = records[index];
39196
39448
  }
39197
39449
  else {
39198
- if (recordIndex >= this._sourceLength || recordIndex < 0) {
39450
+ if (recordIndex >= this.records.length || recordIndex < 0) {
39199
39451
  continue;
39200
39452
  }
39201
- this.beforeChangedRecordsMap.delete(recordIndex.toString());
39202
- realDeletedRecordIndexs.push(recordIndex);
39203
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39204
- this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
39453
+ const oldRecord = this.records[recordIndex];
39454
+ const rawIndex = rawRecords.indexOf(oldRecord);
39455
+ if (rawIndex >= 0) {
39456
+ rawRecords[rawIndex] = records[index];
39205
39457
  }
39206
- this.records[recordIndex] = records[index];
39458
+ realUpdatedIndexs.push(recordIndex);
39207
39459
  }
39208
39460
  }
39209
- if (this.userPagination) {
39210
- this.updatePagerData();
39211
- }
39212
- return realDeletedRecordIndexs;
39461
+ this.beforeChangedRecordsMap.clear();
39462
+ this.sortedIndexMap.clear();
39463
+ this.updateFilterRules(this.dataConfig?.filterRules);
39464
+ return realUpdatedIndexs;
39213
39465
  }
39214
39466
  updateRecordsForSorted(records, recordIndexs) {
39215
39467
  for (let index = 0; index < recordIndexs.length; index++) {
@@ -39290,7 +39542,11 @@
39290
39542
  }
39291
39543
  }
39292
39544
  if (!filedMapArray.length) {
39293
- filedMapArray = states.map(() => ({ asc: [], desc: [], normal: [] }));
39545
+ filedMapArray = states.map(() => ({
39546
+ asc: [],
39547
+ desc: [],
39548
+ normal: []
39549
+ }));
39294
39550
  for (let index = 0; index < states.length; index++) {
39295
39551
  this.sortedIndexMap.set(states[index].field, filedMapArray[index]);
39296
39552
  }
@@ -39305,6 +39561,16 @@
39305
39561
  setSortedIndexMap(field, filedMap) {
39306
39562
  this.sortedIndexMap.set(field, filedMap);
39307
39563
  }
39564
+ markForceVisibleRecord(record) {
39565
+ if (!record || (typeof record !== 'object' && typeof record !== 'function')) {
39566
+ return;
39567
+ }
39568
+ this._forceVisibleRecords ||= new WeakSet();
39569
+ this._forceVisibleRecords.add(record);
39570
+ }
39571
+ clearForceVisibleRecords() {
39572
+ this._forceVisibleRecords = undefined;
39573
+ }
39308
39574
  clearFilteredChildren(record) {
39309
39575
  record.filteredChildren = undefined;
39310
39576
  for (let i = 0; i < (record.children?.length ?? 0); i++) {
@@ -39312,6 +39578,9 @@
39312
39578
  }
39313
39579
  }
39314
39580
  filterRecord(record) {
39581
+ if (this._forceVisibleRecords?.has(record)) {
39582
+ return true;
39583
+ }
39315
39584
  let isReserved = true;
39316
39585
  for (let i = 0; i < this.dataConfig.filterRules?.length; i++) {
39317
39586
  const filterRule = this.dataConfig?.filterRules[i];
@@ -44934,8 +45203,18 @@
44934
45203
  }
44935
45204
  image.failCallback = () => {
44936
45205
  const regedIcons = get$2();
44937
- image.image = regedIcons.damage_pic.svg;
45206
+ image.image = regedIcons.image_damage_pic
45207
+ ? regedIcons.image_damage_pic.svg
45208
+ : regedIcons.damage_pic.svg;
44938
45209
  };
45210
+ if (typeof value === 'string') {
45211
+ if (!(value.startsWith('<svg') || isValidUrl$1(value) || value.includes('/') || isBase64$1(value))) {
45212
+ const regedIcons = get$2();
45213
+ image.image = regedIcons.image_damage_pic
45214
+ ? regedIcons.image_damage_pic.svg
45215
+ : regedIcons.damage_pic.svg;
45216
+ }
45217
+ }
44939
45218
  cellGroup.appendChild(image);
44940
45219
  return cellGroup;
44941
45220
  }
@@ -45145,7 +45424,9 @@
45145
45424
  }
45146
45425
  function isDamagePic(image) {
45147
45426
  const regedIcons = get$2();
45148
- return image.attribute.image === regedIcons.damage_pic.svg;
45427
+ return (image.attribute.image === regedIcons.damage_pic.svg ||
45428
+ (regedIcons.image_damage_pic && image.attribute.image === regedIcons.image_damage_pic.svg) ||
45429
+ (regedIcons.video_damage_pic && image.attribute.image === regedIcons.video_damage_pic.svg));
45149
45430
  }
45150
45431
 
45151
45432
  function dealPromiseData(dataPromise, tabel, callback) {
@@ -45489,11 +45770,7 @@
45489
45770
  if (!addNew && oldCellGroup.role === 'empty') {
45490
45771
  return undefined;
45491
45772
  }
45492
- const type = isVtableMerge || isCustomMerge
45493
- ? 'text'
45494
- : table.isHeader(col, row)
45495
- ? table._getHeaderLayoutMap(col, row).headerType ?? 'text'
45496
- : table.getBodyColumnType(col, row) ?? 'text';
45773
+ const type = isVtableMerge || isCustomMerge ? 'text' : table.getCellType(col, row);
45497
45774
  const padding = cellTheme._vtable.padding;
45498
45775
  const textAlign = cellTheme.text.textAlign;
45499
45776
  const textBaseline = cellTheme.text.textBaseline;
@@ -46385,9 +46662,7 @@
46385
46662
  (table.isRightFrozenColumn(col) && table.isBottomFrozenRow(row)))) {
46386
46663
  continue;
46387
46664
  }
46388
- const cellType = table.isHeader(col, row)
46389
- ? table._getHeaderLayoutMap(col, row)?.headerType
46390
- : table.getBodyColumnType(col, row);
46665
+ const cellType = table.getCellType(col, row);
46391
46666
  const textHeight = computeTextHeight(col, row, cellType, table);
46392
46667
  maxHeight = isValid$1(maxHeight) ? Math.max(textHeight, maxHeight) : textHeight;
46393
46668
  }
@@ -46820,11 +47095,7 @@
46820
47095
  cell.setAttribute('height', distHeight);
46821
47096
  const isVtableMerge = scene.table.getCellRawRecord(col, row)?.vtableMerge;
46822
47097
  const isCustomMerge = !!scene.table.getCustomMerge(col, row);
46823
- const type = isVtableMerge || isCustomMerge
46824
- ? 'text'
46825
- : scene.table.isHeader(col, row)
46826
- ? scene.table._getHeaderLayoutMap(col, row).headerType ?? 'text'
46827
- : scene.table.getBodyColumnType(col, row) ?? 'text';
47098
+ const type = isVtableMerge || isCustomMerge ? 'text' : scene.table.getCellType(col, row);
46828
47099
  if (type === 'progressbar') {
46829
47100
  const columnDefine = scene.table.getBodyColumnDefine(col, row);
46830
47101
  const style = scene.table._getCellStyle(col, row);
@@ -47163,11 +47434,7 @@
47163
47434
  const autoRowHeight = scene.table.isAutoRowHeight(row);
47164
47435
  const isVtableMerge = scene.table.getCellRawRecord(col, row)?.vtableMerge;
47165
47436
  const isCustomMerge = !!scene.table.getCustomMerge(col, row);
47166
- const type = isVtableMerge || isCustomMerge
47167
- ? 'text'
47168
- : scene.table.isHeader(col, row)
47169
- ? scene.table._getHeaderLayoutMap(col, row).headerType ?? 'text'
47170
- : scene.table.getBodyColumnType(col, row) ?? 'text';
47437
+ const type = isVtableMerge || isCustomMerge ? 'text' : scene.table.getCellType(col, row);
47171
47438
  let isHeightChange = false;
47172
47439
  if (type === 'progressbar') {
47173
47440
  const columnDefine = scene.table.getBodyColumnDefine(col, row);
@@ -52745,9 +53012,7 @@
52745
53012
  maxWidth = Math.max(indicatorWidth, maxWidth);
52746
53013
  continue;
52747
53014
  }
52748
- const cellType = table.isHeader(col, row)
52749
- ? table._getHeaderLayoutMap(col, row)?.headerType
52750
- : table.getBodyColumnType(col, row);
53015
+ const cellType = table.getCellType(col, row);
52751
53016
  if (isValid$1(cellType) &&
52752
53017
  cellType !== 'text' &&
52753
53018
  cellType !== 'link' &&
@@ -53317,11 +53582,7 @@
53317
53582
  }
53318
53583
  }
53319
53584
  }
53320
- const type = isVtableMerge || isCustomMerge
53321
- ? 'text'
53322
- : (table.isHeader(col, row)
53323
- ? table._getHeaderLayoutMap(col, row).headerType ?? 'text'
53324
- : table.getBodyColumnType(col, row)) ?? 'text';
53585
+ const type = isVtableMerge || isCustomMerge ? 'text' : table.getCellType(col, row);
53325
53586
  if (isPromise(value)) {
53326
53587
  createEmptyCellGroup(col, row, 0, y, cellWidth, cellHeight, columnGroup);
53327
53588
  dealPromiseData(value, table, callCreateCellForPromiseValue.bind(null, {
@@ -59496,11 +59757,7 @@
59496
59757
  }
59497
59758
  updateCellContentWhileResize(col, row) {
59498
59759
  const isVtableMerge = this.table.getCellRawRecord(col, row)?.vtableMerge;
59499
- const type = isVtableMerge
59500
- ? 'text'
59501
- : this.table.isHeader(col, row)
59502
- ? this.table._getHeaderLayoutMap(col, row).headerType
59503
- : this.table.getBodyColumnType(col, row);
59760
+ const type = isVtableMerge ? 'text' : this.table.getCellType(col, row);
59504
59761
  const cellGroup = this.getCell(col, row);
59505
59762
  if (type === 'image' || type === 'video') {
59506
59763
  updateImageCellContentWhileResize(cellGroup, col, row, 0, 0, this.table);
@@ -63384,15 +63641,7 @@
63384
63641
  if (e.target.type === 'image' && e.target.role && e.target.role.startsWith('icon')) {
63385
63642
  return;
63386
63643
  }
63387
- let cellType;
63388
- if (table.internalProps.layoutMap.isHeader(col, row)) {
63389
- cellType = table.isPivotTable()
63390
- ? table._getHeaderLayoutMap(col, row).headerType
63391
- : table.getHeaderDefine(col, row).headerType;
63392
- }
63393
- else {
63394
- cellType = table.getBodyColumnType(col, row);
63395
- }
63644
+ const cellType = table.getCellType(col, row);
63396
63645
  const columnDefine = table.isHeader(col, row)
63397
63646
  ? table.getHeaderDefine(col, row)
63398
63647
  : table.getBodyColumnDefine(col, row);
@@ -63429,7 +63678,9 @@
63429
63678
  }
63430
63679
  const data = Object.assign({
63431
63680
  __value: cellValue,
63432
- __dataValue: cellOriginValue
63681
+ __dataValue: cellOriginValue,
63682
+ value: cellValue,
63683
+ dataValue: cellOriginValue
63433
63684
  }, rowData);
63434
63685
  if (isFunction$3(templateLink)) {
63435
63686
  url = templateLink(data, col, row, table);
@@ -63483,6 +63734,7 @@
63483
63734
  image.src = cellValue;
63484
63735
  image.style.maxWidth = '80%';
63485
63736
  image.style.maxHeight = '80%';
63737
+ image.style.backgroundColor = '#FFF';
63486
63738
  overlay.appendChild(image);
63487
63739
  document.body.appendChild(overlay);
63488
63740
  }
@@ -64230,7 +64482,7 @@
64230
64482
  }
64231
64483
  }
64232
64484
  const disableSelectOnContextMenu = table.options.select?.disableSelectOnContextMenu;
64233
- if (!cellInRange && !disableSelectOnContextMenu) {
64485
+ if (!cellInRange && !disableSelectOnContextMenu && eventArgsSet?.eventArgs?.target.type !== 'chart') {
64234
64486
  table.selectCell(col, row);
64235
64487
  }
64236
64488
  if (table.hasListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL)) {
@@ -64804,6 +65056,7 @@
64804
65056
  selectedRanges[0].start.col === selectedRanges[0].end.col &&
64805
65057
  selectedRanges[0].start.row === selectedRanges[0].end.row;
64806
65058
  const editor = justOneCellSelected &&
65059
+ table.getEditor &&
64807
65060
  table.getEditor(table.stateManager.select.cellPos.col, table.stateManager.select.cellPos.row);
64808
65061
  const editorInput = editor?.getInputElement?.();
64809
65062
  if (editorInput === relatedTarget) {
@@ -65926,6 +66179,7 @@
65926
66179
  cutOperationTime = 0;
65927
66180
  lastClipboardContent = '';
65928
66181
  cutCellRange = null;
66182
+ cutRanges = null;
65929
66183
  copySourceRange = null;
65930
66184
  constructor(table) {
65931
66185
  this.table = table;
@@ -66445,6 +66699,10 @@
66445
66699
  this.handleCopy(e, true);
66446
66700
  this.cutWaitPaste = true;
66447
66701
  this.cutCellRange = this.table.getSelectedCellInfos();
66702
+ this.cutRanges = this.table.stateManager.select.ranges?.map(r => ({
66703
+ start: { col: r.start.col, row: r.start.row },
66704
+ end: { col: r.end.col, row: r.end.row }
66705
+ }));
66448
66706
  if (this.clipboardCheckTimer) {
66449
66707
  clearTimeout(this.clipboardCheckTimer);
66450
66708
  }
@@ -66452,6 +66710,7 @@
66452
66710
  if (this.cutWaitPaste) {
66453
66711
  this.cutWaitPaste = false;
66454
66712
  this.cutCellRange = null;
66713
+ this.cutRanges = null;
66455
66714
  this.clipboardCheckTimer = null;
66456
66715
  }
66457
66716
  }, 30000);
@@ -66471,6 +66730,7 @@
66471
66730
  if (this.cutWaitPaste) {
66472
66731
  this.cutWaitPaste = false;
66473
66732
  this.cutCellRange = null;
66733
+ this.cutRanges = null;
66474
66734
  if (this.clipboardCheckTimer) {
66475
66735
  clearTimeout(this.clipboardCheckTimer);
66476
66736
  this.clipboardCheckTimer = null;
@@ -66586,17 +66846,11 @@
66586
66846
  }
66587
66847
  clearCutArea(table) {
66588
66848
  try {
66589
- const selectCells = this.cutCellRange;
66590
- if (!selectCells || selectCells.length === 0) {
66849
+ const ranges = this.cutRanges;
66850
+ if (!ranges || ranges.length === 0) {
66591
66851
  return;
66592
66852
  }
66593
- for (let i = 0; i < selectCells.length; i++) {
66594
- for (let j = 0; j < selectCells[i].length; j++) {
66595
- if (selectCells[i][j]) {
66596
- table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, undefined);
66597
- }
66598
- }
66599
- }
66853
+ table.changeCellValuesByRanges(ranges, '');
66600
66854
  }
66601
66855
  catch (error) {
66602
66856
  }
@@ -70164,6 +70418,15 @@
70164
70418
  this.customCellStyleArrangement.push(...compacted);
70165
70419
  this._rebuildCustomCellStyleArrangementIndex();
70166
70420
  }
70421
+ clearCustomCellStyleArrangement() {
70422
+ this.customCellStyleArrangement = [];
70423
+ }
70424
+ addCustomCellStyleArrangement(cellPosition, customStyleId) {
70425
+ this.customCellStyleArrangement.push({
70426
+ cellPosition,
70427
+ customStyleId
70428
+ });
70429
+ }
70167
70430
  getCustomCellStyle(col, row) {
70168
70431
  const customStyleIds = this.getCustomCellStyleIds(col, row);
70169
70432
  if (customStyleIds.length) {
@@ -70429,7 +70692,7 @@
70429
70692
  layoutMap.isRightTopCorner(col, row))) {
70430
70693
  return EMPTY_STYLE;
70431
70694
  }
70432
- const styleClass = table.internalProps.headerHelper.getStyleClass(hd?.headerType || 'text');
70695
+ const styleClass = table.internalProps.headerHelper.getStyleClass(table.getCellType(col, row));
70433
70696
  if (layoutMap.isBottomFrozenRow(col, row) && table.theme.bottomFrozenStyle) {
70434
70697
  cacheStyle = of(paddingForAxis ? { padding: paddingForAxis } : {}, table.theme.bottomFrozenStyle, {
70435
70698
  col,
@@ -70742,7 +71005,7 @@
70742
71005
  return TABLE_EVENT_TYPE;
70743
71006
  }
70744
71007
  options;
70745
- version = "1.23.1-alpha.2";
71008
+ version = "1.23.2";
70746
71009
  pagination;
70747
71010
  id = `VTable${Date.now()}`;
70748
71011
  headerStyleCache;
@@ -76828,9 +77091,10 @@
76828
77091
  return { addRecordRule };
76829
77092
  }
76830
77093
 
76831
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
77094
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
76832
77095
  if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
76833
- const recordIndex = table.getRecordShowIndexByCell(col, row);
77096
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row);
77097
+ const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76834
77098
  const { field } = table.internalProps.layoutMap.getBody(col, row);
76835
77099
  const beforeChangeValue = table.getCellRawValue(col, row);
76836
77100
  const oldValue = table.getCellOriginValue(col, row);
@@ -76838,7 +77102,7 @@
76838
77102
  table.internalProps.layoutMap.updateColumnTitle(col, row, value);
76839
77103
  }
76840
77104
  else {
76841
- table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
77105
+ table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
76842
77106
  }
76843
77107
  const range = table.getCellRange(col, row);
76844
77108
  const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
@@ -76891,18 +77155,24 @@
76891
77155
  }
76892
77156
  const changedValue = table.getCellOriginValue(col, row);
76893
77157
  if (oldValue !== changedValue && triggerEvent) {
76894
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
77158
+ const changeValue = {
76895
77159
  col,
76896
77160
  row,
77161
+ recordIndex,
77162
+ field,
76897
77163
  rawValue: beforeChangeValue,
76898
77164
  currentValue: oldValue,
76899
77165
  changedValue
76900
- });
77166
+ };
77167
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
77168
+ if (!noTriggerChangeCellValuesEvent) {
77169
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
77170
+ }
76901
77171
  }
76902
77172
  table.scenegraph.updateNextFrame();
76903
77173
  }
76904
77174
  }
76905
- async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
77175
+ async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
76906
77176
  const changedCellResults = [];
76907
77177
  let pasteColEnd = startCol;
76908
77178
  let pasteRowEnd = startRow;
@@ -76929,6 +77199,7 @@
76929
77199
  oldRowValues.push(oldValue);
76930
77200
  }
76931
77201
  }
77202
+ const resultChangeValues = [];
76932
77203
  for (let i = 0; i < values.length; i++) {
76933
77204
  if (startRow + i > table.rowCount - 1) {
76934
77205
  break;
@@ -76968,7 +77239,8 @@
76968
77239
  if (isCanChange) {
76969
77240
  changedCellResults[i][j] = true;
76970
77241
  const value = rowValues[j];
76971
- const recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
77242
+ const recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
77243
+ const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76972
77244
  const { field } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i);
76973
77245
  const beforeChangeValue = beforeChangeValues[i][j];
76974
77246
  const oldValue = oldValues[i][j];
@@ -76976,17 +77248,21 @@
76976
77248
  table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value);
76977
77249
  }
76978
77250
  else {
76979
- table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
77251
+ table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
76980
77252
  }
76981
77253
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
76982
77254
  if (oldValue !== changedValue && triggerEvent) {
76983
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
77255
+ const changeValue = {
76984
77256
  col: startCol + j,
76985
77257
  row: startRow + i,
77258
+ recordIndex,
77259
+ field,
76986
77260
  rawValue: beforeChangeValue,
76987
77261
  currentValue: oldValue,
76988
77262
  changedValue
76989
- });
77263
+ };
77264
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
77265
+ resultChangeValues.push(changeValue);
76990
77266
  }
76991
77267
  }
76992
77268
  else {
@@ -76995,6 +77271,9 @@
76995
77271
  }
76996
77272
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
76997
77273
  }
77274
+ if (!noTriggerChangeCellValuesEvent) {
77275
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
77276
+ }
76998
77277
  const startRange = table.getCellRange(startCol, startRow);
76999
77278
  const range = table.getCellRange(pasteColEnd, pasteRowEnd);
77000
77279
  const aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -77067,6 +77346,68 @@
77067
77346
  table.scenegraph.updateNextFrame();
77068
77347
  return changedCellResults;
77069
77348
  }
77349
+ async function listTableChangeCellValuesByRanges(ranges, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
77350
+ const resultChangeValues = [];
77351
+ const processed = new Set();
77352
+ const nextValue = (value ?? '');
77353
+ for (let i = 0; i < (ranges?.length ?? 0); i++) {
77354
+ const range = ranges[i];
77355
+ const startCol = Math.min(range.start.col, range.end.col);
77356
+ const endCol = Math.max(range.start.col, range.end.col);
77357
+ const startRow = Math.min(range.start.row, range.end.row);
77358
+ const endRow = Math.max(range.start.row, range.end.row);
77359
+ if (startCol > endCol || startRow > endRow) {
77360
+ continue;
77361
+ }
77362
+ const values = [];
77363
+ const oldValues = [];
77364
+ for (let row = startRow; row <= endRow; row++) {
77365
+ const rowValues = [];
77366
+ const rowOldValues = [];
77367
+ for (let col = startCol; col <= endCol; col++) {
77368
+ rowValues.push(nextValue);
77369
+ rowOldValues.push(table.getCellOriginValue(col, row));
77370
+ }
77371
+ values.push(rowValues);
77372
+ oldValues.push(rowOldValues);
77373
+ }
77374
+ const changedCellResults = await listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, true);
77375
+ for (let r = 0; r < values.length; r++) {
77376
+ for (let c = 0; c < values[r].length; c++) {
77377
+ const col = startCol + c;
77378
+ const row = startRow + r;
77379
+ const key = `${col},${row}`;
77380
+ if (processed.has(key)) {
77381
+ continue;
77382
+ }
77383
+ processed.add(key);
77384
+ if (!triggerEvent || !changedCellResults?.[r]?.[c]) {
77385
+ continue;
77386
+ }
77387
+ const oldValue = oldValues[r][c];
77388
+ const changedValue = table.getCellOriginValue(col, row);
77389
+ if (oldValue === changedValue) {
77390
+ continue;
77391
+ }
77392
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row);
77393
+ const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
77394
+ const { field } = table.internalProps.layoutMap.getBody(col, row);
77395
+ resultChangeValues.push({
77396
+ col,
77397
+ row,
77398
+ recordIndex,
77399
+ field,
77400
+ rawValue: oldValue,
77401
+ currentValue: oldValue,
77402
+ changedValue
77403
+ });
77404
+ }
77405
+ }
77406
+ }
77407
+ if (!noTriggerChangeCellValuesEvent && triggerEvent) {
77408
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
77409
+ }
77410
+ }
77070
77411
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
77071
77412
  if (oldCellUpdateType === 'group') {
77072
77413
  return oldCellUpdateType;
@@ -77120,7 +77461,13 @@
77120
77461
  table.scenegraph.createSceneGraph();
77121
77462
  }
77122
77463
  else if (table.sortState) {
77123
- table.dataSource.addRecordForSorted(record);
77464
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77465
+ if (syncToOriginalRecords) {
77466
+ table.dataSource.addRecord(record, table.dataSource.records.length, true);
77467
+ }
77468
+ else {
77469
+ table.dataSource.addRecordForSorted(record);
77470
+ }
77124
77471
  table.stateManager.checkedState.clear();
77125
77472
  sortRecords(table);
77126
77473
  table.refreshRowColCount();
@@ -77133,8 +77480,16 @@
77133
77480
  recordIndex = table.dataSource.sourceLength;
77134
77481
  }
77135
77482
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
77136
- table.dataSource.addRecord(record, recordIndex);
77483
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77484
+ table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords);
77137
77485
  adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
77486
+ if (syncToOriginalRecords) {
77487
+ table.refreshRowColCount();
77488
+ table.internalProps.layoutMap.clearCellRangeMap();
77489
+ table.scenegraph.clearCells();
77490
+ table.scenegraph.createSceneGraph();
77491
+ return true;
77492
+ }
77138
77493
  const oldRowCount = table.rowCount;
77139
77494
  table.refreshRowColCount();
77140
77495
  if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
@@ -77246,7 +77601,13 @@
77246
77601
  table.scenegraph.createSceneGraph();
77247
77602
  }
77248
77603
  else if (table.sortState) {
77249
- table.dataSource.addRecordsForSorted(records);
77604
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77605
+ if (syncToOriginalRecords) {
77606
+ table.dataSource.addRecords(records, table.dataSource.records.length, true);
77607
+ }
77608
+ else {
77609
+ table.dataSource.addRecordsForSorted(records);
77610
+ }
77250
77611
  sortRecords(table);
77251
77612
  table.refreshRowColCount();
77252
77613
  table.scenegraph.clearCells();
@@ -77261,8 +77622,16 @@
77261
77622
  recordIndex = 0;
77262
77623
  }
77263
77624
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
77264
- table.dataSource.addRecords(records, recordIndex);
77625
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77626
+ table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords);
77265
77627
  adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
77628
+ if (syncToOriginalRecords) {
77629
+ table.refreshRowColCount();
77630
+ table.internalProps.layoutMap.clearCellRangeMap();
77631
+ table.scenegraph.clearCells();
77632
+ table.scenegraph.createSceneGraph();
77633
+ return true;
77634
+ }
77266
77635
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
77267
77636
  table.refreshRowColCount();
77268
77637
  if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
@@ -77378,20 +77747,34 @@
77378
77747
  table.scenegraph.createSceneGraph();
77379
77748
  }
77380
77749
  else if (table.sortState) {
77381
- table.dataSource.deleteRecordsForSorted(recordIndexs);
77750
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77751
+ if (syncToOriginalRecords) {
77752
+ table.dataSource.deleteRecords(recordIndexs, true);
77753
+ }
77754
+ else {
77755
+ table.dataSource.deleteRecordsForSorted(recordIndexs);
77756
+ }
77382
77757
  sortRecords(table);
77383
77758
  table.refreshRowColCount();
77384
77759
  table.scenegraph.clearCells();
77385
77760
  table.scenegraph.createSceneGraph();
77386
77761
  }
77387
77762
  else {
77388
- const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);
77763
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77764
+ const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
77389
77765
  if (deletedRecordIndexs.length === 0) {
77390
77766
  return;
77391
77767
  }
77392
77768
  for (let index = 0; index < deletedRecordIndexs.length; index++) {
77393
77769
  adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
77394
77770
  }
77771
+ if (syncToOriginalRecords) {
77772
+ table.refreshRowColCount();
77773
+ table.internalProps.layoutMap.clearCellRangeMap();
77774
+ table.scenegraph.clearCells();
77775
+ table.scenegraph.createSceneGraph();
77776
+ return;
77777
+ }
77395
77778
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
77396
77779
  table.refreshRowColCount();
77397
77780
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -77509,18 +77892,32 @@
77509
77892
  table.scenegraph.createSceneGraph();
77510
77893
  }
77511
77894
  else if (table.sortState) {
77512
- table.dataSource.updateRecordsForSorted(records, recordIndexs);
77895
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77896
+ if (syncToOriginalRecords) {
77897
+ table.dataSource.updateRecords(records, recordIndexs, true);
77898
+ }
77899
+ else {
77900
+ table.dataSource.updateRecordsForSorted(records, recordIndexs);
77901
+ }
77513
77902
  sortRecords(table);
77514
77903
  table.refreshRowColCount();
77515
77904
  table.scenegraph.clearCells();
77516
77905
  table.scenegraph.createSceneGraph();
77517
77906
  }
77518
77907
  else {
77519
- const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);
77908
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77909
+ const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
77520
77910
  if (updateRecordIndexs.length === 0) {
77521
77911
  return;
77522
77912
  }
77523
- const bodyRowIndex = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index));
77913
+ if (syncToOriginalRecords) {
77914
+ table.refreshRowColCount();
77915
+ table.internalProps.layoutMap.clearCellRangeMap();
77916
+ table.scenegraph.clearCells();
77917
+ table.scenegraph.createSceneGraph();
77918
+ return;
77919
+ }
77920
+ const bodyRowIndex = updateRecordIndexs.map((index) => table.getBodyRowIndexByRecordIndex(index));
77524
77921
  const recordIndexsMinToMax = bodyRowIndex.sort((a, b) => a - b);
77525
77922
  if (table.pagination) {
77526
77923
  const { perPageCount, currentPage } = table.pagination;
@@ -78697,6 +79094,7 @@
78697
79094
  }
78698
79095
  updateFilterRules(filterRules, options = { clearRowHeightCache: true }) {
78699
79096
  this.scenegraph.clearCells();
79097
+ this.dataSource.clearForceVisibleRecords?.();
78700
79098
  if (this.sortState) {
78701
79099
  this.dataSource.updateFilterRulesForSorted(filterRules);
78702
79100
  sortRecords(this);
@@ -78928,17 +79326,182 @@
78928
79326
  }
78929
79327
  return isValid$1(editorDefine);
78930
79328
  }
78931
- changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true) {
78932
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
79329
+ changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true, noTriggerChangeCellValuesEvent) {
79330
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
79331
+ }
79332
+ changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true, noTriggerChangeCellValuesEvent) {
79333
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
79334
+ }
79335
+ changeCellValuesByRanges(ranges, value, workOnEditableCell = false, triggerEvent = true, noTriggerChangeCellValuesEvent) {
79336
+ return listTableChangeCellValuesByRanges(ranges, value, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
79337
+ }
79338
+ changeSourceCellValue(recordIndex, field, value) {
79339
+ const tableIndex = this.getTableIndexByRecordIndex(recordIndex);
79340
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
79341
+ if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) {
79342
+ return;
79343
+ }
79344
+ this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
79345
+ const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row);
79346
+ const oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
79347
+ const changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
79348
+ if (oldValue !== changedValue) {
79349
+ const changeValue = {
79350
+ col: cellAddr.col,
79351
+ row: cellAddr.row,
79352
+ recordIndex,
79353
+ field,
79354
+ rawValue: beforeChangeValue,
79355
+ currentValue: oldValue,
79356
+ changedValue
79357
+ };
79358
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
79359
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
79360
+ }
79361
+ }
79362
+ changeCellValueByRecord(recordIndex, field, value, options) {
79363
+ const triggerEvent = options?.triggerEvent ?? true;
79364
+ const noTriggerChangeCellValuesEvent = options?.noTriggerChangeCellValuesEvent;
79365
+ const autoRefresh = options?.autoRefresh ?? true;
79366
+ const records = this.dataSource.dataSourceObj?.records;
79367
+ let record;
79368
+ let oldValue;
79369
+ if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
79370
+ record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
79371
+ oldValue = record?.[field];
79372
+ }
79373
+ this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
79374
+ if (!triggerEvent) {
79375
+ return;
79376
+ }
79377
+ const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
79378
+ if (oldValue !== changedValue) {
79379
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
79380
+ const changeValue = {
79381
+ col: cellAddr?.col ?? -1,
79382
+ row: cellAddr?.row ?? -1,
79383
+ recordIndex,
79384
+ field,
79385
+ rawValue: oldValue,
79386
+ currentValue: oldValue,
79387
+ changedValue
79388
+ };
79389
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
79390
+ if (!noTriggerChangeCellValuesEvent) {
79391
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
79392
+ }
79393
+ }
79394
+ if (autoRefresh) {
79395
+ this.refreshAfterSourceChange();
79396
+ }
79397
+ }
79398
+ changeCellValueBySource(recordIndex, field, value, triggerEvent = true, noTriggerChangeCellValuesEvent) {
79399
+ return this.changeCellValueByRecord(recordIndex, field, value, {
79400
+ triggerEvent,
79401
+ noTriggerChangeCellValuesEvent,
79402
+ autoRefresh: true
79403
+ });
79404
+ }
79405
+ changeCellValuesByRecords(changeValues, options) {
79406
+ const triggerEvent = options?.triggerEvent ?? true;
79407
+ const noTriggerChangeCellValuesEvent = options?.noTriggerChangeCellValuesEvent;
79408
+ const autoRefresh = options?.autoRefresh ?? true;
79409
+ const resultChangeValues = [];
79410
+ for (let i = 0; i < changeValues.length; i++) {
79411
+ const { recordIndex, field, value } = changeValues[i];
79412
+ const records = this.dataSource.dataSourceObj?.records;
79413
+ let record;
79414
+ let oldValue;
79415
+ if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
79416
+ record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
79417
+ oldValue = record?.[field];
79418
+ }
79419
+ this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
79420
+ if (triggerEvent) {
79421
+ const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
79422
+ if (oldValue !== changedValue) {
79423
+ const changeValue = {
79424
+ col: (this.getCellAddrByFieldRecord(field, recordIndex)?.col ?? -1),
79425
+ row: (this.getCellAddrByFieldRecord(field, recordIndex)?.row ?? -1),
79426
+ recordIndex,
79427
+ field,
79428
+ rawValue: oldValue,
79429
+ currentValue: oldValue,
79430
+ changedValue
79431
+ };
79432
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
79433
+ resultChangeValues.push(changeValue);
79434
+ }
79435
+ }
79436
+ }
79437
+ if (!noTriggerChangeCellValuesEvent && resultChangeValues.length && triggerEvent) {
79438
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
79439
+ }
79440
+ if (autoRefresh) {
79441
+ this.refreshAfterSourceChange();
79442
+ }
79443
+ }
79444
+ changeCellValuesBySource(changeValues, triggerEvent = true, noTriggerChangeCellValuesEvent) {
79445
+ return this.changeCellValuesByRecords(changeValues, {
79446
+ triggerEvent,
79447
+ noTriggerChangeCellValuesEvent,
79448
+ autoRefresh: true
79449
+ });
78933
79450
  }
78934
- changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true) {
78935
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
79451
+ refreshAfterSourceChange(options) {
79452
+ const reapplyFilter = options?.reapplyFilter ?? true;
79453
+ const reapplySort = options?.reapplySort ?? true;
79454
+ const clearRowHeightCache = options?.clearRowHeightCache ?? true;
79455
+ this.scenegraph.clearCells();
79456
+ if (this.sortState && reapplySort) {
79457
+ this.dataSource.clearSortedIndexMap?.();
79458
+ this.dataSource.sortedIndexMap?.clear?.();
79459
+ }
79460
+ if (reapplyFilter) {
79461
+ if (this.sortState && reapplySort) {
79462
+ this.dataSource.updateFilterRulesForSorted(this.dataSource.dataConfig?.filterRules);
79463
+ sortRecords(this);
79464
+ }
79465
+ else {
79466
+ this.dataSource.updateFilterRules(this.dataSource.dataConfig?.filterRules);
79467
+ }
79468
+ }
79469
+ else if (this.sortState && reapplySort) {
79470
+ sortRecords(this);
79471
+ }
79472
+ const traverseColumns = (columns) => {
79473
+ for (let i = 0; i < (columns?.length ?? 0); i++) {
79474
+ const column = columns[i];
79475
+ const aggregators = column?.vtable_aggregator;
79476
+ if (aggregators) {
79477
+ if (Array.isArray(aggregators)) {
79478
+ for (let j = 0; j < aggregators.length; j++) {
79479
+ aggregators[j]?.recalculate?.();
79480
+ }
79481
+ }
79482
+ else {
79483
+ aggregators?.recalculate?.();
79484
+ }
79485
+ }
79486
+ if (column?.columns) {
79487
+ traverseColumns(column.columns);
79488
+ }
79489
+ }
79490
+ };
79491
+ traverseColumns(this.internalProps.columns);
79492
+ this.refreshRowColCount();
79493
+ this.internalProps.layoutMap.clearCellRangeMap();
79494
+ this.internalProps.useOneRowHeightFillAll = false;
79495
+ this.stateManager.initCheckedState(this.records);
79496
+ this.scenegraph.createSceneGraph(!clearRowHeightCache);
79497
+ this.internalProps.emptyTip?.resetVisible();
79498
+ this.resize();
78936
79499
  }
78937
- addRecord(record, recordIndex) {
79500
+ addRecord(record, recordIndex, triggerEvent = true) {
78938
79501
  const success = listTableAddRecord(record, recordIndex, this);
78939
79502
  adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]);
78940
79503
  this.internalProps.emptyTip?.resetVisible();
78941
- if (success) {
79504
+ if (triggerEvent && success) {
78942
79505
  this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78943
79506
  records: [record],
78944
79507
  recordIndex,
@@ -78946,13 +79509,13 @@
78946
79509
  });
78947
79510
  }
78948
79511
  }
78949
- addRecords(records, recordIndex) {
79512
+ addRecords(records, recordIndex, triggerEvent = true) {
78950
79513
  const success = listTableAddRecords(records, recordIndex, this);
78951
79514
  if (typeof recordIndex === 'number') {
78952
79515
  adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records);
78953
79516
  }
78954
79517
  this.internalProps.emptyTip?.resetVisible();
78955
- if (success) {
79518
+ if (triggerEvent && success) {
78956
79519
  this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78957
79520
  records,
78958
79521
  recordIndex,
@@ -78960,7 +79523,20 @@
78960
79523
  });
78961
79524
  }
78962
79525
  }
78963
- deleteRecords(recordIndexs) {
79526
+ deleteRecords(recordIndexs, triggerEvent = true) {
79527
+ const deletedRecords = [];
79528
+ if (recordIndexs?.length > 0) {
79529
+ recordIndexs.forEach(index => {
79530
+ let record = null;
79531
+ if (typeof index === 'number') {
79532
+ record = this.dataSource.get(index);
79533
+ }
79534
+ else {
79535
+ record = [];
79536
+ }
79537
+ deletedRecords.push(record);
79538
+ });
79539
+ }
78964
79540
  listTableDeleteRecords(recordIndexs, this);
78965
79541
  adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs);
78966
79542
  this.internalProps.emptyTip?.resetVisible();
@@ -78968,21 +79544,26 @@
78968
79544
  for (let i = 0; i < recordIndexs.length; i++) {
78969
79545
  rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
78970
79546
  }
78971
- this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
78972
- recordIndexs,
78973
- rowIndexs,
78974
- deletedCount: Array.isArray(recordIndexs[0])
78975
- ? recordIndexs.length
78976
- : recordIndexs.length
78977
- });
79547
+ if (triggerEvent) {
79548
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
79549
+ recordIndexs,
79550
+ records: deletedRecords,
79551
+ rowIndexs,
79552
+ deletedCount: Array.isArray(recordIndexs[0])
79553
+ ? recordIndexs.length
79554
+ : recordIndexs.length
79555
+ });
79556
+ }
78978
79557
  }
78979
- updateRecords(records, recordIndexs) {
79558
+ updateRecords(records, recordIndexs, triggerEvent = true) {
78980
79559
  listTableUpdateRecords(records, recordIndexs, this);
78981
- this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
78982
- records,
78983
- recordIndexs,
78984
- updateCount: records.length
78985
- });
79560
+ if (triggerEvent) {
79561
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
79562
+ records,
79563
+ recordIndexs,
79564
+ updateCount: records.length
79565
+ });
79566
+ }
78986
79567
  }
78987
79568
  _hasCustomRenderOrLayout() {
78988
79569
  const { headerObjects } = this.internalProps.layoutMap;
@@ -83712,7 +84293,10 @@
83712
84293
  table.scenegraph.updateNextFrame();
83713
84294
  });
83714
84295
  video.onerror = () => {
83715
- image.image = regedIcons.damage_pic.svg;
84296
+ const regedIcons = get$2();
84297
+ image.image = regedIcons.video_damage_pic
84298
+ ? regedIcons.video_damage_pic.svg
84299
+ : regedIcons.damage_pic.svg;
83716
84300
  };
83717
84301
  video.src = value;
83718
84302
  video.setAttribute('preload', 'auto');
@@ -83729,6 +84313,12 @@
83729
84313
  image.textAlign = textAlign;
83730
84314
  image.textBaseline = textBaseline;
83731
84315
  cellGroup.appendChild(image);
84316
+ image.successCallback = () => {
84317
+ if (isDamagePic(image)) {
84318
+ updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table);
84319
+ table.scenegraph.updateNextFrame();
84320
+ }
84321
+ };
83732
84322
  return cellGroup;
83733
84323
  }
83734
84324
 
@@ -94173,7 +94763,7 @@
94173
94763
  }
94174
94764
 
94175
94765
  registerForVrender();
94176
- const version = "1.23.1-alpha.2";
94766
+ const version = "1.23.2";
94177
94767
  function getIcons() {
94178
94768
  return get$2();
94179
94769
  }