@visactor/vtable 1.26.3 → 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 (101) 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/core/BaseTable.js +6 -4
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/core/FouseInput.js +1 -2
  7. package/cjs/core/tableHelper.d.ts +2 -0
  8. package/cjs/core/tableHelper.js +13 -8
  9. package/cjs/core/tableHelper.js.map +1 -1
  10. package/cjs/data/CachedDataSource.d.ts +1 -0
  11. package/cjs/data/CachedDataSource.js +22 -0
  12. package/cjs/data/CachedDataSource.js.map +1 -1
  13. package/cjs/dataset/DataStatistics.js +2 -1
  14. package/cjs/dataset/flatDataToObject.js +1 -2
  15. package/cjs/event/helper.js +1 -1
  16. package/cjs/event/listener/table-group.js +52 -52
  17. package/cjs/event/listener/table-group.js.map +1 -1
  18. package/cjs/event/media-click.js +1 -1
  19. package/cjs/event/scroll.js +1 -1
  20. package/cjs/event/sparkline-event.js +1 -1
  21. package/cjs/event/util.js +1 -1
  22. package/cjs/header-helper/style.js +2 -1
  23. package/cjs/index.d.ts +1 -1
  24. package/cjs/index.js +1 -1
  25. package/cjs/index.js.map +1 -1
  26. package/cjs/plugins/index.js +1 -1
  27. package/cjs/plugins/interface.js +1 -2
  28. package/cjs/plugins/invert-highlight.js +1 -1
  29. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  30. package/cjs/plugins/plugin-manager.js +1 -1
  31. package/cjs/scenegraph/component/custom.js +2 -2
  32. package/cjs/scenegraph/component/custom.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -1
  34. package/cjs/scenegraph/group-creater/cell-helper.js +5 -5
  35. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  36. package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  37. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +3 -2
  38. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  39. package/cjs/scenegraph/group-creater/column-helper.js +9 -6
  40. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  41. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  42. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  43. package/cjs/scenegraph/layout/compute-row-height.js +1 -1
  44. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  45. package/cjs/scenegraph/scenegraph.js +22 -13
  46. package/cjs/scenegraph/scenegraph.js.map +1 -1
  47. package/cjs/scenegraph/utils/text-icon-layout.js +4 -4
  48. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  49. package/cjs/vrender.js.map +1 -1
  50. package/dist/vtable.js +174 -76
  51. package/dist/vtable.min.js +1 -1
  52. package/es/ListTable.d.ts +1 -0
  53. package/es/ListTable.js +26 -6
  54. package/es/ListTable.js.map +1 -1
  55. package/es/core/BaseTable.js +4 -3
  56. package/es/core/BaseTable.js.map +1 -1
  57. package/es/core/FouseInput.js +1 -2
  58. package/es/core/tableHelper.d.ts +2 -0
  59. package/es/core/tableHelper.js +11 -7
  60. package/es/core/tableHelper.js.map +1 -1
  61. package/es/data/CachedDataSource.d.ts +1 -0
  62. package/es/data/CachedDataSource.js +22 -0
  63. package/es/data/CachedDataSource.js.map +1 -1
  64. package/es/dataset/DataStatistics.js +2 -1
  65. package/es/dataset/flatDataToObject.js +1 -2
  66. package/es/event/helper.js +1 -1
  67. package/es/event/listener/table-group.js +52 -52
  68. package/es/event/listener/table-group.js.map +1 -1
  69. package/es/event/media-click.js +1 -1
  70. package/es/event/scroll.js +1 -1
  71. package/es/event/sparkline-event.js +1 -1
  72. package/es/event/util.js +1 -1
  73. package/es/header-helper/style.js +2 -1
  74. package/es/index.d.ts +1 -1
  75. package/es/index.js +1 -1
  76. package/es/index.js.map +1 -1
  77. package/es/plugins/index.js +1 -1
  78. package/es/plugins/interface.js +1 -2
  79. package/es/plugins/invert-highlight.js +1 -1
  80. package/es/plugins/list-tree-stick-cell.js +1 -1
  81. package/es/plugins/plugin-manager.js +1 -1
  82. package/es/scenegraph/component/custom.js +2 -2
  83. package/es/scenegraph/component/custom.js.map +1 -1
  84. package/es/scenegraph/group-creater/cell-helper.d.ts +1 -1
  85. package/es/scenegraph/group-creater/cell-helper.js +5 -5
  86. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  87. package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  88. package/es/scenegraph/group-creater/cell-type/text-cell.js +3 -2
  89. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  90. package/es/scenegraph/group-creater/column-helper.js +9 -6
  91. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  92. package/es/scenegraph/layout/compute-col-width.js +1 -1
  93. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  94. package/es/scenegraph/layout/compute-row-height.js +1 -1
  95. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  96. package/es/scenegraph/scenegraph.js +22 -10
  97. package/es/scenegraph/scenegraph.js.map +1 -1
  98. package/es/scenegraph/utils/text-icon-layout.js +4 -4
  99. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  100. package/es/vrender.js.map +1 -1
  101. package/package.json +3 -3
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;
@@ -42308,17 +42343,21 @@
42308
42343
  })
