@visactor/vtable-gantt 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.
@@ -43213,13 +43213,20 @@
43213
43213
  return parse$2(font);
43214
43214
  }
43215
43215
 
43216
- function getQuadProps(paddingOrigin) {
43216
+ function normalizeQuadArray(values) {
43217
+ 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]];
43218
+ }
43219
+ function parseStringQuad(padding) {
43220
+ const tokens = padding.trim().split(/\s+/),
43221
+ values = tokens.map(token => Number.parseFloat(token)).filter(value => Number.isFinite(value));
43222
+ return values.length === tokens.length && values.length > 0 ? normalizeQuadArray(values) : [padding, padding, padding, padding];
43223
+ }
43224
+ function normalizePaddingObject(paddingOrigin) {
43217
43225
  var _a, _b, _c, _d;
43218
- if (isNumber$2(paddingOrigin) || isString$2(paddingOrigin) || isArray$5(paddingOrigin)) {
43219
- let padding = parsePadding(paddingOrigin);
43220
- return "number" == typeof padding || "string" == typeof padding ? padding = [padding, padding, padding, padding] : Array.isArray(padding) && (padding = padding.slice(0)), padding;
43221
- }
43222
- 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];
43226
+ 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];
43227
+ }
43228
+ function getQuadProps(paddingOrigin) {
43229
+ 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];
43223
43230
  }
43224
43231
 
43225
43232
  const TYPE_PAREN = 0,
@@ -44246,7 +44253,7 @@
44246
44253
  col: null !== (_b = null == range ? void 0 : range.start.col) && void 0 !== _b ? _b : col,
44247
44254
  row: null !== (_c = null == range ? void 0 : range.start.row) && void 0 !== _c ? _c : row,
44248
44255
  dataValue: table.getCellOriginValue(col, row),
44249
- value: table.getCellValue(col, row) || "",
44256
+ value: table.getCellValue(col, row),
44250
44257
  rect: {
44251
44258
  left: 0,
44252
44259
  top: 0,
@@ -44268,7 +44275,7 @@
44268
44275
  col: col,
44269
44276
  row: row,
44270
44277
  dataValue: table.getCellOriginValue(col, row),
44271
- value: table.getCellValue(col, row) || "",
44278
+ value: table.getCellValue(col, row),
44272
44279
  rect: {
44273
44280
  left: 0,
44274
44281
  top: 0,
@@ -46257,7 +46264,7 @@
46257
46264
  col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
46258
46265
  row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
46259
46266
  dataValue: table.getCellOriginValue(col, row),
46260
- value: table.getCellValue(col, row) || "",
46267
+ value: table.getCellValue(col, row),
46261
46268
  rect: getCellRect$1(col, row, table),
46262
46269
  table: table,
46263
46270
  originCol: col,
@@ -47166,6 +47173,17 @@
47166
47173
  }
47167
47174
  }
47168
47175
 
47176
+ function getBodyHorizontalScrollRange(table) {
47177
+ var _a, _b, _c, _d;
47178
+ const totalWidth = table.getAllColsWidth(),
47179
+ frozenColsWidth = table.getFrozenColsWidth(),
47180
+ rightFrozenColsWidth = table.getRightFrozenColsWidth(),
47181
+ frozenColsContentWidth = null !== (_b = null === (_a = table.getFrozenColsContentWidth) || void 0 === _a ? void 0 : _a.call(table)) && void 0 !== _b ? _b : frozenColsWidth,
47182
+ rightFrozenColsContentWidth = null !== (_d = null === (_c = table.getRightFrozenColsContentWidth) || void 0 === _c ? void 0 : _c.call(table)) && void 0 !== _d ? _d : rightFrozenColsWidth,
47183
+ bodyViewportWidth = table.tableNoFrameWidth - frozenColsWidth - rightFrozenColsWidth,
47184
+ bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth;
47185
+ return Math.max(0, bodyContentWidth - bodyViewportWidth);
47186
+ }
47169
47187
  function getColX(col, table, isRightFrozen) {
47170
47188
  var _a, _b, _c, _d, _e, _f;
47171
47189
  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);
@@ -47458,17 +47476,18 @@
47458
47476
  rightFrozenColsWidth = this.table.getRightFrozenColsWidth(),
47459
47477
  rightFrozenColsContentWidth = null !== (_m = null === (_l = (_k = this.table).getRightFrozenColsContentWidth) || void 0 === _l ? void 0 : _l.call(_k)) && void 0 !== _m ? _m : rightFrozenColsWidth,
47460
47478
  hoverOn = this.table.theme.scrollStyle.hoverOn,
47461
- sizeTolerance = (null === (_o = this.table.options.customConfig) || void 0 === _o ? void 0 : _o._disableColumnAndRowSizeRound) ? 1 : 0;
47462
- if (totalWidth > tableWidth + sizeTolerance) {
47463
- const y = Math.min(tableHeight, totalHeight),
47464
- bodyViewportWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth,
47465
- bodyContentWidth = totalWidth - frozenColsContentWidth - rightFrozenColsContentWidth,
47479
+ sizeTolerance = (null === (_o = this.table.options.customConfig) || void 0 === _o ? void 0 : _o._disableColumnAndRowSizeRound) ? 1 : 0,
47480
+ bodyScrollRange = getBodyHorizontalScrollRange(this.table),
47481
+ y = Math.min(tableHeight, totalHeight);
47482
+ let attrY = 0;
47483
+ 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);
47484
+ const ignoreFrozenCols = null !== (_q = null === (_p = this.table.theme.scrollStyle) || void 0 === _p ? void 0 : _p.ignoreFrozenCols) && void 0 !== _q && _q;
47485
+ if (bodyScrollRange > sizeTolerance) {
47486
+ const bodyViewportWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth,
47487
+ bodyContentWidth = bodyViewportWidth + bodyScrollRange,
47466
47488
  rangeEnd = bodyContentWidth > 0 ? Math.max(.05, bodyViewportWidth / bodyContentWidth) : 1;
47467
- let attrY = 0;
47468
- 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);
47469
47489
  let hScrollBarx = frozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x),
