@visactor/vtable 1.22.11-alpha.6 → 1.22.11-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/cjs/ListTable.d.ts +34 -7
  2. package/cjs/ListTable.js +134 -14
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +0 -3
  5. package/cjs/PivotChart.js +5 -12
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/body-helper/style.js +1 -2
  8. package/cjs/core/BaseTable.js +1 -1
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/FouseInput.js +2 -1
  11. package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
  12. package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
  13. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  14. package/cjs/core/index.d.ts +1 -0
  15. package/cjs/core/index.js +30 -0
  16. package/cjs/core/index.js.map +1 -0
  17. package/cjs/core/record-helper.d.ts +4 -2
  18. package/cjs/core/record-helper.js +120 -47
  19. package/cjs/core/record-helper.js.map +1 -1
  20. package/cjs/data/DataSource.d.ts +10 -4
  21. package/cjs/data/DataSource.js +155 -56
  22. package/cjs/data/DataSource.js.map +1 -1
  23. package/cjs/dataset/DataStatistics.js +1 -2
  24. package/cjs/dataset/dataset-pivot-table.js +2 -1
  25. package/cjs/event/event.d.ts +2 -1
  26. package/cjs/event/event.js +20 -9
  27. package/cjs/event/event.js.map +1 -1
  28. package/cjs/event/listener/table-group.js +6 -10
  29. package/cjs/event/listener/table-group.js.map +1 -1
  30. package/cjs/header-helper/style.js +1 -2
  31. package/cjs/index.d.ts +1 -1
  32. package/cjs/index.js +1 -1
  33. package/cjs/index.js.map +1 -1
  34. package/cjs/layout/index.js +2 -1
  35. package/cjs/layout/pivot-header-layout.d.ts +0 -6
  36. package/cjs/layout/pivot-header-layout.js +20 -39
  37. package/cjs/layout/pivot-header-layout.js.map +1 -1
  38. package/cjs/plugins/custom-cell-style.d.ts +5 -0
  39. package/cjs/plugins/custom-cell-style.js +10 -1
  40. package/cjs/plugins/custom-cell-style.js.map +1 -1
  41. package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +2 -14
  42. package/cjs/scenegraph/graphic/active-cell-chart-list.js +75 -195
  43. package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  44. package/cjs/scenegraph/graphic/chart.d.ts +1 -9
  45. package/cjs/scenegraph/graphic/chart.js +20 -48
  46. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  47. package/cjs/scenegraph/graphic/contributions/chart-render.js +4 -3
  48. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  49. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
  50. package/cjs/scenegraph/refresh-node/update-chart.js +1 -2
  51. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  52. package/cjs/scenegraph/scenegraph.d.ts +2 -2
  53. package/cjs/scenegraph/scenegraph.js +12 -41
  54. package/cjs/scenegraph/scenegraph.js.map +1 -1
  55. package/cjs/state/state.js +1 -1
  56. package/cjs/tools/util.d.ts +0 -5
  57. package/cjs/tools/util.js +4 -22
  58. package/cjs/tools/util.js.map +1 -1
  59. package/cjs/ts-types/base-table.d.ts +2 -2
  60. package/cjs/ts-types/base-table.js.map +1 -1
  61. package/cjs/ts-types/events.d.ts +15 -0
  62. package/cjs/ts-types/events.js.map +1 -1
  63. package/cjs/ts-types/table-engine.d.ts +33 -13
  64. package/cjs/ts-types/table-engine.js.map +1 -1
  65. package/cjs/vrender.js.map +1 -1
  66. package/dist/vtable.js +862 -681
  67. package/dist/vtable.min.js +2 -2
  68. package/es/ListTable.d.ts +34 -7
  69. package/es/ListTable.js +130 -14
  70. package/es/ListTable.js.map +1 -1
  71. package/es/PivotChart.d.ts +0 -3
  72. package/es/PivotChart.js +4 -13
  73. package/es/PivotChart.js.map +1 -1
  74. package/es/body-helper/style.js +1 -2
  75. package/es/core/BaseTable.js +1 -1
  76. package/es/core/BaseTable.js.map +1 -1
  77. package/es/core/FouseInput.js +2 -1
  78. package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
  79. package/es/core/TABLE_EVENT_TYPE.js +1 -0
  80. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  81. package/es/core/index.d.ts +1 -0
  82. package/es/core/index.js +2 -0
  83. package/es/core/index.js.map +1 -0
  84. package/es/core/record-helper.d.ts +4 -2
  85. package/es/core/record-helper.js +114 -43
  86. package/es/core/record-helper.js.map +1 -1
  87. package/es/data/DataSource.d.ts +10 -4
  88. package/es/data/DataSource.js +155 -56
  89. package/es/data/DataSource.js.map +1 -1
  90. package/es/dataset/DataStatistics.js +1 -2
  91. package/es/dataset/dataset-pivot-table.js +2 -1
  92. package/es/event/event.d.ts +2 -1
  93. package/es/event/event.js +20 -9
  94. package/es/event/event.js.map +1 -1
  95. package/es/event/listener/table-group.js +6 -9
  96. package/es/event/listener/table-group.js.map +1 -1
  97. package/es/header-helper/style.js +1 -2
  98. package/es/index.d.ts +1 -1
  99. package/es/index.js +1 -1
  100. package/es/index.js.map +1 -1
  101. package/es/layout/index.js +2 -1
  102. package/es/layout/pivot-header-layout.d.ts +0 -6
  103. package/es/layout/pivot-header-layout.js +20 -39
  104. package/es/layout/pivot-header-layout.js.map +1 -1
  105. package/es/plugins/custom-cell-style.d.ts +5 -0
  106. package/es/plugins/custom-cell-style.js +10 -1
  107. package/es/plugins/custom-cell-style.js.map +1 -1
  108. package/es/scenegraph/graphic/active-cell-chart-list.d.ts +2 -14
  109. package/es/scenegraph/graphic/active-cell-chart-list.js +68 -183
  110. package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  111. package/es/scenegraph/graphic/chart.d.ts +1 -9
  112. package/es/scenegraph/graphic/chart.js +19 -47
  113. package/es/scenegraph/graphic/chart.js.map +1 -1
  114. package/es/scenegraph/graphic/contributions/chart-render.js +4 -3
  115. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  116. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
  117. package/es/scenegraph/refresh-node/update-chart.js +1 -2
  118. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  119. package/es/scenegraph/scenegraph.d.ts +2 -2
  120. package/es/scenegraph/scenegraph.js +11 -41
  121. package/es/scenegraph/scenegraph.js.map +1 -1
  122. package/es/state/state.js +1 -1
  123. package/es/tools/util.d.ts +0 -5
  124. package/es/tools/util.js +0 -18
  125. package/es/tools/util.js.map +1 -1
  126. package/es/ts-types/base-table.d.ts +2 -2
  127. package/es/ts-types/base-table.js.map +1 -1
  128. package/es/ts-types/events.d.ts +15 -0
  129. package/es/ts-types/events.js.map +1 -1
  130. package/es/ts-types/table-engine.d.ts +33 -13
  131. package/es/ts-types/table-engine.js.map +1 -1
  132. package/es/vrender.js.map +1 -1
  133. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -36018,47 +36018,6 @@
36018
36018
  }
36019
36019
  };
36020
36020
  }
36021
- function cancellableThrottle(func, delay) {
36022
- let timer = null;
36023
- let lastArgs = null;
36024
- let context = null;
36025
- const throttled = function (...args) {
36026
- lastArgs = args;
36027
- context = this;
36028
- if (!timer) {
36029
- timer = setTimeout(() => {
36030
- if (lastArgs) {
36031
- func.apply(context, lastArgs);
36032
- }
36033
- timer = null;
36034
- lastArgs = null;
36035
- context = null;
36036
- }, delay);
36037
- }
36038
- };
36039
- const cancel = () => {
36040
- if (timer) {
36041
- clearTimeout(timer);
36042
- timer = null;
36043
- lastArgs = null;
36044
- context = null;
36045
- }
36046
- };
36047
- const flush = () => {
36048
- if (timer && lastArgs) {
36049
- clearTimeout(timer);
36050
- func.apply(context, lastArgs);
36051
- timer = null;
36052
- lastArgs = null;
36053
- context = null;
36054
- }
36055
- };
36056
- return {
36057
- throttled,
36058
- cancel,
36059
- flush
36060
- };
36061
- }
36062
36021
  function pad(num, totalChars) {
36063
36022
  const pad = '0';
36064
36023
  num = `${num}`;
@@ -36451,6 +36410,7 @@
36451
36410
  AFTER_UPDATE_CELL_CONTENT_WIDTH: 'after_update_cell_content_width',
36452
36411
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: 'after_update_select_border_height',
36453
36412
  CHANGE_CELL_VALUE: 'change_cell_value',
36413
+ CHANGE_CELL_VALUES: 'change_cell_values',
36454
36414
  DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
36455
36415
  MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
36456
36416
  DBLCLICK_FILL_HANDLE: 'dblclick_fill_handle',
@@ -38973,6 +38933,48 @@
38973
38933
  }
38974
38934
  }
38975
38935
  }
38936
+ changeFieldValueByRecordIndex(value, recordIndex, field, table) {
38937
+ if (field === null) {
38938
+ return undefined;
38939
+ }
38940
+ if (recordIndex === undefined || recordIndex === null) {
38941
+ return;
38942
+ }
38943
+ const rawKey = recordIndex.toString();
38944
+ if (!this.beforeChangedRecordsMap.has(rawKey)) {
38945
+ const rawRecords = Array.isArray(this.dataSourceObj?.records)
38946
+ ? this.dataSourceObj.records
38947
+ : null;
38948
+ const originRecord = rawRecords
38949
+ ? Array.isArray(recordIndex)
38950
+ ? getValueFromDeepArray(rawRecords, recordIndex)
38951
+ : rawRecords[recordIndex]
38952
+ : undefined;
38953
+ this.beforeChangedRecordsMap.set(rawKey, cloneDeep(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {});
38954
+ }
38955
+ if (typeof field === 'string' || typeof field === 'number') {
38956
+ const beforeChangedValue = this.beforeChangedRecordsMap.get(rawKey)?.[field];
38957
+ const rawRecords = Array.isArray(this.dataSourceObj?.records)
38958
+ ? this.dataSourceObj.records
38959
+ : null;
38960
+ const record = rawRecords
38961
+ ? Array.isArray(recordIndex)
38962
+ ? getValueFromDeepArray(rawRecords, recordIndex)
38963
+ : rawRecords[recordIndex]
38964
+ : undefined;
38965
+ let formatValue = value;
38966
+ if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {
38967
+ formatValue = parseFloat(value);
38968
+ }
38969
+ if (record) {
38970
+ record[field] = formatValue;
38971
+ }
38972
+ else if (rawRecords && typeof recordIndex === 'number') {
38973
+ rawRecords[recordIndex] = this.addRecordRule === 'Array' ? [] : {};
38974
+ rawRecords[recordIndex][field] = formatValue;
38975
+ }
38976
+ }
38977
+ }
38976
38978
  cacheBeforeChangedRecord(dataIndex, table) {
38977
38979
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
38978
38980
  const originRecord = this.getOriginalRecord(dataIndex);
@@ -38998,69 +39000,150 @@
38998
39000
  }
38999
39001
  }
39000
39002
  }
