@visactor/vtable-sheet 1.26.2 → 1.26.3

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.
@@ -43572,13 +43572,20 @@
43572
43572
  return parse$3(font);
43573
43573
  }
43574
43574
 
43575
- function getQuadProps(paddingOrigin) {
43575
+ function normalizeQuadArray(values) {
43576
+ return 0 === values.length ? [0, 0, 0, 0] : 1 === values.length ? [values[0], values[0], values[0], values[0]] : 2 === values.length ? [values[0], values[1], values[0], values[1]] : 3 === values.length ? [values[0], values[1], values[2], values[1]] : [values[0], values[1], values[2], values[3]];
43577
+ }
43578
+ function parseStringQuad(padding) {
43579
+ const tokens = padding.trim().split(/\s+/),
43580
+ values = tokens.map(token => Number.parseFloat(token)).filter(value => Number.isFinite(value));
43581
+ return values.length === tokens.length && values.length > 0 ? normalizeQuadArray(values) : [padding, padding, padding, padding];
43582
+ }
43583
+ function normalizePaddingObject(paddingOrigin) {
43576
43584
  var _a, _b, _c, _d;
43577
- if (isNumber$2(paddingOrigin) || isString$2(paddingOrigin) || isArray$8(paddingOrigin)) {
43578
- let padding = parsePadding(paddingOrigin);
43579
- return "number" == typeof padding || "string" == typeof padding ? padding = [padding, padding, padding, padding] : Array.isArray(padding) && (padding = padding.slice(0)), padding;
43580
- }
43581
- return paddingOrigin && (isFinite(paddingOrigin.bottom) || isFinite(paddingOrigin.left) || isFinite(paddingOrigin.right) || isFinite(paddingOrigin.top)) ? [null !== (_a = paddingOrigin.top) && void 0 !== _a ? _a : 0, null !== (_b = paddingOrigin.right) && void 0 !== _b ? _b : 0, null !== (_c = paddingOrigin.bottom) && void 0 !== _c ? _c : 0, null !== (_d = paddingOrigin.left) && void 0 !== _d ? _d : 0] : [0, 0, 0, 0];
43585
+ return Number.isFinite(paddingOrigin.bottom) || Number.isFinite(paddingOrigin.left) || Number.isFinite(paddingOrigin.right) || Number.isFinite(paddingOrigin.top) ? [null !== (_a = paddingOrigin.top) && void 0 !== _a ? _a : 0, null !== (_b = paddingOrigin.right) && void 0 !== _b ? _b : 0, null !== (_c = paddingOrigin.bottom) && void 0 !== _c ? _c : 0, null !== (_d = paddingOrigin.left) && void 0 !== _d ? _d : 0] : [0, 0, 0, 0];
43586
+ }
43587
+ function getQuadProps(paddingOrigin) {
43588
+ return Array.isArray(paddingOrigin) ? normalizeQuadArray(paddingOrigin.slice(0, 4)) : "number" == typeof paddingOrigin && Number.isFinite(paddingOrigin) ? [paddingOrigin, paddingOrigin, paddingOrigin, paddingOrigin] : "string" == typeof paddingOrigin ? parseStringQuad(paddingOrigin) : paddingOrigin && "object" == typeof paddingOrigin ? normalizePaddingObject(paddingOrigin) : [0, 0, 0, 0];
43582
43589
  }
43583
43590
 
43584
43591
  const TYPE_PAREN = 0,
@@ -44605,7 +44612,7 @@
44605
44612
  col: null !== (_b = null == range ? void 0 : range.start.col) && void 0 !== _b ? _b : col,
44606
44613
  row: null !== (_c = null == range ? void 0 : range.start.row) && void 0 !== _c ? _c : row,
44607
44614
  dataValue: table.getCellOriginValue(col, row),
44608
- value: table.getCellValue(col, row) || "",
44615
+ value: table.getCellValue(col, row),
44609
44616
  rect: {
44610
44617
  left: 0,
44611
44618
  top: 0,
@@ -44627,7 +44634,7 @@
44627
44634
  col: col,
44628
44635
  row: row,
44629
44636
  dataValue: table.getCellOriginValue(col, row),
44630
- value: table.getCellValue(col, row) || "",
44637
+ value: table.getCellValue(col, row),
44631
44638
  rect: {
44632
44639
  left: 0,
44633
44640
  top: 0,
@@ -46616,7 +46623,7 @@
46616
46623
  col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
46617
46624
  row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
46618
46625
  dataValue: table.getCellOriginValue(col, row),
46619
- value: table.getCellValue(col, row) || "",
46626
+ value: table.getCellValue(col, row),
46620
46627
  rect: getCellRect$1(col, row, table),
46621
46628
  table: table,
46622
46629
  originCol: col,
@@ -47525,6 +47532,17 @@
47525
47532
  }
47526
47533
  }
47527
47534
 
47535
+ function getBodyHorizontalScrollRange(table) {
47536
+ var _a, _b, _c, _d;
47537
+ const totalWidth = table.getAllColsWidth(),
47538
+ frozenColsWidth = table.getFrozenColsWidth(),
47539
+ rightFrozenColsWidth = table.getRightFrozenColsWidth(),
47540
+ frozenColsContentWidth = null !== (_b = null === (_a = table.getFrozenColsContentWidth) || void 0 === _a ? void 0 : _a.call(table)) && void 0 !== _b ? _b : frozenColsWidth,
47541
+ rightFrozenColsContentWidth = null !== (_d = null === (_c = table.getRightFrozenColsContentWidth) || void 0 === _c ? void 0 : _c.call(table)) && void 0 !== _d ? _d : rightFrozenColsWidth,
47542
+ bodyViewportWidth = table.tableNoFrameWidth - frozenColsWidth - rightFrozenColsWidth,
47543
+ bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth;
47544
+ return Math.max(0, bodyContentWidth - bodyViewportWidth);
47545
+ }
47528
47546
  function getColX(col, table, isRightFrozen) {
47529
47547
  var _a, _b, _c, _d, _e, _f;
47530
47548
  if (isRightFrozen) return Math.min(table.tableNoFrameWidth, table.getAllColsWidth()) - table.getColsWidth(col, table.colCount - 1) + (null !== (_b = null === (_a = table.getRightFrozenColsScrollLeft) || void 0 === _a ? void 0 : _a.call(table)) && void 0 !== _b ? _b : 0);
@@ -47817,17 +47835,18 @@
47817
47835
  rightFrozenColsWidth = this.table.getRightFrozenColsWidth(),
47818
47836
  rightFrozenColsContentWidth = null !== (_m = null === (_l = (_k = this.table).getRightFrozenColsContentWidth) || void 0 === _l ? void 0 : _l.call(_k)) && void 0 !== _m ? _m : rightFrozenColsWidth,
47819
47837
  hoverOn = this.table.theme.scrollStyle.hoverOn,
47820
- sizeTolerance = (null === (_o = this.table.options.customConfig) || void 0 === _o ? void 0 : _o._disableColumnAndRowSizeRound) ? 1 : 0;
47821
- if (totalWidth > tableWidth + sizeTolerance) {
47822
- const y = Math.min(tableHeight, totalHeight),
47823
- bodyViewportWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth,
47824
- bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth,
47838
+ sizeTolerance = (null === (_o = this.table.options.customConfig) || void 0 === _o ? void 0 : _o._disableColumnAndRowSizeRound) ? 1 : 0,
47839
+ bodyScrollRange = getBodyHorizontalScrollRange(this.table),
47840
+ y = Math.min(tableHeight, totalHeight);
47841
+ let attrY = 0;
47842
+ attrY = this.table.theme.scrollStyle.barToSide ? this.table.tableNoFrameHeight - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y) + this.table.tableY : y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
47843
+ const ignoreFrozenCols = null !== (_q = null === (_p = this.table.theme.scrollStyle) || void 0 === _p ? void 0 : _p.ignoreFrozenCols) && void 0 !== _q && _q;
47844
+ if (bodyScrollRange > sizeTolerance) {
47845
+ const bodyViewportWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth,
47846
+ bodyContentWidth = bodyViewportWidth + bodyScrollRange,
47825
47847
  rangeEnd = bodyContentWidth > 0 ? Math.max(.05, bodyViewportWidth / bodyContentWidth) : 1;
47826
- let attrY = 0;
47827
- attrY = this.table.theme.scrollStyle.barToSide ? this.table.tableNoFrameHeight - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y) + this.table.tableY : y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
47828
47848
  let hScrollBarx = frozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x),
47829
47849
  hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
47830
- const ignoreFrozenCols = null !== (_q = null === (_p = this.table.theme.scrollStyle) || void 0 === _p ? void 0 : _p.ignoreFrozenCols) && void 0 !== _q && _q;
47831
47850
  ignoreFrozenCols ? (hScrollBarx = hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x, hScrollBarWidth = tableWidth) : (hScrollBarx = frozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x), hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth), this.hScrollBar.setAttributes({
47832
47851
  x: hScrollBarx,
47833
47852
  y: attrY,
@@ -47840,61 +47859,51 @@
47840
47859
  x: bounds.x1,
47841
47860
  y: bounds.y1
47842
47861
  }, "always" === horizontalVisible && this.hScrollBar.showAll();
47843
- const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
47844
- if (!ignoreFrozenCols && frozenScrollable) {
47845
- const frozenRangeEnd = Math.max(.05, frozenColsWidth / frozenColsContentWidth),
47846
- x = hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x;
47847
- this.frozenHScrollBar.setAttributes({
47848
- x: x,
47849
- y: attrY,
47850
- width: frozenColsWidth,
47851
- range: [0, frozenRangeEnd],
47852
- visible: "always" === horizontalVisible
47853
- });
47854
- const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
47855
- this.frozenHScrollBar._viewPosition = {
47856
- x: bounds.x1,
47857
- y: bounds.y1
47858
- }, "always" === horizontalVisible && this.frozenHScrollBar.showAll();
47859
- } else this.frozenHScrollBar.setAttributes({
47860
- x: 2 * -this.table.tableNoFrameWidth,
47861
- y: 2 * -this.table.tableNoFrameHeight,
47862
- width: 0,
47863
- visible: !1
47864
- });
47865
- const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
47866
- if (!ignoreFrozenCols && rightFrozenScrollable) {
47867
- const rightFrozenRangeEnd = Math.max(.05, rightFrozenColsWidth / rightFrozenColsContentWidth),
47868
- x = tableWidth - rightFrozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x);
47869
- this.rightFrozenHScrollBar.setAttributes({
47870
- x: x,
47871
- y: attrY,
47872
- width: rightFrozenColsWidth,
47873
- range: [0, rightFrozenRangeEnd],
47874
- visible: "always" === horizontalVisible
47875
- });
47876
- const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
47877
- this.rightFrozenHScrollBar._viewPosition = {
47878
- x: bounds.x1,
47879
- y: bounds.y1
47880
- }, "always" === horizontalVisible && this.rightFrozenHScrollBar.showAll();
47881
- } else this.rightFrozenHScrollBar.setAttributes({
47882
- x: 2 * -this.table.tableNoFrameWidth,
47883
- y: 2 * -this.table.tableNoFrameHeight,
47884
- width: 0,
47885
- visible: !1
47886
- });
47887
47862
  } else this.hScrollBar.setAttributes({
47888
47863
  x: 2 * -this.table.tableNoFrameWidth,
47889
47864
  y: 2 * -this.table.tableNoFrameHeight,
47890
47865
  width: 0,
47891
47866
  visible: !1
47892
- }), this.frozenHScrollBar.setAttributes({
47867
+ });
47868
+ const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
47869
+ if (!ignoreFrozenCols && frozenScrollable) {
47870
+ const frozenRangeEnd = Math.max(.05, frozenColsWidth / frozenColsContentWidth),
47871
+ x = hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x;
47872
+ this.frozenHScrollBar.setAttributes({
47873
+ x: x,
47874
+ y: attrY,
47875
+ width: frozenColsWidth,
47876
+ range: [0, frozenRangeEnd],
47877
+ visible: "always" === horizontalVisible
47878
+ });
47879
+ const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
47880
+ this.frozenHScrollBar._viewPosition = {
47881
+ x: bounds.x1,
47882
+ y: bounds.y1
47883
+ }, "always" === horizontalVisible && this.frozenHScrollBar.showAll();
47884
+ } else this.frozenHScrollBar.setAttributes({
47893
47885
  x: 2 * -this.table.tableNoFrameWidth,
47894
47886
  y: 2 * -this.table.tableNoFrameHeight,
47895
47887
  width: 0,
47896
47888
  visible: !1
47897
- }), this.rightFrozenHScrollBar.setAttributes({
47889
+ });
47890
+ const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
47891
+ if (!ignoreFrozenCols && rightFrozenScrollable) {
47892
+ const rightFrozenRangeEnd = Math.max(.05, rightFrozenColsWidth / rightFrozenColsContentWidth),
47893
+ x = tableWidth - rightFrozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x);
47894
+ this.rightFrozenHScrollBar.setAttributes({
47895
+ x: x,
47896
+ y: attrY,
47897
+ width: rightFrozenColsWidth,
47898
+ range: [0, rightFrozenRangeEnd],
47899
+ visible: "always" === horizontalVisible
47900
+ });
47901
+ const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
47902
+ this.rightFrozenHScrollBar._viewPosition = {
47903
+ x: bounds.x1,
47904
+ y: bounds.y1
47905
+ }, "always" === horizontalVisible && this.rightFrozenHScrollBar.showAll();
47906
+ } else this.rightFrozenHScrollBar.setAttributes({
47898
47907
  x: 2 * -this.table.tableNoFrameWidth,
47899
47908
  y: 2 * -this.table.tableNoFrameHeight,
47900
47909
  width: 0,
@@ -50795,7 +50804,7 @@
50795
50804
  col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
50796
50805
  row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
50797
50806
  dataValue: table.getCellOriginValue(col, row),
50798
- value: table.getCellValue(col, row) || "",
50807
+ value: table.getCellValue(col, row),
50799
50808
  rect: getCellRect(col, row, table),
50800
50809
  table: table,
50801
50810
  originCol: col,
@@ -53042,7 +53051,8 @@
53042
53051
  for (let col = table.colCount - currentRightFrozenCol - 1; col >= table.colCount - distRightFrozenCol; col--) {
53043
53052
  insertBefore(rightFrozenGroup, scene.getColGroup(col), rightFrozenGroup.firstChild);
53044
53053
  insertBefore(rightTopCornerGroup, scene.getColGroup(col, !0), rightTopCornerGroup.firstChild);
53045
- insertBefore(rightBottomCornerGroup, scene.getColGroupInBottom(col), rightBottomCornerGroup.firstChild);
53054
+ const bottomColGroup = scene.getColGroupInBottom(col);
53055
+ bottomColGroup && insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
53046
53056
  }
53047
53057
  let x = 0;
53048
53058
  rightFrozenGroup.forEachChildren(columnGroup => {
@@ -53059,7 +53069,10 @@
53059
53069
  const headerColGroup = scene.getColGroupInRightTopCorner(col);
53060
53070
  headerColGroup.setAttribute("x", colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col)), colHeaderGroup.appendChild(headerColGroup);
53061
53071
  const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
53062
- bottomColGroup.setAttribute("x", bottomFrozenGroup.lastChild.attribute.x + table.getColWidth(bottomFrozenGroup.lastChild.col)), bottomFrozenGroup.appendChild(bottomColGroup);
53072
+ if (bottomColGroup) {
53073
+ const lastBottomColGroup = bottomFrozenGroup.lastChild;
53074
+ bottomColGroup.setAttribute("x", lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0), bottomFrozenGroup.appendChild(bottomColGroup);
53075
+ }
53063
53076
  }
53064
53077
  let x = 0;
53065
53078
  rightFrozenGroup.forEachChildren(columnGroup => {
@@ -54447,7 +54460,7 @@
54447
54460
  setBodyAndColHeaderX(x) {
54448
54461
  const firstBodyCol = this.bodyGroup.firstChild;
54449
54462
  let lastBodyCol = this.bodyGroup.lastChild;
54450
- lastBodyCol && "group" !== lastBodyCol.type && (lastBodyCol = lastBodyCol._prev), 0 === x && firstBodyCol && firstBodyCol.col === this.table.frozenColCount && firstBodyCol.attribute.x + x < 0 ? x = -firstBodyCol.attribute.x : lastBodyCol && this.table.tableNoFrameWidth < this.table.getAllColsWidth() && lastBodyCol.col === this.table.colCount - this.table.rightFrozenColCount - 1 && lastBodyCol.attribute.x + lastBodyCol.attribute.width + x < this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() && (x = this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() - lastBodyCol.attribute.x - lastBodyCol.attribute.width), this.table.getFrozenColsWidth() + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.colHeaderGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.bodySelectGroup.setAttribute("x", this.bodyGroup.attribute.x), this.colHeaderSelectGroup.setAttribute("x", this.colHeaderGroup.attribute.x), this.rowHeaderSelectGroup.setAttribute("x", this.rowHeaderGroup.attribute.x), this.cornerHeaderSelectGroup.setAttribute("x", this.cornerHeaderGroup.attribute.x), this.table.bottomFrozenRowCount > 0 && (this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.bottomFrozenSelectGroup.setAttribute("x", this.bottomFrozenGroup.attribute.x), this.leftBottomCornerSelectGroup.setAttribute("x", this.leftBottomCornerGroup.attribute.x)), this.table.rightFrozenColCount > 0 && (this.rightFrozenSelectGroup.setAttribute("x", this.rightFrozenGroup.attribute.x), this.rightTopCornerSelectGroup.setAttribute("x", this.rightTopCornerGroup.attribute.x)), this.table.rightFrozenColCount > 0 && this.table.bottomFrozenRowCount > 0 && this.rightBottomCornerSelectGroup.setAttribute("x", this.rightBottomCornerGroup.attribute.x), this.updateNextFrame());
54463
+ lastBodyCol && "group" !== lastBodyCol.type && (lastBodyCol = lastBodyCol._prev), 0 === x && firstBodyCol && firstBodyCol.col === this.table.frozenColCount && firstBodyCol.attribute.x + x < 0 ? x = -firstBodyCol.attribute.x : lastBodyCol && this.table.tableNoFrameWidth < this.table.getAllColsWidth() && lastBodyCol.col === this.table.colCount - this.table.rightFrozenColCount - 1 && lastBodyCol.attribute.x + lastBodyCol.attribute.width + x < this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() && (x = this.table.tableNoFrameWidth - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth() - lastBodyCol.attribute.x - lastBodyCol.attribute.width), this.table.options.scrollFrozenCols && x > 0 && (x = 0), this.table.getFrozenColsWidth() + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.colHeaderGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.bodySelectGroup.setAttribute("x", this.bodyGroup.attribute.x), this.colHeaderSelectGroup.setAttribute("x", this.colHeaderGroup.attribute.x), this.rowHeaderSelectGroup.setAttribute("x", this.rowHeaderGroup.attribute.x), this.cornerHeaderSelectGroup.setAttribute("x", this.cornerHeaderGroup.attribute.x), this.table.bottomFrozenRowCount > 0 && (this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.bottomFrozenSelectGroup.setAttribute("x", this.bottomFrozenGroup.attribute.x), this.leftBottomCornerSelectGroup.setAttribute("x", this.leftBottomCornerGroup.attribute.x)), this.table.rightFrozenColCount > 0 && (this.rightFrozenSelectGroup.setAttribute("x", this.rightFrozenGroup.attribute.x), this.rightTopCornerSelectGroup.setAttribute("x", this.rightTopCornerGroup.attribute.x)), this.table.rightFrozenColCount > 0 && this.table.bottomFrozenRowCount > 0 && this.rightBottomCornerSelectGroup.setAttribute("x", this.rightBottomCornerGroup.attribute.x), this.updateNextFrame());
54451
54464
  }
54452
54465
  afterScenegraphCreated() {
54453
54466
  var _a, _b;
@@ -54494,11 +54507,11 @@
54494
54507
  let rowHeaderWidth = 0;
54495
54508
  this.rowHeaderGroup.forEachChildrenSkipChild(column => {
54496
54509
  rowHeaderWidth += column.attribute.width;
54497
- }), this.rowHeaderGroup.setAttribute("width", rowHeaderWidth);
54510
+ }), table.options.scrollFrozenCols && (rowHeaderWidth = table.getFrozenColsWidth()), this.rowHeaderGroup.setAttribute("width", rowHeaderWidth);
54498
54511
  let cornerHeaderWidth = 0;
54499
54512
  this.cornerHeaderGroup.forEachChildrenSkipChild(column => {
54500
54513
  cornerHeaderWidth += column.attribute.width;
54501
- }), this.cornerHeaderGroup.setAttribute("width", cornerHeaderWidth), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height), this.bodyGroup.setAttributes({
54514
+ }), table.options.scrollFrozenCols && (cornerHeaderWidth = table.getFrozenColsWidth()), this.cornerHeaderGroup.setAttribute("width", cornerHeaderWidth), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height), this.bodyGroup.setAttributes({
54502
54515
  x: this.rowHeaderGroup.attribute.width,
54503
54516
  y: this.colHeaderGroup.attribute.height
54504
54517
  });
