@visactor/vtable 1.26.2 → 1.26.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/cjs/dataset/DataStatistics.js +1 -2
  2. package/cjs/edit/edit-manager.js +1 -0
  3. package/cjs/event/EventHandler.js +1 -1
  4. package/cjs/event/EventTarget.js +1 -1
  5. package/cjs/event/drill.js +1 -1
  6. package/cjs/event/event.js +1 -1
  7. package/cjs/event/helper.js +1 -1
  8. package/cjs/event/media-click.js +1 -1
  9. package/cjs/event/scroll.js +1 -1
  10. package/cjs/event/sparkline-event.js +1 -1
  11. package/cjs/event/util.js +1 -1
  12. package/cjs/header-helper/style.js +2 -1
  13. package/cjs/layout/pivot-header-layout.js +0 -1
  14. package/cjs/plugins/index.js +1 -1
  15. package/cjs/plugins/interface.js +1 -1
  16. package/cjs/plugins/invert-highlight.js +1 -1
  17. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  18. package/cjs/plugins/plugin-manager.js +1 -1
  19. package/cjs/scenegraph/component/table-component.js +41 -50
  20. package/cjs/scenegraph/component/table-component.js.map +1 -1
  21. package/cjs/scenegraph/component/util.d.ts +1 -0
  22. package/cjs/scenegraph/component/util.js +9 -1
  23. package/cjs/scenegraph/component/util.js.map +1 -1
  24. package/cjs/scenegraph/scenegraph.js +6 -4
  25. package/cjs/scenegraph/scenegraph.js.map +1 -1
  26. package/cjs/state/state.js +16 -16
  27. package/cjs/state/state.js.map +1 -1
  28. package/cjs/themes/ARCO.js +1 -1
  29. package/cjs/themes/BRIGHT.js +1 -1
  30. package/dist/vtable.js +80 -78
  31. package/dist/vtable.min.js +1 -1
  32. package/es/dataset/DataStatistics.js +1 -2
  33. package/es/edit/edit-manager.js +2 -1
  34. package/es/event/EventHandler.js +1 -1
  35. package/es/event/EventTarget.js +1 -1
  36. package/es/event/drill.js +1 -1
  37. package/es/event/event.js +1 -1
  38. package/es/event/helper.js +1 -1
  39. package/es/event/media-click.js +1 -1
  40. package/es/event/scroll.js +1 -1
  41. package/es/event/sparkline-event.js +1 -1
  42. package/es/event/util.js +1 -1
  43. package/es/header-helper/style.js +2 -1
  44. package/es/layout/pivot-header-layout.js +1 -2
  45. package/es/plugins/index.js +1 -1
  46. package/es/plugins/interface.js +1 -1
  47. package/es/plugins/invert-highlight.js +1 -1
  48. package/es/plugins/list-tree-stick-cell.js +1 -1
  49. package/es/plugins/plugin-manager.js +1 -1
  50. package/es/scenegraph/component/table-component.js +41 -51
  51. package/es/scenegraph/component/table-component.js.map +1 -1
  52. package/es/scenegraph/component/util.d.ts +1 -0
  53. package/es/scenegraph/component/util.js +6 -0
  54. package/es/scenegraph/component/util.js.map +1 -1
  55. package/es/scenegraph/scenegraph.js +6 -4
  56. package/es/scenegraph/scenegraph.js.map +1 -1
  57. package/es/state/state.js +16 -14
  58. package/es/state/state.js.map +1 -1
  59. package/es/themes/ARCO.js +1 -1
  60. package/es/themes/BRIGHT.js +1 -1
  61. package/package.json +4 -4
@@ -111,4 +111,4 @@ Object.defineProperty(exports, "__esModule", {
111
111
  fontFamily: "Arial,sans-serif"
112
112
  }
113
113
  };
114
- //# sourceMappingURL=ARCO.js.map
114
+ //# sourceMappingURL=ARCO.js.map
@@ -68,4 +68,4 @@ Object.defineProperty(exports, "__esModule", {
68
68
  fontFamily: "Arial,sans-serif"
69
69
  }
70
70
  };