42309
42344
  ];
42310
42345
  }
42311
- function _setRecords(table, records = []) {
42346
+ function getListTableRowHierarchyType(table) {
42312
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 = []) {
42313
42358
  _dealWithUpdateDataSource(table, () => {
42314
42359
  table.internalProps.records = records;
42315
- let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42316
- if (isArray$5(table.internalProps.dataConfig?.groupByRules)) {
42317
- rowHierarchyType = 'tree';
42318
- }
42319
- if (tableWithPlugins.pluginManager.getPluginByName('Master Detail Plugin')) {
42320
- rowHierarchyType = 'grid';
42321
- }
42360
+ const rowHierarchyType = getListTableRowHierarchyType(table);
42322
42361
  const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table)));
42323
42362
  table.addReleaseObj(newDataSource);
42324
42363
  });
@@ -43533,7 +43572,7 @@
43533
43572
  col: range?.start.col ?? col,
43534
43573
  row: range?.start.row ?? row,
43535
43574
  dataValue: table.getCellOriginValue(col, row),
43536
- value: table.getCellValue(col, row),
43575
+ value: table.getCellValue(col, row) || '',
43537
43576
  rect: {
43538
43577
  left: 0,
43539
43578
  top: 0,
@@ -43569,7 +43608,7 @@
43569
43608
  col,
43570
43609
  row,
43571
43610
  dataValue: table.getCellOriginValue(col, row),
43572
- value: table.getCellValue(col, row),
43611
+ value: table.getCellValue(col, row) || '',
43573
43612
  rect: {
43574
43613
  left: 0,
43575
43614
  top: 0,
@@ -44622,7 +44661,7 @@
44622
44661
  }
44623
44662
 
44624
44663
  function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
44625
- let contentWidth;
44664
+ let contentWidth = 0;
44626
44665
  let leftIconWidth = 0;
44627
44666
  let rightIconWidth = 0;
44628
44667
  let absoluteRightIconWidth = 0;
@@ -44667,8 +44706,9 @@
44667
44706
  wrapText.name = 'text';
44668
44707
  wrapText.textBaseline = textBaseline;
44669
44708
  cellGroup.appendChild(wrapText);
44670
- contentWidth = wrapText.AABBBounds.width();
44671
- wrapText.AABBBounds.height();
44709
+ if (autoColWidth) {
44710
+ contentWidth = wrapText.AABBBounds.width();
44711
+ }
44672
44712
  }
44673
44713
  }
44674
44714
  else {
@@ -44782,8 +44822,9 @@
44782
44822
  cellContent.addContent(textMark);
44783
44823
  cellGroup.appendChild(cellContent);
44784
44824
  cellContent.layout();
44785
- contentWidth = cellContent.AABBBounds.width();
44786
- cellContent.AABBBounds.height();
44825
+ if (autoColWidth) {
44826
+ contentWidth = cellContent.AABBBounds.width();
44827
+ }
44787
44828
  }
