@visactor/vtable 0.14.1 → 0.14.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 (67) hide show
  1. package/cjs/core/BaseTable.js +1 -1
  2. package/cjs/core/BaseTable.js.map +1 -1
  3. package/cjs/index.d.ts +1 -1
  4. package/cjs/index.js +1 -1
  5. package/cjs/index.js.map +1 -1
  6. package/cjs/scenegraph/component/custom.d.ts +1 -0
  7. package/cjs/scenegraph/component/custom.js +3 -2
  8. package/cjs/scenegraph/component/custom.js.map +1 -1
  9. package/cjs/scenegraph/group-creater/column-helper.js +1 -1
  10. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  11. package/cjs/scenegraph/group-creater/progress/proxy.js +3 -1
  12. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  13. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +6 -2
  14. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  15. package/cjs/scenegraph/layout/compute-col-width.js +3 -2
  16. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  17. package/cjs/scenegraph/layout/compute-row-height.js +3 -2
  18. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  19. package/cjs/scenegraph/layout/update-row.js +31 -12
  20. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  21. package/cjs/scenegraph/layout/update-width.js +8 -2
  22. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  23. package/cjs/scenegraph/scenegraph.js +1 -1
  24. package/cjs/scenegraph/scenegraph.js.map +1 -1
  25. package/cjs/scenegraph/select/update-select-border.js +2 -2
  26. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  27. package/cjs/state/select/update-position.js +28 -21
  28. package/cjs/state/select/update-position.js.map +1 -1
  29. package/cjs/themes/DARK.js +2 -1
  30. package/cjs/themes/DEFAULT.js +1 -2
  31. package/cjs/ts-types/base-table.d.ts +2 -0
  32. package/cjs/ts-types/base-table.js.map +1 -1
  33. package/dist/vtable.js +79 -26
  34. package/dist/vtable.min.js +2 -2
  35. package/es/core/BaseTable.js +1 -1
  36. package/es/core/BaseTable.js.map +1 -1
  37. package/es/index.d.ts +1 -1
  38. package/es/index.js +1 -1
  39. package/es/index.js.map +1 -1
  40. package/es/scenegraph/component/custom.d.ts +1 -0
  41. package/es/scenegraph/component/custom.js +1 -1
  42. package/es/scenegraph/component/custom.js.map +1 -1
  43. package/es/scenegraph/group-creater/column-helper.js +1 -1
  44. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  45. package/es/scenegraph/group-creater/progress/proxy.js +3 -1
  46. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  47. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +6 -2
  48. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  49. package/es/scenegraph/layout/compute-col-width.js +4 -3
  50. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  51. package/es/scenegraph/layout/compute-row-height.js +4 -3
  52. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  53. package/es/scenegraph/layout/update-row.js +32 -11
  54. package/es/scenegraph/layout/update-row.js.map +1 -1
  55. package/es/scenegraph/layout/update-width.js +8 -1
  56. package/es/scenegraph/layout/update-width.js.map +1 -1
  57. package/es/scenegraph/scenegraph.js +1 -1
  58. package/es/scenegraph/scenegraph.js.map +1 -1
  59. package/es/scenegraph/select/update-select-border.js +2 -2
  60. package/es/scenegraph/select/update-select-border.js.map +1 -1
  61. package/es/state/select/update-position.js +28 -21
  62. package/es/state/select/update-position.js.map +1 -1
  63. package/es/themes/DARK.js +2 -1
  64. package/es/themes/DEFAULT.js +1 -2
  65. package/es/ts-types/base-table.d.ts +2 -0
  66. package/es/ts-types/base-table.js.map +1 -1
  67. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -52055,8 +52055,8 @@
52055
52055
  let textAlign;
52056
52056
  let textBaseline;
52057
52057
  let y = 0;
52058
- if (columnGroup.colHeight) {
52059
- y = columnGroup.colHeight;
52058
+ if (columnGroup.lastChild) {
52059
+ y = columnGroup.lastChild.attribute.y + columnGroup.lastChild.attribute.height;
52060
52060
  }
52061
52061
  for (let j = rowStart; j <= rowEnd; j++) {
52062
52062
  const row = j;
@@ -53376,10 +53376,10 @@
53376
53376
  };
53377
53377
  if (customLayout) {
53378
53378
  const customLayoutObj = customLayout(arg);
53379
- if (customLayoutObj.rootContainer) {
53380
- customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);
53381
- }
53382
53379
  if (customLayoutObj.rootContainer instanceof Group$3) {
53380
+ customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);
53381
+ dealPercentCalc(customLayoutObj.rootContainer, table.getColWidth(col), 0);
53382
+ customLayoutObj.rootContainer.setStage(table.scenegraph.stage);
53383
53383
  height = customLayoutObj.rootContainer.AABBBounds.height() ?? 0;
53384
53384
  }
