@visactor/vtable 1.10.3 → 1.10.4-alpha.2

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 (75) hide show
  1. package/cjs/core/BaseTable.js +1 -1
  2. package/cjs/core/BaseTable.js.map +1 -1
  3. package/cjs/event/event.js +11 -3
  4. package/cjs/event/event.js.map +1 -1
  5. package/cjs/index.d.ts +4 -1
  6. package/cjs/index.js +3 -2
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/plugins/carousel-animation.d.ts +29 -0
  9. package/cjs/plugins/carousel-animation.js +64 -0
  10. package/cjs/plugins/carousel-animation.js.map +1 -0
  11. package/cjs/plugins/chartModules.js +1 -1
  12. package/cjs/plugins/custom-cell-style.js +22 -15
  13. package/cjs/plugins/custom-cell-style.js.map +1 -1
  14. package/cjs/plugins/header-highlight.d.ts +21 -0
  15. package/cjs/plugins/header-highlight.js +106 -0
  16. package/cjs/plugins/header-highlight.js.map +1 -0
  17. package/cjs/plugins/invert-highlight.d.ts +19 -0
  18. package/cjs/plugins/invert-highlight.js +72 -0
  19. package/cjs/plugins/invert-highlight.js.map +1 -0
  20. package/cjs/scenegraph/graphic/group.js +2 -1
  21. package/cjs/scenegraph/graphic/group.js.map +1 -1
  22. package/cjs/scenegraph/group-creater/cell-helper.js +5 -4
  23. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  24. package/cjs/scenegraph/layout/compute-row-height.js +7 -7
  25. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  26. package/cjs/scenegraph/layout/update-height.js +2 -2
  27. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  28. package/cjs/scenegraph/utils/text-icon-layout.d.ts +1 -1
  29. package/cjs/scenegraph/utils/text-icon-layout.js +9 -8
  30. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  31. package/cjs/tools/cell-range.d.ts +2 -0
  32. package/cjs/tools/cell-range.js +10 -0
  33. package/cjs/tools/cell-range.js.map +1 -0
  34. package/cjs/ts-types/base-table.d.ts +6 -2
  35. package/cjs/ts-types/base-table.js.map +1 -1
  36. package/cjs/vrender.js.map +1 -1
  37. package/dist/vtable.js +409 -32
  38. package/dist/vtable.min.js +2 -2
  39. package/es/core/BaseTable.js +1 -1
  40. package/es/core/BaseTable.js.map +1 -1
  41. package/es/event/event.js +11 -3
  42. package/es/event/event.js.map +1 -1
  43. package/es/index.d.ts +4 -1
  44. package/es/index.js +7 -1
  45. package/es/index.js.map +1 -1
  46. package/es/plugins/carousel-animation.d.ts +29 -0
  47. package/es/plugins/carousel-animation.js +56 -0
  48. package/es/plugins/carousel-animation.js.map +1 -0
  49. package/es/plugins/chartModules.js +1 -1
  50. package/es/plugins/custom-cell-style.js +22 -15
  51. package/es/plugins/custom-cell-style.js.map +1 -1
  52. package/es/plugins/header-highlight.d.ts +21 -0
  53. package/es/plugins/header-highlight.js +98 -0
  54. package/es/plugins/header-highlight.js.map +1 -0
  55. package/es/plugins/invert-highlight.d.ts +19 -0
  56. package/es/plugins/invert-highlight.js +69 -0
  57. package/es/plugins/invert-highlight.js.map +1 -0
  58. package/es/scenegraph/graphic/group.js +2 -1
  59. package/es/scenegraph/graphic/group.js.map +1 -1
  60. package/es/scenegraph/group-creater/cell-helper.js +6 -3
  61. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  62. package/es/scenegraph/layout/compute-row-height.js +7 -7
  63. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  64. package/es/scenegraph/layout/update-height.js +2 -2
  65. package/es/scenegraph/layout/update-height.js.map +1 -1
  66. package/es/scenegraph/utils/text-icon-layout.d.ts +1 -1
  67. package/es/scenegraph/utils/text-icon-layout.js +9 -8
  68. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  69. package/es/tools/cell-range.d.ts +2 -0
  70. package/es/tools/cell-range.js +4 -0
  71. package/es/tools/cell-range.js.map +1 -0
  72. package/es/ts-types/base-table.d.ts +6 -2
  73. package/es/ts-types/base-table.js.map +1 -1
  74. package/es/vrender.js.map +1 -1
  75. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -33531,6 +33531,9 @@
