@visactor/vtable 1.21.1 → 1.22.1

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 (161) hide show
  1. package/cjs/ListTable.d.ts +4 -2
  2. package/cjs/ListTable.js +76 -16
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable.d.ts +1 -1
  5. package/cjs/PivotTable.js +1 -1
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.d.ts +4 -0
  8. package/cjs/core/BaseTable.js +23 -1
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.d.ts +7 -0
  11. package/cjs/core/TABLE_EVENT_TYPE.js +8 -1
  12. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  13. package/cjs/core/record-helper.d.ts +2 -2
  14. package/cjs/core/record-helper.js +141 -129
  15. package/cjs/core/record-helper.js.map +1 -1
  16. package/cjs/core/tableHelper.js +6 -1
  17. package/cjs/core/tableHelper.js.map +1 -1
  18. package/cjs/core/utils/get-cell-position.d.ts +2 -0
  19. package/cjs/core/utils/get-cell-position.js +29 -2
  20. package/cjs/core/utils/get-cell-position.js.map +1 -1
  21. package/cjs/data/CachedDataSource.js +2 -2
  22. package/cjs/data/CachedDataSource.js.map +1 -1
  23. package/cjs/event/event.d.ts +1 -1
  24. package/cjs/event/event.js +5 -4
  25. package/cjs/event/event.js.map +1 -1
  26. package/cjs/event/helper.js +3 -1
  27. package/cjs/event/helper.js.map +1 -1
  28. package/cjs/event/listener/container-dom.js +3 -3
  29. package/cjs/event/listener/container-dom.js.map +1 -1
  30. package/cjs/event/listener/table-group.js +3 -2
  31. package/cjs/event/listener/table-group.js.map +1 -1
  32. package/cjs/event/scroll.d.ts +1 -1
  33. package/cjs/event/scroll.js +4 -4
  34. package/cjs/event/scroll.js.map +1 -1
  35. package/cjs/index.d.ts +1 -1
  36. package/cjs/index.js +1 -1
  37. package/cjs/index.js.map +1 -1
  38. package/cjs/layout/row-height-map.d.ts +2 -2
  39. package/cjs/layout/row-height-map.js +27 -28
  40. package/cjs/layout/row-height-map.js.map +1 -1
  41. package/cjs/layout/simple-header-layout.js +18 -7
  42. package/cjs/layout/simple-header-layout.js.map +1 -1
  43. package/cjs/scenegraph/component/cell-mover.js +3 -3
  44. package/cjs/scenegraph/component/cell-mover.js.map +1 -1
  45. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +4 -4
  46. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  47. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +8 -2
  48. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  49. package/cjs/scenegraph/group-creater/progress/proxy.js +1 -1
  50. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  51. package/cjs/scenegraph/layout/compute-col-width.js +5 -2
  52. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  53. package/cjs/scenegraph/scenegraph.js +5 -3
  54. package/cjs/scenegraph/scenegraph.js.map +1 -1
  55. package/cjs/scenegraph/select/update-select-border.js +6 -1
  56. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  57. package/cjs/scenegraph/utils/text-icon-layout.js +17 -3
  58. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  59. package/cjs/state/cell-move/index.d.ts +1 -1
  60. package/cjs/state/cell-move/index.js +24 -15
  61. package/cjs/state/cell-move/index.js.map +1 -1
  62. package/cjs/state/resize/update-resize-column.js +6 -1
  63. package/cjs/state/resize/update-resize-column.js.map +1 -1
  64. package/cjs/state/resize/update-resize-row.js +6 -1
  65. package/cjs/state/resize/update-resize-row.js.map +1 -1
  66. package/cjs/state/state.d.ts +2 -1
  67. package/cjs/state/state.js +7 -5
  68. package/cjs/state/state.js.map +1 -1
  69. package/cjs/tools/debounce.js +3 -3
  70. package/cjs/tools/debounce.js.map +1 -1
  71. package/cjs/tools/helper.d.ts +2 -1
  72. package/cjs/tools/helper.js.map +1 -1
  73. package/cjs/ts-types/base-table.d.ts +5 -1
  74. package/cjs/ts-types/base-table.js.map +1 -1
  75. package/cjs/ts-types/events.d.ts +55 -2
  76. package/cjs/ts-types/events.js.map +1 -1
  77. package/cjs/ts-types/table-engine.d.ts +1 -0
  78. package/cjs/ts-types/table-engine.js.map +1 -1
  79. package/cjs/vrender.js.map +1 -1
  80. package/dist/vtable.js +647 -335
  81. package/dist/vtable.min.js +2 -2
  82. package/es/ListTable.d.ts +4 -2
  83. package/es/ListTable.js +76 -16
  84. package/es/ListTable.js.map +1 -1
  85. package/es/PivotTable.d.ts +1 -1
  86. package/es/PivotTable.js +1 -1
  87. package/es/PivotTable.js.map +1 -1
  88. package/es/core/BaseTable.d.ts +4 -0
  89. package/es/core/BaseTable.js +24 -2
  90. package/es/core/BaseTable.js.map +1 -1
  91. package/es/core/TABLE_EVENT_TYPE.d.ts +7 -0
  92. package/es/core/TABLE_EVENT_TYPE.js +8 -1
  93. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  94. package/es/core/record-helper.d.ts +2 -2
  95. package/es/core/record-helper.js +141 -129
  96. package/es/core/record-helper.js.map +1 -1
  97. package/es/core/tableHelper.js +7 -2
  98. package/es/core/tableHelper.js.map +1 -1
  99. package/es/core/utils/get-cell-position.d.ts +2 -0
  100. package/es/core/utils/get-cell-position.js +26 -0
  101. package/es/core/utils/get-cell-position.js.map +1 -1
  102. package/es/data/CachedDataSource.js +2 -2
  103. package/es/data/CachedDataSource.js.map +1 -1
  104. package/es/event/event.d.ts +1 -1
  105. package/es/event/event.js +5 -4
  106. package/es/event/event.js.map +1 -1
  107. package/es/event/helper.js +3 -1
  108. package/es/event/helper.js.map +1 -1
  109. package/es/event/listener/container-dom.js +3 -3
  110. package/es/event/listener/container-dom.js.map +1 -1
  111. package/es/event/listener/table-group.js +3 -2
  112. package/es/event/listener/table-group.js.map +1 -1
  113. package/es/event/scroll.d.ts +1 -1
  114. package/es/event/scroll.js +5 -3
  115. package/es/event/scroll.js.map +1 -1
  116. package/es/index.d.ts +1 -1
  117. package/es/index.js +1 -1
  118. package/es/index.js.map +1 -1
  119. package/es/layout/row-height-map.d.ts +2 -2
  120. package/es/layout/row-height-map.js +27 -28
  121. package/es/layout/row-height-map.js.map +1 -1
  122. package/es/layout/simple-header-layout.js +18 -7
  123. package/es/layout/simple-header-layout.js.map +1 -1
  124. package/es/scenegraph/component/cell-mover.js +3 -3
  125. package/es/scenegraph/component/cell-mover.js.map +1 -1
  126. package/es/scenegraph/graphic/contributions/chart-render-helper.js +5 -5
  127. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  128. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +8 -2
  129. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  130. package/es/scenegraph/group-creater/progress/proxy.js +1 -1
  131. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  132. package/es/scenegraph/layout/compute-col-width.js +5 -2
  133. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  134. package/es/scenegraph/scenegraph.js +5 -3
  135. package/es/scenegraph/scenegraph.js.map +1 -1
  136. package/es/scenegraph/select/update-select-border.js +7 -0
  137. package/es/scenegraph/select/update-select-border.js.map +1 -1
  138. package/es/scenegraph/utils/text-icon-layout.js +18 -2
  139. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  140. package/es/state/cell-move/index.d.ts +1 -1
  141. package/es/state/cell-move/index.js +24 -15
  142. package/es/state/cell-move/index.js.map +1 -1
  143. package/es/state/resize/update-resize-column.js +6 -1
  144. package/es/state/resize/update-resize-column.js.map +1 -1
  145. package/es/state/resize/update-resize-row.js +6 -1
  146. package/es/state/resize/update-resize-row.js.map +1 -1
  147. package/es/state/state.d.ts +2 -1
  148. package/es/state/state.js +7 -5
  149. package/es/state/state.js.map +1 -1
  150. package/es/tools/debounce.js +4 -2
  151. package/es/tools/debounce.js.map +1 -1
  152. package/es/tools/helper.d.ts +2 -1
  153. package/es/tools/helper.js.map +1 -1
  154. package/es/ts-types/base-table.d.ts +5 -1
  155. package/es/ts-types/base-table.js.map +1 -1
  156. package/es/ts-types/events.d.ts +55 -2
  157. package/es/ts-types/events.js.map +1 -1
  158. package/es/ts-types/table-engine.d.ts +1 -0
  159. package/es/ts-types/table-engine.js.map +1 -1
  160. package/es/vrender.js.map +1 -1
  161. package/package.json +8 -8
package/dist/vtable.js CHANGED
@@ -24496,12 +24496,12 @@
24496
24496
  const parsedParams = this.parseParams(params, isTimeline);
24497
24497
  return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
24498
24498
  }
24499
- stop(type) {
24499
+ stop(type, callEnd = !0) {
24500
24500
  for (; this._animates.length > 0;) {
24501
24501
  const animate = this._animates.pop();
24502
- null == animate || animate.stop(type);
24502
+ !1 === callEnd && (animate.status = AnimateStatus.END), null == animate || animate.stop(type);
24503
24503
  }
24504
- this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
24504
+ this._animates = [], this._activeCount = 0, this._started && (this._started = !1, callEnd && this.onEnd());
24505
24505
  }
24506
24506
  }
24507
24507
  AnimateExecutor.builtInAnimateMap = {};
@@ -24561,7 +24561,7 @@
24561
24561
  executor: new AnimateExecutor(this.graphic)
24562
24562
  });
