k-vtable 1.0.36 → 1.0.37

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 (83) hide show
  1. package/cjs/ListTable.d.ts +1 -0
  2. package/cjs/ListTable.js +11 -1
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable.js +12 -6
  5. package/cjs/PivotTable.js.map +1 -1
  6. package/cjs/core/BaseTable.js +11 -9
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/event/event.js +3 -1
  9. package/cjs/event/event.js.map +1 -1
  10. package/cjs/event/listener/table-group.js +52 -52
  11. package/cjs/event/listener/table-group.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/layout/pivot-header-layout.d.ts +2 -2
  16. package/cjs/layout/simple-header-layout.js +7 -7
  17. package/cjs/layout/simple-header-layout.js.map +1 -1
  18. package/cjs/plugins/list-tree-stick-cell.js +29 -3
  19. package/cjs/plugins/list-tree-stick-cell.js.map +1 -1
  20. package/cjs/scenegraph/component/custom.js +2 -2
  21. package/cjs/scenegraph/component/custom.js.map +1 -1
  22. package/cjs/scenegraph/component/table-component.js +41 -50
  23. package/cjs/scenegraph/component/table-component.js.map +1 -1
  24. package/cjs/scenegraph/component/util.d.ts +1 -0
  25. package/cjs/scenegraph/component/util.js +9 -3
  26. package/cjs/scenegraph/component/util.js.map +1 -1
  27. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  28. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  29. package/cjs/scenegraph/layout/compute-row-height.js +1 -1
  30. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  31. package/cjs/scenegraph/layout/frozen.js +7 -3
  32. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  33. package/cjs/scenegraph/scenegraph.js +5 -3
  34. package/cjs/scenegraph/scenegraph.js.map +1 -1
  35. package/cjs/scenegraph/utils/padding.d.ts +5 -2
  36. package/cjs/scenegraph/utils/padding.js +16 -13
  37. package/cjs/scenegraph/utils/padding.js.map +1 -1
  38. package/cjs/state/state.js +15 -15
  39. package/cjs/state/state.js.map +1 -1
  40. package/cjs/vrender.js.map +1 -1
  41. package/dist/vtable.js +256 -125
  42. package/dist/vtable.min.js +1 -1
  43. package/es/ListTable.d.ts +1 -0
  44. package/es/ListTable.js +11 -1
  45. package/es/ListTable.js.map +1 -1
  46. package/es/PivotTable.js +12 -6
  47. package/es/PivotTable.js.map +1 -1
  48. package/es/core/BaseTable.js +11 -9
  49. package/es/core/BaseTable.js.map +1 -1
  50. package/es/event/event.js +3 -1
  51. package/es/event/event.js.map +1 -1
  52. package/es/event/listener/table-group.js +52 -52
  53. package/es/event/listener/table-group.js.map +1 -1
  54. package/es/index.d.ts +1 -1
  55. package/es/index.js +1 -1
  56. package/es/index.js.map +1 -1
  57. package/es/layout/pivot-header-layout.d.ts +2 -2
  58. package/es/layout/simple-header-layout.js +7 -7
  59. package/es/layout/simple-header-layout.js.map +1 -1
  60. package/es/plugins/list-tree-stick-cell.js +32 -2
  61. package/es/plugins/list-tree-stick-cell.js.map +1 -1
  62. package/es/scenegraph/component/custom.js +2 -2
  63. package/es/scenegraph/component/custom.js.map +1 -1
  64. package/es/scenegraph/component/table-component.js +41 -51
  65. package/es/scenegraph/component/table-component.js.map +1 -1
  66. package/es/scenegraph/component/util.d.ts +1 -0
  67. package/es/scenegraph/component/util.js +6 -0
  68. package/es/scenegraph/component/util.js.map +1 -1
  69. package/es/scenegraph/layout/compute-col-width.js +1 -1
  70. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  71. package/es/scenegraph/layout/compute-row-height.js +1 -1
  72. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  73. package/es/scenegraph/layout/frozen.js +7 -3
  74. package/es/scenegraph/layout/frozen.js.map +1 -1
  75. package/es/scenegraph/scenegraph.js +5 -3
  76. package/es/scenegraph/scenegraph.js.map +1 -1
  77. package/es/scenegraph/utils/padding.d.ts +5 -2
  78. package/es/scenegraph/utils/padding.js +13 -9
  79. package/es/scenegraph/utils/padding.js.map +1 -1
  80. package/es/state/state.js +15 -13
  81. package/es/state/state.js.map +1 -1
  82. package/es/vrender.js.map +1 -1
  83. package/package.json +2 -2
package/dist/vtable.js CHANGED
@@ -41970,26 +41970,53 @@
41970
41970
  return parse$2(font);
41971
41971
  }
41972
41972
 
