@visactor/vtable 0.17.3-alpha.0 → 0.17.3-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 (63) 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/cell-content.d.ts +1 -0
  7. package/cjs/scenegraph/component/cell-content.js +4 -3
  8. package/cjs/scenegraph/component/cell-content.js.map +1 -1
  9. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +5 -5
  10. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  11. package/cjs/scenegraph/graphic/group.d.ts +2 -0
  12. package/cjs/scenegraph/graphic/group.js.map +1 -1
  13. package/cjs/scenegraph/group-creater/column-helper.d.ts +4 -1
  14. package/cjs/scenegraph/group-creater/column-helper.js +7 -3
  15. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  16. package/cjs/scenegraph/layout/compute-col-width.js +6 -2
  17. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  18. package/cjs/scenegraph/layout/compute-row-height.js +14 -9
  19. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  20. package/cjs/scenegraph/layout/update-height.d.ts +1 -1
  21. package/cjs/scenegraph/layout/update-height.js +7 -5
  22. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  23. package/cjs/scenegraph/layout/update-width.d.ts +1 -1
  24. package/cjs/scenegraph/layout/update-width.js +8 -6
  25. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  26. package/cjs/scenegraph/scenegraph.d.ts +2 -2
  27. package/cjs/scenegraph/scenegraph.js +5 -4
  28. package/cjs/scenegraph/scenegraph.js.map +1 -1
  29. package/cjs/state/state.js +4 -6
  30. package/cjs/state/state.js.map +1 -1
  31. package/dist/vtable.js +70 -28
  32. package/dist/vtable.min.js +2 -2
  33. package/es/core/BaseTable.js +1 -1
  34. package/es/core/BaseTable.js.map +1 -1
  35. package/es/index.d.ts +1 -1
  36. package/es/index.js +1 -1
  37. package/es/index.js.map +1 -1
  38. package/es/scenegraph/component/cell-content.d.ts +1 -0
  39. package/es/scenegraph/component/cell-content.js +4 -3
  40. package/es/scenegraph/component/cell-content.js.map +1 -1
  41. package/es/scenegraph/graphic/contributions/chart-render-helper.js +5 -5
  42. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  43. package/es/scenegraph/graphic/group.d.ts +2 -0
  44. package/es/scenegraph/graphic/group.js.map +1 -1
  45. package/es/scenegraph/group-creater/column-helper.d.ts +4 -1
  46. package/es/scenegraph/group-creater/column-helper.js +7 -3
  47. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  48. package/es/scenegraph/layout/compute-col-width.js +6 -2
  49. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  50. package/es/scenegraph/layout/compute-row-height.js +14 -9
  51. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  52. package/es/scenegraph/layout/update-height.d.ts +1 -1
  53. package/es/scenegraph/layout/update-height.js +7 -5
  54. package/es/scenegraph/layout/update-height.js.map +1 -1
  55. package/es/scenegraph/layout/update-width.d.ts +1 -1
  56. package/es/scenegraph/layout/update-width.js +8 -6
  57. package/es/scenegraph/layout/update-width.js.map +1 -1
  58. package/es/scenegraph/scenegraph.d.ts +2 -2
  59. package/es/scenegraph/scenegraph.js +5 -4
  60. package/es/scenegraph/scenegraph.js.map +1 -1
  61. package/es/state/state.js +4 -6
  62. package/es/state/state.js.map +1 -1
  63. package/package.json +2 -2
package/dist/vtable.js CHANGED
@@ -49120,6 +49120,8 @@
49120
49120
  colHeight;
49121
49121
  border;
49122
49122
  needUpdate;
49123
+ needUpdateWidth;
49124
+ needUpdateHeight;
49123
49125
  clear() {
49124
49126
  this.removeAllChild();
49125
49127
  }
@@ -50366,6 +50368,7 @@
50366
50368
  _autoWidth = false;
50367
50369
  _autoHeight = false;
50368
50370
  _cellWidth;
50371
+ _originCellWidth;
50369
50372
  _cellHeight;
50370
50373
  _align;
50371
50374
  _baseline;
@@ -50397,6 +50400,7 @@
50397
50400
  this._autoWidth = option.autoWidth;
50398
50401
  this._autoHeight = option.autoHeight;
50399
50402
  this._cellWidth = option.cellWidth;
50403
+ this._originCellWidth = option.cellWidth;
50400
50404
  this._cellHeight = option.cellHeight;
50401
50405
  this._align = option.align;
50402
50406
  this._baseline = option.baseline;
@@ -50518,10 +50522,12 @@
50518
50522
  }