24563
24563
  }), shouldStopState.forEach(state => {
24564
- state.executor.stop();
24564
+ state.executor.stop(null, !1);
24565
24565
  }), shouldApplyState.length) {
24566
24566
  shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
24567
24567
  for (let i = 0; i < shouldApplyState.length; i++) {
@@ -24612,7 +24612,7 @@
24612
24612
  clearState() {
24613
24613
  var _a;
24614
24614
  null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
24615
- state.executor.stop();
24615
+ state.executor.stop(null, !1);
24616
24616
  }), this.stateList = null;
24617
24617
  }
24618
24618
  reApplyState(state) {
@@ -36319,6 +36319,8 @@
36319
36319
  AFTER_RENDER: 'after_render',
36320
36320
  INITIALIZED: 'initialized',
36321
36321
  UPDATED: 'updated',
36322
+ AFTER_UPDATE_CELL_CONTENT_WIDTH: 'after_update_cell_content_width',
36323
+ AFTER_UPDATE_SELECT_BORDER_HEIGHT: 'after_update_select_border_height',
36322
36324
  CHANGE_CELL_VALUE: 'change_cell_value',
36323
36325
  DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
36324
36326
  MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
@@ -36328,7 +36330,12 @@
36328
36330
  BUTTON_CLICK: 'button_click',
36329
36331
  BEFORE_CACHE_CHART_IMAGE: 'before_cache_chart_image',
36330
36332
  PASTED_DATA: 'pasted_data',
36331
- PLUGIN_EVENT: 'plugin_event'
36333
+ PLUGIN_EVENT: 'plugin_event',
36334
+ ADD_RECORD: 'add_record',
36335
+ DELETE_RECORD: 'delete_record',
36336
+ UPDATE_RECORD: 'update_record',
36337
+ ADD_COLUMN: 'add_column',
36338
+ DELETE_COLUMN: 'delete_column'
36332
36339
  };
36333
36340
 
36334
36341
  const judgeType = (value) => {
@@ -36379,7 +36386,7 @@
36379
36386
  let maxing = false;
36380
36387
  let leading = false;
36381
36388
  let trailing = true;
36382
- const useRAF = !wait && wait !== 0 && typeof requestAnimationFrame === 'function';
36389
+ const useRAF = !wait && wait !== 0 && typeof vglobal.getRequestAnimationFrame() === 'function';
36383
36390
  if (typeof func !== 'function') {
36384
36391
  throw new TypeError('Expected a function');
36385
36392
  }
@@ -36403,7 +36410,7 @@
36403
36410
  }
36404
36411
  function startTimer(pendingFunc, wait) {
36405
36412
  if (useRAF) {
36406
- return requestAnimationFrame(pendingFunc);
36413
+ return vglobal.getRequestAnimationFrame()(pendingFunc);
36407
36414
  }
36408
36415
  return setTimeout(pendingFunc, wait);
36409
36416
  }
@@ -40818,7 +40825,6 @@
40818
40825
  constructor(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
40819
40826
  let _isGrouped;
40820
40827
  if (isArray$7(dataConfig?.groupByRules)) {
40821
- rowHierarchyType = 'tree';
40822
40828
  _isGrouped = true;
40823
40829
  }
40824
40830
  super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel);
@@ -41662,9 +41668,17 @@
41662
41668
  ];
41663
41669
  }
41664
41670
  function _setRecords(table, records = []) {
41671
+ const tableWithPlugins = table;
41665
41672
  _dealWithUpdateDataSource(table, () => {
41666
41673
  table.internalProps.records = records;
41667
- const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table)));
41674
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
41675
+ if (isArray$7(table.internalProps.dataConfig?.groupByRules)) {
41676
+ rowHierarchyType = 'tree';
41677
+ }
41678
+ if (tableWithPlugins.pluginManager.getPluginByName('Master Detail Plugin')) {
41679
+ rowHierarchyType = 'grid';
41680
+ }
41681
+ const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table)));
41668
41682
  table.addReleaseObj(newDataSource);
41669
41683
  });
41670
41684
  }
@@ -44290,6 +44304,16 @@
44290
44304
  if (autoRowHeight) {
44291
44305
  let newHeight = Math.max(leftIconHeight, contentHeight, rightIconHeight);
44292
44306
  if (isCellHeightUpdate(scene, cellGroup, Math.round(newHeight + padding[0] + padding[2]), oldCellHeight)) {
44307
+ if (scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH)) {
44308
+ scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
44309
+ col: cellGroup.col,
44310
+ row: cellGroup.row,
44311
+ cellHeight,
44312
+ cellGroup,
44313
+ padding,
44314
+ textBaseline
44315
+ });
44316
+ }
44293
44317
  return true;
44294
44318
  }
44295
44319
  newHeight = (cellGroup.contentHeight ?? cellHeight) - (padding[0] + padding[2]);
@@ -44330,6 +44354,16 @@
44330
44354
  }
44331
44355
  });
44332
44356
  }
44357
+ if (scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH)) {
44358
+ scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
44359
+ col: cellGroup.col,
44360
+ row: cellGroup.row,
44361
+ cellHeight,
44362
+ cellGroup,
44363
+ padding,
44364
+ textBaseline
44365
+ });
44366
+ }
44333
44367
  return false;
44334
44368
  }
44335
44369
  function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline, table) {
@@ -47509,7 +47543,8 @@
47509
47543
  let symbolY = 0;
47510
47544
  let symbolRotate = Math.PI;
47511
47545
  const linePoints = [];
47512
- if (cellLocation === 'columnHeader') {
47546
+ const movingColumnOrRow = this.table.stateManager.columnMove.movingColumnOrRow;
47547
+ if ((cellLocation === 'columnHeader' && movingColumnOrRow === undefined) || movingColumnOrRow === 'column') {
47513
47548
  rectX = this.table.getColsWidth(0, col - 1) - this.table.stateManager.scroll.horizontalBarPos;
47514
47549
  rectY = this.table.getRowsHeight(0, this.table.frozenRowCount - 1);
47515
47550
  rectHeight = this.table.tableNoFrameHeight;
@@ -47526,7 +47561,8 @@
47526
47561
  linePoints.push({ x: 0, y: this.table.tableNoFrameHeight });
47527
47562
  }
47528
47563
  else if (cellLocation === 'rowHeader' ||
47529
- this.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)) {
47564
+ this.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ||
47565
+ movingColumnOrRow === 'row') {
47530
47566
  rectY = this.table.getRowsHeight(0, row - 1) - this.table.stateManager.scroll.verticalBarPos;
47531
47567
  rectX = this.table.getColsWidth(0, this.table.frozenColCount - 1);
47532
47568
  rectWidth = this.table.tableNoFrameWidth;
@@ -48980,7 +49016,7 @@
48980
49016
  chartRenderKeys = [];
48981
49017
  chartRenderQueueList = [];
48982
49018
  isHandlingChartQueue = false;
48983
- cancelAnimationFrame(requestAnimationFrameId);
49019
+ vglobal.getCancelAnimationFrame()(requestAnimationFrameId);
48984
49020
  }
48985
49021
  function IsHandlingChartQueue() {
48986
49022
  return isHandlingChartQueue;
@@ -49049,6 +49085,7 @@
49049
49085
  });
49050
49086
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
49051
49087
  if (typeof dataId === 'string') {
49088
+ chartInstance.getChart().setLayoutTag(true);
49052
49089
  chartInstance.updateDataSync(dataId, data ?? []);
49053
49090
  }
49054
49091
  else {
@@ -49073,6 +49110,7 @@
49073
49110
  : data ?? []);
49074
49111
  }
49075
49112
  }
49113
+ chartInstance.getChart().setLayoutTag(true);
49076
49114
  chartInstance.updateFullDataSync?.(dataBatch);
49077
49115
  }
49078
49116
  }
