@xpyjs/gantt-core 0.0.1-rc.4 → 0.0.1
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/dist/style.css +1 -1
- package/dist/x-gantt.js +969 -803
- package/dist/x-gantt.umd.cjs +23 -3
- package/package.json +1 -1
- package/types/GanttContext.d.ts +1 -0
- package/types/event/index.d.ts +3 -0
- package/types/models/Task.d.ts +1 -0
- package/types/rendering/Renderer.d.ts +2 -0
- package/types/rendering/chart/ChartBody.d.ts +4 -0
- package/types/rendering/table/DragHandler.d.ts +50 -0
- package/types/store/DataManager.d.ts +2 -0
- package/types/types/chart.d.ts +2 -0
- package/types/types/event.d.ts +6 -3
- package/types/types/options.d.ts +36 -2
- package/types/types/render.d.ts +5 -0
- package/types/types/table.d.ts +2 -2
- package/types/utils/helpers.d.ts +2 -1
package/dist/x-gantt.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Yt = (f, t, e) => t in f ?
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var Yt = (f, t, e) => t in f ? Nt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
3
|
var h = (f, t, e) => Yt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import
|
|
5
|
-
import { default as
|
|
6
|
-
import { merge as rt, isArray as X, isString as
|
|
7
|
-
import
|
|
8
|
-
const Ct = "0.0.1
|
|
9
|
-
function
|
|
4
|
+
import R from "dayjs";
|
|
5
|
+
import { default as hi } from "dayjs";
|
|
6
|
+
import { merge as rt, isArray as X, isString as V, isFunction as j, cloneDeep as J, isObject as Et, isNumber as Ut, omit as yt, throttle as wt, isBoolean as ht, debounce as Xt } from "lodash-es";
|
|
7
|
+
import k from "konva";
|
|
8
|
+
const Ct = "0.0.1";
|
|
9
|
+
function Vt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
@@ -24,20 +24,20 @@ function Kt() {
|
|
|
24
24
|
`background-color: ${s}; color: ${i}; padding: 2px 4px; border-radius: 0 6px 6px 0; font-weight: normal; margin: 4px 0;`
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const P = class P {
|
|
28
28
|
/**
|
|
29
29
|
* 设置日志配置
|
|
30
30
|
* @param options - 新的日志配置
|
|
31
31
|
*/
|
|
32
32
|
static setOptions(t) {
|
|
33
|
-
|
|
33
|
+
P.options = { ...P.options, ...t };
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* 获取当前日志级别
|
|
37
37
|
* @returns 当前设置的日志级别
|
|
38
38
|
*/
|
|
39
39
|
static getLevel() {
|
|
40
|
-
return
|
|
40
|
+
return P.options.level;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* 输出 DEBUG 级别的日志
|
|
@@ -45,7 +45,7 @@ const N = class N {
|
|
|
45
45
|
* @param args - 需要打印的参数
|
|
46
46
|
*/
|
|
47
47
|
static debug(...t) {
|
|
48
|
-
|
|
48
|
+
P.logWithLevel(1, console.debug, ...t);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* 输出 INFO 级别的日志
|
|
@@ -53,7 +53,7 @@ const N = class N {
|
|
|
53
53
|
* @param args - 需要打印的参数
|
|
54
54
|
*/
|
|
55
55
|
static info(...t) {
|
|
56
|
-
|
|
56
|
+
P.logWithLevel(2, console.info, ...t);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 输出 WARN 级别的日志
|
|
@@ -61,7 +61,7 @@ const N = class N {
|
|
|
61
61
|
* @param args - 需要打印的参数
|
|
62
62
|
*/
|
|
63
63
|
static warn(...t) {
|
|
64
|
-
|
|
64
|
+
P.logWithLevel(3, console.warn, ...t);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* 输出 ERROR 级别的日志
|
|
@@ -69,7 +69,7 @@ const N = class N {
|
|
|
69
69
|
* @param args - 需要打印的参数
|
|
70
70
|
*/
|
|
71
71
|
static error(...t) {
|
|
72
|
-
|
|
72
|
+
P.logWithLevel(4, console.error, ...t);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* 断言方法
|
|
@@ -78,8 +78,8 @@ const N = class N {
|
|
|
78
78
|
* @param args - 断言失败时需要打印的参数
|
|
79
79
|
*/
|
|
80
80
|
static assert(t, ...e) {
|
|
81
|
-
if (!t &&
|
|
82
|
-
const i =
|
|
81
|
+
if (!t && P.options.level <= 4) {
|
|
82
|
+
const i = P.formatArgs("Assertion failed:", ...e);
|
|
83
83
|
console.error(...i);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -87,13 +87,13 @@ const N = class N {
|
|
|
87
87
|
* 返回日志信息
|
|
88
88
|
*/
|
|
89
89
|
static getMessage(...t) {
|
|
90
|
-
return
|
|
90
|
+
return P.formatArgs(...t).join("");
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* 抛出异常
|
|
94
94
|
*/
|
|
95
95
|
static exception(...t) {
|
|
96
|
-
return new Error(
|
|
96
|
+
return new Error(P.getMessage(...t));
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* 根据级别输出日志的核心方法
|
|
@@ -102,8 +102,8 @@ const N = class N {
|
|
|
102
102
|
* @param args - 需要打印的参数
|
|
103
103
|
*/
|
|
104
104
|
static logWithLevel(t, e, ...i) {
|
|
105
|
-
if (
|
|
106
|
-
const s =
|
|
105
|
+
if (P.options.level <= t) {
|
|
106
|
+
const s = P.formatArgs(...i);
|
|
107
107
|
e(...s);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -113,17 +113,17 @@ const N = class N {
|
|
|
113
113
|
* @returns 格式化后的日志参数数组
|
|
114
114
|
*/
|
|
115
115
|
static formatArgs(...t) {
|
|
116
|
-
const e = [
|
|
117
|
-
return
|
|
116
|
+
const e = [P.Prefix];
|
|
117
|
+
return P.options.showTimestamp && e.unshift(`[${R().format("YYYY-MM-DD HH:mm:ss.SSS")}]`), [e.join(""), ...t];
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
h(
|
|
120
|
+
h(P, "Prefix", "[XGantt]"), h(P, "options", {
|
|
121
121
|
// 默认级别,INFO 及以上会被打印
|
|
122
122
|
level: 2,
|
|
123
123
|
// 默认不显示时间戳
|
|
124
124
|
showTimestamp: !1
|
|
125
125
|
});
|
|
126
|
-
let O =
|
|
126
|
+
let O = P;
|
|
127
127
|
const lt = () => ({
|
|
128
128
|
data: [],
|
|
129
129
|
links: {
|
|
@@ -252,13 +252,18 @@ const lt = () => ({
|
|
|
252
252
|
show: !0,
|
|
253
253
|
enabled: !0
|
|
254
254
|
},
|
|
255
|
+
drag: {
|
|
256
|
+
enabled: !1,
|
|
257
|
+
color: "#999",
|
|
258
|
+
targetOpacity: 0.2
|
|
259
|
+
},
|
|
255
260
|
dateFormat: "YYYY-MM-DD HH:mm:ss",
|
|
256
261
|
locale: "en",
|
|
257
262
|
unit: "day",
|
|
258
263
|
table: {
|
|
259
264
|
width: 100,
|
|
260
265
|
ellipsis: !0,
|
|
261
|
-
align: "
|
|
266
|
+
align: "left",
|
|
262
267
|
headerAlign: "center",
|
|
263
268
|
emptyText: "-"
|
|
264
269
|
},
|
|
@@ -316,7 +321,7 @@ const lt = () => ({
|
|
|
316
321
|
opacity: 0.1
|
|
317
322
|
}
|
|
318
323
|
});
|
|
319
|
-
class
|
|
324
|
+
class Kt {
|
|
320
325
|
constructor() {
|
|
321
326
|
h(this, "options", lt());
|
|
322
327
|
}
|
|
@@ -329,7 +334,7 @@ class Vt {
|
|
|
329
334
|
const s = [];
|
|
330
335
|
t.holiday.holidays.forEach((n) => {
|
|
331
336
|
if (X(n.date)) {
|
|
332
|
-
const o = n.date.map((r) =>
|
|
337
|
+
const o = n.date.map((r) => R(r)).sort((r, a) => r.diff(a));
|
|
333
338
|
for (let r = 1; r < o.length; r++)
|
|
334
339
|
if (o[r].diff(o[r - 1], "day") > 1) {
|
|
335
340
|
s.push({
|
|
@@ -354,7 +359,7 @@ class Vt {
|
|
|
354
359
|
var s;
|
|
355
360
|
let e = "";
|
|
356
361
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
357
|
-
return
|
|
362
|
+
return V(i) ? e = i : X(i) && i.length > 0 ? e = i[t.level] : j(i) && (e = i(t.getEmitData())), e;
|
|
358
363
|
}
|
|
359
364
|
unpackFunc(t, e) {
|
|
360
365
|
return j(t) ? t(e.getEmitData()) : t;
|
|
@@ -401,7 +406,7 @@ class jt {
|
|
|
401
406
|
this.events.clear();
|
|
402
407
|
}
|
|
403
408
|
}
|
|
404
|
-
var
|
|
409
|
+
var S = /* @__PURE__ */ ((f) => (f.LOADED = "loaded", f.COLUMN_WIDTH_CHANGE = "column-width-change", f.MOVE_GUIDELINE = "move-guideline", f.SHOW_GUIDELINE = "show-guideline", f.HIDE_GUIDELINE = "hide-guideline", f.TOGGLE_COLLAPSE = "toggle-collapse", f.SCROLL = "scroll", f.CHART_OFFSET_CHANGE = "chart_offset_change", f.DATA_UPDATE = "data-update", f.VIEW_UPDATE = "view-update", f.UPDATE_TABLE_HEADER = "update_table_header", f.UPDATE_TABLE_BODY = "update_table_body", f.UPDATE_CHART_HEADER = "update_chart_header", f.UPDATE_TASK = "update_task", f.UPDATE_LINK = "update_link", f.CREATE_LINK = "create_link", f.TASK_SELECTED = "task_selected", f.TASK_UNSELECTED = "task_unselected", f.SELECT_LINK = "select_link", f.CHECK_TASK = "check_task", f.CONTEXT_LINK = "context_link", f.ROW_CLICK = "row-click", f.ROW_DBL_CLICK = "row-dbl-click", f.ROW_CONTEXTMENU = "row-contextmenu", f.SLIDER_CLICK = "slider-click", f.SLIDER_DBL_CLICK = "slider-dbl-click", f.SLIDER_CONTEXTMENU = "slider-contextmenu", f.SLIDER_DRAGGING = "slider-dragging", f.SLIDER_ENTER = "slider-enter", f.SLIDER_HOVER = "slider-hover", f.SLIDER_LEAVE = "slider-leave", f.SLIDER_BLINK = "slider-blink", f.LINK_BLINK = "link-blink", f.ROW_HIGHLIGHT = "row-highlight", f.ROW_UNHIGHLIGHT = "row-unhighlight", f.TASK_DRAG_START = "task-drag-start", f.TASK_DRAG_MOVE = "task-drag-move", f.TASK_DRAG_END = "task-drag-end", f.BASELINE_CLICK = "baseline-click", f.BASELINE_CONTEXTMENU = "baseline-contextmenu", f.BASELINE_MOUSEENTER = "baseline-mouseenter", f.BASELINE_MOUSEMOVE = "baseline-mousemove", f.BASELINE_MOUSEOUT = "baseline-mouseout", f.ROW_DRAG_START = "row-drag-start", f.ROW_DRAGGING = "row-dragging", f.ROW_DRAG_END = "row-drag-end", f.ERROR = "error", f))(S || {}), Y = /* @__PURE__ */ ((f) => (f.INVALID_TYPE = "INVALID_TYPE", f.TASK_NOT_FOUND = "TASK_NOT_FOUND", f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f.LINK_INVALID_ARG = "LINK_INVALID_ARG", f.LINK_CYCLE = "LINK_CYCLE", f))(Y || {});
|
|
405
410
|
function Q() {
|
|
406
411
|
return Math.random().toString(36).substring(2, 15);
|
|
407
412
|
}
|
|
@@ -413,15 +418,15 @@ function $(f, t, e) {
|
|
|
413
418
|
}
|
|
414
419
|
function nt(f, t) {
|
|
415
420
|
let e = f;
|
|
416
|
-
return
|
|
421
|
+
return V(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
417
422
|
}
|
|
418
|
-
function ct(f, t) {
|
|
423
|
+
function ct(f, t, e = "round") {
|
|
419
424
|
if (t === 0)
|
|
420
425
|
throw new Error("基准值不能为0");
|
|
421
426
|
if (Math.abs(f) <= t / 2)
|
|
422
427
|
return 0;
|
|
423
|
-
const
|
|
424
|
-
return o
|
|
428
|
+
const i = Math.floor(f / t), s = Math.ceil(f / t), n = i * t, o = s * t, r = Math.abs(f - n), a = Math.abs(f - o);
|
|
429
|
+
return e === "floor" ? n : e === "ceil" ? o : r <= a ? n : o;
|
|
425
430
|
}
|
|
426
431
|
function ot(f, t = 4) {
|
|
427
432
|
return typeof f == "number" ? [f, f, f, f] : Array.isArray(f) ? [
|
|
@@ -532,7 +537,7 @@ class mt {
|
|
|
532
537
|
this.store = t, this.event = e, this.fields = this.store.getOptionManager().getOptions().fields, this.id = n || i[this.fields.id] || Q(), this.data = i, this.name = i[this.fields.name] || "", this.type = i[this.fields.type] || "task", this.updateMode(), this.progress = i[this.fields.progress], this.expanded = this.store.getOptionManager().getOptions().expand.show ? this.store.getOptionManager().getOptions().expand.enabled : !0, this.children = [], this.level = s && s.level !== void 0 ? s.level + 1 : 0, this.parent = s, this.flatIndex = 0, this.store.updateTime(this.startTime, this.endTime);
|
|
533
538
|
}
|
|
534
539
|
getField(t) {
|
|
535
|
-
if (!t ||
|
|
540
|
+
if (!t || V(t) && t.trim() === "")
|
|
536
541
|
return;
|
|
537
542
|
if (!t.includes("."))
|
|
538
543
|
return this.data[t];
|
|
@@ -544,29 +549,29 @@ class mt {
|
|
|
544
549
|
return;
|
|
545
550
|
i = i[n];
|
|
546
551
|
}
|
|
547
|
-
return Et(i) ?
|
|
552
|
+
return Et(i) ? J(i) : i;
|
|
548
553
|
}
|
|
549
554
|
/** 切换展示模式时,需要调整时间 */
|
|
550
555
|
updateMode() {
|
|
551
556
|
let t = !1, e = !1;
|
|
552
|
-
return this.data[this.fields.startTime] && (!this.startTime || !this.startTime.isSame(
|
|
557
|
+
return this.data[this.fields.startTime] && (!this.startTime || !this.startTime.isSame(R(this.data[this.fields.startTime]))) && (this.startTime = R(this.data[this.fields.startTime]), t = !0, e = !0), this.data[this.fields.endTime] && (!this.endTime || !this.endTime.isSame(R(this.data[this.fields.endTime]))) && (this.endTime = R(this.data[this.fields.endTime]), t = !0, e = !0), e && this.store.updateTime(this.startTime, this.endTime), this.startTime && this.endTime && this.duration === 0 && (this.duration = this.endTime.diff(this.startTime)), this.isMilestone() && (!this.endTime || !this.endTime.isSame(this.startTime)) && (this.endTime = this.startTime, t = !0), t;
|
|
553
558
|
}
|
|
554
559
|
updateData(t) {
|
|
555
560
|
this.data = t;
|
|
556
561
|
let e = !1;
|
|
557
|
-
t[this.fields.name] && this.name !== t[this.fields.name] && (this.name = t[this.fields.name], e = !0), t[this.fields.type] && this.type !== t[this.fields.type] && (this.type = t[this.fields.type], e = !0), e = this.updateMode(), t[this.fields.progress] !== void 0 && (this.progress !== t[this.fields.progress] && (e = !0), this.progress = $(t[this.fields.progress], 0, 100)), e && this.event.emit(
|
|
562
|
+
t[this.fields.name] && this.name !== t[this.fields.name] && (this.name = t[this.fields.name], e = !0), t[this.fields.type] && this.type !== t[this.fields.type] && (this.type = t[this.fields.type], e = !0), e = this.updateMode(), t[this.fields.progress] !== void 0 && (this.progress !== t[this.fields.progress] && (e = !0), this.progress = $(t[this.fields.progress], 0, 100)), e && this.event.emit(S.UPDATE_TASK, this);
|
|
558
563
|
}
|
|
559
564
|
updateTime(t, e) {
|
|
560
565
|
var s, n;
|
|
561
566
|
this.startTime = t, this.endTime = this.isMilestone() ? t : e;
|
|
562
567
|
const i = (n = (s = this.store) == null ? void 0 : s.getOptionManager().getOptions()) == null ? void 0 : n.dateFormat;
|
|
563
|
-
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.isMilestone() ? this.data[this.fields.endTime || "endTime"] = this.startTime.add(this.duration).format(i) : this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(
|
|
568
|
+
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.isMilestone() ? this.data[this.fields.endTime || "endTime"] = this.startTime.add(this.duration).format(i) : this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(S.UPDATE_TASK, this);
|
|
564
569
|
}
|
|
565
570
|
clone() {
|
|
566
571
|
return new mt(
|
|
567
572
|
this.store,
|
|
568
573
|
this.event,
|
|
569
|
-
|
|
574
|
+
J(this.data),
|
|
570
575
|
this.parent,
|
|
571
576
|
this.id
|
|
572
577
|
);
|
|
@@ -592,6 +597,15 @@ class mt {
|
|
|
592
597
|
isSummary() {
|
|
593
598
|
return this.store.getOptionManager().getOptions().summary.show ? this.type === "summary" : !1;
|
|
594
599
|
}
|
|
600
|
+
isSomeoneChildren(t) {
|
|
601
|
+
let e = t;
|
|
602
|
+
for (; e; ) {
|
|
603
|
+
if (e.id === this.id)
|
|
604
|
+
return !0;
|
|
605
|
+
e = e.parent;
|
|
606
|
+
}
|
|
607
|
+
return !1;
|
|
608
|
+
}
|
|
595
609
|
}
|
|
596
610
|
class Qt {
|
|
597
611
|
constructor(t, e, i) {
|
|
@@ -615,9 +629,9 @@ class Qt {
|
|
|
615
629
|
const s = this.store.getOptionManager().getOptions().fields, n = this.store.getOptionManager().getOptions().baselines.fields;
|
|
616
630
|
this.taskId = i[t.getOptionManager().getOptions().baselines.taskKey], this.id = i[s.id] || i[n.id] || Q(), this.name = i[s.name] || i[n.name] || "", this.highlight = i[n.highlight] !== !1, this.target = i[n.target] === !0;
|
|
617
631
|
const o = i[s.startTime] || i[n.startTime];
|
|
618
|
-
o && (this.startTime =
|
|
632
|
+
o && (this.startTime = R(o));
|
|
619
633
|
const r = i[s.endTime] || i[n.endTime];
|
|
620
|
-
r && (this.endTime =
|
|
634
|
+
r && (this.endTime = R(r)), this.data = i;
|
|
621
635
|
}
|
|
622
636
|
getField(t) {
|
|
623
637
|
return this.data[t];
|
|
@@ -639,7 +653,7 @@ class Qt {
|
|
|
639
653
|
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: u, unit: e };
|
|
640
654
|
}
|
|
641
655
|
}
|
|
642
|
-
class
|
|
656
|
+
class Zt {
|
|
643
657
|
constructor(t, e) {
|
|
644
658
|
/**
|
|
645
659
|
* 原始数据
|
|
@@ -680,7 +694,7 @@ class Jt {
|
|
|
680
694
|
* 设置源数据并初始化任务
|
|
681
695
|
*/
|
|
682
696
|
setData(t, e = !1) {
|
|
683
|
-
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(
|
|
697
|
+
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(S.DATA_UPDATE);
|
|
684
698
|
}
|
|
685
699
|
/**
|
|
686
700
|
* 初始化任务
|
|
@@ -768,62 +782,31 @@ class Jt {
|
|
|
768
782
|
const r = this.checkedList.findIndex((a) => a.id === t);
|
|
769
783
|
r !== -1 && this.checkedList.splice(r, 1);
|
|
770
784
|
}
|
|
771
|
-
return this.taskMap.delete(t), this.invalidateCache(), this.event.emit(
|
|
785
|
+
return this.taskMap.delete(t), this.invalidateCache(), this.event.emit(S.DATA_UPDATE), i;
|
|
772
786
|
}
|
|
773
787
|
/**
|
|
774
788
|
* 移动任务位置
|
|
775
789
|
*/
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
// if (targetParentId) {
|
|
797
|
-
// targetParent = this.getTaskById(targetParentId);
|
|
798
|
-
// if (!targetParent) {
|
|
799
|
-
// return undefined;
|
|
800
|
-
// }
|
|
801
|
-
// targetTasks = targetParent.children || [];
|
|
802
|
-
// targetParent.children = targetTasks;
|
|
803
|
-
// } else {
|
|
804
|
-
// targetTasks = this.tasks;
|
|
805
|
-
// }
|
|
806
|
-
// // 更新任务的父任务和层级
|
|
807
|
-
// task.parent = targetParent;
|
|
808
|
-
// task.level = targetParent
|
|
809
|
-
// ? targetParent.level !== undefined
|
|
810
|
-
// ? targetParent.level + 1
|
|
811
|
-
// : 0
|
|
812
|
-
// : 0;
|
|
813
|
-
// // 更新子任务的层级
|
|
814
|
-
// if (task.children && task.children.length > 0) {
|
|
815
|
-
// this.updateChildrenLevel(task);
|
|
816
|
-
// }
|
|
817
|
-
// // 插入到目标位置
|
|
818
|
-
// if (index !== undefined && index >= 0 && index <= targetTasks.length) {
|
|
819
|
-
// targetTasks.splice(index, 0, task);
|
|
820
|
-
// } else {
|
|
821
|
-
// targetTasks.push(task);
|
|
822
|
-
// }
|
|
823
|
-
// this.invalidateCache(); // 移动任务后,缓存失效
|
|
824
|
-
// this.event.emit(EventName.VIEW_UPDATE);
|
|
825
|
-
// return task;
|
|
826
|
-
// }
|
|
790
|
+
moveTask(t, e, i) {
|
|
791
|
+
const s = this.getVisibleTasks()[i];
|
|
792
|
+
if (!e || !s || t === "inside" && e.isSomeoneChildren(s) || t !== "inside" && e.isSomeoneChildren(s.parent)) return;
|
|
793
|
+
const n = this.store.getOptionManager().getOptions().fields.id, o = this.store.getOptionManager().getOptions().fields.children;
|
|
794
|
+
if (e.parent && e.parent.children) {
|
|
795
|
+
e.parent.children = e.parent.children.filter(
|
|
796
|
+
(a) => a.id !== e.id
|
|
797
|
+
);
|
|
798
|
+
const r = e.parent.data[o] || [];
|
|
799
|
+
e.parent.data[o] = r.filter((a) => a[n] !== e.id);
|
|
800
|
+
} else
|
|
801
|
+
this.tasks = this.tasks.filter((r) => r.id !== e.id), this.rawData = this.rawData.filter((r) => r[n] !== e.id);
|
|
802
|
+
if (t === "inside")
|
|
803
|
+
s.children = s.children || [], s.children.push(e), e.parent = s, s.data[o] = s.data[o] || [], s.data[o].push(e.data);
|
|
804
|
+
else {
|
|
805
|
+
const r = s.parent ? s.parent.children : this.tasks, a = r.findIndex((d) => d.id === s.id), c = s.parent ? s.parent.data[o] || [] : this.rawData, u = c.findIndex((d) => d[n] === s.id);
|
|
806
|
+
t === "before" ? (r.splice(a, 0, e), c.splice(u, 0, e.data)) : t === "after" && (r.splice(a + 1, 0, e), c.splice(u + 1, 0, e.data)), e.parent = s.parent;
|
|
807
|
+
}
|
|
808
|
+
e.parent ? e.level = e.parent.level + 1 : e.level = 0, this.updateChildrenLevel(e), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE), O.info(`Task ${e.id} moved ${t} task ${s.id}`), this.event.emit(S.ROW_DRAG_END, s, e);
|
|
809
|
+
}
|
|
827
810
|
/**
|
|
828
811
|
* 展开任务
|
|
829
812
|
*/
|
|
@@ -831,7 +814,7 @@ class Jt {
|
|
|
831
814
|
const i = this.getTaskById(t);
|
|
832
815
|
return i ? (i.expanded = !i.expanded, i.expanded ? this.collapsedTaskIds.delete(i.id) : this.collapsedTaskIds.add(i.id), e && i.children && i.children.length > 0 && i.children.forEach((s) => {
|
|
833
816
|
this.expandTask(s.id, e);
|
|
834
|
-
}), this.invalidateCache(), this.event.emit(
|
|
817
|
+
}), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE), !0) : !1;
|
|
835
818
|
}
|
|
836
819
|
/**
|
|
837
820
|
* 按条件筛选任务
|
|
@@ -897,21 +880,19 @@ class Jt {
|
|
|
897
880
|
* 清空所有数据
|
|
898
881
|
*/
|
|
899
882
|
clear() {
|
|
900
|
-
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(
|
|
883
|
+
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(S.DATA_UPDATE);
|
|
901
884
|
}
|
|
902
885
|
/**
|
|
903
886
|
* 更新子任务的层级
|
|
904
887
|
*/
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
// });
|
|
914
|
-
// }
|
|
888
|
+
updateChildrenLevel(t) {
|
|
889
|
+
if (!t.children || t.children.length === 0)
|
|
890
|
+
return;
|
|
891
|
+
const e = t.level !== void 0 ? t.level : 0;
|
|
892
|
+
t.children.forEach((i) => {
|
|
893
|
+
i.level = e + 1, this.updateChildrenLevel(i);
|
|
894
|
+
});
|
|
895
|
+
}
|
|
915
896
|
/**
|
|
916
897
|
* 使缓存失效,标记需要重新生成扁平化任务列表
|
|
917
898
|
*/
|
|
@@ -925,7 +906,7 @@ class Jt {
|
|
|
925
906
|
*/
|
|
926
907
|
selectTask(t) {
|
|
927
908
|
const e = this.getTaskById(t);
|
|
928
|
-
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(
|
|
909
|
+
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(S.TASK_SELECTED, e)), !0) : !1;
|
|
929
910
|
}
|
|
930
911
|
/**
|
|
931
912
|
* 取消任务选择
|
|
@@ -933,7 +914,7 @@ class Jt {
|
|
|
933
914
|
unselectTask() {
|
|
934
915
|
if (this.selectedTaskId) {
|
|
935
916
|
const t = this.selectedTaskId;
|
|
936
|
-
this.selectedTaskId = null, this.event.emit(
|
|
917
|
+
this.selectedTaskId = null, this.event.emit(S.TASK_UNSELECTED, t);
|
|
937
918
|
}
|
|
938
919
|
}
|
|
939
920
|
/**
|
|
@@ -979,8 +960,8 @@ class Jt {
|
|
|
979
960
|
for (; a !== "none" && l.length > 0; ) {
|
|
980
961
|
const m = [];
|
|
981
962
|
l.forEach((p) => {
|
|
982
|
-
let g = p.startTime || o,
|
|
983
|
-
a === "scale" ? s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g.add(
|
|
963
|
+
let g = p.startTime || o, y = p.endTime || r, x = o.diff(t.startTime), v = r.diff(t.endTime);
|
|
964
|
+
a === "scale" ? s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g.add(x), y.add(v))) : s === "left" ? (g = g.add(x), g.isSameOrAfter(y.subtract(1, u)) && (y.isBefore(t.endTime) ? y = g.add(1, u) : g = y.subtract(1, u), g.isSameOrBefore(o) && (o = g)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, y)) : s === "right" && (y = y.add(v), y.isSameOrBefore(g.add(1, u)) && (g.isAfter(t.startTime) ? g = y.subtract(1, u) : y = g.add(1, u)), y.isSameOrAfter(r) && (r = y), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, y)) : a === "fixed" && (s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g.add(x), y.add(v))) : s === "left" ? g.isSameOrBefore(o) && (g = o, g.isSameOrAfter(y.subtract(1, u)) && (y.isBefore(t.endTime) ? y = g.add(1, u) : g = y.subtract(1, u), g.isSameOrBefore(o) && (o = g)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, y)) : s === "right" && y.isSameOrAfter(r) && (y = r, y.isSameOrBefore(g.add(1, u)) && (g.isAfter(t.startTime) ? g = y.subtract(1, u) : y = g.add(1, u)), y.isSameOrAfter(r) && (r = y), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, y))), p.children && p.children.length > 0 && m.push(...p.children);
|
|
984
965
|
}), l = m;
|
|
985
966
|
}
|
|
986
967
|
n.findIndex((m) => m.id === t.id) === -1 && n.push(t.clone()), t.updateTime(o, r);
|
|
@@ -1005,7 +986,7 @@ class Jt {
|
|
|
1005
986
|
return this.baselineTaskMap.get(t) || [];
|
|
1006
987
|
}
|
|
1007
988
|
}
|
|
1008
|
-
function
|
|
989
|
+
function Jt(f) {
|
|
1009
990
|
var s;
|
|
1010
991
|
if (typeof f == "object" && f !== null)
|
|
1011
992
|
return {
|
|
@@ -1074,7 +1055,7 @@ class et {
|
|
|
1074
1055
|
h(this, "_g");
|
|
1075
1056
|
h(this, "_b");
|
|
1076
1057
|
h(this, "_a");
|
|
1077
|
-
const e =
|
|
1058
|
+
const e = Jt(t);
|
|
1078
1059
|
e === null ? (O.error(`Failed to parse color: ${t}. Using default black.`), this._r = 0, this._g = 0, this._b = 0, this._a = 1) : (this._r = Math.round(e.r), this._g = Math.round(e.g), this._b = Math.round(e.b), this._a = e.a);
|
|
1079
1060
|
}
|
|
1080
1061
|
// --- Getters ---
|
|
@@ -1227,7 +1208,7 @@ class et {
|
|
|
1227
1208
|
}
|
|
1228
1209
|
}
|
|
1229
1210
|
const B = (f) => f instanceof et ? f : new et(f);
|
|
1230
|
-
class
|
|
1211
|
+
class Mt {
|
|
1231
1212
|
constructor(t, e, i) {
|
|
1232
1213
|
h(this, "element");
|
|
1233
1214
|
h(this, "iconElement");
|
|
@@ -1304,14 +1285,14 @@ class Lt {
|
|
|
1304
1285
|
)) : (this.context.store.getDataManager().updateCheckedList(!0, this.task), this.setState(
|
|
1305
1286
|
1
|
|
1306
1287
|
/* CHECKED */
|
|
1307
|
-
)), this.context.event.emit(
|
|
1288
|
+
)), this.context.event.emit(S.CHECK_TASK, [this.task], !e);
|
|
1308
1289
|
} else {
|
|
1309
1290
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1310
1291
|
this.setState(
|
|
1311
1292
|
e ? 1 : 0
|
|
1312
1293
|
/* UNCHECKED */
|
|
1313
1294
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1314
|
-
|
|
1295
|
+
S.CHECK_TASK,
|
|
1315
1296
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1316
1297
|
!e
|
|
1317
1298
|
);
|
|
@@ -1334,14 +1315,14 @@ class Lt {
|
|
|
1334
1315
|
}), this.setState(
|
|
1335
1316
|
1
|
|
1336
1317
|
/* CHECKED */
|
|
1337
|
-
)), this.context.event.emit(
|
|
1318
|
+
)), this.context.event.emit(S.CHECK_TASK, e, !i);
|
|
1338
1319
|
} else {
|
|
1339
1320
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1340
1321
|
this.setState(
|
|
1341
1322
|
e ? 1 : 0
|
|
1342
1323
|
/* UNCHECKED */
|
|
1343
1324
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1344
|
-
|
|
1325
|
+
S.CHECK_TASK,
|
|
1345
1326
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1346
1327
|
!e
|
|
1347
1328
|
);
|
|
@@ -1349,7 +1330,7 @@ class Lt {
|
|
|
1349
1330
|
});
|
|
1350
1331
|
}
|
|
1351
1332
|
registerEvents() {
|
|
1352
|
-
this.context.event.on(
|
|
1333
|
+
this.context.event.on(S.CHECK_TASK, this.updateState.bind(this));
|
|
1353
1334
|
}
|
|
1354
1335
|
/** 获取元素 */
|
|
1355
1336
|
getElement() {
|
|
@@ -1386,7 +1367,7 @@ class Lt {
|
|
|
1386
1367
|
this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
1387
1368
|
}
|
|
1388
1369
|
}
|
|
1389
|
-
const
|
|
1370
|
+
const vt = "handler_column";
|
|
1390
1371
|
class ee {
|
|
1391
1372
|
constructor(t) {
|
|
1392
1373
|
/** 源列数据 */
|
|
@@ -1448,10 +1429,10 @@ class ee {
|
|
|
1448
1429
|
s + 1
|
|
1449
1430
|
), m.maxLevel = Math.max(
|
|
1450
1431
|
m.maxLevel,
|
|
1451
|
-
m.children.reduce((
|
|
1432
|
+
m.children.reduce((y, x) => Math.max(y, x.maxLevel), 0)
|
|
1452
1433
|
);
|
|
1453
1434
|
}
|
|
1454
|
-
}), this.temporaryLeafColumns =
|
|
1435
|
+
}), this.temporaryLeafColumns = J(this.leafColumns);
|
|
1455
1436
|
}
|
|
1456
1437
|
/**
|
|
1457
1438
|
* 根据 key 查找列
|
|
@@ -1475,13 +1456,13 @@ class ee {
|
|
|
1475
1456
|
return this.isCollapsed() ? 0 : this.leafColumns.reduce((t, e) => t + e.width, this.getHandlerColumn().width);
|
|
1476
1457
|
}
|
|
1477
1458
|
getColumnWidth(t) {
|
|
1478
|
-
if (t ===
|
|
1459
|
+
if (t === vt) return this.getHandlerColumn().width;
|
|
1479
1460
|
const e = this.leafColumns.find((i) => i.key === t);
|
|
1480
1461
|
return typeof (e == null ? void 0 : e.width) == "number" ? e.width : 0;
|
|
1481
1462
|
}
|
|
1482
1463
|
setColumnWidth(t, e) {
|
|
1483
1464
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1484
|
-
i && (i.width = e), this.context.event.emit(
|
|
1465
|
+
i && (i.width = e), this.context.event.emit(S.COLUMN_WIDTH_CHANGE, t, e);
|
|
1485
1466
|
}
|
|
1486
1467
|
isLastColumn(t) {
|
|
1487
1468
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1498,7 +1479,12 @@ class ee {
|
|
|
1498
1479
|
}
|
|
1499
1480
|
getHandlerColumn() {
|
|
1500
1481
|
let t = 0;
|
|
1501
|
-
|
|
1482
|
+
const e = this.context.store.getOptionManager().getOptions().drag.enabled;
|
|
1483
|
+
e && (t += 40);
|
|
1484
|
+
const i = this.context.store.getOptionManager().getOptions().selection.enabled;
|
|
1485
|
+
i && (t += 40);
|
|
1486
|
+
const s = this.context.store.getOptionManager().getOptions().expand.show;
|
|
1487
|
+
return this.context.store.getDataManager().dataLevel > 0 && s && (t += 40), {
|
|
1502
1488
|
label: "",
|
|
1503
1489
|
level: 1,
|
|
1504
1490
|
maxLevel: 1,
|
|
@@ -1508,14 +1494,14 @@ class ee {
|
|
|
1508
1494
|
align: "left",
|
|
1509
1495
|
headerAlign: "left",
|
|
1510
1496
|
customStyle: {
|
|
1511
|
-
paddingLeft:
|
|
1497
|
+
paddingLeft: s ? `${e ? 40 : 8}px` : 0
|
|
1512
1498
|
},
|
|
1513
|
-
headerRender: () =>
|
|
1499
|
+
headerRender: () => i ? new Mt(this.context).getElement() : null,
|
|
1514
1500
|
ellipsis: !1
|
|
1515
1501
|
},
|
|
1516
1502
|
children: [],
|
|
1517
1503
|
path: [],
|
|
1518
|
-
key:
|
|
1504
|
+
key: vt,
|
|
1519
1505
|
isLeaf: !0,
|
|
1520
1506
|
width: t
|
|
1521
1507
|
};
|
|
@@ -1524,7 +1510,7 @@ class ee {
|
|
|
1524
1510
|
return this.columns.some((t) => t.maxLevel > 1);
|
|
1525
1511
|
}
|
|
1526
1512
|
collapse() {
|
|
1527
|
-
this.collapseTable = !this.collapseTable, this.context.event.emit(
|
|
1513
|
+
this.collapseTable = !this.collapseTable, this.context.event.emit(S.TOGGLE_COLLAPSE);
|
|
1528
1514
|
}
|
|
1529
1515
|
isCollapsed() {
|
|
1530
1516
|
return this.collapseTable;
|
|
@@ -1733,80 +1719,80 @@ const tt = class tt {
|
|
|
1733
1719
|
};
|
|
1734
1720
|
const i = this.forwardMemo.get(t), s = this.backwardMemo.get(t);
|
|
1735
1721
|
this.recordCacheAccess(t, !!(i && s));
|
|
1736
|
-
const n = (
|
|
1737
|
-
const w =
|
|
1722
|
+
const n = (x) => (this.fromLinksMap.get(x) || []).map((b) => this.getTask(b.to)).filter((b) => !!b), o = (x) => (this.toLinksMap.get(x) || []).map((b) => this.getTask(b.from)).filter((b) => !!b), r = (x, v, b = /* @__PURE__ */ new Set()) => {
|
|
1723
|
+
const w = x.id;
|
|
1738
1724
|
if (this.forwardMemo.has(w))
|
|
1739
1725
|
return this.recordCacheAccess(w, !0), this.forwardMemo.get(w);
|
|
1740
|
-
if (
|
|
1726
|
+
if (v.has(x.id) || b.has(x.id))
|
|
1741
1727
|
return [];
|
|
1742
|
-
|
|
1743
|
-
const C = n(
|
|
1744
|
-
let
|
|
1728
|
+
v.add(x.id), b.add(x.id);
|
|
1729
|
+
const C = n(x.id);
|
|
1730
|
+
let M = [];
|
|
1745
1731
|
if (C.length === 0)
|
|
1746
|
-
|
|
1732
|
+
M = [[x]];
|
|
1747
1733
|
else {
|
|
1748
1734
|
for (const E of C) {
|
|
1749
|
-
const
|
|
1750
|
-
for (const
|
|
1751
|
-
|
|
1735
|
+
const T = r(E, v, b);
|
|
1736
|
+
for (const L of T)
|
|
1737
|
+
M.push([x, ...L]);
|
|
1752
1738
|
}
|
|
1753
|
-
|
|
1739
|
+
M.length === 0 && (M = [[x]]);
|
|
1754
1740
|
}
|
|
1755
|
-
return
|
|
1756
|
-
}, a = (
|
|
1757
|
-
const w =
|
|
1741
|
+
return v.delete(x.id), M.length < 100 && (this.forwardMemo.set(w, M), this.recordCacheAccess(w, !1)), M;
|
|
1742
|
+
}, a = (x, v, b = /* @__PURE__ */ new Set()) => {
|
|
1743
|
+
const w = x.id;
|
|
1758
1744
|
if (this.backwardMemo.has(w))
|
|
1759
1745
|
return this.recordCacheAccess(w, !0), this.backwardMemo.get(w);
|
|
1760
|
-
if (
|
|
1746
|
+
if (v.has(x.id) || b.has(x.id))
|
|
1761
1747
|
return [];
|
|
1762
|
-
|
|
1763
|
-
const C = o(
|
|
1764
|
-
let
|
|
1748
|
+
v.add(x.id), b.add(x.id);
|
|
1749
|
+
const C = o(x.id);
|
|
1750
|
+
let M = [];
|
|
1765
1751
|
if (C.length === 0)
|
|
1766
|
-
|
|
1752
|
+
M = [[x]];
|
|
1767
1753
|
else {
|
|
1768
1754
|
for (const E of C) {
|
|
1769
|
-
const
|
|
1770
|
-
for (const
|
|
1771
|
-
|
|
1755
|
+
const T = a(E, v, b);
|
|
1756
|
+
for (const L of T)
|
|
1757
|
+
M.push([...L, x]);
|
|
1772
1758
|
}
|
|
1773
|
-
|
|
1759
|
+
M.length === 0 && (M = [[x]]);
|
|
1774
1760
|
}
|
|
1775
|
-
return
|
|
1761
|
+
return v.delete(x.id), M.length < 100 && (this.backwardMemo.set(w, M), this.recordCacheAccess(w, !1)), M;
|
|
1776
1762
|
}, c = a(e, /* @__PURE__ */ new Set()), u = r(e, /* @__PURE__ */ new Set());
|
|
1777
|
-
this.getDirectlyConnectedTasks(t).forEach((
|
|
1778
|
-
this.establishCacheDependency(t,
|
|
1763
|
+
this.getDirectlyConnectedTasks(t).forEach((x) => {
|
|
1764
|
+
this.establishCacheDependency(t, x.id), this.establishCacheDependency(x.id, t);
|
|
1779
1765
|
});
|
|
1780
|
-
const l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), p = (
|
|
1766
|
+
const l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), p = (x, v) => {
|
|
1781
1767
|
const b = [];
|
|
1782
|
-
for (const w of
|
|
1768
|
+
for (const w of x) {
|
|
1783
1769
|
w.forEach((C) => l.set(C.id, C));
|
|
1784
1770
|
for (let C = 0; C < w.length - 1; C++) {
|
|
1785
|
-
const
|
|
1786
|
-
if (
|
|
1787
|
-
const
|
|
1788
|
-
m.has(
|
|
1771
|
+
const M = w[C].id, E = w[C + 1].id, T = this.findLinkFast(M, E);
|
|
1772
|
+
if (T) {
|
|
1773
|
+
const L = `${T.from}-${T.to}-${T.type || "default"}`;
|
|
1774
|
+
m.has(L) || (b.push(T), m.set(L, T));
|
|
1789
1775
|
}
|
|
1790
1776
|
}
|
|
1791
1777
|
}
|
|
1792
1778
|
return b;
|
|
1793
|
-
}, g = p(c),
|
|
1779
|
+
}, g = p(c), y = p(u);
|
|
1794
1780
|
return {
|
|
1795
1781
|
prev: {
|
|
1796
|
-
chain: c.map((
|
|
1782
|
+
chain: c.map((x) => x.map((v) => v.getEmitData().data)),
|
|
1797
1783
|
nodes: c.flat().filter(
|
|
1798
|
-
(
|
|
1799
|
-
).map((
|
|
1784
|
+
(x, v, b) => b.findIndex((w) => w.id === x.id) === v
|
|
1785
|
+
).map((x) => x.getEmitData().data),
|
|
1800
1786
|
links: g
|
|
1801
1787
|
},
|
|
1802
1788
|
next: {
|
|
1803
|
-
chain: u.map((
|
|
1789
|
+
chain: u.map((x) => x.map((v) => v.getEmitData().data)),
|
|
1804
1790
|
nodes: u.flat().filter(
|
|
1805
|
-
(
|
|
1806
|
-
).map((
|
|
1807
|
-
links:
|
|
1791
|
+
(x, v, b) => b.findIndex((w) => w.id === x.id) === v
|
|
1792
|
+
).map((x) => x.getEmitData().data),
|
|
1793
|
+
links: y
|
|
1808
1794
|
},
|
|
1809
|
-
allNodes: Array.from(l.values()).map((
|
|
1795
|
+
allNodes: Array.from(l.values()).map((x) => x.getEmitData().data),
|
|
1810
1796
|
allLinks: Array.from(m.values()),
|
|
1811
1797
|
current: e.getEmitData().data
|
|
1812
1798
|
};
|
|
@@ -2145,39 +2131,39 @@ h(tt, "LINK_TYPE_MAP", {
|
|
|
2145
2131
|
SS: { from: "S", to: "S", description: "开始到开始" }
|
|
2146
2132
|
});
|
|
2147
2133
|
let ft = tt;
|
|
2148
|
-
var
|
|
2134
|
+
var N = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2149
2135
|
function U(f) {
|
|
2150
2136
|
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
2151
2137
|
}
|
|
2152
|
-
var
|
|
2138
|
+
var Lt = { exports: {} };
|
|
2153
2139
|
(function(f, t) {
|
|
2154
2140
|
(function(e, i) {
|
|
2155
2141
|
f.exports = i();
|
|
2156
|
-
})(
|
|
2157
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, a = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, u = 2628e6, d = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = { years: c, months: u, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(
|
|
2158
|
-
return
|
|
2159
|
-
}, p = function(
|
|
2160
|
-
return new w(
|
|
2161
|
-
}, g = function(
|
|
2162
|
-
return i.p(
|
|
2163
|
-
},
|
|
2164
|
-
return
|
|
2165
|
-
},
|
|
2166
|
-
return
|
|
2167
|
-
},
|
|
2168
|
-
return Math.abs(
|
|
2169
|
-
}, b = function(
|
|
2170
|
-
return
|
|
2142
|
+
})(N, function() {
|
|
2143
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, a = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, u = 2628e6, d = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = { years: c, months: u, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(M) {
|
|
2144
|
+
return M instanceof w;
|
|
2145
|
+
}, p = function(M, E, T) {
|
|
2146
|
+
return new w(M, T, E.$l);
|
|
2147
|
+
}, g = function(M) {
|
|
2148
|
+
return i.p(M) + "s";
|
|
2149
|
+
}, y = function(M) {
|
|
2150
|
+
return M < 0;
|
|
2151
|
+
}, x = function(M) {
|
|
2152
|
+
return y(M) ? Math.ceil(M) : Math.floor(M);
|
|
2153
|
+
}, v = function(M) {
|
|
2154
|
+
return Math.abs(M);
|
|
2155
|
+
}, b = function(M, E) {
|
|
2156
|
+
return M ? y(M) ? { negative: !0, format: "" + v(M) + E } : { negative: !1, format: "" + M + E } : { negative: !1, format: "" };
|
|
2171
2157
|
}, w = function() {
|
|
2172
|
-
function
|
|
2158
|
+
function M(T, L, A) {
|
|
2173
2159
|
var _ = this;
|
|
2174
|
-
if (this.$d = {}, this.$l = A,
|
|
2175
|
-
if (typeof
|
|
2176
|
-
if (typeof
|
|
2177
|
-
_.$d[g(W)] =
|
|
2160
|
+
if (this.$d = {}, this.$l = A, T === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), L) return p(T * l[g(L)], this);
|
|
2161
|
+
if (typeof T == "number") return this.$ms = T, this.parseFromMilliseconds(), this;
|
|
2162
|
+
if (typeof T == "object") return Object.keys(T).forEach(function(W) {
|
|
2163
|
+
_.$d[g(W)] = T[W];
|
|
2178
2164
|
}), this.calMilliseconds(), this;
|
|
2179
|
-
if (typeof
|
|
2180
|
-
var D =
|
|
2165
|
+
if (typeof T == "string") {
|
|
2166
|
+
var D = T.match(d);
|
|
2181
2167
|
if (D) {
|
|
2182
2168
|
var H = D.slice(2).map(function(W) {
|
|
2183
2169
|
return W != null ? Number(W) : 0;
|
|
@@ -2187,46 +2173,46 @@ var Mt = { exports: {} };
|
|
|
2187
2173
|
}
|
|
2188
2174
|
return this;
|
|
2189
2175
|
}
|
|
2190
|
-
var E =
|
|
2176
|
+
var E = M.prototype;
|
|
2191
2177
|
return E.calMilliseconds = function() {
|
|
2192
|
-
var
|
|
2193
|
-
this.$ms = Object.keys(this.$d).reduce(function(
|
|
2194
|
-
return
|
|
2178
|
+
var T = this;
|
|
2179
|
+
this.$ms = Object.keys(this.$d).reduce(function(L, A) {
|
|
2180
|
+
return L + (T.$d[A] || 0) * l[A];
|
|
2195
2181
|
}, 0);
|
|
2196
2182
|
}, E.parseFromMilliseconds = function() {
|
|
2197
|
-
var
|
|
2198
|
-
this.$d.years =
|
|
2183
|
+
var T = this.$ms;
|
|
2184
|
+
this.$d.years = x(T / c), T %= c, this.$d.months = x(T / u), T %= u, this.$d.days = x(T / r), T %= r, this.$d.hours = x(T / o), T %= o, this.$d.minutes = x(T / n), T %= n, this.$d.seconds = x(T / s), T %= s, this.$d.milliseconds = T;
|
|
2199
2185
|
}, E.toISOString = function() {
|
|
2200
|
-
var
|
|
2186
|
+
var T = b(this.$d.years, "Y"), L = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2201
2187
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
2202
2188
|
var _ = b(A, "D"), D = b(this.$d.hours, "H"), H = b(this.$d.minutes, "M"), W = this.$d.seconds || 0;
|
|
2203
2189
|
this.$d.milliseconds && (W += this.$d.milliseconds / 1e3, W = Math.round(1e3 * W) / 1e3);
|
|
2204
|
-
var I = b(W, "S"),
|
|
2190
|
+
var I = b(W, "S"), G = T.negative || L.negative || _.negative || D.negative || H.negative || I.negative, F = D.format || H.format || I.format ? "T" : "", z = (G ? "-" : "") + "P" + T.format + L.format + _.format + F + D.format + H.format + I.format;
|
|
2205
2191
|
return z === "P" || z === "-P" ? "P0D" : z;
|
|
2206
2192
|
}, E.toJSON = function() {
|
|
2207
2193
|
return this.toISOString();
|
|
2208
|
-
}, E.format = function(
|
|
2209
|
-
var
|
|
2210
|
-
return
|
|
2194
|
+
}, E.format = function(T) {
|
|
2195
|
+
var L = T || "YYYY-MM-DDTHH:mm:ss", A = { Y: this.$d.years, YY: i.s(this.$d.years, 2, "0"), YYYY: i.s(this.$d.years, 4, "0"), M: this.$d.months, MM: i.s(this.$d.months, 2, "0"), D: this.$d.days, DD: i.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: i.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: i.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: i.s(this.$d.seconds, 2, "0"), SSS: i.s(this.$d.milliseconds, 3, "0") };
|
|
2196
|
+
return L.replace(a, function(_, D) {
|
|
2211
2197
|
return D || String(A[_]);
|
|
2212
2198
|
});
|
|
2213
|
-
}, E.as = function(
|
|
2214
|
-
return this.$ms / l[g(
|
|
2215
|
-
}, E.get = function(
|
|
2216
|
-
var
|
|
2217
|
-
return A === "milliseconds" ?
|
|
2218
|
-
}, E.add = function(
|
|
2199
|
+
}, E.as = function(T) {
|
|
2200
|
+
return this.$ms / l[g(T)];
|
|
2201
|
+
}, E.get = function(T) {
|
|
2202
|
+
var L = this.$ms, A = g(T);
|
|
2203
|
+
return A === "milliseconds" ? L %= 1e3 : L = A === "weeks" ? x(L / l[A]) : this.$d[A], L || 0;
|
|
2204
|
+
}, E.add = function(T, L, A) {
|
|
2219
2205
|
var _;
|
|
2220
|
-
return _ =
|
|
2221
|
-
}, E.subtract = function(
|
|
2222
|
-
return this.add(
|
|
2223
|
-
}, E.locale = function(
|
|
2224
|
-
var
|
|
2225
|
-
return
|
|
2206
|
+
return _ = L ? T * l[g(L)] : m(T) ? T.$ms : p(T, this).$ms, p(this.$ms + _ * (A ? -1 : 1), this);
|
|
2207
|
+
}, E.subtract = function(T, L) {
|
|
2208
|
+
return this.add(T, L, !0);
|
|
2209
|
+
}, E.locale = function(T) {
|
|
2210
|
+
var L = this.clone();
|
|
2211
|
+
return L.$l = T, L;
|
|
2226
2212
|
}, E.clone = function() {
|
|
2227
2213
|
return p(this.$ms, this);
|
|
2228
|
-
}, E.humanize = function(
|
|
2229
|
-
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!
|
|
2214
|
+
}, E.humanize = function(T) {
|
|
2215
|
+
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!T);
|
|
2230
2216
|
}, E.valueOf = function() {
|
|
2231
2217
|
return this.asMilliseconds();
|
|
2232
2218
|
}, E.milliseconds = function() {
|
|
@@ -2261,31 +2247,31 @@ var Mt = { exports: {} };
|
|
|
2261
2247
|
return this.get("years");
|
|
2262
2248
|
}, E.asYears = function() {
|
|
2263
2249
|
return this.as("years");
|
|
2264
|
-
},
|
|
2265
|
-
}(), C = function(
|
|
2266
|
-
return
|
|
2250
|
+
}, M;
|
|
2251
|
+
}(), C = function(M, E, T) {
|
|
2252
|
+
return M.add(E.years() * T, "y").add(E.months() * T, "M").add(E.days() * T, "d").add(E.hours() * T, "h").add(E.minutes() * T, "m").add(E.seconds() * T, "s").add(E.milliseconds() * T, "ms");
|
|
2267
2253
|
};
|
|
2268
|
-
return function(
|
|
2269
|
-
e =
|
|
2270
|
-
var H =
|
|
2254
|
+
return function(M, E, T) {
|
|
2255
|
+
e = T, i = T().$utils(), T.duration = function(_, D) {
|
|
2256
|
+
var H = T.locale();
|
|
2271
2257
|
return p(_, { $l: H }, D);
|
|
2272
|
-
},
|
|
2273
|
-
var
|
|
2258
|
+
}, T.isDuration = m;
|
|
2259
|
+
var L = E.prototype.add, A = E.prototype.subtract;
|
|
2274
2260
|
E.prototype.add = function(_, D) {
|
|
2275
|
-
return m(_) ? C(this, _, 1) :
|
|
2261
|
+
return m(_) ? C(this, _, 1) : L.bind(this)(_, D);
|
|
2276
2262
|
}, E.prototype.subtract = function(_, D) {
|
|
2277
2263
|
return m(_) ? C(this, _, -1) : A.bind(this)(_, D);
|
|
2278
2264
|
};
|
|
2279
2265
|
};
|
|
2280
2266
|
});
|
|
2281
|
-
})(
|
|
2282
|
-
var ie =
|
|
2267
|
+
})(Lt);
|
|
2268
|
+
var ie = Lt.exports;
|
|
2283
2269
|
const se = /* @__PURE__ */ U(ie);
|
|
2284
2270
|
var Ot = { exports: {} };
|
|
2285
2271
|
(function(f, t) {
|
|
2286
2272
|
(function(e, i) {
|
|
2287
2273
|
f.exports = i();
|
|
2288
|
-
})(
|
|
2274
|
+
})(N, function() {
|
|
2289
2275
|
return function(e, i, s) {
|
|
2290
2276
|
i.prototype.isBetween = function(n, o, r, a) {
|
|
2291
2277
|
var c = s(n), u = s(o), d = (a = a || "()")[0] === "(", l = a[1] === ")";
|
|
@@ -2300,7 +2286,7 @@ var Dt = { exports: {} };
|
|
|
2300
2286
|
(function(f, t) {
|
|
2301
2287
|
(function(e, i) {
|
|
2302
2288
|
f.exports = i();
|
|
2303
|
-
})(
|
|
2289
|
+
})(N, function() {
|
|
2304
2290
|
return function(e, i) {
|
|
2305
2291
|
i.prototype.isSameOrBefore = function(s, n) {
|
|
2306
2292
|
return this.isSame(s, n) || this.isBefore(s, n);
|
|
@@ -2314,7 +2300,7 @@ var _t = { exports: {} };
|
|
|
2314
2300
|
(function(f, t) {
|
|
2315
2301
|
(function(e, i) {
|
|
2316
2302
|
f.exports = i();
|
|
2317
|
-
})(
|
|
2303
|
+
})(N, function() {
|
|
2318
2304
|
return function(e, i) {
|
|
2319
2305
|
i.prototype.isSameOrAfter = function(s, n) {
|
|
2320
2306
|
return this.isSame(s, n) || this.isAfter(s, n);
|
|
@@ -2328,25 +2314,25 @@ var At = { exports: {} };
|
|
|
2328
2314
|
(function(f, t) {
|
|
2329
2315
|
(function(e, i) {
|
|
2330
2316
|
f.exports = i();
|
|
2331
|
-
})(
|
|
2317
|
+
})(N, function() {
|
|
2332
2318
|
return function(e, i, s) {
|
|
2333
2319
|
var n = i.prototype, o = function(d) {
|
|
2334
2320
|
return d && (d.indexOf ? d : d.s);
|
|
2335
2321
|
}, r = function(d, l, m, p, g) {
|
|
2336
|
-
var
|
|
2322
|
+
var y = d.name ? d : d.$locale(), x = o(y[l]), v = o(y[m]), b = x || v.map(function(C) {
|
|
2337
2323
|
return C.slice(0, p);
|
|
2338
2324
|
});
|
|
2339
2325
|
if (!g) return b;
|
|
2340
|
-
var w =
|
|
2341
|
-
return b.map(function(C,
|
|
2342
|
-
return b[(
|
|
2326
|
+
var w = y.weekStart;
|
|
2327
|
+
return b.map(function(C, M) {
|
|
2328
|
+
return b[(M + (w || 0)) % 7];
|
|
2343
2329
|
});
|
|
2344
2330
|
}, a = function() {
|
|
2345
2331
|
return s.Ls[s.locale()];
|
|
2346
2332
|
}, c = function(d, l) {
|
|
2347
2333
|
return d.formats[l] || function(m) {
|
|
2348
|
-
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p, g,
|
|
2349
|
-
return g ||
|
|
2334
|
+
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p, g, y) {
|
|
2335
|
+
return g || y.slice(1);
|
|
2350
2336
|
});
|
|
2351
2337
|
}(d.formats[l.toUpperCase()]);
|
|
2352
2338
|
}, u = function() {
|
|
@@ -2406,7 +2392,7 @@ var It = { exports: {} };
|
|
|
2406
2392
|
(function(f, t) {
|
|
2407
2393
|
(function(e, i) {
|
|
2408
2394
|
f.exports = i();
|
|
2409
|
-
})(
|
|
2395
|
+
})(N, function() {
|
|
2410
2396
|
var e = "week", i = "year";
|
|
2411
2397
|
return function(s, n, o) {
|
|
2412
2398
|
var r = n.prototype;
|
|
@@ -2431,7 +2417,7 @@ var Ht = { exports: {} };
|
|
|
2431
2417
|
(function(f, t) {
|
|
2432
2418
|
(function(e, i) {
|
|
2433
2419
|
f.exports = i();
|
|
2434
|
-
})(
|
|
2420
|
+
})(N, function() {
|
|
2435
2421
|
return function(e, i) {
|
|
2436
2422
|
i.prototype.weekYear = function() {
|
|
2437
2423
|
var s = this.month(), n = this.week(), o = this.year();
|
|
@@ -2442,11 +2428,11 @@ var Ht = { exports: {} };
|
|
|
2442
2428
|
})(Ht);
|
|
2443
2429
|
var fe = Ht.exports;
|
|
2444
2430
|
const pe = /* @__PURE__ */ U(fe);
|
|
2445
|
-
var
|
|
2431
|
+
var Rt = { exports: {} };
|
|
2446
2432
|
(function(f, t) {
|
|
2447
2433
|
(function(e, i) {
|
|
2448
2434
|
f.exports = i();
|
|
2449
|
-
})(
|
|
2435
|
+
})(N, function() {
|
|
2450
2436
|
return function(e, i) {
|
|
2451
2437
|
var s = i.prototype, n = s.format;
|
|
2452
2438
|
s.format = function(o) {
|
|
@@ -2489,14 +2475,14 @@ var Gt = { exports: {} };
|
|
|
2489
2475
|
};
|
|
2490
2476
|
};
|
|
2491
2477
|
});
|
|
2492
|
-
})(
|
|
2493
|
-
var me =
|
|
2478
|
+
})(Rt);
|
|
2479
|
+
var me = Rt.exports;
|
|
2494
2480
|
const xe = /* @__PURE__ */ U(me);
|
|
2495
|
-
var
|
|
2481
|
+
var Gt = { exports: {} };
|
|
2496
2482
|
(function(f, t) {
|
|
2497
2483
|
(function(e, i) {
|
|
2498
2484
|
f.exports = i();
|
|
2499
|
-
})(
|
|
2485
|
+
})(N, function() {
|
|
2500
2486
|
return function(e, i, s) {
|
|
2501
2487
|
s.updateLocale = function(n, o) {
|
|
2502
2488
|
var r = s.Ls[n];
|
|
@@ -2506,14 +2492,14 @@ var Rt = { exports: {} };
|
|
|
2506
2492
|
};
|
|
2507
2493
|
};
|
|
2508
2494
|
});
|
|
2509
|
-
})(
|
|
2510
|
-
var ye =
|
|
2495
|
+
})(Gt);
|
|
2496
|
+
var ye = Gt.exports;
|
|
2511
2497
|
const we = /* @__PURE__ */ U(ye);
|
|
2512
2498
|
var Wt = { exports: {} };
|
|
2513
2499
|
(function(f, t) {
|
|
2514
2500
|
(function(e, i) {
|
|
2515
2501
|
f.exports = i();
|
|
2516
|
-
})(
|
|
2502
|
+
})(N, function() {
|
|
2517
2503
|
var e = "day";
|
|
2518
2504
|
return function(i, s, n) {
|
|
2519
2505
|
var o = function(c) {
|
|
@@ -2537,35 +2523,35 @@ var Wt = { exports: {} };
|
|
|
2537
2523
|
});
|
|
2538
2524
|
})(Wt);
|
|
2539
2525
|
var be = Wt.exports;
|
|
2540
|
-
const
|
|
2526
|
+
const ve = /* @__PURE__ */ U(be);
|
|
2541
2527
|
var $t = { exports: {} };
|
|
2542
2528
|
(function(f, t) {
|
|
2543
2529
|
(function(e, i) {
|
|
2544
2530
|
f.exports = i();
|
|
2545
|
-
})(
|
|
2531
|
+
})(N, function() {
|
|
2546
2532
|
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, i = {};
|
|
2547
2533
|
return function(s, n, o) {
|
|
2548
2534
|
var r, a = function(l, m, p) {
|
|
2549
2535
|
p === void 0 && (p = {});
|
|
2550
|
-
var g = new Date(l),
|
|
2551
|
-
|
|
2552
|
-
var b =
|
|
2553
|
-
return C || (C = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone:
|
|
2536
|
+
var g = new Date(l), y = function(x, v) {
|
|
2537
|
+
v === void 0 && (v = {});
|
|
2538
|
+
var b = v.timeZoneName || "short", w = x + "|" + b, C = i[w];
|
|
2539
|
+
return C || (C = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: x, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: b }), i[w] = C), C;
|
|
2554
2540
|
}(m, p);
|
|
2555
|
-
return
|
|
2541
|
+
return y.formatToParts(g);
|
|
2556
2542
|
}, c = function(l, m) {
|
|
2557
|
-
for (var p = a(l, m), g = [],
|
|
2558
|
-
var
|
|
2543
|
+
for (var p = a(l, m), g = [], y = 0; y < p.length; y += 1) {
|
|
2544
|
+
var x = p[y], v = x.type, b = x.value, w = e[v];
|
|
2559
2545
|
w >= 0 && (g[w] = parseInt(b, 10));
|
|
2560
2546
|
}
|
|
2561
|
-
var C = g[3],
|
|
2562
|
-
return (o.utc(E).valueOf() - (
|
|
2547
|
+
var C = g[3], M = C === 24 ? 0 : C, E = g[0] + "-" + g[1] + "-" + g[2] + " " + M + ":" + g[4] + ":" + g[5] + ":000", T = +l;
|
|
2548
|
+
return (o.utc(E).valueOf() - (T -= T % 1e3)) / 6e4;
|
|
2563
2549
|
}, u = n.prototype;
|
|
2564
2550
|
u.tz = function(l, m) {
|
|
2565
2551
|
l === void 0 && (l = r);
|
|
2566
|
-
var p, g = this.utcOffset(),
|
|
2552
|
+
var p, g = this.utcOffset(), y = this.toDate(), x = y.toLocaleString("en-US", { timeZone: l }), v = Math.round((y - new Date(x)) / 1e3 / 60), b = 15 * -Math.round(y.getTimezoneOffset() / 15) - v;
|
|
2567
2553
|
if (!Number(b)) p = this.utcOffset(0, m);
|
|
2568
|
-
else if (p = o(
|
|
2554
|
+
else if (p = o(x, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(b, !0), m) {
|
|
2569
2555
|
var w = p.utcOffset();
|
|
2570
2556
|
p = p.add(g - w, "minute");
|
|
2571
2557
|
}
|
|
@@ -2582,15 +2568,15 @@ var $t = { exports: {} };
|
|
|
2582
2568
|
var p = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
2583
2569
|
return d.call(p, l, m).tz(this.$x.$timezone, !0);
|
|
2584
2570
|
}, o.tz = function(l, m, p) {
|
|
2585
|
-
var g = p && m,
|
|
2586
|
-
if (typeof l != "string") return o(l).tz(
|
|
2587
|
-
var
|
|
2588
|
-
var
|
|
2589
|
-
if (E === A) return [
|
|
2590
|
-
var _ = c(
|
|
2591
|
-
return A === _ ? [
|
|
2592
|
-
}(o.utc(l, g).valueOf(),
|
|
2593
|
-
return C.$x.$timezone =
|
|
2571
|
+
var g = p && m, y = p || m || r, x = c(+o(), y);
|
|
2572
|
+
if (typeof l != "string") return o(l).tz(y);
|
|
2573
|
+
var v = function(M, E, T) {
|
|
2574
|
+
var L = M - 60 * E * 1e3, A = c(L, T);
|
|
2575
|
+
if (E === A) return [L, E];
|
|
2576
|
+
var _ = c(L -= 60 * (A - E) * 1e3, T);
|
|
2577
|
+
return A === _ ? [L, A] : [M - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
2578
|
+
}(o.utc(l, g).valueOf(), x, y), b = v[0], w = v[1], C = o(b).utcOffset(w);
|
|
2579
|
+
return C.$x.$timezone = y, C;
|
|
2594
2580
|
}, o.tz.guess = function() {
|
|
2595
2581
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2596
2582
|
}, o.tz.setDefault = function(l) {
|
|
@@ -2599,22 +2585,22 @@ var $t = { exports: {} };
|
|
|
2599
2585
|
};
|
|
2600
2586
|
});
|
|
2601
2587
|
})($t);
|
|
2602
|
-
var
|
|
2603
|
-
const Se = /* @__PURE__ */ U(
|
|
2588
|
+
var Te = $t.exports;
|
|
2589
|
+
const Se = /* @__PURE__ */ U(Te);
|
|
2604
2590
|
var Ft = { exports: {} };
|
|
2605
2591
|
(function(f, t) {
|
|
2606
2592
|
(function(e, i) {
|
|
2607
2593
|
f.exports = i();
|
|
2608
|
-
})(
|
|
2594
|
+
})(N, function() {
|
|
2609
2595
|
var e = "minute", i = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
|
|
2610
2596
|
return function(n, o, r) {
|
|
2611
2597
|
var a = o.prototype;
|
|
2612
2598
|
r.utc = function(g) {
|
|
2613
|
-
var
|
|
2614
|
-
return new o(
|
|
2599
|
+
var y = { date: g, utc: !0, args: arguments };
|
|
2600
|
+
return new o(y);
|
|
2615
2601
|
}, a.utc = function(g) {
|
|
2616
|
-
var
|
|
2617
|
-
return g ?
|
|
2602
|
+
var y = r(this.toDate(), { locale: this.$L, utc: !0 });
|
|
2603
|
+
return g ? y.add(this.utcOffset(), e) : y;
|
|
2618
2604
|
}, a.local = function() {
|
|
2619
2605
|
return r(this.toDate(), { locale: this.$L, utc: !1 });
|
|
2620
2606
|
};
|
|
@@ -2630,27 +2616,28 @@ var Ft = { exports: {} };
|
|
|
2630
2616
|
} else u.call(this);
|
|
2631
2617
|
};
|
|
2632
2618
|
var d = a.utcOffset;
|
|
2633
|
-
a.utcOffset = function(g,
|
|
2634
|
-
var
|
|
2635
|
-
if (
|
|
2619
|
+
a.utcOffset = function(g, y) {
|
|
2620
|
+
var x = this.$utils().u;
|
|
2621
|
+
if (x(g)) return this.$u ? 0 : x(this.$offset) ? d.call(this) : this.$offset;
|
|
2636
2622
|
if (typeof g == "string" && (g = function(C) {
|
|
2637
2623
|
C === void 0 && (C = "");
|
|
2638
|
-
var
|
|
2639
|
-
if (!
|
|
2640
|
-
var E = ("" +
|
|
2641
|
-
return
|
|
2624
|
+
var M = C.match(i);
|
|
2625
|
+
if (!M) return null;
|
|
2626
|
+
var E = ("" + M[0]).match(s) || ["-", 0, 0], T = E[0], L = 60 * +E[1] + +E[2];
|
|
2627
|
+
return L === 0 ? 0 : T === "+" ? L : -L;
|
|
2642
2628
|
}(g), g === null)) return this;
|
|
2643
|
-
var
|
|
2644
|
-
if (
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2629
|
+
var v = Math.abs(g) <= 16 ? 60 * g : g, b = this;
|
|
2630
|
+
if (y) return b.$offset = v, b.$u = g === 0, b;
|
|
2631
|
+
if (g !== 0) {
|
|
2632
|
+
var w = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
2633
|
+
(b = this.local().add(v + w, e)).$offset = v, b.$x.$localOffset = w;
|
|
2634
|
+
} else b = this.utc();
|
|
2635
|
+
return b;
|
|
2649
2636
|
};
|
|
2650
2637
|
var l = a.format;
|
|
2651
2638
|
a.format = function(g) {
|
|
2652
|
-
var
|
|
2653
|
-
return l.call(this,
|
|
2639
|
+
var y = g || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
2640
|
+
return l.call(this, y);
|
|
2654
2641
|
}, a.valueOf = function() {
|
|
2655
2642
|
var g = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
2656
2643
|
return this.$d.valueOf() - 6e4 * g;
|
|
@@ -2666,10 +2653,10 @@ var Ft = { exports: {} };
|
|
|
2666
2653
|
return g === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
|
|
2667
2654
|
};
|
|
2668
2655
|
var p = a.diff;
|
|
2669
|
-
a.diff = function(g,
|
|
2670
|
-
if (g && this.$u === g.$u) return p.call(this, g,
|
|
2671
|
-
var
|
|
2672
|
-
return p.call(
|
|
2656
|
+
a.diff = function(g, y, x) {
|
|
2657
|
+
if (g && this.$u === g.$u) return p.call(this, g, y, x);
|
|
2658
|
+
var v = this.local(), b = r(g).local();
|
|
2659
|
+
return p.call(v, b, y, x);
|
|
2673
2660
|
};
|
|
2674
2661
|
};
|
|
2675
2662
|
});
|
|
@@ -2680,18 +2667,18 @@ var Ce = { exports: {} };
|
|
|
2680
2667
|
(function(f, t) {
|
|
2681
2668
|
(function(e, i) {
|
|
2682
2669
|
f.exports = i();
|
|
2683
|
-
})(
|
|
2670
|
+
})(N, function() {
|
|
2684
2671
|
return { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(e) {
|
|
2685
2672
|
var i = ["th", "st", "nd", "rd"], s = e % 100;
|
|
2686
2673
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
2687
2674
|
} };
|
|
2688
2675
|
});
|
|
2689
2676
|
})(Ce);
|
|
2690
|
-
var
|
|
2677
|
+
var Me = { exports: {} };
|
|
2691
2678
|
(function(f, t) {
|
|
2692
2679
|
(function(e, i) {
|
|
2693
|
-
f.exports = i(
|
|
2694
|
-
})(
|
|
2680
|
+
f.exports = i(R);
|
|
2681
|
+
})(N, function(e) {
|
|
2695
2682
|
function i(o) {
|
|
2696
2683
|
return o && typeof o == "object" && "default" in o ? o : { default: o };
|
|
2697
2684
|
}
|
|
@@ -2703,37 +2690,37 @@ var Le = { exports: {} };
|
|
|
2703
2690
|
} };
|
|
2704
2691
|
return s.default.locale(n, null, !0), n;
|
|
2705
2692
|
});
|
|
2706
|
-
})(
|
|
2707
|
-
const
|
|
2693
|
+
})(Me);
|
|
2694
|
+
const Le = (f, t) => {
|
|
2708
2695
|
const e = t.prototype;
|
|
2709
2696
|
e.setLocale = function(s) {
|
|
2710
|
-
return this.$locale = s ||
|
|
2697
|
+
return this.$locale = s || R().locale(), this.$L = this.$locale, this;
|
|
2711
2698
|
};
|
|
2712
2699
|
const i = e.format;
|
|
2713
2700
|
e.format = function(s) {
|
|
2714
|
-
return this.$L =
|
|
2701
|
+
return this.$L = R().locale(), i.bind(this)(s);
|
|
2715
2702
|
};
|
|
2716
2703
|
};
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
function
|
|
2704
|
+
R.extend(se);
|
|
2705
|
+
R.extend(oe);
|
|
2706
|
+
R.extend(ae);
|
|
2707
|
+
R.extend(le);
|
|
2708
|
+
R.extend(ge);
|
|
2709
|
+
R.extend(de);
|
|
2710
|
+
R.extend(pe);
|
|
2711
|
+
R.extend(xe);
|
|
2712
|
+
R.extend(we);
|
|
2713
|
+
R.extend(ve);
|
|
2714
|
+
R.extend(Se);
|
|
2715
|
+
R.extend(Ee);
|
|
2716
|
+
R.extend(Le);
|
|
2717
|
+
function Tt(f) {
|
|
2731
2718
|
try {
|
|
2732
|
-
if (
|
|
2733
|
-
if (
|
|
2719
|
+
if (R.locale() === f) return;
|
|
2720
|
+
if (R.locale(f) !== f) throw Error();
|
|
2734
2721
|
O.info(`Locale set to ${f}`);
|
|
2735
2722
|
} catch {
|
|
2736
|
-
O.warn(`Failed to set locale ${f}, fallback to en`),
|
|
2723
|
+
O.warn(`Failed to set locale ${f}, fallback to en`), R.locale("en");
|
|
2737
2724
|
}
|
|
2738
2725
|
}
|
|
2739
2726
|
const ut = () => ({
|
|
@@ -2761,10 +2748,10 @@ const ut = () => ({
|
|
|
2761
2748
|
});
|
|
2762
2749
|
class Oe {
|
|
2763
2750
|
constructor() {
|
|
2764
|
-
h(this, "startTime",
|
|
2765
|
-
h(this, "endTime",
|
|
2751
|
+
h(this, "startTime", R().startOf("day"));
|
|
2752
|
+
h(this, "endTime", R().endOf("day"));
|
|
2766
2753
|
/** 结束的标准时间。切换单位会影响结尾的扩展,需要单独记录一个标准时间 */
|
|
2767
|
-
h(this, "targetEnd",
|
|
2754
|
+
h(this, "targetEnd", R().endOf("day"));
|
|
2768
2755
|
/** 固定起始日期 */
|
|
2769
2756
|
h(this, "strictStart", !1);
|
|
2770
2757
|
/** 固定截止日期 */
|
|
@@ -2785,7 +2772,7 @@ class Oe {
|
|
|
2785
2772
|
h(this, "cellWidth");
|
|
2786
2773
|
/** 用户设定的单位 */
|
|
2787
2774
|
h(this, "unit", "day");
|
|
2788
|
-
this.cellWidth =
|
|
2775
|
+
this.cellWidth = J(ut().normal);
|
|
2789
2776
|
}
|
|
2790
2777
|
getStartTime() {
|
|
2791
2778
|
return this.startTime;
|
|
@@ -2843,13 +2830,13 @@ class Oe {
|
|
|
2843
2830
|
month: "month",
|
|
2844
2831
|
quarter: "quarter"
|
|
2845
2832
|
}[i];
|
|
2846
|
-
n || O.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime =
|
|
2833
|
+
n || O.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime = R(s.startTime).startOf(this.getFinelyUnit()), this.strictStart = !0), s.endTime && (this.endTime = R(s.endTime).endOf(this.getFinelyUnit()), this.strictEnd = !0), s.cellWidth && (Ut(s.cellWidth) ? this.cellWidth = {
|
|
2847
2834
|
hour: s.cellWidth,
|
|
2848
2835
|
day: s.cellWidth,
|
|
2849
2836
|
week: s.cellWidth,
|
|
2850
2837
|
month: s.cellWidth,
|
|
2851
2838
|
quarter: s.cellWidth
|
|
2852
|
-
} :
|
|
2839
|
+
} : V(s.cellWidth) ? this.cellWidth = J(
|
|
2853
2840
|
ut()[s.cellWidth] || ut().normal
|
|
2854
2841
|
) : Et(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2855
2842
|
}
|
|
@@ -2929,7 +2916,7 @@ class Oe {
|
|
|
2929
2916
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2930
2917
|
if (i) return i;
|
|
2931
2918
|
}
|
|
2932
|
-
if (
|
|
2919
|
+
if (V(this.headerGroupFormat))
|
|
2933
2920
|
return t.format(this.headerGroupFormat);
|
|
2934
2921
|
switch (this.getGroupUnit()) {
|
|
2935
2922
|
case "month":
|
|
@@ -2949,7 +2936,7 @@ class Oe {
|
|
|
2949
2936
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2950
2937
|
if (i) return i;
|
|
2951
2938
|
}
|
|
2952
|
-
if (
|
|
2939
|
+
if (V(this.headerCellFormat))
|
|
2953
2940
|
return t.format(this.headerCellFormat);
|
|
2954
2941
|
switch (this.getChildUnit()) {
|
|
2955
2942
|
case "hour":
|
|
@@ -2998,7 +2985,7 @@ class De {
|
|
|
2998
2985
|
const i = yt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2999
2986
|
if (s && !X(s))
|
|
3000
2987
|
throw O.exception("Data should be a array.");
|
|
3001
|
-
this.optionManager = new
|
|
2988
|
+
this.optionManager = new Kt(), this.optionManager.setOptions(i), i.locale && Tt(i.locale), this.timeAxis = new Oe(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new ee(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new Zt(this, this.context.event), s && this.dataManager.setData(s, !0), (n = e == null ? void 0 : e.baselines) != null && n.data && this.dataManager.setBaselines(e.baselines.data), this.linkManager = new ft(this, this.context.event), X((o = e == null ? void 0 : e.links) == null ? void 0 : o.data) && this.linkManager.setLinks(e.links.data, !0), this.linkManager.setCycleDetection(((r = e == null ? void 0 : e.links) == null ? void 0 : r.enableCycleDetection) ?? !0);
|
|
3002
2989
|
}
|
|
3003
2990
|
getOptionManager() {
|
|
3004
2991
|
return this.optionManager;
|
|
@@ -3020,7 +3007,7 @@ class De {
|
|
|
3020
3007
|
const i = yt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
3021
3008
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((c) => {
|
|
3022
3009
|
c.updateMode();
|
|
3023
|
-
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((a = t.links) == null ? void 0 : a.enableCycleDetection) ?? !0), i.locale &&
|
|
3010
|
+
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((a = t.links) == null ? void 0 : a.enableCycleDetection) ?? !0), i.locale && Tt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
3024
3011
|
}
|
|
3025
3012
|
updateTime(t, e) {
|
|
3026
3013
|
this.timeAxis.setDate(t, e);
|
|
@@ -3233,7 +3220,7 @@ class _e {
|
|
|
3233
3220
|
}
|
|
3234
3221
|
// --- 事件处理 ---
|
|
3235
3222
|
emit(t, e, i) {
|
|
3236
|
-
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(
|
|
3223
|
+
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(S.SCROLL, {
|
|
3237
3224
|
x: this.scrollLeft,
|
|
3238
3225
|
y: this.scrollTop,
|
|
3239
3226
|
source: t
|
|
@@ -3435,7 +3422,7 @@ class _e {
|
|
|
3435
3422
|
this.unbindEvents(), this.clearTimeouts(), this.cancelAnimation(), this.scrollbarContainer.parentNode && this.scrollbarContainer.parentNode.removeChild(this.scrollbarContainer), this.rootElement = null, this.eventManager = null, this.hScrollbar = null, this.vScrollbar = null, this.hScrollThumb = null, this.vScrollThumb = null, this.scrollbarContainer = null, O.debug("Scrollbar destroyed");
|
|
3436
3423
|
}
|
|
3437
3424
|
}
|
|
3438
|
-
function
|
|
3425
|
+
function Z(f, t = "") {
|
|
3439
3426
|
const e = ["px", "%", "vh", "vw", "rem", "em"];
|
|
3440
3427
|
if (f == null)
|
|
3441
3428
|
return t;
|
|
@@ -3458,6 +3445,149 @@ function J(f, t = "") {
|
|
|
3458
3445
|
}
|
|
3459
3446
|
return t;
|
|
3460
3447
|
}
|
|
3448
|
+
class Ae {
|
|
3449
|
+
constructor(t, e, i) {
|
|
3450
|
+
h(this, "element");
|
|
3451
|
+
h(this, "isDragging", !1);
|
|
3452
|
+
h(this, "dragStartY", 0);
|
|
3453
|
+
h(this, "dragStartIndex", -1);
|
|
3454
|
+
h(this, "currentIndex", -1);
|
|
3455
|
+
h(this, "dragType", "inside");
|
|
3456
|
+
h(this, "canDrop", !1);
|
|
3457
|
+
h(this, "ghostElement", null);
|
|
3458
|
+
h(this, "placeholderElement", null);
|
|
3459
|
+
h(this, "animationFrameId", null);
|
|
3460
|
+
h(this, "rowElement", null);
|
|
3461
|
+
h(this, "handleMouseDown", (t) => {
|
|
3462
|
+
if (!this.task || !this.container) {
|
|
3463
|
+
O.warn("DragHandler: task or container is not defined");
|
|
3464
|
+
return;
|
|
3465
|
+
}
|
|
3466
|
+
if (this.rowElement = this.container.closest(".x-gantt-table-row"), !this.rowElement) {
|
|
3467
|
+
O.warn("Row element not found", this.container);
|
|
3468
|
+
return;
|
|
3469
|
+
}
|
|
3470
|
+
t.preventDefault(), t.stopPropagation(), this.isDragging = !0, this.dragStartY = t.clientY + this.context.getScrollbar().getScrollPosition().y, this.dragStartIndex = this.task.flatIndex, this.currentIndex = this.dragStartIndex, this.createGhostElement(t), this.createPlaceholderElement(t), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", (e) => {
|
|
3471
|
+
e.key === "Escape" && this.isDragging && this.cleanup();
|
|
3472
|
+
}), O.debug(`Drag started for task ${this.task.id} at index ${this.dragStartIndex}`);
|
|
3473
|
+
});
|
|
3474
|
+
h(this, "handleMouseMove", (t) => {
|
|
3475
|
+
!this.isDragging || !this.task || !this.container || (this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.animationFrameId = requestAnimationFrame(() => {
|
|
3476
|
+
var l, m, p, g;
|
|
3477
|
+
const e = this.context.getRootElement();
|
|
3478
|
+
if (!e) return;
|
|
3479
|
+
const i = e.getBoundingClientRect(), s = this.context.getOptions().header.height, n = this.context.getOptions().row.height, o = this.context.getScrollbar().getScrollPosition(), r = t.clientY - i.top - s + o.y, a = Math.max(0, Math.min(
|
|
3480
|
+
Math.floor(r / n),
|
|
3481
|
+
this.context.store.getDataManager().getVisibleSize() - 1
|
|
3482
|
+
)), c = r % n;
|
|
3483
|
+
let u;
|
|
3484
|
+
c < n * 0.25 ? u = "before" : c > n * 0.75 ? u = "after" : u = "inside", this.dragType = u, this.updateGhostPosition(t.clientY - i.top), this.canDrop = !1;
|
|
3485
|
+
const d = this.context.store.getDataManager().getVisibleTasks()[a];
|
|
3486
|
+
((l = this.context.getOptions().drag.drop) == null ? void 0 : l.crossLevel) === !0 ? u == "inside" ? this.canDrop = !this.task.isSomeoneChildren(d) : this.canDrop = this.task.id !== d.id && !this.task.isSomeoneChildren(d.parent) : u !== "inside" && (this.canDrop = ((m = this.task.parent) == null ? void 0 : m.id) === ((p = d.parent) == null ? void 0 : p.id) && this.task.id !== d.id), this.canDrop === !0 && (g = this.context.getOptions().drag.drop) != null && g.allowed && (this.canDrop = this.context.getOptions().drag.drop.allowed(d.getEmitData(), this.task.getEmitData())), this.updatePlaceholderPosition(a, u, i, o, this.canDrop), this.currentIndex !== a && (this.currentIndex = a);
|
|
3487
|
+
}));
|
|
3488
|
+
});
|
|
3489
|
+
h(this, "handleMouseUp", (t) => {
|
|
3490
|
+
!this.isDragging || !this.task || (this.canDrop && this.context.store.getDataManager().moveTask(this.dragType, this.task, this.currentIndex), this.cleanup());
|
|
3491
|
+
});
|
|
3492
|
+
var s;
|
|
3493
|
+
this.context = t, this.container = e, this.task = i, this.element = document.createElement("div"), this.createElement(), this.bindEvents(), (s = this.container) == null || s.appendChild(this.element);
|
|
3494
|
+
}
|
|
3495
|
+
createElement() {
|
|
3496
|
+
this.element.className = "x-gantt-drag-handle", this.element.style.color = this.context.getOptions().drag.color || "#999", this.element.innerHTML = '<svg t="1746781386866" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3253" width="14" height="14"><path d="M384 128m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="currentColor" p-id="3254"></path><path d="M384 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="currentColor" p-id="3255"></path><path d="M384 896m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="currentColor" p-id="3256"></path><path d="M704 128m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="currentColor" p-id="3257"></path><path d="M704 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z" fill="currentColor" p-id="3258"></path><path d="M704 896m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 -0Z" fill="currentColor" p-id="3259"></path></svg>';
|
|
3497
|
+
}
|
|
3498
|
+
bindEvents() {
|
|
3499
|
+
this.element.addEventListener("mousedown", this.handleMouseDown), this.element.addEventListener("selectstart", (t) => t.preventDefault());
|
|
3500
|
+
}
|
|
3501
|
+
/**
|
|
3502
|
+
* 创建拖拽跟随影像
|
|
3503
|
+
*/
|
|
3504
|
+
createGhostElement(t) {
|
|
3505
|
+
if (!this.container || !this.task || !this.rowElement) return;
|
|
3506
|
+
this.ghostElement = document.createElement("div"), this.ghostElement.className = "x-gantt-drag-ghost", this.ghostElement.innerHTML = this.rowElement.innerHTML;
|
|
3507
|
+
const e = this.context.getRootElement();
|
|
3508
|
+
if (!e) return;
|
|
3509
|
+
const i = e.getBoundingClientRect(), s = this.rowElement.getBoundingClientRect();
|
|
3510
|
+
this.context.store.getTimeAxis().getTotalWidth(), this.ghostElement.style.position = "absolute", this.ghostElement.style.left = "0px", this.ghostElement.style.top = `${t.clientY - i.top - s.height / 2}px`, this.ghostElement.style.width = `${i.width}px`, this.ghostElement.style.height = `${s.height}px`, this.ghostElement.style.pointerEvents = "none", this.ghostElement.style.zIndex = "10000", this.ghostElement.style.opacity = "0.8", this.ghostElement.style.borderRadius = "4px", this.ghostElement.style.overflow = "hidden", this.ghostElement.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
3511
|
+
const n = document.createElement("div");
|
|
3512
|
+
n.style.cssText = `
|
|
3513
|
+
position: absolute;
|
|
3514
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
3515
|
+
background: linear-gradient(to right,
|
|
3516
|
+
rgba(255,255,255,0) 0%,
|
|
3517
|
+
rgba(255,255,255,0.3) 50%,
|
|
3518
|
+
rgba(255,255,255,0.9) 100%);
|
|
3519
|
+
pointer-events: none;
|
|
3520
|
+
`, (this.context.getRootElement() || document.body).appendChild(this.ghostElement), O.debug("Ghost element created");
|
|
3521
|
+
}
|
|
3522
|
+
/**
|
|
3523
|
+
* 更新 ghost 元素位置
|
|
3524
|
+
*/
|
|
3525
|
+
updateGhostPosition(t) {
|
|
3526
|
+
if (!this.ghostElement || !this.rowElement) return;
|
|
3527
|
+
const e = this.context.getRootElement();
|
|
3528
|
+
if (!e) return;
|
|
3529
|
+
const i = e.getBoundingClientRect(), s = this.context.getOptions().row.height, n = 0, o = i.height - s, r = Math.max(n, Math.min(t - s / 2, o));
|
|
3530
|
+
this.ghostElement.style.top = `${r}px`;
|
|
3531
|
+
}
|
|
3532
|
+
/**
|
|
3533
|
+
* 创建插入占位符元素
|
|
3534
|
+
*/
|
|
3535
|
+
createPlaceholderElement(t) {
|
|
3536
|
+
if (!this.rowElement) return;
|
|
3537
|
+
this.placeholderElement = document.createElement("div"), this.placeholderElement.className = "x-gantt-drag-placeholder", this.placeholderElement.style.cssText = `
|
|
3538
|
+
position: absolute;
|
|
3539
|
+
left: 0;
|
|
3540
|
+
top: ${t.clientY}px;
|
|
3541
|
+
opacity: 0;
|
|
3542
|
+
width: 100%;
|
|
3543
|
+
height: ${this.context.getOptions().row.height}px;
|
|
3544
|
+
background-color: ${B(this.context.getOptions().drag.targetBackgroundColor || this.context.getOptions().primaryColor).toString()};
|
|
3545
|
+
pointer-events: none;
|
|
3546
|
+
z-index: 9999;
|
|
3547
|
+
transition: all 0.1s ease;
|
|
3548
|
+
box-sizing: border-box;
|
|
3549
|
+
`, this.context.getRootElement().appendChild(this.placeholderElement);
|
|
3550
|
+
}
|
|
3551
|
+
/**
|
|
3552
|
+
* 更新占位符的位置
|
|
3553
|
+
*/
|
|
3554
|
+
updatePlaceholderPosition(t, e, i, s, n) {
|
|
3555
|
+
var d;
|
|
3556
|
+
if (!this.placeholderElement) return;
|
|
3557
|
+
if (!n) {
|
|
3558
|
+
this.placeholderElement.style.opacity = "0", this.context.getRootElement().style.setProperty("cursor", "not-allowed", "important");
|
|
3559
|
+
return;
|
|
3560
|
+
}
|
|
3561
|
+
this.context.getRootElement().style.setProperty("cursor", "grabbing", "important");
|
|
3562
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height;
|
|
3563
|
+
let a = o + t * r;
|
|
3564
|
+
e === "after" && (a += r);
|
|
3565
|
+
const c = a - s.y, u = e === "inside" ? r : 2;
|
|
3566
|
+
this.placeholderElement.style.top = `${c}px`, this.placeholderElement.style.height = `${u}px`, this.placeholderElement.style.opacity === "0" && (this.placeholderElement.style.opacity = ((d = this.context.getOptions().drag.targetOpacity) == null ? void 0 : d.toString()) || "0.2"), e === "inside" ? (this.placeholderElement.style.backgroundColor = B(
|
|
3567
|
+
this.context.getOptions().drag.targetBackgroundColor || this.context.getOptions().primaryColor
|
|
3568
|
+
).alpha(0.1).toString(), this.placeholderElement.style.border = `2px dashed ${B(
|
|
3569
|
+
this.context.getOptions().drag.targetBackgroundColor || this.context.getOptions().primaryColor
|
|
3570
|
+
).toString()}`) : (this.placeholderElement.style.backgroundColor = B(
|
|
3571
|
+
this.context.getOptions().drag.targetBackgroundColor || this.context.getOptions().primaryColor
|
|
3572
|
+
).toString(), this.placeholderElement.style.border = "none");
|
|
3573
|
+
}
|
|
3574
|
+
/**
|
|
3575
|
+
* 清理拖拽状态
|
|
3576
|
+
*/
|
|
3577
|
+
cleanup() {
|
|
3578
|
+
this.isDragging = !1, this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.ghostElement && this.ghostElement.parentNode && (this.ghostElement.parentNode.removeChild(this.ghostElement), this.ghostElement = null), this.placeholderElement && this.placeholderElement.parentNode && (this.placeholderElement.parentNode.removeChild(this.placeholderElement), this.placeholderElement = null), this.rowElement = null, document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp);
|
|
3579
|
+
}
|
|
3580
|
+
/** 获取元素 */
|
|
3581
|
+
getElement() {
|
|
3582
|
+
return this.element;
|
|
3583
|
+
}
|
|
3584
|
+
/**
|
|
3585
|
+
* 销毁组件
|
|
3586
|
+
*/
|
|
3587
|
+
destroy() {
|
|
3588
|
+
this.cleanup(), this.element.removeEventListener("mousedown", this.handleMouseDown), this.element.removeEventListener("selectstart", (t) => t.preventDefault()), this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element), O.debug("DragHandler destroyed");
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3461
3591
|
class st {
|
|
3462
3592
|
/**
|
|
3463
3593
|
* 创建表格单元格
|
|
@@ -3486,7 +3616,7 @@ class st {
|
|
|
3486
3616
|
}
|
|
3487
3617
|
setContent() {
|
|
3488
3618
|
const t = document.createElement("div");
|
|
3489
|
-
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", (this.column.column.ellipsis ?? this.context.getOptions().table.ellipsis ?? !0) && (t.style.textOverflow = "ellipsis"), t.style.whiteSpace = "nowrap", t.style.flex = "1", t.style.height = "100%", t.style.alignContent = "center", this.colIndex === 0 && (t.style.paddingLeft =
|
|
3619
|
+
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", (this.column.column.ellipsis ?? this.context.getOptions().table.ellipsis ?? !0) && (t.style.textOverflow = "ellipsis"), t.style.whiteSpace = "nowrap", t.style.flex = "1", t.style.height = "100%", t.style.alignContent = "center", this.colIndex === 0 && (t.style.paddingLeft = Z(
|
|
3490
3620
|
this.task.level * this.context.getOptions().row.indent,
|
|
3491
3621
|
"16px"
|
|
3492
3622
|
)), typeof this.column.column.render == "function")
|
|
@@ -3505,15 +3635,21 @@ class st {
|
|
|
3505
3635
|
}
|
|
3506
3636
|
setHandler() {
|
|
3507
3637
|
const t = document.createElement("div");
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3638
|
+
t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", t.style.whiteSpace = "nowrap", t.style.display = "inline-flex", t.style.flex = "1", t.style.height = "100%";
|
|
3639
|
+
const e = this.context.getOptions().drag.enabled !== !1, i = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().drag.enabled, this.task), s = ["0.3", "0.3", "0.4"];
|
|
3640
|
+
if (e || (s[0] = "0", s[1] = "0.5", s[2] = "0.5"), e) {
|
|
3641
|
+
const n = document.createElement("div");
|
|
3642
|
+
n.style.flex = s[0], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", i && new Ae(this.context, n, this.task), t.appendChild(n);
|
|
3643
|
+
}
|
|
3644
|
+
if (this.context.getOptions().selection.enabled) {
|
|
3645
|
+
const n = document.createElement("div");
|
|
3646
|
+
n.style.flex = s[1], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", new Mt(this.context, n, this.task), t.appendChild(n);
|
|
3511
3647
|
}
|
|
3512
3648
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
3513
|
-
const
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
}), t.appendChild(
|
|
3649
|
+
const n = document.createElement("div");
|
|
3650
|
+
n.className = "x-gantt-table-cell__expand", n.style.flex = s[2], n.style.color = this.context.getOptions().primaryColor, n.style.display = "flex", n.style.alignItems = "center", n.style.justifyContent = "center", n.style.height = "100%", n.style.width = "14px", n.style.height = "100%", n.style.cursor = "pointer", n.innerHTML = '<svg t="1746693752280" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2612" width="14" height="14"><path d="M724.48 521.728c-1.8432 7.7824-5.7344 14.848-11.3664 20.48l-341.9136 342.016c-16.6912 16.6912-43.7248 16.6912-60.3136 0s-16.6912-43.7248 0-60.3136L622.6944 512 310.8864 200.0896c-16.6912-16.6912-16.6912-43.7248 0-60.3136 16.6912-16.6912 43.7248-16.6912 60.3136 0l341.9136 341.9136c10.8544 10.8544 14.6432 26.112 11.3664 40.0384z" fill="currentColor" p-id="2613"></path></svg>', n.style.transform = this.task.expanded ? "rotate(90deg)" : "", n.addEventListener("click", (o) => {
|
|
3651
|
+
o.stopPropagation(), this.context.store.getDataManager().expandTask(this.task.id, !1);
|
|
3652
|
+
}), t.appendChild(n);
|
|
3517
3653
|
}
|
|
3518
3654
|
this.element.appendChild(t);
|
|
3519
3655
|
}
|
|
@@ -3528,20 +3664,20 @@ class st {
|
|
|
3528
3664
|
*/
|
|
3529
3665
|
updateWidth() {
|
|
3530
3666
|
if (this.isHandler) {
|
|
3531
|
-
this.element.style.width =
|
|
3667
|
+
this.element.style.width = Z(
|
|
3532
3668
|
this.context.store.getColumnManager().getHandlerColumn().width
|
|
3533
3669
|
);
|
|
3534
3670
|
return;
|
|
3535
3671
|
}
|
|
3536
3672
|
const t = this.context.store.getColumnManager().getLeafColumns().slice(this.colIndex, this.colIndex + Math.max(1, this.colspan)).reduce((e, i) => e + i.width, 0);
|
|
3537
|
-
this.element.style.width =
|
|
3673
|
+
this.element.style.width = Z(t);
|
|
3538
3674
|
}
|
|
3539
3675
|
/**
|
|
3540
3676
|
* 更新高度
|
|
3541
3677
|
*/
|
|
3542
3678
|
updateHeight() {
|
|
3543
3679
|
const t = this.context.getOptions().row.height;
|
|
3544
|
-
this.element.style.height =
|
|
3680
|
+
this.element.style.height = Z(t * Math.max(1, this.rowspan));
|
|
3545
3681
|
}
|
|
3546
3682
|
}
|
|
3547
3683
|
class St {
|
|
@@ -3563,28 +3699,28 @@ class St {
|
|
|
3563
3699
|
*/
|
|
3564
3700
|
bindEvents() {
|
|
3565
3701
|
this.element.addEventListener("mouseenter", () => {
|
|
3566
|
-
this.context.event.emit(
|
|
3702
|
+
this.context.event.emit(S.ROW_HIGHLIGHT, this.task.id);
|
|
3567
3703
|
}), this.element.addEventListener("mouseleave", () => {
|
|
3568
|
-
this.context.event.emit(
|
|
3704
|
+
this.context.event.emit(S.ROW_UNHIGHLIGHT, this.task.id);
|
|
3569
3705
|
}), this.element.addEventListener("click", (t) => {
|
|
3570
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) ||
|
|
3706
|
+
this.context.store.getDataManager().isTaskSelected(this.task.id) || this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(S.ROW_CLICK, t, this.task);
|
|
3571
3707
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
3572
|
-
this.context.event.emit(
|
|
3708
|
+
this.context.event.emit(S.ROW_DBL_CLICK, t, this.task);
|
|
3573
3709
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
3574
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3710
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(S.ROW_CONTEXTMENU, t, this.task);
|
|
3575
3711
|
});
|
|
3576
3712
|
}
|
|
3577
3713
|
/**
|
|
3578
3714
|
* 注册全局接收事件
|
|
3579
3715
|
*/
|
|
3580
3716
|
registerEvents() {
|
|
3581
|
-
this.context.event.on(
|
|
3717
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
3582
3718
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
3583
|
-
}), this.context.event.on(
|
|
3719
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
3584
3720
|
this.task.id === t && this.element.classList.remove("hover");
|
|
3585
|
-
}), this.context.event.on(
|
|
3721
|
+
}), this.context.event.on(S.TASK_SELECTED, (t) => {
|
|
3586
3722
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
3587
|
-
}), this.context.event.on(
|
|
3723
|
+
}), this.context.event.on(S.TASK_UNSELECTED, (t) => {
|
|
3588
3724
|
this.task.id === t && this.element.classList.remove("selected");
|
|
3589
3725
|
});
|
|
3590
3726
|
}
|
|
@@ -3734,7 +3870,7 @@ class St {
|
|
|
3734
3870
|
this.clearCells(), this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
3735
3871
|
}
|
|
3736
3872
|
}
|
|
3737
|
-
class
|
|
3873
|
+
class Ie {
|
|
3738
3874
|
constructor(t, e) {
|
|
3739
3875
|
h(this, "element");
|
|
3740
3876
|
h(this, "rows", /* @__PURE__ */ new Map());
|
|
@@ -3824,7 +3960,7 @@ class pt {
|
|
|
3824
3960
|
"important"
|
|
3825
3961
|
);
|
|
3826
3962
|
const n = document.createElement("div");
|
|
3827
|
-
if (n.className = "x-gantt-table-header-cell__content", n.style.flex = "1", n.style.textAlign = i, n.style.overflow = "hidden", n.style.whiteSpace = "nowrap", s && (n.style.textOverflow = "ellipsis"), n.style.position = "relative", n.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, n.style.fontSize =
|
|
3963
|
+
if (n.className = "x-gantt-table-header-cell__content", n.style.flex = "1", n.style.textAlign = i, n.style.overflow = "hidden", n.style.whiteSpace = "nowrap", s && (n.style.textOverflow = "ellipsis"), n.style.position = "relative", n.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, n.style.fontSize = Z(
|
|
3828
3964
|
this.context.getOptions().header.fontSize
|
|
3829
3965
|
), n.style.setProperty(
|
|
3830
3966
|
"color",
|
|
@@ -3855,14 +3991,14 @@ class pt {
|
|
|
3855
3991
|
const o = (c) => {
|
|
3856
3992
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3857
3993
|
const u = (l) => r(l), d = (l) => a(l, u, d);
|
|
3858
|
-
document.addEventListener("mousemove", u), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(
|
|
3994
|
+
document.addEventListener("mousemove", u), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(S.SHOW_GUIDELINE, n);
|
|
3859
3995
|
}, r = (c) => {
|
|
3860
3996
|
if (c.preventDefault(), !s) return;
|
|
3861
3997
|
const u = c.clientX - e, d = i + u, l = Math.max(50, d), m = e - s.left - i, g = this.root.clientWidth - 20;
|
|
3862
|
-
let
|
|
3863
|
-
|
|
3998
|
+
let y = m + l;
|
|
3999
|
+
y = Math.min(g, y), this.context.event.emit(S.MOVE_GUIDELINE, y);
|
|
3864
4000
|
}, a = (c, u, d) => {
|
|
3865
|
-
document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", d), this.context.event.emit(
|
|
4001
|
+
document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", d), this.context.event.emit(S.HIDE_GUIDELINE);
|
|
3866
4002
|
const l = c.clientX - e, m = Math.max(50, i + l);
|
|
3867
4003
|
this.setWidth(m);
|
|
3868
4004
|
};
|
|
@@ -3883,7 +4019,7 @@ class xt {
|
|
|
3883
4019
|
"border-color",
|
|
3884
4020
|
this.context.getOptions().border.color,
|
|
3885
4021
|
"important"
|
|
3886
|
-
), this.titleContainer.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, this.titleContainer.style.fontSize =
|
|
4022
|
+
), this.titleContainer.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, this.titleContainer.style.fontSize = Z(
|
|
3887
4023
|
this.context.getOptions().header.fontSize
|
|
3888
4024
|
), this.titleContainer.style.fontFamily = this.context.getOptions().header.fontFamily, this.titleContainer.style.setProperty(
|
|
3889
4025
|
"color",
|
|
@@ -3913,7 +4049,7 @@ class xt {
|
|
|
3913
4049
|
});
|
|
3914
4050
|
}
|
|
3915
4051
|
}
|
|
3916
|
-
class
|
|
4052
|
+
class He {
|
|
3917
4053
|
constructor(t, e) {
|
|
3918
4054
|
h(this, "headerElement");
|
|
3919
4055
|
h(this, "headerColumns", []);
|
|
@@ -3973,12 +4109,12 @@ class Ie {
|
|
|
3973
4109
|
});
|
|
3974
4110
|
}
|
|
3975
4111
|
}
|
|
3976
|
-
class
|
|
4112
|
+
class Re {
|
|
3977
4113
|
constructor(t, e) {
|
|
3978
4114
|
h(this, "tableContainer");
|
|
3979
4115
|
h(this, "tableHeader");
|
|
3980
4116
|
h(this, "tableBody");
|
|
3981
|
-
this.context = t, this.container = e, this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table-container", this.tableContainer.style.position = "relative", this.tableContainer.style.width = "100%", this.tableContainer.style.height = "100%", this.tableContainer.style.overflow = "hidden", this.tableContainer.style.display = "flex", this.tableContainer.style.flexDirection = "column", this.container.appendChild(this.tableContainer), this.tableHeader = new
|
|
4117
|
+
this.context = t, this.container = e, this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table-container", this.tableContainer.style.position = "relative", this.tableContainer.style.width = "100%", this.tableContainer.style.height = "100%", this.tableContainer.style.overflow = "hidden", this.tableContainer.style.display = "flex", this.tableContainer.style.flexDirection = "column", this.container.appendChild(this.tableContainer), this.tableHeader = new He(t, this.tableContainer), this.tableBody = new Ie(t, this.tableContainer), this.listenEvents();
|
|
3982
4118
|
}
|
|
3983
4119
|
render(t, e) {
|
|
3984
4120
|
this.tableHeader.render(), this.refresh(t, e);
|
|
@@ -3993,9 +4129,9 @@ class He {
|
|
|
3993
4129
|
this.tableBody.updateTask(t);
|
|
3994
4130
|
}
|
|
3995
4131
|
listenEvents() {
|
|
3996
|
-
this.context.event.on(
|
|
4132
|
+
this.context.event.on(S.UPDATE_TABLE_HEADER, () => {
|
|
3997
4133
|
this.tableHeader.render();
|
|
3998
|
-
}), this.context.event.on(
|
|
4134
|
+
}), this.context.event.on(S.UPDATE_TABLE_BODY, () => {
|
|
3999
4135
|
this.tableBody.update();
|
|
4000
4136
|
});
|
|
4001
4137
|
}
|
|
@@ -4013,10 +4149,10 @@ class Ge {
|
|
|
4013
4149
|
h(this, "width", 0);
|
|
4014
4150
|
h(this, "height", 0);
|
|
4015
4151
|
h(this, "offsetX", 0);
|
|
4016
|
-
this.context = t, this.layer = e, this.background = new
|
|
4152
|
+
this.context = t, this.layer = e, this.background = new k.Rect({
|
|
4017
4153
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
4018
4154
|
name: "header-background"
|
|
4019
|
-
}), this.layer.add(this.background), this.groupHeader = new
|
|
4155
|
+
}), this.layer.add(this.background), this.groupHeader = new k.Group({ name: "primary-header" }), this.cellHeader = new k.Group({ name: "secondary-header" }), this.layer.add(this.groupHeader), this.layer.add(this.cellHeader), this.registerEvents();
|
|
4020
4156
|
}
|
|
4021
4157
|
/**
|
|
4022
4158
|
* 调整表头大小
|
|
@@ -4035,11 +4171,11 @@ class Ge {
|
|
|
4035
4171
|
* 注册事件监听
|
|
4036
4172
|
*/
|
|
4037
4173
|
registerEvents() {
|
|
4038
|
-
this.context.event.on(
|
|
4174
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
4039
4175
|
this.highlightDate(t);
|
|
4040
|
-
}), this.context.event.on(
|
|
4176
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
4041
4177
|
this.unhighlightDate(t);
|
|
4042
|
-
}), this.context.event.on(
|
|
4178
|
+
}), this.context.event.on(S.UPDATE_TASK, (t) => {
|
|
4043
4179
|
this.highlightDate(t.id);
|
|
4044
4180
|
});
|
|
4045
4181
|
}
|
|
@@ -4057,13 +4193,13 @@ class Ge {
|
|
|
4057
4193
|
this.clearHeader();
|
|
4058
4194
|
const t = this.context.store.getTimeAxis(), e = t.getCellWidth(), i = Math.max(0, -this.offsetX), s = i + this.width, n = Math.floor(this.height / 2), o = this.context.getOptions().border.color;
|
|
4059
4195
|
this.layer.add(
|
|
4060
|
-
new
|
|
4196
|
+
new k.Line({
|
|
4061
4197
|
points: [0, n, this.width, n],
|
|
4062
4198
|
stroke: o,
|
|
4063
4199
|
strokeWidth: 1
|
|
4064
4200
|
})
|
|
4065
4201
|
), this.layer.add(
|
|
4066
|
-
new
|
|
4202
|
+
new k.Line({
|
|
4067
4203
|
points: [0, this.height, this.width, this.height],
|
|
4068
4204
|
stroke: o,
|
|
4069
4205
|
strokeWidth: 1
|
|
@@ -4090,18 +4226,18 @@ class Ge {
|
|
|
4090
4226
|
);
|
|
4091
4227
|
if (this.groupHeader.add(p), X(d.children) && d.children.length > 0) {
|
|
4092
4228
|
let g = a;
|
|
4093
|
-
for (let
|
|
4094
|
-
const
|
|
4095
|
-
let
|
|
4096
|
-
for (; d.children[
|
|
4097
|
-
|
|
4098
|
-
if (
|
|
4099
|
-
let
|
|
4100
|
-
for (; r[u + 1].children[
|
|
4101
|
-
r[u + 1].children[
|
|
4102
|
-
|
|
4229
|
+
for (let y = 0; y < d.children.length; ) {
|
|
4230
|
+
const x = d.children[y];
|
|
4231
|
+
let v = 1;
|
|
4232
|
+
for (; d.children[y + v] && x.label === d.children[y + v].label; )
|
|
4233
|
+
v++;
|
|
4234
|
+
if (y += v, y >= d.children.length && r[u + 1] && r[u + 1].children) {
|
|
4235
|
+
let M = 0;
|
|
4236
|
+
for (; r[u + 1].children[M] && x.label === r[u + 1].children[M].label; )
|
|
4237
|
+
r[u + 1].children[M].hide = !0, M++;
|
|
4238
|
+
M > 0 && (v += M);
|
|
4103
4239
|
}
|
|
4104
|
-
const b = e *
|
|
4240
|
+
const b = e * v;
|
|
4105
4241
|
if (g + b < i) {
|
|
4106
4242
|
g += b;
|
|
4107
4243
|
continue;
|
|
@@ -4109,15 +4245,15 @@ class Ge {
|
|
|
4109
4245
|
if (g > s)
|
|
4110
4246
|
break;
|
|
4111
4247
|
const C = this.createCell(
|
|
4112
|
-
`cell-${
|
|
4248
|
+
`cell-${x.date.format("YYYY-MM-DD")}`,
|
|
4113
4249
|
g,
|
|
4114
4250
|
n,
|
|
4115
4251
|
b,
|
|
4116
4252
|
n,
|
|
4117
|
-
|
|
4118
|
-
|
|
4253
|
+
x.hide ? "transparent" : o,
|
|
4254
|
+
x.hide ? "" : x.label
|
|
4119
4255
|
);
|
|
4120
|
-
this.cellHeader.add(C),
|
|
4256
|
+
this.cellHeader.add(C), x.hide && C.visible(!1), g += b;
|
|
4121
4257
|
}
|
|
4122
4258
|
}
|
|
4123
4259
|
a += l;
|
|
@@ -4125,9 +4261,9 @@ class Ge {
|
|
|
4125
4261
|
this.layer.batchDraw();
|
|
4126
4262
|
}
|
|
4127
4263
|
createCell(t, e, i, s, n, o, r) {
|
|
4128
|
-
const a = new
|
|
4264
|
+
const a = new k.Group();
|
|
4129
4265
|
a.x(e), a.y(i);
|
|
4130
|
-
const c = new
|
|
4266
|
+
const c = new k.Rect({
|
|
4131
4267
|
id: t,
|
|
4132
4268
|
x: 0,
|
|
4133
4269
|
y: 0,
|
|
@@ -4139,14 +4275,14 @@ class Ge {
|
|
|
4139
4275
|
a.add(c);
|
|
4140
4276
|
let u = this.context.getOptions().header.fontSize;
|
|
4141
4277
|
t.startsWith("cell-") && (this.cellCache.set(t, c), u -= 2);
|
|
4142
|
-
const d = new
|
|
4278
|
+
const d = new k.Line({
|
|
4143
4279
|
points: [s, 0, s, n],
|
|
4144
4280
|
stroke: o,
|
|
4145
4281
|
strokeWidth: 1,
|
|
4146
4282
|
name: "header-cell-right-border"
|
|
4147
4283
|
});
|
|
4148
4284
|
a.add(d);
|
|
4149
|
-
const l = new
|
|
4285
|
+
const l = new k.Text({
|
|
4150
4286
|
x: 0,
|
|
4151
4287
|
y: 0,
|
|
4152
4288
|
width: s,
|
|
@@ -4200,23 +4336,23 @@ class Ge {
|
|
|
4200
4336
|
`cell-${(r = e == null ? void 0 : e.endTime) == null ? void 0 : r.format("YYYY-MM-DD")}`
|
|
4201
4337
|
), n = this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor;
|
|
4202
4338
|
n && (this.cellCache.forEach((a) => {
|
|
4203
|
-
new
|
|
4339
|
+
new k.Tween({
|
|
4204
4340
|
node: a,
|
|
4205
4341
|
fill: n,
|
|
4206
4342
|
duration: 0.02
|
|
4207
4343
|
}).play();
|
|
4208
|
-
}), t === "in" && (i && new
|
|
4344
|
+
}), t === "in" && (i && new k.Tween({
|
|
4209
4345
|
node: i,
|
|
4210
4346
|
fill: B(n).brighten(30).toHex(),
|
|
4211
4347
|
duration: 0.02
|
|
4212
|
-
}).play(), s && new
|
|
4348
|
+
}).play(), s && new k.Tween({
|
|
4213
4349
|
node: s,
|
|
4214
4350
|
fill: B(n).brighten(30).toHex(),
|
|
4215
4351
|
duration: 0
|
|
4216
4352
|
}).play()));
|
|
4217
4353
|
}
|
|
4218
4354
|
}
|
|
4219
|
-
class
|
|
4355
|
+
class We {
|
|
4220
4356
|
constructor(t, e) {
|
|
4221
4357
|
// 网格线组
|
|
4222
4358
|
h(this, "verticalLines");
|
|
@@ -4226,7 +4362,7 @@ class Re {
|
|
|
4226
4362
|
h(this, "height", 0);
|
|
4227
4363
|
h(this, "offsetX", 0);
|
|
4228
4364
|
h(this, "offsetY", 0);
|
|
4229
|
-
this.context = t, this.layer = e, this.verticalLines = new
|
|
4365
|
+
this.context = t, this.layer = e, this.verticalLines = new k.Group({ name: "vertical-grid-lines" }), this.horizontalLines = new k.Group({ name: "horizontal-grid-lines" }), this.layer.add(this.verticalLines), this.layer.add(this.horizontalLines);
|
|
4230
4366
|
}
|
|
4231
4367
|
/**
|
|
4232
4368
|
* 调整网格大小
|
|
@@ -4272,7 +4408,7 @@ class Re {
|
|
|
4272
4408
|
);
|
|
4273
4409
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
4274
4410
|
for (let d = r; d <= a; d++) {
|
|
4275
|
-
const l = d * i, m = new
|
|
4411
|
+
const l = d * i, m = new k.Line({
|
|
4276
4412
|
points: [l, t, l, o + t],
|
|
4277
4413
|
stroke: this.context.getOptions().border.color,
|
|
4278
4414
|
strokeWidth: 0.5,
|
|
@@ -4281,7 +4417,7 @@ class Re {
|
|
|
4281
4417
|
this.verticalLines.add(m);
|
|
4282
4418
|
}
|
|
4283
4419
|
for (let d = c; d <= u; d++) {
|
|
4284
|
-
const l = d * s + t, m = new
|
|
4420
|
+
const l = d * s + t, m = new k.Line({
|
|
4285
4421
|
points: [0, l, Math.max(this.width, e), l],
|
|
4286
4422
|
stroke: this.context.getOptions().border.color,
|
|
4287
4423
|
strokeWidth: 0.5,
|
|
@@ -4298,7 +4434,7 @@ class Re {
|
|
|
4298
4434
|
}
|
|
4299
4435
|
}
|
|
4300
4436
|
const kt = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><path fill="currentColor" fill-rule="evenodd" d="M5.5 4.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m4 0a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25M10.625 7.5a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 8.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m5.125 2.875a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 12.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25" clip-rule="evenodd"/></svg>';
|
|
4301
|
-
class
|
|
4437
|
+
class $e {
|
|
4302
4438
|
constructor(t, e, i, s, n) {
|
|
4303
4439
|
h(this, "offsetX", 0);
|
|
4304
4440
|
h(this, "offsetY", 0);
|
|
@@ -4328,7 +4464,7 @@ class We {
|
|
|
4328
4464
|
h(this, "dragDiffX", 0);
|
|
4329
4465
|
// 记录拖拽时的原始数据
|
|
4330
4466
|
h(this, "oldTasks", []);
|
|
4331
|
-
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new
|
|
4467
|
+
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new k.Group({
|
|
4332
4468
|
x: e,
|
|
4333
4469
|
y: i,
|
|
4334
4470
|
id: `chart-slider-bar-${s.id}`
|
|
@@ -4345,12 +4481,12 @@ class We {
|
|
|
4345
4481
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
4346
4482
|
}
|
|
4347
4483
|
registerEvents() {
|
|
4348
|
-
this.context.event.on(
|
|
4484
|
+
this.context.event.on(S.SLIDER_BLINK, (t) => {
|
|
4349
4485
|
t === this.task.id && this.handleBarBlink();
|
|
4350
4486
|
});
|
|
4351
4487
|
}
|
|
4352
4488
|
render() {
|
|
4353
|
-
var p, g,
|
|
4489
|
+
var p, g, y, x, v, b, w, C, M, E, T, L, A;
|
|
4354
4490
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4355
4491
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4356
4492
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
@@ -4362,18 +4498,18 @@ class We {
|
|
|
4362
4498
|
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, r = this.unpackFunc(this.context.getOptions().bar.backgroundColor) || this.context.getOptions().primaryColor, a = ot(
|
|
4363
4499
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4364
4500
|
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", u = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, d = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, l = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4365
|
-
this.slider || (this.slider = new
|
|
4501
|
+
this.slider || (this.slider = new k.Group({
|
|
4366
4502
|
dragBoundFunc: (_) => {
|
|
4367
4503
|
let D = Math.min(0, -(-this.offsetX - this.slider.x()));
|
|
4368
4504
|
const H = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime);
|
|
4369
4505
|
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(H - (-this.offsetX + this.sliderGroup.getStage().width()));
|
|
4370
4506
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
4371
4507
|
if (this.task.parent.startTime) {
|
|
4372
|
-
const
|
|
4373
|
-
D = this.context.store.getTimeAxis().getTimeLeft(
|
|
4508
|
+
const G = this.task.parent.startTime;
|
|
4509
|
+
D = this.context.store.getTimeAxis().getTimeLeft(G);
|
|
4374
4510
|
}
|
|
4375
4511
|
if (this.task.parent.endTime) {
|
|
4376
|
-
const
|
|
4512
|
+
const G = this.task.parent.endTime, F = this.context.store.getTimeAxis().getTimeLeft(G);
|
|
4377
4513
|
W = Math.abs(F - this.slider.width());
|
|
4378
4514
|
}
|
|
4379
4515
|
}
|
|
@@ -4390,23 +4526,23 @@ class We {
|
|
|
4390
4526
|
shadowBlur: Math.max((u || 1) * 2, 4),
|
|
4391
4527
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4392
4528
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4393
|
-
}), this.context.event.emit(
|
|
4529
|
+
}), this.context.event.emit(S.SLIDER_ENTER, _.evt, this.task);
|
|
4394
4530
|
}), this.slider.on("mousemove", (_) => {
|
|
4395
|
-
this.context.event.emit(
|
|
4531
|
+
this.context.event.emit(S.SLIDER_HOVER, _.evt, this.task);
|
|
4396
4532
|
}), this.slider.on("mouseout", (_) => {
|
|
4397
4533
|
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4398
4534
|
shadowColor: c,
|
|
4399
4535
|
shadowBlur: u,
|
|
4400
4536
|
shadowOffsetX: d,
|
|
4401
4537
|
shadowOffsetY: l
|
|
4402
|
-
}), this.context.event.emit(
|
|
4538
|
+
}), this.context.event.emit(S.SLIDER_LEAVE, _.evt, this.task);
|
|
4403
4539
|
}), this.task.isMilestone()) {
|
|
4404
4540
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4405
|
-
const _ = this.unpackFunc(this.context.getOptions().milestone.size), D = Math.min(_ || e, t / 2), H = this.unpackFunc(this.context.getOptions().milestone.color) || r, W = this.unpackFunc(this.context.getOptions().milestone.border.color), I = this.unpackFunc(this.context.getOptions().milestone.border.width),
|
|
4541
|
+
const _ = this.unpackFunc(this.context.getOptions().milestone.size), D = Math.min(_ || e, t / 2), H = this.unpackFunc(this.context.getOptions().milestone.color) || r, W = this.unpackFunc(this.context.getOptions().milestone.border.color), I = this.unpackFunc(this.context.getOptions().milestone.border.width), G = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
4406
4542
|
if (!this.sliderBar) {
|
|
4407
|
-
switch (
|
|
4543
|
+
switch (G) {
|
|
4408
4544
|
case "triangle":
|
|
4409
|
-
this.sliderBar = new
|
|
4545
|
+
this.sliderBar = new k.RegularPolygon({
|
|
4410
4546
|
sides: 3,
|
|
4411
4547
|
radius: D,
|
|
4412
4548
|
rotation: 0,
|
|
@@ -4418,7 +4554,7 @@ class We {
|
|
|
4418
4554
|
});
|
|
4419
4555
|
break;
|
|
4420
4556
|
case "circle":
|
|
4421
|
-
this.sliderBar = new
|
|
4557
|
+
this.sliderBar = new k.Circle({
|
|
4422
4558
|
radius: D,
|
|
4423
4559
|
fill: H,
|
|
4424
4560
|
stroke: W,
|
|
@@ -4428,7 +4564,7 @@ class We {
|
|
|
4428
4564
|
});
|
|
4429
4565
|
break;
|
|
4430
4566
|
case "star":
|
|
4431
|
-
this.sliderBar = new
|
|
4567
|
+
this.sliderBar = new k.Star({
|
|
4432
4568
|
numPoints: 5,
|
|
4433
4569
|
innerRadius: D / 2,
|
|
4434
4570
|
outerRadius: D,
|
|
@@ -4441,7 +4577,7 @@ class We {
|
|
|
4441
4577
|
break;
|
|
4442
4578
|
case "diamond":
|
|
4443
4579
|
default:
|
|
4444
|
-
this.sliderBar = new
|
|
4580
|
+
this.sliderBar = new k.RegularPolygon({
|
|
4445
4581
|
sides: 4,
|
|
4446
4582
|
radius: D,
|
|
4447
4583
|
rotation: 0,
|
|
@@ -4453,40 +4589,40 @@ class We {
|
|
|
4453
4589
|
});
|
|
4454
4590
|
}
|
|
4455
4591
|
if (this.slider.add(this.sliderBar), this.unpackFunc(this.context.getOptions().milestone.label.show)) {
|
|
4456
|
-
const F = this.unpackFunc(this.context.getOptions().milestone.label.text), z = this.unpackFunc(this.context.getOptions().milestone.label.position), q = this.unpackFunc(this.context.getOptions().milestone.label.fontSize), zt = this.unpackFunc(this.context.getOptions().milestone.label.fontFamily),
|
|
4592
|
+
const F = this.unpackFunc(this.context.getOptions().milestone.label.text), z = this.unpackFunc(this.context.getOptions().milestone.label.position), q = this.unpackFunc(this.context.getOptions().milestone.label.fontSize), zt = this.unpackFunc(this.context.getOptions().milestone.label.fontFamily), Pt = this.unpackFunc(this.context.getOptions().milestone.label.color), it = new k.Text({
|
|
4457
4593
|
height: e,
|
|
4458
4594
|
text: F,
|
|
4459
|
-
fill:
|
|
4595
|
+
fill: Pt || H,
|
|
4460
4596
|
fontSize: q,
|
|
4461
4597
|
fontFamily: zt
|
|
4462
4598
|
}), at = it.measureSize(F);
|
|
4463
4599
|
it.width(at.width);
|
|
4464
|
-
const
|
|
4600
|
+
const K = { x: 0, y: 0 };
|
|
4465
4601
|
switch (z) {
|
|
4466
4602
|
case "top-left":
|
|
4467
|
-
|
|
4603
|
+
K.x = -(12 + at.width), K.y = -8;
|
|
4468
4604
|
break;
|
|
4469
4605
|
case "bottom-left":
|
|
4470
|
-
|
|
4606
|
+
K.x = -(12 + at.width), K.y = 10;
|
|
4471
4607
|
break;
|
|
4472
4608
|
case "bottom-right":
|
|
4473
|
-
|
|
4609
|
+
K.x = 12, K.y = 10;
|
|
4474
4610
|
break;
|
|
4475
4611
|
case "top-right":
|
|
4476
4612
|
default:
|
|
4477
|
-
|
|
4613
|
+
K.x = 12, K.y = -8;
|
|
4478
4614
|
break;
|
|
4479
4615
|
}
|
|
4480
|
-
it.setAttrs(
|
|
4616
|
+
it.setAttrs(K), this.slider.add(it);
|
|
4481
4617
|
}
|
|
4482
4618
|
}
|
|
4483
4619
|
this.sliderType = "milestone";
|
|
4484
4620
|
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
4485
4621
|
this.sliderBar && this.sliderType !== "summary" && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4486
|
-
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2, H = t * 0.3, W = (I) => new
|
|
4487
|
-
sceneFunc: (
|
|
4622
|
+
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2, H = t * 0.3, W = (I) => new k.Shape({
|
|
4623
|
+
sceneFunc: (G, F) => {
|
|
4488
4624
|
const z = H * 0.5;
|
|
4489
|
-
|
|
4625
|
+
G.beginPath(), G.moveTo(0, (t - D) / 2), G.lineTo(z, (t - D) / 2), G.lineTo(z, (t - D) / 2 + D), G.lineTo(0, (t - D) / 2 + D + H), G.lineTo(0, (t - D) / 2), G.rect(z, (t - D) / 2, I - 2 * z, D), G.moveTo(I - z, (t - D) / 2), G.lineTo(I, (t - D) / 2), G.lineTo(I, (t - D) / 2 + D + H), G.lineTo(I - z, (t - D) / 2 + D), G.lineTo(I - z, (t - D) / 2), G.fillStrokeShape(F);
|
|
4490
4626
|
},
|
|
4491
4627
|
width: I,
|
|
4492
4628
|
fill: _,
|
|
@@ -4504,7 +4640,7 @@ class We {
|
|
|
4504
4640
|
shadowOffsetY: l
|
|
4505
4641
|
}), this.sliderType = "summary";
|
|
4506
4642
|
} else {
|
|
4507
|
-
this.sliderBar && this.sliderType !== "bar" && (this.slider.destroyChildren(), this.sliderBar = null), this.sliderBar || (this.sliderBar = new
|
|
4643
|
+
this.sliderBar && this.sliderType !== "bar" && (this.slider.destroyChildren(), this.sliderBar = null), this.sliderBar || (this.sliderBar = new k.Rect({
|
|
4508
4644
|
x: 0,
|
|
4509
4645
|
y: 0
|
|
4510
4646
|
}), this.slider.add(this.sliderBar), this.sliderType = "bar"), this.sliderBar.setAttrs({
|
|
@@ -4513,10 +4649,10 @@ class We {
|
|
|
4513
4649
|
fill: r,
|
|
4514
4650
|
cornerRadius: a
|
|
4515
4651
|
}), this.renderProgress(o, e);
|
|
4516
|
-
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (g = this.context.getOptions().bar.move.single) == null ? void 0 : g.backgroundColor, H = D ? B(D).alpha(((
|
|
4652
|
+
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (g = this.context.getOptions().bar.move.single) == null ? void 0 : g.backgroundColor, H = D ? B(D).alpha(((y = this.context.getOptions().bar.move.single) == null ? void 0 : y.opacity) ?? 1).toHex() : B(r).brighten(30 * (this.unpackFunc((x = this.context.getOptions().bar.progress) == null ? void 0 : x.show) ? -1 : 1)).alpha(((v = this.context.getOptions().bar.move.single) == null ? void 0 : v.opacity) ?? 1).toHex();
|
|
4517
4653
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
4518
4654
|
if (!this.leftHandleGroup) {
|
|
4519
|
-
this.leftHandleGroup = new
|
|
4655
|
+
this.leftHandleGroup = new k.Group({
|
|
4520
4656
|
x: 0,
|
|
4521
4657
|
y: 0,
|
|
4522
4658
|
opacity: 0
|
|
@@ -4529,13 +4665,13 @@ class We {
|
|
|
4529
4665
|
}), this.leftHandleGroup.on("mouseout", (F) => {
|
|
4530
4666
|
this.isDragging || (F.target.getStage().container().style.cursor = "default");
|
|
4531
4667
|
});
|
|
4532
|
-
const
|
|
4668
|
+
const G = new k.Rect({
|
|
4533
4669
|
x: 0,
|
|
4534
4670
|
y: 0
|
|
4535
4671
|
});
|
|
4536
|
-
this.leftHandleGroup.add(
|
|
4672
|
+
this.leftHandleGroup.add(G), _ !== null && bt(_ || kt, this.handlerWidth, e).then((F) => {
|
|
4537
4673
|
var q;
|
|
4538
|
-
const z = new
|
|
4674
|
+
const z = new k.Image({
|
|
4539
4675
|
image: F,
|
|
4540
4676
|
x: 0,
|
|
4541
4677
|
y: (e - this.handlerWidth) / 2,
|
|
@@ -4557,9 +4693,9 @@ class We {
|
|
|
4557
4693
|
height: this.handlerWidth
|
|
4558
4694
|
});
|
|
4559
4695
|
} else this.leftHandleGroup && (this.leftHandleGroup.remove(), this.leftHandleGroup = null);
|
|
4560
|
-
if (!!this.unpackFunc((
|
|
4696
|
+
if (!!this.unpackFunc((M = this.context.getOptions().bar.move.single) == null ? void 0 : M.right)) {
|
|
4561
4697
|
if (!this.rightHandleGroup) {
|
|
4562
|
-
this.rightHandleGroup = new
|
|
4698
|
+
this.rightHandleGroup = new k.Group({
|
|
4563
4699
|
x: 0,
|
|
4564
4700
|
y: 0,
|
|
4565
4701
|
opacity: 0
|
|
@@ -4572,13 +4708,13 @@ class We {
|
|
|
4572
4708
|
}), this.rightHandleGroup.on("mouseout", (F) => {
|
|
4573
4709
|
this.isDragging || (F.target.getStage().container().style.cursor = "default");
|
|
4574
4710
|
});
|
|
4575
|
-
const
|
|
4711
|
+
const G = new k.Rect({
|
|
4576
4712
|
x: 0,
|
|
4577
4713
|
y: 0
|
|
4578
4714
|
});
|
|
4579
|
-
this.rightHandleGroup.add(
|
|
4715
|
+
this.rightHandleGroup.add(G), _ !== null && bt(_ || kt, this.handlerWidth, e).then((F) => {
|
|
4580
4716
|
var q;
|
|
4581
|
-
const z = new
|
|
4717
|
+
const z = new k.Image({
|
|
4582
4718
|
image: F,
|
|
4583
4719
|
x: o - this.handlerWidth,
|
|
4584
4720
|
y: (e - this.handlerWidth) / 2,
|
|
@@ -4594,14 +4730,14 @@ class We {
|
|
|
4594
4730
|
height: e,
|
|
4595
4731
|
fill: H,
|
|
4596
4732
|
cornerRadius: [0, a[1], a[2], 0]
|
|
4597
|
-
}), (
|
|
4733
|
+
}), (T = this.rightHandleGroup.findOne("Image")) == null || T.setAttrs({
|
|
4598
4734
|
x: o - this.handlerWidth,
|
|
4599
4735
|
y: (e - this.handlerWidth) / 2,
|
|
4600
4736
|
width: this.handlerWidth,
|
|
4601
4737
|
height: this.handlerWidth
|
|
4602
4738
|
});
|
|
4603
4739
|
} else this.rightHandleGroup && (this.rightHandleGroup.remove(), this.rightHandleGroup = null);
|
|
4604
|
-
this.renderText(o, e), (
|
|
4740
|
+
this.renderText(o, e), (L = this.leftHandleGroup) == null || L.moveToTop(), (A = this.rightHandleGroup) == null || A.moveToTop();
|
|
4605
4741
|
}
|
|
4606
4742
|
this.isDragging || this.sliderBar.setAttrs({
|
|
4607
4743
|
shadowColor: c,
|
|
@@ -4623,7 +4759,7 @@ class We {
|
|
|
4623
4759
|
n ? o = this.unpackFunc(n) : this.context.getOptions().bar.field && (o = this.task.getField(this.context.getOptions().bar.field)), s();
|
|
4624
4760
|
const r = t - (this.leftHandleGroup ? this.handlerWidth : 0) - (this.rightHandleGroup ? this.handlerWidth : 0);
|
|
4625
4761
|
if (r > 20) {
|
|
4626
|
-
const a = new
|
|
4762
|
+
const a = new k.Text({
|
|
4627
4763
|
id: i,
|
|
4628
4764
|
x: this.leftHandleGroup ? 10 : 0,
|
|
4629
4765
|
y: 0,
|
|
@@ -4653,51 +4789,51 @@ class We {
|
|
|
4653
4789
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
4654
4790
|
);
|
|
4655
4791
|
if (g === 0) return;
|
|
4656
|
-
const
|
|
4792
|
+
const y = this.unpackFunc(
|
|
4657
4793
|
this.context.getOptions().bar.backgroundColor
|
|
4658
|
-
) || this.context.getOptions().primaryColor,
|
|
4794
|
+
) || this.context.getOptions().primaryColor, x = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || B(y).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), v = ot(
|
|
4659
4795
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4660
4796
|
), b = ot(
|
|
4661
4797
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
4662
4798
|
2
|
|
4663
4799
|
// 默认 2
|
|
4664
4800
|
);
|
|
4665
|
-
b[0] =
|
|
4801
|
+
b[0] = v[0], b[3] = v[3], g === 1 && (b[1] = v[1], b[2] = v[2]);
|
|
4666
4802
|
const w = t * g;
|
|
4667
|
-
this.progressGroup ? (this.progressGroup.width(w), this.progressGroup.destroyChildren()) : (this.progressGroup = new
|
|
4803
|
+
this.progressGroup ? (this.progressGroup.width(w), this.progressGroup.destroyChildren()) : (this.progressGroup = new k.Group({
|
|
4668
4804
|
x: 0,
|
|
4669
4805
|
y: 0,
|
|
4670
4806
|
width: w,
|
|
4671
4807
|
height: e,
|
|
4672
4808
|
listening: !1
|
|
4673
4809
|
}), this.slider.add(this.progressGroup));
|
|
4674
|
-
const C = new
|
|
4810
|
+
const C = new k.Rect({
|
|
4675
4811
|
x: 0,
|
|
4676
4812
|
y: 0,
|
|
4677
4813
|
width: w,
|
|
4678
4814
|
height: e,
|
|
4679
|
-
fill:
|
|
4815
|
+
fill: x,
|
|
4680
4816
|
cornerRadius: b,
|
|
4681
4817
|
opacity: this.unpackFunc((a = this.context.getOptions().bar.progress) == null ? void 0 : a.opacity)
|
|
4682
4818
|
});
|
|
4683
4819
|
this.progressGroup.add(C);
|
|
4684
|
-
const
|
|
4820
|
+
const M = `${gt(
|
|
4685
4821
|
g * 100,
|
|
4686
4822
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4687
|
-
)}%`, E = new
|
|
4823
|
+
)}%`, E = new k.Text().measureSize(M).width, T = this.unpackFunc((u = this.context.getOptions().bar.progress) == null ? void 0 : u.textAlign), L = new k.Text({
|
|
4688
4824
|
x: 0,
|
|
4689
|
-
y:
|
|
4690
|
-
width:
|
|
4825
|
+
y: T === "top" ? -e : 0,
|
|
4826
|
+
width: T === "right" ? w + E : Math.max(w, E),
|
|
4691
4827
|
height: e,
|
|
4692
|
-
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(
|
|
4693
|
-
text:
|
|
4828
|
+
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(x, 50).alpha(0.7).toHex(),
|
|
4829
|
+
text: M,
|
|
4694
4830
|
fontSize: this.unpackFunc((l = this.context.getOptions().bar.progress) == null ? void 0 : l.fontSize) || 10,
|
|
4695
4831
|
fontStyle: this.unpackFunc((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontStyle) || "italic",
|
|
4696
4832
|
fontFamily: "Arial",
|
|
4697
|
-
verticalAlign:
|
|
4833
|
+
verticalAlign: T === "top" ? "bottom" : "middle",
|
|
4698
4834
|
align: "right"
|
|
4699
4835
|
});
|
|
4700
|
-
(p = this.progressGroup) == null || p.add(
|
|
4836
|
+
(p = this.progressGroup) == null || p.add(L);
|
|
4701
4837
|
}
|
|
4702
4838
|
}
|
|
4703
4839
|
// 绑定事件,包括拖拽和边缘检测
|
|
@@ -4711,11 +4847,11 @@ class We {
|
|
|
4711
4847
|
const e = t.target.getStage();
|
|
4712
4848
|
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
4713
4849
|
}), this.slider.on("click", (t) => {
|
|
4714
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
4850
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(S.SLIDER_CLICK, t.evt, this.task));
|
|
4715
4851
|
}), this.slider.on("contextmenu", (t) => {
|
|
4716
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
4852
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(S.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
4717
4853
|
}), this.slider.on("dblclick", (t) => {
|
|
4718
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
4854
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(S.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
4719
4855
|
}));
|
|
4720
4856
|
}
|
|
4721
4857
|
/**
|
|
@@ -4728,7 +4864,7 @@ class We {
|
|
|
4728
4864
|
handleDragStart(t) {
|
|
4729
4865
|
const e = t.target.getStage();
|
|
4730
4866
|
if (!e) return;
|
|
4731
|
-
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(
|
|
4867
|
+
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(S.SLIDER_DRAGGING, !0), e.container().style.cursor = "grabbing";
|
|
4732
4868
|
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ct(i, s);
|
|
4733
4869
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4734
4870
|
}
|
|
@@ -4741,7 +4877,7 @@ class We {
|
|
|
4741
4877
|
}
|
|
4742
4878
|
handleDragEnd(t) {
|
|
4743
4879
|
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.dragDiffX = 0, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
4744
|
-
|
|
4880
|
+
S.TASK_DRAG_END,
|
|
4745
4881
|
this.task,
|
|
4746
4882
|
this.oldTasks
|
|
4747
4883
|
), this.oldTasks = []);
|
|
@@ -4761,13 +4897,13 @@ class We {
|
|
|
4761
4897
|
}
|
|
4762
4898
|
}
|
|
4763
4899
|
}
|
|
4764
|
-
this.context.event.emit(
|
|
4900
|
+
this.context.event.emit(S.SLIDER_DRAGGING, !1);
|
|
4765
4901
|
}
|
|
4766
4902
|
handleMove(t, e) {
|
|
4767
4903
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = t.target.width(), a = t.target.x(), c = a + r, u = Math.max(0, -this.offsetX - a), d = Math.max(0, c - (-this.offsetX + i));
|
|
4768
4904
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4769
|
-
const l = t.target.width(), m = t.target.x(), p = m + l, g = -this.offsetX,
|
|
4770
|
-
if (
|
|
4905
|
+
const l = t.target.width(), m = t.target.x(), p = m + l, g = -this.offsetX, y = g + i, x = this.context.store.getTimeAxis().getTotalWidth(), v = m <= g + this.EDGE_THRESHOLD, b = p >= y - this.EDGE_THRESHOLD;
|
|
4906
|
+
if (v)
|
|
4771
4907
|
if (g <= 0)
|
|
4772
4908
|
this.draggingDirection === "left" && t.target.x(-u), this.stopAutoScroll(), s || (this.draggingDirection === "left" ? this.startAutoExpand("left", -u) : this.stopAutoExpand());
|
|
4773
4909
|
else if (this.draggingDirection === "left") {
|
|
@@ -4783,8 +4919,8 @@ class We {
|
|
|
4783
4919
|
} else
|
|
4784
4920
|
this.stopAutoScroll();
|
|
4785
4921
|
else if (b)
|
|
4786
|
-
if (
|
|
4787
|
-
this.draggingDirection === "right" && t.target.x(
|
|
4922
|
+
if (y >= x)
|
|
4923
|
+
this.draggingDirection === "right" && t.target.x(x - l + d), this.stopAutoScroll(), s || (this.draggingDirection === "right" ? this.startAutoExpand("right", 0, d) : this.stopAutoExpand());
|
|
4788
4924
|
else if (this.draggingDirection === "right") {
|
|
4789
4925
|
const w = n ? o : this.SCROLL_STEP;
|
|
4790
4926
|
this.startAutoScroll(w, n, () => {
|
|
@@ -4799,23 +4935,23 @@ class We {
|
|
|
4799
4935
|
}
|
|
4800
4936
|
// 左右操作拖拽
|
|
4801
4937
|
resizeMove(t, e) {
|
|
4802
|
-
var
|
|
4938
|
+
var y;
|
|
4803
4939
|
t.cancelBubble = !0;
|
|
4804
4940
|
const i = t.target.getStage();
|
|
4805
4941
|
if (!i) return;
|
|
4806
|
-
this.isDragging = !0, this.context.event.emit(
|
|
4807
|
-
let s = ((
|
|
4942
|
+
this.isDragging = !0, this.context.event.emit(S.SLIDER_DRAGGING, !0);
|
|
4943
|
+
let s = ((y = i.getPointerPosition()) == null ? void 0 : y.x) || 0;
|
|
4808
4944
|
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, a = i.width();
|
|
4809
4945
|
let c = 0, u = 0;
|
|
4810
4946
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4811
|
-
const
|
|
4812
|
-
if (
|
|
4947
|
+
const x = this.slider.width(), v = this.slider.x(), b = v + x, w = -this.offsetX, C = w + a, M = v <= w + this.EDGE_THRESHOLD, E = b >= C - this.EDGE_THRESHOLD;
|
|
4948
|
+
if (M && e === "left") {
|
|
4813
4949
|
if (w <= 0)
|
|
4814
4950
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4815
4951
|
else if (this.draggingDirection === "left") {
|
|
4816
|
-
const
|
|
4817
|
-
this.startAutoScroll(
|
|
4818
|
-
c +=
|
|
4952
|
+
const T = n ? -o : -this.SCROLL_STEP;
|
|
4953
|
+
this.startAutoScroll(T, n, () => {
|
|
4954
|
+
c += T, this.slider.x(this.slider.x() + T);
|
|
4819
4955
|
});
|
|
4820
4956
|
} else
|
|
4821
4957
|
this.stopAutoScroll();
|
|
@@ -4826,33 +4962,33 @@ class We {
|
|
|
4826
4962
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
4827
4963
|
), this.stopAutoScroll(), r || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
4828
4964
|
else if (this.draggingDirection === "right") {
|
|
4829
|
-
const
|
|
4830
|
-
this.startAutoScroll(
|
|
4831
|
-
u +=
|
|
4965
|
+
const T = n ? o : this.SCROLL_STEP;
|
|
4966
|
+
this.startAutoScroll(T, n, () => {
|
|
4967
|
+
u += T, this.slider.x(this.slider.x() + T);
|
|
4832
4968
|
});
|
|
4833
4969
|
} else
|
|
4834
4970
|
this.stopAutoScroll();
|
|
4835
4971
|
this.emitUpdate("right");
|
|
4836
|
-
} else if (e === "right" &&
|
|
4837
|
-
const
|
|
4838
|
-
this.startAutoScroll(
|
|
4839
|
-
u +=
|
|
4972
|
+
} else if (e === "right" && v <= w && b <= w + this.EDGE_THRESHOLD + o) {
|
|
4973
|
+
const T = n ? -o : -this.SCROLL_STEP;
|
|
4974
|
+
this.startAutoScroll(T, n, () => {
|
|
4975
|
+
u += T, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + T), this.emitUpdate("right");
|
|
4840
4976
|
});
|
|
4841
|
-
} else if (e === "left" && b >= C &&
|
|
4842
|
-
const
|
|
4843
|
-
this.startAutoScroll(
|
|
4844
|
-
c +=
|
|
4977
|
+
} else if (e === "left" && b >= C && v >= C - this.EDGE_THRESHOLD - o) {
|
|
4978
|
+
const T = n ? o : this.SCROLL_STEP;
|
|
4979
|
+
this.startAutoScroll(T, n, () => {
|
|
4980
|
+
c += T, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + T), this.emitUpdate("left");
|
|
4845
4981
|
});
|
|
4846
4982
|
} else
|
|
4847
4983
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
4848
4984
|
}, this.MOVE_INTERVAL);
|
|
4849
4985
|
let d;
|
|
4850
|
-
const l = this.slider.x(), m = this.slider.width(), p = (
|
|
4986
|
+
const l = this.slider.x(), m = this.slider.width(), p = (x) => {
|
|
4851
4987
|
var w;
|
|
4852
|
-
|
|
4853
|
-
const
|
|
4854
|
-
let b =
|
|
4855
|
-
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o &&
|
|
4988
|
+
x.movementX > 0 ? this.draggingDirection = "right" : x.movementX < 0 && (this.draggingDirection = "left");
|
|
4989
|
+
const v = Math.max(((w = i.getPointerPosition()) == null ? void 0 : w.x) || 0, 0);
|
|
4990
|
+
let b = v - s;
|
|
4991
|
+
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && v < a - this.EDGE_THRESHOLD && (this.slider.width(m - b - c), this.slider.x(l + b + c), this.emitUpdate("left")) : m + b + u >= o && v > this.EDGE_THRESHOLD && (this.slider.width(m + b + u), this.emitUpdate("right")), d = b);
|
|
4856
4992
|
}, g = () => {
|
|
4857
4993
|
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
4858
4994
|
};
|
|
@@ -4863,7 +4999,7 @@ class We {
|
|
|
4863
4999
|
if (this.autoExpandTimer) return;
|
|
4864
5000
|
const s = this.context.store.getTimeAxis();
|
|
4865
5001
|
this.autoExpandTimer = window.setInterval(() => {
|
|
4866
|
-
s.expand(t, 1), this.context.event.emit(
|
|
5002
|
+
s.expand(t, 1), this.context.event.emit(S.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(e);
|
|
4867
5003
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
4868
5004
|
}
|
|
4869
5005
|
// 开始自动滚动
|
|
@@ -4900,11 +5036,11 @@ class We {
|
|
|
4900
5036
|
}
|
|
4901
5037
|
// 拖拽块的高亮动画
|
|
4902
5038
|
handleResizeHighlight(t) {
|
|
4903
|
-
this.leftHandleGroup && new
|
|
5039
|
+
this.leftHandleGroup && new k.Tween({
|
|
4904
5040
|
node: this.leftHandleGroup,
|
|
4905
5041
|
opacity: t,
|
|
4906
5042
|
duration: 0.2
|
|
4907
|
-
}).play(), this.rightHandleGroup && new
|
|
5043
|
+
}).play(), this.rightHandleGroup && new k.Tween({
|
|
4908
5044
|
node: this.rightHandleGroup,
|
|
4909
5045
|
opacity: t,
|
|
4910
5046
|
duration: 0.2
|
|
@@ -4912,7 +5048,7 @@ class We {
|
|
|
4912
5048
|
}
|
|
4913
5049
|
/** 鼠标移入高亮 */
|
|
4914
5050
|
handleBarHighlight(t) {
|
|
4915
|
-
this.sliderBar && new
|
|
5051
|
+
this.sliderBar && new k.Tween({
|
|
4916
5052
|
...t,
|
|
4917
5053
|
node: this.sliderBar,
|
|
4918
5054
|
duration: 0.2
|
|
@@ -4921,7 +5057,7 @@ class We {
|
|
|
4921
5057
|
/** 闪烁 */
|
|
4922
5058
|
handleBarBlink() {
|
|
4923
5059
|
if (!this.sliderGroup) return;
|
|
4924
|
-
const t = this.sliderGroup.opacity(), e = 500, s = e * 2, n = new
|
|
5060
|
+
const t = this.sliderGroup.opacity(), e = 500, s = e * 2, n = new k.Animation((o) => {
|
|
4925
5061
|
if (!this.sliderGroup || !o) return;
|
|
4926
5062
|
const r = o.time;
|
|
4927
5063
|
if (r >= s) {
|
|
@@ -4935,13 +5071,13 @@ class We {
|
|
|
4935
5071
|
n.start();
|
|
4936
5072
|
}
|
|
4937
5073
|
}
|
|
4938
|
-
class
|
|
5074
|
+
class Fe {
|
|
4939
5075
|
constructor(t, e, i, s, n, o, r) {
|
|
4940
5076
|
h(this, "row");
|
|
4941
5077
|
h(this, "slider");
|
|
4942
5078
|
h(this, "cacheKey", "");
|
|
4943
|
-
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new
|
|
4944
|
-
const a = new
|
|
5079
|
+
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new k.Group();
|
|
5080
|
+
const a = new k.Rect({
|
|
4945
5081
|
x: s,
|
|
4946
5082
|
y: n,
|
|
4947
5083
|
width: o,
|
|
@@ -4949,7 +5085,7 @@ class $e {
|
|
|
4949
5085
|
id: i,
|
|
4950
5086
|
listening: !1
|
|
4951
5087
|
});
|
|
4952
|
-
this.row.add(a), this.slider = new
|
|
5088
|
+
this.row.add(a), this.slider = new $e(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
4953
5089
|
}
|
|
4954
5090
|
update(t, e) {
|
|
4955
5091
|
this.slider.update(t, e);
|
|
@@ -4961,7 +5097,7 @@ class $e {
|
|
|
4961
5097
|
this.row.destroy();
|
|
4962
5098
|
}
|
|
4963
5099
|
}
|
|
4964
|
-
class
|
|
5100
|
+
class Be {
|
|
4965
5101
|
constructor(t, e, i, s) {
|
|
4966
5102
|
h(this, "tasks", []);
|
|
4967
5103
|
// 当前渲染的任务列表
|
|
@@ -4981,7 +5117,7 @@ class Fe {
|
|
|
4981
5117
|
// 选中相关
|
|
4982
5118
|
h(this, "selectedRowId", null);
|
|
4983
5119
|
h(this, "selectedRect", null);
|
|
4984
|
-
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new
|
|
5120
|
+
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new k.Group({ name: "chart-body-rows" }), this.layer.add(this.rowsGroup), this.rowBgGroup = new k.Group({ name: "chart-body-row-bgs" }), this.bgLayer.add(this.rowBgGroup), this.registerEvents(), this.bindEvents();
|
|
4985
5121
|
}
|
|
4986
5122
|
/**
|
|
4987
5123
|
* 调整大小
|
|
@@ -5007,7 +5143,7 @@ class Fe {
|
|
|
5007
5143
|
const o = `chart-row-${s.id}`;
|
|
5008
5144
|
let r = this.rowsCache.get(o);
|
|
5009
5145
|
const c = s.flatIndex * e + this.context.getOptions().header.height;
|
|
5010
|
-
r ? (r.update(0, c), r.setOffset(this.offsetX, this.offsetY)) : (r = new
|
|
5146
|
+
r ? (r.update(0, c), r.setOffset(this.offsetX, this.offsetY)) : (r = new Fe(
|
|
5011
5147
|
this.context,
|
|
5012
5148
|
s,
|
|
5013
5149
|
o,
|
|
@@ -5016,7 +5152,7 @@ class Fe {
|
|
|
5016
5152
|
this.width,
|
|
5017
5153
|
e
|
|
5018
5154
|
), r.setOffset(this.offsetX, this.offsetY), this.rowsGroup.add(r.row), this.rowsCache.set(o, r)), r.cacheKey = i, this.context.store.getDataManager().isTaskSelected(s.id) && this.selectRow(s.id);
|
|
5019
|
-
const u = new
|
|
5155
|
+
const u = new k.Rect({
|
|
5020
5156
|
x: 0,
|
|
5021
5157
|
y: c + this.offsetY,
|
|
5022
5158
|
width: this.width,
|
|
@@ -5051,13 +5187,13 @@ class Fe {
|
|
|
5051
5187
|
* 注册事件监听
|
|
5052
5188
|
*/
|
|
5053
5189
|
registerEvents() {
|
|
5054
|
-
this.context.event.on(
|
|
5190
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
5055
5191
|
this.highlightRow(t);
|
|
5056
|
-
}), this.context.event.on(
|
|
5192
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
5057
5193
|
this.unhighlightRow(t);
|
|
5058
|
-
}), this.context.event.on(
|
|
5194
|
+
}), this.context.event.on(S.TASK_SELECTED, (t) => {
|
|
5059
5195
|
this.selectRow(t.id);
|
|
5060
|
-
}), this.context.event.on(
|
|
5196
|
+
}), this.context.event.on(S.TASK_UNSELECTED, (t) => {
|
|
5061
5197
|
this.unselectRow(t);
|
|
5062
5198
|
});
|
|
5063
5199
|
}
|
|
@@ -5069,9 +5205,9 @@ class Fe {
|
|
|
5069
5205
|
if (!e) return;
|
|
5070
5206
|
const i = this.getTaskByPosition(e);
|
|
5071
5207
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
5072
|
-
|
|
5208
|
+
S.ROW_UNHIGHLIGHT,
|
|
5073
5209
|
this.highlightedRowId
|
|
5074
|
-
), i && this.context.event.emit(
|
|
5210
|
+
), i && this.context.event.emit(S.ROW_HIGHLIGHT, i.id);
|
|
5075
5211
|
}
|
|
5076
5212
|
/**
|
|
5077
5213
|
* 处理鼠标离开
|
|
@@ -5088,8 +5224,9 @@ class Fe {
|
|
|
5088
5224
|
if (!e) return;
|
|
5089
5225
|
const i = this.getTaskByPosition(e);
|
|
5090
5226
|
if (i) {
|
|
5091
|
-
|
|
5092
|
-
|
|
5227
|
+
this.context.store.getDataManager().isTaskSelected(i.id) || this.context.store.getDataManager().selectTask(i.id);
|
|
5228
|
+
const s = this.getTimeByPosition(e);
|
|
5229
|
+
this.context.event.emit(S.ROW_CLICK, t.evt, i, s);
|
|
5093
5230
|
}
|
|
5094
5231
|
}
|
|
5095
5232
|
/**
|
|
@@ -5100,7 +5237,10 @@ class Fe {
|
|
|
5100
5237
|
const e = this.stage.getPointerPosition();
|
|
5101
5238
|
if (!e) return;
|
|
5102
5239
|
const i = this.getTaskByPosition(e);
|
|
5103
|
-
|
|
5240
|
+
if (i) {
|
|
5241
|
+
const s = this.getTimeByPosition(e);
|
|
5242
|
+
this.context.event.emit(S.ROW_DBL_CLICK, t.evt, i, s);
|
|
5243
|
+
}
|
|
5104
5244
|
}
|
|
5105
5245
|
/**
|
|
5106
5246
|
* 处理右键菜单
|
|
@@ -5111,7 +5251,10 @@ class Fe {
|
|
|
5111
5251
|
const e = this.stage.getPointerPosition();
|
|
5112
5252
|
if (!e) return;
|
|
5113
5253
|
const i = this.getTaskByPosition(e);
|
|
5114
|
-
|
|
5254
|
+
if (i) {
|
|
5255
|
+
const s = this.getTimeByPosition(e);
|
|
5256
|
+
this.context.event.emit(S.ROW_CONTEXTMENU, t.evt, i, s);
|
|
5257
|
+
}
|
|
5115
5258
|
}
|
|
5116
5259
|
/**
|
|
5117
5260
|
* 按照位置获取任务
|
|
@@ -5124,17 +5267,21 @@ class Fe {
|
|
|
5124
5267
|
);
|
|
5125
5268
|
return this.context.store.getDataManager().getVisibleTasks()[s] || null;
|
|
5126
5269
|
}
|
|
5270
|
+
/**
|
|
5271
|
+
* 按照位置获取时间
|
|
5272
|
+
*/
|
|
5273
|
+
getTimeByPosition(t) {
|
|
5274
|
+
return this.context.store.getTimeAxis().getTimeByLeft(t.x - this.offsetX);
|
|
5275
|
+
}
|
|
5127
5276
|
/**
|
|
5128
5277
|
* 高亮指定行
|
|
5129
5278
|
*/
|
|
5130
5279
|
highlightRow(t) {
|
|
5131
|
-
if (this.highlightedRowId === t || (this.highlightedRowId = t, !this.rowsCache.get(`chart-row-${t}`))) return;
|
|
5132
|
-
this.highlightRect && this.highlightRect.destroy();
|
|
5280
|
+
if (this.highlightedRowId === t || (this.highlightedRowId = t, !this.rowsCache.get(`chart-row-${t}`)) || (this.highlightRect && this.highlightRect.destroy(), this.selectedRowId === t)) return;
|
|
5133
5281
|
const i = this.context.store.getDataManager().getTaskById(t);
|
|
5134
5282
|
if (i) {
|
|
5135
5283
|
const n = i.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
5136
|
-
|
|
5137
|
-
this.highlightRect = new S.Rect({
|
|
5284
|
+
this.highlightRect = new k.Rect({
|
|
5138
5285
|
x: 0,
|
|
5139
5286
|
y: n + this.offsetY,
|
|
5140
5287
|
width: this.width,
|
|
@@ -5189,7 +5336,7 @@ class Fe {
|
|
|
5189
5336
|
const i = this.context.store.getDataManager().getTaskById(t);
|
|
5190
5337
|
if (!i) return;
|
|
5191
5338
|
const n = i.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
5192
|
-
this.selectedRect = new
|
|
5339
|
+
this.selectedRect = new k.Rect({
|
|
5193
5340
|
x: 0,
|
|
5194
5341
|
y: n + this.offsetY,
|
|
5195
5342
|
width: this.width,
|
|
@@ -5261,15 +5408,15 @@ class Bt {
|
|
|
5261
5408
|
} = t || {}, o = s % 180, r = o * Math.PI / 180;
|
|
5262
5409
|
let a, c;
|
|
5263
5410
|
o === 0 ? (a = n, c = i + n) : o === 90 ? (a = i + n, c = n) : (a = Math.abs(Math.ceil((i + n) / Math.sin(r))), c = Math.abs(Math.ceil((i + n) / Math.cos(r))));
|
|
5264
|
-
const u = new
|
|
5411
|
+
const u = new k.Stage({
|
|
5265
5412
|
container: document.createElement("div"),
|
|
5266
5413
|
width: a,
|
|
5267
5414
|
height: c
|
|
5268
|
-
}), d = new
|
|
5415
|
+
}), d = new k.Layer();
|
|
5269
5416
|
u.add(d);
|
|
5270
|
-
const l = new
|
|
5417
|
+
const l = new k.Group();
|
|
5271
5418
|
if (o === 0 || o === 90) {
|
|
5272
|
-
const p = new
|
|
5419
|
+
const p = new k.Line({
|
|
5273
5420
|
points: [0, 0, o === 0 ? a : 0, o === 0 ? 0 : c],
|
|
5274
5421
|
stroke: e,
|
|
5275
5422
|
strokeWidth: i,
|
|
@@ -5278,8 +5425,8 @@ class Bt {
|
|
|
5278
5425
|
l.add(p);
|
|
5279
5426
|
} else
|
|
5280
5427
|
for (let p = -a; p < a * 2; p += a) {
|
|
5281
|
-
const g = p + i / 2,
|
|
5282
|
-
points: [Math.ceil(g), Math.ceil(
|
|
5428
|
+
const g = p + i / 2, y = 0, x = p + i / 2 + (Math.cos(r) < 0 ? -a : a), v = c, b = new k.Line({
|
|
5429
|
+
points: [Math.ceil(g), Math.ceil(y), Math.ceil(x), Math.ceil(v)],
|
|
5283
5430
|
stroke: e,
|
|
5284
5431
|
strokeWidth: i,
|
|
5285
5432
|
perfectDrawEnabled: !0,
|
|
@@ -5300,11 +5447,11 @@ class Bt {
|
|
|
5300
5447
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
5301
5448
|
width: i = (t == null ? void 0 : t.width) || 2,
|
|
5302
5449
|
spacing: s = (t == null ? void 0 : t.spacing) || 4
|
|
5303
|
-
} = t || {}, n = i * 2 + s * 2, o = n, r = B(e), a = new
|
|
5450
|
+
} = t || {}, n = i * 2 + s * 2, o = n, r = B(e), a = new k.Stage({
|
|
5304
5451
|
container: document.createElement("div"),
|
|
5305
5452
|
width: n,
|
|
5306
5453
|
height: o
|
|
5307
|
-
}), c = new
|
|
5454
|
+
}), c = new k.Layer();
|
|
5308
5455
|
a.add(c), [
|
|
5309
5456
|
{ x: s / 2 + i / 2, y: s / 2 + i / 2 },
|
|
5310
5457
|
{
|
|
@@ -5320,7 +5467,7 @@ class Bt {
|
|
|
5320
5467
|
y: o - s / 2 - i / 2
|
|
5321
5468
|
}
|
|
5322
5469
|
].forEach((l) => {
|
|
5323
|
-
const m = new
|
|
5470
|
+
const m = new k.Circle({
|
|
5324
5471
|
x: l.x,
|
|
5325
5472
|
y: l.y,
|
|
5326
5473
|
radius: i / 2,
|
|
@@ -5339,22 +5486,22 @@ class Bt {
|
|
|
5339
5486
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
5340
5487
|
width: i = (t == null ? void 0 : t.width) || 1,
|
|
5341
5488
|
spacing: s = (t == null ? void 0 : t.spacing) || 20
|
|
5342
|
-
} = t || {}, n = i + s, o = n, r = n, a = new
|
|
5489
|
+
} = t || {}, n = i + s, o = n, r = n, a = new k.Stage({
|
|
5343
5490
|
container: document.createElement("div"),
|
|
5344
5491
|
width: o,
|
|
5345
5492
|
height: r
|
|
5346
|
-
}), c = new
|
|
5493
|
+
}), c = new k.Layer();
|
|
5347
5494
|
a.add(c);
|
|
5348
|
-
const u = new
|
|
5495
|
+
const u = new k.Group();
|
|
5349
5496
|
u.add(
|
|
5350
|
-
new
|
|
5497
|
+
new k.Line({
|
|
5351
5498
|
points: [0, 0, o, r],
|
|
5352
5499
|
stroke: e,
|
|
5353
5500
|
strokeWidth: i,
|
|
5354
5501
|
perfectDrawEnabled: !0
|
|
5355
5502
|
})
|
|
5356
5503
|
), u.add(
|
|
5357
|
-
new
|
|
5504
|
+
new k.Line({
|
|
5358
5505
|
points: [0, r, o, 0],
|
|
5359
5506
|
stroke: e,
|
|
5360
5507
|
strokeWidth: i,
|
|
@@ -5365,7 +5512,7 @@ class Bt {
|
|
|
5365
5512
|
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5366
5513
|
}
|
|
5367
5514
|
}
|
|
5368
|
-
class
|
|
5515
|
+
class ze {
|
|
5369
5516
|
constructor(t, e) {
|
|
5370
5517
|
// 状态变量
|
|
5371
5518
|
h(this, "width", 0);
|
|
@@ -5375,7 +5522,7 @@ class Be {
|
|
|
5375
5522
|
// 保存周末
|
|
5376
5523
|
h(this, "weekendGroup");
|
|
5377
5524
|
h(this, "patternImage", null);
|
|
5378
|
-
this.context = t, this.layer = e, this.weekendGroup = new
|
|
5525
|
+
this.context = t, this.layer = e, this.weekendGroup = new k.Group(), this.layer.add(this.weekendGroup);
|
|
5379
5526
|
}
|
|
5380
5527
|
/**
|
|
5381
5528
|
* 检查日期是否为周末
|
|
@@ -5429,7 +5576,7 @@ class Be {
|
|
|
5429
5576
|
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Bt.createPattern(
|
|
5430
5577
|
this.context.getOptions().weekend
|
|
5431
5578
|
));
|
|
5432
|
-
const
|
|
5579
|
+
const x = new k.Rect({
|
|
5433
5580
|
name: "weekend-rect",
|
|
5434
5581
|
x: m,
|
|
5435
5582
|
y: p,
|
|
@@ -5446,14 +5593,14 @@ class Be {
|
|
|
5446
5593
|
},
|
|
5447
5594
|
opacity: this.context.getOptions().weekend.opacity
|
|
5448
5595
|
});
|
|
5449
|
-
this.weekendGroup.add(
|
|
5596
|
+
this.weekendGroup.add(x), d = d.add(2, "day");
|
|
5450
5597
|
} else
|
|
5451
5598
|
d = d.add(1, "day");
|
|
5452
5599
|
}
|
|
5453
5600
|
this.layer.batchDraw();
|
|
5454
5601
|
}
|
|
5455
5602
|
}
|
|
5456
|
-
class
|
|
5603
|
+
class Pe {
|
|
5457
5604
|
constructor(t, e, i) {
|
|
5458
5605
|
h(this, "arrowAnimation");
|
|
5459
5606
|
h(this, "todayLine");
|
|
@@ -5482,7 +5629,7 @@ class ze {
|
|
|
5482
5629
|
* 渲染今日线
|
|
5483
5630
|
*/
|
|
5484
5631
|
render() {
|
|
5485
|
-
var d, l, m, p, g,
|
|
5632
|
+
var d, l, m, p, g, y, x;
|
|
5486
5633
|
const t = Object.assign(
|
|
5487
5634
|
{
|
|
5488
5635
|
show: !0,
|
|
@@ -5494,22 +5641,22 @@ class ze {
|
|
|
5494
5641
|
this.context.getOptions().today || {}
|
|
5495
5642
|
);
|
|
5496
5643
|
if (!t.show) return;
|
|
5497
|
-
let e =
|
|
5644
|
+
let e = R();
|
|
5498
5645
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
5499
5646
|
t.type === "block" && (e = e.startOf(i));
|
|
5500
5647
|
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, r = B(t.backgroundColor).alpha(t.opacity).toHex(), a = (t.type === "block" ? s + n / 2 : s) + this.offsetX, c = [a, o, a, this.height], u = t.type === "line" ? t.width : n;
|
|
5501
|
-
if (this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(u)) : (this.todayLine = new
|
|
5648
|
+
if (this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(u)) : (this.todayLine = new k.Line({
|
|
5502
5649
|
points: c,
|
|
5503
5650
|
stroke: r,
|
|
5504
5651
|
strokeWidth: u
|
|
5505
5652
|
}), this.bgLayer.add(this.todayLine)), (d = this.context.getOptions().today.text) != null && d.show) {
|
|
5506
|
-
const
|
|
5653
|
+
const v = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.fontFamily) || "Arial", w = ((p = this.context.getOptions().today.text) == null ? void 0 : p.content) || "今天", C = new k.Text({ fontSize: v, fontFamily: b }).measureSize(w), M = ((g = this.context.getOptions().today.text) == null ? void 0 : g.color) || "white", E = ((y = this.context.getOptions().today.text) == null ? void 0 : y.backgroundColor) || r;
|
|
5507
5654
|
if (!this.todayTextGroup)
|
|
5508
|
-
this.todayTextGroup = new
|
|
5655
|
+
this.todayTextGroup = new k.Group({
|
|
5509
5656
|
x: s + this.offsetX + u,
|
|
5510
5657
|
y: o,
|
|
5511
|
-
opacity: (
|
|
5512
|
-
}), this.todayTextGroup.add(new
|
|
5658
|
+
opacity: (x = this.context.getOptions().today.text) == null ? void 0 : x.opacity
|
|
5659
|
+
}), this.todayTextGroup.add(new k.Rect({
|
|
5513
5660
|
x: 0,
|
|
5514
5661
|
y: 0,
|
|
5515
5662
|
width: C.width + 12,
|
|
@@ -5517,37 +5664,37 @@ class ze {
|
|
|
5517
5664
|
fill: E,
|
|
5518
5665
|
cornerRadius: 0,
|
|
5519
5666
|
name: "today-text-bg"
|
|
5520
|
-
})), this.todayTextGroup.add(new
|
|
5667
|
+
})), this.todayTextGroup.add(new k.Text({
|
|
5521
5668
|
x: 0,
|
|
5522
5669
|
y: 0,
|
|
5523
5670
|
text: w,
|
|
5524
|
-
fontSize:
|
|
5671
|
+
fontSize: v,
|
|
5525
5672
|
fontFamily: b,
|
|
5526
5673
|
padding: 5,
|
|
5527
|
-
fill:
|
|
5674
|
+
fill: M,
|
|
5528
5675
|
align: "center",
|
|
5529
5676
|
verticalAlign: "middle",
|
|
5530
5677
|
name: "today-text"
|
|
5531
5678
|
})), this.bgLayer.add(this.todayTextGroup);
|
|
5532
5679
|
else {
|
|
5533
5680
|
this.todayTextGroup.x(s + this.offsetX + u);
|
|
5534
|
-
const
|
|
5535
|
-
|
|
5681
|
+
const T = this.todayTextGroup.findOne(".today-text");
|
|
5682
|
+
T == null || T.setAttrs({
|
|
5536
5683
|
text: w,
|
|
5537
|
-
fill:
|
|
5538
|
-
fontSize:
|
|
5684
|
+
fill: M,
|
|
5685
|
+
fontSize: v,
|
|
5539
5686
|
fontFamily: b,
|
|
5540
5687
|
padding: 5
|
|
5541
5688
|
});
|
|
5542
|
-
const
|
|
5543
|
-
|
|
5689
|
+
const L = this.todayTextGroup.findOne(".today-text-bg");
|
|
5690
|
+
L == null || L.setAttrs({
|
|
5544
5691
|
width: C.width + 12,
|
|
5545
5692
|
height: C.height + 8,
|
|
5546
5693
|
fill: E
|
|
5547
5694
|
});
|
|
5548
5695
|
}
|
|
5549
5696
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
5550
|
-
t.type === "line" && (this.triangle ? (this.triangle.x(a), this.triangle.fill(r)) : (this.triangle = new
|
|
5697
|
+
t.type === "line" && (this.triangle ? (this.triangle.x(a), this.triangle.fill(r)) : (this.triangle = new k.RegularPolygon({
|
|
5551
5698
|
x: a,
|
|
5552
5699
|
y: o - 8,
|
|
5553
5700
|
sides: 3,
|
|
@@ -5555,9 +5702,9 @@ class ze {
|
|
|
5555
5702
|
fill: r,
|
|
5556
5703
|
rotation: 180,
|
|
5557
5704
|
name: "today-triangle"
|
|
5558
|
-
}), this.arrowAnimation = new
|
|
5705
|
+
}), this.arrowAnimation = new k.Animation((v) => {
|
|
5559
5706
|
var w;
|
|
5560
|
-
const b = Math.sin(
|
|
5707
|
+
const b = Math.sin(v.time * 4 * Math.PI / 2e3) + o - 8;
|
|
5561
5708
|
(w = this.triangle) == null || w.y(b);
|
|
5562
5709
|
}, this.headerLayer), this.headerLayer.add(this.triangle), this.triangle.moveToTop(), this.arrowAnimation.start())), this.bgLayer.batchDraw();
|
|
5563
5710
|
}
|
|
@@ -5579,7 +5726,7 @@ class Ne {
|
|
|
5579
5726
|
// 保存假期
|
|
5580
5727
|
h(this, "holidayGroup");
|
|
5581
5728
|
h(this, "patternImage", /* @__PURE__ */ new WeakMap());
|
|
5582
|
-
this.context = t, this.layer = e, this.holidayGroup = new
|
|
5729
|
+
this.context = t, this.layer = e, this.holidayGroup = new k.Group(), this.layer.add(this.holidayGroup);
|
|
5583
5730
|
}
|
|
5584
5731
|
/**
|
|
5585
5732
|
* 调整假期大小
|
|
@@ -5612,7 +5759,7 @@ class Ne {
|
|
|
5612
5759
|
* 计算假期
|
|
5613
5760
|
*/
|
|
5614
5761
|
async calculateHoliday() {
|
|
5615
|
-
var d, l, m, p, g,
|
|
5762
|
+
var d, l, m, p, g, y, x, v;
|
|
5616
5763
|
if (this.clearHoliday(), !this.context.getOptions().holiday.show) return;
|
|
5617
5764
|
const t = this.context.getOptions().holiday.holidays;
|
|
5618
5765
|
if (!t || t.length === 0) return;
|
|
@@ -5622,13 +5769,13 @@ class Ne {
|
|
|
5622
5769
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5623
5770
|
const w = t.find((C) => {
|
|
5624
5771
|
if (X(C.date)) {
|
|
5625
|
-
if (C.date.some((
|
|
5772
|
+
if (C.date.some((M) => R(M).isSame(b, "day")))
|
|
5626
5773
|
return C;
|
|
5627
|
-
} else if (
|
|
5774
|
+
} else if (R(C.date).isSame(b, "day"))
|
|
5628
5775
|
return C;
|
|
5629
5776
|
});
|
|
5630
5777
|
if (w) {
|
|
5631
|
-
const C = this.context.store.getTimeAxis().getTimeLeft(b),
|
|
5778
|
+
const C = this.context.store.getTimeAxis().getTimeLeft(b), M = r, E = u;
|
|
5632
5779
|
if (C + o < e)
|
|
5633
5780
|
continue;
|
|
5634
5781
|
if (C > i)
|
|
@@ -5641,10 +5788,10 @@ class Ne {
|
|
|
5641
5788
|
...this.context.getOptions().holiday
|
|
5642
5789
|
})
|
|
5643
5790
|
);
|
|
5644
|
-
const
|
|
5791
|
+
const L = new k.Rect({
|
|
5645
5792
|
name: "holiday-rect",
|
|
5646
5793
|
x: C,
|
|
5647
|
-
y:
|
|
5794
|
+
y: M,
|
|
5648
5795
|
width: o,
|
|
5649
5796
|
height: E,
|
|
5650
5797
|
// 根据模式设置填充
|
|
@@ -5659,35 +5806,35 @@ class Ne {
|
|
|
5659
5806
|
opacity: w.opacity || this.context.getOptions().holiday.opacity
|
|
5660
5807
|
}
|
|
5661
5808
|
});
|
|
5662
|
-
if (this.holidayGroup.add(
|
|
5663
|
-
if (X(w.date) && !
|
|
5809
|
+
if (this.holidayGroup.add(L), (d = w.text) != null && d.show) {
|
|
5810
|
+
if (X(w.date) && !R(w.date[0]).isSame(b, "day"))
|
|
5664
5811
|
continue;
|
|
5665
|
-
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "", H = new
|
|
5812
|
+
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "", H = new k.Text({ fontSize: A, fontFamily: _ }).measureSize(D), W = ((g = w.text) == null ? void 0 : g.color) || "white", I = ((y = w.text) == null ? void 0 : y.backgroundColor) || w.backgroundColor || ((x = this.context.getOptions().holiday) == null ? void 0 : x.backgroundColor) || this.context.getOptions().primaryColor, G = new k.Group({
|
|
5666
5813
|
name: "holiday-text-group",
|
|
5667
5814
|
x: C,
|
|
5668
|
-
y:
|
|
5669
|
-
opacity: (
|
|
5670
|
-
}), F = new
|
|
5815
|
+
y: M,
|
|
5816
|
+
opacity: (v = w.text) == null ? void 0 : v.opacity
|
|
5817
|
+
}), F = new k.Text({
|
|
5671
5818
|
text: D,
|
|
5672
5819
|
fill: W,
|
|
5673
5820
|
fontSize: A,
|
|
5674
5821
|
fontFamily: _,
|
|
5675
5822
|
padding: 5
|
|
5676
|
-
}), z = new
|
|
5823
|
+
}), z = new k.Rect({
|
|
5677
5824
|
x: 0,
|
|
5678
5825
|
y: 0,
|
|
5679
5826
|
width: H.width + 12,
|
|
5680
5827
|
height: H.height + 8,
|
|
5681
5828
|
fill: I
|
|
5682
5829
|
});
|
|
5683
|
-
|
|
5830
|
+
G.add(z), G.add(F), this.holidayGroup.add(G);
|
|
5684
5831
|
}
|
|
5685
5832
|
}
|
|
5686
5833
|
}
|
|
5687
5834
|
this.layer.batchDraw();
|
|
5688
5835
|
}
|
|
5689
5836
|
}
|
|
5690
|
-
class
|
|
5837
|
+
class Ye {
|
|
5691
5838
|
constructor(t, e) {
|
|
5692
5839
|
// 状态变量
|
|
5693
5840
|
h(this, "width", 0);
|
|
@@ -5696,7 +5843,7 @@ class Pe {
|
|
|
5696
5843
|
h(this, "offsetY", 0);
|
|
5697
5844
|
// 保存标志日期渲染组
|
|
5698
5845
|
h(this, "flagGroup");
|
|
5699
|
-
this.context = t, this.layer = e, this.flagGroup = new
|
|
5846
|
+
this.context = t, this.layer = e, this.flagGroup = new k.Group(), this.layer.add(this.flagGroup);
|
|
5700
5847
|
}
|
|
5701
5848
|
/**
|
|
5702
5849
|
* 调整标志日期大小
|
|
@@ -5729,84 +5876,84 @@ class Pe {
|
|
|
5729
5876
|
* 计算标志日期
|
|
5730
5877
|
*/
|
|
5731
5878
|
async calculateFlag() {
|
|
5732
|
-
var d, l, m, p, g,
|
|
5879
|
+
var d, l, m, p, g, y, x;
|
|
5733
5880
|
if (this.clearFlag(), !((d = this.context.getOptions().flag) != null && d.show)) return;
|
|
5734
5881
|
const t = (l = this.context.getOptions().flag) == null ? void 0 : l.data;
|
|
5735
5882
|
if (!t || t.length === 0) return;
|
|
5736
|
-
const e = ((m = this.context.getOptions().flag) == null ? void 0 : m.backgroundColor) || this.context.getOptions().primaryColor, i = ((p = this.context.getOptions().flag) == null ? void 0 : p.opacity) || 1, s = ((g = this.context.getOptions().flag) == null ? void 0 : g.color) || (B(e).isDark() ? "white" : "black"), n = ((
|
|
5737
|
-
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((
|
|
5738
|
-
const b =
|
|
5883
|
+
const e = ((m = this.context.getOptions().flag) == null ? void 0 : m.backgroundColor) || this.context.getOptions().primaryColor, i = ((p = this.context.getOptions().flag) == null ? void 0 : p.opacity) || 1, s = ((g = this.context.getOptions().flag) == null ? void 0 : g.color) || (B(e).isDark() ? "white" : "black"), n = ((y = this.context.getOptions().flag) == null ? void 0 : y.fontFamily) || "Arial", o = ((x = this.context.getOptions().flag) == null ? void 0 : x.fontSize) || 10, r = Math.max(0, -this.offsetX), a = r + this.width, c = this.context.store.getTimeAxis().getCellWidth(), u = this.context.getOptions().header.height;
|
|
5884
|
+
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((v) => {
|
|
5885
|
+
const b = R(v.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = u;
|
|
5739
5886
|
if (w + c < r || w > a)
|
|
5740
5887
|
return;
|
|
5741
|
-
const E = [w, u, w, this.height],
|
|
5888
|
+
const E = [w, u, w, this.height], T = new k.Line({
|
|
5742
5889
|
points: E,
|
|
5743
|
-
stroke:
|
|
5744
|
-
opacity:
|
|
5890
|
+
stroke: v.backgroundColor || e,
|
|
5891
|
+
opacity: v.opacity || i,
|
|
5745
5892
|
strokeWidth: 1
|
|
5746
5893
|
});
|
|
5747
|
-
this.flagGroup.add(
|
|
5748
|
-
const
|
|
5749
|
-
if (
|
|
5750
|
-
const A = new
|
|
5751
|
-
text:
|
|
5894
|
+
this.flagGroup.add(T);
|
|
5895
|
+
const L = v.content || "";
|
|
5896
|
+
if (L) {
|
|
5897
|
+
const A = new k.Text({
|
|
5898
|
+
text: L,
|
|
5752
5899
|
x: w + 5,
|
|
5753
5900
|
// 添加一些内边距
|
|
5754
5901
|
y: C + 5,
|
|
5755
5902
|
// 添加一些内边距
|
|
5756
5903
|
fontSize: o,
|
|
5757
5904
|
fontFamily: n,
|
|
5758
|
-
fill:
|
|
5905
|
+
fill: v.color || s,
|
|
5759
5906
|
verticalAlign: "middle",
|
|
5760
5907
|
align: "left"
|
|
5761
|
-
}), _ = new
|
|
5908
|
+
}), _ = new k.Rect({
|
|
5762
5909
|
x: w,
|
|
5763
5910
|
y: C,
|
|
5764
|
-
width: A.measureSize(
|
|
5765
|
-
height: A.measureSize(
|
|
5766
|
-
fill:
|
|
5911
|
+
width: A.measureSize(L).width + 12,
|
|
5912
|
+
height: A.measureSize(L).height + 8,
|
|
5913
|
+
fill: v.backgroundColor || e
|
|
5767
5914
|
});
|
|
5768
5915
|
this.flagGroup.add(_), this.flagGroup.add(A);
|
|
5769
|
-
} else if (
|
|
5770
|
-
switch (
|
|
5916
|
+
} else if (v.flag)
|
|
5917
|
+
switch (v.flag) {
|
|
5771
5918
|
case "banner":
|
|
5772
|
-
this.flagGroup.add(new
|
|
5919
|
+
this.flagGroup.add(new k.Rect({
|
|
5773
5920
|
x: w,
|
|
5774
5921
|
y: C,
|
|
5775
5922
|
width: 20,
|
|
5776
5923
|
height: 10,
|
|
5777
|
-
fill:
|
|
5778
|
-
opacity:
|
|
5924
|
+
fill: v.backgroundColor || e,
|
|
5925
|
+
opacity: v.opacity || i
|
|
5779
5926
|
}));
|
|
5780
5927
|
break;
|
|
5781
5928
|
case "pennant":
|
|
5782
|
-
this.flagGroup.add(new
|
|
5929
|
+
this.flagGroup.add(new k.Line({
|
|
5783
5930
|
points: [w, C, w + 20, C + 5, w, C + 10],
|
|
5784
|
-
fill:
|
|
5785
|
-
opacity:
|
|
5931
|
+
fill: v.backgroundColor || e,
|
|
5932
|
+
opacity: v.opacity || i,
|
|
5786
5933
|
closed: !0
|
|
5787
5934
|
}));
|
|
5788
5935
|
break;
|
|
5789
5936
|
case "tag":
|
|
5790
|
-
this.flagGroup.add(new
|
|
5937
|
+
this.flagGroup.add(new k.Line({
|
|
5791
5938
|
points: [w, C, w + 20, C, w + 15, C + 5, w + 20, C + 10, w, C + 10],
|
|
5792
|
-
fill:
|
|
5793
|
-
opacity:
|
|
5939
|
+
fill: v.backgroundColor || e,
|
|
5940
|
+
opacity: v.opacity || i,
|
|
5794
5941
|
closed: !0
|
|
5795
5942
|
}));
|
|
5796
5943
|
break;
|
|
5797
5944
|
case "wedge":
|
|
5798
|
-
this.flagGroup.add(new
|
|
5945
|
+
this.flagGroup.add(new k.Line({
|
|
5799
5946
|
points: [w, C, w + 20, C, w + 25, C + 5, w + 20, C + 10, w, C + 10],
|
|
5800
|
-
fill:
|
|
5801
|
-
opacity:
|
|
5947
|
+
fill: v.backgroundColor || e,
|
|
5948
|
+
opacity: v.opacity || i,
|
|
5802
5949
|
closed: !0
|
|
5803
5950
|
}));
|
|
5804
5951
|
break;
|
|
5805
5952
|
case "ribbon":
|
|
5806
|
-
this.flagGroup.add(new
|
|
5953
|
+
this.flagGroup.add(new k.Line({
|
|
5807
5954
|
points: [w, C, w + 15, C + 2, w + 20, C, w + 20, C + 10, w + 15, C + 12, w, C + 10],
|
|
5808
|
-
fill:
|
|
5809
|
-
opacity:
|
|
5955
|
+
fill: v.backgroundColor || e,
|
|
5956
|
+
opacity: v.opacity || i,
|
|
5810
5957
|
closed: !0,
|
|
5811
5958
|
tension: 0.1
|
|
5812
5959
|
}));
|
|
@@ -5815,7 +5962,7 @@ class Pe {
|
|
|
5815
5962
|
}), this.layer.batchDraw();
|
|
5816
5963
|
}
|
|
5817
5964
|
}
|
|
5818
|
-
class
|
|
5965
|
+
class Ue {
|
|
5819
5966
|
constructor(t, e, i) {
|
|
5820
5967
|
h(this, "tasks", []);
|
|
5821
5968
|
// 创建点组
|
|
@@ -5835,7 +5982,7 @@ class Ye {
|
|
|
5835
5982
|
h(this, "height", 0);
|
|
5836
5983
|
h(this, "offsetX", 0);
|
|
5837
5984
|
h(this, "offsetY", 0);
|
|
5838
|
-
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new
|
|
5985
|
+
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new k.Group({ name: "links-group" }), this.pointGroup = new k.Group({ name: "point-group" }), this.templateArrow = new k.Arrow({
|
|
5839
5986
|
points: [],
|
|
5840
5987
|
stroke: this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5841
5988
|
strokeWidth: this.context.getOptions().links.width,
|
|
@@ -5854,11 +6001,11 @@ class Ye {
|
|
|
5854
6001
|
* 注册事件
|
|
5855
6002
|
*/
|
|
5856
6003
|
registerEvents() {
|
|
5857
|
-
this.context.event.on(
|
|
6004
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
5858
6005
|
this.highlightPoint(t);
|
|
5859
|
-
}), this.context.event.on(
|
|
6006
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
5860
6007
|
this.unhighlightPoint(t);
|
|
5861
|
-
}), this.context.event.on(
|
|
6008
|
+
}), this.context.event.on(S.SLIDER_DRAGGING, (t) => {
|
|
5862
6009
|
this.isSliderMoving = t;
|
|
5863
6010
|
});
|
|
5864
6011
|
}
|
|
@@ -5908,38 +6055,38 @@ class Ye {
|
|
|
5908
6055
|
const m = this.context.store.getTimeAxis().getTimeLeft(l.startTime), p = this.context.store.getTimeAxis().getTimeLeft(l.endTime);
|
|
5909
6056
|
let g = this.context.getOptions().links.gap;
|
|
5910
6057
|
l.isMilestone() && (g += i / 2);
|
|
5911
|
-
const
|
|
5912
|
-
let
|
|
5913
|
-
if (ht(b) ?
|
|
5914
|
-
const w = new
|
|
6058
|
+
const y = s + i * l.flatIndex;
|
|
6059
|
+
let x = !0, v = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
6060
|
+
if (ht(b) ? x = v = b : V(b) && (x = b === "S", v = b === "F"), x) {
|
|
6061
|
+
const w = new k.Circle({
|
|
5915
6062
|
id: `point-${l.id}-left`,
|
|
5916
6063
|
x: m - g,
|
|
5917
|
-
y
|
|
6064
|
+
y,
|
|
5918
6065
|
radius: n,
|
|
5919
6066
|
opacity: o,
|
|
5920
6067
|
stroke: a,
|
|
5921
6068
|
strokeWidth: c
|
|
5922
6069
|
});
|
|
5923
6070
|
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
5924
|
-
this.isDragging = !0, this.createLink(C, "S", r, [m - g,
|
|
6071
|
+
this.isDragging = !0, this.createLink(C, "S", r, [m - g, y], l.id);
|
|
5925
6072
|
}), w.on("mouseover", (C) => {
|
|
5926
6073
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5927
6074
|
}), w.on("mouseout", (C) => {
|
|
5928
6075
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
5929
6076
|
});
|
|
5930
6077
|
}
|
|
5931
|
-
if (
|
|
5932
|
-
const w = new
|
|
6078
|
+
if (v) {
|
|
6079
|
+
const w = new k.Circle({
|
|
5933
6080
|
id: `point-${l.id}-right`,
|
|
5934
6081
|
x: p + g,
|
|
5935
|
-
y
|
|
6082
|
+
y,
|
|
5936
6083
|
radius: n,
|
|
5937
6084
|
opacity: o,
|
|
5938
6085
|
stroke: a,
|
|
5939
6086
|
strokeWidth: c
|
|
5940
6087
|
});
|
|
5941
6088
|
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
5942
|
-
this.isDragging = !0, this.createLink(C, "F", r, [p + g,
|
|
6089
|
+
this.isDragging = !0, this.createLink(C, "F", r, [p + g, y], l.id);
|
|
5943
6090
|
}), w.on("mouseover", (C) => {
|
|
5944
6091
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5945
6092
|
}), w.on("mouseout", (C) => {
|
|
@@ -5968,7 +6115,7 @@ class Ye {
|
|
|
5968
6115
|
});
|
|
5969
6116
|
const i = Q();
|
|
5970
6117
|
e.forEach((s) => {
|
|
5971
|
-
var u, d, l, m, p, g,
|
|
6118
|
+
var u, d, l, m, p, g, y, x;
|
|
5972
6119
|
if (s.valid === !1) return;
|
|
5973
6120
|
const n = this.createId(s), o = this.context.store.getDataManager().getTaskById(s.from), r = this.context.store.getDataManager().getTaskById(s.to);
|
|
5974
6121
|
if (!o) {
|
|
@@ -5989,51 +6136,51 @@ class Ye {
|
|
|
5989
6136
|
return;
|
|
5990
6137
|
const a = Math.max(0, -this.offsetX), c = a + this.width;
|
|
5991
6138
|
if (!(this.context.store.getTimeAxis().getTimeLeft(((u = s.type) == null ? void 0 : u[0]) === "S" ? o.startTime : o.endTime) < a && this.context.store.getTimeAxis().getTimeLeft(((d = s.type) == null ? void 0 : d[1]) === "F" ? r.endTime : r.startTime) < a) && !(this.context.store.getTimeAxis().getTimeLeft(((l = s.type) == null ? void 0 : l[0]) === "S" ? o.startTime : o.endTime) > c && this.context.store.getTimeAxis().getTimeLeft(((m = s.type) == null ? void 0 : m[1]) === "F" ? r.endTime : r.startTime) > c) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, o) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
5992
|
-
const
|
|
5993
|
-
if (
|
|
6139
|
+
const v = this.getPoints(o, r, s);
|
|
6140
|
+
if (v.length <= 2)
|
|
5994
6141
|
O.warn("The link position has some error.", s);
|
|
5995
6142
|
else {
|
|
5996
|
-
const b = s.radius ?? this.context.getOptions().links.radius, w = ((p = s.arrow) == null ? void 0 : p.width) ?? this.context.getOptions().links.arrow.width, C = ((g = s.arrow) == null ? void 0 : g.height) ?? this.context.getOptions().links.arrow.height,
|
|
6143
|
+
const b = s.radius ?? this.context.getOptions().links.radius, w = ((p = s.arrow) == null ? void 0 : p.width) ?? this.context.getOptions().links.arrow.width, C = ((g = s.arrow) == null ? void 0 : g.height) ?? this.context.getOptions().links.arrow.height, M = s.width ?? this.context.getOptions().links.width;
|
|
5997
6144
|
let E = this.linkCache.get(n);
|
|
5998
|
-
E === void 0 && (E = new
|
|
5999
|
-
const
|
|
6000
|
-
if (
|
|
6001
|
-
|
|
6145
|
+
E === void 0 && (E = new k.Group({ id: n })), t != null && t.length || (E._ = i);
|
|
6146
|
+
const T = E.findOne("Circle");
|
|
6147
|
+
if (T)
|
|
6148
|
+
T.radius(b), T.fill(
|
|
6002
6149
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6003
|
-
),
|
|
6150
|
+
), T.x(v[0]), T.y(v[1]);
|
|
6004
6151
|
else {
|
|
6005
|
-
const I = new
|
|
6152
|
+
const I = new k.Circle({
|
|
6006
6153
|
radius: b,
|
|
6007
6154
|
fill: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6008
|
-
x:
|
|
6009
|
-
y:
|
|
6155
|
+
x: v[0],
|
|
6156
|
+
y: v[1]
|
|
6010
6157
|
});
|
|
6011
6158
|
E.add(I);
|
|
6012
6159
|
}
|
|
6013
|
-
const
|
|
6160
|
+
const L = Math.floor(v.length / 2), A = L % 2 === 0 ? L : L - 1, _ = v.slice(0, A + 2), D = v.slice(A), H = E.findOne("Line");
|
|
6014
6161
|
if (H)
|
|
6015
6162
|
H.points(_), H.stroke(
|
|
6016
6163
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6017
|
-
), H.strokeWidth(
|
|
6164
|
+
), H.strokeWidth(M + (this.selectedMap.has(n) ? 2 : 0)), H.dash(s.dash || this.context.getOptions().links.dash);
|
|
6018
6165
|
else {
|
|
6019
|
-
const I = new
|
|
6166
|
+
const I = new k.Line({
|
|
6020
6167
|
points: _,
|
|
6021
6168
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6022
|
-
strokeWidth:
|
|
6169
|
+
strokeWidth: M,
|
|
6023
6170
|
lineCap: "round",
|
|
6024
6171
|
lineJoin: "round",
|
|
6025
6172
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
6026
6173
|
hitStrokeWidth: 10,
|
|
6027
6174
|
// 增加点击区域
|
|
6028
6175
|
draggable: !0,
|
|
6029
|
-
dragBoundFunc: (
|
|
6176
|
+
dragBoundFunc: (G) => ({ x: 0, y: 0 })
|
|
6030
6177
|
});
|
|
6031
|
-
E.add(I), I.on("dragstart", (
|
|
6178
|
+
E.add(I), I.on("dragstart", (G) => {
|
|
6032
6179
|
this.handleDrag(
|
|
6033
|
-
|
|
6180
|
+
G,
|
|
6034
6181
|
s,
|
|
6035
6182
|
"S",
|
|
6036
|
-
[
|
|
6183
|
+
[v[v.length - 2], v[v.length - 1]],
|
|
6037
6184
|
n
|
|
6038
6185
|
);
|
|
6039
6186
|
});
|
|
@@ -6042,27 +6189,27 @@ class Ye {
|
|
|
6042
6189
|
if (W)
|
|
6043
6190
|
W.points(D), W.stroke(
|
|
6044
6191
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6045
|
-
), W.strokeWidth(
|
|
6046
|
-
((
|
|
6192
|
+
), W.strokeWidth(M + (this.selectedMap.has(n) ? 2 : 0)), W.pointerLength(C), W.pointerWidth(w), W.fill(
|
|
6193
|
+
((y = s.arrow) == null ? void 0 : y.color) || this.context.getOptions().links.arrow.color || s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6047
6194
|
), W.lineJoin("round"), W.dash(s.dash || this.context.getOptions().links.dash);
|
|
6048
6195
|
else {
|
|
6049
|
-
const I = new
|
|
6196
|
+
const I = new k.Arrow({
|
|
6050
6197
|
points: D,
|
|
6051
6198
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6052
|
-
strokeWidth:
|
|
6199
|
+
strokeWidth: M,
|
|
6053
6200
|
pointerLength: C,
|
|
6054
6201
|
pointerWidth: w,
|
|
6055
|
-
fill: ((
|
|
6202
|
+
fill: ((x = s.arrow) == null ? void 0 : x.color) || this.context.getOptions().links.arrow.color || s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6056
6203
|
// 箭头填充色
|
|
6057
6204
|
lineJoin: "round",
|
|
6058
6205
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
6059
6206
|
hitStrokeWidth: 10,
|
|
6060
6207
|
// 增加点击区域
|
|
6061
6208
|
draggable: !0,
|
|
6062
|
-
dragBoundFunc: (
|
|
6209
|
+
dragBoundFunc: (G) => ({ x: 0, y: 0 })
|
|
6063
6210
|
});
|
|
6064
|
-
E.add(I), I.on("dragstart", (
|
|
6065
|
-
this.handleDrag(
|
|
6211
|
+
E.add(I), I.on("dragstart", (G) => {
|
|
6212
|
+
this.handleDrag(G, s, "F", [v[0], v[1]], n);
|
|
6066
6213
|
});
|
|
6067
6214
|
}
|
|
6068
6215
|
this.linkCache.has(n) || (this.linksGroup.add(E), E.on("mouseover", (I) => {
|
|
@@ -6071,7 +6218,7 @@ class Ye {
|
|
|
6071
6218
|
b,
|
|
6072
6219
|
w,
|
|
6073
6220
|
C,
|
|
6074
|
-
|
|
6221
|
+
M,
|
|
6075
6222
|
2
|
|
6076
6223
|
);
|
|
6077
6224
|
}), E.on("mouseout", (I) => {
|
|
@@ -6080,31 +6227,31 @@ class Ye {
|
|
|
6080
6227
|
b,
|
|
6081
6228
|
w,
|
|
6082
6229
|
C,
|
|
6083
|
-
|
|
6230
|
+
M,
|
|
6084
6231
|
0
|
|
6085
6232
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
6086
6233
|
}), E.on("mousedown", (I) => {
|
|
6087
6234
|
this.isDragging = !0;
|
|
6088
6235
|
}), E.on("click", (I) => {
|
|
6089
6236
|
I.cancelBubble = !0, this.isDragging = !1, E.moveToTop(), I.evt.button === 0 && (this.selectedMap.has(n) ? (this.selectedMap.delete(n), this.context.event.emit(
|
|
6090
|
-
|
|
6237
|
+
S.SELECT_LINK,
|
|
6091
6238
|
null,
|
|
6092
6239
|
s,
|
|
6093
6240
|
this.selectedMap.values().toArray()
|
|
6094
6241
|
)) : (this.selectedMap.set(n, s), this.context.event.emit(
|
|
6095
|
-
|
|
6242
|
+
S.SELECT_LINK,
|
|
6096
6243
|
s,
|
|
6097
6244
|
null,
|
|
6098
6245
|
this.selectedMap.values().toArray()
|
|
6099
6246
|
)));
|
|
6100
6247
|
}), E.on("contextmenu", (I) => {
|
|
6101
|
-
I.evt.preventDefault(), I.cancelBubble = !0, this.context.event.emit(
|
|
6248
|
+
I.evt.preventDefault(), I.cancelBubble = !0, this.context.event.emit(S.CONTEXT_LINK, I.evt, s);
|
|
6102
6249
|
}), this.linkCache.set(n, E)), this.selectedMap.has(n) && this.handleHighlight(
|
|
6103
6250
|
E,
|
|
6104
6251
|
b,
|
|
6105
6252
|
w,
|
|
6106
6253
|
C,
|
|
6107
|
-
|
|
6254
|
+
M,
|
|
6108
6255
|
2,
|
|
6109
6256
|
!0
|
|
6110
6257
|
);
|
|
@@ -6150,13 +6297,13 @@ class Ye {
|
|
|
6150
6297
|
if (isNaN(m))
|
|
6151
6298
|
O.error("Link's distance must be a Numeric");
|
|
6152
6299
|
else {
|
|
6153
|
-
const p = n + d + m, g = o - d - m,
|
|
6300
|
+
const p = n + d + m, g = o - d - m, y = [
|
|
6154
6301
|
Math.max(p, g),
|
|
6155
6302
|
u + c * e.flatIndex
|
|
6156
6303
|
];
|
|
6157
|
-
l.push(...
|
|
6158
|
-
const
|
|
6159
|
-
l.push(
|
|
6304
|
+
l.push(...y);
|
|
6305
|
+
const x = c * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6306
|
+
l.push(y[0], x), l.push(g, x), l.push(g, u + c * i.flatIndex);
|
|
6160
6307
|
}
|
|
6161
6308
|
}
|
|
6162
6309
|
return l.push(o - d, u + c * i.flatIndex), l;
|
|
@@ -6172,11 +6319,11 @@ class Ye {
|
|
|
6172
6319
|
if (isNaN(m))
|
|
6173
6320
|
O.error("Link's distance must be a Numeric");
|
|
6174
6321
|
else {
|
|
6175
|
-
const p = n + d + m, g = r + d + m,
|
|
6322
|
+
const p = n + d + m, g = r + d + m, y = [
|
|
6176
6323
|
p <= g ? g : p,
|
|
6177
6324
|
u + c * e.flatIndex
|
|
6178
6325
|
];
|
|
6179
|
-
l.push(...
|
|
6326
|
+
l.push(...y), l.push(
|
|
6180
6327
|
Math.max(g, p),
|
|
6181
6328
|
u + c * i.flatIndex
|
|
6182
6329
|
);
|
|
@@ -6218,13 +6365,13 @@ class Ye {
|
|
|
6218
6365
|
if (isNaN(m))
|
|
6219
6366
|
O.error("Link's distance must be a Numeric");
|
|
6220
6367
|
else {
|
|
6221
|
-
const p = s - d - m, g = r + d + m,
|
|
6368
|
+
const p = s - d - m, g = r + d + m, y = [
|
|
6222
6369
|
Math.min(p, g),
|
|
6223
6370
|
u + c * e.flatIndex
|
|
6224
6371
|
];
|
|
6225
|
-
l.push(...
|
|
6226
|
-
const
|
|
6227
|
-
l.push(
|
|
6372
|
+
l.push(...y);
|
|
6373
|
+
const x = c * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6374
|
+
l.push(y[0], x), l.push(g, x), l.push(g, u + c * i.flatIndex);
|
|
6228
6375
|
}
|
|
6229
6376
|
}
|
|
6230
6377
|
return l.push(r + d, u + c * i.flatIndex), l;
|
|
@@ -6233,18 +6380,18 @@ class Ye {
|
|
|
6233
6380
|
* 处理连线被点击后的移动
|
|
6234
6381
|
*/
|
|
6235
6382
|
handleDrag(t, e, i, s, n) {
|
|
6236
|
-
var
|
|
6383
|
+
var y, x, v;
|
|
6237
6384
|
if (!this.isDragging || this.context.getOptions().links.move.enabled !== !0) return;
|
|
6238
6385
|
this.stage.container().style.cursor = "pointer";
|
|
6239
6386
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
6240
6387
|
this.templateArrow.setAttrs({
|
|
6241
6388
|
stroke: e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6242
6389
|
strokeWidth: e.width ?? this.context.getOptions().links.width,
|
|
6243
|
-
pointerLength: ((
|
|
6390
|
+
pointerLength: ((y = e.arrow) == null ? void 0 : y.height) ?? this.context.getOptions().links.arrow.height,
|
|
6244
6391
|
// 箭头长度
|
|
6245
|
-
pointerWidth: ((
|
|
6392
|
+
pointerWidth: ((x = e.arrow) == null ? void 0 : x.width) ?? this.context.getOptions().links.arrow.width,
|
|
6246
6393
|
// 箭头宽度
|
|
6247
|
-
fill: ((
|
|
6394
|
+
fill: ((v = e.arrow) == null ? void 0 : v.color) || this.context.getOptions().links.arrow.color || e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6248
6395
|
// 箭头填充色
|
|
6249
6396
|
lineJoin: "round",
|
|
6250
6397
|
dash: e.data || this.context.getOptions().links.dash
|
|
@@ -6255,36 +6402,36 @@ class Ye {
|
|
|
6255
6402
|
const m = () => {
|
|
6256
6403
|
const b = this.stage.getPointerPosition();
|
|
6257
6404
|
if (b && (l = this.getTaskByPosition(b), !!l && (this.templateArrow.visible(!0), o == null || o.visible(!1), l != null && l.startTime && (l != null && l.endTime)))) {
|
|
6258
|
-
const w = this.context.store.getTimeAxis().getTimeLeft(l.startTime), C = this.context.store.getTimeAxis().getTimeLeft(l.endTime),
|
|
6405
|
+
const w = this.context.store.getTimeAxis().getTimeLeft(l.startTime), C = this.context.store.getTimeAxis().getTimeLeft(l.endTime), M = (C + w) / 2 + this.offsetX;
|
|
6259
6406
|
let E = w - d;
|
|
6260
|
-
b.x <=
|
|
6261
|
-
let
|
|
6262
|
-
if (i === "S" ?
|
|
6263
|
-
const { allowLeft:
|
|
6407
|
+
b.x <= M ? r = "S" : (r = "F", E = C + d);
|
|
6408
|
+
let T;
|
|
6409
|
+
if (i === "S" ? T = `${r}${(e.type || "FS")[1]}` : T = `${(e.type || "FS")[0]}${r}`, i === "S") {
|
|
6410
|
+
const { allowLeft: L, allowRight: A } = this.isAllowStartDrop(l, e.to, T);
|
|
6264
6411
|
this.templateArrow.points([
|
|
6265
6412
|
E,
|
|
6266
6413
|
u + c * l.flatIndex,
|
|
6267
6414
|
...s
|
|
6268
6415
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6269
6416
|
} else if (i === "F") {
|
|
6270
|
-
const { allowLeft:
|
|
6417
|
+
const { allowLeft: L, allowRight: A } = this.isAllowEndDrop(l, e.from, T);
|
|
6271
6418
|
this.templateArrow.points([
|
|
6272
6419
|
...s,
|
|
6273
6420
|
E,
|
|
6274
6421
|
u + c * l.flatIndex
|
|
6275
|
-
]),
|
|
6422
|
+
]), L ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6276
6423
|
}
|
|
6277
6424
|
}
|
|
6278
6425
|
}, p = () => {
|
|
6279
|
-
var C,
|
|
6426
|
+
var C, M;
|
|
6280
6427
|
let b;
|
|
6281
|
-
const w =
|
|
6428
|
+
const w = J(e);
|
|
6282
6429
|
if (r && l && (i === "S" ? (b = `${r}${(e.type || "FS")[1]}`, w.from = l.id) : i === "F" && (b = `${(e.type || "FS")[0]}${r}`, w.to = l.id)), b && l) {
|
|
6283
6430
|
w.type = b;
|
|
6284
|
-
let E = !1,
|
|
6285
|
-
i === "S" ? { allowLeft: E, allowRight:
|
|
6431
|
+
let E = !1, T = !1, L;
|
|
6432
|
+
i === "S" ? { allowLeft: E, allowRight: T, reason: L } = this.isAllowStartDrop(l, w.to, w.type, !0) : i === "F" && ({ allowLeft: E, allowRight: T, reason: L } = this.isAllowEndDrop(l, w.from, w.type, !0)), ((C = w.type) == null ? void 0 : C.slice(1)) === "S" && E || ((M = w.type) == null ? void 0 : M.slice(1)) === "F" && T ? (this.context.event.emit(S.UPDATE_LINK, w), this.context.store.getLinkManager().update(), this.calculateLinks()) : this.context.event.emit(S.ERROR, L || Y.LINK_NOT_ALLOWED);
|
|
6286
6433
|
} else
|
|
6287
|
-
this.context.event.emit(
|
|
6434
|
+
this.context.event.emit(S.ERROR, Y.TASK_NOT_FOUND);
|
|
6288
6435
|
this.cleanupTempLink(), this.calculateLinks([l, this.context.store.getDataManager().getTaskById(e.from), this.context.store.getDataManager().getTaskById(e.to)].filter((E) => !!E)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6289
6436
|
}, g = (b) => {
|
|
6290
6437
|
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", g));
|
|
@@ -6311,37 +6458,37 @@ class Ye {
|
|
|
6311
6458
|
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = this.context.getOptions().links.gap;
|
|
6312
6459
|
let l = null;
|
|
6313
6460
|
const m = () => {
|
|
6314
|
-
const
|
|
6315
|
-
if (
|
|
6316
|
-
const
|
|
6317
|
-
let w =
|
|
6318
|
-
|
|
6461
|
+
const y = this.stage.getPointerPosition();
|
|
6462
|
+
if (y && (l = this.getTaskByPosition(y), !!l && (this.templateArrow.visible(!0), l.startTime && l.endTime))) {
|
|
6463
|
+
const x = this.context.store.getTimeAxis().getTimeLeft(l.startTime), v = this.context.store.getTimeAxis().getTimeLeft(l.endTime), b = (v + x) / 2 + this.offsetX;
|
|
6464
|
+
let w = x - d;
|
|
6465
|
+
y.x <= b ? r = "S" : (r = "F", w = v + d), this.templateArrow.points([
|
|
6319
6466
|
...s,
|
|
6320
6467
|
w,
|
|
6321
6468
|
u + c * l.flatIndex
|
|
6322
6469
|
]);
|
|
6323
|
-
const { allowLeft: C, allowRight:
|
|
6324
|
-
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !
|
|
6470
|
+
const { allowLeft: C, allowRight: M } = this.isAllowEndDrop(l, n, o.convertPointsToLinkType(e, r));
|
|
6471
|
+
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !M ? this.stage.container().style.cursor = "not-allowed" : this.stage.container().style.cursor = "pointer";
|
|
6325
6472
|
}
|
|
6326
6473
|
}, p = () => {
|
|
6327
|
-
let
|
|
6328
|
-
if (r && (
|
|
6329
|
-
if (o.isLinkExist(n, l.id,
|
|
6330
|
-
this.context.event.emit(
|
|
6474
|
+
let y;
|
|
6475
|
+
if (r && (y = o.convertPointsToLinkType(e, r)), y && l)
|
|
6476
|
+
if (o.isLinkExist(n, l.id, y))
|
|
6477
|
+
this.context.event.emit(S.ERROR, Y.LINK_EXIST);
|
|
6331
6478
|
else if (n === l.id && e === r)
|
|
6332
|
-
this.context.event.emit(
|
|
6479
|
+
this.context.event.emit(S.ERROR, Y.LINK_SAME);
|
|
6333
6480
|
else {
|
|
6334
|
-
const { allowLeft:
|
|
6335
|
-
r === "S" &&
|
|
6481
|
+
const { allowLeft: x, allowRight: v, reason: b } = this.isAllowEndDrop(l, n, y, !0);
|
|
6482
|
+
r === "S" && x || r === "F" && v ? (this.context.event.emit(S.CREATE_LINK, {
|
|
6336
6483
|
from: n,
|
|
6337
6484
|
to: l.id,
|
|
6338
|
-
type:
|
|
6485
|
+
type: y,
|
|
6339
6486
|
color: i
|
|
6340
|
-
}), this.context.store.getLinkManager().update()) : this.context.event.emit(
|
|
6487
|
+
}), this.context.store.getLinkManager().update()) : this.context.event.emit(S.ERROR, b || Y.LINK_NOT_ALLOWED);
|
|
6341
6488
|
}
|
|
6342
|
-
this.cleanupTempLink(), this.calculateLinks([l].filter((
|
|
6343
|
-
}, g = (
|
|
6344
|
-
|
|
6489
|
+
this.cleanupTempLink(), this.calculateLinks([l].filter((x) => !!x)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6490
|
+
}, g = (y) => {
|
|
6491
|
+
y.key === "Escape" && (this.cleanupTempLink(), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", g));
|
|
6345
6492
|
};
|
|
6346
6493
|
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown", g);
|
|
6347
6494
|
}
|
|
@@ -6370,7 +6517,7 @@ class Ye {
|
|
|
6370
6517
|
j(r) && (r = r(
|
|
6371
6518
|
t.getEmitData(),
|
|
6372
6519
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6373
|
-
)), ht(r) ? n = o = r :
|
|
6520
|
+
)), ht(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6374
6521
|
const a = this.validateChain(t.id, e, i, s);
|
|
6375
6522
|
return {
|
|
6376
6523
|
allowLeft: n && a.ok,
|
|
@@ -6386,7 +6533,7 @@ class Ye {
|
|
|
6386
6533
|
j(r) && (r = r(
|
|
6387
6534
|
t.getEmitData(),
|
|
6388
6535
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6389
|
-
)), ht(r) ? n = o = r :
|
|
6536
|
+
)), ht(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6390
6537
|
const a = this.validateChain(e, t.id, i, s);
|
|
6391
6538
|
return {
|
|
6392
6539
|
allowLeft: n && a.ok,
|
|
@@ -6406,17 +6553,17 @@ class Ye {
|
|
|
6406
6553
|
*/
|
|
6407
6554
|
handleHighlight(t, e, i, s, n, o, r = !1) {
|
|
6408
6555
|
const a = t.findOne("Circle"), c = t.findOne("Arrow"), u = t.findOne("Line");
|
|
6409
|
-
a && new
|
|
6556
|
+
a && new k.Tween({
|
|
6410
6557
|
node: a,
|
|
6411
6558
|
radius: e + o,
|
|
6412
6559
|
duration: r ? 0 : 0.1
|
|
6413
|
-
}).play(), c && new
|
|
6560
|
+
}).play(), c && new k.Tween({
|
|
6414
6561
|
node: c,
|
|
6415
6562
|
pointerWidth: i + o,
|
|
6416
6563
|
pointerLength: s + o,
|
|
6417
6564
|
strokeWidth: n + o,
|
|
6418
6565
|
duration: r ? 0 : 0.1
|
|
6419
|
-
}).play(), u && new
|
|
6566
|
+
}).play(), u && new k.Tween({
|
|
6420
6567
|
node: u,
|
|
6421
6568
|
strokeWidth: n + o,
|
|
6422
6569
|
duration: r ? 0 : 0.1
|
|
@@ -6434,11 +6581,11 @@ class Ye {
|
|
|
6434
6581
|
/** 操作创建点的高亮 */
|
|
6435
6582
|
handlePointHighlight(t, e) {
|
|
6436
6583
|
const i = this.pointGroup.findOne(`#point-${t}-left`), s = this.pointGroup.findOne(`#point-${t}-right`);
|
|
6437
|
-
i && new
|
|
6584
|
+
i && new k.Tween({
|
|
6438
6585
|
node: i,
|
|
6439
6586
|
opacity: e,
|
|
6440
6587
|
duration: 0.1
|
|
6441
|
-
}).play(), s && new
|
|
6588
|
+
}).play(), s && new k.Tween({
|
|
6442
6589
|
node: s,
|
|
6443
6590
|
opacity: e,
|
|
6444
6591
|
duration: 0.1
|
|
@@ -6449,11 +6596,11 @@ class Ye {
|
|
|
6449
6596
|
*/
|
|
6450
6597
|
highlightCycleNodes(t) {
|
|
6451
6598
|
t.forEach((e) => {
|
|
6452
|
-
this.context.event.emit(
|
|
6599
|
+
this.context.event.emit(S.SLIDER_BLINK, e);
|
|
6453
6600
|
});
|
|
6454
6601
|
}
|
|
6455
6602
|
}
|
|
6456
|
-
class
|
|
6603
|
+
class Xe {
|
|
6457
6604
|
constructor(t, e, i) {
|
|
6458
6605
|
h(this, "tasks", []);
|
|
6459
6606
|
h(this, "chartBaselineGroup");
|
|
@@ -6464,7 +6611,7 @@ class Ue {
|
|
|
6464
6611
|
h(this, "height", 0);
|
|
6465
6612
|
h(this, "offsetX", 0);
|
|
6466
6613
|
h(this, "offsetY", 0);
|
|
6467
|
-
this.context = t, this.stage = e, this.layer = i, this.chartBaselineGroup = new
|
|
6614
|
+
this.context = t, this.stage = e, this.layer = i, this.chartBaselineGroup = new k.Group({ name: "chart-baseline-group" }), this.baselineGroup = new k.Group({ name: "baseline-group" }), this.chartBaselineGroup.add(this.baselineGroup), this.indicatorGroup = new k.Group({ name: "baseline-indicator-group" }), this.chartBaselineGroup.add(this.indicatorGroup), this.layer.add(this.chartBaselineGroup), this.registerEvents();
|
|
6468
6615
|
}
|
|
6469
6616
|
/**
|
|
6470
6617
|
* 注册事件
|
|
@@ -6517,19 +6664,19 @@ class Ue {
|
|
|
6517
6664
|
), u = this.context.getOptions().baselines.offset ?? 0;
|
|
6518
6665
|
a.forEach((d, l) => {
|
|
6519
6666
|
if (!d.validate()) return;
|
|
6520
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(d.startTime), p = this.context.store.getTimeAxis().getTimeLeft(d.endTime), g = new
|
|
6667
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(d.startTime), p = this.context.store.getTimeAxis().getTimeLeft(d.endTime), g = new k.Group({ id: `baseline-group-${d.id}` });
|
|
6521
6668
|
this.renderBaselineBar(g, r, d, m, p, i, e, c, t, o, n, s, u), this.baselineGroup.add(g);
|
|
6522
|
-
const
|
|
6523
|
-
if (!
|
|
6524
|
-
const
|
|
6525
|
-
d.highlight && (
|
|
6669
|
+
const y = this.context.getOptions().baselines.compare, x = d.getTimeDiff();
|
|
6670
|
+
if (!y.enabled || !x) return;
|
|
6671
|
+
const v = y.mode;
|
|
6672
|
+
d.highlight && (v === "highlight" || v === "both") && this.renderCompareHighlight(g, r, d, x), l === 0 && (v === "indicator" || v === "both") && this.renderCompareIndicator(r, d, x), this.bindEvents(g, r, d);
|
|
6526
6673
|
});
|
|
6527
6674
|
}
|
|
6528
6675
|
});
|
|
6529
6676
|
}
|
|
6530
6677
|
renderBaselineBar(t, e, i, s, n, o, r, a, c, u, d, l, m) {
|
|
6531
6678
|
if (this.context.getOptions().baselines.mode === "shadow") {
|
|
6532
|
-
const p = o + r * e.flatIndex - a / 2 + m, g = new
|
|
6679
|
+
const p = o + r * e.flatIndex - a / 2 + m, g = new k.Rect({
|
|
6533
6680
|
id: `baseline-item-${i.id}`,
|
|
6534
6681
|
x: s,
|
|
6535
6682
|
y: p,
|
|
@@ -6543,10 +6690,10 @@ class Ue {
|
|
|
6543
6690
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
6544
6691
|
const p = nt(this.context.getOptions().baselines.height ?? 5, r);
|
|
6545
6692
|
let g = c + r * e.flatIndex + m;
|
|
6546
|
-
const
|
|
6547
|
-
let
|
|
6548
|
-
|
|
6549
|
-
const
|
|
6693
|
+
const y = this.context.getOptions().baselines.position;
|
|
6694
|
+
let x = "";
|
|
6695
|
+
y === "top" ? (g += +p / 2, x = "line_top") : y === "center" ? (g += r / 2, x = "line_center") : (g += r - p / 2, x = "line_bottom");
|
|
6696
|
+
const v = new k.Line({
|
|
6550
6697
|
id: `baseline-item-${i.id}`,
|
|
6551
6698
|
points: [s, g, n, g],
|
|
6552
6699
|
stroke: u,
|
|
@@ -6555,17 +6702,17 @@ class Ue {
|
|
|
6555
6702
|
lineCap: "butt",
|
|
6556
6703
|
lineJoin: "round"
|
|
6557
6704
|
});
|
|
6558
|
-
t.add(
|
|
6705
|
+
t.add(v), this.renderText(t, e, i, s, n, g, p, x);
|
|
6559
6706
|
}
|
|
6560
6707
|
}
|
|
6561
6708
|
renderText(t, e, i, s, n, o, r, a) {
|
|
6562
6709
|
const c = `chart-baseline-text-${i.id}`;
|
|
6563
6710
|
if ((() => {
|
|
6564
|
-
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((
|
|
6711
|
+
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((x) => x.remove());
|
|
6565
6712
|
})(), !this.context.getOptions().baselines.label.show) return;
|
|
6566
6713
|
const d = this.context.getOptions().baselines.label.field, l = d ? i.getField(d) : i.name;
|
|
6567
6714
|
if (!l || l === "") return;
|
|
6568
|
-
const m = n - s - 10, p = Math.max(this.context.getOptions().baselines.label.fontSize, r), g = new
|
|
6715
|
+
const m = n - s - 10, p = Math.max(this.context.getOptions().baselines.label.fontSize, r), g = new k.Text({
|
|
6569
6716
|
text: l,
|
|
6570
6717
|
id: c,
|
|
6571
6718
|
x: s + 5,
|
|
@@ -6590,8 +6737,8 @@ class Ue {
|
|
|
6590
6737
|
}), r >= p && g.setAttrs({
|
|
6591
6738
|
verticalAlign: "middle"
|
|
6592
6739
|
});
|
|
6593
|
-
const
|
|
6594
|
-
(this.context.getOptions().baselines.label.forceDisplay || m >
|
|
6740
|
+
const y = g.measureSize(l);
|
|
6741
|
+
(this.context.getOptions().baselines.label.forceDisplay || m > y.width) && t.add(g);
|
|
6595
6742
|
}
|
|
6596
6743
|
renderCompareHighlight(t, e, i, s) {
|
|
6597
6744
|
const n = s[`${this.context.getOptions().baselines.compare.target}Status`];
|
|
@@ -6621,7 +6768,7 @@ class Ue {
|
|
|
6621
6768
|
const m = i.startStatus;
|
|
6622
6769
|
if (m && s.compare.indicator[m].show) {
|
|
6623
6770
|
c = B(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
6624
|
-
const p = new
|
|
6771
|
+
const p = new k.Circle({
|
|
6625
6772
|
x: u - n.size,
|
|
6626
6773
|
y: l,
|
|
6627
6774
|
fill: c,
|
|
@@ -6629,23 +6776,23 @@ class Ue {
|
|
|
6629
6776
|
});
|
|
6630
6777
|
this.indicatorGroup.add(p);
|
|
6631
6778
|
let g = `${gt(i.startDiff)}${i.unit} ${m}`;
|
|
6632
|
-
const
|
|
6633
|
-
j(
|
|
6634
|
-
const
|
|
6779
|
+
const y = s.compare.indicator[m].text;
|
|
6780
|
+
j(y) ? g = y(i.startDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (g = y);
|
|
6781
|
+
const x = new k.Text({
|
|
6635
6782
|
y: l - n.fontSize / 2,
|
|
6636
6783
|
text: g,
|
|
6637
6784
|
fill: c,
|
|
6638
6785
|
fontSize: n.fontSize,
|
|
6639
6786
|
fontFamily: n.fontFamily || "Arial"
|
|
6640
|
-
}),
|
|
6641
|
-
|
|
6787
|
+
}), v = x.measureSize(g);
|
|
6788
|
+
x.x(u - n.size - v.width - 5), this.indicatorGroup.add(x);
|
|
6642
6789
|
}
|
|
6643
6790
|
}
|
|
6644
6791
|
if (n.show === "end" || n.show === "both" || n.show === !0) {
|
|
6645
6792
|
const m = i.endStatus;
|
|
6646
6793
|
if (m && s.compare.indicator[m].show) {
|
|
6647
6794
|
c = B(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
6648
|
-
const p = new
|
|
6795
|
+
const p = new k.Circle({
|
|
6649
6796
|
x: d + n.size,
|
|
6650
6797
|
y: l,
|
|
6651
6798
|
fill: c,
|
|
@@ -6653,9 +6800,9 @@ class Ue {
|
|
|
6653
6800
|
});
|
|
6654
6801
|
this.indicatorGroup.add(p);
|
|
6655
6802
|
let g = `${gt(i.endDiff)}${i.unit} ${m}`;
|
|
6656
|
-
const
|
|
6657
|
-
j(
|
|
6658
|
-
const
|
|
6803
|
+
const y = s.compare.indicator[m].text;
|
|
6804
|
+
j(y) ? g = y(i.endDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (g = y);
|
|
6805
|
+
const x = new k.Text({
|
|
6659
6806
|
x: d + n.size + 5,
|
|
6660
6807
|
y: l - n.fontSize / 2,
|
|
6661
6808
|
text: g,
|
|
@@ -6663,23 +6810,23 @@ class Ue {
|
|
|
6663
6810
|
fontSize: n.fontSize,
|
|
6664
6811
|
fontFamily: n.fontFamily || "Arial"
|
|
6665
6812
|
});
|
|
6666
|
-
this.indicatorGroup.add(
|
|
6813
|
+
this.indicatorGroup.add(x);
|
|
6667
6814
|
}
|
|
6668
6815
|
}
|
|
6669
6816
|
}
|
|
6670
6817
|
bindEvents(t, e, i) {
|
|
6671
6818
|
t.on("mouseenter", (s) => {
|
|
6672
|
-
this.context.event.emit(
|
|
6819
|
+
this.context.event.emit(S.BASELINE_MOUSEENTER, s.evt, e, i);
|
|
6673
6820
|
}), t.on("mousemove", (s) => {
|
|
6674
|
-
this.context.event.emit(
|
|
6821
|
+
this.context.event.emit(S.BASELINE_MOUSEMOVE, s.evt, e, i);
|
|
6675
6822
|
}), t.on("mouseout", (s) => {
|
|
6676
|
-
this.context.event.emit(
|
|
6823
|
+
this.context.event.emit(S.BASELINE_MOUSEOUT, s.evt, e, i);
|
|
6677
6824
|
}), t.on("click", (s) => {
|
|
6678
|
-
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(
|
|
6825
|
+
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(S.BASELINE_CLICK, s.evt, e, i) : s.evt.button === 2 && this.context.event.emit(S.BASELINE_CONTEXTMENU, s.evt, e, i);
|
|
6679
6826
|
});
|
|
6680
6827
|
}
|
|
6681
6828
|
}
|
|
6682
|
-
class
|
|
6829
|
+
class Ve {
|
|
6683
6830
|
constructor(t, e) {
|
|
6684
6831
|
// Konva 元素
|
|
6685
6832
|
h(this, "stage");
|
|
@@ -6697,11 +6844,11 @@ class Xe {
|
|
|
6697
6844
|
h(this, "bodyLayer");
|
|
6698
6845
|
h(this, "width", 0);
|
|
6699
6846
|
h(this, "height", 0);
|
|
6700
|
-
this.context = t, this.container = e, this.stage = new
|
|
6847
|
+
this.context = t, this.container = e, this.stage = new k.Stage({
|
|
6701
6848
|
container: this.container,
|
|
6702
6849
|
width: this.container.clientWidth,
|
|
6703
6850
|
height: this.container.clientHeight
|
|
6704
|
-
}), this.bgLayer = new
|
|
6851
|
+
}), this.bgLayer = new k.Layer(), this.weekendGroup = new ze(this.context, this.bgLayer), this.holidayGroup = new Ne(this.context, this.bgLayer), this.flagGroup = new Ye(this.context, this.bgLayer), this.gridGroup = new We(this.context, this.bgLayer), this.stage.add(this.bgLayer), this.axisLayer = new k.Layer(), this.headerLayer = new Ge(this.context, this.axisLayer), this.todayLayer = new Pe(this.context, this.bgLayer, this.axisLayer), this.stage.add(this.axisLayer), this.bodyLayer = new k.Layer(), this.linkGroup = new Ue(this.context, this.stage, this.bodyLayer), this.baselineGroup = new Xe(this.context, this.stage, this.bodyLayer), this.bodyGroup = new Be(this.context, this.stage, this.bodyLayer, this.bgLayer), this.stage.add(this.bodyLayer);
|
|
6705
6852
|
}
|
|
6706
6853
|
/**
|
|
6707
6854
|
* 调整大小
|
|
@@ -6729,7 +6876,7 @@ class Xe {
|
|
|
6729
6876
|
}
|
|
6730
6877
|
}
|
|
6731
6878
|
const Ke = '<svg style="transition: all 0.3s" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>';
|
|
6732
|
-
class
|
|
6879
|
+
class je {
|
|
6733
6880
|
constructor(t, e) {
|
|
6734
6881
|
h(this, "line");
|
|
6735
6882
|
h(this, "initialX", 0);
|
|
@@ -6756,7 +6903,7 @@ class Ve {
|
|
|
6756
6903
|
const c = s[s.length - 1].key;
|
|
6757
6904
|
this.initialWidth = i.getColumnWidth(c);
|
|
6758
6905
|
const u = this.initialX;
|
|
6759
|
-
this.root.event.emit(
|
|
6906
|
+
this.root.event.emit(S.SHOW_GUIDELINE, u);
|
|
6760
6907
|
const d = (m) => o(m), l = (m) => r(m, d, l);
|
|
6761
6908
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6762
6909
|
}, o = (a) => {
|
|
@@ -6764,16 +6911,16 @@ class Ve {
|
|
|
6764
6911
|
const c = a.clientX - t;
|
|
6765
6912
|
s[s.length - 1].key;
|
|
6766
6913
|
const u = 50 - this.initialWidth, l = e.width - 20 - this.initialX, m = Math.max(u, Math.min(l, c)), p = this.initialX + m;
|
|
6767
|
-
this.root.event.emit(
|
|
6914
|
+
this.root.event.emit(S.MOVE_GUIDELINE, p);
|
|
6768
6915
|
}, r = (a, c, u) => {
|
|
6769
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), this.root.event.emit(
|
|
6916
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), this.root.event.emit(S.HIDE_GUIDELINE);
|
|
6770
6917
|
const d = a.clientX - t, l = s[s.length - 1].key, m = Math.max(50, this.initialWidth + d);
|
|
6771
|
-
i.setColumnWidth(l, m), this.root.event.emit(
|
|
6918
|
+
i.setColumnWidth(l, m), this.root.event.emit(S.UPDATE_TABLE_HEADER);
|
|
6772
6919
|
};
|
|
6773
6920
|
this.line.addEventListener("mousedown", n);
|
|
6774
6921
|
}
|
|
6775
6922
|
}
|
|
6776
|
-
class
|
|
6923
|
+
class qe {
|
|
6777
6924
|
/**
|
|
6778
6925
|
* @param container 指示线的容器元素
|
|
6779
6926
|
*/
|
|
@@ -6799,11 +6946,11 @@ class je {
|
|
|
6799
6946
|
* 初始化事件监听
|
|
6800
6947
|
*/
|
|
6801
6948
|
initEvents() {
|
|
6802
|
-
this.context.event.on(
|
|
6949
|
+
this.context.event.on(S.SHOW_GUIDELINE, (t) => {
|
|
6803
6950
|
this.show(t);
|
|
6804
|
-
}), this.context.event.on(
|
|
6951
|
+
}), this.context.event.on(S.HIDE_GUIDELINE, () => {
|
|
6805
6952
|
this.hide();
|
|
6806
|
-
}), this.context.event.on(
|
|
6953
|
+
}), this.context.event.on(S.MOVE_GUIDELINE, (t) => {
|
|
6807
6954
|
this.setLeft(t);
|
|
6808
6955
|
});
|
|
6809
6956
|
}
|
|
@@ -6848,7 +6995,7 @@ class je {
|
|
|
6848
6995
|
return this.element.offsetLeft;
|
|
6849
6996
|
}
|
|
6850
6997
|
}
|
|
6851
|
-
class
|
|
6998
|
+
class Qe {
|
|
6852
6999
|
constructor(t = 16) {
|
|
6853
7000
|
h(this, "taskQueue", /* @__PURE__ */ new Map());
|
|
6854
7001
|
// 使用 Map 避免同类型重复任务
|
|
@@ -6989,7 +7136,7 @@ class qe {
|
|
|
6989
7136
|
this.cancelScheduled(), this.taskHandlers.clear(), O.debug("RenderScheduler: 已销毁");
|
|
6990
7137
|
}
|
|
6991
7138
|
}
|
|
6992
|
-
class
|
|
7139
|
+
class Ze {
|
|
6993
7140
|
constructor(t, e) {
|
|
6994
7141
|
h(this, "scrollbar");
|
|
6995
7142
|
h(this, "rootElement");
|
|
@@ -7008,6 +7155,7 @@ class Qe {
|
|
|
7008
7155
|
h(this, "width", 0);
|
|
7009
7156
|
h(this, "height", 0);
|
|
7010
7157
|
h(this, "isInitialized", !0);
|
|
7158
|
+
h(this, "resizeObserver");
|
|
7011
7159
|
// 更新尺寸
|
|
7012
7160
|
h(this, "updateSize", () => {
|
|
7013
7161
|
this.width = this.context.store.getOptionManager().getOptions().width || this.container.clientWidth, this.height = this.context.store.getOptionManager().getOptions().height || this.container.clientHeight, this.rootElement.style.width = this.width ? `${this.width}px` : "100%", this.rootElement.style.height = this.height ? `${this.height}px` : "100%";
|
|
@@ -7057,16 +7205,24 @@ class Qe {
|
|
|
7057
7205
|
h(this, "handleColumnWidthChange", () => {
|
|
7058
7206
|
this.table.updateWidth(), this.updateSize();
|
|
7059
7207
|
});
|
|
7060
|
-
|
|
7208
|
+
var i;
|
|
7209
|
+
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new qe(this.context, this.container), this.middleLine = new je(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new Re(this.context, this.tableContainer), this.chart = new Ve(this.context, this.chartContainer), this.scrollbar = new _e(
|
|
7061
7210
|
this.context,
|
|
7062
7211
|
this.rootElement,
|
|
7063
7212
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
7064
7213
|
// 传入配置项
|
|
7065
|
-
), this.renderScheduler = new
|
|
7214
|
+
), this.renderScheduler = new Qe(16), this.setupTaskHandlers(), this.updateSize(), this.setupEventListeners(), (i = this.context.store.getOptionManager().getOptions().resize) != null && i.enabled && (typeof window.ResizeObserver > "u" ? O.warn(
|
|
7215
|
+
"Current environment does not support ResizeObserver, please include a polyfill to enable auto-resize feature."
|
|
7216
|
+
) : (this.resizeObserver = new ResizeObserver(() => {
|
|
7217
|
+
this.updateSize(), this.renderScheduler.scheduleTask("VIEW_UPDATE", [!1]);
|
|
7218
|
+
}), this.resizeObserver.observe(this.container)));
|
|
7066
7219
|
}
|
|
7067
7220
|
getScrollbar() {
|
|
7068
7221
|
return this.scrollbar;
|
|
7069
7222
|
}
|
|
7223
|
+
getRootElement() {
|
|
7224
|
+
return this.rootElement;
|
|
7225
|
+
}
|
|
7070
7226
|
/**
|
|
7071
7227
|
* 设置任务处理器
|
|
7072
7228
|
*/
|
|
@@ -7100,21 +7256,21 @@ class Qe {
|
|
|
7100
7256
|
* 设置事件监听器
|
|
7101
7257
|
*/
|
|
7102
7258
|
setupEventListeners() {
|
|
7103
|
-
this.context.event.on(
|
|
7259
|
+
this.context.event.on(S.DATA_UPDATE, () => {
|
|
7104
7260
|
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
7105
|
-
}), this.context.event.on(
|
|
7261
|
+
}), this.context.event.on(S.SCROLL, () => {
|
|
7106
7262
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
7107
|
-
}), this.context.event.on(
|
|
7263
|
+
}), this.context.event.on(S.COLUMN_WIDTH_CHANGE, () => {
|
|
7108
7264
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
7109
|
-
}), this.context.event.on(
|
|
7265
|
+
}), this.context.event.on(S.VIEW_UPDATE, () => {
|
|
7110
7266
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
7111
|
-
}), this.context.event.on(
|
|
7267
|
+
}), this.context.event.on(S.UPDATE_TASK, (t) => {
|
|
7112
7268
|
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
7113
7269
|
immediate: !0
|
|
7114
7270
|
});
|
|
7115
|
-
}), this.context.event.on(
|
|
7271
|
+
}), this.context.event.on(S.CHART_OFFSET_CHANGE, () => {
|
|
7116
7272
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
7117
|
-
}), this.context.event.on(
|
|
7273
|
+
}), this.context.event.on(S.TOGGLE_COLLAPSE, () => {
|
|
7118
7274
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1], { immediate: !0 });
|
|
7119
7275
|
});
|
|
7120
7276
|
}
|
|
@@ -7125,7 +7281,7 @@ class Qe {
|
|
|
7125
7281
|
performRender(t = !1, e = !1) {
|
|
7126
7282
|
this.setStyleValue();
|
|
7127
7283
|
const { x: i, y: s } = this.scrollbar.getScrollPosition(), n = this.context.store.getOptionManager().getOptions().row.height, o = this.context.store.getOptionManager().getOptions().header.height, r = Math.floor(s / n), a = Math.ceil((this.height - o) / n), c = 2, u = Math.max(0, r), d = a + c, l = this.context.store.getDataManager().getVisibleTasks().slice(u, u + d);
|
|
7128
|
-
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(
|
|
7284
|
+
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(S.LOADED), this.isInitialized = !1), O.debug("execute render");
|
|
7129
7285
|
}
|
|
7130
7286
|
/**
|
|
7131
7287
|
* 公共渲染方法,向后兼容
|
|
@@ -7146,7 +7302,7 @@ class Qe {
|
|
|
7146
7302
|
);
|
|
7147
7303
|
}
|
|
7148
7304
|
destroy() {
|
|
7149
|
-
O.debug("Renderer destroy"), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
7305
|
+
O.debug("Renderer destroy"), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
7150
7306
|
}
|
|
7151
7307
|
}
|
|
7152
7308
|
class Je {
|
|
@@ -7155,7 +7311,7 @@ class Je {
|
|
|
7155
7311
|
h(this, "store");
|
|
7156
7312
|
h(this, "event", new jt());
|
|
7157
7313
|
h(this, "renderer");
|
|
7158
|
-
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new De(this, i), this.renderer = new
|
|
7314
|
+
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new De(this, i), this.renderer = new Ze(this, this.container), this.render(), this.registerEvents(), O.debug(
|
|
7159
7315
|
"----Gantt initialized for element:",
|
|
7160
7316
|
this._id,
|
|
7161
7317
|
this.container
|
|
@@ -7165,6 +7321,10 @@ class Je {
|
|
|
7165
7321
|
var t;
|
|
7166
7322
|
return (t = this.renderer) == null ? void 0 : t.getScrollbar();
|
|
7167
7323
|
}
|
|
7324
|
+
getRootElement() {
|
|
7325
|
+
var t;
|
|
7326
|
+
return (t = this.renderer) == null ? void 0 : t.getRootElement();
|
|
7327
|
+
}
|
|
7168
7328
|
getOptions() {
|
|
7169
7329
|
return this.store.getOptionManager().getOptions();
|
|
7170
7330
|
}
|
|
@@ -7187,7 +7347,7 @@ class Je {
|
|
|
7187
7347
|
* @return {boolean} 是否成功跳转
|
|
7188
7348
|
*/
|
|
7189
7349
|
jumpTo(t) {
|
|
7190
|
-
const e =
|
|
7350
|
+
const e = R(t);
|
|
7191
7351
|
if (!this.store.getTimeAxis().isInTimeAxis(e)) return !1;
|
|
7192
7352
|
const i = this.store.getTimeAxis().getTimeLeft(e) - 100;
|
|
7193
7353
|
return this.renderer.getScrollbar().scrollTo({ x: Math.max(i, 0) }), !0;
|
|
@@ -7208,7 +7368,7 @@ class Je {
|
|
|
7208
7368
|
}, n);
|
|
7209
7369
|
}
|
|
7210
7370
|
return this.renderer.getScrollbar().scrollTo({ y: i }), e && s && setTimeout(() => {
|
|
7211
|
-
this.event.emit(
|
|
7371
|
+
this.event.emit(S.SLIDER_BLINK, s.id);
|
|
7212
7372
|
}, n * 2), !0;
|
|
7213
7373
|
}
|
|
7214
7374
|
/**
|
|
@@ -7229,11 +7389,11 @@ class Je {
|
|
|
7229
7389
|
}
|
|
7230
7390
|
// 注册对外事件
|
|
7231
7391
|
registerEvents() {
|
|
7232
|
-
this.event.on(
|
|
7392
|
+
this.event.on(S.ERROR, (t, e) => {
|
|
7233
7393
|
this._emit("error", t, e);
|
|
7234
|
-
}), this.event.on(
|
|
7394
|
+
}), this.event.on(S.LOADED, () => {
|
|
7235
7395
|
this._emit("loaded");
|
|
7236
|
-
}), this.event.on(
|
|
7396
|
+
}), this.event.on(S.TASK_DRAG_END, (t, e) => {
|
|
7237
7397
|
this._emit(
|
|
7238
7398
|
"move",
|
|
7239
7399
|
e.map((i) => {
|
|
@@ -7244,56 +7404,62 @@ class Je {
|
|
|
7244
7404
|
};
|
|
7245
7405
|
})
|
|
7246
7406
|
);
|
|
7247
|
-
}), this.event.on(
|
|
7407
|
+
}), this.event.on(S.ROW_DRAG_END, (t, e) => {
|
|
7408
|
+
this._emit(
|
|
7409
|
+
"drag:row",
|
|
7410
|
+
t.data,
|
|
7411
|
+
e.data
|
|
7412
|
+
);
|
|
7413
|
+
}), this.event.on(S.CHECK_TASK, (t, e) => {
|
|
7248
7414
|
this._emit(
|
|
7249
7415
|
"select",
|
|
7250
7416
|
t.map((i) => i.data),
|
|
7251
7417
|
e,
|
|
7252
7418
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
7253
7419
|
);
|
|
7254
|
-
}), this.event.on(
|
|
7420
|
+
}), this.event.on(S.UPDATE_LINK, (t) => {
|
|
7255
7421
|
this._emit("update:link", t);
|
|
7256
|
-
}), this.event.on(
|
|
7422
|
+
}), this.event.on(S.CREATE_LINK, (t) => {
|
|
7257
7423
|
this._emit("create:link", t);
|
|
7258
7424
|
}), this.event.on(
|
|
7259
|
-
|
|
7425
|
+
S.SELECT_LINK,
|
|
7260
7426
|
(t, e, i) => {
|
|
7261
7427
|
this._emit("select:link", t, e, i);
|
|
7262
7428
|
}
|
|
7263
|
-
), this.event.on(
|
|
7429
|
+
), this.event.on(S.CONTEXT_LINK, (t, e) => {
|
|
7264
7430
|
this._emit("contextmenu:link", t, e);
|
|
7265
|
-
}), this.event.on(
|
|
7266
|
-
this._emit("click:row", t, e.data);
|
|
7267
|
-
}), this.event.on(
|
|
7268
|
-
this._emit("dblclick:row", t, e.data);
|
|
7269
|
-
}), this.event.on(
|
|
7270
|
-
this._emit("contextmenu:row", t, e.data);
|
|
7271
|
-
}), this.event.on(
|
|
7431
|
+
}), this.event.on(S.ROW_CLICK, (t, e, i) => {
|
|
7432
|
+
this._emit("click:row", t, e.data, i);
|
|
7433
|
+
}), this.event.on(S.ROW_DBL_CLICK, (t, e, i) => {
|
|
7434
|
+
this._emit("dblclick:row", t, e.data, i);
|
|
7435
|
+
}), this.event.on(S.ROW_CONTEXTMENU, (t, e, i) => {
|
|
7436
|
+
this._emit("contextmenu:row", t, e.data, i);
|
|
7437
|
+
}), this.event.on(S.SLIDER_CLICK, (t, e) => {
|
|
7272
7438
|
this._emit("click:slider", t, e.data);
|
|
7273
|
-
}), this.event.on(
|
|
7439
|
+
}), this.event.on(S.SLIDER_DBL_CLICK, (t, e) => {
|
|
7274
7440
|
this._emit("dblclick:slider", t, e.data);
|
|
7275
|
-
}), this.event.on(
|
|
7441
|
+
}), this.event.on(S.SLIDER_CONTEXTMENU, (t, e) => {
|
|
7276
7442
|
this._emit("contextmenu:slider", t, e.data);
|
|
7277
|
-
}), this.event.on(
|
|
7443
|
+
}), this.event.on(S.SLIDER_ENTER, (t, e) => {
|
|
7278
7444
|
this._emit("enter:slider", t, e.data);
|
|
7279
|
-
}), this.event.on(
|
|
7445
|
+
}), this.event.on(S.SLIDER_HOVER, (t, e) => {
|
|
7280
7446
|
this._emit("hover:slider", t, e.data);
|
|
7281
|
-
}), this.event.on(
|
|
7447
|
+
}), this.event.on(S.SLIDER_LEAVE, (t, e) => {
|
|
7282
7448
|
this._emit("leave:slider", t, e.data);
|
|
7283
|
-
}), this.event.on(
|
|
7449
|
+
}), this.event.on(S.BASELINE_CLICK, (t, e, i) => {
|
|
7284
7450
|
this._emit("click:baseline", t, e.data, i.data);
|
|
7285
|
-
}), this.event.on(
|
|
7451
|
+
}), this.event.on(S.BASELINE_CONTEXTMENU, (t, e, i) => {
|
|
7286
7452
|
this._emit("contextmenu:baseline", t, e.data, i.data);
|
|
7287
|
-
}), this.event.on(
|
|
7453
|
+
}), this.event.on(S.BASELINE_MOUSEENTER, (t, e, i) => {
|
|
7288
7454
|
this._emit("enter:baseline", t, e.data, i.data);
|
|
7289
|
-
}), this.event.on(
|
|
7455
|
+
}), this.event.on(S.BASELINE_MOUSEMOVE, (t, e, i) => {
|
|
7290
7456
|
this._emit("hover:baseline", t, e.data, i.data);
|
|
7291
|
-
}), this.event.on(
|
|
7457
|
+
}), this.event.on(S.BASELINE_MOUSEOUT, (t, e, i) => {
|
|
7292
7458
|
this._emit("leave:baseline", t, e.data, i.data);
|
|
7293
7459
|
});
|
|
7294
7460
|
}
|
|
7295
7461
|
}
|
|
7296
|
-
class
|
|
7462
|
+
class ni {
|
|
7297
7463
|
constructor(t, e) {
|
|
7298
7464
|
h(this, "context");
|
|
7299
7465
|
// 管理对外事件
|
|
@@ -7306,7 +7472,7 @@ class si {
|
|
|
7306
7472
|
warn: 3,
|
|
7307
7473
|
error: 4,
|
|
7308
7474
|
none: 5
|
|
7309
|
-
}[e.logLevel] ||
|
|
7475
|
+
}[e.logLevel] || 3
|
|
7310
7476
|
});
|
|
7311
7477
|
const i = typeof t == "string" ? document.querySelector(t) : t;
|
|
7312
7478
|
if (!i)
|
|
@@ -7653,12 +7819,12 @@ class si {
|
|
|
7653
7819
|
return this.context.store.getDataManager().deleteTaskById(t);
|
|
7654
7820
|
}
|
|
7655
7821
|
}
|
|
7656
|
-
|
|
7657
|
-
const
|
|
7822
|
+
Vt();
|
|
7823
|
+
const oi = Ct;
|
|
7658
7824
|
export {
|
|
7659
|
-
|
|
7825
|
+
ni as XGantt,
|
|
7660
7826
|
B as colorjs,
|
|
7661
|
-
|
|
7827
|
+
hi as dayjs,
|
|
7662
7828
|
Q as generateId,
|
|
7663
|
-
|
|
7829
|
+
oi as version
|
|
7664
7830
|
};
|