39001
- addRecord(record, index) {
39002
- if (Array.isArray(this.records)) {
39003
- this.records.splice(index, 0, record);
39004
- this.adjustBeforeChangedRecordsMap(index, 1);
39005
- this.currentIndexedData.push(this.currentIndexedData.length);
39006
- this._sourceLength += 1;
39007
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39008
- this.fieldAggregators[i].push(record);
39009
- }
39010
- if (this.rowHierarchyType === 'tree') {
39011
- this.initTreeHierarchyState();
39012
- }
39013
- if (this.userPagination) {
39014
- this.pagination.totalCount = this._sourceLength;
39015
- const { perPageCount, currentPage } = this.pagination;
39016
- const startIndex = perPageCount * (currentPage || 0);
39017
- const endIndex = startIndex + perPageCount;
39018
- if (index < endIndex) {
39003
+ _getRawRecordsArray() {
39004
+ const rawRecords = this.dataSourceObj?.records;
39005
+ return Array.isArray(rawRecords) ? rawRecords : null;
39006
+ }
39007
+ _hasFilterInEffect() {
39008
+ return (this.dataConfig?.filterRules?.length ?? 0) >= 1 || (this.lastFilterRules?.length ?? 0) >= 1;
39009
+ }
39010
+ _normalizeInsertIndex(index, length) {
39011
+ if (index === undefined || index === null) {
39012
+ return length;
39013
+ }
39014
+ if (index > length) {
39015
+ return length;
39016
+ }
39017
+ if (index < 0) {
39018
+ return 0;
39019
+ }
39020
+ return index;
39021
+ }
39022
+ _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
39023
+ if (viewIndex >= this.records.length) {
39024
+ return rawRecords.length;
39025
+ }
39026
+ if (viewIndex <= 0) {
39027
+ return 0;
39028
+ }
39029
+ const prevRecord = this.records[viewIndex - 1];
39030
+ const rawIndex = rawRecords.indexOf(prevRecord);
39031
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
39032
+ }
39033
+ _resetIndexingFromViewRecords() {
39034
+ this._sourceLength = this.records.length;
39035
+ this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
39036
+ if (this.rowHierarchyType === 'tree') {
39037
+ this.initTreeHierarchyState();
39038
+ }
39039
+ if (this.userPagination) {
39040
+ this.pagination.totalCount = this._sourceLength;
39041
+ this.updatePagerData();
39042
+ return;
39043
+ }
39044
+ this.pagination.perPageCount = this._sourceLength;
39045
+ this.pagination.totalCount = this._sourceLength;
39046
+ this.updatePagerData();
39047
+ }
39048
+ addRecord(record, index, syncToOriginalRecords = false) {
39049
+ if (!syncToOriginalRecords) {
39050
+ if (Array.isArray(this.records)) {
39051
+ this.records.splice(index, 0, record);
39052
+ this.adjustBeforeChangedRecordsMap(index, 1);
39053
+ this.currentIndexedData.push(this.currentIndexedData.length);
39054
+ this._sourceLength += 1;
39055
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39056
+ this.fieldAggregators[i].push(record);
39057
+ }
39058
+ if (this.rowHierarchyType === 'tree') {
39059
+ this.initTreeHierarchyState();
39060
+ }
39061
+ if (this.userPagination) {
39062
+ this.pagination.totalCount = this._sourceLength;
39063
+ const { perPageCount, currentPage } = this.pagination;
39064
+ const startIndex = perPageCount * (currentPage || 0);
39065
+ const endIndex = startIndex + perPageCount;
39066
+ if (index < endIndex) {
39067
+ this.updatePagerData();
39068
+ }
39069
+ }
39070
+ else {
39071
+ this.pagination.perPageCount = this._sourceLength;
39072
+ this.pagination.totalCount = this._sourceLength;
39019
39073
  this.updatePagerData();
39020
39074
  }
39075
+ if (this.dataSourceObj?.added) {
39076
+ this.dataSourceObj.added(index, 1);
39077
+ }
39021
39078
  }
39022
- else {
39023
- this.pagination.perPageCount = this._sourceLength;
39024
- this.pagination.totalCount = this._sourceLength;
39025
- this.updatePagerData();
39026
- }
39027
- if (this.dataSourceObj?.added) {
39028
- this.dataSourceObj.added(index, 1);
39029
- }
39079
+ return;
39080
+ }
39081
+ const rawRecords = this._getRawRecordsArray();
39082
+ if (!rawRecords) {
39083
+ return;
39084
+ }
39085
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length);
39086
+ const rawInsertIndex = this._hasFilterInEffect()
39087
+ ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex)
39088
+ : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
39089
+ rawRecords.splice(rawInsertIndex, 0, record);
39090
+ this.beforeChangedRecordsMap.clear();
39091
+ this.sortedIndexMap.clear();
39092
+ this.updateFilterRules(this.dataConfig?.filterRules);
39093
+ if (this.dataSourceObj?.added) {
39094
+ this.dataSourceObj.added(rawInsertIndex, 1);
39030
39095
  }
39031
39096
  }
39032
- addRecords(recordArr, index) {
39033
- if (Array.isArray(this.records)) {
39034
- if (Array.isArray(recordArr)) {
39035
- this.records.splice(index, 0, ...recordArr);
39036
- this.adjustBeforeChangedRecordsMap(index, recordArr.length);
39037
- for (let i = 0; i < recordArr.length; i++) {
39038
- this.currentIndexedData.push(this.currentIndexedData.length);
39097
+ addRecords(recordArr, index, syncToOriginalRecords = false) {
39098
+ if (!syncToOriginalRecords) {
39099
+ if (Array.isArray(this.records)) {
39100
+ if (Array.isArray(recordArr)) {
39101
+ this.records.splice(index, 0, ...recordArr);
39102
+ this.adjustBeforeChangedRecordsMap(index, recordArr.length);
39103
+ for (let i = 0; i < recordArr.length; i++) {
39104
+ this.currentIndexedData.push(this.currentIndexedData.length);
39105
+ }
39106
+ this._sourceLength += recordArr.length;
39107
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39108
+ for (let j = 0; j < recordArr.length; j++) {
39109
+ this.fieldAggregators[i].push(recordArr[j]);
39110
+ }
39111
+ }
39039
39112
  }
39040
- this._sourceLength += recordArr.length;
39041
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39042
- for (let j = 0; j < recordArr.length; j++) {
39043
- this.fieldAggregators[i].push(recordArr[j]);
39113
+ if (this.userPagination) {
39114
+ this.pagination.totalCount = this._sourceLength;
39115
+ const { perPageCount, currentPage } = this.pagination;
39116
+ const startIndex = perPageCount * (currentPage || 0);
39117
+ const endIndex = startIndex + perPageCount;
39118
+ if (index < endIndex) {
39119
+ this.updatePagerData();
39044
39120
  }
39045
39121
  }
39046
- }
39047
- if (this.userPagination) {
39048
- this.pagination.totalCount = this._sourceLength;
39049
- const { perPageCount, currentPage } = this.pagination;
39050
- const startIndex = perPageCount * (currentPage || 0);
39051
- const endIndex = startIndex + perPageCount;
39052
- if (index < endIndex) {
39122
+ else {
39123
+ this.pagination.perPageCount = this._sourceLength;
39124
+ this.pagination.totalCount = this._sourceLength;
39053
39125
  this.updatePagerData();
39054
39126
  }
39127
+ if (this.dataSourceObj?.added) {
39128
+ this.dataSourceObj.added(index, recordArr.length);
39129
+ }
39055
39130
  }
39056
- else {
39057
- this.pagination.perPageCount = this._sourceLength;
39058
- this.pagination.totalCount = this._sourceLength;
39059
- this.updatePagerData();
39060
- }
39061
- if (this.dataSourceObj?.added) {
39062
- this.dataSourceObj.added(index, recordArr.length);
39063
- }
39131
+ return;
39132
+ }
39133
+ const rawRecords = this._getRawRecordsArray();
39134
+ if (!rawRecords || !Array.isArray(recordArr) || recordArr.length === 0) {
39135
+ return;
39136
+ }
39137
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length);
39138
+ const rawInsertIndex = this._hasFilterInEffect()
39139
+ ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex)
39140
+ : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
39141
+ rawRecords.splice(rawInsertIndex, 0, ...recordArr);
39142
+ this.beforeChangedRecordsMap.clear();
39143
+ this.sortedIndexMap.clear();
39144
+ this.updateFilterRules(this.dataConfig?.filterRules);
39145
+ if (this.dataSourceObj?.added) {
39146
+ this.dataSourceObj.added(rawInsertIndex, recordArr.length);
39064
39147
  }
39065
39148
  }
39066
39149
  addRecordForSorted(record) {
@@ -39094,46 +39177,84 @@
39094
39177
  }
39095
39178
  }
39096
39179
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
39097
- const length = this.beforeChangedRecordsMap.size;
39098
- for (let key = length - 1; key >= insertIndex; key--) {
39180
+ const delta = type === 'add' ? insertCount : -insertCount;
39181
+ const numericKeys = [];
39182
+ this.beforeChangedRecordsMap.forEach((_, key) => {
39183
+ const numKey = Number(key);
39184
+ if (Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex) {
39185
+ numericKeys.push(numKey);
39186
+ }
39187
+ });
39188
+ numericKeys.sort((a, b) => (type === 'add' ? b - a : a - b));
39189
+ for (let i = 0; i < numericKeys.length; i++) {
39190
+ const key = numericKeys[i];
39099
39191
  const record = this.beforeChangedRecordsMap.get(key.toString());
39100
39192
  this.beforeChangedRecordsMap.delete(key.toString());
39101
- this.beforeChangedRecordsMap.set((key + (type === 'add' ? insertCount : -insertCount)).toString(), record);
39193
+ this.beforeChangedRecordsMap.set((key + delta).toString(), record);
39102
39194
  }
39103
39195
  }
39104
- deleteRecords(recordIndexs) {
39105
- if (Array.isArray(this.records)) {
39106
- const realDeletedRecordIndexs = [];
39107
- const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
39108
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39109
- const recordIndex = recordIndexsMaxToMin[index];
39110
- if (recordIndex >= this._sourceLength || recordIndex < 0) {
39111
- continue;
39196
+ deleteRecords(recordIndexs, syncToOriginalRecords = false) {
39197
+ if (!syncToOriginalRecords) {
39198
+ if (Array.isArray(this.records)) {
39199
+ const realDeletedRecordIndexs = [];
39200
+ const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
39201
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39202
+ const recordIndex = recordIndexsMaxToMin[index];
39203
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
39204
+ continue;
39205
+ }
39206
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
39207
+ realDeletedRecordIndexs.push(recordIndex);
39208
+ const deletedRecord = this.records[recordIndex];
39209
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39210
+ this.fieldAggregators[i].deleteRecord(deletedRecord);
39211
+ }
39212
+ this.records.splice(recordIndex, 1);
39213
+ this.currentIndexedData.pop();
39214
+ this._sourceLength -= 1;
39112
39215
  }
39113
- this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
39114
- realDeletedRecordIndexs.push(recordIndex);
39115
- const deletedRecord = this.records[recordIndex];
39116
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39117
- this.fieldAggregators[i].deleteRecord(deletedRecord);
39216
+ if (this.userPagination) {
39217
+ this.updatePagerData();
39118
39218
  }
39119
- this.records.splice(recordIndex, 1);
39120
- this.currentIndexedData.pop();
39121
- this._sourceLength -= 1;
39122
- }
39123
- if (this.userPagination) {
39124
- this.updatePagerData();
39219
+ else {
39220
+ this.pagination.perPageCount = this._sourceLength;
39221
+ this.pagination.totalCount = this._sourceLength;
39222
+ this.updatePagerData();
39223
+ }
39224
+ if (this.dataSourceObj?.deleted) {
39225
+ this.dataSourceObj.deleted(realDeletedRecordIndexs);
39226
+ }
39227
+ return realDeletedRecordIndexs;
39125
39228
  }
39126
- else {
39127
- this.pagination.perPageCount = this._sourceLength;
39128
- this.pagination.totalCount = this._sourceLength;
39129
- this.updatePagerData();
39229
+ return [];
39230
+ }
39231
+ const rawRecords = this._getRawRecordsArray();
39232
+ if (!rawRecords || !Array.isArray(this.records)) {
39233
+ return [];
39234
+ }
39235
+ const realDeletedRecordIndexs = [];
39236
+ const recordIndexsMaxToMin = recordIndexs.slice().sort((a, b) => b - a);
39237
+ const rawDeletedIndexs = [];
39238
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
39239
+ const viewIndex = recordIndexsMaxToMin[index];
39240
+ if (viewIndex >= this.records.length || viewIndex < 0) {
39241
+ continue;
39130
39242
  }
39131
- if (this.dataSourceObj?.deleted) {
39132
- this.dataSourceObj.deleted(realDeletedRecordIndexs);
39243
+ const deletedRecord = this.records[viewIndex];
39244
+ const rawIndex = rawRecords.indexOf(deletedRecord);
39245
+ if (rawIndex >= 0) {
39246
+ rawRecords.splice(rawIndex, 1);
39247
+ rawDeletedIndexs.push(rawIndex);
39133
39248
  }
39134
- return realDeletedRecordIndexs;
39249
+ realDeletedRecordIndexs.push(viewIndex);
39135
39250
  }
39136
- return [];
39251
+ this.beforeChangedRecordsMap.clear();
39252
+ this.sortedIndexMap.clear();
39253
+ this.updateFilterRules(this.dataConfig?.filterRules);
39254
+ if (this.dataSourceObj?.deleted) {
39255
+ this.dataSourceObj.deleted(rawDeletedIndexs);
39256
+ }
39257
+ return realDeletedRecordIndexs;
39137
39258
  }
39138
39259
  deleteRecordsForSorted(recordIndexs) {
39139
39260
  if (Array.isArray(this.records)) {
@@ -39155,36 +39276,71 @@
39155
39276
  this.beforeChangedRecordsMap.clear();
39156
39277
  }
39157
39278
  }
39158
- updateRecords(records, recordIndexs) {
39159
- const realDeletedRecordIndexs = [];
39279
+ updateRecords(records, recordIndexs, syncToOriginalRecords = false) {
39280
+ if (!syncToOriginalRecords) {
39281
+ const realDeletedRecordIndexs = [];
39282
+ for (let index = 0; index < recordIndexs.length; index++) {
39283
+ const recordIndex = recordIndexs[index];
39284
+ if (Array.isArray(recordIndex)) {
39285
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
39286
+ realDeletedRecordIndexs.push(recordIndex);
39287
+ recordIndex.slice(0, -1).reduce((acc, key) => {
39288
+ if (acc[key] === undefined) {
39289
+ acc[key] = {};
39290
+ }
39291
+ return acc[key].children;
39292
+ }, this.records)[recordIndex[recordIndex.length - 1]] = records[index];
39293
+ }
39294
+ else {
39295
+ if (recordIndex >= this._sourceLength || recordIndex < 0) {
39296
+ continue;
39297
+ }
39298
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
39299
+ realDeletedRecordIndexs.push(recordIndex);
39300
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
39301
+ this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
39302
+ }
39303
+ this.records[recordIndex] = records[index];
39304
+ }
39305
+ }
39306
+ if (this.userPagination) {
39307
+ this.updatePagerData();
39308
+ }
39309
+ return realDeletedRecordIndexs;
39310
+ }
39311
+ const rawRecords = this._getRawRecordsArray();
39312
+ if (!rawRecords || !Array.isArray(this.records)) {
39313
+ return [];
39314
+ }
39315
+ const realUpdatedIndexs = [];
39160
39316
  for (let index = 0; index < recordIndexs.length; index++) {
39161
39317
  const recordIndex = recordIndexs[index];
39162
39318
  if (Array.isArray(recordIndex)) {
39163
39319
  this.beforeChangedRecordsMap.delete(recordIndex.toString());
39164
- realDeletedRecordIndexs.push(recordIndex);
39320
+ realUpdatedIndexs.push(recordIndex);
39165
39321
  recordIndex.slice(0, -1).reduce((acc, key) => {
39166
39322
  if (acc[key] === undefined) {
39167
39323
  acc[key] = {};
39168
39324
  }
39169
39325
  return acc[key].children;
39170
- }, this.records)[recordIndex[recordIndex.length - 1]] = records[index];
39326
+ }, rawRecords)[recordIndex[recordIndex.length - 1]] = records[index];
39171
39327
  }
39172
39328
  else {
39173
- if (recordIndex >= this._sourceLength || recordIndex < 0) {
39329
+ if (recordIndex >= this.records.length || recordIndex < 0) {
39174
39330
  continue;
39175
39331
  }
39176
- this.beforeChangedRecordsMap.delete(recordIndex.toString());
39177
- realDeletedRecordIndexs.push(recordIndex);
39178
- for (let i = 0; i < this.fieldAggregators.length; i++) {
39179
- this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
39332
+ const oldRecord = this.records[recordIndex];
39333
+ const rawIndex = rawRecords.indexOf(oldRecord);
39334
+ if (rawIndex >= 0) {
39335
+ rawRecords[rawIndex] = records[index];
39180
39336
  }
39181
- this.records[recordIndex] = records[index];
39337
+ realUpdatedIndexs.push(recordIndex);
39182
39338
  }
39183
39339
  }
39184
- if (this.userPagination) {
39185
- this.updatePagerData();
39186
- }
39187
- return realDeletedRecordIndexs;
39340
+ this.beforeChangedRecordsMap.clear();
39341
+ this.sortedIndexMap.clear();
39342
+ this.updateFilterRules(this.dataConfig?.filterRules);
39343
+ return realUpdatedIndexs;
39188
39344
  }
39189
39345
  updateRecordsForSorted(records, recordIndexs) {
39190
39346
  for (let index = 0; index < recordIndexs.length; index++) {
@@ -39265,7 +39421,11 @@
39265
39421
  }
39266
39422
  }
39267
39423
  if (!filedMapArray.length) {
39268
- filedMapArray = states.map(() => ({ asc: [], desc: [], normal: [] }));
39424
+ filedMapArray = states.map(() => ({
39425
+ asc: [],
39426
+ desc: [],
39427
+ normal: []
39428
+ }));
39269
39429
  for (let index = 0; index < states.length; index++) {
39270
39430
  this.sortedIndexMap.set(states[index].field, filedMapArray[index]);
39271
39431
  }
@@ -49015,27 +49175,9 @@
49015
49175
  return hoverMode;
49016
49176
  }
49017
49177
 
49018
- let brushingChartInstance;
49019
- let brushingChartInstanceCellPos = { col: -1, row: -1 };
49020
- function setBrushingChartInstance(chartInstance, col, row) {
49021
- brushingChartInstance = chartInstance;
49022
- brushingChartInstanceCellPos = { col, row };
49023
- }
49024
- function clearBrushingChartInstance() {
49025
- brushingChartInstance = undefined;
49026
- brushingChartInstanceCellPos = { col: -1, row: -1 };
49027
- }
49028
- function getBrushingChartInstance() {
49029
- return brushingChartInstance;
49030
- }
49031
- function getBrushingChartInstanceCellPos() {
49032
- return brushingChartInstanceCellPos;
49033
- }
49034
49178
  const chartInstanceListColumnByColumnDirection = {};
49035
49179
  const chartInstanceListRowByRowDirection = {};
49036
- const delayRunDimensionHoverTimer = [];
49037
49180
  function generateChartInstanceListByColumnDirection(col, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = false, isScatter = false) {
49038
- clearDelayRunDimensionHoverTimers();
49039
49181
  if (!isValid$1(chartInstanceListColumnByColumnDirection[col])) {
49040
49182
  chartInstanceListColumnByColumnDirection[col] = {};
49041
49183
  }
@@ -49045,9 +49187,9 @@
49045
49187
  for (let i = rowStart; i <= rowEnd; i++) {
49046
49188
  const cellGroup = table.scenegraph.getCell(col, i);
49047
49189
  const chartNode = cellGroup?.getChildren()?.[0];
49190
+ chartNode.addUpdateShapeAndBoundsTag();
49048
49191
  if (chartInstanceListColumnByColumnDirection[col][i]) ;
49049
49192
  else if (isValid$1(chartNode)) {
49050
- chartNode.addUpdateShapeAndBoundsTag();
49051
49193
  if (chartNode.activeChartInstance) {
49052
49194
  chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;
49053
49195
  }
@@ -49056,13 +49198,44 @@
49056
49198
  chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;
49057
49199
  }
49058
49200
  }
49059
- const timer = setTimeout(() => {
49201
+ setTimeout(() => {
49060
49202
  if (chartInstanceListColumnByColumnDirection[col]?.[i]) {
49061
49203
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
49062
49204
  let isShowTooltip = !isScatter;
49063
49205
  if (!isScatter && typeof chartDimensionLinkage === 'object') {
49064
49206
  isShowTooltip = chartDimensionLinkage.showTooltip ?? true;
49065
- isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table);
49207
+ if (i === rowEnd && isShowTooltip) {
49208
+ const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;
49209
+ const { rowEnd: rowEnd1 } = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
49210
+ if (rowEnd1 === rowEnd) {
49211
+ isShowTooltip = true;
49212
+ }
49213
+ else {
49214
+ const { rowEnd: rowEnd2 } = table.getBodyVisibleRowRange(0, 5);
49215
+ if (rowEnd2 !== rowEnd) {
49216
+ isShowTooltip = true;
49217
+ }
49218
+ else {
49219
+ isShowTooltip = false;
49220
+ }
49221
+ }
49222
+ }
49223
+ else if (i === rowStart && isShowTooltip) {
49224
+ const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;
49225
+ const { rowStart: rowStart1 } = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
49226
+ if (rowStart1 === rowStart) {
49227
+ isShowTooltip = true;
49228
+ }
49229
+ else {
49230
+ const { rowStart: rowStart2 } = table.getBodyVisibleRowRange(0, -5);
49231
+ if (rowStart2 !== rowStart) {
49232
+ isShowTooltip = true;
49233
+ }
49234
+ else {
49235
+ isShowTooltip = false;
49236
+ }
49237
+ }
49238
+ }
49066
49239
  }
49067
49240
  if (isScatter) {
49068
49241
  if (table.stateManager.hover.cellPos.col !== col || table.stateManager.hover.cellPos.row !== i) {
@@ -49075,7 +49248,6 @@
49075
49248
  }
49076
49249
  }
49077
49250
  else {
49078
- const cellBoundry = table.getCellRelativeRect(col, i);
49079
49251
  const bodyBoundryTop = table.frozenRowCount
49080
49252
  ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom
49081
49253
  : 0;
@@ -49086,32 +49258,43 @@
49086
49258
  }
49087
49259
  chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
49088
49260
  tooltip: false,
49089
- showTooltipOption: {
49090
- x: canvasXY.x - cellBoundry.left,
49091
- y: absolutePositionTop - cellBoundry.top,
49092
- activeType: 'dimension'
49093
- }
49261
+ showTooltipOption: { x: canvasXY.x, y: absolutePositionTop, activeType: 'dimension' }
49094
49262
  });
49095
49263
  }
49096
49264
  else {
49097
49265
  chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
49098
49266
  tooltip: isShowTooltip,
49099
- showTooltipOption: {
49100
- x: canvasXY.x - cellBoundry.left,
49101
- y: absolutePositionTop - cellBoundry.top,
49102
- activeType: 'dimension'
49103
- }
49267
+ showTooltipOption: { x: canvasXY.x, y: absolutePositionTop, activeType: 'dimension' }
49104
49268
  });
49105
49269
  }
49106
49270
  }
49107
49271
  }
49108
49272
  }, 0);