33531
33531
  this._AABBBounds.setValue(x, y, x + width, y + height);
33532
33532
  this.parent && this.parent.addChildUpdateBoundTag();
33533
33533
  this.clearUpdateBoundTag();
33534
+ if (this.shadowRoot) {
33535
+ this.shadowRoot.tryUpdateAABBBounds();
33536
+ }
33534
33537
  return this._AABBBounds;
33535
33538
  }
33536
33539
  else if (this.role === 'body' ||
@@ -33961,12 +33964,18 @@
33961
33964
  autoWrapText,
33962
33965
  lineClamp,
33963
33966
  wordBreak: 'break-word',
33964
- heightLimit: autoRowHeight && !table.options.customConfig?.multilinesForXTable
33967
+ heightLimit: table.options.customConfig?.limitContentHeight === false
33965
33968
  ? -1
33966
- : cellHeight - Math.floor(padding[0] + padding[2]),
33969
+ : autoRowHeight && !table.options.customConfig?.multilinesForXTable
33970
+ ? -1
33971
+ : cellHeight - Math.floor(padding[0] + padding[2]),
33967
33972
  pickable: false,
33968
33973
  dx: (textAlign === 'left' ? hierarchyOffset : 0) + _contentOffset,
33969
- whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
33974
+ whiteSpace: table.options.customConfig?.limitContentHeight === false
33975
+ ? 'normal'
33976
+ : text.length === 1 && !autoWrapText
33977
+ ? 'no-wrap'
33978
+ : 'normal'
33970
33979
  };
33971
33980
  const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
33972
33981
  wrapText.name = 'text';
@@ -34003,14 +34012,20 @@
34003
34012
  ? Infinity
34004
34013
  : cellWidth - (padding[1] + padding[3]) - leftIconWidth - rightIconWidth - hierarchyOffset,
34005
34014
  textBaseline: 'top',
34006
- heightLimit: autoRowHeight && !table.options.customConfig?.multilinesForXTable
34015
+ heightLimit: table.options.customConfig?.limitContentHeight === false
34007
34016
  ? -1
34008
- : cellHeight - Math.floor(padding[0] + padding[2]),
34017
+ : autoRowHeight && !table.options.customConfig?.multilinesForXTable
34018
+ ? -1
34019
+ : cellHeight - Math.floor(padding[0] + padding[2]),
34009
34020
  pickable: false,
34010
34021
  autoWrapText,
34011
34022
  lineClamp,
34012
34023
  wordBreak: 'break-word',
34013
- whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal',
34024
+ whiteSpace: table.options.customConfig?.limitContentHeight === false
34025
+ ? 'normal'
34026
+ : text.length === 1 && !autoWrapText
34027
+ ? 'no-wrap'
34028
+ : 'normal',
34014
34029
  dx: (textAlign === 'left' ? (!contentLeftIcons.length ? hierarchyOffset : 0) : 0) + _contentOffset
34015
34030
  };
34016
34031
  const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
@@ -34333,12 +34348,12 @@
34333
34348
  }
34334
34349
  return false;
34335
34350
  }