47470
47490
  hScrollBarWidth = tableWidth - frozenColsWidth - rightFrozenColsWidth;
47471
- const ignoreFrozenCols = null !== (_q = null === (_p = this.table.theme.scrollStyle) || void 0 === _p ? void 0 : _p.ignoreFrozenCols) && void 0 !== _q && _q;
47472
47491
  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({
47473
47492
  x: hScrollBarx,
47474
47493
  y: attrY,
@@ -47481,61 +47500,51 @@
47481
47500
  x: bounds.x1,
47482
47501
  y: bounds.y1
47483
47502
  }, "always" === horizontalVisible && this.hScrollBar.showAll();
47484
- const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
47485
- if (!ignoreFrozenCols && frozenScrollable) {
47486
- const frozenRangeEnd = Math.max(.05, frozenColsWidth / frozenColsContentWidth),
47487
- x = hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x;
47488
- this.frozenHScrollBar.setAttributes({
47489
- x: x,
47490
- y: attrY,
47491
- width: frozenColsWidth,
47492
- range: [0, frozenRangeEnd],
47493
- visible: "always" === horizontalVisible
47494
- });
47495
- const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
47496
- this.frozenHScrollBar._viewPosition = {
47497
- x: bounds.x1,
47498
- y: bounds.y1
47499
- }, "always" === horizontalVisible && this.frozenHScrollBar.showAll();
47500
- } else this.frozenHScrollBar.setAttributes({
47501
- x: 2 * -this.table.tableNoFrameWidth,
47502
- y: 2 * -this.table.tableNoFrameHeight,
47503
- width: 0,
47504
- visible: !1
47505
- });
47506
- const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
47507
- if (!ignoreFrozenCols && rightFrozenScrollable) {
47508
- const rightFrozenRangeEnd = Math.max(.05, rightFrozenColsWidth / rightFrozenColsContentWidth),
47509
- x = tableWidth - rightFrozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x);
47510
- this.rightFrozenHScrollBar.setAttributes({
47511
- x: x,
47512
- y: attrY,
47513
- width: rightFrozenColsWidth,
47514
- range: [0, rightFrozenRangeEnd],
47515
- visible: "always" === horizontalVisible
47516
- });
47517
- const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
47518
- this.rightFrozenHScrollBar._viewPosition = {
47519
- x: bounds.x1,
47520
- y: bounds.y1
47521
- }, "always" === horizontalVisible && this.rightFrozenHScrollBar.showAll();
47522
- } else this.rightFrozenHScrollBar.setAttributes({
47523
- x: 2 * -this.table.tableNoFrameWidth,
47524
- y: 2 * -this.table.tableNoFrameHeight,
47525
- width: 0,
47526
- visible: !1
47527
- });
47528
47503
  } else this.hScrollBar.setAttributes({
47529
47504
  x: 2 * -this.table.tableNoFrameWidth,
47530
47505
  y: 2 * -this.table.tableNoFrameHeight,
47531
47506
  width: 0,
47532
47507
  visible: !1
47533
- }), this.frozenHScrollBar.setAttributes({
47508
+ });
47509
+ const frozenScrollable = this.table.options.scrollFrozenCols && this.table.getFrozenColsOffset() > 0;
47510
+ if (!ignoreFrozenCols && frozenScrollable) {
47511
+ const frozenRangeEnd = Math.max(.05, frozenColsWidth / frozenColsContentWidth),
47512
+ x = hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x;
47513
+ this.frozenHScrollBar.setAttributes({
47514
+ x: x,
47515
+ y: attrY,
47516
+ width: frozenColsWidth,
47517
+ range: [0, frozenRangeEnd],
47518
+ visible: "always" === horizontalVisible
47519
+ });
47520
+ const bounds = this.frozenHScrollBar.AABBBounds && this.frozenHScrollBar.globalAABBBounds;
47521
+ this.frozenHScrollBar._viewPosition = {
47522
+ x: bounds.x1,
47523
+ y: bounds.y1
47524
+ }, "always" === horizontalVisible && this.frozenHScrollBar.showAll();
47525
+ } else this.frozenHScrollBar.setAttributes({
47534
47526
  x: 2 * -this.table.tableNoFrameWidth,
47535
47527
  y: 2 * -this.table.tableNoFrameHeight,
47536
47528
  width: 0,
47537
47529
  visible: !1
47538
- }), this.rightFrozenHScrollBar.setAttributes({
47530
+ });
47531
+ const rightFrozenScrollable = this.table.options.scrollRightFrozenCols && this.table.getRightFrozenColsOffset() > 0;
47532
+ if (!ignoreFrozenCols && rightFrozenScrollable) {
47533
+ const rightFrozenRangeEnd = Math.max(.05, rightFrozenColsWidth / rightFrozenColsContentWidth),
47534
+ x = tableWidth - rightFrozenColsWidth + (hoverOn ? 0 : this.table.scenegraph.tableGroup.attribute.x);
47535
+ this.rightFrozenHScrollBar.setAttributes({
47536
+ x: x,
47537
+ y: attrY,
47538
+ width: rightFrozenColsWidth,
47539
+ range: [0, rightFrozenRangeEnd],
47540
+ visible: "always" === horizontalVisible
47541
+ });
47542
+ const bounds = this.rightFrozenHScrollBar.AABBBounds && this.rightFrozenHScrollBar.globalAABBBounds;
47543
+ this.rightFrozenHScrollBar._viewPosition = {
47544
+ x: bounds.x1,
47545
+ y: bounds.y1
47546
+ }, "always" === horizontalVisible && this.rightFrozenHScrollBar.showAll();
47547
+ } else this.rightFrozenHScrollBar.setAttributes({
47539
47548
  x: 2 * -this.table.tableNoFrameWidth,
47540
47549
  y: 2 * -this.table.tableNoFrameHeight,
47541
47550
  width: 0,
@@ -50436,7 +50445,7 @@
50436
50445
  col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
50437
50446
  row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
50438
50447
  dataValue: table.getCellOriginValue(col, row),
50439
- value: table.getCellValue(col, row) || "",
50448
+ value: table.getCellValue(col, row),
50440
50449
  rect: getCellRect(col, row, table),
50441
50450
  table: table,
50442
50451
  originCol: col,
@@ -52683,7 +52692,8 @@
52683
52692
  for (let col = table.colCount - currentRightFrozenCol - 1; col >= table.colCount - distRightFrozenCol; col--) {
52684
52693
  insertBefore(rightFrozenGroup, scene.getColGroup(col), rightFrozenGroup.firstChild);
52685
52694
  insertBefore(rightTopCornerGroup, scene.getColGroup(col, !0), rightTopCornerGroup.firstChild);
52686
- insertBefore(rightBottomCornerGroup, scene.getColGroupInBottom(col), rightBottomCornerGroup.firstChild);
52695
+ const bottomColGroup = scene.getColGroupInBottom(col);
52696
+ bottomColGroup && insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
52687
52697
  }
52688
52698
  let x = 0;
52689
52699
  rightFrozenGroup.forEachChildren(columnGroup => {
@@ -52700,7 +52710,10 @@
52700
52710
  const headerColGroup = scene.getColGroupInRightTopCorner(col);
52701
52711
  headerColGroup.setAttribute("x", colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col)), colHeaderGroup.appendChild(headerColGroup);
52702
52712
  const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
52703
- bottomColGroup.setAttribute("x", bottomFrozenGroup.lastChild.attribute.x + table.getColWidth(bottomFrozenGroup.lastChild.col)), bottomFrozenGroup.appendChild(bottomColGroup);
52713
+ if (bottomColGroup) {
52714
+ const lastBottomColGroup = bottomFrozenGroup.lastChild;
52715
+ bottomColGroup.setAttribute("x", lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0), bottomFrozenGroup.appendChild(bottomColGroup);
52716
+ }
52704
52717
  }
52705
52718
  let x = 0;
52706
52719
  rightFrozenGroup.forEachChildren(columnGroup => {
@@ -54088,7 +54101,7 @@
54088
54101
  setBodyAndColHeaderX(x) {
54089
54102
  const firstBodyCol = this.bodyGroup.firstChild;
54090
54103
  let lastBodyCol = this.bodyGroup.lastChild;
54091
- 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());
54104
+ 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());
54092
54105
  }
54093
54106
  afterScenegraphCreated() {
54094
54107
  var _a, _b;
@@ -54135,11 +54148,11 @@
54135
54148
  let rowHeaderWidth = 0;
54136
54149
  this.rowHeaderGroup.forEachChildrenSkipChild(column => {
54137
54150
  rowHeaderWidth += column.attribute.width;
54138
- }), this.rowHeaderGroup.setAttribute("width", rowHeaderWidth);
54151
+ }), table.options.scrollFrozenCols && (rowHeaderWidth = table.getFrozenColsWidth()), this.rowHeaderGroup.setAttribute("width", rowHeaderWidth);
54139
54152
  let cornerHeaderWidth = 0;
54140
54153
  this.cornerHeaderGroup.forEachChildrenSkipChild(column => {
54141
54154
  cornerHeaderWidth += column.attribute.width;
54142
- }), this.cornerHeaderGroup.setAttribute("width", cornerHeaderWidth), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height), this.bodyGroup.setAttributes({
54155
+ }), 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({
54143
54156
  x: this.rowHeaderGroup.attribute.width,
54144
54157
  y: this.colHeaderGroup.attribute.height
54145
54158
  });