49109
- delayRunDimensionHoverTimer.push(timer);
49110
49273
  table.scenegraph.updateNextFrame();
49111
49274
  }
49112
49275
  }
49276
+ function clearChartInstanceListByColumnDirection(col, excludedRow, table) {
49277
+ if (isValid$1(chartInstanceListColumnByColumnDirection[col])) {
49278
+ for (const i in chartInstanceListColumnByColumnDirection[col]) {
49279
+ if (isValid$1(excludedRow) && Number(i) === excludedRow) {
49280
+ continue;
49281
+ }
49282
+ const cellGroup = table.scenegraph.getCell(col, Number(i));
49283
+ const chartNode = cellGroup?.getChildren()?.[0];
49284
+ chartNode.addUpdateShapeAndBoundsTag();
49285
+ if (isValid$1(chartNode)) {
49286
+ chartNode.deactivate(table, {
49287
+ releaseChartInstance: true,
49288
+ releaseColumnChartInstance: false,
49289
+ releaseRowChartInstance: false
49290
+ });
49291
+ chartInstanceListColumnByColumnDirection[col][i] = null;
49292
+ }
49293
+ }
49294
+ delete chartInstanceListColumnByColumnDirection[col];
49295
+ }
49296
+ }
49113
49297
  function generateChartInstanceListByRowDirection(row, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = false, isScatter = false) {
49114
- clearDelayRunDimensionHoverTimers();
49115
49298
  if (!isValid$1(chartInstanceListRowByRowDirection[row])) {
49116
49299
  chartInstanceListRowByRowDirection[row] = {};
49117
49300
  }
@@ -49121,9 +49304,9 @@
49121
49304
  for (let i = colStart; i <= colEnd; i++) {
49122
49305
  const cellGroup = table.scenegraph.getCell(i, row);
49123
49306
  const chartNode = cellGroup?.getChildren()?.[0];
49307
+ chartNode.addUpdateShapeAndBoundsTag();
49124
49308
  if (chartInstanceListRowByRowDirection[row][i]) ;
49125
49309
  else if (isValid$1(chartNode)) {
49126
- chartNode.addUpdateShapeAndBoundsTag();
49127
49310
  if (chartNode.activeChartInstance) {
49128
49311
  chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance;
49129
49312
  }
@@ -49132,13 +49315,44 @@
49132
49315
  chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance;
49133
49316
  }
49134
49317
  }
49135
- const timer = setTimeout(() => {
49318
+ setTimeout(() => {
49136
49319
  if (chartInstanceListRowByRowDirection[row]?.[i]) {
49137
49320
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
49138
49321
  let isShowTooltip = !isScatter;
49139
49322
  if (!isScatter && typeof chartDimensionLinkage === 'object') {
49140
49323
  isShowTooltip = chartDimensionLinkage.showTooltip ?? true;
49141
- isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(i, table);
49324
+ if (i === colEnd && isShowTooltip) {
49325
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;
49326
+ const { colEnd: colEnd1 } = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
49327
+ if (colEnd1 === colEnd) {
49328
+ isShowTooltip = true;
49329
+ }
49330
+ else {
49331
+ const { colEnd: colEnd2 } = table.getBodyVisibleColRange(0, 5);
49332
+ if (colEnd2 !== colEnd) {
49333
+ isShowTooltip = true;
49334
+ }
49335
+ else {
49336
+ isShowTooltip = false;
49337
+ }
49338
+ }
49339
+ }
49340
+ else if (i === colStart && isShowTooltip) {
49341
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;
49342
+ const { colStart: colStart1 } = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
49343
+ if (colStart1 === colStart) {
49344
+ isShowTooltip = true;
49345
+ }
49346
+ else {
49347
+ const { colStart: colStart2 } = table.getBodyVisibleColRange(0, -5);
49348
+ if (colStart2 !== colStart) {
49349
+ isShowTooltip = true;
49350
+ }
49351
+ else {
49352
+ isShowTooltip = false;
49353
+ }
49354
+ }
49355
+ }
49142
49356
  }
49143
49357
  if (isScatter) {
49144
49358
  if (table.stateManager.hover.cellPos.col !== i || table.stateManager.hover.cellPos.row !== row) {
@@ -49151,7 +49365,6 @@
49151
49365
  }
49152
49366
  }
49153
49367
  else {
49154
- const cellBoundry = table.getCellRelativeRect(i, row);
49155
49368
  const bodyBoundryLeft = table.frozenColCount
49156
49369
  ? table.getCellRelativeRect(table.frozenColCount - 1, row).right
49157
49370
  : 0;
@@ -49162,188 +49375,22 @@
49162
49375
  }
49163
49376
  chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
49164
49377
  tooltip: false,
49165
- showTooltipOption: {
49166
- x: absolutePositionLeft - cellBoundry.left,
49167
- y: canvasXY.y - cellBoundry.top,
49168
- activeType: 'dimension'
49169
- }
49378
+ showTooltipOption: { x: absolutePositionLeft, y: canvasXY.y, activeType: 'dimension' }
49170
49379
  });
49171
49380
  }
49172
49381
  else {
49173
49382
  chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
49174
49383
  tooltip: isShowTooltip,
49175
- showTooltipOption: {
49176
- x: absolutePositionLeft - cellBoundry.left,
49177
- y: canvasXY.y - cellBoundry.top,
49178
- activeType: 'dimension'
49179
- }
49384
+ showTooltipOption: { x: absolutePositionLeft, y: canvasXY.y, activeType: 'dimension' }
49180
49385
  });
49181
49386
  }
49182
49387
  }