34336
- function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline) {
34351
+ function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline, table) {
34337
34352
  const newHeight = distHeight - Math.floor(padding[0] + padding[2]);
34338
34353
  const textMark = cellGroup.getChildByName('text');
34339
34354
  if (textMark instanceof Text$1 && !autoRowHeight) {
34340
34355
  textMark.setAttributes({
34341
- heightLimit: newHeight
34356
+ heightLimit: table.options.customConfig?.limitContentHeight === false ? -1 : newHeight
34342
34357
  });
34343
34358
  }
34344
34359
  else if (textMark instanceof RichText && !autoRowHeight) {
@@ -34903,6 +34918,107 @@
34903
34918
  });
34904
34919
  }
34905
34920
 
34921
+ function isSameRange$1(range1, range2) {
34922
+ if (!range1 && !range2) {
34923
+ return true;
34924
+ }
34925
+ if (!range1 || !range2) {
34926
+ return false;
34927
+ }
34928
+ return (range1.start.col === range2.start.col &&
34929
+ range1.start.row === range2.start.row &&
34930
+ range1.end.col === range2.end.col &&
34931
+ range1.end.row === range2.end.row);
34932
+ }
34933
+
34934
+ class InvertHighlightPlugin {
34935
+ table;
34936
+ range;
34937
+ _fill;
34938
+ _opacity;
34939
+ constructor(table, options) {
34940
+ this.table = table;
34941
+ this._fill = options?.fill ?? '#000';
34942
+ this._opacity = options?.opacity ?? 0.5;
34943
+ }
34944
+ setInvertHighlightRange(range) {
34945
+ if (isSameRange$1(this.range, range)) {
34946
+ return;
34947
+ }
34948
+ this.range = range;
34949
+ if (!range) {
34950
+ this.deleteAllCellGroupShadow();
34951
+ }
34952
+ else {
34953
+ this.updateCellGroupShadow();
34954
+ }
34955
+ this.table.scenegraph.updateNextFrame();
34956
+ }
34957
+ deleteAllCellGroupShadow() {
34958
+ if (!this.table.isPivotTable()) {
34959
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup);
34960
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup);
34961
+ }
34962
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup);
34963
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup);
34964
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup);
34965
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);
34966
+ }
34967
+ updateCellGroupShadow() {
34968
+ if (!this.table.isPivotTable()) {
34969
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range);
34970
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range);
34971
+ }
34972
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range);
34973
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range);
34974
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup), this.range;
34975
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);
34976
+ }
34977
+ updateCellGroupShadowInContainer(container, range) {
34978
+ container.forEachChildrenSkipChild((column) => {
34979
+ if (column.role === 'column') {
34980
+ column.forEachChildrenSkipChild((cell) => {
34981
+ if (cell.role !== 'cell') {
34982
+ return;
34983
+ }
34984
+ cell.attachShadow(cell.shadowRoot);
34985
+ const shadowGroup = cell.shadowRoot;
34986
+ if (!range) {
34987
+ shadowGroup.removeAllChild();
34988
+ }
34989
+ else if (cellInRange(range, cell.col, cell.row)) {
34990
+ shadowGroup.removeAllChild();
34991
+ }
34992
+ else if (!shadowGroup.firstChild) {
34993
+ const shadowRect = createRect({
34994
+ x: 0,
34995
+ y: 0,
34996
+ width: cell.attribute.width,
34997
+ height: cell.attribute.height,
34998
+ fill: this._fill,
34999
+ opacity: this._opacity
35000
+ });
35001
+ shadowRect.name = 'shadow-rect';
35002
+ shadowGroup.appendChild(shadowRect);
35003
+ }
35004
+ });
35005
+ }
35006
+ });
35007
+ }
35008
+ }
35009
+ function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
35010
+ const graphic = this;
35011
+ if (graphic.shadowRoot && graphic.shadowRoot.childrenCount && (isValid$1(val.width) || isValid$1(val.height))) {
35012
+ const shadowRect = graphic.shadowRoot.findChildrenByName('shadow-rect')[0];
35013
+ if (shadowRect) {
35014
+ shadowRect.setAttributes({
35015
+ width: val.width ?? shadowRect.attribute.width,
35016
+ height: val.height ?? shadowRect.attribute.height
35017
+ });
35018
+ }
35019
+ }
35020
+ }
35021
+
34906
35022
  function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
