@visactor/vtable-gantt 1.26.3-alpha.0 → 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.
- package/cjs/Gantt.d.ts +1 -0
- package/cjs/Gantt.js +25 -8
- package/cjs/Gantt.js.map +1 -1
- package/cjs/event/event-manager.js +2 -1
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/state/gantt-table-sync.js +20 -2
- package/cjs/state/gantt-table-sync.js.map +1 -1
- package/cjs/state/state-manager.js +28 -10
- package/cjs/state/state-manager.js.map +1 -1
- package/cjs/tools/debounce.js +2 -1
- package/dist/vtable-gantt.js +224 -119
- package/dist/vtable-gantt.min.js +1 -1
- package/es/Gantt.d.ts +1 -0
- package/es/Gantt.js +25 -8
- package/es/Gantt.js.map +1 -1
- package/es/event/event-manager.js +2 -1
- package/es/event/event-manager.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/state/gantt-table-sync.js +21 -3
- package/es/state/gantt-table-sync.js.map +1 -1
- package/es/state/state-manager.js +27 -10
- package/es/state/state-manager.js.map +1 -1
- package/es/tools/debounce.js +2 -1
- package/package.json +5 -5
package/dist/vtable-gantt.js
CHANGED
|
@@ -43213,13 +43213,20 @@
|
|
|
43213
43213
|
return parse$2(font);
|
|
43214
43214
|
}
|
|
43215
43215
|
|
|
43216
|
-
function
|
|
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
|
-
|
|
43219
|
-
|
|
43220
|
-
|
|
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,
|
|
@@ -50438,7 +50445,7 @@
|
|
|
50438
50445
|
col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
|
|
50439
50446
|
row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
|
|
50440
50447
|
dataValue: table.getCellOriginValue(col, row),
|
|
50441
|
-
value: table.getCellValue(col, row)
|
|
50448
|
+
value: table.getCellValue(col, row),
|
|
50442
50449
|
rect: getCellRect(col, row, table),
|
|
50443
50450
|
table: table,
|
|
50444
50451
|
originCol: col,
|
|
@@ -52685,7 +52692,8 @@
|
|
|
52685
52692
|
for (let col = table.colCount - currentRightFrozenCol - 1; col >= table.colCount - distRightFrozenCol; col--) {
|
|
52686
52693
|
insertBefore(rightFrozenGroup, scene.getColGroup(col), rightFrozenGroup.firstChild);
|
|
52687
52694
|
insertBefore(rightTopCornerGroup, scene.getColGroup(col, !0), rightTopCornerGroup.firstChild);
|
|
52688
|
-
|
|
52695
|
+
const bottomColGroup = scene.getColGroupInBottom(col);
|
|
52696
|
+
bottomColGroup && insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
|
|
52689
52697
|
}
|
|
52690
52698
|
let x = 0;
|
|
52691
52699
|
rightFrozenGroup.forEachChildren(columnGroup => {
|
|
@@ -52702,7 +52710,10 @@
|
|
|
52702
52710
|
const headerColGroup = scene.getColGroupInRightTopCorner(col);
|
|
52703
52711
|
headerColGroup.setAttribute("x", colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col)), colHeaderGroup.appendChild(headerColGroup);
|
|
52704
52712
|
const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
|
|
52705
|
-
|
|
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
|
+
}
|
|
52706
52717
|
}
|
|
52707
52718
|
let x = 0;
|
|
52708
52719
|
rightFrozenGroup.forEachChildren(columnGroup => {
|
|
@@ -57191,70 +57202,73 @@
|
|
|
57191
57202
|
});
|
|
57192
57203
|
}), table.scenegraph.tableGroup.addEventListener("pointerup", e => {
|
|
57193
57204
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
57194
|
-
if (0
|
|
57195
|
-
|
|
57196
|
-
|
|
57197
|
-
|
|
57198
|
-
|
|
57199
|
-
|
|
57200
|
-
|
|
57201
|
-
|
|
57202
|
-
|
|
57203
|
-
|
|
57204
|
-
|
|
57205
|
-
cells: [],
|
|
57206
|
-
col: eventArgsSet.eventArgs.target.col,
|
|
57207
|
-
row: eventArgsSet.eventArgs.target.row,
|
|
57208
|
-
scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
|
|
57209
|
-
target: null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target,
|
|
57210
|
-
mergeCellInfo: null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.mergeInfo
|
|
57211
|
-
};
|
|
57212
|
-
cellsEvent.cells = table.getSelectedCellInfos(), table.fireListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END, cellsEvent);
|
|
57213
|
-
}
|
|
57214
|
-
}
|
|
57215
|
-
} else stateManager.interactionState === InteractionState.scrolling && stateManager.updateInteractionState(InteractionState.default);
|
|
57216
|
-
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();
|
|
57217
57216
|
const eventArgsSet = getEventArgsSet(e);
|
|
57218
|
-
if (
|
|
57219
|
-
const {
|
|
57220
|
-
col: col,
|
|
57221
|
-
row: row
|
|
57222
|
-
} = eventArgsSet.eventArgs,
|
|
57223
|
-
cellInfo = table.getCellInfo(col, row);
|
|
57224
|
-
let icon, position;
|
|
57225
|
-
if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
|
|
57226
|
-
const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
|
|
57227
|
-
iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
|
|
57228
|
-
}
|
|
57229
|
-
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 = {
|
|
57230
57219
|
event: e.nativeEvent,
|
|
57231
|
-
federatedEvent: e,
|
|
57232
57220
|
cells: [],
|
|
57233
|
-
|
|
57234
|
-
|
|
57235
|
-
|
|
57236
|
-
|
|
57237
|
-
|
|
57238
|
-
|
|
57239
|
-
|
|
57240
|
-
});
|
|
57241
|
-
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);
|
|
57242
57228
|
}
|
|
57243
57229
|
}
|
|
57244
|
-
|
|
57245
|
-
|
|
57246
|
-
|
|
57247
|
-
|
|
57248
|
-
|
|
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), {
|
|
57249
57245
|
event: e.nativeEvent,
|
|
57250
|
-
|
|
57251
|
-
|
|
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
|
|
57252
57255
|
});
|
|
57256
|
+
table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
|
|
57253
57257
|
}
|
|
57254
|
-
setTimeout(() => {
|
|
57255
|
-
eventManager.isDown = !1, eventManager.isTouchdown = !1, eventManager.isTouchMove = !1, eventManager.isDraging = !1, eventManager.touchMovePoints = [];
|
|
57256
|
-
}, 0);
|
|
57257
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);
|
|
57258
57272
|
}), table.scenegraph.tableGroup.addEventListener("rightdown", e => {
|
|
57259
57273
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
57260
57274
|
const eventArgsSet = getEventArgsSet(e);
|
|
@@ -61072,7 +61086,7 @@
|
|
|
61072
61086
|
}
|
|
61073
61087
|
constructor(container, options = {}) {
|
|
61074
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;
|
|
61075
|
-
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.
|
|
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) {
|
|
61076
61090
|
const g = window;
|
|
61077
61091
|
g[this.id] = this;
|
|
61078
61092
|
const registry = g.__vtable__ || (g.__vtable__ = {
|
|
@@ -63285,16 +63299,17 @@
|
|
|
63285
63299
|
}
|
|
63286
63300
|
scrollToRow(row, animationOption) {
|
|
63287
63301
|
var _a;
|
|
63288
|
-
const targetRow = Math.min(Math.max(
|
|
63302
|
+
const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1),
|
|
63303
|
+
targetRowInt = Math.floor(targetRow);
|
|
63289
63304
|
if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
|
|
63290
|
-
row:
|
|
63291
|
-
}), void this._scheduleScrollToRowCorrect(
|
|
63305
|
+
row: targetRowInt
|
|
63306
|
+
}), void this._scheduleScrollToRowCorrect(targetRowInt);
|
|
63292
63307
|
const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
|
|
63293
63308
|
this.animationManager.scrollTo({
|
|
63294
63309
|
row: targetRow
|
|
63295
|
-
}, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
63296
|
-
this.scrollToRow(
|
|
63297
|
-
}, duration);
|
|
63310
|
+
}, animationOption), targetRowInt === targetRow && (this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
63311
|
+
this.scrollToRow(targetRowInt, !1);
|
|
63312
|
+
}, duration));
|
|
63298
63313
|
}
|
|
63299
63314
|
scrollToCol(col, animationOption) {
|
|
63300
63315
|
animationOption ? this.animationManager.scrollTo({
|
|
@@ -74391,7 +74406,8 @@
|
|
|
74391
74406
|
return false;
|
|
74392
74407
|
});
|
|
74393
74408
|
if (downBarNode) {
|
|
74394
|
-
const taskRecord = downBarNode.
|
|
74409
|
+
const taskRecord = scene._gantt.getRecordByIndex(downBarNode.task_index, downBarNode.sub_task_index);
|
|
74410
|
+
downBarNode.record = taskRecord;
|
|
74395
74411
|
const isProjectTask = taskRecord?.type === TaskType.PROJECT;
|
|
74396
74412
|
if (!isProjectTask) {
|
|
74397
74413
|
if (e.target.name === 'task-bar-hover-shadow-left-icon') {
|
|
@@ -75128,12 +75144,43 @@
|
|
|
75128
75144
|
});
|
|
75129
75145
|
}
|
|
75130
75146
|
function syncSortFromTable(gantt) {
|
|
75131
|
-
gantt.taskListTableInstance
|
|
75147
|
+
const taskListTableInstance = gantt.taskListTableInstance;
|
|
75148
|
+
if (!taskListTableInstance || taskListTableInstance._vtableGanttSortSyncPatched) {
|
|
75149
|
+
return;
|
|
75150
|
+
}
|
|
75151
|
+
const syncTaskBarsAfterSort = (attempt = 0) => {
|
|
75132
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
|
+
}
|
|
75133
75168
|
const left = gantt.stateManager.scroll.horizontalBarPos;
|
|
75134
75169
|
const top = gantt.stateManager.scroll.verticalBarPos;
|
|
75135
75170
|
gantt.scenegraph.setX(-left);
|
|
75136
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();
|
|
75137
75184
|
});
|
|
75138
75185
|
}
|
|
75139
75186
|
function syncDragOrderFromTable(gantt) {
|
|
@@ -75381,6 +75428,7 @@
|
|
|
75381
75428
|
if (target.name === 'task-bar-hover-shadow') {
|
|
75382
75429
|
target = target.parent;
|
|
75383
75430
|
}
|
|
75431
|
+
syncTaskBarNodeRecord(target, this._gantt);
|
|
75384
75432
|
this.moveTaskBar.moving = true;
|
|
75385
75433
|
this.moveTaskBar.target = target;
|
|
75386
75434
|
this.moveTaskBar.targetStartX = target.attribute.x;
|
|
@@ -75419,10 +75467,12 @@
|
|
|
75419
75467
|
const newEndDate = new Date(newStartDate.getTime() +
|
|
75420
75468
|
(createDateAtMidnight(oldEndDate).getTime() - createDateAtMidnight(oldStartDate).getTime()));
|
|
75421
75469
|
let dateChanged;
|
|
75470
|
+
let reorderedTaskShowIndex;
|
|
75422
75471
|
if (createDateAtMidnight(oldStartDate).getTime() !== newStartDate.getTime()) {
|
|
75423
75472
|
dateChanged = createDateAtMidnight(oldStartDate).getTime() > newStartDate.getTime() ? 'left' : 'right';
|
|
75424
75473
|
this._gantt._updateStartEndDateToTaskRecord(newStartDate, newEndDate, taskIndex, sub_task_index);
|
|
75425
|
-
const newRecord =
|
|
75474
|
+
const newRecord = target.record;
|
|
75475
|
+
reorderedTaskShowIndex = getTaskShowIndexByTaskRecord(newRecord, this._gantt);
|
|
75426
75476
|
if (this._gantt.hasListeners(GANTT_EVENT_TYPE.CHANGE_DATE_RANGE)) {
|
|
75427
75477
|
this._gantt.fireListeners(GANTT_EVENT_TYPE.CHANGE_DATE_RANGE, {
|
|
75428
75478
|
startDate: newRecord[this._gantt.parsedOptions.startDateField],
|
|
@@ -75434,7 +75484,7 @@
|
|
|
75434
75484
|
});
|
|
75435
75485
|
}
|
|
75436
75486
|
const indexs = getTaskIndexsByTaskY(targetEndY, this._gantt);
|
|
75437
|
-
const newRowIndex = indexs.task_index;
|
|
75487
|
+
const newRowIndex = isValid$1(reorderedTaskShowIndex) ? reorderedTaskShowIndex : indexs.task_index;
|
|
75438
75488
|
if (this._gantt.hasListeners(GANTT_EVENT_TYPE.MOVE_END_TASK_BAR)) {
|
|
75439
75489
|
this._gantt.fireListeners(GANTT_EVENT_TYPE.MOVE_END_TASK_BAR, {
|
|
75440
75490
|
startDate: newRecord[this._gantt.parsedOptions.startDateField],
|
|
@@ -75489,34 +75539,44 @@
|
|
|
75489
75539
|
}
|
|
75490
75540
|
}
|
|
75491
75541
|
else {
|
|
75492
|
-
|
|
75493
|
-
|
|
75494
|
-
|
|
75495
|
-
|
|
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);
|
|
75496
75549
|
}
|
|
75497
|
-
|
|
75498
|
-
|
|
75499
|
-
|
|
75500
|
-
|
|
75501
|
-
|
|
75502
|
-
insertAfterNode.nextSibling.record[this._gantt.parsedOptions.startDateField] <=
|
|
75503
|
-
target.record[this._gantt.parsedOptions.startDateField]) {
|
|
75504
|
-
insertAfterNode = insertAfterNode.nextSibling;
|
|
75505
|
-
}
|
|
75506
|
-
if (insertAfterNode !== target) {
|
|
75507
|
-
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;
|
|
75508
75555
|
}
|
|
75509
|
-
|
|
75510
|
-
|
|
75511
|
-
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75515
|
-
|
|
75516
|
-
|
|
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
|
+
}
|
|
75517
75568
|
}
|
|
75518
|
-
if (
|
|
75519
|
-
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
|
+
}
|
|
75520
75580
|
}
|
|
75521
75581
|
}
|
|
75522
75582
|
}
|
|
@@ -75632,6 +75692,7 @@
|
|
|
75632
75692
|
gantt.scenegraph.updateNextFrame();
|
|
75633
75693
|
}
|
|
75634
75694
|
startResizeTaskBar(target, x, y, startOffsetY, onIconName) {
|
|
75695
|
+
syncTaskBarNodeRecord(target, this._gantt);
|
|
75635
75696
|
this.resizeTaskBar.onIconName = onIconName;
|
|
75636
75697
|
this.resizeTaskBar.resizing = true;
|
|
75637
75698
|
this.resizeTaskBar.target = target;
|
|
@@ -75733,6 +75794,7 @@
|
|
|
75733
75794
|
this._gantt.scenegraph.updateNextFrame();
|
|
75734
75795
|
}
|
|
75735
75796
|
startAdjustProgressBar(target, x, y) {
|
|
75797
|
+
syncTaskBarNodeRecord(target, this._gantt);
|
|
75736
75798
|
if (!target || !target.record) {
|
|
75737
75799
|
return;
|
|
75738
75800
|
}
|
|
@@ -76164,6 +76226,27 @@
|
|
|
76164
76226
|
}
|
|
76165
76227
|
}
|
|
76166
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
|
+
}
|
|
76167
76250
|
function moveTaskBar(target, dx, dy, state) {
|
|
76168
76251
|
const taskIndex = target.task_index;
|
|
76169
76252
|
const sub_task_index = target.sub_task_index;
|
|
@@ -78052,6 +78135,23 @@
|
|
|
78052
78135
|
_updateRecordToListTable(record, index) {
|
|
78053
78136
|
this.taskListTableInstance.updateRecords([record], [index]);
|
|
78054
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
|
+
}
|
|
78055
78155
|
getTaskInfoByTaskListIndex(taskShowIndex, sub_task_index) {
|
|
78056
78156
|
const taskRecord = this.getRecordByIndex(taskShowIndex, sub_task_index);
|
|
78057
78157
|
const isMilestone = taskRecord?.type;
|
|
@@ -78154,11 +78254,12 @@
|
|
|
78154
78254
|
const newStartDate = formatDate(startDate, dateFormat);
|
|
78155
78255
|
taskRecord[startDateField] = newStartDate;
|
|
78156
78256
|
if (!isValid$1(sub_task_index)) {
|
|
78157
|
-
const
|
|
78158
|
-
this._updateRecordToListTable(taskRecord,
|
|
78159
|
-
if (Array.isArray(
|
|
78160
|
-
this.stateManager.updateProjectTaskTimes(
|
|
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);
|
|
78161
78261
|
}
|
|
78262
|
+
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
|
|
78162
78263
|
}
|
|
78163
78264
|
else if (Array.isArray(sub_task_index)) {
|
|
78164
78265
|
this.stateManager.updateProjectTaskTimes(sub_task_index);
|
|
@@ -78171,11 +78272,12 @@
|
|
|
78171
78272
|
const newEndDate = formatDate(endDate, dateFormat);
|
|
78172
78273
|
taskRecord[endDateField] = newEndDate;
|
|
78173
78274
|
if (!isValid$1(sub_task_index)) {
|
|
78174
|
-
const
|
|
78175
|
-
this._updateRecordToListTable(taskRecord,
|
|
78176
|
-
if (Array.isArray(
|
|
78177
|
-
this.stateManager.updateProjectTaskTimes(
|
|
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);
|
|
78178
78279
|
}
|
|
78280
|
+
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
|
|
78179
78281
|
}
|
|
78180
78282
|
else if (Array.isArray(sub_task_index)) {
|
|
78181
78283
|
this.stateManager.updateProjectTaskTimes(sub_task_index);
|
|
@@ -78191,11 +78293,12 @@
|
|
|
78191
78293
|
const newEndDate = formatDate(endDate, dateFormat);
|
|
78192
78294
|
taskRecord[endDateField] = newEndDate;
|
|
78193
78295
|
if (!isValid$1(sub_task_index)) {
|
|
78194
|
-
const
|
|
78195
|
-
this._updateRecordToListTable(taskRecord,
|
|
78196
|
-
if (Array.isArray(
|
|
78197
|
-
this.stateManager.updateProjectTaskTimes(
|
|
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);
|
|
78198
78300
|
}
|
|
78301
|
+
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
|
|
78199
78302
|
}
|
|
78200
78303
|
else if (Array.isArray(sub_task_index)) {
|
|
78201
78304
|
this.stateManager.updateProjectTaskTimes(sub_task_index);
|
|
@@ -78206,9 +78309,11 @@
|
|
|
78206
78309
|
const progressField = this.parsedOptions.progressField;
|
|
78207
78310
|
if (progressField) {
|
|
78208
78311
|
taskRecord[progressField] = progress;
|
|
78209
|
-
const
|
|
78210
|
-
this._updateRecordToListTable(taskRecord,
|
|
78211
|
-
this.
|
|
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
|
+
}
|
|
78212
78317
|
}
|
|
78213
78318
|
}
|
|
78214
78319
|
_dragOrderTaskRecord(source_index, source_sub_task_index, target_index, target_sub_task_index) {
|
|
@@ -78603,7 +78708,7 @@
|
|
|
78603
78708
|
PluginManager: PluginManager
|
|
78604
78709
|
});
|
|
78605
78710
|
|
|
78606
|
-
const version = "1.26.
|
|
78711
|
+
const version = "1.26.3";
|
|
78607
78712
|
|
|
78608
78713
|
exports.Gantt = Gantt;
|
|
78609
78714
|
exports.TYPES = index$4;
|