49183
49388
  }
49184
49389
  }, 0);
49185
- delayRunDimensionHoverTimer.push(timer);
49186
49390
  table.scenegraph.updateNextFrame();
49187
49391
  }
49188
49392
  }
49189
- function generateChartInstanceListByViewRange(datum, table, deactivate = false) {
49190
- clearDelayRunDimensionHoverTimers();
49191
- const { rowStart } = table.getBodyVisibleRowRange();
49192
- let rowEnd = table.getBodyVisibleRowRange().rowEnd;
49193
- rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
49194
- const { colStart } = table.getBodyVisibleColRange();
49195
- let colEnd = table.getBodyVisibleColRange().colEnd;
49196
- colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
49197
- for (let col = colStart; col <= colEnd; col++) {
49198
- if (!isValid$1(chartInstanceListColumnByColumnDirection[col])) {
49199
- chartInstanceListColumnByColumnDirection[col] = {};
49200
- }
49201
- for (let i = rowStart; i <= rowEnd; i++) {
49202
- const cellGroup = table.scenegraph.getCell(col, i);
49203
- const chartNode = cellGroup?.getChildren()?.[0];
49204
- if (chartInstanceListColumnByColumnDirection[col][i]) ;
49205
- else if (isValid$1(chartNode)) {
49206
- chartNode.addUpdateShapeAndBoundsTag();
49207
- if (chartNode.activeChartInstance) {
49208
- chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;
49209
- }
49210
- else {
49211
- if (chartNode.attribute.spec.type === 'pie') {
49212
- chartNode.activate(table);
49213
- chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;
49214
- }
49215
- }
49216
- }
49217
- const timer = setTimeout(() => {
49218
- if (chartInstanceListColumnByColumnDirection[col]?.[i]) {
49219
- const chartDimensionLinkage = table.options.chartDimensionLinkage;
49220
- let isShowTooltip = true;
49221
- if (typeof chartDimensionLinkage === 'object') {
49222
- if (deactivate) {
49223
- chartInstanceListColumnByColumnDirection[col][i].setHovered();
49224
- chartInstanceListColumnByColumnDirection[col][i].hideTooltip();
49225
- }
49226
- else {
49227
- isShowTooltip = chartDimensionLinkage.showTooltip ?? true;
49228
- isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table);
49229
- isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(col, table);
49230
- chartInstanceListColumnByColumnDirection[col][i].setHovered(datum);
49231
- isShowTooltip &&
49232
- chartInstanceListColumnByColumnDirection[col][i].showTooltip(datum, {
49233
- activeType: 'mark'
49234
- });
49235
- }
49236
- }
49237
- }
49238
- }, 0);
49239
- delayRunDimensionHoverTimer.push(timer);
49240
- table.scenegraph.updateNextFrame();
49241
- }
49242
- }
49243
- }
49244
- function checkIsShowTooltipForEdgeRow(row, table) {
49245
- let isShowTooltip = true;
49246
- const { rowStart } = table.getBodyVisibleRowRange();
49247
- let rowEnd = table.getBodyVisibleRowRange().rowEnd;
49248
- rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
49249
- const chartDimensionLinkage = table.options.chartDimensionLinkage;
49250
- if (row === rowEnd && isShowTooltip) {
49251
- const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;
49252
- const { rowEnd: rowEnd1 } = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
49253
- if (rowEnd1 === rowEnd) {
49254
- isShowTooltip = true;
49255
- }
49256
- else {
49257
- const { rowEnd: rowEnd2 } = table.getBodyVisibleRowRange(0, 5);
49258
- if (rowEnd2 !== rowEnd) {
49259
- isShowTooltip = true;
49260
- }
49261
- else {
49262
- isShowTooltip = false;
49263
- }
49264
- }
49265
- }
49266
- else if (row === rowStart && isShowTooltip) {
49267
- const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;
49268
- const { rowStart: rowStart1 } = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
49269
- if (rowStart1 === rowStart) {
49270
- isShowTooltip = true;
49271
- }
49272
- else {
49273
- const { rowStart: rowStart2 } = table.getBodyVisibleRowRange(0, -5);
49274
- if (rowStart2 !== rowStart) {
49275
- isShowTooltip = true;
49276
- }
49277
- else {
49278
- isShowTooltip = false;
49279
- }
49280
- }
49281
- }
49282
- return isShowTooltip;
49283
- }
49284
- function checkIsShowTooltipForEdgeColumn(col, table) {
49285
- let isShowTooltip = true;
49286
- const { colStart } = table.getBodyVisibleColRange();
49287
- let colEnd = table.getBodyVisibleColRange().colEnd;
49288
- colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
49289
- const chartDimensionLinkage = table.options.chartDimensionLinkage;
49290
- if (col === colEnd && isShowTooltip) {
49291
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;
49292
- const { colEnd: colEnd1 } = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
49293
- if (colEnd1 === colEnd) {
49294
- isShowTooltip = true;
49295
- }
49296
- else {
49297
- const { colEnd: colEnd2 } = table.getBodyVisibleColRange(0, 5);
49298
- if (colEnd2 !== colEnd) {
49299
- isShowTooltip = true;
49300
- }
49301
- else {
49302
- isShowTooltip = false;
49303
- }
49304
- }
49305
- }
49306
- else if (col === colStart && isShowTooltip) {
49307
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;
49308
- const { colStart: colStart1 } = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
49309
- if (colStart1 === colStart) {
49310
- isShowTooltip = true;
49311
- }
49312
- else {
49313
- const { colStart: colStart2 } = table.getBodyVisibleColRange(0, -5);
49314
- if (colStart2 !== colStart) {
49315
- isShowTooltip = true;
49316
- }
49317
- else {
49318
- isShowTooltip = false;
49319
- }
49320
- }
49321
- }
49322
- return isShowTooltip;
49323
- }
49324
- function clearChartInstanceListByColumnDirection(col, excludedRow, table, forceRelease = false) {
49325
- if (isValid$1(chartInstanceListColumnByColumnDirection[col])) {
49326
- for (const i in chartInstanceListColumnByColumnDirection[col]) {
49327
- if (isValid$1(excludedRow) && Number(i) === excludedRow) {
49328
- continue;
49329
- }
49330
- const cellGroup = table.scenegraph.getCell(col, Number(i));
49331
- const chartNode = cellGroup?.getChildren()?.[0];
49332
- if (isValid$1(chartNode)) {
49333
- chartNode.addUpdateShapeAndBoundsTag();
49334
- chartNode.deactivate(table, {
49335
- forceRelease: forceRelease,
49336
- releaseChartInstance: true,
49337
- releaseColumnChartInstance: false,
49338
- releaseRowChartInstance: false
49339
- });
49340
- chartInstanceListColumnByColumnDirection[col][i] = null;
49341
- }
49342
- }
49343
- delete chartInstanceListColumnByColumnDirection[col];
49344
- }
49345
- }
49346
- function clearChartInstanceListByRowDirection(row, excludedCol, table, forceRelease = false) {
49393
+ function clearChartInstanceListByRowDirection(row, excludedCol, table) {
49347
49394
  if (isValid$1(chartInstanceListRowByRowDirection[row])) {
49348
49395
  for (const i in chartInstanceListRowByRowDirection[row]) {
49349
49396
  if (isValid$1(excludedCol) && Number(i) === excludedCol) {
@@ -49351,10 +49398,9 @@
49351
49398
  }
49352
49399
  const cellGroup = table.scenegraph.getCell(Number(i), row);
49353
49400
  const chartNode = cellGroup?.getChildren()?.[0];
49401
+ chartNode.addUpdateShapeAndBoundsTag();
49354
49402
  if (isValid$1(chartNode)) {
49355
- chartNode.addUpdateShapeAndBoundsTag();
49356
49403
  chartNode.deactivate(table, {
49357
- forceRelease: forceRelease,
49358
49404
  releaseChartInstance: true,
49359
49405
  releaseColumnChartInstance: false,
49360
49406
  releaseRowChartInstance: false
@@ -49365,56 +49411,6 @@
49365
49411
  }
49366
49412
  delete chartInstanceListRowByRowDirection[row];
49367
49413
  }
49368
- function clearDelayRunDimensionHoverTimers() {
49369
- for (const timer of delayRunDimensionHoverTimer) {
49370
- clearTimeout(timer);
49371
- }
49372
- delayRunDimensionHoverTimer.length = 0;
49373
- }
49374
- function clearAllChartInstanceList(table, forceRelease = false) {
49375
- clearDelayRunDimensionHoverTimers();
49376
- for (const col in chartInstanceListColumnByColumnDirection) {
49377
- clearChartInstanceListByColumnDirection(Number(col), undefined, table, forceRelease);
49378
- }
49379
- for (const row in chartInstanceListRowByRowDirection) {
49380
- clearChartInstanceListByRowDirection(Number(row), undefined, table, forceRelease);
49381
- }
49382
- }
49383
- function disableDimensionHoverToAllChartInstances() {
49384
- clearDelayRunDimensionHoverTimers();
49385
- for (const col in chartInstanceListColumnByColumnDirection) {
49386
- for (const row in chartInstanceListColumnByColumnDirection[col]) {
49387
- chartInstanceListColumnByColumnDirection[col][row].disableDimensionHoverEvent(true);
49388
- chartInstanceListColumnByColumnDirection[col][row].disableCrossHair(true);
49389
- chartInstanceListColumnByColumnDirection[col][row].disableTooltip(true);
49390
- chartInstanceListColumnByColumnDirection[col][row].hideTooltip();
49391
- }
49392
- }
49393
- for (const row in chartInstanceListRowByRowDirection) {
49394
- for (const col in chartInstanceListRowByRowDirection[row]) {
49395
- chartInstanceListRowByRowDirection[row][col].disableDimensionHoverEvent(true);
49396
- chartInstanceListRowByRowDirection[row][col].disableCrossHair(true);
49397
- chartInstanceListRowByRowDirection[row][col].disableTooltip(true);
49398
- chartInstanceListRowByRowDirection[row][col].hideTooltip();
49399
- }
49400
- }
49401
- }
49402
- function enableDimensionHoverToAllChartInstances() {
49403
- for (const col in chartInstanceListColumnByColumnDirection) {
49404
- for (const row in chartInstanceListColumnByColumnDirection[col]) {
49405
- chartInstanceListColumnByColumnDirection[col][row].disableDimensionHoverEvent(false);
49406
- chartInstanceListColumnByColumnDirection[col][row].disableCrossHair(false);
49407
- chartInstanceListColumnByColumnDirection[col][row].disableTooltip(false);
49408
- }
49409
- }
49410
- for (const row in chartInstanceListRowByRowDirection) {
49411
- for (const col in chartInstanceListRowByRowDirection[row]) {
49412
- chartInstanceListRowByRowDirection[row][col].disableDimensionHoverEvent(false);
49413
- chartInstanceListRowByRowDirection[row][col].disableCrossHair(false);
49414
- chartInstanceListRowByRowDirection[row][col].disableTooltip(false);
49415
- }
49416
- }
49417
- }
49418
49414
 
49419
49415
  function isValidAlignDomain(domain) {
49420
49416
  return domain.length === 2 && isValidNumber$1(domain[0]) && isValidNumber$1(domain[1]) && domain[1] >= domain[0];
@@ -50374,7 +50370,6 @@
50374
50370
  type = 'chart';
50375
50371
  chartInstance;
50376
50372
  activeChartInstance;
50377
- activeChartInstanceLastViewBox = null;
50378
50373
  activeChartInstanceHoverOnMark = null;
50379
50374
  justShowMarkTooltip = undefined;
50380
50375
  justShowMarkTooltipTimer = Date.now();
@@ -50419,6 +50414,7 @@
50419
50414
  y1: y1 - table.scrollTop,
50420
50415
  y2: y2 - table.scrollTop
50421
50416
  });
50417
+ this.activeChartInstance?.release();
50422
50418
  this.attribute.ClassType.globalConfig.uniqueTooltip = false;
50423
50419
  this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
50424
50420
  renderCanvas: this.attribute.canvas,
@@ -50471,7 +50467,7 @@
50471
50467
  }
50472
50468
  }
50473
50469
  },
50474
- componentShowContent: table.options.chartDimensionLinkage?.showTooltip &&
50470
+ componentShowContent: table.options.chartDimensionLinkage &&
50475
50471
  this.attribute.spec.type !== 'scatter'
50476
50472
  ? {
50477
50473
  tooltip: {
@@ -50492,49 +50488,20 @@
50492
50488
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
50493
50489
  this.activeChartInstance.on('click', (params) => {
50494
50490
  if (this.attribute.spec.select?.enable === false) {
50495
- table.scenegraph.updateChartState(null, undefined);
50491
+ table.scenegraph.updateChartState(null);
50496
50492
  }
50497
50493
  else if (Chart.temp) {
50498
- table.scenegraph.updateChartState(params?.datum, 'click');
50499
- }
50500
- });
50501
- let brushChangeThrottle;
50502
- if (table.options.chartDimensionLinkage?.listenBrushChange) {
50503
- brushChangeThrottle = cancellableThrottle(table.scenegraph.updateChartState.bind(table.scenegraph), table.options.chartDimensionLinkage?.brushChangeDelay ?? 100);
50504
- this.activeChartInstance.on('brushChange', (params) => {
50505
- brushChangeThrottle.throttled(params?.value?.inBrushData, 'brush');
50506
- });
50507
- }
50508
- this.activeChartInstance.on('brushStart', (params) => {
50509
- const brushingChartInstance = getBrushingChartInstance();
50510
- if (brushingChartInstance !== this.activeChartInstance) {
50511
- if (brushingChartInstance) {
50512
- brushingChartInstance.getChart().getComponentsByKey('brush')[0].clearBrushStateAndMask();
50513
- }
50514
- setBrushingChartInstance(this.activeChartInstance, col, row);
50494
+ table.scenegraph.updateChartState(params?.datum);
50515
50495
  }
50516
50496
  });
50517
50497
  this.activeChartInstance.on('brushEnd', (params) => {
50518
- brushChangeThrottle?.cancel();
50519
- table.scenegraph.updateChartState(params?.value?.inBrushData, 'brush');
50498
+ table.scenegraph.updateChartState(params?.value?.inBrushData);
50520
50499
  Chart.temp = 0;
50521
50500
  setTimeout(() => {
50522
50501
  Chart.temp = 1;
50523
50502
  }, 0);
50524
50503
  });
50525
- if (table.options.chartDimensionLinkage?.showTooltip) {
50526
- if (this.attribute.spec.type === 'pie') {
50527
- this.activeChartInstance.on('pointerover', { markName: 'pie' }, (params) => {
50528
- const categoryField = this.attribute.spec.categoryField;
50529
- const datum = { [categoryField]: params?.datum?.[categoryField] };
50530
- generateChartInstanceListByViewRange(datum, table, false);
50531
- });
50532
- this.activeChartInstance.on('pointerout', { markName: 'pie' }, (params) => {
50533
- const categoryField = this.attribute.spec.categoryField;
50534
- const datum = { [categoryField]: params?.datum?.[categoryField] };
50535
- generateChartInstanceListByViewRange(datum, table, true);
50536
- });
50537
- }
50504
+ if (table.options.chartDimensionLinkage) {
50538
50505
  this.activeChartInstance.on('dimensionHover', (params) => {
50539
50506
  const dimensionInfo = params?.dimensionInfo[0];
50540
50507
  const canvasXY = params?.event?.canvas;
@@ -50672,23 +50639,21 @@
50672
50639
  table._bindChartEvent?.(this.activeChartInstance);
50673
50640
  }
50674
50641
  static temp = 1;
50675
- deactivate(table, { forceRelease = false, releaseChartInstance = true, releaseColumnChartInstance = true, releaseRowChartInstance = true, releaseAllChartInstance = false } = {}) {
50642
+ deactivate(table, { releaseChartInstance = true, releaseColumnChartInstance = true, releaseRowChartInstance = true } = {}) {
50676
50643
  this.activeChartInstanceHoverOnMark = null;
50677
50644
  this.justShowMarkTooltip = undefined;
50678
50645
  this.justShowMarkTooltipTimer = Date.now();
50679
50646
  clearTimeout(this.delayRunDimensionHoverTimer);
50680
50647
  this.delayRunDimensionHoverTimer = undefined;
50681
50648
  if (releaseChartInstance) {
50682
- if (forceRelease || !getBrushingChartInstance() || getBrushingChartInstance() !== this.activeChartInstance) {
50683
- this.activeChartInstance?.updateViewBox({
50684
- x1: -1000,
50685
- x2: -800,
50686
- y1: -1000,
50687
- y2: -800
50688
- }, false, false);
50689
- this.activeChartInstance?.release();
50690
- this.activeChartInstance = null;
50691
- }
50649
+ this.activeChartInstance?.updateViewBox({
50650
+ x1: -1000,
50651
+ x2: -800,
50652
+ y1: -1000,
50653
+ y2: -800
50654
+ }, false, false);
50655
+ this.activeChartInstance?.release();
50656
+ this.activeChartInstance = null;
50692
50657
  const { col, row } = this.parent;
50693
50658
  table.internalProps.layoutMap.isAxisCell(table.rowHeaderLevelCount - 1, row) &&
50694
50659
  table.scenegraph.getCell(table.rowHeaderLevelCount - 1, row).firstChild?.hideLabelHoverOnAxis?.();
@@ -50708,16 +50673,11 @@
50708
50673
  table.scenegraph.getCell(table.rowHeaderLevelCount - 1, row).firstChild?.hideLabelHoverOnAxis?.();
50709
50674
  }
50710
50675
  }
50711
- if (releaseAllChartInstance) {
50712
- clearAllChartInstanceList(table, forceRelease);
50676
+ if (releaseColumnChartInstance) {
50677
+ clearChartInstanceListByColumnDirection(this.parent.col, this.attribute.spec.type === 'scatter' ? this.parent.row : undefined, table);
50713
50678
  }
50714
- else {
50715
- if (releaseColumnChartInstance) {
50716
- clearChartInstanceListByColumnDirection(this.parent.col, this.attribute.spec.type === 'scatter' ? this.parent.row : undefined, table, forceRelease);
50717
- }
50718
- if (releaseRowChartInstance) {
50719
- clearChartInstanceListByRowDirection(this.parent.row, this.attribute.spec.type === 'scatter' ? this.parent.col : undefined, table, forceRelease);
50720
- }
50679
+ if (releaseRowChartInstance) {
50680
+ clearChartInstanceListByRowDirection(this.parent.row, this.attribute.spec.type === 'scatter' ? this.parent.col : undefined, table);
50721
50681
  }
50722
50682
  }
50723
50683
  updateData(data) {
@@ -50728,19 +50688,12 @@
50728
50688
  const padding = this.attribute.cellPadding;
50729
50689
  const table = this.stage.table;
50730
50690
  const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
50731
- const viewBox = {
50691
+ return {
50732
50692
  x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
50733
50693
  x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
50734
50694
  y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
50735
50695
  y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
50736
50696
  };
50737
- if (this.activeChartInstance) {
50738
- this.activeChartInstanceLastViewBox = viewBox;
50739
- }
50740
- else {
50741
- this.activeChartInstanceLastViewBox = null;
50742
- }
50743
- return viewBox;
50744
50697
  }
50745
50698
  }
50746
50699
  function getTableBounds(col, row, table) {
@@ -51009,6 +50962,7 @@
51009
50962
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
51010
50963
  const groupAttribute = getTheme(chart, params?.theme).group;
51011
50964
  const { dataId, data, spec } = chart.attribute;
50965
+ chart.getViewBox();
51012
50966
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
51013
50967
  const { table } = chart.getRootNode();
51014
50968
  const { cacheCanvas, activeChartInstance } = chart;
@@ -51031,20 +50985,13 @@
51031
50985
  activeChartInstance.updateSpecSync(spec, false, { reuse: false, morph: false });
51032
50986
  }
51033
50987
  }
51034
- const lastViewBox = chart.activeChartInstanceLastViewBox;
51035
50988
  const viewBox = chart.getViewBox();
51036
- if (!(lastViewBox &&
51037
- viewBox.x1 === lastViewBox.x1 &&
51038
- viewBox.x2 === lastViewBox.x2 &&
51039
- viewBox.y1 === lastViewBox.y1 &&
51040
- viewBox.y2 === lastViewBox.y2)) {
51041
- activeChartInstance.updateViewBox({
51042
- x1: 0,
51043
- x2: viewBox.x2 - viewBox.x1,
51044
- y1: 0,
51045
- y2: viewBox.y2 - viewBox.y1
51046
- }, false, false);
51047
- }
50989
+ activeChartInstance.updateViewBox({
50990
+ x1: 0,
50991
+ x2: viewBox.x2 - viewBox.x1,
50992
+ y1: 0,
50993
+ y2: viewBox.y2 - viewBox.y1
50994
+ }, false, false);
51048
50995
  const chartStage = activeChartInstance.getStage();
51049
50996
  chartStage.needRender = true;
51050
50997
  const matrix = chart.globalTransMatrix.clone();
@@ -57160,10 +57107,9 @@
57160
57107
  updateTableAxes(scenegraph.rightFrozenGroup, scenegraph.table);
57161
57108
  updateTableAxes(scenegraph.bottomFrozenGroup, scenegraph.table);
57162
57109
  }
57163
- function updateChartState(scenegraph, datum, selectedDataMode) {
57110
+ function updateChartState(scenegraph, datum) {
57164
57111
  const table = scenegraph.table;
57165
57112
  if (table.isPivotChart()) {
57166
- table._selectedDataMode = selectedDataMode;
57167
57113
  const preSelectItemsCount = table._selectedDataItemsInChart.length;
57168
57114
  if ((datum === null || datum === undefined || datum?.length === 0 || Object.keys(datum).length === 0) &&
57169
57115
  preSelectItemsCount === 0) {
@@ -58430,70 +58376,38 @@
58430
58376
  resetResidentHoverIcon(col, row) {
58431
58377
  resetResidentHoverIcon(col, row, this);
58432
58378
  }
58433
- deactivateChart(col, row, forceRelease = false) {
58379
+ deactivateChart(col, row) {
58434
58380
  if (col === -1 || row === -1) {
58435
- if (forceRelease) {
58436
- const brushingChartInstanceCellPos = getBrushingChartInstanceCellPos();
58437
- const cellGroup = this.getCell(brushingChartInstanceCellPos.col, brushingChartInstanceCellPos.row);
58438
- if (cellGroup?.firstChild?.deactivate) {
58439
- clearBrushingChartInstance();
58440
- cellGroup?.firstChild?.deactivate?.(this.table, {
58441
- forceRelease: true,
58442
- releaseChartInstance: true,
58443
- releaseColumnChartInstance: true,
58444
- releaseRowChartInstance: true,
58445
- releaseAllChartInstance: true
58446
- });
58447
- }
58448
- }
58449
58381
  return;
58450
58382
  }
58451
58383
  const cellGroup = this.getCell(col, row);
58452
58384
  if (cellGroup?.firstChild?.deactivate) {
58453
- if (forceRelease) {
58454
- clearBrushingChartInstance();
58455
- cellGroup?.firstChild?.deactivate?.(this.table, {
58456
- forceRelease: true,
58457
- releaseChartInstance: true,
58458
- releaseColumnChartInstance: true,
58459
- releaseRowChartInstance: true,
58460
- releaseAllChartInstance: true
58461
- });
58462
- return;
58463
- }
58464
58385
  const chartNode = cellGroup?.firstChild;
58465
58386
  const chartType = chartNode.attribute.spec.type;
58466
- cellGroup?.firstChild?.deactivate?.(this.table, this.table.options.chartDimensionLinkage?.showTooltip
58387
+ cellGroup?.firstChild?.deactivate?.(this.table, this.table.options.chartDimensionLinkage
58467
58388
  ? {
58468
- releaseChartInstance: chartType === 'pie'
58469
- ? false
58470
- : chartType === 'scatter'
58471
- ? (col !== this.table.stateManager.hover.cellPos.col &&
58472
- row !== this.table.stateManager.hover.cellPos.row) ||
58473
- this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount ||
58474
- this.table.stateManager.hover.cellPos.row >
58475
- this.table.rowCount - 1 - this.table.bottomFrozenRowCount ||
58476
- this.table.stateManager.hover.cellPos.col < this.table.frozenColCount ||
58477
- this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount
58478
- : this.table.options.indicatorsAsCol
58479
- ? row !== this.table.stateManager.hover.cellPos.row ||
58480
- this.table.stateManager.hover.cellPos.col < this.table.frozenColCount ||
58481
- this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount
58482
- : col !== this.table.stateManager.hover.cellPos.col ||
58483
- this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount ||
58484
- this.table.stateManager.hover.cellPos.row >
58485
- this.table.rowCount - 1 - this.table.bottomFrozenRowCount,
58486
- releaseColumnChartInstance: chartType === 'pie'
58487
- ? false
58488
- : col !== this.table.stateManager.hover.cellPos.col ||
58389
+ releaseChartInstance: chartType === 'scatter'
58390
+ ? (col !== this.table.stateManager.hover.cellPos.col &&
58391
+ row !== this.table.stateManager.hover.cellPos.row) ||
58489
58392
  this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount ||
58490
58393
  this.table.stateManager.hover.cellPos.row >
58491
- this.table.rowCount - 1 - this.table.bottomFrozenRowCount,
58492
- releaseRowChartInstance: chartType === 'pie'
58493
- ? false
58494
- : row !== this.table.stateManager.hover.cellPos.row ||
58394
+ this.table.rowCount - 1 - this.table.bottomFrozenRowCount ||
58495
58395
  this.table.stateManager.hover.cellPos.col < this.table.frozenColCount ||
58496
58396
  this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount
58397
+ : this.table.options.indicatorsAsCol
58398
+ ? row !== this.table.stateManager.hover.cellPos.row ||
58399
+ this.table.stateManager.hover.cellPos.col < this.table.frozenColCount ||
58400
+ this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount
58401
+ : col !== this.table.stateManager.hover.cellPos.col ||
58402
+ this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount ||
58403
+ this.table.stateManager.hover.cellPos.row >
58404
+ this.table.rowCount - 1 - this.table.bottomFrozenRowCount,
58405
+ releaseColumnChartInstance: col !== this.table.stateManager.hover.cellPos.col ||
58406
+ this.table.stateManager.hover.cellPos.row < this.table.frozenRowCount ||
58407
+ this.table.stateManager.hover.cellPos.row > this.table.rowCount - 1 - this.table.bottomFrozenRowCount,
58408
+ releaseRowChartInstance: row !== this.table.stateManager.hover.cellPos.row ||
58409
+ this.table.stateManager.hover.cellPos.col < this.table.frozenColCount ||
58410
+ this.table.stateManager.hover.cellPos.col > this.table.colCount - 1 - this.table.rightFrozenColCount
58497
58411
  }
58498
58412
  : undefined);
58499
58413
  }
@@ -58550,17 +58464,8 @@
58550
58464
  updateChartSizeForResizeRowHeight(row) {
58551
58465
  updateChartSizeForResizeRowHeight(this, row);
58552
58466
  }
58553
- updateChartState(datum, selectedDataMode) {
58554
- if (this.table.isPivotChart()) {
58555
- if (datum === null || datum === undefined || datum?.length === 0 || Object.keys(datum).length === 0) {
58556
- const brushingChartInstance = getBrushingChartInstance();
58557
- if (brushingChartInstance) {
58558
- brushingChartInstance.getChart().getComponentsByKey('brush')[0].clearBrushStateAndMask();
58559
- }
58560
- this.table.options.chartDimensionLinkage?.clearChartState?.();
58561
- }
58562
- updateChartState(this, datum, selectedDataMode);
58563
- }
58467
+ updateChartState(datum) {
58468
+ this.table.isPivotChart() && updateChartState(this, datum);
58564
58469
  }
58565
58470
  updateCheckboxCellState(col, row, checked) {
58566
58471
  if (this.table.transpose) {
@@ -63847,7 +63752,7 @@
63847
63752
  return;
63848
63753
  }
63849
63754
  if (table.isPivotChart() && eventArgsSet?.eventArgs?.target.type !== 'chart') {
63850
- table.scenegraph.updateChartState(null, undefined);
63755
+ table.scenegraph.updateChartState(null);
63851
63756
  }
63852
63757
  if (eventArgsSet.eventArgs?.target !== stateManager.residentHoverIcon?.icon) {
63853
63758
  stateManager.hideMenu();
@@ -63916,7 +63821,7 @@
63916
63821
  else {
63917
63822
  if (!eventManager.checkCellFillhandle(eventArgsSet) &&
63918
63823
  (eventManager.checkColumnResize(eventArgsSet, true) || eventManager.checkRowResize(eventArgsSet, true))) {
63919
- table.scenegraph.updateChartState(null, undefined);
63824
+ table.scenegraph.updateChartState(null);
63920
63825
  stateManager.updateInteractionState(InteractionState.grabing);
63921
63826
  return;
63922
63827
  }
@@ -64161,7 +64066,7 @@
64161
64066
  !eventManager.checkCellFillhandle(eventArgsSet) &&
64162
64067
  !stateManager.columnResize.resizing &&
64163
64068
  eventManager.checkColumnResize(eventArgsSet, true)) {
64164
- table.scenegraph.updateChartState(null, undefined);
64069
+ table.scenegraph.updateChartState(null);
64165
64070
  stateManager.updateInteractionState(InteractionState.grabing);
64166
64071
  const { eventArgs } = eventArgsSet;
64167
64072
  if (!eventArgs?.targetCell) {
@@ -64208,7 +64113,7 @@
64208
64113
  }
64209
64114
  stateManager.endSelectCells(true, isHasSelected);
64210
64115
  stateManager.updateCursor();
64211
- table.scenegraph.updateChartState(null, undefined);
64116
+ table.scenegraph.updateChartState(null);
64212
64117
  }
64213
64118
  else if (table.eventManager.isDraging && stateManager.isSelecting()) {
64214
64119
  stateManager.endSelectCells();
@@ -64399,10 +64304,6 @@
64399
64304
  const legend = e.path.find(node => node.name === 'legend');
64400
64305
  if (!legend) {
64401
64306
  table.editorManager?.completeEdit();
64402
- const { cellPos } = table.stateManager.hover;
64403
- const prevHoverCellCol = cellPos.col;
64404
- const prevHoverCellRow = cellPos.row;
64405
- table.scenegraph.deactivateChart(prevHoverCellCol, prevHoverCellRow, true);
64406
64307
  if (table.eventManager._enableTableScroll) {
64407
64308
  handleWhell(e, stateManager);
64408
64309
  }
@@ -65755,6 +65656,7 @@
65755
65656
  cutOperationTime = 0;
65756
65657
  lastClipboardContent = '';
65757
65658
  cutCellRange = null;
65659
+ cutRanges = null;
65758
65660
  copySourceRange = null;
65759
65661
  constructor(table) {
65760
65662
  this.table = table;
@@ -66274,6 +66176,10 @@
66274
66176
  this.handleCopy(e, true);
66275
66177
  this.cutWaitPaste = true;
66276
66178
  this.cutCellRange = this.table.getSelectedCellInfos();
66179
+ this.cutRanges = this.table.stateManager.select.ranges?.map(r => ({
66180
+ start: { col: r.start.col, row: r.start.row },
66181
+ end: { col: r.end.col, row: r.end.row }
66182
+ }));
66277
66183
  if (this.clipboardCheckTimer) {
66278
66184
  clearTimeout(this.clipboardCheckTimer);
66279
66185
  }
@@ -66281,6 +66187,7 @@
66281
66187
  if (this.cutWaitPaste) {
66282
66188
  this.cutWaitPaste = false;
66283
66189
  this.cutCellRange = null;
66190
+ this.cutRanges = null;
66284
66191
  this.clipboardCheckTimer = null;
66285
66192
  }
66286
66193
  }, 30000);
@@ -66300,6 +66207,7 @@
66300
66207
  if (this.cutWaitPaste) {
66301
66208
  this.cutWaitPaste = false;
66302
66209
  this.cutCellRange = null;
66210
+ this.cutRanges = null;
66303
66211
  if (this.clipboardCheckTimer) {
66304
66212
  clearTimeout(this.clipboardCheckTimer);
66305
66213
  this.clipboardCheckTimer = null;
@@ -66415,17 +66323,11 @@
66415
66323
  }
66416
66324
  clearCutArea(table) {
66417
66325
  try {
66418
- const selectCells = this.cutCellRange;
66419
- if (!selectCells || selectCells.length === 0) {
66326
+ const ranges = this.cutRanges;
66327
+ if (!ranges || ranges.length === 0) {
66420
66328
  return;
66421
66329
  }
66422
- for (let i = 0; i < selectCells.length; i++) {
66423
- for (let j = 0; j < selectCells[i].length; j++) {
66424
- if (selectCells[i][j]) {
66425
- table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, undefined);
66426
- }
66427
- }
66428
- }
66330
+ table.changeCellValuesByIds(ranges, '');
66429
66331
  }
66430
66332
  catch (error) {
66431
66333
  }
@@ -69947,6 +69849,15 @@
69947
69849
  this.customCellStyle = customCellStyle;
69948
69850
  this.customCellStyleArrangement = customCellStyleArrangement;
69949
69851
  }
69852
+ clearCustomCellStyleArrangement() {
69853
+ this.customCellStyleArrangement = [];
69854
+ }
69855
+ addCustomCellStyleArrangement(cellPosition, customStyleId) {
69856
+ this.customCellStyleArrangement.push({
69857
+ cellPosition,
69858
+ customStyleId
69859
+ });
69860
+ }
69950
69861
  getCustomCellStyle(col, row) {
69951
69862
  const customStyleIds = this.getCustomCellStyleIds(col, row);
69952
69863
  if (customStyleIds.length) {
@@ -70475,7 +70386,7 @@
70475
70386
  return TABLE_EVENT_TYPE;
70476
70387
  }
70477
70388
  options;
70478
- version = "1.22.11-alpha.6";
70389
+ version = "1.22.11-alpha.7";
70479
70390
  pagination;
70480
70391
  id = `VTable${Date.now()}`;
70481
70392
  headerStyleCache;
@@ -76513,9 +76424,10 @@
76513
76424
  return { addRecordRule };
76514
76425
  }
76515
76426
 
76516
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
76427
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
76517
76428
  if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
76518
- const recordIndex = table.getRecordShowIndexByCell(col, row);
76429
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row);
76430
+ const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76519
76431
  const { field } = table.internalProps.layoutMap.getBody(col, row);
76520
76432
  const beforeChangeValue = table.getCellRawValue(col, row);
76521
76433
  const oldValue = table.getCellOriginValue(col, row);
@@ -76523,7 +76435,7 @@
76523
76435
  table.internalProps.layoutMap.updateColumnTitle(col, row, value);
76524
76436
  }
76525
76437
  else {
76526
- table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
76438
+ table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
76527
76439
  }
76528
76440
  const range = table.getCellRange(col, row);
76529
76441
  const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
@@ -76576,18 +76488,24 @@
76576
76488
  }
76577
76489
  const changedValue = table.getCellOriginValue(col, row);
76578
76490
  if (oldValue !== changedValue && triggerEvent) {
76579
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
76491
+ const changeValue = {
76580
76492
  col,
76581
76493
  row,
76494
+ recordIndex,
76495
+ field,
76582
76496
  rawValue: beforeChangeValue,
76583
76497
  currentValue: oldValue,
76584
76498
  changedValue
76585
- });
76499
+ };
76500
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
76501
+ if (!silentChangeCellValuesEvent) {
76502
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
76503
+ }
76586
76504
  }
76587
76505
  table.scenegraph.updateNextFrame();
76588
76506
  }
76589
76507
  }
76590
- async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
76508
+ async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
76591
76509
  const changedCellResults = [];
76592
76510
  let pasteColEnd = startCol;
76593
76511
  let pasteRowEnd = startRow;
@@ -76614,6 +76532,7 @@
76614
76532
  oldRowValues.push(oldValue);
76615
76533
  }
76616
76534
  }
76535
+ const resultChangeValues = [];
76617
76536
  for (let i = 0; i < values.length; i++) {
76618
76537
  if (startRow + i > table.rowCount - 1) {
76619
76538
  break;
@@ -76653,7 +76572,8 @@
76653
76572
  if (isCanChange) {
76654
76573
  changedCellResults[i][j] = true;
76655
76574
  const value = rowValues[j];
76656
- const recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
76575
+ const recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
76576
+ const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76657
76577
  const { field } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i);
76658
76578
  const beforeChangeValue = beforeChangeValues[i][j];
76659
76579
  const oldValue = oldValues[i][j];
@@ -76661,17 +76581,21 @@
76661
76581
  table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value);
76662
76582
  }
76663
76583
  else {
76664
- table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
76584
+ table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
76665
76585
  }
76666
76586
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
76667
76587
  if (oldValue !== changedValue && triggerEvent) {
76668
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
76588
+ const changeValue = {
76669
76589
  col: startCol + j,
76670
76590
  row: startRow + i,
76591
+ recordIndex,
76592
+ field,
76671
76593
  rawValue: beforeChangeValue,
76672
76594
  currentValue: oldValue,
76673
76595
  changedValue
76674
- });
76596
+ };
76597
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
76598
+ resultChangeValues.push(changeValue);
76675
76599
  }
76676
76600
  }
76677
76601
  else {
@@ -76680,6 +76604,9 @@
76680
76604
  }
76681
76605
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
76682
76606
  }
76607
+ if (!silentChangeCellValuesEvent) {
76608
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
76609
+ }
76683
76610
  const startRange = table.getCellRange(startCol, startRow);
76684
76611
  const range = table.getCellRange(pasteColEnd, pasteRowEnd);
76685
76612
  const aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -76752,6 +76679,68 @@
76752
76679
  table.scenegraph.updateNextFrame();
76753
76680
  return changedCellResults;
76754
76681
  }
76682
+ async function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
76683
+ const resultChangeValues = [];
76684
+ const processed = new Set();
76685
+ const nextValue = (value ?? '');
76686
+ for (let i = 0; i < (ranges?.length ?? 0); i++) {
76687
+ const range = ranges[i];
76688
+ const startCol = Math.min(range.start.col, range.end.col);
76689
+ const endCol = Math.max(range.start.col, range.end.col);
76690
+ const startRow = Math.min(range.start.row, range.end.row);
76691
+ const endRow = Math.max(range.start.row, range.end.row);
76692
+ if (startCol > endCol || startRow > endRow) {
76693
+ continue;
76694
+ }
76695
+ const values = [];
76696
+ const oldValues = [];
76697
+ for (let row = startRow; row <= endRow; row++) {
76698
+ const rowValues = [];
76699
+ const rowOldValues = [];
76700
+ for (let col = startCol; col <= endCol; col++) {
76701
+ rowValues.push(nextValue);
76702
+ rowOldValues.push(table.getCellOriginValue(col, row));
76703
+ }
76704
+ values.push(rowValues);
76705
+ oldValues.push(rowOldValues);
76706
+ }
76707
+ const changedCellResults = await listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, true);
76708
+ for (let r = 0; r < values.length; r++) {
76709
+ for (let c = 0; c < values[r].length; c++) {
76710
+ const col = startCol + c;
76711
+ const row = startRow + r;
76712
+ const key = `${col},${row}`;
76713
+ if (processed.has(key)) {
76714
+ continue;
76715
+ }
76716
+ processed.add(key);
76717
+ if (!triggerEvent || !changedCellResults?.[r]?.[c]) {
76718
+ continue;
76719
+ }
76720
+ const oldValue = oldValues[r][c];
76721
+ const changedValue = table.getCellOriginValue(col, row);
76722
+ if (oldValue === changedValue) {
76723
+ continue;
76724
+ }
76725
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row);
76726
+ const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
76727
+ const { field } = table.internalProps.layoutMap.getBody(col, row);
76728
+ resultChangeValues.push({
76729
+ col,
76730
+ row,
76731
+ recordIndex,
76732
+ field,
76733
+ rawValue: oldValue,
76734
+ currentValue: oldValue,
76735
+ changedValue
76736
+ });
76737
+ }
76738
+ }
76739
+ }
76740
+ if (!silentChangeCellValuesEvent && triggerEvent) {
76741
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
76742
+ }
76743
+ }
76755
76744
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
76756
76745
  if (oldCellUpdateType === 'group') {
76757
76746
  return oldCellUpdateType;
@@ -76805,7 +76794,13 @@
76805
76794
  table.scenegraph.createSceneGraph();
76806
76795
  }
76807
76796
  else if (table.sortState) {
76808
- table.dataSource.addRecordForSorted(record);
76797
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76798
+ if (syncToOriginalRecords) {
76799
+ table.dataSource.addRecord(record, table.dataSource.records.length, true);
76800
+ }
76801
+ else {
76802
+ table.dataSource.addRecordForSorted(record);
76803
+ }
76809
76804
  table.stateManager.checkedState.clear();
76810
76805
  sortRecords(table);
76811
76806
  table.refreshRowColCount();
@@ -76818,8 +76813,16 @@
76818
76813
  recordIndex = table.dataSource.sourceLength;
76819
76814
  }
76820
76815
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76821
- table.dataSource.addRecord(record, recordIndex);
76816
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76817
+ table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords);
76822
76818
  adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
