@visactor/vtable 1.26.3-alpha.0 → 1.26.4-alpha.0

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 (91) hide show
  1. package/cjs/ListTable.d.ts +1 -0
  2. package/cjs/ListTable.js +25 -4
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable.js +7 -6
  5. package/cjs/PivotTable.js.map +1 -1
  6. package/cjs/body-helper/style.js +2 -1
  7. package/cjs/core/BaseTable.js +9 -8
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/core/FouseInput.js +1 -2
  10. package/cjs/core/tableHelper.d.ts +2 -0
  11. package/cjs/core/tableHelper.js +13 -8
  12. package/cjs/core/tableHelper.js.map +1 -1
  13. package/cjs/data/CachedDataSource.d.ts +1 -0
  14. package/cjs/data/CachedDataSource.js +22 -0
  15. package/cjs/data/CachedDataSource.js.map +1 -1
  16. package/cjs/dataset/DataStatistics.js +2 -1
  17. package/cjs/dataset/flatDataToObject.js +1 -2
  18. package/cjs/event/EventHandler.js +1 -1
  19. package/cjs/event/EventTarget.js +1 -1
  20. package/cjs/event/drill.js +1 -1
  21. package/cjs/event/event.js +1 -1
  22. package/cjs/layout/pivot-header-layout.d.ts +2 -2
  23. package/cjs/layout/pivot-header-layout.js +1 -0
  24. package/cjs/plugins/interface.js +1 -2
  25. package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -1
  26. package/cjs/scenegraph/group-creater/cell-helper.js +5 -5
  27. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  28. package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  29. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +3 -2
  30. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  31. package/cjs/scenegraph/group-creater/column-helper.js +9 -6
  32. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  33. package/cjs/scenegraph/layout/frozen.js +7 -3
  34. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  35. package/cjs/scenegraph/scenegraph.js +23 -14
  36. package/cjs/scenegraph/scenegraph.js.map +1 -1
  37. package/cjs/scenegraph/utils/padding.d.ts +5 -2
  38. package/cjs/scenegraph/utils/padding.js +16 -13
  39. package/cjs/scenegraph/utils/padding.js.map +1 -1
  40. package/cjs/scenegraph/utils/text-icon-layout.js +4 -4
  41. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  42. package/cjs/state/state.js +1 -1
  43. package/cjs/themes/ARCO.js +1 -1
  44. package/cjs/themes/BRIGHT.js +1 -1
  45. package/dist/vtable.js +239 -89
  46. package/dist/vtable.min.js +1 -1
  47. package/es/ListTable.d.ts +1 -0
  48. package/es/ListTable.js +26 -6
  49. package/es/ListTable.js.map +1 -1
  50. package/es/PivotTable.js +7 -6
  51. package/es/PivotTable.js.map +1 -1
  52. package/es/body-helper/style.js +2 -1
  53. package/es/core/BaseTable.js +7 -7
  54. package/es/core/BaseTable.js.map +1 -1
  55. package/es/core/FouseInput.js +1 -2
  56. package/es/core/tableHelper.d.ts +2 -0
  57. package/es/core/tableHelper.js +11 -7
  58. package/es/core/tableHelper.js.map +1 -1
  59. package/es/data/CachedDataSource.d.ts +1 -0
  60. package/es/data/CachedDataSource.js +22 -0
  61. package/es/data/CachedDataSource.js.map +1 -1
  62. package/es/dataset/DataStatistics.js +2 -1
  63. package/es/dataset/flatDataToObject.js +1 -2
  64. package/es/event/EventHandler.js +1 -1
  65. package/es/event/EventTarget.js +1 -1
  66. package/es/event/drill.js +1 -1
  67. package/es/event/event.js +1 -1
  68. package/es/layout/pivot-header-layout.d.ts +2 -2
  69. package/es/layout/pivot-header-layout.js +2 -1
  70. package/es/plugins/interface.js +1 -2
  71. package/es/scenegraph/group-creater/cell-helper.d.ts +1 -1
  72. package/es/scenegraph/group-creater/cell-helper.js +5 -5
  73. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  74. package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  75. package/es/scenegraph/group-creater/cell-type/text-cell.js +3 -2
  76. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  77. package/es/scenegraph/group-creater/column-helper.js +9 -6
  78. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  79. package/es/scenegraph/layout/frozen.js +7 -3
  80. package/es/scenegraph/layout/frozen.js.map +1 -1
  81. package/es/scenegraph/scenegraph.js +23 -11
  82. package/es/scenegraph/scenegraph.js.map +1 -1
  83. package/es/scenegraph/utils/padding.d.ts +5 -2
  84. package/es/scenegraph/utils/padding.js +13 -9
  85. package/es/scenegraph/utils/padding.js.map +1 -1
  86. package/es/scenegraph/utils/text-icon-layout.js +4 -4
  87. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  88. package/es/state/state.js +1 -1
  89. package/es/themes/ARCO.js +1 -1
  90. package/es/themes/BRIGHT.js +1 -1
  91. package/package.json +4 -4