@@ -49083,7 +49121,7 @@
49083
49121
  function startRenderChartQueue(table) {
49084
49122
  isHandlingChartQueue = true;
49085
49123
  if (chartRenderQueueList.length > 0) {
49086
- requestAnimationFrameId = requestAnimationFrame(() => {
49124
+ requestAnimationFrameId = vglobal.getRequestAnimationFrame()(() => {
49087
49125
  const chartsToRender = chartRenderQueueList.splice(0, batchRenderChartCount);
49088
49126
  chartRenderKeys.splice(0, batchRenderChartCount);
49089
49127
  chartsToRender.forEach(chart => {
@@ -50710,15 +50748,20 @@
50710
50748
  let actualWidth = 0;
50711
50749
  for (let col = 0; col < table.colCount; col++) {
50712
50750
  const colWidth = update ? newWidths[col] ?? table.getColWidth(col) : table.getColWidth(col);
50713
- if (col < table.rowHeaderLevelCount + table.leftRowSeriesNumberCount ||
50714
- (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount)) {
50751
+ if (table.widthAdaptiveMode === 'only-body' &&
50752
+ (col < table.rowHeaderLevelCount + table.leftRowSeriesNumberCount ||
50753
+ (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount))) {
50715
50754
  actualHeaderWidth += colWidth;
50716
50755
  }
50717
50756
  actualWidth += colWidth;
50718
50757
  }
50719
50758
  if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) {
50720
- const startCol = table.rowHeaderLevelCount + table.leftRowSeriesNumberCount;
50721
- const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
50759
+ let startCol = 0;
50760
+ let endCol = table.colCount;
50761
+ if (table.widthAdaptiveMode === 'only-body') {
50762
+ startCol = table.rowHeaderLevelCount + table.leftRowSeriesNumberCount;
50763
+ endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
50764
+ }
50722
50765
  getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, update, newWidths, table);
50723
50766
  }
50724
50767
  }
@@ -53151,8 +53194,9 @@
53151
53194
  else if (this.rowEnd === this.bodyBottomRow) {
53152
53195
  const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, this.rowEnd, true);
53153
53196
  if (cellGroup.role === 'cell') {
53197
+ const actualRowHeight = this.table.getRowHeight(this.rowEnd);
53154
53198
  const deltaY = cellGroup.attribute.y +
53155
- cellGroup.attribute.height -
53199
+ actualRowHeight -
53156
53200
  (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
53157
53201
  this.deltaY = -deltaY;
53158
53202
  }
@@ -53376,6 +53420,14 @@
53376
53420
  height: rowsHeight,
53377
53421
  visible: true
53378
53422
  });
53423
+ if (table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT)) {
53424
+ table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT, {
53425
+ startRow: computeRectCellRangeStartRow,
53426
+ endRow: computeRectCellRangeEndRow,
53427
+ currentHeight: rowsHeight,
53428
+ selectComp
53429
+ });
53430
+ }
53379
53431
  if (selectComp.fillhandle) {
53380
53432
  const fillHandle = scene.table.options.excelOptions?.fillHandle;
53381
53433
  let visible = true;
@@ -57069,14 +57121,14 @@
57069
57121
  else if (lastBodyCell &&
57070
57122
  this.table.tableNoFrameHeight < this.table.getAllRowsHeight() &&
57071
57123
  lastBodyCell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 &&
57072
- lastBodyCell.attribute.y + lastBodyCell.attribute.height + y <
57124
+ lastBodyCell.attribute.y + this.table.getRowHeight(lastBodyCell.row) + y <
57073
57125
  this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight()) {
57074
57126
  y =
57075
57127
  this.table.tableNoFrameHeight -
57076
57128
  this.table.getFrozenRowsHeight() -
57077
57129
  this.table.getBottomFrozenRowsHeight() -
57078
57130
  lastBodyCell.attribute.y -
57079
- lastBodyCell.attribute.height;
57131
+ this.table.getRowHeight(lastBodyCell.row);
57080
57132
  }
57081
57133
  if (this.colHeaderGroup.attribute.height + y === this.bodyGroup.attribute.y) {
57082
57134
  return;
@@ -57172,15 +57224,20 @@
57172
57224
  let actualWidth = 0;
57173
57225
  for (let col = 0; col < table.colCount; col++) {
57174
57226
  const colWidth = table.getColWidth(col);
57175
- if (col < table.rowHeaderLevelCount ||
57176
- (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount)) {
57227
+ if (table.widthAdaptiveMode === 'only-body' &&
57228
+ (col < table.rowHeaderLevelCount ||
57229
+ (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount))) {
57177
57230
  actualHeaderWidth += colWidth;
57178
57231
  }
57179
57232
  actualWidth += colWidth;
57180
57233
  }
57181
57234
  if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) {
57182
- const startCol = table.rowHeaderLevelCount;
57183
- const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
57235
+ let startCol = 0;
57236
+ let endCol = table.colCount;
57237
+ if (table.widthAdaptiveMode === 'only-body') {
57238
+ startCol = table.rowHeaderLevelCount;
57239
+ endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
57240
+ }
57184
57241
  getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, false, [], table, true);
57185
57242
  }
57186
57243
  }
@@ -58676,10 +58733,11 @@
58676
58733
  return target;
58677
58734
  }
58678
58735
 
58679
- function startMoveCol(col, row, x, y, state, event) {
58736
+ function startMoveCol(col, row, x, y, state, event, dragColumnOrRow) {
58680
58737
  if (!('canMoveHeaderPosition' in state.table.internalProps.layoutMap)) {
58681
58738
  return;
58682
58739
  }
58740
+ state.columnMove.movingColumnOrRow = dragColumnOrRow;
58683
58741
  state.columnMove.moving = true;
58684
58742
  state.columnMove.colSource = col;
58685
58743
  state.columnMove.rowSource = row;
@@ -58691,13 +58749,23 @@
58691
58749
  }
58692
58750
  state.columnMove.x = x - state.table.tableX;
58693
58751
  state.columnMove.y = y - state.table.tableY;
58694
- const cellLocation = state.table.getCellLocation(col, row);
58695
- const delta = cellLocation === 'columnHeader'
58696
- ? state.columnMove.x
58697
- : cellLocation === 'rowHeader' ||
58698
- state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)
58699
- ? state.columnMove.y
58700
- : 0;
58752
+ let delta;
58753
+ if (dragColumnOrRow === 'column') {
58754
+ delta = state.columnMove.x;
58755
+ }
58756
+ else if (dragColumnOrRow === 'row') {
58757
+ delta = state.columnMove.y;
58758
+ }
58759
+ else {
58760
+ const cellLocation = state.table.getCellLocation(col, row);
58761
+ delta =
58762
+ cellLocation === 'columnHeader'
58763
+ ? state.columnMove.x
58764
+ : cellLocation === 'rowHeader' ||
58765
+ state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)
58766
+ ? state.columnMove.y
58767
+ : 0;
58768
+ }
58701
58769
  const { backX, lineX, backY, lineY } = state.table.scenegraph.component.showMoveCol(col, row, delta);
58702
58770
  state.table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_START, {
58703
58771
  col,
@@ -58708,7 +58776,8 @@
58708
58776
  lineX,
58709
58777
  backY,
58710
58778
  lineY,
58711
- event
58779
+ event,
58780
+ movingColumnOrRow: dragColumnOrRow
58712
58781
  });
58713
58782
  const isHasSelected = !!state.select.ranges?.length;
58714
58783
  state.table.stateManager.updateSelectPos(-1, -1);
@@ -58763,7 +58832,8 @@
58763
58832
  }
58764
58833
  }
58765
58834
  else if (cellLocation === 'rowHeader' ||
58766
- state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)) {
58835
+ state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ||
58836
+ state.columnMove.movingColumnOrRow === 'row') {
58767
58837
  backY = state.columnMove.y;
58768
58838
  if (state.table.isFrozenRow(row)) {
58769
58839
  lineY =
@@ -58793,7 +58863,8 @@
58793
58863
  lineX,
58794
58864
  backY,
58795
58865
  lineY,
58796
- event
58866
+ event,
58867
+ movingColumnOrRow: state.columnMove.movingColumnOrRow
58797
58868
  });
58798
58869
  state.table.scenegraph.updateNextFrame();
58799
58870
  }
@@ -58802,10 +58873,10 @@
58802
58873
  let moveColResult = false;
58803
58874
  if ('canMoveHeaderPosition' in state.table.internalProps.layoutMap &&
58804
58875
  state.columnMove.moving &&
58805
- state.columnMove.colSource >= 0 &&
58806
- state.columnMove.rowSource >= 0 &&
58807
- state.columnMove.colTarget >= 0 &&
58808
- state.columnMove.rowTarget >= 0 &&
58876
+ (state.columnMove.colSource >= 0 || state.columnMove.movingColumnOrRow === 'row') &&
58877
+ (state.columnMove.rowSource >= 0 || state.columnMove.movingColumnOrRow === 'column') &&
58878
+ (state.columnMove.colTarget >= 0 || state.columnMove.movingColumnOrRow === 'row') &&
58879
+ (state.columnMove.rowTarget >= 0 || state.columnMove.movingColumnOrRow === 'column') &&
58809
58880
  state.table.options.customConfig?.notUpdateInColumnRowMove !== true) {
58810
58881
  const oldSourceMergeInfo = state.table.getCellRange(state.columnMove.colSource, state.columnMove.rowSource);
58811
58882
  const oldTargetMergeInfo = state.table.getCellRange(state.columnMove.colTarget, state.columnMove.rowTarget);
@@ -58829,7 +58900,8 @@
58829
58900
  }
58830
58901
  }
58831
58902
  if (!state.table.transpose &&
58832
- state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource)) {
58903
+ (state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) ||
58904
+ state.columnMove.movingColumnOrRow === 'row')) {
58833
58905
  state.table.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex);
58834
58906
  state.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex);
58835
58907
  }
@@ -58840,7 +58912,8 @@
58840
58912
  clearWidthsAndHeightsCache(0, -1, rowMin, rowMax, state.table);
58841
58913
  }
58842
58914
  state.table.clearCellStyleCache();
58843
- if (state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource)) {
58915
+ if (state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) ||
58916
+ state.columnMove.movingColumnOrRow === 'row') {
58844
58917
  state.table.scenegraph.updateHeaderPosition(state.table.scenegraph.proxy.colStart, state.table.scenegraph.proxy.colEnd, state.table.scenegraph.proxy.rowStart, state.table.scenegraph.proxy.rowEnd, moveContext.moveType);
58845
58918
  }
58846
58919
  else if (moveContext.moveType === 'column') {
@@ -58876,10 +58949,13 @@
58876
58949
  else {
58877
58950
  state.updateCursor();
58878
58951
  state.columnMove.moving = false;
58879
- delete state.columnMove.colSource;
58880
- delete state.columnMove.rowSource;
58881
- delete state.columnMove.colTarget;
58882
- delete state.columnMove.rowTarget;
58952
+ setTimeout(() => {
58953
+ delete state.columnMove.colSource;
58954
+ delete state.columnMove.rowSource;
58955
+ delete state.columnMove.colTarget;
58956
+ delete state.columnMove.rowTarget;
58957
+ state.columnMove.movingColumnOrRow = undefined;
58958
+ }, 0);
58883
58959
  state.table.scenegraph.component.hideMoveCol();
58884
58960
  state.table.scenegraph.updateNextFrame();
58885
58961
  return false;
@@ -58891,6 +58967,7 @@
58891
58967
  delete state.columnMove.rowSource;
58892
58968
  delete state.columnMove.colTarget;
58893
58969
  delete state.columnMove.rowTarget;
58970
+ state.columnMove.movingColumnOrRow = undefined;
58894
58971
  }, 0);
58895
58972
  state.table.scenegraph.component.hideMoveCol();
58896
58973
  if (state.columnResize.col < state.table.frozenColCount &&
@@ -59034,6 +59111,15 @@
59034
59111
  state.columnResize.x = xInTable;
59035
59112
  state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen);