@@ -56318,12 +56331,9 @@
56318
56331
  }), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
56319
56332
  }
56320
56333
  updateHorizontalScrollBar(xRatio) {
56321
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
56322
- const totalWidth = this.table.getAllColsWidth(),
56323
- oldHorizontalBarPos = this.scroll.horizontalBarPos,
56324
- frozenOffset = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0,
56325
- rightFrozenOffset = null !== (_f = null === (_e = (_d = this.table).getRightFrozenColsOffset) || void 0 === _e ? void 0 : _e.call(_d)) && void 0 !== _f ? _f : 0,
56326
- scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
56334
+ var _a, _b, _c, _d;
56335
+ const oldHorizontalBarPos = this.scroll.horizontalBarPos,
56336
+ scrollRange = getBodyHorizontalScrollRange(this.table);
56327
56337
  let horizontalBarPos = Math.ceil(xRatio * scrollRange);
56328
56338
  isValid$1(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
56329
56339
  const dx = horizontalBarPos - this.table.scenegraph.proxy.deltaX - oldHorizontalBarPos;
@@ -56331,8 +56341,8 @@
56331
56341
  event: void 0,
56332
56342
  scrollTop: this.scroll.verticalBarPos,
56333
56343
  scrollLeft: horizontalBarPos - this.table.scenegraph.proxy.deltaX,
56334
- scrollHeight: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
56335
- scrollWidth: null === (_h = this.table.theme.scrollStyle) || void 0 === _h ? void 0 : _h.width,
56344
+ scrollHeight: null === (_a = this.table.theme.scrollStyle) || void 0 === _a ? void 0 : _a.width,
56345
+ scrollWidth: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
56336
56346
  viewHeight: this.table.tableNoFrameHeight,
56337
56347
  viewWidth: this.table.tableNoFrameWidth,
56338
56348
  scrollDirection: "horizontal",
@@ -56345,8 +56355,8 @@
56345
56355
  event: void 0,
56346
56356
  scrollTop: this.scroll.verticalBarPos,
56347
56357
  scrollLeft: this.scroll.horizontalBarPos,
56348
- scrollHeight: null === (_j = this.table.theme.scrollStyle) || void 0 === _j ? void 0 : _j.width,
56349
- scrollWidth: null === (_k = this.table.theme.scrollStyle) || void 0 === _k ? void 0 : _k.width,
56358
+ scrollHeight: null === (_c = this.table.theme.scrollStyle) || void 0 === _c ? void 0 : _c.width,
56359
+ scrollWidth: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
56350
56360
  viewHeight: this.table.tableNoFrameHeight,
56351
56361
  viewWidth: this.table.tableNoFrameWidth,
56352
56362
  scrollDirection: "horizontal",
@@ -56398,18 +56408,15 @@
56398
56408
  }), oldVerticalBarPos !== top && triggerEvent && this.checkVerticalScrollBarEnd();
