@visactor/vtable 0.16.4-alpha.1 → 0.17.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 (85) hide show
  1. package/cjs/ListTable.js +1 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.js +3 -2
  4. package/cjs/PivotChart.js.map +1 -1
  5. package/cjs/PivotTable.js +3 -2
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.d.ts +1 -0
  8. package/cjs/core/BaseTable.js +27 -13
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/dataset/dataset.js +21 -22
  11. package/cjs/dataset/dataset.js.map +1 -1
  12. package/cjs/event/listener/table-group.js +14 -8
  13. package/cjs/event/listener/table-group.js.map +1 -1
  14. package/cjs/index.d.ts +1 -1
  15. package/cjs/index.js +1 -1
  16. package/cjs/index.js.map +1 -1
  17. package/cjs/layout/pivot-header-layout.d.ts +1 -0
  18. package/cjs/layout/pivot-header-layout.js +25 -8
  19. package/cjs/layout/pivot-header-layout.js.map +1 -1
  20. package/cjs/layout/pivot-layout-helper.d.ts +2 -1
  21. package/cjs/layout/pivot-layout-helper.js +17 -7
  22. package/cjs/layout/pivot-layout-helper.js.map +1 -1
  23. package/cjs/scenegraph/layout/compute-col-width.d.ts +1 -0
  24. package/cjs/scenegraph/layout/compute-col-width.js +12 -8
  25. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  26. package/cjs/scenegraph/layout/compute-row-height.js +7 -4
  27. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  28. package/cjs/scenegraph/layout/update-row.js +1 -1
  29. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  30. package/cjs/scenegraph/scenegraph.js +20 -22
  31. package/cjs/scenegraph/scenegraph.js.map +1 -1
  32. package/cjs/scenegraph/select/update-select-border.js +12 -6
  33. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  34. package/cjs/themes/BRIGHT.js +1 -2
  35. package/cjs/themes/DARK.js +2 -1
  36. package/cjs/ts-types/base-table.d.ts +1 -0
  37. package/cjs/ts-types/base-table.js.map +1 -1
  38. package/cjs/ts-types/new-data-set.d.ts +8 -2
  39. package/cjs/ts-types/new-data-set.js.map +1 -1
  40. package/cjs/ts-types/style-define.d.ts +3 -0
  41. package/cjs/ts-types/style-define.js.map +1 -1
  42. package/dist/vtable.js +206 -102
  43. package/dist/vtable.min.js +2 -2
  44. package/es/ListTable.js +1 -1
  45. package/es/ListTable.js.map +1 -1
  46. package/es/PivotChart.js +3 -2
  47. package/es/PivotChart.js.map +1 -1
  48. package/es/PivotTable.js +3 -2
  49. package/es/PivotTable.js.map +1 -1
  50. package/es/core/BaseTable.d.ts +1 -0
  51. package/es/core/BaseTable.js +27 -13
  52. package/es/core/BaseTable.js.map +1 -1
  53. package/es/dataset/dataset.js +21 -22
  54. package/es/dataset/dataset.js.map +1 -1
  55. package/es/event/listener/table-group.js +14 -8
  56. package/es/event/listener/table-group.js.map +1 -1
  57. package/es/index.d.ts +1 -1
  58. package/es/index.js +1 -1
  59. package/es/index.js.map +1 -1
  60. package/es/layout/pivot-header-layout.d.ts +1 -0
  61. package/es/layout/pivot-header-layout.js +25 -8
  62. package/es/layout/pivot-header-layout.js.map +1 -1
  63. package/es/layout/pivot-layout-helper.d.ts +2 -1
  64. package/es/layout/pivot-layout-helper.js +17 -7
  65. package/es/layout/pivot-layout-helper.js.map +1 -1
  66. package/es/scenegraph/layout/compute-col-width.d.ts +1 -0
  67. package/es/scenegraph/layout/compute-col-width.js +9 -6
  68. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  69. package/es/scenegraph/layout/compute-row-height.js +7 -4
  70. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  71. package/es/scenegraph/layout/update-row.js +1 -1
  72. package/es/scenegraph/layout/update-row.js.map +1 -1
  73. package/es/scenegraph/scenegraph.js +21 -23
  74. package/es/scenegraph/scenegraph.js.map +1 -1
  75. package/es/scenegraph/select/update-select-border.js +12 -6
  76. package/es/scenegraph/select/update-select-border.js.map +1 -1
  77. package/es/themes/BRIGHT.js +1 -2
  78. package/es/themes/DARK.js +2 -1
  79. package/es/ts-types/base-table.d.ts +1 -0
  80. package/es/ts-types/base-table.js.map +1 -1
  81. package/es/ts-types/new-data-set.d.ts +8 -2
  82. package/es/ts-types/new-data-set.js.map +1 -1
  83. package/es/ts-types/style-define.d.ts +3 -0
  84. package/es/ts-types/style-define.js.map +1 -1
  85. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -55044,7 +55044,7 @@
55044
55044
  let actualHeaderHeight = 0;
