@visactor/vtable 1.26.5 → 1.26.6

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 (93) hide show
  1. package/cjs/ListTable.d.ts +4 -1
  2. package/cjs/ListTable.js +17 -3
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/body-helper/body-helper.d.ts +1 -0
  5. package/cjs/body-helper/body-helper.js +4 -3
  6. package/cjs/body-helper/body-helper.js.map +1 -1
  7. package/cjs/components/index.js +2 -1
  8. package/cjs/core/BaseTable.d.ts +1 -0
  9. package/cjs/core/BaseTable.js +20 -10
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/core/row-series-number-helper.d.ts +1 -0
  12. package/cjs/core/row-series-number-helper.js +3 -1
  13. package/cjs/core/row-series-number-helper.js.map +1 -1
  14. package/cjs/data/CachedDataSource.js +5 -3
  15. package/cjs/data/CachedDataSource.js.map +1 -1
  16. package/cjs/header-helper/header-helper.d.ts +1 -0
  17. package/cjs/header-helper/header-helper.js +4 -3
  18. package/cjs/header-helper/header-helper.js.map +1 -1
  19. package/cjs/index.d.ts +1 -1
  20. package/cjs/index.js +1 -1
  21. package/cjs/index.js.map +1 -1
  22. package/cjs/layout/index.js +2 -1
  23. package/cjs/plugins/interface.d.ts +2 -1
  24. package/cjs/plugins/interface.js.map +1 -1
  25. package/cjs/plugins/plugin-manager.d.ts +1 -1
  26. package/cjs/plugins/plugin-manager.js +11 -6
  27. package/cjs/plugins/plugin-manager.js.map +1 -1
  28. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +24 -8
  29. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  30. package/cjs/scenegraph/layout/compute-row-height.js +15 -4
  31. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  32. package/cjs/scenegraph/layout/update-row.js +24 -3
  33. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  34. package/cjs/scenegraph/scenegraph.js +42 -20
  35. package/cjs/scenegraph/scenegraph.js.map +1 -1
  36. package/cjs/scenegraph/utils/text-icon-layout.js +4 -3
  37. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  38. package/cjs/state/checkbox/checkbox.d.ts +3 -0
  39. package/cjs/state/checkbox/checkbox.js +138 -2
  40. package/cjs/state/checkbox/checkbox.js.map +1 -1
  41. package/cjs/ts-types/base-table.d.ts +1 -0
  42. package/cjs/ts-types/base-table.js.map +1 -1
  43. package/cjs/ts-types/table-engine.d.ts +7 -1
  44. package/cjs/ts-types/table-engine.js.map +1 -1
  45. package/cjs/vrender.js.map +1 -1
  46. package/dist/vtable.js +404 -45
  47. package/dist/vtable.min.js +1 -1
  48. package/es/ListTable.d.ts +4 -1
  49. package/es/ListTable.js +17 -4
  50. package/es/ListTable.js.map +1 -1
  51. package/es/body-helper/body-helper.d.ts +1 -0
  52. package/es/body-helper/body-helper.js +4 -3
  53. package/es/body-helper/body-helper.js.map +1 -1
  54. package/es/components/index.js +2 -1
  55. package/es/core/BaseTable.d.ts +1 -0
  56. package/es/core/BaseTable.js +22 -12
  57. package/es/core/BaseTable.js.map +1 -1
  58. package/es/core/row-series-number-helper.d.ts +1 -0
  59. package/es/core/row-series-number-helper.js +3 -1
  60. package/es/core/row-series-number-helper.js.map +1 -1
  61. package/es/data/CachedDataSource.js +5 -3
  62. package/es/data/CachedDataSource.js.map +1 -1
  63. package/es/header-helper/header-helper.d.ts +1 -0
  64. package/es/header-helper/header-helper.js +4 -3
  65. package/es/header-helper/header-helper.js.map +1 -1
  66. package/es/index.d.ts +1 -1
  67. package/es/index.js +1 -1
  68. package/es/index.js.map +1 -1
  69. package/es/layout/index.js +2 -1
  70. package/es/plugins/interface.d.ts +2 -1
  71. package/es/plugins/interface.js.map +1 -1
  72. package/es/plugins/plugin-manager.d.ts +1 -1
  73. package/es/plugins/plugin-manager.js +11 -6
  74. package/es/plugins/plugin-manager.js.map +1 -1
  75. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +24 -8
  76. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  77. package/es/scenegraph/layout/compute-row-height.js +15 -4
  78. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  79. package/es/scenegraph/layout/update-row.js +25 -2
  80. package/es/scenegraph/layout/update-row.js.map +1 -1
  81. package/es/scenegraph/scenegraph.js +42 -20
  82. package/es/scenegraph/scenegraph.js.map +1 -1
  83. package/es/scenegraph/utils/text-icon-layout.js +7 -6
  84. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  85. package/es/state/checkbox/checkbox.d.ts +3 -0
  86. package/es/state/checkbox/checkbox.js +133 -0
  87. package/es/state/checkbox/checkbox.js.map +1 -1
  88. package/es/ts-types/base-table.d.ts +1 -0
  89. package/es/ts-types/base-table.js.map +1 -1
  90. package/es/ts-types/table-engine.d.ts +7 -1
  91. package/es/ts-types/table-engine.js.map +1 -1
  92. package/es/vrender.js.map +1 -1
  93. package/package.json +4 -4
package/dist/vtable.js CHANGED
@@ -54828,6 +54828,9 @@
54828
54828
  continue;
54829
54829
  }
54830
54830
  const originRecordIndex = this.getOriginRecordIndexForGroup(recordIndex);
54831
+ if (!isValid$1(originRecordIndex)) {
54832
+ continue;
54833
+ }
54831
54834
  this.beforeChangedRecordsMap.delete(originRecordIndex.toString());
54832
54835
  this.dataSourceObj.records.splice(originRecordIndex, 1);