59036
59113
  state.table._updateSize();
59114
+ state.table.internalProps.legends?.forEach(legend => {
59115
+ legend?.resize();
59116
+ });
59117
+ if (state.table.internalProps.title) {
59118
+ state.table.internalProps.title.resize();
59119
+ }
59120
+ if (state.table.internalProps.emptyTip) {
59121
+ state.table.internalProps.emptyTip.resize();
59122
+ }
59037
59123
  if (state.columnResize.col < state.table.frozenColCount &&
59038
59124
  !state.table.isPivotTable() &&
59039
59125
  !state.table.transpose) {
@@ -59693,6 +59779,15 @@
59693
59779
  state.rowResize.y = yInTable;
59694
59780
  state.table.scenegraph.component.updateResizeRow(state.rowResize.row, xInTable, state.rowResize.isBottomFrozen);
59695
59781
  state.table._updateSize();
59782
+ state.table.internalProps.legends?.forEach(legend => {
59783
+ legend?.resize();
59784
+ });
59785
+ if (state.table.internalProps.title) {
59786
+ state.table.internalProps.title.resize();
59787
+ }
59788
+ if (state.table.internalProps.emptyTip) {
59789
+ state.table.internalProps.emptyTip.resize();
59790
+ }
59696
59791
  state.table.scenegraph.updateNextFrame();
59697
59792
  }
59698
59793
  function updateResizeColForRow(detaY, state) {
@@ -59977,7 +60072,8 @@
59977
60072
  rowTargetSize: 0,
59978
60073
  x: 0,
59979
60074
  y: 0,
59980
- moving: false
60075
+ moving: false,
60076
+ movingColumnOrRow: undefined
59981
60077
  };
59982
60078
  this.menu = {
59983
60079
  x: -1,
@@ -60059,7 +60155,8 @@
60059
60155
  rowTargetSize: 0,
60060
60156
  x: 0,
60061
60157
  y: 0,
60062
- moving: false
60158
+ moving: false,
60159
+ movingColumnOrRow: undefined
60063
60160
  };
60064
60161
  this.menu = {
60065
60162
  x: -1,
@@ -60349,7 +60446,8 @@
60349
60446
  }
60350
60447
  const currentRange = this.select.ranges[this.select.ranges.length - 1];
60351
60448
  if (!this.table.isSeriesNumber(this.select.cellPos.col, this.select.cellPos.row) &&
60352
- !this.table.isHeader(this.select.cellPos.col, this.select.cellPos.row)) {
60449
+ !this.table.isHeader(this.select.cellPos.col, this.select.cellPos.row) &&
60450
+ !this.table.isSeriesNumberInBody(currentRange.start.col, currentRange.start.row)) {
60353
60451
  expendCellRange(currentRange, this.table);
60354
60452
  }
60355
60453
  let isSame = false;
@@ -60458,8 +60556,8 @@
60458
60556
  this.fillHandle.beforeFillMinCol = undefined;
60459
60557
  this.fillHandle.beforeFillMinRow = undefined;
60460
60558
  }
60461
- startMoveCol(col, row, x, y, event) {
60462
- startMoveCol(col, row, x, y, this, event);
60559
+ startMoveCol(col, row, x, y, event, dragColumnOrRow) {
60560
+ startMoveCol(col, row, x, y, this, event, dragColumnOrRow);
60463
60561
  }
60464
60562
  updateMoveCol(col, row, x, y, event) {
60465
60563
  updateMoveCol(col, row, x, y, this, event);
@@ -61458,7 +61556,7 @@
61458
61556
  this.speedY = speedY;
61459
61557
  this.friction = friction;
61460
61558
  if (!this.runingId) {
61461
- this.runingId = requestAnimationFrame(this.inertia.bind(this));
61559
+ this.runingId = vglobal.getRequestAnimationFrame()(this.inertia.bind(this));
61462
61560
  }
61463
61561
  }
61464
61562
  inertia() {
@@ -61486,10 +61584,10 @@
61486
61584
  this.lastTime = now;
61487
61585
  this.speedX = newSpeedX;
61488
61586
  this.speedY = newSpeedY;
61489
- this.runingId = requestAnimationFrame(this.inertia.bind(this));
61587
+ this.runingId = vglobal.getRequestAnimationFrame()(this.inertia.bind(this));
61490
61588
  }
61491
61589
  endInertia() {
61492
- cancelAnimationFrame(this.runingId);
61590
+ vglobal.getCancelAnimationFrame()(this.runingId);
61493
61591
  this.runingId = null;
61494
61592
  }
61495
61593
  isInertiaScrolling() {
@@ -61504,7 +61602,7 @@
61504
61602
  table.stateManager.columnMove?.colTarget !== -1 &&
61505
61603
  table.stateManager.columnMove?.rowTarget !== -1) {
61506
61604
  if (table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION)) {
61507
- const { colSource, rowSource, colTarget, rowTarget } = table.stateManager.columnMove;
61605
+ const { colSource, rowSource, colTarget, rowTarget, movingColumnOrRow } = table.stateManager.columnMove;
61508
61606
  const rowSourceSize = table.stateManager.columnMove.rowSourceSize ?? 0;
61509
61607
  const rowTargetSize = table.stateManager.columnMove.rowTargetSize ?? 0;
61510
61608
  table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION, {
@@ -61513,6 +61611,7 @@
61513
61611
  col: colSource,
61514
61612
  row: rowSource
61515
61613
  },
61614
+ movingColumnOrRow,
61516
61615
  event: e
61517
61616
  });
61518
61617
  }
@@ -61530,6 +61629,7 @@
61530
61629
  col: table.stateManager.columnMove.colSource,
61531
61630
  row: table.stateManager.columnMove.rowSource
61532
61631
  },
61632
+ movingColumnOrRow: table.stateManager.columnMove.movingColumnOrRow,
61533
61633
  event: e
61534
61634
  });
61535
61635
  }
@@ -61562,9 +61662,7 @@
61562
61662
  if (stateManager.interactionState === InteractionState.grabing) {
61563
61663
  if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
61564
61664
  if (stateManager.isResizeCol() || stateManager.isResizeRow()) ;
61565
- else if (stateManager.isMoveCol()) {
61566
- eventManager.dealColumnMover(eventArgsSet);
61567
- }
61665
+ else if (stateManager.isMoveCol()) ;
61568
61666
  else if (stateManager.isFillHandle()) {
61569
61667
  eventManager.dealFillSelect(eventArgsSet, true);
61570
61668
  }
@@ -62132,6 +62230,10 @@
62132
62230
  });
62133
62231
  table.scenegraph.stage.addEventListener('pointermove', (e) => {
62134
62232
  const eventArgsSet = getCellEventArgsSet(e);
62233
+ const isEventFromCurrentTable = e.target?.isDescendantsOf?.(table.scenegraph.tableGroup) ?? false;
62234
+ if (!isEventFromCurrentTable) {
62235
+ return;
62236
+ }
62135
62237
  if (stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet)) {
62136
62238
  if (table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet)) {
62137
62239
  stateManager.updateCursor('crosshair');
@@ -62767,7 +62869,10 @@
62767
62869
  if (e.width === 0 && e.height === 0) {
62768
62870
  return;
62769
62871
  }
62770
- if (table.autoFillWidth || table.autoFillHeight) {
62872
+ if (table.autoFillWidth ||
62873
+ table.autoFillHeight ||
62874
+ table.widthMode === 'adaptive' ||
62875
+ table.heightMode === 'adaptive') {
62771
62876
  table.editorManager?.completeEdit();
62772
62877
  }
62773
62878
  if (!isValid$3(table.options.pixelRatio)) {
@@ -62913,6 +63018,9 @@
62913
63018
  });
62914
63019
  }
62915
63020
  }
63021
+ else if (stateManager.isMoveCol()) {
63022
+ eventManager.dealColumnMover(x, y, e);
63023
+ }
62916
63024
  }
62917
63025
  const isSelecting = table.stateManager.isSelecting();
62918
63026
  if (eventManager._enableTableScroll &&
@@ -63946,10 +64054,17 @@
63946
64054
  }
63947
64055
  return false;
63948
64056
  }
