@visactor/vtable 1.19.5 → 1.19.7

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 (111) hide show
  1. package/cjs/ListTable.d.ts +0 -4
  2. package/cjs/ListTable.js +11 -18
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.js +6 -4
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.d.ts +0 -8
  7. package/cjs/PivotTable.js +2 -30
  8. package/cjs/PivotTable.js.map +1 -1
  9. package/cjs/components/legend/discrete-legend/discrete-legend.js +6 -4
  10. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  11. package/cjs/components/menu/dom/MenuHandler.js +42 -4
  12. package/cjs/components/menu/dom/MenuHandler.js.map +1 -1
  13. package/cjs/components/menu/dom/logic/MenuElement.js +1 -0
  14. package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
  15. package/cjs/core/BaseTable.d.ts +3 -1
  16. package/cjs/core/BaseTable.js +37 -7
  17. package/cjs/core/BaseTable.js.map +1 -1
  18. package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
  19. package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
  20. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  21. package/cjs/data/CachedDataSource.js +1 -1
  22. package/cjs/data/CachedDataSource.js.map +1 -1
  23. package/cjs/event/listener/table-group.js.map +1 -1
  24. package/cjs/index.d.ts +1 -1
  25. package/cjs/index.js +1 -1
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/layout/simple-header-layout.js +1 -1
  28. package/cjs/layout/simple-header-layout.js.map +1 -1
  29. package/cjs/scenegraph/component/table-component.js +10 -8
  30. package/cjs/scenegraph/component/table-component.js.map +1 -1
  31. package/cjs/scenegraph/icon/icon-update.js +1 -1
  32. package/cjs/scenegraph/icon/icon-update.js.map +1 -1
  33. package/cjs/scenegraph/layout/compute-col-width.js +47 -2
  34. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  35. package/cjs/scenegraph/scenegraph.d.ts +1 -0
  36. package/cjs/scenegraph/scenegraph.js +17 -1
  37. package/cjs/scenegraph/scenegraph.js.map +1 -1
  38. package/cjs/scenegraph/utils/text-icon-layout.js +1 -0
  39. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  40. package/cjs/state/resize/update-resize-column.js +1 -1
  41. package/cjs/state/resize/update-resize-column.js.map +1 -1
  42. package/cjs/state/resize/update-resize-row.js +1 -1
  43. package/cjs/state/resize/update-resize-row.js.map +1 -1
  44. package/cjs/themes/theme-define.js +4 -0
  45. package/cjs/themes/theme-define.js.map +1 -1
  46. package/cjs/ts-types/base-table.d.ts +11 -0
  47. package/cjs/ts-types/base-table.js.map +1 -1
  48. package/cjs/ts-types/events.d.ts +2 -0
  49. package/cjs/ts-types/events.js.map +1 -1
  50. package/cjs/ts-types/table-engine.d.ts +20 -13
  51. package/cjs/ts-types/table-engine.js.map +1 -1
  52. package/cjs/ts-types/theme.d.ts +1 -0
  53. package/cjs/ts-types/theme.js.map +1 -1
  54. package/cjs/vrender.js.map +1 -1
  55. package/dist/vtable.js +247 -97
  56. package/dist/vtable.min.js +2 -2
  57. package/es/ListTable.d.ts +0 -4
  58. package/es/ListTable.js +11 -18
  59. package/es/ListTable.js.map +1 -1
  60. package/es/PivotChart.js +6 -4
  61. package/es/PivotChart.js.map +1 -1
  62. package/es/PivotTable.d.ts +0 -8
  63. package/es/PivotTable.js +2 -30
  64. package/es/PivotTable.js.map +1 -1
  65. package/es/components/legend/discrete-legend/discrete-legend.js +6 -4
  66. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  67. package/es/components/menu/dom/MenuHandler.js +42 -4
  68. package/es/components/menu/dom/MenuHandler.js.map +1 -1
  69. package/es/components/menu/dom/logic/MenuElement.js +1 -0
  70. package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
  71. package/es/core/BaseTable.d.ts +3 -1
  72. package/es/core/BaseTable.js +37 -7
  73. package/es/core/BaseTable.js.map +1 -1
  74. package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
  75. package/es/core/TABLE_EVENT_TYPE.js +1 -0
  76. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  77. package/es/data/CachedDataSource.js +1 -1
  78. package/es/data/CachedDataSource.js.map +1 -1
  79. package/es/event/listener/table-group.js.map +1 -1
  80. package/es/index.d.ts +1 -1
  81. package/es/index.js +1 -1
  82. package/es/index.js.map +1 -1
  83. package/es/layout/simple-header-layout.js +1 -1
  84. package/es/layout/simple-header-layout.js.map +1 -1
  85. package/es/scenegraph/component/table-component.js +10 -8
  86. package/es/scenegraph/component/table-component.js.map +1 -1
  87. package/es/scenegraph/icon/icon-update.js +1 -1
  88. package/es/scenegraph/icon/icon-update.js.map +1 -1
  89. package/es/scenegraph/layout/compute-col-width.js +47 -2
  90. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  91. package/es/scenegraph/scenegraph.d.ts +1 -0
  92. package/es/scenegraph/scenegraph.js +21 -1
  93. package/es/scenegraph/scenegraph.js.map +1 -1
  94. package/es/scenegraph/utils/text-icon-layout.js +1 -0
  95. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  96. package/es/state/resize/update-resize-column.js +1 -1
  97. package/es/state/resize/update-resize-column.js.map +1 -1
  98. package/es/state/resize/update-resize-row.js +1 -1
  99. package/es/state/resize/update-resize-row.js.map +1 -1
  100. package/es/themes/theme-define.js +4 -0
  101. package/es/themes/theme-define.js.map +1 -1
  102. package/es/ts-types/base-table.d.ts +11 -0
  103. package/es/ts-types/base-table.js.map +1 -1
  104. package/es/ts-types/events.d.ts +2 -0
  105. package/es/ts-types/events.js.map +1 -1
  106. package/es/ts-types/table-engine.d.ts +20 -13
  107. package/es/ts-types/table-engine.js.map +1 -1
  108. package/es/ts-types/theme.d.ts +1 -0
  109. package/es/ts-types/theme.js.map +1 -1
  110. package/es/vrender.js.map +1 -1
  111. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -34905,6 +34905,7 @@