34907
35023
  let isAsync = false;
34908
35024
  let cellGroup;
@@ -35021,6 +35137,7 @@
35021
35137
  const createRadioCellGroup = Factory.getFunction('createRadioCellGroup');
35022
35138
  cellGroup = createRadioCellGroup(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define);
35023
35139
  }
35140
+ cellGroup.onBeforeAttributeUpdate = onBeforeAttributeUpdateForInvertHighlight;
35024
35141
  return cellGroup;
35025
35142
  }
35026
35143
  function updateCell$1(col, row, table, addNew, isShadow) {
@@ -35276,7 +35393,7 @@
35276
35393
  continue;
35277
35394
  }
35278
35395
  if (range.start.row !== range.end.row && cellGroup.contentHeight !== cellHeight) {
35279
- updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline);
35396
+ updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table);
35280
35397
  }
35281
35398
  if (range.start.col !== range.end.col && cellGroup.contentWidth !== cellWidth) {
35282
35399
  updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table.scenegraph);
@@ -35292,7 +35409,7 @@
35292
35409
  function dealWithMergeCellSizeForShadow(range, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellGroup) {
35293
35410
  const { col, row } = cellGroup;
35294
35411
  if (range.start.row !== range.end.row && cellGroup.contentHeight !== cellHeight) {
35295
- updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline);
35412
+ updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table);
35296
35413
  }
35297
35414
  if (range.start.col !== range.end.col && cellGroup.contentWidth !== cellWidth) {
35298
35415
  updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table.scenegraph);
@@ -35697,7 +35814,8 @@
35697
35814
  table.defaultHeaderColWidth;
35698
35815
  const isDefaultHeaderHasAuto = table.defaultHeaderRowHeight === 'auto' ||
35699
35816
  (isArray$1(table.defaultHeaderRowHeight) && table.defaultHeaderRowHeight.some(item => item === 'auto'));
35700
- const isAllRowsAuto = table.heightMode === 'autoHeight' || table.heightMode === 'adaptive';
35817
+ const isAllRowsAuto = table.heightMode === 'autoHeight' ||
35818
+ (table.heightMode === 'adaptive' && table.options.autoHeightInAdaptiveMode !== false);
35701
35819
  if (isAllRowsAuto || isDefaultHeaderHasAuto) {
35702
35820
  rowStart = rowStart ?? 0;
35703
35821
  rowEnd = rowEnd ?? table.rowCount - 1;
@@ -35717,7 +35835,9 @@
35717
35835
  if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') {
35718
35836
  const height = computeRowHeight(row, startCol, endCol, table);
35719
35837
  newHeights[row] = Math.round(height);
35720
- table._setRowHeight(row, height);
35838
+ if (table.heightAdaptiveMode === 'only-body' || !update) {
35839
+ table._setRowHeight(row, height);
35840
+ }
35721
35841
  }
35722
35842
  }
35723
35843
  for (let row = table.rowCount - table.bottomFrozenRowCount; row <= rowEnd; row++) {
@@ -35882,7 +36002,7 @@
35882
36002
  if (update) {
35883
36003
  for (let row = rowStart; row <= rowEnd; row++) {
35884
36004
  const newRowHeight = newHeights[row] ?? table.getRowHeight(row);
35885
- if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
36005
+ if (isValid$1(newRowHeight)) {
35886
36006
  table._setRowHeight(row, newRowHeight);
35887
36007
  }
35888
36008
  }
@@ -36491,7 +36611,7 @@
36491
36611
  });
36492
36612
  if (renderDefault) {
36493
36613
  const style = table._getCellStyle(colStart, rowStart);
36494
- updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline);
36614
+ updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, table);
36495
36615
  }
36496
36616
  const rangeHeight = table.getRowHeight(row);
36497
36617
  const rangeWidth = table.getColWidth(col);