41973
- function getQuadProps(paddingOrigin) {
41974
- if (isNumber$3(paddingOrigin) || isString$2(paddingOrigin) || isArray$5(paddingOrigin)) {
41975
- let padding = parsePadding(paddingOrigin);
41976
- if (typeof padding === 'number' || typeof padding === 'string') {
41977
- padding = [padding, padding, padding, padding];
41978
- }
41979
- else if (Array.isArray(padding)) {
41980
- padding = padding.slice(0);
41981
- }
41982
- return padding;
41973
+ function normalizeQuadArray(values) {
41974
+ if (values.length === 0) {
41975
+ return [0, 0, 0, 0];
41976
+ }
41977
+ if (values.length === 1) {
41978
+ return [values[0], values[0], values[0], values[0]];
41979
+ }
41980
+ if (values.length === 2) {
41981
+ return [values[0], values[1], values[0], values[1]];
41982
+ }
41983
+ if (values.length === 3) {
41984
+ return [values[0], values[1], values[2], values[1]];
41985
+ }
41986
+ return [values[0], values[1], values[2], values[3]];
41987
+ }
41988
+ function parseStringQuad(padding) {
41989
+ const tokens = padding.trim().split(/\s+/);
41990
+ const values = tokens.map(token => Number.parseFloat(token)).filter(value => Number.isFinite(value));
41991
+ if (values.length === tokens.length && values.length > 0) {
41992
+ return normalizeQuadArray(values);
41983
41993
  }
41984
- else if (paddingOrigin &&
41985
- (isFinite(paddingOrigin.bottom) ||
41986
- isFinite(paddingOrigin.left) ||
41987
- isFinite(paddingOrigin.right) ||
41988
- isFinite(paddingOrigin.top))) {
41994
+ return [padding, padding, padding, padding];
41995
+ }
41996
+ function normalizePaddingObject(paddingOrigin) {
41997
+ if (Number.isFinite(paddingOrigin.bottom) ||
41998
+ Number.isFinite(paddingOrigin.left) ||
41999
+ Number.isFinite(paddingOrigin.right) ||
42000
+ Number.isFinite(paddingOrigin.top)) {
41989
42001
  return [paddingOrigin.top ?? 0, paddingOrigin.right ?? 0, paddingOrigin.bottom ?? 0, paddingOrigin.left ?? 0];
41990
42002
  }
41991
42003
  return [0, 0, 0, 0];
41992
42004
  }
42005
+ function getQuadProps(paddingOrigin) {
42006
+ if (Array.isArray(paddingOrigin)) {
42007
+ return normalizeQuadArray(paddingOrigin.slice(0, 4));
42008
+ }
42009
+ if (typeof paddingOrigin === 'number' && Number.isFinite(paddingOrigin)) {
42010
+ return [paddingOrigin, paddingOrigin, paddingOrigin, paddingOrigin];
42011
+ }
42012
+ if (typeof paddingOrigin === 'string') {
42013
+ return parseStringQuad(paddingOrigin);
42014
+ }
42015
+ if (paddingOrigin && typeof paddingOrigin === 'object') {
42016
+ return normalizePaddingObject(paddingOrigin);
42017
+ }
42018
+ return [0, 0, 0, 0];
42019
+ }
41993
42020
 
41994
42021
  const TYPE_PAREN = 0;
41995
42022
  const TYPE_UNIT = 1;
@@ -43511,7 +43538,7 @@
43511
43538
  col: range?.start.col ?? col,
43512
43539
  row: range?.start.row ?? row,
43513
43540
  dataValue: table.getCellOriginValue(col, row),
43514
- value: table.getCellValue(col, row) || '',
43541
+ value: table.getCellValue(col, row),
43515
43542
  rect: {
43516
43543
  left: 0,
43517
43544
  top: 0,
@@ -43547,7 +43574,7 @@
43547
43574
  col,
43548
43575
  row,
43549
43576
  dataValue: table.getCellOriginValue(col, row),
43550
- value: table.getCellValue(col, row) || '',
43577
+ value: table.getCellValue(col, row),
43551
43578
  rect: {
43552
43579
  left: 0,
43553
43580
  top: 0,
@@ -46990,7 +47017,7 @@
46990
47017
  col: cellRange?.start.col ?? col,
46991
47018
  row: cellRange?.start.row ?? row,
46992
47019
  dataValue: table.getCellOriginValue(col, row),
46993
- value: table.getCellValue(col, row) || '',
47020
+ value: table.getCellValue(col, row),
46994
47021
  rect: getCellRect$1(col, row, table),
46995
47022
  table,
46996
47023
  originCol: col,
@@ -48348,6 +48375,16 @@
48348
48375
  }
48349
48376
  }
48350
48377
 
48378
+ function getBodyHorizontalScrollRange(table) {
48379
+ const totalWidth = table.getAllColsWidth();
48380
+ const frozenColsWidth = table.getFrozenColsWidth();
48381
+ const rightFrozenColsWidth = table.getRightFrozenColsWidth();
48382
+ const frozenColsContentWidth = table.getFrozenColsContentWidth?.() ?? frozenColsWidth;
48383
+ const rightFrozenColsContentWidth = table.getRightFrozenColsContentWidth?.() ?? rightFrozenColsWidth;
48384
+ const bodyViewportWidth = table.tableNoFrameWidth - frozenColsWidth - rightFrozenColsWidth;
48385
+ const bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth;
48386
+ return Math.max(0, bodyContentWidth - bodyViewportWidth);
48387
+ }
48351
48388
  function getColX(col, table, isRightFrozen) {
48352
48389
  if (isRightFrozen) {
48353
48390
  return (Math.min(table.tableNoFrameWidth, table.getAllColsWidth()) -
@@ -48752,24 +48789,25 @@
48752
48789
  const rightFrozenColsContentWidth = this.table.getRightFrozenColsContentWidth?.() ?? rightFrozenColsWidth;
48753
48790
  const hoverOn = this.table.theme.scrollStyle.hoverOn;
48754
48791
  const sizeTolerance = this.table.options.customConfig?._disableColumnAndRowSizeRound ? 1 : 0;
48755
- if (totalWidth > tableWidth + sizeTolerance) {
48756
- const y = Math.min(tableHeight, totalHeight);
48792
+ const bodyScrollRange = getBodyHorizontalScrollRange(this.table);
48793
+ const y = Math.min(tableHeight, totalHeight);
48794
+ let attrY = 0;
48795
+ if (this.table.theme.scrollStyle.barToSide) {
48796
+ attrY =
48797
+ this.table.tableNoFrameHeight -
48798
+ (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y) +
48799
+ this.table.tableY;
48800
+ }
48801
+ else {
48802
+ attrY = y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
48803
+ }
48804
+ const ignoreFrozenCols = this.table.theme.scrollStyle?.ignoreFrozenCols ?? false;
48805
+ if (bodyScrollRange > sizeTolerance) {
48757
48806
  const bodyViewportWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
48758
- const bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth;
48807
+ const bodyContentWidth = bodyViewportWidth + bodyScrollRange;
48759
48808
  const rangeEnd = bodyContentWidth > 0 ? Math.max(0.05, bodyViewportWidth / bodyContentWidth) : 1;
48760
- let attrY = 0;
48761
- if (this.table.theme.scrollStyle.barToSide) {
48762
- attrY =
48763
- this.table.tableNoFrameHeight -
48764
- (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y) +
48765
- this.table.tableY;
48766
- }
48767
- else {
48768
- attrY = y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
48769
- }
48770
48809
  let hScrollBarx = frozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
48771
48810
  let hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
48772
- const ignoreFrozenCols = this.table.theme.scrollStyle?.ignoreFrozenCols ?? false;
48773
48811
  if (ignoreFrozenCols) {
48774
48812
  hScrollBarx = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
48775
48813
  hScrollBarWidth = tableWidth;
@@ -48793,62 +48831,6 @@
48793
48831
  if (horizontalVisible === 'always') {
48794
48832
  this.hScrollBar.showAll();
48795
48833
  }
48796
- const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
48797
- if (!ignoreFrozenCols && frozenScrollable) {
48798
- const frozenRangeEnd = Math.max(0.05, frozenColsWidth / frozenColsContentWidth);
48799
- const x = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
48800
- this.frozenHScrollBar.setAttributes({
48801
- x,
48802
- y: attrY,
48803
- width: frozenColsWidth,
48804
- range: [0, frozenRangeEnd],
48805
- visible: horizontalVisible === 'always'
48806
- });
48807
- const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
48808
- this.frozenHScrollBar._viewPosition = {
48809
- x: bounds.x1,
48810
- y: bounds.y1
48811
- };
48812
- if (horizontalVisible === 'always') {
48813
- this.frozenHScrollBar.showAll();
48814
- }
48815
- }
48816
- else {
48817
- this.frozenHScrollBar.setAttributes({
48818
- x: -this.table.tableNoFrameWidth * 2,
48819
- y: -this.table.tableNoFrameHeight * 2,
48820
- width: 0,
48821
- visible: false
48822
- });
48823
- }
48824
- const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
48825
- if (!ignoreFrozenCols && rightFrozenScrollable) {
48826
- const rightFrozenRangeEnd = Math.max(0.05, rightFrozenColsWidth / rightFrozenColsContentWidth);
48827
- const x = tableWidth - rightFrozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
48828
- this.rightFrozenHScrollBar.setAttributes({
48829
- x,
48830
- y: attrY,
48831
- width: rightFrozenColsWidth,
48832
- range: [0, rightFrozenRangeEnd],
48833
- visible: horizontalVisible === 'always'
48834
- });
48835
- const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
48836
- this.rightFrozenHScrollBar._viewPosition = {
48837
- x: bounds.x1,
48838
- y: bounds.y1
48839
- };
48840
- if (horizontalVisible === 'always') {
48841
- this.rightFrozenHScrollBar.showAll();
48842
- }
48843
- }
48844
- else {
48845
- this.rightFrozenHScrollBar.setAttributes({
48846
- x: -this.table.tableNoFrameWidth * 2,
48847
- y: -this.table.tableNoFrameHeight * 2,
48848
- width: 0,
48849
- visible: false
48850
- });
48851
- }
48852
48834
  }
48853
48835
  else {
48854
48836
  this.hScrollBar.setAttributes({
@@ -48857,12 +48839,56 @@
48857
48839
  width: 0,
48858
48840
  visible: false
48859
48841
  });
48842
+ }
48843
+ const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
48844
+ if (!ignoreFrozenCols && frozenScrollable) {
48845
+ const frozenRangeEnd = Math.max(0.05, frozenColsWidth / frozenColsContentWidth);
48846
+ const x = !hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0;
48847
+ this.frozenHScrollBar.setAttributes({
48848
+ x,
48849
+ y: attrY,
48850
+ width: frozenColsWidth,
48851
+ range: [0, frozenRangeEnd],
48852
+ visible: horizontalVisible === 'always'
48853
+ });
48854
+ const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
48855
+ this.frozenHScrollBar._viewPosition = {
48856
+ x: bounds.x1,
48857
+ y: bounds.y1
48858
+ };
48859
+ if (horizontalVisible === 'always') {
48860
+ this.frozenHScrollBar.showAll();
48861
+ }
48862
+ }
48863
+ else {
48860
48864
  this.frozenHScrollBar.setAttributes({
48861
48865
  x: -this.table.tableNoFrameWidth * 2,
48862
48866
  y: -this.table.tableNoFrameHeight * 2,
48863
48867
  width: 0,
48864
48868
  visible: false
48865
48869
  });
48870
+ }
48871
+ const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
48872
+ if (!ignoreFrozenCols && rightFrozenScrollable) {
48873
+ const rightFrozenRangeEnd = Math.max(0.05, rightFrozenColsWidth / rightFrozenColsContentWidth);
48874
+ const x = tableWidth - rightFrozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0);
48875
+ this.rightFrozenHScrollBar.setAttributes({
48876
+ x,
48877
+ y: attrY,
48878
+ width: rightFrozenColsWidth,
48879
+ range: [0, rightFrozenRangeEnd],
48880
+ visible: horizontalVisible === 'always'
48881
+ });
48882
+ const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
48883
+ this.rightFrozenHScrollBar._viewPosition = {
48884
+ x: bounds.x1,
48885
+ y: bounds.y1
48886
+ };
48887
+ if (horizontalVisible === 'always') {
48888
+ this.rightFrozenHScrollBar.showAll();
48889
+ }
48890
+ }
48891
+ else {
48866
48892
  this.rightFrozenHScrollBar.setAttributes({
48867
48893
  x: -this.table.tableNoFrameWidth * 2,
48868
48894
  y: -this.table.tableNoFrameHeight * 2,
@@ -53748,7 +53774,7 @@
53748
53774
  col: cellRange?.start.col ?? col,
53749
53775
  row: cellRange?.start.row ?? row,
53750
53776
  dataValue: table.getCellOriginValue(col, row),
53751
- value: table.getCellValue(col, row) || '',
53777
+ value: table.getCellValue(col, row),
53752
53778
  rect: getCellRect(col, row, table),
53753
53779
  table,
53754
53780
  originCol: col,
@@ -57534,7 +57560,9 @@
57534
57560
  const headerColGroup = scene.getColGroup(col, true);
57535
57561
  insertBefore(rightTopCornerGroup, headerColGroup, rightTopCornerGroup.firstChild);
57536
57562
  const bottomColGroup = scene.getColGroupInBottom(col);
57537
- insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
57563
+ if (bottomColGroup) {
57564
+ insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
57565
+ }
57538
57566
  }
57539
57567
  let x = 0;
57540
57568
  rightFrozenGroup.forEachChildren((columnGroup) => {
@@ -57561,9 +57589,11 @@
57561
57589
  headerColGroup?.setAttribute('x', colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col));
57562
57590
  colHeaderGroup?.appendChild(headerColGroup);
57563
57591
  const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
57564
- bottomColGroup?.setAttribute('x', bottomFrozenGroup.lastChild.attribute.x +
57565
- table.getColWidth(bottomFrozenGroup.lastChild.col));
57566
- bottomFrozenGroup?.appendChild(bottomColGroup);
57592
+ if (bottomColGroup) {
57593
+ const lastBottomColGroup = bottomFrozenGroup.lastChild;
57594
+ bottomColGroup.setAttribute('x', lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0);
57595
+ bottomFrozenGroup.appendChild(bottomColGroup);
57596
+ }
57567
57597
  }
57568
57598
  let x = 0;
57569
57599
  rightFrozenGroup.forEachChildren((columnGroup) => {
@@ -60121,6 +60151,9 @@
60121
60151
  lastBodyCol.attribute.x -
60122
60152
  lastBodyCol.attribute.width;
60123
60153
  }
60154
+ if (this.table.options.scrollFrozenCols && x > 0) {
60155
+ x = 0;
60156
+ }
60124
60157
  if (this.table.getFrozenColsWidth() + x === this.bodyGroup.attribute.x) {
60125
60158
  return;
60126
60159
  }
@@ -60236,11 +60269,17 @@
60236
60269
  this.rowHeaderGroup.forEachChildrenSkipChild((column) => {
60237
60270
  rowHeaderWidth += column.attribute.width;
60238
60271
  });
60272
+ if (table.options.scrollFrozenCols) {
60273
+ rowHeaderWidth = table.getFrozenColsWidth();
60274
+ }
60239
60275
  this.rowHeaderGroup.setAttribute('width', rowHeaderWidth);
60240
60276
  let cornerHeaderWidth = 0;
60241
60277
  this.cornerHeaderGroup.forEachChildrenSkipChild((column) => {
60242
60278
  cornerHeaderWidth += column.attribute.width;
60243
60279
  });
60280
+ if (table.options.scrollFrozenCols) {
60281
+ cornerHeaderWidth = table.getFrozenColsWidth();
60282
+ }
60244
60283
  this.cornerHeaderGroup.setAttribute('width', cornerHeaderWidth);
60245
60284
  this.colHeaderGroup.setAttribute('x', this.cornerHeaderGroup.attribute.width);
60246
60285
  this.rowHeaderGroup.setAttribute('y', this.cornerHeaderGroup.attribute.height);
@@ -64004,11 +64043,8 @@
64004
64043
  }
64005
64044
  }
64006
64045
  updateHorizontalScrollBar(xRatio) {
64007
- const totalWidth = this.table.getAllColsWidth();
64008
64046
  const oldHorizontalBarPos = this.scroll.horizontalBarPos;
64009
- const frozenOffset = this.table.getFrozenColsOffset?.() ?? 0;
64010
- const rightFrozenOffset = this.table.getRightFrozenColsOffset?.() ?? 0;
64011
- const scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
64047
+ const scrollRange = getBodyHorizontalScrollRange(this.table);
64012
64048
  let horizontalBarPos = Math.ceil(xRatio * scrollRange);
64013
64049
  if (!isValid$1(horizontalBarPos) || isNaN(horizontalBarPos)) {
64014
64050
  horizontalBarPos = 0;
@@ -64118,10 +64154,7 @@
64118
64154
  return;
64119
64155
  }
64120
64156
  this.table.scrollLeft;
64121
- const totalWidth = this.table.getAllColsWidth();
64122
- const frozenOffset = this.table.getFrozenColsOffset?.() ?? 0;
64123
- const rightFrozenOffset = this.table.getRightFrozenColsOffset?.() ?? 0;
64124
- const scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
64157
+ const scrollRange = getBodyHorizontalScrollRange(this.table);
64125
64158
  const sizeTolerance = this.table.options.customConfig?._disableColumnAndRowSizeRound ? 1 : 0;
64126
64159
  left = Math.max(0, Math.min(left, scrollRange - sizeTolerance));
64127
64160
  left = Math.ceil(left);
@@ -65400,15 +65433,19 @@
65400
65433
  if (e.button !== 0) {
65401
65434
  return;
65402
65435
  }
65436
+ const endedResizeCol = stateManager.isResizeCol();
65437
+ const endedResizeRow = stateManager.isResizeRow();
65438
+ const endedMoveCol = stateManager.isMoveCol();
65439
+ const shouldSkipClickCell = endedResizeCol || endedResizeRow;
65403
65440
  if (stateManager.interactionState === 'grabing') {
65404
65441
  stateManager.updateInteractionState(InteractionState.default);
65405
- if (stateManager.isResizeCol()) {
65442
+ if (endedResizeCol) {
65406
65443
  endResizeCol(table);
65407
65444
  }
65408
- else if (stateManager.isResizeRow()) {
65445
+ else if (endedResizeRow) {
65409
65446
  endResizeRow(table);
65410
65447
  }
65411
- else if (stateManager.isMoveCol()) {
65448
+ else if (endedMoveCol) {
65412
65449
  const endMoveColSuccess = table.stateManager.endMoveCol();
65413
65450
  fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
65414
65451
  }
@@ -65438,7 +65475,7 @@
65438
65475
  else if (stateManager.interactionState === InteractionState.scrolling) {
65439
65476
  stateManager.updateInteractionState(InteractionState.default);
65440
65477
  }
65441
- if (!table.eventManager.isDraging) {
65478
+ if (!table.eventManager.isDraging && !shouldSkipClickCell) {
65442
65479
  const eventArgsSet = getEventArgsSet(e);
65443
65480
  if (!eventManager.isTouchMove &&
65444
65481
  e.button === 0 &&
@@ -67684,6 +67721,9 @@
67684
67721
  }
67685
67722
  cellIsHeaderCheck(eventArgsSet, update) {
67686
67723
  const { eventArgs } = eventArgsSet;
67724
+ if (!eventArgs) {
67725
+ return false;
67726
+ }
67687
67727
  const { col, row, target } = eventArgs;
67688
67728
  if (!this.table.isHeader(col, row)) {
67689
67729
  return false;
@@ -72286,7 +72326,7 @@
72286
72326
  return TABLE_EVENT_TYPE;
72287
72327
  }
72288
72328
  options;
72289
- version = "1.0.36";
72329
+ version = "1.0.37";
72290
72330
  pagination;
72291
72331
  id = `VTable${Date.now()}`;
72292
72332
  headerStyleCache;
@@ -73816,15 +73856,14 @@
73816
73856
  }
73817
73857
  getBodyVisibleCellRange() {
73818
73858
  const { scrollTop, scrollLeft } = this;
73819
- const frozenRowsHeight = this.getFrozenRowsHeight();
73820
73859
  const frozenColsContentWidth = this.getFrozenColsContentWidth();
73821
73860
  const frozenColsOffset = this.getFrozenColsOffset();
73822
73861
  const bottomFrozenRowsHeight = this.getBottomFrozenRowsHeight();
73823
73862
  const rightFrozenColsWidth = this.getRightFrozenColsWidth();
73824
- const { row: rowStart } = this.getRowAt(scrollTop + frozenRowsHeight + 1);
73863
+ const rowStart = Math.max(this.getTargetRowAt(scrollTop + 1)?.row ?? -1, this.frozenRowCount);
73825
73864
  const { col: colStart } = this.getColAt(scrollLeft + frozenColsContentWidth + 1);
73826
73865
  const rowEnd = this.getAllRowsHeight() > this.tableNoFrameHeight
73827
- ? this.getRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight).row
73866
+ ? Math.max(this.getTargetRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight)?.row ?? -1, rowStart)
73828
73867
  : this.rowCount - 1;
73829
73868
  const colEnd = this.getAllColsWidth() > this.tableNoFrameWidth
73830
73869
  ? this.getColAt(scrollLeft + frozenColsOffset + this.tableNoFrameWidth - 1 - rightFrozenColsWidth).col
@@ -73836,11 +73875,11 @@
73836
73875
  }
73837
73876
  getBodyVisibleRowRange(start_deltaY = 0, end_deltaY = 0) {
73838
73877
  const { scrollTop } = this;
73839
- const frozenRowsHeight = this.getFrozenRowsHeight();
73840
73878
  const bottomFrozenRowsHeight = this.getBottomFrozenRowsHeight();
73841
- const { row: rowStart } = this.getRowAt(scrollTop + frozenRowsHeight + 1 + start_deltaY);
73879
+ const rowStart = Math.max(this.getTargetRowAt(scrollTop + 1 + start_deltaY)?.row ?? -1, this.frozenRowCount);
73842
73880
  const rowEnd = this.getAllRowsHeight() > this.tableNoFrameHeight
73843
- ? this.getRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight + end_deltaY).row
73881
+ ? Math.max(this.getTargetRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight + end_deltaY)?.row ??
73882
+ -1, rowStart)
73844
73883
  : this.rowCount - 1;
73845
73884
  if (rowEnd < 0) {
73846
73885
  return null;
@@ -75703,18 +75742,21 @@
75703
75742
  }, delay);
75704
75743
  }
75705
75744
  scrollToRow(row, animationOption) {
75706
- const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
75745
+ const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1);
75746
+ const targetRowInt = Math.floor(targetRow);
75707
75747
  this.clearCorrectTimer();
75708
75748
  if (!animationOption) {
75709
- this.scrollToCell({ row: targetRow });
75710
- this._scheduleScrollToRowCorrect(targetRow);
75749
+ this.scrollToCell({ row: targetRowInt });
75750
+ this._scheduleScrollToRowCorrect(targetRowInt);
75711
75751
  return;
75712
75752
  }
75713
75753
  const duration = !isBoolean$2(animationOption) ? animationOption?.duration ?? 3000 : 3000;
75714
75754
  this.animationManager.scrollTo({ row: targetRow }, animationOption);
75715
- this._scrollToRowCorrectTimer = setTimeout(() => {
75716
- this.scrollToRow(targetRow, false);
75717
- }, duration);
75755
+ if (targetRowInt === targetRow) {
75756
+ this._scrollToRowCorrectTimer = setTimeout(() => {
75757
+ this.scrollToRow(targetRowInt, false);
75758
+ }, duration);
75759
+ }
75718
75760
  }
75719
75761
  scrollToCol(col, animationOption) {
75720
75762
  if (!animationOption) {
@@ -78150,7 +78192,13 @@
78150
78192
  }
78151
78193
  }
78152
78194
  }
78153
- const sourceColumns = this._columns.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
78195
+ const sourceColIndex = sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount;
78196
+ const targetColIndex = target.col >= source.col
78197
+ ? targetCellRange.end.col - this.leftRowSeriesNumberColumnCount
78198
+ : targetCellRange.start.col - this.leftRowSeriesNumberColumnCount;
78199
+ const sourceTotalIndex = this._columns[sourceColIndex]?.define?.startInTotal ?? sourceColIndex;
78200
+ const targetTotalIndex = this._columns[targetColIndex]?.define?.startInTotal ?? targetColIndex;
78201
+ const sourceColumns = this._columns.splice(sourceColIndex, sourceSize);
78154
78202
  sourceColumns.unshift((targetIndex - this.leftRowSeriesNumberColumnCount), 0);
78155
78203
  Array.prototype.splice.apply(this._columns, sourceColumns);
78156
78204
  if (this._table.options.dragOrder?.maintainArrayDataOrder) {
@@ -78158,7 +78206,7 @@
78158
78206
  this._columns[i].field = i;
78159
78207
  }
78160
78208
  }
78161
- this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, targetIndex - this.leftRowSeriesNumberColumnCount);
78209
+ this.columnTree.movePosition(sourceCellRange.start.row, sourceTotalIndex, targetTotalIndex);
78162
78210
  if (this._table.options.dragOrder?.maintainArrayDataOrder) {
78163
78211
  for (let i = 0; i < this.columnTree.tree.children.length; i++) {
78164
78212
  this.columnTree.tree.children[i].field = i;
@@ -78196,10 +78244,14 @@
78196
78244
  sourceIds.unshift(targetIndex, 0);
78197
78245
  Array.prototype.splice.apply(this._headerCellIds[row], sourceIds);
78198
78246
  }
78199
- const sourceColumns = this._columns.splice(sourceCellRange.start.row, sourceSize);
78247
+ const sourceRowIndex = sourceCellRange.start.row;
78248
+ const targetRowIndex = target.row >= source.row ? targetCellRange.end.row : targetCellRange.start.row;
78249
+ const sourceTotalIndex = this._columns[sourceRowIndex]?.define?.startInTotal ?? sourceRowIndex;
78250
+ const targetTotalIndex = this._columns[targetRowIndex]?.define?.startInTotal ?? targetRowIndex;
78251
+ const sourceColumns = this._columns.splice(sourceRowIndex, sourceSize);
78200
78252
  sourceColumns.unshift(targetIndex, 0);
78201
78253
  Array.prototype.splice.apply(this._columns, sourceColumns);
78202
- this.columnTree.movePosition(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceCellRange.start.row, targetIndex + (target.row > source.row ? sourceCellRange.end.row - sourceCellRange.start.row : 0));
78254
+ this.columnTree.movePosition(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceTotalIndex, targetTotalIndex);
78203
78255
  this.columnTree.reset(this.columnTree.tree.children);
78204
78256
  this._cellRangeMap = new Map();
78205
78257
  return {
@@ -80584,10 +80636,32 @@
80584
80636
  }
80585
80637
  adjustHeightResizedRowMap(moveContext, this);
80586
80638
  }
80639
+ this.syncColumnsStateFromLayoutMap();
80587
80640
  return moveContext;
80588
80641
  }
80589
80642
  return null;
80590
80643
  }
80644
+ syncColumnsStateFromLayoutMap() {
80645
+ const nextColumns = cloneDeepSpec(this.internalProps.columns, ['children']);
80646
+ const cleanColumns = (columns) => {
80647
+ columns.forEach(col => {
80648
+ delete col.level;
80649
+ delete col.size;
80650
+ delete col.startInTotal;
80651
+ delete col.startIndex;
80652
+ delete col.id;
80653
+ delete col.hierarchyState;
80654
+ if (col.columns) {
80655
+ cleanColumns(col.columns);
80656
+ }
80657
+ });
80658
+ };
80659
+ cleanColumns(nextColumns);
80660
+ this.options.columns = nextColumns;
80661
+ if (this.options.header) {
80662
+ this.options.header = nextColumns;
80663
+ }
80664
+ }
80591
80665
  changeRecordOrder(sourceIndex, targetIndex) {
80592
80666
  if (this.transpose) {
80593
80667
  sourceIndex = this.getRecordShowIndexByCell(sourceIndex, 0);
@@ -84829,7 +84903,18 @@
84829
84903
  const titleRows = table.listTreeStickCellPlugin.titleRows;
84830
84904
  const { shadowTarget } = e.pickParams;
84831
84905
  const cellGroup = getTargetCell(shadowTarget);
84832
- const { col, row } = cellGroup;
84906
+ if (!cellGroup) {
84907
+ return;
84908
+ }
84909
+ const iconInfo = getIconAndPositionFromTarget(shadowTarget);
84910
+ const funcType = iconInfo?.icon?.attribute?.funcType;
84911
+ if (funcType === IconFuncTypeEnum.collapse || funcType === IconFuncTypeEnum.expand) {
84912
+ const stickCellTop = getStickCellTop(cellGroup, table);
84913
+ table.toggleHierarchyState(cellGroup.col, cellGroup.row);
84914
+ keepRowAtVisiblePosition(cellGroup.col, cellGroup.row, stickCellTop, table);
84915
+ return;
84916
+ }
84917
+ const { row } = cellGroup;
84833
84918
  const rowIndex = titleRows.indexOf(row);
84834
84919
  scrollToRow(row - rowIndex, table);
84835
84920
  });
@@ -84850,7 +84935,18 @@
84850
84935
  const titleRows = table.listTreeStickCellPlugin.titleRows;
84851
84936
  const { shadowTarget } = e.pickParams;
84852
84937
  const cellGroup = getTargetCell(shadowTarget);
84853
- const { col, row } = cellGroup;
84938
+ if (!cellGroup) {
84939
+ return;
84940
+ }
84941
+ const iconInfo = getIconAndPositionFromTarget(shadowTarget);
84942
+ const funcType = iconInfo?.icon?.attribute?.funcType;
84943
+ if (funcType === IconFuncTypeEnum.collapse || funcType === IconFuncTypeEnum.expand) {
84944
+ const stickCellTop = getStickCellTop(cellGroup, table);
84945
+ table.toggleHierarchyState(cellGroup.col, cellGroup.row);
84946
+ keepRowAtVisiblePosition(cellGroup.col, cellGroup.row, stickCellTop, table);
84947
+ return;
84948
+ }
84949
+ const { row } = cellGroup;
84854
84950
  const rowIndex = titleRows.indexOf(row);
84855
84951
  scrollToRow(row - rowIndex, table);
84856
84952
  });
@@ -84870,6 +84966,15 @@
84870
84966
  }
84871
84967
  table.scenegraph.updateNextFrame();
84872
84968
  }