34905
34905
  MOUSEENTER_CELL: 'mouseenter_cell',
34906
34906
  MOUSELEAVE_CELL: 'mouseleave_cell',
34907
34907
  CONTEXTMENU_CELL: 'contextmenu_cell',
34908
+ CONTEXTMENU_CANVAS: 'contextmenu_canvas',
34908
34909
  RESIZE_COLUMN: 'resize_column',
34909
34910
  RESIZE_COLUMN_END: 'resize_column_end',
34910
34911
  RESIZE_ROW: 'resize_row',
@@ -36402,6 +36403,9 @@
36402
36403
  },
36403
36404
  get verticalPadding() {
36404
36405
  return scroll.verticalPadding ?? 0;
36406
+ },
36407
+ get ignoreFrozenCols() {
36408
+ return scroll.ignoreFrozenCols ?? false;
36405
36409
  }
36406
36410
  };
36407
36411
  }
@@ -39769,8 +39773,8 @@
39769
39773
  if (isValid$3(newRecord)) {
39770
39774
  newRecord.hierarchyState = oldSource[i].hierarchyState;
39771
39775
  }
39772
- if (isArray$7(oldRecord.children) &&
39773
- isArray$7(newRecord.children) &&
39776
+ if (isArray$7(oldRecord?.children) &&
39777
+ isArray$7(newRecord?.children) &&
39774
39778
  oldRecord.map.size !== 0 &&
39775
39779
  newRecord.map.size !== 0) {
39776
39780
  syncGroupCollapseState(oldRecord.children, newRecord.children, oldRecord.map, newRecord.map);
@@ -42647,6 +42651,9 @@
42647
42651
  });
42648
42652
  }