50519
50523
  updateWidth(width) {
50520
50524
  this._cellWidth = width;
50525
+ this._originCellWidth = width;
50521
50526
  this.layout();
50522
50527
  }
50523
50528
  updateHeight(height) {
50524
50529
  this._cellHeight = height;
50530
+ this._cellWidth = this._originCellWidth;
50525
50531
  this.layout();
50526
50532
  }
50527
50533
  }
@@ -51774,6 +51780,8 @@
51774
51780
  if (row === range.end.row) {
51775
51781
  newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;
51776
51782
  }
51783
+ const widthChange = rangeWidth !== cellGroup.attribute.width;
51784
+ const heightChange = rangeHeight !== cellGroup.attribute.height;
51777
51785
  cellGroup.setAttributes({
51778
51786
  width: rangeWidth,
51779
51787
  height: rangeHeight,
@@ -51783,6 +51791,10 @@
51783
51791
  cellGroup.mergeStartRow = range.start.row;
51784
51792
  cellGroup.mergeEndCol = range.end.col;
51785
51793
  cellGroup.mergeEndRow = range.end.row;
51794
+ return {
51795
+ widthChange,
51796
+ heightChange
51797
+ };
51786
51798
  }
51787
51799
  function dealMerge(range, mergeMap, table) {
51788
51800
  let cellWidth = 0;
@@ -52781,7 +52793,7 @@
52781
52793
  if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') {
52782
52794
  const height = computeRowHeight(row, startCol, endCol, table);
52783
52795
  if (update) {
52784
- newHeights[row] = height;
52796
+ newHeights[row] = Math.round(height);
52785
52797
  }
52786
52798
  else {
52787
52799
  table._setRowHeight(row, height);
@@ -52792,7 +52804,7 @@
52792
52804
  if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') {
52793
52805
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
52794
52806
  if (update) {
52795
- newHeights[row] = height;
52807
+ newHeights[row] = Math.round(height);
52796
52808
  }
52797
52809
  else {
52798
52810
  table._setRowHeight(row, height);
@@ -52809,7 +52821,7 @@
52809
52821
  for (let row = table.rowCount - table.bottomFrozenRowCount; row <= rowEnd; row++) {
52810
52822
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
52811
52823
  if (update) {
52812
- newHeights[row] = height;
52824
+ newHeights[row] = Math.round(height);
52813
52825
  }
52814
52826
  else {
52815
52827
  table._setRowHeight(row, height);
@@ -52827,7 +52839,7 @@
52827
52839
  height = computeRowHeight(row, 0, table.colCount - 1, table);
52828
52840
  }
52829
52841
  if (update) {
52830
- newHeights[row] = height;
52842
+ newHeights[row] = Math.round(height);
52831
52843
  }
52832
52844
  else {
52833
52845
  table._setRowHeight(row, height);
@@ -52838,7 +52850,7 @@
52838
52850
  for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {
52839
52851
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
52840
52852
  if (update) {
52841
- newHeights[row] = height;
52853
+ newHeights[row] = Math.round(height);
52842
52854
  }
52843
52855
  else {
52844
52856
  table._setRowHeight(row, height);
@@ -52939,10 +52951,15 @@
52939
52951
  for (let row = 0; row < table.rowCount; row++) {
52940
52952
  const newRowHeight = newHeights[row] ?? table.getRowHeight(row);
52941
52953
  if (newRowHeight !== oldRowHeights[row]) {
52942
- table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row]);
52943
52954
  table._setRowHeight(row, newRowHeight);
52944
52955
  }
52945
52956
  }
52957
+ for (let row = 0; row < table.rowCount; row++) {
52958
+ const newRowHeight = table.getRowHeight(row);
52959
+ if (newRowHeight !== oldRowHeights[row]) {
52960
+ table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
52961
+ }
52962
+ }
52946
52963
  }
52947
52964
  }
52948
52965
  function computeRowHeight(row, startCol, endCol, table) {
@@ -53279,8 +53296,10 @@
53279
53296
  };
53280
53297
  }
53281
53298
 
53282
- function updateRowHeight(scene, row, detaY) {
53283
- scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);
53299
+ function updateRowHeight(scene, row, detaY, skipTableHeightMap) {
53300
+ if (!skipTableHeightMap) {
53301
+ scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);
53302
+ }
53284
53303
  for (let col = 0; col < scene.table.colCount; col++) {
53285
53304
  const cell = scene.getCell(col, row);
53286
53305
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
@@ -53311,7 +53330,6 @@
53311
53330
  }
53312
53331
  }
53313
53332
  function updateCellHeightForRow(scene, cell, col, row, height, detaY, isHeader) {
53314
- cell.setAttribute('height', height);
53315
53333
  const cellGroup = cell;
53316
53334
  const distHeight = height;
53317
53335
  if (!cellGroup) {
@@ -53320,6 +53338,11 @@
53320
53338
  updateCellHeight(scene, cellGroup, col, row, distHeight, detaY);
53321
53339
  }
53322
53340
  function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader) {
53341
+ if (cell.attribute.height === distHeight && !cell.needUpdateHeight) {
53342
+ return;
53343
+ }
53344
+ cell.needUpdateHeight = false;
53345
+ cell.setAttribute('height', distHeight);
53323
53346
  const type = scene.table.isHeader(col, row)
53324
53347
  ? scene.table._getHeaderLayoutMap(col, row).headerType
53325
53348
  : scene.table.getBodyColumnType(col, row);
@@ -53407,7 +53430,7 @@
53407
53430
  const rangeHeight = table.getRowHeight(row);
53408
53431
  const rangeWidth = table.getColWidth(col);
53409
53432
  singleCellGroup.contentHeight = distHeight;
53410
- resizeCellGroup(singleCellGroup, rangeWidth, rangeHeight, {
53433
+ const { widthChange } = resizeCellGroup(singleCellGroup, rangeWidth, rangeHeight, {
53411
53434
  start: {
53412
53435
  col: cellGroup.mergeStartCol,
53413
53436
  row: cellGroup.mergeStartRow
@@ -53417,6 +53440,9 @@
53417
53440
  row: cellGroup.mergeEndRow
53418
53441
  }
53419
53442
  }, table);
53443
+ if (widthChange) {
53444
+ singleCellGroup.needUpdateWidth = true;
53445
+ }
53420
53446
  }
53421
53447
  }
53422
53448
  }
@@ -53425,8 +53451,10 @@
53425
53451
  }
53426
53452
  }