44788
44829
  else {
44789
44830
  if (cellGroup.firstChild) {
@@ -44792,8 +44833,9 @@
44792
44833
  else {
44793
44834
  cellGroup.appendChild(textMark);
44794
44835
  }
44795
- contentWidth = textMark.AABBBounds.width();
44796
- textMark.AABBBounds.height();
44836
+ if (autoColWidth) {
44837
+ contentWidth = textMark.AABBBounds.width();
44838
+ }
44797
44839
  }
44798
44840
  }
44799
44841
  const width = autoColWidth
@@ -45679,7 +45721,7 @@
45679
45721
  }
45680
45722
  }
45681
45723
 
45682
- 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) {
45683
45725
  let isAsync = false;
45684
45726
  let cellGroup;
45685
45727
  if (isPromise(value)) {
@@ -45728,7 +45770,7 @@
45728
45770
  }
45729
45771
  const { customElementsGroup, renderDefault } = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult);
45730
45772
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45731
- 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);
45732
45774
  const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
45733
45775
  if (axisConfig) {
45734
45776
  const CartesianAxis = Factory.getComponent('axis');
@@ -45766,7 +45808,7 @@
45766
45808
  const style = table._getCellStyle(col, row);
45767
45809
  const dataValue = table.getCellOriginValue(col, row);
45768
45810
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45769
- 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);
45770
45812
  const createProgressBarCell = Factory.getFunction('createProgressBarCell');
45771
45813
  const progressBarGroup = createProgressBarCell(define, style, colWidth, value, dataValue, col, row, padding, table, range);
45772
45814
  if (cellGroup.firstChild) {
@@ -45784,7 +45826,7 @@
45784
45826
  const isAggregation = 'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
45785
45827
  if (isAggregation) {
45786
45828
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45787
- 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);
45788
45830
  }
45789
45831
  else {
45790
45832
  const createCheckboxCellGroup = Factory.getFunction('createCheckboxCellGroup');
@@ -45795,7 +45837,7 @@
45795
45837
  const isAggregation = 'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
45796
45838
  if (isAggregation) {
45797
45839
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45798
- 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);
45799
45841
  }