package/dist/vtable.js CHANGED
@@ -41545,6 +41545,41 @@
41545
41545
  getGroupLength() {
41546
41546
  return this.dataConfig?.groupByRules?.length ?? 0;
41547
41547
  }
41548
+ refreshRecords(records = [], dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
41549
+ this.clearCache();
41550
+ this.beforeChangedRecordsMap.clear();
41551
+ this.groupAggregator = null;
41552
+ this.addRecordRule = dataConfig?.addRecordRule || 'Object';
41553
+ this.dataConfig = dataConfig;
41554
+ this.columns = columns;
41555
+ this._isGrouped = isArray$5(dataConfig?.groupByRules);
41556
+ this.rowHierarchyType = rowHierarchyType;
41557
+ this.dataSourceObj = {
41558
+ get: (index) => records[index],
41559
+ length: records.length,
41560
+ records
41561
+ };
41562
+ this._source = this.processRecords(records);
41563
+ this.sourceLength = this.source?.length || 0;
41564
+ this.sortedIndexMap.clear();
41565
+ this._currentPagerIndexedData = [];
41566
+ this.userPagination = pagination;
41567
+ this.pagination = pagination || {
41568
+ totalCount: this.sourceLength,
41569
+ perPageCount: this.sourceLength,
41570
+ currentPage: 0
41571
+ };
41572
+ this.hierarchyExpandLevel = hierarchyExpandLevel >= 1 ? hierarchyExpandLevel : 0;
41573
+ this.currentIndexedData = Array.from({ length: this.sourceLength }, (_, i) => i);
41574
+ if (!this.userPagination) {
41575
+ this.pagination.perPageCount = this.sourceLength;
41576
+ this.pagination.totalCount = this.sourceLength;
41577
+ }
41578
+ if (rowHierarchyType === 'tree') {
41579
+ this.initTreeHierarchyState();
41580
+ }
41581
+ this.updatePagerData();
41582
+ }
41548
41583
  updateGroup() {
41549
41584
  this.clearCache();
41550
41585
  const oldSource = this.source;
@@ -41965,26 +42000,53 @@
41965
42000
  return parse$2(font);
41966
42001
  }
41967
42002
 