53385
53385
  else {
@@ -53918,6 +53918,13 @@
53918
53918
  });
53919
53919
  });
53920
53920
  const changed = updateCellContentWidth(singleCellGroup, distWidth, cellHeight, detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
53921
+ const hierarchyOffset = getHierarchyOffset(singleCellGroup.col, singleCellGroup.row, table);
53922
+ if (hierarchyOffset) {
53923
+ const text = singleCellGroup.getChildByName('text');
53924
+ if (text) {
53925
+ text.setAttribute('dx', hierarchyOffset);
53926
+ }
53927
+ }
53921
53928
  const rangeHeight = table.getRowHeight(row);
53922
53929
  const rangeWidth = table.getColWidth(col);
53923
53930
  singleCellGroup.contentWidth = distWidth;
@@ -55957,10 +55964,10 @@
55957
55964
  };
55958
55965
  if (customLayout) {
55959
55966
  const customLayoutObj = customLayout(arg);
55960
- if (customLayoutObj.rootContainer) {
55961
- customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);
55962
- }
55963
55967
  if (customLayoutObj.rootContainer instanceof Group$3) {
55968
+ customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);
55969
+ dealPercentCalc(customLayoutObj.rootContainer, 0, table.getRowHeight(row));
55970
+ customLayoutObj.rootContainer.setStage(table.scenegraph.stage);
55964
55971
  width = customLayoutObj.rootContainer.AABBBounds.width() ?? 0;
55965
55972
  }