84969
+ function getStickCellTop(cellGroup, table) {
84970
+ return table.getFrozenRowsHeight() + (cellGroup.attribute?.y ?? 0);
84971
+ }
84972
+ function keepRowAtVisiblePosition(col, row, visibleTop, table) {
84973
+ const drawRange = table.getDrawRange();
84974
+ const targetScrollTop = Math.max(0, Math.min(table.getCellRect(col, row).top - visibleTop, table.getAllRowsHeight() - drawRange.height));
84975
+ table.scrollTop = targetScrollTop;
84976
+ table.scenegraph.updateNextFrame();
84977
+ }
84873
84978
  const registerListTreeStickCellPlugin = () => {
84874
84979
  Factory.registerComponent('listTreeStickCellPlugin', ListTreeStickCellPlugin);
84875
84980
  };
@@ -94343,6 +94448,11 @@
94343
94448
  _refreshHierarchyState(col, row, recalculateColWidths = true, beforeUpdateCell) {
94344
94449
  this.frozenColCount;
94345
94450
  this.frozenRowCount;
94451
+ const sizeTolerance = this.options.customConfig?._disableColumnAndRowSizeRound ? 1 : 0;
94452
+ const getMaxScrollTop = () => Math.max(0, this.getAllRowsHeight() - (this.scenegraph?.height ?? this.tableNoFrameHeight) - sizeTolerance);
94453
+ const oldMaxScrollTop = getMaxScrollTop();
94454
+ const isScrollToBottom = oldMaxScrollTop > 0 && this.scrollTop >= oldMaxScrollTop - 1;
94455
+ const oldScrollTop = this.scrollTop;
94346
94456
  const visibleStartRow = this.getBodyVisibleRowRange().rowStart;
94347
94457
  this.internalProps._oldRowCount = this.rowCount;
94348
94458
  this.internalProps._oldColCount = this.colCount;
@@ -94359,6 +94469,9 @@
94359
94469
  }
