@visactor/vtable-gantt 1.26.3-alpha.0 → 1.26.4-alpha.0
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/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 +250 -97
- 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/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
|
@@ -42898,6 +42898,20 @@
|
|
|
42898
42898
|
var _a, _b, _c;
|
|
42899
42899
|
return null !== (_c = null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0;
|
|
42900
42900
|
}
|
|
42901
|
+
refreshRecords(records = [], dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
|
|
42902
|
+
var _a;
|
|
42903
|
+
this.clearCache(), this.beforeChangedRecordsMap.clear(), this.groupAggregator = null, this.addRecordRule = (null == dataConfig ? void 0 : dataConfig.addRecordRule) || "Object", this.dataConfig = dataConfig, this.columns = columns, this._isGrouped = isArray$5(null == dataConfig ? void 0 : dataConfig.groupByRules), this.rowHierarchyType = rowHierarchyType, this.dataSourceObj = {
|
|
42904
|
+
get: index => records[index],
|
|
42905
|
+
length: records.length,
|
|
42906
|
+
records: records
|
|
42907
|
+
}, this._source = this.processRecords(records), this.sourceLength = (null === (_a = this.source) || void 0 === _a ? void 0 : _a.length) || 0, this.sortedIndexMap.clear(), this._currentPagerIndexedData = [], this.userPagination = pagination, this.pagination = pagination || {
|
|
42908
|
+
totalCount: this.sourceLength,
|
|
42909
|
+
perPageCount: this.sourceLength,
|
|
42910
|
+
currentPage: 0
|
|
42911
|
+
}, this.hierarchyExpandLevel = hierarchyExpandLevel >= 1 ? hierarchyExpandLevel : 0, this.currentIndexedData = Array.from({
|
|
42912
|
+
length: this.sourceLength
|
|
42913
|
+
}, (_, i) => i), this.userPagination || (this.pagination.perPageCount = this.sourceLength, this.pagination.totalCount = this.sourceLength), "tree" === rowHierarchyType && this.initTreeHierarchyState(), this.updatePagerData();
|
|
42914
|
+
}
|
|
42901
42915
|
updateGroup() {
|
|
42902
42916
|
var _a, _b, _c;
|
|
42903
42917
|
this.clearCache();
|
|
@@ -43213,13 +43227,20 @@
|
|
|
43213
43227
|
return parse$2(font);
|
|
43214
43228
|
}
|
|
43215
43229
|
|
|
43216
|
-
function
|
|
43230
|
+
function normalizeQuadArray(values) {
|
|
43231
|
+
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]];
|
|
43232
|
+
}
|
|
43233
|
+
function parseStringQuad(padding) {
|
|
43234
|
+
const tokens = padding.trim().split(/\s+/),
|
|
43235
|
+
values = tokens.map(token => Number.parseFloat(token)).filter(value => Number.isFinite(value));
|
|
43236
|
+
return values.length === tokens.length && values.length > 0 ? normalizeQuadArray(values) : [padding, padding, padding, padding];
|
|
43237
|
+
}
|
|
43238
|
+
function normalizePaddingObject(paddingOrigin) {
|
|
43217
43239
|
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];
|
|
43240
|
+
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];
|
|
43241
|
+
}
|
|
43242
|
+
function getQuadProps(paddingOrigin) {
|
|
43243
|
+
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
43244
|
}
|
|
43224
43245
|
|
|
43225
43246
|
const TYPE_PAREN = 0,
|
|
@@ -43449,14 +43470,17 @@
|
|
|
43449
43470
|
table.dataSource.hierarchyExpandLevel && table.refreshRowColCount(), table.render();
|
|
43450
43471
|
})];
|
|
43451
43472
|
}
|
|
43452
|
-
function
|
|
43473
|
+
function getListTableRowHierarchyType(table) {
|
|
43474
|
+
var _a, _b;
|
|
43453
43475
|
const tableWithPlugins = table;
|
|
43476
|
+
let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
|
|
43477
|
+
return isArray$5(null === (_a = table.internalProps.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) && (rowHierarchyType = "tree"), (null === (_b = tableWithPlugins.pluginManager) || void 0 === _b ? void 0 : _b.getPluginByName("Master Detail Plugin")) && (rowHierarchyType = "grid"), rowHierarchyType;
|
|
43478
|
+
}
|
|
43479
|
+
function _setRecords(table, records = []) {
|
|
43454
43480
|
_dealWithUpdateDataSource(table, () => {
|
|
43455
|
-
var _a;
|
|
43456
43481
|
table.internalProps.records = records;
|
|
43457
|
-
|
|
43458
|
-
|
|
43459
|
-
const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
|
|
43482
|
+
const rowHierarchyType = getListTableRowHierarchyType(table),
|
|
43483
|
+
newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
|
|
43460
43484
|
table.addReleaseObj(newDataSource);
|
|
43461
43485
|
});
|
|
43462
43486
|
}
|
|
@@ -44832,7 +44856,7 @@
|
|
|
44832
44856
|
|
|
44833
44857
|
function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
|
|
44834
44858
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
44835
|
-
let contentWidth,
|
|
44859
|
+
let contentWidth = 0,
|
|
44836
44860
|
leftIconWidth = 0,
|
|
44837
44861
|
rightIconWidth = 0,
|
|
44838
44862
|
absoluteRightIconWidth = 0;
|
|
@@ -44912,8 +44936,8 @@
|
|
|
44912
44936
|
}), contentRightIcons.forEach(icon => {
|
|
44913
44937
|
const iconMark = dealWithIcon(icon, void 0, cellGroup.col, cellGroup.row, range, table, dealWithIconComputeVar);
|
|
44914
44938
|
iconMark.role = "icon-content-right", iconMark.name = icon.name, cellContent.addRightOccupyingIcon(iconMark);
|
|
44915
|
-
}), cellContent.addContent(textMark), cellGroup.appendChild(cellContent), cellContent.layout(), contentWidth = cellContent.AABBBounds.width()
|
|
44916
|
-
} else cellGroup.firstChild ? cellGroup.insertBefore(textMark, cellGroup.firstChild) : cellGroup.appendChild(textMark), contentWidth = textMark.AABBBounds.width()
|
|
44939
|
+
}), cellContent.addContent(textMark), cellGroup.appendChild(cellContent), cellContent.layout(), autoColWidth && (contentWidth = cellContent.AABBBounds.width());
|
|
44940
|
+
} else cellGroup.firstChild ? cellGroup.insertBefore(textMark, cellGroup.firstChild) : cellGroup.appendChild(textMark), autoColWidth && (contentWidth = textMark.AABBBounds.width());
|
|
44917
44941
|
} else if (isValid$1(textStr)) {
|
|
44918
44942
|
const {
|
|
44919
44943
|
text: text,
|
|
@@ -44937,7 +44961,7 @@
|
|
|
44937
44961
|
keepCenterInLine: !0
|
|
44938
44962
|
},
|
|
44939
44963
|
wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
|
|
44940
|
-
wrapText.name = "text", wrapText.textBaseline = textBaseline, cellGroup.appendChild(wrapText), contentWidth = wrapText.AABBBounds.width()
|
|
44964
|
+
wrapText.name = "text", wrapText.textBaseline = textBaseline, cellGroup.appendChild(wrapText), autoColWidth && (contentWidth = wrapText.AABBBounds.width());
|
|
44941
44965
|
}
|
|
44942
44966
|
const width = autoColWidth ? leftIconWidth + contentWidth + rightIconWidth : cellWidth - (padding[1] + padding[3]),
|
|
44943
44967
|
height = cellHeight - (padding[0] + padding[2]);
|
|
@@ -45395,7 +45419,7 @@
|
|
|
45395
45419
|
}
|
|
45396
45420
|
}
|
|
45397
45421
|
|
|
45398
|
-
function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
|
|
45422
|
+
function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, headerStyle) {
|
|
45399
45423
|
var _a, _b;
|
|
45400
45424
|
let cellGroup,
|
|
45401
45425
|
isAsync = !1;
|
|
@@ -45430,7 +45454,7 @@
|
|
|
45430
45454
|
customElementsGroup: customElementsGroup,
|
|
45431
45455
|
renderDefault: renderDefault
|
|
45432
45456
|
} = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult);
|
|
45433
|
-
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
|
|
45457
|
+
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
|
|
45434
45458
|
const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
|
|
45435
45459
|
if (axisConfig) {
|
|
45436
45460
|
const axis = new (Factory.getComponent("axis"))(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, null !== (_a = axisConfig.__vtableBodyChartCellPadding) && void 0 !== _a ? _a : padding, table);
|
|
@@ -45453,20 +45477,20 @@
|
|
|
45453
45477
|
} = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult),
|
|
45454
45478
|
style = table._getCellStyle(col, row),
|
|
45455
45479
|
dataValue = table.getCellOriginValue(col, row);
|
|
45456
|
-
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
|
|
45480
|
+
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
|
|
45457
45481
|
const progressBarGroup = Factory.getFunction("createProgressBarCell")(define, style, colWidth, value, dataValue, col, row, padding, table, range);
|
|
45458
45482
|
cellGroup.firstChild ? cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild) : cellGroup.appendChild(progressBarGroup);
|
|
45459
45483
|
} else if ("sparkline" === type) {
|
|
45460
45484
|
cellGroup = Factory.getFunction("createSparkLineCellGroup")(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table, cellTheme, isAsync);
|
|
45461
45485
|
} else if ("checkbox" === type) {
|
|
45462
45486
|
if ("isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row)) {
|
|
45463
|
-
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
|
|
45487
|
+
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync, headerStyle);
|
|
45464
45488
|
} else {
|
|
45465
45489
|
cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, !1);
|
|
45466
45490
|
}
|
|
45467
45491
|
} else if ("radio" === type) {
|
|
45468
45492
|
if ("isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row)) {
|
|
45469
|
-
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
|
|
45493
|
+
cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync, headerStyle);
|
|
45470
45494
|
} else {
|
|
45471
45495
|
cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define, range);
|
|
45472
45496
|
}
|
|
@@ -50678,6 +50702,7 @@
|
|
|
50678
50702
|
isMerge,
|
|
50679
50703
|
customStyle,
|
|
50680
50704
|
customResult,
|
|
50705
|
+
rawRecord,
|
|
50681
50706
|
cellLocation = table.getCellLocation(col, row),
|
|
50682
50707
|
value = table.getCellValue(col, row),
|
|
50683
50708
|
cellWidth = colWidth,
|
|
@@ -50707,17 +50732,17 @@
|
|
|
50707
50732
|
const isAggregation = "isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row),
|
|
50708
50733
|
isSeriesNumber = table.internalProps.layoutMap.isSeriesNumber(col, row);
|
|
50709
50734
|
let mayHaveIcon = "body" !== cellLocation || ((null == define ? void 0 : define.dragOrder) || !!(null == define ? void 0 : define.icon) || !!(null == define ? void 0 : define.tree)) && !(isAggregation && isSeriesNumber);
|
|
50710
|
-
if (!range && (table.internalProps.enableTreeNodeMerge || "body" !== cellLocation || (null == define ? void 0 : define.mergeCell)) && (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row, isMerge)) {
|
|
50735
|
+
if (!range && (table.internalProps.enableTreeNodeMerge || "body" !== cellLocation || (null == define ? void 0 : define.mergeCell)) && (table.internalProps.enableTreeNodeMerge && "body" === cellLocation && !(null == define ? void 0 : define.mergeCell) ? (rawRecord = table.getCellRawRecord(col, row), (null == rawRecord ? void 0 : rawRecord.vtableMerge) && (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row)) : (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row), isMerge)) {
|
|
50711
50736
|
const mergeSize = dealMerge(range, mergeMap, table, rowStart > range.start.row);
|
|
50712
50737
|
cellWidth = mergeSize.cellWidth, cellHeight = mergeSize.cellHeight;
|
|
50713
50738
|
}
|
|
50714
50739
|
let isVtableMerge = !1;
|
|
50715
50740
|
if (table.internalProps.enableTreeNodeMerge && isMerge) {
|
|
50716
|
-
|
|
50717
|
-
|
|
50718
|
-
|
|
50719
|
-
|
|
50720
|
-
|
|
50741
|
+
rawRecord = null != rawRecord ? rawRecord : table.getCellRawRecord(range.start.col, range.start.row);
|
|
50742
|
+
const {
|
|
50743
|
+
vtableMergeName: vtableMergeName,
|
|
50744
|
+
vtableMerge: vtableMerge
|
|
50745
|
+
} = null != rawRecord ? rawRecord : {};
|
|
50721
50746
|
isVtableMerge = vtableMerge, vtableMerge && (mayHaveIcon = !0, table.internalProps.groupTitleCustomLayout && (customResult = dealWithCustom(table.internalProps.groupTitleCustomLayout, void 0, range.start.col, range.start.row, table.getColsWidth(range.start.col, range.end.col), table.getRowsHeight(range.start.row, range.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table)), table.internalProps.groupTitleFieldFormat ? value = table.internalProps.groupTitleFieldFormat(rawRecord, col, row, table) : void 0 !== vtableMergeName && (value = vtableMergeName));
|
|
50722
50747
|
}
|
|
50723
50748
|
const type = isVtableMerge || isCustomMerge ? "text" : table.getCellType(col, row);
|
|
@@ -50747,7 +50772,7 @@
|
|
|
50747
50772
|
const cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
|
|
50748
50773
|
cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
|
|
50749
50774
|
cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), cellTheme.group.width = colWidth, cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight, cellTheme._vtable.padding && (padding = cellTheme._vtable.padding), cellTheme.text.textAlign && (textAlign = cellTheme.text.textAlign), cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff");
|
|
50750
|
-
const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
|
|
50775
|
+
const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
|
|
50751
50776
|
if (columnGroup.updateColumnRowNumber(row), isMerge) {
|
|
50752
50777
|
const rangeHeight = table.getRowHeight(row),
|
|
50753
50778
|
{
|
|
@@ -50789,7 +50814,7 @@
|
|
|
50789
50814
|
} = createCellArgs,
|
|
50790
50815
|
cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
|
|
50791
50816
|
cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
|
|
50792
|
-
cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), cellTheme.group.width = colWidth, cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight, cellTheme._vtable.padding && (padding = cellTheme._vtable.padding), cellTheme.text.textAlign && (textAlign = cellTheme.text.textAlign), cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff"), createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
|
|
50817
|
+
cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), cellTheme.group.width = colWidth, cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight, cellTheme._vtable.padding && (padding = cellTheme._vtable.padding), cellTheme.text.textAlign && (textAlign = cellTheme.text.textAlign), cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff"), createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
|
|
50793
50818
|
}
|
|
50794
50819
|
function dealMerge(range, mergeMap, table, forceUpdate) {
|
|
50795
50820
|
let cellWidth = 0,
|
|
@@ -52685,7 +52710,8 @@
|
|
|
52685
52710
|
for (let col = table.colCount - currentRightFrozenCol - 1; col >= table.colCount - distRightFrozenCol; col--) {
|
|
52686
52711
|
insertBefore(rightFrozenGroup, scene.getColGroup(col), rightFrozenGroup.firstChild);
|
|
52687
52712
|
insertBefore(rightTopCornerGroup, scene.getColGroup(col, !0), rightTopCornerGroup.firstChild);
|
|
52688
|
-
|
|
52713
|
+
const bottomColGroup = scene.getColGroupInBottom(col);
|
|
52714
|
+
bottomColGroup && insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
|
|
52689
52715
|
}
|
|
52690
52716
|
let x = 0;
|
|
52691
52717
|
rightFrozenGroup.forEachChildren(columnGroup => {
|
|
@@ -52702,7 +52728,10 @@
|
|
|
52702
52728
|
const headerColGroup = scene.getColGroupInRightTopCorner(col);
|
|
52703
52729
|
headerColGroup.setAttribute("x", colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col)), colHeaderGroup.appendChild(headerColGroup);
|
|
52704
52730
|
const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
|
|
52705
|
-
|
|
52731
|
+
if (bottomColGroup) {
|
|
52732
|
+
const lastBottomColGroup = bottomFrozenGroup.lastChild;
|
|
52733
|
+
bottomColGroup.setAttribute("x", lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0), bottomFrozenGroup.appendChild(bottomColGroup);
|
|
52734
|
+
}
|
|
52706
52735
|
}
|
|
52707
52736
|
let x = 0;
|
|
52708
52737
|
rightFrozenGroup.forEachChildren(columnGroup => {
|
|
@@ -54235,16 +54264,28 @@
|
|
|
54235
54264
|
updateContainerChildrenX(this.rightFrozenGroup, rightStartX), updateContainerChildrenX(this.rightTopCornerGroup, rightStartX), updateContainerChildrenX(this.rightBottomCornerGroup, rightStartX), this.updateNextFrame();
|
|
54236
54265
|
}
|
|
54237
54266
|
updateContainerAttrHeightAndY() {
|
|
54238
|
-
|
|
54239
|
-
|
|
54240
|
-
|
|
54241
|
-
|
|
54242
|
-
|
|
54243
|
-
|
|
54244
|
-
|
|
54245
|
-
|
|
54246
|
-
|
|
54247
|
-
|
|
54267
|
+
this.cornerHeaderGroup.forEachChildrenSkipChild(column => {
|
|
54268
|
+
updateContainerChildrenY(column, 0);
|
|
54269
|
+
}), this.colHeaderGroup.forEachChildrenSkipChild(column => {
|
|
54270
|
+
updateContainerChildrenY(column, 0);
|
|
54271
|
+
}), this.rightTopCornerGroup.forEachChildrenSkipChild(column => {
|
|
54272
|
+
updateContainerChildrenY(column, 0);
|
|
54273
|
+
}), this.rowHeaderGroup.forEachChildrenSkipChild(column => {
|
|
54274
|
+
var _a;
|
|
54275
|
+
column.firstChild && updateContainerChildrenY(column, column.firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, column.firstChild.row - 1) : 0);
|
|
54276
|
+
}), this.bodyGroup.forEachChildrenSkipChild(column => {
|
|
54277
|
+
var _a;
|
|
54278
|
+
column.firstChild && updateContainerChildrenY(column, column.firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, column.firstChild.row - 1) : 0);
|
|
54279
|
+
}), this.rightFrozenGroup.forEachChildrenSkipChild(column => {
|
|
54280
|
+
var _a;
|
|
54281
|
+
column.firstChild && updateContainerChildrenY(column, column.firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, column.firstChild.row - 1) : 0);
|
|
54282
|
+
}), this.leftBottomCornerGroup.forEachChildrenSkipChild(column => {
|
|
54283
|
+
updateContainerChildrenY(column, 0);
|
|
54284
|
+
}), this.bottomFrozenGroup.forEachChildrenSkipChild(column => {
|
|
54285
|
+
updateContainerChildrenY(column, 0);
|
|
54286
|
+
}), this.rightBottomCornerGroup.forEachChildrenSkipChild(column => {
|
|
54287
|
+
updateContainerChildrenY(column, 0);
|
|
54288
|
+
});
|
|
54248
54289
|
}
|
|
54249
54290
|
updateContainer(updateConfig = {
|
|
54250
54291
|
async: !1,
|
|
@@ -62131,7 +62172,7 @@
|
|
|
62131
62172
|
const internalProps = this.internalProps;
|
|
62132
62173
|
if ("node" === Env.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding), this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal", internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = null === (_e = null != enableCheckboxCascade ? enableCheckboxCascade : null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox) || void 0 === _e || _e, internalProps.enableHeaderCheckboxCascade = enableCheckboxCascade || null == enableHeaderCheckboxCascade || enableHeaderCheckboxCascade, internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode, internalProps.canResizeColumn = null == resize ? void 0 : resize.canResizeColumn, internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode, internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.cellTextOverflows = {}, internalProps.groupBy = null !== (_k = null == groupConfig ? void 0 : groupConfig.groupBy) && void 0 !== _k ? _k : groupBy, internalProps.groupTitleCheckbox = null == groupConfig ? void 0 : groupConfig.titleCheckbox, internalProps.groupTitleFieldFormat = null !== (_l = null == groupConfig ? void 0 : groupConfig.titleFieldFormat) && void 0 !== _l ? _l : groupTitleFieldFormat, internalProps.groupTitleCustomLayout = null !== (_m = null == groupConfig ? void 0 : groupConfig.titleCustomLayout) && void 0 !== _m ? _m : groupTitleCustomLayout, internalProps.enableTreeStickCell = null !== (_o = null == groupConfig ? void 0 : groupConfig.enableTreeStickCell) && void 0 !== _o ? _o : enableTreeStickCell, (null == updateConfig ? void 0 : updateConfig.clearColWidthCache) && (internalProps._widthResizedColMap.clear(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {}), (null == updateConfig ? void 0 : updateConfig.clearRowHeightCache) && (internalProps._heightResizedRowMap.clear(), internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map()), internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_p = options.theme) && void 0 !== _p ? _p : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_q = options.allowFrozenColCount) && void 0 !== _q ? _q : 0, internalProps.limitMaxAutoWidth = null !== (_r = options.limitMaxAutoWidth) && void 0 !== _r ? _r : 450, internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10, internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10, null === (_s = internalProps.legends) || void 0 === _s || _s.forEach(legend => {
|
|
62133
62174
|
null == legend || legend.release();
|
|
62134
|
-
}), null === (_t = internalProps.title) || void 0 === _t || _t.release(), internalProps.title = null, null === (_u = internalProps.emptyTip) || void 0 === _u || _u.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
|
|
62175
|
+
}), null === (_t = internalProps.title) || void 0 === _t || _t.release(), internalProps.title = null, null === (_u = internalProps.emptyTip) || void 0 === _u || _u.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), (null == updateConfig ? void 0 : updateConfig.skipClearCells) || this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
|
|
62135
62176
|
internalProps.legends = [];
|
|
62136
62177
|
const createLegend = Factory.getFunction("createLegend");
|
|
62137
62178
|
if (Array.isArray(options.legends)) {
|
|
@@ -63285,16 +63326,17 @@
|
|
|
63285
63326
|
}
|
|
63286
63327
|
scrollToRow(row, animationOption) {
|
|
63287
63328
|
var _a;
|
|
63288
|
-
const targetRow = Math.min(Math.max(
|
|
63329
|
+
const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1),
|
|
63330
|
+
targetRowInt = Math.floor(targetRow);
|
|
63289
63331
|
if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
|
|
63290
|
-
row:
|
|
63291
|
-
}), void this._scheduleScrollToRowCorrect(
|
|
63332
|
+
row: targetRowInt
|
|
63333
|
+
}), void this._scheduleScrollToRowCorrect(targetRowInt);
|
|
63292
63334
|
const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
|
|
63293
63335
|
this.animationManager.scrollTo({
|
|
63294
63336
|
row: targetRow
|
|
63295
|
-
}, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
63296
|
-
this.scrollToRow(
|
|
63297
|
-
}, duration);
|
|
63337
|
+
}, animationOption), targetRowInt === targetRow && (this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
63338
|
+
this.scrollToRow(targetRowInt, !1);
|
|
63339
|
+
}, duration));
|
|
63298
63340
|
}
|
|
63299
63341
|
scrollToCol(col, animationOption) {
|
|
63300
63342
|
animationOption ? this.animationManager.scrollTo({
|
|
@@ -66192,14 +66234,19 @@
|
|
|
66192
66234
|
clearRowHeightCache: !0
|
|
66193
66235
|
}) {
|
|
66194
66236
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
66195
|
-
const internalProps = this.internalProps
|
|
66196
|
-
|
|
66237
|
+
const internalProps = this.internalProps,
|
|
66238
|
+
prevSortState = internalProps.sortState,
|
|
66239
|
+
hasActiveSortState = (Array.isArray(options.sortState) ? options.sortState : options.sortState ? [options.sortState] : []).some(item => (null == item ? void 0 : item.field) && (null == item ? void 0 : item.order) && "normal" !== item.order),
|
|
66240
|
+
shouldSkipInitialClearCells = Boolean(options.records) || !!options.dataSource && this.dataSource !== options.dataSource;
|
|
66241
|
+
if (this.pluginManager.removeOrAddPlugins(options.plugins), super.updateOption(options, Object.assign(Object.assign({}, updateConfig), {
|
|
66242
|
+
skipClearCells: shouldSkipInitialClearCells
|
|
66243
|
+
})), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
|
|
66197
66244
|
addRecordRule: options.addRecordRule
|
|
66198
66245
|
}, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$1(this.internalProps.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.rowHeightConfig = options.rowHeightConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
|
|
66199
66246
|
const releaseObj = internalProps.releaseList[i];
|
|
66200
66247
|
releaseObj instanceof DataSource$1 ? releaseObj.updateColumns(this.internalProps.columns) : (null === (_g = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _g || _g.call(releaseObj), internalProps.releaseList.splice(i, 1));
|
|
66201
66248
|
}
|
|
66202
|
-
if (options.dataSource && this.dataSource !== options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
|
|
66249
|
+
if (options.dataSource && this.dataSource !== options.dataSource ? this.dataSource = options.dataSource : options.records && options.records === internalProps.records && options.sortState === prevSortState && !hasActiveSortState && this.dataSource instanceof CachedDataSource ? this._refreshCurrentRecordsForOptionUpdate(options.records) : options.records ? this.setRecords(options.records, {
|
|
66203
66250
|
sortState: options.sortState
|
|
66204
66251
|
}) : (this.refreshRowColCount(), this._resetFrozenColCount(), this.scenegraph.createSceneGraph(), this.render()), options.title) {
|
|
66205
66252
|
const Title = Factory.getComponent("title");
|
|
@@ -66215,6 +66262,22 @@
|
|
|
66215
66262
|
setTimeout(resolve, 0);
|
|
66216
66263
|
});
|
|
66217
66264
|
}
|
|
66265
|
+
_refreshCurrentRecordsForOptionUpdate(records) {
|
|
66266
|
+
var _a;
|
|
66267
|
+
const dataSource = this.dataSource;
|
|
66268
|
+
this.stateManager.endResizeIfResizing(), clearChartRenderQueue();
|
|
66269
|
+
const oldHoverState = {
|
|
66270
|
+
col: this.stateManager.hover.cellPos.col,
|
|
66271
|
+
row: this.stateManager.hover.cellPos.row
|
|
66272
|
+
};
|
|
66273
|
+
this.scenegraph.clearCells(), this.internalProps.records = records, dataSource.refreshRecords(records, this.internalProps.dataConfig, this.pagination, this.internalProps.columns, getListTableRowHierarchyType(this), getHierarchyExpandLevel(this)), this.refreshRowColCount(), this.stateManager.initCheckedState(records), this.clearCellStyleCache(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this._updateSize();
|
|
66274
|
+
(null !== (_a = this.options.componentLayoutOrder) && void 0 !== _a ? _a : ["legend", "title"]).forEach(component => {
|
|
66275
|
+
var _a, _b;
|
|
66276
|
+
"legend" === component ? null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach(legend => {
|
|
66277
|
+
null == legend || legend.resize();
|
|
66278
|
+
}) : "title" === component && (null === (_b = this.internalProps.title) || void 0 === _b || _b.resize());
|
|
66279
|
+
}), this.scenegraph.resize(), this.render();
|
|
66280
|
+
}
|
|
66218
66281
|
updatePagination(pagination) {
|
|
66219
66282
|
this.pagination && ("number" == typeof pagination.currentPage && pagination.currentPage >= 0 && (this.pagination.currentPage = pagination.currentPage), pagination.perPageCount && (this.pagination.perPageCount = pagination.perPageCount || this.pagination.perPageCount), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.clearCells(), this.dataSource.updatePagination(this.pagination), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(), this.renderAsync());
|
|
66220
66283
|
}
|
|
@@ -70120,10 +70183,10 @@
|
|
|
70120
70183
|
}
|
|
70121
70184
|
}
|
|
70122
70185
|
|
|
70123
|
-
function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync) {
|
|
70186
|
+
function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle) {
|
|
70124
70187
|
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, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
70125
|
-
|
|
70126
|
-
|
|
70188
|
+
headerStyle = headerStyle || table._getCellStyle(col, row);
|
|
70189
|
+
const functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
|
|
70127
70190
|
isValid$1(functionalPadding) && (padding = functionalPadding), (null === (_a = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _a ? void 0 : _a.textAlign) && (textAlign = null === (_b = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _b ? void 0 : _b.textAlign), (null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textBaseline) && (textBaseline = null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textBaseline);
|
|
70128
70191
|
const autoRowHeight = table.isAutoRowHeight(row),
|
|
70129
70192
|
autoColWidth = "auto" === colWidth,
|
|
@@ -74391,7 +74454,8 @@
|
|
|
74391
74454
|
return false;
|
|
74392
74455
|
});
|
|
74393
74456
|
if (downBarNode) {
|
|
74394
|
-
const taskRecord = downBarNode.
|
|
74457
|
+
const taskRecord = scene._gantt.getRecordByIndex(downBarNode.task_index, downBarNode.sub_task_index);
|
|
74458
|
+
downBarNode.record = taskRecord;
|
|
74395
74459
|
const isProjectTask = taskRecord?.type === TaskType.PROJECT;
|
|
74396
74460
|
if (!isProjectTask) {
|
|
74397
74461
|
if (e.target.name === 'task-bar-hover-shadow-left-icon') {
|
|
@@ -75128,12 +75192,43 @@
|
|
|
75128
75192
|
});
|
|
75129
75193
|
}
|
|
75130
75194
|
function syncSortFromTable(gantt) {
|
|
75131
|
-
gantt.taskListTableInstance
|
|
75195
|
+
const taskListTableInstance = gantt.taskListTableInstance;
|
|
75196
|
+
if (!taskListTableInstance || taskListTableInstance._vtableGanttSortSyncPatched) {
|
|
75197
|
+
return;
|
|
75198
|
+
}
|
|
75199
|
+
const syncTaskBarsAfterSort = (attempt = 0) => {
|
|
75132
75200
|
gantt.scenegraph.refreshTaskBars();
|
|
75201
|
+
const taskCount = Math.min(gantt.itemCount ?? 0, 10);
|
|
75202
|
+
const taskKeyField = gantt.parsedOptions.taskKeyField;
|
|
75203
|
+
let taskBarsSynced = true;
|
|
75204
|
+
for (let index = 0; index < taskCount; index++) {
|
|
75205
|
+
const taskBarNode = gantt.scenegraph.taskBar.getTaskBarNodeByIndex(index);
|
|
75206
|
+
const visibleRecord = gantt.getRecordByIndex(index);
|
|
75207
|
+
if (taskBarNode && taskBarNode.record?.[taskKeyField] !== visibleRecord?.[taskKeyField]) {
|
|
75208
|
+
taskBarsSynced = false;
|
|
75209
|
+
break;
|
|
75210
|
+
}
|
|
75211
|
+
}
|
|
75212
|
+
if (!taskBarsSynced && attempt < 10) {
|
|
75213
|
+
setTimeout(() => syncTaskBarsAfterSort(attempt + 1), 16);
|
|
75214
|
+
return;
|
|
75215
|
+
}
|
|
75133
75216
|
const left = gantt.stateManager.scroll.horizontalBarPos;
|
|
75134
75217
|
const top = gantt.stateManager.scroll.verticalBarPos;
|
|
75135
75218
|
gantt.scenegraph.setX(-left);
|
|
75136
75219
|
gantt.scenegraph.setY(-top);
|
|
75220
|
+
};
|
|
75221
|
+
const originalUpdateSortState = taskListTableInstance.updateSortState?.bind(taskListTableInstance);
|
|
75222
|
+
if (originalUpdateSortState) {
|
|
75223
|
+
taskListTableInstance.updateSortState = (...args) => {
|
|
75224
|
+
const result = originalUpdateSortState(...args);
|
|
75225
|
+
syncTaskBarsAfterSort();
|
|
75226
|
+
return result;
|
|
75227
|
+
};
|
|
75228
|
+
}
|
|
75229
|
+
taskListTableInstance._vtableGanttSortSyncPatched = true;
|
|
75230
|
+
taskListTableInstance.on('after_sort', () => {
|
|
75231
|
+
syncTaskBarsAfterSort();
|
|
75137
75232
|
});
|
|
75138
75233
|
}
|
|
75139
75234
|
function syncDragOrderFromTable(gantt) {
|
|
@@ -75381,6 +75476,7 @@
|
|
|
75381
75476
|
if (target.name === 'task-bar-hover-shadow') {
|
|
75382
75477
|
target = target.parent;
|
|
75383
75478
|
}
|
|
75479
|
+
syncTaskBarNodeRecord(target, this._gantt);
|
|
75384
75480
|
this.moveTaskBar.moving = true;
|
|
75385
75481
|
this.moveTaskBar.target = target;
|
|
75386
75482
|
this.moveTaskBar.targetStartX = target.attribute.x;
|
|
@@ -75419,10 +75515,12 @@
|
|
|
75419
75515
|
const newEndDate = new Date(newStartDate.getTime() +
|
|
75420
75516
|
(createDateAtMidnight(oldEndDate).getTime() - createDateAtMidnight(oldStartDate).getTime()));
|
|
75421
75517
|
let dateChanged;
|
|
75518
|
+
let reorderedTaskShowIndex;
|
|
75422
75519
|
if (createDateAtMidnight(oldStartDate).getTime() !== newStartDate.getTime()) {
|
|
75423
75520
|
dateChanged = createDateAtMidnight(oldStartDate).getTime() > newStartDate.getTime() ? 'left' : 'right';
|
|
75424
75521
|
this._gantt._updateStartEndDateToTaskRecord(newStartDate, newEndDate, taskIndex, sub_task_index);
|
|
75425
|
-
const newRecord =
|
|
75522
|
+
const newRecord = target.record;
|
|
75523
|
+
reorderedTaskShowIndex = getTaskShowIndexByTaskRecord(newRecord, this._gantt);
|
|
75426
75524
|
if (this._gantt.hasListeners(GANTT_EVENT_TYPE.CHANGE_DATE_RANGE)) {
|
|
75427
75525
|
this._gantt.fireListeners(GANTT_EVENT_TYPE.CHANGE_DATE_RANGE, {
|
|
75428
75526
|
startDate: newRecord[this._gantt.parsedOptions.startDateField],
|
|
@@ -75434,7 +75532,7 @@
|
|
|
75434
75532
|
});
|
|
75435
75533
|
}
|
|
75436
75534
|
const indexs = getTaskIndexsByTaskY(targetEndY, this._gantt);
|
|
75437
|
-
const newRowIndex = indexs.task_index;
|
|
75535
|
+
const newRowIndex = isValid$1(reorderedTaskShowIndex) ? reorderedTaskShowIndex : indexs.task_index;
|
|
75438
75536
|
if (this._gantt.hasListeners(GANTT_EVENT_TYPE.MOVE_END_TASK_BAR)) {
|
|
75439
75537
|
this._gantt.fireListeners(GANTT_EVENT_TYPE.MOVE_END_TASK_BAR, {
|
|
75440
75538
|
startDate: newRecord[this._gantt.parsedOptions.startDateField],
|
|
@@ -75489,34 +75587,44 @@
|
|
|
75489
75587
|
}
|
|
75490
75588
|
}
|
|
75491
75589
|
else {
|
|
75492
|
-
|
|
75493
|
-
|
|
75494
|
-
|
|
75495
|
-
|
|
75590
|
+
if (dateChanged && isValid$1(reorderedTaskShowIndex) && reorderedTaskShowIndex !== taskIndex) {
|
|
75591
|
+
this._gantt._syncPropsFromTable();
|
|
75592
|
+
this._gantt.scenegraph.refreshTaskBarsAndGrid();
|
|
75593
|
+
const left = this._gantt.stateManager.scroll.horizontalBarPos;
|
|
75594
|
+
const top = this._gantt.stateManager.scroll.verticalBarPos;
|
|
75595
|
+
this._gantt.scenegraph.setX(-left);
|
|
75596
|
+
this._gantt.scenegraph.setY(-top);
|
|
75496
75597
|
}
|
|
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);
|
|
75598
|
+
else {
|
|
75599
|
+
let newX = startDateColIndex >= 1 ? this._gantt.getDateColsWidth(0, startDateColIndex - 1) : 0;
|
|
75600
|
+
if (target.record.type === TaskType.MILESTONE) {
|
|
75601
|
+
const milestoneTaskbarHeight = this._gantt.parsedOptions.taskBarMilestoneStyle.width;
|
|
75602
|
+
newX -= milestoneTaskbarHeight / 2;
|
|
75508
75603
|
}
|
|
75509
|
-
|
|
75510
|
-
|
|
75511
|
-
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75515
|
-
|
|
75516
|
-
|
|
75604
|
+
moveTaskBar(target, newX - target.attribute.x, targetEndY - target.attribute.y, this);
|
|
75605
|
+
if (dateChanged === 'right') {
|
|
75606
|
+
let insertAfterNode = target;
|
|
75607
|
+
while (insertAfterNode.nextSibling &&
|
|
75608
|
+
insertAfterNode.nextSibling.attribute.y === target.attribute.y &&
|
|
75609
|
+
insertAfterNode.nextSibling.record[this._gantt.parsedOptions.startDateField] <=
|
|
75610
|
+
target.record[this._gantt.parsedOptions.startDateField]) {
|
|
75611
|
+
insertAfterNode = insertAfterNode.nextSibling;
|
|
75612
|
+
}
|
|
75613
|
+
if (insertAfterNode !== target) {
|
|
75614
|
+
insertAfterNode.parent.insertAfter(target, insertAfterNode);
|
|
75615
|
+
}
|
|
75517
75616
|
}
|
|
75518
|
-
if (
|
|
75519
|
-
insertBeforeNode
|
|
75617
|
+
else if (dateChanged === 'left') {
|
|
75618
|
+
let insertBeforeNode = target;
|
|
75619
|
+
while (insertBeforeNode.previousSibling &&
|
|
75620
|
+
insertBeforeNode.previousSibling.attribute.y === target.attribute.y &&
|
|
75621
|
+
insertBeforeNode.previousSibling.record[this._gantt.parsedOptions.startDateField] >=
|
|
75622
|
+
target.record[this._gantt.parsedOptions.startDateField]) {
|
|
75623
|
+
insertBeforeNode = insertBeforeNode.previousSibling;
|
|
75624
|
+
}
|
|
75625
|
+
if (insertBeforeNode !== target) {
|
|
75626
|
+
insertBeforeNode.parent.insertBefore(target, insertBeforeNode);
|
|
75627
|
+
}
|
|
75520
75628
|
}
|
|
75521
75629
|
}
|
|
75522
75630
|
}
|
|
@@ -75632,6 +75740,7 @@
|
|
|
75632
75740
|
gantt.scenegraph.updateNextFrame();
|
|
75633
75741
|
}
|
|
75634
75742
|
startResizeTaskBar(target, x, y, startOffsetY, onIconName) {
|
|
75743
|
+
syncTaskBarNodeRecord(target, this._gantt);
|
|
75635
75744
|
this.resizeTaskBar.onIconName = onIconName;
|
|
75636
75745
|
this.resizeTaskBar.resizing = true;
|
|
75637
75746
|
this.resizeTaskBar.target = target;
|
|
@@ -75733,6 +75842,7 @@
|
|
|
75733
75842
|
this._gantt.scenegraph.updateNextFrame();
|
|
75734
75843
|
}
|
|
75735
75844
|
startAdjustProgressBar(target, x, y) {
|
|
75845
|
+
syncTaskBarNodeRecord(target, this._gantt);
|
|
75736
75846
|
if (!target || !target.record) {
|
|
75737
75847
|
return;
|
|
75738
75848
|
}
|
|
@@ -76164,6 +76274,27 @@
|
|
|
76164
76274
|
}
|
|
76165
76275
|
}
|
|
76166
76276
|
}
|
|
76277
|
+
function syncTaskBarNodeRecord(target, gantt) {
|
|
76278
|
+
if (!target) {
|
|
76279
|
+
return;
|
|
76280
|
+
}
|
|
76281
|
+
target.record = gantt.getRecordByIndex(target.task_index, target.sub_task_index);
|
|
76282
|
+
}
|
|
76283
|
+
function getTaskShowIndexByTaskRecord(record, gantt) {
|
|
76284
|
+
if (!record) {
|
|
76285
|
+
return undefined;
|
|
76286
|
+
}
|
|
76287
|
+
const taskKeyField = gantt.parsedOptions.taskKeyField;
|
|
76288
|
+
const taskKey = record?.[taskKeyField];
|
|
76289
|
+
if (!isValid$1(taskKey)) {
|
|
76290
|
+
return undefined;
|
|
76291
|
+
}
|
|
76292
|
+
const matchedRecord = findRecordByTaskKey(gantt.records, taskKeyField, taskKey);
|
|
76293
|
+
if (!matchedRecord) {
|
|
76294
|
+
return undefined;
|
|
76295
|
+
}
|
|
76296
|
+
return gantt.getTaskShowIndexByRecordIndex(matchedRecord.index);
|
|
76297
|
+
}
|
|
76167
76298
|
function moveTaskBar(target, dx, dy, state) {
|
|
76168
76299
|
const taskIndex = target.task_index;
|
|
76169
76300
|
const sub_task_index = target.sub_task_index;
|
|
@@ -78052,6 +78183,23 @@
|
|
|
78052
78183
|
_updateRecordToListTable(record, index) {
|
|
78053
78184
|
this.taskListTableInstance.updateRecords([record], [index]);
|
|
78054
78185
|
}
|
|
78186
|
+
_refreshSortedTaskBarsAfterRecordUpdate(recordIndex, taskShowIndex) {
|
|
78187
|
+
const sortState = this.taskListTableInstance?.sortState;
|
|
78188
|
+
if (!sortState || (Array.isArray(sortState) && sortState.length === 0)) {
|
|
78189
|
+
return false;
|
|
78190
|
+
}
|
|
78191
|
+
const nextTaskShowIndex = this.getTaskShowIndexByRecordIndex(recordIndex);
|
|
78192
|
+
if (!isValid$1(nextTaskShowIndex) || nextTaskShowIndex === taskShowIndex) {
|
|
78193
|
+
return false;
|
|
78194
|
+
}
|
|
78195
|
+
this._syncPropsFromTable();
|
|
78196
|
+
this.scenegraph.refreshTaskBarsAndGrid();
|
|
78197
|
+
const left = this.stateManager.scroll.horizontalBarPos;
|
|
78198
|
+
const top = this.stateManager.scroll.verticalBarPos;
|
|
78199
|
+
this.scenegraph.setX(-left);
|
|
78200
|
+
this.scenegraph.setY(-top);
|
|
78201
|
+
return true;
|
|
78202
|
+
}
|
|
78055
78203
|
getTaskInfoByTaskListIndex(taskShowIndex, sub_task_index) {
|
|
78056
78204
|
const taskRecord = this.getRecordByIndex(taskShowIndex, sub_task_index);
|
|
78057
78205
|
const isMilestone = taskRecord?.type;
|
|
@@ -78154,11 +78302,12 @@
|
|
|
78154
78302
|
const newStartDate = formatDate(startDate, dateFormat);
|
|
78155
78303
|
taskRecord[startDateField] = newStartDate;
|
|
78156
78304
|
if (!isValid$1(sub_task_index)) {
|
|
78157
|
-
const
|
|
78158
|
-
this._updateRecordToListTable(taskRecord,
|
|
78159
|
-
if (Array.isArray(
|
|
78160
|
-
this.stateManager.updateProjectTaskTimes(
|
|
78305
|
+
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
78306
|
+
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
|
|
78307
|
+
if (Array.isArray(recordIndex)) {
|
|
78308
|
+
this.stateManager.updateProjectTaskTimes(recordIndex);
|
|
78161
78309
|
}
|
|
78310
|
+
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
|
|
78162
78311
|
}
|
|
78163
78312
|
else if (Array.isArray(sub_task_index)) {
|
|
78164
78313
|
this.stateManager.updateProjectTaskTimes(sub_task_index);
|
|
@@ -78171,11 +78320,12 @@
|
|
|
78171
78320
|
const newEndDate = formatDate(endDate, dateFormat);
|
|
78172
78321
|
taskRecord[endDateField] = newEndDate;
|
|
78173
78322
|
if (!isValid$1(sub_task_index)) {
|
|
78174
|
-
const
|
|
78175
|
-
this._updateRecordToListTable(taskRecord,
|
|
78176
|
-
if (Array.isArray(
|
|
78177
|
-
this.stateManager.updateProjectTaskTimes(
|
|
78323
|
+
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
78324
|
+
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
|
|
78325
|
+
if (Array.isArray(recordIndex)) {
|
|
78326
|
+
this.stateManager.updateProjectTaskTimes(recordIndex);
|
|
78178
78327
|
}
|
|
78328
|
+
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
|
|
78179
78329
|
}
|
|
78180
78330
|
else if (Array.isArray(sub_task_index)) {
|
|
78181
78331
|
this.stateManager.updateProjectTaskTimes(sub_task_index);
|
|
@@ -78191,11 +78341,12 @@
|
|
|
78191
78341
|
const newEndDate = formatDate(endDate, dateFormat);
|
|
78192
78342
|
taskRecord[endDateField] = newEndDate;
|
|
78193
78343
|
if (!isValid$1(sub_task_index)) {
|
|
78194
|
-
const
|
|
78195
|
-
this._updateRecordToListTable(taskRecord,
|
|
78196
|
-
if (Array.isArray(
|
|
78197
|
-
this.stateManager.updateProjectTaskTimes(
|
|
78344
|
+
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
78345
|
+
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
|
|
78346
|
+
if (Array.isArray(recordIndex)) {
|
|
78347
|
+
this.stateManager.updateProjectTaskTimes(recordIndex);
|
|
78198
78348
|
}
|
|
78349
|
+
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index);
|
|
78199
78350
|
}
|
|
78200
78351
|
else if (Array.isArray(sub_task_index)) {
|
|
78201
78352
|
this.stateManager.updateProjectTaskTimes(sub_task_index);
|
|
@@ -78206,9 +78357,11 @@
|
|
|
78206
78357
|
const progressField = this.parsedOptions.progressField;
|
|
78207
78358
|
if (progressField) {
|
|
78208
78359
|
taskRecord[progressField] = progress;
|
|
78209
|
-
const
|
|
78210
|
-
this._updateRecordToListTable(taskRecord,
|
|
78211
|
-
this.
|
|
78360
|
+
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
78361
|
+
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index);
|
|
78362
|
+
if (!this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index)) {
|
|
78363
|
+
this._refreshTaskBar(index, sub_task_index);
|
|
78364
|
+
}
|
|
78212
78365
|
}
|
|
78213
78366
|
}
|
|
78214
78367
|
_dragOrderTaskRecord(source_index, source_sub_task_index, target_index, target_sub_task_index) {
|