55966
55973
  else {
@@ -56496,7 +56503,9 @@
56496
56503
  proxy.rowEnd = direction === 'up' ? proxy.rowEnd + count : proxy.rowEnd - count;
56497
56504
  updateRowContent(syncTopRow, syncBottomRow, proxy);
56498
56505
  if (proxy.table.heightMode === 'autoHeight') {
56499
- updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, direction);
56506
+ updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
56507
+ updateAutoRow(0, proxy.table.frozenColCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
56508
+ updateAutoRow(proxy.table.colCount - proxy.table.rightFrozenColCount, proxy.table.colCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
56500
56509
  const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.bodyLeftCol, screenTopRow, true);
56501
56510
  const delaY = screenTopY - (cellGroup.attribute.y + proxy.table.getFrozenRowsHeight() + proxy.table.scenegraph.proxy.deltaY);
56502
56511
  proxy.table.scenegraph.proxy.deltaY += delaY;
@@ -56532,6 +56541,8 @@
56532
56541
  updateRowContent(syncTopRow, syncBottomRow, proxy);
56533
56542
  if (proxy.table.heightMode === 'autoHeight') {
56534
56543
  updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
56544
+ updateAutoRow(0, proxy.table.frozenColCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
56545
+ updateAutoRow(proxy.table.colCount - proxy.table.rightFrozenColCount, proxy.table.colCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
56535
56546
  }
56536
56547
  proxy.table.scenegraph.proxy.deltaY = 0;
56537
56548
  proxy.currentRow = direction === 'up' ? proxy.currentRow + count : proxy.currentRow - count;
@@ -56982,6 +56993,8 @@
56982
56993
  updateRowContent(this.rowUpdatePos, distRow, this);
56983
56994
  if (this.table.heightMode === 'autoHeight') {
56984
56995
  updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
56996
+ updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
56997
+ updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
56985
56998
  }
56986
56999
  this.rowUpdatePos = distRow + 1;
56987
57000
  }
@@ -57210,7 +57223,7 @@
57210
57223
  const cellRange = scene.table.getCellRange(startCol, startRow);
57211
57224
  const colsWidth = scene.table.getColsWidth(cellRange.start.col, endCol);
57212
57225
  const rowsHeight = scene.table.getRowsHeight(cellRange.start.row, endRow);
57213
- const firstCellBound = scene.highPerformanceGetCell(startCol, startRow).globalAABBBounds;
57226
+ const firstCellBound = scene.highPerformanceGetCell(cellRange.start.col, cellRange.start.row).globalAABBBounds;
57214
57227
  selectComp.rect.setAttributes({
57215
57228
  x: firstCellBound.x1 - scene.tableGroup.attribute.x,
57216
57229
  y: firstCellBound.y1 - scene.tableGroup.attribute.y,
@@ -57218,9 +57231,9 @@
57218
57231
  height: rowsHeight,
57219
57232
  visible: true
57220
57233
  });
57221
- const isNearRowHeader = startCol === scene.table.frozenColCount;
57234
+ const isNearRowHeader = cellRange.start.col === scene.table.frozenColCount;
57222
57235
  const isNearRightRowHeader = endCol === scene.table.colCount - scene.table.rightFrozenColCount - 1;
57223
- const isNearColHeader = startRow === scene.table.frozenRowCount;
57236
+ const isNearColHeader = cellRange.start.row === scene.table.frozenRowCount;
57224
57237
  const isNearBottomColHeader = endRow === scene.table.rowCount - scene.table.bottomFrozenRowCount - 1;
57225
57238
  if ((isNearRowHeader && selectComp.rect.attribute.stroke[3]) ||
57226
57239
  (isNearRightRowHeader && selectComp.rect.attribute.stroke[1]) ||
@@ -57565,17 +57578,24 @@
57565
57578
 
57566
57579
  function updateRow(removeCells, addCells, updateCells, table) {
57567
57580
  const scene = table.scenegraph;
57568
- const removeRows = deduplication(removeCells.map(cell => cell.row)).sort((a, b) => a - b);
57581
+ const removeRows = deduplication(removeCells.map(cell => cell.row)).sort((a, b) => b - a);
57569
57582
  const addRows = deduplication(addCells.map(cell => cell.row)).sort((a, b) => a - b);
57570
57583
  removeRows.forEach(row => {
57571
57584
  removeRow(row, scene);
57572
57585
  });
57586
+ removeRows.forEach(row => {
57587
+ scene.table.rowHeightsMap.adjustOrder(row + 1, row, scene.table.rowHeightsMap.count() - row - 1);
57588
+ scene.table.rowHeightsMap.del(scene.table.rowHeightsMap.count() - 1);
57589
+ });
57573
57590
  if (removeRows.length) {
57574
57591
  resetRowNumber(scene);
57575
57592
  }
57593
+ scene.table._clearRowRangeHeightsMap();
57576
57594
  addRows.forEach(row => {
57577
57595
  addRow(row, scene);
57596
+ scene.table.rowHeightsMap.adjustOrder(row, row + 1, scene.table.rowHeightsMap.count() - row);
57578
57597
  });
57598
+ const newTotalHeight = resetRowNumberAndY(scene);
57579
57599
  updateCells.forEach(cell => {
57580
57600
  if (!cell) {
57581
57601
  return;
@@ -57592,13 +57612,17 @@
57592
57612
  updateCell$1(cell.col, cell.row, scene.table, false);
57593
57613
  }
57594
57614
  });
57595
- const newTotalHeight = resetRowNumberAndY(scene);
57596
57615
  if (addRows.length) {
57597
- scene.proxy.rowUpdatePos = scene.proxy.rowStart;
57616
+ const minRow = Math.min(...addRows);
57617
+ scene.proxy.rowUpdatePos = minRow;
57598
57618
  scene.proxy.rowUpdateDirection = 'up';
57599
57619
  scene.proxy.updateCellGroups(scene.proxy.screenRowCount * 2);
57600
57620
  scene.proxy.progress();
57601
57621
  }
57622
+ else if (removeRows.length) {
57623
+ scene.proxy.updateCellGroups(scene.proxy.screenRowCount * 2);
57624
+ scene.proxy.progress();
57625
+ }
57602
57626
  scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);
57603
57627
  }
57604
57628
  function removeRow(row, scene) {
@@ -57616,13 +57640,18 @@
57616
57640
  return false;
57617
57641
  });
57618
57642
  if (cellGroup) {
57643
+ colGroup.updateColumnHeight(-cellGroup.attribute.height);
57619
57644
  colGroup.removeChild(cellGroup);
57620
57645
  }
57621
57646
  }
57622
- scene.proxy.rowEnd--;
57647
+ if (row <= scene.proxy.rowEnd) {
57648
+ scene.proxy.rowEnd--;
57649
+ scene.proxy.currentRow--;
57650
+ }
57623
57651
  scene.proxy.bodyBottomRow--;
57624
- scene.proxy.currentRow--;
57625
- scene.proxy.totalRow--;
57652
+ const totalActualBodyRowCount = Math.min(scene.proxy.rowLimit, scene.proxy.bodyBottomRow - scene.proxy.bodyTopRow + 1);
57653
+ scene.proxy.totalActualBodyRowCount = totalActualBodyRowCount;
57654
+ scene.proxy.totalRow = scene.proxy.bodyTopRow + totalActualBodyRowCount - 1;
57626
57655
  }
57627
57656
  function addRow(row, scene) {
57628
57657
  for (let col = 0; col < scene.table.colCount; col++) {
@@ -57661,10 +57690,10 @@
57661
57690
  }
57662
57691
  }
57663
57692
  }
57664
- scene.proxy.rowEnd++;
57665
57693
  scene.proxy.bodyBottomRow++;
57666
- scene.proxy.currentRow++;
57667
57694
  scene.proxy.totalRow++;
