@wimi/vtable-gantt 1.0.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/README.md +213 -0
- package/README.zh-CN.md +215 -0
- package/cjs/Gantt.d.ts +200 -0
- package/cjs/Gantt.js +582 -0
- package/cjs/Gantt.js.map +1 -0
- package/cjs/components/Menu.d.ts +1 -0
- package/cjs/components/Menu.js +1 -0
- package/cjs/components/Menu.js.map +1 -0
- package/cjs/components/MenuElementStyle.d.ts +1 -0
- package/cjs/components/MenuElementStyle.js +12 -0
- package/cjs/components/MenuElementStyle.js.map +1 -0
- package/cjs/data/DataSource.d.ts +9 -0
- package/cjs/data/DataSource.js +76 -0
- package/cjs/data/DataSource.js.map +1 -0
- package/cjs/env.d.ts +19 -0
- package/cjs/env.js +48 -0
- package/cjs/env.js.map +1 -0
- package/cjs/event/EventHandler.d.ts +47 -0
- package/cjs/event/EventHandler.js +128 -0
- package/cjs/event/EventHandler.js.map +1 -0
- package/cjs/event/EventTarget.d.ts +12 -0
- package/cjs/event/EventTarget.js +67 -0
- package/cjs/event/EventTarget.js.map +1 -0
- package/cjs/event/event-manager.d.ts +34 -0
- package/cjs/event/event-manager.js +369 -0
- package/cjs/event/event-manager.js.map +1 -0
- package/cjs/event/scroll.d.ts +8 -0
- package/cjs/event/scroll.js +112 -0
- package/cjs/event/scroll.js.map +1 -0
- package/cjs/event/touch.d.ts +2 -0
- package/cjs/event/touch.js +86 -0
- package/cjs/event/touch.js.map +1 -0
- package/cjs/gantt-helper.d.ts +63 -0
- package/cjs/gantt-helper.js +712 -0
- package/cjs/gantt-helper.js.map +1 -0
- package/cjs/index.d.ts +10 -0
- package/cjs/index.js +60 -0
- package/cjs/index.js.map +1 -0
- package/cjs/plugins/index.d.ts +2 -0
- package/cjs/plugins/index.js +15 -0
- package/cjs/plugins/index.js.map +1 -0
- package/cjs/plugins/interface.d.ts +10 -0
- package/cjs/plugins/interface.js +6 -0
- package/cjs/plugins/interface.js.map +1 -0
- package/cjs/plugins/plugin-manager.d.ts +16 -0
- package/cjs/plugins/plugin-manager.js +63 -0
- package/cjs/plugins/plugin-manager.js.map +1 -0
- package/cjs/register.d.ts +1 -0
- package/cjs/register.js +1 -0
- package/cjs/register.js.map +1 -0
- package/cjs/scenegraph/dependency-link.d.ts +48 -0
- package/cjs/scenegraph/dependency-link.js +480 -0
- package/cjs/scenegraph/dependency-link.js.map +1 -0
- package/cjs/scenegraph/drag-order-line.d.ts +12 -0
- package/cjs/scenegraph/drag-order-line.js +49 -0
- package/cjs/scenegraph/drag-order-line.js.map +1 -0
- package/cjs/scenegraph/frame-border.d.ts +10 -0
- package/cjs/scenegraph/frame-border.js +58 -0
- package/cjs/scenegraph/frame-border.js.map +1 -0
- package/cjs/scenegraph/gantt-node.d.ts +22 -0
- package/cjs/scenegraph/gantt-node.js +66 -0
- package/cjs/scenegraph/gantt-node.js.map +1 -0
- package/cjs/scenegraph/graphic/group-contribution-render.d.ts +12 -0
- package/cjs/scenegraph/graphic/group-contribution-render.js +37 -0
- package/cjs/scenegraph/graphic/group-contribution-render.js.map +1 -0
- package/cjs/scenegraph/graphic/index.d.ts +3 -0
- package/cjs/scenegraph/graphic/index.js +13 -0
- package/cjs/scenegraph/graphic/index.js.map +1 -0
- package/cjs/scenegraph/grid.d.ts +34 -0
- package/cjs/scenegraph/grid.js +316 -0
- package/cjs/scenegraph/grid.js.map +1 -0
- package/cjs/scenegraph/mark-line.d.ts +13 -0
- package/cjs/scenegraph/mark-line.js +109 -0
- package/cjs/scenegraph/mark-line.js.map +1 -0
- package/cjs/scenegraph/scenegraph.d.ts +59 -0
- package/cjs/scenegraph/scenegraph.js +240 -0
- package/cjs/scenegraph/scenegraph.js.map +1 -0
- package/cjs/scenegraph/scroll-bar.d.ts +19 -0
- package/cjs/scenegraph/scroll-bar.js +150 -0
- package/cjs/scenegraph/scroll-bar.js.map +1 -0
- package/cjs/scenegraph/task-bar.d.ts +40 -0
- package/cjs/scenegraph/task-bar.js +476 -0
- package/cjs/scenegraph/task-bar.js.map +1 -0
- package/cjs/scenegraph/task-creation-button.d.ts +13 -0
- package/cjs/scenegraph/task-creation-button.js +86 -0
- package/cjs/scenegraph/task-creation-button.js.map +1 -0
- package/cjs/scenegraph/timeline-header.d.ts +14 -0
- package/cjs/scenegraph/timeline-header.js +190 -0
- package/cjs/scenegraph/timeline-header.js.map +1 -0
- package/cjs/scenegraph/tooltip.d.ts +9 -0
- package/cjs/scenegraph/tooltip.js +59 -0
- package/cjs/scenegraph/tooltip.js.map +1 -0
- package/cjs/state/gantt-table-sync.d.ts +8 -0
- package/cjs/state/gantt-table-sync.js +96 -0
- package/cjs/state/gantt-table-sync.js.map +1 -0
- package/cjs/state/state-manager.d.ts +127 -0
- package/cjs/state/state-manager.js +634 -0
- package/cjs/state/state-manager.js.map +1 -0
- package/cjs/sub-tasks-inline-helper.d.ts +1 -0
- package/cjs/sub-tasks-inline-helper.js +1 -0
- package/cjs/sub-tasks-inline-helper.js.map +1 -0
- package/cjs/themes.d.ts +1 -0
- package/cjs/themes.js +1 -0
- package/cjs/themes.js.map +1 -0
- package/cjs/tools/debounce.d.ts +1 -0
- package/cjs/tools/debounce.js +51 -0
- package/cjs/tools/debounce.js.map +1 -0
- package/cjs/tools/dom.d.ts +1 -0
- package/cjs/tools/dom.js +11 -0
- package/cjs/tools/dom.js.map +1 -0
- package/cjs/tools/index.d.ts +2 -0
- package/cjs/tools/index.js +30 -0
- package/cjs/tools/index.js.map +1 -0
- package/cjs/tools/inertia.d.ts +15 -0
- package/cjs/tools/inertia.js +40 -0
- package/cjs/tools/inertia.js.map +1 -0
- package/cjs/tools/isx.d.ts +16 -0
- package/cjs/tools/isx.js +117 -0
- package/cjs/tools/isx.js.map +1 -0
- package/cjs/tools/pixel-ratio.d.ts +2 -0
- package/cjs/tools/pixel-ratio.js +16 -0
- package/cjs/tools/pixel-ratio.js.map +1 -0
- package/cjs/tools/util.d.ts +19 -0
- package/cjs/tools/util.js +404 -0
- package/cjs/tools/util.js.map +1 -0
- package/cjs/ts-types/EVENT_TYPE.d.ts +19 -0
- package/cjs/ts-types/EVENT_TYPE.js +22 -0
- package/cjs/ts-types/EVENT_TYPE.js.map +1 -0
- package/cjs/ts-types/common.d.ts +11 -0
- package/cjs/ts-types/common.js +10 -0
- package/cjs/ts-types/common.js.map +1 -0
- package/cjs/ts-types/events.d.ts +132 -0
- package/cjs/ts-types/events.js +6 -0
- package/cjs/ts-types/events.js.map +1 -0
- package/cjs/ts-types/gantt-engine.d.ts +344 -0
- package/cjs/ts-types/gantt-engine.js +18 -0
- package/cjs/ts-types/gantt-engine.js.map +1 -0
- package/cjs/ts-types/index.d.ts +5 -0
- package/cjs/ts-types/index.js +23 -0
- package/cjs/ts-types/index.js.map +1 -0
- package/cjs/ts-types/zoom-scale.d.ts +32 -0
- package/cjs/ts-types/zoom-scale.js +6 -0
- package/cjs/ts-types/zoom-scale.js.map +1 -0
- package/cjs/vrender.d.ts +1 -0
- package/cjs/vrender.js +60 -0
- package/cjs/vrender.js.map +1 -0
- package/cjs/vtable.d.ts +1 -0
- package/cjs/vtable.js +35 -0
- package/cjs/vtable.js.map +1 -0
- package/cjs/zoom-scale/DataZoomIntegration.d.ts +50 -0
- package/cjs/zoom-scale/DataZoomIntegration.js +261 -0
- package/cjs/zoom-scale/DataZoomIntegration.js.map +1 -0
- package/cjs/zoom-scale/ZoomScaleManager.d.ts +55 -0
- package/cjs/zoom-scale/ZoomScaleManager.js +328 -0
- package/cjs/zoom-scale/ZoomScaleManager.js.map +1 -0
- package/cjs/zoom-scale/index.d.ts +4 -0
- package/cjs/zoom-scale/index.js +24 -0
- package/cjs/zoom-scale/index.js.map +1 -0
- package/dist/vtable-gantt.js +76328 -0
- package/dist/vtable-gantt.min.js +15 -0
- package/es/Gantt.d.ts +200 -0
- package/es/Gantt.js +584 -0
- package/es/Gantt.js.map +1 -0
- package/es/components/Menu.d.ts +1 -0
- package/es/components/Menu.js +1 -0
- package/es/components/Menu.js.map +1 -0
- package/es/components/MenuElementStyle.d.ts +1 -0
- package/es/components/MenuElementStyle.js +6 -0
- package/es/components/MenuElementStyle.js.map +1 -0
- package/es/data/DataSource.d.ts +9 -0
- package/es/data/DataSource.js +63 -0
- package/es/data/DataSource.js.map +1 -0
- package/es/env.d.ts +19 -0
- package/es/env.js +42 -0
- package/es/env.js.map +1 -0
- package/es/event/EventHandler.d.ts +47 -0
- package/es/event/EventHandler.js +119 -0
- package/es/event/EventHandler.js.map +1 -0
- package/es/event/EventTarget.d.ts +12 -0
- package/es/event/EventTarget.js +58 -0
- package/es/event/EventTarget.js.map +1 -0
- package/es/event/event-manager.d.ts +34 -0
- package/es/event/event-manager.js +376 -0
- package/es/event/event-manager.js.map +1 -0
- package/es/event/scroll.d.ts +8 -0
- package/es/event/scroll.js +104 -0
- package/es/event/scroll.js.map +1 -0
- package/es/event/touch.d.ts +2 -0
- package/es/event/touch.js +78 -0
- package/es/event/touch.js.map +1 -0
- package/es/gantt-helper.d.ts +63 -0
- package/es/gantt-helper.js +683 -0
- package/es/gantt-helper.js.map +1 -0
- package/es/index.d.ts +10 -0
- package/es/index.js +16 -0
- package/es/index.js.map +1 -0
- package/es/plugins/index.d.ts +2 -0
- package/es/plugins/index.js +2 -0
- package/es/plugins/index.js.map +1 -0
- package/es/plugins/interface.d.ts +10 -0
- package/es/plugins/interface.js +2 -0
- package/es/plugins/interface.js.map +1 -0
- package/es/plugins/plugin-manager.d.ts +16 -0
- package/es/plugins/plugin-manager.js +55 -0
- package/es/plugins/plugin-manager.js.map +1 -0
- package/es/register.d.ts +1 -0
- package/es/register.js +1 -0
- package/es/register.js.map +1 -0
- package/es/scenegraph/dependency-link.d.ts +48 -0
- package/es/scenegraph/dependency-link.js +462 -0
- package/es/scenegraph/dependency-link.js.map +1 -0
- package/es/scenegraph/drag-order-line.d.ts +12 -0
- package/es/scenegraph/drag-order-line.js +40 -0
- package/es/scenegraph/drag-order-line.js.map +1 -0
- package/es/scenegraph/frame-border.d.ts +10 -0
- package/es/scenegraph/frame-border.js +51 -0
- package/es/scenegraph/frame-border.js.map +1 -0
- package/es/scenegraph/gantt-node.d.ts +22 -0
- package/es/scenegraph/gantt-node.js +64 -0
- package/es/scenegraph/gantt-node.js.map +1 -0
- package/es/scenegraph/graphic/group-contribution-render.d.ts +12 -0
- package/es/scenegraph/graphic/group-contribution-render.js +32 -0
- package/es/scenegraph/graphic/group-contribution-render.js.map +1 -0
- package/es/scenegraph/graphic/index.d.ts +3 -0
- package/es/scenegraph/graphic/index.js +8 -0
- package/es/scenegraph/graphic/index.js.map +1 -0
- package/es/scenegraph/grid.d.ts +34 -0
- package/es/scenegraph/grid.js +306 -0
- package/es/scenegraph/grid.js.map +1 -0
- package/es/scenegraph/mark-line.d.ts +13 -0
- package/es/scenegraph/mark-line.js +101 -0
- package/es/scenegraph/mark-line.js.map +1 -0
- package/es/scenegraph/scenegraph.d.ts +59 -0
- package/es/scenegraph/scenegraph.js +250 -0
- package/es/scenegraph/scenegraph.js.map +1 -0
- package/es/scenegraph/scroll-bar.d.ts +19 -0
- package/es/scenegraph/scroll-bar.js +144 -0
- package/es/scenegraph/scroll-bar.js.map +1 -0
- package/es/scenegraph/task-bar.d.ts +40 -0
- package/es/scenegraph/task-bar.js +475 -0
- package/es/scenegraph/task-bar.js.map +1 -0
- package/es/scenegraph/task-creation-button.d.ts +13 -0
- package/es/scenegraph/task-creation-button.js +78 -0
- package/es/scenegraph/task-creation-button.js.map +1 -0
- package/es/scenegraph/timeline-header.d.ts +14 -0
- package/es/scenegraph/timeline-header.js +186 -0
- package/es/scenegraph/timeline-header.js.map +1 -0
- package/es/scenegraph/tooltip.d.ts +9 -0
- package/es/scenegraph/tooltip.js +51 -0
- package/es/scenegraph/tooltip.js.map +1 -0
- package/es/state/gantt-table-sync.d.ts +8 -0
- package/es/state/gantt-table-sync.js +87 -0
- package/es/state/gantt-table-sync.js.map +1 -0
- package/es/state/state-manager.d.ts +127 -0
- package/es/state/state-manager.js +631 -0
- package/es/state/state-manager.js.map +1 -0
- package/es/sub-tasks-inline-helper.d.ts +1 -0
- package/es/sub-tasks-inline-helper.js +1 -0
- package/es/sub-tasks-inline-helper.js.map +1 -0
- package/es/themes.d.ts +1 -0
- package/es/themes.js +1 -0
- package/es/themes.js.map +1 -0
- package/es/tools/debounce.d.ts +1 -0
- package/es/tools/debounce.js +45 -0
- package/es/tools/debounce.js.map +1 -0
- package/es/tools/dom.d.ts +1 -0
- package/es/tools/dom.js +5 -0
- package/es/tools/dom.js.map +1 -0
- package/es/tools/index.d.ts +2 -0
- package/es/tools/index.js +4 -0
- package/es/tools/index.js.map +1 -0
- package/es/tools/inertia.d.ts +15 -0
- package/es/tools/inertia.js +31 -0
- package/es/tools/inertia.js.map +1 -0
- package/es/tools/isx.d.ts +16 -0
- package/es/tools/isx.js +80 -0
- package/es/tools/isx.js.map +1 -0
- package/es/tools/pixel-ratio.d.ts +2 -0
- package/es/tools/pixel-ratio.js +12 -0
- package/es/tools/pixel-ratio.js.map +1 -0
- package/es/tools/util.d.ts +19 -0
- package/es/tools/util.js +390 -0
- package/es/tools/util.js.map +1 -0
- package/es/ts-types/EVENT_TYPE.d.ts +19 -0
- package/es/ts-types/EVENT_TYPE.js +18 -0
- package/es/ts-types/EVENT_TYPE.js.map +1 -0
- package/es/ts-types/common.d.ts +11 -0
- package/es/ts-types/common.js +6 -0
- package/es/ts-types/common.js.map +1 -0
- package/es/ts-types/events.d.ts +132 -0
- package/es/ts-types/events.js +2 -0
- package/es/ts-types/events.js.map +1 -0
- package/es/ts-types/gantt-engine.d.ts +344 -0
- package/es/ts-types/gantt-engine.js +21 -0
- package/es/ts-types/gantt-engine.js.map +1 -0
- package/es/ts-types/index.d.ts +5 -0
- package/es/ts-types/index.js +10 -0
- package/es/ts-types/index.js.map +1 -0
- package/es/ts-types/zoom-scale.d.ts +32 -0
- package/es/ts-types/zoom-scale.js +2 -0
- package/es/ts-types/zoom-scale.js.map +1 -0
- package/es/vrender.d.ts +1 -0
- package/es/vrender.js +2 -0
- package/es/vrender.js.map +1 -0
- package/es/vtable.d.ts +1 -0
- package/es/vtable.js +2 -0
- package/es/vtable.js.map +1 -0
- package/es/zoom-scale/DataZoomIntegration.d.ts +50 -0
- package/es/zoom-scale/DataZoomIntegration.js +253 -0
- package/es/zoom-scale/DataZoomIntegration.js.map +1 -0
- package/es/zoom-scale/ZoomScaleManager.d.ts +55 -0
- package/es/zoom-scale/ZoomScaleManager.js +322 -0
- package/es/zoom-scale/ZoomScaleManager.js.map +1 -0
- package/es/zoom-scale/index.d.ts +4 -0
- package/es/zoom-scale/index.js +4 -0
- package/es/zoom-scale/index.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.initProjectTaskTimes = exports.checkHasChildTasks = exports.judgeIfHasMarkLine = exports.getNodeClickPos = exports._getTaskInfoByXYForCreateSchedule = exports.updateOptionsWhenMarkLineChanged = exports.updateOptionsWhenDateRangeChanged = exports.updateOptionsWhenRecordChanged = exports.formatRecordDateConsiderHasHour = exports.getSubTaskRowIndexByRecordDate = exports.computeRowsCountByRecordDate = exports.computeRowsCountByRecordDateForCompact = exports.getTaskIndexsByTaskY = exports.clearRecordShowIndex = exports.clearRecordLinkInfos = exports.findRecordByTaskKey = exports.updateSplitLineAndResizeLine = exports.createSplitLineAndResizeLine = exports.convertProgress = exports.getTextPos = exports.generateTimeLineDate = exports.updateOptionsWhenScaleChanged = exports.initOptions = exports.isNode = exports.getVerticalScrollBarSize = exports.getHorizontalScrollBarSize = exports.generateMarkLine = exports.getDateIndexByX = exports.DayTimes = exports.defaultTaskBarStyle = void 0;
|
|
6
|
+
|
|
7
|
+
const ts_types_1 = require("./ts-types"), util_1 = require("./tools/util");
|
|
8
|
+
|
|
9
|
+
function setWidthToDefaultTaskBarStyle(width) {
|
|
10
|
+
exports.defaultTaskBarStyle.width = width;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.defaultTaskBarStyle = {
|
|
14
|
+
barColor: "blue",
|
|
15
|
+
completedBarColor: "gray",
|
|
16
|
+
width: 30,
|
|
17
|
+
cornerRadius: 3,
|
|
18
|
+
borderWidth: 0,
|
|
19
|
+
fontFamily: "Arial",
|
|
20
|
+
fontSize: 14
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const isNode = "undefined" == typeof window || void 0 === window.window;
|
|
24
|
+
|
|
25
|
+
function getDateIndexByX(x, gantt) {
|
|
26
|
+
const totalX = x + gantt.stateManager.scroll.horizontalBarPos, firstDateColWidth = gantt.getDateColWidth(0);
|
|
27
|
+
return Math.floor((totalX - firstDateColWidth) / gantt.parsedOptions.timelineColWidth) + 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function generateMarkLine(markLine) {
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
32
|
+
return markLine ? !0 === markLine ? [ {
|
|
33
|
+
date: (0, util_1.createDateAtMidnight)().toLocaleDateString(),
|
|
34
|
+
content: "",
|
|
35
|
+
scrollToMarkLine: !0,
|
|
36
|
+
position: "left",
|
|
37
|
+
style: {
|
|
38
|
+
lineColor: "red",
|
|
39
|
+
lineWidth: 1
|
|
40
|
+
}
|
|
41
|
+
} ] : Array.isArray(markLine) ? markLine.map(((item, index) => {
|
|
42
|
+
var _a, _b, _c, _d;
|
|
43
|
+
return Object.assign(Object.assign({}, item), {
|
|
44
|
+
date: item.date,
|
|
45
|
+
scrollToMarkLine: item.scrollToMarkLine,
|
|
46
|
+
position: null !== (_a = item.position) && void 0 !== _a ? _a : "left",
|
|
47
|
+
style: {
|
|
48
|
+
lineColor: (null === (_b = item.style) || void 0 === _b ? void 0 : _b.lineColor) || "red",
|
|
49
|
+
lineWidth: (null === (_c = item.style) || void 0 === _c ? void 0 : _c.lineWidth) || 1,
|
|
50
|
+
lineDash: null === (_d = item.style) || void 0 === _d ? void 0 : _d.lineDash
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
})) : [ Object.assign(Object.assign({}, markLine), {
|
|
54
|
+
date: markLine.date,
|
|
55
|
+
scrollToMarkLine: null === (_a = markLine.scrollToMarkLine) || void 0 === _a || _a,
|
|
56
|
+
position: null !== (_b = markLine.position) && void 0 !== _b ? _b : "left",
|
|
57
|
+
style: {
|
|
58
|
+
lineColor: (null === (_c = markLine.style) || void 0 === _c ? void 0 : _c.lineColor) || "red",
|
|
59
|
+
lineWidth: (null === (_d = markLine.style) || void 0 === _d ? void 0 : _d.lineWidth) || 1,
|
|
60
|
+
lineDash: null === (_e = markLine.style) || void 0 === _e ? void 0 : _e.lineDash
|
|
61
|
+
}
|
|
62
|
+
}) ] : [];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getHorizontalScrollBarSize(scrollStyle) {
|
|
66
|
+
var _a;
|
|
67
|
+
return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getVerticalScrollBarSize(scrollStyle) {
|
|
71
|
+
var _a;
|
|
72
|
+
return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function initOptions(gantt) {
|
|
76
|
+
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, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91;
|
|
77
|
+
const options = gantt.options;
|
|
78
|
+
gantt.parsedOptions.tasksShowMode = null !== (_a = null == options ? void 0 : options.tasksShowMode) && void 0 !== _a ? _a : ts_types_1.TasksShowMode.Tasks_Separate,
|
|
79
|
+
gantt.parsedOptions.pixelRatio = null !== (_b = null == options ? void 0 : options.pixelRatio) && void 0 !== _b ? _b : 1,
|
|
80
|
+
gantt.parsedOptions.rowHeight = null !== (_c = null == options ? void 0 : options.rowHeight) && void 0 !== _c ? _c : 40,
|
|
81
|
+
gantt.parsedOptions.timelineColWidth = null !== (_e = null === (_d = null == options ? void 0 : options.timelineHeader) || void 0 === _d ? void 0 : _d.colWidth) && void 0 !== _e ? _e : 60,
|
|
82
|
+
gantt.parsedOptions.startDateField = null !== (_g = null === (_f = options.taskBar) || void 0 === _f ? void 0 : _f.startDateField) && void 0 !== _g ? _g : "startDate",
|
|
83
|
+
gantt.parsedOptions.endDateField = null !== (_j = null === (_h = options.taskBar) || void 0 === _h ? void 0 : _h.endDateField) && void 0 !== _j ? _j : "endDate",
|
|
84
|
+
gantt.parsedOptions.progressField = null !== (_l = null === (_k = options.taskBar) || void 0 === _k ? void 0 : _k.progressField) && void 0 !== _l ? _l : "progress",
|
|
85
|
+
gantt.parsedOptions.taskBarClip = null === (_o = null === (_m = null == options ? void 0 : options.taskBar) || void 0 === _m ? void 0 : _m.clip) || void 0 === _o || _o,
|
|
86
|
+
gantt.parsedOptions.projectSubTasksExpandable = null === (_p = null == options ? void 0 : options.projectSubTasksExpandable) || void 0 === _p || _p;
|
|
87
|
+
const {unit: minTimeUnit, startOfWeek: startOfWeek, step: step} = gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
88
|
+
gantt.parsedOptions.minDate = (null == options ? void 0 : options.minDate) ? (0,
|
|
89
|
+
util_1.getStartDateByTimeUnit)(new Date(options.minDate), minTimeUnit, startOfWeek) : void 0,
|
|
90
|
+
gantt.parsedOptions.maxDate = (null == options ? void 0 : options.maxDate) && (null === (_q = gantt.parsedOptions) || void 0 === _q ? void 0 : _q.minDate) ? (0,
|
|
91
|
+
util_1.getEndDateByTimeUnit)(null === (_r = gantt.parsedOptions) || void 0 === _r ? void 0 : _r.minDate, new Date(options.maxDate), minTimeUnit, step) : void 0,
|
|
92
|
+
gantt.parsedOptions._minDateTime = null === (_s = gantt.parsedOptions.minDate) || void 0 === _s ? void 0 : _s.getTime(),
|
|
93
|
+
gantt.parsedOptions._maxDateTime = null === (_t = gantt.parsedOptions.maxDate) || void 0 === _t ? void 0 : _t.getTime(),
|
|
94
|
+
gantt.parsedOptions.overscrollBehavior = null !== (_u = null == options ? void 0 : options.overscrollBehavior) && void 0 !== _u ? _u : "auto",
|
|
95
|
+
gantt.parsedOptions.underlayBackgroundColor = null !== (_v = null == options ? void 0 : options.underlayBackgroundColor) && void 0 !== _v ? _v : "#FFF",
|
|
96
|
+
gantt.parsedOptions.scrollStyle = Object.assign({}, {
|
|
97
|
+
scrollRailColor: "rgba(100, 100, 100, 0.2)",
|
|
98
|
+
scrollSliderColor: "rgba(100, 100, 100, 0.5)",
|
|
99
|
+
scrollSliderCornerRadius: 4,
|
|
100
|
+
width: 10,
|
|
101
|
+
visible: "always",
|
|
102
|
+
hoverOn: !0,
|
|
103
|
+
barToSide: !1
|
|
104
|
+
}, null == options ? void 0 : options.scrollStyle), gantt.parsedOptions.timelineHeaderHorizontalLineStyle = null === (_w = null == options ? void 0 : options.timelineHeader) || void 0 === _w ? void 0 : _w.horizontalLine,
|
|
105
|
+
gantt.parsedOptions.timelineHeaderVerticalLineStyle = null === (_x = null == options ? void 0 : options.timelineHeader) || void 0 === _x ? void 0 : _x.verticalLine,
|
|
106
|
+
gantt.parsedOptions.timelineHeaderBackgroundColor = null === (_y = null == options ? void 0 : options.timelineHeader) || void 0 === _y ? void 0 : _y.backgroundColor,
|
|
107
|
+
gantt.parsedOptions.timeLineHeaderRowHeights = [], gantt.parsedOptions.timelineHeaderStyles = [];
|
|
108
|
+
for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length; i++) {
|
|
109
|
+
const style = gantt.parsedOptions.sortedTimelineScales[i].style;
|
|
110
|
+
gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
|
|
111
|
+
fontSize: 20,
|
|
112
|
+
fontWeight: "bold",
|
|
113
|
+
textAlign: "center",
|
|
114
|
+
textBaseline: "middle",
|
|
115
|
+
color: "#000",
|
|
116
|
+
backgroundColor: "#fff"
|
|
117
|
+
}, style)), gantt.parsedOptions.timeLineHeaderRowHeights.push(null !== (_0 = null !== (_z = gantt.parsedOptions.sortedTimelineScales[i].rowHeight) && void 0 !== _z ? _z : null == options ? void 0 : options.headerRowHeight) && void 0 !== _0 ? _0 : 40);
|
|
118
|
+
}
|
|
119
|
+
gantt.parsedOptions.grid = Object.assign({}, null == options ? void 0 : options.grid),
|
|
120
|
+
setWidthToDefaultTaskBarStyle(3 * gantt.parsedOptions.rowHeight / 4), gantt.parsedOptions.taskBarStyle = (null === (_1 = null == options ? void 0 : options.taskBar) || void 0 === _1 ? void 0 : _1.barStyle) && "function" == typeof (null === (_2 = null == options ? void 0 : options.taskBar) || void 0 === _2 ? void 0 : _2.barStyle) ? options.taskBar.barStyle : Object.assign({}, exports.defaultTaskBarStyle, null === (_3 = null == options ? void 0 : options.taskBar) || void 0 === _3 ? void 0 : _3.barStyle),
|
|
121
|
+
gantt.parsedOptions.projectBarStyle = (null === (_4 = null == options ? void 0 : options.taskBar) || void 0 === _4 ? void 0 : _4.projectStyle) && "function" == typeof (null === (_5 = null == options ? void 0 : options.taskBar) || void 0 === _5 ? void 0 : _5.projectStyle) ? options.taskBar.projectStyle : (null === (_6 = null == options ? void 0 : options.taskBar) || void 0 === _6 ? void 0 : _6.projectStyle) ? Object.assign({}, exports.defaultTaskBarStyle, null === (_7 = null == options ? void 0 : options.taskBar) || void 0 === _7 ? void 0 : _7.projectStyle) : gantt.parsedOptions.taskBarStyle;
|
|
122
|
+
gantt.parsedOptions.taskBarMilestoneStyle = Object.assign("function" == typeof gantt.parsedOptions.taskBarStyle ? {} : {
|
|
123
|
+
width: gantt.parsedOptions.taskBarStyle.width,
|
|
124
|
+
borderColor: gantt.parsedOptions.taskBarStyle.borderColor,
|
|
125
|
+
borderLineWidth: null !== (_8 = gantt.parsedOptions.taskBarStyle.borderLineWidth) && void 0 !== _8 ? _8 : 1,
|
|
126
|
+
fillColor: gantt.parsedOptions.taskBarStyle.barColor,
|
|
127
|
+
cornerRadius: 0
|
|
128
|
+
}, {
|
|
129
|
+
labelTextStyle: {
|
|
130
|
+
fontSize: 16,
|
|
131
|
+
color: "red",
|
|
132
|
+
fontFamily: "Arial",
|
|
133
|
+
padding: 4
|
|
134
|
+
}
|
|
135
|
+
}, null === (_9 = null == options ? void 0 : options.taskBar) || void 0 === _9 ? void 0 : _9.milestoneStyle),
|
|
136
|
+
gantt.parsedOptions.taskBarMilestoneHypotenuse = gantt.parsedOptions.taskBarMilestoneStyle.width * Math.sqrt(2),
|
|
137
|
+
gantt.parsedOptions.dateFormat = null == options ? void 0 : options.dateFormat,
|
|
138
|
+
gantt.parsedOptions.taskBarHoverStyle = Object.assign({
|
|
139
|
+
barOverlayColor: "rgba(99, 144, 0, 0.4)"
|
|
140
|
+
}, null === (_10 = null == options ? void 0 : options.taskBar) || void 0 === _10 ? void 0 : _10.hoverBarStyle),
|
|
141
|
+
gantt.parsedOptions.taskBarSelectable = null === (_12 = null === (_11 = null == options ? void 0 : options.taskBar) || void 0 === _11 ? void 0 : _11.selectable) || void 0 === _12 || _12,
|
|
142
|
+
gantt.parsedOptions.taskBarSelectedStyle = Object.assign("function" == typeof gantt.parsedOptions.taskBarStyle ? {
|
|
143
|
+
shadowBlur: 6,
|
|
144
|
+
shadowOffsetX: 0,
|
|
145
|
+
shadowOffsetY: 0,
|
|
146
|
+
borderLineWidth: 1
|
|
147
|
+
} : {
|
|
148
|
+
shadowBlur: 6,
|
|
149
|
+
shadowOffsetX: 0,
|
|
150
|
+
shadowOffsetY: 0,
|
|
151
|
+
shadowColor: gantt.parsedOptions.taskBarStyle.barColor,
|
|
152
|
+
borderColor: gantt.parsedOptions.taskBarStyle.barColor,
|
|
153
|
+
borderLineWidth: 1
|
|
154
|
+
}, null === (_13 = null == options ? void 0 : options.taskBar) || void 0 === _13 ? void 0 : _13.selectedBarStyle),
|
|
155
|
+
gantt.parsedOptions.taskBarLabelText = null !== (_15 = null === (_14 = null == options ? void 0 : options.taskBar) || void 0 === _14 ? void 0 : _14.labelText) && void 0 !== _15 ? _15 : "",
|
|
156
|
+
gantt.parsedOptions.taskBarMoveable = null === (_17 = null === (_16 = null == options ? void 0 : options.taskBar) || void 0 === _16 ? void 0 : _16.moveable) || void 0 === _17 || _17,
|
|
157
|
+
gantt.parsedOptions.moveTaskBarToExtendDateRange = null === (_19 = null === (_18 = null == options ? void 0 : options.taskBar) || void 0 === _18 ? void 0 : _18.moveToExtendDateRange) || void 0 === _19 || _19,
|
|
158
|
+
gantt.parsedOptions.taskBarResizable = null === (_21 = null === (_20 = null == options ? void 0 : options.taskBar) || void 0 === _20 ? void 0 : _20.resizable) || void 0 === _21 || _21,
|
|
159
|
+
gantt.parsedOptions.taskBarProgressAdjustable = null !== (_23 = null === (_22 = null == options ? void 0 : options.taskBar) || void 0 === _22 ? void 0 : _22.progressAdjustable) && void 0 !== _23 && _23,
|
|
160
|
+
gantt.parsedOptions.taskBarDragOrder = null === (_25 = null === (_24 = null == options ? void 0 : options.taskBar) || void 0 === _24 ? void 0 : _24.dragOrder) || void 0 === _25 || _25,
|
|
161
|
+
gantt.parsedOptions.taskBarLabelStyle = {
|
|
162
|
+
fontFamily: null !== (_28 = null === (_27 = null === (_26 = null == options ? void 0 : options.taskBar) || void 0 === _26 ? void 0 : _26.labelTextStyle) || void 0 === _27 ? void 0 : _27.fontFamily) && void 0 !== _28 ? _28 : "Arial",
|
|
163
|
+
fontSize: null !== (_31 = null === (_30 = null === (_29 = null == options ? void 0 : options.taskBar) || void 0 === _29 ? void 0 : _29.labelTextStyle) || void 0 === _30 ? void 0 : _30.fontSize) && void 0 !== _31 ? _31 : 20,
|
|
164
|
+
color: null !== (_34 = null === (_33 = null === (_32 = null == options ? void 0 : options.taskBar) || void 0 === _32 ? void 0 : _32.labelTextStyle) || void 0 === _33 ? void 0 : _33.color) && void 0 !== _34 ? _34 : "#F01",
|
|
165
|
+
outsideColor: null !== (_37 = null === (_36 = null === (_35 = null == options ? void 0 : options.taskBar) || void 0 === _35 ? void 0 : _35.labelTextStyle) || void 0 === _36 ? void 0 : _36.outsideColor) && void 0 !== _37 ? _37 : "#333333",
|
|
166
|
+
textAlign: null !== (_40 = null === (_39 = null === (_38 = null == options ? void 0 : options.taskBar) || void 0 === _38 ? void 0 : _38.labelTextStyle) || void 0 === _39 ? void 0 : _39.textAlign) && void 0 !== _40 ? _40 : "left",
|
|
167
|
+
textBaseline: null !== (_43 = null === (_42 = null === (_41 = null == options ? void 0 : options.taskBar) || void 0 === _41 ? void 0 : _41.labelTextStyle) || void 0 === _42 ? void 0 : _42.textBaseline) && void 0 !== _43 ? _43 : "middle",
|
|
168
|
+
padding: null !== (_46 = null === (_45 = null === (_44 = null == options ? void 0 : options.taskBar) || void 0 === _44 ? void 0 : _44.labelTextStyle) || void 0 === _45 ? void 0 : _45.padding) && void 0 !== _46 ? _46 : [ 0, 0, 0, 10 ],
|
|
169
|
+
textOverflow: null === (_48 = null === (_47 = null == options ? void 0 : options.taskBar) || void 0 === _47 ? void 0 : _47.labelTextStyle) || void 0 === _48 ? void 0 : _48.textOverflow,
|
|
170
|
+
orient: null === (_50 = null === (_49 = null == options ? void 0 : options.taskBar) || void 0 === _49 ? void 0 : _49.labelTextStyle) || void 0 === _50 ? void 0 : _50.orient,
|
|
171
|
+
orientHandleWithOverflow: null === (_52 = null === (_51 = null == options ? void 0 : options.taskBar) || void 0 === _51 ? void 0 : _51.labelTextStyle) || void 0 === _52 ? void 0 : _52.orientHandleWithOverflow
|
|
172
|
+
}, gantt.parsedOptions.taskBarCustomLayout = null === (_53 = null == options ? void 0 : options.taskBar) || void 0 === _53 ? void 0 : _53.customLayout,
|
|
173
|
+
gantt.parsedOptions.taskBarCreatable = null !== (_55 = null === (_54 = null == options ? void 0 : options.taskBar) || void 0 === _54 ? void 0 : _54.scheduleCreatable) && void 0 !== _55 ? _55 : !(gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Separate && gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Tasks_Separate),
|
|
174
|
+
gantt.parsedOptions.taskBarCreationButtonStyle = Object.assign({
|
|
175
|
+
lineColor: "rgb(99, 144, 0)",
|
|
176
|
+
lineWidth: 1,
|
|
177
|
+
lineDash: [ 5, 5 ],
|
|
178
|
+
cornerRadius: 4,
|
|
179
|
+
backgroundColor: "#FFF"
|
|
180
|
+
}, null === (_57 = null === (_56 = null == options ? void 0 : options.taskBar) || void 0 === _56 ? void 0 : _56.scheduleCreation) || void 0 === _57 ? void 0 : _57.buttonStyle),
|
|
181
|
+
gantt.parsedOptions.taskBarCreationCustomLayout = null === (_59 = null === (_58 = null == options ? void 0 : options.taskBar) || void 0 === _58 ? void 0 : _58.scheduleCreation) || void 0 === _59 ? void 0 : _59.customLayout,
|
|
182
|
+
gantt.parsedOptions.taskBarCreationMaxWidth = null === (_61 = null === (_60 = null == options ? void 0 : options.taskBar) || void 0 === _60 ? void 0 : _60.scheduleCreation) || void 0 === _61 ? void 0 : _61.maxWidth,
|
|
183
|
+
gantt.parsedOptions.taskBarCreationMinWidth = null === (_63 = null === (_62 = null == options ? void 0 : options.taskBar) || void 0 === _62 ? void 0 : _62.scheduleCreation) || void 0 === _63 ? void 0 : _63.minWidth,
|
|
184
|
+
gantt.parsedOptions.outerFrameStyle = Object.assign({
|
|
185
|
+
borderColor: "#e1e4e8",
|
|
186
|
+
borderLineWidth: 1,
|
|
187
|
+
cornerRadius: 4
|
|
188
|
+
}, null === (_64 = options.frame) || void 0 === _64 ? void 0 : _64.outerFrameStyle),
|
|
189
|
+
gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine),
|
|
190
|
+
null !== (_66 = null === (_65 = gantt.parsedOptions.markLine) || void 0 === _65 ? void 0 : _65.length) && void 0 !== _66 && _66 && ((null === (_67 = gantt.parsedOptions.markLine) || void 0 === _67 ? void 0 : _67.every((item => void 0 === item.scrollToMarkLine))) && (gantt.parsedOptions.markLine[0].scrollToMarkLine = !0),
|
|
191
|
+
(null === (_68 = gantt.parsedOptions.markLine) || void 0 === _68 ? void 0 : _68.find((item => item.scrollToMarkLine))) && (gantt.parsedOptions.scrollToMarkLineDate = (0,
|
|
192
|
+
util_1.getStartDateByTimeUnit)(new Date(null === (_69 = gantt.parsedOptions.markLine) || void 0 === _69 ? void 0 : _69.find((item => item.scrollToMarkLine)).date), minTimeUnit, startOfWeek))),
|
|
193
|
+
gantt.parsedOptions.verticalSplitLineHighlight = null === (_70 = options.frame) || void 0 === _70 ? void 0 : _70.verticalSplitLineHighlight,
|
|
194
|
+
gantt.parsedOptions.verticalSplitLine = Object.assign({
|
|
195
|
+
lineColor: null === (_71 = gantt.parsedOptions.outerFrameStyle) || void 0 === _71 ? void 0 : _71.borderColor,
|
|
196
|
+
lineWidth: null === (_72 = gantt.parsedOptions.outerFrameStyle) || void 0 === _72 ? void 0 : _72.borderLineWidth
|
|
197
|
+
}, null === (_73 = options.frame) || void 0 === _73 ? void 0 : _73.verticalSplitLine),
|
|
198
|
+
gantt.parsedOptions.horizontalSplitLine = null === (_74 = options.frame) || void 0 === _74 ? void 0 : _74.horizontalSplitLine,
|
|
199
|
+
gantt.parsedOptions.verticalSplitLineMoveable = null === (_75 = options.frame) || void 0 === _75 ? void 0 : _75.verticalSplitLineMoveable,
|
|
200
|
+
gantt.parsedOptions.taskKeyField = null !== (_76 = options.taskKeyField) && void 0 !== _76 ? _76 : "id",
|
|
201
|
+
gantt.parsedOptions.dependencyLinks = null !== (_78 = null === (_77 = options.dependency) || void 0 === _77 ? void 0 : _77.links) && void 0 !== _78 ? _78 : [],
|
|
202
|
+
gantt.parsedOptions.dependencyLinkCreatable = null !== (_80 = null === (_79 = options.dependency) || void 0 === _79 ? void 0 : _79.linkCreatable) && void 0 !== _80 && _80,
|
|
203
|
+
gantt.parsedOptions.dependencyLinkSelectable = null === (_82 = null === (_81 = options.dependency) || void 0 === _81 ? void 0 : _81.linkSelectable) || void 0 === _82 || _82,
|
|
204
|
+
gantt.parsedOptions.dependencyLinkDeletable = null !== (_84 = null === (_83 = options.dependency) || void 0 === _83 ? void 0 : _83.linkDeletable) && void 0 !== _84 && _84,
|
|
205
|
+
gantt.parsedOptions.dependencyLinkLineStyle = Object.assign({
|
|
206
|
+
lineColor: "red",
|
|
207
|
+
lineWidth: 1
|
|
208
|
+
}, null === (_85 = options.dependency) || void 0 === _85 ? void 0 : _85.linkLineStyle),
|
|
209
|
+
gantt.parsedOptions.dependencyLinkSelectedLineStyle = Object.assign({
|
|
210
|
+
shadowBlur: 4,
|
|
211
|
+
shadowOffset: 0,
|
|
212
|
+
shadowColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
|
|
213
|
+
lineColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
|
|
214
|
+
lineWidth: gantt.parsedOptions.dependencyLinkLineStyle.lineWidth
|
|
215
|
+
}, null === (_86 = null == options ? void 0 : options.dependency) || void 0 === _86 ? void 0 : _86.linkSelectedLineStyle),
|
|
216
|
+
gantt.parsedOptions.dependencyLinkLineCreatePointStyle = Object.assign({
|
|
217
|
+
strokeColor: "red",
|
|
218
|
+
fillColor: "white",
|
|
219
|
+
radius: 5,
|
|
220
|
+
strokeWidth: 1
|
|
221
|
+
}, null === (_87 = null == options ? void 0 : options.dependency) || void 0 === _87 ? void 0 : _87.linkCreatePointStyle),
|
|
222
|
+
gantt.parsedOptions.dependencyLinkLineCreatingPointStyle = Object.assign({
|
|
223
|
+
strokeColor: "red",
|
|
224
|
+
fillColor: "red",
|
|
225
|
+
radius: 5,
|
|
226
|
+
strokeWidth: 1
|
|
227
|
+
}, null === (_88 = null == options ? void 0 : options.dependency) || void 0 === _88 ? void 0 : _88.linkCreatingPointStyle),
|
|
228
|
+
gantt.parsedOptions.dependencyLinkLineCreatingStyle = Object.assign({
|
|
229
|
+
lineColor: "red",
|
|
230
|
+
lineWidth: 1,
|
|
231
|
+
lineDash: [ 5, 5 ]
|
|
232
|
+
}, null === (_89 = null == options ? void 0 : options.dependency) || void 0 === _89 ? void 0 : _89.linkCreatingLineStyle),
|
|
233
|
+
gantt.parsedOptions.dependencyLinkDistanceToTaskBar = null !== (_91 = null === (_90 = null == options ? void 0 : options.dependency) || void 0 === _90 ? void 0 : _90.distanceToTaskBar) && void 0 !== _91 ? _91 : 20,
|
|
234
|
+
gantt.parsedOptions.eventOptions = null == options ? void 0 : options.eventOptions,
|
|
235
|
+
gantt.parsedOptions.keyboardOptions = null == options ? void 0 : options.keyboardOptions,
|
|
236
|
+
gantt.parsedOptions.markLineCreateOptions = null == options ? void 0 : options.markLineCreateOptions;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function updateOptionsWhenScaleChanged(gantt) {
|
|
240
|
+
var _a, _b, _c, _d;
|
|
241
|
+
const options = gantt.options, {unit: minTimeUnit, startOfWeek: startOfWeek, step: step} = gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
242
|
+
gantt.parsedOptions.minDate = (0, util_1.getStartDateByTimeUnit)(new Date(gantt.parsedOptions.minDate), minTimeUnit, startOfWeek),
|
|
243
|
+
gantt.parsedOptions.maxDate = (0, util_1.getEndDateByTimeUnit)(gantt.parsedOptions.minDate, new Date(gantt.parsedOptions.maxDate), minTimeUnit, step),
|
|
244
|
+
gantt.parsedOptions._minDateTime = null === (_a = gantt.parsedOptions.minDate) || void 0 === _a ? void 0 : _a.getTime(),
|
|
245
|
+
gantt.parsedOptions._maxDateTime = null === (_b = gantt.parsedOptions.maxDate) || void 0 === _b ? void 0 : _b.getTime(),
|
|
246
|
+
gantt.parsedOptions.timeLineHeaderRowHeights = [], gantt.parsedOptions.timelineHeaderStyles = [];
|
|
247
|
+
for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length; i++) {
|
|
248
|
+
const style = gantt.parsedOptions.sortedTimelineScales[i].style;
|
|
249
|
+
gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
|
|
250
|
+
fontSize: 20,
|
|
251
|
+
fontWeight: "bold",
|
|
252
|
+
textAlign: "center",
|
|
253
|
+
textBaseline: "middle",
|
|
254
|
+
color: "#000",
|
|
255
|
+
backgroundColor: "#fff"
|
|
256
|
+
}, style)), gantt.parsedOptions.timeLineHeaderRowHeights.push(null !== (_d = null !== (_c = gantt.parsedOptions.sortedTimelineScales[i].rowHeight) && void 0 !== _c ? _c : null == options ? void 0 : options.headerRowHeight) && void 0 !== _d ? _d : 40);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function generateTimeLineDate(currentDate, endDate, scale) {
|
|
261
|
+
var _a;
|
|
262
|
+
const {unit: unit, step: step, format: format} = scale, timelineDates = [];
|
|
263
|
+
for (;currentDate < endDate; ) if ("day" === unit) {
|
|
264
|
+
const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), end = (0,
|
|
265
|
+
util_1.createDateAtLastHour)(new Date(year, month, day + step - 1), !0);
|
|
266
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
267
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
268
|
+
dateIndex: day,
|
|
269
|
+
startDate: start,
|
|
270
|
+
endDate: end
|
|
271
|
+
})) || day.toString(), dayCellConfig = {
|
|
272
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / exports.DayTimes,
|
|
273
|
+
startDate: start,
|
|
274
|
+
endDate: end,
|
|
275
|
+
step: step,
|
|
276
|
+
unit: "day",
|
|
277
|
+
title: columnTitle,
|
|
278
|
+
dateIndex: day
|
|
279
|
+
};
|
|
280
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day + step);
|
|
281
|
+
} else if ("month" === unit) {
|
|
282
|
+
const year = currentDate.getFullYear(), month = currentDate.getMonth(), end = (0,
|
|
283
|
+
util_1.createDateAtLastHour)(new Date(year, month + step, 0), !0);
|
|
284
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
285
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
286
|
+
dateIndex: month + 1,
|
|
287
|
+
startDate: start,
|
|
288
|
+
endDate: end
|
|
289
|
+
})) || (month + 1).toString(), dayCellConfig = {
|
|
290
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / exports.DayTimes,
|
|
291
|
+
startDate: start,
|
|
292
|
+
step: step,
|
|
293
|
+
unit: "month",
|
|
294
|
+
endDate: end,
|
|
295
|
+
title: columnTitle,
|
|
296
|
+
dateIndex: month + 1
|
|
297
|
+
};
|
|
298
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year, month + step, 1);
|
|
299
|
+
} else if ("quarter" === unit) {
|
|
300
|
+
const year = currentDate.getFullYear(), quarter = Math.floor(currentDate.getMonth() / 3), end = (0,
|
|
301
|
+
util_1.createDateAtLastHour)(new Date(year, 3 * (quarter + step), 0), !0);
|
|
302
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
303
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
304
|
+
dateIndex: quarter + 1,
|
|
305
|
+
startDate: start,
|
|
306
|
+
endDate: end
|
|
307
|
+
})) || (quarter + 1).toString(), dayCellConfig = {
|
|
308
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
|
|
309
|
+
startDate: start,
|
|
310
|
+
step: step,
|
|
311
|
+
unit: "quarter",
|
|
312
|
+
endDate: end,
|
|
313
|
+
title: columnTitle,
|
|
314
|
+
dateIndex: quarter + 1
|
|
315
|
+
};
|
|
316
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year, 3 * (quarter + step), 1);
|
|
317
|
+
} else if ("year" === unit) {
|
|
318
|
+
const year = currentDate.getFullYear(), end = (0, util_1.createDateAtLastHour)(new Date(year + step - 1, 11, 31), !0);
|
|
319
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
320
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
321
|
+
dateIndex: year,
|
|
322
|
+
startDate: start,
|
|
323
|
+
endDate: end
|
|
324
|
+
})) || year.toString(), dayCellConfig = {
|
|
325
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / exports.DayTimes,
|
|
326
|
+
startDate: start,
|
|
327
|
+
endDate: end,
|
|
328
|
+
step: step,
|
|
329
|
+
unit: "year",
|
|
330
|
+
title: columnTitle,
|
|
331
|
+
dateIndex: year
|
|
332
|
+
};
|
|
333
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year + step, 0, 1);
|
|
334
|
+
} else if ("week" === unit) {
|
|
335
|
+
const startOfWeekSetting = null !== (_a = scale.startOfWeek) && void 0 !== _a ? _a : "monday";
|
|
336
|
+
let dayOfWeek = currentDate.getDay();
|
|
337
|
+
"monday" === startOfWeekSetting && (dayOfWeek = 0 === dayOfWeek ? 6 : dayOfWeek - 1);
|
|
338
|
+
const startOfWeek = (0, util_1.createDateAtMidnight)(currentDate), dateEnd = (0,
|
|
339
|
+
util_1.createDateAtLastHour)(currentDate.getTime() + 24 * (7 * step - dayOfWeek) * 60 * 60 * 1e3 - 1, !0);
|
|
340
|
+
dateEnd > endDate && dateEnd.setTime(endDate.getTime());
|
|
341
|
+
const weekNumber = (0, util_1.getWeekNumber)(startOfWeek), columnTitle = (null == format ? void 0 : format({
|
|
342
|
+
dateIndex: weekNumber,
|
|
343
|
+
startDate: startOfWeek,
|
|
344
|
+
endDate: dateEnd
|
|
345
|
+
})) || weekNumber.toString(), dayCellConfig = {
|
|
346
|
+
days: (dateEnd.getTime() - startOfWeek.getTime() + 1) / exports.DayTimes,
|
|
347
|
+
startDate: startOfWeek,
|
|
348
|
+
endDate: dateEnd,
|
|
349
|
+
step: step,
|
|
350
|
+
unit: "week",
|
|
351
|
+
title: columnTitle,
|
|
352
|
+
dateIndex: weekNumber
|
|
353
|
+
};
|
|
354
|
+
timelineDates.push(dayCellConfig), currentDate.setTime((0, util_1.createDateAtMidnight)(currentDate.getTime() + 24 * (7 * step - dayOfWeek) * 60 * 60 * 1e3, !0).getTime());
|
|
355
|
+
} else if ("hour" === unit) {
|
|
356
|
+
const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), hour = currentDate.getHours(), end = (0,
|
|
357
|
+
util_1.createDateAtLastMinute)(new Date(year, month, day, hour + step - 1), !0);
|
|
358
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
359
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
360
|
+
dateIndex: hour,
|
|
361
|
+
startDate: start,
|
|
362
|
+
endDate: end
|
|
363
|
+
})) || hour.toString(), dayCellConfig = {
|
|
364
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / exports.DayTimes,
|
|
365
|
+
startDate: start,
|
|
366
|
+
endDate: end,
|
|
367
|
+
step: step,
|
|
368
|
+
unit: "hour",
|
|
369
|
+
title: columnTitle,
|
|
370
|
+
dateIndex: currentDate.getHours()
|
|
371
|
+
};
|
|
372
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day, hour + step);
|
|
373
|
+
} else if ("minute" === unit) {
|
|
374
|
+
const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), hour = currentDate.getHours(), minute = currentDate.getMinutes(), end = (0,
|
|
375
|
+
util_1.createDateAtLastSecond)(new Date(year, month, day, hour, minute + step - 1), !0);
|
|
376
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
377
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
378
|
+
dateIndex: minute,
|
|
379
|
+
startDate: start,
|
|
380
|
+
endDate: end
|
|
381
|
+
})) || minute.toString(), dayCellConfig = {
|
|
382
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / exports.DayTimes,
|
|
383
|
+
startDate: start,
|
|
384
|
+
endDate: end,
|
|
385
|
+
step: step,
|
|
386
|
+
unit: "minute",
|
|
387
|
+
title: columnTitle,
|
|
388
|
+
dateIndex: currentDate.getMinutes()
|
|
389
|
+
};
|
|
390
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day, hour, minute + step);
|
|
391
|
+
} else if ("second" === unit) {
|
|
392
|
+
const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), hour = currentDate.getHours(), minute = currentDate.getMinutes(), second = currentDate.getSeconds(), end = (0,
|
|
393
|
+
util_1.createDateAtLastMillisecond)(new Date(year, month, day, hour, minute, second + step - 1), !0);
|
|
394
|
+
end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
|
|
395
|
+
const start = currentDate, columnTitle = (null == format ? void 0 : format({
|
|
396
|
+
dateIndex: second,
|
|
397
|
+
startDate: start,
|
|
398
|
+
endDate: end
|
|
399
|
+
})) || second.toString(), dayCellConfig = {
|
|
400
|
+
days: Math.abs(end.getTime() - currentDate.getTime() + 1) / exports.DayTimes,
|
|
401
|
+
startDate: start,
|
|
402
|
+
endDate: end,
|
|
403
|
+
step: step,
|
|
404
|
+
unit: "second",
|
|
405
|
+
title: columnTitle,
|
|
406
|
+
dateIndex: currentDate.getSeconds()
|
|
407
|
+
};
|
|
408
|
+
timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day, hour, minute, second + step);
|
|
409
|
+
}
|
|
410
|
+
return timelineDates;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function getTextPos(padding, textAlign, textBaseline, width, height) {
|
|
414
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
415
|
+
let textX = null !== (_a = padding[3]) && void 0 !== _a ? _a : 10;
|
|
416
|
+
"right" === textAlign || "end" === textAlign ? textX = width - 0 - (null !== (_b = padding[1]) && void 0 !== _b ? _b : 10) : "center" === textAlign && (textX = 0 + (width - 0 + (null !== (_c = padding[3]) && void 0 !== _c ? _c : 10) - (null !== (_d = padding[1]) && void 0 !== _d ? _d : 10)) / 2);
|
|
417
|
+
let textY = 0 + (null !== (_e = padding[0]) && void 0 !== _e ? _e : 10);
|
|
418
|
+
return "bottom" === textBaseline || "alphabetic" === textBaseline || "ideographic" === textBaseline ? textY = height - 0 - (null !== (_f = padding[2]) && void 0 !== _f ? _f : 10) : "middle" === textBaseline && (textY = 0 + (height - 0 - (null !== (_g = padding[0]) && void 0 !== _g ? _g : 10) - (null !== (_h = padding[2]) && void 0 !== _h ? _h : 10)) / 2 + (null !== (_j = padding[0]) && void 0 !== _j ? _j : 10)),
|
|
419
|
+
{
|
|
420
|
+
x: textX,
|
|
421
|
+
y: textY
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function convertProgress(progress) {
|
|
426
|
+
return "string" == typeof progress && (progress = progress.replace("%", ""), progress = parseFloat(progress)),
|
|
427
|
+
isNaN(progress) ? 0 : Math.max(0, Math.min(100, Math.round(10 * progress) / 10));
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function createSplitLineAndResizeLine(gantt) {
|
|
431
|
+
if (gantt.taskListTableInstance) {
|
|
432
|
+
gantt.verticalSplitResizeLine = document.createElement("div"), gantt.verticalSplitResizeLine.style.position = "absolute",
|
|
433
|
+
gantt.verticalSplitResizeLine.style.top = gantt.tableY + "px", gantt.verticalSplitResizeLine.style.left = (-1 !== gantt.taskTableWidth ? gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2 : 0) + "px",
|
|
434
|
+
gantt.verticalSplitResizeLine.style.width = "14px", gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + "px",
|
|
435
|
+
gantt.verticalSplitResizeLine.style.backgroundColor = "rgba(0,0,0,0)", gantt.verticalSplitResizeLine.style.zIndex = "100",
|
|
436
|
+
gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = "col-resize"),
|
|
437
|
+
gantt.verticalSplitResizeLine.style.userSelect = "none", gantt.verticalSplitResizeLine.style.opacity = "1";
|
|
438
|
+
const verticalSplitLine = document.createElement("div");
|
|
439
|
+
if (verticalSplitLine.style.position = "absolute", verticalSplitLine.style.top = "0px",
|
|
440
|
+
verticalSplitLine.style.left = (14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2 + "px",
|
|
441
|
+
verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + "px",
|
|
442
|
+
verticalSplitLine.style.height = "100%", verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor,
|
|
443
|
+
verticalSplitLine.style.zIndex = "100", verticalSplitLine.style.userSelect = "none",
|
|
444
|
+
verticalSplitLine.style.pointerEvents = "none", verticalSplitLine.style.transition = "background-color 0.3s",
|
|
445
|
+
gantt.verticalSplitResizeLine.appendChild(verticalSplitLine), gantt.parsedOptions.verticalSplitLineHighlight) {
|
|
446
|
+
const highlightLine = document.createElement("div");
|
|
447
|
+
highlightLine.style.position = "absolute", highlightLine.style.top = "0px", highlightLine.style.left = (14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth) / 2 + "px",
|
|
448
|
+
highlightLine.style.width = gantt.parsedOptions.verticalSplitLineHighlight.lineWidth + "px",
|
|
449
|
+
highlightLine.style.height = "100%", highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor,
|
|
450
|
+
highlightLine.style.zIndex = "100", highlightLine.style.cursor = "col-resize", highlightLine.style.userSelect = "none",
|
|
451
|
+
highlightLine.style.pointerEvents = "none", highlightLine.style.opacity = "0", highlightLine.style.transition = "background-color 0.3s",
|
|
452
|
+
gantt.verticalSplitResizeLine.appendChild(highlightLine);
|
|
453
|
+
}
|
|
454
|
+
gantt.container.appendChild(gantt.verticalSplitResizeLine);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function updateSplitLineAndResizeLine(gantt) {
|
|
459
|
+
if (gantt.verticalSplitResizeLine) {
|
|
460
|
+
gantt.verticalSplitResizeLine.style.position = "absolute", gantt.verticalSplitResizeLine.style.top = gantt.tableY + "px",
|
|
461
|
+
gantt.verticalSplitResizeLine.style.left = -1 !== gantt.taskTableWidth ? gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2 + "px" : "0px",
|
|
462
|
+
gantt.verticalSplitResizeLine.style.width = "14px", gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + "px",
|
|
463
|
+
gantt.verticalSplitResizeLine.style.backgroundColor = "rgba(0,0,0,0)", gantt.verticalSplitResizeLine.style.zIndex = "100",
|
|
464
|
+
gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = "col-resize"),
|
|
465
|
+
gantt.verticalSplitResizeLine.style.userSelect = "none", gantt.verticalSplitResizeLine.style.opacity = "1";
|
|
466
|
+
const verticalSplitLine = gantt.verticalSplitResizeLine.childNodes[0];
|
|
467
|
+
if (verticalSplitLine.style.position = "absolute", verticalSplitLine.style.top = "0px",
|
|
468
|
+
verticalSplitLine.style.left = (14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2 + "px",
|
|
469
|
+
verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + "px",
|
|
470
|
+
verticalSplitLine.style.height = "100%", verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor,
|
|
471
|
+
verticalSplitLine.style.zIndex = "100", verticalSplitLine.style.userSelect = "none",
|
|
472
|
+
verticalSplitLine.style.pointerEvents = "none", verticalSplitLine.style.transition = "background-color 0.3s",
|
|
473
|
+
gantt.verticalSplitResizeLine.childNodes[1]) {
|
|
474
|
+
const highlightLine = gantt.verticalSplitResizeLine.childNodes[1];
|
|
475
|
+
highlightLine.style.position = "absolute", highlightLine.style.top = "0px", highlightLine.style.left = (14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth) / 2 + "px",
|
|
476
|
+
highlightLine.style.width = gantt.parsedOptions.verticalSplitLineHighlight.lineWidth + "px",
|
|
477
|
+
highlightLine.style.height = "100%", highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor,
|
|
478
|
+
highlightLine.style.zIndex = "100", highlightLine.style.cursor = "col-resize", highlightLine.style.userSelect = "none",
|
|
479
|
+
highlightLine.style.pointerEvents = "none", highlightLine.style.opacity = "0", highlightLine.style.transition = "background-color 0.3s";
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function findRecordByTaskKey(records, taskKeyField, taskKey, childrenField = "children") {
|
|
485
|
+
var _a;
|
|
486
|
+
for (let i = 0; i < records.length; i++) {
|
|
487
|
+
if (Array.isArray(taskKey) && 1 === taskKey.length && records[i][taskKeyField] === taskKey[0] || records[i][taskKeyField] === taskKey) return {
|
|
488
|
+
record: records[i],
|
|
489
|
+
index: [ i ]
|
|
490
|
+
};
|
|
491
|
+
if (null === (_a = records[i][childrenField]) || void 0 === _a ? void 0 : _a.length) if (Array.isArray(taskKey) && taskKey[0] === records[i][taskKeyField]) {
|
|
492
|
+
const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey.slice(1));
|
|
493
|
+
if (result) return result.index.unshift(i), result;
|
|
494
|
+
} else if (!Array.isArray(taskKey)) {
|
|
495
|
+
const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey);
|
|
496
|
+
if (result) return result.index.unshift(i), result;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function clearRecordLinkInfos(records, childrenField = "children") {
|
|
502
|
+
var _a;
|
|
503
|
+
for (let i = 0; i < records.length; i++) (null === (_a = records[i][childrenField]) || void 0 === _a ? void 0 : _a.length) ? clearRecordLinkInfos(records[i][childrenField], childrenField) : (delete records[i].vtable_gantt_linkedTo,
|
|
504
|
+
delete records[i].vtable_gantt_linkedFrom);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function clearRecordShowIndex(records, childrenField = "children") {
|
|
508
|
+
var _a;
|
|
509
|
+
for (let i = 0; i < records.length; i++) (null === (_a = records[i][childrenField]) || void 0 === _a ? void 0 : _a.length) ? clearRecordShowIndex(records[i][childrenField], childrenField) : delete records[i].vtable_gantt_showIndex;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function getTaskIndexsByTaskY(y, gantt) {
|
|
513
|
+
var _a;
|
|
514
|
+
let task_index, sub_task_index;
|
|
515
|
+
if (gantt.taskListTableInstance) {
|
|
516
|
+
const rowInfo = gantt.taskListTableInstance.getTargetRowAt(y + gantt.headerHeight);
|
|
517
|
+
if (rowInfo) {
|
|
518
|
+
const {row: row} = rowInfo;
|
|
519
|
+
task_index = row - gantt.taskListTableInstance.columnHeaderLevelCount;
|
|
520
|
+
const beforeRowsHeight = gantt.getRowsHeightByIndex(0, task_index - 1);
|
|
521
|
+
if (gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Inline || gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Arrange || gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Compact || gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Separate) sub_task_index = Math.floor((y - beforeRowsHeight) / gantt.parsedOptions.rowHeight); else if (gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Project_Sub_Tasks_Inline) {
|
|
522
|
+
const record = gantt.getRecordByIndex(task_index);
|
|
523
|
+
if (record && record.type === ts_types_1.TaskType.PROJECT && (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) > 0) {
|
|
524
|
+
"expand" === record.hierarchyState || !1 === gantt.parsedOptions.projectSubTasksExpandable || (sub_task_index = Math.floor((y - beforeRowsHeight) / gantt.parsedOptions.rowHeight));
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
} else task_index = Math.floor(y / gantt.parsedOptions.rowHeight);
|
|
529
|
+
return {
|
|
530
|
+
task_index: task_index,
|
|
531
|
+
sub_task_index: sub_task_index
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
function computeRowsCountByRecordDateForCompact(gantt, record) {
|
|
536
|
+
var _a;
|
|
537
|
+
if (!record.children || record.children.length <= 1) return 1 === (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) ? record.children[0].vtable_gantt_showIndex = 0 : record.vtable_gantt_showIndex = 0,
|
|
538
|
+
1;
|
|
539
|
+
const sortedChildren = record.children.slice().sort(((a, b) => {
|
|
540
|
+
const {startDate: aStartDate} = formatRecordDateConsiderHasHour(gantt, a), {startDate: bStartDate} = formatRecordDateConsiderHasHour(gantt, b);
|
|
541
|
+
return aStartDate.getTime() - bStartDate.getTime();
|
|
542
|
+
})), rows = [];
|
|
543
|
+
for (let i = 0; i <= sortedChildren.length - 1; i++) {
|
|
544
|
+
const newRecord = sortedChildren[i], {startDate: startDate, endDate: endDate} = formatRecordDateConsiderHasHour(gantt, newRecord);
|
|
545
|
+
let placed = !1;
|
|
546
|
+
for (let j = 0; j < rows.length; j++) if (startDate.getTime() > rows[j]) {
|
|
547
|
+
rows[j] = endDate.getTime(), placed = !0, newRecord.vtable_gantt_showIndex = j;
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
placed || (rows.push(endDate.getTime()), newRecord.vtable_gantt_showIndex = rows.length - 1);
|
|
551
|
+
}
|
|
552
|
+
return rows.length;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function isOverlapping(startDate, endDate, rowTasks, gantt) {
|
|
556
|
+
return rowTasks.some((rowTask => {
|
|
557
|
+
const {startDate: startDate2, endDate: endDate2} = formatRecordDateConsiderHasHour(gantt, rowTask);
|
|
558
|
+
return startDate <= endDate2 && startDate2 <= endDate;
|
|
559
|
+
}));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function computeRowsCountByRecordDate(gantt, record) {
|
|
563
|
+
var _a;
|
|
564
|
+
if (!record.children || record.children.length <= 1) return 1 === (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) ? record.children[0].vtable_gantt_showIndex = 0 : record.vtable_gantt_showIndex = 0,
|
|
565
|
+
1;
|
|
566
|
+
const rows = [];
|
|
567
|
+
for (let i = 0; i <= record.children.length - 1; i++) {
|
|
568
|
+
const newRecord = record.children[i], {startDate: startDate, endDate: endDate} = formatRecordDateConsiderHasHour(gantt, newRecord);
|
|
569
|
+
let placed = !1;
|
|
570
|
+
for (let j = 0; j < rows.length; j++) {
|
|
571
|
+
if (!isOverlapping(startDate, endDate, record.children.filter((t => t !== newRecord && t.vtable_gantt_showIndex === j)), gantt)) {
|
|
572
|
+
rows[j] = endDate.getTime(), placed = !0, newRecord.vtable_gantt_showIndex = j;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
placed || (rows.push(endDate.getTime()), newRecord.vtable_gantt_showIndex = rows.length - 1);
|
|
577
|
+
}
|
|
578
|
+
return rows.length;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function getSubTaskRowIndexByRecordDate(record, childIndex, startDateField, endDateField) {
|
|
582
|
+
if (0 === childIndex) return 0;
|
|
583
|
+
const rows = [];
|
|
584
|
+
if (null == record ? void 0 : record.children) for (let i = 0; i <= record.children.length - 1; i++) {
|
|
585
|
+
const newRecord = record.children[i], startDate = (0, util_1.createDateAtMidnight)(newRecord[startDateField]).getTime(), endDate = (0,
|
|
586
|
+
util_1.createDateAtMidnight)(newRecord[endDateField]).getTime();
|
|
587
|
+
let placed = !1;
|
|
588
|
+
for (let j = 0; j < rows.length; j++) if (startDate > rows[j]) {
|
|
589
|
+
if (rows[j] = endDate, placed = !0, i === childIndex) return j;
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
if (placed || rows.push(endDate), i === childIndex) return rows.length - 1;
|
|
593
|
+
}
|
|
594
|
+
return 0;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function formatRecordDateConsiderHasHour(gantt, record) {
|
|
598
|
+
const {timeScaleIncludeHour: timeScaleIncludeHour, startDateField: startDateField, endDateField: endDateField} = gantt.parsedOptions, startDate = record[startDateField], endDate = record[endDateField];
|
|
599
|
+
return timeScaleIncludeHour ? {
|
|
600
|
+
startDate: (0, util_1.createDateAtMidnight)(startDate),
|
|
601
|
+
endDate: (0, util_1.createDateAtLastHour)(endDate)
|
|
602
|
+
} : {
|
|
603
|
+
startDate: (0, util_1.createDateAtMidnight)(startDate, !0),
|
|
604
|
+
endDate: (0, util_1.createDateAtLastHour)(endDate, !0)
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function updateOptionsWhenRecordChanged(gantt) {
|
|
609
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
610
|
+
const options = gantt.options, {unit: minTimeUnit, startOfWeek: startOfWeek} = gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
611
|
+
gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine),
|
|
612
|
+
null !== (_b = null === (_a = gantt.parsedOptions.markLine) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b && _b && ((null === (_c = gantt.parsedOptions.markLine) || void 0 === _c ? void 0 : _c.every((item => void 0 === item.scrollToMarkLine))) && (gantt.parsedOptions.markLine[0].scrollToMarkLine = !0),
|
|
613
|
+
(null === (_d = gantt.parsedOptions.markLine) || void 0 === _d ? void 0 : _d.find((item => item.scrollToMarkLine))) && (gantt.parsedOptions.scrollToMarkLineDate = (0,
|
|
614
|
+
util_1.getStartDateByTimeUnit)(new Date(null === (_e = gantt.parsedOptions.markLine) || void 0 === _e ? void 0 : _e.find((item => item.scrollToMarkLine)).date), minTimeUnit, startOfWeek))),
|
|
615
|
+
gantt.parsedOptions.dependencyLinks = null !== (_g = null === (_f = options.dependency) || void 0 === _f ? void 0 : _f.links) && void 0 !== _g ? _g : [];
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function updateOptionsWhenDateRangeChanged(gantt) {
|
|
619
|
+
var _a, _b;
|
|
620
|
+
const options = gantt.options, {unit: minTimeUnit, startOfWeek: startOfWeek, step: step} = gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
621
|
+
gantt.parsedOptions.minDate = (null == options ? void 0 : options.minDate) ? (0,
|
|
622
|
+
util_1.getStartDateByTimeUnit)(new Date(options.minDate), minTimeUnit, startOfWeek) : void 0,
|
|
623
|
+
gantt.parsedOptions.maxDate = (null == options ? void 0 : options.maxDate) ? (0,
|
|
624
|
+
util_1.getEndDateByTimeUnit)(gantt.parsedOptions.minDate, new Date(options.maxDate), minTimeUnit, step) : void 0,
|
|
625
|
+
gantt.parsedOptions._minDateTime = null === (_a = gantt.parsedOptions.minDate) || void 0 === _a ? void 0 : _a.getTime(),
|
|
626
|
+
gantt.parsedOptions._maxDateTime = null === (_b = gantt.parsedOptions.maxDate) || void 0 === _b ? void 0 : _b.getTime();
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function updateOptionsWhenMarkLineChanged(gantt) {
|
|
630
|
+
const options = gantt.options;
|
|
631
|
+
gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function _getTaskInfoByXYForCreateSchedule(eventX, eventY, gantt) {
|
|
635
|
+
const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt), recordParent = gantt.getRecordByIndex(taskIndex.task_index), dateIndex = getDateIndexByX(eventX, gantt), dateRange = gantt.getDateRangeByIndex(dateIndex);
|
|
636
|
+
if (null == recordParent ? void 0 : recordParent.children) {
|
|
637
|
+
const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt);
|
|
638
|
+
for (let i = 0; i < recordParent.children.length; i++) {
|
|
639
|
+
const {startDate: startDate, endDate: endDate, taskDays: taskDays, progress: progress, taskRecord: taskRecord} = gantt.getTaskInfoByTaskListIndex(taskIndex.task_index, i);
|
|
640
|
+
if (((gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Compact || gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Arrange) && taskRecord.vtable_gantt_showIndex === taskIndex.sub_task_index || gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Inline || gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Project_Sub_Tasks_Inline && recordParent.type === ts_types_1.TaskType.PROJECT && "expand" !== recordParent.hierarchyState && !1 !== gantt.parsedOptions.projectSubTasksExpandable) && startDate && endDate && dateRange.startDate.getTime() >= startDate.getTime() && dateRange.endDate.getTime() <= endDate.getTime()) return {
|
|
641
|
+
startDate: startDate,
|
|
642
|
+
endDate: endDate,
|
|
643
|
+
taskDays: taskDays,
|
|
644
|
+
progress: progress,
|
|
645
|
+
taskRecord: taskRecord
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function getNodeClickPos(marklineIconNode, gantt) {
|
|
652
|
+
return {
|
|
653
|
+
left: marklineIconNode.globalTransMatrix.e + gantt.taskListTableInstance.tableNoFrameWidth + gantt.taskListTableInstance.tableX + gantt.tableX,
|
|
654
|
+
top: marklineIconNode.globalTransMatrix.f,
|
|
655
|
+
width: marklineIconNode.attribute.width,
|
|
656
|
+
height: marklineIconNode.attribute.height
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
function judgeIfHasMarkLine(data, markLine) {
|
|
661
|
+
const beginTime = data.startDate.getTime(), endTime = data.endDate.getTime();
|
|
662
|
+
return markLine.some((item => {
|
|
663
|
+
const marklineTime = new Date(item.date).getTime();
|
|
664
|
+
return marklineTime >= beginTime && marklineTime <= endTime;
|
|
665
|
+
}));
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function checkHasChildTasks(gantt, taskIndex, subTaskIndex) {
|
|
669
|
+
const taskRecord = gantt.getRecordByIndex(taskIndex, subTaskIndex);
|
|
670
|
+
return !!((null == taskRecord ? void 0 : taskRecord.children) && taskRecord.children.length > 0);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
function initProjectTaskTimes(gantt) {
|
|
674
|
+
if (!gantt.records || 0 === gantt.records.length) return;
|
|
675
|
+
const startDateField = gantt.parsedOptions.startDateField, endDateField = gantt.parsedOptions.endDateField, processTasksRecursively = (records, parentIndex, parentArray) => {
|
|
676
|
+
let earliestStartAll = null, latestEndAll = null;
|
|
677
|
+
return records.forEach(((record, index) => {
|
|
678
|
+
var _a;
|
|
679
|
+
if (!record) return;
|
|
680
|
+
let earliestStart = null, latestEnd = null;
|
|
681
|
+
if (record.children && record.children.length > 0 && record.type === ts_types_1.TaskType.PROJECT) {
|
|
682
|
+
const [childrenEarliestStart, childrenLatestEnd] = processTasksRecursively(record.children, index, records);
|
|
683
|
+
if (childrenEarliestStart && childrenLatestEnd && (earliestStart = childrenEarliestStart,
|
|
684
|
+
latestEnd = childrenLatestEnd, record.type === ts_types_1.TaskType.PROJECT)) {
|
|
685
|
+
const dateFormat = null !== (_a = gantt.parsedOptions.dateFormat) && void 0 !== _a ? _a : gantt.parseTimeFormat(record[startDateField] || record.children[0][startDateField] || ""), formatDateValue = date => gantt.formatDate ? gantt.formatDate(date, dateFormat) : date.toISOString().split("T")[0], updatedRecord = Object.assign({}, record);
|
|
686
|
+
updatedRecord[startDateField] = formatDateValue(earliestStart), updatedRecord[endDateField] = formatDateValue(latestEnd),
|
|
687
|
+
records[index] = updatedRecord;
|
|
688
|
+
}
|
|
689
|
+
} else record[startDateField] && record[endDateField] && (earliestStart = new Date(record[startDateField]),
|
|
690
|
+
latestEnd = new Date(record[endDateField]));
|
|
691
|
+
earliestStart && (!earliestStartAll || earliestStart < earliestStartAll) && (earliestStartAll = earliestStart),
|
|
692
|
+
latestEnd && (!latestEndAll || latestEnd > latestEndAll) && (latestEndAll = latestEnd);
|
|
693
|
+
})), [ earliestStartAll, latestEndAll ];
|
|
694
|
+
};
|
|
695
|
+
processTasksRecursively(gantt.records);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
exports.isNode = isNode, exports.DayTimes = 864e5, exports.getDateIndexByX = getDateIndexByX,
|
|
699
|
+
exports.generateMarkLine = generateMarkLine, exports.getHorizontalScrollBarSize = getHorizontalScrollBarSize,
|
|
700
|
+
exports.getVerticalScrollBarSize = getVerticalScrollBarSize, exports.initOptions = initOptions,
|
|
701
|
+
exports.updateOptionsWhenScaleChanged = updateOptionsWhenScaleChanged, exports.generateTimeLineDate = generateTimeLineDate,
|
|
702
|
+
exports.getTextPos = getTextPos, exports.convertProgress = convertProgress, exports.createSplitLineAndResizeLine = createSplitLineAndResizeLine,
|
|
703
|
+
exports.updateSplitLineAndResizeLine = updateSplitLineAndResizeLine, exports.findRecordByTaskKey = findRecordByTaskKey,
|
|
704
|
+
exports.clearRecordLinkInfos = clearRecordLinkInfos, exports.clearRecordShowIndex = clearRecordShowIndex,
|
|
705
|
+
exports.getTaskIndexsByTaskY = getTaskIndexsByTaskY, exports.computeRowsCountByRecordDateForCompact = computeRowsCountByRecordDateForCompact,
|
|
706
|
+
exports.computeRowsCountByRecordDate = computeRowsCountByRecordDate, exports.getSubTaskRowIndexByRecordDate = getSubTaskRowIndexByRecordDate,
|
|
707
|
+
exports.formatRecordDateConsiderHasHour = formatRecordDateConsiderHasHour, exports.updateOptionsWhenRecordChanged = updateOptionsWhenRecordChanged,
|
|
708
|
+
exports.updateOptionsWhenDateRangeChanged = updateOptionsWhenDateRangeChanged, exports.updateOptionsWhenMarkLineChanged = updateOptionsWhenMarkLineChanged,
|
|
709
|
+
exports._getTaskInfoByXYForCreateSchedule = _getTaskInfoByXYForCreateSchedule, exports.getNodeClickPos = getNodeClickPos,
|
|
710
|
+
exports.judgeIfHasMarkLine = judgeIfHasMarkLine, exports.checkHasChildTasks = checkHasChildTasks,
|
|
711
|
+
exports.initProjectTaskTimes = initProjectTaskTimes;
|
|
712
|
+
//# sourceMappingURL=gantt-helper.js.map
|