41968
- function getQuadProps(paddingOrigin) {
41969
- if (isNumber$3(paddingOrigin) || isString$2(paddingOrigin) || isArray$5(paddingOrigin)) {
41970
- let padding = parsePadding(paddingOrigin);
41971
- if (typeof padding === 'number' || typeof padding === 'string') {
41972
- padding = [padding, padding, padding, padding];
41973
- }
41974
- else if (Array.isArray(padding)) {
41975
- padding = padding.slice(0);
41976
- }
41977
- return padding;
42003
+ function normalizeQuadArray(values) {
42004
+ if (values.length === 0) {
42005
+ return [0, 0, 0, 0];
42006
+ }
42007
+ if (values.length === 1) {
42008
+ return [values[0], values[0], values[0], values[0]];
42009
+ }
42010
+ if (values.length === 2) {
42011
+ return [values[0], values[1], values[0], values[1]];
42012
+ }
42013
+ if (values.length === 3) {
42014
+ return [values[0], values[1], values[2], values[1]];
41978
42015
  }
41979
- else if (paddingOrigin &&
41980
- (isFinite(paddingOrigin.bottom) ||
41981
- isFinite(paddingOrigin.left) ||
41982
- isFinite(paddingOrigin.right) ||
41983
- isFinite(paddingOrigin.top))) {
42016
+ return [values[0], values[1], values[2], values[3]];
42017
+ }
42018
+ function parseStringQuad(padding) {
42019
+ const tokens = padding.trim().split(/\s+/);
42020
+ const values = tokens.map(token => Number.parseFloat(token)).filter(value => Number.isFinite(value));
42021
+ if (values.length === tokens.length && values.length > 0) {
42022
+ return normalizeQuadArray(values);
42023
+ }
42024
+ return [padding, padding, padding, padding];
42025
+ }
42026
+ function normalizePaddingObject(paddingOrigin) {
42027
+ if (Number.isFinite(paddingOrigin.bottom) ||
42028
+ Number.isFinite(paddingOrigin.left) ||
42029
+ Number.isFinite(paddingOrigin.right) ||
42030
+ Number.isFinite(paddingOrigin.top)) {
41984
42031
  return [paddingOrigin.top ?? 0, paddingOrigin.right ?? 0, paddingOrigin.bottom ?? 0, paddingOrigin.left ?? 0];
41985
42032
  }
41986
42033
  return [0, 0, 0, 0];
41987
42034
  }
42035
+ function getQuadProps(paddingOrigin) {
42036
+ if (Array.isArray(paddingOrigin)) {
42037
+ return normalizeQuadArray(paddingOrigin.slice(0, 4));
42038
+ }
42039
+ if (typeof paddingOrigin === 'number' && Number.isFinite(paddingOrigin)) {
42040
+ return [paddingOrigin, paddingOrigin, paddingOrigin, paddingOrigin];
42041
+ }
42042
+ if (typeof paddingOrigin === 'string') {
42043
+ return parseStringQuad(paddingOrigin);
42044
+ }
42045
+ if (paddingOrigin && typeof paddingOrigin === 'object') {
42046
+ return normalizePaddingObject(paddingOrigin);
42047
+ }
42048
+ return [0, 0, 0, 0];
42049
+ }
41988
42050
 
41989
42051
  const TYPE_PAREN = 0;
41990
42052
  const TYPE_UNIT = 1;
@@ -42281,17 +42343,21 @@
42281
42343
  })
42282
42344
  ];
42283
42345
  }
42284
- function _setRecords(table, records = []) {
42346
+ function getListTableRowHierarchyType(table) {
42285
42347
  const tableWithPlugins = table;
42348
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42349
+ if (isArray$5(table.internalProps.dataConfig?.groupByRules)) {
42350
+ rowHierarchyType = 'tree';
42351
+ }
42352
+ if (tableWithPlugins.pluginManager?.getPluginByName('Master Detail Plugin')) {
42353
+ rowHierarchyType = 'grid';
42354
+ }
42355
+ return rowHierarchyType;
42356
+ }
42357
+ function _setRecords(table, records = []) {
42286
42358
  _dealWithUpdateDataSource(table, () => {
42287
42359
  table.internalProps.records = records;
42288
- let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42289
- if (isArray$5(table.internalProps.dataConfig?.groupByRules)) {
42290
- rowHierarchyType = 'tree';
42291
- }
42292
- if (tableWithPlugins.pluginManager.getPluginByName('Master Detail Plugin')) {
42293
- rowHierarchyType = 'grid';
42294
- }
42360
+ const rowHierarchyType = getListTableRowHierarchyType(table);
42295
42361
  const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table)));
42296
42362
  table.addReleaseObj(newDataSource);
42297
42363
  });
@@ -44595,7 +44661,7 @@
44595
44661
  }
44596
44662
 
44597
44663
  function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
44598
- let contentWidth;
44664
+ let contentWidth = 0;
44599
44665
  let leftIconWidth = 0;
44600
44666
  let rightIconWidth = 0;
44601
44667
  let absoluteRightIconWidth = 0;
@@ -44640,8 +44706,9 @@
44640
44706
  wrapText.name = 'text';
44641
44707
  wrapText.textBaseline = textBaseline;
44642
44708
  cellGroup.appendChild(wrapText);