@@ -36514,7 +36634,7 @@
36514
36634
  }
36515
36635
  else {
36516
36636
  const style = table._getCellStyle(cellGroup.col, cellGroup.row);
36517
- updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline);
36637
+ updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, table);
36518
36638
  }
36519
36639
  }
36520
36640
 
@@ -51756,7 +51876,11 @@
51756
51876
  }
51757
51877
  else if (!this.table.isHeader(eventArgs.col, eventArgs.row) && define?.disableSelect) {
51758
51878
  if (!isSelectMoving) {
51879
+ const isHasSelected = !!this.table.stateManager.select.ranges?.length;
51759
51880
  this.table.stateManager.updateSelectPos(-1, -1);
51881
+ if (isHasSelected) {
51882
+ this.table.stateManager.endSelectCells(true, isHasSelected);
51883
+ }
51760
51884
  }
51761
51885
  return false;
51762
51886
  }
@@ -54002,19 +54126,24 @@
54002
54126
  }
54003
54127
  getCustomCellStyleId(col, row) {
54004
54128
  let customStyleId;
54005
- this.customCellStyleArrangement.forEach(style => {
54006
- if (style.cellPosition.range) {
54007
- if (style.cellPosition.range.start.col <= col &&
54008
- style.cellPosition.range.end.col >= col &&
54009
- style.cellPosition.range.start.row <= row &&
54010
- style.cellPosition.range.end.row >= row) {
54011
- customStyleId = style.customStyleId;
54012
- }
54013
- }
54014
- else if (style.cellPosition.col === col && style.cellPosition.row === row) {
54015
- customStyleId = style.customStyleId;
54129
+ const range = this.table.getCellRange(col, row);
54130
+ for (let c = range.start.col; c <= range.end.col; c++) {
54131
+ for (let r = range.start.row; r <= range.end.row; r++) {
54132
+ this.customCellStyleArrangement.forEach(style => {
54133
+ if (style.cellPosition.range) {
54134
+ if (style.cellPosition.range.start.col <= c &&
54135
+ style.cellPosition.range.end.col >= c &&
54136
+ style.cellPosition.range.start.row <= r &&
54137
+ style.cellPosition.range.end.row >= r) {
54138
+ customStyleId = style.customStyleId;
54139
+ }
54140
+ }
54141
+ else if (style.cellPosition.col === c && style.cellPosition.row === r) {
54142
+ customStyleId = style.customStyleId;
54143
+ }
54144
+ });
54016
54145
  }
54017
- });
54146
+ }
54018
54147
  return customStyleId;
54019
54148
  }
54020
54149
  getCustomCellStyleOption(customStyleId) {
@@ -54061,7 +54190,10 @@
54061
54190
  }
54062
54191
  return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;
54063
54192
  });