55045
55045
  for (let row = 0; row < table.rowCount; row++) {
55046
55046
  const rowHeight = update ? newHeights[row] : table.getRowHeight(row);
55047
- if (row < table.frozenRowCount || row >= table.rowCount - table.bottomFrozenRowCount) {
55047
+ if (row < table.frozenRowCount || (table.isPivotChart() && row >= table.rowCount - table.bottomFrozenRowCount)) {
55048
55048
  actualHeaderHeight += rowHeight;
55049
55049
  }
55050
55050
  actualHeight += rowHeight;
@@ -55285,8 +55285,14 @@
55285
55285
  let iconInlineFrontHeight = 0;
55286
55286
  const iconInlineEnd = [];
55287
55287
  let iconInlineEndHeight = 0;
55288
- const define = table.getBodyColumnDefine(col, row);
55289
- const mayHaveIcon = table.getCellLocation(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;
55288
+ let mayHaveIcon = false;
55289
+ if (table.getCellLocation(col, row) !== 'body') {
55290
+ mayHaveIcon = true;
55291
+ }
55292
+ else {
55293
+ const define = table.getBodyColumnDefine(col, row);
55294
+ mayHaveIcon = !!define?.icon || !!define?.tree;
55295
+ }
55290
55296
  if (mayHaveIcon) {
55291
55297
  const icons = table.getCellIcons(col, row);
55292
55298
  icons?.forEach(icon => {
@@ -57758,7 +57764,7 @@
57758
57764
  let actualWidth = 0;
57759
57765
  for (let col = 0; col < table.colCount; col++) {
57760
57766
  const colWidth = update ? newWidths[col] : table.getColWidth(col);
57761
- if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {
57767
+ if (col < table.frozenColCount || (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount)) {
57762
57768
  actualHeaderWidth += colWidth;
57763
57769
  }
57764
57770
  actualWidth += colWidth;
@@ -57949,8 +57955,14 @@
57949
57955
  const cellValue = table.getCellValue(col, row);
57950
57956
  const actStyle = table._getCellStyle(col, row);
57951
57957
  let iconWidth = 0;
57952
- const define = table.getBodyColumnDefine(col, row);
57953
- const mayHaveIcon = table.getCellLocation(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;
57958
+ let mayHaveIcon = false;
57959
+ if (table.getCellLocation(col, row) !== 'body') {
57960
+ mayHaveIcon = true;
57961
+ }
57962
+ else {
57963
+ const define = table.getBodyColumnDefine(col, row);
57964
+ mayHaveIcon = !!define?.icon || !!define?.tree;
57965
+ }
57954
57966
  if (mayHaveIcon) {
57955
57967
  const icons = table.getCellIcons(col, row);
57956
57968
  icons?.forEach(icon => {
@@ -58020,7 +58032,7 @@
58020
58032
  }
58021
58033
  return widthDefined;
58022
58034
  }
58023
- function getAdaptiveWidth(totalDrawWidth, startCol, endColPlus1, update, newWidths, table) {
58035
+ function getAdaptiveWidth(totalDrawWidth, startCol, endColPlus1, update, newWidths, table, fromScenegraph) {
58024
58036
  let actualWidth = 0;
58025
58037
  const adaptiveColumns = [];
58026
58038
  for (let col = startCol; col < endColPlus1; col++) {
@@ -58055,6 +58067,9 @@
58055
58067
  if (update) {
58056
58068
  newWidths[col] = table._adjustColWidth(col, colWidth);
58057
58069
  }
58070
+ else if (fromScenegraph) {
58071
+ table.scenegraph.setColWidth(col, table._adjustColWidth(col, colWidth));
58072
+ }
58058
58073
  else {
58059
58074
  table._setColWidth(col, table._adjustColWidth(col, colWidth), false, true);
58060
58075
  }
@@ -59461,24 +59476,39 @@
59461
59476
  ? scene.bottomFrozenGroup
59462
59477
  : scene.rightBottomCornerGroup);
59463
59478
  }
59464
- const diffSize = Math.ceil(selectComp.rect.attribute.lineWidth / 2);
59479
+ let diffSize = 0;
59480
+ if (typeof selectComp.rect.attribute.lineWidth === 'number') {
59481
+ diffSize = Math.ceil(selectComp.rect.attribute.lineWidth / 2);
59482
+ }
59465
59483
  if (endCol === scene.table.colCount - 1) {
59484
+ if (Array.isArray(selectComp.rect.attribute.lineWidth)) {
59485
+ diffSize = Math.ceil((selectComp.rect.attribute.lineWidth[1] ?? 0) / 2);
59486
+ }
59466
59487
  selectComp.rect.setAttributes({
59467
59488
  width: selectComp.rect.attribute.width - diffSize
59468
59489
  });
59469
59490
  }
59470
59491
  if (startCol === 0) {
59492
+ if (Array.isArray(selectComp.rect.attribute.lineWidth)) {
59493
+ diffSize = Math.ceil((selectComp.rect.attribute.lineWidth[3] ?? 0) / 2);
59494
+ }
59471
59495
  selectComp.rect.setAttributes({
59472
59496
  x: selectComp.rect.attribute.x + diffSize,
59473
59497
  width: selectComp.rect.attribute.width - diffSize
59474
59498
  });
59475
59499
  }
59476
59500
  if (endRow === scene.table.rowCount - 1) {
59501
+ if (Array.isArray(selectComp.rect.attribute.lineWidth)) {
59502
+ diffSize = Math.ceil((selectComp.rect.attribute.lineWidth[2] ?? 0) / 2);
59503
+ }
59477
59504
  selectComp.rect.setAttributes({
59478
59505
  height: selectComp.rect.attribute.height - diffSize
59479
59506
  });
59480
59507
  }
59481
59508
  if (startRow === 0) {
59509
+ if (Array.isArray(selectComp.rect.attribute.lineWidth)) {
59510
+ diffSize = Math.ceil((selectComp.rect.attribute.lineWidth[0] ?? 0) / 2);
59511
+ }
59482
59512
  selectComp.rect.setAttributes({
59483
59513
  y: selectComp.rect.attribute.y + diffSize,
59484
59514
  height: selectComp.rect.attribute.height - diffSize
@@ -59789,7 +59819,7 @@
59789
59819
  if (addRows.length) {
59790
59820
  if (!isNumber$7(updateAfter)) {
59791
59821
  const minRow = Math.min(...addRows);
59792
- scene.proxy.rowUpdatePos = minRow;
59822
+ scene.proxy.rowUpdatePos = Math.min(minRow, scene.proxy.rowUpdatePos);
59793
59823
  }
59794
59824
  scene.proxy.rowUpdateDirection = 'up';
59795
59825
  scene.proxy.updateCellGroups(scene.proxy.screenRowCount * 2);
@@ -62161,50 +62191,35 @@
62161
62191
  dealWidthMode() {
62162
62192
  const table = this.table;
62163
62193
  if (table.widthMode === 'adaptive') {
62164
- const totalDrawWidth = table.tableNoFrameWidth - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
62165
- let actualWidth = 0;
62166
- for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {
62167
- actualWidth += table.getColWidth(col);
62168
- }
62169
- const factor = totalDrawWidth / actualWidth;
62170
- for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {
62171
- let colWidth;
62172
- if (col === table.colCount - table.rightFrozenColCount - 1) {
62173
- colWidth =
62174
- totalDrawWidth - table.getColsWidth(table.frozenColCount, table.colCount - table.rightFrozenColCount - 2);
62175
- }
62176
- else {
62177
- colWidth = Math.round(table.getColWidth(col) * factor);
62194
+ table._clearColRangeWidthsMap();
62195
+ const canvasWidth = table.tableNoFrameWidth;
62196
+ let actualHeaderWidth = 0;
62197
+ for (let col = 0; col < table.colCount; col++) {
62198
+ const colWidth = table.getColWidth(col);
62199
+ if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {
62200
+ actualHeaderWidth += colWidth;
62178
62201
  }
62179
- this.setColWidth(col, colWidth);
62180
62202
  }
62203
+ const startCol = table.frozenColCount;
62204
+ const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
62205
+ getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, false, [], table, true);
62181
62206
  }
62182
62207
  else if (table.autoFillWidth) {
62208
+ table._clearColRangeWidthsMap();
62183
62209
  const canvasWidth = table.tableNoFrameWidth;
62184
- let actualWidth = 0;
62185
62210
  let actualHeaderWidth = 0;
62211
+ let actualWidth = 0;
62186
62212
  for (let col = 0; col < table.colCount; col++) {
62187
62213
  const colWidth = table.getColWidth(col);
62188
- if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {
62214
+ if (col < table.frozenColCount || (table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount)) {
62189
62215
  actualHeaderWidth += colWidth;
62190
62216
  }
62191
62217
  actualWidth += colWidth;
62192
62218
  }
62193
- if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) {
62194
- const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth);
62195
- for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {
62196
- let colWidth;
62197
- if (col === table.colCount - table.rightFrozenColCount - 1) {
62198
- colWidth =
62199
- canvasWidth -
62200
- actualHeaderWidth -
62201
- table.getColsWidth(table.frozenColCount, table.colCount - table.rightFrozenColCount - 2);
62202
- }
62203
- else {
62204
- colWidth = Math.round(table.getColWidth(col) * factor);
62205
- }
62206
- this.setColWidth(col, colWidth);
62207
- }
62219
+ if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) {
62220
+ const startCol = table.frozenColCount;
62221
+ const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;
62222
+ getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, false, [], table, true);
62208
62223
  }
62209
62224
  }
62210
62225
  let bodyWidth = 0;
@@ -62238,18 +62253,20 @@
62238
62253
  const table = this.table;
62239
62254
  if (table.heightMode === 'adaptive') {
62240
62255
  table._clearRowRangeHeightsMap();
62241
- const totalDrawHeight = table.tableNoFrameHeight - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
62256
+ const columnHeaderHeight = table.getRowsHeight(0, table.columnHeaderLevelCount - 1);
62257
+ const bottomHeaderHeight = table.isPivotChart() ? table.getBottomFrozenRowsHeight() : 0;
62258
+ const totalDrawHeight = table.tableNoFrameHeight - columnHeaderHeight - bottomHeaderHeight;
62259
+ const startRow = table.columnHeaderLevelCount;
62260
+ const endRow = table.isPivotChart() ? table.rowCount - table.bottomFrozenRowCount : table.rowCount;
62242
62261
  let actualHeight = 0;
62243
- for (let row = table.frozenRowCount; row < table.rowCount - table.bottomFrozenRowCount; row++) {
62262
+ for (let row = startRow; row < endRow; row++) {
62244
62263
  actualHeight += table.getRowHeight(row);
62245
62264
  }
62246
62265
  const factor = totalDrawHeight / actualHeight;
62247
- for (let row = table.frozenRowCount; row < table.rowCount - table.bottomFrozenRowCount; row++) {
62266
+ for (let row = startRow; row < endRow; row++) {
62248
62267
  let rowHeight;
62249
- if (row === table.rowCount - table.bottomFrozenRowCount - 1) {
62250
- rowHeight =
62251
- totalDrawHeight -
62252
- table.getRowsHeight(table.frozenRowCount, table.rowCount - table.bottomFrozenRowCount - 2);
62268
+ if (row === endRow - 1) {
62269
+ rowHeight = totalDrawHeight - table.getRowsHeight(startRow, endRow - 2);
62253
62270
  }
62254
62271
  else {
62255
62272
  rowHeight = Math.round(table.getRowHeight(row) * factor);
@@ -62258,12 +62275,14 @@
62258
62275
  }
62259
62276
  }
62260
62277
  else if (table.autoFillHeight) {
62278
+ table._clearRowRangeHeightsMap();
62261
62279
  const canvasHeight = table.tableNoFrameHeight;
62262
62280
  let actualHeight = 0;
62263
62281
  let actualHeaderHeight = 0;
62264
62282
  for (let row = 0; row < table.rowCount; row++) {
62265
62283
  const rowHeight = table.getRowHeight(row);
62266
- if (row < table.frozenRowCount || row >= table.rowCount - table.bottomFrozenRowCount) {
62284
+ if (row < table.frozenRowCount ||
62285
+ (table.isPivotChart() && row >= table.rowCount - table.bottomFrozenRowCount)) {
62267
62286
  actualHeaderHeight += rowHeight;
62268
62287
  }
62269
62288
  actualHeight += rowHeight;
@@ -64666,6 +64685,10 @@
64666
64685
  }
64667
64686
  });
64668
64687
  table.scenegraph.tableGroup.addEventListener('pointerupoutside', (e) => {
64688
+ const eventArgsSet = getCellEventArgsSet(e);
64689
+ if (stateManager.menu.isShow && eventArgsSet.eventArgs?.target !== stateManager.residentHoverIcon?.icon) {
64690
+ stateManager.hideMenu();
64691
+ }
64669
64692
  if (stateManager.isResizeCol()) {
64670
64693
  endResizeCol(table);
64671
64694
  }
@@ -64723,9 +64746,7 @@
64723
64746
  if (table.isPivotChart() && eventArgsSet?.eventArgs?.target.type !== 'chart') {
64724
64747
  table.scenegraph.updateChartState(null);
64725
64748
  }
64726
- if (stateManager.menu.isShow &&
64727
- eventArgsSet.eventArgs &&
64728
- eventArgsSet.eventArgs.target !== stateManager.residentHoverIcon?.icon) {
64749
+ if (stateManager.menu.isShow && eventArgsSet.eventArgs?.target !== stateManager.residentHoverIcon?.icon) {
64729
64750
  stateManager.hideMenu();
64730
64751
  }
64731
64752
  const hitIcon = eventArgsSet?.eventArgs?.target?.role?.startsWith('icon')
@@ -64920,6 +64941,12 @@
64920
64941
  }
64921
64942
  }
64922
64943
  });
64944
+ table.scenegraph.stage.addEventListener('pointerdown', (e) => {
64945
+ const eventArgsSet = getCellEventArgsSet(e);
64946
+ if (stateManager.menu.isShow && eventArgsSet.eventArgs?.target !== stateManager.residentHoverIcon?.icon) {
64947
+ stateManager.hideMenu();
64948
+ }
64949
+ });
64923
64950
  table.scenegraph.stage.addEventListener('pointertap', (e) => {
64924
64951
  const target = e.target;
64925
64952
  if (!isDraging &&
@@ -68560,7 +68587,7 @@
68560
68587
  return TABLE_EVENT_TYPE;
68561
68588
  }
68562
68589
  options;
68563
- version = "0.16.4-alpha.1";
68590
+ version = "0.17.0";
68564
68591
  pagination;
68565
68592
  id = `VTable${Date.now()}`;
68566
68593
  headerStyleCache;
@@ -69699,8 +69726,7 @@
69699
69726
  if (internalProps.menu.renderMode === 'html' && !internalProps.menuHandler) {
69700
69727
  internalProps.menuHandler = new MenuHandler(this);
69701
69728
  }
69702
- this.headerStyleCache = new Map();
69703
- this.bodyStyleCache = new Map();
69729
+ this.clearCellStyleCache();
69704
69730
  this.clearColWidthCache();
69705
69731
  this.clearRowHeightCache();
69706
69732
  }
@@ -69708,8 +69734,7 @@
69708
69734
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
69709
69735
  this.refreshHeader();
69710
69736
  this.scenegraph.clearCells();
69711
- this.headerStyleCache = new Map();
69712
- this.bodyStyleCache = new Map();
69737
+ this.clearCellStyleCache();
69713
69738
  this.scenegraph.createSceneGraph();
69714
69739
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
69715
69740
  this.render();
@@ -69968,8 +69993,7 @@
69968
69993
  this.internalProps.autoWrapText = autoWrapText;
69969
69994
  this.options.autoWrapText = autoWrapText;
69970
69995
  this.scenegraph.clearCells();
69971
- this.headerStyleCache = new Map();
69972
- this.bodyStyleCache = new Map();
69996
+ this.clearCellStyleCache();
69973
69997
  this.scenegraph.createSceneGraph();
69974
69998
  this.render();
69975
69999
  }
@@ -69986,8 +70010,7 @@
69986
70010
  this.options.theme = theme;
69987
70011
  this.scenegraph.updateStageBackground();
69988
70012
  this.scenegraph.clearCells();
69989
- this.headerStyleCache = new Map();
69990
- this.bodyStyleCache = new Map();
70013
+ this.clearCellStyleCache();
69991
70014
  this.scenegraph.createSceneGraph();
69992
70015
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
69993
70016
  this.render();
@@ -70003,6 +70026,16 @@
70003
70026
  const cellType = this.internalProps.layoutMap.getBody(col, row).cellType;
70004
70027
  return getProp('cellType', { cellType }, col, row, this);
70005
70028
  }
70029
+ getCellType(col, row) {
70030
+ let cellType;
70031
+ if (this.isHeader(col, row)) {
70032
+ cellType = this.internalProps.layoutMap.getHeader(col, row).headerType;
70033
+ }
70034
+ else {
70035
+ cellType = this.internalProps.layoutMap.getBody(col, row).cellType;
70036
+ }
70037
+ return getProp('cellType', { cellType }, col, row, this);
70038
+ }
70006
70039
  getHeaderField(col, row) {
70007
70040
  return this.internalProps.layoutMap.getHeaderField(col, row);
70008
70041
  }
@@ -70191,7 +70224,19 @@
70191
70224
  const { layoutMap } = this.internalProps;
70192
70225
  const isHeader = layoutMap.isHeader(col, row);
70193
70226
  if (isHeader) {
70194
- let cacheStyle = this.headerStyleCache.get(`${col}-${row}`);
70227
+ let cacheKey;
70228
+ if (this.isPivotTable() && !this.isBottomFrozenRow(row) && !this.isRightFrozenColumn(col)) {
70229
+ const define = this.getHeaderDefine(col, row);
70230
+ cacheKey = define?.dimensionKey
70231
+ ? `dim-${define.dimensionKey}`
70232
+ : define?.indicatorKey
70233
+ ? `ind-${define.indicatorKey}`
70234
+ : `${col}-${row}`;
70235
+ }
70236
+ else {
70237
+ cacheKey = `${col}-${row}`;
70238
+ }
70239
+ let cacheStyle = this.headerStyleCache.get(cacheKey);
70195
70240
  if (cacheStyle) {
70196
70241
  return cacheStyle;
70197
70242
  }
@@ -70253,7 +70298,7 @@
70253
70298
  cellHeaderPaths: this.getCellHeaderPaths(col, row)
70254
70299
  }, styleClass, this.options.autoWrapText);
70255
70300
  }
70256
- this.headerStyleCache.set(`${col}-${row}`, cacheStyle);
70301
+ this.headerStyleCache.set(cacheKey, cacheStyle);
70257
70302
  return cacheStyle;
70258
70303
  }
70259
70304
  let cacheKey;
@@ -70286,6 +70331,7 @@
70286
70331
  }
70287
70332
  clearCellStyleCache() {
70288
70333
  this.headerStyleCache.clear();
70334
+ this.bodyStyleCache.clear();
70289
70335
  }
70290
70336
  clearRowHeightCache() {
70291
70337
  this.internalProps._rowHeightsMap.clear();
@@ -70418,7 +70464,10 @@
70418
70464
  lineThrough: !!theme.text.lineThrough,
70419
70465
  padding: theme._vtable.padding,
70420
70466
  underlineWidth: theme.text.underline,
70421
- lineThroughLineWidth: theme.text.lineThrough
70467
+ lineThroughLineWidth: theme.text.lineThrough,
70468
+ _strokeArrayWidth: theme.group.strokeArrayWidth,
70469
+ _strokeArrayColor: theme.group.strokeArrayColor,
70470
+ _linkColor: getProp('linkColor', actStyle, col, row, this)
70422
70471
  };
70423
70472
  }
70424
70473
  getAllBodyCells(colMaxCount, rowMaxCount) {
@@ -72709,6 +72758,7 @@
72709
72758
  _setRecords(this, records);
72710
72759
  }
72711
72760
  this.stateManager.initCheckedState(records);
72761
+ this.clearCellStyleCache();
72712
72762
  this.scenegraph.createSceneGraph();
72713
72763
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
72714
72764
  if (this.internalProps.title && !this.internalProps.title.isReleased) {
@@ -73023,6 +73073,7 @@
73023
73073
  value: '',
73024
73074
  children: [],
73025
73075
  level: -1,
73076
+ levelSpan: 1,
73026
73077
  startIndex: 0,
73027
73078
  size: 0,
73028
73079
  startInTotal: 0,
@@ -73127,21 +73178,33 @@
73127
73178
  }
73128
73179
  searchPath(index, node, path, maxDeep) {
73129
73180
  if (!node) {
73130
- return false;
73181
+ return;
73131
73182
  }
73132
73183
  if (index < node.startIndex || index >= node.startIndex + node.size) {
73133
- return false;
73184
+ return;
73134
73185
  }
73135
73186
  path.push(node);
73136
- if (!node.children || node.children.length === 0) {
73137
- return true;
73138
- }
73139
- if (node.level >= maxDeep) {
73140
- return true;
73187
+ if (!node.children || node.children.length === 0 || node.level >= maxDeep) {
73188
+ return;
73141
73189
  }
73142
73190
  const cIndex = index - node.startIndex;
73143
- node.children.some(n => this.searchPath(cIndex, n, path, maxDeep));
73144
- return true;
73191
+ let left = 0;
73192
+ let right = node.children.length - 1;
73193
+ while (left <= right) {
73194
+ const middle = Math.floor((left + right) / 2);
73195
+ const element = node.children[middle];
73196
+ if (cIndex >= element.startIndex && cIndex < element.startIndex + element.size) {
73197
+ this.searchPath(cIndex, element, path, maxDeep);
73198
+ break;
73199
+ }
73200
+ else if (cIndex < element.startIndex) {
73201
+ right = middle - 1;
73202
+ }
73203
+ else {
73204
+ left = middle + 1;
73205
+ }
73206
+ }
73207
+ return;
73145
73208
  }
73146
73209
  movePosition(level, sourceIndex, targetIndex) {
73147
73210
  let parNode;
@@ -73289,9 +73352,20 @@
73289
73352
  for (let r = row - 1; r >= 0; r--) {
73290
73353
  _headerCellIds[r][layoutMap.colIndex] = roots[r];
73291
73354
  }
73355
+ if (hd.levelSpan > 1) {
73356
+ for (let i = 1; i < hd.levelSpan; i++) {
73357
+ if (!_headerCellIds[row + i]) {
73358
+ _headerCellIds[row + i] = [];
73359
+ }
73360
+ _headerCellIds[row + i][layoutMap.colIndex] = id;
73361
+ }
73362
+ }
73292
73363
  if (hd.children?.length >= 1) {
73293
73364
  layoutMap
73294
- ._addHeaders(_headerCellIds, row + 1, hd.children ?? [], [...roots, id])
73365
+ ._addHeaders(_headerCellIds, row + (hd.levelSpan ?? 1), hd.children ?? [], [
73366
+ ...roots,
73367
+ ...Array(hd.levelSpan ?? 1).fill(id)
73368
+ ])
73295
73369
  .forEach(c => results.push(c));
73296
73370
  }
73297
73371
  else {
@@ -73402,6 +73476,7 @@
73402
73476
  colDimensionKeys = [];
73403
73477
  indicatorKeys = [];
73404
73478
  indicatorDimensionKey = IndicatorDimensionKeyPlaceholder;
73479
+ _largeCellRangeCache;
73405
73480
  _CellHeaderPathMap;
73406
73481
  _table;
73407
73482
  extensionRows;
@@ -73425,6 +73500,7 @@
73425
73500
  this.extensionRows = table.options.extensionRows;
73426
73501
  }
73427
73502
  this.dataset = dataset;
73503
+ this._largeCellRangeCache = [];
73428
73504
  this._CellHeaderPathMap = new Map();
73429
73505
  this.rowTree = table.internalProps.rowTree;
73430
73506
  this.columnTree = table.internalProps.columnTree;
@@ -73492,6 +73568,7 @@
73492
73568
  this.columnHeaderObjs = this._addHeaders(this._columnHeaderCellIds, 0, this.columnDimensionTree.tree.children, []);
73493
73569
  }
73494
73570
  if (this.columnHeaderTitle) {
73571
+ this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
73495
73572
  const id = ++this.sharedVar.seqId;
73496
73573
  const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
73497
73574
  this._columnHeaderCellIds.unshift(firstRowIds);
@@ -73525,6 +73602,7 @@
73525
73602
  : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, []);
73526
73603
  }
73527
73604
  if (this.rowHeaderTitle) {
73605
+ this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
73528
73606
  const id = ++this.sharedVar.seqId;
73529
73607
  const firstColIds = Array(this._rowHeaderCellIds_FULL[0]?.length ?? this.rowDimensionTree.tree.size).fill(id);
73530
73608
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
@@ -73578,6 +73656,7 @@
73578
73656
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
73579
73657
  });
73580
73658
  }
73659
+ this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
73581
73660
  if (this.cornerSetting.titleOnDimension === 'column') {
73582
73661
  this.cornerHeaderObjs = this._addCornerHeaders(this.columnHeaderTitle ? [''].concat(this.colDimensionKeys) : this.colDimensionKeys, this.columnsDefine);
73583
73662
  }
@@ -74329,6 +74408,12 @@
74329
74408
  if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) {
74330
74409
  return result;
74331
74410
  }
74411
+ for (let i = 0; i < this._largeCellRangeCache.length; i++) {
74412
+ const range = this._largeCellRangeCache[i];
74413
+ if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
74414
+ return range;
74415
+ }
74416
+ }
74332
74417
  if (this.isHeader(col, row) && col !== -1 && row !== -1) {
74333
74418
  const id = this.getCellId(col, row);
74334
74419
  for (let c = col - 1; c >= 0; c--) {
@@ -74356,6 +74441,9 @@
74356
74441
  result.end.row = r;
74357
74442
  }
74358
74443
  }
74444
+ if (result.end.col - result.start.col > 100 || result.end.row - result.start.row > 100) {
74445
+ this._largeCellRangeCache.push(result);
74446
+ }
74359
74447
  return result;
74360
74448
  }
74361
74449
  isCellRangeEqual(col, row, targetCol, targetRow) {
@@ -74406,6 +74494,12 @@
74406
74494
  if (this._CellHeaderPathMap.has(`${col}-${row}`)) {
74407
74495
  return this._CellHeaderPathMap.get(`${col}-${row}`);
74408
74496
  }
74497
+ for (let i = 0; i < this._largeCellRangeCache.length; i++) {
74498
+ const range = this._largeCellRangeCache[i];
74499
+ if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
74500
+ break;
74501
+ }
74502
+ }
74409
74503
  const recordCol = this.getBodyIndexByCol(col);
74410
74504
  const recordRow = this.getBodyIndexByRow(row) + this.currentPageStartIndex;
74411
74505
  let colPath = [];
@@ -74581,6 +74675,7 @@
74581
74675
  return o;
74582
74676
  }, {});
74583
74677
  this._CellHeaderPathMap = new Map();
74678
+ this._largeCellRangeCache.length = 0;
74584
74679
  const diffCell = diffCellAddress(col, row, oldRowHeaderCellIds.map(oldCellId => oldCellId[col]), this._rowHeaderCellIds_FULL.map(newCellId => newCellId[col]), oldRowHeaderCellPositons, this);
74585
74680
  this._rowHeaderCellIds = this._rowHeaderCellIds_FULL;
74586
74681
  return diffCell;
@@ -74798,6 +74893,7 @@
74798
74893
  this.columnDimensionTree.movePosition(source.row, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount);
74799
74894
  this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, true);
74800
74895
  this._CellHeaderPathMap = new Map();
74896
+ this._largeCellRangeCache.length = 0;
74801
74897
  return {
74802
74898
  sourceIndex: sourceCellRange.start.col,
74803
74899
  targetIndex,
@@ -74831,6 +74927,7 @@
74831
74927
  this.rowDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths.length - 1, sourceCellRange.start.row - this.columnHeaderLevelCount, targetIndex + (target.row > source.row ? sourceRowHeaderNode.size - 1 : 0));
74832
74928
  this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, true);
74833
74929
  this._CellHeaderPathMap = new Map();
74930
+ this._largeCellRangeCache.length = 0;
74834
74931
  return {
74835
74932
  sourceIndex: sourceCellRange.start.row,
74836
74933
  targetIndex: targetIndex + this.columnHeaderLevelCount,
@@ -75133,6 +75230,7 @@
75133
75230
  return undefined;
75134
75231
  }
75135
75232
  clearCellRangeMap() {
75233
+ this._largeCellRangeCache.length = 0;
75136
75234
  this._CellHeaderPathMap = new Map();
75137
75235
  }
75138
75236
  getDimensionKeyInChartSpec(_col, _row) {
@@ -76063,12 +76161,12 @@
76063
76161
  }
76064
76162
  else {
76065
76163
  if (this.rowHierarchyType === 'tree') {
76066
- this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? undefined : this.indicators, this?.totals?.row?.showGrandTotals ||
76164
+ this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? undefined : this.indicators, this.totals?.row?.showGrandTotals ||
76067
76165
  (!this.indicatorsAsCol && this.columns.length === 0) ||
76068
76166
  (this.indicatorsAsCol && this.rows.length === 0), this.rowGrandTotalLabel);
76069
76167
  }
76070
76168
  else {
76071
- this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, this.indicatorsAsCol ? undefined : this.indicators, this.rowsIsTotal, this?.totals?.row?.showGrandTotals || (this.indicatorsAsCol && this.rows.length === 0), this.rowGrandTotalLabel, this.rowSubTotalLabel);
76169
+ this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, this.indicatorsAsCol ? undefined : this.indicators, this.rowsIsTotal, this.totals?.row?.showGrandTotals || (this.indicatorsAsCol && this.rows.length === 0), this.rowGrandTotalLabel, this.rowSubTotalLabel, this.totals?.row?.showGrandTotalsOnTop ?? false, this.totals?.row?.showSubTotalsOnTop ?? false);
76072
76170
  }
76073
76171
  }