57695
+ scene.proxy.rowEnd++;
57696
+ scene.proxy.currentRow++;
57668
57697
  }
57669
57698
  function deduplication(array) {
57670
57699
  const result = [];
@@ -57684,11 +57713,25 @@
57684
57713
  }
57685
57714
  let rowIndex = headerColGroup.firstChild?.row;
57686
57715
  headerColGroup.forEachChildren((cellGroup) => {
57716
+ const oldRow = cellGroup.row;
57717
+ if (isNumber$7(cellGroup.mergeStartRow)) {
57718
+ cellGroup.mergeStartRow = cellGroup.mergeStartRow - oldRow + rowIndex;
57719
+ }
57720
+ if (isNumber$7(cellGroup.mergeEndRow)) {
57721
+ cellGroup.mergeEndRow = cellGroup.mergeEndRow - oldRow + rowIndex;
57722
+ }
57687
57723
  cellGroup.row = rowIndex;
57688
57724
  rowIndex++;
57689
57725
  });
57690
57726
  rowIndex = colGroup.firstChild?.row;
57691
57727
  colGroup.forEachChildren((cellGroup) => {
57728
+ const oldRow = cellGroup.row;
57729
+ if (isNumber$7(cellGroup.mergeStartRow)) {
57730
+ cellGroup.mergeStartRow = cellGroup.mergeStartRow - oldRow + rowIndex;
57731
+ }
57732
+ if (isNumber$7(cellGroup.mergeEndRow)) {
57733
+ cellGroup.mergeEndRow = cellGroup.mergeEndRow - oldRow + rowIndex;
57734
+ }
57692
57735
  cellGroup.row = rowIndex;
57693
57736
  rowIndex++;
57694
57737
  });
@@ -57708,6 +57751,13 @@
57708
57751
  rowIndex = colGroup.firstChild?.row;
57709
57752
  y = 0;
57710
57753
  colGroup.forEachChildren((cellGroup) => {
57754
+ const oldRow = cellGroup.row;
57755
+ if (isNumber$7(cellGroup.mergeStartRow)) {
57756
+ cellGroup.mergeStartRow = cellGroup.mergeStartRow - oldRow + rowIndex;
57757
+ }
57758
+ if (isNumber$7(cellGroup.mergeEndRow)) {
57759
+ cellGroup.mergeEndRow = cellGroup.mergeEndRow - oldRow + rowIndex;
57760
+ }
57711
57761
  cellGroup.row = rowIndex;
57712
57762
  rowIndex++;
57713
57763
  if (cellGroup.role !== 'cell') {
@@ -59799,6 +59849,7 @@
59799
59849
  if (!this.isPivot && !this.transpose) {
59800
59850
  this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
59801
59851
  }
59852
+ this.component.updateScrollBar();
59802
59853
  this.updateNextFrame();
59803
59854
  }
59804
59855
  getColumnGroupX(col) {
@@ -60166,15 +60217,17 @@
60166
60217
  scenegraph.deleteAllSelectBorder();
60167
60218
  }
60168
60219
  if (state.select.headerSelectMode !== 'cell' && table.isColumnHeader(col, row)) {
60220
+ const cellRange = table.getCellRange(col, row);
60169
60221
  state.select.ranges.push({
60170
- start: { col, row },
60171
- end: { col, row: table.rowCount - 1 }
60222
+ start: { col: cellRange.start.col, row },
60223
+ end: { col: cellRange.end.col, row: table.rowCount - 1 }
60172
60224
  });
60173
60225
  }
60174
60226
  else if (state.select.headerSelectMode !== 'cell' && table.isRowHeader(col, row)) {
60227
+ const cellRange = table.getCellRange(col, row);
60175
60228
  state.select.ranges.push({
60176
- start: { col, row },
60177
- end: { col: table.colCount - 1, row }
60229
+ start: { col, row: cellRange.start.row },
60230
+ end: { col: table.colCount - 1, row: cellRange.end.row }
60178
60231
  });
60179
60232
  }
60180
60233
  else {
@@ -65666,7 +65719,7 @@
65666
65719
  return TABLE_EVENT_TYPE;
65667
65720
  }
65668
65721
  options;
65669
- version = "0.14.1";
65722
+ version = "0.14.2";
65670
65723
  pagination;
65671
65724
  id = `VTable${Date.now()}`;
65672
65725
  headerStyleCache;
@@ -75069,7 +75122,7 @@
75069
75122
  return new Tag$1(params ? params.attribute : {});
75070
75123
  }
75071
75124
 
75072
- const version = "0.14.1";
75125
+ const version = "0.14.2";
75073
75126
  function getIcons() {
75074
75127
  return get$1();
75075
75128
  }