63949
- dealColumnMover(eventArgsSet) {
63950
- const { eventArgs } = eventArgsSet;
63951
- if (isValid$3(eventArgs.col) && isValid$3(eventArgs.row)) {
63952
- this.table.stateManager.updateMoveCol(eventArgs.col, eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, eventArgs?.event?.nativeEvent);
64057
+ dealColumnMover(x, y, event) {
64058
+ let col = this.table.getColAtRelativePosition(x);
64059
+ let row = this.table.getRowAtRelativePosition(y);
64060
+ if (col === -1 && this.table.stateManager.columnMove.movingColumnOrRow === 'row') {
64061
+ col = 0;
64062
+ }
64063
+ if (row === -1 && this.table.stateManager.columnMove.movingColumnOrRow === 'column') {
64064
+ row = 0;
64065
+ }
64066
+ if (isValid$3(col) && isValid$3(row)) {
64067
+ this.table.stateManager.updateMoveCol(col, row, x, y, event);
63953
64068
  }
63954
64069
  }
63955
64070
  startColumnResize(eventArgsSet) {
@@ -66220,7 +66335,7 @@
66220
66335
  this.cumulativeSum.clear();
66221
66336
  this.difference.clear();
66222
66337
  }
66223
- add(position, value) {
66338
+ _add(position, value) {
66224
66339
  if (!isValid$3(value)) {
66225
66340
  return;
66226
66341
  }
@@ -66233,7 +66348,7 @@
66233
66348
  this.totalSum += value;
66234
66349
  this.updateDifference(position, value - defaultValue);
66235
66350
  }
66236
- remove(position) {
66351
+ _remove(position) {
66237
66352
  if (this.data.has(position)) {
66238
66353
  const value = this.data.get(position);
66239
66354
  this.data.delete(position);
@@ -66261,7 +66376,7 @@
66261
66376
  this.updateDifference(position, difference);
66262
66377
  }
66263
66378
  else {
66264
- this.add(position, newValue);
66379
+ this._add(position, newValue);
66265
66380
  }
66266
66381
  }
66267
66382
  get(position) {
@@ -66371,10 +66486,19 @@
66371
66486
  this.cumulativeSum.delete(i);
66372
66487
  }
66373
66488
  const lastIndex = this.getLastIndex() + 1;
66374
- this.adjustOrder(position, position + 1, lastIndex - position);
66489
+ const values = [];
66490
+ for (let i = position; i <= lastIndex; i++) {
66491
+ if (this.has(i)) {
66492
+ values.push({ position: i, value: this.get(i) });
66493
+ this._remove(i);
66494
+ }
66495
+ }
66375
66496
  if (isValid$3(value)) {
66376
66497
  this.put(position, value);
66377
66498
  }
66499
+ for (const { position, value } of values) {
66500
+ this.put(position + 1, value);
66501
+ }
66378
66502
  }
66379
66503
  getLastIndex() {
66380
66504
  this._sort();
@@ -66382,18 +66506,26 @@
66382
66506
  }
66383
66507
  delLast() {
66384
66508
  const lastIndex = this.getLastIndex();
66385
- this.remove(lastIndex);
66509
+ this._remove(lastIndex);
66386
66510
  }
66387
66511
  delete(position) {
66388
- if (!this.has(position)) {
66389
- return;
66390
- }
66391
66512
  for (let i = position; i <= this.getLastIndex(); i++) {
66392
66513
  this.cumulativeSum.delete(i);
66393
66514
  }
66394
66515
  const lastIndex = this.getLastIndex();
66395
- this.adjustOrder(position + 1, position, lastIndex - position);
66396
- this.delLast();
66516
+ if (this.has(position)) {
66517
+ this._remove(position);
66518
+ }
66519
+ const values = [];
66520
+ for (let i = position + 1; i <= lastIndex; i++) {
66521
+ if (this.has(i)) {
66522
+ values.push({ position: i, value: this.get(i) });
66523
+ }
66524
+ }
66525
+ for (const { position, value } of values) {
66526
+ this._remove(position);
66527
+ this._add(position - 1, value);
66528
+ }
66397
66529
  }
66398
66530
  adjustOrder(sourceIndex, targetIndex, moveCount) {
66399
66531
  this.clearRange();
@@ -66438,56 +66570,13 @@
66438
66570
  }
66439
66571
  }
66440
66572
  exchangeOrder(sourceIndex, sourceCount, targetIndex, targetCount, insertIndex) {
66441
- const { _keys: keys } = this;
66442
- if (!this._sorted) {
66443
- keys.sort((a, b) => {
66444
- if (a < b) {
66445
- return -1;
66446
- }
66447
- if (a > b) {
66448
- return 1;
66449
- }
66450
- return 0;
66451
- });
66452
- this._sorted = true;
66573
+ const values = [];
66574
+ for (let i = sourceIndex + sourceCount - 1; i >= sourceIndex; i--) {
66575
+ values.push({ position: i, value: this.get(i) });
66576
+ this.delete(i);
66453
66577
  }
66454
- if (sourceIndex > targetIndex) {
66455
- const targetVals = [];
66456
- const sourceVals = [];
66457
- for (let i = indexFirst(keys, targetIndex); i < indexFirst(keys, sourceIndex) + sourceCount; i++) {
66458
- const key = keys[i];
66459
- if (key >= sourceIndex && key < sourceIndex + sourceCount) {
66460
- sourceVals.push(this.get(key));
66461
- }
66462
- else {
66463
- targetVals.push(this.get(key));
66464
- }
66465
- }
66466
- for (let i = 0; i < sourceCount; i++) {
66467
- this.put(insertIndex + i, sourceVals[i]);
66468
- }
66469
- for (let i = 0; i < targetVals.length; i++) {
66470
- this.put(insertIndex + sourceCount + i, targetVals[i]);
66471
- }
66472
- }
66473
- else {
66474
- const targetVals = [];
66475
- const sourceVals = [];
66476
- for (let i = indexFirst(keys, sourceIndex); i < indexFirst(keys, targetIndex) + targetCount; i++) {
66477
- const key = keys[i];
66478
- if (key >= sourceIndex && key < sourceIndex + sourceCount) {
66479
- sourceVals.push(this.get(key));
66480
- }
66481
- else {
66482
- targetVals.push(this.get(key));
66483
- }
66484
- }
66485
- for (let i = 0; i < sourceCount; i++) {
66486
- this.put(insertIndex + i, sourceVals[i]);
66487
- }
66488
- for (let i = 0; i < targetVals.length; i++) {
66489
- this.put(sourceIndex + i, targetVals[i]);
66490
- }
66578
+ for (let i = 0; i < sourceCount; i++) {
66579
+ this.insert(insertIndex, values[i].value);
66491
66580
  }
66492
66581
  }
66493
66582
  }
@@ -66506,7 +66595,11 @@
66506
66595
  low = i + 1;
66507
66596
  }
66508
66597
  }
66509
- return high < 0 ? 0 : high;
66598
+ const tempI = high < 0 ? 0 : high;
66599
+ if (arr[tempI] === elm) {
66600
+ return tempI;
66601
+ }
66602
+ return -1;
66510
66603
  }
66511
66604
 
66512
66605
  class RowSeriesNumberHelper {
@@ -67689,6 +67782,44 @@
67689
67782
  }
67690
67783
  return { col: -1, row: -1 };
67691
67784
  }
67785
+ function getColAtRelativePosition(x, _this) {
67786
+ x -= _this.tableX;
67787
+ let leftFrozen = false;
67788
+ if (x > 0 && x < _this.getFrozenColsWidth()) {
67789
+ leftFrozen = true;
67790
+ }
67791
+ let rightFrozen = false;
67792
+ if (x > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() &&
67793
+ x < _this.tableNoFrameWidth &&
67794
+ x <= _this.getAllColsWidth()) {
67795
+ rightFrozen = true;
67796
+ }
67797
+ const colInfo = getTargetColAtConsiderRightFrozen((leftFrozen || rightFrozen ? x : x + _this.scrollLeft) + _this.tableX, rightFrozen, _this);
67798
+ if (colInfo) {
67799
+ const { col } = colInfo;
67800
+ return col;
67801
+ }
67802
+ return -1;
67803
+ }
67804
+ function getRowAtRelativePosition(y, _this) {
67805
+ y -= _this.tableY;
67806
+ let topFrozen = false;
67807
+ if (y > 0 && y < _this.getFrozenRowsHeight()) {
67808
+ topFrozen = true;
67809
+ }
67810
+ let bottomFrozen = false;
67811
+ if (y > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() &&
67812
+ y < _this.tableNoFrameHeight &&
67813
+ y <= _this.getAllRowsHeight()) {
67814
+ bottomFrozen = true;
67815
+ }
67816
+ const rowInfo = getTargetRowAtConsiderBottomFrozen((topFrozen || bottomFrozen ? y : y + _this.scrollTop) + _this.tableY, bottomFrozen, _this);
67817
+ if (rowInfo) {
67818
+ const { row } = rowInfo;
67819
+ return row;
67820
+ }
67821
+ return -1;
67822
+ }
67692
67823
 
67693
67824
  function isValidAlignDomain(domain) {
67694
67825
  return domain.length === 2 && isValidNumber$1(domain[0]) && isValidNumber$1(domain[1]) && domain[1] >= domain[0];
@@ -69128,7 +69259,7 @@
69128
69259
  return TABLE_EVENT_TYPE;
69129
69260
  }
69130
69261
  options;
69131
- version = "1.21.1";
69262
+ version = "1.22.1";
69132
69263
  pagination;
69133
69264
  id = `VTable${Date.now()}`;
69134
69265
  headerStyleCache;
@@ -70486,6 +70617,12 @@
70486
70617
  getCellAtRelativePosition(relativeX, relativeY) {
70487
70618
  return getCellAtRelativePosition(relativeX, relativeY, this);
70488
70619
  }
70620
+ getColAtRelativePosition(relativeX) {
70621
+ return getColAtRelativePosition(relativeX, this);
70622
+ }
70623
+ getRowAtRelativePosition(relativeY) {
70624
+ return getRowAtRelativePosition(relativeY, this);
70625
+ }
70489
70626
  _checkRowCol(col, row) {
70490
70627
  if (col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount) {
70491
70628
  return true;
@@ -72328,6 +72465,32 @@
72328
72465
  this._containerFit = { width: false, height: false };
72329
72466
  }
72330
72467
  }
72468
+ isColumnSelected(col) {
72469
+ const selectRange = this.stateManager.select.ranges;
72470
+ for (let i = 0; i <= selectRange.length - 1; i++) {
72471
+ const range = selectRange[i];
72472
+ if (range.start.col <= col &&
72473
+ range.end.col >= col &&
72474
+ range.start.row === 0 &&
72475
+ range.end.row === this.rowCount - 1) {
72476
+ return true;
72477
+ }
72478
+ }
72479
+ return false;
72480
+ }
72481
+ isRowSelected(row) {
72482
+ const selectRange = this.stateManager.select.ranges;
72483
+ for (let i = 0; i <= selectRange.length - 1; i++) {
72484
+ const range = selectRange[i];
72485
+ if (range.start.row <= row &&
72486
+ range.end.row >= row &&
72487
+ range.start.col === 0 &&
72488
+ range.end.col === this.colCount - 1) {
72489
+ return true;
72490
+ }
72491
+ }
72492
+ return false;
72493
+ }
72331
72494
  }
72332
72495
 
