@xpyjs/gantt-core 0.0.1-alpha.5 → 0.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/x-gantt.js +1447 -1230
- package/dist/x-gantt.umd.cjs +3 -3
- package/package.json +1 -1
- package/types/rendering/chart/ChartFlag.d.ts +36 -0
- package/types/rendering/chart/ChartToday.d.ts +1 -0
- package/types/rendering/chart/index.d.ts +1 -0
- package/types/store/TimeAxis.d.ts +0 -2
- package/types/types/options.d.ts +101 -0
package/dist/x-gantt.js
CHANGED
|
@@ -2,10 +2,10 @@ var Bt = Object.defineProperty;
|
|
|
2
2
|
var zt = (f, t, e) => t in f ? Bt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
3
|
var a = (f, t, e) => zt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import H from "dayjs";
|
|
5
|
-
import { default as
|
|
6
|
-
import { merge as ot, isArray as
|
|
7
|
-
import
|
|
8
|
-
const St = "0.0.1-
|
|
5
|
+
import { default as ni } from "dayjs";
|
|
6
|
+
import { merge as ot, isArray as U, isString as X, isFunction as j, cloneDeep as J, isObject as Tt, isNumber as Pt, omit as gt, throttle as ft, isBoolean as pt, debounce as Yt } from "lodash-es";
|
|
7
|
+
import y from "konva";
|
|
8
|
+
const St = "0.0.1-beta.0";
|
|
9
9
|
function Nt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
@@ -24,20 +24,20 @@ function Nt() {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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 z = class z {
|
|
|
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(`[${H().format("YYYY-MM-DD HH:mm:ss.SSS")}]`), [e.join(""), ...t];
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
a(
|
|
120
|
+
a(P, "Prefix", "[XGantt]"), a(P, "options", {
|
|
121
121
|
// 默认级别,INFO 及以上会被打印
|
|
122
122
|
level: 2,
|
|
123
123
|
// 默认不显示时间戳
|
|
124
124
|
showTimestamp: !1
|
|
125
125
|
});
|
|
126
|
-
let
|
|
126
|
+
let D = P;
|
|
127
127
|
const at = () => ({
|
|
128
128
|
data: [],
|
|
129
129
|
links: {
|
|
@@ -323,8 +323,28 @@ class Ut {
|
|
|
323
323
|
return this.options;
|
|
324
324
|
}
|
|
325
325
|
setOptions(t, e = { merge: !0 }) {
|
|
326
|
-
var i;
|
|
327
|
-
this.options = e.merge ? ot(at(), this.options, t) : ot(at(), t),
|
|
326
|
+
var i, s;
|
|
327
|
+
if (this.options = e.merge ? ot(at(), this.options, t) : ot(at(), t), U((i = t.links) == null ? void 0 : i.data) && (this.options.links.data = t.links.data), (s = t.holiday) != null && s.holidays && t.holiday.holidays.length > 0) {
|
|
328
|
+
const n = [];
|
|
329
|
+
t.holiday.holidays.forEach((o) => {
|
|
330
|
+
if (U(o.date)) {
|
|
331
|
+
const r = o.date.map((h) => H(h)).sort((h, l) => h.diff(l));
|
|
332
|
+
for (let h = 1; h < r.length; h++)
|
|
333
|
+
if (r[h].diff(r[h - 1], "day") > 1) {
|
|
334
|
+
n.push({
|
|
335
|
+
...o,
|
|
336
|
+
date: r.slice(0, h).map((l) => l.valueOf())
|
|
337
|
+
}), r.splice(0, h);
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
r.length > 0 && n.push({
|
|
341
|
+
...o,
|
|
342
|
+
date: r.map((h) => h.valueOf())
|
|
343
|
+
});
|
|
344
|
+
} else
|
|
345
|
+
n.push(o);
|
|
346
|
+
}), this.options.holiday.holidays = n;
|
|
347
|
+
}
|
|
328
348
|
}
|
|
329
349
|
update(t) {
|
|
330
350
|
this.setOptions(t);
|
|
@@ -333,7 +353,7 @@ class Ut {
|
|
|
333
353
|
var s;
|
|
334
354
|
let e = "";
|
|
335
355
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
336
|
-
return
|
|
356
|
+
return X(i) ? e = i : U(i) && i.length > 0 ? e = i[t.level] : j(i) && (e = i(t.getEmitData())), e;
|
|
337
357
|
}
|
|
338
358
|
unpackFunc(t, e) {
|
|
339
359
|
return j(t) ? t(e.getEmitData()) : t;
|
|
@@ -380,7 +400,7 @@ class Xt {
|
|
|
380
400
|
this.events.clear();
|
|
381
401
|
}
|
|
382
402
|
}
|
|
383
|
-
var
|
|
403
|
+
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_MOVING = "slider-moving", f.SLIDER_HOVER = "slider-hover", f.SLIDER_LEAVE = "slider-leave", 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_MOUSEOVER = "baseline-mouseover", f.BASELINE_MOUSEOUT = "baseline-mouseout", f.ERROR = "error", f))(S || {}), q = /* @__PURE__ */ ((f) => (f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f))(q || {});
|
|
384
404
|
function Z() {
|
|
385
405
|
return Math.random().toString(36).substring(2, 15);
|
|
386
406
|
}
|
|
@@ -447,7 +467,7 @@ class dt {
|
|
|
447
467
|
this.store = t, this.event = e, this.fields = this.store.getOptionManager().getOptions().fields, this.id = n || i[this.fields.id] || Z(), 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);
|
|
448
468
|
}
|
|
449
469
|
getField(t) {
|
|
450
|
-
if (!t ||
|
|
470
|
+
if (!t || X(t) && t.trim() === "")
|
|
451
471
|
return;
|
|
452
472
|
if (!t.includes("."))
|
|
453
473
|
return this.data[t];
|
|
@@ -466,13 +486,13 @@ class dt {
|
|
|
466
486
|
this.data[this.fields.startTime] && (this.startTime = H(this.data[this.fields.startTime])), this.data[this.fields.endTime] && (this.endTime = H(this.data[this.fields.endTime])), this.startTime && this.endTime && (this.duration = this.endTime.diff(this.startTime)), this.isMilestone() && (this.endTime = this.startTime);
|
|
467
487
|
}
|
|
468
488
|
updateData(t) {
|
|
469
|
-
this.data = t, t[this.fields.name] && (this.name = t[this.fields.name]), t[this.fields.type] && (this.type = t[this.fields.type]), this.updateMode(), t[this.fields.progress] !== void 0 && (this.progress = t[this.fields.progress]), this.event.emit(
|
|
489
|
+
this.data = t, t[this.fields.name] && (this.name = t[this.fields.name]), t[this.fields.type] && (this.type = t[this.fields.type]), this.updateMode(), t[this.fields.progress] !== void 0 && (this.progress = t[this.fields.progress]), this.event.emit(S.UPDATE_TASK, this);
|
|
470
490
|
}
|
|
471
491
|
updateTime(t, e) {
|
|
472
492
|
var s, n;
|
|
473
493
|
this.startTime = t, this.endTime = this.isMilestone() ? t : e;
|
|
474
494
|
const i = (n = (s = this.store) == null ? void 0 : s.getOptionManager().getOptions()) == null ? void 0 : n.dateFormat;
|
|
475
|
-
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(
|
|
495
|
+
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);
|
|
476
496
|
}
|
|
477
497
|
clone() {
|
|
478
498
|
return new dt(
|
|
@@ -493,7 +513,7 @@ class dt {
|
|
|
493
513
|
getAllChildren() {
|
|
494
514
|
const t = [], e = (i) => {
|
|
495
515
|
i.forEach((s) => {
|
|
496
|
-
t.push(s),
|
|
516
|
+
t.push(s), U(s.children) && s.children.length > 0 && e(s.children);
|
|
497
517
|
});
|
|
498
518
|
};
|
|
499
519
|
return e(this.children), t;
|
|
@@ -547,7 +567,7 @@ class Vt {
|
|
|
547
567
|
if (!this.validate()) return null;
|
|
548
568
|
const t = this.store.getDataManager().getTaskById(this.taskId);
|
|
549
569
|
if (!t || !t.startTime || !t.endTime) return null;
|
|
550
|
-
const e = this.store.getTimeAxis().getCellUnit(), i = this.startTime.diff(t.startTime, e, !0), s = this.endTime.diff(t.endTime, e, !0), n = this.store.getOptionManager().getOptions().baselines.compare.tolerance, o = i < -n ? "delayed" : i > n ? "ahead" : "ontime", r = s < -n ? "delayed" : s > n ? "ahead" : "ontime",
|
|
570
|
+
const e = this.store.getTimeAxis().getCellUnit(), i = this.startTime.diff(t.startTime, e, !0), s = this.endTime.diff(t.endTime, e, !0), n = this.store.getOptionManager().getOptions().baselines.compare.tolerance, o = i < -n ? "delayed" : i > n ? "ahead" : "ontime", r = s < -n ? "delayed" : s > n ? "ahead" : "ontime", h = this.endTime.diff(this.startTime, e, !0), l = t.endTime.diff(t.startTime, e, !0), g = h > 0 ? (l - h) / h * 100 : 0;
|
|
551
571
|
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: g, unit: e };
|
|
552
572
|
}
|
|
553
573
|
}
|
|
@@ -592,13 +612,13 @@ class Kt {
|
|
|
592
612
|
* 设置源数据并初始化任务
|
|
593
613
|
*/
|
|
594
614
|
setData(t, e = !1) {
|
|
595
|
-
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(
|
|
615
|
+
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(S.DATA_UPDATE);
|
|
596
616
|
}
|
|
597
617
|
/**
|
|
598
618
|
* 初始化任务
|
|
599
619
|
*/
|
|
600
620
|
initTasks(t = !1) {
|
|
601
|
-
this.dataLevel = 0,
|
|
621
|
+
t ? (this.dataLevel = 0, this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear(), this.rawData.forEach((e) => {
|
|
602
622
|
this.tasks.push(this.createTask(e));
|
|
603
623
|
})) : this.rawData.length > 0 ? this.updateTask(this.rawData, this.tasks) : (this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear());
|
|
604
624
|
}
|
|
@@ -621,10 +641,10 @@ class Kt {
|
|
|
621
641
|
if (o && o.children)
|
|
622
642
|
this.updateTask(r, o.children, o);
|
|
623
643
|
else {
|
|
624
|
-
const
|
|
625
|
-
(
|
|
644
|
+
const h = r.map(
|
|
645
|
+
(l) => this.createTask(l, e[s])
|
|
626
646
|
);
|
|
627
|
-
e[s].children =
|
|
647
|
+
e[s].children = h;
|
|
628
648
|
}
|
|
629
649
|
} else o && o.children && (o.children = []);
|
|
630
650
|
s++;
|
|
@@ -712,7 +732,7 @@ class Kt {
|
|
|
712
732
|
const i = this.getTaskById(t);
|
|
713
733
|
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) => {
|
|
714
734
|
this.expandTask(s.id, e);
|
|
715
|
-
}), this.invalidateCache(), this.event.emit(
|
|
735
|
+
}), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE), !0) : !1;
|
|
716
736
|
}
|
|
717
737
|
/**
|
|
718
738
|
* 按条件筛选任务
|
|
@@ -770,7 +790,7 @@ class Kt {
|
|
|
770
790
|
* 清空所有数据
|
|
771
791
|
*/
|
|
772
792
|
clear() {
|
|
773
|
-
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(
|
|
793
|
+
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(S.DATA_UPDATE);
|
|
774
794
|
}
|
|
775
795
|
/**
|
|
776
796
|
* 更新子任务的层级
|
|
@@ -798,7 +818,7 @@ class Kt {
|
|
|
798
818
|
*/
|
|
799
819
|
selectTask(t) {
|
|
800
820
|
const e = this.getTaskById(t);
|
|
801
|
-
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(
|
|
821
|
+
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(S.TASK_SELECTED, e)), !0) : !1;
|
|
802
822
|
}
|
|
803
823
|
/**
|
|
804
824
|
* 取消任务选择
|
|
@@ -806,7 +826,7 @@ class Kt {
|
|
|
806
826
|
unselectTask() {
|
|
807
827
|
if (this.selectedTaskId) {
|
|
808
828
|
const t = this.selectedTaskId;
|
|
809
|
-
this.selectedTaskId = null, this.event.emit(
|
|
829
|
+
this.selectedTaskId = null, this.event.emit(S.TASK_UNSELECTED, t);
|
|
810
830
|
}
|
|
811
831
|
}
|
|
812
832
|
/**
|
|
@@ -839,24 +859,24 @@ class Kt {
|
|
|
839
859
|
}
|
|
840
860
|
updateTaskTime(t, e, i, s, n = []) {
|
|
841
861
|
let o = e, r = i;
|
|
842
|
-
const
|
|
843
|
-
let
|
|
844
|
-
for (;
|
|
845
|
-
if (
|
|
846
|
-
let
|
|
847
|
-
(!
|
|
848
|
-
} else
|
|
849
|
-
|
|
862
|
+
const h = this.store.getOptionManager().getOptions().bar.move.link.child, l = this.store.getOptionManager().getOptions().bar.move.link.parent, g = this.store.getTimeAxis().getCellUnit();
|
|
863
|
+
let c = t.parent;
|
|
864
|
+
for (; l !== "none" && c; ) {
|
|
865
|
+
if (l === "expand") {
|
|
866
|
+
let p = c.startTime || o, m = c.endTime || r;
|
|
867
|
+
(!c.startTime || o.isBefore(c.startTime)) && (p = o), (!c.endTime || r.isAfter(c.endTime)) && (m = r), (c.startTime === void 0 || c.endTime === void 0 || !p.isSame(c.startTime) || !m.isSame(c.endTime)) && (n.findIndex((d) => d.id === c.id) === -1 && n.push(c.clone()), c.updateTime(p, m));
|
|
868
|
+
} else l === "strict" && (c.startTime && o.isBefore(c.startTime) && (o = c.startTime, r.isSameOrBefore(o) && (r = o.add(1, g))), c.endTime && r.isAfter(c.endTime) && (r = c.endTime, o.isAfter(r) && (o = r.subtract(1, g))));
|
|
869
|
+
c = c.parent;
|
|
850
870
|
}
|
|
851
|
-
let
|
|
852
|
-
for (;
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
let
|
|
856
|
-
|
|
857
|
-
}),
|
|
871
|
+
let u = t.children || [];
|
|
872
|
+
for (; h !== "none" && u.length > 0; ) {
|
|
873
|
+
const p = [];
|
|
874
|
+
u.forEach((m) => {
|
|
875
|
+
let d = m.startTime || o, x = m.endTime || r, w = o.diff(t.startTime), T = r.diff(t.endTime);
|
|
876
|
+
h === "scale" ? s === "both" ? (n.findIndex((v) => v.id === m.id) === -1 && n.push(m.clone()), m.updateTime(d.add(w), x.add(T))) : s === "left" ? (d = d.add(w), d.isSameOrAfter(x.subtract(1, g)) && (x.isBefore(t.endTime) ? x = d.add(1, g) : d = x.subtract(1, g), d.isSameOrBefore(o) && (o = d)), n.findIndex((v) => v.id === m.id) === -1 && n.push(m.clone()), m.updateTime(d, x)) : s === "right" && (x = x.add(T), x.isSameOrBefore(d.add(1, g)) && (d.isAfter(t.startTime) ? d = x.subtract(1, g) : x = d.add(1, g)), x.isSameOrAfter(r) && (r = x), n.findIndex((v) => v.id === m.id) === -1 && n.push(m.clone()), m.updateTime(d, x)) : h === "fixed" && (s === "both" ? (n.findIndex((v) => v.id === m.id) === -1 && n.push(m.clone()), m.updateTime(d.add(w), x.add(T))) : s === "left" ? d.isSameOrBefore(o) && (d = o, d.isSameOrAfter(x.subtract(1, g)) && (x.isBefore(t.endTime) ? x = d.add(1, g) : d = x.subtract(1, g), d.isSameOrBefore(o) && (o = d)), n.findIndex((v) => v.id === m.id) === -1 && n.push(m.clone()), m.updateTime(d, x)) : s === "right" && x.isSameOrAfter(r) && (x = r, x.isSameOrBefore(d.add(1, g)) && (d.isAfter(t.startTime) ? d = x.subtract(1, g) : x = d.add(1, g)), x.isSameOrAfter(r) && (r = x), n.findIndex((v) => v.id === m.id) === -1 && n.push(m.clone()), m.updateTime(d, x))), m.children && m.children.length > 0 && p.push(...m.children);
|
|
877
|
+
}), u = p;
|
|
858
878
|
}
|
|
859
|
-
n.findIndex((
|
|
879
|
+
n.findIndex((p) => p.id === t.id) === -1 && n.push(t.clone()), t.updateTime(o, r);
|
|
860
880
|
}
|
|
861
881
|
//** 基线数据操作 */
|
|
862
882
|
setBaselines(t) {
|
|
@@ -878,7 +898,7 @@ class Kt {
|
|
|
878
898
|
return this.baselineTaskMap.get(t) || [];
|
|
879
899
|
}
|
|
880
900
|
}
|
|
881
|
-
function
|
|
901
|
+
function R(f, t, e) {
|
|
882
902
|
if (!Number.isFinite(f) || !Number.isFinite(t) || !Number.isFinite(e))
|
|
883
903
|
return Number.isFinite(t) ? t : 0;
|
|
884
904
|
const i = Math.min(t, e), s = Math.max(t, e);
|
|
@@ -886,9 +906,9 @@ function G(f, t, e) {
|
|
|
886
906
|
}
|
|
887
907
|
function st(f, t) {
|
|
888
908
|
let e = f;
|
|
889
|
-
return
|
|
909
|
+
return X(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
890
910
|
}
|
|
891
|
-
function
|
|
911
|
+
function mt(f, t) {
|
|
892
912
|
if (t === 0)
|
|
893
913
|
throw new Error("基准值不能为0");
|
|
894
914
|
if (Math.abs(f) <= t / 2)
|
|
@@ -918,10 +938,10 @@ function xt(f, t = 16, e = 16) {
|
|
|
918
938
|
return new Promise((i, s) => {
|
|
919
939
|
let n = f;
|
|
920
940
|
if (!/viewBox\s*=\s*["'][^"']*["']/.test(n)) {
|
|
921
|
-
const g = n.match(/width\s*=\s*["']([^"']*)["']/),
|
|
941
|
+
const g = n.match(/width\s*=\s*["']([^"']*)["']/), c = n.match(/height\s*=\s*["']([^"']*)["']/), u = g ? parseFloat(g[1]) : t, p = c ? parseFloat(c[1]) : e;
|
|
922
942
|
n = n.replace(
|
|
923
943
|
/<svg([^>]*)>/,
|
|
924
|
-
`<svg$1 viewBox="0 0 ${
|
|
944
|
+
`<svg$1 viewBox="0 0 ${u} ${p}">`
|
|
925
945
|
);
|
|
926
946
|
}
|
|
927
947
|
n = n.replace(/width\s*=\s*["'][^"']*["']/, `width="${t}"`), n = n.replace(/height\s*=\s*["'][^"']*["']/, `height="${e}"`), /width\s*=/.test(n) || (n = n.replace(/<svg/, `<svg width="${t}"`)), /height\s*=/.test(n) || (n = n.replace(/<svg/, `<svg height="${e}"`)), /preserveAspectRatio\s*=/.test(n) || (n = n.replace(
|
|
@@ -934,65 +954,65 @@ function xt(f, t = 16, e = 16) {
|
|
|
934
954
|
}, r.onerror = (g) => {
|
|
935
955
|
URL.revokeObjectURL(r.src), s(g);
|
|
936
956
|
};
|
|
937
|
-
const
|
|
938
|
-
r.src =
|
|
957
|
+
const h = new Blob([n], { type: "image/svg+xml" }), l = URL.createObjectURL(h);
|
|
958
|
+
r.src = l;
|
|
939
959
|
});
|
|
940
960
|
}
|
|
941
961
|
function qt(f) {
|
|
942
962
|
var s;
|
|
943
963
|
if (typeof f == "object" && f !== null)
|
|
944
964
|
return {
|
|
945
|
-
r:
|
|
946
|
-
g:
|
|
947
|
-
b:
|
|
948
|
-
a:
|
|
965
|
+
r: R(f.r ?? 0, 0, 255),
|
|
966
|
+
g: R(f.g ?? 0, 0, 255),
|
|
967
|
+
b: R(f.b ?? 0, 0, 255),
|
|
968
|
+
a: R(f.a ?? 1, 0, 1)
|
|
949
969
|
};
|
|
950
970
|
if (typeof f != "string")
|
|
951
|
-
return
|
|
971
|
+
return D.warn(`Invalid color value type: ${typeof f}`), null;
|
|
952
972
|
let t = f.trim();
|
|
953
973
|
const e = (s = document == null ? void 0 : document.createElement("canvas")) == null ? void 0 : s.getContext("2d");
|
|
954
974
|
if (e && (e.fillStyle = t, t = e.fillStyle), t.startsWith("#")) {
|
|
955
975
|
const n = t.slice(1);
|
|
956
|
-
let o, r,
|
|
976
|
+
let o, r, h, l, g = 1;
|
|
957
977
|
try {
|
|
958
978
|
o = parseInt(n, 16);
|
|
959
979
|
} catch {
|
|
960
|
-
return
|
|
980
|
+
return D.warn(`Invalid hex color: ${f}`), null;
|
|
961
981
|
}
|
|
962
982
|
if (n.length === 3)
|
|
963
|
-
r = (o >> 8 & 15) * 17,
|
|
983
|
+
r = (o >> 8 & 15) * 17, h = (o >> 4 & 15) * 17, l = (o & 15) * 17;
|
|
964
984
|
else if (n.length === 6)
|
|
965
|
-
r = o >> 16 & 255,
|
|
985
|
+
r = o >> 16 & 255, h = o >> 8 & 255, l = o & 255;
|
|
966
986
|
else if (n.length === 8)
|
|
967
|
-
r = o >> 24 & 255,
|
|
987
|
+
r = o >> 24 & 255, h = o >> 16 & 255, l = o >> 8 & 255, g = (o & 255) / 255;
|
|
968
988
|
else
|
|
969
|
-
return
|
|
970
|
-
return { r, g:
|
|
989
|
+
return D.warn(`Invalid hex color length: ${f}`), null;
|
|
990
|
+
return { r, g: h, b: l, a: g };
|
|
971
991
|
}
|
|
972
992
|
let i = t.match(
|
|
973
993
|
/rgba?\(\s*(\d+%?)\s*,\s*(\d+%?)\s*,\s*(\d+%?)\s*(?:,\s*([\d.]+)\s*)?\)/i
|
|
974
994
|
);
|
|
975
995
|
if (i) {
|
|
976
|
-
const n = (o) => o.endsWith("%") ?
|
|
996
|
+
const n = (o) => o.endsWith("%") ? R(parseFloat(o) / 100 * 255, 0, 255) : R(parseInt(o, 10), 0, 255);
|
|
977
997
|
return {
|
|
978
998
|
r: n(i[1]),
|
|
979
999
|
g: n(i[2]),
|
|
980
1000
|
b: n(i[3]),
|
|
981
|
-
a: i[4] !== void 0 ?
|
|
1001
|
+
a: i[4] !== void 0 ? R(parseFloat(i[4]), 0, 1) : 1
|
|
982
1002
|
};
|
|
983
1003
|
}
|
|
984
|
-
return
|
|
1004
|
+
return D.warn(`Could not parse color: ${f}`), null;
|
|
985
1005
|
}
|
|
986
1006
|
function Qt(f, t, e, i, s = !1, n = !1) {
|
|
987
|
-
const o = (
|
|
988
|
-
const
|
|
989
|
-
return
|
|
990
|
-
}, r = o(f),
|
|
991
|
-
if (s && r[0] === r[1] &&
|
|
1007
|
+
const o = (u) => {
|
|
1008
|
+
const p = Math.round(R(u, 0, 255)).toString(16);
|
|
1009
|
+
return p.length === 1 ? "0" + p : p;
|
|
1010
|
+
}, r = o(f), h = o(t), l = o(e), g = o(i * 255);
|
|
1011
|
+
if (s && r[0] === r[1] && h[0] === h[1] && l[0] === l[1] && i === 1 && // Alpha 必须为 1 才能缩写
|
|
992
1012
|
!n)
|
|
993
|
-
return `#${r[0]}${
|
|
994
|
-
const
|
|
995
|
-
return n || i < 1 ? `${
|
|
1013
|
+
return `#${r[0]}${h[0]}${l[0]}`;
|
|
1014
|
+
const c = `#${r}${h}${l}`;
|
|
1015
|
+
return n || i < 1 ? `${c}${g}` : c;
|
|
996
1016
|
}
|
|
997
1017
|
class tt {
|
|
998
1018
|
/**
|
|
@@ -1008,7 +1028,7 @@ class tt {
|
|
|
1008
1028
|
a(this, "_b");
|
|
1009
1029
|
a(this, "_a");
|
|
1010
1030
|
const e = qt(t);
|
|
1011
|
-
e === null ? (
|
|
1031
|
+
e === null ? (D.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);
|
|
1012
1032
|
}
|
|
1013
1033
|
// --- Getters ---
|
|
1014
1034
|
/** 获取 Red 通道值 (0-255) */
|
|
@@ -1028,16 +1048,16 @@ class tt {
|
|
|
1028
1048
|
return this._a;
|
|
1029
1049
|
}
|
|
1030
1050
|
red(t) {
|
|
1031
|
-
return t === void 0 ? this._r : (this._r = Math.round(
|
|
1051
|
+
return t === void 0 ? this._r : (this._r = Math.round(R(t, 0, 255)), this);
|
|
1032
1052
|
}
|
|
1033
1053
|
green(t) {
|
|
1034
|
-
return t === void 0 ? this._g : (this._g = Math.round(
|
|
1054
|
+
return t === void 0 ? this._g : (this._g = Math.round(R(t, 0, 255)), this);
|
|
1035
1055
|
}
|
|
1036
1056
|
blue(t) {
|
|
1037
|
-
return t === void 0 ? this._b : (this._b = Math.round(
|
|
1057
|
+
return t === void 0 ? this._b : (this._b = Math.round(R(t, 0, 255)), this);
|
|
1038
1058
|
}
|
|
1039
1059
|
alpha(t) {
|
|
1040
|
-
return t === void 0 ? this._a : (this._a =
|
|
1060
|
+
return t === void 0 ? this._a : (this._a = R(t, 0, 1), this);
|
|
1041
1061
|
}
|
|
1042
1062
|
// --- 输出方法 ---
|
|
1043
1063
|
/**
|
|
@@ -1091,8 +1111,8 @@ class tt {
|
|
|
1091
1111
|
*/
|
|
1092
1112
|
brighten(t = 10) {
|
|
1093
1113
|
if (t < 0) return this.darken(-t);
|
|
1094
|
-
const e =
|
|
1095
|
-
return this._r = Math.round(
|
|
1114
|
+
const e = R(t, 0, 100) / 100;
|
|
1115
|
+
return this._r = Math.round(R(this._r + (255 - this._r) * e, 0, 255)), this._g = Math.round(R(this._g + (255 - this._g) * e, 0, 255)), this._b = Math.round(R(this._b + (255 - this._b) * e, 0, 255)), this;
|
|
1096
1116
|
}
|
|
1097
1117
|
/**
|
|
1098
1118
|
* 降低颜色亮度 (变暗)。
|
|
@@ -1101,8 +1121,8 @@ class tt {
|
|
|
1101
1121
|
*/
|
|
1102
1122
|
darken(t = 10) {
|
|
1103
1123
|
if (t < 0) return this.brighten(-t);
|
|
1104
|
-
const e =
|
|
1105
|
-
return this._r = Math.round(
|
|
1124
|
+
const e = R(t, 0, 100) / 100;
|
|
1125
|
+
return this._r = Math.round(R(this._r * (1 - e), 0, 255)), this._g = Math.round(R(this._g * (1 - e), 0, 255)), this._b = Math.round(R(this._b * (1 - e), 0, 255)), this;
|
|
1106
1126
|
}
|
|
1107
1127
|
/**
|
|
1108
1128
|
* 判断颜色是否偏亮。
|
|
@@ -1126,14 +1146,14 @@ class tt {
|
|
|
1126
1146
|
* @returns 当前 Colorjs 实例。
|
|
1127
1147
|
*/
|
|
1128
1148
|
mix(t, e = 50) {
|
|
1129
|
-
const i =
|
|
1149
|
+
const i = R(e, 0, 100) / 100, s = F(t);
|
|
1130
1150
|
return this._r = Math.round(
|
|
1131
|
-
|
|
1151
|
+
R(this._r * (1 - i) + s.R * i, 0, 255)
|
|
1132
1152
|
), this._g = Math.round(
|
|
1133
|
-
|
|
1153
|
+
R(this._g * (1 - i) + s.G * i, 0, 255)
|
|
1134
1154
|
), this._b = Math.round(
|
|
1135
|
-
|
|
1136
|
-
), this._a =
|
|
1155
|
+
R(this._b * (1 - i) + s.B * i, 0, 255)
|
|
1156
|
+
), this._a = R(this._a * (1 - i) + s.A * i, 0, 1), this;
|
|
1137
1157
|
}
|
|
1138
1158
|
/**
|
|
1139
1159
|
* 创建当前颜色对象的副本。
|
|
@@ -1154,13 +1174,13 @@ class tt {
|
|
|
1154
1174
|
* @param option - 传递给插件的选项 (可选)。
|
|
1155
1175
|
*/
|
|
1156
1176
|
static extend(t, e) {
|
|
1157
|
-
typeof t == "function" ? t(e, tt, F) :
|
|
1177
|
+
typeof t == "function" ? t(e, tt, F) : D.warn(
|
|
1158
1178
|
"Invalid plugin provided to Colorjs.extend. Expected a function."
|
|
1159
1179
|
);
|
|
1160
1180
|
}
|
|
1161
1181
|
}
|
|
1162
1182
|
const F = (f) => f instanceof tt ? f : new tt(f);
|
|
1163
|
-
class
|
|
1183
|
+
class kt {
|
|
1164
1184
|
constructor(t, e, i) {
|
|
1165
1185
|
a(this, "element");
|
|
1166
1186
|
a(this, "iconElement");
|
|
@@ -1237,14 +1257,14 @@ class Et {
|
|
|
1237
1257
|
)) : (this.context.store.getDataManager().updateCheckedList(!0, this.task), this.setState(
|
|
1238
1258
|
1
|
|
1239
1259
|
/* CHECKED */
|
|
1240
|
-
)), this.context.event.emit(
|
|
1260
|
+
)), this.context.event.emit(S.CHECK_TASK, [this.task], !e);
|
|
1241
1261
|
} else {
|
|
1242
1262
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1243
1263
|
this.setState(
|
|
1244
1264
|
e ? 1 : 0
|
|
1245
1265
|
/* UNCHECKED */
|
|
1246
1266
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1247
|
-
|
|
1267
|
+
S.CHECK_TASK,
|
|
1248
1268
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1249
1269
|
!e
|
|
1250
1270
|
);
|
|
@@ -1267,14 +1287,14 @@ class Et {
|
|
|
1267
1287
|
}), this.setState(
|
|
1268
1288
|
1
|
|
1269
1289
|
/* CHECKED */
|
|
1270
|
-
)), this.context.event.emit(
|
|
1290
|
+
)), this.context.event.emit(S.CHECK_TASK, e, !i);
|
|
1271
1291
|
} else {
|
|
1272
1292
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1273
1293
|
this.setState(
|
|
1274
1294
|
e ? 1 : 0
|
|
1275
1295
|
/* UNCHECKED */
|
|
1276
1296
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1277
|
-
|
|
1297
|
+
S.CHECK_TASK,
|
|
1278
1298
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1279
1299
|
!e
|
|
1280
1300
|
);
|
|
@@ -1282,7 +1302,7 @@ class Et {
|
|
|
1282
1302
|
});
|
|
1283
1303
|
}
|
|
1284
1304
|
registerEvents() {
|
|
1285
|
-
this.context.event.on(
|
|
1305
|
+
this.context.event.on(S.CHECK_TASK, this.updateState.bind(this));
|
|
1286
1306
|
}
|
|
1287
1307
|
/** 获取元素 */
|
|
1288
1308
|
getElement() {
|
|
@@ -1353,35 +1373,35 @@ class Jt {
|
|
|
1353
1373
|
*/
|
|
1354
1374
|
processColumns(t, e = [], i, s = 1) {
|
|
1355
1375
|
t.forEach((n, o) => {
|
|
1356
|
-
var
|
|
1357
|
-
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0,
|
|
1358
|
-
let
|
|
1359
|
-
r ?
|
|
1360
|
-
const g = [...(i == null ? void 0 : i.path) || [],
|
|
1361
|
-
|
|
1362
|
-
const
|
|
1363
|
-
label:
|
|
1376
|
+
var m;
|
|
1377
|
+
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0, h = !r;
|
|
1378
|
+
let l = "";
|
|
1379
|
+
r ? l = `group-${o}` : l = `field-${n.field}`;
|
|
1380
|
+
const g = [...(i == null ? void 0 : i.path) || [], l];
|
|
1381
|
+
l = "column-" + o + "-" + g.join("-");
|
|
1382
|
+
const c = n.label || (h ? n.field : ""), u = h ? ((m = this.temporaryLeafColumns.find((d) => d.key === l)) == null ? void 0 : m.width) || n.width || 100 : "auto", p = {
|
|
1383
|
+
label: c,
|
|
1364
1384
|
level: s,
|
|
1365
1385
|
maxLevel: s,
|
|
1366
1386
|
column: n,
|
|
1367
1387
|
children: [],
|
|
1368
1388
|
path: g,
|
|
1369
|
-
key:
|
|
1370
|
-
isLeaf:
|
|
1371
|
-
width:
|
|
1389
|
+
key: l,
|
|
1390
|
+
isLeaf: h,
|
|
1391
|
+
width: u
|
|
1372
1392
|
};
|
|
1373
|
-
if (e.push(
|
|
1374
|
-
this.leafColumns.push(
|
|
1393
|
+
if (e.push(p), h)
|
|
1394
|
+
this.leafColumns.push(p);
|
|
1375
1395
|
else if (r) {
|
|
1376
|
-
const
|
|
1396
|
+
const d = n.children;
|
|
1377
1397
|
this.processColumns(
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1398
|
+
d,
|
|
1399
|
+
p.children,
|
|
1400
|
+
p,
|
|
1381
1401
|
s + 1
|
|
1382
|
-
),
|
|
1383
|
-
|
|
1384
|
-
|
|
1402
|
+
), p.maxLevel = Math.max(
|
|
1403
|
+
p.maxLevel,
|
|
1404
|
+
p.children.reduce((x, w) => Math.max(x, w.maxLevel), 0)
|
|
1385
1405
|
);
|
|
1386
1406
|
}
|
|
1387
1407
|
}), this.temporaryLeafColumns = J(this.leafColumns);
|
|
@@ -1414,7 +1434,7 @@ class Jt {
|
|
|
1414
1434
|
}
|
|
1415
1435
|
setColumnWidth(t, e) {
|
|
1416
1436
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1417
|
-
i && (i.width = e), this.context.event.emit(
|
|
1437
|
+
i && (i.width = e), this.context.event.emit(S.COLUMN_WIDTH_CHANGE, t, e);
|
|
1418
1438
|
}
|
|
1419
1439
|
isLastColumn(t) {
|
|
1420
1440
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1443,7 +1463,7 @@ class Jt {
|
|
|
1443
1463
|
customStyle: {
|
|
1444
1464
|
paddingLeft: this.context.store.getOptionManager().getOptions().expand.show ? "8px" : 0
|
|
1445
1465
|
},
|
|
1446
|
-
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new
|
|
1466
|
+
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new kt(this.context).getElement() : null,
|
|
1447
1467
|
ellipsis: !1
|
|
1448
1468
|
},
|
|
1449
1469
|
children: [],
|
|
@@ -1457,7 +1477,7 @@ class Jt {
|
|
|
1457
1477
|
return this.columns.some((t) => t.maxLevel > 1);
|
|
1458
1478
|
}
|
|
1459
1479
|
collapse() {
|
|
1460
|
-
this.collapseTable = !this.collapseTable, this.context.event.emit(
|
|
1480
|
+
this.collapseTable = !this.collapseTable, this.context.event.emit(S.TOGGLE_COLLAPSE);
|
|
1461
1481
|
}
|
|
1462
1482
|
isCollapsed() {
|
|
1463
1483
|
return this.collapseTable;
|
|
@@ -1467,137 +1487,137 @@ var Y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : ty
|
|
|
1467
1487
|
function N(f) {
|
|
1468
1488
|
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
1469
1489
|
}
|
|
1470
|
-
var
|
|
1490
|
+
var Et = { exports: {} };
|
|
1471
1491
|
(function(f, t) {
|
|
1472
1492
|
(function(e, i) {
|
|
1473
1493
|
f.exports = i();
|
|
1474
1494
|
})(Y, function() {
|
|
1475
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5,
|
|
1476
|
-
return
|
|
1477
|
-
},
|
|
1478
|
-
return new
|
|
1479
|
-
},
|
|
1480
|
-
return i.p(
|
|
1481
|
-
}, x = function(
|
|
1482
|
-
return
|
|
1483
|
-
}, w = function(
|
|
1484
|
-
return x(
|
|
1485
|
-
},
|
|
1486
|
-
return Math.abs(
|
|
1487
|
-
},
|
|
1488
|
-
return
|
|
1489
|
-
},
|
|
1490
|
-
function k
|
|
1495
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, h = /\[([^\]]+)]|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, l = 31536e6, g = 2628e6, c = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, u = { years: l, months: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, p = function(M) {
|
|
1496
|
+
return M instanceof b;
|
|
1497
|
+
}, m = function(M, E, k) {
|
|
1498
|
+
return new b(M, k, E.$l);
|
|
1499
|
+
}, d = function(M) {
|
|
1500
|
+
return i.p(M) + "s";
|
|
1501
|
+
}, x = function(M) {
|
|
1502
|
+
return M < 0;
|
|
1503
|
+
}, w = function(M) {
|
|
1504
|
+
return x(M) ? Math.ceil(M) : Math.floor(M);
|
|
1505
|
+
}, T = function(M) {
|
|
1506
|
+
return Math.abs(M);
|
|
1507
|
+
}, v = function(M, E) {
|
|
1508
|
+
return M ? x(M) ? { negative: !0, format: "" + T(M) + E } : { negative: !1, format: "" + M + E } : { negative: !1, format: "" };
|
|
1509
|
+
}, b = function() {
|
|
1510
|
+
function M(k, L, A) {
|
|
1491
1511
|
var _ = this;
|
|
1492
|
-
if (this.$d = {}, this.$l =
|
|
1493
|
-
if (typeof
|
|
1494
|
-
if (typeof
|
|
1495
|
-
_.$d[
|
|
1512
|
+
if (this.$d = {}, this.$l = A, k === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), L) return m(k * u[d(L)], this);
|
|
1513
|
+
if (typeof k == "number") return this.$ms = k, this.parseFromMilliseconds(), this;
|
|
1514
|
+
if (typeof k == "object") return Object.keys(k).forEach(function(B) {
|
|
1515
|
+
_.$d[d(B)] = k[B];
|
|
1496
1516
|
}), this.calMilliseconds(), this;
|
|
1497
|
-
if (typeof
|
|
1498
|
-
var
|
|
1499
|
-
if (
|
|
1500
|
-
var
|
|
1517
|
+
if (typeof k == "string") {
|
|
1518
|
+
var C = k.match(c);
|
|
1519
|
+
if (C) {
|
|
1520
|
+
var I = C.slice(2).map(function(B) {
|
|
1501
1521
|
return B != null ? Number(B) : 0;
|
|
1502
1522
|
});
|
|
1503
|
-
return this.$d.years =
|
|
1523
|
+
return this.$d.years = I[0], this.$d.months = I[1], this.$d.weeks = I[2], this.$d.days = I[3], this.$d.hours = I[4], this.$d.minutes = I[5], this.$d.seconds = I[6], this.calMilliseconds(), this;
|
|
1504
1524
|
}
|
|
1505
1525
|
}
|
|
1506
1526
|
return this;
|
|
1507
1527
|
}
|
|
1508
|
-
var
|
|
1509
|
-
return
|
|
1510
|
-
var
|
|
1511
|
-
this.$ms = Object.keys(this.$d).reduce(function(
|
|
1512
|
-
return
|
|
1528
|
+
var E = M.prototype;
|
|
1529
|
+
return E.calMilliseconds = function() {
|
|
1530
|
+
var k = this;
|
|
1531
|
+
this.$ms = Object.keys(this.$d).reduce(function(L, A) {
|
|
1532
|
+
return L + (k.$d[A] || 0) * u[A];
|
|
1513
1533
|
}, 0);
|
|
1514
|
-
},
|
|
1515
|
-
var
|
|
1516
|
-
this.$d.years = w(
|
|
1517
|
-
},
|
|
1518
|
-
var
|
|
1519
|
-
this.$d.weeks && (
|
|
1520
|
-
var _ =
|
|
1534
|
+
}, E.parseFromMilliseconds = function() {
|
|
1535
|
+
var k = this.$ms;
|
|
1536
|
+
this.$d.years = w(k / l), k %= l, this.$d.months = w(k / g), k %= g, this.$d.days = w(k / r), k %= r, this.$d.hours = w(k / o), k %= o, this.$d.minutes = w(k / n), k %= n, this.$d.seconds = w(k / s), k %= s, this.$d.milliseconds = k;
|
|
1537
|
+
}, E.toISOString = function() {
|
|
1538
|
+
var k = v(this.$d.years, "Y"), L = v(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
1539
|
+
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
1540
|
+
var _ = v(A, "D"), C = v(this.$d.hours, "H"), I = v(this.$d.minutes, "M"), B = this.$d.seconds || 0;
|
|
1521
1541
|
this.$d.milliseconds && (B += this.$d.milliseconds / 1e3, B = Math.round(1e3 * B) / 1e3);
|
|
1522
|
-
var $ =
|
|
1523
|
-
return
|
|
1524
|
-
},
|
|
1542
|
+
var $ = v(B, "S"), G = k.negative || L.negative || _.negative || C.negative || I.negative || $.negative, W = C.format || I.format || $.format ? "T" : "", z = (G ? "-" : "") + "P" + k.format + L.format + _.format + W + C.format + I.format + $.format;
|
|
1543
|
+
return z === "P" || z === "-P" ? "P0D" : z;
|
|
1544
|
+
}, E.toJSON = function() {
|
|
1525
1545
|
return this.toISOString();
|
|
1526
|
-
},
|
|
1527
|
-
var
|
|
1528
|
-
return
|
|
1529
|
-
return
|
|
1546
|
+
}, E.format = function(k) {
|
|
1547
|
+
var L = k || "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") };
|
|
1548
|
+
return L.replace(h, function(_, C) {
|
|
1549
|
+
return C || String(A[_]);
|
|
1530
1550
|
});
|
|
1531
|
-
},
|
|
1532
|
-
return this.$ms / d
|
|
1533
|
-
},
|
|
1534
|
-
var
|
|
1535
|
-
return
|
|
1536
|
-
},
|
|
1551
|
+
}, E.as = function(k) {
|
|
1552
|
+
return this.$ms / u[d(k)];
|
|
1553
|
+
}, E.get = function(k) {
|
|
1554
|
+
var L = this.$ms, A = d(k);
|
|
1555
|
+
return A === "milliseconds" ? L %= 1e3 : L = A === "weeks" ? w(L / u[A]) : this.$d[A], L || 0;
|
|
1556
|
+
}, E.add = function(k, L, A) {
|
|
1537
1557
|
var _;
|
|
1538
|
-
return _ =
|
|
1539
|
-
},
|
|
1540
|
-
return this.add(
|
|
1541
|
-
},
|
|
1542
|
-
var
|
|
1543
|
-
return
|
|
1544
|
-
},
|
|
1545
|
-
return
|
|
1546
|
-
},
|
|
1547
|
-
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!
|
|
1548
|
-
},
|
|
1558
|
+
return _ = L ? k * u[d(L)] : p(k) ? k.$ms : m(k, this).$ms, m(this.$ms + _ * (A ? -1 : 1), this);
|
|
1559
|
+
}, E.subtract = function(k, L) {
|
|
1560
|
+
return this.add(k, L, !0);
|
|
1561
|
+
}, E.locale = function(k) {
|
|
1562
|
+
var L = this.clone();
|
|
1563
|
+
return L.$l = k, L;
|
|
1564
|
+
}, E.clone = function() {
|
|
1565
|
+
return m(this.$ms, this);
|
|
1566
|
+
}, E.humanize = function(k) {
|
|
1567
|
+
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!k);
|
|
1568
|
+
}, E.valueOf = function() {
|
|
1549
1569
|
return this.asMilliseconds();
|
|
1550
|
-
},
|
|
1570
|
+
}, E.milliseconds = function() {
|
|
1551
1571
|
return this.get("milliseconds");
|
|
1552
|
-
},
|
|
1572
|
+
}, E.asMilliseconds = function() {
|
|
1553
1573
|
return this.as("milliseconds");
|
|
1554
|
-
},
|
|
1574
|
+
}, E.seconds = function() {
|
|
1555
1575
|
return this.get("seconds");
|
|
1556
|
-
},
|
|
1576
|
+
}, E.asSeconds = function() {
|
|
1557
1577
|
return this.as("seconds");
|
|
1558
|
-
},
|
|
1578
|
+
}, E.minutes = function() {
|
|
1559
1579
|
return this.get("minutes");
|
|
1560
|
-
},
|
|
1580
|
+
}, E.asMinutes = function() {
|
|
1561
1581
|
return this.as("minutes");
|
|
1562
|
-
},
|
|
1582
|
+
}, E.hours = function() {
|
|
1563
1583
|
return this.get("hours");
|
|
1564
|
-
},
|
|
1584
|
+
}, E.asHours = function() {
|
|
1565
1585
|
return this.as("hours");
|
|
1566
|
-
},
|
|
1586
|
+
}, E.days = function() {
|
|
1567
1587
|
return this.get("days");
|
|
1568
|
-
},
|
|
1588
|
+
}, E.asDays = function() {
|
|
1569
1589
|
return this.as("days");
|
|
1570
|
-
},
|
|
1590
|
+
}, E.weeks = function() {
|
|
1571
1591
|
return this.get("weeks");
|
|
1572
|
-
},
|
|
1592
|
+
}, E.asWeeks = function() {
|
|
1573
1593
|
return this.as("weeks");
|
|
1574
|
-
},
|
|
1594
|
+
}, E.months = function() {
|
|
1575
1595
|
return this.get("months");
|
|
1576
|
-
},
|
|
1596
|
+
}, E.asMonths = function() {
|
|
1577
1597
|
return this.as("months");
|
|
1578
|
-
},
|
|
1598
|
+
}, E.years = function() {
|
|
1579
1599
|
return this.get("years");
|
|
1580
|
-
},
|
|
1600
|
+
}, E.asYears = function() {
|
|
1581
1601
|
return this.as("years");
|
|
1582
|
-
},
|
|
1583
|
-
}(),
|
|
1584
|
-
return
|
|
1602
|
+
}, M;
|
|
1603
|
+
}(), O = function(M, E, k) {
|
|
1604
|
+
return M.add(E.years() * k, "y").add(E.months() * k, "M").add(E.days() * k, "d").add(E.hours() * k, "h").add(E.minutes() * k, "m").add(E.seconds() * k, "s").add(E.milliseconds() * k, "ms");
|
|
1585
1605
|
};
|
|
1586
|
-
return function(
|
|
1587
|
-
e =
|
|
1588
|
-
var
|
|
1589
|
-
return
|
|
1590
|
-
},
|
|
1591
|
-
var
|
|
1592
|
-
|
|
1593
|
-
return
|
|
1594
|
-
},
|
|
1595
|
-
return
|
|
1606
|
+
return function(M, E, k) {
|
|
1607
|
+
e = k, i = k().$utils(), k.duration = function(_, C) {
|
|
1608
|
+
var I = k.locale();
|
|
1609
|
+
return m(_, { $l: I }, C);
|
|
1610
|
+
}, k.isDuration = p;
|
|
1611
|
+
var L = E.prototype.add, A = E.prototype.subtract;
|
|
1612
|
+
E.prototype.add = function(_, C) {
|
|
1613
|
+
return p(_) ? O(this, _, 1) : L.bind(this)(_, C);
|
|
1614
|
+
}, E.prototype.subtract = function(_, C) {
|
|
1615
|
+
return p(_) ? O(this, _, -1) : A.bind(this)(_, C);
|
|
1596
1616
|
};
|
|
1597
1617
|
};
|
|
1598
1618
|
});
|
|
1599
|
-
})(
|
|
1600
|
-
var Zt =
|
|
1619
|
+
})(Et);
|
|
1620
|
+
var Zt = Et.exports;
|
|
1601
1621
|
const te = /* @__PURE__ */ N(Zt);
|
|
1602
1622
|
var Ot = { exports: {} };
|
|
1603
1623
|
(function(f, t) {
|
|
@@ -1605,9 +1625,9 @@ var Ot = { exports: {} };
|
|
|
1605
1625
|
f.exports = i();
|
|
1606
1626
|
})(Y, function() {
|
|
1607
1627
|
return function(e, i, s) {
|
|
1608
|
-
i.prototype.isBetween = function(n, o, r,
|
|
1609
|
-
var
|
|
1610
|
-
return (
|
|
1628
|
+
i.prototype.isBetween = function(n, o, r, h) {
|
|
1629
|
+
var l = s(n), g = s(o), c = (h = h || "()")[0] === "(", u = h[1] === ")";
|
|
1630
|
+
return (c ? this.isAfter(l, r) : !this.isBefore(l, r)) && (u ? this.isBefore(g, r) : !this.isAfter(g, r)) || (c ? this.isBefore(l, r) : !this.isAfter(l, r)) && (u ? this.isAfter(g, r) : !this.isBefore(g, r));
|
|
1611
1631
|
};
|
|
1612
1632
|
};
|
|
1613
1633
|
});
|
|
@@ -1648,49 +1668,49 @@ var Ct = { exports: {} };
|
|
|
1648
1668
|
f.exports = i();
|
|
1649
1669
|
})(Y, function() {
|
|
1650
1670
|
return function(e, i, s) {
|
|
1651
|
-
var n = i.prototype, o = function(
|
|
1652
|
-
return
|
|
1653
|
-
}, r = function(
|
|
1654
|
-
var x =
|
|
1655
|
-
return
|
|
1671
|
+
var n = i.prototype, o = function(c) {
|
|
1672
|
+
return c && (c.indexOf ? c : c.s);
|
|
1673
|
+
}, r = function(c, u, p, m, d) {
|
|
1674
|
+
var x = c.name ? c : c.$locale(), w = o(x[u]), T = o(x[p]), v = w || T.map(function(O) {
|
|
1675
|
+
return O.slice(0, m);
|
|
1656
1676
|
});
|
|
1657
|
-
if (!
|
|
1658
|
-
var
|
|
1659
|
-
return
|
|
1660
|
-
return
|
|
1677
|
+
if (!d) return v;
|
|
1678
|
+
var b = x.weekStart;
|
|
1679
|
+
return v.map(function(O, M) {
|
|
1680
|
+
return v[(M + (b || 0)) % 7];
|
|
1661
1681
|
});
|
|
1662
|
-
},
|
|
1682
|
+
}, h = function() {
|
|
1663
1683
|
return s.Ls[s.locale()];
|
|
1664
|
-
},
|
|
1665
|
-
return
|
|
1666
|
-
return
|
|
1667
|
-
return
|
|
1684
|
+
}, l = function(c, u) {
|
|
1685
|
+
return c.formats[u] || function(p) {
|
|
1686
|
+
return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(m, d, x) {
|
|
1687
|
+
return d || x.slice(1);
|
|
1668
1688
|
});
|
|
1669
|
-
}(
|
|
1689
|
+
}(c.formats[u.toUpperCase()]);
|
|
1670
1690
|
}, g = function() {
|
|
1671
|
-
var
|
|
1672
|
-
return { months: function(
|
|
1673
|
-
return
|
|
1674
|
-
}, monthsShort: function(
|
|
1675
|
-
return
|
|
1691
|
+
var c = this;
|
|
1692
|
+
return { months: function(u) {
|
|
1693
|
+
return u ? u.format("MMMM") : r(c, "months");
|
|
1694
|
+
}, monthsShort: function(u) {
|
|
1695
|
+
return u ? u.format("MMM") : r(c, "monthsShort", "months", 3);
|
|
1676
1696
|
}, firstDayOfWeek: function() {
|
|
1677
|
-
return
|
|
1678
|
-
}, weekdays: function(
|
|
1679
|
-
return
|
|
1680
|
-
}, weekdaysMin: function(
|
|
1681
|
-
return
|
|
1682
|
-
}, weekdaysShort: function(
|
|
1683
|
-
return
|
|
1684
|
-
}, longDateFormat: function(
|
|
1685
|
-
return c
|
|
1697
|
+
return c.$locale().weekStart || 0;
|
|
1698
|
+
}, weekdays: function(u) {
|
|
1699
|
+
return u ? u.format("dddd") : r(c, "weekdays");
|
|
1700
|
+
}, weekdaysMin: function(u) {
|
|
1701
|
+
return u ? u.format("dd") : r(c, "weekdaysMin", "weekdays", 2);
|
|
1702
|
+
}, weekdaysShort: function(u) {
|
|
1703
|
+
return u ? u.format("ddd") : r(c, "weekdaysShort", "weekdays", 3);
|
|
1704
|
+
}, longDateFormat: function(u) {
|
|
1705
|
+
return l(c.$locale(), u);
|
|
1686
1706
|
}, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
|
|
1687
1707
|
};
|
|
1688
1708
|
n.localeData = function() {
|
|
1689
1709
|
return g.bind(this)();
|
|
1690
1710
|
}, s.localeData = function() {
|
|
1691
|
-
var
|
|
1711
|
+
var c = h();
|
|
1692
1712
|
return { firstDayOfWeek: function() {
|
|
1693
|
-
return
|
|
1713
|
+
return c.weekStart || 0;
|
|
1694
1714
|
}, weekdays: function() {
|
|
1695
1715
|
return s.weekdays();
|
|
1696
1716
|
}, weekdaysShort: function() {
|
|
@@ -1701,19 +1721,19 @@ var Ct = { exports: {} };
|
|
|
1701
1721
|
return s.months();
|
|
1702
1722
|
}, monthsShort: function() {
|
|
1703
1723
|
return s.monthsShort();
|
|
1704
|
-
}, longDateFormat: function(
|
|
1705
|
-
return c
|
|
1706
|
-
}, meridiem:
|
|
1724
|
+
}, longDateFormat: function(u) {
|
|
1725
|
+
return l(c, u);
|
|
1726
|
+
}, meridiem: c.meridiem, ordinal: c.ordinal };
|
|
1707
1727
|
}, s.months = function() {
|
|
1708
|
-
return r(
|
|
1728
|
+
return r(h(), "months");
|
|
1709
1729
|
}, s.monthsShort = function() {
|
|
1710
|
-
return r(
|
|
1711
|
-
}, s.weekdays = function(
|
|
1712
|
-
return r(
|
|
1713
|
-
}, s.weekdaysShort = function(
|
|
1714
|
-
return r(
|
|
1715
|
-
}, s.weekdaysMin = function(
|
|
1716
|
-
return r(
|
|
1730
|
+
return r(h(), "monthsShort", "months", 3);
|
|
1731
|
+
}, s.weekdays = function(c) {
|
|
1732
|
+
return r(h(), "weekdays", null, null, c);
|
|
1733
|
+
}, s.weekdaysShort = function(c) {
|
|
1734
|
+
return r(h(), "weekdaysShort", "weekdays", 3, c);
|
|
1735
|
+
}, s.weekdaysMin = function(c) {
|
|
1736
|
+
return r(h(), "weekdaysMin", "weekdays", 2, c);
|
|
1717
1737
|
};
|
|
1718
1738
|
};
|
|
1719
1739
|
});
|
|
@@ -1728,17 +1748,17 @@ var Dt = { exports: {} };
|
|
|
1728
1748
|
var e = "week", i = "year";
|
|
1729
1749
|
return function(s, n, o) {
|
|
1730
1750
|
var r = n.prototype;
|
|
1731
|
-
r.week = function(
|
|
1732
|
-
if (
|
|
1733
|
-
var
|
|
1751
|
+
r.week = function(h) {
|
|
1752
|
+
if (h === void 0 && (h = null), h !== null) return this.add(7 * (h - this.week()), "day");
|
|
1753
|
+
var l = this.$locale().yearStart || 1;
|
|
1734
1754
|
if (this.month() === 11 && this.date() > 25) {
|
|
1735
|
-
var g = o(this).startOf(i).add(1, i).date(
|
|
1736
|
-
if (g.isBefore(
|
|
1755
|
+
var g = o(this).startOf(i).add(1, i).date(l), c = o(this).endOf(e);
|
|
1756
|
+
if (g.isBefore(c)) return 1;
|
|
1737
1757
|
}
|
|
1738
|
-
var
|
|
1739
|
-
return
|
|
1740
|
-
}, r.weeks = function(
|
|
1741
|
-
return
|
|
1758
|
+
var u = o(this).startOf(i).date(l).startOf(e).subtract(1, "millisecond"), p = this.diff(u, e, !0);
|
|
1759
|
+
return p < 0 ? o(this).startOf("week").week() : Math.ceil(p);
|
|
1760
|
+
}, r.weeks = function(h) {
|
|
1761
|
+
return h === void 0 && (h = null), this.week(h);
|
|
1742
1762
|
};
|
|
1743
1763
|
};
|
|
1744
1764
|
});
|
|
@@ -1768,29 +1788,29 @@ var Ht = { exports: {} };
|
|
|
1768
1788
|
return function(e, i) {
|
|
1769
1789
|
var s = i.prototype, n = s.format;
|
|
1770
1790
|
s.format = function(o) {
|
|
1771
|
-
var r = this,
|
|
1791
|
+
var r = this, h = this.$locale();
|
|
1772
1792
|
if (!this.isValid()) return n.bind(this)(o);
|
|
1773
|
-
var
|
|
1774
|
-
switch (
|
|
1793
|
+
var l = this.$utils(), g = (o || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(c) {
|
|
1794
|
+
switch (c) {
|
|
1775
1795
|
case "Q":
|
|
1776
1796
|
return Math.ceil((r.$M + 1) / 3);
|
|
1777
1797
|
case "Do":
|
|
1778
|
-
return
|
|
1798
|
+
return h.ordinal(r.$D);
|
|
1779
1799
|
case "gggg":
|
|
1780
1800
|
return r.weekYear();
|
|
1781
1801
|
case "GGGG":
|
|
1782
1802
|
return r.isoWeekYear();
|
|
1783
1803
|
case "wo":
|
|
1784
|
-
return
|
|
1804
|
+
return h.ordinal(r.week(), "W");
|
|
1785
1805
|
case "w":
|
|
1786
1806
|
case "ww":
|
|
1787
|
-
return
|
|
1807
|
+
return l.s(r.week(), c === "w" ? 1 : 2, "0");
|
|
1788
1808
|
case "W":
|
|
1789
1809
|
case "WW":
|
|
1790
|
-
return
|
|
1810
|
+
return l.s(r.isoWeek(), c === "W" ? 1 : 2, "0");
|
|
1791
1811
|
case "k":
|
|
1792
1812
|
case "kk":
|
|
1793
|
-
return
|
|
1813
|
+
return l.s(String(r.$H === 0 ? 24 : r.$H), c === "k" ? 1 : 2, "0");
|
|
1794
1814
|
case "X":
|
|
1795
1815
|
return Math.floor(r.$d.getTime() / 1e3);
|
|
1796
1816
|
case "x":
|
|
@@ -1800,7 +1820,7 @@ var Ht = { exports: {} };
|
|
|
1800
1820
|
case "zzz":
|
|
1801
1821
|
return "[" + r.offsetName("long") + "]";
|
|
1802
1822
|
default:
|
|
1803
|
-
return
|
|
1823
|
+
return c;
|
|
1804
1824
|
}
|
|
1805
1825
|
});
|
|
1806
1826
|
return n.bind(this)(g);
|
|
@@ -1818,15 +1838,15 @@ var At = { exports: {} };
|
|
|
1818
1838
|
return function(e, i, s) {
|
|
1819
1839
|
s.updateLocale = function(n, o) {
|
|
1820
1840
|
var r = s.Ls[n];
|
|
1821
|
-
if (r) return (o ? Object.keys(o) : []).forEach(function(
|
|
1822
|
-
r[
|
|
1841
|
+
if (r) return (o ? Object.keys(o) : []).forEach(function(h) {
|
|
1842
|
+
r[h] = o[h];
|
|
1823
1843
|
}), r;
|
|
1824
1844
|
};
|
|
1825
1845
|
};
|
|
1826
1846
|
});
|
|
1827
1847
|
})(At);
|
|
1828
|
-
var
|
|
1829
|
-
const
|
|
1848
|
+
var pe = At.exports;
|
|
1849
|
+
const me = /* @__PURE__ */ N(pe);
|
|
1830
1850
|
var It = { exports: {} };
|
|
1831
1851
|
(function(f, t) {
|
|
1832
1852
|
(function(e, i) {
|
|
@@ -1834,22 +1854,22 @@ var It = { exports: {} };
|
|
|
1834
1854
|
})(Y, function() {
|
|
1835
1855
|
var e = "day";
|
|
1836
1856
|
return function(i, s, n) {
|
|
1837
|
-
var o = function(
|
|
1838
|
-
return
|
|
1857
|
+
var o = function(l) {
|
|
1858
|
+
return l.add(4 - l.isoWeekday(), e);
|
|
1839
1859
|
}, r = s.prototype;
|
|
1840
1860
|
r.isoWeekYear = function() {
|
|
1841
1861
|
return o(this).year();
|
|
1842
|
-
}, r.isoWeek = function(
|
|
1843
|
-
if (!this.$utils().u(
|
|
1844
|
-
var g,
|
|
1845
|
-
return
|
|
1846
|
-
}, r.isoWeekday = function(
|
|
1847
|
-
return this.$utils().u(
|
|
1862
|
+
}, r.isoWeek = function(l) {
|
|
1863
|
+
if (!this.$utils().u(l)) return this.add(7 * (l - this.isoWeek()), e);
|
|
1864
|
+
var g, c, u, p, m = o(this), d = (g = this.isoWeekYear(), c = this.$u, u = (c ? n.utc : n)().year(g).startOf("year"), p = 4 - u.isoWeekday(), u.isoWeekday() > 4 && (p += 7), u.add(p, e));
|
|
1865
|
+
return m.diff(d, "week") + 1;
|
|
1866
|
+
}, r.isoWeekday = function(l) {
|
|
1867
|
+
return this.$utils().u(l) ? this.day() || 7 : this.day(this.day() % 7 ? l : l - 7);
|
|
1848
1868
|
};
|
|
1849
|
-
var
|
|
1850
|
-
r.startOf = function(
|
|
1851
|
-
var
|
|
1852
|
-
return
|
|
1869
|
+
var h = r.startOf;
|
|
1870
|
+
r.startOf = function(l, g) {
|
|
1871
|
+
var c = this.$utils(), u = !!c.u(g) || g;
|
|
1872
|
+
return c.p(l) === "isoweek" ? u ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : h.bind(this)(l, g);
|
|
1853
1873
|
};
|
|
1854
1874
|
};
|
|
1855
1875
|
});
|
|
@@ -1863,56 +1883,56 @@ var Gt = { exports: {} };
|
|
|
1863
1883
|
})(Y, function() {
|
|
1864
1884
|
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, i = {};
|
|
1865
1885
|
return function(s, n, o) {
|
|
1866
|
-
var r,
|
|
1867
|
-
|
|
1868
|
-
var
|
|
1869
|
-
|
|
1870
|
-
var
|
|
1871
|
-
return
|
|
1872
|
-
}(
|
|
1873
|
-
return x.formatToParts(
|
|
1874
|
-
},
|
|
1875
|
-
for (var
|
|
1876
|
-
var w =
|
|
1877
|
-
|
|
1886
|
+
var r, h = function(u, p, m) {
|
|
1887
|
+
m === void 0 && (m = {});
|
|
1888
|
+
var d = new Date(u), x = function(w, T) {
|
|
1889
|
+
T === void 0 && (T = {});
|
|
1890
|
+
var v = T.timeZoneName || "short", b = w + "|" + v, O = i[b];
|
|
1891
|
+
return O || (O = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: w, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: v }), i[b] = O), O;
|
|
1892
|
+
}(p, m);
|
|
1893
|
+
return x.formatToParts(d);
|
|
1894
|
+
}, l = function(u, p) {
|
|
1895
|
+
for (var m = h(u, p), d = [], x = 0; x < m.length; x += 1) {
|
|
1896
|
+
var w = m[x], T = w.type, v = w.value, b = e[T];
|
|
1897
|
+
b >= 0 && (d[b] = parseInt(v, 10));
|
|
1878
1898
|
}
|
|
1879
|
-
var
|
|
1880
|
-
return (o.utc(
|
|
1899
|
+
var O = d[3], M = O === 24 ? 0 : O, E = d[0] + "-" + d[1] + "-" + d[2] + " " + M + ":" + d[4] + ":" + d[5] + ":000", k = +u;
|
|
1900
|
+
return (o.utc(E).valueOf() - (k -= k % 1e3)) / 6e4;
|
|
1881
1901
|
}, g = n.prototype;
|
|
1882
|
-
g.tz = function(
|
|
1883
|
-
|
|
1884
|
-
var
|
|
1885
|
-
if (!Number(
|
|
1886
|
-
else if (
|
|
1887
|
-
var
|
|
1888
|
-
|
|
1902
|
+
g.tz = function(u, p) {
|
|
1903
|
+
u === void 0 && (u = r);
|
|
1904
|
+
var m, d = this.utcOffset(), x = this.toDate(), w = x.toLocaleString("en-US", { timeZone: u }), T = Math.round((x - new Date(w)) / 1e3 / 60), v = 15 * -Math.round(x.getTimezoneOffset() / 15) - T;
|
|
1905
|
+
if (!Number(v)) m = this.utcOffset(0, p);
|
|
1906
|
+
else if (m = o(w, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(v, !0), p) {
|
|
1907
|
+
var b = m.utcOffset();
|
|
1908
|
+
m = m.add(d - b, "minute");
|
|
1889
1909
|
}
|
|
1890
|
-
return
|
|
1891
|
-
}, g.offsetName = function(
|
|
1892
|
-
var
|
|
1893
|
-
return
|
|
1910
|
+
return m.$x.$timezone = u, m;
|
|
1911
|
+
}, g.offsetName = function(u) {
|
|
1912
|
+
var p = this.$x.$timezone || o.tz.guess(), m = h(this.valueOf(), p, { timeZoneName: u }).find(function(d) {
|
|
1913
|
+
return d.type.toLowerCase() === "timezonename";
|
|
1894
1914
|
});
|
|
1895
|
-
return
|
|
1915
|
+
return m && m.value;
|
|
1896
1916
|
};
|
|
1897
|
-
var
|
|
1898
|
-
g.startOf = function(
|
|
1899
|
-
if (!this.$x || !this.$x.$timezone) return
|
|
1900
|
-
var
|
|
1901
|
-
return
|
|
1902
|
-
}, o.tz = function(
|
|
1903
|
-
var
|
|
1904
|
-
if (typeof
|
|
1905
|
-
var
|
|
1906
|
-
var
|
|
1907
|
-
if (
|
|
1908
|
-
var _ =
|
|
1909
|
-
return
|
|
1910
|
-
}(o.utc(
|
|
1911
|
-
return
|
|
1917
|
+
var c = g.startOf;
|
|
1918
|
+
g.startOf = function(u, p) {
|
|
1919
|
+
if (!this.$x || !this.$x.$timezone) return c.call(this, u, p);
|
|
1920
|
+
var m = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
1921
|
+
return c.call(m, u, p).tz(this.$x.$timezone, !0);
|
|
1922
|
+
}, o.tz = function(u, p, m) {
|
|
1923
|
+
var d = m && p, x = m || p || r, w = l(+o(), x);
|
|
1924
|
+
if (typeof u != "string") return o(u).tz(x);
|
|
1925
|
+
var T = function(M, E, k) {
|
|
1926
|
+
var L = M - 60 * E * 1e3, A = l(L, k);
|
|
1927
|
+
if (E === A) return [L, E];
|
|
1928
|
+
var _ = l(L -= 60 * (A - E) * 1e3, k);
|
|
1929
|
+
return A === _ ? [L, A] : [M - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
1930
|
+
}(o.utc(u, d).valueOf(), w, x), v = T[0], b = T[1], O = o(v).utcOffset(b);
|
|
1931
|
+
return O.$x.$timezone = x, O;
|
|
1912
1932
|
}, o.tz.guess = function() {
|
|
1913
1933
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1914
|
-
}, o.tz.setDefault = function(
|
|
1915
|
-
r =
|
|
1934
|
+
}, o.tz.setDefault = function(u) {
|
|
1935
|
+
r = u;
|
|
1916
1936
|
};
|
|
1917
1937
|
};
|
|
1918
1938
|
});
|
|
@@ -1926,69 +1946,69 @@ var Rt = { exports: {} };
|
|
|
1926
1946
|
})(Y, function() {
|
|
1927
1947
|
var e = "minute", i = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
|
|
1928
1948
|
return function(n, o, r) {
|
|
1929
|
-
var
|
|
1930
|
-
r.utc = function(
|
|
1931
|
-
var x = { date:
|
|
1949
|
+
var h = o.prototype;
|
|
1950
|
+
r.utc = function(d) {
|
|
1951
|
+
var x = { date: d, utc: !0, args: arguments };
|
|
1932
1952
|
return new o(x);
|
|
1933
|
-
},
|
|
1953
|
+
}, h.utc = function(d) {
|
|
1934
1954
|
var x = r(this.toDate(), { locale: this.$L, utc: !0 });
|
|
1935
|
-
return
|
|
1936
|
-
},
|
|
1955
|
+
return d ? x.add(this.utcOffset(), e) : x;
|
|
1956
|
+
}, h.local = function() {
|
|
1937
1957
|
return r(this.toDate(), { locale: this.$L, utc: !1 });
|
|
1938
1958
|
};
|
|
1939
|
-
var
|
|
1940
|
-
|
|
1941
|
-
|
|
1959
|
+
var l = h.parse;
|
|
1960
|
+
h.parse = function(d) {
|
|
1961
|
+
d.utc && (this.$u = !0), this.$utils().u(d.$offset) || (this.$offset = d.$offset), l.call(this, d);
|
|
1942
1962
|
};
|
|
1943
|
-
var g =
|
|
1944
|
-
|
|
1963
|
+
var g = h.init;
|
|
1964
|
+
h.init = function() {
|
|
1945
1965
|
if (this.$u) {
|
|
1946
|
-
var
|
|
1947
|
-
this.$y =
|
|
1966
|
+
var d = this.$d;
|
|
1967
|
+
this.$y = d.getUTCFullYear(), this.$M = d.getUTCMonth(), this.$D = d.getUTCDate(), this.$W = d.getUTCDay(), this.$H = d.getUTCHours(), this.$m = d.getUTCMinutes(), this.$s = d.getUTCSeconds(), this.$ms = d.getUTCMilliseconds();
|
|
1948
1968
|
} else g.call(this);
|
|
1949
1969
|
};
|
|
1950
|
-
var
|
|
1951
|
-
|
|
1970
|
+
var c = h.utcOffset;
|
|
1971
|
+
h.utcOffset = function(d, x) {
|
|
1952
1972
|
var w = this.$utils().u;
|
|
1953
|
-
if (w(
|
|
1954
|
-
if (typeof
|
|
1955
|
-
|
|
1956
|
-
var
|
|
1957
|
-
if (!
|
|
1958
|
-
var
|
|
1959
|
-
return
|
|
1960
|
-
}(
|
|
1961
|
-
var
|
|
1962
|
-
if (x) return
|
|
1963
|
-
if (
|
|
1964
|
-
var
|
|
1965
|
-
(
|
|
1966
|
-
} else
|
|
1967
|
-
return
|
|
1973
|
+
if (w(d)) return this.$u ? 0 : w(this.$offset) ? c.call(this) : this.$offset;
|
|
1974
|
+
if (typeof d == "string" && (d = function(O) {
|
|
1975
|
+
O === void 0 && (O = "");
|
|
1976
|
+
var M = O.match(i);
|
|
1977
|
+
if (!M) return null;
|
|
1978
|
+
var E = ("" + M[0]).match(s) || ["-", 0, 0], k = E[0], L = 60 * +E[1] + +E[2];
|
|
1979
|
+
return L === 0 ? 0 : k === "+" ? L : -L;
|
|
1980
|
+
}(d), d === null)) return this;
|
|
1981
|
+
var T = Math.abs(d) <= 16 ? 60 * d : d, v = this;
|
|
1982
|
+
if (x) return v.$offset = T, v.$u = d === 0, v;
|
|
1983
|
+
if (d !== 0) {
|
|
1984
|
+
var b = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
1985
|
+
(v = this.local().add(T + b, e)).$offset = T, v.$x.$localOffset = b;
|
|
1986
|
+
} else v = this.utc();
|
|
1987
|
+
return v;
|
|
1968
1988
|
};
|
|
1969
|
-
var
|
|
1970
|
-
|
|
1971
|
-
var x =
|
|
1972
|
-
return
|
|
1973
|
-
},
|
|
1974
|
-
var
|
|
1975
|
-
return this.$d.valueOf() - 6e4 *
|
|
1976
|
-
},
|
|
1989
|
+
var u = h.format;
|
|
1990
|
+
h.format = function(d) {
|
|
1991
|
+
var x = d || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
1992
|
+
return u.call(this, x);
|
|
1993
|
+
}, h.valueOf = function() {
|
|
1994
|
+
var d = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
1995
|
+
return this.$d.valueOf() - 6e4 * d;
|
|
1996
|
+
}, h.isUTC = function() {
|
|
1977
1997
|
return !!this.$u;
|
|
1978
|
-
},
|
|
1998
|
+
}, h.toISOString = function() {
|
|
1979
1999
|
return this.toDate().toISOString();
|
|
1980
|
-
},
|
|
2000
|
+
}, h.toString = function() {
|
|
1981
2001
|
return this.toDate().toUTCString();
|
|
1982
2002
|
};
|
|
1983
|
-
var
|
|
1984
|
-
|
|
1985
|
-
return
|
|
2003
|
+
var p = h.toDate;
|
|
2004
|
+
h.toDate = function(d) {
|
|
2005
|
+
return d === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : p.call(this);
|
|
1986
2006
|
};
|
|
1987
|
-
var
|
|
1988
|
-
|
|
1989
|
-
if (
|
|
1990
|
-
var
|
|
1991
|
-
return
|
|
2007
|
+
var m = h.diff;
|
|
2008
|
+
h.diff = function(d, x, w) {
|
|
2009
|
+
if (d && this.$u === d.$u) return m.call(this, d, x, w);
|
|
2010
|
+
var T = this.local(), v = r(d).local();
|
|
2011
|
+
return m.call(T, v, x, w);
|
|
1992
2012
|
};
|
|
1993
2013
|
};
|
|
1994
2014
|
});
|
|
@@ -2006,7 +2026,7 @@ var Se = { exports: {} };
|
|
|
2006
2026
|
} };
|
|
2007
2027
|
});
|
|
2008
2028
|
})(Se);
|
|
2009
|
-
var
|
|
2029
|
+
var ke = { exports: {} };
|
|
2010
2030
|
(function(f, t) {
|
|
2011
2031
|
(function(e, i) {
|
|
2012
2032
|
f.exports = i(H);
|
|
@@ -2017,13 +2037,13 @@ var Ee = { exports: {} };
|
|
|
2017
2037
|
var s = i(e), n = { name: "zh", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(o, r) {
|
|
2018
2038
|
return r === "W" ? o + "周" : o + "日";
|
|
2019
2039
|
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s后", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(o, r) {
|
|
2020
|
-
var
|
|
2021
|
-
return
|
|
2040
|
+
var h = 100 * o + r;
|
|
2041
|
+
return h < 600 ? "凌晨" : h < 900 ? "早上" : h < 1100 ? "上午" : h < 1300 ? "中午" : h < 1800 ? "下午" : "晚上";
|
|
2022
2042
|
} };
|
|
2023
2043
|
return s.default.locale(n, null, !0), n;
|
|
2024
2044
|
});
|
|
2025
|
-
})(
|
|
2026
|
-
const
|
|
2045
|
+
})(ke);
|
|
2046
|
+
const Ee = (f, t) => {
|
|
2027
2047
|
const e = t.prototype;
|
|
2028
2048
|
e.setLocale = function(s) {
|
|
2029
2049
|
return this.$locale = s || H().locale(), this.$L = this.$locale, this;
|
|
@@ -2041,18 +2061,18 @@ H.extend(ce);
|
|
|
2041
2061
|
H.extend(he);
|
|
2042
2062
|
H.extend(ue);
|
|
2043
2063
|
H.extend(fe);
|
|
2044
|
-
H.extend(
|
|
2064
|
+
H.extend(me);
|
|
2045
2065
|
H.extend(ye);
|
|
2046
2066
|
H.extend(be);
|
|
2047
2067
|
H.extend(Te);
|
|
2048
|
-
H.extend(
|
|
2068
|
+
H.extend(Ee);
|
|
2049
2069
|
function wt(f) {
|
|
2050
2070
|
try {
|
|
2051
2071
|
if (H.locale() === f) return;
|
|
2052
2072
|
if (H.locale(f) !== f) throw Error();
|
|
2053
|
-
|
|
2073
|
+
D.info(`Locale set to ${f}`);
|
|
2054
2074
|
} catch {
|
|
2055
|
-
|
|
2075
|
+
D.warn(`Failed to set locale ${f}, fallback to en`), H.locale("en");
|
|
2056
2076
|
}
|
|
2057
2077
|
}
|
|
2058
2078
|
const ht = () => ({
|
|
@@ -2088,8 +2108,6 @@ class Oe {
|
|
|
2088
2108
|
a(this, "strictStart", !1);
|
|
2089
2109
|
/** 固定截止日期 */
|
|
2090
2110
|
a(this, "strictEnd", !1);
|
|
2091
|
-
/** 是否锁定时间范围 */
|
|
2092
|
-
a(this, "isStrict", !1);
|
|
2093
2111
|
/** 是否自适应宽度 */
|
|
2094
2112
|
a(this, "isAuto", !1);
|
|
2095
2113
|
/** 表头的日期列表 */
|
|
@@ -2154,7 +2172,7 @@ class Oe {
|
|
|
2154
2172
|
return this.startTime.add(n, "second");
|
|
2155
2173
|
}
|
|
2156
2174
|
init(t) {
|
|
2157
|
-
this.isDirty = !0;
|
|
2175
|
+
this.isDirty = !0, this.isFirstTime = !0;
|
|
2158
2176
|
const { unit: e, chart: i } = t;
|
|
2159
2177
|
this.isAuto = !!i.autoCellWidth;
|
|
2160
2178
|
const s = {
|
|
@@ -2164,13 +2182,13 @@ class Oe {
|
|
|
2164
2182
|
month: "month",
|
|
2165
2183
|
quarter: "quarter"
|
|
2166
2184
|
}[e];
|
|
2167
|
-
s ||
|
|
2185
|
+
s || D.warn(`Unknown unit: [${e}]. Falling back to "day".`), this.unit = s || "day", i.startTime && (this.startTime = H(i.startTime).startOf(this.getFinelyUnit()), this.strictStart = !0), i.endTime && (this.endTime = H(i.endTime).endOf(this.getFinelyUnit()), this.strictEnd = !0), i.cellWidth && (Pt(i.cellWidth) ? this.cellWidth = {
|
|
2168
2186
|
hour: i.cellWidth,
|
|
2169
2187
|
day: i.cellWidth,
|
|
2170
2188
|
week: i.cellWidth,
|
|
2171
2189
|
month: i.cellWidth,
|
|
2172
2190
|
quarter: i.cellWidth
|
|
2173
|
-
} :
|
|
2191
|
+
} : X(i.cellWidth) ? this.cellWidth = J(
|
|
2174
2192
|
ht()[i.cellWidth] || ht().normal
|
|
2175
2193
|
) : Tt(i.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, i.cellWidth))), this.headerCellFormat = i.headerCellFormat, this.headerGroupFormat = i.headerGroupFormat;
|
|
2176
2194
|
}
|
|
@@ -2178,7 +2196,7 @@ class Oe {
|
|
|
2178
2196
|
this.init(t), this.endTime = this.targetEnd.clone();
|
|
2179
2197
|
}
|
|
2180
2198
|
setDate(t, e) {
|
|
2181
|
-
this.
|
|
2199
|
+
this.strictStart || t && (this.isFirstTime || t.isBefore(this.startTime)) && (this.startTime = t.startOf(this.getFinelyUnit())), this.strictEnd || e && (this.isFirstTime || e.isAfter(this.endTime)) && (this.endTime = e.endOf(this.getFinelyUnit())), this.targetEnd = this.endTime.clone(), this.isFirstTime = !1, this.invalidateCache();
|
|
2182
2200
|
}
|
|
2183
2201
|
/** 获取表头的日期列表 */
|
|
2184
2202
|
getTimeline() {
|
|
@@ -2250,7 +2268,7 @@ class Oe {
|
|
|
2250
2268
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2251
2269
|
if (i) return i;
|
|
2252
2270
|
}
|
|
2253
|
-
if (
|
|
2271
|
+
if (X(this.headerGroupFormat))
|
|
2254
2272
|
return t.format(this.headerGroupFormat);
|
|
2255
2273
|
switch (this.getGroupUnit()) {
|
|
2256
2274
|
case "month":
|
|
@@ -2270,7 +2288,7 @@ class Oe {
|
|
|
2270
2288
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2271
2289
|
if (i) return i;
|
|
2272
2290
|
}
|
|
2273
|
-
if (
|
|
2291
|
+
if (X(this.headerCellFormat))
|
|
2274
2292
|
return t.format(this.headerCellFormat);
|
|
2275
2293
|
switch (this.getChildUnit()) {
|
|
2276
2294
|
case "hour":
|
|
@@ -2316,8 +2334,8 @@ class Me {
|
|
|
2316
2334
|
var n;
|
|
2317
2335
|
this.context = t;
|
|
2318
2336
|
const i = gt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2319
|
-
if (s && !
|
|
2320
|
-
throw
|
|
2337
|
+
if (s && !U(s))
|
|
2338
|
+
throw D.exception("Data should be a array.");
|
|
2321
2339
|
this.optionManager = new Ut(), this.optionManager.setOptions(i), i.locale && wt(i.locale), this.timeAxis = new Oe(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new Jt(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new Kt(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);
|
|
2322
2340
|
}
|
|
2323
2341
|
getOptionManager() {
|
|
@@ -2337,7 +2355,7 @@ class Me {
|
|
|
2337
2355
|
const i = gt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
2338
2356
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((r) => {
|
|
2339
2357
|
r.updateMode();
|
|
2340
|
-
}),
|
|
2358
|
+
}), U(s) && this.dataManager.setData(s, !1), U((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), i.locale && wt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
2341
2359
|
}
|
|
2342
2360
|
updateTime(t, e) {
|
|
2343
2361
|
this.timeAxis.setDate(t, e);
|
|
@@ -2411,14 +2429,14 @@ class Le {
|
|
|
2411
2429
|
a(this, "handleHorizontalTrackMouseDown", (t) => {
|
|
2412
2430
|
if (t.target !== this.hScrollbar) return;
|
|
2413
2431
|
t.preventDefault();
|
|
2414
|
-
const e = this.hScrollbar.getBoundingClientRect(), i = this.hScrollThumb.offsetWidth, s = t.clientX - e.left, n = this.hScrollbar.clientWidth, o = this.contentWidth - this.viewportWidth, r = n - i,
|
|
2415
|
-
this.scrollTo({ x:
|
|
2432
|
+
const e = this.hScrollbar.getBoundingClientRect(), i = this.hScrollThumb.offsetWidth, s = t.clientX - e.left, n = this.hScrollbar.clientWidth, o = this.contentWidth - this.viewportWidth, r = n - i, h = (s - i / 2) / r * o;
|
|
2433
|
+
this.scrollTo({ x: h, y: this.scrollTop }, "track");
|
|
2416
2434
|
});
|
|
2417
2435
|
a(this, "handleVerticalTrackMouseDown", (t) => {
|
|
2418
2436
|
if (t.target !== this.vScrollbar) return;
|
|
2419
2437
|
t.preventDefault();
|
|
2420
|
-
const e = this.vScrollbar.getBoundingClientRect(), i = this.vScrollThumb.offsetHeight, s = t.clientY - e.top, n = this.vScrollbar.clientHeight, o = this.contentHeight - this.viewportHeight, r = n - i,
|
|
2421
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
2438
|
+
const e = this.vScrollbar.getBoundingClientRect(), i = this.vScrollThumb.offsetHeight, s = t.clientY - e.top, n = this.vScrollbar.clientHeight, o = this.contentHeight - this.viewportHeight, r = n - i, h = (s - i / 2) / r * o;
|
|
2439
|
+
this.scrollTo({ x: this.scrollLeft, y: h }, "track");
|
|
2422
2440
|
});
|
|
2423
2441
|
a(this, "handleMouseUp", () => {
|
|
2424
2442
|
if (this.isDraggingHScroll || this.isDraggingVScroll) {
|
|
@@ -2429,8 +2447,8 @@ class Le {
|
|
|
2429
2447
|
// --- 动画处理 ---
|
|
2430
2448
|
a(this, "animationStep", (t) => {
|
|
2431
2449
|
if (!this.isAnimating) return;
|
|
2432
|
-
const e = t - this.animationStartTime, i = this.options.animationDuration, s = Math.min(1, e / i), n = s * (2 - s), o = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * n, r = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * n,
|
|
2433
|
-
(
|
|
2450
|
+
const e = t - this.animationStartTime, i = this.options.animationDuration, s = Math.min(1, e / i), n = s * (2 - s), o = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * n, r = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * n, h = this.scrollLeft !== o, l = this.scrollTop !== r;
|
|
2451
|
+
(h || l) && this.emit(this.animationSource, o, r), s < 1 ? this.animationFrameId = requestAnimationFrame(this.animationStep) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && this.emit(this.animationSource, this.animationTargetScrollLeft, this.animationTargetScrollTop), this.scheduleHide());
|
|
2434
2452
|
});
|
|
2435
2453
|
this.root = t, this.rootElement = e, this.options = ot(
|
|
2436
2454
|
{
|
|
@@ -2550,7 +2568,7 @@ class Le {
|
|
|
2550
2568
|
}
|
|
2551
2569
|
// --- 事件处理 ---
|
|
2552
2570
|
emit(t, e, i) {
|
|
2553
|
-
this.scrollLeft =
|
|
2571
|
+
this.scrollLeft = R(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = R(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(S.SCROLL, {
|
|
2554
2572
|
x: this.scrollLeft,
|
|
2555
2573
|
y: this.scrollTop,
|
|
2556
2574
|
source: t
|
|
@@ -2561,8 +2579,8 @@ class Le {
|
|
|
2561
2579
|
if (this.scheduleShow(), this.isDraggingHScroll) {
|
|
2562
2580
|
const e = t.clientX - this.dragStartX, i = this.hScrollbar.clientWidth, s = this.hScrollThumb.offsetWidth, n = Math.max(0, i - s), o = Math.max(0, this.contentWidth - this.viewportWidth);
|
|
2563
2581
|
if (n === 0 || o === 0) return;
|
|
2564
|
-
const r = e / n * o,
|
|
2565
|
-
this.scrollTo({ x:
|
|
2582
|
+
const r = e / n * o, h = this.thumbStartScrollLeft + r;
|
|
2583
|
+
this.scrollTo({ x: h, y: this.scrollTop }, "drag");
|
|
2566
2584
|
}
|
|
2567
2585
|
if (this.isDraggingVScroll) {
|
|
2568
2586
|
const e = t.clientY - this.dragStartY, i = this.vScrollbar.clientHeight, s = this.vScrollThumb.offsetHeight, n = Math.max(0, i - s), o = Math.max(
|
|
@@ -2570,17 +2588,17 @@ class Le {
|
|
|
2570
2588
|
this.contentHeight - this.viewportHeight
|
|
2571
2589
|
);
|
|
2572
2590
|
if (n === 0 || o === 0) return;
|
|
2573
|
-
const r = e / n * o,
|
|
2574
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
2591
|
+
const r = e / n * o, h = this.thumbStartScrollTop + r;
|
|
2592
|
+
this.scrollTo({ x: this.scrollLeft, y: h }, "drag");
|
|
2575
2593
|
}
|
|
2576
2594
|
}
|
|
2577
2595
|
}
|
|
2578
2596
|
handleWheel(t) {
|
|
2579
|
-
if (t.target !== this.rootElement && !this.rootElement.contains(t.target) &&
|
|
2597
|
+
if (t.target !== this.rootElement && !this.rootElement.contains(t.target) && D.debug(
|
|
2580
2598
|
"Wheel event ignored, target not root or descendant:",
|
|
2581
2599
|
t.target
|
|
2582
2600
|
), !this.isMouseOverRoot && !this.isMouseOverScrollbar) {
|
|
2583
|
-
|
|
2601
|
+
D.debug("Wheel event ignored, mouse not over root or scrollbar");
|
|
2584
2602
|
return;
|
|
2585
2603
|
}
|
|
2586
2604
|
const e = this.canScrollHorizontal(), i = this.canScrollVertical();
|
|
@@ -2604,8 +2622,8 @@ class Le {
|
|
|
2604
2622
|
this.isAnimating = !0, this.animationStartTime = performance.now(), this.animationStartScrollLeft = this.scrollLeft, this.animationStartScrollTop = this.scrollTop, this.animationTargetScrollLeft = i.x, this.animationTargetScrollTop = i.y, this.animationSource = "wheel";
|
|
2605
2623
|
const s = 150, n = (o) => {
|
|
2606
2624
|
if (!this.isAnimating) return;
|
|
2607
|
-
const r = o - this.animationStartTime,
|
|
2608
|
-
(
|
|
2625
|
+
const r = o - this.animationStartTime, h = Math.min(1, r / s), l = h * (2 - h), g = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * l, c = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * l, u = this.scrollLeft !== g, p = this.scrollTop !== c;
|
|
2626
|
+
(u || p) && this.emit("wheel", g, c), h < 1 ? this.animationFrameId = requestAnimationFrame(n) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && this.emit("wheel", this.animationTargetScrollLeft, this.animationTargetScrollTop), this.scheduleHide());
|
|
2609
2627
|
};
|
|
2610
2628
|
this.animationFrameId = requestAnimationFrame(n);
|
|
2611
2629
|
}
|
|
@@ -2653,23 +2671,23 @@ class Le {
|
|
|
2653
2671
|
*/
|
|
2654
2672
|
updateSize(t, e, i, s, n = 0, o = 0) {
|
|
2655
2673
|
this.viewportWidth = Math.max(0, t), this.viewportHeight = Math.max(0, e), this.contentWidth = Math.max(this.viewportWidth, i), this.contentHeight = Math.max(this.viewportHeight, s);
|
|
2656
|
-
const r = this.canScrollHorizontal() && this.options.showHorizontal,
|
|
2674
|
+
const r = this.canScrollHorizontal() && this.options.showHorizontal, h = this.canScrollVertical() && this.options.showVertical;
|
|
2657
2675
|
if (r) {
|
|
2658
|
-
const g = this.viewportWidth - (
|
|
2659
|
-
this.hScrollbar.style.display = "block", this.hScrollbar.style.left = `${n}px`, this.hScrollbar.style.width = `${Math.max(0, g)}px`, this.hScrollbar.style.bottom = "0px", this.hScrollbar.style.right =
|
|
2676
|
+
const g = this.viewportWidth - (h ? this.options.track.size : 0);
|
|
2677
|
+
this.hScrollbar.style.display = "block", this.hScrollbar.style.left = `${n}px`, this.hScrollbar.style.width = `${Math.max(0, g)}px`, this.hScrollbar.style.bottom = "0px", this.hScrollbar.style.right = h ? `${this.options.track.size}px` : "0px";
|
|
2660
2678
|
} else
|
|
2661
2679
|
this.hScrollbar.style.display = "none";
|
|
2662
|
-
if (
|
|
2680
|
+
if (h) {
|
|
2663
2681
|
const g = this.viewportHeight - o - (r ? this.options.track.size : 0);
|
|
2664
2682
|
this.vScrollbar.style.display = "block", this.vScrollbar.style.top = `${o}px`, this.vScrollbar.style.height = `${Math.max(0, g)}px`, this.vScrollbar.style.right = "0px", this.vScrollbar.style.bottom = r ? `${this.options.track.size}px` : "0px";
|
|
2665
2683
|
} else
|
|
2666
2684
|
this.vScrollbar.style.display = "none";
|
|
2667
2685
|
this.updateThumbStyles();
|
|
2668
|
-
const
|
|
2686
|
+
const l = this.clampScroll({
|
|
2669
2687
|
x: this.scrollLeft,
|
|
2670
2688
|
y: this.scrollTop
|
|
2671
2689
|
});
|
|
2672
|
-
(
|
|
2690
|
+
(l.x !== this.scrollLeft || l.y !== this.scrollTop) && this.emit("api", l.x, l.y), this.isMouseOverRoot || this.isDraggingHScroll || this.isDraggingVScroll ? this.scheduleShow() : !r && !h ? this.hideScrollbars(!0) : this.isVisible ? this.scheduleShow() : this.hideScrollbars(!0);
|
|
2673
2691
|
}
|
|
2674
2692
|
updateThumbStyles() {
|
|
2675
2693
|
if (this.canScrollHorizontal() && this.options.showHorizontal) {
|
|
@@ -2749,7 +2767,7 @@ class Le {
|
|
|
2749
2767
|
}
|
|
2750
2768
|
// --- 销毁 ---
|
|
2751
2769
|
destroy() {
|
|
2752
|
-
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,
|
|
2770
|
+
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, D.debug("Scrollbar destroyed");
|
|
2753
2771
|
}
|
|
2754
2772
|
}
|
|
2755
2773
|
function Q(f, t = "") {
|
|
@@ -2787,11 +2805,11 @@ class it {
|
|
|
2787
2805
|
* @param colspan 横向合并的列数
|
|
2788
2806
|
* @param rowspan 纵向合并的行数
|
|
2789
2807
|
*/
|
|
2790
|
-
constructor(t, e, i, s, n, o, r = 1,
|
|
2808
|
+
constructor(t, e, i, s, n, o, r = 1, h = 1, l) {
|
|
2791
2809
|
a(this, "element");
|
|
2792
2810
|
a(this, "isEmpty", !1);
|
|
2793
2811
|
a(this, "isHandler", !1);
|
|
2794
|
-
this.context = t, this.container = e, this.column = i, this.task = s, this.rowIndex = n, this.colIndex = o, this.colspan = r, this.rowspan =
|
|
2812
|
+
this.context = t, this.container = e, this.column = i, this.task = s, this.rowIndex = n, this.colIndex = o, this.colspan = r, this.rowspan = h, this.isEmpty = l === "empty", this.isHandler = l === "handler", this.element = document.createElement("div"), this.element.className = "x-gantt-table-cell", this.element.style.boxSizing = "border-box", this.element.style.display = "inline-flex", this.element.style.flexShrink = "0", this.element.style.flexGrow = "0", this.element.style.flexBasis = "auto", this.element.style.pointerEvents = "all", this.element.style.setProperty(
|
|
2795
2813
|
"border-color",
|
|
2796
2814
|
this.context.getOptions().border.color,
|
|
2797
2815
|
"important"
|
|
@@ -2809,12 +2827,12 @@ class it {
|
|
|
2809
2827
|
)), typeof this.column.column.render == "function")
|
|
2810
2828
|
try {
|
|
2811
2829
|
const e = this.column.column.render(this.task.getEmitData());
|
|
2812
|
-
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement ? t.appendChild(e) :
|
|
2830
|
+
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement ? t.appendChild(e) : D.warn(
|
|
2813
2831
|
"Table cell render function does not return a valid value.",
|
|
2814
2832
|
e
|
|
2815
2833
|
);
|
|
2816
2834
|
} catch (e) {
|
|
2817
|
-
|
|
2835
|
+
D.error("Table cell render error:", e), t.textContent = this.task.getField(this.column.column.field) ?? this.context.getOptions().table.emptyText;
|
|
2818
2836
|
}
|
|
2819
2837
|
else
|
|
2820
2838
|
t.textContent = this.task.getField(this.column.column.field) ?? this.context.getOptions().table.emptyText;
|
|
@@ -2824,7 +2842,7 @@ class it {
|
|
|
2824
2842
|
const t = document.createElement("div");
|
|
2825
2843
|
if (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%", this.context.getOptions().selection.enabled) {
|
|
2826
2844
|
const e = document.createElement("div");
|
|
2827
|
-
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new
|
|
2845
|
+
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new kt(this.context, e, this.task), t.appendChild(e);
|
|
2828
2846
|
}
|
|
2829
2847
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
2830
2848
|
const e = document.createElement("div");
|
|
@@ -2880,28 +2898,28 @@ class bt {
|
|
|
2880
2898
|
*/
|
|
2881
2899
|
bindEvents() {
|
|
2882
2900
|
this.element.addEventListener("mouseenter", () => {
|
|
2883
|
-
this.context.event.emit(
|
|
2901
|
+
this.context.event.emit(S.ROW_HIGHLIGHT, this.task.id);
|
|
2884
2902
|
}), this.element.addEventListener("mouseleave", () => {
|
|
2885
|
-
this.context.event.emit(
|
|
2903
|
+
this.context.event.emit(S.ROW_UNHIGHLIGHT, this.task.id);
|
|
2886
2904
|
}), this.element.addEventListener("click", (t) => {
|
|
2887
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
2905
|
+
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));
|
|
2888
2906
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
2889
|
-
this.context.event.emit(
|
|
2907
|
+
this.context.event.emit(S.ROW_DBL_CLICK, t, this.task);
|
|
2890
2908
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
2891
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
2909
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(S.ROW_CONTEXTMENU, t, this.task.id);
|
|
2892
2910
|
});
|
|
2893
2911
|
}
|
|
2894
2912
|
/**
|
|
2895
2913
|
* 注册全局接收事件
|
|
2896
2914
|
*/
|
|
2897
2915
|
registerEvents() {
|
|
2898
|
-
this.context.event.on(
|
|
2916
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
2899
2917
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
2900
|
-
}), this.context.event.on(
|
|
2918
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
2901
2919
|
this.task.id === t && this.element.classList.remove("hover");
|
|
2902
|
-
}), this.context.event.on(
|
|
2920
|
+
}), this.context.event.on(S.TASK_SELECTED, (t) => {
|
|
2903
2921
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
2904
|
-
}), this.context.event.on(
|
|
2922
|
+
}), this.context.event.on(S.TASK_UNSELECTED, (t) => {
|
|
2905
2923
|
this.task.id === t && this.element.classList.remove("selected");
|
|
2906
2924
|
});
|
|
2907
2925
|
}
|
|
@@ -2951,7 +2969,7 @@ class bt {
|
|
|
2951
2969
|
const o = e[n], r = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
2952
2970
|
if (r) {
|
|
2953
2971
|
if (r.task.id !== this.task.id) {
|
|
2954
|
-
const
|
|
2972
|
+
const h = new it(
|
|
2955
2973
|
this.context,
|
|
2956
2974
|
this.element,
|
|
2957
2975
|
o,
|
|
@@ -2962,9 +2980,9 @@ class bt {
|
|
|
2962
2980
|
1,
|
|
2963
2981
|
"empty"
|
|
2964
2982
|
);
|
|
2965
|
-
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(
|
|
2983
|
+
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(h);
|
|
2966
2984
|
} else if (r.originColumnIndex === n) {
|
|
2967
|
-
const
|
|
2985
|
+
const h = new it(
|
|
2968
2986
|
this.context,
|
|
2969
2987
|
this.element,
|
|
2970
2988
|
o,
|
|
@@ -2974,10 +2992,10 @@ class bt {
|
|
|
2974
2992
|
r.colspan,
|
|
2975
2993
|
r.rowspan
|
|
2976
2994
|
);
|
|
2977
|
-
this.cells.push(
|
|
2995
|
+
this.cells.push(h);
|
|
2978
2996
|
}
|
|
2979
2997
|
} else {
|
|
2980
|
-
let
|
|
2998
|
+
let h = 1, l = 1;
|
|
2981
2999
|
const g = (s = (i = o.column).merge) == null ? void 0 : s.call(
|
|
2982
3000
|
i,
|
|
2983
3001
|
this.task.getField(o.column.field),
|
|
@@ -2985,42 +3003,42 @@ class bt {
|
|
|
2985
3003
|
n,
|
|
2986
3004
|
this.task.level + 1
|
|
2987
3005
|
);
|
|
2988
|
-
if (g && (typeof g.col != "number" ?
|
|
2989
|
-
if (
|
|
2990
|
-
for (let
|
|
2991
|
-
const
|
|
2992
|
-
if (
|
|
2993
|
-
|
|
3006
|
+
if (g && (typeof g.col != "number" ? D.error("colspan function must returned a number") : h = g.col, typeof g.row != "number" ? D.error("rowspan function must returned a number") : l = g.row), h > 1 || l > 1) {
|
|
3007
|
+
if (l > 1)
|
|
3008
|
+
for (let m = 1; m < l; m++) {
|
|
3009
|
+
const d = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + m];
|
|
3010
|
+
if (d && this.task.level !== d.level) {
|
|
3011
|
+
l = m;
|
|
2994
3012
|
break;
|
|
2995
3013
|
}
|
|
2996
3014
|
}
|
|
2997
|
-
const
|
|
3015
|
+
const u = {
|
|
2998
3016
|
task: this.task,
|
|
2999
3017
|
originColumnIndex: n,
|
|
3000
|
-
colspan:
|
|
3001
|
-
rowspan:
|
|
3018
|
+
colspan: h,
|
|
3019
|
+
rowspan: l
|
|
3002
3020
|
};
|
|
3003
|
-
let
|
|
3004
|
-
for (let
|
|
3005
|
-
if (
|
|
3006
|
-
for (let
|
|
3007
|
-
this.context.store.getColumnManager().addMergeInfo(
|
|
3008
|
-
|
|
3021
|
+
let p = this.task;
|
|
3022
|
+
for (let m = l; m > 0; m--)
|
|
3023
|
+
if (p) {
|
|
3024
|
+
for (let d = 0; d < h; d++)
|
|
3025
|
+
this.context.store.getColumnManager().addMergeInfo(p.id, d + n, u);
|
|
3026
|
+
p = this.context.store.getDataManager().getVisibleTasks().at(p.flatIndex + 1);
|
|
3009
3027
|
}
|
|
3010
|
-
for (let
|
|
3011
|
-
this.context.store.getColumnManager().addMergeInfo(this.task.id,
|
|
3028
|
+
for (let m = 0; m < h; m++)
|
|
3029
|
+
this.context.store.getColumnManager().addMergeInfo(this.task.id, m + n, u);
|
|
3012
3030
|
}
|
|
3013
|
-
const
|
|
3031
|
+
const c = new it(
|
|
3014
3032
|
this.context,
|
|
3015
3033
|
this.element,
|
|
3016
3034
|
o,
|
|
3017
3035
|
this.task,
|
|
3018
3036
|
this.task.flatIndex,
|
|
3019
3037
|
n,
|
|
3020
|
-
|
|
3021
|
-
|
|
3038
|
+
h,
|
|
3039
|
+
l
|
|
3022
3040
|
);
|
|
3023
|
-
this.cells.push(
|
|
3041
|
+
this.cells.push(c);
|
|
3024
3042
|
}
|
|
3025
3043
|
}
|
|
3026
3044
|
this.context.store.getDataManager().isTaskSelected(this.task.id) && this.element.classList.add("selected");
|
|
@@ -3073,25 +3091,25 @@ class Ce {
|
|
|
3073
3091
|
}), e.forEach((n, o) => {
|
|
3074
3092
|
const r = n.id;
|
|
3075
3093
|
if (this.rows.has(r)) {
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3094
|
+
const h = this.rows.get(r);
|
|
3095
|
+
h.update(n), h.updateTop(t);
|
|
3078
3096
|
} else {
|
|
3079
|
-
const
|
|
3080
|
-
|
|
3097
|
+
const h = new bt(this.context, this.element, n, t);
|
|
3098
|
+
h.create(), this.rows.set(r, h);
|
|
3081
3099
|
}
|
|
3082
|
-
this.context.store.getColumnManager().getLeafColumns().forEach((
|
|
3083
|
-
const g = this.context.store.getColumnManager().getMergeInfo(n.id,
|
|
3100
|
+
this.context.store.getColumnManager().getLeafColumns().forEach((h, l) => {
|
|
3101
|
+
const g = this.context.store.getColumnManager().getMergeInfo(n.id, l);
|
|
3084
3102
|
if (g && g.rowspan > 1) {
|
|
3085
|
-
const
|
|
3086
|
-
if (!this.rows.has(
|
|
3087
|
-
const
|
|
3103
|
+
const c = g.task.id;
|
|
3104
|
+
if (!this.rows.has(c) && !this.mergeRows.has(c)) {
|
|
3105
|
+
const u = new bt(
|
|
3088
3106
|
this.context,
|
|
3089
3107
|
this.element,
|
|
3090
3108
|
g.task,
|
|
3091
3109
|
t,
|
|
3092
3110
|
!0
|
|
3093
3111
|
);
|
|
3094
|
-
|
|
3112
|
+
u.create(), this.mergeRows.set(c, u);
|
|
3095
3113
|
}
|
|
3096
3114
|
}
|
|
3097
3115
|
});
|
|
@@ -3169,19 +3187,19 @@ class ct {
|
|
|
3169
3187
|
const t = document.createElement("div");
|
|
3170
3188
|
t.className = "x-gantt-column-resize-handle", t.style.position = "absolute", t.style.top = "0", t.style.right = "0", t.style.width = "5px", t.style.height = "100%", t.style.cursor = "col-resize", t.style.zIndex = "2", this.columnElement.appendChild(t);
|
|
3171
3189
|
let e = 0, i = 0, s = null, n = 0;
|
|
3172
|
-
const o = (
|
|
3173
|
-
|
|
3174
|
-
const g = (
|
|
3175
|
-
document.addEventListener("mousemove", g), document.addEventListener("mouseup",
|
|
3176
|
-
}, r = (
|
|
3177
|
-
if (
|
|
3178
|
-
const g =
|
|
3179
|
-
let x =
|
|
3180
|
-
x = Math.min(
|
|
3181
|
-
},
|
|
3182
|
-
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup",
|
|
3183
|
-
const
|
|
3184
|
-
this.setWidth(
|
|
3190
|
+
const o = (l) => {
|
|
3191
|
+
l.preventDefault(), l.stopPropagation(), e = l.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3192
|
+
const g = (u) => r(u), c = (u) => h(u, g, c);
|
|
3193
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", c), n = e - s.left, this.context.event.emit(S.SHOW_GUIDELINE, n);
|
|
3194
|
+
}, r = (l) => {
|
|
3195
|
+
if (l.preventDefault(), !s) return;
|
|
3196
|
+
const g = l.clientX - e, c = i + g, u = Math.max(50, c), p = e - s.left - i, d = this.root.clientWidth - 20;
|
|
3197
|
+
let x = p + u;
|
|
3198
|
+
x = Math.min(d, x), this.context.event.emit(S.MOVE_GUIDELINE, x);
|
|
3199
|
+
}, h = (l, g, c) => {
|
|
3200
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", c), this.context.event.emit(S.HIDE_GUIDELINE);
|
|
3201
|
+
const u = l.clientX - e, p = Math.max(50, i + u);
|
|
3202
|
+
this.setWidth(p);
|
|
3185
3203
|
};
|
|
3186
3204
|
t.addEventListener("mousedown", o);
|
|
3187
3205
|
}
|
|
@@ -3310,9 +3328,9 @@ class _e {
|
|
|
3310
3328
|
this.tableBody.updateTask(t);
|
|
3311
3329
|
}
|
|
3312
3330
|
listenEvents() {
|
|
3313
|
-
this.context.event.on(
|
|
3331
|
+
this.context.event.on(S.UPDATE_TABLE_HEADER, () => {
|
|
3314
3332
|
this.tableHeader.render();
|
|
3315
|
-
}), this.context.event.on(
|
|
3333
|
+
}), this.context.event.on(S.UPDATE_TABLE_BODY, () => {
|
|
3316
3334
|
this.tableBody.update();
|
|
3317
3335
|
});
|
|
3318
3336
|
}
|
|
@@ -3331,10 +3349,10 @@ class He {
|
|
|
3331
3349
|
a(this, "width", 0);
|
|
3332
3350
|
a(this, "height", 0);
|
|
3333
3351
|
a(this, "offsetX", 0);
|
|
3334
|
-
this.context = t, this.stage = e, this.layer = new
|
|
3352
|
+
this.context = t, this.stage = e, this.layer = new y.Layer(), this.stage.add(this.layer), this.background = new y.Rect({
|
|
3335
3353
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
3336
3354
|
name: "header-background"
|
|
3337
|
-
}), this.layer.add(this.background), this.groupHeader = new
|
|
3355
|
+
}), this.layer.add(this.background), this.groupHeader = new y.Group({ name: "primary-header" }), this.cellHeader = new y.Group({ name: "secondary-header" }), this.layer.add(this.groupHeader), this.layer.add(this.cellHeader), this.resize(this.stage.width()), this.registerEvents();
|
|
3338
3356
|
}
|
|
3339
3357
|
/**
|
|
3340
3358
|
* 调整表头大小
|
|
@@ -3353,11 +3371,11 @@ class He {
|
|
|
3353
3371
|
* 注册事件监听
|
|
3354
3372
|
*/
|
|
3355
3373
|
registerEvents() {
|
|
3356
|
-
this.context.event.on(
|
|
3374
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
3357
3375
|
this.highlightDate(t);
|
|
3358
|
-
}), this.context.event.on(
|
|
3376
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
3359
3377
|
this.unhighlightDate(t);
|
|
3360
|
-
}), this.context.event.on(
|
|
3378
|
+
}), this.context.event.on(S.UPDATE_TASK, (t) => {
|
|
3361
3379
|
this.highlightDate(t.id);
|
|
3362
3380
|
});
|
|
3363
3381
|
}
|
|
@@ -3371,81 +3389,81 @@ class He {
|
|
|
3371
3389
|
* 计算并绘制表头
|
|
3372
3390
|
*/
|
|
3373
3391
|
calculateHeader() {
|
|
3374
|
-
var
|
|
3392
|
+
var l;
|
|
3375
3393
|
this.clearHeader();
|
|
3376
3394
|
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;
|
|
3377
3395
|
this.layer.add(
|
|
3378
|
-
new
|
|
3396
|
+
new y.Line({
|
|
3379
3397
|
points: [0, n, this.width, n],
|
|
3380
3398
|
stroke: o,
|
|
3381
3399
|
strokeWidth: 1
|
|
3382
3400
|
})
|
|
3383
3401
|
), this.layer.add(
|
|
3384
|
-
new
|
|
3402
|
+
new y.Line({
|
|
3385
3403
|
points: [0, this.height, this.width, this.height],
|
|
3386
3404
|
stroke: o,
|
|
3387
3405
|
strokeWidth: 1
|
|
3388
3406
|
})
|
|
3389
3407
|
);
|
|
3390
3408
|
const r = t.getTimeline();
|
|
3391
|
-
let
|
|
3409
|
+
let h = 0;
|
|
3392
3410
|
for (let g = 0; g < r.length; g++) {
|
|
3393
|
-
const
|
|
3394
|
-
if (
|
|
3395
|
-
|
|
3411
|
+
const c = r[g], u = e * (((l = c.children) == null ? void 0 : l.length) ?? 0);
|
|
3412
|
+
if (h + u < i) {
|
|
3413
|
+
h += u;
|
|
3396
3414
|
continue;
|
|
3397
3415
|
}
|
|
3398
|
-
if (
|
|
3416
|
+
if (h > s)
|
|
3399
3417
|
break;
|
|
3400
|
-
const
|
|
3401
|
-
`group-${
|
|
3402
|
-
|
|
3418
|
+
const m = this.createCell(
|
|
3419
|
+
`group-${c.date.format("YYYY-MM-DD")}`,
|
|
3420
|
+
h,
|
|
3403
3421
|
0,
|
|
3404
|
-
|
|
3422
|
+
u,
|
|
3405
3423
|
n,
|
|
3406
3424
|
o,
|
|
3407
|
-
|
|
3425
|
+
c.label
|
|
3408
3426
|
);
|
|
3409
|
-
if (this.groupHeader.add(
|
|
3410
|
-
let
|
|
3411
|
-
for (let x = 0; x <
|
|
3412
|
-
const w =
|
|
3413
|
-
let
|
|
3414
|
-
for (;
|
|
3415
|
-
|
|
3416
|
-
if (x +=
|
|
3417
|
-
let
|
|
3418
|
-
for (; r[g + 1].children[
|
|
3419
|
-
r[g + 1].children[
|
|
3420
|
-
|
|
3427
|
+
if (this.groupHeader.add(m), U(c.children) && c.children.length > 0) {
|
|
3428
|
+
let d = h;
|
|
3429
|
+
for (let x = 0; x < c.children.length; ) {
|
|
3430
|
+
const w = c.children[x];
|
|
3431
|
+
let T = 1;
|
|
3432
|
+
for (; c.children[x + T] && w.label === c.children[x + T].label; )
|
|
3433
|
+
T++;
|
|
3434
|
+
if (x += T, x >= c.children.length && r[g + 1] && r[g + 1].children) {
|
|
3435
|
+
let M = 0;
|
|
3436
|
+
for (; r[g + 1].children[M] && w.label === r[g + 1].children[M].label; )
|
|
3437
|
+
r[g + 1].children[M].hide = !0, M++;
|
|
3438
|
+
M > 0 && (T += M);
|
|
3421
3439
|
}
|
|
3422
|
-
const
|
|
3423
|
-
if (
|
|
3424
|
-
|
|
3440
|
+
const v = e * T;
|
|
3441
|
+
if (d + v < i) {
|
|
3442
|
+
d += v;
|
|
3425
3443
|
continue;
|
|
3426
3444
|
}
|
|
3427
|
-
if (
|
|
3445
|
+
if (d > s)
|
|
3428
3446
|
break;
|
|
3429
|
-
const
|
|
3447
|
+
const O = this.createCell(
|
|
3430
3448
|
`cell-${w.date.format("YYYY-MM-DD")}`,
|
|
3431
|
-
|
|
3449
|
+
d,
|
|
3432
3450
|
n,
|
|
3433
|
-
|
|
3451
|
+
v,
|
|
3434
3452
|
n,
|
|
3435
3453
|
w.hide ? "transparent" : o,
|
|
3436
3454
|
w.hide ? "" : w.label
|
|
3437
3455
|
);
|
|
3438
|
-
this.cellHeader.add(
|
|
3456
|
+
this.cellHeader.add(O), w.hide && O.visible(!1), d += v;
|
|
3439
3457
|
}
|
|
3440
3458
|
}
|
|
3441
|
-
|
|
3459
|
+
h += u;
|
|
3442
3460
|
}
|
|
3443
3461
|
this.layer.batchDraw();
|
|
3444
3462
|
}
|
|
3445
3463
|
createCell(t, e, i, s, n, o, r) {
|
|
3446
|
-
const
|
|
3447
|
-
|
|
3448
|
-
const
|
|
3464
|
+
const h = new y.Group();
|
|
3465
|
+
h.x(e), h.y(i);
|
|
3466
|
+
const l = new y.Rect({
|
|
3449
3467
|
id: t,
|
|
3450
3468
|
x: 0,
|
|
3451
3469
|
y: 0,
|
|
@@ -3454,17 +3472,17 @@ class He {
|
|
|
3454
3472
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
3455
3473
|
name: "header-cell-bg"
|
|
3456
3474
|
});
|
|
3457
|
-
|
|
3475
|
+
h.add(l);
|
|
3458
3476
|
let g = this.context.getOptions().header.fontSize;
|
|
3459
|
-
t.startsWith("cell-") && (this.cellCache.set(t,
|
|
3460
|
-
const
|
|
3477
|
+
t.startsWith("cell-") && (this.cellCache.set(t, l), g -= 2);
|
|
3478
|
+
const c = new y.Line({
|
|
3461
3479
|
points: [s, 0, s, n],
|
|
3462
3480
|
stroke: o,
|
|
3463
3481
|
strokeWidth: 1,
|
|
3464
3482
|
name: "header-cell-right-border"
|
|
3465
3483
|
});
|
|
3466
|
-
|
|
3467
|
-
const
|
|
3484
|
+
h.add(c);
|
|
3485
|
+
const u = new y.Text({
|
|
3468
3486
|
x: 0,
|
|
3469
3487
|
y: 0,
|
|
3470
3488
|
width: s,
|
|
@@ -3480,7 +3498,7 @@ class He {
|
|
|
3480
3498
|
ellipsis: !0,
|
|
3481
3499
|
name: "header-cell-text"
|
|
3482
3500
|
});
|
|
3483
|
-
return
|
|
3501
|
+
return h.add(u), h;
|
|
3484
3502
|
}
|
|
3485
3503
|
/**
|
|
3486
3504
|
* 清除表头内容
|
|
@@ -3517,17 +3535,17 @@ class He {
|
|
|
3517
3535
|
), s = this.cellCache.get(
|
|
3518
3536
|
`cell-${(r = e == null ? void 0 : e.endTime) == null ? void 0 : r.format("YYYY-MM-DD")}`
|
|
3519
3537
|
), n = this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor;
|
|
3520
|
-
n && (this.cellCache.forEach((
|
|
3521
|
-
new
|
|
3522
|
-
node:
|
|
3538
|
+
n && (this.cellCache.forEach((h) => {
|
|
3539
|
+
new y.Tween({
|
|
3540
|
+
node: h,
|
|
3523
3541
|
fill: n,
|
|
3524
3542
|
duration: 0.02
|
|
3525
3543
|
}).play();
|
|
3526
|
-
}), t === "in" && (i && new
|
|
3544
|
+
}), t === "in" && (i && new y.Tween({
|
|
3527
3545
|
node: i,
|
|
3528
3546
|
fill: F(n).brighten(30).toHex(),
|
|
3529
3547
|
duration: 0.02
|
|
3530
|
-
}).play(), s && new
|
|
3548
|
+
}).play(), s && new y.Tween({
|
|
3531
3549
|
node: s,
|
|
3532
3550
|
fill: F(n).brighten(30).toHex(),
|
|
3533
3551
|
duration: 0
|
|
@@ -3544,7 +3562,7 @@ class Ae {
|
|
|
3544
3562
|
a(this, "height", 0);
|
|
3545
3563
|
a(this, "offsetX", 0);
|
|
3546
3564
|
a(this, "offsetY", 0);
|
|
3547
|
-
this.context = t, this.layer = e, this.verticalLines = new
|
|
3565
|
+
this.context = t, this.layer = e, this.verticalLines = new y.Group({ name: "vertical-grid-lines" }), this.horizontalLines = new y.Group({ name: "horizontal-grid-lines" }), this.layer.add(this.verticalLines), this.layer.add(this.horizontalLines);
|
|
3548
3566
|
}
|
|
3549
3567
|
/**
|
|
3550
3568
|
* 调整网格大小
|
|
@@ -3578,10 +3596,10 @@ class Ae {
|
|
|
3578
3596
|
const t = this.context.getOptions().header.height, e = this.width, i = this.context.store.getTimeAxis().getCellWidth(), s = this.context.getOptions().row.height, n = this.context.store.getDataManager().getVisibleSize(), o = n * s, r = Math.max(
|
|
3579
3597
|
0,
|
|
3580
3598
|
Math.floor(-this.offsetX / i) - 2
|
|
3581
|
-
),
|
|
3599
|
+
), h = Math.min(
|
|
3582
3600
|
this.context.store.getTimeAxis().getCellCount(),
|
|
3583
3601
|
Math.ceil((-this.offsetX + this.width) / i) + 2
|
|
3584
|
-
),
|
|
3602
|
+
), l = Math.max(
|
|
3585
3603
|
0,
|
|
3586
3604
|
Math.floor((-this.offsetY + t) / s) - 2
|
|
3587
3605
|
), g = Math.min(
|
|
@@ -3589,23 +3607,23 @@ class Ae {
|
|
|
3589
3607
|
Math.ceil((-this.offsetY + this.height) / s) + 2
|
|
3590
3608
|
);
|
|
3591
3609
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
3592
|
-
for (let
|
|
3593
|
-
const
|
|
3594
|
-
points: [
|
|
3610
|
+
for (let c = r; c <= h; c++) {
|
|
3611
|
+
const u = c * i, p = new y.Line({
|
|
3612
|
+
points: [u, t, u, o + t],
|
|
3595
3613
|
stroke: this.context.getOptions().border.color,
|
|
3596
3614
|
strokeWidth: 0.5,
|
|
3597
3615
|
name: "vertical-grid-line"
|
|
3598
3616
|
});
|
|
3599
|
-
this.verticalLines.add(
|
|
3617
|
+
this.verticalLines.add(p);
|
|
3600
3618
|
}
|
|
3601
|
-
for (let
|
|
3602
|
-
const
|
|
3603
|
-
points: [0,
|
|
3619
|
+
for (let c = l; c <= g; c++) {
|
|
3620
|
+
const u = c * s + t, p = new y.Line({
|
|
3621
|
+
points: [0, u, Math.max(this.width, e), u],
|
|
3604
3622
|
stroke: this.context.getOptions().border.color,
|
|
3605
3623
|
strokeWidth: 0.5,
|
|
3606
3624
|
name: "horizontal-grid-line"
|
|
3607
3625
|
});
|
|
3608
|
-
this.horizontalLines.add(
|
|
3626
|
+
this.horizontalLines.add(p);
|
|
3609
3627
|
}
|
|
3610
3628
|
}
|
|
3611
3629
|
/**
|
|
@@ -3645,7 +3663,7 @@ class Ie {
|
|
|
3645
3663
|
a(this, "draggingDirection", "none");
|
|
3646
3664
|
// 记录拖拽时的原始数据
|
|
3647
3665
|
a(this, "oldTasks", []);
|
|
3648
|
-
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new
|
|
3666
|
+
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new y.Group({
|
|
3649
3667
|
x: e,
|
|
3650
3668
|
y: i,
|
|
3651
3669
|
id: `chart-slider-bar-${s.id}`
|
|
@@ -3662,169 +3680,169 @@ class Ie {
|
|
|
3662
3680
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
3663
3681
|
}
|
|
3664
3682
|
render() {
|
|
3665
|
-
var
|
|
3683
|
+
var m, d, x, w, T, v, b, O, M, E, k, L, A;
|
|
3666
3684
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
3667
3685
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
3668
|
-
|
|
3686
|
+
D.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
3669
3687
|
return;
|
|
3670
3688
|
}
|
|
3671
3689
|
const t = this.context.getOptions().row.height, e = st(
|
|
3672
3690
|
this.unpackFunc(this.context.getOptions().bar.height),
|
|
3673
3691
|
t
|
|
3674
|
-
), 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,
|
|
3692
|
+
), 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, h = nt(
|
|
3675
3693
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
3676
|
-
),
|
|
3677
|
-
this.slider || (this.slider = new
|
|
3694
|
+
), l = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", g = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, c = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, u = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
3695
|
+
this.slider || (this.slider = new y.Group({
|
|
3678
3696
|
dragBoundFunc: (_) => {
|
|
3679
|
-
let
|
|
3697
|
+
let C = 0, I = Math.abs(this.rowWidth - this.slider.width());
|
|
3680
3698
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
3681
3699
|
if (this.task.parent.startTime) {
|
|
3682
3700
|
const $ = this.task.parent.startTime;
|
|
3683
|
-
|
|
3701
|
+
C = this.context.store.getTimeAxis().getTimeLeft($);
|
|
3684
3702
|
}
|
|
3685
3703
|
if (this.task.parent.endTime) {
|
|
3686
|
-
const $ = this.task.parent.endTime,
|
|
3687
|
-
|
|
3704
|
+
const $ = this.task.parent.endTime, G = this.context.store.getTimeAxis().getTimeLeft($);
|
|
3705
|
+
I = Math.abs(G - this.slider.width());
|
|
3688
3706
|
}
|
|
3689
3707
|
}
|
|
3690
3708
|
return {
|
|
3691
|
-
x:
|
|
3709
|
+
x: R(_.x, C, I),
|
|
3692
3710
|
y: this.y + i + this.offsetY
|
|
3693
3711
|
};
|
|
3694
3712
|
}
|
|
3695
3713
|
})), this.slider.position({ x: s, y: i }), this.slider.size({ width: o, height: e });
|
|
3696
|
-
const
|
|
3697
|
-
if (this.slider.draggable(
|
|
3698
|
-
|
|
3699
|
-
shadowColor: F(
|
|
3714
|
+
const p = !!this.unpackFunc(this.context.getOptions().bar.move.enabled) && (this.task.isSummary() ? this.context.getOptions().summary.move.enabled : !0);
|
|
3715
|
+
if (this.slider.draggable(p), this.slider.on("mouseover", (_) => {
|
|
3716
|
+
p && !this.isDragging && (_.target.getStage().container().style.cursor = "grab"), this.handleBarHighlight({
|
|
3717
|
+
shadowColor: F(l).alpha(F(l).alpha() + 0.1).toHex(),
|
|
3700
3718
|
shadowBlur: Math.max((g || 1) * 2, 4),
|
|
3701
|
-
shadowOffsetX: Math.max(
|
|
3702
|
-
shadowOffsetY: Math.max((
|
|
3703
|
-
}), this.context.event.emit(
|
|
3719
|
+
shadowOffsetX: Math.max(c || 1, 2),
|
|
3720
|
+
shadowOffsetY: Math.max((u || 1) * 1.5, 4)
|
|
3721
|
+
}), this.context.event.emit(S.SLIDER_HOVER, _.evt, this.task);
|
|
3704
3722
|
}), this.slider.on("mouseout", (_) => {
|
|
3705
|
-
|
|
3706
|
-
shadowColor:
|
|
3723
|
+
p && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
3724
|
+
shadowColor: l,
|
|
3707
3725
|
shadowBlur: g,
|
|
3708
|
-
shadowOffsetX:
|
|
3709
|
-
shadowOffsetY:
|
|
3710
|
-
}), this.context.event.emit(
|
|
3726
|
+
shadowOffsetX: c,
|
|
3727
|
+
shadowOffsetY: u
|
|
3728
|
+
}), this.context.event.emit(S.SLIDER_LEAVE, _.evt, this.task);
|
|
3711
3729
|
}), this.task.isMilestone()) {
|
|
3712
3730
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
3713
|
-
const _ = this.unpackFunc(this.context.getOptions().milestone.size),
|
|
3731
|
+
const _ = this.unpackFunc(this.context.getOptions().milestone.size), C = Math.min(_ || e, t / 2), I = this.unpackFunc(this.context.getOptions().milestone.color) || r, B = this.unpackFunc(this.context.getOptions().milestone.border.color), $ = this.unpackFunc(this.context.getOptions().milestone.border.width), G = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
3714
3732
|
if (!this.sliderBar) {
|
|
3715
|
-
switch (
|
|
3733
|
+
switch (G) {
|
|
3716
3734
|
case "triangle":
|
|
3717
|
-
this.sliderBar = new
|
|
3735
|
+
this.sliderBar = new y.RegularPolygon({
|
|
3718
3736
|
sides: 3,
|
|
3719
|
-
radius:
|
|
3737
|
+
radius: C,
|
|
3720
3738
|
rotation: 0,
|
|
3721
|
-
fill:
|
|
3739
|
+
fill: I,
|
|
3722
3740
|
stroke: B,
|
|
3723
3741
|
strokeWidth: $,
|
|
3724
|
-
y:
|
|
3742
|
+
y: C / 3 * 2
|
|
3725
3743
|
// 居中
|
|
3726
3744
|
});
|
|
3727
3745
|
break;
|
|
3728
3746
|
case "circle":
|
|
3729
|
-
this.sliderBar = new
|
|
3730
|
-
radius:
|
|
3731
|
-
fill:
|
|
3747
|
+
this.sliderBar = new y.Circle({
|
|
3748
|
+
radius: C,
|
|
3749
|
+
fill: I,
|
|
3732
3750
|
stroke: B,
|
|
3733
3751
|
strokeWidth: $,
|
|
3734
|
-
y:
|
|
3752
|
+
y: C / 2
|
|
3735
3753
|
// 居中
|
|
3736
3754
|
});
|
|
3737
3755
|
break;
|
|
3738
3756
|
case "star":
|
|
3739
|
-
this.sliderBar = new
|
|
3757
|
+
this.sliderBar = new y.Star({
|
|
3740
3758
|
numPoints: 5,
|
|
3741
|
-
innerRadius:
|
|
3742
|
-
outerRadius:
|
|
3743
|
-
fill:
|
|
3759
|
+
innerRadius: C / 2,
|
|
3760
|
+
outerRadius: C,
|
|
3761
|
+
fill: I,
|
|
3744
3762
|
stroke: B,
|
|
3745
3763
|
strokeWidth: $,
|
|
3746
|
-
y:
|
|
3764
|
+
y: C / 2
|
|
3747
3765
|
// 居中
|
|
3748
3766
|
});
|
|
3749
3767
|
break;
|
|
3750
3768
|
case "diamond":
|
|
3751
3769
|
default:
|
|
3752
|
-
this.sliderBar = new
|
|
3770
|
+
this.sliderBar = new y.RegularPolygon({
|
|
3753
3771
|
sides: 4,
|
|
3754
|
-
radius:
|
|
3772
|
+
radius: C,
|
|
3755
3773
|
rotation: 0,
|
|
3756
|
-
fill:
|
|
3774
|
+
fill: I,
|
|
3757
3775
|
stroke: B,
|
|
3758
3776
|
strokeWidth: $,
|
|
3759
|
-
y:
|
|
3777
|
+
y: C / 2
|
|
3760
3778
|
// 居中
|
|
3761
3779
|
});
|
|
3762
3780
|
}
|
|
3763
3781
|
if (this.slider.add(this.sliderBar), this.unpackFunc(this.context.getOptions().milestone.label.show)) {
|
|
3764
|
-
const W = this.unpackFunc(this.context.getOptions().milestone.label.text),
|
|
3782
|
+
const W = this.unpackFunc(this.context.getOptions().milestone.label.text), z = this.unpackFunc(this.context.getOptions().milestone.label.position), K = this.unpackFunc(this.context.getOptions().milestone.label.fontSize), $t = this.unpackFunc(this.context.getOptions().milestone.label.fontFamily), Ft = this.unpackFunc(this.context.getOptions().milestone.label.color), et = new y.Text({
|
|
3765
3783
|
height: e,
|
|
3766
3784
|
text: W,
|
|
3767
|
-
fill: Ft ||
|
|
3785
|
+
fill: Ft || I,
|
|
3768
3786
|
fontSize: K,
|
|
3769
3787
|
fontFamily: $t
|
|
3770
3788
|
}), rt = et.measureSize(W);
|
|
3771
3789
|
et.width(rt.width);
|
|
3772
|
-
const
|
|
3773
|
-
switch (
|
|
3790
|
+
const V = { x: 0, y: 0 };
|
|
3791
|
+
switch (z) {
|
|
3774
3792
|
case "top-left":
|
|
3775
|
-
|
|
3793
|
+
V.x = -(12 + rt.width), V.y = -8;
|
|
3776
3794
|
break;
|
|
3777
3795
|
case "bottom-left":
|
|
3778
|
-
|
|
3796
|
+
V.x = -(12 + rt.width), V.y = 10;
|
|
3779
3797
|
break;
|
|
3780
3798
|
case "bottom-right":
|
|
3781
|
-
|
|
3799
|
+
V.x = 12, V.y = 10;
|
|
3782
3800
|
break;
|
|
3783
3801
|
case "top-right":
|
|
3784
3802
|
default:
|
|
3785
|
-
|
|
3803
|
+
V.x = 12, V.y = -8;
|
|
3786
3804
|
break;
|
|
3787
3805
|
}
|
|
3788
|
-
et.setAttrs(
|
|
3806
|
+
et.setAttrs(V), this.slider.add(et);
|
|
3789
3807
|
}
|
|
3790
3808
|
}
|
|
3791
3809
|
this.sliderType = "milestone";
|
|
3792
3810
|
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
3793
3811
|
this.sliderBar && this.sliderType !== "summary" && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
3794
|
-
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r,
|
|
3795
|
-
sceneFunc: (
|
|
3796
|
-
const
|
|
3797
|
-
|
|
3812
|
+
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, C = t * 0.2, I = t * 0.3, B = ($) => new y.Shape({
|
|
3813
|
+
sceneFunc: (G, W) => {
|
|
3814
|
+
const z = I * 0.5;
|
|
3815
|
+
G.beginPath(), G.moveTo(0, (t - C) / 2), G.lineTo(z, (t - C) / 2), G.lineTo(z, (t - C) / 2 + C), G.lineTo(0, (t - C) / 2 + C + I), G.lineTo(0, (t - C) / 2), G.rect(z, (t - C) / 2, $ - 2 * z, C), G.moveTo($ - z, (t - C) / 2), G.lineTo($, (t - C) / 2), G.lineTo($, (t - C) / 2 + C + I), G.lineTo($ - z, (t - C) / 2 + C), G.lineTo($ - z, (t - C) / 2), G.fillStrokeShape(W);
|
|
3798
3816
|
},
|
|
3799
3817
|
width: $,
|
|
3800
3818
|
fill: _,
|
|
3801
|
-
shadowColor:
|
|
3819
|
+
shadowColor: l,
|
|
3802
3820
|
shadowBlur: g,
|
|
3803
|
-
shadowOffsetX:
|
|
3804
|
-
shadowOffsetY:
|
|
3805
|
-
y: -(
|
|
3821
|
+
shadowOffsetX: c,
|
|
3822
|
+
shadowOffsetY: u,
|
|
3823
|
+
y: -(I + C) / 2 - i / 2
|
|
3806
3824
|
});
|
|
3807
3825
|
!this.sliderBar || this.sliderBar.width() !== o ? (this.sliderBar && this.sliderBar.destroy(), this.sliderBar = B(o), this.slider.add(this.sliderBar)) : this.sliderBar.setAttrs({
|
|
3808
3826
|
fill: _,
|
|
3809
|
-
shadowColor:
|
|
3827
|
+
shadowColor: l,
|
|
3810
3828
|
shadowBlur: g,
|
|
3811
|
-
shadowOffsetX:
|
|
3812
|
-
shadowOffsetY:
|
|
3829
|
+
shadowOffsetX: c,
|
|
3830
|
+
shadowOffsetY: u
|
|
3813
3831
|
}), this.sliderType = "summary";
|
|
3814
3832
|
} else {
|
|
3815
|
-
this.sliderBar && this.sliderType !== "bar" && (this.slider.destroyChildren(), this.sliderBar = null), this.sliderBar || (this.sliderBar = new
|
|
3833
|
+
this.sliderBar && this.sliderType !== "bar" && (this.slider.destroyChildren(), this.sliderBar = null), this.sliderBar || (this.sliderBar = new y.Rect({
|
|
3816
3834
|
x: 0,
|
|
3817
3835
|
y: 0
|
|
3818
3836
|
}), this.slider.add(this.sliderBar), this.sliderType = "bar"), this.sliderBar.setAttrs({
|
|
3819
3837
|
width: o,
|
|
3820
3838
|
height: e,
|
|
3821
3839
|
fill: r,
|
|
3822
|
-
cornerRadius:
|
|
3840
|
+
cornerRadius: h
|
|
3823
3841
|
}), this.renderProgress(o, e);
|
|
3824
|
-
const _ = (
|
|
3825
|
-
if (!!this.unpackFunc((
|
|
3842
|
+
const _ = (m = this.context.getOptions().bar.move.single) == null ? void 0 : m.icon, C = (d = this.context.getOptions().bar.move.single) == null ? void 0 : d.backgroundColor, I = C ? F(C).alpha(((x = this.context.getOptions().bar.move.single) == null ? void 0 : x.opacity) ?? 1).toHex() : F(r).brighten(30 * (this.unpackFunc((w = this.context.getOptions().bar.progress) == null ? void 0 : w.show) ? -1 : 1)).alpha(((T = this.context.getOptions().bar.move.single) == null ? void 0 : T.opacity) ?? 1).toHex();
|
|
3843
|
+
if (!!this.unpackFunc((v = this.context.getOptions().bar.move.single) == null ? void 0 : v.left)) {
|
|
3826
3844
|
if (!this.leftHandleGroup) {
|
|
3827
|
-
this.leftHandleGroup = new
|
|
3845
|
+
this.leftHandleGroup = new y.Group({
|
|
3828
3846
|
x: 0,
|
|
3829
3847
|
y: 0,
|
|
3830
3848
|
opacity: 0
|
|
@@ -3837,37 +3855,37 @@ class Ie {
|
|
|
3837
3855
|
}), this.leftHandleGroup.on("mouseout", (W) => {
|
|
3838
3856
|
this.isDragging || (W.target.getStage().container().style.cursor = "default");
|
|
3839
3857
|
});
|
|
3840
|
-
const
|
|
3858
|
+
const G = new y.Rect({
|
|
3841
3859
|
x: 0,
|
|
3842
3860
|
y: 0
|
|
3843
3861
|
});
|
|
3844
|
-
this.leftHandleGroup.add(
|
|
3862
|
+
this.leftHandleGroup.add(G), _ !== null && xt(_ || vt, this.handlerWidth, e).then((W) => {
|
|
3845
3863
|
var K;
|
|
3846
|
-
const
|
|
3864
|
+
const z = new y.Image({
|
|
3847
3865
|
image: W,
|
|
3848
3866
|
x: 0,
|
|
3849
3867
|
y: (e - this.handlerWidth) / 2,
|
|
3850
3868
|
width: this.handlerWidth,
|
|
3851
3869
|
height: this.handlerWidth
|
|
3852
3870
|
});
|
|
3853
|
-
(K = this.leftHandleGroup) == null || K.add(
|
|
3871
|
+
(K = this.leftHandleGroup) == null || K.add(z);
|
|
3854
3872
|
});
|
|
3855
3873
|
}
|
|
3856
|
-
(
|
|
3874
|
+
(b = this.leftHandleGroup.findOne("Rect")) == null || b.setAttrs({
|
|
3857
3875
|
width: this.handlerWidth,
|
|
3858
3876
|
height: e,
|
|
3859
|
-
fill:
|
|
3860
|
-
cornerRadius: [
|
|
3861
|
-
}), (
|
|
3877
|
+
fill: I,
|
|
3878
|
+
cornerRadius: [h[0], 0, 0, h[3]]
|
|
3879
|
+
}), (O = this.leftHandleGroup.findOne("Image")) == null || O.setAttrs({
|
|
3862
3880
|
x: 0,
|
|
3863
3881
|
y: (e - this.handlerWidth) / 2,
|
|
3864
3882
|
width: this.handlerWidth,
|
|
3865
3883
|
height: this.handlerWidth
|
|
3866
3884
|
});
|
|
3867
3885
|
} else this.leftHandleGroup && (this.leftHandleGroup.remove(), this.leftHandleGroup = null);
|
|
3868
|
-
if (!!this.unpackFunc((
|
|
3886
|
+
if (!!this.unpackFunc((M = this.context.getOptions().bar.move.single) == null ? void 0 : M.right)) {
|
|
3869
3887
|
if (!this.rightHandleGroup) {
|
|
3870
|
-
this.rightHandleGroup = new
|
|
3888
|
+
this.rightHandleGroup = new y.Group({
|
|
3871
3889
|
x: 0,
|
|
3872
3890
|
y: 0,
|
|
3873
3891
|
opacity: 0
|
|
@@ -3880,47 +3898,47 @@ class Ie {
|
|
|
3880
3898
|
}), this.rightHandleGroup.on("mouseout", (W) => {
|
|
3881
3899
|
this.isDragging || (W.target.getStage().container().style.cursor = "default");
|
|
3882
3900
|
});
|
|
3883
|
-
const
|
|
3901
|
+
const G = new y.Rect({
|
|
3884
3902
|
x: 0,
|
|
3885
3903
|
y: 0
|
|
3886
3904
|
});
|
|
3887
|
-
this.rightHandleGroup.add(
|
|
3905
|
+
this.rightHandleGroup.add(G), _ !== null && xt(_ || vt, this.handlerWidth, e).then((W) => {
|
|
3888
3906
|
var K;
|
|
3889
|
-
const
|
|
3907
|
+
const z = new y.Image({
|
|
3890
3908
|
image: W,
|
|
3891
3909
|
x: o - this.handlerWidth,
|
|
3892
3910
|
y: (e - this.handlerWidth) / 2,
|
|
3893
3911
|
width: this.handlerWidth,
|
|
3894
3912
|
height: this.handlerWidth
|
|
3895
3913
|
});
|
|
3896
|
-
(K = this.rightHandleGroup) == null || K.add(
|
|
3914
|
+
(K = this.rightHandleGroup) == null || K.add(z);
|
|
3897
3915
|
});
|
|
3898
3916
|
}
|
|
3899
|
-
(
|
|
3917
|
+
(E = this.rightHandleGroup.findOne("Rect")) == null || E.setAttrs({
|
|
3900
3918
|
x: o - this.handlerWidth,
|
|
3901
3919
|
width: this.handlerWidth,
|
|
3902
3920
|
height: e,
|
|
3903
|
-
fill:
|
|
3904
|
-
cornerRadius: [0,
|
|
3905
|
-
}), (
|
|
3921
|
+
fill: I,
|
|
3922
|
+
cornerRadius: [0, h[1], h[2], 0]
|
|
3923
|
+
}), (k = this.rightHandleGroup.findOne("Image")) == null || k.setAttrs({
|
|
3906
3924
|
x: o - this.handlerWidth,
|
|
3907
3925
|
y: (e - this.handlerWidth) / 2,
|
|
3908
3926
|
width: this.handlerWidth,
|
|
3909
3927
|
height: this.handlerWidth
|
|
3910
3928
|
});
|
|
3911
3929
|
} else this.rightHandleGroup && (this.rightHandleGroup.remove(), this.rightHandleGroup = null);
|
|
3912
|
-
this.renderText(o, e), (
|
|
3930
|
+
this.renderText(o, e), (L = this.leftHandleGroup) == null || L.moveToTop(), (A = this.rightHandleGroup) == null || A.moveToTop();
|
|
3913
3931
|
}
|
|
3914
3932
|
this.isDragging || this.sliderBar.setAttrs({
|
|
3915
|
-
shadowColor:
|
|
3933
|
+
shadowColor: l,
|
|
3916
3934
|
shadowBlur: g,
|
|
3917
|
-
shadowOffsetX:
|
|
3918
|
-
shadowOffsetY:
|
|
3935
|
+
shadowOffsetX: c,
|
|
3936
|
+
shadowOffsetY: u
|
|
3919
3937
|
}), this.sliderGroup.add(this.slider), this.unpackFunc(this.context.getOptions().bar.show) === !1 ? this.sliderGroup.hide() : this.sliderGroup.show();
|
|
3920
3938
|
}
|
|
3921
3939
|
renderText(t, e) {
|
|
3922
3940
|
const i = `chart-slider-text-${this.task.id}`, s = () => {
|
|
3923
|
-
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((
|
|
3941
|
+
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((h) => h.remove());
|
|
3924
3942
|
};
|
|
3925
3943
|
if (!this.context.getOptions().bar.field && !this.context.getOptions().bar.label) {
|
|
3926
3944
|
s();
|
|
@@ -3931,7 +3949,7 @@ class Ie {
|
|
|
3931
3949
|
n ? o = this.unpackFunc(n) : this.context.getOptions().bar.field && (o = this.task.getField(this.context.getOptions().bar.field)), s();
|
|
3932
3950
|
const r = t - (this.leftHandleGroup ? this.handlerWidth : 0) - (this.rightHandleGroup ? this.handlerWidth : 0);
|
|
3933
3951
|
if (r > 20) {
|
|
3934
|
-
const
|
|
3952
|
+
const h = new y.Text({
|
|
3935
3953
|
id: i,
|
|
3936
3954
|
x: this.leftHandleGroup ? 10 : 0,
|
|
3937
3955
|
y: 0,
|
|
@@ -3946,66 +3964,66 @@ class Ie {
|
|
|
3946
3964
|
verticalAlign: this.unpackFunc(this.context.getOptions().bar.verticalAlign) || "middle",
|
|
3947
3965
|
ellipsis: !0
|
|
3948
3966
|
});
|
|
3949
|
-
this.slider.add(
|
|
3967
|
+
this.slider.add(h);
|
|
3950
3968
|
}
|
|
3951
3969
|
}
|
|
3952
3970
|
renderProgress(t, e) {
|
|
3953
|
-
var i, s, n, o, r,
|
|
3971
|
+
var i, s, n, o, r, h, l, g, c, u, p, m;
|
|
3954
3972
|
if (!this.unpackFunc((i = this.context.getOptions().bar.progress) == null ? void 0 : i.show)) {
|
|
3955
3973
|
this.progressGroup && (this.progressGroup.destroy(), this.progressGroup = null);
|
|
3956
3974
|
return;
|
|
3957
3975
|
}
|
|
3958
3976
|
if (this.task.progress) {
|
|
3959
|
-
const
|
|
3977
|
+
const d = jt(
|
|
3960
3978
|
this.task.progress,
|
|
3961
3979
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
3962
3980
|
);
|
|
3963
|
-
if (
|
|
3981
|
+
if (d === 0) return;
|
|
3964
3982
|
const x = this.unpackFunc(
|
|
3965
3983
|
this.context.getOptions().bar.backgroundColor
|
|
3966
|
-
) || this.context.getOptions().primaryColor, w = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || F(x).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(),
|
|
3984
|
+
) || this.context.getOptions().primaryColor, w = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || F(x).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), T = nt(
|
|
3967
3985
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
3968
|
-
),
|
|
3986
|
+
), v = nt(
|
|
3969
3987
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
3970
3988
|
2
|
|
3971
3989
|
// 默认 2
|
|
3972
3990
|
);
|
|
3973
|
-
|
|
3974
|
-
const
|
|
3975
|
-
this.progressGroup ? (this.progressGroup.width(
|
|
3991
|
+
v[0] = T[0], v[3] = T[3], d === 1 && (v[1] = T[1], v[2] = T[2]);
|
|
3992
|
+
const b = t * d;
|
|
3993
|
+
this.progressGroup ? (this.progressGroup.width(b), this.progressGroup.destroyChildren()) : (this.progressGroup = new y.Group({
|
|
3976
3994
|
x: 0,
|
|
3977
3995
|
y: 0,
|
|
3978
|
-
width:
|
|
3996
|
+
width: b,
|
|
3979
3997
|
height: e,
|
|
3980
3998
|
listening: !1
|
|
3981
3999
|
}), this.slider.add(this.progressGroup));
|
|
3982
|
-
const
|
|
4000
|
+
const O = new y.Rect({
|
|
3983
4001
|
x: 0,
|
|
3984
4002
|
y: 0,
|
|
3985
|
-
width:
|
|
4003
|
+
width: b,
|
|
3986
4004
|
height: e,
|
|
3987
4005
|
fill: w,
|
|
3988
|
-
cornerRadius:
|
|
3989
|
-
opacity: this.unpackFunc((
|
|
4006
|
+
cornerRadius: v,
|
|
4007
|
+
opacity: this.unpackFunc((h = this.context.getOptions().bar.progress) == null ? void 0 : h.opacity)
|
|
3990
4008
|
});
|
|
3991
|
-
this.progressGroup.add(
|
|
3992
|
-
const
|
|
3993
|
-
|
|
3994
|
-
(
|
|
3995
|
-
)}%`,
|
|
4009
|
+
this.progressGroup.add(O);
|
|
4010
|
+
const M = `${lt(
|
|
4011
|
+
d * 100,
|
|
4012
|
+
(l = this.context.getOptions().bar.progress) == null ? void 0 : l.decimal
|
|
4013
|
+
)}%`, E = new y.Text().measureSize(M).width, k = this.unpackFunc((g = this.context.getOptions().bar.progress) == null ? void 0 : g.textAlign), L = new y.Text({
|
|
3996
4014
|
x: 0,
|
|
3997
|
-
y:
|
|
3998
|
-
width:
|
|
4015
|
+
y: k === "top" ? -e : 0,
|
|
4016
|
+
width: k === "right" ? b + E : Math.max(b, E),
|
|
3999
4017
|
height: e,
|
|
4000
|
-
fill: this.unpackFunc((
|
|
4001
|
-
text:
|
|
4002
|
-
fontSize: this.unpackFunc((
|
|
4003
|
-
fontStyle: this.unpackFunc((
|
|
4018
|
+
fill: this.unpackFunc((c = this.context.getOptions().bar.progress) == null ? void 0 : c.color) || F("#000000").mix(w, 50).alpha(0.7).toHex(),
|
|
4019
|
+
text: M,
|
|
4020
|
+
fontSize: this.unpackFunc((u = this.context.getOptions().bar.progress) == null ? void 0 : u.fontSize) || 10,
|
|
4021
|
+
fontStyle: this.unpackFunc((p = this.context.getOptions().bar.progress) == null ? void 0 : p.fontStyle) || "italic",
|
|
4004
4022
|
fontFamily: "Arial",
|
|
4005
|
-
verticalAlign:
|
|
4023
|
+
verticalAlign: k === "top" ? "bottom" : "middle",
|
|
4006
4024
|
align: "right"
|
|
4007
4025
|
});
|
|
4008
|
-
(
|
|
4026
|
+
(m = this.progressGroup) == null || m.add(L);
|
|
4009
4027
|
}
|
|
4010
4028
|
}
|
|
4011
4029
|
// 绑定事件,包括拖拽和边缘检测
|
|
@@ -4019,11 +4037,11 @@ class Ie {
|
|
|
4019
4037
|
const e = t.target.getStage();
|
|
4020
4038
|
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
4021
4039
|
}), this.slider.on("click", (t) => {
|
|
4022
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
4040
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(S.SLIDER_CLICK, t.evt, this.task));
|
|
4023
4041
|
}), this.slider.on("contextmenu", (t) => {
|
|
4024
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
4042
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(S.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
4025
4043
|
}), this.slider.on("dblclick", (t) => {
|
|
4026
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
4044
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(S.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
4027
4045
|
}));
|
|
4028
4046
|
}
|
|
4029
4047
|
/**
|
|
@@ -4035,18 +4053,18 @@ class Ie {
|
|
|
4035
4053
|
}
|
|
4036
4054
|
handleDragStart(t) {
|
|
4037
4055
|
const e = t.target.getStage();
|
|
4038
|
-
e && (this.isDragging = !0, this.oldTasks = [], this.context.event.emit(
|
|
4056
|
+
e && (this.isDragging = !0, this.oldTasks = [], this.context.event.emit(S.SLIDER_MOVING, !0), e.container().style.cursor = "grabbing", this.handleMove(t, e));
|
|
4039
4057
|
}
|
|
4040
4058
|
handleDragMove(t) {
|
|
4041
4059
|
if (!this.isDragging) return;
|
|
4042
4060
|
if (t.evt.movementX > 0 ? this.draggingDirection = "right" : t.evt.movementX < 0 && (this.draggingDirection = "left"), !!this.context.getOptions().bar.move.byUnit) {
|
|
4043
|
-
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n =
|
|
4061
|
+
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = mt(i, s);
|
|
4044
4062
|
t.target.x(n);
|
|
4045
4063
|
}
|
|
4046
4064
|
}
|
|
4047
4065
|
handleDragEnd(t) {
|
|
4048
4066
|
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
4049
|
-
|
|
4067
|
+
S.TASK_DRAG_END,
|
|
4050
4068
|
this.task,
|
|
4051
4069
|
this.oldTasks
|
|
4052
4070
|
), this.oldTasks = []);
|
|
@@ -4056,41 +4074,41 @@ class Ie {
|
|
|
4056
4074
|
if (i) {
|
|
4057
4075
|
const s = this.context.getOptions().row.height, n = this.y + this.offsetY, o = n + s;
|
|
4058
4076
|
if (i.y < n || i.y > o) {
|
|
4059
|
-
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)",
|
|
4077
|
+
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", h = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, l = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, g = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4060
4078
|
this.handleBarHighlight({
|
|
4061
4079
|
shadowColor: r,
|
|
4062
|
-
shadowBlur:
|
|
4063
|
-
shadowOffsetX:
|
|
4080
|
+
shadowBlur: h,
|
|
4081
|
+
shadowOffsetX: l,
|
|
4064
4082
|
shadowOffsetY: g
|
|
4065
4083
|
}), this.handleResizeHighlight(0), e.container().style.cursor = "default";
|
|
4066
4084
|
}
|
|
4067
4085
|
}
|
|
4068
4086
|
}
|
|
4069
|
-
this.context.event.emit(
|
|
4087
|
+
this.context.event.emit(S.SLIDER_MOVING, !1);
|
|
4070
4088
|
}
|
|
4071
4089
|
handleMove(t, e) {
|
|
4072
4090
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth();
|
|
4073
4091
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4074
|
-
const r = t.target.width(),
|
|
4075
|
-
if (
|
|
4092
|
+
const r = t.target.width(), h = t.target.x() - this.offsetX, l = h + r, g = -this.offsetX, c = g + i, u = h <= g - this.offsetX + this.EDGE_THRESHOLD, p = l >= c - this.offsetX - this.EDGE_THRESHOLD;
|
|
4093
|
+
if (u)
|
|
4076
4094
|
if (g <= 0)
|
|
4077
4095
|
t.target.x(0), this.stopAutoScroll(), s || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4078
4096
|
else if (this.draggingDirection === "left") {
|
|
4079
|
-
const
|
|
4080
|
-
this.startAutoScroll(
|
|
4081
|
-
t.target.x(t.target.x() +
|
|
4097
|
+
const m = n ? -o : -this.SCROLL_STEP;
|
|
4098
|
+
this.startAutoScroll(m, n, () => {
|
|
4099
|
+
t.target.x(t.target.x() + m);
|
|
4082
4100
|
});
|
|
4083
4101
|
} else
|
|
4084
4102
|
this.stopAutoScroll();
|
|
4085
|
-
else if (
|
|
4086
|
-
if (
|
|
4103
|
+
else if (p)
|
|
4104
|
+
if (c >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4087
4105
|
t.target.x(
|
|
4088
4106
|
this.context.store.getTimeAxis().getTotalWidth() - r
|
|
4089
4107
|
), this.stopAutoScroll(), s || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
4090
4108
|
else if (this.draggingDirection === "right") {
|
|
4091
|
-
const
|
|
4092
|
-
this.startAutoScroll(
|
|
4093
|
-
t.target.x(t.target.x() +
|
|
4109
|
+
const m = n ? o : this.SCROLL_STEP;
|
|
4110
|
+
this.startAutoScroll(m, n, () => {
|
|
4111
|
+
t.target.x(t.target.x() + m);
|
|
4094
4112
|
});
|
|
4095
4113
|
} else
|
|
4096
4114
|
this.stopAutoScroll();
|
|
@@ -4105,67 +4123,67 @@ class Ie {
|
|
|
4105
4123
|
t.cancelBubble = !0;
|
|
4106
4124
|
const i = t.target.getStage();
|
|
4107
4125
|
if (!i) return;
|
|
4108
|
-
this.isDragging = !0, this.context.event.emit(
|
|
4126
|
+
this.isDragging = !0, this.context.event.emit(S.SLIDER_MOVING, !0);
|
|
4109
4127
|
let s = ((x = i.getPointerPosition()) == null ? void 0 : x.x) || 0;
|
|
4110
|
-
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock,
|
|
4111
|
-
let
|
|
4128
|
+
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, h = i.width();
|
|
4129
|
+
let l = 0, g = 0;
|
|
4112
4130
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4113
|
-
const w = this.slider.width(),
|
|
4114
|
-
if (
|
|
4115
|
-
if (
|
|
4131
|
+
const w = this.slider.width(), T = this.slider.x(), v = T + w, b = -this.offsetX, O = b + h, M = T <= b + this.EDGE_THRESHOLD, E = v >= O - this.EDGE_THRESHOLD;
|
|
4132
|
+
if (M && e === "left") {
|
|
4133
|
+
if (b <= 0)
|
|
4116
4134
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4117
4135
|
else if (this.draggingDirection === "left") {
|
|
4118
|
-
const
|
|
4119
|
-
this.startAutoScroll(
|
|
4120
|
-
|
|
4136
|
+
const k = n ? -o : -this.SCROLL_STEP;
|
|
4137
|
+
this.startAutoScroll(k, n, () => {
|
|
4138
|
+
l += k, this.slider.x(this.slider.x() + k);
|
|
4121
4139
|
});
|
|
4122
4140
|
} else
|
|
4123
4141
|
this.stopAutoScroll();
|
|
4124
4142
|
this.emitUpdate("left");
|
|
4125
|
-
} else if (
|
|
4126
|
-
if (
|
|
4143
|
+
} else if (E && e === "right") {
|
|
4144
|
+
if (O >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4127
4145
|
this.slider.width(
|
|
4128
4146
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
4129
4147
|
), this.stopAutoScroll(), r || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
4130
4148
|
else if (this.draggingDirection === "right") {
|
|
4131
|
-
const
|
|
4132
|
-
this.startAutoScroll(
|
|
4133
|
-
g +=
|
|
4149
|
+
const k = n ? o : this.SCROLL_STEP;
|
|
4150
|
+
this.startAutoScroll(k, n, () => {
|
|
4151
|
+
g += k, this.slider.x(this.slider.x() + k);
|
|
4134
4152
|
});
|
|
4135
4153
|
} else
|
|
4136
4154
|
this.stopAutoScroll();
|
|
4137
4155
|
this.emitUpdate("right");
|
|
4138
|
-
} else if (e === "right" &&
|
|
4139
|
-
const
|
|
4140
|
-
this.startAutoScroll(
|
|
4141
|
-
g +=
|
|
4156
|
+
} else if (e === "right" && T <= b && v <= b + this.EDGE_THRESHOLD + o) {
|
|
4157
|
+
const k = n ? -o : -this.SCROLL_STEP;
|
|
4158
|
+
this.startAutoScroll(k, n, () => {
|
|
4159
|
+
g += k, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + k), this.emitUpdate("right");
|
|
4142
4160
|
});
|
|
4143
|
-
} else if (e === "left" &&
|
|
4144
|
-
const
|
|
4145
|
-
this.startAutoScroll(
|
|
4146
|
-
|
|
4161
|
+
} else if (e === "left" && v >= O && T >= O - this.EDGE_THRESHOLD - o) {
|
|
4162
|
+
const k = n ? o : this.SCROLL_STEP;
|
|
4163
|
+
this.startAutoScroll(k, n, () => {
|
|
4164
|
+
l += k, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + k), this.emitUpdate("left");
|
|
4147
4165
|
});
|
|
4148
4166
|
} else
|
|
4149
4167
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
4150
4168
|
}, this.MOVE_INTERVAL);
|
|
4151
|
-
let
|
|
4152
|
-
const
|
|
4153
|
-
var
|
|
4169
|
+
let c;
|
|
4170
|
+
const u = this.slider.x(), p = this.slider.width(), m = (w) => {
|
|
4171
|
+
var b;
|
|
4154
4172
|
w.movementX > 0 ? this.draggingDirection = "right" : w.movementX < 0 && (this.draggingDirection = "left");
|
|
4155
|
-
const
|
|
4156
|
-
let
|
|
4157
|
-
n && (
|
|
4158
|
-
},
|
|
4159
|
-
this.handleDragEnd(t), document.removeEventListener("mousemove",
|
|
4173
|
+
const T = Math.max(((b = i.getPointerPosition()) == null ? void 0 : b.x) || 0, 0);
|
|
4174
|
+
let v = T - s;
|
|
4175
|
+
n && (v = mt(v, o)), (c === void 0 || c !== v) && (e === "left" ? p - v - l >= o && T < h - this.EDGE_THRESHOLD && (this.slider.width(p - v - l), this.slider.x(u + v + l), this.emitUpdate("left")) : p + v + g >= o && T > this.EDGE_THRESHOLD && (this.slider.width(p + v + g), this.emitUpdate("right")), c = v);
|
|
4176
|
+
}, d = () => {
|
|
4177
|
+
this.handleDragEnd(t), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", d);
|
|
4160
4178
|
};
|
|
4161
|
-
document.addEventListener("mousemove",
|
|
4179
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", d);
|
|
4162
4180
|
}
|
|
4163
4181
|
// 开始自动扩展
|
|
4164
4182
|
startAutoExpand(t) {
|
|
4165
4183
|
if (this.autoExpandTimer) return;
|
|
4166
4184
|
const e = this.context.store.getTimeAxis();
|
|
4167
4185
|
this.autoExpandTimer = window.setInterval(() => {
|
|
4168
|
-
e.expand(t, 1), this.context.event.emit(
|
|
4186
|
+
e.expand(t, 1), this.context.event.emit(S.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(0);
|
|
4169
4187
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
4170
4188
|
}
|
|
4171
4189
|
// 开始自动滚动
|
|
@@ -4202,11 +4220,11 @@ class Ie {
|
|
|
4202
4220
|
}
|
|
4203
4221
|
// 拖拽块的高亮动画
|
|
4204
4222
|
handleResizeHighlight(t) {
|
|
4205
|
-
this.leftHandleGroup && new
|
|
4223
|
+
this.leftHandleGroup && new y.Tween({
|
|
4206
4224
|
node: this.leftHandleGroup,
|
|
4207
4225
|
opacity: t,
|
|
4208
4226
|
duration: 0.2
|
|
4209
|
-
}).play(), this.rightHandleGroup && new
|
|
4227
|
+
}).play(), this.rightHandleGroup && new y.Tween({
|
|
4210
4228
|
node: this.rightHandleGroup,
|
|
4211
4229
|
opacity: t,
|
|
4212
4230
|
duration: 0.2
|
|
@@ -4214,7 +4232,7 @@ class Ie {
|
|
|
4214
4232
|
}
|
|
4215
4233
|
/** 鼠标移入高亮 */
|
|
4216
4234
|
handleBarHighlight(t) {
|
|
4217
|
-
this.sliderBar && new
|
|
4235
|
+
this.sliderBar && new y.Tween({
|
|
4218
4236
|
...t,
|
|
4219
4237
|
node: this.sliderBar,
|
|
4220
4238
|
duration: 0.2
|
|
@@ -4226,8 +4244,8 @@ class Ge {
|
|
|
4226
4244
|
a(this, "row");
|
|
4227
4245
|
a(this, "slider");
|
|
4228
4246
|
a(this, "cacheKey", "");
|
|
4229
|
-
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new
|
|
4230
|
-
const
|
|
4247
|
+
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new y.Group();
|
|
4248
|
+
const h = new y.Rect({
|
|
4231
4249
|
x: s,
|
|
4232
4250
|
y: n,
|
|
4233
4251
|
width: o,
|
|
@@ -4235,7 +4253,7 @@ class Ge {
|
|
|
4235
4253
|
id: i,
|
|
4236
4254
|
listening: !1
|
|
4237
4255
|
});
|
|
4238
|
-
this.row.add(
|
|
4256
|
+
this.row.add(h), this.slider = new Ie(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
4239
4257
|
}
|
|
4240
4258
|
update(t, e) {
|
|
4241
4259
|
this.slider.update(t, e);
|
|
@@ -4265,7 +4283,7 @@ class Re {
|
|
|
4265
4283
|
// 选中相关
|
|
4266
4284
|
a(this, "selectedRowId", null);
|
|
4267
4285
|
a(this, "selectedRect", null);
|
|
4268
|
-
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new
|
|
4286
|
+
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new y.Group({ name: "chart-body-rows" }), this.layer.add(this.rowsGroup), this.rowBgGroup = new y.Group({ name: "chart-body-row-bgs" }), this.bgLayer.add(this.rowBgGroup), this.registerEvents(), this.bindEvents();
|
|
4269
4287
|
}
|
|
4270
4288
|
/**
|
|
4271
4289
|
* 调整大小
|
|
@@ -4289,19 +4307,19 @@ class Re {
|
|
|
4289
4307
|
this.rowBgGroup.destroyChildren(), t.forEach((s, n) => {
|
|
4290
4308
|
const o = `chart-row-${s.id}`;
|
|
4291
4309
|
let r = this.rowsCache.get(o);
|
|
4292
|
-
const
|
|
4293
|
-
r ? (r.update(0,
|
|
4310
|
+
const l = s.flatIndex * e + this.context.getOptions().header.height;
|
|
4311
|
+
r ? (r.update(0, l), r.setOffset(this.offsetX, this.offsetY)) : (r = new Ge(
|
|
4294
4312
|
this.context,
|
|
4295
4313
|
s,
|
|
4296
4314
|
o,
|
|
4297
4315
|
0,
|
|
4298
|
-
|
|
4316
|
+
l,
|
|
4299
4317
|
this.width,
|
|
4300
4318
|
e
|
|
4301
4319
|
), 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);
|
|
4302
|
-
const g = new
|
|
4320
|
+
const g = new y.Rect({
|
|
4303
4321
|
x: 0,
|
|
4304
|
-
y:
|
|
4322
|
+
y: l + this.offsetY,
|
|
4305
4323
|
width: this.width,
|
|
4306
4324
|
height: e,
|
|
4307
4325
|
fill: this.context.store.getOptionManager().getRowBackgroundColor(s),
|
|
@@ -4334,13 +4352,13 @@ class Re {
|
|
|
4334
4352
|
* 注册事件监听
|
|
4335
4353
|
*/
|
|
4336
4354
|
registerEvents() {
|
|
4337
|
-
this.context.event.on(
|
|
4355
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
4338
4356
|
this.highlightRow(t);
|
|
4339
|
-
}), this.context.event.on(
|
|
4357
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
4340
4358
|
this.unhighlightRow(t);
|
|
4341
|
-
}), this.context.event.on(
|
|
4359
|
+
}), this.context.event.on(S.TASK_SELECTED, (t) => {
|
|
4342
4360
|
this.selectRow(t.id);
|
|
4343
|
-
}), this.context.event.on(
|
|
4361
|
+
}), this.context.event.on(S.TASK_UNSELECTED, (t) => {
|
|
4344
4362
|
this.unselectRow(t);
|
|
4345
4363
|
});
|
|
4346
4364
|
}
|
|
@@ -4352,9 +4370,9 @@ class Re {
|
|
|
4352
4370
|
if (!e) return;
|
|
4353
4371
|
const i = this.getTaskByPosition(e);
|
|
4354
4372
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
4355
|
-
|
|
4373
|
+
S.ROW_UNHIGHLIGHT,
|
|
4356
4374
|
this.highlightedRowId
|
|
4357
|
-
), i && this.context.event.emit(
|
|
4375
|
+
), i && this.context.event.emit(S.ROW_HIGHLIGHT, i.id);
|
|
4358
4376
|
}
|
|
4359
4377
|
/**
|
|
4360
4378
|
* 处理鼠标离开
|
|
@@ -4372,7 +4390,7 @@ class Re {
|
|
|
4372
4390
|
const i = this.getTaskByPosition(e);
|
|
4373
4391
|
if (i) {
|
|
4374
4392
|
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
4375
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(
|
|
4393
|
+
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(S.ROW_CLICK, t.evt, i);
|
|
4376
4394
|
}
|
|
4377
4395
|
}
|
|
4378
4396
|
/**
|
|
@@ -4383,7 +4401,7 @@ class Re {
|
|
|
4383
4401
|
const e = this.stage.getPointerPosition();
|
|
4384
4402
|
if (!e) return;
|
|
4385
4403
|
const i = this.getTaskByPosition(e);
|
|
4386
|
-
i && this.context.event.emit(
|
|
4404
|
+
i && this.context.event.emit(S.ROW_DBL_CLICK, t.evt, i);
|
|
4387
4405
|
}
|
|
4388
4406
|
/**
|
|
4389
4407
|
* 处理右键菜单
|
|
@@ -4394,7 +4412,7 @@ class Re {
|
|
|
4394
4412
|
const e = this.stage.getPointerPosition();
|
|
4395
4413
|
if (!e) return;
|
|
4396
4414
|
const i = this.getTaskByPosition(e);
|
|
4397
|
-
i && this.context.event.emit(
|
|
4415
|
+
i && this.context.event.emit(S.ROW_CONTEXTMENU, t.evt, i);
|
|
4398
4416
|
}
|
|
4399
4417
|
/**
|
|
4400
4418
|
* 按照位置获取任务
|
|
@@ -4417,7 +4435,7 @@ class Re {
|
|
|
4417
4435
|
if (!e) return;
|
|
4418
4436
|
this.highlightRect && this.highlightRect.destroy();
|
|
4419
4437
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
4420
|
-
this.selectedRowId !== t && (this.highlightRect = new
|
|
4438
|
+
this.selectedRowId !== t && (this.highlightRect = new y.Rect({
|
|
4421
4439
|
x: 0,
|
|
4422
4440
|
y: s + this.offsetY,
|
|
4423
4441
|
width: this.width,
|
|
@@ -4466,7 +4484,7 @@ class Re {
|
|
|
4466
4484
|
if (!e) return;
|
|
4467
4485
|
this.selectedRect && this.selectedRect.destroy(), this.selectedRowId === this.highlightedRowId && ((n = this.highlightRect) == null || n.fill("transparent"));
|
|
4468
4486
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
4469
|
-
this.selectedRect = new
|
|
4487
|
+
this.selectedRect = new y.Rect({
|
|
4470
4488
|
x: 0,
|
|
4471
4489
|
y: s + this.offsetY,
|
|
4472
4490
|
width: this.width,
|
|
@@ -4536,38 +4554,38 @@ class Wt {
|
|
|
4536
4554
|
angle: s = (t == null ? void 0 : t.angle) ?? 30,
|
|
4537
4555
|
spacing: n = (t == null ? void 0 : t.spacing) || 10
|
|
4538
4556
|
} = t || {}, o = s % 180, r = o * Math.PI / 180;
|
|
4539
|
-
let
|
|
4540
|
-
o === 0 ? (
|
|
4541
|
-
const g = new
|
|
4557
|
+
let h, l;
|
|
4558
|
+
o === 0 ? (h = n, l = i + n) : o === 90 ? (h = i + n, l = n) : (h = Math.abs(Math.ceil((i + n) / Math.sin(r))), l = Math.abs(Math.ceil((i + n) / Math.cos(r))));
|
|
4559
|
+
const g = new y.Stage({
|
|
4542
4560
|
container: document.createElement("div"),
|
|
4543
|
-
width:
|
|
4544
|
-
height:
|
|
4545
|
-
}),
|
|
4546
|
-
g.add(
|
|
4547
|
-
const
|
|
4561
|
+
width: h,
|
|
4562
|
+
height: l
|
|
4563
|
+
}), c = new y.Layer();
|
|
4564
|
+
g.add(c);
|
|
4565
|
+
const u = new y.Group();
|
|
4548
4566
|
if (o === 0 || o === 90) {
|
|
4549
|
-
const
|
|
4550
|
-
points: [0, 0, o === 0 ?
|
|
4567
|
+
const m = new y.Line({
|
|
4568
|
+
points: [0, 0, o === 0 ? h : 0, o === 0 ? 0 : l],
|
|
4551
4569
|
stroke: e,
|
|
4552
4570
|
strokeWidth: i,
|
|
4553
4571
|
perfectDrawEnabled: !0
|
|
4554
4572
|
});
|
|
4555
|
-
|
|
4573
|
+
u.add(m);
|
|
4556
4574
|
} else
|
|
4557
|
-
for (let
|
|
4558
|
-
const
|
|
4559
|
-
points: [Math.ceil(
|
|
4575
|
+
for (let m = -h; m < h * 2; m += h) {
|
|
4576
|
+
const d = m + i / 2, x = 0, w = m + i / 2 + (Math.cos(r) < 0 ? -h : h), T = l, v = new y.Line({
|
|
4577
|
+
points: [Math.ceil(d), Math.ceil(x), Math.ceil(w), Math.ceil(T)],
|
|
4560
4578
|
stroke: e,
|
|
4561
4579
|
strokeWidth: i,
|
|
4562
4580
|
perfectDrawEnabled: !0,
|
|
4563
4581
|
lineCap: "square",
|
|
4564
4582
|
lineJoin: "miter"
|
|
4565
4583
|
});
|
|
4566
|
-
|
|
4584
|
+
u.add(v);
|
|
4567
4585
|
}
|
|
4568
|
-
|
|
4569
|
-
const
|
|
4570
|
-
return
|
|
4586
|
+
c.add(u), c.draw();
|
|
4587
|
+
const p = new Image();
|
|
4588
|
+
return p.src = g.toDataURL(), g.destroy(), p;
|
|
4571
4589
|
}
|
|
4572
4590
|
/**
|
|
4573
4591
|
* 创建圆点图案
|
|
@@ -4577,12 +4595,12 @@ class Wt {
|
|
|
4577
4595
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
4578
4596
|
width: i = (t == null ? void 0 : t.width) || 2,
|
|
4579
4597
|
spacing: s = (t == null ? void 0 : t.spacing) || 4
|
|
4580
|
-
} = t || {}, n = i * 2 + s * 2, o = n, r = F(e),
|
|
4598
|
+
} = t || {}, n = i * 2 + s * 2, o = n, r = F(e), h = new y.Stage({
|
|
4581
4599
|
container: document.createElement("div"),
|
|
4582
4600
|
width: n,
|
|
4583
4601
|
height: o
|
|
4584
|
-
}),
|
|
4585
|
-
|
|
4602
|
+
}), l = new y.Layer();
|
|
4603
|
+
h.add(l), [
|
|
4586
4604
|
{ x: s / 2 + i / 2, y: s / 2 + i / 2 },
|
|
4587
4605
|
{
|
|
4588
4606
|
x: n - s / 2 - i / 2,
|
|
@@ -4596,17 +4614,17 @@ class Wt {
|
|
|
4596
4614
|
x: n - s / 2 - i / 2,
|
|
4597
4615
|
y: o - s / 2 - i / 2
|
|
4598
4616
|
}
|
|
4599
|
-
].forEach((
|
|
4600
|
-
const
|
|
4601
|
-
x:
|
|
4602
|
-
y:
|
|
4617
|
+
].forEach((u) => {
|
|
4618
|
+
const p = new y.Circle({
|
|
4619
|
+
x: u.x,
|
|
4620
|
+
y: u.y,
|
|
4603
4621
|
radius: i / 2,
|
|
4604
4622
|
fill: r.toString()
|
|
4605
4623
|
});
|
|
4606
|
-
|
|
4607
|
-
}),
|
|
4608
|
-
const
|
|
4609
|
-
return
|
|
4624
|
+
l.add(p);
|
|
4625
|
+
}), l.draw();
|
|
4626
|
+
const c = new Image();
|
|
4627
|
+
return c.src = h.toDataURL(), h.destroy(), c;
|
|
4610
4628
|
}
|
|
4611
4629
|
/**
|
|
4612
4630
|
* 创建网格图案
|
|
@@ -4616,30 +4634,30 @@ class Wt {
|
|
|
4616
4634
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
4617
4635
|
width: i = (t == null ? void 0 : t.width) || 1,
|
|
4618
4636
|
spacing: s = (t == null ? void 0 : t.spacing) || 20
|
|
4619
|
-
} = t || {}, n = i + s, o = n, r = n,
|
|
4637
|
+
} = t || {}, n = i + s, o = n, r = n, h = new y.Stage({
|
|
4620
4638
|
container: document.createElement("div"),
|
|
4621
4639
|
width: o,
|
|
4622
4640
|
height: r
|
|
4623
|
-
}),
|
|
4624
|
-
|
|
4625
|
-
const g = new
|
|
4641
|
+
}), l = new y.Layer();
|
|
4642
|
+
h.add(l);
|
|
4643
|
+
const g = new y.Group();
|
|
4626
4644
|
g.add(
|
|
4627
|
-
new
|
|
4645
|
+
new y.Line({
|
|
4628
4646
|
points: [0, 0, o, r],
|
|
4629
4647
|
stroke: e,
|
|
4630
4648
|
strokeWidth: i,
|
|
4631
4649
|
perfectDrawEnabled: !0
|
|
4632
4650
|
})
|
|
4633
4651
|
), g.add(
|
|
4634
|
-
new
|
|
4652
|
+
new y.Line({
|
|
4635
4653
|
points: [0, r, o, 0],
|
|
4636
4654
|
stroke: e,
|
|
4637
4655
|
strokeWidth: i,
|
|
4638
4656
|
perfectDrawEnabled: !0
|
|
4639
4657
|
})
|
|
4640
|
-
),
|
|
4641
|
-
const
|
|
4642
|
-
return
|
|
4658
|
+
), l.add(g), l.draw();
|
|
4659
|
+
const c = new Image();
|
|
4660
|
+
return c.src = h.toDataURL(), h.destroy(), c;
|
|
4643
4661
|
}
|
|
4644
4662
|
}
|
|
4645
4663
|
class We {
|
|
@@ -4652,7 +4670,7 @@ class We {
|
|
|
4652
4670
|
// 保存周末
|
|
4653
4671
|
a(this, "weekendGroup");
|
|
4654
4672
|
a(this, "patternImage", null);
|
|
4655
|
-
this.context = t, this.layer = e, this.weekendGroup = new
|
|
4673
|
+
this.context = t, this.layer = e, this.weekendGroup = new y.Group(), this.layer.add(this.weekendGroup);
|
|
4656
4674
|
}
|
|
4657
4675
|
/**
|
|
4658
4676
|
* 检查日期是否为周末
|
|
@@ -4692,26 +4710,26 @@ class We {
|
|
|
4692
4710
|
*/
|
|
4693
4711
|
async calculateWeekend() {
|
|
4694
4712
|
if (this.clearWeekend(), !this.context.getOptions().weekend.show) return;
|
|
4695
|
-
const t = this.context.store.getTimeAxis().getStartTime(), e = this.context.store.getTimeAxis().getEndTime(), i = this.context.store.getTimeAxis().getCellUnit(), s = this.context.store.getTimeAxis().getCellWidth(), n = this.context.getOptions().header.height, o = this.context.getOptions().row.height,
|
|
4696
|
-
for (let
|
|
4697
|
-
let
|
|
4698
|
-
if (
|
|
4699
|
-
const
|
|
4700
|
-
if (
|
|
4701
|
-
|
|
4713
|
+
const t = this.context.store.getTimeAxis().getStartTime(), e = this.context.store.getTimeAxis().getEndTime(), i = this.context.store.getTimeAxis().getCellUnit(), s = this.context.store.getTimeAxis().getCellWidth(), n = this.context.getOptions().header.height, o = this.context.getOptions().row.height, h = this.context.store.getDataManager().getVisibleSize() * o, l = Math.max(0, -this.offsetX), g = l + this.width;
|
|
4714
|
+
for (let c = t; c <= e; ) {
|
|
4715
|
+
let u = s;
|
|
4716
|
+
if (u = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(c)) {
|
|
4717
|
+
const p = this.context.store.getTimeAxis().getTimeLeft(c), m = n, d = h;
|
|
4718
|
+
if (p + u < l) {
|
|
4719
|
+
c = c.add(2, "day");
|
|
4702
4720
|
continue;
|
|
4703
4721
|
}
|
|
4704
|
-
if (
|
|
4722
|
+
if (p > g)
|
|
4705
4723
|
break;
|
|
4706
4724
|
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Wt.createPattern(
|
|
4707
4725
|
this.context.getOptions().weekend
|
|
4708
4726
|
));
|
|
4709
|
-
const w = new
|
|
4727
|
+
const w = new y.Rect({
|
|
4710
4728
|
name: "weekend-rect",
|
|
4711
|
-
x:
|
|
4712
|
-
y:
|
|
4713
|
-
width:
|
|
4714
|
-
height:
|
|
4729
|
+
x: p,
|
|
4730
|
+
y: m,
|
|
4731
|
+
width: u,
|
|
4732
|
+
height: d,
|
|
4715
4733
|
// 根据模式设置填充
|
|
4716
4734
|
...this.patternImage ? {
|
|
4717
4735
|
fillPatternImage: this.patternImage,
|
|
@@ -4723,9 +4741,9 @@ class We {
|
|
|
4723
4741
|
},
|
|
4724
4742
|
opacity: this.context.getOptions().weekend.opacity
|
|
4725
4743
|
});
|
|
4726
|
-
this.weekendGroup.add(w),
|
|
4744
|
+
this.weekendGroup.add(w), c = c.add(2, "day");
|
|
4727
4745
|
} else
|
|
4728
|
-
|
|
4746
|
+
c = c.add(1, "day");
|
|
4729
4747
|
}
|
|
4730
4748
|
this.layer.batchDraw();
|
|
4731
4749
|
}
|
|
@@ -4734,6 +4752,7 @@ class $e {
|
|
|
4734
4752
|
constructor(t, e, i) {
|
|
4735
4753
|
a(this, "arrowAnimation");
|
|
4736
4754
|
a(this, "todayLine");
|
|
4755
|
+
a(this, "todayTextGroup");
|
|
4737
4756
|
a(this, "triangle");
|
|
4738
4757
|
// 状态变量
|
|
4739
4758
|
a(this, "width", 0);
|
|
@@ -4758,6 +4777,7 @@ class $e {
|
|
|
4758
4777
|
* 渲染今日线
|
|
4759
4778
|
*/
|
|
4760
4779
|
render() {
|
|
4780
|
+
var c, u, p, m, d, x, w;
|
|
4761
4781
|
const t = Object.assign(
|
|
4762
4782
|
{
|
|
4763
4783
|
show: !0,
|
|
@@ -4772,31 +4792,76 @@ class $e {
|
|
|
4772
4792
|
let e = H();
|
|
4773
4793
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
4774
4794
|
t.type === "block" && (e = e.startOf(i));
|
|
4775
|
-
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, r = F(t.backgroundColor).alpha(t.opacity).toHex(),
|
|
4776
|
-
this.todayLine ? (this.todayLine.points(
|
|
4777
|
-
points:
|
|
4795
|
+
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, r = F(t.backgroundColor).alpha(t.opacity).toHex(), h = (t.type === "block" ? s + n / 2 : s) + this.offsetX, l = [h, o, h, this.height], g = t.type === "line" ? t.width : n;
|
|
4796
|
+
if (this.todayLine ? (this.todayLine.points(l), this.todayLine.stroke(r), this.todayLine.strokeWidth(g)) : (this.todayLine = new y.Line({
|
|
4797
|
+
points: l,
|
|
4778
4798
|
stroke: r,
|
|
4779
4799
|
strokeWidth: g
|
|
4780
|
-
}), this.bgLayer.add(this.todayLine)),
|
|
4781
|
-
x:
|
|
4800
|
+
}), this.bgLayer.add(this.todayLine)), (c = this.context.getOptions().today.text) != null && c.show) {
|
|
4801
|
+
const T = ((u = this.context.getOptions().today.text) == null ? void 0 : u.fontSize) || 10, v = ((p = this.context.getOptions().today.text) == null ? void 0 : p.fontFamily) || "Arial", b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.content) || "今天", O = new y.Text({ fontSize: T, fontFamily: v }).measureSize(b), M = ((d = this.context.getOptions().today.text) == null ? void 0 : d.color) || "white", E = ((x = this.context.getOptions().today.text) == null ? void 0 : x.backgroundColor) || r;
|
|
4802
|
+
if (!this.todayTextGroup)
|
|
4803
|
+
this.todayTextGroup = new y.Group({
|
|
4804
|
+
x: s + this.offsetX + g,
|
|
4805
|
+
y: o,
|
|
4806
|
+
opacity: (w = this.context.getOptions().today.text) == null ? void 0 : w.opacity
|
|
4807
|
+
}), this.todayTextGroup.add(new y.Rect({
|
|
4808
|
+
x: 0,
|
|
4809
|
+
y: 0,
|
|
4810
|
+
width: O.width + 12,
|
|
4811
|
+
height: O.height + 8,
|
|
4812
|
+
fill: E,
|
|
4813
|
+
cornerRadius: 0,
|
|
4814
|
+
name: "today-text-bg"
|
|
4815
|
+
})), this.todayTextGroup.add(new y.Text({
|
|
4816
|
+
x: 0,
|
|
4817
|
+
y: 0,
|
|
4818
|
+
text: b,
|
|
4819
|
+
fontSize: T,
|
|
4820
|
+
fontFamily: v,
|
|
4821
|
+
padding: 5,
|
|
4822
|
+
fill: M,
|
|
4823
|
+
align: "center",
|
|
4824
|
+
verticalAlign: "middle",
|
|
4825
|
+
name: "today-text"
|
|
4826
|
+
})), this.bgLayer.add(this.todayTextGroup);
|
|
4827
|
+
else {
|
|
4828
|
+
this.todayTextGroup.x(s + this.offsetX + g);
|
|
4829
|
+
const k = this.todayTextGroup.findOne(".today-text");
|
|
4830
|
+
k == null || k.setAttrs({
|
|
4831
|
+
text: b,
|
|
4832
|
+
fill: M,
|
|
4833
|
+
fontSize: T,
|
|
4834
|
+
fontFamily: v,
|
|
4835
|
+
padding: 5
|
|
4836
|
+
});
|
|
4837
|
+
const L = this.todayTextGroup.findOne(".today-text-bg");
|
|
4838
|
+
L == null || L.setAttrs({
|
|
4839
|
+
width: O.width + 12,
|
|
4840
|
+
height: O.height + 8,
|
|
4841
|
+
fill: E
|
|
4842
|
+
});
|
|
4843
|
+
}
|
|
4844
|
+
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
4845
|
+
t.type === "line" && (this.triangle ? (this.triangle.x(h), this.triangle.fill(r)) : (this.triangle = new y.RegularPolygon({
|
|
4846
|
+
x: h,
|
|
4782
4847
|
y: o - 8,
|
|
4783
4848
|
sides: 3,
|
|
4784
4849
|
radius: 8,
|
|
4785
4850
|
fill: r,
|
|
4786
4851
|
rotation: 180,
|
|
4787
4852
|
name: "today-triangle"
|
|
4788
|
-
}), this.arrowAnimation = new
|
|
4789
|
-
var
|
|
4790
|
-
const
|
|
4791
|
-
(
|
|
4853
|
+
}), this.arrowAnimation = new y.Animation((T) => {
|
|
4854
|
+
var b;
|
|
4855
|
+
const v = Math.sin(T.time * 4 * Math.PI / 2e3) + o - 8;
|
|
4856
|
+
(b = this.triangle) == null || b.y(v);
|
|
4792
4857
|
}, this.headerLayer), this.headerLayer.add(this.triangle), this.triangle.moveToTop(), this.arrowAnimation.start())), this.bgLayer.batchDraw();
|
|
4793
4858
|
}
|
|
4794
4859
|
/**
|
|
4795
4860
|
* 销毁今日线
|
|
4796
4861
|
*/
|
|
4797
4862
|
destroy() {
|
|
4798
|
-
var t, e, i;
|
|
4799
|
-
(t = this.todayLine) == null || t.destroy(), (e = this.triangle) == null || e.destroy(), (i = this.
|
|
4863
|
+
var t, e, i, s;
|
|
4864
|
+
(t = this.todayLine) == null || t.destroy(), (e = this.triangle) == null || e.destroy(), (i = this.todayTextGroup) == null || i.destroy(), (s = this.arrowAnimation) == null || s.stop(), this.arrowAnimation = void 0;
|
|
4800
4865
|
}
|
|
4801
4866
|
}
|
|
4802
4867
|
class Fe {
|
|
@@ -4809,7 +4874,7 @@ class Fe {
|
|
|
4809
4874
|
// 保存假期
|
|
4810
4875
|
a(this, "holidayGroup");
|
|
4811
4876
|
a(this, "patternImage", /* @__PURE__ */ new WeakMap());
|
|
4812
|
-
this.context = t, this.layer = e, this.holidayGroup = new
|
|
4877
|
+
this.context = t, this.layer = e, this.holidayGroup = new y.Group(), this.layer.add(this.holidayGroup);
|
|
4813
4878
|
}
|
|
4814
4879
|
/**
|
|
4815
4880
|
* 调整假期大小
|
|
@@ -4821,7 +4886,7 @@ class Fe {
|
|
|
4821
4886
|
* 设置偏移量 (响应滚动)
|
|
4822
4887
|
*/
|
|
4823
4888
|
setOffset(t, e) {
|
|
4824
|
-
this.offsetX = t, this.offsetY = e, this.holidayGroup.x(t), this.
|
|
4889
|
+
this.offsetX = t, this.offsetY = e, this.holidayGroup.x(t), this.calculateHoliday();
|
|
4825
4890
|
}
|
|
4826
4891
|
/**
|
|
4827
4892
|
* 渲染假期
|
|
@@ -4842,59 +4907,210 @@ class Fe {
|
|
|
4842
4907
|
* 计算假期
|
|
4843
4908
|
*/
|
|
4844
4909
|
async calculateHoliday() {
|
|
4910
|
+
var c, u, p, m, d, x, w, T;
|
|
4845
4911
|
if (this.clearHoliday(), !this.context.getOptions().holiday.show) return;
|
|
4846
4912
|
const t = this.context.getOptions().holiday.holidays;
|
|
4847
4913
|
if (!t || t.length === 0) return;
|
|
4848
4914
|
const e = Math.max(0, -this.offsetX), i = e + this.width, s = this.context.store.getTimeAxis().getStartTime(), n = this.context.store.getTimeAxis().getEndTime();
|
|
4849
4915
|
this.context.store.getTimeAxis().getCellUnit();
|
|
4850
|
-
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height,
|
|
4851
|
-
for (let
|
|
4852
|
-
const
|
|
4853
|
-
if (
|
|
4854
|
-
if (
|
|
4855
|
-
return
|
|
4856
|
-
} else if (H(
|
|
4857
|
-
return
|
|
4916
|
+
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height, h = this.context.getOptions().row.height, g = this.context.store.getDataManager().getVisibleSize() * h;
|
|
4917
|
+
for (let v = s; v <= n; v = v.add(1, "day")) {
|
|
4918
|
+
const b = t.find((O) => {
|
|
4919
|
+
if (U(O.date)) {
|
|
4920
|
+
if (O.date.some((M) => H(M).isSame(v, "day")))
|
|
4921
|
+
return O;
|
|
4922
|
+
} else if (H(O.date).isSame(v, "day"))
|
|
4923
|
+
return O;
|
|
4858
4924
|
});
|
|
4859
|
-
if (
|
|
4860
|
-
const
|
|
4861
|
-
if (
|
|
4925
|
+
if (b) {
|
|
4926
|
+
const O = this.context.store.getTimeAxis().getTimeLeft(v), M = r, E = g;
|
|
4927
|
+
if (O + o < e)
|
|
4862
4928
|
continue;
|
|
4863
|
-
if (
|
|
4929
|
+
if (O > i)
|
|
4864
4930
|
break;
|
|
4865
|
-
!this.patternImage.has(
|
|
4866
|
-
|
|
4931
|
+
!this.patternImage.has(b) && (b.pattern || this.context.getOptions().holiday.pattern) && this.patternImage.set(
|
|
4932
|
+
b,
|
|
4867
4933
|
await Wt.createPattern({
|
|
4868
4934
|
backgroundColor: this.context.getOptions().primaryColor,
|
|
4869
|
-
...
|
|
4935
|
+
...b,
|
|
4870
4936
|
...this.context.getOptions().holiday
|
|
4871
4937
|
})
|
|
4872
4938
|
);
|
|
4873
|
-
const
|
|
4939
|
+
const L = new y.Rect({
|
|
4874
4940
|
name: "holiday-rect",
|
|
4875
|
-
x:
|
|
4876
|
-
y:
|
|
4941
|
+
x: O,
|
|
4942
|
+
y: M,
|
|
4877
4943
|
width: o,
|
|
4878
|
-
height:
|
|
4944
|
+
height: E,
|
|
4879
4945
|
// 根据模式设置填充
|
|
4880
|
-
...this.patternImage.get(
|
|
4881
|
-
fillPatternImage: this.patternImage.get(
|
|
4946
|
+
...this.patternImage.get(b) ? {
|
|
4947
|
+
fillPatternImage: this.patternImage.get(b) ?? void 0,
|
|
4882
4948
|
fillPatternRepeat: "repeat",
|
|
4883
4949
|
fillPatternOffset: { x: 0, y: 0 },
|
|
4884
4950
|
fillPatternScale: { x: 1, y: 1 },
|
|
4885
|
-
opacity:
|
|
4951
|
+
opacity: b.opacity || this.context.getOptions().holiday.opacity
|
|
4886
4952
|
} : {
|
|
4887
|
-
fill:
|
|
4888
|
-
opacity:
|
|
4953
|
+
fill: b.backgroundColor || this.context.getOptions().holiday.backgroundColor || this.context.getOptions().primaryColor,
|
|
4954
|
+
opacity: b.opacity || this.context.getOptions().holiday.opacity
|
|
4889
4955
|
}
|
|
4890
4956
|
});
|
|
4891
|
-
this.holidayGroup.add(
|
|
4957
|
+
if (this.holidayGroup.add(L), (c = b.text) != null && c.show) {
|
|
4958
|
+
if (U(b.date) && !H(b.date[0]).isSame(v, "day"))
|
|
4959
|
+
continue;
|
|
4960
|
+
const A = ((u = b.text) == null ? void 0 : u.fontSize) || 10, _ = ((p = b.text) == null ? void 0 : p.fontFamily) || "Arial", C = ((m = b.text) == null ? void 0 : m.content) || "", I = new y.Text({ fontSize: A, fontFamily: _ }).measureSize(C), B = ((d = b.text) == null ? void 0 : d.color) || "white", $ = ((x = b.text) == null ? void 0 : x.backgroundColor) || b.backgroundColor || ((w = this.context.getOptions().holiday) == null ? void 0 : w.backgroundColor) || this.context.getOptions().primaryColor, G = new y.Group({
|
|
4961
|
+
name: "holiday-text-group",
|
|
4962
|
+
x: O,
|
|
4963
|
+
y: M,
|
|
4964
|
+
opacity: (T = b.text) == null ? void 0 : T.opacity
|
|
4965
|
+
}), W = new y.Text({
|
|
4966
|
+
text: C,
|
|
4967
|
+
fill: B,
|
|
4968
|
+
fontSize: A,
|
|
4969
|
+
fontFamily: _,
|
|
4970
|
+
padding: 5
|
|
4971
|
+
}), z = new y.Rect({
|
|
4972
|
+
x: 0,
|
|
4973
|
+
y: 0,
|
|
4974
|
+
width: I.width + 12,
|
|
4975
|
+
height: I.height + 8,
|
|
4976
|
+
fill: $
|
|
4977
|
+
});
|
|
4978
|
+
G.add(z), G.add(W), this.holidayGroup.add(G);
|
|
4979
|
+
}
|
|
4892
4980
|
}
|
|
4893
4981
|
}
|
|
4894
4982
|
this.layer.batchDraw();
|
|
4895
4983
|
}
|
|
4896
4984
|
}
|
|
4897
4985
|
class Be {
|
|
4986
|
+
constructor(t, e) {
|
|
4987
|
+
// 状态变量
|
|
4988
|
+
a(this, "width", 0);
|
|
4989
|
+
a(this, "height", 0);
|
|
4990
|
+
a(this, "offsetX", 0);
|
|
4991
|
+
a(this, "offsetY", 0);
|
|
4992
|
+
// 保存标志日期渲染组
|
|
4993
|
+
a(this, "flagGroup");
|
|
4994
|
+
this.context = t, this.layer = e, this.flagGroup = new y.Group(), this.layer.add(this.flagGroup);
|
|
4995
|
+
}
|
|
4996
|
+
/**
|
|
4997
|
+
* 调整标志日期大小
|
|
4998
|
+
*/
|
|
4999
|
+
resize(t, e) {
|
|
5000
|
+
this.width = t, this.height = e, this.calculateFlag();
|
|
5001
|
+
}
|
|
5002
|
+
/**
|
|
5003
|
+
* 设置偏移量 (响应滚动)
|
|
5004
|
+
*/
|
|
5005
|
+
setOffset(t, e) {
|
|
5006
|
+
this.offsetX = t, this.offsetY = e, this.flagGroup.x(t), this.calculateFlag();
|
|
5007
|
+
}
|
|
5008
|
+
/**
|
|
5009
|
+
* 渲染标志日期
|
|
5010
|
+
*/
|
|
5011
|
+
render() {
|
|
5012
|
+
this.layer.batchDraw();
|
|
5013
|
+
}
|
|
5014
|
+
/**
|
|
5015
|
+
* 销毁标志日期层
|
|
5016
|
+
*/
|
|
5017
|
+
destroy() {
|
|
5018
|
+
this.flagGroup.destroy();
|
|
5019
|
+
}
|
|
5020
|
+
clearFlag() {
|
|
5021
|
+
this.flagGroup.destroyChildren();
|
|
5022
|
+
}
|
|
5023
|
+
/**
|
|
5024
|
+
* 计算标志日期
|
|
5025
|
+
*/
|
|
5026
|
+
async calculateFlag() {
|
|
5027
|
+
var c, u, p, m, d, x, w;
|
|
5028
|
+
if (this.clearFlag(), !((c = this.context.getOptions().flag) != null && c.show)) return;
|
|
5029
|
+
const t = (u = this.context.getOptions().flag) == null ? void 0 : u.data;
|
|
5030
|
+
if (!t || t.length === 0) return;
|
|
5031
|
+
const e = ((p = this.context.getOptions().flag) == null ? void 0 : p.backgroundColor) || this.context.getOptions().primaryColor, i = ((m = this.context.getOptions().flag) == null ? void 0 : m.opacity) || 1, s = ((d = this.context.getOptions().flag) == null ? void 0 : d.color) || (F(e).isDark() ? "white" : "black"), n = ((x = this.context.getOptions().flag) == null ? void 0 : x.fontFamily) || "Arial", o = ((w = this.context.getOptions().flag) == null ? void 0 : w.fontSize) || 10, r = Math.max(0, -this.offsetX), h = r + this.width, l = this.context.store.getTimeAxis().getCellWidth(), g = this.context.getOptions().header.height;
|
|
5032
|
+
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((T) => {
|
|
5033
|
+
const v = H(T.date), b = this.context.store.getTimeAxis().getTimeLeft(v), O = g;
|
|
5034
|
+
if (b + l < r || b > h)
|
|
5035
|
+
return;
|
|
5036
|
+
const E = [b, g, b, this.height], k = new y.Line({
|
|
5037
|
+
points: E,
|
|
5038
|
+
stroke: T.backgroundColor || e,
|
|
5039
|
+
opacity: T.opacity || i,
|
|
5040
|
+
strokeWidth: 1
|
|
5041
|
+
});
|
|
5042
|
+
this.flagGroup.add(k);
|
|
5043
|
+
const L = T.content || "";
|
|
5044
|
+
if (L) {
|
|
5045
|
+
const A = new y.Text({
|
|
5046
|
+
text: L,
|
|
5047
|
+
x: b + 5,
|
|
5048
|
+
// 添加一些内边距
|
|
5049
|
+
y: O + 5,
|
|
5050
|
+
// 添加一些内边距
|
|
5051
|
+
fontSize: o,
|
|
5052
|
+
fontFamily: n,
|
|
5053
|
+
fill: T.color || s,
|
|
5054
|
+
verticalAlign: "middle",
|
|
5055
|
+
align: "left"
|
|
5056
|
+
}), _ = new y.Rect({
|
|
5057
|
+
x: b,
|
|
5058
|
+
y: O,
|
|
5059
|
+
width: A.measureSize(L).width + 12,
|
|
5060
|
+
height: A.measureSize(L).height + 8,
|
|
5061
|
+
fill: T.backgroundColor || e
|
|
5062
|
+
});
|
|
5063
|
+
this.flagGroup.add(_), this.flagGroup.add(A);
|
|
5064
|
+
} else if (T.flag)
|
|
5065
|
+
switch (T.flag) {
|
|
5066
|
+
case "banner":
|
|
5067
|
+
this.flagGroup.add(new y.Rect({
|
|
5068
|
+
x: b,
|
|
5069
|
+
y: O,
|
|
5070
|
+
width: 20,
|
|
5071
|
+
height: 10,
|
|
5072
|
+
fill: T.backgroundColor || e,
|
|
5073
|
+
opacity: T.opacity || i
|
|
5074
|
+
}));
|
|
5075
|
+
break;
|
|
5076
|
+
case "pennant":
|
|
5077
|
+
this.flagGroup.add(new y.Line({
|
|
5078
|
+
points: [b, O, b + 20, O + 5, b, O + 10],
|
|
5079
|
+
fill: T.backgroundColor || e,
|
|
5080
|
+
opacity: T.opacity || i,
|
|
5081
|
+
closed: !0
|
|
5082
|
+
}));
|
|
5083
|
+
break;
|
|
5084
|
+
case "tag":
|
|
5085
|
+
this.flagGroup.add(new y.Line({
|
|
5086
|
+
points: [b, O, b + 20, O, b + 15, O + 5, b + 20, O + 10, b, O + 10],
|
|
5087
|
+
fill: T.backgroundColor || e,
|
|
5088
|
+
opacity: T.opacity || i,
|
|
5089
|
+
closed: !0
|
|
5090
|
+
}));
|
|
5091
|
+
break;
|
|
5092
|
+
case "wedge":
|
|
5093
|
+
this.flagGroup.add(new y.Line({
|
|
5094
|
+
points: [b, O, b + 20, O, b + 25, O + 5, b + 20, O + 10, b, O + 10],
|
|
5095
|
+
fill: T.backgroundColor || e,
|
|
5096
|
+
opacity: T.opacity || i,
|
|
5097
|
+
closed: !0
|
|
5098
|
+
}));
|
|
5099
|
+
break;
|
|
5100
|
+
case "ribbon":
|
|
5101
|
+
this.flagGroup.add(new y.Line({
|
|
5102
|
+
points: [b, O, b + 15, O + 2, b + 20, O, b + 20, O + 10, b + 15, O + 12, b, O + 10],
|
|
5103
|
+
fill: T.backgroundColor || e,
|
|
5104
|
+
opacity: T.opacity || i,
|
|
5105
|
+
closed: !0,
|
|
5106
|
+
tension: 0.1
|
|
5107
|
+
}));
|
|
5108
|
+
break;
|
|
5109
|
+
}
|
|
5110
|
+
}), this.layer.batchDraw();
|
|
5111
|
+
}
|
|
5112
|
+
}
|
|
5113
|
+
class ze {
|
|
4898
5114
|
constructor(t, e, i) {
|
|
4899
5115
|
a(this, "tasks", []);
|
|
4900
5116
|
// 创建点组
|
|
@@ -4912,7 +5128,7 @@ class Be {
|
|
|
4912
5128
|
a(this, "height", 0);
|
|
4913
5129
|
a(this, "offsetX", 0);
|
|
4914
5130
|
a(this, "offsetY", 0);
|
|
4915
|
-
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new
|
|
5131
|
+
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new y.Group({ name: "links-group" }), this.pointGroup = new y.Group({ name: "point-group" }), this.templateArrow = new y.Arrow({
|
|
4916
5132
|
points: [],
|
|
4917
5133
|
stroke: this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4918
5134
|
strokeWidth: this.context.getOptions().links.width,
|
|
@@ -4931,11 +5147,11 @@ class Be {
|
|
|
4931
5147
|
* 注册事件
|
|
4932
5148
|
*/
|
|
4933
5149
|
registerEvents() {
|
|
4934
|
-
this.context.event.on(
|
|
5150
|
+
this.context.event.on(S.ROW_HIGHLIGHT, (t) => {
|
|
4935
5151
|
this.highlightPoint(t);
|
|
4936
|
-
}), this.context.event.on(
|
|
5152
|
+
}), this.context.event.on(S.ROW_UNHIGHLIGHT, (t) => {
|
|
4937
5153
|
this.unhighlightPoint(t);
|
|
4938
|
-
}), this.context.event.on(
|
|
5154
|
+
}), this.context.event.on(S.SLIDER_MOVING, (t) => {
|
|
4939
5155
|
this.isSliderMoving = t;
|
|
4940
5156
|
});
|
|
4941
5157
|
}
|
|
@@ -4974,47 +5190,47 @@ class Be {
|
|
|
4974
5190
|
*/
|
|
4975
5191
|
calculatePoints() {
|
|
4976
5192
|
if (this.pointGroup.destroyChildren(), !this.context.getOptions().links.create.enabled) return;
|
|
4977
|
-
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s = this.context.getOptions().links.create.radius, n = this.context.getOptions().links.create.mode === "always" ? 0.5 : 0, o = this.context.getOptions().links.create.color || this.context.getOptions().primaryColor, r = F(o).alpha(this.context.getOptions().links.create.opacity ?? 1).toHex(),
|
|
4978
|
-
this.tasks.forEach((
|
|
4979
|
-
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show,
|
|
4980
|
-
const g = this.context.store.getTimeAxis().getTimeLeft(
|
|
4981
|
-
let
|
|
4982
|
-
|
|
4983
|
-
const
|
|
4984
|
-
let
|
|
4985
|
-
if (
|
|
4986
|
-
const w = new
|
|
4987
|
-
id: `point-${
|
|
4988
|
-
x: g -
|
|
4989
|
-
y:
|
|
5193
|
+
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s = this.context.getOptions().links.create.radius, n = this.context.getOptions().links.create.mode === "always" ? 0.5 : 0, o = this.context.getOptions().links.create.color || this.context.getOptions().primaryColor, r = F(o).alpha(this.context.getOptions().links.create.opacity ?? 1).toHex(), h = this.context.getOptions().links.create.width;
|
|
5194
|
+
this.tasks.forEach((l) => {
|
|
5195
|
+
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, l) && this.context.store.getDataManager().isTaskVisible(l) && l.startTime && l.endTime) {
|
|
5196
|
+
const g = this.context.store.getTimeAxis().getTimeLeft(l.startTime), c = this.context.store.getTimeAxis().getTimeLeft(l.endTime);
|
|
5197
|
+
let u = this.context.getOptions().links.gap;
|
|
5198
|
+
l.isMilestone() && (u += e / 2);
|
|
5199
|
+
const p = i + e * l.flatIndex;
|
|
5200
|
+
let m = !0, d = !0, x = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
5201
|
+
if (pt(x) ? m = d = x : X(x) && (m = x === "S", d = x === "F"), m) {
|
|
5202
|
+
const w = new y.Circle({
|
|
5203
|
+
id: `point-${l.id}-left`,
|
|
5204
|
+
x: g - u,
|
|
5205
|
+
y: p,
|
|
4990
5206
|
radius: s,
|
|
4991
5207
|
opacity: n,
|
|
4992
5208
|
stroke: r,
|
|
4993
|
-
strokeWidth:
|
|
5209
|
+
strokeWidth: h
|
|
4994
5210
|
});
|
|
4995
|
-
this.pointGroup.add(w), w.on("mousedown", (
|
|
4996
|
-
this.isDragging = !0, this.createLink(
|
|
4997
|
-
}), w.on("mouseover", (
|
|
5211
|
+
this.pointGroup.add(w), w.on("mousedown", (T) => {
|
|
5212
|
+
this.isDragging = !0, this.createLink(T, "S", o, [g - u, p], l.id);
|
|
5213
|
+
}), w.on("mouseover", (T) => {
|
|
4998
5214
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
4999
|
-
}), w.on("mouseout", (
|
|
5215
|
+
}), w.on("mouseout", (T) => {
|
|
5000
5216
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
5001
5217
|
});
|
|
5002
5218
|
}
|
|
5003
|
-
if (
|
|
5004
|
-
const w = new
|
|
5005
|
-
id: `point-${
|
|
5006
|
-
x:
|
|
5007
|
-
y:
|
|
5219
|
+
if (d) {
|
|
5220
|
+
const w = new y.Circle({
|
|
5221
|
+
id: `point-${l.id}-right`,
|
|
5222
|
+
x: c + u,
|
|
5223
|
+
y: p,
|
|
5008
5224
|
radius: s,
|
|
5009
5225
|
opacity: n,
|
|
5010
5226
|
stroke: r,
|
|
5011
|
-
strokeWidth:
|
|
5227
|
+
strokeWidth: h
|
|
5012
5228
|
});
|
|
5013
|
-
this.pointGroup.add(w), w.on("mousedown", (
|
|
5014
|
-
this.isDragging = !0, this.createLink(
|
|
5015
|
-
}), w.on("mouseover", (
|
|
5229
|
+
this.pointGroup.add(w), w.on("mousedown", (T) => {
|
|
5230
|
+
this.isDragging = !0, this.createLink(T, "F", o, [c + u, p], l.id);
|
|
5231
|
+
}), w.on("mouseover", (T) => {
|
|
5016
5232
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5017
|
-
}), w.on("mouseout", (
|
|
5233
|
+
}), w.on("mouseout", (T) => {
|
|
5018
5234
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
5019
5235
|
});
|
|
5020
5236
|
}
|
|
@@ -5033,102 +5249,102 @@ class Be {
|
|
|
5033
5249
|
}), this.selectedMap.forEach((i, s) => {
|
|
5034
5250
|
e.includes(s) || this.selectedMap.delete(s);
|
|
5035
5251
|
}), t.forEach((i) => {
|
|
5036
|
-
var o, r,
|
|
5252
|
+
var o, r, h;
|
|
5037
5253
|
const s = this.context.store.getDataManager().getTaskById(i.from), n = this.context.store.getDataManager().getTaskById(i.to);
|
|
5038
|
-
if (s ||
|
|
5254
|
+
if (s || D.warn(
|
|
5039
5255
|
`No corresponding FROM task [${i.from}] was found for the link. Info:`,
|
|
5040
5256
|
i
|
|
5041
|
-
), n ||
|
|
5257
|
+
), n || D.warn(
|
|
5042
5258
|
`No corresponding TO task [${i.to}] was found for the link. Info:`,
|
|
5043
5259
|
i
|
|
5044
5260
|
), s && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, s) && this.context.store.getDataManager().isTaskVisible(s) && n && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, n) && this.context.store.getDataManager().isTaskVisible(n)) {
|
|
5045
|
-
const
|
|
5046
|
-
if (
|
|
5047
|
-
|
|
5261
|
+
const l = this.getPoints(s, n, i);
|
|
5262
|
+
if (l.length <= 2)
|
|
5263
|
+
D.warn("The link position has some error.", i);
|
|
5048
5264
|
else {
|
|
5049
|
-
const g = this.createId(i),
|
|
5050
|
-
radius:
|
|
5265
|
+
const g = this.createId(i), c = i.radius ?? this.context.getOptions().links.radius, u = ((o = i.arrow) == null ? void 0 : o.width) ?? this.context.getOptions().links.arrow.width, p = ((r = i.arrow) == null ? void 0 : r.height) ?? this.context.getOptions().links.arrow.height, m = i.width ?? this.context.getOptions().links.width, d = new y.Group({ id: g }), x = new y.Circle({
|
|
5266
|
+
radius: c,
|
|
5051
5267
|
fill: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5052
|
-
x:
|
|
5053
|
-
y:
|
|
5268
|
+
x: l[0],
|
|
5269
|
+
y: l[1]
|
|
5054
5270
|
});
|
|
5055
|
-
|
|
5056
|
-
const w = Math.floor(
|
|
5057
|
-
points:
|
|
5271
|
+
d.add(x);
|
|
5272
|
+
const w = Math.floor(l.length / 2), T = w % 2 === 0 ? w : w - 1, v = l.slice(0, T + 2), b = l.slice(T), O = new y.Line({
|
|
5273
|
+
points: v,
|
|
5058
5274
|
stroke: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5059
|
-
strokeWidth:
|
|
5275
|
+
strokeWidth: m,
|
|
5060
5276
|
lineCap: "round",
|
|
5061
5277
|
lineJoin: "round",
|
|
5062
5278
|
dash: i.dash || this.context.getOptions().links.dash,
|
|
5063
5279
|
hitStrokeWidth: 10,
|
|
5064
5280
|
// 增加点击区域
|
|
5065
5281
|
draggable: !0,
|
|
5066
|
-
dragBoundFunc: (
|
|
5282
|
+
dragBoundFunc: (E) => ({ x: 0, y: 0 })
|
|
5067
5283
|
});
|
|
5068
|
-
|
|
5284
|
+
d.add(O), O.on("dragstart", (E) => {
|
|
5069
5285
|
this.handleDrag(
|
|
5070
|
-
|
|
5286
|
+
E,
|
|
5071
5287
|
i,
|
|
5072
5288
|
"S",
|
|
5073
|
-
[
|
|
5289
|
+
[l[l.length - 2], l[l.length - 1]],
|
|
5074
5290
|
g
|
|
5075
5291
|
);
|
|
5076
5292
|
});
|
|
5077
|
-
const
|
|
5078
|
-
points:
|
|
5293
|
+
const M = new y.Arrow({
|
|
5294
|
+
points: b,
|
|
5079
5295
|
stroke: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5080
|
-
strokeWidth:
|
|
5081
|
-
pointerLength:
|
|
5082
|
-
pointerWidth:
|
|
5083
|
-
fill: ((
|
|
5296
|
+
strokeWidth: m,
|
|
5297
|
+
pointerLength: p,
|
|
5298
|
+
pointerWidth: u,
|
|
5299
|
+
fill: ((h = i.arrow) == null ? void 0 : h.color) || this.context.getOptions().links.arrow.color || i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5084
5300
|
// 箭头填充色
|
|
5085
5301
|
lineJoin: "round",
|
|
5086
5302
|
dash: i.dash || this.context.getOptions().links.dash,
|
|
5087
5303
|
hitStrokeWidth: 10,
|
|
5088
5304
|
// 增加点击区域
|
|
5089
5305
|
draggable: !0,
|
|
5090
|
-
dragBoundFunc: (
|
|
5306
|
+
dragBoundFunc: (E) => ({ x: 0, y: 0 })
|
|
5091
5307
|
});
|
|
5092
|
-
|
|
5093
|
-
this.handleDrag(
|
|
5094
|
-
}), this.linksGroup.add(
|
|
5095
|
-
|
|
5096
|
-
u,
|
|
5097
|
-
h,
|
|
5308
|
+
d.add(M), M.on("dragstart", (E) => {
|
|
5309
|
+
this.handleDrag(E, i, "F", [l[0], l[1]], g);
|
|
5310
|
+
}), this.linksGroup.add(d), d.on("mouseover", (E) => {
|
|
5311
|
+
E.target.moveToTop(), this.context.getOptions().links.move.enabled === !0 && (this.stage.container().style.cursor = "pointer"), this.selectedMap.has(g) || this.handleHighlight(
|
|
5098
5312
|
d,
|
|
5099
|
-
|
|
5313
|
+
c,
|
|
5314
|
+
u,
|
|
5100
5315
|
p,
|
|
5316
|
+
m,
|
|
5101
5317
|
2
|
|
5102
5318
|
);
|
|
5103
|
-
}),
|
|
5319
|
+
}), d.on("mouseout", (E) => {
|
|
5104
5320
|
this.selectedMap.has(g) || this.handleHighlight(
|
|
5105
|
-
u,
|
|
5106
|
-
h,
|
|
5107
5321
|
d,
|
|
5108
|
-
|
|
5322
|
+
c,
|
|
5323
|
+
u,
|
|
5109
5324
|
p,
|
|
5325
|
+
m,
|
|
5110
5326
|
0
|
|
5111
5327
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
5112
|
-
}),
|
|
5328
|
+
}), d.on("mousedown", (E) => {
|
|
5113
5329
|
this.isDragging = !0;
|
|
5114
|
-
}),
|
|
5115
|
-
|
|
5116
|
-
|
|
5330
|
+
}), d.on("click", (E) => {
|
|
5331
|
+
E.cancelBubble = !0, this.isDragging = !1, d.moveToTop(), E.evt.button === 0 ? this.selectedMap.has(g) ? (this.selectedMap.delete(g), this.context.event.emit(
|
|
5332
|
+
S.SELECT_LINK,
|
|
5117
5333
|
null,
|
|
5118
5334
|
i,
|
|
5119
5335
|
this.selectedMap.values().toArray()
|
|
5120
5336
|
)) : (this.selectedMap.set(g, i), this.context.event.emit(
|
|
5121
|
-
|
|
5337
|
+
S.SELECT_LINK,
|
|
5122
5338
|
i,
|
|
5123
5339
|
null,
|
|
5124
5340
|
this.selectedMap.values().toArray()
|
|
5125
|
-
)) :
|
|
5341
|
+
)) : E.evt.button === 2 && this.context.event.emit(S.CONTEXT_LINK, E.evt, i);
|
|
5126
5342
|
}), this.selectedMap.has(g) && this.handleHighlight(
|
|
5127
|
-
u,
|
|
5128
|
-
h,
|
|
5129
5343
|
d,
|
|
5130
|
-
|
|
5344
|
+
c,
|
|
5345
|
+
u,
|
|
5131
5346
|
p,
|
|
5347
|
+
m,
|
|
5132
5348
|
2,
|
|
5133
5349
|
!0
|
|
5134
5350
|
);
|
|
@@ -5141,121 +5357,121 @@ class Be {
|
|
|
5141
5357
|
}
|
|
5142
5358
|
getPoints(t, e, i) {
|
|
5143
5359
|
if (t.startTime && t.endTime && e.startTime && e.endTime) {
|
|
5144
|
-
const s = this.context.getOptions().row.height, n = t.isMilestone() ? s / 2 : 0, o = this.context.store.getTimeAxis().getTimeLeft(t.startTime) - n, r = this.context.store.getTimeAxis().getTimeLeft(t.endTime) + n,
|
|
5145
|
-
let
|
|
5360
|
+
const s = this.context.getOptions().row.height, n = t.isMilestone() ? s / 2 : 0, o = this.context.store.getTimeAxis().getTimeLeft(t.startTime) - n, r = this.context.store.getTimeAxis().getTimeLeft(t.endTime) + n, h = e.isMilestone() ? s / 2 : 0, l = this.context.store.getTimeAxis().getTimeLeft(e.startTime) - h, g = this.context.store.getTimeAxis().getTimeLeft(e.endTime) + h;
|
|
5361
|
+
let c = [];
|
|
5146
5362
|
switch (i.type || "FS") {
|
|
5147
5363
|
case "FF":
|
|
5148
|
-
|
|
5364
|
+
c = this.createFF(i, t, e, o, r, l, g);
|
|
5149
5365
|
break;
|
|
5150
5366
|
case "SS":
|
|
5151
|
-
|
|
5367
|
+
c = this.createSS(i, t, e, o, r, l, g);
|
|
5152
5368
|
break;
|
|
5153
5369
|
case "SF":
|
|
5154
|
-
|
|
5370
|
+
c = this.createSF(i, t, e, o, r, l, g);
|
|
5155
5371
|
break;
|
|
5156
5372
|
case "FS":
|
|
5157
5373
|
default:
|
|
5158
|
-
|
|
5374
|
+
c = this.createFS(i, t, e, o, r, l, g);
|
|
5159
5375
|
}
|
|
5160
|
-
return
|
|
5376
|
+
return c;
|
|
5161
5377
|
}
|
|
5162
5378
|
return [];
|
|
5163
5379
|
}
|
|
5164
5380
|
/** 生成 FS 连线 */
|
|
5165
5381
|
createFS(t, e, i, s, n, o, r) {
|
|
5166
|
-
const
|
|
5167
|
-
n +
|
|
5168
|
-
0.05 + g +
|
|
5382
|
+
const h = this.context.getOptions().header.height, l = this.context.getOptions().row.height, g = l / 2 + h, c = t.gap || this.context.getOptions().links.gap, u = [
|
|
5383
|
+
n + c,
|
|
5384
|
+
0.05 + g + l * e.flatIndex
|
|
5169
5385
|
];
|
|
5170
5386
|
{
|
|
5171
|
-
const
|
|
5172
|
-
if (isNaN(
|
|
5173
|
-
|
|
5387
|
+
const p = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5388
|
+
if (isNaN(p))
|
|
5389
|
+
D.error("Link's distance must be a Numeric");
|
|
5174
5390
|
else {
|
|
5175
|
-
const
|
|
5176
|
-
Math.max(
|
|
5177
|
-
g +
|
|
5391
|
+
const m = n + c + p, d = o - c - p, x = [
|
|
5392
|
+
Math.max(m, d),
|
|
5393
|
+
g + l * e.flatIndex
|
|
5178
5394
|
];
|
|
5179
|
-
|
|
5180
|
-
const w =
|
|
5181
|
-
|
|
5395
|
+
u.push(...x);
|
|
5396
|
+
const w = l * e.flatIndex + h + (e.flatIndex <= i.flatIndex ? l : 0);
|
|
5397
|
+
u.push(x[0], w), u.push(d, w), u.push(d, g + l * i.flatIndex);
|
|
5182
5398
|
}
|
|
5183
5399
|
}
|
|
5184
|
-
return
|
|
5400
|
+
return u.push(o - c, g + l * i.flatIndex), u;
|
|
5185
5401
|
}
|
|
5186
5402
|
/** 生成 FF 连线 */
|
|
5187
5403
|
createFF(t, e, i, s, n, o, r) {
|
|
5188
|
-
const
|
|
5189
|
-
n +
|
|
5190
|
-
0.05 + g +
|
|
5404
|
+
const h = this.context.getOptions().header.height, l = this.context.getOptions().row.height, g = l / 2 + h, c = t.gap || this.context.getOptions().links.gap, u = [
|
|
5405
|
+
n + c,
|
|
5406
|
+
0.05 + g + l * e.flatIndex
|
|
5191
5407
|
];
|
|
5192
5408
|
{
|
|
5193
|
-
const
|
|
5194
|
-
if (isNaN(
|
|
5195
|
-
|
|
5409
|
+
const p = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5410
|
+
if (isNaN(p))
|
|
5411
|
+
D.error("Link's distance must be a Numeric");
|
|
5196
5412
|
else {
|
|
5197
|
-
const
|
|
5198
|
-
|
|
5199
|
-
g +
|
|
5413
|
+
const m = n + c + p, d = r + c + p, x = [
|
|
5414
|
+
m <= d ? d : m,
|
|
5415
|
+
g + l * e.flatIndex
|
|
5200
5416
|
];
|
|
5201
|
-
|
|
5202
|
-
Math.max(
|
|
5203
|
-
g +
|
|
5417
|
+
u.push(...x), u.push(
|
|
5418
|
+
Math.max(d, m),
|
|
5419
|
+
g + l * i.flatIndex
|
|
5204
5420
|
);
|
|
5205
5421
|
}
|
|
5206
5422
|
}
|
|
5207
|
-
return
|
|
5423
|
+
return u.push(r + c, g + l * i.flatIndex), u;
|
|
5208
5424
|
}
|
|
5209
5425
|
/** 生成 SS 连线 */
|
|
5210
5426
|
createSS(t, e, i, s, n, o, r) {
|
|
5211
|
-
const
|
|
5212
|
-
s -
|
|
5213
|
-
0.05 + g +
|
|
5427
|
+
const h = this.context.getOptions().header.height, l = this.context.getOptions().row.height, g = l / 2 + h, c = t.gap || this.context.getOptions().links.gap, u = [
|
|
5428
|
+
s - c,
|
|
5429
|
+
0.05 + g + l * e.flatIndex
|
|
5214
5430
|
];
|
|
5215
5431
|
{
|
|
5216
|
-
const
|
|
5217
|
-
if (isNaN(
|
|
5218
|
-
|
|
5432
|
+
const p = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5433
|
+
if (isNaN(p))
|
|
5434
|
+
D.error("Link's distance must be a Numeric");
|
|
5219
5435
|
else {
|
|
5220
|
-
const
|
|
5221
|
-
|
|
5222
|
-
Math.min(
|
|
5223
|
-
g +
|
|
5224
|
-
),
|
|
5225
|
-
Math.min(
|
|
5226
|
-
g +
|
|
5436
|
+
const m = s - c - p, d = o - c - p;
|
|
5437
|
+
u.push(
|
|
5438
|
+
Math.min(d, m),
|
|
5439
|
+
g + l * e.flatIndex
|
|
5440
|
+
), u.push(
|
|
5441
|
+
Math.min(d, m),
|
|
5442
|
+
g + l * i.flatIndex
|
|
5227
5443
|
);
|
|
5228
5444
|
}
|
|
5229
5445
|
}
|
|
5230
|
-
return
|
|
5446
|
+
return u.push(o - c, g + l * i.flatIndex), u;
|
|
5231
5447
|
}
|
|
5232
5448
|
/** 生成 SF 连线 */
|
|
5233
5449
|
createSF(t, e, i, s, n, o, r) {
|
|
5234
|
-
const
|
|
5235
|
-
s -
|
|
5236
|
-
0.05 + g +
|
|
5450
|
+
const h = this.context.getOptions().header.height, l = this.context.getOptions().row.height, g = l / 2 + h, c = t.gap || this.context.getOptions().links.gap, u = [
|
|
5451
|
+
s - c,
|
|
5452
|
+
0.05 + g + l * e.flatIndex
|
|
5237
5453
|
];
|
|
5238
5454
|
{
|
|
5239
|
-
const
|
|
5240
|
-
if (isNaN(
|
|
5241
|
-
|
|
5455
|
+
const p = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5456
|
+
if (isNaN(p))
|
|
5457
|
+
D.error("Link's distance must be a Numeric");
|
|
5242
5458
|
else {
|
|
5243
|
-
const
|
|
5244
|
-
Math.min(
|
|
5245
|
-
g +
|
|
5459
|
+
const m = s - c - p, d = r + c + p, x = [
|
|
5460
|
+
Math.min(m, d),
|
|
5461
|
+
g + l * e.flatIndex
|
|
5246
5462
|
];
|
|
5247
|
-
|
|
5248
|
-
const w =
|
|
5249
|
-
|
|
5463
|
+
u.push(...x);
|
|
5464
|
+
const w = l * e.flatIndex + h + (e.flatIndex <= i.flatIndex ? l : 0);
|
|
5465
|
+
u.push(x[0], w), u.push(d, w), u.push(d, g + l * i.flatIndex);
|
|
5250
5466
|
}
|
|
5251
5467
|
}
|
|
5252
|
-
return
|
|
5468
|
+
return u.push(r + c, g + l * i.flatIndex), u;
|
|
5253
5469
|
}
|
|
5254
5470
|
/**
|
|
5255
5471
|
* 处理连线被点击后的移动
|
|
5256
5472
|
*/
|
|
5257
5473
|
handleDrag(t, e, i, s, n) {
|
|
5258
|
-
var x, w,
|
|
5474
|
+
var x, w, T;
|
|
5259
5475
|
if (!this.isDragging || this.context.getOptions().links.move.enabled !== !0) return;
|
|
5260
5476
|
this.stage.container().style.cursor = "pointer";
|
|
5261
5477
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
@@ -5266,45 +5482,45 @@ class Be {
|
|
|
5266
5482
|
// 箭头长度
|
|
5267
5483
|
pointerWidth: ((w = e.arrow) == null ? void 0 : w.width) ?? this.context.getOptions().links.arrow.width,
|
|
5268
5484
|
// 箭头宽度
|
|
5269
|
-
fill: ((
|
|
5485
|
+
fill: ((T = e.arrow) == null ? void 0 : T.color) || this.context.getOptions().links.arrow.color || e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5270
5486
|
// 箭头填充色
|
|
5271
5487
|
lineJoin: "round",
|
|
5272
5488
|
dash: e.data || this.context.getOptions().links.dash
|
|
5273
5489
|
}), this.templateArrow.visible(!1);
|
|
5274
5490
|
let r = null;
|
|
5275
|
-
const
|
|
5276
|
-
let
|
|
5277
|
-
const
|
|
5278
|
-
const
|
|
5279
|
-
if (!
|
|
5280
|
-
const { allowLeft:
|
|
5281
|
-
if (this.templateArrow.visible(!0), o == null || o.visible(!1),
|
|
5282
|
-
const
|
|
5283
|
-
let
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
g +
|
|
5491
|
+
const h = this.context.getOptions().header.height, l = this.context.getOptions().row.height, g = l / 2 + h, c = e.gap || this.context.getOptions().links.gap;
|
|
5492
|
+
let u = null;
|
|
5493
|
+
const p = () => {
|
|
5494
|
+
const v = this.stage.getPointerPosition();
|
|
5495
|
+
if (!v || (u = this.getTaskByPosition(v), !u)) return;
|
|
5496
|
+
const { allowLeft: b, allowRight: O } = this.isAllowDrop(u, e.from);
|
|
5497
|
+
if (this.templateArrow.visible(!0), o == null || o.visible(!1), u != null && u.startTime && (u != null && u.endTime)) {
|
|
5498
|
+
const M = this.context.store.getTimeAxis().getTimeLeft(u.startTime), E = this.context.store.getTimeAxis().getTimeLeft(u.endTime), k = (E + M) / 2 + this.offsetX;
|
|
5499
|
+
let L = M - c;
|
|
5500
|
+
v.x <= k ? r = "S" : (r = "F", L = E + c), i === "S" ? (this.templateArrow.points([
|
|
5501
|
+
L,
|
|
5502
|
+
g + l * u.flatIndex,
|
|
5287
5503
|
...s
|
|
5288
|
-
]),
|
|
5504
|
+
]), O ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed") : i === "F" && (this.templateArrow.points([
|
|
5289
5505
|
...s,
|
|
5290
|
-
|
|
5291
|
-
g +
|
|
5292
|
-
]),
|
|
5506
|
+
L,
|
|
5507
|
+
g + l * u.flatIndex
|
|
5508
|
+
]), b ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed");
|
|
5293
5509
|
}
|
|
5294
|
-
},
|
|
5295
|
-
var
|
|
5296
|
-
let
|
|
5297
|
-
const
|
|
5298
|
-
if (r &&
|
|
5299
|
-
const { allowLeft:
|
|
5300
|
-
|
|
5510
|
+
}, m = () => {
|
|
5511
|
+
var O, M;
|
|
5512
|
+
let v;
|
|
5513
|
+
const b = J(e);
|
|
5514
|
+
if (r && u && (i === "S" ? (v = `${r}${(e.type || "FS")[1]}`, b.from = u.id) : i === "F" && (v = `${(e.type || "FS")[0]}${r}`, b.to = u.id)), v && u && !(b.from === b.to && ["FF", "SS"].includes(v))) {
|
|
5515
|
+
const { allowLeft: E, allowRight: k } = this.isAllowDrop(u, b.from);
|
|
5516
|
+
b.type = v, ((O = b.type) == null ? void 0 : O.slice(1)) === "S" && E || ((M = b.type) == null ? void 0 : M.slice(1)) === "F" && k ? this.context.event.emit(S.UPDATE_LINK, b) : this.context.event.emit(S.ERROR, q.LINK_NOT_ALLOWED);
|
|
5301
5517
|
} else
|
|
5302
|
-
this.context.event.emit(
|
|
5303
|
-
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, this.calculateLinks(), document.removeEventListener("mousemove",
|
|
5304
|
-
},
|
|
5305
|
-
|
|
5518
|
+
this.context.event.emit(S.ERROR, q.LINK_SAME);
|
|
5519
|
+
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, this.calculateLinks(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m);
|
|
5520
|
+
}, d = (v) => {
|
|
5521
|
+
v.key === "Escape" && (this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, o == null || o.visible(!0), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m), document.removeEventListener("keydown", d));
|
|
5306
5522
|
};
|
|
5307
|
-
document.addEventListener("mousemove",
|
|
5523
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", m), document.addEventListener("keydown", d);
|
|
5308
5524
|
}
|
|
5309
5525
|
/**
|
|
5310
5526
|
* 处理连线被点击后的移动
|
|
@@ -5322,45 +5538,45 @@ class Be {
|
|
|
5322
5538
|
dash: this.context.getOptions().links.dash
|
|
5323
5539
|
}), this.templateArrow.visible(!1);
|
|
5324
5540
|
let o = null;
|
|
5325
|
-
const r = this.context.getOptions().header.height,
|
|
5326
|
-
let
|
|
5327
|
-
const
|
|
5328
|
-
const
|
|
5329
|
-
if (!
|
|
5330
|
-
const { allowLeft: x, allowRight: w } = this.isAllowDrop(
|
|
5331
|
-
if (this.templateArrow.visible(!0),
|
|
5332
|
-
const
|
|
5333
|
-
let
|
|
5334
|
-
|
|
5541
|
+
const r = this.context.getOptions().header.height, h = this.context.getOptions().row.height, l = h / 2 + r, g = this.context.getOptions().links.gap;
|
|
5542
|
+
let c = null;
|
|
5543
|
+
const u = () => {
|
|
5544
|
+
const d = this.stage.getPointerPosition();
|
|
5545
|
+
if (!d || (c = this.getTaskByPosition(d), !c)) return;
|
|
5546
|
+
const { allowLeft: x, allowRight: w } = this.isAllowDrop(c, n);
|
|
5547
|
+
if (this.templateArrow.visible(!0), c.startTime && c.endTime) {
|
|
5548
|
+
const T = this.context.store.getTimeAxis().getTimeLeft(c.startTime), v = this.context.store.getTimeAxis().getTimeLeft(c.endTime), b = (v + T) / 2 + this.offsetX;
|
|
5549
|
+
let O = T - g;
|
|
5550
|
+
d.x <= b ? o = "S" : (o = "F", O = v + g), this.templateArrow.points([
|
|
5335
5551
|
...s,
|
|
5336
|
-
|
|
5337
|
-
|
|
5552
|
+
O,
|
|
5553
|
+
l + h * c.flatIndex
|
|
5338
5554
|
]), o === "S" && !x ? this.stage.container().style.cursor = "not-allowed" : o === "F" && !w ? this.stage.container().style.cursor = "not-allowed" : this.stage.container().style.cursor = "pointer";
|
|
5339
5555
|
}
|
|
5340
|
-
},
|
|
5341
|
-
let
|
|
5342
|
-
if (o && (
|
|
5343
|
-
if (this.context.getOptions().links.data.some((x) => x.from === n && x.to ===
|
|
5344
|
-
this.context.event.emit(
|
|
5345
|
-
else if (n ===
|
|
5346
|
-
this.context.event.emit(
|
|
5556
|
+
}, p = () => {
|
|
5557
|
+
let d;
|
|
5558
|
+
if (o && (d = `${e}${o}`), d && c)
|
|
5559
|
+
if (this.context.getOptions().links.data.some((x) => x.from === n && x.to === c.id && x.type === d))
|
|
5560
|
+
this.context.event.emit(S.ERROR, q.LINK_EXIST);
|
|
5561
|
+
else if (n === c.id && e === o)
|
|
5562
|
+
this.context.event.emit(S.ERROR, q.LINK_SAME);
|
|
5347
5563
|
else {
|
|
5348
|
-
const { allowLeft: x, allowRight: w } = this.isAllowDrop(
|
|
5349
|
-
o === "S" && x || o === "F" && w ? this.context.event.emit(
|
|
5564
|
+
const { allowLeft: x, allowRight: w } = this.isAllowDrop(c, n);
|
|
5565
|
+
o === "S" && x || o === "F" && w ? this.context.event.emit(S.CREATE_LINK, {
|
|
5350
5566
|
from: n,
|
|
5351
|
-
to:
|
|
5352
|
-
type:
|
|
5567
|
+
to: c.id,
|
|
5568
|
+
type: d,
|
|
5353
5569
|
color: i
|
|
5354
5570
|
}) : this.context.event.emit(
|
|
5355
|
-
|
|
5571
|
+
S.ERROR,
|
|
5356
5572
|
q.LINK_NOT_ALLOWED
|
|
5357
5573
|
);
|
|
5358
5574
|
}
|
|
5359
|
-
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, this.calculateLinks(), document.removeEventListener("mousemove",
|
|
5360
|
-
},
|
|
5361
|
-
|
|
5575
|
+
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, this.calculateLinks(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", p);
|
|
5576
|
+
}, m = (d) => {
|
|
5577
|
+
d.key === "Escape" && (this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", m));
|
|
5362
5578
|
};
|
|
5363
|
-
document.addEventListener("mousemove",
|
|
5579
|
+
document.addEventListener("mousemove", u), document.addEventListener("mouseup", p), document.addEventListener("keydown", m);
|
|
5364
5580
|
}
|
|
5365
5581
|
/**
|
|
5366
5582
|
* 按照位置获取任务
|
|
@@ -5381,7 +5597,7 @@ class Be {
|
|
|
5381
5597
|
return j(n) && (n = n(
|
|
5382
5598
|
t.getEmitData(),
|
|
5383
5599
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
5384
|
-
)),
|
|
5600
|
+
)), pt(n) ? i = s = n : X(n) && (i = n === "S", s = n === "F"), {
|
|
5385
5601
|
allowLeft: i,
|
|
5386
5602
|
allowRight: s
|
|
5387
5603
|
};
|
|
@@ -5390,18 +5606,18 @@ class Be {
|
|
|
5390
5606
|
* 操作高亮关联线
|
|
5391
5607
|
*/
|
|
5392
5608
|
handleHighlight(t, e, i, s, n, o, r = !1) {
|
|
5393
|
-
const
|
|
5394
|
-
|
|
5395
|
-
node:
|
|
5609
|
+
const h = t.findOne("Circle"), l = t.findOne("Arrow"), g = t.findOne("Line");
|
|
5610
|
+
h && new y.Tween({
|
|
5611
|
+
node: h,
|
|
5396
5612
|
radius: e + o,
|
|
5397
5613
|
duration: r ? 0 : 0.1
|
|
5398
|
-
}).play(),
|
|
5399
|
-
node:
|
|
5614
|
+
}).play(), l && new y.Tween({
|
|
5615
|
+
node: l,
|
|
5400
5616
|
pointerWidth: i + o,
|
|
5401
5617
|
pointerLength: s + o,
|
|
5402
5618
|
strokeWidth: n + o,
|
|
5403
5619
|
duration: r ? 0 : 0.1
|
|
5404
|
-
}).play(), g && new
|
|
5620
|
+
}).play(), g && new y.Tween({
|
|
5405
5621
|
node: g,
|
|
5406
5622
|
strokeWidth: n + o,
|
|
5407
5623
|
duration: r ? 0 : 0.1
|
|
@@ -5419,18 +5635,18 @@ class Be {
|
|
|
5419
5635
|
/** 操作创建点的高亮 */
|
|
5420
5636
|
handlePointHighlight(t, e) {
|
|
5421
5637
|
const i = this.pointGroup.findOne(`#point-${t}-left`), s = this.pointGroup.findOne(`#point-${t}-right`);
|
|
5422
|
-
i && new
|
|
5638
|
+
i && new y.Tween({
|
|
5423
5639
|
node: i,
|
|
5424
5640
|
opacity: e,
|
|
5425
5641
|
duration: 0.1
|
|
5426
|
-
}).play(), s && new
|
|
5642
|
+
}).play(), s && new y.Tween({
|
|
5427
5643
|
node: s,
|
|
5428
5644
|
opacity: e,
|
|
5429
5645
|
duration: 0.1
|
|
5430
5646
|
}).play();
|
|
5431
5647
|
}
|
|
5432
5648
|
}
|
|
5433
|
-
class
|
|
5649
|
+
class Pe {
|
|
5434
5650
|
constructor(t, e, i) {
|
|
5435
5651
|
a(this, "tasks", []);
|
|
5436
5652
|
a(this, "chartBaselineGroup");
|
|
@@ -5441,7 +5657,7 @@ class ze {
|
|
|
5441
5657
|
a(this, "height", 0);
|
|
5442
5658
|
a(this, "offsetX", 0);
|
|
5443
5659
|
a(this, "offsetY", 0);
|
|
5444
|
-
this.context = t, this.stage = e, this.layer = i, this.chartBaselineGroup = new
|
|
5660
|
+
this.context = t, this.stage = e, this.layer = i, this.chartBaselineGroup = new y.Group({ name: "chart-baseline-group" }), this.baselineGroup = new y.Group({ name: "baseline-group" }), this.chartBaselineGroup.add(this.baselineGroup), this.indicatorGroup = new y.Group({ name: "baseline-indicator-group" }), this.chartBaselineGroup.add(this.indicatorGroup), this.layer.add(this.chartBaselineGroup), this.registerEvents();
|
|
5445
5661
|
}
|
|
5446
5662
|
/**
|
|
5447
5663
|
* 注册事件
|
|
@@ -5488,155 +5704,155 @@ class ze {
|
|
|
5488
5704
|
), n = this.context.getOptions().baselines.opacity, o = this.context.getOptions().baselines.backgroundColor;
|
|
5489
5705
|
this.tasks.forEach((r) => {
|
|
5490
5706
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r) && this.context.store.getDataManager().isTaskVisible(r)) {
|
|
5491
|
-
const
|
|
5707
|
+
const h = this.context.store.getDataManager().getBaselinesByTaskId(r.id), l = st(
|
|
5492
5708
|
this.context.getOptions().baselines.height || this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, r),
|
|
5493
5709
|
e
|
|
5494
5710
|
), g = this.context.getOptions().baselines.offset ?? 0;
|
|
5495
|
-
|
|
5496
|
-
if (!
|
|
5497
|
-
const
|
|
5498
|
-
this.renderBaselineBar(
|
|
5499
|
-
const x = this.context.getOptions().baselines.compare, w =
|
|
5711
|
+
h.forEach((c, u) => {
|
|
5712
|
+
if (!c.validate()) return;
|
|
5713
|
+
const p = this.context.store.getTimeAxis().getTimeLeft(c.startTime), m = this.context.store.getTimeAxis().getTimeLeft(c.endTime), d = new y.Group({ id: `baseline-group-${c.id}` });
|
|
5714
|
+
this.renderBaselineBar(d, r, c, p, m, i, e, l, t, o, n, s, g);
|
|
5715
|
+
const x = this.context.getOptions().baselines.compare, w = c.getTimeDiff();
|
|
5500
5716
|
if (!x.enabled || !w) return;
|
|
5501
|
-
const
|
|
5502
|
-
|
|
5717
|
+
const T = x.mode;
|
|
5718
|
+
c.highlight && (T === "highlight" || T === "both") && this.renderCompareHighlight(d, r, c, w), u === 0 && (T === "indicator" || T === "both") && this.renderCompareIndicator(r, c, w), this.bindEvents(d, r, c), this.baselineGroup.add(d);
|
|
5503
5719
|
});
|
|
5504
5720
|
}
|
|
5505
5721
|
});
|
|
5506
5722
|
}
|
|
5507
|
-
renderBaselineBar(t, e, i, s, n, o, r,
|
|
5723
|
+
renderBaselineBar(t, e, i, s, n, o, r, h, l, g, c, u, p) {
|
|
5508
5724
|
if (this.context.getOptions().baselines.mode === "shadow") {
|
|
5509
|
-
const
|
|
5725
|
+
const m = o + r * e.flatIndex - h / 2 + p, d = new y.Rect({
|
|
5510
5726
|
id: `baseline-item-${i.id}`,
|
|
5511
5727
|
x: s,
|
|
5512
|
-
y:
|
|
5728
|
+
y: m,
|
|
5513
5729
|
width: n - s,
|
|
5514
|
-
height:
|
|
5515
|
-
cornerRadius:
|
|
5730
|
+
height: h,
|
|
5731
|
+
cornerRadius: u,
|
|
5516
5732
|
fill: g,
|
|
5517
|
-
opacity:
|
|
5733
|
+
opacity: c
|
|
5518
5734
|
});
|
|
5519
|
-
t.add(
|
|
5735
|
+
t.add(d), this.renderText(t, e, i, s, n, m, h);
|
|
5520
5736
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
5521
|
-
const
|
|
5522
|
-
let
|
|
5737
|
+
const m = st(this.context.getOptions().baselines.height ?? 5, r);
|
|
5738
|
+
let d = l + r * e.flatIndex + p;
|
|
5523
5739
|
const x = this.context.getOptions().baselines.position;
|
|
5524
5740
|
let w = "";
|
|
5525
|
-
x === "top" ? (
|
|
5526
|
-
const
|
|
5741
|
+
x === "top" ? (d += +m / 2, w = "line_top") : x === "center" ? (d += r / 2, w = "line_center") : (d += r - m / 2, w = "line_bottom");
|
|
5742
|
+
const T = new y.Line({
|
|
5527
5743
|
id: `baseline-item-${i.id}`,
|
|
5528
|
-
points: [s,
|
|
5744
|
+
points: [s, d, n, d],
|
|
5529
5745
|
stroke: g,
|
|
5530
|
-
opacity:
|
|
5531
|
-
strokeWidth:
|
|
5746
|
+
opacity: c,
|
|
5747
|
+
strokeWidth: m,
|
|
5532
5748
|
lineCap: "butt",
|
|
5533
5749
|
lineJoin: "round"
|
|
5534
5750
|
});
|
|
5535
|
-
t.add(
|
|
5751
|
+
t.add(T), this.renderText(t, e, i, s, n, d, m, w);
|
|
5536
5752
|
}
|
|
5537
5753
|
}
|
|
5538
|
-
renderText(t, e, i, s, n, o, r,
|
|
5539
|
-
const
|
|
5754
|
+
renderText(t, e, i, s, n, o, r, h) {
|
|
5755
|
+
const l = `chart-baseline-text-${i.id}`;
|
|
5540
5756
|
if ((() => {
|
|
5541
|
-
this.baselineGroup.find(`#${
|
|
5757
|
+
this.baselineGroup.find(`#${l}`) && this.baselineGroup.find(`#${l}`).forEach((w) => w.remove());
|
|
5542
5758
|
})(), !this.context.getOptions().baselines.label.show) return;
|
|
5543
|
-
const
|
|
5544
|
-
if (!
|
|
5545
|
-
const
|
|
5546
|
-
text:
|
|
5547
|
-
id:
|
|
5759
|
+
const c = this.context.getOptions().baselines.label.field, u = c ? i.getField(c) : i.name;
|
|
5760
|
+
if (!u || u === "") return;
|
|
5761
|
+
const p = n - s - 10, m = Math.max(this.context.getOptions().baselines.label.fontSize, r), d = new y.Text({
|
|
5762
|
+
text: u,
|
|
5763
|
+
id: l,
|
|
5548
5764
|
x: s + 5,
|
|
5549
5765
|
y: o,
|
|
5550
|
-
width:
|
|
5551
|
-
height:
|
|
5766
|
+
width: p,
|
|
5767
|
+
height: m,
|
|
5552
5768
|
fill: this.context.getOptions().baselines.label.color,
|
|
5553
5769
|
fontSize: this.context.getOptions().baselines.label.fontSize,
|
|
5554
5770
|
fontFamily: this.context.getOptions().baselines.label.fontFamily || "Arial",
|
|
5555
5771
|
align: this.context.getOptions().baselines.label.position,
|
|
5556
5772
|
verticalAlign: "bottom"
|
|
5557
5773
|
});
|
|
5558
|
-
|
|
5559
|
-
y: o -
|
|
5774
|
+
h === "line_bottom" ? d.setAttrs({
|
|
5775
|
+
y: o - m / 2,
|
|
5560
5776
|
verticalAlign: "top"
|
|
5561
|
-
}) :
|
|
5562
|
-
y: o -
|
|
5777
|
+
}) : h === "line_center" ? d.setAttrs({
|
|
5778
|
+
y: o - m / 2,
|
|
5563
5779
|
verticalAlign: "middle"
|
|
5564
|
-
}) :
|
|
5780
|
+
}) : h === "line_top" && d.setAttrs({
|
|
5565
5781
|
y: o - r / 2,
|
|
5566
5782
|
verticalAlign: "bottom"
|
|
5567
|
-
}), r >=
|
|
5783
|
+
}), r >= m && d.setAttrs({
|
|
5568
5784
|
verticalAlign: "middle"
|
|
5569
5785
|
});
|
|
5570
|
-
const x =
|
|
5571
|
-
(this.context.getOptions().baselines.label.forceDisplay ||
|
|
5786
|
+
const x = d.measureSize(u);
|
|
5787
|
+
(this.context.getOptions().baselines.label.forceDisplay || p > x.width) && t.add(d);
|
|
5572
5788
|
}
|
|
5573
5789
|
renderCompareHighlight(t, e, i, s) {
|
|
5574
5790
|
const n = s[`${this.context.getOptions().baselines.compare.target}Status`];
|
|
5575
5791
|
if (!n || n === "ontime") return;
|
|
5576
5792
|
const o = t.findOne(`#baseline-item-${i.id}`);
|
|
5577
5793
|
if (!o) return;
|
|
5578
|
-
const r = this.context.getOptions().baselines.compare,
|
|
5579
|
-
if (
|
|
5580
|
-
|
|
5581
|
-
else if (
|
|
5582
|
-
|
|
5794
|
+
const r = this.context.getOptions().baselines.compare, h = this.context.getOptions().baselines.mode, l = { fill: "", stroke: "", opacity: r[n].opacity };
|
|
5795
|
+
if (h === "shadow")
|
|
5796
|
+
l.fill = r[n].backgroundColor;
|
|
5797
|
+
else if (h === "line")
|
|
5798
|
+
l.stroke = r[n].backgroundColor;
|
|
5583
5799
|
else
|
|
5584
5800
|
return;
|
|
5585
|
-
o.setAttrs(
|
|
5801
|
+
o.setAttrs(l);
|
|
5586
5802
|
}
|
|
5587
5803
|
renderCompareIndicator(t, e, i) {
|
|
5588
5804
|
const s = this.context.getOptions().baselines, n = s.compare.indicator;
|
|
5589
5805
|
if (!n || !n.show) return;
|
|
5590
|
-
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height,
|
|
5806
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, h = st(
|
|
5591
5807
|
this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, t),
|
|
5592
5808
|
r
|
|
5593
5809
|
);
|
|
5594
|
-
let
|
|
5595
|
-
const g = this.context.store.getTimeAxis().getTimeLeft(t.startTime),
|
|
5596
|
-
let
|
|
5597
|
-
if (n.position === "bottom" && (
|
|
5598
|
-
const
|
|
5599
|
-
if (
|
|
5600
|
-
|
|
5601
|
-
const
|
|
5810
|
+
let l = s.backgroundColor;
|
|
5811
|
+
const g = this.context.store.getTimeAxis().getTimeLeft(t.startTime), c = this.context.store.getTimeAxis().getTimeLeft(t.endTime);
|
|
5812
|
+
let u = (r - h) / 2 + r * t.flatIndex + o;
|
|
5813
|
+
if (n.position === "bottom" && (u += h), n.show === "start" || n.show === "both" || n.show === !0) {
|
|
5814
|
+
const p = i.startStatus;
|
|
5815
|
+
if (p && s.compare.indicator[p].show) {
|
|
5816
|
+
l = F(s.compare.indicator[p].color).alpha(s.compare.indicator[p].opacity).toHex();
|
|
5817
|
+
const m = new y.Circle({
|
|
5602
5818
|
x: g - n.size,
|
|
5603
|
-
y:
|
|
5604
|
-
fill:
|
|
5819
|
+
y: u,
|
|
5820
|
+
fill: l,
|
|
5605
5821
|
radius: n.size / 2
|
|
5606
5822
|
});
|
|
5607
|
-
this.indicatorGroup.add(
|
|
5608
|
-
let
|
|
5609
|
-
const x = s.compare.indicator[
|
|
5610
|
-
j(x) ?
|
|
5611
|
-
const w = new
|
|
5612
|
-
y:
|
|
5613
|
-
text:
|
|
5614
|
-
fill:
|
|
5823
|
+
this.indicatorGroup.add(m);
|
|
5824
|
+
let d = `${lt(i.startDiff)}${i.unit} ${p}`;
|
|
5825
|
+
const x = s.compare.indicator[p].text;
|
|
5826
|
+
j(x) ? d = x(i.startDiff, { ...t.getEmitData(), baseline: e }) : X(x) && (d = x);
|
|
5827
|
+
const w = new y.Text({
|
|
5828
|
+
y: u - n.fontSize / 2,
|
|
5829
|
+
text: d,
|
|
5830
|
+
fill: l,
|
|
5615
5831
|
fontSize: n.fontSize,
|
|
5616
5832
|
fontFamily: n.fontFamily || "Arial"
|
|
5617
|
-
}),
|
|
5618
|
-
w.x(g - n.size -
|
|
5833
|
+
}), T = w.measureSize(d);
|
|
5834
|
+
w.x(g - n.size - T.width - 5), this.indicatorGroup.add(w);
|
|
5619
5835
|
}
|
|
5620
5836
|
}
|
|
5621
5837
|
if (n.show === "end" || n.show === "both" || n.show === !0) {
|
|
5622
|
-
const
|
|
5623
|
-
if (
|
|
5624
|
-
|
|
5625
|
-
const
|
|
5626
|
-
x:
|
|
5627
|
-
y:
|
|
5628
|
-
fill:
|
|
5838
|
+
const p = i.endStatus;
|
|
5839
|
+
if (p && s.compare.indicator[p].show) {
|
|
5840
|
+
l = F(s.compare.indicator[p].color).alpha(s.compare.indicator[p].opacity).toHex();
|
|
5841
|
+
const m = new y.Circle({
|
|
5842
|
+
x: c + n.size,
|
|
5843
|
+
y: u,
|
|
5844
|
+
fill: l,
|
|
5629
5845
|
radius: n.size / 2
|
|
5630
5846
|
});
|
|
5631
|
-
this.indicatorGroup.add(
|
|
5632
|
-
let
|
|
5633
|
-
const x = s.compare.indicator[
|
|
5634
|
-
j(x) ?
|
|
5635
|
-
const w = new
|
|
5636
|
-
x:
|
|
5637
|
-
y:
|
|
5638
|
-
text:
|
|
5639
|
-
fill:
|
|
5847
|
+
this.indicatorGroup.add(m);
|
|
5848
|
+
let d = `${lt(i.endDiff)}${i.unit} ${p}`;
|
|
5849
|
+
const x = s.compare.indicator[p].text;
|
|
5850
|
+
j(x) ? d = x(i.endDiff, { ...t.getEmitData(), baseline: e }) : X(x) && (d = x);
|
|
5851
|
+
const w = new y.Text({
|
|
5852
|
+
x: c + n.size + 5,
|
|
5853
|
+
y: u - n.fontSize / 2,
|
|
5854
|
+
text: d,
|
|
5855
|
+
fill: l,
|
|
5640
5856
|
fontSize: n.fontSize,
|
|
5641
5857
|
fontFamily: n.fontFamily || "Arial"
|
|
5642
5858
|
});
|
|
@@ -5646,15 +5862,15 @@ class ze {
|
|
|
5646
5862
|
}
|
|
5647
5863
|
bindEvents(t, e, i) {
|
|
5648
5864
|
t.on("mouseover", (s) => {
|
|
5649
|
-
this.context.event.emit(
|
|
5865
|
+
this.context.event.emit(S.BASELINE_MOUSEOVER, s.evt, e, i);
|
|
5650
5866
|
}), t.on("mouseout", (s) => {
|
|
5651
|
-
this.context.event.emit(
|
|
5867
|
+
this.context.event.emit(S.BASELINE_MOUSEOUT, s.evt, e, i);
|
|
5652
5868
|
}), t.on("click", (s) => {
|
|
5653
|
-
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(
|
|
5869
|
+
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);
|
|
5654
5870
|
});
|
|
5655
5871
|
}
|
|
5656
5872
|
}
|
|
5657
|
-
class
|
|
5873
|
+
class Ye {
|
|
5658
5874
|
constructor(t, e) {
|
|
5659
5875
|
// Konva 元素
|
|
5660
5876
|
a(this, "stage");
|
|
@@ -5663,6 +5879,7 @@ class Pe {
|
|
|
5663
5879
|
a(this, "gridGroup");
|
|
5664
5880
|
a(this, "weekendGroup");
|
|
5665
5881
|
a(this, "holidayGroup");
|
|
5882
|
+
a(this, "flagGroup");
|
|
5666
5883
|
a(this, "todayLayer");
|
|
5667
5884
|
a(this, "linkGroup");
|
|
5668
5885
|
a(this, "baselineGroup");
|
|
@@ -5670,15 +5887,15 @@ class Pe {
|
|
|
5670
5887
|
a(this, "bodyLayer");
|
|
5671
5888
|
a(this, "width", 0);
|
|
5672
5889
|
a(this, "height", 0);
|
|
5673
|
-
this.context = t, this.container = e, this.stage = new
|
|
5890
|
+
this.context = t, this.container = e, this.stage = new y.Stage({
|
|
5674
5891
|
container: this.container,
|
|
5675
5892
|
width: this.container.clientWidth,
|
|
5676
5893
|
height: this.container.clientHeight
|
|
5677
|
-
}), this.bgLayer = new
|
|
5894
|
+
}), this.bgLayer = new y.Layer(), this.weekendGroup = new We(this.context, this.bgLayer), this.holidayGroup = new Fe(this.context, this.bgLayer), this.flagGroup = new Be(this.context, this.bgLayer), this.gridGroup = new Ae(this.context, this.bgLayer), this.stage.add(this.bgLayer), this.headerLayer = new He(this.context, this.stage), this.todayLayer = new $e(
|
|
5678
5895
|
this.context,
|
|
5679
5896
|
this.bgLayer,
|
|
5680
5897
|
this.headerLayer.layer
|
|
5681
|
-
), this.bodyLayer = new
|
|
5898
|
+
), this.bodyLayer = new y.Layer(), this.linkGroup = new ze(this.context, this.stage, this.bodyLayer), this.baselineGroup = new Pe(this.context, this.stage, this.bodyLayer), this.bodyGroup = new Re(
|
|
5682
5899
|
this.context,
|
|
5683
5900
|
this.stage,
|
|
5684
5901
|
this.bodyLayer,
|
|
@@ -5689,10 +5906,10 @@ class Pe {
|
|
|
5689
5906
|
* 调整大小
|
|
5690
5907
|
*/
|
|
5691
5908
|
resize(t, e) {
|
|
5692
|
-
this.width = t, this.height = e, this.context.store.getTimeAxis().setAllWidth(t), this.stage.width(t), this.stage.height(e), this.headerLayer.resize(t), this.gridGroup.resize(t, e), this.linkGroup.resize(t, e), this.baselineGroup.resize(t, e), this.holidayGroup.resize(t, e), this.weekendGroup.resize(t, e), this.bodyGroup.resize(t, e), this.todayLayer.resize(t, e);
|
|
5909
|
+
this.width = t, this.height = e, this.context.store.getTimeAxis().setAllWidth(t), this.stage.width(t), this.stage.height(e), this.headerLayer.resize(t), this.gridGroup.resize(t, e), this.linkGroup.resize(t, e), this.baselineGroup.resize(t, e), this.holidayGroup.resize(t, e), this.flagGroup.resize(t, e), this.weekendGroup.resize(t, e), this.bodyGroup.resize(t, e), this.todayLayer.resize(t, e);
|
|
5693
5910
|
}
|
|
5694
5911
|
render(t, e, i) {
|
|
5695
|
-
this.headerLayer.setOffset(-t, 0), this.gridGroup.setOffset(-t, -e), this.linkGroup.setOffset(-t, -e), this.baselineGroup.setOffset(-t, -e), this.weekendGroup.setOffset(-t, -e), this.holidayGroup.setOffset(-t, -e), this.bodyGroup.setOffset(-t, -e), this.todayLayer.setOffset(-t, -e), this.gridGroup.render(), this.holidayGroup.render(), this.weekendGroup.render(), this.linkGroup.render(i), this.baselineGroup.render(i), this.bodyGroup.render(i), this.headerLayer.render(), this.todayLayer.render();
|
|
5912
|
+
this.headerLayer.setOffset(-t, 0), this.gridGroup.setOffset(-t, -e), this.linkGroup.setOffset(-t, -e), this.baselineGroup.setOffset(-t, -e), this.weekendGroup.setOffset(-t, -e), this.holidayGroup.setOffset(-t, -e), this.flagGroup.setOffset(-t, -e), this.bodyGroup.setOffset(-t, -e), this.todayLayer.setOffset(-t, -e), this.gridGroup.render(), this.holidayGroup.render(), this.flagGroup.render(), this.weekendGroup.render(), this.linkGroup.render(i), this.baselineGroup.render(i), this.bodyGroup.render(i), this.headerLayer.render(), this.todayLayer.render();
|
|
5696
5913
|
}
|
|
5697
5914
|
/**
|
|
5698
5915
|
* 刷新图表(用于滚动或局部更新时的高效渲染)
|
|
@@ -5707,11 +5924,11 @@ class Pe {
|
|
|
5707
5924
|
this.bodyGroup.updateTask(t), this.linkGroup.update(), this.baselineGroup.update();
|
|
5708
5925
|
}
|
|
5709
5926
|
destroy() {
|
|
5710
|
-
this.headerLayer.destroy(), this.gridGroup.destroy(), this.bodyLayer.destroy(), this.todayLayer.destroy(), this.holidayGroup.destroy(), this.weekendGroup.destroy(), this.linkGroup.destroy(), this.baselineGroup.destroy(), this.bgLayer.destroy(), this.stage.destroy();
|
|
5927
|
+
this.headerLayer.destroy(), this.gridGroup.destroy(), this.bodyLayer.destroy(), this.todayLayer.destroy(), this.holidayGroup.destroy(), this.flagGroup.destroy(), this.weekendGroup.destroy(), this.linkGroup.destroy(), this.baselineGroup.destroy(), this.bgLayer.destroy(), this.stage.destroy();
|
|
5711
5928
|
}
|
|
5712
5929
|
}
|
|
5713
|
-
const
|
|
5714
|
-
class
|
|
5930
|
+
const Ne = '<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>';
|
|
5931
|
+
class Ue {
|
|
5715
5932
|
constructor(t, e) {
|
|
5716
5933
|
a(this, "line");
|
|
5717
5934
|
a(this, "initialX", 0);
|
|
@@ -5721,7 +5938,7 @@ class Ne {
|
|
|
5721
5938
|
"border-left-color",
|
|
5722
5939
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
5723
5940
|
"important"
|
|
5724
|
-
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML =
|
|
5941
|
+
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML = Ne, this.collapseButton.addEventListener("click", (i) => {
|
|
5725
5942
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
5726
5943
|
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
5727
5944
|
}
|
|
@@ -5733,29 +5950,29 @@ class Ne {
|
|
|
5733
5950
|
*/
|
|
5734
5951
|
addDragEvents() {
|
|
5735
5952
|
let t = 0, e = null;
|
|
5736
|
-
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (
|
|
5737
|
-
|
|
5738
|
-
const
|
|
5739
|
-
this.initialWidth = i.getColumnWidth(
|
|
5953
|
+
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (h) => {
|
|
5954
|
+
h.preventDefault(), h.stopPropagation(), t = h.clientX, e = this.container.getBoundingClientRect();
|
|
5955
|
+
const l = s[s.length - 1].key;
|
|
5956
|
+
this.initialWidth = i.getColumnWidth(l);
|
|
5740
5957
|
const g = parseInt(this.line.style.left) + 2;
|
|
5741
|
-
this.root.event.emit(
|
|
5742
|
-
const
|
|
5743
|
-
document.addEventListener("mousemove",
|
|
5744
|
-
}, o = (
|
|
5745
|
-
if (
|
|
5746
|
-
const
|
|
5958
|
+
this.root.event.emit(S.SHOW_GUIDELINE, g);
|
|
5959
|
+
const c = (p) => o(p), u = (p) => r(p, c, u);
|
|
5960
|
+
document.addEventListener("mousemove", c), document.addEventListener("mouseup", u);
|
|
5961
|
+
}, o = (h) => {
|
|
5962
|
+
if (h.preventDefault(), !e) return;
|
|
5963
|
+
const l = h.clientX - t;
|
|
5747
5964
|
s[s.length - 1].key;
|
|
5748
|
-
const g = 50 - this.initialWidth,
|
|
5749
|
-
this.root.event.emit(
|
|
5750
|
-
}, r = (
|
|
5751
|
-
document.removeEventListener("mousemove",
|
|
5752
|
-
const
|
|
5753
|
-
i.setColumnWidth(
|
|
5965
|
+
const g = 50 - this.initialWidth, u = e.width - 20 - this.initialX, p = Math.max(g, Math.min(u, l)), m = this.initialX + p;
|
|
5966
|
+
this.root.event.emit(S.MOVE_GUIDELINE, m);
|
|
5967
|
+
}, r = (h, l, g) => {
|
|
5968
|
+
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", g), this.root.event.emit(S.HIDE_GUIDELINE);
|
|
5969
|
+
const c = h.clientX - t, u = s[s.length - 1].key, p = Math.max(50, this.initialWidth + c);
|
|
5970
|
+
i.setColumnWidth(u, p), this.root.event.emit(S.UPDATE_TABLE_HEADER);
|
|
5754
5971
|
};
|
|
5755
5972
|
this.line.addEventListener("mousedown", n);
|
|
5756
5973
|
}
|
|
5757
5974
|
}
|
|
5758
|
-
class
|
|
5975
|
+
class Xe {
|
|
5759
5976
|
/**
|
|
5760
5977
|
* @param container 指示线的容器元素
|
|
5761
5978
|
*/
|
|
@@ -5781,11 +5998,11 @@ class Ue {
|
|
|
5781
5998
|
* 初始化事件监听
|
|
5782
5999
|
*/
|
|
5783
6000
|
initEvents() {
|
|
5784
|
-
this.context.event.on(
|
|
6001
|
+
this.context.event.on(S.SHOW_GUIDELINE, (t) => {
|
|
5785
6002
|
this.show(t);
|
|
5786
|
-
}), this.context.event.on(
|
|
6003
|
+
}), this.context.event.on(S.HIDE_GUIDELINE, () => {
|
|
5787
6004
|
this.hide();
|
|
5788
|
-
}), this.context.event.on(
|
|
6005
|
+
}), this.context.event.on(S.MOVE_GUIDELINE, (t) => {
|
|
5789
6006
|
this.setLeft(t);
|
|
5790
6007
|
});
|
|
5791
6008
|
}
|
|
@@ -5830,7 +6047,7 @@ class Ue {
|
|
|
5830
6047
|
return this.element.offsetLeft;
|
|
5831
6048
|
}
|
|
5832
6049
|
}
|
|
5833
|
-
class
|
|
6050
|
+
class Ve {
|
|
5834
6051
|
constructor(t = 16) {
|
|
5835
6052
|
a(this, "taskQueue", /* @__PURE__ */ new Map());
|
|
5836
6053
|
// 使用 Map 避免同类型重复任务
|
|
@@ -5850,7 +6067,7 @@ class Xe {
|
|
|
5850
6067
|
* @param handler 处理器配置
|
|
5851
6068
|
*/
|
|
5852
6069
|
registerHandler(t, e) {
|
|
5853
|
-
this.taskHandlers.set(t, e),
|
|
6070
|
+
this.taskHandlers.set(t, e), D.debug(`RenderScheduler: 注册任务处理器 ${t}`);
|
|
5854
6071
|
}
|
|
5855
6072
|
/**
|
|
5856
6073
|
* 注册任务处理器(简化版本,只传回调函数)
|
|
@@ -5870,7 +6087,7 @@ class Xe {
|
|
|
5870
6087
|
scheduleTask(t, e = [], i = {}) {
|
|
5871
6088
|
const s = this.taskHandlers.get(t);
|
|
5872
6089
|
if (!s) {
|
|
5873
|
-
|
|
6090
|
+
D.warn(`RenderScheduler: 未找到任务类型 ${t} 的处理器`);
|
|
5874
6091
|
return;
|
|
5875
6092
|
}
|
|
5876
6093
|
const n = {
|
|
@@ -5881,10 +6098,10 @@ class Xe {
|
|
|
5881
6098
|
immediate: i.immediate ?? s.immediate ?? !1
|
|
5882
6099
|
};
|
|
5883
6100
|
if (n.immediate) {
|
|
5884
|
-
|
|
6101
|
+
D.debug(`RenderScheduler: 立即执行任务 ${t}`), this.executeTask(n);
|
|
5885
6102
|
return;
|
|
5886
6103
|
}
|
|
5887
|
-
this.taskQueue.set(t, n),
|
|
6104
|
+
this.taskQueue.set(t, n), D.debug(`RenderScheduler: 添加任务到队列 ${t}`), this.debouncedFlush();
|
|
5888
6105
|
}
|
|
5889
6106
|
/**
|
|
5890
6107
|
* 立即执行指定类型的任务(跳过队列)
|
|
@@ -5895,10 +6112,10 @@ class Xe {
|
|
|
5895
6112
|
immediateExecuteTask(t, e = [], i = !1) {
|
|
5896
6113
|
const s = this.taskHandlers.get(t);
|
|
5897
6114
|
if (!s) {
|
|
5898
|
-
|
|
6115
|
+
D.warn(`RenderScheduler: 未找到任务类型 ${t} 的处理器`);
|
|
5899
6116
|
return;
|
|
5900
6117
|
}
|
|
5901
|
-
|
|
6118
|
+
D.debug(`RenderScheduler: 立即执行任务 ${t}`);
|
|
5902
6119
|
const n = {
|
|
5903
6120
|
type: t,
|
|
5904
6121
|
refresh: i,
|
|
@@ -5912,7 +6129,7 @@ class Xe {
|
|
|
5912
6129
|
* 立即执行所有队列中的任务
|
|
5913
6130
|
*/
|
|
5914
6131
|
immediateFlushAll() {
|
|
5915
|
-
|
|
6132
|
+
D.debug("RenderScheduler: 立即执行所有队列任务"), this.cancelScheduled(), this.flushTaskQueue();
|
|
5916
6133
|
}
|
|
5917
6134
|
/**
|
|
5918
6135
|
* 执行单个任务
|
|
@@ -5922,7 +6139,7 @@ class Xe {
|
|
|
5922
6139
|
try {
|
|
5923
6140
|
t.callback(...t.args || []);
|
|
5924
6141
|
} catch (e) {
|
|
5925
|
-
|
|
6142
|
+
D.error(`RenderScheduler: 执行任务 ${t.type} 时出错:`, e);
|
|
5926
6143
|
}
|
|
5927
6144
|
}
|
|
5928
6145
|
/**
|
|
@@ -5931,7 +6148,7 @@ class Xe {
|
|
|
5931
6148
|
flushTaskQueue() {
|
|
5932
6149
|
if (this.taskQueue.size === 0)
|
|
5933
6150
|
return;
|
|
5934
|
-
|
|
6151
|
+
D.debug(
|
|
5935
6152
|
`RenderScheduler: 执行任务队列,任务数量: ${this.taskQueue.size}`
|
|
5936
6153
|
);
|
|
5937
6154
|
const t = Array.from(this.taskQueue.values()).sort((e, i) => e.immediate !== i.immediate ? e.immediate ? -1 : 1 : e.refresh !== i.refresh ? e.refresh ? -1 : 1 : 0);
|
|
@@ -5950,7 +6167,7 @@ class Xe {
|
|
|
5950
6167
|
* @param taskType 任务类型
|
|
5951
6168
|
*/
|
|
5952
6169
|
unregisterHandler(t) {
|
|
5953
|
-
this.taskHandlers.delete(t), this.taskQueue.delete(t),
|
|
6170
|
+
this.taskHandlers.delete(t), this.taskQueue.delete(t), D.debug(`RenderScheduler: 移除任务处理器 ${t}`);
|
|
5954
6171
|
}
|
|
5955
6172
|
/**
|
|
5956
6173
|
* 获取当前队列中的任务数量
|
|
@@ -5968,10 +6185,10 @@ class Xe {
|
|
|
5968
6185
|
* 销毁调度器
|
|
5969
6186
|
*/
|
|
5970
6187
|
destroy() {
|
|
5971
|
-
this.cancelScheduled(), this.taskHandlers.clear(),
|
|
6188
|
+
this.cancelScheduled(), this.taskHandlers.clear(), D.debug("RenderScheduler: 已销毁");
|
|
5972
6189
|
}
|
|
5973
6190
|
}
|
|
5974
|
-
class
|
|
6191
|
+
class Ke {
|
|
5975
6192
|
constructor(t, e) {
|
|
5976
6193
|
a(this, "scrollbar");
|
|
5977
6194
|
a(this, "rootElement");
|
|
@@ -6039,12 +6256,12 @@ class Ve {
|
|
|
6039
6256
|
a(this, "handleColumnWidthChange", () => {
|
|
6040
6257
|
this.table.updateWidth(), this.updateSize();
|
|
6041
6258
|
});
|
|
6042
|
-
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
|
|
6259
|
+
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 Xe(this.context, this.container), this.middleLine = new Ue(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new _e(this.context, this.tableContainer), this.chart = new Ye(this.context, this.chartContainer), this.scrollbar = new Le(
|
|
6043
6260
|
this.context,
|
|
6044
6261
|
this.rootElement,
|
|
6045
6262
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
6046
6263
|
// 传入配置项
|
|
6047
|
-
), this.renderScheduler = new
|
|
6264
|
+
), this.renderScheduler = new Ve(16), this.setupTaskHandlers(), this.updateSize(), this.setupEventListeners();
|
|
6048
6265
|
}
|
|
6049
6266
|
getScrollbar() {
|
|
6050
6267
|
return this.scrollbar;
|
|
@@ -6082,21 +6299,21 @@ class Ve {
|
|
|
6082
6299
|
* 设置事件监听器
|
|
6083
6300
|
*/
|
|
6084
6301
|
setupEventListeners() {
|
|
6085
|
-
this.context.event.on(
|
|
6302
|
+
this.context.event.on(S.DATA_UPDATE, () => {
|
|
6086
6303
|
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
6087
|
-
}), this.context.event.on(
|
|
6304
|
+
}), this.context.event.on(S.SCROLL, () => {
|
|
6088
6305
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
6089
|
-
}), this.context.event.on(
|
|
6306
|
+
}), this.context.event.on(S.COLUMN_WIDTH_CHANGE, () => {
|
|
6090
6307
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
6091
|
-
}), this.context.event.on(
|
|
6308
|
+
}), this.context.event.on(S.VIEW_UPDATE, () => {
|
|
6092
6309
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
6093
|
-
}), this.context.event.on(
|
|
6310
|
+
}), this.context.event.on(S.UPDATE_TASK, (t) => {
|
|
6094
6311
|
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
6095
6312
|
immediate: !0
|
|
6096
6313
|
});
|
|
6097
|
-
}), this.context.event.on(
|
|
6314
|
+
}), this.context.event.on(S.CHART_OFFSET_CHANGE, () => {
|
|
6098
6315
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
6099
|
-
}), this.context.event.on(
|
|
6316
|
+
}), this.context.event.on(S.TOGGLE_COLLAPSE, () => {
|
|
6100
6317
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
6101
6318
|
});
|
|
6102
6319
|
}
|
|
@@ -6106,8 +6323,8 @@ class Ve {
|
|
|
6106
6323
|
*/
|
|
6107
6324
|
performRender(t = !1) {
|
|
6108
6325
|
this.setStyleValue();
|
|
6109
|
-
const { x: e, y: i } = this.scrollbar.getScrollPosition(), s = this.context.store.getOptionManager().getOptions().row.height, n = this.context.store.getOptionManager().getOptions().header.height, o = Math.floor(i / s), r = Math.ceil((this.height - n) / s),
|
|
6110
|
-
this.updateSize(), t ? (this.table.refresh(i,
|
|
6326
|
+
const { x: e, y: i } = this.scrollbar.getScrollPosition(), s = this.context.store.getOptionManager().getOptions().row.height, n = this.context.store.getOptionManager().getOptions().header.height, o = Math.floor(i / s), r = Math.ceil((this.height - n) / s), h = 2, l = Math.max(0, o), g = r + h, c = this.context.store.getDataManager().getVisibleTasks().slice(l, l + g);
|
|
6327
|
+
this.updateSize(), t ? (this.table.refresh(i, c), this.chart.refresh(e, i, c)) : (this.table.render(i, c), this.chart.render(e, i, c)), this.isInitialized && (this.context.event.emit(S.LOADED), this.isInitialized = !1), D.debug("execute render");
|
|
6111
6328
|
}
|
|
6112
6329
|
/**
|
|
6113
6330
|
* 公共渲染方法,向后兼容
|
|
@@ -6128,16 +6345,16 @@ class Ve {
|
|
|
6128
6345
|
);
|
|
6129
6346
|
}
|
|
6130
6347
|
destroy() {
|
|
6131
|
-
|
|
6348
|
+
D.debug("Renderer destroy"), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
6132
6349
|
}
|
|
6133
6350
|
}
|
|
6134
|
-
class
|
|
6351
|
+
class je {
|
|
6135
6352
|
constructor(t, e, i) {
|
|
6136
6353
|
a(this, "_id", Z());
|
|
6137
6354
|
a(this, "store");
|
|
6138
6355
|
a(this, "event", new Xt());
|
|
6139
6356
|
a(this, "renderer");
|
|
6140
|
-
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new Me(this, i), this.renderer = new
|
|
6357
|
+
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new Me(this, i), this.renderer = new Ke(this, this.container), this.render(), this.registerEvents(), D.debug(
|
|
6141
6358
|
"----Gantt initialized for element:",
|
|
6142
6359
|
this._id,
|
|
6143
6360
|
this.container
|
|
@@ -6158,10 +6375,10 @@ class Ke {
|
|
|
6158
6375
|
this.renderer.render();
|
|
6159
6376
|
}
|
|
6160
6377
|
updateOptions(t, e) {
|
|
6161
|
-
this.setOptions(t, e),
|
|
6378
|
+
this.setOptions(t, e), D.debug("GanttChart options updated"), this.render();
|
|
6162
6379
|
}
|
|
6163
6380
|
destroy() {
|
|
6164
|
-
|
|
6381
|
+
D.debug("Gantt destroying..."), this.event.offAll(), this.renderer.destroy(), this.container.innerHTML = "";
|
|
6165
6382
|
}
|
|
6166
6383
|
/**
|
|
6167
6384
|
* 跳转到指定日期。默认为今天
|
|
@@ -6186,11 +6403,11 @@ class Ke {
|
|
|
6186
6403
|
}
|
|
6187
6404
|
// 注册对外事件
|
|
6188
6405
|
registerEvents() {
|
|
6189
|
-
this.event.on(
|
|
6406
|
+
this.event.on(S.ERROR, (t) => {
|
|
6190
6407
|
this._emit("error", t);
|
|
6191
|
-
}), this.event.on(
|
|
6408
|
+
}), this.event.on(S.LOADED, () => {
|
|
6192
6409
|
this._emit("loaded");
|
|
6193
|
-
}), this.event.on(
|
|
6410
|
+
}), this.event.on(S.TASK_DRAG_END, (t, e) => {
|
|
6194
6411
|
this._emit(
|
|
6195
6412
|
"move",
|
|
6196
6413
|
e.map((i) => {
|
|
@@ -6201,57 +6418,57 @@ class Ke {
|
|
|
6201
6418
|
};
|
|
6202
6419
|
})
|
|
6203
6420
|
);
|
|
6204
|
-
}), this.event.on(
|
|
6421
|
+
}), this.event.on(S.CHECK_TASK, (t, e) => {
|
|
6205
6422
|
this._emit(
|
|
6206
6423
|
"select",
|
|
6207
6424
|
t.map((i) => i.data),
|
|
6208
6425
|
e,
|
|
6209
6426
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
6210
6427
|
);
|
|
6211
|
-
}), this.event.on(
|
|
6428
|
+
}), this.event.on(S.UPDATE_LINK, (t) => {
|
|
6212
6429
|
this._emit("update:link", t);
|
|
6213
|
-
}), this.event.on(
|
|
6430
|
+
}), this.event.on(S.CREATE_LINK, (t) => {
|
|
6214
6431
|
this._emit("create:link", t);
|
|
6215
6432
|
}), this.event.on(
|
|
6216
|
-
|
|
6433
|
+
S.SELECT_LINK,
|
|
6217
6434
|
(t, e, i) => {
|
|
6218
6435
|
this._emit("select:link", t, e, i);
|
|
6219
6436
|
}
|
|
6220
|
-
), this.event.on(
|
|
6437
|
+
), this.event.on(S.CONTEXT_LINK, (t, e) => {
|
|
6221
6438
|
this._emit("contextmenu:link", t, e);
|
|
6222
|
-
}), this.event.on(
|
|
6439
|
+
}), this.event.on(S.ROW_CLICK, (t, e) => {
|
|
6223
6440
|
this._emit("click:row", t, e.data);
|
|
6224
|
-
}), this.event.on(
|
|
6441
|
+
}), this.event.on(S.ROW_DBL_CLICK, (t, e) => {
|
|
6225
6442
|
this._emit("dblclick:row", t, e.data);
|
|
6226
|
-
}), this.event.on(
|
|
6443
|
+
}), this.event.on(S.ROW_CONTEXTMENU, (t, e) => {
|
|
6227
6444
|
this._emit("contextmenu:row", t, e.data);
|
|
6228
|
-
}), this.event.on(
|
|
6445
|
+
}), this.event.on(S.SLIDER_CLICK, (t, e) => {
|
|
6229
6446
|
this._emit("click:slider", t, e.data);
|
|
6230
|
-
}), this.event.on(
|
|
6447
|
+
}), this.event.on(S.SLIDER_DBL_CLICK, (t, e) => {
|
|
6231
6448
|
this._emit("dblclick:slider", t, e.data);
|
|
6232
|
-
}), this.event.on(
|
|
6449
|
+
}), this.event.on(S.SLIDER_CONTEXTMENU, (t, e) => {
|
|
6233
6450
|
this._emit("contextmenu:slider", t, e.data);
|
|
6234
|
-
}), this.event.on(
|
|
6451
|
+
}), this.event.on(S.SLIDER_HOVER, (t, e) => {
|
|
6235
6452
|
this._emit("hover:slider", t, e.data);
|
|
6236
|
-
}), this.event.on(
|
|
6453
|
+
}), this.event.on(S.SLIDER_LEAVE, (t, e) => {
|
|
6237
6454
|
this._emit("leave:slider", t, e.data);
|
|
6238
|
-
}), this.event.on(
|
|
6455
|
+
}), this.event.on(S.BASELINE_CLICK, (t, e, i) => {
|
|
6239
6456
|
this._emit("click:baseline", t, e.data, i.data);
|
|
6240
|
-
}), this.event.on(
|
|
6457
|
+
}), this.event.on(S.BASELINE_CONTEXTMENU, (t, e, i) => {
|
|
6241
6458
|
this._emit("contextmenu:baseline", t, e.data, i.data);
|
|
6242
|
-
}), this.event.on(
|
|
6459
|
+
}), this.event.on(S.BASELINE_MOUSEOVER, (t, e, i) => {
|
|
6243
6460
|
this._emit("hover:baseline", t, e.data, i.data);
|
|
6244
|
-
}), this.event.on(
|
|
6461
|
+
}), this.event.on(S.BASELINE_MOUSEOUT, (t, e, i) => {
|
|
6245
6462
|
this._emit("leave:baseline", t, e.data, i.data);
|
|
6246
6463
|
});
|
|
6247
6464
|
}
|
|
6248
6465
|
}
|
|
6249
|
-
class
|
|
6466
|
+
class ti {
|
|
6250
6467
|
constructor(t, e) {
|
|
6251
6468
|
a(this, "context");
|
|
6252
6469
|
// 管理对外事件
|
|
6253
6470
|
a(this, "events", /* @__PURE__ */ new Map());
|
|
6254
|
-
e != null && e.logLevel &&
|
|
6471
|
+
e != null && e.logLevel && D.setOptions({
|
|
6255
6472
|
showTimestamp: e.logLevel === "debug",
|
|
6256
6473
|
level: {
|
|
6257
6474
|
debug: 1,
|
|
@@ -6263,8 +6480,8 @@ class Ze {
|
|
|
6263
6480
|
});
|
|
6264
6481
|
const i = typeof t == "string" ? document.querySelector(t) : t;
|
|
6265
6482
|
if (!i)
|
|
6266
|
-
throw
|
|
6267
|
-
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new
|
|
6483
|
+
throw D.exception(`Container ${t} not found or invalid.`);
|
|
6484
|
+
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new je(i, this.events, e);
|
|
6268
6485
|
}
|
|
6269
6486
|
// *** Public API Methods ***/
|
|
6270
6487
|
/**
|
|
@@ -6318,7 +6535,7 @@ class Ze {
|
|
|
6318
6535
|
* @description 此方法通常不需要主动调用,初始化以及 `update` 中都会自动更新。 如果你需要强制刷新页面,可以在合适的时候调用此方法
|
|
6319
6536
|
*/
|
|
6320
6537
|
render() {
|
|
6321
|
-
this.context.render(),
|
|
6538
|
+
this.context.render(), D.info("Gantt rendered successfully.");
|
|
6322
6539
|
}
|
|
6323
6540
|
/**
|
|
6324
6541
|
* 销毁甘特图实例,清理所有资源
|
|
@@ -6355,7 +6572,7 @@ class Ze {
|
|
|
6355
6572
|
* @warning 销毁后的实例不能再次使用,调用任何方法都可能导致错误
|
|
6356
6573
|
*/
|
|
6357
6574
|
destroy() {
|
|
6358
|
-
|
|
6575
|
+
D.info("Gantt destroying..."), this.events.clear(), this.context.destroy(), D.info("Gantt destroyed successfully.");
|
|
6359
6576
|
}
|
|
6360
6577
|
/**
|
|
6361
6578
|
* 跳转到指定日期
|
|
@@ -6482,11 +6699,11 @@ class Ze {
|
|
|
6482
6699
|
}
|
|
6483
6700
|
}
|
|
6484
6701
|
Nt();
|
|
6485
|
-
const
|
|
6702
|
+
const ei = St;
|
|
6486
6703
|
export {
|
|
6487
|
-
|
|
6704
|
+
ti as XGantt,
|
|
6488
6705
|
F as colorjs,
|
|
6489
|
-
|
|
6706
|
+
ni as dayjs,
|
|
6490
6707
|
Z as generateId,
|
|
6491
|
-
|
|
6708
|
+
ei as version
|
|
6492
6709
|
};
|