42649
42653
  function dealWithIcon(icon, mark, col, row, range, table, dealWithIconComputeVar) {
42654
+ if (!icon) {
42655
+ return undefined;
42656
+ }
42650
42657
  const iconAttribute = {};
42651
42658
  if (icon.type === 'image') {
42652
42659
  if (icon.isGif) {
@@ -46419,19 +46426,19 @@
46419
46426
  const visible1 = theme.scrollStyle?.visible;
46420
46427
  const horizontalVisible = theme.scrollStyle?.horizontalVisible ?? visible1;
46421
46428
  const verticalVisible = theme.scrollStyle?.verticalVisible ?? visible1;
46422
- const tableWidth = Math.ceil(this.table.scenegraph.tableGroup.attribute.width);
46423
- const tableHeight = Math.ceil(this.table.scenegraph.tableGroup.attribute.height);
46429
+ const tableWidth = Math.ceil(this.table.tableNoFrameWidth);
46430
+ const tableHeight = Math.ceil(this.table.tableNoFrameHeight);
46424
46431
  const totalHeight = this.table.getAllRowsHeight();
46425
46432
  const totalWidth = this.table.getAllColsWidth();
46426
46433
  const frozenRowsHeight = this.table.getFrozenRowsHeight();
46427
46434
  const frozenColsWidth = this.table.getFrozenColsWidth();
46428
46435
  const bottomFrozenRowsHeight = this.table.getBottomFrozenRowsHeight();
46429
46436
  const rightFrozenColsWidth = this.table.getRightFrozenColsWidth();
46437
+ const hoverOn = this.table.theme.scrollStyle.hoverOn;
46430
46438
  const sizeTolerance = this.table.options.customConfig?._disableColumnAndRowSizeRound ? 1 : 0;
46431
46439
  if (totalWidth > tableWidth + sizeTolerance) {
46432
46440
  const y = Math.min(tableHeight, totalHeight);
46433
46441
  const rangeEnd = Math.max(0.05, (tableWidth - frozenColsWidth) / (totalWidth - frozenColsWidth));
46434
- const hoverOn = this.table.theme.scrollStyle.hoverOn;
46435
46442
  let attrY = 0;
46436
46443
  if (this.table.theme.scrollStyle.barToSide) {
46437
46444
  attrY =
@@ -46442,10 +46449,21 @@
46442
46449
  else {
46443
46450
  attrY = y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
46444
46451
  }
46452
+ let hScrollBarx = frozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
46453
+ let hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
46454
+ const ignoreFrozenCols = this.table.theme.scrollStyle?.ignoreFrozenCols ?? false;
46455
+ if (ignoreFrozenCols) {
46456
+ hScrollBarx = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
46457
+ hScrollBarWidth = tableWidth;
46458
+ }
46459
+ else {
46460
+ hScrollBarx = frozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
46461
+ hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
46462
+ }
46445
46463
  this.hScrollBar.setAttributes({
46446
- x: frozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0),
46464
+ x: hScrollBarx,
46447
46465
  y: attrY,
46448
- width: tableWidth - frozenColsWidth - rightFrozenColsWidth,
46466
+ width: hScrollBarWidth,
46449
46467
  range: [0, rangeEnd],
46450
46468
  visible: horizontalVisible === 'always'
46451
46469
  });
@@ -46470,7 +46488,6 @@
46470
46488
  const x = Math.min(tableWidth, totalWidth);
46471
46489
  const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));
46472
46490
  let attrX = 0;
46473
- const hoverOn = this.table.theme.scrollStyle.hoverOn;
46474
46491
  if (this.table.theme.scrollStyle.barToSide) {
46475
46492
  attrX =
46476
46493
  this.table.tableNoFrameWidth -
@@ -49127,11 +49144,10 @@
49127
49144
  });
49128
49145
 
49129
49146
  function computeColsWidth(table, colStart, colEnd, update) {
49130
- table.internalProps.columnWidthConfig &&
49131
- table._parseColumnWidthConfig(table.internalProps.columnWidthConfig);
49147
+ table.internalProps.columnWidthConfig && _parseColumnWidthConfig(table, table.internalProps.columnWidthConfig);
49132
49148
  table.isPivotTable() &&
49133
49149
  table.internalProps.columnWidthConfigForRowHeader &&
49134
- table._parseColumnWidthConfigForRowHeader(table.internalProps.columnWidthConfigForRowHeader);
49150
+ _parseColumnWidthConfigForPivotRowHeader(table, table.internalProps.columnWidthConfigForRowHeader);
49135
49151
  colStart = colStart ?? 0;
49136
49152
  colEnd = colEnd ?? table.colCount - 1;
49137
49153
  if (colStart === 0 && colEnd === table.colCount - 1) {
@@ -49689,6 +49705,83 @@
49689
49705
  }
49690
49706
  }
49691
49707
  }
49708
+ function _parseColumnWidthConfig(table, columnWidthConfig) {
49709
+ if (table.isPivotTable()) {
49710
+ _parseColumnWidthConfigForPivotTable(table, columnWidthConfig);
49711
+ }
49712
+ else if (table.isListTable()) {
49713
+ _parseColumnWidthConfigForListTable(table, columnWidthConfig);
49714
+ }
49715
+ }
49716
+ function _parseColumnWidthConfigForListTable(table, columnWidthConfig) {
49717
+ for (let i = 0; i < columnWidthConfig?.length; i++) {
49718
+ const item = columnWidthConfig[i];
49719
+ const key = item.key;
49720
+ const width = item.width;
49721
+ const columnData = table.internalProps.layoutMap.getColumnByKey(key);
49722
+ if (columnData.columnDefine) {
49723
+ const { col } = columnData;
49724
+ if (!table.internalProps._widthResizedColMap.has(col)) {
49725
+ table._setColWidth(col, width);
49726
+ table.internalProps._widthResizedColMap.add(col);
49727
+ }
49728
+ }
49729
+ }
49730
+ }
49731
+ function _parseColumnWidthConfigForPivotTable(table, columnWidthConfig) {
49732
+ for (let i = 0; i < columnWidthConfig?.length; i++) {
49733
+ const item = columnWidthConfig[i];
49734
+ const dimensions = item.dimensions;
49735
+ const width = item.width;
49736
+ const cell = table.getCellAddressByHeaderPaths(dimensions);
49737
+ if (cell && cell.col >= table.rowHeaderLevelCount) {
49738
+ const cellPath = table.getCellHeaderPaths(cell.col, table.columnHeaderLevelCount);
49739
+ if (cellPath.colHeaderPaths.length === dimensions.length) {
49740
+ let match = true;
49741
+ for (let i = 0; i < dimensions.length; i++) {
49742
+ const dimension = dimensions[i];
49743
+ const finded = cellPath.colHeaderPaths.findIndex((colPath, index) => {
49744
+ if (colPath.indicatorKey === dimension.indicatorKey) {
49745
+ return true;
49746
+ }
49747
+ if (colPath.dimensionKey === dimension.dimensionKey && colPath.value === dimension.value) {
49748
+ return true;
49749
+ }
49750
+ return false;
49751
+ });
49752
+ if (finded < 0) {
49753
+ match = false;
49754
+ break;
49755
+ }
49756
+ }
49757
+ if (match && !table.internalProps._widthResizedColMap.has(cell.col)) {
49758
+ table._setColWidth(cell.col, width);
49759
+ table.internalProps._widthResizedColMap.add(cell.col);
49760
+ }
49761
+ }
49762
+ }
49763
+ else if (cell && cell.col < table.rowHeaderLevelCount) {
49764
+ if (!table.internalProps._widthResizedColMap.has(cell.col)) {
49765
+ table._setColWidth(cell.col, width);
49766
+ table.internalProps._widthResizedColMap.add(cell.col);
49767
+ }
49768
+ }
49769
+ }
49770
+ }
49771
+ function _parseColumnWidthConfigForPivotRowHeader(table, columnWidthConfig) {
49772
+ for (let i = 0; i < columnWidthConfig?.length; i++) {
49773
+ const item = columnWidthConfig[i];
49774
+ const dimensions = item.dimensions;
49775
+ const width = item.width;
49776
+ const cell = table.getCellAddressByHeaderPaths(dimensions);
49777
+ if (cell && cell.col < table.rowHeaderLevelCount) {
49778
+ if (!table.internalProps._widthResizedColMap.has(cell.col)) {
49779
+ table._setColWidth(cell.col, width);
49780
+ table.internalProps._widthResizedColMap.add(cell.col);
49781
+ }
49782
+ }
49783
+ }
49784
+ }
49692
49785
 