76074
76172
  if (this.customColTree) {
@@ -76078,7 +76176,7 @@
76078
76176
  this.colHeaderTree = this.customColTree;
76079
76177
  }
76080
76178
  else {
76081
- this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : undefined, this.colsIsTotal, this.totals?.column?.showGrandTotals || (!this.indicatorsAsCol && this.columns.length === 0), this.colGrandTotalLabel, this.colSubTotalLabel);
76179
+ this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : undefined, this.colsIsTotal, this.totals?.column?.showGrandTotals || (!this.indicatorsAsCol && this.columns.length === 0), this.colGrandTotalLabel, this.colSubTotalLabel, this.totals?.column?.showGrandTotalsOnLeft ?? false, this.totals?.column?.showSubTotalsOnLeft ?? false);
76082
76180
  }
76083
76181
  typeof window !== 'undefined' ? window.performance.now() : 0;
76084
76182
  if (this.dataConfig?.isPivotChart) {
@@ -76795,7 +76893,7 @@
76795
76893
  }
76796
76894
  return result;
76797
76895
  }
76798
- ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel) {
76896
+ ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel, showGrandTotalsOnTop, showSubTotalsOnTop) {
76799
76897
  let result = [];
76800
76898
  const concatStr = this.stringJoinChar;
76801
76899
  const map = new Map();
@@ -76827,32 +76925,31 @@
76827
76925
  };