53427
53453
 
53428
- function updateColWidth(scene, col, detaX) {
53429
- scene.table._setColWidth(col, scene.table.getColWidth(col) + detaX, true);
53454
+ function updateColWidth(scene, col, detaX, skipTableWidthMap) {
53455
+ if (!skipTableWidthMap) {
53456
+ scene.table._setColWidth(col, scene.table.getColWidth(col) + detaX, true);
53457
+ }
53430
53458
  const autoRowHeight = scene.table.heightMode === 'autoHeight';
53431
53459
  const colOrCornerHeaderColumn = scene.getColGroup(col, true);
53432
53460
  if (colOrCornerHeaderColumn) {
@@ -53567,9 +53595,10 @@
53567
53595
  }
53568
53596
  }
53569
53597
  function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoRowHeight) {
53570
- if (cell.attribute.width === distWidth) {
53598
+ if (cell.attribute.width === distWidth && !cell.needUpdateWidth) {
53571
53599
  return false;
53572
53600
  }
53601
+ cell.needUpdateWidth = false;
53573
53602
  cell.setAttribute('width', distWidth);
53574
53603
  const cellGroup = cell;
53575
53604
  if (!cellGroup) {
@@ -53689,7 +53718,7 @@
53689
53718
  const rangeHeight = table.getRowHeight(row);
53690
53719
  const rangeWidth = table.getColWidth(col);
53691
53720
  singleCellGroup.contentWidth = distWidth;
53692
- resizeCellGroup(singleCellGroup, rangeWidth, rangeHeight, {
53721
+ const { heightChange } = resizeCellGroup(singleCellGroup, rangeWidth, rangeHeight, {
53693
53722
  start: {
53694
53723
  col: cellGroup.mergeStartCol,
53695
53724
  row: cellGroup.mergeStartRow
@@ -53699,6 +53728,9 @@
53699
53728
  row: cellGroup.mergeEndRow
53700
53729
  }
53701
53730
  }, table);
53731
+ if (heightChange) {
53732
+ singleCellGroup.needUpdateHeight = true;
53733
+ }
53702
53734
  isHeightChange = isHeightChange || changed;
53703
53735
  }
53704
53736
  }
@@ -54765,12 +54797,12 @@
54765
54797
  viewBox.y2 = viewBox.y1 + 1;
54766
54798
  }
54767
54799
  axes.forEach((axis, index) => {
54768
- if (axis.type === 'linear') {
54769
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
54770
- }
54771
- else if (axis.type === 'band') {
54800
+ if (axis.type === 'band') {
54772
54801
  chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
54773
54802
  }
54803
+ else {
54804
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
54805
+ }
54774
54806
  });
54775
54807
  chartInstance.updateViewBox({
54776
54808
  x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
@@ -55592,7 +55624,7 @@
55592
55624
  table._clearColRangeWidthsMap(col);
55593
55625
  }
55594
55626
  if (update) {
55595
- newWidths[col] = table._adjustColWidth(col, maxWidth);
55627
+ newWidths[col] = Math.round(table._adjustColWidth(col, maxWidth));
55596
55628
  }
55597
55629
  else {
55598
55630
  table._setColWidth(col, table._adjustColWidth(col, maxWidth), false, true);
@@ -55637,7 +55669,13 @@
55637
55669
  for (let col = 0; col < table.colCount; col++) {
55638
55670
  const newColWidth = newWidths[col] ?? table.getColWidth(col);
55639
55671
  if (newColWidth !== oldColWidths[col]) {
55640
- table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true);
55672
+ table._setColWidth(col, newColWidth);
55673
+ }
55674
+ }
55675
+ for (let col = 0; col < table.colCount; col++) {
55676
+ const newColWidth = table.getColWidth(col);
55677
+ if (newColWidth !== oldColWidths[col]) {
55678
+ table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true, true);
55641
55679
  }
55642
55680
  }
55643
55681
  table.scenegraph.updateContainer();
@@ -59782,8 +59820,8 @@
59782
59820
  });
59783
59821
  moveSelectingRangeComponentsToSelectedRangeComponents(this);
59784
59822
  }