49693
49786
  const emptyGroup = new Group$1({});
49694
49787
  emptyGroup.role = 'empty';
@@ -54124,7 +54217,7 @@
54124
54217
  }
54125
54218
  updateCellRangeIcon(col, row, (icon) => icon.attribute.funcType === IconFuncTypeEnum.collapse || icon.attribute.funcType === IconFuncTypeEnum.expand, (icon) => {
54126
54219
  dealWithIcon(iconConfig, icon);
54127
- icon.name = iconConfig.name;
54220
+ icon.name = iconConfig?.name;
54128
54221
  }, scene);
54129
54222
  }
54130
54223
  function updateCellGroupIcon(cellGroup, filter, dealer) {
@@ -54710,6 +54803,22 @@
54710
54803
  this.isPivot = this.table.isPivotTable();
54711
54804
  initSceneGraph(this);
54712
54805
  }
54806
+ canvasShowMenu() {
54807
+ this.stage.addEventListener('rightdown', (e) => {
54808
+ const eventArgsSet = getCellEventArgsSet(e);
54809
+ if (!eventArgsSet.eventArgs) {
54810
+ this.table.stateManager.triggerContextMenu(-1, -1, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
54811
+ this.table.fireListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CANVAS, {
54812
+ event: e,
54813
+ x: eventArgsSet.abstractPos.x,
54814
+ y: eventArgsSet.abstractPos.y,
54815
+ col: -1,
54816
+ row: -1,
54817
+ target: undefined
54818
+ });
54819
+ }
54820
+ });
54821
+ }
54713
54822
  clearCells() {
54714
54823
  this.table.animationManager.clear();
54715
54824
  if (this.table.isPivotChart() || this.table._hasCustomRenderOrLayout()) {
@@ -55556,6 +55665,9 @@
55556
55665
  if (this.table.options.animationAppear) {
55557
55666
  dealWithAnimationAppear(this.table);
55558
55667
  }
55668
+ if (this.table.options.menu?.contextMenuWorkOnlyCell === false) {
55669
+ this.canvasShowMenu();
55670
+ }
55559
55671
  this.updateNextFrame();
55560
55672
  }
55561
55673
  dealWidthMode() {
@@ -57406,6 +57518,7 @@
57406
57518
  }
57407
57519
  state.columnResize.x = xInTable;
57408
57520
  state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen);
57521
+ state.table._updateSize();
57409
57522
  if (state.columnResize.col < state.table.frozenColCount &&
57410
57523
  !state.table.isPivotTable() &&
57411
57524
  !state.table.transpose) {
@@ -58064,6 +58177,7 @@
58064
58177
  }
58065
58178
  state.rowResize.y = yInTable;
58066
58179
  state.table.scenegraph.component.updateResizeRow(state.rowResize.row, xInTable, state.rowResize.isBottomFrozen);
58180
+ state.table._updateSize();
58067
58181
  state.table.scenegraph.updateNextFrame();
58068
58182
  }