44643
- contentWidth = wrapText.AABBBounds.width();
44644
- wrapText.AABBBounds.height();
44709
+ if (autoColWidth) {
44710
+ contentWidth = wrapText.AABBBounds.width();
44711
+ }
44645
44712
  }
44646
44713
  }
44647
44714
  else {
@@ -44755,8 +44822,9 @@
44755
44822
  cellContent.addContent(textMark);
44756
44823
  cellGroup.appendChild(cellContent);
44757
44824
  cellContent.layout();
44758
- contentWidth = cellContent.AABBBounds.width();
44759
- cellContent.AABBBounds.height();
44825
+ if (autoColWidth) {
44826
+ contentWidth = cellContent.AABBBounds.width();
44827
+ }
44760
44828
  }
44761
44829
  else {
44762
44830
  if (cellGroup.firstChild) {
@@ -44765,8 +44833,9 @@
44765
44833
  else {
44766
44834
  cellGroup.appendChild(textMark);
44767
44835
  }
44768
- contentWidth = textMark.AABBBounds.width();
44769
- textMark.AABBBounds.height();
44836
+ if (autoColWidth) {
44837
+ contentWidth = textMark.AABBBounds.width();
44838
+ }
44770
44839
  }
44771
44840
  }
44772
44841
  const width = autoColWidth
@@ -45652,7 +45721,7 @@
45652
45721
  }
45653
45722
  }
45654
45723
 
45655
- function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
45724
+ function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, headerStyle) {
45656
45725
  let isAsync = false;
45657
45726
  let cellGroup;
45658
45727
  if (isPromise(value)) {
@@ -45701,7 +45770,7 @@
45701
45770
  }
45702
45771
  const { customElementsGroup, renderDefault } = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult);
45703
45772
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45704
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
45773
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
45705
45774
  const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
45706
45775
  if (axisConfig) {
45707
45776
  const CartesianAxis = Factory.getComponent('axis');
@@ -45739,7 +45808,7 @@
45739
45808
  const style = table._getCellStyle(col, row);
45740
45809
  const dataValue = table.getCellOriginValue(col, row);
45741
45810
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45742
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
45811
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
45743
45812
  const createProgressBarCell = Factory.getFunction('createProgressBarCell');
45744
45813
  const progressBarGroup = createProgressBarCell(define, style, colWidth, value, dataValue, col, row, padding, table, range);
45745
45814
  if (cellGroup.firstChild) {
@@ -45757,7 +45826,7 @@
45757
45826
  const isAggregation = 'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
45758
45827
  if (isAggregation) {
45759
45828
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45760
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync);
45829
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync, headerStyle);
45761
45830
  }
45762
45831
  else {
45763
45832
  const createCheckboxCellGroup = Factory.getFunction('createCheckboxCellGroup');
@@ -45768,7 +45837,7 @@
45768
45837
  const isAggregation = 'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
45769
45838
  if (isAggregation) {
45770
45839
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45771
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync);
45840
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync, headerStyle);
45772
45841
  }