@@ -56677,12 +56690,9 @@
56677
56690
  }), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
56678
56691
  }
56679
56692
  updateHorizontalScrollBar(xRatio) {
56680
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
56681
- const totalWidth = this.table.getAllColsWidth(),
56682
- oldHorizontalBarPos = this.scroll.horizontalBarPos,
56683
- frozenOffset = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0,
56684
- rightFrozenOffset = null !== (_f = null === (_e = (_d = this.table).getRightFrozenColsOffset) || void 0 === _e ? void 0 : _e.call(_d)) && void 0 !== _f ? _f : 0,
56685
- scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
56693
+ var _a, _b, _c, _d;
56694
+ const oldHorizontalBarPos = this.scroll.horizontalBarPos,
56695
+ scrollRange = getBodyHorizontalScrollRange(this.table);
56686
56696
  let horizontalBarPos = Math.ceil(xRatio * scrollRange);
56687
56697
  isValid$2(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
56688
56698
  const dx = horizontalBarPos - this.table.scenegraph.proxy.deltaX - oldHorizontalBarPos;
@@ -56690,8 +56700,8 @@
56690
56700
  event: void 0,
56691
56701
  scrollTop: this.scroll.verticalBarPos,
56692
56702
  scrollLeft: horizontalBarPos - this.table.scenegraph.proxy.deltaX,
56693
- scrollHeight: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
56694
- scrollWidth: null === (_h = this.table.theme.scrollStyle) || void 0 === _h ? void 0 : _h.width,
56703
+ scrollHeight: null === (_a = this.table.theme.scrollStyle) || void 0 === _a ? void 0 : _a.width,
56704
+ scrollWidth: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
56695
56705
  viewHeight: this.table.tableNoFrameHeight,
56696
56706
  viewWidth: this.table.tableNoFrameWidth,
56697
56707
  scrollDirection: "horizontal",
@@ -56704,8 +56714,8 @@
56704
56714
  event: void 0,
56705
56715
  scrollTop: this.scroll.verticalBarPos,
56706
56716
  scrollLeft: this.scroll.horizontalBarPos,
56707
- scrollHeight: null === (_j = this.table.theme.scrollStyle) || void 0 === _j ? void 0 : _j.width,
56708
- scrollWidth: null === (_k = this.table.theme.scrollStyle) || void 0 === _k ? void 0 : _k.width,
56717
+ scrollHeight: null === (_c = this.table.theme.scrollStyle) || void 0 === _c ? void 0 : _c.width,
56718
+ scrollWidth: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
56709
56719
  viewHeight: this.table.tableNoFrameHeight,
56710
56720
  viewWidth: this.table.tableNoFrameWidth,
56711
56721
  scrollDirection: "horizontal",
@@ -56757,18 +56767,15 @@
56757
56767
  }), oldVerticalBarPos !== top && triggerEvent && this.checkVerticalScrollBarEnd();