58069
58183
  function updateResizeColForRow(detaY, state) {
@@ -63258,6 +63372,9 @@
63258
63372
  const rect = table.getCellRangeRelativeRect({ col, row });
63259
63373
  const element = table.internalProps.menu.parentElement ?? table.getElement();
63260
63374
  const { top, bottom, left, right } = rect;
63375
+ if (col === -1 && row === -1) {
63376
+ return true;
63377
+ }
63261
63378
  if (table.isFrozenCell(col, row)) {
63262
63379
  return true;
63263
63380
  }
@@ -67147,7 +67264,7 @@
67147
67264
  return TABLE_EVENT_TYPE;
67148
67265
  }
67149
67266
  options;
67150
- version = "1.19.5";
67267
+ version = "1.19.7";
67151
67268
  pagination;
67152
67269
  id = `VTable${Date.now()}`;
67153
67270
  headerStyleCache;
@@ -67839,8 +67956,17 @@
67839
67956
  widthP = this.canvasWidth - 1;
67840
67957
  heightP = this.canvasHeight - 1;
67841
67958
  }
67842
- const width = Math.floor(widthP - getVerticalScrollBarSize(this.getTheme().scrollStyle));
67843
- const height = Math.floor(heightP - getHorizontalScrollBarSize(this.getTheme().scrollStyle));
67959
+ const scrollStyle = this.getTheme().scrollStyle;
67960
+ let vScrollBarWidth = 0;
67961
+ let hScrollBarWidth = 0;
67962
+ vScrollBarWidth = this.shouldVScrollBarWidthShow(widthP, heightP, scrollStyle)
67963
+ ? getVerticalScrollBarSize(scrollStyle)
67964
+ : 0;
67965
+ hScrollBarWidth = this.shouldHScrollBarWidthShow(widthP, heightP, scrollStyle)
67966
+ ? getHorizontalScrollBarSize(scrollStyle)
67967
+ : 0;
67968
+ const width = Math.floor(widthP - vScrollBarWidth);
67969
+ const height = Math.floor(heightP - hScrollBarWidth);
67844
67970
  if (this.internalProps.theme?.frameStyle) {
67845
67971
  const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
67846
67972
  const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
@@ -67853,15 +67979,67 @@
67853
67979
  else {
67854
67980
  this.tableX = (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
67855
67981
  this.tableY = (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
67982
+ const rightBorder = (lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0);
67856
67983
  this.tableNoFrameWidth =
67857
- width - ((lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0)) - ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
67984
+ width -
67985
+ (rightBorder > vScrollBarWidth ? rightBorder - vScrollBarWidth : 0) -
67986
+ ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
67987
+ const bottomBorder = (lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0);
67858
67988
  this.tableNoFrameHeight =
67859
- height - ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0)) - ((lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0));
67989
+ height -
67990
+ (bottomBorder > hScrollBarWidth ? bottomBorder - hScrollBarWidth : 0) -
67991
+ ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0));
67860
67992
  }
67861
67993
  }
67862
67994
  this._clearColRangeWidthsMap();
67863
67995
  this._clearRowRangeHeightsMap();
67864
67996
  }
67997
+ shouldVScrollBarWidthShow(tableWidth, tableHeight, scrollStyle) {
67998
+ if (scrollStyle.hoverOn || scrollStyle.visible === 'none') {
67999
+ return false;
68000
+ }
68001
+ const totalHeight = this.getAllRowsHeight();
68002
+ const sizeTolerance = scrollStyle.visible ? getHorizontalScrollBarSize(scrollStyle) : 0;
68003
+ const isHScrollBarDecideVScrollBar = totalHeight > tableHeight - sizeTolerance && totalHeight <= tableHeight;
68004
+ if (isHScrollBarDecideVScrollBar) {
68005
+ const totalWidth = this.getAllColsWidth();
68006
+ const sizeTolerance = scrollStyle.visible ? getVerticalScrollBarSize(scrollStyle) : 0;
68007
+ const isVScrollBarDecideHScrollBar = totalWidth > tableWidth - sizeTolerance && totalWidth <= tableWidth;
68008
+ if (isVScrollBarDecideHScrollBar) {
68009
+ return false;
68010
+ }
68011
+ if (totalWidth > tableWidth) {
68012
+ return true;
68013
+ }
68014
+ if (totalWidth <= tableWidth - sizeTolerance) {
68015
+ return false;
68016
+ }
68017
+ }
68018
+ return !(totalHeight <= tableHeight - sizeTolerance);
68019
+ }
68020
+ shouldHScrollBarWidthShow(tableWidth, tableHeight, scrollStyle) {
68021
+ if (scrollStyle.hoverOn || scrollStyle.visible === 'none') {
68022
+ return false;
68023
+ }
68024
+ const totalWidth = this.getAllColsWidth();
68025
+ const sizeTolerance = scrollStyle.visible ? getVerticalScrollBarSize(scrollStyle) : 0;
68026
+ const isVScrollBarDecideHScrollBar = totalWidth > tableWidth - sizeTolerance && totalWidth <= tableWidth;
68027
+ if (isVScrollBarDecideHScrollBar) {
68028
+ const totalHeight = this.getAllRowsHeight();
68029
+ const sizeTolerance = scrollStyle.visible ? getHorizontalScrollBarSize(scrollStyle) : 0;
68030
+ const isHScrollBarDecideVScrollBar = totalHeight > tableHeight - sizeTolerance && totalHeight <= tableHeight;
68031
+ if (isHScrollBarDecideVScrollBar) {
68032
+ return false;
68033
+ }
68034
+ if (totalHeight > tableHeight) {
68035
+ return true;
68036
+ }
68037
+ if (totalHeight <= tableHeight - sizeTolerance) {
68038
+ return false;
68039
+ }
68040
+ }
68041
+ return !(totalWidth <= tableWidth - sizeTolerance);
68042
+ }
67865
68043
  updateViewBox(newViewBox) {
67866
68044
  const oldWidth = (this.options?.viewBox?.x2 ?? 0) - (this.options?.viewBox?.x1 ?? 0);
67867
68045
  const oldHeight = (this.options?.viewBox?.y2 ?? 0) - (this.options?.viewBox?.y1 ?? 0);
@@ -72996,7 +73174,7 @@
72996
73174
  }