56399
56409
  }
56400
56410
  setScrollLeft(left, event, triggerEvent = !0) {
56401
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
56411
+ var _a, _b, _c, _d, _e, _f, _g;
56402
56412
  if (!this.table || !this.table.scenegraph) return;
56403
56413
  this.table.scrollLeft;
56404
- const totalWidth = this.table.getAllColsWidth(),
56405
- frozenOffset = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0,
56406
- rightFrozenOffset = null !== (_f = null === (_e = (_d = this.table).getRightFrozenColsOffset) || void 0 === _e ? void 0 : _e.call(_d)) && void 0 !== _f ? _f : 0,
56407
- scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset),
56408
- sizeTolerance = (null === (_g = this.table.options.customConfig) || void 0 === _g ? void 0 : _g._disableColumnAndRowSizeRound) ? 1 : 0;
56414
+ const scrollRange = getBodyHorizontalScrollRange(this.table),
56415
+ sizeTolerance = (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0;
56409
56416
  left = Math.max(0, Math.min(left, scrollRange - sizeTolerance)), left = Math.ceil(left);
56410
56417
  const oldHorizontalBarPos = this.scroll.horizontalBarPos,
56411
56418
  xRatio = scrollRange ? left / scrollRange : 0;
56412
- 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) {
56419
+ 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) {
56413
56420
  let horizontalBarPos = left;
56414
56421
  isValid$1(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
56415
56422
  const dx = horizontalBarPos - oldHorizontalBarPos;
@@ -56417,8 +56424,8 @@
56417
56424
  event: null == event ? void 0 : event.nativeEvent,
56418
56425
  scrollTop: this.scroll.verticalBarPos,
56419
56426
  scrollLeft: horizontalBarPos,
56420
- scrollHeight: null === (_k = this.table.theme.scrollStyle) || void 0 === _k ? void 0 : _k.width,
56421
- scrollWidth: null === (_l = this.table.theme.scrollStyle) || void 0 === _l ? void 0 : _l.width,
56427
+ scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
56428
+ scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
56422
56429
  viewHeight: this.table.tableNoFrameHeight,
56423
56430
  viewWidth: this.table.tableNoFrameWidth,
56424
56431
  scrollDirection: "horizontal",
@@ -56435,8 +56442,8 @@
56435
56442
  event: null == event ? void 0 : event.nativeEvent,
56436
56443
  scrollTop: this.scroll.verticalBarPos,
56437
56444
  scrollLeft: this.scroll.horizontalBarPos,
56438
- scrollHeight: null === (_m = this.table.theme.scrollStyle) || void 0 === _m ? void 0 : _m.width,
56439
- scrollWidth: null === (_o = this.table.theme.scrollStyle) || void 0 === _o ? void 0 : _o.width,
56445
+ scrollHeight: null === (_f = this.table.theme.scrollStyle) || void 0 === _f ? void 0 : _f.width,
56446
+ scrollWidth: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
56440
56447
  viewHeight: this.table.tableNoFrameHeight,
56441
56448
  viewWidth: this.table.tableNoFrameWidth,
56442
56449
  scrollDirection: "horizontal",
@@ -57195,70 +57202,73 @@
57195
57202
  });
57196
57203
  }), table.scenegraph.tableGroup.addEventListener("pointerup", e => {
57197
57204
  var _a, _b, _c, _d, _e, _f, _g, _h;
57198
- if (0 === e.button) {
57199
- if ("grabing" === stateManager.interactionState) {
57200
- if (stateManager.updateInteractionState(InteractionState.default), stateManager.isResizeCol()) endResizeCol(table);else if (stateManager.isResizeRow()) endResizeRow(table);else if (stateManager.isMoveCol()) {
57201
- const endMoveColSuccess = table.stateManager.endMoveCol();
57202
- fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
57203
- } else if (stateManager.isSelecting()) {
57204
- table.stateManager.endSelectCells(), table.stateManager.isFillHandle() && table.stateManager.endFillSelect();
57205
- const eventArgsSet = getEventArgsSet(e);
57206
- if (table.eventManager.isDraging && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END)) {
57207
- const cellsEvent = {
57208
- event: e.nativeEvent,
57209
- cells: [],
57210
- col: eventArgsSet.eventArgs.target.col,
57211
- row: eventArgsSet.eventArgs.target.row,
57212
- scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
57213
- target: null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target,
57214
- mergeCellInfo: null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.mergeInfo
57215
- };
57216
- cellsEvent.cells = table.getSelectedCellInfos(), table.fireListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END, cellsEvent);
57217
- }
57218
- }
57219
- } else stateManager.interactionState === InteractionState.scrolling && stateManager.updateInteractionState(InteractionState.default);
57220
- if (!table.eventManager.isDraging) {
57205
+ if (0 !== e.button) return;
57206
+ const endedResizeCol = stateManager.isResizeCol(),
57207
+ endedResizeRow = stateManager.isResizeRow(),
57208
+ endedMoveCol = stateManager.isMoveCol(),
57209
+ shouldSkipClickCell = endedResizeCol || endedResizeRow;
57210
+ if ("grabing" === stateManager.interactionState) {
57211
+ if (stateManager.updateInteractionState(InteractionState.default), endedResizeCol) endResizeCol(table);else if (endedResizeRow) endResizeRow(table);else if (endedMoveCol) {
57212
+ const endMoveColSuccess = table.stateManager.endMoveCol();
57213
+ fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
57214
+ } else if (stateManager.isSelecting()) {
57215
+ table.stateManager.endSelectCells(), table.stateManager.isFillHandle() && table.stateManager.endFillSelect();
57221
57216
  const eventArgsSet = getEventArgsSet(e);
57222
- if (!eventManager.isTouchMove && 0 === e.button && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
57223
- const {
57224
- col: col,
57225
- row: row
57226
- } = eventArgsSet.eventArgs,
57227
- cellInfo = table.getCellInfo(col, row);
57228
- let icon, position;
57229
- if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
57230
- const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
57231
- iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
57232
- }
57233
- const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
57217
+ if (table.eventManager.isDraging && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END)) {
57218
+ const cellsEvent = {
57234
57219
  event: e.nativeEvent,
57235
- federatedEvent: e,
57236
57220
  cells: [],
57237
- targetIcon: icon ? {
57238
- name: icon.name,
57239
- position: position,
57240
- funcType: icon.attribute.funcType
57241
- } : void 0,
57242
- target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
57243
- mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
57244
- });
57245
- table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
57221
+ col: eventArgsSet.eventArgs.target.col,
57222
+ row: eventArgsSet.eventArgs.target.row,
57223
+ scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
57224
+ target: null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target,
57225
+ mergeCellInfo: null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.mergeInfo
57226
+ };
57227
+ cellsEvent.cells = table.getSelectedCellInfos(), table.fireListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END, cellsEvent);
57246
57228
  }