76819
+ if (syncToOriginalRecords) {
76820
+ table.refreshRowColCount();
76821
+ table.internalProps.layoutMap.clearCellRangeMap();
76822
+ table.scenegraph.clearCells();
76823
+ table.scenegraph.createSceneGraph();
76824
+ return true;
76825
+ }
76823
76826
  const oldRowCount = table.rowCount;
76824
76827
  table.refreshRowColCount();
76825
76828
  if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
@@ -76931,7 +76934,13 @@
76931
76934
  table.scenegraph.createSceneGraph();
76932
76935
  }
76933
76936
  else if (table.sortState) {
76934
- table.dataSource.addRecordsForSorted(records);
76937
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76938
+ if (syncToOriginalRecords) {
76939
+ table.dataSource.addRecords(records, table.dataSource.records.length, true);
76940
+ }
76941
+ else {
76942
+ table.dataSource.addRecordsForSorted(records);
76943
+ }
76935
76944
  sortRecords(table);
76936
76945
  table.refreshRowColCount();
76937
76946
  table.scenegraph.clearCells();
@@ -76946,8 +76955,16 @@
76946
76955
  recordIndex = 0;
76947
76956
  }
76948
76957
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76949
- table.dataSource.addRecords(records, recordIndex);
76958
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
76959
+ table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords);
76950
76960
  adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
