@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
package/cjs/Gantt.js
ADDED
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Gantt = exports.createRootElement = void 0;
|
|
6
|
+
|
|
7
|
+
const scenegraph_1 = require("./scenegraph/scenegraph"), env_1 = require("./env"), ts_types_1 = require("./ts-types"), vtable_1 = require("@visactor/vtable"), event_manager_1 = require("./event/event-manager"), state_manager_1 = require("./state/state-manager"), gantt_helper_1 = require("./gantt-helper"), EventTarget_1 = require("./event/EventTarget"), util_1 = require("./tools/util"), DataSource_1 = require("./data/DataSource"), vutils_1 = require("@visactor/vutils"), plugin_manager_1 = require("./plugins/plugin-manager"), vtable_2 = require("@visactor/vtable"), zoom_scale_1 = require("./zoom-scale");
|
|
8
|
+
|
|
9
|
+
function createRootElement(padding, className = "vtable-gantt") {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const element = document.createElement("div");
|
|
12
|
+
element.setAttribute("tabindex", "0"), element.classList.add(className), element.style.outline = "none",
|
|
13
|
+
element.style.margin = `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px`;
|
|
14
|
+
const width = (element.offsetWidth || (null === (_a = element.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) || 1) - 1, height = (element.offsetHeight || (null === (_b = element.parentElement) || void 0 === _b ? void 0 : _b.offsetHeight) || 1) - 1;
|
|
15
|
+
return element.style.width = width && width - padding.left - padding.right + "px" || "0px",
|
|
16
|
+
element.style.height = height && height - padding.top - padding.bottom + "px" || "0px",
|
|
17
|
+
element;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.createRootElement = createRootElement;
|
|
21
|
+
|
|
22
|
+
class Gantt extends EventTarget_1.EventTarget {
|
|
23
|
+
recalculateTimeScale() {
|
|
24
|
+
this.zoomScaleManager && this.zoomScaleManager.recalculateTimeScale();
|
|
25
|
+
}
|
|
26
|
+
zoomByFactor(factor, keepCenter = !0, centerX) {
|
|
27
|
+
this.zoomScaleManager && this.zoomScaleManager.zoomByFactor(factor, keepCenter, centerX);
|
|
28
|
+
}
|
|
29
|
+
constructor(container, options) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f;
|
|
31
|
+
super(), this.parsedOptions = {}, this.container = container, this.options = options,
|
|
32
|
+
this.taskTableWidth = "number" == typeof (null === (_a = null == options ? void 0 : options.taskListTable) || void 0 === _a ? void 0 : _a.tableWidth) ? null === (_b = null == options ? void 0 : options.taskListTable) || void 0 === _b ? void 0 : _b.tableWidth : -1,
|
|
33
|
+
this.taskTableColumns = null !== (_d = null === (_c = null == options ? void 0 : options.taskListTable) || void 0 === _c ? void 0 : _c.columns) && void 0 !== _d ? _d : [],
|
|
34
|
+
this.records = null !== (_e = null == options ? void 0 : options.records) && void 0 !== _e ? _e : [],
|
|
35
|
+
(null === (_f = options.timelineHeader) || void 0 === _f ? void 0 : _f.zoomScale) && !1 !== options.timelineHeader.zoomScale.enabled && (this.zoomScaleManager = new zoom_scale_1.ZoomScaleManager(this, options.timelineHeader.zoomScale)),
|
|
36
|
+
this._sortScales(), (0, gantt_helper_1.initOptions)(this), this.zoomScaleManager ? this.millisecondsPerPixel = this.zoomScaleManager.getInitialMillisecondsPerPixel() : this.millisecondsPerPixel = 144e4,
|
|
37
|
+
(0, gantt_helper_1.initProjectTaskTimes)(this), this.data = new DataSource_1.DataSource(this),
|
|
38
|
+
this._generateTimeLineDateMap(), this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length,
|
|
39
|
+
this.element = createRootElement({
|
|
40
|
+
top: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
left: 0,
|
|
43
|
+
bottom: 0
|
|
44
|
+
}, "vtable-gantt"), this.element.style.left = -1 !== this.taskTableWidth ? `${this.taskTableWidth}px` : "0px",
|
|
45
|
+
this.canvas = document.createElement("canvas"), this.element.appendChild(this.canvas),
|
|
46
|
+
this.context = this.canvas.getContext("2d"), container ? (container.appendChild(this.element),
|
|
47
|
+
this._updateSize()) : this._updateSize(), this._generateListTable(), this._syncPropsFromTable(),
|
|
48
|
+
(0, gantt_helper_1.createSplitLineAndResizeLine)(this), this.scenegraph = new scenegraph_1.Scenegraph(this),
|
|
49
|
+
this.stateManager = new state_manager_1.StateManager(this), this.eventManager = new event_manager_1.EventManager(this),
|
|
50
|
+
this.scenegraph.afterCreateSceneGraph(), this._scrollToMarkLine(), this.pluginManager = new plugin_manager_1.PluginManager(this, options),
|
|
51
|
+
this.recalculateTimeScale();
|
|
52
|
+
}
|
|
53
|
+
renderTaskBarsTable() {
|
|
54
|
+
this.scenegraph.updateNextFrame();
|
|
55
|
+
}
|
|
56
|
+
_updateSize() {
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
58
|
+
let widthP = 0, heightP = 0;
|
|
59
|
+
if ("browser" === env_1.Env.mode) {
|
|
60
|
+
const element = this.getElement();
|
|
61
|
+
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
62
|
+
if (element.parentElement) {
|
|
63
|
+
const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
|
|
64
|
+
widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10),
|
|
65
|
+
heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20);
|
|
66
|
+
}
|
|
67
|
+
const width1 = (null != widthWithoutPadding ? widthWithoutPadding : 1) - 1 - this.taskTableWidth, height1 = (null != heightWithoutPadding ? heightWithoutPadding : 1) - 1 - this.getDataZoomHeight();
|
|
68
|
+
element.style.width = width1 && `${width1}px` || "0px", element.style.height = height1 && `${height1}px` || "0px";
|
|
69
|
+
const {canvas: canvas} = this;
|
|
70
|
+
widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 1,
|
|
71
|
+
heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 1,
|
|
72
|
+
(null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
73
|
+
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
74
|
+
canvas.style.height = `${heightP}px`);
|
|
75
|
+
} else env_1.Env.mode;
|
|
76
|
+
const width = Math.floor(widthP - (0, gantt_helper_1.getVerticalScrollBarSize)(this.parsedOptions.scrollStyle)), height = Math.floor(heightP - (0,
|
|
77
|
+
gantt_helper_1.getHorizontalScrollBarSize)(this.parsedOptions.scrollStyle));
|
|
78
|
+
if (this.tableNoFrameWidth = widthP, this.tableNoFrameHeight = Math.floor(heightP),
|
|
79
|
+
this.parsedOptions.outerFrameStyle) {
|
|
80
|
+
const [top, right, bottom, left] = (0, vtable_2.toBoxArray)(null !== (_g = null === (_f = this.parsedOptions.outerFrameStyle) || void 0 === _f ? void 0 : _f.borderLineWidth) && void 0 !== _g ? _g : 0);
|
|
81
|
+
this.tableX = this.taskTableColumns.length >= 1 || (null === (_h = this.options) || void 0 === _h ? void 0 : _h.rowSeriesNumber) ? null !== (_j = this.parsedOptions.verticalSplitLine.lineWidth) && void 0 !== _j ? _j : 0 : left,
|
|
82
|
+
this.tableY = top, this.tableNoFrameWidth = Math.min(width - right - this.tableX, this.getAllDateColsWidth()),
|
|
83
|
+
this.tableNoFrameHeight = height - top - bottom;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_updateListTableSize(taskListTableInstance) {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
88
|
+
if (taskListTableInstance) {
|
|
89
|
+
if ("auto" === (null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.taskListTable) || void 0 === _b ? void 0 : _b.tableWidth) || -1 === this.taskTableWidth) {
|
|
90
|
+
const [top, right, bottom, left] = (0, vtable_2.toBoxArray)(null !== (_d = null === (_c = this.parsedOptions.outerFrameStyle) || void 0 === _c ? void 0 : _c.borderLineWidth) && void 0 !== _d ? _d : 0);
|
|
91
|
+
this.taskTableWidth = taskListTableInstance.getAllColsWidth() + right, (null === (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.taskListTable) || void 0 === _f ? void 0 : _f.maxTableWidth) && (this.taskTableWidth = Math.min(null === (_h = null === (_g = this.options) || void 0 === _g ? void 0 : _g.taskListTable) || void 0 === _h ? void 0 : _h.maxTableWidth, this.taskTableWidth)),
|
|
92
|
+
(null === (_k = null === (_j = this.options) || void 0 === _j ? void 0 : _j.taskListTable) || void 0 === _k ? void 0 : _k.minTableWidth) && (this.taskTableWidth = Math.max(null === (_m = null === (_l = this.options) || void 0 === _l ? void 0 : _l.taskListTable) || void 0 === _m ? void 0 : _m.minTableWidth, this.taskTableWidth)),
|
|
93
|
+
this.element.style.left = -1 !== this.taskTableWidth ? `${this.taskTableWidth}px` : "0px",
|
|
94
|
+
taskListTableInstance.setCanvasSize(this.taskTableWidth, this.tableNoFrameHeight + top + bottom),
|
|
95
|
+
this._updateSize();
|
|
96
|
+
}
|
|
97
|
+
if (taskListTableInstance.columnHeaderLevelCount > 1) if (taskListTableInstance.columnHeaderLevelCount === this.parsedOptions.timeLineHeaderRowHeights.length) for (let i = 0; i < taskListTableInstance.columnHeaderLevelCount; i++) taskListTableInstance.setRowHeight(i, this.parsedOptions.timeLineHeaderRowHeights[i]); else {
|
|
98
|
+
const newRowHeight = this.getAllHeaderRowsHeight() / taskListTableInstance.columnHeaderLevelCount;
|
|
99
|
+
for (let i = 0; i < taskListTableInstance.columnHeaderLevelCount; i++) taskListTableInstance.setRowHeight(i, newRowHeight);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
_generateListTable() {
|
|
104
|
+
var _a;
|
|
105
|
+
if (this.taskTableColumns.length >= 1 || (null === (_a = this.options) || void 0 === _a ? void 0 : _a.rowSeriesNumber)) {
|
|
106
|
+
const listTableOption = this._generateListTableOptions();
|
|
107
|
+
this.taskListTableInstance = new vtable_1.ListTable(this.container, listTableOption),
|
|
108
|
+
this._updateListTableSize(this.taskListTableInstance);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
_generateListTableOptions() {
|
|
112
|
+
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;
|
|
113
|
+
const listTable_options = {}, needPutInListTableKeys = [ "container", "records", "rowSeriesNumber", "overscrollBehavior", "pixelRatio", "eventOptions" ];
|
|
114
|
+
for (const key of needPutInListTableKeys) key in this.options && (listTable_options[key] = this.options[key]);
|
|
115
|
+
if (listTable_options.defaultRowHeight = this.options.rowHeight, this.options.taskListTable) for (const key in this.options.taskListTable) {
|
|
116
|
+
if (listTable_options[key] = this.options.taskListTable[key], "columns" === key && (listTable_options[key][listTable_options[key].length - 1].disableColumnResize = !0,
|
|
117
|
+
this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Inline || this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Separate || this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Arrange || this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Compact)) for (let i = 0; i < listTable_options.columns.length; i++) listTable_options.columns[i].tree && (listTable_options.columns[i].tree = !1);
|
|
118
|
+
"hierarchyExpandLevel" !== key || this.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Inline && this.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Separate && this.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Arrange && this.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Compact || delete listTable_options[key];
|
|
119
|
+
}
|
|
120
|
+
if (null === (_a = this.options.taskListTable) || void 0 === _a ? void 0 : _a.theme) if (listTable_options.theme = null === (_b = this.options.taskListTable) || void 0 === _b ? void 0 : _b.theme,
|
|
121
|
+
listTable_options.theme.bodyStyle && !(0, util_1.isPropertyWritable)(listTable_options.theme, "bodyStyle")) {
|
|
122
|
+
listTable_options.theme = (null === (_c = this.options.taskListTable) || void 0 === _c ? void 0 : _c.theme).extends((null === (_d = this.options.taskListTable) || void 0 === _d ? void 0 : _d.theme).getExtendTheme());
|
|
123
|
+
const extendThemeOption = listTable_options.theme.getExtendTheme();
|
|
124
|
+
listTable_options.theme.clearBodyStyleCache(), (null === (_e = listTable_options.theme.headerStyle) || void 0 === _e ? void 0 : _e.bgColor) || (extendThemeOption.headerStyle ? extendThemeOption.headerStyle.bgColor || (extendThemeOption.headerStyle.bgColor = this.parsedOptions.timelineHeaderBackgroundColor) : extendThemeOption.headerStyle = {
|
|
125
|
+
bgColor: this.parsedOptions.timelineHeaderBackgroundColor
|
|
126
|
+
}), extendThemeOption.bodyStyle ? extendThemeOption.bodyStyle.frameStyle = {
|
|
127
|
+
borderLineWidth: [ null !== (_g = null === (_f = this.parsedOptions.horizontalSplitLine) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 0, 0, 0, 0 ],
|
|
128
|
+
borderColor: null === (_h = this.parsedOptions.horizontalSplitLine) || void 0 === _h ? void 0 : _h.lineColor
|
|
129
|
+
} : extendThemeOption.bodyStyle = {
|
|
130
|
+
frameStyle: {
|
|
131
|
+
borderLineWidth: [ null !== (_k = null === (_j = this.parsedOptions.horizontalSplitLine) || void 0 === _j ? void 0 : _j.lineWidth) && void 0 !== _k ? _k : 0, 0, 0, 0 ],
|
|
132
|
+
borderColor: null === (_l = this.parsedOptions.horizontalSplitLine) || void 0 === _l ? void 0 : _l.lineColor
|
|
133
|
+
}
|
|
134
|
+
}, extendThemeOption.cellInnerBorder = !1;
|
|
135
|
+
const [top, right, bottom, left] = (0, vtable_2.toBoxArray)(null !== (_o = null === (_m = this.parsedOptions.outerFrameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : 0);
|
|
136
|
+
extendThemeOption.frameStyle = Object.assign({}, this.parsedOptions.outerFrameStyle, {
|
|
137
|
+
shadowBlur: 0,
|
|
138
|
+
cornerRadius: [ null !== (_q = null === (_p = this.parsedOptions.outerFrameStyle) || void 0 === _p ? void 0 : _p.cornerRadius) && void 0 !== _q ? _q : 0, 0, 0, null !== (_s = null === (_r = this.parsedOptions.outerFrameStyle) || void 0 === _r ? void 0 : _r.cornerRadius) && void 0 !== _s ? _s : 0 ],
|
|
139
|
+
borderLineWidth: [ top, 0, bottom, left ]
|
|
140
|
+
}), extendThemeOption.scrollStyle = Object.assign({}, null === (_u = null === (_t = this.options.taskListTable) || void 0 === _t ? void 0 : _t.theme) || void 0 === _u ? void 0 : _u.scrollStyle, this.parsedOptions.scrollStyle, {
|
|
141
|
+
verticalVisible: "none"
|
|
142
|
+
}), extendThemeOption.columnResize = Object.assign({
|
|
143
|
+
labelColor: "rgba(0,0,0,0)",
|
|
144
|
+
labelBackgroundFill: "rgba(0,0,0,0)"
|
|
145
|
+
}, null == extendThemeOption ? void 0 : extendThemeOption.columnResize), extendThemeOption.underlayBackgroundColor || (extendThemeOption.underlayBackgroundColor = this.parsedOptions.underlayBackgroundColor);
|
|
146
|
+
} else {
|
|
147
|
+
listTable_options.theme.headerStyle ? listTable_options.theme.headerStyle.bgColor || (listTable_options.theme.headerStyle.bgColor = this.parsedOptions.timelineHeaderBackgroundColor) : listTable_options.theme.headerStyle = {
|
|
148
|
+
bgColor: this.parsedOptions.timelineHeaderBackgroundColor
|
|
149
|
+
}, listTable_options.theme.headerStyle = Object.assign({}, vtable_1.themes.DEFAULT.headerStyle, {
|
|
150
|
+
bgColor: this.parsedOptions.timelineHeaderBackgroundColor
|
|
151
|
+
}, null === (_w = null === (_v = this.options.taskListTable) || void 0 === _v ? void 0 : _v.theme) || void 0 === _w ? void 0 : _w.headerStyle),
|
|
152
|
+
listTable_options.theme.bodyStyle = Object.assign({}, vtable_1.themes.DEFAULT.bodyStyle, null === (_y = null === (_x = this.options.taskListTable) || void 0 === _x ? void 0 : _x.theme) || void 0 === _y ? void 0 : _y.bodyStyle, {
|
|
153
|
+
frameStyle: {
|
|
154
|
+
borderLineWidth: [ null !== (_0 = null === (_z = this.parsedOptions.horizontalSplitLine) || void 0 === _z ? void 0 : _z.lineWidth) && void 0 !== _0 ? _0 : 0, 0, 0, 0 ],
|
|
155
|
+
borderColor: null === (_1 = this.parsedOptions.horizontalSplitLine) || void 0 === _1 ? void 0 : _1.lineColor
|
|
156
|
+
}
|
|
157
|
+
}), listTable_options.theme.cellInnerBorder = !1;
|
|
158
|
+
const [top, right, bottom, left] = (0, vtable_2.toBoxArray)(null !== (_3 = null === (_2 = this.parsedOptions.outerFrameStyle) || void 0 === _2 ? void 0 : _2.borderLineWidth) && void 0 !== _3 ? _3 : 0);
|
|
159
|
+
listTable_options.theme.frameStyle = Object.assign({}, this.parsedOptions.outerFrameStyle, {
|
|
160
|
+
cornerRadius: [ null !== (_5 = null === (_4 = this.parsedOptions.outerFrameStyle) || void 0 === _4 ? void 0 : _4.cornerRadius) && void 0 !== _5 ? _5 : 0, 0, 0, null !== (_7 = null === (_6 = this.parsedOptions.outerFrameStyle) || void 0 === _6 ? void 0 : _6.cornerRadius) && void 0 !== _7 ? _7 : 0 ],
|
|
161
|
+
borderLineWidth: [ top, 0, bottom, left ]
|
|
162
|
+
}), listTable_options.theme.scrollStyle = Object.assign({}, null === (_9 = null === (_8 = this.options.taskListTable) || void 0 === _8 ? void 0 : _8.theme) || void 0 === _9 ? void 0 : _9.scrollStyle, this.parsedOptions.scrollStyle, {
|
|
163
|
+
verticalVisible: "none"
|
|
164
|
+
}), listTable_options.theme.columnResize = Object.assign({
|
|
165
|
+
labelColor: "rgba(0,0,0,0)",
|
|
166
|
+
labelBackgroundFill: "rgba(0,0,0,0)"
|
|
167
|
+
}, null === (_11 = null === (_10 = this.options.taskListTable) || void 0 === _10 ? void 0 : _10.theme) || void 0 === _11 ? void 0 : _11.columnResize),
|
|
168
|
+
listTable_options.theme.underlayBackgroundColor || (listTable_options.theme.underlayBackgroundColor = this.parsedOptions.underlayBackgroundColor);
|
|
169
|
+
} else {
|
|
170
|
+
const [top, right, bottom, left] = (0, vtable_2.toBoxArray)(null !== (_13 = null === (_12 = this.parsedOptions.outerFrameStyle) || void 0 === _12 ? void 0 : _12.borderLineWidth) && void 0 !== _13 ? _13 : 0);
|
|
171
|
+
listTable_options.theme = {
|
|
172
|
+
scrollStyle: Object.assign({}, null === (_15 = null === (_14 = this.options.taskListTable) || void 0 === _14 ? void 0 : _14.theme) || void 0 === _15 ? void 0 : _15.scrollStyle, this.parsedOptions.scrollStyle, {
|
|
173
|
+
verticalVisible: "none"
|
|
174
|
+
}),
|
|
175
|
+
headerStyle: Object.assign({}, vtable_1.themes.DEFAULT.headerStyle, {
|
|
176
|
+
bgColor: this.parsedOptions.timelineHeaderBackgroundColor
|
|
177
|
+
}, null === (_17 = null === (_16 = this.options.taskListTable) || void 0 === _16 ? void 0 : _16.theme) || void 0 === _17 ? void 0 : _17.headerStyle),
|
|
178
|
+
bodyStyle: Object.assign({}, vtable_1.themes.DEFAULT.bodyStyle, null === (_19 = null === (_18 = this.options.taskListTable) || void 0 === _18 ? void 0 : _18.theme) || void 0 === _19 ? void 0 : _19.bodyStyle, {
|
|
179
|
+
frameStyle: {
|
|
180
|
+
borderLineWidth: [ null !== (_21 = null === (_20 = this.parsedOptions.horizontalSplitLine) || void 0 === _20 ? void 0 : _20.lineWidth) && void 0 !== _21 ? _21 : 0, 0, 0, 0 ],
|
|
181
|
+
borderColor: null === (_22 = this.parsedOptions.horizontalSplitLine) || void 0 === _22 ? void 0 : _22.lineColor
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
cellInnerBorder: !1,
|
|
185
|
+
frameStyle: Object.assign({}, this.parsedOptions.outerFrameStyle, {
|
|
186
|
+
cornerRadius: [ null !== (_24 = null === (_23 = this.parsedOptions.outerFrameStyle) || void 0 === _23 ? void 0 : _23.cornerRadius) && void 0 !== _24 ? _24 : 0, 0, 0, null !== (_26 = null === (_25 = this.parsedOptions.outerFrameStyle) || void 0 === _25 ? void 0 : _25.cornerRadius) && void 0 !== _26 ? _26 : 0 ],
|
|
187
|
+
borderLineWidth: [ top, 0, bottom, left ]
|
|
188
|
+
}),
|
|
189
|
+
columnResize: Object.assign({
|
|
190
|
+
labelColor: "rgba(0,0,0,0)",
|
|
191
|
+
labelBackgroundFill: "rgba(0,0,0,0)"
|
|
192
|
+
}, null === (_28 = null === (_27 = this.options.taskListTable) || void 0 === _27 ? void 0 : _27.theme) || void 0 === _28 ? void 0 : _28.columnResize),
|
|
193
|
+
underlayBackgroundColor: this.parsedOptions.underlayBackgroundColor
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return listTable_options.canvasWidth = this.taskTableWidth, listTable_options.canvasHeight = this.canvas.height,
|
|
197
|
+
listTable_options.defaultHeaderRowHeight = this.getAllHeaderRowsHeight(), this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Separate ? (listTable_options.customComputeRowHeight = args => {
|
|
198
|
+
var _a;
|
|
199
|
+
const {row: row, table: table} = args, record = table.getRecordByRowCol(0, row);
|
|
200
|
+
return record ? ((null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) || 1) * this.parsedOptions.rowHeight : this.parsedOptions.rowHeight;
|
|
201
|
+
}, listTable_options.defaultRowHeight = "auto", listTable_options.customConfig = {
|
|
202
|
+
forceComputeAllRowHeight: !0
|
|
203
|
+
}) : this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Compact ? (listTable_options.customComputeRowHeight = args => {
|
|
204
|
+
const {row: row, table: table} = args, record = table.getRecordByRowCol(0, row);
|
|
205
|
+
return record ? (0, gantt_helper_1.computeRowsCountByRecordDateForCompact)(this, record) * this.parsedOptions.rowHeight : this.parsedOptions.rowHeight;
|
|
206
|
+
}, listTable_options.defaultRowHeight = "auto", listTable_options.customConfig = {
|
|
207
|
+
forceComputeAllRowHeight: !0
|
|
208
|
+
}) : this.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Arrange ? (listTable_options.customComputeRowHeight = args => {
|
|
209
|
+
const {row: row, table: table} = args, record = table.getRecordByRowCol(0, row);
|
|
210
|
+
return record ? (0, gantt_helper_1.computeRowsCountByRecordDate)(this, record) * this.parsedOptions.rowHeight : this.parsedOptions.rowHeight;
|
|
211
|
+
}, listTable_options.defaultRowHeight = "auto", listTable_options.customConfig = {
|
|
212
|
+
forceComputeAllRowHeight: !0
|
|
213
|
+
}) : listTable_options.defaultRowHeight = null !== (_29 = this.options.rowHeight) && void 0 !== _29 ? _29 : 40,
|
|
214
|
+
listTable_options.clearDOM = !1, listTable_options;
|
|
215
|
+
}
|
|
216
|
+
getElement() {
|
|
217
|
+
return this.element;
|
|
218
|
+
}
|
|
219
|
+
getContainer() {
|
|
220
|
+
return this.element.parentElement;
|
|
221
|
+
}
|
|
222
|
+
_sortScales() {
|
|
223
|
+
const {timelineHeader: timelineHeader} = this.options;
|
|
224
|
+
if (timelineHeader) {
|
|
225
|
+
const timelineScales = timelineHeader.scales, sortOrder = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second" ];
|
|
226
|
+
1 === timelineScales.length && ("hour" !== timelineScales[0].unit && "minute" !== timelineScales[0].unit && "second" !== timelineScales[0].unit || (this.parsedOptions.timeScaleIncludeHour = !0));
|
|
227
|
+
const orderedScales = timelineScales.slice().sort(((a, b) => {
|
|
228
|
+
"hour" !== a.unit && "minute" !== a.unit && "second" !== a.unit || (this.parsedOptions.timeScaleIncludeHour = !0);
|
|
229
|
+
const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
|
|
230
|
+
return -1 === indexA ? 1 : -1 === indexB ? -1 : indexA - indexB;
|
|
231
|
+
})), reverseOrderedScales = timelineScales.slice().sort(((a, b) => {
|
|
232
|
+
const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
|
|
233
|
+
return -1 === indexA ? 1 : -1 === indexB ? -1 : indexB - indexA;
|
|
234
|
+
}));
|
|
235
|
+
this.parsedOptions.sortedTimelineScales = orderedScales, this.parsedOptions.reverseSortedTimelineScales = reverseOrderedScales;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
_generateTimeLineDateMap() {
|
|
239
|
+
if (this.parsedOptions.minDate && this.parsedOptions.maxDate) for (const scale of this.parsedOptions.reverseSortedTimelineScales) scale.timelineDates = (0,
|
|
240
|
+
gantt_helper_1.generateTimeLineDate)(new Date(this.parsedOptions.minDate), this.parsedOptions.maxDate, scale);
|
|
241
|
+
}
|
|
242
|
+
getRowHeightByIndex(index) {
|
|
243
|
+
return this.taskListTableInstance ? this.taskListTableInstance.getRowHeight(index + this.taskListTableInstance.columnHeaderLevelCount) : this.parsedOptions.rowHeight;
|
|
244
|
+
}
|
|
245
|
+
getRowsHeightByIndex(startIndex, endIndex) {
|
|
246
|
+
return this.taskListTableInstance ? this.taskListTableInstance.getRowsHeight(startIndex + this.taskListTableInstance.columnHeaderLevelCount, endIndex + this.taskListTableInstance.columnHeaderLevelCount) : this.parsedOptions.rowHeight * (endIndex - startIndex + 1);
|
|
247
|
+
}
|
|
248
|
+
getAllRowsHeight() {
|
|
249
|
+
return this.taskListTableInstance ? this.taskListTableInstance.getAllRowsHeight() : this.getAllHeaderRowsHeight() + this.itemCount * this.parsedOptions.rowHeight;
|
|
250
|
+
}
|
|
251
|
+
getAllHeaderRowsHeight() {
|
|
252
|
+
return this.parsedOptions.timeLineHeaderRowHeights.reduce(((acc, curr, index) => !1 === this.parsedOptions.sortedTimelineScales[index].visible ? acc : acc + curr), 0);
|
|
253
|
+
}
|
|
254
|
+
getAllDateColsWidth() {
|
|
255
|
+
var _a, _b;
|
|
256
|
+
return this.parsedOptions.timelineColWidth * (null !== (_b = null === (_a = this.parsedOptions.reverseSortedTimelineScales[0].timelineDates) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0);
|
|
257
|
+
}
|
|
258
|
+
getAllTaskBarsHeight() {
|
|
259
|
+
return this.taskListTableInstance ? this.taskListTableInstance.getRowsHeight(this.taskListTableInstance.columnHeaderLevelCount, this.taskListTableInstance.rowCount - 1) : this.itemCount * this.parsedOptions.rowHeight;
|
|
260
|
+
}
|
|
261
|
+
getRecordIndexByTaskShowIndex(showIndex) {
|
|
262
|
+
return this.taskListTableInstance ? this.taskListTableInstance.getRecordIndexByCell(0, this.taskListTableInstance.columnHeaderLevelCount + showIndex) : showIndex;
|
|
263
|
+
}
|
|
264
|
+
getTaskShowIndexByRecordIndex(index) {
|
|
265
|
+
return this.taskListTableInstance.getBodyRowIndexByRecordIndex(index);
|
|
266
|
+
}
|
|
267
|
+
getRecordByIndex(taskShowIndex, sub_task_index) {
|
|
268
|
+
var _a, _b;
|
|
269
|
+
if (this.taskListTableInstance) {
|
|
270
|
+
if ((0, vutils_1.isValid)(sub_task_index)) {
|
|
271
|
+
const record = this.taskListTableInstance.getRecordByCell(0, taskShowIndex + this.taskListTableInstance.columnHeaderLevelCount);
|
|
272
|
+
if (Array.isArray(sub_task_index)) {
|
|
273
|
+
const recordIndex = this.getRecordIndexByTaskShowIndex(taskShowIndex), parentIndexLength = Array.isArray(recordIndex) ? recordIndex.length : 1, new_sub_task_index = [ ...sub_task_index ];
|
|
274
|
+
new_sub_task_index.splice(0, parentIndexLength);
|
|
275
|
+
let currentRecord = record;
|
|
276
|
+
for (;new_sub_task_index.length > 0; ) {
|
|
277
|
+
const index = new_sub_task_index.shift();
|
|
278
|
+
currentRecord = null === (_a = null == currentRecord ? void 0 : currentRecord.children) || void 0 === _a ? void 0 : _a[index];
|
|
279
|
+
}
|
|
280
|
+
return currentRecord;
|
|
281
|
+
}
|
|
282
|
+
return null === (_b = null == record ? void 0 : record.children) || void 0 === _b ? void 0 : _b[sub_task_index];
|
|
283
|
+
}
|
|
284
|
+
return this.taskListTableInstance.getRecordByCell(0, taskShowIndex + this.taskListTableInstance.columnHeaderLevelCount);
|
|
285
|
+
}
|
|
286
|
+
return this.records[taskShowIndex];
|
|
287
|
+
}
|
|
288
|
+
_refreshTaskBar(taskShowIndex, sub_task_index) {
|
|
289
|
+
this.scenegraph.taskBar.updateTaskBarNode(taskShowIndex, sub_task_index), this.scenegraph.refreshRecordLinkNodes(taskShowIndex, void 0, this.scenegraph.taskBar.getTaskBarNodeByIndex(taskShowIndex, sub_task_index)),
|
|
290
|
+
this.scenegraph.updateNextFrame();
|
|
291
|
+
}
|
|
292
|
+
_updateRecordToListTable(record, index) {
|
|
293
|
+
this.taskListTableInstance.updateRecords([ record ], [ index ]);
|
|
294
|
+
}
|
|
295
|
+
getTaskInfoByTaskListIndex(taskShowIndex, sub_task_index) {
|
|
296
|
+
const taskRecord = this.getRecordByIndex(taskShowIndex, sub_task_index), isMilestone = null == taskRecord ? void 0 : taskRecord.type, startDateField = this.parsedOptions.startDateField, endDateField = this.parsedOptions.endDateField, progressField = this.parsedOptions.progressField, rawDateStartDateTime = (0,
|
|
297
|
+
util_1.createDateAtMidnight)(null == taskRecord ? void 0 : taskRecord[startDateField]).getTime(), rawDateEndDateTime = (0,
|
|
298
|
+
util_1.createDateAtMidnight)(null == taskRecord ? void 0 : taskRecord[endDateField]).getTime();
|
|
299
|
+
if (isMilestone && !(null == taskRecord ? void 0 : taskRecord[startDateField]) || !isMilestone && (rawDateEndDateTime < this.parsedOptions._minDateTime || rawDateStartDateTime > this.parsedOptions._maxDateTime || !(null == taskRecord ? void 0 : taskRecord[startDateField]) || !(null == taskRecord ? void 0 : taskRecord[endDateField]))) return {
|
|
300
|
+
taskDays: 0,
|
|
301
|
+
progress: 0,
|
|
302
|
+
startDate: null,
|
|
303
|
+
endDate: null,
|
|
304
|
+
taskRecord: taskRecord
|
|
305
|
+
};
|
|
306
|
+
const progress = (0, gantt_helper_1.convertProgress)(taskRecord[progressField]);
|
|
307
|
+
let startDate, endDate;
|
|
308
|
+
if (this.parsedOptions.timeScaleIncludeHour) {
|
|
309
|
+
startDate = (0, util_1.createDateAtMidnight)(Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime));
|
|
310
|
+
const rawEnd = null == taskRecord ? void 0 : taskRecord[endDateField];
|
|
311
|
+
let hasMillisecondProvided = !1;
|
|
312
|
+
"string" == typeof rawEnd && (hasMillisecondProvided = /:\d{2}\.\d+/.test(rawEnd));
|
|
313
|
+
const shouldForceMillisecond = !hasMillisecondProvided;
|
|
314
|
+
endDate = (0, util_1.createDateAtLastMillisecond)(Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime), shouldForceMillisecond);
|
|
315
|
+
} else startDate = (0, util_1.createDateAtMidnight)(Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime), !0),
|
|
316
|
+
endDate = (0, util_1.createDateAtLastHour)(Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime), !0);
|
|
317
|
+
return {
|
|
318
|
+
taskRecord: taskRecord,
|
|
319
|
+
taskDays: (endDate.getTime() - startDate.getTime() + 1) / 864e5,
|
|
320
|
+
startDate: startDate,
|
|
321
|
+
endDate: endDate,
|
|
322
|
+
progress: progress
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
_updateStartDateToTaskRecord(startDate, index, sub_task_index) {
|
|
326
|
+
var _a;
|
|
327
|
+
const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : (0,
|
|
328
|
+
util_1.parseDateFormat)(taskRecord[startDateField]), newStartDate = (0, util_1.formatDate)(startDate, dateFormat);
|
|
329
|
+
if (taskRecord[startDateField] = newStartDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && this.stateManager.updateProjectTaskTimes(sub_task_index); else {
|
|
330
|
+
const indexs = this.getRecordIndexByTaskShowIndex(index);
|
|
331
|
+
this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
_updateEndDateToTaskRecord(endDate, index, sub_task_index) {
|
|
335
|
+
var _a;
|
|
336
|
+
const taskRecord = this.getRecordByIndex(index, sub_task_index), endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : (0,
|
|
337
|
+
util_1.parseDateFormat)(taskRecord[endDateField]), newEndDate = (0, util_1.formatDate)(endDate, dateFormat);
|
|
338
|
+
if (taskRecord[endDateField] = newEndDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && this.stateManager.updateProjectTaskTimes(sub_task_index); else {
|
|
339
|
+
const indexs = this.getRecordIndexByTaskShowIndex(index);
|
|
340
|
+
this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
_updateStartEndDateToTaskRecord(startDate, endDate, index, sub_task_index) {
|
|
344
|
+
var _a;
|
|
345
|
+
const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : (0,
|
|
346
|
+
util_1.parseDateFormat)(taskRecord[startDateField]), newStartDate = (0, util_1.formatDate)(startDate, dateFormat);
|
|
347
|
+
taskRecord[startDateField] = newStartDate;
|
|
348
|
+
const newEndDate = (0, util_1.formatDate)(endDate, dateFormat);
|
|
349
|
+
if (taskRecord[endDateField] = newEndDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && this.stateManager.updateProjectTaskTimes(sub_task_index); else {
|
|
350
|
+
const indexs = this.getRecordIndexByTaskShowIndex(index);
|
|
351
|
+
this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
_updateProgressToTaskRecord(progress, index, sub_task_index) {
|
|
355
|
+
const taskRecord = this.getRecordByIndex(index, sub_task_index), progressField = this.parsedOptions.progressField;
|
|
356
|
+
if (progressField) {
|
|
357
|
+
taskRecord[progressField] = progress;
|
|
358
|
+
const indexs = this.getRecordIndexByTaskShowIndex(index);
|
|
359
|
+
this._updateRecordToListTable(taskRecord, indexs), this._refreshTaskBar(index, sub_task_index);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
_dragOrderTaskRecord(source_index, source_sub_task_index, target_index, target_sub_task_index) {
|
|
363
|
+
this.data.adjustOrder(source_index, source_sub_task_index, target_index, target_sub_task_index);
|
|
364
|
+
}
|
|
365
|
+
updateTaskRecord(record, task_index, sub_task_index) {
|
|
366
|
+
if ((0, vutils_1.isValid)(sub_task_index)) {
|
|
367
|
+
const index = "number" == typeof task_index ? task_index : task_index[0];
|
|
368
|
+
return this._updateRecordToListTable(record, [ index, sub_task_index ]), void this._refreshTaskBar(index, sub_task_index);
|
|
369
|
+
}
|
|
370
|
+
if (Array.isArray(task_index)) {
|
|
371
|
+
const index = task_index[0], sub_index = task_index[1];
|
|
372
|
+
return this._updateRecordToListTable(record, task_index), void this._refreshTaskBar(index, sub_index);
|
|
373
|
+
}
|
|
374
|
+
let recordIndexs = task_index;
|
|
375
|
+
"tree" === this.taskListTableInstance.rowHierarchyType && (recordIndexs = this.taskListTableInstance.getRecordIndexByCell(0, task_index + this.taskListTableInstance.columnHeaderLevelCount)),
|
|
376
|
+
this._updateRecordToListTable(record, recordIndexs), this._refreshTaskBar(task_index, void 0);
|
|
377
|
+
}
|
|
378
|
+
setPixelRatio(pixelRatio) {
|
|
379
|
+
var _a;
|
|
380
|
+
null === (_a = this.taskListTableInstance) || void 0 === _a || _a.setPixelRatio(pixelRatio),
|
|
381
|
+
this.parsedOptions.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
|
|
382
|
+
}
|
|
383
|
+
updateTasksShowMode(tasksShowMode) {
|
|
384
|
+
this.options.tasksShowMode = tasksShowMode, this.updateOption(this.options);
|
|
385
|
+
}
|
|
386
|
+
_resize() {
|
|
387
|
+
var _a, _b, _c, _d, _e;
|
|
388
|
+
this._updateSize(), null === (_a = this.taskListTableInstance) || void 0 === _a || _a.setCanvasSize(this.taskTableWidth, this.tableNoFrameHeight + (0,
|
|
389
|
+
vtable_2.toBoxArray)(null !== (_c = null === (_b = this.parsedOptions.outerFrameStyle) || void 0 === _b ? void 0 : _b.borderLineWidth) && void 0 !== _c ? _c : 0)[0] + (0,
|
|
390
|
+
vtable_2.toBoxArray)(null !== (_e = null === (_d = this.parsedOptions.outerFrameStyle) || void 0 === _d ? void 0 : _d.borderLineWidth) && void 0 !== _e ? _e : 0)[2]),
|
|
391
|
+
this._syncPropsFromTable(), this.scenegraph.resize(), (0, gantt_helper_1.updateSplitLineAndResizeLine)(this);
|
|
392
|
+
}
|
|
393
|
+
_syncPropsFromTable() {
|
|
394
|
+
this.itemCount = this.taskListTableInstance ? this.taskListTableInstance.rowCount - this.taskListTableInstance.columnHeaderLevelCount : this.records.length,
|
|
395
|
+
this.headerHeight = this.getAllHeaderRowsHeight(), this.drawHeight = Math.min(this.getAllRowsHeight(), this.tableNoFrameHeight),
|
|
396
|
+
this.gridHeight = this.drawHeight - this.headerHeight;
|
|
397
|
+
}
|
|
398
|
+
hasDataZoom() {
|
|
399
|
+
var _a;
|
|
400
|
+
if (!this.zoomScaleManager) return !1;
|
|
401
|
+
const dataZoomConfig = null === (_a = this.zoomScaleManager.config) || void 0 === _a ? void 0 : _a.dataZoomAxis;
|
|
402
|
+
return !(!dataZoomConfig || !1 === dataZoomConfig.enabled) && null !== this.zoomScaleManager.getDataZoomIntegration();
|
|
403
|
+
}
|
|
404
|
+
getDataZoomHeight() {
|
|
405
|
+
var _a, _b, _c;
|
|
406
|
+
return this.hasDataZoom() ? (null === (_c = null === (_b = null === (_a = this.zoomScaleManager) || void 0 === _a ? void 0 : _a.config) || void 0 === _b ? void 0 : _b.dataZoomAxis) || void 0 === _c ? void 0 : _c.height) || 30 : 0;
|
|
407
|
+
}
|
|
408
|
+
getContext() {
|
|
409
|
+
return this.context;
|
|
410
|
+
}
|
|
411
|
+
release() {
|
|
412
|
+
var _a, _b, _c;
|
|
413
|
+
null === (_a = super.release) || void 0 === _a || _a.call(this), this.eventManager.release(),
|
|
414
|
+
null === (_b = this.taskListTableInstance) || void 0 === _b || _b.release(), this.zoomScaleManager && (this.zoomScaleManager.destroyDataZoomIntegration(),
|
|
415
|
+
this.zoomScaleManager = null);
|
|
416
|
+
const parentElement = null === (_c = this.element) || void 0 === _c ? void 0 : _c.parentElement;
|
|
417
|
+
parentElement && (parentElement.removeChild(this.element), this.verticalSplitResizeLine && parentElement.removeChild(this.verticalSplitResizeLine),
|
|
418
|
+
this.horizontalSplitLine && parentElement.removeChild(this.horizontalSplitLine)),
|
|
419
|
+
this.scenegraph = null, this.pluginManager.release();
|
|
420
|
+
}
|
|
421
|
+
updateOption(options) {
|
|
422
|
+
var _a, _b, _c, _d, _e;
|
|
423
|
+
if (this.parsedOptions = {}, this.options = options, this.taskTableWidth = "number" == typeof (null === (_a = null == options ? void 0 : options.taskListTable) || void 0 === _a ? void 0 : _a.tableWidth) ? null === (_b = null == options ? void 0 : options.taskListTable) || void 0 === _b ? void 0 : _b.tableWidth : -1,
|
|
424
|
+
this.taskTableColumns = null !== (_d = null === (_c = null == options ? void 0 : options.taskListTable) || void 0 === _c ? void 0 : _c.columns) && void 0 !== _d ? _d : [],
|
|
425
|
+
this.records = null !== (_e = null == options ? void 0 : options.records) && void 0 !== _e ? _e : [],
|
|
426
|
+
this._sortScales(), (0, gantt_helper_1.initOptions)(this), this.data.setRecords(this.records),
|
|
427
|
+
this._generateTimeLineDateMap(), this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length,
|
|
428
|
+
this._updateSize(), this.taskListTableInstance) {
|
|
429
|
+
const listTableOption = this._generateListTableOptions();
|
|
430
|
+
this.taskListTableInstance.updateOption(listTableOption), this._updateListTableSize(this.taskListTableInstance);
|
|
431
|
+
}
|
|
432
|
+
this._syncPropsFromTable(), this.scenegraph.updateStageBackground(), this.element.style.left = -1 !== this.taskTableWidth ? `${this.taskTableWidth}px` : "0px",
|
|
433
|
+
(0, gantt_helper_1.updateSplitLineAndResizeLine)(this), this.scenegraph.updateSceneGraph(),
|
|
434
|
+
this.scenegraph.afterCreateSceneGraph(), this._scrollToMarkLine();
|
|
435
|
+
}
|
|
436
|
+
setRecords(records) {
|
|
437
|
+
this.records = records, this.data.setRecords(records), (0, gantt_helper_1.updateOptionsWhenRecordChanged)(this),
|
|
438
|
+
this.taskListTableInstance.setRecords(records), this._syncPropsFromTable(), this._generateTimeLineDateMap(),
|
|
439
|
+
this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length, this._updateSize(),
|
|
440
|
+
this.scenegraph.refreshAll(), this.verticalSplitResizeLine.style.height = this.drawHeight + "px";
|
|
441
|
+
const left = this.stateManager.scroll.horizontalBarPos, top = this.stateManager.scroll.verticalBarPos;
|
|
442
|
+
this.scenegraph.setX(-left), this.scenegraph.setY(-top);
|
|
443
|
+
}
|
|
444
|
+
updateScales(scales) {
|
|
445
|
+
const oldScalesLength = this.parsedOptions.sortedTimelineScales.length;
|
|
446
|
+
if (this.options.timelineHeader.scales = scales, this._sortScales(), (0, gantt_helper_1.updateOptionsWhenScaleChanged)(this),
|
|
447
|
+
this._generateTimeLineDateMap(), this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length,
|
|
448
|
+
this.scenegraph.refreshAll(), (0, gantt_helper_1.updateSplitLineAndResizeLine)(this),
|
|
449
|
+
this.taskListTableInstance) if (this.taskListTableInstance.columnHeaderLevelCount === this.parsedOptions.timeLineHeaderRowHeights.length) for (let i = 0; i < this.taskListTableInstance.columnHeaderLevelCount; i++) this.taskListTableInstance.setRowHeight(i, this.parsedOptions.timeLineHeaderRowHeights[i]); else {
|
|
450
|
+
const newRowHeight = this.getAllHeaderRowsHeight() / this.taskListTableInstance.columnHeaderLevelCount;
|
|
451
|
+
for (let i = 0; i < this.taskListTableInstance.columnHeaderLevelCount; i++) this.taskListTableInstance.setRowHeight(i, newRowHeight);
|
|
452
|
+
}
|
|
453
|
+
oldScalesLength !== scales.length && this._resize();
|
|
454
|
+
}
|
|
455
|
+
updateDateRange(minDate, maxDate) {
|
|
456
|
+
this.options.minDate = minDate, this.options.maxDate = maxDate, (0, gantt_helper_1.updateOptionsWhenDateRangeChanged)(this),
|
|
457
|
+
this._generateTimeLineDateMap(), this._updateSize(), this.scenegraph.refreshAll(),
|
|
458
|
+
this._scrollToMarkLine();
|
|
459
|
+
}
|
|
460
|
+
updateMarkLine(markLine) {
|
|
461
|
+
this.options.markLine = markLine, (0, gantt_helper_1.updateOptionsWhenMarkLineChanged)(this),
|
|
462
|
+
this.scenegraph.markLine.refresh(), this.scenegraph.renderSceneGraph();
|
|
463
|
+
}
|
|
464
|
+
addMarkLine(markLine) {
|
|
465
|
+
this.options.markLine = [ ...this.parsedOptions.markLine, markLine ], (0, gantt_helper_1.updateOptionsWhenMarkLineChanged)(this),
|
|
466
|
+
this.scenegraph.markLine.refresh(), this.scenegraph.renderSceneGraph(), this.scenegraph.updateNextFrame();
|
|
467
|
+
}
|
|
468
|
+
updateCurrentMarkLine(markLine) {
|
|
469
|
+
const currentMarkLineIndex = this.parsedOptions.markLine.findIndex((item => item.date === markLine.date));
|
|
470
|
+
-1 !== currentMarkLineIndex && (this.options.markLine = [ ...this.parsedOptions.markLine.slice(0, currentMarkLineIndex), Object.assign(Object.assign({}, this.options.markLine[currentMarkLineIndex]), markLine), ...this.parsedOptions.markLine.slice(currentMarkLineIndex + 1) ],
|
|
471
|
+
(0, gantt_helper_1.updateOptionsWhenMarkLineChanged)(this), this.scenegraph.markLine.refresh(),
|
|
472
|
+
this.scenegraph.renderSceneGraph(), this.scenegraph.updateNextFrame());
|
|
473
|
+
}
|
|
474
|
+
_scrollToMarkLine() {
|
|
475
|
+
if (this.parsedOptions.scrollToMarkLineDate && this.parsedOptions.minDate) {
|
|
476
|
+
const minDate = this.parsedOptions.minDate, {unit: unit, step: step} = this.parsedOptions.reverseSortedTimelineScales[0], left = (0,
|
|
477
|
+
util_1.computeCountToTimeScale)(this.parsedOptions.scrollToMarkLineDate, minDate, unit, step) * this.parsedOptions.timelineColWidth - this.tableNoFrameWidth / 2;
|
|
478
|
+
this.stateManager.setScrollLeft(left);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
scrollToMarkLine(date) {
|
|
482
|
+
if (!date || !this.parsedOptions.minDate) return;
|
|
483
|
+
const minDate = this.parsedOptions.minDate, {unit: unit, step: step} = this.parsedOptions.reverseSortedTimelineScales[0], left = (0,
|
|
484
|
+
util_1.computeCountToTimeScale)(date, minDate, unit, step) * this.parsedOptions.timelineColWidth - this.tableNoFrameWidth / 2;
|
|
485
|
+
this.stateManager.setScrollLeft(left);
|
|
486
|
+
}
|
|
487
|
+
addLink(link) {
|
|
488
|
+
this.parsedOptions.dependencyLinks.push(link), this.scenegraph.dependencyLink.initLinkLine(this.parsedOptions.dependencyLinks.length - 1),
|
|
489
|
+
this.scenegraph.updateNextFrame();
|
|
490
|
+
}
|
|
491
|
+
deleteLink(link) {
|
|
492
|
+
if (this.parsedOptions.dependencyLinkDeletable) {
|
|
493
|
+
const index = this.parsedOptions.dependencyLinks.findIndex((item => item.type === link.type && item.linkedFromTaskKey === link.linkedFromTaskKey && item.linkedToTaskKey === link.linkedToTaskKey));
|
|
494
|
+
if (-1 !== index) {
|
|
495
|
+
const link = this.parsedOptions.dependencyLinks[index];
|
|
496
|
+
this.parsedOptions.dependencyLinks.splice(index, 1), this.scenegraph.dependencyLink.deleteLink(link),
|
|
497
|
+
this.scenegraph.updateNextFrame();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
get scrollTop() {
|
|
502
|
+
return this.stateManager.scrollTop;
|
|
503
|
+
}
|
|
504
|
+
set scrollTop(value) {
|
|
505
|
+
this.stateManager.setScrollTop(value);
|
|
506
|
+
}
|
|
507
|
+
get scrollLeft() {
|
|
508
|
+
return this.stateManager.scrollLeft;
|
|
509
|
+
}
|
|
510
|
+
set scrollLeft(value) {
|
|
511
|
+
this.stateManager.setScrollLeft(value);
|
|
512
|
+
}
|
|
513
|
+
getTaskBarRelativeRect(index) {
|
|
514
|
+
const taskBarNode = this.scenegraph.taskBar.getTaskBarNodeByIndex(index);
|
|
515
|
+
return {
|
|
516
|
+
left: taskBarNode.attribute.x + this.taskListTableInstance.tableNoFrameWidth + this.taskListTableInstance.tableX + this.tableX - this.scrollLeft,
|
|
517
|
+
top: taskBarNode.attribute.y + this.tableY + this.headerHeight - this.scrollTop,
|
|
518
|
+
width: taskBarNode.attribute.width,
|
|
519
|
+
height: taskBarNode.attribute.height
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
getDateColWidth(dateIndex) {
|
|
523
|
+
return this.parsedOptions.timelineColWidth;
|
|
524
|
+
}
|
|
525
|
+
getDateColsWidth(startDateIndex, endDateIndex) {
|
|
526
|
+
return (endDateIndex - startDateIndex + 1) * this.parsedOptions.timelineColWidth;
|
|
527
|
+
}
|
|
528
|
+
getDateRangeByIndex(index) {
|
|
529
|
+
const minScale = this.parsedOptions.reverseSortedTimelineScales[0];
|
|
530
|
+
if (index < minScale.timelineDates.length) {
|
|
531
|
+
return {
|
|
532
|
+
startDate: minScale.timelineDates[index].startDate,
|
|
533
|
+
endDate: minScale.timelineDates[index].endDate
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
parseTimeFormat(date) {
|
|
539
|
+
return (0, util_1.parseDateFormat)(date);
|
|
540
|
+
}
|
|
541
|
+
getTaskBarStyle(task_index, sub_task_index) {
|
|
542
|
+
const {startDate: startDate, endDate: endDate, taskRecord: taskRecord} = this.getTaskInfoByTaskListIndex(task_index, sub_task_index);
|
|
543
|
+
let style;
|
|
544
|
+
if (style = taskRecord.type === ts_types_1.TaskType.PROJECT ? this.parsedOptions.projectBarStyle : this.parsedOptions.taskBarStyle,
|
|
545
|
+
"function" == typeof style) {
|
|
546
|
+
return style({
|
|
547
|
+
index: task_index,
|
|
548
|
+
startDate: startDate,
|
|
549
|
+
endDate: endDate,
|
|
550
|
+
taskRecord: taskRecord,
|
|
551
|
+
ganttInstance: this
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
return style;
|
|
555
|
+
}
|
|
556
|
+
formatDate(date, format) {
|
|
557
|
+
return (0, util_1.formatDate)(date instanceof Date ? date : new Date(date), format);
|
|
558
|
+
}
|
|
559
|
+
getCurrentMillisecondsPerPixel() {
|
|
560
|
+
return this.millisecondsPerPixel;
|
|
561
|
+
}
|
|
562
|
+
setMillisecondsPerPixel(millisecondsPerPixel) {
|
|
563
|
+
var _a, _b, _c, _d;
|
|
564
|
+
const minMillisecondsPerPixel = null !== (_b = null === (_a = this.parsedOptions.zoom) || void 0 === _a ? void 0 : _a.minMillisecondsPerPixel) && void 0 !== _b ? _b : 2e5, maxMillisecondsPerPixel = null !== (_d = null === (_c = this.parsedOptions.zoom) || void 0 === _c ? void 0 : _c.maxMillisecondsPerPixel) && void 0 !== _d ? _d : 3e6, oldMillisecondsPerPixel = this.millisecondsPerPixel, oldWidth = this.parsedOptions.timelineColWidth;
|
|
565
|
+
this.millisecondsPerPixel = Math.max(minMillisecondsPerPixel, Math.min(maxMillisecondsPerPixel, millisecondsPerPixel)),
|
|
566
|
+
this.recalculateTimeScale(), this._updateSize(), this.scenegraph.refreshAll();
|
|
567
|
+
const newWidth = this.parsedOptions.timelineColWidth, scale = newWidth / oldWidth;
|
|
568
|
+
this.hasListeners(ts_types_1.GANTT_EVENT_TYPE.ZOOM) && this.fireListeners(ts_types_1.GANTT_EVENT_TYPE.ZOOM, {
|
|
569
|
+
oldWidth: oldWidth,
|
|
570
|
+
newWidth: newWidth,
|
|
571
|
+
scale: scale,
|
|
572
|
+
oldMillisecondsPerPixel: oldMillisecondsPerPixel,
|
|
573
|
+
newMillisecondsPerPixel: this.millisecondsPerPixel
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
getCurrentZoomScaleLevel() {
|
|
577
|
+
var _a, _b;
|
|
578
|
+
return null !== (_b = null === (_a = this.zoomScaleManager) || void 0 === _a ? void 0 : _a.getCurrentLevel()) && void 0 !== _b ? _b : -1;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
exports.Gantt = Gantt;
|