72997
73175
  const expand = !hd.hierarchyState || hd.hierarchyState === HierarchyState.expand;
72998
73176
  if (!!hd.columns && !!expand) {
72999
- const isAllHided = hd.columns.every((c) => c.hide);
73177
+ const isAllHided = hd.columns.every((c) => c.hide) || hd.hide;
73000
73178
  !isAllHided &&
73001
73179
  this._addHeaders(maxRow + 1, hd.columns, [...roots, id], hd.hideColumnsSubHeader || hideColumnsSubHeader, hd.levelSpan).forEach(c => results.push(c));
73002
73180
  }
@@ -74570,7 +74748,6 @@
74570
74748
  if (options.title) {
74571
74749
  const Title = Factory.getComponent('title');
74572
74750
  internalProps.title = new Title(options.title, this);
74573
- this.scenegraph.resize();
74574
74751
  }
74575
74752
  if (this.options.emptyTip) {
74576
74753
  if (this.internalProps.emptyTip) {
@@ -74587,6 +74764,7 @@
74587
74764
  this.listTreeStickCellPlugin = new ListTreeStickCellPlugin(this);
74588
74765
  }
74589
74766
  setTimeout(() => {
74767
+ this.resize();
74590
74768
  this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
74591
74769
  }, 0);
74592
74770
  }
@@ -74645,6 +74823,7 @@
74645
74823
  this.headerStyleCache = new Map();
74646
74824
  this.bodyStyleCache = new Map();
74647
74825
  this.bodyBottomStyleCache = new Map();
74826
+ this._updateSize();
74648
74827
  this.scenegraph.createSceneGraph();
74649
74828
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
74650
74829
  this.renderAsync();
@@ -74976,6 +75155,9 @@
74976
75155
  table.colCount = layoutMap.colCount ?? 0;
74977
75156
  table.rowCount = layoutMap.recordsCount * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount;
74978
75157
  this.internalProps.frozenColCount = this.options.frozenColCount ?? 0;
75158
+ if (this.options.frozenColCount >= this.colCount) {
75159
+ this.internalProps.frozenColCount = 0;
75160
+ }
74979
75161
  table.frozenRowCount = Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0);
74980
75162
  if (table.bottomFrozenRowCount !== (this.options.bottomFrozenRowCount ?? 0)) {
74981
75163
  table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0;
@@ -75306,6 +75488,7 @@
75306
75488
  this.refreshRowColCount();
75307
75489
  this.stateManager.initCheckedState(this.records);
75308
75490
  this.scenegraph.createSceneGraph();
75491
+ this.resize();
75309
75492
  }