45800
45842
  else {
45801
45843
  const createRadioCellGroup = Factory.getFunction('createRadioCellGroup');
@@ -47012,7 +47054,7 @@
47012
47054
  col: cellRange?.start.col ?? col,
47013
47055
  row: cellRange?.start.row ?? row,
47014
47056
  dataValue: table.getCellOriginValue(col, row),
47015
- value: table.getCellValue(col, row),
47057
+ value: table.getCellValue(col, row) || '',
47016
47058
  rect: getCellRect$1(col, row, table),
47017
47059
  table,
47018
47060
  originCol: col,
@@ -53567,7 +53609,7 @@
53567
53609
  col: cellRange?.start.col ?? col,
53568
53610
  row: cellRange?.start.row ?? row,
53569
53611
  dataValue: table.getCellOriginValue(col, row),
53570
- value: table.getCellValue(col, row),
53612
+ value: table.getCellValue(col, row) || '',
53571
53613
  rect: getCellRect(col, row, table),
53572
53614
  table,
53573
53615
  originCol: col,
@@ -53972,6 +54014,7 @@
53972
54014
  let customStyle;
53973
54015
  let customResult;
53974
54016
  let isCustomMerge = false;
54017
+ let rawRecord;
53975
54018
  if (table.internalProps.customMergeCell) {
53976
54019
  const customMerge = table.getCustomMerge(col, row);
53977
54020
  if (customMerge) {
@@ -54021,8 +54064,19 @@
54021
54064
  !(isAggregation && isSeriesNumber);
54022
54065
  if (!range &&
54023
54066
  (table.internalProps.enableTreeNodeMerge || cellLocation !== 'body' || define?.mergeCell)) {
54024
- range = table.getCellRange(col, row);
54025
- 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
+ }
54026
54080
  if (isMerge) {
54027
54081
  const needUpdateRange = rowStart > range.start.row;
54028
54082
  const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
@@ -54032,7 +54086,7 @@
54032
54086
  }
54033
54087
  let isVtableMerge = false;
54034
54088
  if (table.internalProps.enableTreeNodeMerge && isMerge) {
54035
- const rawRecord = table.getCellRawRecord(range.start.col, range.start.row);
54089
+ rawRecord = rawRecord ?? table.getCellRawRecord(range.start.col, range.start.row);
54036
54090
  const { vtableMergeName, vtableMerge } = rawRecord ?? {};
54037
54091
  isVtableMerge = vtableMerge;
54038
54092
  if (vtableMerge) {
@@ -54093,7 +54147,7 @@
54093
54147
  if (cellLocation !== 'body' && !cellTheme.group.fill) {
54094
54148
  cellTheme.group.fill = '#fff';
54095
54149
  }
54096
- 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);
54097
54151
  columnGroup.updateColumnRowNumber(row);
54098
54152
  if (isMerge) {
54099
54153
  const rangeHeight = table.getRowHeight(row);
@@ -54143,7 +54197,7 @@
54143
54197
  if (cellLocation !== 'body' && !cellTheme.group.fill) {
54144
54198
  cellTheme.group.fill = '#fff';
54145
54199
  }
54146
- 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);
54147
54201
  }
54148
54202
  function dealMerge(range, mergeMap, table, forceUpdate) {
54149
54203
  let cellWidth = 0;
@@ -60217,42 +60271,42 @@
60217
60271
  this.updateNextFrame();
60218
60272
  }
60219
60273
  updateContainerAttrHeightAndY() {
60220
- for (let i = 0; i < this.cornerHeaderGroup.children.length; i++) {
60221
- updateContainerChildrenY(this.cornerHeaderGroup.children[i], 0);
60222
- }
60223
- for (let i = 0; i < this.colHeaderGroup.children.length; i++) {
60224
- updateContainerChildrenY(this.colHeaderGroup.children[i], 0);
60225
- }
60226
- for (let i = 0; i < this.rightTopCornerGroup.children.length; i++) {
60227
- updateContainerChildrenY(this.rightTopCornerGroup.children[i], 0);
60228
- }
60229
- for (let i = 0; i < this.rowHeaderGroup.children.length; i++) {
60230
- this.rowHeaderGroup.children[i].firstChild &&
60231
- updateContainerChildrenY(this.rowHeaderGroup.children[i], this.rowHeaderGroup.children[i].firstChild.row > 0
60232
- ? 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)
60233
60287
  : 0);
60234
- }
60235
- for (let i = 0; i < this.bodyGroup.children.length; i++) {
60236
- this.bodyGroup.children[i].firstChild &&
60237
- updateContainerChildrenY(this.bodyGroup.children[i], this.bodyGroup.children[i].firstChild.row > 0
60238
- ? 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)
60239
60293
  : 0);
60240
- }
60241
- for (let i = 0; i < this.rightFrozenGroup.children.length; i++) {
60242
- this.rightFrozenGroup.children[i].firstChild &&
60243
- updateContainerChildrenY(this.rightFrozenGroup.children[i], this.rightFrozenGroup.children[i].firstChild.row > 0
60244
- ? 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)
60245
60299
  : 0);
60246
- }
60247
- for (let i = 0; i < this.leftBottomCornerGroup.children.length; i++) {
60248
- updateContainerChildrenY(this.leftBottomCornerGroup.children[i], 0);
60249
- }
60250
- for (let i = 0; i < this.bottomFrozenGroup.children.length; i++) {
60251
- updateContainerChildrenY(this.bottomFrozenGroup.children[i], 0);
60252
- }
60253
- for (let i = 0; i < this.rightBottomCornerGroup.children.length; i++) {
60254
- updateContainerChildrenY(this.rightBottomCornerGroup.children[i], 0);
60255
- }
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
+ });
60256
60310
  }