72333
72496
  var core = /*#__PURE__*/Object.freeze({
@@ -75300,20 +75463,21 @@
75300
75463
  return undefined;
75301
75464
  }
75302
75465
  canMoveHeaderPosition(source, target) {
75466
+ const dragColumnOrRow = this._table.stateManager.columnMove.movingColumnOrRow;
75303
75467
  if (this.isSeriesNumberInHeader(target.col, target.row) || this.isSeriesNumberInHeader(source.col, source.row)) {
75304
75468
  return false;
75305
75469
  }
75306
75470
  else if (!this.transpose &&
75307
- this.isSeriesNumberInBody(target.col, target.row) &&
75308
- this.isSeriesNumberInBody(source.col, source.row)) {
75471
+ ((this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row)) ||
75472
+ dragColumnOrRow === 'row')) {
75309
75473
  const sourceIndex = this.getRecordShowIndexByCell(0, source.row);
75310
75474
  const targetIndex = this.getRecordShowIndexByCell(0, target.row);
75311
75475
  const canMove = this._table.dataSource.canChangeOrder(sourceIndex, targetIndex);
75312
75476
  return canMove;
75313
75477
  }
75314
75478
  else if (this.transpose &&
75315
- this.isSeriesNumberInBody(target.col, target.row) &&
75316
- this.isSeriesNumberInBody(source.col, source.row)) {
75479
+ ((this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row)) ||
75480
+ dragColumnOrRow === 'row')) {
75317
75481
  if (this.getBody(source.col + this.leftRowSeriesNumberColumnCount, source.row).isChildNode &&
75318
75482
  this.getBody(target.col + this.leftRowSeriesNumberColumnCount, target.row).isChildNode) {
75319
75483
  source.col = source.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1;
@@ -75368,10 +75532,33 @@
75368
75532
  sourceIds.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0);
75369
75533
  Array.prototype.splice.apply(this._headerCellIds[row], sourceIds);
75370
75534
  }
75535
+ if (this._table.options.dragOrder?.maintainArrayDataOrder) {
75536
+ for (let j = 0; j < this._table.dataSource.dataSourceObj?.records.length; j++) {
75537
+ const rowRecords = this._table.dataSource.dataSourceObj?.records[j];
75538
+ if (Array.isArray(rowRecords)) {
75539
+ if (rowRecords.length - 1 < targetIndex) {
75540
+ rowRecords.push(...Array(targetIndex - rowRecords.length + 1).fill(undefined));
75541
+ }
75542
+ const sourceData = rowRecords.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
75543
+ sourceData.unshift((targetIndex - this.leftRowSeriesNumberColumnCount), 0);
75544
+ Array.prototype.splice.apply(rowRecords, sourceData);
75545
+ }
75546
+ }
75547
+ }
75371
75548
  const sourceColumns = this._columns.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
75372
75549
  sourceColumns.unshift((targetIndex - this.leftRowSeriesNumberColumnCount), 0);
75373
75550
  Array.prototype.splice.apply(this._columns, sourceColumns);
75551
+ if (this._table.options.dragOrder?.maintainArrayDataOrder) {
75552
+ for (let i = 0; i < this._columns.length; i++) {
75553
+ this._columns[i].field = i;
75554
+ }
75555
+ }
75374
75556
  this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, targetIndex - this.leftRowSeriesNumberColumnCount);
75557
+ if (this._table.options.dragOrder?.maintainArrayDataOrder) {
75558
+ for (let i = 0; i < this.columnTree.tree.children.length; i++) {
75559
+ this.columnTree.tree.children[i].field = i;
75560
+ }
75561
+ }
75375
75562
  this.columnTree.reset(this.columnTree.tree.children);
75376
75563
  this._cellRangeMap = new Map();
75377
75564
  return {
@@ -75418,7 +75605,8 @@
75418
75605
  moveType: 'row'
75419
75606
  };
75420
75607
  }