54833
54836
  this.sourceLength -= 1;
@@ -54842,6 +54845,9 @@
54842
54845
  continue;
54843
54846
  }
54844
54847
  const originRecordIndex = this.getOriginRecordIndexForGroup(recordIndex);
54848
+ if (!isValid$1(originRecordIndex)) {
54849
+ continue;
54850
+ }
54845
54851
  this.beforeChangedRecordsMap.delete(originRecordIndex.toString());
54846
54852
  this.dataSourceObj.records[originRecordIndex] = records[index];
54847
54853
  }
@@ -57743,17 +57749,25 @@
57743
57749
  if ('shape' in icon && icon.shape === 'circle') {
57744
57750
  iconAttribute.shape = icon.shape;
57745
57751
  }
57752
+ if (icon.type === 'text') {
57753
+ iconAttribute.text = icon.content;
57754
+ merge(iconAttribute, icon.style);
57755
+ }
57756
+ if (isNil$1(iconAttribute.opacity)) {
57757
+ iconAttribute.opacity =
57758
+ iconAttribute.visibleTime === 'mouseenter_cell' || iconAttribute.visibleTime === 'click_cell' ? 0 : 1;
57759
+ }
57746
57760
  if (mark) {
57747
57761
  mark.setAttributes(iconAttribute);
57748
- mark.loadImage(iconAttribute.image);
57762
+ if (iconAttribute.image) {
57763
+ mark.loadImage(iconAttribute.image);
57764
+ }
57749
57765
  mark.tooltip = icon.tooltip;
57750
57766
  mark.name = icon.name;
57751
57767
  return mark;
57752
57768
  }
57753
57769
  let iconMark;
57754
57770
  if (icon.type === 'text') {
57755
- iconAttribute.text = icon.content;
57756
- merge(iconAttribute, icon.style);
57757
57771
  iconMark = new TextIcon(iconAttribute);
57758
57772
  iconMark.tooltip = icon.tooltip;
57759
57773
  iconMark.name = icon.name;
@@ -59497,22 +59511,41 @@
59497
59511
  }
59498
59512
  }