76961
+ if (syncToOriginalRecords) {
76962
+ table.refreshRowColCount();
76963
+ table.internalProps.layoutMap.clearCellRangeMap();
76964
+ table.scenegraph.clearCells();
76965
+ table.scenegraph.createSceneGraph();
76966
+ return true;
76967
+ }
76951
76968
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
76952
76969
  table.refreshRowColCount();
76953
76970
  if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
@@ -77063,20 +77080,34 @@
77063
77080
  table.scenegraph.createSceneGraph();
77064
77081
  }
77065
77082
  else if (table.sortState) {
77066
- table.dataSource.deleteRecordsForSorted(recordIndexs);
77083
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77084
+ if (syncToOriginalRecords) {
77085
+ table.dataSource.deleteRecords(recordIndexs, true);
77086
+ }
77087
+ else {
77088
+ table.dataSource.deleteRecordsForSorted(recordIndexs);
77089
+ }
77067
77090
  sortRecords(table);
77068
77091
  table.refreshRowColCount();
77069
77092
  table.scenegraph.clearCells();
77070
77093
  table.scenegraph.createSceneGraph();
77071
77094
  }
77072
77095
  else {
77073
- const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);
77096
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77097
+ const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
77074
77098
  if (deletedRecordIndexs.length === 0) {
77075
77099
  return;
77076
77100
  }