75310
75493
  getCheckboxState(field) {
75311
75494
  if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount) {
@@ -75420,11 +75603,11 @@
75420
75603
  this.clearCellStyleCache();
75421
75604
  this.scenegraph.createSceneGraph();
75422
75605
  this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
75606
+ this._updateSize();
75423
75607
  if (this.internalProps.title && !this.internalProps.title.isReleased) {
75424
- this._updateSize();
75425
75608
  this.internalProps.title.resize();
75426
- this.scenegraph.resize();
75427
75609
  }
75610
+ this.scenegraph.resize();
75428
75611
  if (this.options.emptyTip) {
75429
75612
  if (this.internalProps.emptyTip) {
75430
75613
  this.internalProps.emptyTip?.resetVisible();
@@ -75591,21 +75774,6 @@
75591
75774
  }
75592
75775
  return this.dataSource.getTableIndex(index);
75593
75776
  }
75594
- _parseColumnWidthConfig(columnWidthConfig) {
75595
- for (let i = 0; i < columnWidthConfig?.length; i++) {
75596
- const item = columnWidthConfig[i];
75597
- const key = item.key;
75598
- const width = item.width;
75599
- const columnData = this.internalProps.layoutMap.getColumnByKey(key);
75600
- if (columnData.columnDefine) {
75601
- const { col } = columnData;
75602
- if (!this.internalProps._widthResizedColMap.has(col)) {
75603
- this._setColWidth(col, width);
75604
- this.internalProps._widthResizedColMap.add(col);
75605
- }
75606
- }
75607
- }
75608
- }
75609
75777
  release() {
75610
75778
  this.editorManager.release();
75611
75779
  super.release();
@@ -77738,10 +77906,11 @@
77738
77906
  if (!this.legendComponent || this.visible === false) {
77739
77907
  return;
77740
77908
  }
77741
- this.legendComponent.setAttributes({
77742
- maxWidth: this.table.tableNoFrameWidth,
77743
- maxHeight: this.table.tableNoFrameHeight
77909
+ const attrs = this.getLegendAttributes({
77910
+ width: this.table.tableNoFrameWidth,
77911
+ height: this.table.tableNoFrameHeight
77744
77912
  });
77913
+ this.legendComponent.setAttributes(attrs);
77745
77914
  this.adjustTableSize(this.legendComponent.attribute);
77746
77915
  }
77747
77916
  adjustTableSize(attrs) {
@@ -78431,6 +78600,19 @@
78431
78600
  }
78432
78601
  };
78433
78602
  function getMenuInstanceInfo(table, col, row, type, dropDownMenuOptions) {
78603
+ if (col === -1 && row === -1 && type === 'context-menu') {
78604
+ if (dropDownMenuOptions?.content) {
78605
+ return {
78606
+ type,
78607
+ position: dropDownMenuOptions.position,
78608
+ referencePosition: dropDownMenuOptions.referencePosition ?? {
78609
+ rect: { left: 0, right: 0, top: 0, bottom: 0, width: 0, height: 0 }
78610
+ },
78611
+ content: dropDownMenuOptions.content
78612
+ };
78613
+ }
78614
+ return null;
78615
+ }
78434
78616
  const { lineHeight, textBaseline, textStick } = table._getCellStyle(col, row);
78435
78617
  let rect = table.getCellRangeRelativeRect(table.getCellRange(col, row));
78436
78618
  if (textStick) {
@@ -78513,7 +78695,9 @@
78513
78695
  const { instance, info: menuInstanceInfo } = instanceInfo;
78514
78696
  const attach = instance && instance.bindMenuElement(col, row, menuInstanceInfo);
78515
78697
  if (attach) {
78516
- const range = this._table.getCellRange(col, row);
78698
+ const range = col === -1 && row === -1
78699
+ ? { start: { col: -1, row: -1 }, end: { col: -1, row: -1 } }
78700
+ : this._table.getCellRange(col, row);
78517
78701
  this._attachInfo = { range, instance };
78518
78702
  }
78519
78703
  }
@@ -78574,6 +78758,22 @@
78574
78758
  });
78575
78759
  }
78576
78760
  });
78761
+ table.on(TABLE_EVENT_TYPE.CONTEXTMENU_CANVAS, e => {
78762
+ if (table.internalProps.menu?.renderMode === 'html') {
78763
+ const abstractPos = table._getMouseAbstractPoint(e.event);
78764
+ let menu = null;
78765
+ if (abstractPos.inTable && typeof table.internalProps.menu?.contextMenuItems === 'function') {
78766
+ menu = table.internalProps.menu.contextMenuItems(table.getHeaderField(e.col, e.row), e.row, e.col, table);
78767
+ }
78768
+ else if (abstractPos.inTable && Array.isArray(table.internalProps.menu?.contextMenuItems)) {
78769
+ menu = table.internalProps.menu?.contextMenuItems;
78770
+ }
78771
+ this._bindToCell(-1, -1, 'context-menu', {
78772
+ content: menu,
78773
+ position: { x: abstractPos.x, y: abstractPos.y }
78774
+ });
78775
+ }
78776
+ });
78577
78777
  }
78578
78778
  _getMenuInstanceInfo(col, row, type, dropDownMenuOptions) {
78579
78779
  const table = this._table;
@@ -87725,7 +87925,6 @@
87725
87925
  if (options.title) {
87726
87926
  const Title = Factory.getComponent('title');
87727
87927
  this.internalProps.title = new Title(options.title, this);
87728
- this.scenegraph.resize();
87729
87928
  }
87730
87929
  if (this.options.emptyTip) {
87731
87930
  if (this.internalProps.emptyTip) {
@@ -87738,6 +87937,7 @@
87738
87937
  }
87739
87938
  }
87740
87939
  setTimeout(() => {
87940
+ this.resize();
87741
87941
  this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
87742
87942
  }, 0);
87743
87943
  }
@@ -88445,60 +88645,6 @@
88445
88645
  });
88446
88646
  }
88447
88647
  }