59499
59513
  function computeRowHeight(row, startCol, endCol, table) {
59514
+ return computeRowHeightInternal(row, startCol, endCol, table, true);
59515
+ }
59516
+ function computeRowHeightInternal(row, startCol, endCol, table, enableCustomCompute) {
59500
59517
  const isAllRowsAuto = table.isAutoRowHeight(row) || (table.heightMode === 'adaptive' && table.options.autoHeightInAdaptiveMode !== false);
59501
59518
  if (!isAllRowsAuto && table.getDefaultRowHeight(row) !== 'auto') {
59502
59519
  return table.getDefaultRowHeight(row);
59503
59520
  }
59504
59521
  let maxHeight;
59505
- if (table.options.customComputeRowHeight) {
59506
- const customRowHeight = table.options.customComputeRowHeight({
59522
+ if (enableCustomCompute && table.options.customComputeRowHeight) {
59523
+ let realHeight;
59524
+ let hasRealHeight = false;
59525
+ const getRealHeight = () => {
59526
+ if (!hasRealHeight) {
59527
+ realHeight = computeRowHeightInternal(row, startCol, endCol, table, false);
59528
+ hasRealHeight = true;
59529
+ }
59530
+ return realHeight;
59531
+ };
59532
+ const computeArgs = {
59507
59533
  row,
59508
59534
  table
59535
+ };
59536
+ Object.defineProperty(computeArgs, 'realHeight', {
59537
+ get: getRealHeight,
59538
+ enumerable: false,
59539
+ configurable: true
59509
59540
  });
59541
+ const customRowHeight = table.options.customComputeRowHeight(computeArgs);
59510
59542
  if (typeof customRowHeight === 'number') {
59511
59543
  return customRowHeight;
59512
59544
  }
59513
- else if (customRowHeight !== 'auto') {
59514
- return table.getDefaultRowHeight(row);
59545
+ else if (customRowHeight === 'auto') {
59546
+ return getRealHeight();
59515
59547
  }
59548
+ return table.getDefaultRowHeight(row);
59516
59549
  }
59517
59550
  if (table.internalProps.rowHeightConfig) {
59518
59551
  const rowHeightConfig = table.internalProps.rowHeightConfig.find((item) => item.key === row);
@@ -63146,6 +63179,25 @@
63146
63179
  containerGroup.setAttribute('height', heightMax);
63147
63180
  }
63148
63181
 
63182
+ function fillVisibleBodyRows$1(proxy, distRow) {
63183
+ const { table } = proxy;
63184
+ const bodyBottomRow = table.rowCount - 1 - table.bottomFrozenRowCount;
63185
+ const visibleBodyHeight = table.tableNoFrameHeight - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
63186
+ let targetRow = distRow;
63187
+ while (targetRow < bodyBottomRow && table.getRowsHeight(table.frozenRowCount, targetRow) < visibleBodyHeight) {
63188
+ const nextRow = targetRow + 1;
63189
+ computeRowsHeight(table, nextRow, nextRow, false);
63190
+ targetRow = nextRow;
63191
+ }
63192
+ return targetRow;
63193
+ }
63194
+ function syncVisibleBodyRows(proxy, targetRow) {
63195
+ if (targetRow <= proxy.totalRow) {
63196
+ return;
63197
+ }
63198
+ proxy.totalRow = targetRow;
63199
+ proxy.totalActualBodyRowCount = Math.max(proxy.totalActualBodyRowCount, targetRow - proxy.bodyTopRow + 1);
63200
+ }
63149
63201
  function createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin, proxy) {
63150
63202
  const { table } = proxy;
63151
63203
  const { leftBottomCornerGroup, rightTopCornerGroup, rightBottomCornerGroup } = table.scenegraph;
@@ -63171,6 +63223,7 @@
63171
63223
  else {
63172
63224
  distRow = Math.min(proxy.firstScreenRowLimit - 1, table.rowCount - 1);
63173
63225
  }
63226
+ let bodyDistRow = Math.min(proxy.bodyBottomRow, distRow - table.bottomFrozenRowCount);
63174
63227
  if (table.internalProps._widthResizedColMap.size === 0) {
63175
63228
  computeColsWidth(table, 0, distColForCompute ?? distCol);
63176
63229
  }
@@ -63178,6 +63231,10 @@
63178
63231
  computeRowsHeight(table, 0, table.options.canvasHeight === 'auto' || table.options.customConfig?.forceComputeAllRowHeight
63179
63232
  ? table.rowCount - 1
63180
63233
  : distRowForCompute ?? distRow);
63234
+ if (table.heightMode === 'autoHeight') {
63235
+ bodyDistRow = fillVisibleBodyRows$1(proxy, bodyDistRow);
63236
+ syncVisibleBodyRows(proxy, bodyDistRow);
63237
+ }
63181
63238
  }
63182
63239
  if (distCol < table.colCount - table.rightFrozenColCount) {
63183
63240
  if (table.colCount - table.rightFrozenColCount <= table.colCount - 1) {
@@ -63202,13 +63259,13 @@
63202
63259
  createColGroup(colHeaderGroup, xOrigin, yOrigin, table.frozenColCount, distCol - table.rightFrozenColCount, 0, table.frozenRowCount - 1, 'columnHeader', table);
63203
63260
  if (table.frozenColCount > 0) {
63204
63261
  if (table.leftRowSeriesNumberCount > 0) {
63205
- createColGroup(rowHeaderGroup, xOrigin, yOrigin, 0, table.leftRowSeriesNumberCount - 1, table.frozenRowCount, distRow - table.bottomFrozenRowCount, 'rowHeader', table);
63262
+ createColGroup(rowHeaderGroup, xOrigin, yOrigin, 0, table.leftRowSeriesNumberCount - 1, table.frozenRowCount, bodyDistRow, 'rowHeader', table);
63206
63263
  }
63207
63264
  if (table.frozenColCount > table.leftRowSeriesNumberCount) {
63208
- createColGroup(rowHeaderGroup, xOrigin, yOrigin, table.leftRowSeriesNumberCount, Math.min(table.frozenColCount - 1, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount - 1), table.frozenRowCount, distRow - table.bottomFrozenRowCount, 'rowHeader', table);
63265
+ createColGroup(rowHeaderGroup, xOrigin, yOrigin, table.leftRowSeriesNumberCount, Math.min(table.frozenColCount - 1, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount - 1), table.frozenRowCount, bodyDistRow, 'rowHeader', table);
63209
63266
  }
63210
63267
  if (table.frozenColCount > table.rowHeaderLevelCount + table.leftRowSeriesNumberCount) {
63211
- createColGroup(rowHeaderGroup, xOrigin, yOrigin, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, table.frozenColCount - 1, table.frozenRowCount, distRow - table.bottomFrozenRowCount, 'body', table);
63268
+ createColGroup(rowHeaderGroup, xOrigin, yOrigin, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, table.frozenColCount - 1, table.frozenRowCount, bodyDistRow, 'body', table);
63212
63269
  }
63213
63270
  }
63214
63271
  if (table.bottomFrozenRowCount > 0) {
@@ -63228,13 +63285,13 @@
63228
63285
  }
63229
63286
  if (table.rightFrozenColCount > 0) {
63230
63287
  createColGroup(rightTopCornerGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, 0, table.frozenRowCount - 1, 'columnHeader', table);
63231
- createColGroup(rightFrozenGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, table.frozenRowCount, distRow - table.bottomFrozenRowCount, table.isPivotChart() ? 'rowHeader' : 'body', table);
63288
+ createColGroup(rightFrozenGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, table.frozenRowCount, bodyDistRow, table.isPivotChart() ? 'rowHeader' : 'body', table);
63232
63289
  }
63233
63290
  if (table.bottomFrozenRowCount > 0 && table.rightFrozenColCount > 0) {
63234
63291
  createColGroup(rightBottomCornerGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, table.rowCount - 1 - table.bottomFrozenRowCount + 1, table.rowCount - 1, 'body', table);
63235
63292
  }
63236
63293
  distCol - table.rightFrozenColCount >= table.frozenColCount &&
63237
- createColGroup(bodyGroup, xOrigin, yOrigin, table.frozenColCount, distCol - table.rightFrozenColCount, table.frozenRowCount, distRow - table.bottomFrozenRowCount, 'body', table);
63294
+ createColGroup(bodyGroup, xOrigin, yOrigin, table.frozenColCount, distCol - table.rightFrozenColCount, table.frozenRowCount, bodyDistRow, 'body', table);
63238
63295
  if (!bodyGroup.firstChild &&
63239
63296
  !colHeaderGroup.firstChild &&
63240
63297
  !cornerHeaderGroup.firstChild &&
@@ -65468,6 +65525,11 @@
65468
65525
  updateAfter = updateAfter ?? needUpdateAfter;
65469
65526
  rowHeightsMap.insert(row);
65470
65527
  });
65528
+ const filledVisibleRowStart = fillVisibleBodyRows(scene);
65529
+ if (isNumber$3(filledVisibleRowStart)) {
65530
+ updateAfter = updateAfter ?? filledVisibleRowStart;
65531
+ rowUpdatePos = isValid$1(rowUpdatePos) ? Math.min(rowUpdatePos, filledVisibleRowStart) : filledVisibleRowStart;
65532
+ }
65471
65533
  resetRowNumberAndY(scene);
65472
65534
  if (addRows.length) {
65473
65535
  const beforeRow = addRows[0] - 1;
@@ -65612,6 +65674,34 @@
65612
65674
  }
65613
65675
  return row;
65614
65676
  }
65677
+ function fillVisibleBodyRows(scene) {
65678
+ const { table, proxy } = scene;
65679
+ if (table.heightMode !== 'autoHeight') {
65680
+ return undefined;
65681
+ }
65682
+ const bodyBottomRow = table.rowCount - 1 - table.bottomFrozenRowCount;
65683
+ const visibleBodyHeight = table.tableNoFrameHeight - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
65684
+ let targetRow = Math.min(proxy.rowEnd, bodyBottomRow);
65685
+ computeRowsHeight(table, proxy.rowStart, targetRow, false);
65686
+ while (targetRow < bodyBottomRow && table.getRowsHeight(table.frozenRowCount, targetRow) < visibleBodyHeight) {
65687
+ const nextRow = targetRow + 1;
65688
+ computeRowsHeight(table, nextRow, nextRow, false);
65689
+ targetRow = nextRow;
65690
+ }
65691
+ if (targetRow <= proxy.rowEnd) {
65692
+ return undefined;
65693
+ }
65694
+ const startRow = proxy.rowEnd + 1;
65695
+ for (let row = startRow; row <= targetRow; row++) {
65696
+ addRowCellGroup(row, scene);
65697
+ }
65698
+ proxy.rowEnd = targetRow;
65699
+ proxy.currentRow = Math.max(proxy.currentRow, targetRow);
65700
+ proxy.totalRow = Math.max(proxy.totalRow, targetRow);
65701
+ proxy.totalActualBodyRowCount = Math.max(proxy.totalActualBodyRowCount, targetRow - proxy.rowStart + 1);
65702
+ proxy.rowUpdatePos = Math.min(proxy.rowUpdatePos, startRow);
65703
+ return startRow;
65704
+ }
65615
65705
  function resetRowNumber(scene) {
65616
65706
  scene.bodyGroup.forEachChildren((colGroup) => {
65617
65707
  let rowIndex = scene.bodyRowStart;
@@ -68704,32 +68794,65 @@
68704
68794
  }
68705
68795
  }
68706
68796
  }
68707
- if (this.table.bottomFrozenRowCount > 0) {
68708
- this.bottomFrozenGroup.setAttribute('y', this.tableGroup.attribute.height - this.table.getBottomFrozenRowsHeight());
68797
+ const hasFrozenCols = this.table.frozenColCount > 0;
68798
+ const hasRightFrozenCols = this.table.rightFrozenColCount > 0;
68799
+ const hasFrozenRows = this.table.frozenRowCount > 0;
68800
+ const hasBottomFrozenRows = this.table.bottomFrozenRowCount > 0;
68801
+ if (hasBottomFrozenRows) {
68802
+ const bottomFrozenRowsHeight = this.table.getBottomFrozenRowsHeight();
68803
+ const topFrozenBottom = Math.max(this.colHeaderGroup.attribute.y + this.colHeaderGroup.attribute.height, this.cornerHeaderGroup.attribute.y + this.cornerHeaderGroup.attribute.height, this.rightTopCornerGroup.attribute.y + this.rightTopCornerGroup.attribute.height);
68804
+ const middleContentBottom = Math.max(this.rowHeaderGroup.attribute.y + this.rowHeaderGroup.attribute.height, this.bodyGroup.attribute.y + this.bodyGroup.attribute.height, this.rightFrozenGroup.attribute.y + this.rightFrozenGroup.attribute.height, topFrozenBottom);
68805
+ const bottomFrozenY = Math.min(this.tableGroup.attribute.height - bottomFrozenRowsHeight, middleContentBottom);
68806
+ this.bottomFrozenGroup.setAttribute('y', bottomFrozenY);
68709
68807
  this.leftBottomCornerGroup.setAttributes({
68710
- visible: true,
68711
- y: this.tableGroup.attribute.height - this.table.getBottomFrozenRowsHeight(),
68712
- height: this.table.getBottomFrozenRowsHeight(),
68713
- width: this.table.getFrozenColsWidth()
68808
+ visible: hasFrozenCols,
68809
+ y: bottomFrozenY,
68810
+ height: bottomFrozenRowsHeight,
68811
+ width: hasFrozenCols ? this.table.getFrozenColsWidth() : 0
68714
68812
  });
68715
68813
  this.rightBottomCornerGroup.setAttributes({
68716
- visible: true,
68717
- y: this.tableGroup.attribute.height - this.table.getBottomFrozenRowsHeight(),
68718
- height: this.table.getBottomFrozenRowsHeight()
68814
+ visible: hasRightFrozenCols,
68815
+ x: 0,
68816
+ y: bottomFrozenY,
68817
+ width: 0,
68818
+ height: bottomFrozenRowsHeight
68719
68819
  });
68720
68820
  }
68721
- if (this.table.rightFrozenColCount > 0) {
68722
- this.rightFrozenGroup.setAttribute('x', this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth());
68821
+ else {
68822
+ this.leftBottomCornerGroup.setAttributes({
68823
+ visible: false,
68824
+ width: 0,
68825
+ height: 0
68826
+ });
68827
+ this.rightBottomCornerGroup.setAttributes({
68828
+ visible: false,
68829
+ width: 0,
68830
+ height: 0
68831
+ });
68832
+ }
68833
+ if (hasRightFrozenCols) {
68834
+ const rightFrozenColsWidth = this.table.getRightFrozenColsWidth();
68835
+ const middleContentRight = Math.max(this.colHeaderGroup.attribute.x + this.colHeaderGroup.attribute.width, this.bodyGroup.attribute.x + this.bodyGroup.attribute.width, this.bottomFrozenGroup.attribute.x + this.bottomFrozenGroup.attribute.width);
68836
+ const rightFrozenX = Math.min(this.tableGroup.attribute.width - rightFrozenColsWidth, middleContentRight);
68837
+ this.rightFrozenGroup.setAttribute('x', rightFrozenX);
68723
68838
  this.rightTopCornerGroup.setAttributes({
68724
- visible: true,
68725
- x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(),
68726
- width: this.table.getRightFrozenColsWidth(),
68727
- height: this.table.getFrozenRowsHeight()
68839
+ visible: hasFrozenRows,
68840
+ x: rightFrozenX,
68841
+ width: hasFrozenRows ? rightFrozenColsWidth : 0,
68842
+ height: hasFrozenRows ? this.table.getFrozenRowsHeight() : 0
68728
68843
  });
68729
68844
  this.rightBottomCornerGroup.setAttributes({
68730
- visible: true,
68731
- x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(),
68732
- width: this.table.getRightFrozenColsWidth()
68845
+ visible: hasBottomFrozenRows,
68846
+ x: rightFrozenX,
68847
+ width: hasBottomFrozenRows ? rightFrozenColsWidth : 0,
68848
+ height: hasBottomFrozenRows ? this.table.getBottomFrozenRowsHeight() : 0
68849
+ });
68850
+ }
68851
+ else {
68852
+ this.rightTopCornerGroup.setAttributes({
68853
+ visible: false,
68854
+ width: 0,
68855
+ height: 0
68733
68856
  });
68734
68857
  }
68735
68858
  this.updateDomContainer();
@@ -71573,6 +71696,25 @@
71573
71696
  }
71574
71697
  }
71575
71698
  }
71699
+ function setCheckboxStateByRecordIndex(recordIndex, field, checked, table) {
71700
+ setRecordCheckboxState(recordIndex, field, checked, table.stateManager.checkedState);
71701
+ if (table.internalProps.enableCheckboxCascade && checked !== 'indeterminate') {
71702
+ updateChildrenCheckboxStateByRecordIndex(recordIndex, field, checked, table);
71703
+ updateParentCheckboxStateByRecordIndex(recordIndex, field, table);
71704
+ }
71705
+ updateVisibleCheckboxCellByRecordIndex(recordIndex, field, checked, table);
71706
+ updateHeaderCheckboxStateByField(field, table);
71707
+ renderCheckboxStateUpdate(table);
71708
+ }
71709
+ function clearCheckboxState(field, table) {
71710
+ if (!isValid$1(field)) {
71711
+ return;
71712
+ }
71713
+ clearRecordCheckboxState(table.records, field, table);
71714
+ updateVisibleCheckboxCellsByField(field, false, table);
71715
+ updateHeaderCheckboxStateByField(field, table);
71716
+ renderCheckboxStateUpdate(table);
71717
+ }
71576
71718
  function setCellCheckboxStateByAttribute(col, row, checked, table) {
71577
71719
  const cellGroup = table.scenegraph.getCell(col, row);
71578
71720
  const checkbox = cellGroup?.getChildByName('checkbox') ||
@@ -71657,6 +71799,186 @@
71657
71799
  });
71658
71800
  return result;
71659
71801
  }
71802
+ function normalizeRecordIndex(recordIndex) {
71803
+ if (isArray$5(recordIndex) && recordIndex.length === 1) {
71804
+ return recordIndex[0];
71805
+ }
71806
+ return recordIndex;
71807
+ }
71808
+ function setRecordCheckboxState(recordIndex, field, checked, checkedState) {
71809
+ const dataIndex = normalizeRecordIndex(recordIndex).toString();
71810
+ if (checkedState.get(dataIndex)) {
71811
+ checkedState.get(dataIndex)[field] = checked;
71812
+ }
71813
+ else {
71814
+ checkedState.set(dataIndex, {
71815
+ [field]: checked
71816
+ });
71817
+ }
71818
+ }
71819
+ function clearRecordCheckboxState(records, field, table, parentIndex = []) {
71820
+ if (!isArray$5(records)) {
71821
+ return;
71822
+ }
71823
+ records.forEach((record, index) => {
71824
+ const recordIndex = parentIndex.length ? parentIndex.concat(index) : [index];
71825
+ const currentState = getRecordCheckboxState(recordIndex, record, field, table);
71826
+ if (currentState !== false) {
71827
+ setRecordCheckboxState(recordIndex, field, false, table.stateManager.checkedState);
71828
+ }
71829
+ if (isArray$5(record?.children)) {
71830
+ clearRecordCheckboxState(record.children, field, table, recordIndex);
71831
+ }
71832
+ });
71833
+ }
71834
+ function updateVisibleCheckboxCellByRecordIndex(recordIndex, field, checked, table) {
71835
+ const bodyRowIndex = table.getBodyRowIndexByRecordIndex?.(recordIndex);
71836
+ if (!isNumber$3(bodyRowIndex) || bodyRowIndex < 0) {
71837
+ return;
71838
+ }
71839
+ const row = bodyRowIndex + table.columnHeaderLevelCount;
71840
+ const cols = getCheckboxColsByField(field, row, table);
71841
+ cols.forEach(col => {
71842
+ setCellCheckboxStateByAttribute(col, row, checked, table);
71843
+ });
71844
+ }
71845
+ function updateVisibleCheckboxCellsByField(field, checked, table) {
71846
+ const bodyStartRow = table.columnHeaderLevelCount;
71847
+ const cols = getCheckboxColsByField(field, bodyStartRow, table);
71848
+ for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {
71849
+ cols.forEach(col => {
71850
+ setCellCheckboxStateByAttribute(col, row, checked, table);
71851
+ });
71852
+ }
71853
+ }
71854
+ function renderCheckboxStateUpdate(table) {
71855
+ const renderAsync = table.renderAsync;
71856
+ if (isFunction$3(renderAsync)) {
71857
+ renderAsync.call(table);
71858
+ }
71859
+ else {
71860
+ table.render();
71861
+ }
71862
+ }
71863
+ function updateHeaderCheckboxStateByField(field, table) {
71864
+ const fieldKey = field;
71865
+ let hasChecked = false;
71866
+ let hasUnchecked = false;
71867
+ let hasRecord = false;
71868
+ traverseRecords(table.records, (record, recordIndex) => {
71869
+ const state = getRecordCheckboxState(recordIndex, record, field, table);
71870
+ hasRecord = true;
71871
+ if (state === true) {
71872
+ hasChecked = true;
71873
+ }
71874
+ else if (state === 'indeterminate') {
71875
+ hasChecked = true;
71876
+ hasUnchecked = true;
71877
+ }
71878
+ else {
71879
+ hasUnchecked = true;
71880
+ }
71881
+ });
71882
+ const checked = hasRecord && hasChecked && !hasUnchecked ? true : hasChecked ? 'indeterminate' : false;
71883
+ table.stateManager.headerCheckedState[fieldKey] = checked;
71884
+ updateVisibleHeaderCheckboxCellByField(field, checked, table);
71885
+ }
71886
+ function updateVisibleHeaderCheckboxCellByField(field, checked, table) {
71887
+ for (let row = 0; row < table.columnHeaderLevelCount; row++) {
71888
+ for (let col = 0; col < table.colCount; col++) {
71889
+ if (table.getHeaderField(col, row) === field && table.getCellType(col, row) === 'checkbox') {
71890
+ table.scenegraph.updateHeaderCheckboxCellState(col, row, checked);
71891
+ }
71892
+ }
71893
+ }
71894
+ }
71895
+ function getCheckboxColsByField(field, row, table) {
71896
+ const cols = [];
71897
+ for (let col = 0; col < table.colCount; col++) {
71898
+ if (table.isHeader(col, row)) {
71899
+ continue;
71900
+ }
71901
+ const define = table.getBodyColumnDefine(col, row);
71902
+ if (define?.field === field && table.getCellType(col, row) === 'checkbox') {
71903
+ cols.push(col);
71904
+ }
71905
+ }
71906
+ return cols;
71907
+ }
71908
+ function updateChildrenCheckboxStateByRecordIndex(recordIndex, field, checked, table) {
71909
+ const record = getRecordByRecordIndex(table.records, recordIndex);
71910
+ if (!record?.children?.length) {
71911
+ return;
71912
+ }
71913
+ record.children.forEach((child, childIndex) => {
71914
+ const childRecordIndex = normalizeRecordIndexToArray(recordIndex).concat(childIndex);
71915
+ setRecordCheckboxState(childRecordIndex, field, checked, table.stateManager.checkedState);
71916
+ updateVisibleCheckboxCellByRecordIndex(childRecordIndex, field, checked, table);
71917
+ updateChildrenCheckboxStateByRecordIndex(childRecordIndex, field, checked, table);
71918
+ });
71919
+ }
71920
+ function updateParentCheckboxStateByRecordIndex(recordIndex, field, table) {
71921
+ const recordIndexPath = normalizeRecordIndexToArray(recordIndex);
71922
+ for (let level = recordIndexPath.length - 1; level > 0; level--) {
71923
+ const parentIndex = recordIndexPath.slice(0, level);
71924
+ const parentRecord = getRecordByRecordIndex(table.records, parentIndex);
71925
+ if (!parentRecord?.children?.length) {
71926
+ continue;
71927
+ }
71928
+ const childStates = parentRecord.children.map((child, childIndex) => {
71929
+ const childRecordIndex = parentIndex.concat(childIndex);
71930
+ const childState = getRecordCheckboxState(childRecordIndex, child, field, table);
71931
+ setRecordCheckboxState(childRecordIndex, field, childState, table.stateManager.checkedState);
71932
+ return childState;
71933
+ });
71934
+ const allChecked = childStates.every(state => state === true);
71935
+ const allUnchecked = childStates.every(state => state !== true && state !== 'indeterminate');
71936
+ const parentState = allChecked ? true : allUnchecked ? false : 'indeterminate';
71937
+ setRecordCheckboxState(parentIndex, field, parentState, table.stateManager.checkedState);
71938
+ updateVisibleCheckboxCellByRecordIndex(parentIndex, field, parentState, table);
71939
+ }
71940
+ }
71941
+ function getRecordCheckboxState(recordIndex, record, field, table) {
71942
+ const fieldKey = field;
71943
+ const dataIndex = normalizeRecordIndex(recordIndex).toString();
71944
+ const cachedState = table.stateManager.checkedState.get(dataIndex)?.[fieldKey];
71945
+ if (isValid$1(cachedState)) {
71946
+ return cachedState;
71947
+ }
71948
+ const value = record?.[fieldKey];
71949
+ if (isObject$7(value) && isValid$1(value.checked)) {
71950
+ return value.checked;
71951
+ }
71952
+ if (typeof value === 'boolean') {
71953
+ return value;
71954
+ }
71955
+ return false;
71956
+ }
71957
+ function getRecordByRecordIndex(records, recordIndex) {
71958
+ const recordIndexPath = normalizeRecordIndexToArray(recordIndex);
71959
+ let currentRecords = records;
71960
+ let record;
71961
+ for (let i = 0; i < recordIndexPath.length; i++) {
71962
+ record = currentRecords?.[recordIndexPath[i]];
71963
+ currentRecords = record?.children;
71964
+ }
71965
+ return record;
71966
+ }
71967
+ function normalizeRecordIndexToArray(recordIndex) {
71968
+ return isArray$5(recordIndex) ? recordIndex : [recordIndex];
71969
+ }
71970
+ function traverseRecords(records, handler, parentIndex = []) {
71971
+ if (!isArray$5(records)) {
71972
+ return;
71973
+ }
71974
+ records.forEach((record, index) => {
71975
+ const recordIndex = parentIndex.length ? parentIndex.concat(index) : index;
71976
+ handler(record, recordIndex);
71977
+ if (isArray$5(record?.children)) {
71978
+ traverseRecords(record.children, handler, isArray$5(recordIndex) ? recordIndex : [recordIndex]);
71979
+ }
71980
+ });
71981
+ }
71660
71982
  function initRecordCheckState(records, state) {
71661
71983
  const table = state.table;
71662
71984
  const start = table.isPivotTable()
@@ -77253,6 +77575,9 @@
77253
77575
  _table;
77254
77576
  constructor(_table) {
77255
77577
  this._table = _table;
77578
+ this.updateIcons();
77579
+ }
77580
+ updateIcons() {
77256
77581
  const regedIcons = get$4();
77257
77582
  this.expandIcon = regedIcons[InternalIconName.expandIconName];
77258
77583
  this.collapseIcon = regedIcons[InternalIconName.collapseIconName];
@@ -78455,6 +78780,9 @@
78455
78780
  _table;
78456
78781
  constructor(_table) {
78457
78782
  this._table = _table;
78783
+ this.updateIcons();
78784
+ }
78785
+ updateIcons() {
78458
78786
  const regedIcons = get$4();
78459
78787
  this.freezeIcon = regedIcons[InternalIconName.freezeIconName];
78460
78788
  this.frozenIcon = regedIcons[InternalIconName.frozenIconName];
@@ -79166,6 +79494,9 @@
79166
79494
  _table;
79167
79495
  constructor(_table) {
79168
79496
  this._table = _table;
79497
+ this.updateIcons();
79498
+ }
79499
+ updateIcons() {
79169
79500
  const regedIcons = get$4();
79170
79501
  this.dragReorderIconName = regedIcons[InternalIconName.dragReorderIconName];
79171
79502
  }
@@ -80935,8 +81266,9 @@
80935
81266
  pluginEventMap = new Map();
80936
81267
  constructor(table, options) {
80937
81268
  this.table = table;
80938
- options.plugins?.map(plugin => {
81269
+ options.plugins?.forEach(plugin => {
80939
81270
  this.register(plugin);
81271
+ plugin.init?.(this.table, options);
80940
81272
  this._bindTableEventForPlugin(plugin);
80941
81273
  });
80942
81274
  }
@@ -80960,18 +81292,20 @@
80960
81292
  this.pluginEventMap.set(plugin.id, [...(this.pluginEventMap.get(plugin.id) || []), id]);
80961
81293
  });
80962
81294
  }
80963
- removeOrAddPlugins(plugins) {
81295
+ removeOrAddPlugins(plugins, options = this.table.options) {
80964
81296
  const removedPlugins = Array.from(this.plugins.values()).filter(plugin => !plugins?.some(p => p.id === plugin.id));
80965
81297
  removedPlugins.forEach(plugin => {
80966
81298
  this.pluginEventMap.get(plugin.id)?.forEach(id => {
80967
81299
  this.table.off(id);
80968
81300
  });
80969
- this.release();
81301
+ this.pluginEventMap.delete(plugin.id);
81302
+ plugin.release?.(this.table);
80970
81303
  this.plugins.delete(plugin.id);
80971
81304
  });
80972
81305
  const addedPlugins = plugins?.filter(plugin => !this.plugins.has(plugin.id));
80973
81306
  addedPlugins?.forEach(plugin => {
80974
81307
  this.register(plugin);
81308
+ plugin.init?.(this.table, options);
80975
81309
  this._bindTableEventForPlugin(plugin);
80976
81310
  });
80977
81311
  }
@@ -80993,6 +81327,9 @@
80993
81327
  const { isTouchEvent } = event;
80994
81328
  const rangeReg = /^\$(\d+)\$(\d+)$/;
80995
81329
  importStyle$2();
81330
+ function normalizeCellType(cellType) {
81331
+ return isValid$1(cellType) ? cellType : 'text';
81332
+ }
80996
81333
  class BaseTable extends EventTarget$1 {
80997
81334
  internalProps;
80998
81335
  showFrozenIcon = true;
@@ -81031,7 +81368,7 @@
81031
81368
  return TABLE_EVENT_TYPE;
81032
81369
  }
81033
81370
  options;
81034
- version = "1.26.5";
81371
+ version = "1.26.6";
81035
81372
  pagination;
81036
81373
  id = `VTable${Date.now()}`;
81037
81374
  headerStyleCache;
@@ -81224,7 +81561,7 @@
81224
81561
  internalProps.focusedTable = false;
81225
81562
  internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
81226
81563
  internalProps.theme.isPivot = this.isPivotTable();
81227
- setIconColor(internalProps.theme.functionalIconsStyle);
81564
+ this._updateFunctionalIcons();
81228
81565
  if (container) {
81229
81566
  if (clearDOM) {
81230
81567
  container.innerHTML = '';
@@ -82859,7 +83196,7 @@
82859
83196
  internalProps.stick.changedCells.clear();
82860
83197
  internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
82861
83198
  internalProps.theme.isPivot = this.isPivotTable();
82862
- setIconColor(internalProps.theme.functionalIconsStyle);
83199
+ this._updateFunctionalIcons();
82863
83200
  this.scenegraph.updateStageBackground();
82864
83201
  internalProps.autoWrapText = options.autoWrapText;
82865
83202
  internalProps.enableLineBreak = options.enableLineBreak;
@@ -83346,6 +83683,12 @@
83346
83683
  this.scenegraph.createSceneGraph();
83347
83684
  this.render();
83348
83685
  }
83686
+ _updateFunctionalIcons() {
83687
+ setIconColor(this.internalProps.theme.functionalIconsStyle);
83688
+ this.internalProps.headerHelper?.updateIcons();
83689
+ this.internalProps.bodyHelper?.updateIcons();
83690
+ this.internalProps.rowSeriesNumberHelper?.updateIcons();
83691
+ }
83349
83692
  get theme() {
83350
83693
  return this.internalProps.theme;
83351
83694
  }
@@ -83353,13 +83696,13 @@
83353
83696
  this.internalProps.theme = themes.of(theme ?? themes.DEFAULT);
83354
83697
  this.internalProps.theme.isPivot = this.isPivotTable();
83355
83698
  this.options.theme = theme;
83356
- setIconColor(this.internalProps.theme.functionalIconsStyle);
83699
+ this._updateFunctionalIcons();
83357
83700
  }
83358
83701
  updateTheme(theme) {
83359
83702
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
83360
83703
  this.internalProps.theme = themes.of(theme ?? themes.DEFAULT);
83361
83704
  this.internalProps.theme.isPivot = this.isPivotTable();
83362
- setIconColor(this.internalProps.theme.functionalIconsStyle);
83705
+ this._updateFunctionalIcons();
83363
83706
  this.options.theme = theme;
83364
83707
  this.scenegraph.updateComponent();
83365
83708
  this.scenegraph.updateStageBackground();
@@ -83378,13 +83721,13 @@
83378
83721
  }
83379
83722
  getBodyColumnType(col, row) {
83380
83723
  const cellType = this.internalProps.layoutMap.getBody(col, row)?.cellType ?? 'text';
83381
- return getProp('cellType', { cellType }, col, row, this);
83724
+ return normalizeCellType(getProp('cellType', { cellType }, col, row, this));
83382
83725
  }
83383
83726
  getCellType(col, row) {
83384
83727
  let cellType;
83385
83728
  if (this.isSeriesNumberInHeader(col, row)) {
83386
83729
  const seriesHeaderCellType = this.internalProps.layoutMap.getSeriesNumberHeader(col, row).cellType;
83387
- return seriesHeaderCellType === 'radio' ? 'text' : seriesHeaderCellType;
83730
+ return normalizeCellType(seriesHeaderCellType === 'radio' ? 'text' : seriesHeaderCellType);
83388
83731
  }
83389
83732
  else if (this.isHeader(col, row)) {
83390
83733
  cellType = this.internalProps.layoutMap.getHeader(col, row).headerType;
@@ -83392,7 +83735,7 @@
83392
83735
  else {
83393
83736
  cellType = this.internalProps.layoutMap.getBody(col, row).cellType;
83394
83737
  }
83395
- return getProp('cellType', { cellType }, col, row, this);
83738
+ return normalizeCellType(getProp('cellType', { cellType }, col, row, this));
83396
83739
  }
83397
83740
  getHeaderField(col, row) {
83398
83741
  return this.internalProps.layoutMap.getHeaderField(col, row);
@@ -89011,6 +89354,9 @@
89011
89354
  const { title } = table.internalProps.layoutMap.getSeriesNumberHeader(col, row);
89012
89355
  return title;
89013
89356
  }
89357
+ if (table.internalProps.layoutMap.isAggregation(col, row)) {
89358
+ return '';
89359
+ }
89014
89360
  let value;
89015
89361
  if (this.internalProps.groupBy) {
89016
89362
  const record = table.getCellRawRecord(col, row);
@@ -89064,6 +89410,9 @@
89064
89410
  const { title } = table.internalProps.layoutMap.getSeriesNumberHeader(col, row);
89065
89411
  return title;
89066
89412
  }
89413
+ if (table.internalProps.layoutMap.isAggregation(col, row)) {
89414
+ return '';
89415
+ }
89067
89416
  const { format } = table.internalProps.layoutMap.getSeriesNumberBody(col, row);
89068
89417
  return typeof format === 'function' ? format(col, row, this) : row - this.columnHeaderLevelCount;
89069
89418
  }
@@ -89165,7 +89514,7 @@
89165
89514
  clearRowHeightCache: true
89166
89515
  }) {
89167
89516
  const internalProps = this.internalProps;
89168
- this.pluginManager.removeOrAddPlugins(options.plugins);
89517
+ this.pluginManager.removeOrAddPlugins(options.plugins, options);
89169
89518
  super.updateOption(options, updateConfig);
89170
89519
  internalProps.frozenColDragHeaderMode =
89171
89520
  options.dragOrder?.frozenColDragHeaderMode ?? options.frozenColDragHeaderMode;
@@ -89720,6 +90069,15 @@
89720
90069
  setCellCheckboxState(col, row, checked) {
89721
90070
  setCellCheckboxState(col, row, checked, this);
89722
90071
  }
90072
+ setCellCheckboxStateByRecordIndex(recordIndex, field, checked) {
90073
+ setCheckboxStateByRecordIndex(recordIndex, field, checked, this);
90074
+ }
90075
+ clearCheckboxState(field) {
90076
+ clearCheckboxState(field, this);
90077
+ }
90078
+ clearAllCheckboxState(field) {
90079
+ this.clearCheckboxState(field);
90080
+ }
89723
90081
  setCellRadioState(col, row, index) {
89724
90082
  setCellRadioState(col, row, index, this);
89725
90083
  }
@@ -90329,11 +90687,12 @@
90329
90687
  }
90330
90688
  }
90331
90689
  updateRecords(records, recordIndexs, triggerEvent = true) {
90332
- listTableUpdateRecords(records, recordIndexs, this);
90690
+ const updateRecordIndexs = recordIndexs ?? records?.map((_, index) => index) ?? [];
90691
+ listTableUpdateRecords(records, updateRecordIndexs, this);
90333
90692
  if (triggerEvent) {
90334
90693
  this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
90335
90694
  records,
90336
- recordIndexs,
90695
+ recordIndexs: updateRecordIndexs,
90337
90696
  updateCount: records.length
90338
90697
  });
90339
90698
  }
@@ -105862,7 +106221,7 @@
105862
106221
  }
105863
106222
 
105864
106223
  registerForVrender();
105865
- const version = "1.26.5";
106224
+ const version = "1.26.6";
105866
106225
  function getIcons() {
105867
106226
  return get$4();
105868
106227
  }