56758
56768
  }
56759
56769
  setScrollLeft(left, event, triggerEvent = !0) {
56760
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
56770
+ var _a, _b, _c, _d, _e, _f, _g;
56761
56771
  if (!this.table || !this.table.scenegraph) return;
56762
56772
  this.table.scrollLeft;
56763
- const totalWidth = this.table.getAllColsWidth(),
56764
- frozenOffset = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0,
56765
- rightFrozenOffset = null !== (_f = null === (_e = (_d = this.table).getRightFrozenColsOffset) || void 0 === _e ? void 0 : _e.call(_d)) && void 0 !== _f ? _f : 0,
56766
- scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset),
56767
- sizeTolerance = (null === (_g = this.table.options.customConfig) || void 0 === _g ? void 0 : _g._disableColumnAndRowSizeRound) ? 1 : 0;
56773
+ const scrollRange = getBodyHorizontalScrollRange(this.table),
56774
+ sizeTolerance = (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0;
56768
56775
  left = Math.max(0, Math.min(left, scrollRange - sizeTolerance)), left = Math.ceil(left);
56769
56776
  const oldHorizontalBarPos = this.scroll.horizontalBarPos,
56770
56777
  xRatio = scrollRange ? left / scrollRange : 0;
56771
- if ((oldHorizontalBarPos !== left || !0 === (null === (_j = null === (_h = this.table.options) || void 0 === _h ? void 0 : _h.customConfig) || void 0 === _j ? void 0 : _j.scrollEventAlwaysTrigger)) && triggerEvent) {
56778
+ if ((oldHorizontalBarPos !== left || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
56772
56779
  let horizontalBarPos = left;
56773
56780
  isValid$2(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
56774
56781
  const dx = horizontalBarPos - oldHorizontalBarPos;
@@ -56776,8 +56783,8 @@
56776
56783
  event: null == event ? void 0 : event.nativeEvent,
56777
56784
  scrollTop: this.scroll.verticalBarPos,
56778
56785
  scrollLeft: horizontalBarPos,
56779
- scrollHeight: null === (_k = this.table.theme.scrollStyle) || void 0 === _k ? void 0 : _k.width,
56780
- scrollWidth: null === (_l = this.table.theme.scrollStyle) || void 0 === _l ? void 0 : _l.width,
56786
+ scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
56787
+ scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
56781
56788
  viewHeight: this.table.tableNoFrameHeight,
56782
56789
  viewWidth: this.table.tableNoFrameWidth,
56783
56790
  scrollDirection: "horizontal",
@@ -56794,8 +56801,8 @@
56794
56801
  event: null == event ? void 0 : event.nativeEvent,
56795
56802
  scrollTop: this.scroll.verticalBarPos,
56796
56803
  scrollLeft: this.scroll.horizontalBarPos,
56797
- scrollHeight: null === (_m = this.table.theme.scrollStyle) || void 0 === _m ? void 0 : _m.width,
56798
- scrollWidth: null === (_o = this.table.theme.scrollStyle) || void 0 === _o ? void 0 : _o.width,
56804
+ scrollHeight: null === (_f = this.table.theme.scrollStyle) || void 0 === _f ? void 0 : _f.width,
56805
+ scrollWidth: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
56799
56806
  viewHeight: this.table.tableNoFrameHeight,
56800
56807
  viewWidth: this.table.tableNoFrameWidth,
56801
56808
  scrollDirection: "horizontal",
@@ -57554,70 +57561,73 @@
57554
57561
  });
57555
57562
  }), table.scenegraph.tableGroup.addEventListener("pointerup", e => {
57556
57563
  var _a, _b, _c, _d, _e, _f, _g, _h;
57557
- if (0 === e.button) {
57558
- if ("grabing" === stateManager.interactionState) {
57559
- if (stateManager.updateInteractionState(InteractionState.default), stateManager.isResizeCol()) endResizeCol(table);else if (stateManager.isResizeRow()) endResizeRow(table);else if (stateManager.isMoveCol()) {
57560
- const endMoveColSuccess = table.stateManager.endMoveCol();
57561
- fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
57562
- } else if (stateManager.isSelecting()) {
57563
- table.stateManager.endSelectCells(), table.stateManager.isFillHandle() && table.stateManager.endFillSelect();
57564
- const eventArgsSet = getEventArgsSet(e);
57565
- if (table.eventManager.isDraging && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END)) {
57566
- const cellsEvent = {
57567
- event: e.nativeEvent,
57568
- cells: [],
57569
- col: eventArgsSet.eventArgs.target.col,
57570
- row: eventArgsSet.eventArgs.target.row,
57571
- scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
57572
- target: null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target,
57573
- mergeCellInfo: null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.mergeInfo
57574
- };
57575
- cellsEvent.cells = table.getSelectedCellInfos(), table.fireListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END, cellsEvent);
57576
- }
57577
- }
57578
- } else stateManager.interactionState === InteractionState.scrolling && stateManager.updateInteractionState(InteractionState.default);
57579
- if (!table.eventManager.isDraging) {
57564
+ if (0 !== e.button) return;
57565
+ const endedResizeCol = stateManager.isResizeCol(),
57566
+ endedResizeRow = stateManager.isResizeRow(),
57567
+ endedMoveCol = stateManager.isMoveCol(),
57568
+ shouldSkipClickCell = endedResizeCol || endedResizeRow;
57569
+ if ("grabing" === stateManager.interactionState) {
57570
+ if (stateManager.updateInteractionState(InteractionState.default), endedResizeCol) endResizeCol(table);else if (endedResizeRow) endResizeRow(table);else if (endedMoveCol) {
57571
+ const endMoveColSuccess = table.stateManager.endMoveCol();
57572
+ fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
57573
+ } else if (stateManager.isSelecting()) {
57574
+ table.stateManager.endSelectCells(), table.stateManager.isFillHandle() && table.stateManager.endFillSelect();
57580
57575
  const eventArgsSet = getEventArgsSet(e);
57581
- if (!eventManager.isTouchMove && 0 === e.button && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
57582
- const {
57583
- col: col,
57584
- row: row
57585
- } = eventArgsSet.eventArgs,
57586
- cellInfo = table.getCellInfo(col, row);
57587
- let icon, position;
57588
- if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
57589
- const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
57590
- iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
57591
- }
57592
- const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
57576
+ if (table.eventManager.isDraging && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END)) {
57577
+ const cellsEvent = {
57593
57578
  event: e.nativeEvent,
57594
- federatedEvent: e,
57595
57579
  cells: [],
57596
- targetIcon: icon ? {
57597
- name: icon.name,
57598
- position: position,
57599
- funcType: icon.attribute.funcType
57600
- } : void 0,
57601
- target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
57602
- mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
57603
- });
57604
- table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
57580
+ col: eventArgsSet.eventArgs.target.col,
57581
+ row: eventArgsSet.eventArgs.target.row,
57582
+ scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
57583
+ target: null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target,
57584
+ mergeCellInfo: null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.mergeInfo
57585
+ };
57586
+ cellsEvent.cells = table.getSelectedCellInfos(), table.fireListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END, cellsEvent);
57605
57587
  }
57606
57588
  }