60257
60311
  updateContainer(updateConfig = { async: false, needUpdateCellY: false }) {
60258
60312
  if (updateConfig.async) {
@@ -65166,19 +65220,15 @@
65166
65220
  if (e.button !== 0) {
65167
65221
  return;
65168
65222
  }
65169
- const endedResizeCol = stateManager.isResizeCol();
65170
- const endedResizeRow = stateManager.isResizeRow();
65171
- const endedMoveCol = stateManager.isMoveCol();
65172
- const shouldSkipClickCell = endedResizeCol || endedResizeRow;
65173
65223
  if (stateManager.interactionState === 'grabing') {
65174
65224
  stateManager.updateInteractionState(InteractionState.default);
65175
- if (endedResizeCol) {
65225
+ if (stateManager.isResizeCol()) {
65176
65226
  endResizeCol(table);
65177
65227
  }
65178
- else if (endedResizeRow) {
65228
+ else if (stateManager.isResizeRow()) {
65179
65229
  endResizeRow(table);
65180
65230
  }
65181
- else if (endedMoveCol) {
65231
+ else if (stateManager.isMoveCol()) {
65182
65232
  const endMoveColSuccess = table.stateManager.endMoveCol();
65183
65233
  fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
65184
65234
  }
@@ -65208,7 +65258,7 @@
65208
65258
  else if (stateManager.interactionState === InteractionState.scrolling) {
65209
65259
  stateManager.updateInteractionState(InteractionState.default);
65210
65260
  }
65211
- if (!table.eventManager.isDraging && !shouldSkipClickCell) {
65261
+ if (!table.eventManager.isDraging) {
65212
65262
  const eventArgsSet = getEventArgsSet(e);
65213
65263
  if (!eventManager.isTouchMove &&
65214
65264
  e.button === 0 &&
@@ -72059,7 +72109,7 @@
72059
72109
  return TABLE_EVENT_TYPE;
72060
72110
  }
72061
72111
  options;
72062
- version = "1.26.3";
72112
+ version = "1.26.2";
72063
72113
  pagination;
72064
72114
  id = `VTable${Date.now()}`;
72065
72115
  headerStyleCache;
@@ -73914,7 +73964,9 @@
73914
73964
  internalProps.emptyTip = null;
73915
73965
  internalProps.layoutMap.release();
73916
73966
  clearChartRenderQueue();
73917
- this.scenegraph.clearCells();
73967
+ if (!updateConfig?.skipClearCells) {
73968
+ this.scenegraph.clearCells();
73969
+ }
73918
73970
  this.scenegraph.updateComponent();
73919
73971
  this.stateManager.updateOptionSetState();
73920
73972
  this._updateSize();
@@ -80180,8 +80232,19 @@
80180
80232
  clearRowHeightCache: true
80181
80233
  }) {
80182
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);
80183
80243
  this.pluginManager.removeOrAddPlugins(options.plugins);
80184
- super.updateOption(options, updateConfig);
80244
+ super.updateOption(options, {
80245
+ ...updateConfig,
80246
+ skipClearCells: shouldSkipInitialClearCells
80247
+ });
80185
80248
  internalProps.frozenColDragHeaderMode =
80186
80249
  options.dragOrder?.frozenColDragHeaderMode ?? options.frozenColDragHeaderMode;
80187
80250
  this.pagination = options.pagination;
@@ -80219,6 +80282,13 @@
80219
80282
  if (options.dataSource && this.dataSource !== options.dataSource) {
80220
80283
  this.dataSource = options.dataSource;
80221
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
+ }
80222
80292
  else if (options.records) {
80223
80293
  this.setRecords(options.records, {
80224
80294
  sortState: options.sortState
@@ -80253,6 +80323,34 @@
80253
80323
  setTimeout(resolve, 0);
80254
80324
  });
80255
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
+ }
80256
80354
  updatePagination(pagination) {
80257
80355
  if (this.pagination) {
80258
80356
  typeof pagination.currentPage === 'number' &&
@@ -86277,8 +86375,8 @@
86277
86375
  }
86278
86376
  }
86279
86377
 
86280
- function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync) {
86281
- 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);
86282
86380
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
86283
86381
  if (isValid$1(functionalPadding)) {
86284
86382
  padding = functionalPadding;
@@ -96723,7 +96821,7 @@
96723
96821
  }
96724
96822
 
96725
96823
  registerForVrender();
96726
- const version = "1.26.3";
96824
+ const version = "1.26.2";
96727
96825
  function getIcons() {
96728
96826
  return get$2();
96729
96827
  }