71
- //# sourceMappingURL=BRIGHT.js.map
71
+ //# sourceMappingURL=BRIGHT.js.map
package/dist/vtable.js CHANGED
@@ -48343,6 +48343,16 @@
48343
48343
  }
48344
48344
  }
48345
48345
 
48346
+ function getBodyHorizontalScrollRange(table) {
48347
+ const totalWidth = table.getAllColsWidth();
48348
+ const frozenColsWidth = table.getFrozenColsWidth();
48349
+ const rightFrozenColsWidth = table.getRightFrozenColsWidth();
48350
+ const frozenColsContentWidth = table.getFrozenColsContentWidth?.() ?? frozenColsWidth;
48351
+ const rightFrozenColsContentWidth = table.getRightFrozenColsContentWidth?.() ?? rightFrozenColsWidth;
48352
+ const bodyViewportWidth = table.tableNoFrameWidth - frozenColsWidth - rightFrozenColsWidth;
48353
+ const bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth;
48354
+ return Math.max(0, bodyContentWidth - bodyViewportWidth);
48355
+ }
48346
48356
  function getColX(col, table, isRightFrozen) {
48347
48357
  if (isRightFrozen) {
48348
48358
  return (Math.min(table.tableNoFrameWidth, table.getAllColsWidth()) -
@@ -48699,24 +48709,25 @@
48699
48709
  const rightFrozenColsContentWidth = this.table.getRightFrozenColsContentWidth?.() ?? rightFrozenColsWidth;
48700
48710
  const hoverOn = this.table.theme.scrollStyle.hoverOn;
48701
48711
  const sizeTolerance = this.table.options.customConfig?._disableColumnAndRowSizeRound ? 1 : 0;
48702
- if (totalWidth > tableWidth + sizeTolerance) {
48703
- const y = Math.min(tableHeight, totalHeight);
48712
+ const bodyScrollRange = getBodyHorizontalScrollRange(this.table);
48713
+ const y = Math.min(tableHeight, totalHeight);
48714
+ let attrY = 0;
48715
+ if (this.table.theme.scrollStyle.barToSide) {
48716
+ attrY =
48717
+ this.table.tableNoFrameHeight -
48718
+ (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y) +
48719
+ this.table.tableY;
48720
+ }
48721
+ else {
48722
+ attrY = y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
48723
+ }
48724
+ const ignoreFrozenCols = this.table.theme.scrollStyle?.ignoreFrozenCols ?? false;
48725
+ if (bodyScrollRange > sizeTolerance) {
48704
48726
  const bodyViewportWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
48705
- const bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth;
48727
+ const bodyContentWidth = bodyViewportWidth + bodyScrollRange;
48706
48728
  const rangeEnd = bodyContentWidth > 0 ? Math.max(0.05, bodyViewportWidth / bodyContentWidth) : 1;
48707
- let attrY = 0;
48708
- if (this.table.theme.scrollStyle.barToSide) {
48709
- attrY =
48710
- this.table.tableNoFrameHeight -
48711
- (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y) +
48712
- this.table.tableY;
48713
- }
48714
- else {
48715
- attrY = y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
48716
- }
48717
48729
  let hScrollBarx = frozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
48718
48730
  let hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
48719
- const ignoreFrozenCols = this.table.theme.scrollStyle?.ignoreFrozenCols ?? false;
48720
48731
  if (ignoreFrozenCols) {
48721
48732
  hScrollBarx = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
48722
48733
  hScrollBarWidth = tableWidth;
@@ -48740,62 +48751,6 @@
48740
48751
  if (horizontalVisible === 'always') {
48741
48752
  this.hScrollBar.showAll();
48742
48753
  }
48743
- const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
48744
- if (!ignoreFrozenCols && frozenScrollable) {
48745
- const frozenRangeEnd = Math.max(0.05, frozenColsWidth / frozenColsContentWidth);
48746
- const x = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
48747
- this.frozenHScrollBar.setAttributes({
48748
- x,
48749
- y: attrY,
48750
- width: frozenColsWidth,
48751
- range: [0, frozenRangeEnd],
48752
- visible: horizontalVisible === 'always'
48753
- });
48754
- const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
48755
- this.frozenHScrollBar._viewPosition = {
48756
- x: bounds.x1,
48757
- y: bounds.y1
48758
- };
48759
- if (horizontalVisible === 'always') {
48760
- this.frozenHScrollBar.showAll();
48761
- }
48762
- }
48763
- else {
48764
- this.frozenHScrollBar.setAttributes({
48765
- x: -this.table.tableNoFrameWidth * 2,
48766
- y: -this.table.tableNoFrameHeight * 2,
48767
- width: 0,
48768
- visible: false
48769
- });
48770
- }
48771
- const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
48772
- if (!ignoreFrozenCols && rightFrozenScrollable) {
48773
- const rightFrozenRangeEnd = Math.max(0.05, rightFrozenColsWidth / rightFrozenColsContentWidth);
48774
- const x = tableWidth - rightFrozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
48775
- this.rightFrozenHScrollBar.setAttributes({
48776
- x,
48777
- y: attrY,
48778
- width: rightFrozenColsWidth,
48779
- range: [0, rightFrozenRangeEnd],
48780
- visible: horizontalVisible === 'always'
48781
- });
48782
- const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
48783
- this.rightFrozenHScrollBar._viewPosition = {
48784
- x: bounds.x1,
48785
- y: bounds.y1
48786
- };
48787
- if (horizontalVisible === 'always') {
48788
- this.rightFrozenHScrollBar.showAll();
48789
- }
48790
- }
48791
- else {
48792
- this.rightFrozenHScrollBar.setAttributes({
48793
- x: -this.table.tableNoFrameWidth * 2,
48794
- y: -this.table.tableNoFrameHeight * 2,
48795
- width: 0,
48796
- visible: false
48797
- });
48798
- }
48799
48754
  }
48800
48755
  else {
48801
48756
  this.hScrollBar.setAttributes({
@@ -48804,12 +48759,56 @@
48804
48759
  width: 0,
48805
48760
  visible: false
48806
48761
  });
48762
+ }
48763
+ const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
48764
+ if (!ignoreFrozenCols && frozenScrollable) {
48765
+ const frozenRangeEnd = Math.max(0.05, frozenColsWidth / frozenColsContentWidth);
48766
+ const x = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
48767
+ this.frozenHScrollBar.setAttributes({
48768
+ x,
48769
+ y: attrY,
48770
+ width: frozenColsWidth,
48771
+ range: [0, frozenRangeEnd],
48772
+ visible: horizontalVisible === 'always'
48773
+ });
48774
+ const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
48775
+ this.frozenHScrollBar._viewPosition = {
48776
+ x: bounds.x1,
48777
+ y: bounds.y1
48778
+ };
48779
+ if (horizontalVisible === 'always') {
48780
+ this.frozenHScrollBar.showAll();
48781
+ }
48782
+ }
48783
+ else {
48807
48784
  this.frozenHScrollBar.setAttributes({
48808
48785
  x: -this.table.tableNoFrameWidth * 2,
48809
48786
  y: -this.table.tableNoFrameHeight * 2,
48810
48787
  width: 0,
48811
48788
  visible: false
48812
48789
  });
48790
+ }
48791
+ const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
48792
+ if (!ignoreFrozenCols && rightFrozenScrollable) {
48793
+ const rightFrozenRangeEnd = Math.max(0.05, rightFrozenColsWidth / rightFrozenColsContentWidth);
48794
+ const x = tableWidth - rightFrozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
48795
+ this.rightFrozenHScrollBar.setAttributes({
48796
+ x,
48797
+ y: attrY,
48798
+ width: rightFrozenColsWidth,
48799
+ range: [0, rightFrozenRangeEnd],
48800
+ visible: horizontalVisible === 'always'
48801
+ });
48802
+ const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
48803
+ this.rightFrozenHScrollBar._viewPosition = {
48804
+ x: bounds.x1,
48805
+ y: bounds.y1
48806
+ };
48807
+ if (horizontalVisible === 'always') {
48808
+ this.rightFrozenHScrollBar.showAll();
48809
+ }
48810
+ }
48811
+ else {
48813
48812
  this.rightFrozenHScrollBar.setAttributes({
48814
48813
  x: -this.table.tableNoFrameWidth * 2,
48815
48814
  y: -this.table.tableNoFrameHeight * 2,
@@ -59886,6 +59885,9 @@
59886
59885
  lastBodyCol.attribute.x -
59887
59886
  lastBodyCol.attribute.width;
59888
59887
  }
59888
+ if (this.table.options.scrollFrozenCols && x > 0) {
59889
+ x = 0;
59890
+ }
59889
59891
  if (this.table.getFrozenColsWidth() + x === this.bodyGroup.attribute.x) {
59890
59892
  return;
59891
59893
  }
@@ -59999,11 +60001,17 @@
59999
60001
  this.rowHeaderGroup.forEachChildrenSkipChild((column) => {
60000
60002
  rowHeaderWidth += column.attribute.width;
60001
60003
  });
60004
+ if (table.options.scrollFrozenCols) {
60005
+ rowHeaderWidth = table.getFrozenColsWidth();
60006
+ }
60002
60007
  this.rowHeaderGroup.setAttribute('width', rowHeaderWidth);
60003
60008
  let cornerHeaderWidth = 0;
60004
60009
  this.cornerHeaderGroup.forEachChildrenSkipChild((column) => {
60005
60010
  cornerHeaderWidth += column.attribute.width;
60006
60011
  });
60012
+ if (table.options.scrollFrozenCols) {
60013
+ cornerHeaderWidth = table.getFrozenColsWidth();
60014
+ }
60007
60015
  this.cornerHeaderGroup.setAttribute('width', cornerHeaderWidth);
60008
60016
  this.colHeaderGroup.setAttribute('x', this.cornerHeaderGroup.attribute.width);
60009
60017
  this.rowHeaderGroup.setAttribute('y', this.cornerHeaderGroup.attribute.height);
@@ -63741,11 +63749,8 @@
63741
63749
  }
63742
63750
  }
63743
63751
  updateHorizontalScrollBar(xRatio) {
63744
- const totalWidth = this.table.getAllColsWidth();
63745
63752
  const oldHorizontalBarPos = this.scroll.horizontalBarPos;
63746
- const frozenOffset = this.table.getFrozenColsOffset?.() ?? 0;
63747
- const rightFrozenOffset = this.table.getRightFrozenColsOffset?.() ?? 0;
63748
- const scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
63753
+ const scrollRange = getBodyHorizontalScrollRange(this.table);
63749
63754
  let horizontalBarPos = Math.ceil(xRatio * scrollRange);
63750
63755
  if (!isValid$1(horizontalBarPos) || isNaN(horizontalBarPos)) {
63751
63756
  horizontalBarPos = 0;
@@ -63855,10 +63860,7 @@
63855
63860
  return;
63856
63861
  }
63857
63862
  this.table.scrollLeft;
63858
- const totalWidth = this.table.getAllColsWidth();
63859
- const frozenOffset = this.table.getFrozenColsOffset?.() ?? 0;
63860
- const rightFrozenOffset = this.table.getRightFrozenColsOffset?.() ?? 0;
63861
- const scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
63863
+ const scrollRange = getBodyHorizontalScrollRange(this.table);
63862
63864
  const sizeTolerance = this.table.options.customConfig?._disableColumnAndRowSizeRound ? 1 : 0;
63863
63865
  left = Math.max(0, Math.min(left, scrollRange - sizeTolerance));
63864
63866
  left = Math.ceil(left);