57607
- if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
57608
- const eventArgsSet = getEventArgsSet(e);
57609
- eventArgsSet.eventArgs && table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
57610
- col: eventArgsSet.eventArgs.col,
57611
- row: eventArgsSet.eventArgs.row,
57589
+ } else stateManager.interactionState === InteractionState.scrolling && stateManager.updateInteractionState(InteractionState.default);
57590
+ if (!table.eventManager.isDraging && !shouldSkipClickCell) {
57591
+ const eventArgsSet = getEventArgsSet(e);
57592
+ if (!eventManager.isTouchMove && 0 === e.button && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
57593
+ const {
57594
+ col: col,
57595
+ row: row
57596
+ } = eventArgsSet.eventArgs,
57597
+ cellInfo = table.getCellInfo(col, row);
57598
+ let icon, position;
57599
+ if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
57600
+ const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
57601
+ iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
57602
+ }
57603
+ const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
57612
57604
  event: e.nativeEvent,
57613
- target: null === (_g = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _g ? void 0 : _g.target,
57614
- mergeCellInfo: null === (_h = eventArgsSet.eventArgs) || void 0 === _h ? void 0 : _h.mergeInfo
57605
+ federatedEvent: e,
57606
+ cells: [],
57607
+ targetIcon: icon ? {
57608
+ name: icon.name,
57609
+ position: position,
57610
+ funcType: icon.attribute.funcType
57611
+ } : void 0,
57612
+ target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
57613
+ mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
57615
57614
  });