75421
- else if (this.isSeriesNumberInBody(source.col, source.row)) {
75608
+ else if (this.isSeriesNumberInBody(source.col, source.row) ||
75609
+ this._table.stateManager.columnMove.movingColumnOrRow === 'row') {
75422
75610
  return {
75423
75611
  sourceIndex: source.row,
75424
75612
  targetIndex: target.row,
@@ -76049,226 +76237,259 @@
76049
76237
  }
76050
76238
  }
76051
76239
  function listTableAddRecord(record, recordIndex, table) {
76052
- if (table.internalProps.groupBy) {
76053
- table.dataSource.addRecordsForGroup?.([record], recordIndex);
76054
- table.refreshRowColCount();
76055
- table.internalProps.layoutMap.clearCellRangeMap();
76056
- table.sortState && sortRecords(table);
76057
- table.scenegraph.clearCells();
76058
- table.scenegraph.createSceneGraph();
76059
- }
76060
- else if (table.dataSource.rowHierarchyType === 'tree') {
76061
- table.dataSource.addRecordsForTree?.([record], recordIndex);
76062
- adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
76063
- table.refreshRowColCount();
76064
- table.internalProps.layoutMap.clearCellRangeMap();
76065
- table.sortState && sortRecords(table);
76066
- table.scenegraph.clearCells();
76067
- table.scenegraph.createSceneGraph();
76068
- }
76069
- else if (table.sortState) {
76070
- table.dataSource.addRecordForSorted(record);
76071
- table.stateManager.checkedState.clear();
76072
- sortRecords(table);
76073
- table.refreshRowColCount();
76074
- table.scenegraph.clearCells();
76075
- table.scenegraph.createSceneGraph();
76076
- }
76077
- else {
76078
- recordIndex = recordIndex;
76079
- if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {
76080
- recordIndex = table.dataSource.sourceLength;
76081
- }
76082
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76083
- table.dataSource.addRecord(record, recordIndex);
76084
- adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
76085
- const oldRowCount = table.rowCount;
76086
- table.refreshRowColCount();
76087
- if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
76240
+ try {
76241
+ if (!record) {
76242
+ return false;
76243
+ }
76244
+ if (table.internalProps.groupBy) {
76245
+ table.dataSource.addRecordsForGroup?.([record], recordIndex);
76246
+ table.refreshRowColCount();
76247
+ table.internalProps.layoutMap.clearCellRangeMap();
76248
+ table.sortState && sortRecords(table);
76088
76249
  table.scenegraph.clearCells();
76089
76250
  table.scenegraph.createSceneGraph();
76090
- return;
76091
76251
  }
76092
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
76093
- if (table.pagination) {
76094
- const { perPageCount, currentPage } = table.pagination;
76095
- const startIndex = perPageCount * (currentPage || 0);
76096
- const endIndex = startIndex + perPageCount;
76097
- if (recordIndex < endIndex) {
76098
- if (recordIndex < endIndex - perPageCount) {
76099
- table.scenegraph.clearCells();
76100
- table.scenegraph.createSceneGraph();
76101
- }
76102
- else {
76103
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
76104
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
76105
- const updateRows = [];
76106
- for (let row = rowNum; row < newRowCount; row++) {
76107
- if (table.transpose) {
76108
- updateRows.push({ col: row, row: 0 });
76109
- }
76110
- else {
76111
- updateRows.push({ col: 0, row });
76112
- }
76113
- }
76114
- table.transpose
76115
- ? table.scenegraph.updateCol([], [], updateRows)
76116
- : table.scenegraph.updateRow([], [], updateRows);
76252
+ else if (table.dataSource.rowHierarchyType === 'tree') {
76253
+ table.dataSource.addRecordsForTree?.([record], recordIndex);
76254
+ adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
76255
+ table.refreshRowColCount();
76256
+ table.internalProps.layoutMap.clearCellRangeMap();
76257
+ table.sortState && sortRecords(table);
76258
+ table.scenegraph.clearCells();
76259
+ table.scenegraph.createSceneGraph();
76260
+ }
76261
+ else if (table.sortState) {
76262
+ table.dataSource.addRecordForSorted(record);
76263
+ table.stateManager.checkedState.clear();
76264
+ sortRecords(table);
76265
+ table.refreshRowColCount();
76266
+ table.scenegraph.clearCells();
76267
+ table.scenegraph.createSceneGraph();
76268
+ }
76269
+ else {
76270
+ recordIndex = recordIndex;
76271
+ if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {
76272
+ recordIndex = table.dataSource.sourceLength;
76273
+ }
76274
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76275
+ table.dataSource.addRecord(record, recordIndex);
76276
+ adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
76277
+ const oldRowCount = table.rowCount;
76278
+ table.refreshRowColCount();
76279
+ if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
76280
+ table.scenegraph.clearCells();
76281
+ table.scenegraph.createSceneGraph();
76282
+ return true;
76283
+ }
76284
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
76285
+ if (table.pagination) {
76286
+ const { perPageCount, currentPage } = table.pagination;
76287
+ const startIndex = perPageCount * (currentPage || 0);
76288
+ const endIndex = startIndex + perPageCount;
76289
+ if (recordIndex < endIndex) {
76290
+ if (recordIndex < endIndex - perPageCount) {
76291
+ table.scenegraph.clearCells();
76292
+ table.scenegraph.createSceneGraph();
76117
76293
  }
76118
76294
  else {
76119
- const addRows = [];
76120
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) {
76121
- if (table.transpose) {
76122
- addRows.push({ col: row, row: 0 });
76295
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
76296
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
76297
+ const updateRows = [];
76298
+ for (let row = rowNum; row < newRowCount; row++) {
76299
+ if (table.transpose) {
76300
+ updateRows.push({ col: row, row: 0 });
76301
+ }
76302
+ else {
76303
+ updateRows.push({ col: 0, row });
76304
+ }
76123
76305
  }
76124
- else {
76125
- addRows.push({ col: 0, row });
76306
+ table.transpose
76307
+ ? table.scenegraph.updateCol([], [], updateRows)
76308
+ : table.scenegraph.updateRow([], [], updateRows);
76309
+ }
76310
+ else {
76311
+ const addRows = [];
76312
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) {
76313
+ if (table.transpose) {
76314
+ addRows.push({ col: row, row: 0 });
76315
+ }
76316
+ else {
76317
+ addRows.push({ col: 0, row });
76318
+ }
76126
76319
  }
76320
+ table.transpose
76321
+ ? table.scenegraph.updateCol([], addRows, [])
76322
+ : table.scenegraph.updateRow([], addRows, []);
76127
76323
  }
76128
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
76129
76324
  }
76130
76325
  }
76131
76326
  }
76132
- }
76133
- else {
76134
- const addRows = [];
76135
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) {
76136
- if (table.transpose) {
76137
- addRows.push({ col: row, row: 0 });
76327
+ else {
76328
+ const addRows = [];
76329
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) {
76330
+ if (table.transpose) {
76331
+ addRows.push({ col: row, row: 0 });
76332
+ }
76333
+ else {
76334
+ addRows.push({ col: 0, row });
76335
+ }
76138
76336
  }
76139
- else {
76140
- addRows.push({ col: 0, row });
76337
+ const updateRows = [];
76338
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
76339
+ const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
76340
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
76341
+ if (table.transpose) {
76342
+ updateRows.push({ col: row, row: 0 });
76343
+ }
76344
+ else {
76345
+ updateRows.push({ col: 0, row });
76346
+ }
76141
76347
  }
76348
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
76349
+ if (table.transpose) {
76350
+ updateRows.push({ col: row, row: 0 });
76351
+ }
76352
+ else {
76353
+ updateRows.push({ col: 0, row });
76354
+ }
76355
+ }
76356
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
76142
76357
  }
76143
- const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
76144
- const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
76145
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
76146
- if (table.transpose) ;
76147
- }
76148
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
76149
- if (table.transpose) ;
76150
- }
76151
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
76152
76358
  }
76359
+ return true;
76360
+ }
76361
+ catch (error) {
76362
+ return false;
76153
76363
  }
76154
76364
  }
76155
76365
  function listTableAddRecords(records, recordIndex, table) {
76156
- if (table.internalProps.groupBy) {
76157
- table.dataSource.addRecordsForGroup?.(records, recordIndex);
76158
- table.refreshRowColCount();
76159
- table.internalProps.layoutMap.clearCellRangeMap();
76160
- table.sortState && sortRecords(table);
76161
- table.scenegraph.clearCells();
76162
- table.scenegraph.createSceneGraph();
76163
- }
76164
- else if (table.dataSource.rowHierarchyType === 'tree') {
76165
- table.dataSource.addRecordsForTree?.(records, recordIndex);
76166
- adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
76167
- table.refreshRowColCount();
76168
- table.internalProps.layoutMap.clearCellRangeMap();
76169
- table.sortState && sortRecords(table);
76170
- table.scenegraph.clearCells();
76171
- table.scenegraph.createSceneGraph();
76172
- }
76173
- else if (table.sortState) {
76174
- table.dataSource.addRecordsForSorted(records);
76175
- sortRecords(table);
76176
- table.refreshRowColCount();
76177
- table.scenegraph.clearCells();
76178
- table.scenegraph.createSceneGraph();
76179
- }
76180
- else {
76181
- recordIndex = recordIndex;
76182
- if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {
76183
- recordIndex = table.dataSource.sourceLength;
76366
+ try {
76367
+ if (!records || records.length === 0) {
76368
+ return false;
76184
76369
  }
76185
- else if (recordIndex < 0) {
76186
- recordIndex = 0;
76370
+ if (table.internalProps.groupBy) {
76371
+ table.dataSource.addRecordsForGroup?.(records, recordIndex);
76372
+ table.refreshRowColCount();
76373
+ table.internalProps.layoutMap.clearCellRangeMap();
76374
+ table.sortState && sortRecords(table);
76375
+ table.scenegraph.clearCells();
76376
+ table.scenegraph.createSceneGraph();
76187
76377
  }
76188
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76189
- table.dataSource.addRecords(records, recordIndex);
76190
- adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
76191
- const oldRowCount = table.transpose ? table.colCount : table.rowCount;
76192
- table.refreshRowColCount();
76193
- if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
76378
+ else if (table.dataSource.rowHierarchyType === 'tree') {
76379
+ table.dataSource.addRecordsForTree?.(records, recordIndex);
76380
+ adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
76381
+ table.refreshRowColCount();
76382
+ table.internalProps.layoutMap.clearCellRangeMap();
76383
+ table.sortState && sortRecords(table);
76194
76384
  table.scenegraph.clearCells();
76195
76385
  table.scenegraph.createSceneGraph();
76196
- return;
76197
76386
  }
76198
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
76199
- if (table.pagination) {
76200
- const { perPageCount, currentPage } = table.pagination;
76201
- const startIndex = perPageCount * (currentPage || 0);
76202
- const endIndex = startIndex + perPageCount;
76203
- if (recordIndex < endIndex) {
76204
- if (recordIndex < endIndex - perPageCount) {
76205
- table.scenegraph.clearCells();
76206
- table.scenegraph.createSceneGraph();
76207
- }
76208
- else {
76209
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
76210
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
76211
- const updateRows = [];
76212
- for (let row = rowNum; row < newRowCount; row++) {
76213
- if (table.transpose) {
76214
- updateRows.push({ col: row, row: 0 });
76215
- }
76216
- else {
76217
- updateRows.push({ col: 0, row });
76218
- }
76219
- }
76220
- table.transpose
76221
- ? table.scenegraph.updateCol([], [], updateRows)
76222
- : table.scenegraph.updateRow([], [], updateRows);
76387
+ else if (table.sortState) {
76388
+ table.dataSource.addRecordsForSorted(records);
76389
+ sortRecords(table);
76390
+ table.refreshRowColCount();
76391
+ table.scenegraph.clearCells();
76392
+ table.scenegraph.createSceneGraph();
76393
+ }
76394
+ else {
76395
+ recordIndex = recordIndex;
76396
+ if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {
76397
+ recordIndex = table.dataSource.sourceLength;
76398
+ }
76399
+ else if (recordIndex < 0) {
76400
+ recordIndex = 0;
76401
+ }
76402
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
76403
+ table.dataSource.addRecords(records, recordIndex);
76404
+ adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
76405
+ const oldRowCount = table.transpose ? table.colCount : table.rowCount;
76406
+ table.refreshRowColCount();
76407
+ if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {
76408
+ table.scenegraph.clearCells();
76409
+ table.scenegraph.createSceneGraph();
76410
+ return true;
76411
+ }
76412
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
76413
+ if (table.pagination) {
76414
+ const { perPageCount, currentPage } = table.pagination;
76415
+ const startIndex = perPageCount * (currentPage || 0);
76416
+ const endIndex = startIndex + perPageCount;
76417
+ if (recordIndex < endIndex) {
76418
+ if (recordIndex < endIndex - perPageCount) {
76419
+ table.scenegraph.clearCells();
76420
+ table.scenegraph.createSceneGraph();
76223
76421
  }
76224
76422
  else {
76225
- const addRows = [];
76226
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) {
76227
- if (table.transpose) {
76228
- addRows.push({ col: row, row: 0 });
76423
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
76424
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
76425
+ const updateRows = [];
76426
+ for (let row = rowNum; row < newRowCount; row++) {
76427
+ if (table.transpose) {
76428
+ updateRows.push({ col: row, row: 0 });
76429
+ }
76430
+ else {
76431
+ updateRows.push({ col: 0, row });
76432
+ }
76229
76433
  }
76230
- else {
76231
- addRows.push({ col: 0, row });
76434
+ table.transpose
76435
+ ? table.scenegraph.updateCol([], [], updateRows)
76436
+ : table.scenegraph.updateRow([], [], updateRows);
76437
+ }
76438
+ else {
76439
+ const addRows = [];
76440
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) {
76441
+ if (table.transpose) {
76442
+ addRows.push({ col: row, row: 0 });
76443
+ }
76444
+ else {
76445
+ addRows.push({ col: 0, row });
76446
+ }
76232
76447
  }
76448
+ table.transpose
76449
+ ? table.scenegraph.updateCol([], addRows, [])
76450
+ : table.scenegraph.updateRow([], addRows, []);
76233
76451
  }
76234
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
76235
76452
  }
76236
76453
  }
76237
76454
  }
76238
- }
76239
- else {
76240
- const addRows = [];
76241
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) {
76242
- if (table.transpose) {
76243
- addRows.push({ col: row, row: 0 });
76244
- }
76245
- else {
76246
- addRows.push({ col: 0, row });
76247
- }
76248
- }
76249
- const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
76250
- const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
76251
- const updateRows = [];
76252
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
76253
- if (table.transpose) {
76254
- updateRows.push({ col: row, row: 0 });
76255
- }
76256
- else {
76257
- updateRows.push({ col: 0, row });
76455
+ else {
76456
+ const addRows = [];
76457
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) {
76458
+ if (table.transpose) {
76459
+ addRows.push({ col: row, row: 0 });
76460
+ }
76461
+ else {
76462
+ addRows.push({ col: 0, row });
76463
+ }
76258
76464
  }
76259
- }
76260
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
76261
- if (table.transpose) {
76262
- updateRows.push({ col: row, row: 0 });
76465
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
76466
+ const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
76467
+ const updateRows = [];
76468
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
76469
+ if (table.transpose) {
76470
+ updateRows.push({ col: row, row: 0 });
76471
+ }
76472
+ else {
76473
+ updateRows.push({ col: 0, row });
76474
+ }
76263
76475
  }
76264
- else {
76265
- updateRows.push({ col: 0, row });
76476
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
76477
+ if (table.transpose) {
76478
+ updateRows.push({ col: row, row: 0 });
76479
+ }
76480
+ else {
76481
+ updateRows.push({ col: 0, row });
76482
+ }
76266
76483
  }
76484
+ table.transpose
76485
+ ? table.scenegraph.updateCol([], addRows, updateRows)
76486
+ : table.scenegraph.updateRow([], addRows, updateRows);
76267
76487
  }
76268
- table.transpose
76269
- ? table.scenegraph.updateCol([], addRows, updateRows)
76270
- : table.scenegraph.updateRow([], addRows, updateRows);
76271
76488
  }
76489
+ return true;
76490
+ }
76491
+ catch (error) {
76492
+ return false;
76272
76493
  }
76273
76494
  }
76274
76495
  function listTableDeleteRecords(recordIndexs, table) {
@@ -76838,7 +77059,10 @@
76838
77059
  get recordsCount() {
76839
77060
  return this.dataSource.records.length;
76840
77061
  }
76841
- updateColumns(columns, options) {
77062
+ updateColumns(columns, options = {
77063
+ clearColWidthCache: false,
77064
+ clearRowHeightCache: true
77065
+ }) {
76842
77066
  this.scenegraph.clearCells();
76843
77067
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
76844
77068
  this.internalProps.columns = cloneDeepSpec(columns, ['children']);
@@ -76858,7 +77082,7 @@
76858
77082
  this.headerStyleCache = new Map();
76859
77083
  this.bodyStyleCache = new Map();
76860
77084
  this.bodyBottomStyleCache = new Map();
76861
- this.scenegraph.createSceneGraph();
77085
+ this.scenegraph.createSceneGraph(!!!options?.clearRowHeightCache);
76862
77086
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
76863
77087
  this.renderAsync();
76864
77088
  this.eventManager.updateEventBinder();
@@ -76881,37 +77105,81 @@
76881
77105
  this.renderAsync();
76882
77106
  this.eventManager.updateEventBinder();
76883
77107
  }
76884
- addColumn(column, colIndex, isMaintainArrayData = true) {
77108
+ addColumns(toAddColumns, colIndex, isMaintainArrayData = true) {
76885
77109
  const columns = this.options.columns;
76886
77110
  if (colIndex === undefined) {
76887
- columns.push(column);
77111
+ colIndex = columns.length;
77112
+ columns.push(...toAddColumns);
76888
77113
  }
76889
77114
  else {
76890
- if (isMaintainArrayData) {
76891
- for (let i = 0; i < columns.length; i++) {
76892
- if (typeof columns[i].field === 'number') {
76893
- if (columns[i].field >= colIndex) {
76894
- columns[i].field = columns[i].field + 1;
76895
- }
76896
- }
76897
- }
77115
+ columns.splice(colIndex, 0, ...toAddColumns);
77116
+ }
77117
+ for (let i = 0; i < toAddColumns.length; i++) {
77118
+ this.colWidthsMap.addAndReorder(colIndex + i, toAddColumns[i].width ?? this.internalProps.defaultColWidth);
77119
+ }
77120
+ this.internalProps._colRangeWidthsMap.clear();
77121
+ const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
77122
+ for (let i = 0; i < resizedColIndexs.length; i++) {
77123
+ if (resizedColIndexs[i] >= colIndex) {
77124
+ this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]);
77125
+ this.internalProps._widthResizedColMap.add(resizedColIndexs[i] + toAddColumns.length);
76898
77126
  }
76899
- columns.splice(colIndex, 0, column);
76900
77127
  }
76901
77128
  if (isMaintainArrayData) {
77129
+ for (let i = 0; i < columns.length; i++) {
77130
+ columns[i].field = i;
77131
+ }
76902
77132
  for (let i = 0; i < this.records.length; i++) {
76903
77133
  const record = this.records[i];
76904
77134
  if (Array.isArray(record)) {
76905
- record.splice(colIndex, 0, undefined);
77135
+ record.splice(colIndex, 0, ...Array(toAddColumns.length).fill(undefined));
76906
77136
  }
76907
77137
  }
76908
77138
  }
76909
- this.updateColumns(columns);
77139
+ this.updateColumns(columns, { clearRowHeightCache: false });
77140
+ this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
77141
+ columnIndex: colIndex,
77142
+ columnCount: toAddColumns.length,
77143
+ columns
77144
+ });
76910
77145
  }
76911
- deleteColumn(colIndex) {
77146
+ deleteColumns(deleteColIndexs, isMaintainArrayData = true) {
76912
77147
  const columns = this.options.columns;
76913
- columns.splice(colIndex, 1);
76914
- this.updateColumns(columns);
77148
+ deleteColIndexs.sort((a, b) => b - a);
77149
+ for (let i = 0; i < deleteColIndexs.length; i++) {
77150
+ columns.splice(deleteColIndexs[i], 1);
77151
+ this.colWidthsMap.delAndReorder(deleteColIndexs[i]);
77152
+ this.internalProps._widthResizedColMap.delete(deleteColIndexs[i]);
77153
+ if (isMaintainArrayData) {
77154
+ for (let j = 0; j < this.records.length; j++) {
77155
+ const record = this.records[j];
77156
+ if (Array.isArray(record)) {
77157
+ record.splice(deleteColIndexs[i], 1);
77158
+ }
77159
+ }
77160
+ }
77161
+ }
77162
+ this.internalProps._colRangeWidthsMap.clear();
77163
+ const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
77164
+ for (let i = 0; i < resizedColIndexs.length; i++) {
77165
+ for (let j = 0; j < deleteColIndexs.length; j++) {
77166
+ if (resizedColIndexs[i] > deleteColIndexs[j]) {
77167
+ this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]);
77168
+ this.internalProps._widthResizedColMap.add(resizedColIndexs[i] - (deleteColIndexs.length - j));
77169
+ break;
77170
+ }
77171
+ }
77172
+ }
77173
+ if (isMaintainArrayData) {
77174
+ for (let i = 0; i < columns.length; i++) {
77175
+ columns[i].field = i;
77176
+ }
77177
+ }
77178
+ this.updateColumns(columns, { clearRowHeightCache: false });
77179
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
77180
+ deleteColIndexs: deleteColIndexs,
77181
+ columns
77182
+ });
76915
77183
  }
76916
77184
  get columns() {
76917
77185
  return this.internalProps.layoutMap.columnTree.getCopiedTree();
@@ -77575,6 +77843,9 @@
77575
77843
  this.scenegraph.createSceneGraph();
77576
77844
  this.resize();
77577
77845
  }
77846
+ getFilteredRecords() {
77847
+ return this.dataSource.records;
77848
+ }
77578
77849
  getCheckboxState(field) {
77579
77850
  if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount) {
77580
77851
  this.stateManager.initLeftRecordsCheckState(this.records);
@@ -77777,19 +78048,49 @@
77777
78048
  return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
77778
78049
  }
77779
78050
  addRecord(record, recordIndex) {
77780
- listTableAddRecord(record, recordIndex, this);
78051
+ const success = listTableAddRecord(record, recordIndex, this);
77781
78052
  this.internalProps.emptyTip?.resetVisible();
78053
+ if (success) {
78054
+ this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78055
+ records: [record],
78056
+ recordIndex,
78057
+ recordCount: 1
78058
+ });
78059
+ }
77782
78060
  }