57247
57229
  }
57248
- if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
57249
- const eventArgsSet = getEventArgsSet(e);
57250
- eventArgsSet.eventArgs && table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
57251
- col: eventArgsSet.eventArgs.col,
57252
- row: eventArgsSet.eventArgs.row,
57230
+ } else stateManager.interactionState === InteractionState.scrolling && stateManager.updateInteractionState(InteractionState.default);
57231
+ if (!table.eventManager.isDraging && !shouldSkipClickCell) {
57232
+ const eventArgsSet = getEventArgsSet(e);
57233
+ if (!eventManager.isTouchMove && 0 === e.button && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
57234
+ const {
57235
+ col: col,
57236
+ row: row
57237
+ } = eventArgsSet.eventArgs,
57238
+ cellInfo = table.getCellInfo(col, row);
57239
+ let icon, position;
57240
+ if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
57241
+ const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
57242
+ iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
57243
+ }
57244
+ const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
57253
57245
  event: e.nativeEvent,
57254
- target: null === (_g = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _g ? void 0 : _g.target,
57255
- mergeCellInfo: null === (_h = eventArgsSet.eventArgs) || void 0 === _h ? void 0 : _h.mergeInfo
57246
+ federatedEvent: e,
57247
+ cells: [],
57248
+ targetIcon: icon ? {
57249
+ name: icon.name,
57250
+ position: position,
57251
+ funcType: icon.attribute.funcType
57252
+ } : void 0,
57253
+ target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
57254
+ mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
57256
57255
  });
57256
+ table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
57257
57257
  }
57258
- setTimeout(() => {
57259
- eventManager.isDown = !1, eventManager.isTouchdown = !1, eventManager.isTouchMove = !1, eventManager.isDraging = !1, eventManager.touchMovePoints = [];
57260
- }, 0);
57261
57258
  }
57259
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
57260
+ const eventArgsSet = getEventArgsSet(e);
57261
+ eventArgsSet.eventArgs && table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
57262
+ col: eventArgsSet.eventArgs.col,
57263
+ row: eventArgsSet.eventArgs.row,
57264
+ event: e.nativeEvent,
57265
+ target: null === (_g = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _g ? void 0 : _g.target,
57266
+ mergeCellInfo: null === (_h = eventArgsSet.eventArgs) || void 0 === _h ? void 0 : _h.mergeInfo
57267
+ });
57268
+ }
57269
+ setTimeout(() => {
57270
+ eventManager.isDown = !1, eventManager.isTouchdown = !1, eventManager.isTouchMove = !1, eventManager.isDraging = !1, eventManager.touchMovePoints = [];
57271
+ }, 0);
57262
57272
  }), table.scenegraph.tableGroup.addEventListener("rightdown", e => {
57263
57273
  var _a, _b, _c, _d, _e, _f, _g, _h;
57264
57274
  const eventArgsSet = getEventArgsSet(e);
@@ -61076,7 +61086,7 @@
61076
61086
  }
61077
61087
  constructor(container, options = {}) {
61078
61088
  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;
61079
- 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) {
61089
+ 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) {
61080
61090
  const g = window;
61081
61091
  g[this.id] = this;
61082
61092
  const registry = g.__vtable__ || (g.__vtable__ = {
@@ -63289,16 +63299,17 @@
63289
63299
  }
63290
63300
  scrollToRow(row, animationOption) {
63291
63301
  var _a;
63292
- const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
63302
+ const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1),
63303
+ targetRowInt = Math.floor(targetRow);
63293
63304
  if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
63294
- row: targetRow
63295
- }), void this._scheduleScrollToRowCorrect(targetRow);
63305
+ row: targetRowInt
63306
+ }), void this._scheduleScrollToRowCorrect(targetRowInt);
63296
63307
  const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
63297
63308
  this.animationManager.scrollTo({
63298
63309
  row: targetRow
63299
- }, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
63300
- this.scrollToRow(targetRow, !1);
63301
- }, duration);
63310
+ }, animationOption), targetRowInt === targetRow && (this._scrollToRowCorrectTimer = setTimeout(() => {
63311
+ this.scrollToRow(targetRowInt, !1);
63312
+ }, duration));
63302
63313
  }