77077
77101
  for (let index = 0; index < deletedRecordIndexs.length; index++) {
77078
77102
  adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
77079
77103
  }
77104
+ if (syncToOriginalRecords) {
77105
+ table.refreshRowColCount();
77106
+ table.internalProps.layoutMap.clearCellRangeMap();
77107
+ table.scenegraph.clearCells();
77108
+ table.scenegraph.createSceneGraph();
77109
+ return;
77110
+ }
77080
77111
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
77081
77112
  table.refreshRowColCount();
77082
77113
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -77194,18 +77225,32 @@
77194
77225
  table.scenegraph.createSceneGraph();
77195
77226
  }
77196
77227
  else if (table.sortState) {
77197
- table.dataSource.updateRecordsForSorted(records, recordIndexs);
77228
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77229
+ if (syncToOriginalRecords) {
77230
+ table.dataSource.updateRecords(records, recordIndexs, true);
77231
+ }
77232
+ else {
77233
+ table.dataSource.updateRecordsForSorted(records, recordIndexs);
77234
+ }
77198
77235
  sortRecords(table);
77199
77236
  table.refreshRowColCount();
77200
77237
  table.scenegraph.clearCells();
77201
77238
  table.scenegraph.createSceneGraph();
77202
77239
  }
77203
77240
  else {
77204
- const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);
77241
+ const syncToOriginalRecords = !!table.options?.syncRecordOperationsToSourceRecords;
77242
+ const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
77205
77243
  if (updateRecordIndexs.length === 0) {
77206
77244
  return;
77207
77245
  }
77208
- const bodyRowIndex = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index));
77246
+ if (syncToOriginalRecords) {
77247
+ table.refreshRowColCount();
77248
+ table.internalProps.layoutMap.clearCellRangeMap();
77249
+ table.scenegraph.clearCells();
77250
+ table.scenegraph.createSceneGraph();
77251
+ return;
77252
+ }
77253
+ const bodyRowIndex = updateRecordIndexs.map((index) => table.getBodyRowIndexByRecordIndex(index));
77209
77254
  const recordIndexsMinToMax = bodyRowIndex.sort((a, b) => a - b);
77210
77255
  if (table.pagination) {
77211
77256
  const { perPageCount, currentPage } = table.pagination;
@@ -78602,17 +78647,182 @@
78602
78647
  }
78603
78648
  return isValid$1(editorDefine);
78604
78649
  }
78605
- changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true) {
78606
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
78650
+ changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
78651
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
78652
+ }
78653
+ changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
78654
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
78655
+ }
78656
+ changeCellValuesByIds(ranges, value, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
78657
+ return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
78658
+ }
78659
+ changeSourceCellValue(recordIndex, field, value) {
78660
+ const tableIndex = this.getTableIndexByRecordIndex(recordIndex);
78661
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
78662
+ if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) {
78663
+ return;
78664
+ }
78665
+ this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
78666
+ const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row);
78667
+ const oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
78668
+ const changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
78669
+ if (oldValue !== changedValue) {
78670
+ const changeValue = {
78671
+ col: cellAddr.col,
78672
+ row: cellAddr.row,
78673
+ recordIndex,
78674
+ field,
78675
+ rawValue: beforeChangeValue,
78676
+ currentValue: oldValue,
78677
+ changedValue
78678
+ };
78679
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
78680
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
78681
+ }
78682
+ }
78683
+ changeCellValueByRecord(recordIndex, field, value, options) {
78684
+ const triggerEvent = options?.triggerEvent ?? true;
78685
+ const silentChangeCellValuesEvent = options?.silentChangeCellValuesEvent;
78686
+ const autoRefresh = options?.autoRefresh ?? true;
78687
+ const records = this.dataSource.dataSourceObj?.records;
78688
+ let record;
78689
+ let oldValue;
78690
+ if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
78691
+ record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
78692
+ oldValue = record?.[field];
78693
+ }
78694
+ this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
78695
+ if (!triggerEvent) {
78696
+ return;
78697
+ }
78698
+ const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
78699
+ if (oldValue !== changedValue) {
78700
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
78701
+ const changeValue = {
78702
+ col: cellAddr?.col ?? -1,
78703
+ row: cellAddr?.row ?? -1,
78704
+ recordIndex,
78705
+ field,
78706
+ rawValue: oldValue,
78707
+ currentValue: oldValue,
78708
+ changedValue
78709
+ };
78710
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
78711
+ if (!silentChangeCellValuesEvent) {
78712
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
78713
+ }
78714
+ }
78715
+ if (autoRefresh) {
78716
+ this.refreshAfterSourceChange();
78717
+ }
78718
+ }
78719
+ changeCellValueBySource(recordIndex, field, value, triggerEvent = true, silentChangeCellValuesEvent) {
78720
+ return this.changeCellValueByRecord(recordIndex, field, value, {
78721
+ triggerEvent,
78722
+ silentChangeCellValuesEvent,
78723
+ autoRefresh: true
78724
+ });
78725
+ }
78726
+ changeCellValuesByRecords(changeValues, options) {
78727
+ const triggerEvent = options?.triggerEvent ?? true;
78728
+ const silentChangeCellValuesEvent = options?.silentChangeCellValuesEvent;
78729
+ const autoRefresh = options?.autoRefresh ?? true;
78730
+ const resultChangeValues = [];
78731
+ for (let i = 0; i < changeValues.length; i++) {
78732
+ const { recordIndex, field, value } = changeValues[i];
78733
+ const records = this.dataSource.dataSourceObj?.records;
78734
+ let record;
78735
+ let oldValue;
78736
+ if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
78737
+ record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
78738
+ oldValue = record?.[field];
78739
+ }
78740
+ this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
78741
+ if (triggerEvent) {
78742
+ const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
78743
+ if (oldValue !== changedValue) {
78744
+ const changeValue = {
78745
+ col: (this.getCellAddrByFieldRecord(field, recordIndex)?.col ?? -1),
78746
+ row: (this.getCellAddrByFieldRecord(field, recordIndex)?.row ?? -1),
78747
+ recordIndex,
78748
+ field,
78749
+ rawValue: oldValue,
78750
+ currentValue: oldValue,
78751
+ changedValue
78752
+ };
78753
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
78754
+ resultChangeValues.push(changeValue);
78755
+ }
78756
+ }
78757
+ }
78758
+ if (!silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent) {
78759
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
78760
+ }
78761
+ if (autoRefresh) {
78762
+ this.refreshAfterSourceChange();
78763
+ }
78764
+ }
78765
+ changeCellValuesBySource(changeValues, triggerEvent = true, silentChangeCellValuesEvent) {
78766
+ return this.changeCellValuesByRecords(changeValues, {
78767
+ triggerEvent,
78768
+ silentChangeCellValuesEvent,
78769
+ autoRefresh: true
78770
+ });
78607
78771
  }