54064
- if (index === -1) {
54193
+ if (index === -1 && !customStyleId) {
54194
+ return;
54195
+ }
54196
+ else if (index === -1 && customStyleId) {
54065
54197
  this.customCellStyleArrangement.push({
54066
54198
  cellPosition: {
54067
54199
  col: cellPos.col,
@@ -54074,13 +54206,21 @@
54074
54206
  else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {
54075
54207
  return;
54076
54208
  }
54077
- else {
54209
+ else if (customStyleId) {
54078
54210
  this.customCellStyleArrangement[index].customStyleId = customStyleId;
54079
54211
  }
54212
+ else {
54213
+ this.customCellStyleArrangement.splice(index, 1);
54214
+ }
54080
54215
  if (cellPos.range) {
54081
54216
  for (let col = cellPos.range.start.col; col <= cellPos.range.end.col; col++) {
54082
54217
  for (let row = cellPos.range.start.row; row <= cellPos.range.end.row; row++) {
54083
- this.table.scenegraph.updateCellContent(col, row);
54218
+ const range = this.table.getCellRange(col, row);
54219
+ for (let c = range.start.col; c <= range.end.col; c++) {
54220
+ for (let r = range.start.row; r <= range.end.row; r++) {
54221
+ this.table.scenegraph.updateCellContent(c, r);
54222
+ }
54223
+ }
54084
54224
  }
54085
54225
  }
54086
54226
  }
@@ -56114,7 +56254,7 @@
56114
56254
  return TABLE_EVENT_TYPE;
56115
56255
  }
56116
56256
  options;
56117
- version = "1.10.3";
56257
+ version = "1.10.4-alpha.2";
56118
56258
  pagination;
56119
56259
  id = `VTable${Date.now()}`;
56120
56260
  headerStyleCache;
@@ -75435,8 +75575,241 @@
75435
75575
  return new Radio(params ? params.attribute : {});
75436
75576
  }
75437
75577
 
75578
+ class CarouselAnimationPlugin {
75579
+ table;
75580
+ rowCount;
75581
+ colCount;
75582
+ animationDuration;
75583
+ animationDelay;
75584
+ animationEasing;
75585
+ replaceScrollAction;
75586
+ playing;
75587
+ row;
75588
+ col;
75589
+ constructor(table, options) {
75590
+ this.table = table;
75591
+ this.rowCount = options?.rowCount ?? undefined;
75592
+ this.colCount = options?.colCount ?? undefined;
75593
+ this.animationDuration = options?.animationDuration ?? 500;
75594
+ this.animationDelay = options?.animationDelay ?? 1000;
75595
+ this.animationEasing = options?.animationEasing ?? 'linear';
75596
+ this.replaceScrollAction = options?.replaceScrollAction ?? false;
75597
+ this.playing = false;
75598
+ this.row = table.frozenRowCount;
75599
+ this.col = table.frozenColCount;
75600
+ this.init();
75601
+ }
75602
+ init() {
75603
+ if (this.replaceScrollAction) {
75604
+ this.table.disableScroll();
75605
+ this.table.scenegraph.stage.addEventListener('wheel', this.onScrollEnd.bind(this));
75606
+ }
75607
+ }
75608
+ onScrollEnd(e) {
75609
+ if (this.rowCount) {
75610
+ if (e.deltaY > 0) {
75611
+ this.row += this.rowCount;
75612
+ this.row = Math.min(this.row, this.table.rowCount - this.table.frozenRowCount);
75613
+ }
75614
+ else if (e.deltaY < 0) {
75615
+ this.row -= this.rowCount;
75616
+ this.row = Math.max(this.row, this.table.frozenRowCount);
75617
+ }
75618
+ this.table.scrollToRow(this.row, { duration: this.animationDuration, easing: this.animationEasing });
75619
+ }
75620
+ else if (this.colCount) {
75621
+ if (e.deltaX > 0) {
75622
+ this.col += this.colCount;
75623
+ this.col = Math.min(this.col, this.table.colCount - this.table.frozenColCount);
75624
+ }
75625
+ else if (e.deltaX < 0) {
75626
+ this.col -= this.colCount;
75627
+ this.col = Math.max(this.col, this.table.frozenColCount);
75628
+ }
75629
+ this.table.scrollToCol(this.col, { duration: this.animationDuration, easing: this.animationEasing });
75630
+ }
75631
+ }
75632
+ play() {
75633
+ this.playing = true;
75634
+ if (this.rowCount) {
75635
+ this.updateRow();
75636
+ }
75637
+ else if (this.colCount) {
75638
+ this.updateCol();
75639
+ }
75640
+ }
75641
+ pause() {
75642
+ this.playing = false;
75643
+ }
75644
+ updateRow() {
75645
+ if (!this.playing) {
75646
+ return;
75647
+ }
75648
+ let animation = true;
75649
+ if (this.table.scenegraph.proxy.screenTopRow !== this.row) {
75650
+ this.row = this.table.frozenRowCount;
75651
+ animation = false;
75652
+ }
75653
+ else {
75654
+ this.row += this.rowCount;
75655
+ }
75656
+ this.table.scrollToRow(this.row, animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined);
75657
+ setTimeout(() => {
75658
+ this.updateRow();
75659
+ }, animation ? this.animationDuration + this.animationDelay : 0);
75660
+ }
75661
+ updateCol() {
75662
+ if (!this.playing) {
75663
+ return;
75664
+ }
75665
+ let animation = true;
75666
+ if (this.table.scenegraph.proxy.screenLeftCol !== this.col) {
75667
+ this.col = this.table.frozenColCount;
75668
+ animation = false;
75669
+ }
75670
+ else {
75671
+ this.col += this.colCount;
75672
+ }
75673
+ this.table.scrollToCol(this.col, animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined);
75674
+ setTimeout(() => {
75675
+ this.updateCol();
75676
+ }, animation ? this.animationDuration + this.animationDelay : 0);
75677
+ }
75678
+ }
75679
+
75680
+ class HeaderHighlightPlugin {
75681
+ table;
75682
+ options;
75683
+ colHeaderRange;
75684
+ rowHeaderRange;
75685
+ constructor(table, options) {
75686
+ this.table = table;
75687
+ this.options = options;
75688
+ this.registerStyle();
75689
+ this.bindEvent();
75690
+ }
75691
+ registerStyle() {
75692
+ this.table.registerCustomCellStyle('col-highlight', {
75693
+ bgColor: this.options?.colHighlightBGColor ?? '#82b2f5',
75694
+ color: this.options?.colHighlightColor ?? '#FFF'
75695
+ });
75696
+ this.table.registerCustomCellStyle('row-highlight', {
75697
+ bgColor: this.options?.rowHighlightBGColor ?? '#82b2f5',
75698
+ color: this.options?.rowHighlightColor ?? '#FFF'
75699
+ });
75700
+ }
75701
+ bindEvent() {
75702
+ this.table.on('selected_cell', e => {
75703
+ this.updateHighlight();
75704
+ });
75705
+ this.table.on('selected_clear', () => {
75706
+ this.clearHighlight();
75707
+ });
75708
+ }
75709
+ clearHighlight() {
75710
+ this.colHeaderRange && this.table.arrangeCustomCellStyle({ range: this.colHeaderRange }, undefined);
75711
+ this.rowHeaderRange && this.table.arrangeCustomCellStyle({ range: this.rowHeaderRange }, undefined);
75712
+ this.colHeaderRange = undefined;
75713
+ this.rowHeaderRange = undefined;
75714
+ }
75715
+ updateHighlight() {
75716
+ if (this.options?.colHighlight === false && this.options?.rowHighlight === false) {
75717
+ return;
75718
+ }
75719
+ const selectRanges = this.table.getSelectedCellRanges();
75720
+ if (selectRanges.length === 0) {
75721
+ this.clearHighlight();
75722
+ return;
75723
+ }
75724
+ const selectRange = selectRanges[0];
75725
+ const rowSelectRange = [selectRange.start.row, selectRange.end.row];
75726
+ rowSelectRange.sort((a, b) => a - b);
75727
+ const colSelectRange = [selectRange.start.col, selectRange.end.col];
75728
+ colSelectRange.sort((a, b) => a - b);
75729
+ let colHeaderRange;
75730
+ let rowHeaderRange;
75731
+ if (this.table.isPivotTable()) {
75732
+ colHeaderRange = {
75733
+ start: {
75734
+ col: colSelectRange[0],
75735
+ row: 0
75736
+ },
75737
+ end: {
75738
+ col: colSelectRange[1],
75739
+ row: this.table.columnHeaderLevelCount - 1
75740
+ }
75741
+ };
75742
+ rowHeaderRange = {
75743
+ start: {
75744
+ col: 0,
75745
+ row: rowSelectRange[0]
75746
+ },
75747
+ end: {
75748
+ col: this.table.rowHeaderLevelCount - 1,
75749
+ row: rowSelectRange[1]
75750
+ }
75751
+ };
75752
+ }
75753
+ else if (this.table.internalProps.transpose) {
75754
+ rowHeaderRange = {
75755
+ start: {
75756
+ col: 0,
75757
+ row: rowSelectRange[0]
75758
+ },
75759
+ end: {
75760
+ col: this.table.rowHeaderLevelCount - 1,
75761
+ row: rowSelectRange[1]
75762
+ }
75763
+ };
75764
+ }
75765
+ else {
75766
+ colHeaderRange = {
75767
+ start: {
75768
+ col: colSelectRange[0],
75769
+ row: 0
75770
+ },
75771
+ end: {
75772
+ col: colSelectRange[1],
75773
+ row: this.table.columnHeaderLevelCount - 1
75774
+ }
75775
+ };
75776
+ if (this.table.internalProps.rowSeriesNumber) {
75777
+ rowHeaderRange = {
75778
+ start: {
75779
+ col: 0,
75780
+ row: rowSelectRange[0]
75781
+ },
75782
+ end: {
75783
+ col: 0,
75784
+ row: rowSelectRange[1]
75785
+ }
75786
+ };
75787
+ }
75788
+ }
75789
+ if (this.options?.colHighlight !== false && !isSameRange(this.colHeaderRange, colHeaderRange)) {
75790
+ this.colHeaderRange && this.table.arrangeCustomCellStyle({ range: this.colHeaderRange }, undefined);
75791
+ colHeaderRange && this.table.arrangeCustomCellStyle({ range: colHeaderRange }, 'col-highlight');
75792
+ this.colHeaderRange = colHeaderRange;
75793
+ }
75794
+ if (this.options?.rowHighlight !== false && !isSameRange(this.rowHeaderRange, rowHeaderRange)) {
75795
+ this.rowHeaderRange && this.table.arrangeCustomCellStyle({ range: this.rowHeaderRange }, undefined);
75796
+ rowHeaderRange && this.table.arrangeCustomCellStyle({ range: rowHeaderRange }, 'row-highlight');
75797
+ this.rowHeaderRange = rowHeaderRange;
75798
+ }
75799
+ }
75800
+ }
75801
+ function isSameRange(a, b) {
75802
+ if (a === undefined && b === undefined) {
75803
+ return true;
75804
+ }
75805
+ if (a === undefined || b === undefined) {
75806
+ return false;
75807
+ }
75808
+ return (a.start.col === b.start.col && a.start.row === b.start.row && a.end.col === b.end.col && a.end.row === b.end.row);
75809
+ }
75810
+
75438
75811
  registerForVrender();
75439
- const version = "1.10.3";
75812
+ const version = "1.10.4-alpha.2";
75440
75813
  function getIcons() {
75441
75814
  return get$2();
75442
75815
  }
@@ -75444,8 +75817,11 @@
75444
75817
  clearAll();
75445
75818
  }
75446
75819
 
75820
+ exports.CarouselAnimationPlugin = CarouselAnimationPlugin;
75447
75821
  exports.CustomLayout = index;
75448
75822
  exports.DataStatistics = DataStatistics;
75823
+ exports.HeaderHighlightPlugin = HeaderHighlightPlugin;
75824
+ exports.InvertHighlightPlugin = InvertHighlightPlugin;
75449
75825
  exports.ListTable = ListTableAll;
75450
75826
  exports.ListTableSimple = ListTableSimple;
75451
75827
  exports.PIVOT_CHART_EVENT_TYPE = PIVOT_CHART_EVENT_TYPE;
@@ -75478,6 +75854,7 @@
75478
75854
  exports.getTargetCell = getTargetCell;
75479
75855
  exports.graphicUtil = graphicUtil;
75480
75856
  exports.jsx = jsx;
75857
+ exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
75481
75858
  exports.register = register$1;
75482
75859
  exports.registerAxis = registerAxis;
75483
75860
  exports.registerChartCell = registerChartCell;