77783
78061
  addRecords(records, recordIndex) {
77784
- listTableAddRecords(records, recordIndex, this);
78062
+ const success = listTableAddRecords(records, recordIndex, this);
77785
78063
  this.internalProps.emptyTip?.resetVisible();
78064
+ if (success) {
78065
+ this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
78066
+ records,
78067
+ recordIndex,
78068
+ recordCount: records.length
78069
+ });
78070
+ }
77786
78071
  }
77787
78072
  deleteRecords(recordIndexs) {
77788
78073
  listTableDeleteRecords(recordIndexs, this);
77789
78074
  this.internalProps.emptyTip?.resetVisible();
78075
+ const rowIndexs = [];
78076
+ for (let i = 0; i < recordIndexs.length; i++) {
78077
+ rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
78078
+ }
78079
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
78080
+ recordIndexs,
78081
+ rowIndexs,
78082
+ deletedCount: Array.isArray(recordIndexs[0])
78083
+ ? recordIndexs.length
78084
+ : recordIndexs.length
78085
+ });
77790
78086
  }
77791
78087
  updateRecords(records, recordIndexs) {
77792
78088
  listTableUpdateRecords(records, recordIndexs, this);
78089
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
78090
+ records,
78091
+ recordIndexs,
78092
+ updateCount: records.length
78093
+ });
77793
78094
  }
77794
78095
  _hasCustomRenderOrLayout() {
77795
78096
  const { headerObjects } = this.internalProps.layoutMap;
@@ -83676,6 +83977,17 @@
83676
83977
  else {
83677
83978
  height = table.getRowHeight(row);
83678
83979
  }
83980
+ if (table.pluginManager) {
83981
+ const masterDetailPlugin = table.pluginManager.getPluginByName('Master Detail Plugin');
83982
+ if (masterDetailPlugin) {
83983
+ const bodyRowIndex = row - table.columnHeaderLevelCount;
83984
+ const internalProps = table.internalProps;
83985
+ const originalHeight = internalProps?.originalRowHeights?.get(bodyRowIndex);
83986
+ if (originalHeight !== undefined && originalHeight > 0) {
83987
+ height = originalHeight;
83988
+ }
83989
+ }
83990
+ }
83679
83991
  let contentWidth = width;
83680
83992
  let contentHeight = height;
83681
83993
  let _contentOffset = 0;
@@ -91546,7 +91858,7 @@
91546
91858
  this.renderWithRecreateCells();
91547
91859
  }
91548
91860
  getFilteredRecords() {
91549
- return this.dataset?.filterRules;
91861
+ return this.dataset?.filteredRecords;
91550
91862
  }
91551
91863
  getCellPivotRole(col, row) {
91552
91864
  const path = this.getCellHeaderPaths(col, row);
@@ -93426,7 +93738,7 @@
93426
93738
  }
93427
93739
 
93428
93740
  registerForVrender();
93429
- const version = "1.21.1";
93741
+ const version = "1.22.1";
93430
93742
  function getIcons() {
93431
93743
  return get$2();
93432
93744
  }