78608
- changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true) {
78609
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
78772
+ refreshAfterSourceChange(options) {
78773
+ const reapplyFilter = options?.reapplyFilter ?? true;
78774
+ const reapplySort = options?.reapplySort ?? true;
78775
+ const clearRowHeightCache = options?.clearRowHeightCache ?? true;
78776
+ this.scenegraph.clearCells();
78777
+ if (this.sortState && reapplySort) {
78778
+ this.dataSource.clearSortedIndexMap?.();
78779
+ this.dataSource.sortedIndexMap?.clear?.();
78780
+ }
78781
+ if (reapplyFilter) {
78782
+ if (this.sortState && reapplySort) {
78783
+ this.dataSource.updateFilterRulesForSorted(this.dataSource.dataConfig?.filterRules);
78784
+ sortRecords(this);
78785
+ }
78786
+ else {
78787
+ this.dataSource.updateFilterRules(this.dataSource.dataConfig?.filterRules);
78788
+ }
78789
+ }
78790
+ else if (this.sortState && reapplySort) {
78791
+ sortRecords(this);
78792
+ }
78793
+ const traverseColumns = (columns) => {
78794
+ for (let i = 0; i < (columns?.length ?? 0); i++) {
78795
+ const column = columns[i];
78796
+ const aggregators = column?.vtable_aggregator;
78797
+ if (aggregators) {
78798
+ if (Array.isArray(aggregators)) {
78799
+ for (let j = 0; j < aggregators.length; j++) {
78800
+ aggregators[j]?.recalculate?.();
78801
+ }
78802
+ }
78803
+ else {
78804
+ aggregators?.recalculate?.();
78805
+ }
78806
+ }
78807
+ if (column?.columns) {
78808
+ traverseColumns(column.columns);
78809
+ }
78810
+ }
78811
+ };
78812
+ traverseColumns(this.internalProps.columns);
78813
+ this.refreshRowColCount();
78814
+ this.internalProps.layoutMap.clearCellRangeMap();
78815
+ this.internalProps.useOneRowHeightFillAll = false;
78816
+ this.stateManager.initCheckedState(this.records);
78817
+ this.scenegraph.createSceneGraph(!clearRowHeightCache);
78818
+ this.internalProps.emptyTip?.resetVisible();
78819
+ this.resize();
78610
78820
  }
78611
- addRecord(record, recordIndex) {
78821
+ addRecord(record, recordIndex, triggerEvent = true) {
78612
78822
  const success = listTableAddRecord(record, recordIndex, this);
78613
78823
  adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]);
78614
78824
  this.internalProps.emptyTip?.resetVisible();
78615
- if (success) {
78825
+ if (triggerEvent && success) {
78616
78826
  this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78617
78827
  records: [record],
78618
78828
  recordIndex,
@@ -78620,13 +78830,13 @@
78620
78830
  });
78621
78831
  }
78622
78832
  }
78623
- addRecords(records, recordIndex) {
78833
+ addRecords(records, recordIndex, triggerEvent = true) {
78624
78834
  const success = listTableAddRecords(records, recordIndex, this);
78625
78835
  if (typeof recordIndex === 'number') {
78626
78836
  adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records);
78627
78837
  }
78628
78838
  this.internalProps.emptyTip?.resetVisible();
78629
- if (success) {
78839
+ if (triggerEvent && success) {
78630
78840
  this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78631
78841
  records,
78632
78842
  recordIndex,
@@ -78634,7 +78844,20 @@
78634
78844
  });
78635
78845
  }
78636
78846
  }
78637
- deleteRecords(recordIndexs) {
78847
+ deleteRecords(recordIndexs, triggerEvent = true) {
78848
+ const deletedRecords = [];
78849
+ if (recordIndexs?.length > 0) {
78850
+ recordIndexs.forEach(index => {
78851
+ let record = null;
78852
+ if (typeof index === 'number') {
78853
+ record = this.dataSource.get(index);
78854
+ }
78855
+ else {
78856
+ record = [];
78857
+ }
78858
+ deletedRecords.push(record);
78859
+ });
78860
+ }
78638
78861
  listTableDeleteRecords(recordIndexs, this);
78639
78862
  adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs);
78640
78863
  this.internalProps.emptyTip?.resetVisible();
@@ -78642,21 +78865,26 @@
78642
78865
  for (let i = 0; i < recordIndexs.length; i++) {
78643
78866
  rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
78644
78867
  }
78645
- this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
78646
- recordIndexs,
78647
- rowIndexs,
78648
- deletedCount: Array.isArray(recordIndexs[0])
78649
- ? recordIndexs.length
78650
- : recordIndexs.length
78651
- });
78868
+ if (triggerEvent) {
78869
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
78870
+ recordIndexs,
78871
+ records: deletedRecords,
78872
+ rowIndexs,
78873
+ deletedCount: Array.isArray(recordIndexs[0])
78874
+ ? recordIndexs.length
78875
+ : recordIndexs.length
78876
+ });
78877
+ }
78652
78878
  }
78653
- updateRecords(records, recordIndexs) {
78879
+ updateRecords(records, recordIndexs, triggerEvent = true) {
78654
78880
  listTableUpdateRecords(records, recordIndexs, this);
78655
- this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
78656
- records,
78657
- recordIndexs,
78658
- updateCount: records.length
78659
- });
78881
+ if (triggerEvent) {
78882
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
78883
+ records,
78884
+ recordIndexs,
78885
+ updateCount: records.length
78886
+ });
78887
+ }
78660
78888
  }
78661
78889
  _hasCustomRenderOrLayout() {
78662
78890
  const { headerObjects } = this.internalProps.layoutMap;
@@ -87553,93 +87781,53 @@
87553
87781
  return null;
87554
87782
  }
87555
87783
  _generateChartState() {
87556
- const select_filter = (datum) => {
87557
- if (this._table._selectedDataItemsInChart.length >= 1) {
87558
- const match = this._table._selectedDataItemsInChart.find(item => {
87559
- for (const itemKey in item) {
87560
- if (typeof item[itemKey] !== 'object' && item[itemKey] !== datum[itemKey]) {
87561
- return false;
87562
- }
87563
- }
87564
- return true;
87565
- });
87566
- return !!match;
87567
- }
87568
- else if (this._table._selectedDimensionInChart?.length) {
87569
- const match = this._table._selectedDimensionInChart.every(item => {
87570
- if (typeof item.value !== 'object' && datum[item.key] !== item.value) {
87571
- return false;
87572
- }
87573
- return true;
87574
- });
87575
- return !!match;
87576
- }
87577
- return false;
87578
- };
87579
- const selected_reverse = (datum) => {
87580
- if (this._table._selectedDataItemsInChart.length >= 1) {
87581
- const match = this._table._selectedDataItemsInChart.find(item => {
87582
- for (const itemKey in item) {
87583
- if (typeof item[itemKey] !== 'object' && item[itemKey] !== datum[itemKey]) {
87584
- return false;
87585
- }
87586
- }
87587
- return true;
87588
- });
87589
- return !match;
87590
- }
87591
- else if (this._table._selectedDimensionInChart?.length) {
87592
- const match = this._table._selectedDimensionInChart.every(item => {
87593
- if (typeof item.value !== 'object' && datum[item.key] !== item.value) {
87594
- return false;
87595
- }
87596
- return true;
87597
- });
87598
- return !match;
87599
- }
87600
- return false;
87601
- };
87602
87784
  const state = {
87603
87785
  vtable_selected: {
87604
87786
  filter: (datum) => {
87605
- if (this._table.options.chartDimensionLinkage?.selectedStateFilter) {
87606
- return this._table.options.chartDimensionLinkage.selectedStateFilter(datum);
87787
+ if (this._table._selectedDataItemsInChart.length >= 1) {
87788
+ const match = this._table._selectedDataItemsInChart.find(item => {
87789
+ for (const itemKey in item) {
87790
+ if (typeof item[itemKey] !== 'object' && item[itemKey] !== datum[itemKey]) {
87791
+ return false;
87792
+ }
87793
+ }
87794
+ return true;
87795
+ });
87796
+ return !!match;
87607
87797
  }
87608
- if (this._table._selectedDataMode === 'click') {
87609
- return select_filter(datum);
87798
+ else if (this._table._selectedDimensionInChart?.length) {
87799
+ const match = this._table._selectedDimensionInChart.every(item => {
87800
+ if (typeof item.value !== 'object' && datum[item.key] !== item.value) {
87801
+ return false;
87802
+ }
87803
+ return true;
87804
+ });
87805
+ return !!match;
87610
87806
  }
87611
87807
  return false;
87612
87808
  }
87613
87809
  },
87614
87810
  vtable_selected_reverse: {
87615
87811
  filter: (datum) => {
87616
- if (this._table.options.chartDimensionLinkage?.selectedReverseStateFilter) {
87617
- return this._table.options.chartDimensionLinkage.selectedReverseStateFilter(datum);
87618
- }
87619
- if (this._table._selectedDataMode === 'click') {
87620
- return selected_reverse(datum);
87621
- }
87622
- return false;
87623
- }
87624
- },
87625
- inBrush: {
87626
- filter: (datum) => {
87627
- if (this._table.options.chartDimensionLinkage?.inBrushStateFilter) {
87628
- return this._table.options.chartDimensionLinkage.inBrushStateFilter(datum);
87629
- }
87630
- if (this._table._selectedDataMode === 'brush') {
87631
- return select_filter(datum);
87632
- }
87633
- return false;
87634
- }
87635
- },
87636
- outOfBrush: {
87637
- filter: (datum) => {
87638
- if (this._table.options.chartDimensionLinkage?.outOfBrushStateFilter) {
87639
- return this._table.options.chartDimensionLinkage.outOfBrushStateFilter(datum);
87812
+ if (this._table._selectedDataItemsInChart.length >= 1) {
87813
+ const match = this._table._selectedDataItemsInChart.find(item => {
87814
+ for (const itemKey in item) {
87815
+ if (typeof item[itemKey] !== 'object' && item[itemKey] !== datum[itemKey]) {
87816
+ return false;
87817
+ }
87818
+ }
87819
+ return true;
87820
+ });
87821
+ return !match;
87640
87822
  }
87641
- if (this._table._selectedDataMode === 'brush') {
87642
- return selected_reverse(datum);
87823
+ else if (this._table._selectedDimensionInChart?.length) {
87824
+ const match = this._table._selectedDimensionInChart.every(item => {
87825
+ if (typeof item.value !== 'object' && datum[item.key] !== item.value) {
87826
+ return false;
87827
+ }
87828
+ return true;
87829
+ });
87830
+ return !match;
87643
87831
  }
87644
87832
  return false;
87645
87833
  }
@@ -91911,7 +92099,6 @@
91911
92099
  pivotSortState;
91912
92100
  dataset;
91913
92101
  _selectedDataItemsInChart = [];
91914
- _selectedDataMode = 'click';
91915
92102
  _selectedDimensionInChart = [];
91916
92103
  _chartEventMap = {};
91917
92104
  _axes;
@@ -93101,12 +93288,6 @@
93101
93288
  const headerNodes = layoutMap.getCellHeaderPathsWithTreeNode(col, row);
93102
93289
  return headerNodes;
93103
93290
  }
93104
- disableDimensionHoverToAllChartInstances() {
93105
- disableDimensionHoverToAllChartInstances();
93106
- }
93107
- enableDimensionHoverToAllChartInstances() {
93108
- enableDimensionHoverToAllChartInstances();
93109
- }
93110
93291
  }
93111
93292
 
93112
93293
  class Circle extends Circle$1 {
@@ -93668,7 +93849,7 @@
93668
93849
  }
93669
93850
 
93670
93851
  registerForVrender();
93671
- const version = "1.22.11-alpha.6";
93852
+ const version = "1.22.11-alpha.7";
93672
93853
  function getIcons() {
93673
93854
  return get$2();
93674
93855
  }