59785
- updateColWidth(col, detaX, skipUpdateContainer) {
59786
- updateColWidth(this, col, Math.round(detaX));
59823
+ updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) {
59824
+ updateColWidth(this, col, Math.round(detaX), skipTableWidthMap);
59787
59825
  if (!skipUpdateContainer) {
59788
59826
  this.updateContainer();
59789
59827
  }
@@ -59961,9 +59999,9 @@
59961
59999
  });
59962
60000
  }
59963
60001
  }
59964
- updateRowHeight(row, detaY) {
60002
+ updateRowHeight(row, detaY, skipTableHeightMap) {
59965
60003
  detaY = Math.round(detaY);
59966
- updateRowHeight(this, row, detaY);
60004
+ updateRowHeight(this, row, detaY, skipTableHeightMap);
59967
60005
  this.updateContainerHeight(row, detaY);
59968
60006
  }
59969
60007
  updateContainerWidth(col, detaX) {
@@ -61763,11 +61801,13 @@
61763
61801
  const totalHeight = this.table.getAllRowsHeight();
61764
61802
  top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height));
61765
61803
  top = Math.ceil(top);
61804
+ if (top !== this.scroll.verticalBarPos) {
61805
+ this.table.stateManager.updateHoverPos(-1, -1);
61806
+ }
61766
61807
  this.scroll.verticalBarPos = top;
61767
61808
  this.table.scenegraph.setY(-top);
61768
61809
  const yRatio = top / (totalHeight - this.table.scenegraph.height);
61769
61810
  this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
61770
- this.table.stateManager.updateHoverPos(-1, -1);
61771
61811
  this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
61772
61812
  scrollTop: this.scroll.verticalBarPos,
61773
61813
  scrollLeft: this.scroll.horizontalBarPos,
@@ -61784,11 +61824,13 @@
61784
61824
  this.table.getFrozenColsWidth();
61785
61825
  left = Math.max(0, Math.min(left, totalWidth - this.table.scenegraph.width));
61786
61826
  left = Math.ceil(left);
61827
+ if (left !== this.scroll.horizontalBarPos) {
61828
+ this.table.stateManager.updateHoverPos(-1, -1);
61829
+ }
61787
61830
  this.scroll.horizontalBarPos = left;
61788
61831
  this.table.scenegraph.setX(-left);
61789
61832
  const xRatio = left / (totalWidth - this.table.scenegraph.width);
61790
61833
  this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
61791
- this.table.stateManager.updateHoverPos(-1, -1);
61792
61834
  this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
61793
61835
  scrollTop: this.scroll.verticalBarPos,
61794
61836
  scrollLeft: this.scroll.horizontalBarPos,
@@ -66581,7 +66623,7 @@
66581
66623
  return TABLE_EVENT_TYPE;
66582
66624
  }
66583
66625
  options;
66584
- version = "0.17.3-alpha.0";
66626
+ version = "0.17.3-alpha.2";
66585
66627
  pagination;
66586
66628
  id = `VTable${Date.now()}`;
66587
66629
  headerStyleCache;
@@ -77208,7 +77250,7 @@
77208
77250
  return new Tag$1(params ? params.attribute : {});
77209
77251
  }
77210
77252
 
77211
- const version = "0.17.3-alpha.0";
77253
+ const version = "0.17.3-alpha.2";
77212
77254
  function getIcons() {
77213
77255
  return get$2();
77214
77256
  }