76828
76926
  if (subTotalFlags[index]) {
76829
76927
  let curChild = item.children;
76830
- for (let i = index; i < list.length - 1; i++) {
76831
- const totalChild = {
76832
- value: subTotalLabel,
76833
- dimensionKey: rows[index + 1],
76834
- children: index + 1 === list.length - 1 && indicators?.length >= 1
76835
- ? indicators?.map(indicator => {
76836
- if (typeof indicator === 'string') {
76837
- return {
76838
- indicatorKey: indicator,
76839
- value: indicator
76840
- };
76841
- }
76928
+ const totalChild = {
76929
+ value: subTotalLabel,
76930
+ dimensionKey: rows[index + 1],
76931
+ levelSpan: subTotalFlags.length - index - 1,
76932
+ children: indicators?.length >= 1
76933
+ ? indicators?.map(indicator => {
76934
+ if (typeof indicator === 'string') {
76842
76935
  return {
76843
- indicatorKey: indicator.indicatorKey,
76844
- value: indicator.title
76936
+ indicatorKey: indicator,
76937
+ value: indicator
76845
76938
  };
76846
- })
76847
- : []
76848
- };
76849
- curChild.push(totalChild);
76850
- curChild = totalChild.children;
76851
- }
76939
+ }
76940
+ return {
76941
+ indicatorKey: indicator.indicatorKey,
76942
+ value: indicator.title
76943
+ };
76944
+ })
76945
+ : []
76946
+ };
76947
+ curChild.push(totalChild);
76948
+ curChild = totalChild.children;
76852
76949
  }