57615
+ table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
57616
57616
  }
57617
- setTimeout(() => {
57618
- eventManager.isDown = !1, eventManager.isTouchdown = !1, eventManager.isTouchMove = !1, eventManager.isDraging = !1, eventManager.touchMovePoints = [];
57619
- }, 0);
57620
57617
  }
57618
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
57619
+ const eventArgsSet = getEventArgsSet(e);
57620
+ eventArgsSet.eventArgs && table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
57621
+ col: eventArgsSet.eventArgs.col,
57622
+ row: eventArgsSet.eventArgs.row,
57623
+ event: e.nativeEvent,
57624
+ target: null === (_g = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _g ? void 0 : _g.target,
57625
+ mergeCellInfo: null === (_h = eventArgsSet.eventArgs) || void 0 === _h ? void 0 : _h.mergeInfo
57626
+ });
57627
+ }
57628
+ setTimeout(() => {
57629
+ eventManager.isDown = !1, eventManager.isTouchdown = !1, eventManager.isTouchMove = !1, eventManager.isDraging = !1, eventManager.touchMovePoints = [];
57630
+ }, 0);
57621
57631
  }), table.scenegraph.tableGroup.addEventListener("rightdown", e => {
57622
57632
  var _a, _b, _c, _d, _e, _f, _g, _h;
57623
57633
  const eventArgsSet = getEventArgsSet(e);
@@ -61435,7 +61445,7 @@
61435
61445
  }
61436
61446
  constructor(container, options = {}) {
61437
61447
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
61438
- if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.26.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
61448
+ if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.26.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
61439
61449
  const g = window;
61440
61450
  g[this.id] = this;
61441
61451
  const registry = g.__vtable__ || (g.__vtable__ = {
@@ -63648,16 +63658,17 @@
63648
63658
  }
63649
63659
  scrollToRow(row, animationOption) {
63650
63660
  var _a;
63651
- const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
63661
+ const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1),
63662
+ targetRowInt = Math.floor(targetRow);
63652
63663
  if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
63653
- row: targetRow
63654
- }), void this._scheduleScrollToRowCorrect(targetRow);
63664
+ row: targetRowInt
63665
+ }), void this._scheduleScrollToRowCorrect(targetRowInt);
63655
63666
  const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