94360
94470
  }
94361
94471
  const isChangeRowTree = this.internalProps.layoutMap.isRowHeader(col, row);
94472
+ const oldHierarchyState = isChangeRowTree ? this.getHierarchyState(col, row) : undefined;
94473
+ const shouldKeepBottomAfterToggle = isScrollToBottom && oldHierarchyState === 'expand';
94474
+ const shouldKeepScrollAfterToggle = isChangeRowTree && !shouldKeepBottomAfterToggle;
94362
94475
  const result = isChangeRowTree
94363
94476
  ? this.internalProps.layoutMap.toggleHierarchyState(col, row)
94364
94477
  : this.internalProps.layoutMap.toggleHierarchyStateForColumnTree(col, row);
@@ -94380,8 +94493,26 @@
94380
94493
  this.clearCellStyleCache();
94381
94494
  this.scenegraph.createSceneGraph();
94382
94495
  this.scrollToRow(visibleStartRow);
94496
+ if (shouldKeepBottomAfterToggle) {
94497
+ this.clearCorrectTimer();
94498
+ this.setScrollTop(Number.MAX_SAFE_INTEGER);
94499
+ }
94500
+ else if (shouldKeepScrollAfterToggle) {
94501
+ this.clearCorrectTimer();
94502
+ this.setScrollTop(oldScrollTop);
94503
+ }
94383
94504
  }
94384
94505
  this.reactCustomLayout?.updateAllCustomCell();
94506
+ if (shouldKeepBottomAfterToggle) {
94507
+ this.clearCorrectTimer();
94508
+ this.setScrollTop(Number.MAX_SAFE_INTEGER);
94509
+ }
94510
+ else if (shouldKeepScrollAfterToggle &&
94511
+ this.rowHierarchyType !== 'grid-tree' &&
94512
+ this.columnHierarchyType !== 'grid-tree') {
94513
+ this.clearCorrectTimer();
94514
+ this.setScrollTop(oldScrollTop);
94515
+ }
94385
94516
  if (checkHasChart) {
94386
94517
  if (this.autoFillWidth && !notFillWidth) {
94387
94518
  notFillWidth = this.getAllColsWidth() <= this.tableNoFrameWidth;
@@ -96861,7 +96992,7 @@
96861
96992
  }
96862
96993
 
96863
96994
  registerForVrender();
96864
- const version = "1.0.36";
96995
+ const version = "1.0.37";
96865
96996
  function getIcons() {
96866
96997
  return get$2();
96867
96998
  }