76853
76950
  map.set(flatKey, item);
76854
76951
  if (node) {
76855
- if (subTotalFlags[index - 1]) {
76952
+ if (subTotalFlags[index - 1] && !showSubTotalsOnTop) {
76856
76953
  node.children.splice(node.children.length - 1, 0, item);
76857
76954
  }
76858
76955
  else {
@@ -76878,7 +76975,7 @@
76878
76975
  const node = {
76879
76976
  value: grandTotalLabel,
76880
76977
  dimensionKey: rows[0],
76881
- rowSpan: subTotalFlags.length,
76978
+ levelSpan: subTotalFlags.length,
76882
76979
  children: indicators?.map(indicator => {
76883
76980
  if (typeof indicator === 'string') {
76884
76981
  return {
@@ -76892,7 +76989,12 @@
76892
76989
  };
76893
76990
  }) ?? []
76894
76991
  };
76895
- result.push(node);
76992
+ if (showGrandTotalsOnTop) {
76993
+ result.unshift(node);
76994
+ }
76995
+ else {
76996
+ result.push(node);
76997
+ }
76896
76998
  }
76897
76999
  return result;
76898
77000
  }
@@ -77625,6 +77727,7 @@
77625
77727
  }
77626
77728
  this.refreshHeader();
77627
77729
  this.scenegraph.clearCells();
77730
+ this.clearCellStyleCache();
77628
77731
  this.scenegraph.createSceneGraph();
77629
77732
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
77630
77733
  if (this.internalProps.title && !this.internalProps.title.isReleased) {
@@ -78520,6 +78623,7 @@
78520
78623
  internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
78521
78624
  this.refreshHeader();
78522
78625
  this.scenegraph.clearCells();
78626
+ this.clearCellStyleCache();
78523
78627
  this.scenegraph.createSceneGraph();
78524
78628
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
78525
78629
  if (this.internalProps.title && !this.internalProps.title.isReleased) {
@@ -79037,7 +79141,7 @@
79037
79141
  return new Tag$1(params ? params.attribute : {});
79038
79142
  }
79039
79143
 
79040
- const version = "0.16.4-alpha.1";
79144
+ const version = "0.17.0";
79041
79145
  function getIcons() {
79042
79146
  return get$2();
79043
79147
  }