88448
- _parseColumnWidthConfig(columnWidthConfig) {
88449
- for (let i = 0; i < columnWidthConfig?.length; i++) {
88450
- const item = columnWidthConfig[i];
88451
- const dimensions = item.dimensions;
88452
- const width = item.width;
88453
- const cell = this.getCellAddressByHeaderPaths(dimensions);
88454
- if (cell && cell.col >= this.rowHeaderLevelCount) {
88455
- const cellPath = this.getCellHeaderPaths(cell.col, this.columnHeaderLevelCount);
88456
- if (cellPath.colHeaderPaths.length === dimensions.length) {
88457
- let match = true;
88458
- for (let i = 0; i < dimensions.length; i++) {
88459
- const dimension = dimensions[i];
88460
- const finded = cellPath.colHeaderPaths.findIndex((colPath, index) => {
88461
- if (colPath.indicatorKey === dimension.indicatorKey) {
88462
- return true;
88463
- }
88464
- if (colPath.dimensionKey === dimension.dimensionKey && colPath.value === dimension.value) {
88465
- return true;
88466
- }
88467
- return false;
88468
- });
88469
- if (finded < 0) {
88470
- match = false;
88471
- break;
88472
- }
88473
- }
88474
- if (match && !this.internalProps._widthResizedColMap.has(cell.col)) {
88475
- this._setColWidth(cell.col, width);
88476
- this.internalProps._widthResizedColMap.add(cell.col);
88477
- }
88478
- }
88479
- }
88480
- else if (cell && cell.col < this.rowHeaderLevelCount) {
88481
- if (!this.internalProps._widthResizedColMap.has(cell.col)) {
88482
- this._setColWidth(cell.col, width);
88483
- this.internalProps._widthResizedColMap.add(cell.col);
88484
- }
88485
- }
88486
- }
88487
- }
88488
- _parseColumnWidthConfigForRowHeader(columnWidthConfig) {
88489
- for (let i = 0; i < columnWidthConfig?.length; i++) {
88490
- const item = columnWidthConfig[i];
88491
- const dimensions = item.dimensions;
88492
- const width = item.width;
88493
- const cell = this.getCellAddressByHeaderPaths(dimensions);
88494
- if (cell && cell.col < this.rowHeaderLevelCount) {
88495
- if (!this.internalProps._widthResizedColMap.has(cell.col)) {
88496
- this._setColWidth(cell.col, width);
88497
- this.internalProps._widthResizedColMap.add(cell.col);
88498
- }
88499
- }
88500
- }
88501
- }
88502
88648
  updatePivotSortState(pivotSortStateConfig) {
88503
88649
  this.pivotSortState = pivotSortStateConfig;
88504
88650
  }
@@ -89370,6 +89516,8 @@
89370
89516
  this.internalProps.columnResizeType = options.resize?.columnResizeType ?? options.columnResizeType ?? 'column';
89371
89517
  this.internalProps.rowResizeType = options.resize?.rowResizeType ?? options.rowResizeType ?? 'row';
89372
89518
  this.internalProps.dataConfig = { isPivotChart: true };
89519
+ this.internalProps.columnWidthConfig = options.columnWidthConfig;
89520
+ this.internalProps.columnWidthConfigForRowHeader = options.columnWidthConfigForRowHeader;
89373
89521
  this._axes = isArray$7(options.axes) ? options.axes : [];
89374
89522
  let columnDimensionTree;
89375
89523
  let rowDimensionTree;
@@ -89467,7 +89615,6 @@
89467
89615
  if (options.title) {
89468
89616
  const Title = Factory.getComponent('title');
89469
89617
  this.internalProps.title = new Title(options.title, this);
89470
- this.scenegraph.resize();
89471
89618
  }
89472
89619
  if (this.options.emptyTip) {
89473
89620
  if (this.internalProps.emptyTip) {
@@ -89480,6 +89627,7 @@
89480
89627
  }
89481
89628
  }
89482
89629
  setTimeout(() => {
89630
+ this.resize();
89483
89631
  this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
89484
89632
  }, 0);
89485
89633
  }
@@ -89530,6 +89678,8 @@
89530
89678
  internalProps.columnResizeType = options.resize?.columnResizeType ?? options.columnResizeType ?? 'column';
89531
89679
  internalProps.rowResizeType = options.resize?.rowResizeType ?? options.rowResizeType ?? 'row';
89532
89680
  internalProps.dataConfig = { isPivotChart: true };
89681
+ this.internalProps.columnWidthConfig = options.columnWidthConfig;
89682
+ this.internalProps.columnWidthConfigForRowHeader = options.columnWidthConfigForRowHeader;
89533
89683
  this._axes = isArray$7(options.axes) ? options.axes : [];
89534
89684
  let columnDimensionTree;
89535
89685
  let rowDimensionTree;
@@ -91036,7 +91186,7 @@
91036
91186
  }
91037
91187
 
91038
91188
  registerForVrender();
91039
- const version = "1.19.5";
91189
+ const version = "1.19.7";
91040
91190
  function getIcons() {
91041
91191
  return get$2();
91042
91192
  }