45773
45842
  else {
45774
45843
  const createRadioCellGroup = Factory.getFunction('createRadioCellGroup');
@@ -53945,6 +54014,7 @@
53945
54014
  let customStyle;
53946
54015
  let customResult;
53947
54016
  let isCustomMerge = false;
54017
+ let rawRecord;
53948
54018
  if (table.internalProps.customMergeCell) {
53949
54019
  const customMerge = table.getCustomMerge(col, row);
53950
54020
  if (customMerge) {
@@ -53994,8 +54064,19 @@
53994
54064
  !(isAggregation && isSeriesNumber);
53995
54065
  if (!range &&
53996
54066
  (table.internalProps.enableTreeNodeMerge || cellLocation !== 'body' || define?.mergeCell)) {
53997
- range = table.getCellRange(col, row);
53998
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
54067
+ if (table.internalProps.enableTreeNodeMerge &&
54068
+ cellLocation === 'body' &&
54069
+ !define?.mergeCell) {
54070
+ rawRecord = table.getCellRawRecord(col, row);
54071
+ if (rawRecord?.vtableMerge) {
54072
+ range = table.getCellRange(col, row);
54073
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
54074
+ }
54075
+ }
54076
+ else {
54077
+ range = table.getCellRange(col, row);
54078
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
54079
+ }
53999
54080
  if (isMerge) {
54000
54081
  const needUpdateRange = rowStart > range.start.row;
54001
54082
  const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
@@ -54005,7 +54086,7 @@
54005
54086
  }
54006
54087
  let isVtableMerge = false;
54007
54088
  if (table.internalProps.enableTreeNodeMerge && isMerge) {
54008
- const rawRecord = table.getCellRawRecord(range.start.col, range.start.row);
54089
+ rawRecord = rawRecord ?? table.getCellRawRecord(range.start.col, range.start.row);
54009
54090
  const { vtableMergeName, vtableMerge } = rawRecord ?? {};
54010
54091
  isVtableMerge = vtableMerge;
54011
54092
  if (vtableMerge) {
@@ -54066,7 +54147,7 @@
54066
54147
  if (cellLocation !== 'body' && !cellTheme.group.fill) {
54067
54148
  cellTheme.group.fill = '#fff';
54068
54149
  }
54069
- const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
54150
+ const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
54070
54151
  columnGroup.updateColumnRowNumber(row);
54071
54152
  if (isMerge) {
54072
54153
  const rangeHeight = table.getRowHeight(row);
@@ -54116,7 +54197,7 @@
54116
54197
  if (cellLocation !== 'body' && !cellTheme.group.fill) {
54117
54198
  cellTheme.group.fill = '#fff';
54118
54199
  }
54119
- createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
54200
+ createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
54120
54201
  }
54121
54202
  function dealMerge(range, mergeMap, table, forceUpdate) {
54122
54203
  let cellWidth = 0;
@@ -57299,7 +57380,9 @@
57299
57380
  const headerColGroup = scene.getColGroup(col, true);
57300
57381
  insertBefore(rightTopCornerGroup, headerColGroup, rightTopCornerGroup.firstChild);
57301
57382
  const bottomColGroup = scene.getColGroupInBottom(col);
57302
- insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
57383
+ if (bottomColGroup) {
57384
+ insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
57385
+ }
57303
57386
  }
57304
57387
  let x = 0;
57305
57388
  rightFrozenGroup.forEachChildren((columnGroup) => {
@@ -57326,9 +57409,11 @@
57326
57409
  headerColGroup.setAttribute('x', colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col));
57327
57410
  colHeaderGroup.appendChild(headerColGroup);
57328
57411
  const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
57329
- bottomColGroup.setAttribute('x', bottomFrozenGroup.lastChild.attribute.x +
57330
- table.getColWidth(bottomFrozenGroup.lastChild.col));
57331
- bottomFrozenGroup.appendChild(bottomColGroup);
57412
+ if (bottomColGroup) {
57413
+ const lastBottomColGroup = bottomFrozenGroup.lastChild;
57414
+ bottomColGroup.setAttribute('x', lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0);
57415
+ bottomFrozenGroup.appendChild(bottomColGroup);
57416
+ }
57332
57417
  }
57333
57418
  let x = 0;
57334
57419
  rightFrozenGroup.forEachChildren((columnGroup) => {
@@ -60186,42 +60271,42 @@
60186
60271
  this.updateNextFrame();
60187
60272
  }
60188
60273
  updateContainerAttrHeightAndY() {
60189
- for (let i = 0; i < this.cornerHeaderGroup.children.length; i++) {
60190
- updateContainerChildrenY(this.cornerHeaderGroup.children[i], 0);
60191
- }
60192
- for (let i = 0; i < this.colHeaderGroup.children.length; i++) {
60193
- updateContainerChildrenY(this.colHeaderGroup.children[i], 0);
60194
- }
60195
- for (let i = 0; i < this.rightTopCornerGroup.children.length; i++) {
60196
- updateContainerChildrenY(this.rightTopCornerGroup.children[i], 0);
60197
- }
60198
- for (let i = 0; i < this.rowHeaderGroup.children.length; i++) {
60199
- this.rowHeaderGroup.children[i].firstChild &&
60200
- updateContainerChildrenY(this.rowHeaderGroup.children[i], this.rowHeaderGroup.children[i].firstChild.row > 0
60201
- ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.rowHeaderGroup.children[i].firstChild.row - 1)
60274
+ this.cornerHeaderGroup.forEachChildrenSkipChild((column) => {
60275
+ updateContainerChildrenY(column, 0);
60276
+ });
60277
+ this.colHeaderGroup.forEachChildrenSkipChild((column) => {
60278
+ updateContainerChildrenY(column, 0);
60279
+ });
60280
+ this.rightTopCornerGroup.forEachChildrenSkipChild((column) => {
60281
+ updateContainerChildrenY(column, 0);
60282
+ });
60283
+ this.rowHeaderGroup.forEachChildrenSkipChild((column) => {
60284
+ column.firstChild &&
60285
+ updateContainerChildrenY(column, column.firstChild.row > 0
60286
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, column.firstChild.row - 1)
60202
60287
  : 0);
60203
- }
60204
- for (let i = 0; i < this.bodyGroup.children.length; i++) {
60205
- this.bodyGroup.children[i].firstChild &&
60206
- updateContainerChildrenY(this.bodyGroup.children[i], this.bodyGroup.children[i].firstChild.row > 0
60207
- ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.bodyGroup.children[i].firstChild.row - 1)
60288
+ });
60289
+ this.bodyGroup.forEachChildrenSkipChild((column) => {
60290
+ column.firstChild &&
60291
+ updateContainerChildrenY(column, column.firstChild.row > 0
60292
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, column.firstChild.row - 1)
60208
60293
  : 0);
60209
- }
60210
- for (let i = 0; i < this.rightFrozenGroup.children.length; i++) {
60211
- this.rightFrozenGroup.children[i].firstChild &&
60212
- updateContainerChildrenY(this.rightFrozenGroup.children[i], this.rightFrozenGroup.children[i].firstChild.row > 0
60213
- ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.rightFrozenGroup.children[i].firstChild.row - 1)
60294
+ });
60295
+ this.rightFrozenGroup.forEachChildrenSkipChild((column) => {
60296
+ column.firstChild &&
60297
+ updateContainerChildrenY(column, column.firstChild.row > 0
60298
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, column.firstChild.row - 1)
60214
60299
  : 0);
60215
- }
60216
- for (let i = 0; i < this.leftBottomCornerGroup.children.length; i++) {
60217
- updateContainerChildrenY(this.leftBottomCornerGroup.children[i], 0);
60218
- }
60219
- for (let i = 0; i < this.bottomFrozenGroup.children.length; i++) {
60220
- updateContainerChildrenY(this.bottomFrozenGroup.children[i], 0);
60221
- }
60222
- for (let i = 0; i < this.rightBottomCornerGroup.children.length; i++) {
60223
- updateContainerChildrenY(this.rightBottomCornerGroup.children[i], 0);
60224
- }
60300
+ });
60301
+ this.leftBottomCornerGroup.forEachChildrenSkipChild((column) => {
60302
+ updateContainerChildrenY(column, 0);
60303
+ });
60304
+ this.bottomFrozenGroup.forEachChildrenSkipChild((column) => {
60305
+ updateContainerChildrenY(column, 0);
60306
+ });
60307
+ this.rightBottomCornerGroup.forEachChildrenSkipChild((column) => {
60308
+ updateContainerChildrenY(column, 0);
60309
+ });
60225
60310
  }
60226
60311
  updateContainer(updateConfig = { async: false, needUpdateCellY: false }) {
60227
60312
  if (updateConfig.async) {
@@ -73879,7 +73964,9 @@
73879
73964
  internalProps.emptyTip = null;
73880
73965
  internalProps.layoutMap.release();
73881
73966
  clearChartRenderQueue();
73882
- this.scenegraph.clearCells();
73967
+ if (!updateConfig?.skipClearCells) {
73968
+ this.scenegraph.clearCells();
73969
+ }
73883
73970
  this.scenegraph.updateComponent();
73884
73971
  this.stateManager.updateOptionSetState();
73885
73972
  this._updateSize();
@@ -75438,18 +75525,21 @@
75438
75525
  }, delay);
75439
75526
  }
75440
75527
  scrollToRow(row, animationOption) {
75441
- const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
75528
+ const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1);
75529
+ const targetRowInt = Math.floor(targetRow);
75442
75530
  this.clearCorrectTimer();
75443
75531
  if (!animationOption) {
75444
- this.scrollToCell({ row: targetRow });
75445
- this._scheduleScrollToRowCorrect(targetRow);
75532
+ this.scrollToCell({ row: targetRowInt });
75533
+ this._scheduleScrollToRowCorrect(targetRowInt);
75446
75534
  return;
75447
75535
  }
75448
75536
  const duration = !isBoolean$2(animationOption) ? animationOption?.duration ?? 3000 : 3000;
75449
75537
  this.animationManager.scrollTo({ row: targetRow }, animationOption);
75450
- this._scrollToRowCorrectTimer = setTimeout(() => {
75451
- this.scrollToRow(targetRow, false);
75452
- }, duration);
75538
+ if (targetRowInt === targetRow) {
75539
+ this._scrollToRowCorrectTimer = setTimeout(() => {
75540
+ this.scrollToRow(targetRowInt, false);
75541
+ }, duration);
75542
+ }
75453
75543
  }
75454
75544
  scrollToCol(col, animationOption) {
75455
75545
  if (!animationOption) {
@@ -80142,8 +80232,19 @@
80142
80232
  clearRowHeightCache: true
80143
80233
  }) {
80144
80234
  const internalProps = this.internalProps;
80235
+ const prevSortState = internalProps.sortState;
80236
+ const nextSortStates = Array.isArray(options.sortState)
80237
+ ? options.sortState
80238
+ : options.sortState
80239
+ ? [options.sortState]
80240
+ : [];
80241
+ const hasActiveSortState = nextSortStates.some(item => item?.field && item?.order && item.order !== 'normal');
80242
+ const shouldSkipInitialClearCells = Boolean(options.records) || (!!options.dataSource && this.dataSource !== options.dataSource);
80145
80243
  this.pluginManager.removeOrAddPlugins(options.plugins);
80146
- super.updateOption(options, updateConfig);
80244
+ super.updateOption(options, {
80245
+ ...updateConfig,
80246
+ skipClearCells: shouldSkipInitialClearCells
80247
+ });
80147
80248
  internalProps.frozenColDragHeaderMode =
80148
80249
  options.dragOrder?.frozenColDragHeaderMode ?? options.frozenColDragHeaderMode;
80149
80250
  this.pagination = options.pagination;
@@ -80181,6 +80282,13 @@
80181
80282
  if (options.dataSource && this.dataSource !== options.dataSource) {
80182
80283
  this.dataSource = options.dataSource;
80183
80284
  }
80285
+ else if (options.records &&
80286
+ options.records === internalProps.records &&
80287
+ options.sortState === prevSortState &&
80288
+ !hasActiveSortState &&
80289
+ this.dataSource instanceof CachedDataSource) {
80290
+ this._refreshCurrentRecordsForOptionUpdate(options.records);
80291
+ }
80184
80292
  else if (options.records) {
80185
80293
  this.setRecords(options.records, {
80186
80294
  sortState: options.sortState
@@ -80215,6 +80323,34 @@
80215
80323
  setTimeout(resolve, 0);
80216
80324
  });
80217
80325
  }
80326
+ _refreshCurrentRecordsForOptionUpdate(records) {
80327
+ const dataSource = this.dataSource;
80328
+ this.stateManager.endResizeIfResizing();
80329
+ clearChartRenderQueue();
80330
+ const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
80331
+ this.scenegraph.clearCells();
80332
+ this.internalProps.records = records;
80333
+ dataSource.refreshRecords(records, this.internalProps.dataConfig, this.pagination, this.internalProps.columns, getListTableRowHierarchyType(this), getHierarchyExpandLevel(this));
80334
+ this.refreshRowColCount();
80335
+ this.stateManager.initCheckedState(records);
80336
+ this.clearCellStyleCache();
80337
+ this.scenegraph.createSceneGraph();
80338
+ this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
80339
+ this._updateSize();
80340
+ const layoutOrder = this.options.componentLayoutOrder ?? ['legend', 'title'];
80341
+ layoutOrder.forEach(component => {
80342
+ if (component === 'legend') {
80343
+ this.internalProps.legends?.forEach(legend => {
80344
+ legend?.resize();
80345
+ });
80346
+ }
80347
+ else if (component === 'title') {
80348
+ this.internalProps.title?.resize();
80349
+ }
80350
+ });
80351
+ this.scenegraph.resize();
80352
+ this.render();
80353
+ }
80218
80354
  updatePagination(pagination) {
80219
80355
  if (this.pagination) {
80220
80356
  typeof pagination.currentPage === 'number' &&
@@ -86239,8 +86375,8 @@
86239
86375
  }
86240
86376
  }
86241
86377
 
86242
- function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync) {
86243
- const headerStyle = table._getCellStyle(col, row);
86378
+ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle) {
86379
+ headerStyle = headerStyle || table._getCellStyle(col, row);
86244
86380
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
86245
86381
  if (isValid$1(functionalPadding)) {
86246
86382
  padding = functionalPadding;
@@ -94145,6 +94281,7 @@
94145
94281
  const getMaxScrollTop = () => Math.max(0, this.getAllRowsHeight() - (this.scenegraph?.height ?? this.tableNoFrameHeight) - sizeTolerance);
94146
94282
  const oldMaxScrollTop = getMaxScrollTop();
94147
94283
  const isScrollToBottom = oldMaxScrollTop > 0 && this.scrollTop >= oldMaxScrollTop - 1;
94284
+ const oldScrollTop = this.scrollTop;
94148
94285
  const visibleStartRow = this.getBodyVisibleRowRange().rowStart;
94149
94286
  this.internalProps._oldRowCount = this.rowCount;
94150
94287
  this.internalProps._oldColCount = this.colCount;
@@ -94161,6 +94298,9 @@
94161
94298
  }
94162
94299
  }
94163
94300
  const isChangeRowTree = this.internalProps.layoutMap.isRowHeader(col, row);
94301
+ const oldHierarchyState = isChangeRowTree ? this.getHierarchyState(col, row) : undefined;
94302
+ const shouldKeepBottomAfterToggle = isScrollToBottom && oldHierarchyState === 'expand';
94303
+ const shouldKeepScrollAfterToggle = isChangeRowTree && !shouldKeepBottomAfterToggle;
94164
94304
  const result = isChangeRowTree
94165
94305
  ? this.internalProps.layoutMap.toggleHierarchyState(col, row)
94166
94306
  : this.internalProps.layoutMap.toggleHierarchyStateForColumnTree(col, row);
@@ -94182,16 +94322,26 @@
94182
94322
  this.clearCellStyleCache();
94183
94323
  this.scenegraph.createSceneGraph();
94184
94324
  this.scrollToRow(visibleStartRow);
94185
- if (isScrollToBottom) {
94325
+ if (shouldKeepBottomAfterToggle) {
94186
94326
  this.clearCorrectTimer();
94187
94327
  this.setScrollTop(Number.MAX_SAFE_INTEGER);
94188
94328
  }
94329
+ else if (shouldKeepScrollAfterToggle) {
94330
+ this.clearCorrectTimer();
94331
+ this.setScrollTop(oldScrollTop);
94332
+ }
94189
94333
  }
94190
94334
  this.reactCustomLayout?.updateAllCustomCell();
94191
- if (isScrollToBottom) {
94335
+ if (shouldKeepBottomAfterToggle) {
94192
94336
  this.clearCorrectTimer();
94193
94337
  this.setScrollTop(Number.MAX_SAFE_INTEGER);
94194
94338
  }
94339
+ else if (shouldKeepScrollAfterToggle &&
94340
+ this.rowHierarchyType !== 'grid-tree' &&
94341
+ this.columnHierarchyType !== 'grid-tree') {
94342
+ this.clearCorrectTimer();
94343
+ this.setScrollTop(oldScrollTop);
94344
+ }
94195
94345
  if (checkHasChart) {
94196
94346
  if (this.autoFillWidth && !notFillWidth) {
94197
94347
  notFillWidth = this.getAllColsWidth() <= this.tableNoFrameWidth;