63656
63667
  this.animationManager.scrollTo({
63657
63668
  row: targetRow
63658
- }, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
63659
- this.scrollToRow(targetRow, !1);
63660
- }, duration);
63669
+ }, animationOption), targetRowInt === targetRow && (this._scrollToRowCorrectTimer = setTimeout(() => {
63670
+ this.scrollToRow(targetRowInt, !1);
63671
+ }, duration));
63661
63672
  }
63662
63673
  scrollToCol(col, animationOption) {
63663
63674
  animationOption ? this.animationManager.scrollTo({
@@ -87773,7 +87784,7 @@
87773
87784
  return this.element;
87774
87785
  }
87775
87786
  targetIsOnEditor(target) {
87776
- return target === this.element || target === this.sheet.formulaUIManager.formulaInput;
87787
+ return target === this.element || target === this.sheet?.formulaUIManager.formulaInput;
87777
87788
  }
87778
87789
  createElement() {
87779
87790
  super.createElement();
@@ -87805,7 +87816,10 @@
87805
87816
  return;
87806
87817
  }
87807
87818
  const value = this.element.value;
87808
- this.sheet.formulaUIManager.formulaInput.value = value;
87819
+ const formulaInput = this.sheet.formulaUIManager.formulaInput;
87820
+ if (formulaInput) {
87821
+ formulaInput.value = value;
87822
+ }
87809
87823
  const highlightManager = this.sheet.formulaManager.cellHighlightManager;
87810
87824
  if (highlightManager) {
87811
87825
  if (value.startsWith('=')) {
@@ -91303,6 +91317,28 @@
91303
91317
  }
91304
91318
  }
91305
91319
 
91320
+ const normalizeColumnsField = (columns, startFieldIndex = 0) => {
91321
+ if (!columns?.length) {
91322
+ return startFieldIndex;
91323
+ }
91324
+ let fieldIndex = startFieldIndex;
91325
+ columns.forEach(column => {
91326
+ const childColumns = column
91327
+ .columns;
91328
+ if (childColumns?.length) {
91329
+ fieldIndex = normalizeColumnsField(childColumns, fieldIndex);
91330
+ return;
91331
+ }
91332
+ if (!isValid$2(column.field)) {
91333
+ column.field = fieldIndex;
91334
+ }
91335
+ if (!isValid$2(column.key)) {
91336
+ column.key = column.field;
91337
+ }
91338
+ fieldIndex++;
91339
+ });
91340
+ return fieldIndex;
91341
+ };
91306
91342
  class WorkSheet {
91307
91343
  options;
91308
91344
  container;
@@ -91430,10 +91466,7 @@
91430
91466
  this.options.columns = [];
91431
91467
  }
91432
91468
  else {
91433
- for (let i = 0; i < this.options.columns.length; i++) {
91434
- this.options.columns[i].field = i;
91435
- this.options.columns[i].key = i;
91436
- }
91469
+ normalizeColumnsField(this.options.columns);
91437
91470
  }
91438
91471
  if (!this.options.data) {
91439
91472
  this.options.data = [];
@@ -96196,7 +96229,7 @@
96196
96229
  importStyle();
96197
96230
  }
96198
96231
 
96199
- const version = "1.26.2";
96232
+ const version = "1.26.3";
96200
96233
  importStyles();
96201
96234
 
96202
96235
  exports.TYPES = index;