63303
63314
  scrollToCol(col, animationOption) {
63304
63315
  animationOption ? this.animationManager.scrollTo({
@@ -74395,7 +74406,8 @@
74395
74406
  return false;
74396
74407
  });
74397
74408
  if (downBarNode) {
74398
- const taskRecord = downBarNode.record;
74409
+ const taskRecord = scene._gantt.getRecordByIndex(downBarNode.task_index, downBarNode.sub_task_index);
74410
+ downBarNode.record = taskRecord;
74399
74411
  const isProjectTask = taskRecord?.type === TaskType.PROJECT;
74400
74412
  if (!isProjectTask) {
74401
74413
  if (e.target.name === 'task-bar-hover-shadow-left-icon') {
@@ -75132,12 +75144,43 @@
75132
75144
  });
75133
75145
  }
75134
75146
  function syncSortFromTable(gantt) {
75135
- gantt.taskListTableInstance?.on('after_sort', (args) => {
75147
+ const taskListTableInstance = gantt.taskListTableInstance;
75148
+ if (!taskListTableInstance || taskListTableInstance._vtableGanttSortSyncPatched) {
75149
+ return;
75150
+ }
75151
+ const syncTaskBarsAfterSort = (attempt = 0) => {
75136
75152
  gantt.scenegraph.refreshTaskBars();
75153
+ const taskCount = Math.min(gantt.itemCount ?? 0, 10);
75154
+ const taskKeyField = gantt.parsedOptions.taskKeyField;
75155
+ let taskBarsSynced = true;
75156
+ for (let index = 0; index < taskCount; index++) {
75157
+ const taskBarNode = gantt.scenegraph.taskBar.getTaskBarNodeByIndex(index);
75158
+ const visibleRecord = gantt.getRecordByIndex(index);
75159
+ if (taskBarNode && taskBarNode.record?.[taskKeyField] !== visibleRecord?.[taskKeyField]) {
75160
+ taskBarsSynced = false;
75161
+ break;
75162
+ }
75163
+ }
75164
+ if (!taskBarsSynced && attempt < 10) {
75165
+ setTimeout(() => syncTaskBarsAfterSort(attempt + 1), 16);
75166
+ return;
75167
+ }
75137
75168
  const left = gantt.stateManager.scroll.horizontalBarPos;
75138
75169
  const top = gantt.stateManager.scroll.verticalBarPos;
75139
75170
  gantt.scenegraph.setX(-left);
75140
75171
  gantt.scenegraph.setY(-top);
75172
+ };
75173
+ const originalUpdateSortState = taskListTableInstance.updateSortState?.bind(taskListTableInstance);
75174
+ if (originalUpdateSortState) {
75175
+ taskListTableInstance.updateSortState = (...args) => {
75176
+ const result = originalUpdateSortState(...args);
75177
+ syncTaskBarsAfterSort();
75178
+ return result;
75179
+ };
75180
+ }
75181
+ taskListTableInstance._vtableGanttSortSyncPatched = true;
75182
+ taskListTableInstance.on('after_sort', () => {
75183
+ syncTaskBarsAfterSort();
75141
75184
  });
75142
75185
  }
75143
75186
  function syncDragOrderFromTable(gantt) {
@@ -75385,6 +75428,7 @@
75385
75428
  if (target.name === 'task-bar-hover-shadow') {
75386
75429
  target = target.parent;
75387
75430
  }
75431
+ syncTaskBarNodeRecord(target, this._gantt);
75388
75432
  this.moveTaskBar.moving = true;
75389
75433
  this.moveTaskBar.target = target;
75390
75434
  this.moveTaskBar.targetStartX = target.attribute.x;
@@ -75423,10 +75467,12 @@
75423
75467
  const newEndDate = new Date(newStartDate.getTime() +
75424
75468
  (createDateAtMidnight(oldEndDate).getTime() - createDateAtMidnight(oldStartDate).getTime()));
75425
75469
  let dateChanged;
75470
+ let reorderedTaskShowIndex;
75426
75471
  if (createDateAtMidnight(oldStartDate).getTime() !== newStartDate.getTime()) {
75427
75472
  dateChanged = createDateAtMidnight(oldStartDate).getTime() > newStartDate.getTime() ? 'left' : 'right';
75428
75473
  this._gantt._updateStartEndDateToTaskRecord(newStartDate, newEndDate, taskIndex, sub_task_index);
75429
- const newRecord = this._gantt.getRecordByIndex(taskIndex, sub_task_index);
75474
+ const newRecord = target.record;
75475
+ reorderedTaskShowIndex = getTaskShowIndexByTaskRecord(newRecord, this._gantt);
75430
75476
  if (this._gantt.hasListeners(GANTT_EVENT_TYPE.CHANGE_DATE_RANGE)) {
75431
75477
  this._gantt.fireListeners(GANTT_EVENT_TYPE.CHANGE_DATE_RANGE, {
75432
75478
  startDate: newRecord[this._gantt.parsedOptions.startDateField],
@@ -75438,7 +75484,7 @@
75438
75484
  });
75439
75485
  }
75440
75486
  const indexs = getTaskIndexsByTaskY(targetEndY, this._gantt);
75441
- const newRowIndex = indexs.task_index;
75487
+ const newRowIndex = isValid$1(reorderedTaskShowIndex) ? reorderedTaskShowIndex : indexs.task_index;
75442
75488
  if (this._gantt.hasListeners(GANTT_EVENT_TYPE.MOVE_END_TASK_BAR)) {
75443
75489
  this._gantt.fireListeners(GANTT_EVENT_TYPE.MOVE_END_TASK_BAR, {
75444
75490
  startDate: newRecord[this._gantt.parsedOptions.startDateField],
@@ -75493,34 +75539,44 @@
75493
75539
  }
75494
75540
  }
75495
75541
  else {
75496
- let newX = startDateColIndex >= 1 ? this._gantt.getDateColsWidth(0, startDateColIndex - 1) : 0;
75497
- if (target.record.type === TaskType.MILESTONE) {
75498
- const milestoneTaskbarHeight = this._gantt.parsedOptions.taskBarMilestoneStyle.width;
75499
- newX -= milestoneTaskbarHeight / 2;
75542
+ if (dateChanged && isValid$1(reorderedTaskShowIndex) && reorderedTaskShowIndex !== taskIndex) {
75543
+ this._gantt._syncPropsFromTable();
75544
+ this._gantt.scenegraph.refreshTaskBarsAndGrid();
75545
+ const left = this._gantt.stateManager.scroll.horizontalBarPos;
75546
+ const top = this._gantt.stateManager.scroll.verticalBarPos;
75547
+ this._gantt.scenegraph.setX(-left);
75548
+ this._gantt.scenegraph.setY(-top);
75500
75549
  }
75501
- moveTaskBar(target, newX - target.attribute.x, targetEndY - target.attribute.y, this);
75502
- if (dateChanged === 'right') {
75503
- let insertAfterNode = target;
75504
- while (insertAfterNode.nextSibling &&
75505
- insertAfterNode.nextSibling.attribute.y === target.attribute.y &&
75506
- insertAfterNode.nextSibling.record[this._gantt.parsedOptions.startDateField] <=
75507
- target.record[this._gantt.parsedOptions.startDateField]) {
75508
- insertAfterNode = insertAfterNode.nextSibling;
75509
- }
75510
- if (insertAfterNode !== target) {
75511
- insertAfterNode.parent.insertAfter(target, insertAfterNode);
75550
+ else {
75551
+ let newX = startDateColIndex >= 1 ? this._gantt.getDateColsWidth(0, startDateColIndex - 1) : 0;
75552
+ if (target.record.type === TaskType.MILESTONE) {
75553
+ const milestoneTaskbarHeight = this._gantt.parsedOptions.taskBarMilestoneStyle.width;
75554
+ newX -= milestoneTaskbarHeight / 2;
75512
75555
  }
75513
- }
75514
- else if (dateChanged === 'left') {
75515
- let insertBeforeNode = target;
75516
- while (insertBeforeNode.previousSibling &&
75517
- insertBeforeNode.previousSibling.attribute.y === target.attribute.y &&
75518
- insertBeforeNode.previousSibling.record[this._gantt.parsedOptions.startDateField] >=
75519
- target.record[this._gantt.parsedOptions.startDateField]) {
75520
- insertBeforeNode = insertBeforeNode.previousSibling;
75556
+ moveTaskBar(target, newX - target.attribute.x, targetEndY - target.attribute.y, this);
75557
+ if (dateChanged === 'right') {
75558
+ let insertAfterNode = target;
75559
+ while (insertAfterNode.nextSibling &&
75560
+ insertAfterNode.nextSibling.attribute.y === target.attribute.y &&
75561
+ insertAfterNode.nextSibling.record[this._gantt.parsedOptions.startDateField] <=
75562
+ target.record[this._gantt.parsedOptions.startDateField]) {
75563
+ insertAfterNode = insertAfterNode.nextSibling;
75564
+ }
75565
+ if (insertAfterNode !== target) {
75566
+ insertAfterNode.parent.insertAfter(target, insertAfterNode);
75567
+ }
75521
75568
  }
75522
- if (insertBeforeNode !== target) {
75523
- insertBeforeNode.parent.insertBefore(target, insertBeforeNode);
75569
+ else if (dateChanged === 'left') {
75570
+ let insertBeforeNode = target;
75571
+ while (insertBeforeNode.previousSibling &&
75572
+ insertBeforeNode.previousSibling.attribute.y === target.attribute.y &&
75573
+ insertBeforeNode.previousSibling.record[this._gantt.parsedOptions.startDateField] >=
75574
+ target.record[this._gantt.parsedOptions.startDateField]) {
75575
+ insertBeforeNode = insertBeforeNode.previousSibling;
75576
+ }
75577
+ if (insertBeforeNode !== target) {
75578
+ insertBeforeNode.parent.insertBefore(target, insertBeforeNode);
75579
+ }
75524
75580
  }
75525
75581
  }
75526
75582
  }
@@ -75636,6 +75692,7 @@
75636
75692
  gantt.scenegraph.updateNextFrame();
75637
75693
  }
75638
75694
  startResizeTaskBar(target, x, y, startOffsetY, onIconName) {
75695
+ syncTaskBarNodeRecord(target, this._gantt);
75639
75696
  this.resizeTaskBar.onIconName = onIconName;
75640
75697
  this.resizeTaskBar.resizing = true;
75641
75698
  this.resizeTaskBar.target = target;
@@ -75737,6 +75794,7 @@
75737
75794
  this._gantt.scenegraph.updateNextFrame();
75738
75795
  }
75739
75796
  startAdjustProgressBar(target, x, y) {
75797
+ syncTaskBarNodeRecord(target, this._gantt);
75740
75798
  if (!target || !target.record) {
75741
75799
  return;
75742
75800
  }
@@ -76168,6 +76226,27 @@
76168
76226
  }
76169
76227
  }
76170
76228
  }
76229
+ function syncTaskBarNodeRecord(target, gantt) {
76230
+ if (!target) {
76231
+ return;
76232
+ }
76233
+ target.record = gantt.getRecordByIndex(target.task_index, target.sub_task_index);
76234
+ }
76235
+ function getTaskShowIndexByTaskRecord(record, gantt) {
76236
+ if (!record) {
76237
+ return undefined;
76238
+ }
76239
+ const taskKeyField = gantt.parsedOptions.taskKeyField;
76240
+ const taskKey = record?.[taskKeyField];
76241
+ if (!isValid$1(taskKey)) {
76242
+ return undefined;
76243
+ }
76244
+ const matchedRecord = findRecordByTaskKey(gantt.records, taskKeyField, taskKey);
76245
+ if (!matchedRecord) {
76246
+ return undefined;
76247
+ }
76248
+ return gantt.getTaskShowIndexByRecordIndex(matchedRecord.index);
76249
+ }
76171
76250
  function moveTaskBar(target, dx, dy, state) {
76172
76251
  const taskIndex = target.task_index;
76173
76252
  const sub_task_index = target.sub_task_index;
@@ -78056,6 +78135,23 @@
78056
78135
  _updateRecordToListTable(record, index) {
78057
78136
  this.taskListTableInstance.updateRecords([record], [index]);
78058
78137
  }
78138
+ _refreshSortedTaskBarsAfterRecordUpdate(recordIndex, taskShowIndex) {
78139
+ const sortState = this.taskListTableInstance?.sortState;
78140
+ if (!sortState || (Array.isArray(sortState) && sortState.length === 0)) {
78141
+ return false;
78142
+ }
78143
+ const nextTaskShowIndex = this.getTaskShowIndexByRecordIndex(recordIndex);
78144
+ if (!isValid$1(nextTaskShowIndex) || nextTaskShowIndex === taskShowIndex) {
78145
+ return false;
78146
+ }
78147
+ this._syncPropsFromTable();
78148
+ this.scenegraph.refreshTaskBarsAndGrid();
78149
+ const left = this.stateManager.scroll.horizontalBarPos;
78150
+ const top = this.stateManager.scroll.verticalBarPos;
78151
+ this.scenegraph.setX(-left);
78152
+ this.scenegraph.setY(-top);
78153
+ return true;
78154
+ }
78059
78155
  getTaskInfoByTaskListIndex(taskShowIndex, sub_task_index) {
78060
78156
  const taskRecord = this.getRecordByIndex(taskShowIndex, sub_task_index);
78061
78157
  const isMilestone = taskRecord?.type;
@@ -78158,11 +78254,12 @@
78158
78254
  const newStartDate = formatDate(startDate, dateFormat);
78159
78255
  taskRecord[startDateField] = newStartDate;
78160
78256
  if (!isValid$1(sub_task_index)) {
78161
- const indexs = this.getRecordIndexByTaskShowIndex(index);
78162
- this._updateRecordToListTable(taskRecord, indexs);
78163
- if (Array.isArray(indexs)) {
78164
- this.stateManager.updateProjectTaskTimes(indexs);
78257
+ const recordIndex = this.getRecordIndexByTaskShowIndex(index);
78258
+ this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
78259
+ if (Array.isArray(recordIndex)) {
78260
+ this.stateManager.updateProjectTaskTimes(recordIndex);
78165
78261
  }
78262
+ this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
78166
78263
  }
78167
78264
  else if (Array.isArray(sub_task_index)) {
78168
78265
  this.stateManager.updateProjectTaskTimes(sub_task_index);
@@ -78175,11 +78272,12 @@
78175
78272
  const newEndDate = formatDate(endDate, dateFormat);
78176
78273
  taskRecord[endDateField] = newEndDate;
78177
78274
  if (!isValid$1(sub_task_index)) {
78178
- const indexs = this.getRecordIndexByTaskShowIndex(index);
78179
- this._updateRecordToListTable(taskRecord, indexs);
78180
- if (Array.isArray(indexs)) {
78181
- this.stateManager.updateProjectTaskTimes(indexs);
78275
+ const recordIndex = this.getRecordIndexByTaskShowIndex(index);
78276
+ this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
78277
+ if (Array.isArray(recordIndex)) {
78278
+ this.stateManager.updateProjectTaskTimes(recordIndex);
78182
78279
  }
78280
+ this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
78183
78281
  }
78184
78282
  else if (Array.isArray(sub_task_index)) {
78185
78283
  this.stateManager.updateProjectTaskTimes(sub_task_index);
@@ -78195,11 +78293,12 @@
78195
78293
  const newEndDate = formatDate(endDate, dateFormat);
78196
78294
  taskRecord[endDateField] = newEndDate;
78197
78295
  if (!isValid$1(sub_task_index)) {
78198
- const indexs = this.getRecordIndexByTaskShowIndex(index);
78199
- this._updateRecordToListTable(taskRecord, indexs);
78200
- if (Array.isArray(indexs)) {
78201
- this.stateManager.updateProjectTaskTimes(indexs);
78296
+ const recordIndex = this.getRecordIndexByTaskShowIndex(index);
78297
+ this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
78298
+ if (Array.isArray(recordIndex)) {
78299
+ this.stateManager.updateProjectTaskTimes(recordIndex);
78202
78300
  }
78301
+ this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
78203
78302
  }
78204
78303
  else if (Array.isArray(sub_task_index)) {
78205
78304
  this.stateManager.updateProjectTaskTimes(sub_task_index);
@@ -78210,9 +78309,11 @@
78210
78309
  const progressField = this.parsedOptions.progressField;
78211
78310
  if (progressField) {
78212
78311
  taskRecord[progressField] = progress;
78213
- const indexs = this.getRecordIndexByTaskShowIndex(index);
78214
- this._updateRecordToListTable(taskRecord, indexs);
78215
- this._refreshTaskBar(index, sub_task_index);
78312
+ const recordIndex = this.getRecordIndexByTaskShowIndex(index);
78313
+ this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
78314
+ if (!this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index)) {
78315
+ this._refreshTaskBar(index, sub_task_index);
78316
+ }
78216
78317
  }
78217
78318
  }
78218
78319
  _dragOrderTaskRecord(source_index, source_sub_task_index, target_index, target_sub_task_index) {
@@ -78607,7 +78708,7 @@
78607
78708
  PluginManager: PluginManager
78608
78709
  });
78609
78710
 
78610
- const version = "1.26.2";
78711
+ const version = "1.26.3";
78611
78712
 
78612
78713
  exports.Gantt = Gantt;
78613
78714
  exports.TYPES = index$4;