@xpyjs/gantt-core 0.0.1-alpha.4 → 0.0.1-alpha.5
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 +1078 -1028
- package/dist/x-gantt.umd.cjs +3 -3
- package/package.json +1 -1
- package/types/models/Task.d.ts +1 -0
- package/types/rendering/chart/ChartLink.d.ts +1 -0
- package/types/types/options.d.ts +40 -0
package/dist/x-gantt.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Bt = Object.defineProperty;
|
|
2
|
-
var zt = (
|
|
3
|
-
var a = (
|
|
2
|
+
var zt = (f, t, e) => t in f ? Bt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
|
+
var a = (f, t, e) => zt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import H from "dayjs";
|
|
5
5
|
import { default as si } from "dayjs";
|
|
6
|
-
import { merge as ot, isArray as V, isString as
|
|
6
|
+
import { merge as ot, isArray as V, isString as U, isFunction as j, cloneDeep as J, isObject as Tt, isNumber as Pt, omit as gt, throttle as ft, isBoolean as mt, debounce as Yt } from "lodash-es";
|
|
7
7
|
import v from "konva";
|
|
8
|
-
const St = "0.0.1-alpha.
|
|
8
|
+
const St = "0.0.1-alpha.5";
|
|
9
9
|
function Nt() {
|
|
10
|
-
const
|
|
10
|
+
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
13
13
|
"| | || __|| _ || | ||_ _||_ _|",
|
|
@@ -16,7 +16,7 @@ function Nt() {
|
|
|
16
16
|
].forEach((o) => {
|
|
17
17
|
console.log(
|
|
18
18
|
`%c${o}`,
|
|
19
|
-
`color: ${
|
|
19
|
+
`color: ${f}; font-weight: bold; font-family: monospace;`
|
|
20
20
|
);
|
|
21
21
|
}), console.log(
|
|
22
22
|
`%c 🚀 欢迎使用 XGantt %c Version: ${St} `,
|
|
@@ -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 z = class z {
|
|
28
28
|
/**
|
|
29
29
|
* 设置日志配置
|
|
30
30
|
* @param options - 新的日志配置
|
|
31
31
|
*/
|
|
32
32
|
static setOptions(t) {
|
|
33
|
-
|
|
33
|
+
z.options = { ...z.options, ...t };
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* 获取当前日志级别
|
|
37
37
|
* @returns 当前设置的日志级别
|
|
38
38
|
*/
|
|
39
39
|
static getLevel() {
|
|
40
|
-
return
|
|
40
|
+
return z.options.level;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* 输出 DEBUG 级别的日志
|
|
@@ -45,7 +45,7 @@ const $ = class $ {
|
|
|
45
45
|
* @param args - 需要打印的参数
|
|
46
46
|
*/
|
|
47
47
|
static debug(...t) {
|
|
48
|
-
|
|
48
|
+
z.logWithLevel(1, console.debug, ...t);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* 输出 INFO 级别的日志
|
|
@@ -53,7 +53,7 @@ const $ = class $ {
|
|
|
53
53
|
* @param args - 需要打印的参数
|
|
54
54
|
*/
|
|
55
55
|
static info(...t) {
|
|
56
|
-
|
|
56
|
+
z.logWithLevel(2, console.info, ...t);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 输出 WARN 级别的日志
|
|
@@ -61,7 +61,7 @@ const $ = class $ {
|
|
|
61
61
|
* @param args - 需要打印的参数
|
|
62
62
|
*/
|
|
63
63
|
static warn(...t) {
|
|
64
|
-
|
|
64
|
+
z.logWithLevel(3, console.warn, ...t);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* 输出 ERROR 级别的日志
|
|
@@ -69,7 +69,7 @@ const $ = class $ {
|
|
|
69
69
|
* @param args - 需要打印的参数
|
|
70
70
|
*/
|
|
71
71
|
static error(...t) {
|
|
72
|
-
|
|
72
|
+
z.logWithLevel(4, console.error, ...t);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* 断言方法
|
|
@@ -78,8 +78,8 @@ const $ = class $ {
|
|
|
78
78
|
* @param args - 断言失败时需要打印的参数
|
|
79
79
|
*/
|
|
80
80
|
static assert(t, ...e) {
|
|
81
|
-
if (!t &&
|
|
82
|
-
const i =
|
|
81
|
+
if (!t && z.options.level <= 4) {
|
|
82
|
+
const i = z.formatArgs("Assertion failed:", ...e);
|
|
83
83
|
console.error(...i);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -87,13 +87,13 @@ const $ = class $ {
|
|
|
87
87
|
* 返回日志信息
|
|
88
88
|
*/
|
|
89
89
|
static getMessage(...t) {
|
|
90
|
-
return
|
|
90
|
+
return z.formatArgs(...t).join("");
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* 抛出异常
|
|
94
94
|
*/
|
|
95
95
|
static exception(...t) {
|
|
96
|
-
return new Error(
|
|
96
|
+
return new Error(z.getMessage(...t));
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* 根据级别输出日志的核心方法
|
|
@@ -102,8 +102,8 @@ const $ = class $ {
|
|
|
102
102
|
* @param args - 需要打印的参数
|
|
103
103
|
*/
|
|
104
104
|
static logWithLevel(t, e, ...i) {
|
|
105
|
-
if (
|
|
106
|
-
const s =
|
|
105
|
+
if (z.options.level <= t) {
|
|
106
|
+
const s = z.formatArgs(...i);
|
|
107
107
|
e(...s);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -113,17 +113,17 @@ const $ = class $ {
|
|
|
113
113
|
* @returns 格式化后的日志参数数组
|
|
114
114
|
*/
|
|
115
115
|
static formatArgs(...t) {
|
|
116
|
-
const e = [
|
|
117
|
-
return
|
|
116
|
+
const e = [z.Prefix];
|
|
117
|
+
return z.options.showTimestamp && e.unshift(`[${H().format("YYYY-MM-DD HH:mm:ss.SSS")}]`), [e.join(""), ...t];
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
a(
|
|
120
|
+
a(z, "Prefix", "[XGantt]"), a(z, "options", {
|
|
121
121
|
// 默认级别,INFO 及以上会被打印
|
|
122
122
|
level: 2,
|
|
123
123
|
// 默认不显示时间戳
|
|
124
124
|
showTimestamp: !1
|
|
125
125
|
});
|
|
126
|
-
let
|
|
126
|
+
let L = z;
|
|
127
127
|
const at = () => ({
|
|
128
128
|
data: [],
|
|
129
129
|
links: {
|
|
@@ -146,6 +146,9 @@ const at = () => ({
|
|
|
146
146
|
width: 2,
|
|
147
147
|
from: !0,
|
|
148
148
|
to: !0
|
|
149
|
+
},
|
|
150
|
+
move: {
|
|
151
|
+
enabled: !1
|
|
149
152
|
}
|
|
150
153
|
},
|
|
151
154
|
baselines: {
|
|
@@ -224,6 +227,13 @@ const at = () => ({
|
|
|
224
227
|
position: "top-right"
|
|
225
228
|
}
|
|
226
229
|
},
|
|
230
|
+
summary: {
|
|
231
|
+
show: !1,
|
|
232
|
+
mode: "expand",
|
|
233
|
+
move: {
|
|
234
|
+
enabled: !1
|
|
235
|
+
}
|
|
236
|
+
},
|
|
227
237
|
fields: {
|
|
228
238
|
id: "id",
|
|
229
239
|
startTime: "startTime",
|
|
@@ -323,7 +333,7 @@ class Ut {
|
|
|
323
333
|
var s;
|
|
324
334
|
let e = "";
|
|
325
335
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
326
|
-
return
|
|
336
|
+
return U(i) ? e = i : V(i) && i.length > 0 ? e = i[t.level] : j(i) && (e = i(t.getEmitData())), e;
|
|
327
337
|
}
|
|
328
338
|
unpackFunc(t, e) {
|
|
329
339
|
return j(t) ? t(e.getEmitData()) : t;
|
|
@@ -370,7 +380,7 @@ class Xt {
|
|
|
370
380
|
this.events.clear();
|
|
371
381
|
}
|
|
372
382
|
}
|
|
373
|
-
var y = /* @__PURE__ */ ((
|
|
383
|
+
var y = /* @__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))(y || {}), q = /* @__PURE__ */ ((f) => (f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f))(q || {});
|
|
374
384
|
function Z() {
|
|
375
385
|
return Math.random().toString(36).substring(2, 15);
|
|
376
386
|
}
|
|
@@ -437,7 +447,7 @@ class dt {
|
|
|
437
447
|
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);
|
|
438
448
|
}
|
|
439
449
|
getField(t) {
|
|
440
|
-
if (!t ||
|
|
450
|
+
if (!t || U(t) && t.trim() === "")
|
|
441
451
|
return;
|
|
442
452
|
if (!t.includes("."))
|
|
443
453
|
return this.data[t];
|
|
@@ -491,6 +501,9 @@ class dt {
|
|
|
491
501
|
isMilestone() {
|
|
492
502
|
return this.store.getOptionManager().getOptions().milestone.show ? this.type === "milestone" : !1;
|
|
493
503
|
}
|
|
504
|
+
isSummary() {
|
|
505
|
+
return this.store.getOptionManager().getOptions().summary.show ? this.type === "summary" : !1;
|
|
506
|
+
}
|
|
494
507
|
}
|
|
495
508
|
class Vt {
|
|
496
509
|
constructor(t, e, i) {
|
|
@@ -534,8 +547,8 @@ class Vt {
|
|
|
534
547
|
if (!this.validate()) return null;
|
|
535
548
|
const t = this.store.getDataManager().getTaskById(this.taskId);
|
|
536
549
|
if (!t || !t.startTime || !t.endTime) return null;
|
|
537
|
-
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",
|
|
538
|
-
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff:
|
|
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", l = this.endTime.diff(this.startTime, e, !0), c = t.endTime.diff(t.startTime, e, !0), g = l > 0 ? (c - l) / l * 100 : 0;
|
|
551
|
+
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: g, unit: e };
|
|
539
552
|
}
|
|
540
553
|
}
|
|
541
554
|
class Kt {
|
|
@@ -608,10 +621,10 @@ class Kt {
|
|
|
608
621
|
if (o && o.children)
|
|
609
622
|
this.updateTask(r, o.children, o);
|
|
610
623
|
else {
|
|
611
|
-
const
|
|
624
|
+
const l = r.map(
|
|
612
625
|
(c) => this.createTask(c, e[s])
|
|
613
626
|
);
|
|
614
|
-
e[s].children =
|
|
627
|
+
e[s].children = l;
|
|
615
628
|
}
|
|
616
629
|
} else o && o.children && (o.children = []);
|
|
617
630
|
s++;
|
|
@@ -826,21 +839,21 @@ class Kt {
|
|
|
826
839
|
}
|
|
827
840
|
updateTaskTime(t, e, i, s, n = []) {
|
|
828
841
|
let o = e, r = i;
|
|
829
|
-
const
|
|
830
|
-
let
|
|
831
|
-
for (; c !== "none" &&
|
|
842
|
+
const l = this.store.getOptionManager().getOptions().bar.move.link.child, c = this.store.getOptionManager().getOptions().bar.move.link.parent, g = this.store.getTimeAxis().getCellUnit();
|
|
843
|
+
let h = t.parent;
|
|
844
|
+
for (; c !== "none" && h; ) {
|
|
832
845
|
if (c === "expand") {
|
|
833
|
-
let m =
|
|
834
|
-
(!
|
|
835
|
-
} else c === "strict" && (
|
|
836
|
-
|
|
846
|
+
let m = h.startTime || o, p = h.endTime || r;
|
|
847
|
+
(!h.startTime || o.isBefore(h.startTime)) && (m = o), (!h.endTime || r.isAfter(h.endTime)) && (p = r), (h.startTime === void 0 || h.endTime === void 0 || !m.isSame(h.startTime) || !p.isSame(h.endTime)) && (n.findIndex((u) => u.id === h.id) === -1 && n.push(h.clone()), h.updateTime(m, p));
|
|
848
|
+
} else c === "strict" && (h.startTime && o.isBefore(h.startTime) && (o = h.startTime, r.isSameOrBefore(o) && (r = o.add(1, g))), h.endTime && r.isAfter(h.endTime) && (r = h.endTime, o.isAfter(r) && (o = r.subtract(1, g))));
|
|
849
|
+
h = h.parent;
|
|
837
850
|
}
|
|
838
851
|
let d = t.children || [];
|
|
839
|
-
for (;
|
|
852
|
+
for (; l !== "none" && d.length > 0; ) {
|
|
840
853
|
const m = [];
|
|
841
854
|
d.forEach((p) => {
|
|
842
|
-
let u = p.startTime || o, x = p.endTime || r,
|
|
843
|
-
|
|
855
|
+
let u = p.startTime || o, x = p.endTime || r, w = o.diff(t.startTime), E = r.diff(t.endTime);
|
|
856
|
+
l === "scale" ? s === "both" ? (n.findIndex((T) => T.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u.add(w), x.add(E))) : s === "left" ? (u = u.add(w), u.isSameOrAfter(x.subtract(1, g)) && (x.isBefore(t.endTime) ? x = u.add(1, g) : u = x.subtract(1, g), u.isSameOrBefore(o) && (o = u)), n.findIndex((T) => T.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, x)) : s === "right" && (x = x.add(E), x.isSameOrBefore(u.add(1, g)) && (u.isAfter(t.startTime) ? u = x.subtract(1, g) : x = u.add(1, g)), x.isSameOrAfter(r) && (r = x), n.findIndex((T) => T.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, x)) : l === "fixed" && (s === "both" ? (n.findIndex((T) => T.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u.add(w), x.add(E))) : s === "left" ? u.isSameOrBefore(o) && (u = o, u.isSameOrAfter(x.subtract(1, g)) && (x.isBefore(t.endTime) ? x = u.add(1, g) : u = x.subtract(1, g), u.isSameOrBefore(o) && (o = u)), n.findIndex((T) => T.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, x)) : s === "right" && x.isSameOrAfter(r) && (x = r, x.isSameOrBefore(u.add(1, g)) && (u.isAfter(t.startTime) ? u = x.subtract(1, g) : x = u.add(1, g)), x.isSameOrAfter(r) && (r = x), n.findIndex((T) => T.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, x))), p.children && p.children.length > 0 && m.push(...p.children);
|
|
844
857
|
}), d = m;
|
|
845
858
|
}
|
|
846
859
|
n.findIndex((m) => m.id === t.id) === -1 && n.push(t.clone()), t.updateTime(o, r);
|
|
@@ -865,47 +878,47 @@ class Kt {
|
|
|
865
878
|
return this.baselineTaskMap.get(t) || [];
|
|
866
879
|
}
|
|
867
880
|
}
|
|
868
|
-
function
|
|
869
|
-
if (!Number.isFinite(
|
|
881
|
+
function G(f, t, e) {
|
|
882
|
+
if (!Number.isFinite(f) || !Number.isFinite(t) || !Number.isFinite(e))
|
|
870
883
|
return Number.isFinite(t) ? t : 0;
|
|
871
884
|
const i = Math.min(t, e), s = Math.max(t, e);
|
|
872
|
-
return Math.min(Math.max(i,
|
|
885
|
+
return Math.min(Math.max(i, f), s);
|
|
873
886
|
}
|
|
874
|
-
function st(
|
|
875
|
-
let e =
|
|
876
|
-
return
|
|
887
|
+
function st(f, t) {
|
|
888
|
+
let e = f;
|
|
889
|
+
return U(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
877
890
|
}
|
|
878
|
-
function pt(
|
|
891
|
+
function pt(f, t) {
|
|
879
892
|
if (t === 0)
|
|
880
893
|
throw new Error("基准值不能为0");
|
|
881
|
-
if (Math.abs(
|
|
894
|
+
if (Math.abs(f) <= t / 2)
|
|
882
895
|
return 0;
|
|
883
|
-
const e = Math.floor(
|
|
896
|
+
const e = Math.floor(f / t), i = Math.ceil(f / t), s = e * t, n = i * t, o = Math.abs(f - s), r = Math.abs(f - n);
|
|
884
897
|
return o <= r ? s : n;
|
|
885
898
|
}
|
|
886
|
-
function nt(
|
|
887
|
-
return typeof
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
899
|
+
function nt(f, t = 4) {
|
|
900
|
+
return typeof f == "number" ? [f, f, f, f] : Array.isArray(f) ? [
|
|
901
|
+
f[0] ?? t,
|
|
902
|
+
f[1] ?? t,
|
|
903
|
+
f[2] ?? t,
|
|
904
|
+
f[3] ?? t
|
|
892
905
|
] : [t, t, t, t];
|
|
893
906
|
}
|
|
894
|
-
function jt(
|
|
895
|
-
if (!Number.isFinite(
|
|
907
|
+
function jt(f, t = 100) {
|
|
908
|
+
if (!Number.isFinite(f) || !Number.isFinite(t) || t === 0 || f < 0)
|
|
896
909
|
return 0;
|
|
897
|
-
const e =
|
|
910
|
+
const e = f / Math.abs(t);
|
|
898
911
|
return Math.min(e, 1);
|
|
899
912
|
}
|
|
900
|
-
function lt(
|
|
901
|
-
const i =
|
|
913
|
+
function lt(f, t = 2, e = !1) {
|
|
914
|
+
const i = f.toFixed(t);
|
|
902
915
|
return e ? i : i.replace(/\.?0+$/, "");
|
|
903
916
|
}
|
|
904
|
-
function xt(
|
|
917
|
+
function xt(f, t = 16, e = 16) {
|
|
905
918
|
return new Promise((i, s) => {
|
|
906
|
-
let n =
|
|
919
|
+
let n = f;
|
|
907
920
|
if (!/viewBox\s*=\s*["'][^"']*["']/.test(n)) {
|
|
908
|
-
const
|
|
921
|
+
const g = n.match(/width\s*=\s*["']([^"']*)["']/), h = n.match(/height\s*=\s*["']([^"']*)["']/), d = g ? parseFloat(g[1]) : t, m = h ? parseFloat(h[1]) : e;
|
|
909
922
|
n = n.replace(
|
|
910
923
|
/<svg([^>]*)>/,
|
|
911
924
|
`<svg$1 viewBox="0 0 ${d} ${m}">`
|
|
@@ -918,68 +931,68 @@ function xt(g, t = 16, e = 16) {
|
|
|
918
931
|
const r = new Image();
|
|
919
932
|
r.onload = () => {
|
|
920
933
|
URL.revokeObjectURL(r.src), i(r);
|
|
921
|
-
}, r.onerror = (
|
|
922
|
-
URL.revokeObjectURL(r.src), s(
|
|
934
|
+
}, r.onerror = (g) => {
|
|
935
|
+
URL.revokeObjectURL(r.src), s(g);
|
|
923
936
|
};
|
|
924
|
-
const
|
|
937
|
+
const l = new Blob([n], { type: "image/svg+xml" }), c = URL.createObjectURL(l);
|
|
925
938
|
r.src = c;
|
|
926
939
|
});
|
|
927
940
|
}
|
|
928
|
-
function qt(
|
|
941
|
+
function qt(f) {
|
|
929
942
|
var s;
|
|
930
|
-
if (typeof
|
|
943
|
+
if (typeof f == "object" && f !== null)
|
|
931
944
|
return {
|
|
932
|
-
r:
|
|
933
|
-
g:
|
|
934
|
-
b:
|
|
935
|
-
a:
|
|
945
|
+
r: G(f.r ?? 0, 0, 255),
|
|
946
|
+
g: G(f.g ?? 0, 0, 255),
|
|
947
|
+
b: G(f.b ?? 0, 0, 255),
|
|
948
|
+
a: G(f.a ?? 1, 0, 1)
|
|
936
949
|
};
|
|
937
|
-
if (typeof
|
|
938
|
-
return
|
|
939
|
-
let t =
|
|
950
|
+
if (typeof f != "string")
|
|
951
|
+
return L.warn(`Invalid color value type: ${typeof f}`), null;
|
|
952
|
+
let t = f.trim();
|
|
940
953
|
const e = (s = document == null ? void 0 : document.createElement("canvas")) == null ? void 0 : s.getContext("2d");
|
|
941
954
|
if (e && (e.fillStyle = t, t = e.fillStyle), t.startsWith("#")) {
|
|
942
955
|
const n = t.slice(1);
|
|
943
|
-
let o, r,
|
|
956
|
+
let o, r, l, c, g = 1;
|
|
944
957
|
try {
|
|
945
958
|
o = parseInt(n, 16);
|
|
946
959
|
} catch {
|
|
947
|
-
return
|
|
960
|
+
return L.warn(`Invalid hex color: ${f}`), null;
|
|
948
961
|
}
|
|
949
962
|
if (n.length === 3)
|
|
950
|
-
r = (o >> 8 & 15) * 17,
|
|
963
|
+
r = (o >> 8 & 15) * 17, l = (o >> 4 & 15) * 17, c = (o & 15) * 17;
|
|
951
964
|
else if (n.length === 6)
|
|
952
|
-
r = o >> 16 & 255,
|
|
965
|
+
r = o >> 16 & 255, l = o >> 8 & 255, c = o & 255;
|
|
953
966
|
else if (n.length === 8)
|
|
954
|
-
r = o >> 24 & 255,
|
|
967
|
+
r = o >> 24 & 255, l = o >> 16 & 255, c = o >> 8 & 255, g = (o & 255) / 255;
|
|
955
968
|
else
|
|
956
|
-
return
|
|
957
|
-
return { r, g:
|
|
969
|
+
return L.warn(`Invalid hex color length: ${f}`), null;
|
|
970
|
+
return { r, g: l, b: c, a: g };
|
|
958
971
|
}
|
|
959
972
|
let i = t.match(
|
|
960
973
|
/rgba?\(\s*(\d+%?)\s*,\s*(\d+%?)\s*,\s*(\d+%?)\s*(?:,\s*([\d.]+)\s*)?\)/i
|
|
961
974
|
);
|
|
962
975
|
if (i) {
|
|
963
|
-
const n = (o) => o.endsWith("%") ?
|
|
976
|
+
const n = (o) => o.endsWith("%") ? G(parseFloat(o) / 100 * 255, 0, 255) : G(parseInt(o, 10), 0, 255);
|
|
964
977
|
return {
|
|
965
978
|
r: n(i[1]),
|
|
966
979
|
g: n(i[2]),
|
|
967
980
|
b: n(i[3]),
|
|
968
|
-
a: i[4] !== void 0 ?
|
|
981
|
+
a: i[4] !== void 0 ? G(parseFloat(i[4]), 0, 1) : 1
|
|
969
982
|
};
|
|
970
983
|
}
|
|
971
|
-
return
|
|
984
|
+
return L.warn(`Could not parse color: ${f}`), null;
|
|
972
985
|
}
|
|
973
|
-
function Qt(
|
|
986
|
+
function Qt(f, t, e, i, s = !1, n = !1) {
|
|
974
987
|
const o = (d) => {
|
|
975
|
-
const m = Math.round(
|
|
988
|
+
const m = Math.round(G(d, 0, 255)).toString(16);
|
|
976
989
|
return m.length === 1 ? "0" + m : m;
|
|
977
|
-
}, r = o(
|
|
978
|
-
if (s && r[0] === r[1] &&
|
|
990
|
+
}, r = o(f), l = o(t), c = o(e), g = o(i * 255);
|
|
991
|
+
if (s && r[0] === r[1] && l[0] === l[1] && c[0] === c[1] && i === 1 && // Alpha 必须为 1 才能缩写
|
|
979
992
|
!n)
|
|
980
|
-
return `#${r[0]}${
|
|
981
|
-
const
|
|
982
|
-
return n || i < 1 ? `${
|
|
993
|
+
return `#${r[0]}${l[0]}${c[0]}`;
|
|
994
|
+
const h = `#${r}${l}${c}`;
|
|
995
|
+
return n || i < 1 ? `${h}${g}` : h;
|
|
983
996
|
}
|
|
984
997
|
class tt {
|
|
985
998
|
/**
|
|
@@ -995,7 +1008,7 @@ class tt {
|
|
|
995
1008
|
a(this, "_b");
|
|
996
1009
|
a(this, "_a");
|
|
997
1010
|
const e = qt(t);
|
|
998
|
-
e === null ? (
|
|
1011
|
+
e === null ? (L.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);
|
|
999
1012
|
}
|
|
1000
1013
|
// --- Getters ---
|
|
1001
1014
|
/** 获取 Red 通道值 (0-255) */
|
|
@@ -1015,16 +1028,16 @@ class tt {
|
|
|
1015
1028
|
return this._a;
|
|
1016
1029
|
}
|
|
1017
1030
|
red(t) {
|
|
1018
|
-
return t === void 0 ? this._r : (this._r = Math.round(
|
|
1031
|
+
return t === void 0 ? this._r : (this._r = Math.round(G(t, 0, 255)), this);
|
|
1019
1032
|
}
|
|
1020
1033
|
green(t) {
|
|
1021
|
-
return t === void 0 ? this._g : (this._g = Math.round(
|
|
1034
|
+
return t === void 0 ? this._g : (this._g = Math.round(G(t, 0, 255)), this);
|
|
1022
1035
|
}
|
|
1023
1036
|
blue(t) {
|
|
1024
|
-
return t === void 0 ? this._b : (this._b = Math.round(
|
|
1037
|
+
return t === void 0 ? this._b : (this._b = Math.round(G(t, 0, 255)), this);
|
|
1025
1038
|
}
|
|
1026
1039
|
alpha(t) {
|
|
1027
|
-
return t === void 0 ? this._a : (this._a =
|
|
1040
|
+
return t === void 0 ? this._a : (this._a = G(t, 0, 1), this);
|
|
1028
1041
|
}
|
|
1029
1042
|
// --- 输出方法 ---
|
|
1030
1043
|
/**
|
|
@@ -1078,8 +1091,8 @@ class tt {
|
|
|
1078
1091
|
*/
|
|
1079
1092
|
brighten(t = 10) {
|
|
1080
1093
|
if (t < 0) return this.darken(-t);
|
|
1081
|
-
const e =
|
|
1082
|
-
return this._r = Math.round(
|
|
1094
|
+
const e = G(t, 0, 100) / 100;
|
|
1095
|
+
return this._r = Math.round(G(this._r + (255 - this._r) * e, 0, 255)), this._g = Math.round(G(this._g + (255 - this._g) * e, 0, 255)), this._b = Math.round(G(this._b + (255 - this._b) * e, 0, 255)), this;
|
|
1083
1096
|
}
|
|
1084
1097
|
/**
|
|
1085
1098
|
* 降低颜色亮度 (变暗)。
|
|
@@ -1088,8 +1101,8 @@ class tt {
|
|
|
1088
1101
|
*/
|
|
1089
1102
|
darken(t = 10) {
|
|
1090
1103
|
if (t < 0) return this.brighten(-t);
|
|
1091
|
-
const e =
|
|
1092
|
-
return this._r = Math.round(
|
|
1104
|
+
const e = G(t, 0, 100) / 100;
|
|
1105
|
+
return this._r = Math.round(G(this._r * (1 - e), 0, 255)), this._g = Math.round(G(this._g * (1 - e), 0, 255)), this._b = Math.round(G(this._b * (1 - e), 0, 255)), this;
|
|
1093
1106
|
}
|
|
1094
1107
|
/**
|
|
1095
1108
|
* 判断颜色是否偏亮。
|
|
@@ -1113,14 +1126,14 @@ class tt {
|
|
|
1113
1126
|
* @returns 当前 Colorjs 实例。
|
|
1114
1127
|
*/
|
|
1115
1128
|
mix(t, e = 50) {
|
|
1116
|
-
const i =
|
|
1129
|
+
const i = G(e, 0, 100) / 100, s = F(t);
|
|
1117
1130
|
return this._r = Math.round(
|
|
1118
|
-
|
|
1131
|
+
G(this._r * (1 - i) + s.R * i, 0, 255)
|
|
1119
1132
|
), this._g = Math.round(
|
|
1120
|
-
|
|
1133
|
+
G(this._g * (1 - i) + s.G * i, 0, 255)
|
|
1121
1134
|
), this._b = Math.round(
|
|
1122
|
-
|
|
1123
|
-
), this._a =
|
|
1135
|
+
G(this._b * (1 - i) + s.B * i, 0, 255)
|
|
1136
|
+
), this._a = G(this._a * (1 - i) + s.A * i, 0, 1), this;
|
|
1124
1137
|
}
|
|
1125
1138
|
/**
|
|
1126
1139
|
* 创建当前颜色对象的副本。
|
|
@@ -1141,13 +1154,13 @@ class tt {
|
|
|
1141
1154
|
* @param option - 传递给插件的选项 (可选)。
|
|
1142
1155
|
*/
|
|
1143
1156
|
static extend(t, e) {
|
|
1144
|
-
typeof t == "function" ? t(e, tt,
|
|
1157
|
+
typeof t == "function" ? t(e, tt, F) : L.warn(
|
|
1145
1158
|
"Invalid plugin provided to Colorjs.extend. Expected a function."
|
|
1146
1159
|
);
|
|
1147
1160
|
}
|
|
1148
1161
|
}
|
|
1149
|
-
const
|
|
1150
|
-
class
|
|
1162
|
+
const F = (f) => f instanceof tt ? f : new tt(f);
|
|
1163
|
+
class Et {
|
|
1151
1164
|
constructor(t, e, i) {
|
|
1152
1165
|
a(this, "element");
|
|
1153
1166
|
a(this, "iconElement");
|
|
@@ -1184,7 +1197,7 @@ class kt {
|
|
|
1184
1197
|
updateIcon() {
|
|
1185
1198
|
const t = this.context.store.getOptionManager().getOptions().primaryColor;
|
|
1186
1199
|
this.iconElement.innerHTML = "";
|
|
1187
|
-
let e = "#ffffff", i =
|
|
1200
|
+
let e = "#ffffff", i = F(t).alpha(0.5).toHex();
|
|
1188
1201
|
switch (this._state) {
|
|
1189
1202
|
case 0:
|
|
1190
1203
|
e = "#ffffff", i = i;
|
|
@@ -1341,23 +1354,23 @@ class Jt {
|
|
|
1341
1354
|
processColumns(t, e = [], i, s = 1) {
|
|
1342
1355
|
t.forEach((n, o) => {
|
|
1343
1356
|
var p;
|
|
1344
|
-
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0,
|
|
1357
|
+
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0, l = !r;
|
|
1345
1358
|
let c = "";
|
|
1346
1359
|
r ? c = `group-${o}` : c = `field-${n.field}`;
|
|
1347
|
-
const
|
|
1348
|
-
c = "column-" + o + "-" +
|
|
1349
|
-
const
|
|
1350
|
-
label:
|
|
1360
|
+
const g = [...(i == null ? void 0 : i.path) || [], c];
|
|
1361
|
+
c = "column-" + o + "-" + g.join("-");
|
|
1362
|
+
const h = n.label || (l ? n.field : ""), d = l ? ((p = this.temporaryLeafColumns.find((u) => u.key === c)) == null ? void 0 : p.width) || n.width || 100 : "auto", m = {
|
|
1363
|
+
label: h,
|
|
1351
1364
|
level: s,
|
|
1352
1365
|
maxLevel: s,
|
|
1353
1366
|
column: n,
|
|
1354
1367
|
children: [],
|
|
1355
|
-
path:
|
|
1368
|
+
path: g,
|
|
1356
1369
|
key: c,
|
|
1357
|
-
isLeaf:
|
|
1370
|
+
isLeaf: l,
|
|
1358
1371
|
width: d
|
|
1359
1372
|
};
|
|
1360
|
-
if (e.push(m),
|
|
1373
|
+
if (e.push(m), l)
|
|
1361
1374
|
this.leafColumns.push(m);
|
|
1362
1375
|
else if (r) {
|
|
1363
1376
|
const u = n.children;
|
|
@@ -1368,7 +1381,7 @@ class Jt {
|
|
|
1368
1381
|
s + 1
|
|
1369
1382
|
), m.maxLevel = Math.max(
|
|
1370
1383
|
m.maxLevel,
|
|
1371
|
-
m.children.reduce((x,
|
|
1384
|
+
m.children.reduce((x, w) => Math.max(x, w.maxLevel), 0)
|
|
1372
1385
|
);
|
|
1373
1386
|
}
|
|
1374
1387
|
}), this.temporaryLeafColumns = J(this.leafColumns);
|
|
@@ -1430,7 +1443,7 @@ class Jt {
|
|
|
1430
1443
|
customStyle: {
|
|
1431
1444
|
paddingLeft: this.context.store.getOptionManager().getOptions().expand.show ? "8px" : 0
|
|
1432
1445
|
},
|
|
1433
|
-
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new
|
|
1446
|
+
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new Et(this.context).getElement() : null,
|
|
1434
1447
|
ellipsis: !1
|
|
1435
1448
|
},
|
|
1436
1449
|
children: [],
|
|
@@ -1450,176 +1463,176 @@ class Jt {
|
|
|
1450
1463
|
return this.collapseTable;
|
|
1451
1464
|
}
|
|
1452
1465
|
}
|
|
1453
|
-
var
|
|
1454
|
-
function
|
|
1455
|
-
return
|
|
1466
|
+
var Y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1467
|
+
function N(f) {
|
|
1468
|
+
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
1456
1469
|
}
|
|
1457
|
-
var
|
|
1458
|
-
(function(
|
|
1470
|
+
var kt = { exports: {} };
|
|
1471
|
+
(function(f, t) {
|
|
1459
1472
|
(function(e, i) {
|
|
1460
|
-
|
|
1461
|
-
})(
|
|
1462
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5,
|
|
1463
|
-
return
|
|
1464
|
-
}, p = function(
|
|
1465
|
-
return new
|
|
1466
|
-
}, u = function(
|
|
1467
|
-
return i.p(
|
|
1468
|
-
}, x = function(
|
|
1469
|
-
return
|
|
1470
|
-
},
|
|
1471
|
-
return x(
|
|
1472
|
-
},
|
|
1473
|
-
return Math.abs(
|
|
1474
|
-
}, T = function(
|
|
1475
|
-
return
|
|
1476
|
-
},
|
|
1477
|
-
function
|
|
1473
|
+
f.exports = i();
|
|
1474
|
+
})(Y, function() {
|
|
1475
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, l = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, g = 2628e6, h = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, d = { years: c, months: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(k) {
|
|
1476
|
+
return k instanceof O;
|
|
1477
|
+
}, p = function(k, S, b) {
|
|
1478
|
+
return new O(k, b, S.$l);
|
|
1479
|
+
}, u = function(k) {
|
|
1480
|
+
return i.p(k) + "s";
|
|
1481
|
+
}, x = function(k) {
|
|
1482
|
+
return k < 0;
|
|
1483
|
+
}, w = function(k) {
|
|
1484
|
+
return x(k) ? Math.ceil(k) : Math.floor(k);
|
|
1485
|
+
}, E = function(k) {
|
|
1486
|
+
return Math.abs(k);
|
|
1487
|
+
}, T = function(k, S) {
|
|
1488
|
+
return k ? x(k) ? { negative: !0, format: "" + E(k) + S } : { negative: !1, format: "" + k + S } : { negative: !1, format: "" };
|
|
1489
|
+
}, O = function() {
|
|
1490
|
+
function k(b, D, I) {
|
|
1478
1491
|
var _ = this;
|
|
1479
|
-
if (this.$d = {}, this.$l =
|
|
1480
|
-
if (typeof
|
|
1481
|
-
if (typeof
|
|
1482
|
-
_.$d[u(
|
|
1492
|
+
if (this.$d = {}, this.$l = I, b === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), D) return p(b * d[u(D)], this);
|
|
1493
|
+
if (typeof b == "number") return this.$ms = b, this.parseFromMilliseconds(), this;
|
|
1494
|
+
if (typeof b == "object") return Object.keys(b).forEach(function(B) {
|
|
1495
|
+
_.$d[u(B)] = b[B];
|
|
1483
1496
|
}), this.calMilliseconds(), this;
|
|
1484
|
-
if (typeof
|
|
1485
|
-
var
|
|
1486
|
-
if (
|
|
1487
|
-
var
|
|
1488
|
-
return
|
|
1497
|
+
if (typeof b == "string") {
|
|
1498
|
+
var M = b.match(h);
|
|
1499
|
+
if (M) {
|
|
1500
|
+
var A = M.slice(2).map(function(B) {
|
|
1501
|
+
return B != null ? Number(B) : 0;
|
|
1489
1502
|
});
|
|
1490
|
-
return this.$d.years =
|
|
1503
|
+
return this.$d.years = A[0], this.$d.months = A[1], this.$d.weeks = A[2], this.$d.days = A[3], this.$d.hours = A[4], this.$d.minutes = A[5], this.$d.seconds = A[6], this.calMilliseconds(), this;
|
|
1491
1504
|
}
|
|
1492
1505
|
}
|
|
1493
1506
|
return this;
|
|
1494
1507
|
}
|
|
1495
|
-
var
|
|
1496
|
-
return
|
|
1497
|
-
var
|
|
1498
|
-
this.$ms = Object.keys(this.$d).reduce(function(D,
|
|
1499
|
-
return D + (
|
|
1508
|
+
var S = k.prototype;
|
|
1509
|
+
return S.calMilliseconds = function() {
|
|
1510
|
+
var b = this;
|
|
1511
|
+
this.$ms = Object.keys(this.$d).reduce(function(D, I) {
|
|
1512
|
+
return D + (b.$d[I] || 0) * d[I];
|
|
1500
1513
|
}, 0);
|
|
1501
|
-
},
|
|
1502
|
-
var
|
|
1503
|
-
this.$d.years = b
|
|
1504
|
-
},
|
|
1505
|
-
var
|
|
1506
|
-
this.$d.weeks && (
|
|
1507
|
-
var _ = T(
|
|
1508
|
-
this.$d.milliseconds && (
|
|
1509
|
-
var
|
|
1510
|
-
return
|
|
1511
|
-
},
|
|
1514
|
+
}, S.parseFromMilliseconds = function() {
|
|
1515
|
+
var b = this.$ms;
|
|
1516
|
+
this.$d.years = w(b / c), b %= c, this.$d.months = w(b / g), b %= g, this.$d.days = w(b / r), b %= r, this.$d.hours = w(b / o), b %= o, this.$d.minutes = w(b / n), b %= n, this.$d.seconds = w(b / s), b %= s, this.$d.milliseconds = b;
|
|
1517
|
+
}, S.toISOString = function() {
|
|
1518
|
+
var b = T(this.$d.years, "Y"), D = T(this.$d.months, "M"), I = +this.$d.days || 0;
|
|
1519
|
+
this.$d.weeks && (I += 7 * this.$d.weeks);
|
|
1520
|
+
var _ = T(I, "D"), M = T(this.$d.hours, "H"), A = T(this.$d.minutes, "M"), B = this.$d.seconds || 0;
|
|
1521
|
+
this.$d.milliseconds && (B += this.$d.milliseconds / 1e3, B = Math.round(1e3 * B) / 1e3);
|
|
1522
|
+
var $ = T(B, "S"), R = b.negative || D.negative || _.negative || M.negative || A.negative || $.negative, W = M.format || A.format || $.format ? "T" : "", P = (R ? "-" : "") + "P" + b.format + D.format + _.format + W + M.format + A.format + $.format;
|
|
1523
|
+
return P === "P" || P === "-P" ? "P0D" : P;
|
|
1524
|
+
}, S.toJSON = function() {
|
|
1512
1525
|
return this.toISOString();
|
|
1513
|
-
},
|
|
1514
|
-
var D =
|
|
1515
|
-
return D.replace(
|
|
1516
|
-
return
|
|
1526
|
+
}, S.format = function(b) {
|
|
1527
|
+
var D = b || "YYYY-MM-DDTHH:mm:ss", I = { 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") };
|
|
1528
|
+
return D.replace(l, function(_, M) {
|
|
1529
|
+
return M || String(I[_]);
|
|
1517
1530
|
});
|
|
1518
|
-
},
|
|
1519
|
-
return this.$ms / d[u(
|
|
1520
|
-
},
|
|
1521
|
-
var D = this.$ms,
|
|
1522
|
-
return
|
|
1523
|
-
},
|
|
1531
|
+
}, S.as = function(b) {
|
|
1532
|
+
return this.$ms / d[u(b)];
|
|
1533
|
+
}, S.get = function(b) {
|
|
1534
|
+
var D = this.$ms, I = u(b);
|
|
1535
|
+
return I === "milliseconds" ? D %= 1e3 : D = I === "weeks" ? w(D / d[I]) : this.$d[I], D || 0;
|
|
1536
|
+
}, S.add = function(b, D, I) {
|
|
1524
1537
|
var _;
|
|
1525
|
-
return _ = D ?
|
|
1526
|
-
},
|
|
1527
|
-
return this.add(
|
|
1528
|
-
},
|
|
1538
|
+
return _ = D ? b * d[u(D)] : m(b) ? b.$ms : p(b, this).$ms, p(this.$ms + _ * (I ? -1 : 1), this);
|
|
1539
|
+
}, S.subtract = function(b, D) {
|
|
1540
|
+
return this.add(b, D, !0);
|
|
1541
|
+
}, S.locale = function(b) {
|
|
1529
1542
|
var D = this.clone();
|
|
1530
|
-
return D.$l =
|
|
1531
|
-
},
|
|
1543
|
+
return D.$l = b, D;
|
|
1544
|
+
}, S.clone = function() {
|
|
1532
1545
|
return p(this.$ms, this);
|
|
1533
|
-
},
|
|
1534
|
-
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!
|
|
1535
|
-
},
|
|
1546
|
+
}, S.humanize = function(b) {
|
|
1547
|
+
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!b);
|
|
1548
|
+
}, S.valueOf = function() {
|
|
1536
1549
|
return this.asMilliseconds();
|
|
1537
|
-
},
|
|
1550
|
+
}, S.milliseconds = function() {
|
|
1538
1551
|
return this.get("milliseconds");
|
|
1539
|
-
},
|
|
1552
|
+
}, S.asMilliseconds = function() {
|
|
1540
1553
|
return this.as("milliseconds");
|
|
1541
|
-
},
|
|
1554
|
+
}, S.seconds = function() {
|
|
1542
1555
|
return this.get("seconds");
|
|
1543
|
-
},
|
|
1556
|
+
}, S.asSeconds = function() {
|
|
1544
1557
|
return this.as("seconds");
|
|
1545
|
-
},
|
|
1558
|
+
}, S.minutes = function() {
|
|
1546
1559
|
return this.get("minutes");
|
|
1547
|
-
},
|
|
1560
|
+
}, S.asMinutes = function() {
|
|
1548
1561
|
return this.as("minutes");
|
|
1549
|
-
},
|
|
1562
|
+
}, S.hours = function() {
|
|
1550
1563
|
return this.get("hours");
|
|
1551
|
-
},
|
|
1564
|
+
}, S.asHours = function() {
|
|
1552
1565
|
return this.as("hours");
|
|
1553
|
-
},
|
|
1566
|
+
}, S.days = function() {
|
|
1554
1567
|
return this.get("days");
|
|
1555
|
-
},
|
|
1568
|
+
}, S.asDays = function() {
|
|
1556
1569
|
return this.as("days");
|
|
1557
|
-
},
|
|
1570
|
+
}, S.weeks = function() {
|
|
1558
1571
|
return this.get("weeks");
|
|
1559
|
-
},
|
|
1572
|
+
}, S.asWeeks = function() {
|
|
1560
1573
|
return this.as("weeks");
|
|
1561
|
-
},
|
|
1574
|
+
}, S.months = function() {
|
|
1562
1575
|
return this.get("months");
|
|
1563
|
-
},
|
|
1576
|
+
}, S.asMonths = function() {
|
|
1564
1577
|
return this.as("months");
|
|
1565
|
-
},
|
|
1578
|
+
}, S.years = function() {
|
|
1566
1579
|
return this.get("years");
|
|
1567
|
-
},
|
|
1580
|
+
}, S.asYears = function() {
|
|
1568
1581
|
return this.as("years");
|
|
1569
|
-
},
|
|
1570
|
-
}(),
|
|
1571
|
-
return
|
|
1582
|
+
}, k;
|
|
1583
|
+
}(), C = function(k, S, b) {
|
|
1584
|
+
return k.add(S.years() * b, "y").add(S.months() * b, "M").add(S.days() * b, "d").add(S.hours() * b, "h").add(S.minutes() * b, "m").add(S.seconds() * b, "s").add(S.milliseconds() * b, "ms");
|
|
1572
1585
|
};
|
|
1573
|
-
return function(
|
|
1574
|
-
e =
|
|
1575
|
-
var
|
|
1576
|
-
return p(_, { $l:
|
|
1577
|
-
},
|
|
1578
|
-
var D =
|
|
1579
|
-
|
|
1580
|
-
return m(_) ?
|
|
1581
|
-
},
|
|
1582
|
-
return m(_) ?
|
|
1586
|
+
return function(k, S, b) {
|
|
1587
|
+
e = b, i = b().$utils(), b.duration = function(_, M) {
|
|
1588
|
+
var A = b.locale();
|
|
1589
|
+
return p(_, { $l: A }, M);
|
|
1590
|
+
}, b.isDuration = m;
|
|
1591
|
+
var D = S.prototype.add, I = S.prototype.subtract;
|
|
1592
|
+
S.prototype.add = function(_, M) {
|
|
1593
|
+
return m(_) ? C(this, _, 1) : D.bind(this)(_, M);
|
|
1594
|
+
}, S.prototype.subtract = function(_, M) {
|
|
1595
|
+
return m(_) ? C(this, _, -1) : I.bind(this)(_, M);
|
|
1583
1596
|
};
|
|
1584
1597
|
};
|
|
1585
1598
|
});
|
|
1586
|
-
})(
|
|
1587
|
-
var Zt =
|
|
1588
|
-
const te = /* @__PURE__ */
|
|
1589
|
-
var
|
|
1590
|
-
(function(
|
|
1599
|
+
})(kt);
|
|
1600
|
+
var Zt = kt.exports;
|
|
1601
|
+
const te = /* @__PURE__ */ N(Zt);
|
|
1602
|
+
var Ot = { exports: {} };
|
|
1603
|
+
(function(f, t) {
|
|
1591
1604
|
(function(e, i) {
|
|
1592
|
-
|
|
1593
|
-
})(
|
|
1605
|
+
f.exports = i();
|
|
1606
|
+
})(Y, function() {
|
|
1594
1607
|
return function(e, i, s) {
|
|
1595
|
-
i.prototype.isBetween = function(n, o, r,
|
|
1596
|
-
var c = s(n),
|
|
1597
|
-
return (
|
|
1608
|
+
i.prototype.isBetween = function(n, o, r, l) {
|
|
1609
|
+
var c = s(n), g = s(o), h = (l = l || "()")[0] === "(", d = l[1] === ")";
|
|
1610
|
+
return (h ? this.isAfter(c, r) : !this.isBefore(c, r)) && (d ? this.isBefore(g, r) : !this.isAfter(g, r)) || (h ? this.isBefore(c, r) : !this.isAfter(c, r)) && (d ? this.isAfter(g, r) : !this.isBefore(g, r));
|
|
1598
1611
|
};
|
|
1599
1612
|
};
|
|
1600
1613
|
});
|
|
1601
|
-
})(
|
|
1602
|
-
var ee =
|
|
1603
|
-
const ie = /* @__PURE__ */
|
|
1604
|
-
var
|
|
1605
|
-
(function(
|
|
1614
|
+
})(Ot);
|
|
1615
|
+
var ee = Ot.exports;
|
|
1616
|
+
const ie = /* @__PURE__ */ N(ee);
|
|
1617
|
+
var Mt = { exports: {} };
|
|
1618
|
+
(function(f, t) {
|
|
1606
1619
|
(function(e, i) {
|
|
1607
|
-
|
|
1608
|
-
})(
|
|
1620
|
+
f.exports = i();
|
|
1621
|
+
})(Y, function() {
|
|
1609
1622
|
return function(e, i) {
|
|
1610
1623
|
i.prototype.isSameOrBefore = function(s, n) {
|
|
1611
1624
|
return this.isSame(s, n) || this.isBefore(s, n);
|
|
1612
1625
|
};
|
|
1613
1626
|
};
|
|
1614
1627
|
});
|
|
1615
|
-
})(
|
|
1616
|
-
var se =
|
|
1617
|
-
const ne = /* @__PURE__ */
|
|
1628
|
+
})(Mt);
|
|
1629
|
+
var se = Mt.exports;
|
|
1630
|
+
const ne = /* @__PURE__ */ N(se);
|
|
1618
1631
|
var Lt = { exports: {} };
|
|
1619
|
-
(function(
|
|
1632
|
+
(function(f, t) {
|
|
1620
1633
|
(function(e, i) {
|
|
1621
|
-
|
|
1622
|
-
})(
|
|
1634
|
+
f.exports = i();
|
|
1635
|
+
})(Y, function() {
|
|
1623
1636
|
return function(e, i) {
|
|
1624
1637
|
i.prototype.isSameOrAfter = function(s, n) {
|
|
1625
1638
|
return this.isSame(s, n) || this.isAfter(s, n);
|
|
@@ -1628,56 +1641,56 @@ var Lt = { exports: {} };
|
|
|
1628
1641
|
});
|
|
1629
1642
|
})(Lt);
|
|
1630
1643
|
var oe = Lt.exports;
|
|
1631
|
-
const re = /* @__PURE__ */
|
|
1644
|
+
const re = /* @__PURE__ */ N(oe);
|
|
1632
1645
|
var Ct = { exports: {} };
|
|
1633
|
-
(function(
|
|
1646
|
+
(function(f, t) {
|
|
1634
1647
|
(function(e, i) {
|
|
1635
|
-
|
|
1636
|
-
})(
|
|
1648
|
+
f.exports = i();
|
|
1649
|
+
})(Y, function() {
|
|
1637
1650
|
return function(e, i, s) {
|
|
1638
|
-
var n = i.prototype, o = function(
|
|
1639
|
-
return
|
|
1640
|
-
}, r = function(
|
|
1641
|
-
var x =
|
|
1642
|
-
return
|
|
1651
|
+
var n = i.prototype, o = function(h) {
|
|
1652
|
+
return h && (h.indexOf ? h : h.s);
|
|
1653
|
+
}, r = function(h, d, m, p, u) {
|
|
1654
|
+
var x = h.name ? h : h.$locale(), w = o(x[d]), E = o(x[m]), T = w || E.map(function(C) {
|
|
1655
|
+
return C.slice(0, p);
|
|
1643
1656
|
});
|
|
1644
1657
|
if (!u) return T;
|
|
1645
|
-
var
|
|
1646
|
-
return T.map(function(
|
|
1647
|
-
return T[(
|
|
1658
|
+
var O = x.weekStart;
|
|
1659
|
+
return T.map(function(C, k) {
|
|
1660
|
+
return T[(k + (O || 0)) % 7];
|
|
1648
1661
|
});
|
|
1649
|
-
},
|
|
1662
|
+
}, l = function() {
|
|
1650
1663
|
return s.Ls[s.locale()];
|
|
1651
|
-
}, c = function(
|
|
1652
|
-
return
|
|
1664
|
+
}, c = function(h, d) {
|
|
1665
|
+
return h.formats[d] || function(m) {
|
|
1653
1666
|
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p, u, x) {
|
|
1654
1667
|
return u || x.slice(1);
|
|
1655
1668
|
});
|
|
1656
|
-
}(
|
|
1657
|
-
},
|
|
1658
|
-
var
|
|
1669
|
+
}(h.formats[d.toUpperCase()]);
|
|
1670
|
+
}, g = function() {
|
|
1671
|
+
var h = this;
|
|
1659
1672
|
return { months: function(d) {
|
|
1660
|
-
return d ? d.format("MMMM") : r(
|
|
1673
|
+
return d ? d.format("MMMM") : r(h, "months");
|
|
1661
1674
|
}, monthsShort: function(d) {
|
|
1662
|
-
return d ? d.format("MMM") : r(
|
|
1675
|
+
return d ? d.format("MMM") : r(h, "monthsShort", "months", 3);
|
|
1663
1676
|
}, firstDayOfWeek: function() {
|
|
1664
|
-
return
|
|
1677
|
+
return h.$locale().weekStart || 0;
|
|
1665
1678
|
}, weekdays: function(d) {
|
|
1666
|
-
return d ? d.format("dddd") : r(
|
|
1679
|
+
return d ? d.format("dddd") : r(h, "weekdays");
|
|
1667
1680
|
}, weekdaysMin: function(d) {
|
|
1668
|
-
return d ? d.format("dd") : r(
|
|
1681
|
+
return d ? d.format("dd") : r(h, "weekdaysMin", "weekdays", 2);
|
|
1669
1682
|
}, weekdaysShort: function(d) {
|
|
1670
|
-
return d ? d.format("ddd") : r(
|
|
1683
|
+
return d ? d.format("ddd") : r(h, "weekdaysShort", "weekdays", 3);
|
|
1671
1684
|
}, longDateFormat: function(d) {
|
|
1672
|
-
return c(
|
|
1685
|
+
return c(h.$locale(), d);
|
|
1673
1686
|
}, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
|
|
1674
1687
|
};
|
|
1675
1688
|
n.localeData = function() {
|
|
1676
|
-
return
|
|
1689
|
+
return g.bind(this)();
|
|
1677
1690
|
}, s.localeData = function() {
|
|
1678
|
-
var
|
|
1691
|
+
var h = l();
|
|
1679
1692
|
return { firstDayOfWeek: function() {
|
|
1680
|
-
return
|
|
1693
|
+
return h.weekStart || 0;
|
|
1681
1694
|
}, weekdays: function() {
|
|
1682
1695
|
return s.weekdays();
|
|
1683
1696
|
}, weekdaysShort: function() {
|
|
@@ -1689,54 +1702,54 @@ var Ct = { exports: {} };
|
|
|
1689
1702
|
}, monthsShort: function() {
|
|
1690
1703
|
return s.monthsShort();
|
|
1691
1704
|
}, longDateFormat: function(d) {
|
|
1692
|
-
return c(
|
|
1693
|
-
}, meridiem:
|
|
1705
|
+
return c(h, d);
|
|
1706
|
+
}, meridiem: h.meridiem, ordinal: h.ordinal };
|
|
1694
1707
|
}, s.months = function() {
|
|
1695
|
-
return r(
|
|
1708
|
+
return r(l(), "months");
|
|
1696
1709
|
}, s.monthsShort = function() {
|
|
1697
|
-
return r(
|
|
1698
|
-
}, s.weekdays = function(
|
|
1699
|
-
return r(
|
|
1700
|
-
}, s.weekdaysShort = function(
|
|
1701
|
-
return r(
|
|
1702
|
-
}, s.weekdaysMin = function(
|
|
1703
|
-
return r(
|
|
1710
|
+
return r(l(), "monthsShort", "months", 3);
|
|
1711
|
+
}, s.weekdays = function(h) {
|
|
1712
|
+
return r(l(), "weekdays", null, null, h);
|
|
1713
|
+
}, s.weekdaysShort = function(h) {
|
|
1714
|
+
return r(l(), "weekdaysShort", "weekdays", 3, h);
|
|
1715
|
+
}, s.weekdaysMin = function(h) {
|
|
1716
|
+
return r(l(), "weekdaysMin", "weekdays", 2, h);
|
|
1704
1717
|
};
|
|
1705
1718
|
};
|
|
1706
1719
|
});
|
|
1707
1720
|
})(Ct);
|
|
1708
1721
|
var ae = Ct.exports;
|
|
1709
|
-
const he = /* @__PURE__ */
|
|
1722
|
+
const he = /* @__PURE__ */ N(ae);
|
|
1710
1723
|
var Dt = { exports: {} };
|
|
1711
|
-
(function(
|
|
1724
|
+
(function(f, t) {
|
|
1712
1725
|
(function(e, i) {
|
|
1713
|
-
|
|
1714
|
-
})(
|
|
1726
|
+
f.exports = i();
|
|
1727
|
+
})(Y, function() {
|
|
1715
1728
|
var e = "week", i = "year";
|
|
1716
1729
|
return function(s, n, o) {
|
|
1717
1730
|
var r = n.prototype;
|
|
1718
|
-
r.week = function(
|
|
1719
|
-
if (
|
|
1731
|
+
r.week = function(l) {
|
|
1732
|
+
if (l === void 0 && (l = null), l !== null) return this.add(7 * (l - this.week()), "day");
|
|
1720
1733
|
var c = this.$locale().yearStart || 1;
|
|
1721
1734
|
if (this.month() === 11 && this.date() > 25) {
|
|
1722
|
-
var
|
|
1723
|
-
if (
|
|
1735
|
+
var g = o(this).startOf(i).add(1, i).date(c), h = o(this).endOf(e);
|
|
1736
|
+
if (g.isBefore(h)) return 1;
|
|
1724
1737
|
}
|
|
1725
1738
|
var d = o(this).startOf(i).date(c).startOf(e).subtract(1, "millisecond"), m = this.diff(d, e, !0);
|
|
1726
1739
|
return m < 0 ? o(this).startOf("week").week() : Math.ceil(m);
|
|
1727
|
-
}, r.weeks = function(
|
|
1728
|
-
return
|
|
1740
|
+
}, r.weeks = function(l) {
|
|
1741
|
+
return l === void 0 && (l = null), this.week(l);
|
|
1729
1742
|
};
|
|
1730
1743
|
};
|
|
1731
1744
|
});
|
|
1732
1745
|
})(Dt);
|
|
1733
1746
|
var le = Dt.exports;
|
|
1734
|
-
const ce = /* @__PURE__ */
|
|
1747
|
+
const ce = /* @__PURE__ */ N(le);
|
|
1735
1748
|
var _t = { exports: {} };
|
|
1736
|
-
(function(
|
|
1749
|
+
(function(f, t) {
|
|
1737
1750
|
(function(e, i) {
|
|
1738
|
-
|
|
1739
|
-
})(
|
|
1751
|
+
f.exports = i();
|
|
1752
|
+
})(Y, function() {
|
|
1740
1753
|
return function(e, i) {
|
|
1741
1754
|
i.prototype.weekYear = function() {
|
|
1742
1755
|
var s = this.month(), n = this.week(), o = this.year();
|
|
@@ -1746,38 +1759,38 @@ var _t = { exports: {} };
|
|
|
1746
1759
|
});
|
|
1747
1760
|
})(_t);
|
|
1748
1761
|
var de = _t.exports;
|
|
1749
|
-
const ue = /* @__PURE__ */
|
|
1762
|
+
const ue = /* @__PURE__ */ N(de);
|
|
1750
1763
|
var Ht = { exports: {} };
|
|
1751
|
-
(function(
|
|
1764
|
+
(function(f, t) {
|
|
1752
1765
|
(function(e, i) {
|
|
1753
|
-
|
|
1754
|
-
})(
|
|
1766
|
+
f.exports = i();
|
|
1767
|
+
})(Y, function() {
|
|
1755
1768
|
return function(e, i) {
|
|
1756
1769
|
var s = i.prototype, n = s.format;
|
|
1757
1770
|
s.format = function(o) {
|
|
1758
|
-
var r = this,
|
|
1771
|
+
var r = this, l = this.$locale();
|
|
1759
1772
|
if (!this.isValid()) return n.bind(this)(o);
|
|
1760
|
-
var c = this.$utils(),
|
|
1761
|
-
switch (
|
|
1773
|
+
var c = 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(h) {
|
|
1774
|
+
switch (h) {
|
|
1762
1775
|
case "Q":
|
|
1763
1776
|
return Math.ceil((r.$M + 1) / 3);
|
|
1764
1777
|
case "Do":
|
|
1765
|
-
return
|
|
1778
|
+
return l.ordinal(r.$D);
|
|
1766
1779
|
case "gggg":
|
|
1767
1780
|
return r.weekYear();
|
|
1768
1781
|
case "GGGG":
|
|
1769
1782
|
return r.isoWeekYear();
|
|
1770
1783
|
case "wo":
|
|
1771
|
-
return
|
|
1784
|
+
return l.ordinal(r.week(), "W");
|
|
1772
1785
|
case "w":
|
|
1773
1786
|
case "ww":
|
|
1774
|
-
return c.s(r.week(),
|
|
1787
|
+
return c.s(r.week(), h === "w" ? 1 : 2, "0");
|
|
1775
1788
|
case "W":
|
|
1776
1789
|
case "WW":
|
|
1777
|
-
return c.s(r.isoWeek(),
|
|
1790
|
+
return c.s(r.isoWeek(), h === "W" ? 1 : 2, "0");
|
|
1778
1791
|
case "k":
|
|
1779
1792
|
case "kk":
|
|
1780
|
-
return c.s(String(r.$H === 0 ? 24 : r.$H),
|
|
1793
|
+
return c.s(String(r.$H === 0 ? 24 : r.$H), h === "k" ? 1 : 2, "0");
|
|
1781
1794
|
case "X":
|
|
1782
1795
|
return Math.floor(r.$d.getTime() / 1e3);
|
|
1783
1796
|
case "x":
|
|
@@ -1787,38 +1800,38 @@ var Ht = { exports: {} };
|
|
|
1787
1800
|
case "zzz":
|
|
1788
1801
|
return "[" + r.offsetName("long") + "]";
|
|
1789
1802
|
default:
|
|
1790
|
-
return
|
|
1803
|
+
return h;
|
|
1791
1804
|
}
|
|
1792
1805
|
});
|
|
1793
|
-
return n.bind(this)(
|
|
1806
|
+
return n.bind(this)(g);
|
|
1794
1807
|
};
|
|
1795
1808
|
};
|
|
1796
1809
|
});
|
|
1797
1810
|
})(Ht);
|
|
1798
1811
|
var ge = Ht.exports;
|
|
1799
|
-
const fe = /* @__PURE__ */
|
|
1812
|
+
const fe = /* @__PURE__ */ N(ge);
|
|
1800
1813
|
var At = { exports: {} };
|
|
1801
|
-
(function(
|
|
1814
|
+
(function(f, t) {
|
|
1802
1815
|
(function(e, i) {
|
|
1803
|
-
|
|
1804
|
-
})(
|
|
1816
|
+
f.exports = i();
|
|
1817
|
+
})(Y, function() {
|
|
1805
1818
|
return function(e, i, s) {
|
|
1806
1819
|
s.updateLocale = function(n, o) {
|
|
1807
1820
|
var r = s.Ls[n];
|
|
1808
|
-
if (r) return (o ? Object.keys(o) : []).forEach(function(
|
|
1809
|
-
r[
|
|
1821
|
+
if (r) return (o ? Object.keys(o) : []).forEach(function(l) {
|
|
1822
|
+
r[l] = o[l];
|
|
1810
1823
|
}), r;
|
|
1811
1824
|
};
|
|
1812
1825
|
};
|
|
1813
1826
|
});
|
|
1814
1827
|
})(At);
|
|
1815
1828
|
var me = At.exports;
|
|
1816
|
-
const pe = /* @__PURE__ */
|
|
1829
|
+
const pe = /* @__PURE__ */ N(me);
|
|
1817
1830
|
var It = { exports: {} };
|
|
1818
|
-
(function(
|
|
1831
|
+
(function(f, t) {
|
|
1819
1832
|
(function(e, i) {
|
|
1820
|
-
|
|
1821
|
-
})(
|
|
1833
|
+
f.exports = i();
|
|
1834
|
+
})(Y, function() {
|
|
1822
1835
|
var e = "day";
|
|
1823
1836
|
return function(i, s, n) {
|
|
1824
1837
|
var o = function(c) {
|
|
@@ -1828,74 +1841,74 @@ var It = { exports: {} };
|
|
|
1828
1841
|
return o(this).year();
|
|
1829
1842
|
}, r.isoWeek = function(c) {
|
|
1830
1843
|
if (!this.$utils().u(c)) return this.add(7 * (c - this.isoWeek()), e);
|
|
1831
|
-
var
|
|
1844
|
+
var g, h, d, m, p = o(this), u = (g = this.isoWeekYear(), h = this.$u, d = (h ? n.utc : n)().year(g).startOf("year"), m = 4 - d.isoWeekday(), d.isoWeekday() > 4 && (m += 7), d.add(m, e));
|
|
1832
1845
|
return p.diff(u, "week") + 1;
|
|
1833
1846
|
}, r.isoWeekday = function(c) {
|
|
1834
1847
|
return this.$utils().u(c) ? this.day() || 7 : this.day(this.day() % 7 ? c : c - 7);
|
|
1835
1848
|
};
|
|
1836
|
-
var
|
|
1837
|
-
r.startOf = function(c,
|
|
1838
|
-
var
|
|
1839
|
-
return
|
|
1849
|
+
var l = r.startOf;
|
|
1850
|
+
r.startOf = function(c, g) {
|
|
1851
|
+
var h = this.$utils(), d = !!h.u(g) || g;
|
|
1852
|
+
return h.p(c) === "isoweek" ? d ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : l.bind(this)(c, g);
|
|
1840
1853
|
};
|
|
1841
1854
|
};
|
|
1842
1855
|
});
|
|
1843
1856
|
})(It);
|
|
1844
1857
|
var xe = It.exports;
|
|
1845
|
-
const ye = /* @__PURE__ */
|
|
1846
|
-
var
|
|
1847
|
-
(function(
|
|
1858
|
+
const ye = /* @__PURE__ */ N(xe);
|
|
1859
|
+
var Gt = { exports: {} };
|
|
1860
|
+
(function(f, t) {
|
|
1848
1861
|
(function(e, i) {
|
|
1849
|
-
|
|
1850
|
-
})(
|
|
1862
|
+
f.exports = i();
|
|
1863
|
+
})(Y, function() {
|
|
1851
1864
|
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, i = {};
|
|
1852
1865
|
return function(s, n, o) {
|
|
1853
|
-
var r,
|
|
1866
|
+
var r, l = function(d, m, p) {
|
|
1854
1867
|
p === void 0 && (p = {});
|
|
1855
|
-
var u = new Date(d), x = function(
|
|
1856
|
-
|
|
1857
|
-
var T =
|
|
1858
|
-
return
|
|
1868
|
+
var u = new Date(d), x = function(w, E) {
|
|
1869
|
+
E === void 0 && (E = {});
|
|
1870
|
+
var T = E.timeZoneName || "short", O = w + "|" + T, C = i[O];
|
|
1871
|
+
return C || (C = 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: T }), i[O] = C), C;
|
|
1859
1872
|
}(m, p);
|
|
1860
1873
|
return x.formatToParts(u);
|
|
1861
1874
|
}, c = function(d, m) {
|
|
1862
|
-
for (var p =
|
|
1863
|
-
var
|
|
1864
|
-
|
|
1875
|
+
for (var p = l(d, m), u = [], x = 0; x < p.length; x += 1) {
|
|
1876
|
+
var w = p[x], E = w.type, T = w.value, O = e[E];
|
|
1877
|
+
O >= 0 && (u[O] = parseInt(T, 10));
|
|
1865
1878
|
}
|
|
1866
|
-
var
|
|
1867
|
-
return (o.utc(
|
|
1868
|
-
},
|
|
1869
|
-
|
|
1879
|
+
var C = u[3], k = C === 24 ? 0 : C, S = u[0] + "-" + u[1] + "-" + u[2] + " " + k + ":" + u[4] + ":" + u[5] + ":000", b = +d;
|
|
1880
|
+
return (o.utc(S).valueOf() - (b -= b % 1e3)) / 6e4;
|
|
1881
|
+
}, g = n.prototype;
|
|
1882
|
+
g.tz = function(d, m) {
|
|
1870
1883
|
d === void 0 && (d = r);
|
|
1871
|
-
var p, u = this.utcOffset(), x = this.toDate(),
|
|
1884
|
+
var p, u = this.utcOffset(), x = this.toDate(), w = x.toLocaleString("en-US", { timeZone: d }), E = Math.round((x - new Date(w)) / 1e3 / 60), T = 15 * -Math.round(x.getTimezoneOffset() / 15) - E;
|
|
1872
1885
|
if (!Number(T)) p = this.utcOffset(0, m);
|
|
1873
|
-
else if (p = o(
|
|
1874
|
-
var
|
|
1875
|
-
p = p.add(u -
|
|
1886
|
+
else if (p = o(w, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(T, !0), m) {
|
|
1887
|
+
var O = p.utcOffset();
|
|
1888
|
+
p = p.add(u - O, "minute");
|
|
1876
1889
|
}
|
|
1877
1890
|
return p.$x.$timezone = d, p;
|
|
1878
|
-
},
|
|
1879
|
-
var m = this.$x.$timezone || o.tz.guess(), p =
|
|
1891
|
+
}, g.offsetName = function(d) {
|
|
1892
|
+
var m = this.$x.$timezone || o.tz.guess(), p = l(this.valueOf(), m, { timeZoneName: d }).find(function(u) {
|
|
1880
1893
|
return u.type.toLowerCase() === "timezonename";
|
|
1881
1894
|
});
|
|
1882
1895
|
return p && p.value;
|
|
1883
1896
|
};
|
|
1884
|
-
var
|
|
1885
|
-
|
|
1886
|
-
if (!this.$x || !this.$x.$timezone) return
|
|
1897
|
+
var h = g.startOf;
|
|
1898
|
+
g.startOf = function(d, m) {
|
|
1899
|
+
if (!this.$x || !this.$x.$timezone) return h.call(this, d, m);
|
|
1887
1900
|
var p = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
1888
|
-
return
|
|
1901
|
+
return h.call(p, d, m).tz(this.$x.$timezone, !0);
|
|
1889
1902
|
}, o.tz = function(d, m, p) {
|
|
1890
|
-
var u = p && m, x = p || m || r,
|
|
1903
|
+
var u = p && m, x = p || m || r, w = c(+o(), x);
|
|
1891
1904
|
if (typeof d != "string") return o(d).tz(x);
|
|
1892
|
-
var
|
|
1893
|
-
var D =
|
|
1894
|
-
if (
|
|
1895
|
-
var _ = c(D -= 60 * (
|
|
1896
|
-
return
|
|
1897
|
-
}(o.utc(d, u).valueOf(),
|
|
1898
|
-
return
|
|
1905
|
+
var E = function(k, S, b) {
|
|
1906
|
+
var D = k - 60 * S * 1e3, I = c(D, b);
|
|
1907
|
+
if (S === I) return [D, S];
|
|
1908
|
+
var _ = c(D -= 60 * (I - S) * 1e3, b);
|
|
1909
|
+
return I === _ ? [D, I] : [k - 60 * Math.min(I, _) * 1e3, Math.max(I, _)];
|
|
1910
|
+
}(o.utc(d, u).valueOf(), w, x), T = E[0], O = E[1], C = o(T).utcOffset(O);
|
|
1911
|
+
return C.$x.$timezone = x, C;
|
|
1899
1912
|
}, o.tz.guess = function() {
|
|
1900
1913
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1901
1914
|
}, o.tz.setDefault = function(d) {
|
|
@@ -1903,114 +1916,114 @@ var Rt = { exports: {} };
|
|
|
1903
1916
|
};
|
|
1904
1917
|
};
|
|
1905
1918
|
});
|
|
1906
|
-
})(
|
|
1907
|
-
var we =
|
|
1908
|
-
const be = /* @__PURE__ */
|
|
1909
|
-
var
|
|
1910
|
-
(function(
|
|
1919
|
+
})(Gt);
|
|
1920
|
+
var we = Gt.exports;
|
|
1921
|
+
const be = /* @__PURE__ */ N(we);
|
|
1922
|
+
var Rt = { exports: {} };
|
|
1923
|
+
(function(f, t) {
|
|
1911
1924
|
(function(e, i) {
|
|
1912
|
-
|
|
1913
|
-
})(
|
|
1925
|
+
f.exports = i();
|
|
1926
|
+
})(Y, function() {
|
|
1914
1927
|
var e = "minute", i = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
|
|
1915
1928
|
return function(n, o, r) {
|
|
1916
|
-
var
|
|
1929
|
+
var l = o.prototype;
|
|
1917
1930
|
r.utc = function(u) {
|
|
1918
1931
|
var x = { date: u, utc: !0, args: arguments };
|
|
1919
1932
|
return new o(x);
|
|
1920
|
-
},
|
|
1933
|
+
}, l.utc = function(u) {
|
|
1921
1934
|
var x = r(this.toDate(), { locale: this.$L, utc: !0 });
|
|
1922
1935
|
return u ? x.add(this.utcOffset(), e) : x;
|
|
1923
|
-
},
|
|
1936
|
+
}, l.local = function() {
|
|
1924
1937
|
return r(this.toDate(), { locale: this.$L, utc: !1 });
|
|
1925
1938
|
};
|
|
1926
|
-
var c =
|
|
1927
|
-
|
|
1939
|
+
var c = l.parse;
|
|
1940
|
+
l.parse = function(u) {
|
|
1928
1941
|
u.utc && (this.$u = !0), this.$utils().u(u.$offset) || (this.$offset = u.$offset), c.call(this, u);
|
|
1929
1942
|
};
|
|
1930
|
-
var
|
|
1931
|
-
|
|
1943
|
+
var g = l.init;
|
|
1944
|
+
l.init = function() {
|
|
1932
1945
|
if (this.$u) {
|
|
1933
1946
|
var u = this.$d;
|
|
1934
1947
|
this.$y = u.getUTCFullYear(), this.$M = u.getUTCMonth(), this.$D = u.getUTCDate(), this.$W = u.getUTCDay(), this.$H = u.getUTCHours(), this.$m = u.getUTCMinutes(), this.$s = u.getUTCSeconds(), this.$ms = u.getUTCMilliseconds();
|
|
1935
|
-
} else
|
|
1948
|
+
} else g.call(this);
|
|
1936
1949
|
};
|
|
1937
|
-
var
|
|
1938
|
-
|
|
1939
|
-
var
|
|
1940
|
-
if (
|
|
1941
|
-
if (typeof u == "string" && (u = function(
|
|
1942
|
-
|
|
1943
|
-
var
|
|
1944
|
-
if (!
|
|
1945
|
-
var
|
|
1946
|
-
return D === 0 ? 0 :
|
|
1950
|
+
var h = l.utcOffset;
|
|
1951
|
+
l.utcOffset = function(u, x) {
|
|
1952
|
+
var w = this.$utils().u;
|
|
1953
|
+
if (w(u)) return this.$u ? 0 : w(this.$offset) ? h.call(this) : this.$offset;
|
|
1954
|
+
if (typeof u == "string" && (u = function(C) {
|
|
1955
|
+
C === void 0 && (C = "");
|
|
1956
|
+
var k = C.match(i);
|
|
1957
|
+
if (!k) return null;
|
|
1958
|
+
var S = ("" + k[0]).match(s) || ["-", 0, 0], b = S[0], D = 60 * +S[1] + +S[2];
|
|
1959
|
+
return D === 0 ? 0 : b === "+" ? D : -D;
|
|
1947
1960
|
}(u), u === null)) return this;
|
|
1948
|
-
var
|
|
1949
|
-
if (x) return T.$offset =
|
|
1961
|
+
var E = Math.abs(u) <= 16 ? 60 * u : u, T = this;
|
|
1962
|
+
if (x) return T.$offset = E, T.$u = u === 0, T;
|
|
1950
1963
|
if (u !== 0) {
|
|
1951
|
-
var
|
|
1952
|
-
(T = this.local().add(
|
|
1964
|
+
var O = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
1965
|
+
(T = this.local().add(E + O, e)).$offset = E, T.$x.$localOffset = O;
|
|
1953
1966
|
} else T = this.utc();
|
|
1954
1967
|
return T;
|
|
1955
1968
|
};
|
|
1956
|
-
var d =
|
|
1957
|
-
|
|
1969
|
+
var d = l.format;
|
|
1970
|
+
l.format = function(u) {
|
|
1958
1971
|
var x = u || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
1959
1972
|
return d.call(this, x);
|
|
1960
|
-
},
|
|
1973
|
+
}, l.valueOf = function() {
|
|
1961
1974
|
var u = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
1962
1975
|
return this.$d.valueOf() - 6e4 * u;
|
|
1963
|
-
},
|
|
1976
|
+
}, l.isUTC = function() {
|
|
1964
1977
|
return !!this.$u;
|
|
1965
|
-
},
|
|
1978
|
+
}, l.toISOString = function() {
|
|
1966
1979
|
return this.toDate().toISOString();
|
|
1967
|
-
},
|
|
1980
|
+
}, l.toString = function() {
|
|
1968
1981
|
return this.toDate().toUTCString();
|
|
1969
1982
|
};
|
|
1970
|
-
var m =
|
|
1971
|
-
|
|
1983
|
+
var m = l.toDate;
|
|
1984
|
+
l.toDate = function(u) {
|
|
1972
1985
|
return u === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
|
|
1973
1986
|
};
|
|
1974
|
-
var p =
|
|
1975
|
-
|
|
1976
|
-
if (u && this.$u === u.$u) return p.call(this, u, x,
|
|
1977
|
-
var
|
|
1978
|
-
return p.call(
|
|
1987
|
+
var p = l.diff;
|
|
1988
|
+
l.diff = function(u, x, w) {
|
|
1989
|
+
if (u && this.$u === u.$u) return p.call(this, u, x, w);
|
|
1990
|
+
var E = this.local(), T = r(u).local();
|
|
1991
|
+
return p.call(E, T, x, w);
|
|
1979
1992
|
};
|
|
1980
1993
|
};
|
|
1981
1994
|
});
|
|
1982
|
-
})(
|
|
1983
|
-
var ve =
|
|
1984
|
-
const Te = /* @__PURE__ */
|
|
1995
|
+
})(Rt);
|
|
1996
|
+
var ve = Rt.exports;
|
|
1997
|
+
const Te = /* @__PURE__ */ N(ve);
|
|
1985
1998
|
var Se = { exports: {} };
|
|
1986
|
-
(function(
|
|
1999
|
+
(function(f, t) {
|
|
1987
2000
|
(function(e, i) {
|
|
1988
|
-
|
|
1989
|
-
})(
|
|
2001
|
+
f.exports = i();
|
|
2002
|
+
})(Y, function() {
|
|
1990
2003
|
return { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(e) {
|
|
1991
2004
|
var i = ["th", "st", "nd", "rd"], s = e % 100;
|
|
1992
2005
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
1993
2006
|
} };
|
|
1994
2007
|
});
|
|
1995
2008
|
})(Se);
|
|
1996
|
-
var
|
|
1997
|
-
(function(
|
|
2009
|
+
var Ee = { exports: {} };
|
|
2010
|
+
(function(f, t) {
|
|
1998
2011
|
(function(e, i) {
|
|
1999
|
-
|
|
2000
|
-
})(
|
|
2012
|
+
f.exports = i(H);
|
|
2013
|
+
})(Y, function(e) {
|
|
2001
2014
|
function i(o) {
|
|
2002
2015
|
return o && typeof o == "object" && "default" in o ? o : { default: o };
|
|
2003
2016
|
}
|
|
2004
2017
|
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) {
|
|
2005
2018
|
return r === "W" ? o + "周" : o + "日";
|
|
2006
2019
|
}, 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) {
|
|
2007
|
-
var
|
|
2008
|
-
return
|
|
2020
|
+
var l = 100 * o + r;
|
|
2021
|
+
return l < 600 ? "凌晨" : l < 900 ? "早上" : l < 1100 ? "上午" : l < 1300 ? "中午" : l < 1800 ? "下午" : "晚上";
|
|
2009
2022
|
} };
|
|
2010
2023
|
return s.default.locale(n, null, !0), n;
|
|
2011
2024
|
});
|
|
2012
|
-
})(
|
|
2013
|
-
const
|
|
2025
|
+
})(Ee);
|
|
2026
|
+
const ke = (f, t) => {
|
|
2014
2027
|
const e = t.prototype;
|
|
2015
2028
|
e.setLocale = function(s) {
|
|
2016
2029
|
return this.$locale = s || H().locale(), this.$L = this.$locale, this;
|
|
@@ -2032,14 +2045,14 @@ H.extend(pe);
|
|
|
2032
2045
|
H.extend(ye);
|
|
2033
2046
|
H.extend(be);
|
|
2034
2047
|
H.extend(Te);
|
|
2035
|
-
H.extend(
|
|
2036
|
-
function wt(
|
|
2048
|
+
H.extend(ke);
|
|
2049
|
+
function wt(f) {
|
|
2037
2050
|
try {
|
|
2038
|
-
if (H.locale() ===
|
|
2039
|
-
if (H.locale(
|
|
2040
|
-
|
|
2051
|
+
if (H.locale() === f) return;
|
|
2052
|
+
if (H.locale(f) !== f) throw Error();
|
|
2053
|
+
L.info(`Locale set to ${f}`);
|
|
2041
2054
|
} catch {
|
|
2042
|
-
|
|
2055
|
+
L.warn(`Failed to set locale ${f}, fallback to en`), H.locale("en");
|
|
2043
2056
|
}
|
|
2044
2057
|
}
|
|
2045
2058
|
const ht = () => ({
|
|
@@ -2065,7 +2078,7 @@ const ht = () => ({
|
|
|
2065
2078
|
quarter: 14
|
|
2066
2079
|
}
|
|
2067
2080
|
});
|
|
2068
|
-
class
|
|
2081
|
+
class Oe {
|
|
2069
2082
|
constructor() {
|
|
2070
2083
|
a(this, "startTime", H().startOf("day"));
|
|
2071
2084
|
a(this, "endTime", H().endOf("day"));
|
|
@@ -2151,13 +2164,13 @@ class Me {
|
|
|
2151
2164
|
month: "month",
|
|
2152
2165
|
quarter: "quarter"
|
|
2153
2166
|
}[e];
|
|
2154
|
-
s ||
|
|
2167
|
+
s || L.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), this.isStrict = this.strictStart && this.strictEnd, i.cellWidth && (Pt(i.cellWidth) ? this.cellWidth = {
|
|
2155
2168
|
hour: i.cellWidth,
|
|
2156
2169
|
day: i.cellWidth,
|
|
2157
2170
|
week: i.cellWidth,
|
|
2158
2171
|
month: i.cellWidth,
|
|
2159
2172
|
quarter: i.cellWidth
|
|
2160
|
-
} :
|
|
2173
|
+
} : U(i.cellWidth) ? this.cellWidth = J(
|
|
2161
2174
|
ht()[i.cellWidth] || ht().normal
|
|
2162
2175
|
) : Tt(i.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, i.cellWidth))), this.headerCellFormat = i.headerCellFormat, this.headerGroupFormat = i.headerGroupFormat;
|
|
2163
2176
|
}
|
|
@@ -2237,7 +2250,7 @@ class Me {
|
|
|
2237
2250
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2238
2251
|
if (i) return i;
|
|
2239
2252
|
}
|
|
2240
|
-
if (
|
|
2253
|
+
if (U(this.headerGroupFormat))
|
|
2241
2254
|
return t.format(this.headerGroupFormat);
|
|
2242
2255
|
switch (this.getGroupUnit()) {
|
|
2243
2256
|
case "month":
|
|
@@ -2257,7 +2270,7 @@ class Me {
|
|
|
2257
2270
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2258
2271
|
if (i) return i;
|
|
2259
2272
|
}
|
|
2260
|
-
if (
|
|
2273
|
+
if (U(this.headerCellFormat))
|
|
2261
2274
|
return t.format(this.headerCellFormat);
|
|
2262
2275
|
switch (this.getChildUnit()) {
|
|
2263
2276
|
case "hour":
|
|
@@ -2292,7 +2305,7 @@ class Me {
|
|
|
2292
2305
|
return t.isSameOrAfter(this.startTime) && t.isSameOrBefore(this.endTime);
|
|
2293
2306
|
}
|
|
2294
2307
|
}
|
|
2295
|
-
class
|
|
2308
|
+
class Me {
|
|
2296
2309
|
// 使用私有构造函数防止直接创建实例
|
|
2297
2310
|
constructor(t, e) {
|
|
2298
2311
|
// 声明成员属性类型
|
|
@@ -2304,8 +2317,8 @@ class Oe {
|
|
|
2304
2317
|
this.context = t;
|
|
2305
2318
|
const i = gt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2306
2319
|
if (s && !V(s))
|
|
2307
|
-
throw
|
|
2308
|
-
this.optionManager = new Ut(), this.optionManager.setOptions(i), i.locale && wt(i.locale), this.timeAxis = new
|
|
2320
|
+
throw L.exception("Data should be a array.");
|
|
2321
|
+
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);
|
|
2309
2322
|
}
|
|
2310
2323
|
getOptionManager() {
|
|
2311
2324
|
return this.optionManager;
|
|
@@ -2398,14 +2411,14 @@ class Le {
|
|
|
2398
2411
|
a(this, "handleHorizontalTrackMouseDown", (t) => {
|
|
2399
2412
|
if (t.target !== this.hScrollbar) return;
|
|
2400
2413
|
t.preventDefault();
|
|
2401
|
-
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,
|
|
2402
|
-
this.scrollTo({ x:
|
|
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, l = (s - i / 2) / r * o;
|
|
2415
|
+
this.scrollTo({ x: l, y: this.scrollTop }, "track");
|
|
2403
2416
|
});
|
|
2404
2417
|
a(this, "handleVerticalTrackMouseDown", (t) => {
|
|
2405
2418
|
if (t.target !== this.vScrollbar) return;
|
|
2406
2419
|
t.preventDefault();
|
|
2407
|
-
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,
|
|
2408
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
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, l = (s - i / 2) / r * o;
|
|
2421
|
+
this.scrollTo({ x: this.scrollLeft, y: l }, "track");
|
|
2409
2422
|
});
|
|
2410
2423
|
a(this, "handleMouseUp", () => {
|
|
2411
2424
|
if (this.isDraggingHScroll || this.isDraggingVScroll) {
|
|
@@ -2416,8 +2429,8 @@ class Le {
|
|
|
2416
2429
|
// --- 动画处理 ---
|
|
2417
2430
|
a(this, "animationStep", (t) => {
|
|
2418
2431
|
if (!this.isAnimating) return;
|
|
2419
|
-
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,
|
|
2420
|
-
(
|
|
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, l = this.scrollLeft !== o, c = this.scrollTop !== r;
|
|
2433
|
+
(l || c) && 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());
|
|
2421
2434
|
});
|
|
2422
2435
|
this.root = t, this.rootElement = e, this.options = ot(
|
|
2423
2436
|
{
|
|
@@ -2537,7 +2550,7 @@ class Le {
|
|
|
2537
2550
|
}
|
|
2538
2551
|
// --- 事件处理 ---
|
|
2539
2552
|
emit(t, e, i) {
|
|
2540
|
-
this.scrollLeft =
|
|
2553
|
+
this.scrollLeft = G(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = G(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2541
2554
|
x: this.scrollLeft,
|
|
2542
2555
|
y: this.scrollTop,
|
|
2543
2556
|
source: t
|
|
@@ -2548,8 +2561,8 @@ class Le {
|
|
|
2548
2561
|
if (this.scheduleShow(), this.isDraggingHScroll) {
|
|
2549
2562
|
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);
|
|
2550
2563
|
if (n === 0 || o === 0) return;
|
|
2551
|
-
const r = e / n * o,
|
|
2552
|
-
this.scrollTo({ x:
|
|
2564
|
+
const r = e / n * o, l = this.thumbStartScrollLeft + r;
|
|
2565
|
+
this.scrollTo({ x: l, y: this.scrollTop }, "drag");
|
|
2553
2566
|
}
|
|
2554
2567
|
if (this.isDraggingVScroll) {
|
|
2555
2568
|
const e = t.clientY - this.dragStartY, i = this.vScrollbar.clientHeight, s = this.vScrollThumb.offsetHeight, n = Math.max(0, i - s), o = Math.max(
|
|
@@ -2557,17 +2570,17 @@ class Le {
|
|
|
2557
2570
|
this.contentHeight - this.viewportHeight
|
|
2558
2571
|
);
|
|
2559
2572
|
if (n === 0 || o === 0) return;
|
|
2560
|
-
const r = e / n * o,
|
|
2561
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
2573
|
+
const r = e / n * o, l = this.thumbStartScrollTop + r;
|
|
2574
|
+
this.scrollTo({ x: this.scrollLeft, y: l }, "drag");
|
|
2562
2575
|
}
|
|
2563
2576
|
}
|
|
2564
2577
|
}
|
|
2565
2578
|
handleWheel(t) {
|
|
2566
|
-
if (t.target !== this.rootElement && !this.rootElement.contains(t.target) &&
|
|
2579
|
+
if (t.target !== this.rootElement && !this.rootElement.contains(t.target) && L.debug(
|
|
2567
2580
|
"Wheel event ignored, target not root or descendant:",
|
|
2568
2581
|
t.target
|
|
2569
2582
|
), !this.isMouseOverRoot && !this.isMouseOverScrollbar) {
|
|
2570
|
-
|
|
2583
|
+
L.debug("Wheel event ignored, mouse not over root or scrollbar");
|
|
2571
2584
|
return;
|
|
2572
2585
|
}
|
|
2573
2586
|
const e = this.canScrollHorizontal(), i = this.canScrollVertical();
|
|
@@ -2591,8 +2604,8 @@ class Le {
|
|
|
2591
2604
|
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";
|
|
2592
2605
|
const s = 150, n = (o) => {
|
|
2593
2606
|
if (!this.isAnimating) return;
|
|
2594
|
-
const r = o - this.animationStartTime,
|
|
2595
|
-
(d || m) && this.emit("wheel",
|
|
2607
|
+
const r = o - this.animationStartTime, l = Math.min(1, r / s), c = l * (2 - l), g = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * c, h = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * c, d = this.scrollLeft !== g, m = this.scrollTop !== h;
|
|
2608
|
+
(d || m) && this.emit("wheel", g, h), l < 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());
|
|
2596
2609
|
};
|
|
2597
2610
|
this.animationFrameId = requestAnimationFrame(n);
|
|
2598
2611
|
}
|
|
@@ -2640,15 +2653,15 @@ class Le {
|
|
|
2640
2653
|
*/
|
|
2641
2654
|
updateSize(t, e, i, s, n = 0, o = 0) {
|
|
2642
2655
|
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);
|
|
2643
|
-
const r = this.canScrollHorizontal() && this.options.showHorizontal,
|
|
2656
|
+
const r = this.canScrollHorizontal() && this.options.showHorizontal, l = this.canScrollVertical() && this.options.showVertical;
|
|
2644
2657
|
if (r) {
|
|
2645
|
-
const
|
|
2646
|
-
this.hScrollbar.style.display = "block", this.hScrollbar.style.left = `${n}px`, this.hScrollbar.style.width = `${Math.max(0,
|
|
2658
|
+
const g = this.viewportWidth - (l ? this.options.track.size : 0);
|
|
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 = l ? `${this.options.track.size}px` : "0px";
|
|
2647
2660
|
} else
|
|
2648
2661
|
this.hScrollbar.style.display = "none";
|
|
2649
|
-
if (
|
|
2650
|
-
const
|
|
2651
|
-
this.vScrollbar.style.display = "block", this.vScrollbar.style.top = `${o}px`, this.vScrollbar.style.height = `${Math.max(0,
|
|
2662
|
+
if (l) {
|
|
2663
|
+
const g = this.viewportHeight - o - (r ? this.options.track.size : 0);
|
|
2664
|
+
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";
|
|
2652
2665
|
} else
|
|
2653
2666
|
this.vScrollbar.style.display = "none";
|
|
2654
2667
|
this.updateThumbStyles();
|
|
@@ -2656,7 +2669,7 @@ class Le {
|
|
|
2656
2669
|
x: this.scrollLeft,
|
|
2657
2670
|
y: this.scrollTop
|
|
2658
2671
|
});
|
|
2659
|
-
(c.x !== this.scrollLeft || c.y !== this.scrollTop) && this.emit("api", c.x, c.y), this.isMouseOverRoot || this.isDraggingHScroll || this.isDraggingVScroll ? this.scheduleShow() : !r && !
|
|
2672
|
+
(c.x !== this.scrollLeft || c.y !== this.scrollTop) && this.emit("api", c.x, c.y), this.isMouseOverRoot || this.isDraggingHScroll || this.isDraggingVScroll ? this.scheduleShow() : !r && !l ? this.hideScrollbars(!0) : this.isVisible ? this.scheduleShow() : this.hideScrollbars(!0);
|
|
2660
2673
|
}
|
|
2661
2674
|
updateThumbStyles() {
|
|
2662
2675
|
if (this.canScrollHorizontal() && this.options.showHorizontal) {
|
|
@@ -2736,17 +2749,17 @@ class Le {
|
|
|
2736
2749
|
}
|
|
2737
2750
|
// --- 销毁 ---
|
|
2738
2751
|
destroy() {
|
|
2739
|
-
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,
|
|
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, L.debug("Scrollbar destroyed");
|
|
2740
2753
|
}
|
|
2741
2754
|
}
|
|
2742
|
-
function Q(
|
|
2755
|
+
function Q(f, t = "") {
|
|
2743
2756
|
const e = ["px", "%", "vh", "vw", "rem", "em"];
|
|
2744
|
-
if (
|
|
2757
|
+
if (f == null)
|
|
2745
2758
|
return t;
|
|
2746
|
-
if (typeof
|
|
2747
|
-
return isFinite(
|
|
2748
|
-
if (typeof
|
|
2749
|
-
const i =
|
|
2759
|
+
if (typeof f == "number")
|
|
2760
|
+
return isFinite(f) ? `${f}px` : t;
|
|
2761
|
+
if (typeof f == "string") {
|
|
2762
|
+
const i = f.trim();
|
|
2750
2763
|
if (i === "")
|
|
2751
2764
|
return t;
|
|
2752
2765
|
for (const n of e)
|
|
@@ -2774,11 +2787,11 @@ class it {
|
|
|
2774
2787
|
* @param colspan 横向合并的列数
|
|
2775
2788
|
* @param rowspan 纵向合并的行数
|
|
2776
2789
|
*/
|
|
2777
|
-
constructor(t, e, i, s, n, o, r = 1,
|
|
2790
|
+
constructor(t, e, i, s, n, o, r = 1, l = 1, c) {
|
|
2778
2791
|
a(this, "element");
|
|
2779
2792
|
a(this, "isEmpty", !1);
|
|
2780
2793
|
a(this, "isHandler", !1);
|
|
2781
|
-
this.context = t, this.container = e, this.column = i, this.task = s, this.rowIndex = n, this.colIndex = o, this.colspan = r, this.rowspan =
|
|
2794
|
+
this.context = t, this.container = e, this.column = i, this.task = s, this.rowIndex = n, this.colIndex = o, this.colspan = r, this.rowspan = l, this.isEmpty = c === "empty", this.isHandler = c === "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(
|
|
2782
2795
|
"border-color",
|
|
2783
2796
|
this.context.getOptions().border.color,
|
|
2784
2797
|
"important"
|
|
@@ -2790,18 +2803,18 @@ class it {
|
|
|
2790
2803
|
}
|
|
2791
2804
|
setContent() {
|
|
2792
2805
|
const t = document.createElement("div");
|
|
2793
|
-
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", (this.column.column.ellipsis ??
|
|
2806
|
+
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", (this.column.column.ellipsis ?? this.context.getOptions().table.ellipsis ?? !0) && (t.style.textOverflow = "ellipsis"), t.style.whiteSpace = "nowrap", t.style.flex = "1", t.style.height = "100%", t.style.alignContent = "center", this.colIndex === 0 && (t.style.paddingLeft = Q(
|
|
2794
2807
|
this.task.level * this.context.getOptions().row.indent,
|
|
2795
2808
|
"16px"
|
|
2796
2809
|
)), typeof this.column.column.render == "function")
|
|
2797
2810
|
try {
|
|
2798
2811
|
const e = this.column.column.render(this.task.getEmitData());
|
|
2799
|
-
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement ? t.appendChild(e) :
|
|
2812
|
+
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement ? t.appendChild(e) : L.warn(
|
|
2800
2813
|
"Table cell render function does not return a valid value.",
|
|
2801
2814
|
e
|
|
2802
2815
|
);
|
|
2803
2816
|
} catch (e) {
|
|
2804
|
-
|
|
2817
|
+
L.error("Table cell render error:", e), t.textContent = this.task.getField(this.column.column.field) ?? this.context.getOptions().table.emptyText;
|
|
2805
2818
|
}
|
|
2806
2819
|
else
|
|
2807
2820
|
t.textContent = this.task.getField(this.column.column.field) ?? this.context.getOptions().table.emptyText;
|
|
@@ -2811,7 +2824,7 @@ class it {
|
|
|
2811
2824
|
const t = document.createElement("div");
|
|
2812
2825
|
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) {
|
|
2813
2826
|
const e = document.createElement("div");
|
|
2814
|
-
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new
|
|
2827
|
+
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new Et(this.context, e, this.task), t.appendChild(e);
|
|
2815
2828
|
}
|
|
2816
2829
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
2817
2830
|
const e = document.createElement("div");
|
|
@@ -2936,9 +2949,9 @@ class bt {
|
|
|
2936
2949
|
const e = this.context.store.getColumnManager().getLeafColumns();
|
|
2937
2950
|
for (let n = 0; n < e.length; n++) {
|
|
2938
2951
|
const o = e[n], r = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
2939
|
-
if (r)
|
|
2952
|
+
if (r) {
|
|
2940
2953
|
if (r.task.id !== this.task.id) {
|
|
2941
|
-
const
|
|
2954
|
+
const l = new it(
|
|
2942
2955
|
this.context,
|
|
2943
2956
|
this.element,
|
|
2944
2957
|
o,
|
|
@@ -2949,9 +2962,9 @@ class bt {
|
|
|
2949
2962
|
1,
|
|
2950
2963
|
"empty"
|
|
2951
2964
|
);
|
|
2952
|
-
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(
|
|
2953
|
-
} else {
|
|
2954
|
-
const
|
|
2965
|
+
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(l);
|
|
2966
|
+
} else if (r.originColumnIndex === n) {
|
|
2967
|
+
const l = new it(
|
|
2955
2968
|
this.context,
|
|
2956
2969
|
this.element,
|
|
2957
2970
|
o,
|
|
@@ -2961,18 +2974,18 @@ class bt {
|
|
|
2961
2974
|
r.colspan,
|
|
2962
2975
|
r.rowspan
|
|
2963
2976
|
);
|
|
2964
|
-
this.cells.push(
|
|
2977
|
+
this.cells.push(l);
|
|
2965
2978
|
}
|
|
2966
|
-
else {
|
|
2967
|
-
let
|
|
2968
|
-
const
|
|
2979
|
+
} else {
|
|
2980
|
+
let l = 1, c = 1;
|
|
2981
|
+
const g = (s = (i = o.column).merge) == null ? void 0 : s.call(
|
|
2969
2982
|
i,
|
|
2970
2983
|
this.task.getField(o.column.field),
|
|
2971
2984
|
this.task.data,
|
|
2972
2985
|
n,
|
|
2973
2986
|
this.task.level + 1
|
|
2974
2987
|
);
|
|
2975
|
-
if (
|
|
2988
|
+
if (g && (typeof g.col != "number" ? L.error("colspan function must returned a number") : l = g.col, typeof g.row != "number" ? L.error("rowspan function must returned a number") : c = g.row), l > 1 || c > 1) {
|
|
2976
2989
|
if (c > 1)
|
|
2977
2990
|
for (let p = 1; p < c; p++) {
|
|
2978
2991
|
const u = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + p];
|
|
@@ -2984,30 +2997,30 @@ class bt {
|
|
|
2984
2997
|
const d = {
|
|
2985
2998
|
task: this.task,
|
|
2986
2999
|
originColumnIndex: n,
|
|
2987
|
-
colspan:
|
|
3000
|
+
colspan: l,
|
|
2988
3001
|
rowspan: c
|
|
2989
3002
|
};
|
|
2990
3003
|
let m = this.task;
|
|
2991
3004
|
for (let p = c; p > 0; p--)
|
|
2992
3005
|
if (m) {
|
|
2993
|
-
for (let u = 0; u <
|
|
3006
|
+
for (let u = 0; u < l; u++)
|
|
2994
3007
|
this.context.store.getColumnManager().addMergeInfo(m.id, u + n, d);
|
|
2995
3008
|
m = this.context.store.getDataManager().getVisibleTasks().at(m.flatIndex + 1);
|
|
2996
3009
|
}
|
|
2997
|
-
for (let p = 0; p <
|
|
3010
|
+
for (let p = 0; p < l; p++)
|
|
2998
3011
|
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, d);
|
|
2999
3012
|
}
|
|
3000
|
-
const
|
|
3013
|
+
const h = new it(
|
|
3001
3014
|
this.context,
|
|
3002
3015
|
this.element,
|
|
3003
3016
|
o,
|
|
3004
3017
|
this.task,
|
|
3005
3018
|
this.task.flatIndex,
|
|
3006
3019
|
n,
|
|
3007
|
-
|
|
3020
|
+
l,
|
|
3008
3021
|
c
|
|
3009
3022
|
);
|
|
3010
|
-
this.cells.push(
|
|
3023
|
+
this.cells.push(h);
|
|
3011
3024
|
}
|
|
3012
3025
|
}
|
|
3013
3026
|
this.context.store.getDataManager().isTaskSelected(this.task.id) && this.element.classList.add("selected");
|
|
@@ -3060,25 +3073,25 @@ class Ce {
|
|
|
3060
3073
|
}), e.forEach((n, o) => {
|
|
3061
3074
|
const r = n.id;
|
|
3062
3075
|
if (this.rows.has(r)) {
|
|
3063
|
-
const
|
|
3064
|
-
|
|
3076
|
+
const l = this.rows.get(r);
|
|
3077
|
+
l.update(n), l.updateTop(t);
|
|
3065
3078
|
} else {
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3079
|
+
const l = new bt(this.context, this.element, n, t);
|
|
3080
|
+
l.create(), this.rows.set(r, l);
|
|
3068
3081
|
}
|
|
3069
|
-
this.context.store.getColumnManager().getLeafColumns().forEach((
|
|
3070
|
-
const
|
|
3071
|
-
if (
|
|
3072
|
-
const
|
|
3073
|
-
if (!this.rows.has(
|
|
3082
|
+
this.context.store.getColumnManager().getLeafColumns().forEach((l, c) => {
|
|
3083
|
+
const g = this.context.store.getColumnManager().getMergeInfo(n.id, c);
|
|
3084
|
+
if (g && g.rowspan > 1) {
|
|
3085
|
+
const h = g.task.id;
|
|
3086
|
+
if (!this.rows.has(h) && !this.mergeRows.has(h)) {
|
|
3074
3087
|
const d = new bt(
|
|
3075
3088
|
this.context,
|
|
3076
3089
|
this.element,
|
|
3077
|
-
|
|
3090
|
+
g.task,
|
|
3078
3091
|
t,
|
|
3079
3092
|
!0
|
|
3080
3093
|
);
|
|
3081
|
-
d.create(), this.mergeRows.set(
|
|
3094
|
+
d.create(), this.mergeRows.set(h, d);
|
|
3082
3095
|
}
|
|
3083
3096
|
}
|
|
3084
3097
|
});
|
|
@@ -3121,7 +3134,7 @@ class ct {
|
|
|
3121
3134
|
this.context = t, this.root = e, this.container = i, this.column = s, this.columnElement = document.createElement("div"), this.initElement(), this.container.appendChild(this.columnElement);
|
|
3122
3135
|
}
|
|
3123
3136
|
initElement() {
|
|
3124
|
-
const t = this.context.store.getColumnManager(), e = t.getColumnWidth(this.column.key), i = this.column.column.headerAlign || this.context.getOptions().table.headerAlign, s = this.column.column.ellipsis ??
|
|
3137
|
+
const t = this.context.store.getColumnManager(), e = t.getColumnWidth(this.column.key), i = this.column.column.headerAlign || this.context.getOptions().table.headerAlign, s = this.column.column.ellipsis ?? this.context.getOptions().table.ellipsis ?? !0;
|
|
3125
3138
|
this.columnElement.className = "x-gantt-table-header-cell", (t.isMultiHeader() || this.context.getOptions().border.show) && this.columnElement.classList.add("border"), this.columnElement.style.height = "100%", this.columnElement.style.width = `${e}px`, this.columnElement.style.display = "flex", this.columnElement.style.flexShrink = "0", this.columnElement.style.alignItems = "center", this.columnElement.style.padding = "0 8px", this.columnElement.style.boxSizing = "border-box", this.columnElement.style.setProperty(
|
|
3126
3139
|
"border-color",
|
|
3127
3140
|
this.context.getOptions().border.color,
|
|
@@ -3158,15 +3171,15 @@ class ct {
|
|
|
3158
3171
|
let e = 0, i = 0, s = null, n = 0;
|
|
3159
3172
|
const o = (c) => {
|
|
3160
3173
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3161
|
-
const
|
|
3162
|
-
document.addEventListener("mousemove",
|
|
3174
|
+
const g = (d) => r(d), h = (d) => l(d, g, h);
|
|
3175
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", h), n = e - s.left, this.context.event.emit(y.SHOW_GUIDELINE, n);
|
|
3163
3176
|
}, r = (c) => {
|
|
3164
3177
|
if (c.preventDefault(), !s) return;
|
|
3165
|
-
const
|
|
3178
|
+
const g = c.clientX - e, h = i + g, d = Math.max(50, h), m = e - s.left - i, u = this.root.clientWidth - 20;
|
|
3166
3179
|
let x = m + d;
|
|
3167
3180
|
x = Math.min(u, x), this.context.event.emit(y.MOVE_GUIDELINE, x);
|
|
3168
|
-
},
|
|
3169
|
-
document.removeEventListener("mousemove",
|
|
3181
|
+
}, l = (c, g, h) => {
|
|
3182
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", h), this.context.event.emit(y.HIDE_GUIDELINE);
|
|
3170
3183
|
const d = c.clientX - e, m = Math.max(50, i + d);
|
|
3171
3184
|
this.setWidth(m);
|
|
3172
3185
|
};
|
|
@@ -3288,7 +3301,7 @@ class _e {
|
|
|
3288
3301
|
this.tableHeader.render(), this.refresh(t, e);
|
|
3289
3302
|
}
|
|
3290
3303
|
refresh(t, e) {
|
|
3291
|
-
this.
|
|
3304
|
+
this.tableBody.render(t, e);
|
|
3292
3305
|
}
|
|
3293
3306
|
updateWidth() {
|
|
3294
3307
|
this.tableBody.updateWidth();
|
|
@@ -3375,63 +3388,63 @@ class He {
|
|
|
3375
3388
|
})
|
|
3376
3389
|
);
|
|
3377
3390
|
const r = t.getTimeline();
|
|
3378
|
-
let
|
|
3379
|
-
for (let
|
|
3380
|
-
const
|
|
3381
|
-
if (
|
|
3382
|
-
|
|
3391
|
+
let l = 0;
|
|
3392
|
+
for (let g = 0; g < r.length; g++) {
|
|
3393
|
+
const h = r[g], d = e * (((c = h.children) == null ? void 0 : c.length) ?? 0);
|
|
3394
|
+
if (l + d < i) {
|
|
3395
|
+
l += d;
|
|
3383
3396
|
continue;
|
|
3384
3397
|
}
|
|
3385
|
-
if (
|
|
3398
|
+
if (l > s)
|
|
3386
3399
|
break;
|
|
3387
3400
|
const p = this.createCell(
|
|
3388
|
-
`group-${
|
|
3389
|
-
|
|
3401
|
+
`group-${h.date.format("YYYY-MM-DD")}`,
|
|
3402
|
+
l,
|
|
3390
3403
|
0,
|
|
3391
3404
|
d,
|
|
3392
3405
|
n,
|
|
3393
3406
|
o,
|
|
3394
|
-
|
|
3407
|
+
h.label
|
|
3395
3408
|
);
|
|
3396
|
-
if (this.groupHeader.add(p), V(
|
|
3397
|
-
let u =
|
|
3398
|
-
for (let x = 0; x <
|
|
3399
|
-
const
|
|
3400
|
-
let
|
|
3401
|
-
for (;
|
|
3402
|
-
|
|
3403
|
-
if (x +=
|
|
3404
|
-
let
|
|
3405
|
-
for (; r[
|
|
3406
|
-
r[
|
|
3407
|
-
|
|
3409
|
+
if (this.groupHeader.add(p), V(h.children) && h.children.length > 0) {
|
|
3410
|
+
let u = l;
|
|
3411
|
+
for (let x = 0; x < h.children.length; ) {
|
|
3412
|
+
const w = h.children[x];
|
|
3413
|
+
let E = 1;
|
|
3414
|
+
for (; h.children[x + E] && w.label === h.children[x + E].label; )
|
|
3415
|
+
E++;
|
|
3416
|
+
if (x += E, x >= h.children.length && r[g + 1] && r[g + 1].children) {
|
|
3417
|
+
let k = 0;
|
|
3418
|
+
for (; r[g + 1].children[k] && w.label === r[g + 1].children[k].label; )
|
|
3419
|
+
r[g + 1].children[k].hide = !0, k++;
|
|
3420
|
+
k > 0 && (E += k);
|
|
3408
3421
|
}
|
|
3409
|
-
const T = e *
|
|
3422
|
+
const T = e * E;
|
|
3410
3423
|
if (u + T < i) {
|
|
3411
3424
|
u += T;
|
|
3412
3425
|
continue;
|
|
3413
3426
|
}
|
|
3414
3427
|
if (u > s)
|
|
3415
3428
|
break;
|
|
3416
|
-
const
|
|
3417
|
-
`cell-${
|
|
3429
|
+
const C = this.createCell(
|
|
3430
|
+
`cell-${w.date.format("YYYY-MM-DD")}`,
|
|
3418
3431
|
u,
|
|
3419
3432
|
n,
|
|
3420
3433
|
T,
|
|
3421
3434
|
n,
|
|
3422
|
-
|
|
3423
|
-
|
|
3435
|
+
w.hide ? "transparent" : o,
|
|
3436
|
+
w.hide ? "" : w.label
|
|
3424
3437
|
);
|
|
3425
|
-
this.cellHeader.add(
|
|
3438
|
+
this.cellHeader.add(C), w.hide && C.visible(!1), u += T;
|
|
3426
3439
|
}
|
|
3427
3440
|
}
|
|
3428
|
-
|
|
3441
|
+
l += d;
|
|
3429
3442
|
}
|
|
3430
3443
|
this.layer.batchDraw();
|
|
3431
3444
|
}
|
|
3432
3445
|
createCell(t, e, i, s, n, o, r) {
|
|
3433
|
-
const
|
|
3434
|
-
|
|
3446
|
+
const l = new v.Group();
|
|
3447
|
+
l.x(e), l.y(i);
|
|
3435
3448
|
const c = new v.Rect({
|
|
3436
3449
|
id: t,
|
|
3437
3450
|
x: 0,
|
|
@@ -3441,23 +3454,23 @@ class He {
|
|
|
3441
3454
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
3442
3455
|
name: "header-cell-bg"
|
|
3443
3456
|
});
|
|
3444
|
-
|
|
3445
|
-
let
|
|
3446
|
-
t.startsWith("cell-") && (this.cellCache.set(t, c),
|
|
3447
|
-
const
|
|
3457
|
+
l.add(c);
|
|
3458
|
+
let g = this.context.getOptions().header.fontSize;
|
|
3459
|
+
t.startsWith("cell-") && (this.cellCache.set(t, c), g -= 2);
|
|
3460
|
+
const h = new v.Line({
|
|
3448
3461
|
points: [s, 0, s, n],
|
|
3449
3462
|
stroke: o,
|
|
3450
3463
|
strokeWidth: 1,
|
|
3451
3464
|
name: "header-cell-right-border"
|
|
3452
3465
|
});
|
|
3453
|
-
|
|
3466
|
+
l.add(h);
|
|
3454
3467
|
const d = new v.Text({
|
|
3455
3468
|
x: 0,
|
|
3456
3469
|
y: 0,
|
|
3457
3470
|
width: s,
|
|
3458
3471
|
height: n,
|
|
3459
3472
|
text: r,
|
|
3460
|
-
fontSize:
|
|
3473
|
+
fontSize: g,
|
|
3461
3474
|
fontFamily: this.context.getOptions().header.fontFamily,
|
|
3462
3475
|
fontStyle: `${this.context.getOptions().header.fontWeight}`,
|
|
3463
3476
|
fill: this.context.getOptions().header.color,
|
|
@@ -3467,7 +3480,7 @@ class He {
|
|
|
3467
3480
|
ellipsis: !0,
|
|
3468
3481
|
name: "header-cell-text"
|
|
3469
3482
|
});
|
|
3470
|
-
return
|
|
3483
|
+
return l.add(d), l;
|
|
3471
3484
|
}
|
|
3472
3485
|
/**
|
|
3473
3486
|
* 清除表头内容
|
|
@@ -3504,19 +3517,19 @@ class He {
|
|
|
3504
3517
|
), s = this.cellCache.get(
|
|
3505
3518
|
`cell-${(r = e == null ? void 0 : e.endTime) == null ? void 0 : r.format("YYYY-MM-DD")}`
|
|
3506
3519
|
), n = this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor;
|
|
3507
|
-
n && (this.cellCache.forEach((
|
|
3520
|
+
n && (this.cellCache.forEach((l) => {
|
|
3508
3521
|
new v.Tween({
|
|
3509
|
-
node:
|
|
3522
|
+
node: l,
|
|
3510
3523
|
fill: n,
|
|
3511
3524
|
duration: 0.02
|
|
3512
3525
|
}).play();
|
|
3513
3526
|
}), t === "in" && (i && new v.Tween({
|
|
3514
3527
|
node: i,
|
|
3515
|
-
fill:
|
|
3528
|
+
fill: F(n).brighten(30).toHex(),
|
|
3516
3529
|
duration: 0.02
|
|
3517
3530
|
}).play(), s && new v.Tween({
|
|
3518
3531
|
node: s,
|
|
3519
|
-
fill:
|
|
3532
|
+
fill: F(n).brighten(30).toHex(),
|
|
3520
3533
|
duration: 0
|
|
3521
3534
|
}).play()));
|
|
3522
3535
|
}
|
|
@@ -3565,19 +3578,19 @@ class Ae {
|
|
|
3565
3578
|
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(
|
|
3566
3579
|
0,
|
|
3567
3580
|
Math.floor(-this.offsetX / i) - 2
|
|
3568
|
-
),
|
|
3581
|
+
), l = Math.min(
|
|
3569
3582
|
this.context.store.getTimeAxis().getCellCount(),
|
|
3570
3583
|
Math.ceil((-this.offsetX + this.width) / i) + 2
|
|
3571
3584
|
), c = Math.max(
|
|
3572
3585
|
0,
|
|
3573
3586
|
Math.floor((-this.offsetY + t) / s) - 2
|
|
3574
|
-
),
|
|
3587
|
+
), g = Math.min(
|
|
3575
3588
|
n,
|
|
3576
3589
|
Math.ceil((-this.offsetY + this.height) / s) + 2
|
|
3577
3590
|
);
|
|
3578
3591
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
3579
|
-
for (let
|
|
3580
|
-
const d =
|
|
3592
|
+
for (let h = r; h <= l; h++) {
|
|
3593
|
+
const d = h * i, m = new v.Line({
|
|
3581
3594
|
points: [d, t, d, o + t],
|
|
3582
3595
|
stroke: this.context.getOptions().border.color,
|
|
3583
3596
|
strokeWidth: 0.5,
|
|
@@ -3585,8 +3598,8 @@ class Ae {
|
|
|
3585
3598
|
});
|
|
3586
3599
|
this.verticalLines.add(m);
|
|
3587
3600
|
}
|
|
3588
|
-
for (let
|
|
3589
|
-
const d =
|
|
3601
|
+
for (let h = c; h <= g; h++) {
|
|
3602
|
+
const d = h * s + t, m = new v.Line({
|
|
3590
3603
|
points: [0, d, Math.max(this.width, e), d],
|
|
3591
3604
|
stroke: this.context.getOptions().border.color,
|
|
3592
3605
|
strokeWidth: 0.5,
|
|
@@ -3649,88 +3662,88 @@ class Ie {
|
|
|
3649
3662
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
3650
3663
|
}
|
|
3651
3664
|
render() {
|
|
3652
|
-
var p, u, x,
|
|
3665
|
+
var p, u, x, w, E, T, O, C, k, S, b, D, I;
|
|
3653
3666
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
3654
3667
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
3655
|
-
|
|
3668
|
+
L.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
3656
3669
|
return;
|
|
3657
3670
|
}
|
|
3658
3671
|
const t = this.context.getOptions().row.height, e = st(
|
|
3659
3672
|
this.unpackFunc(this.context.getOptions().bar.height),
|
|
3660
3673
|
t
|
|
3661
|
-
), 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,
|
|
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, l = nt(
|
|
3662
3675
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
3663
|
-
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)",
|
|
3676
|
+
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", g = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, h = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, d = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
3664
3677
|
this.slider || (this.slider = new v.Group({
|
|
3665
3678
|
dragBoundFunc: (_) => {
|
|
3666
|
-
let
|
|
3679
|
+
let M = 0, A = Math.abs(this.rowWidth - this.slider.width());
|
|
3667
3680
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
3668
3681
|
if (this.task.parent.startTime) {
|
|
3669
|
-
const
|
|
3670
|
-
|
|
3682
|
+
const $ = this.task.parent.startTime;
|
|
3683
|
+
M = this.context.store.getTimeAxis().getTimeLeft($);
|
|
3671
3684
|
}
|
|
3672
3685
|
if (this.task.parent.endTime) {
|
|
3673
|
-
const
|
|
3674
|
-
|
|
3686
|
+
const $ = this.task.parent.endTime, R = this.context.store.getTimeAxis().getTimeLeft($);
|
|
3687
|
+
A = Math.abs(R - this.slider.width());
|
|
3675
3688
|
}
|
|
3676
3689
|
}
|
|
3677
3690
|
return {
|
|
3678
|
-
x:
|
|
3691
|
+
x: G(_.x, M, A),
|
|
3679
3692
|
y: this.y + i + this.offsetY
|
|
3680
3693
|
};
|
|
3681
3694
|
}
|
|
3682
3695
|
})), this.slider.position({ x: s, y: i }), this.slider.size({ width: o, height: e });
|
|
3683
|
-
const m = !!this.unpackFunc(this.context.getOptions().bar.move.enabled);
|
|
3696
|
+
const m = !!this.unpackFunc(this.context.getOptions().bar.move.enabled) && (this.task.isSummary() ? this.context.getOptions().summary.move.enabled : !0);
|
|
3684
3697
|
if (this.slider.draggable(m), this.slider.on("mouseover", (_) => {
|
|
3685
3698
|
m && !this.isDragging && (_.target.getStage().container().style.cursor = "grab"), this.handleBarHighlight({
|
|
3686
|
-
shadowColor:
|
|
3687
|
-
shadowBlur: Math.max((
|
|
3688
|
-
shadowOffsetX: Math.max(
|
|
3699
|
+
shadowColor: F(c).alpha(F(c).alpha() + 0.1).toHex(),
|
|
3700
|
+
shadowBlur: Math.max((g || 1) * 2, 4),
|
|
3701
|
+
shadowOffsetX: Math.max(h || 1, 2),
|
|
3689
3702
|
shadowOffsetY: Math.max((d || 1) * 1.5, 4)
|
|
3690
3703
|
}), this.context.event.emit(y.SLIDER_HOVER, _.evt, this.task);
|
|
3691
3704
|
}), this.slider.on("mouseout", (_) => {
|
|
3692
|
-
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.handleBarHighlight({
|
|
3705
|
+
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
3693
3706
|
shadowColor: c,
|
|
3694
|
-
shadowBlur:
|
|
3695
|
-
shadowOffsetX:
|
|
3707
|
+
shadowBlur: g,
|
|
3708
|
+
shadowOffsetX: h,
|
|
3696
3709
|
shadowOffsetY: d
|
|
3697
3710
|
}), this.context.event.emit(y.SLIDER_LEAVE, _.evt, this.task);
|
|
3698
3711
|
}), this.task.isMilestone()) {
|
|
3699
3712
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
3700
|
-
const _ = this.unpackFunc(this.context.getOptions().milestone.size),
|
|
3713
|
+
const _ = this.unpackFunc(this.context.getOptions().milestone.size), M = Math.min(_ || e, t / 2), A = 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), R = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
3701
3714
|
if (!this.sliderBar) {
|
|
3702
|
-
switch (
|
|
3715
|
+
switch (R) {
|
|
3703
3716
|
case "triangle":
|
|
3704
3717
|
this.sliderBar = new v.RegularPolygon({
|
|
3705
3718
|
sides: 3,
|
|
3706
|
-
radius:
|
|
3719
|
+
radius: M,
|
|
3707
3720
|
rotation: 0,
|
|
3708
|
-
fill:
|
|
3709
|
-
stroke:
|
|
3710
|
-
strokeWidth:
|
|
3711
|
-
y:
|
|
3721
|
+
fill: A,
|
|
3722
|
+
stroke: B,
|
|
3723
|
+
strokeWidth: $,
|
|
3724
|
+
y: M / 3 * 2
|
|
3712
3725
|
// 居中
|
|
3713
3726
|
});
|
|
3714
3727
|
break;
|
|
3715
3728
|
case "circle":
|
|
3716
3729
|
this.sliderBar = new v.Circle({
|
|
3717
|
-
radius:
|
|
3718
|
-
fill:
|
|
3719
|
-
stroke:
|
|
3720
|
-
strokeWidth:
|
|
3721
|
-
y:
|
|
3730
|
+
radius: M,
|
|
3731
|
+
fill: A,
|
|
3732
|
+
stroke: B,
|
|
3733
|
+
strokeWidth: $,
|
|
3734
|
+
y: M / 2
|
|
3722
3735
|
// 居中
|
|
3723
3736
|
});
|
|
3724
3737
|
break;
|
|
3725
3738
|
case "star":
|
|
3726
3739
|
this.sliderBar = new v.Star({
|
|
3727
3740
|
numPoints: 5,
|
|
3728
|
-
innerRadius:
|
|
3729
|
-
outerRadius:
|
|
3730
|
-
fill:
|
|
3731
|
-
stroke:
|
|
3732
|
-
strokeWidth:
|
|
3733
|
-
y:
|
|
3741
|
+
innerRadius: M / 2,
|
|
3742
|
+
outerRadius: M,
|
|
3743
|
+
fill: A,
|
|
3744
|
+
stroke: B,
|
|
3745
|
+
strokeWidth: $,
|
|
3746
|
+
y: M / 2
|
|
3734
3747
|
// 居中
|
|
3735
3748
|
});
|
|
3736
3749
|
break;
|
|
@@ -3738,26 +3751,26 @@ class Ie {
|
|
|
3738
3751
|
default:
|
|
3739
3752
|
this.sliderBar = new v.RegularPolygon({
|
|
3740
3753
|
sides: 4,
|
|
3741
|
-
radius:
|
|
3754
|
+
radius: M,
|
|
3742
3755
|
rotation: 0,
|
|
3743
|
-
fill:
|
|
3744
|
-
stroke:
|
|
3745
|
-
strokeWidth:
|
|
3746
|
-
y:
|
|
3756
|
+
fill: A,
|
|
3757
|
+
stroke: B,
|
|
3758
|
+
strokeWidth: $,
|
|
3759
|
+
y: M / 2
|
|
3747
3760
|
// 居中
|
|
3748
3761
|
});
|
|
3749
3762
|
}
|
|
3750
3763
|
if (this.slider.add(this.sliderBar), this.unpackFunc(this.context.getOptions().milestone.label.show)) {
|
|
3751
|
-
const W = this.unpackFunc(this.context.getOptions().milestone.label.text),
|
|
3764
|
+
const W = this.unpackFunc(this.context.getOptions().milestone.label.text), P = 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 v.Text({
|
|
3752
3765
|
height: e,
|
|
3753
3766
|
text: W,
|
|
3754
|
-
fill: Ft ||
|
|
3767
|
+
fill: Ft || A,
|
|
3755
3768
|
fontSize: K,
|
|
3756
3769
|
fontFamily: $t
|
|
3757
3770
|
}), rt = et.measureSize(W);
|
|
3758
3771
|
et.width(rt.width);
|
|
3759
3772
|
const X = { x: 0, y: 0 };
|
|
3760
|
-
switch (
|
|
3773
|
+
switch (P) {
|
|
3761
3774
|
case "top-left":
|
|
3762
3775
|
X.x = -(12 + rt.width), X.y = -8;
|
|
3763
3776
|
break;
|
|
@@ -3776,6 +3789,28 @@ class Ie {
|
|
|
3776
3789
|
}
|
|
3777
3790
|
}
|
|
3778
3791
|
this.sliderType = "milestone";
|
|
3792
|
+
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
3793
|
+
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, M = t * 0.2, A = t * 0.3, B = ($) => new v.Shape({
|
|
3795
|
+
sceneFunc: (R, W) => {
|
|
3796
|
+
const P = A * 0.5;
|
|
3797
|
+
R.beginPath(), R.moveTo(0, (t - M) / 2), R.lineTo(P, (t - M) / 2), R.lineTo(P, (t - M) / 2 + M), R.lineTo(0, (t - M) / 2 + M + A), R.lineTo(0, (t - M) / 2), R.rect(P, (t - M) / 2, $ - 2 * P, M), R.moveTo($ - P, (t - M) / 2), R.lineTo($, (t - M) / 2), R.lineTo($, (t - M) / 2 + M + A), R.lineTo($ - P, (t - M) / 2 + M), R.lineTo($ - P, (t - M) / 2), R.fillStrokeShape(W);
|
|
3798
|
+
},
|
|
3799
|
+
width: $,
|
|
3800
|
+
fill: _,
|
|
3801
|
+
shadowColor: c,
|
|
3802
|
+
shadowBlur: g,
|
|
3803
|
+
shadowOffsetX: h,
|
|
3804
|
+
shadowOffsetY: d,
|
|
3805
|
+
y: -(A + M) / 2 - i / 2
|
|
3806
|
+
});
|
|
3807
|
+
!this.sliderBar || this.sliderBar.width() !== o ? (this.sliderBar && this.sliderBar.destroy(), this.sliderBar = B(o), this.slider.add(this.sliderBar)) : this.sliderBar.setAttrs({
|
|
3808
|
+
fill: _,
|
|
3809
|
+
shadowColor: c,
|
|
3810
|
+
shadowBlur: g,
|
|
3811
|
+
shadowOffsetX: h,
|
|
3812
|
+
shadowOffsetY: d
|
|
3813
|
+
}), this.sliderType = "summary";
|
|
3779
3814
|
} else {
|
|
3780
3815
|
this.sliderBar && this.sliderType !== "bar" && (this.slider.destroyChildren(), this.sliderBar = null), this.sliderBar || (this.sliderBar = new v.Rect({
|
|
3781
3816
|
x: 0,
|
|
@@ -3784,9 +3819,9 @@ class Ie {
|
|
|
3784
3819
|
width: o,
|
|
3785
3820
|
height: e,
|
|
3786
3821
|
fill: r,
|
|
3787
|
-
cornerRadius:
|
|
3822
|
+
cornerRadius: l
|
|
3788
3823
|
}), this.renderProgress(o, e);
|
|
3789
|
-
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon,
|
|
3824
|
+
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, M = (u = this.context.getOptions().bar.move.single) == null ? void 0 : u.backgroundColor, A = M ? F(M).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(((E = this.context.getOptions().bar.move.single) == null ? void 0 : E.opacity) ?? 1).toHex();
|
|
3790
3825
|
if (!!this.unpackFunc((T = this.context.getOptions().bar.move.single) == null ? void 0 : T.left)) {
|
|
3791
3826
|
if (!this.leftHandleGroup) {
|
|
3792
3827
|
this.leftHandleGroup = new v.Group({
|
|
@@ -3802,35 +3837,35 @@ class Ie {
|
|
|
3802
3837
|
}), this.leftHandleGroup.on("mouseout", (W) => {
|
|
3803
3838
|
this.isDragging || (W.target.getStage().container().style.cursor = "default");
|
|
3804
3839
|
});
|
|
3805
|
-
const
|
|
3840
|
+
const R = new v.Rect({
|
|
3806
3841
|
x: 0,
|
|
3807
3842
|
y: 0
|
|
3808
3843
|
});
|
|
3809
|
-
this.leftHandleGroup.add(
|
|
3844
|
+
this.leftHandleGroup.add(R), _ !== null && xt(_ || vt, this.handlerWidth, e).then((W) => {
|
|
3810
3845
|
var K;
|
|
3811
|
-
const
|
|
3846
|
+
const P = new v.Image({
|
|
3812
3847
|
image: W,
|
|
3813
3848
|
x: 0,
|
|
3814
3849
|
y: (e - this.handlerWidth) / 2,
|
|
3815
3850
|
width: this.handlerWidth,
|
|
3816
3851
|
height: this.handlerWidth
|
|
3817
3852
|
});
|
|
3818
|
-
(K = this.leftHandleGroup) == null || K.add(
|
|
3853
|
+
(K = this.leftHandleGroup) == null || K.add(P);
|
|
3819
3854
|
});
|
|
3820
3855
|
}
|
|
3821
|
-
(
|
|
3856
|
+
(O = this.leftHandleGroup.findOne("Rect")) == null || O.setAttrs({
|
|
3822
3857
|
width: this.handlerWidth,
|
|
3823
3858
|
height: e,
|
|
3824
|
-
fill:
|
|
3825
|
-
cornerRadius: [
|
|
3826
|
-
}), (
|
|
3859
|
+
fill: A,
|
|
3860
|
+
cornerRadius: [l[0], 0, 0, l[3]]
|
|
3861
|
+
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
3827
3862
|
x: 0,
|
|
3828
3863
|
y: (e - this.handlerWidth) / 2,
|
|
3829
3864
|
width: this.handlerWidth,
|
|
3830
3865
|
height: this.handlerWidth
|
|
3831
3866
|
});
|
|
3832
3867
|
} else this.leftHandleGroup && (this.leftHandleGroup.remove(), this.leftHandleGroup = null);
|
|
3833
|
-
if (!!this.unpackFunc((
|
|
3868
|
+
if (!!this.unpackFunc((k = this.context.getOptions().bar.move.single) == null ? void 0 : k.right)) {
|
|
3834
3869
|
if (!this.rightHandleGroup) {
|
|
3835
3870
|
this.rightHandleGroup = new v.Group({
|
|
3836
3871
|
x: 0,
|
|
@@ -3845,47 +3880,47 @@ class Ie {
|
|
|
3845
3880
|
}), this.rightHandleGroup.on("mouseout", (W) => {
|
|
3846
3881
|
this.isDragging || (W.target.getStage().container().style.cursor = "default");
|
|
3847
3882
|
});
|
|
3848
|
-
const
|
|
3883
|
+
const R = new v.Rect({
|
|
3849
3884
|
x: 0,
|
|
3850
3885
|
y: 0
|
|
3851
3886
|
});
|
|
3852
|
-
this.rightHandleGroup.add(
|
|
3887
|
+
this.rightHandleGroup.add(R), _ !== null && xt(_ || vt, this.handlerWidth, e).then((W) => {
|
|
3853
3888
|
var K;
|
|
3854
|
-
const
|
|
3889
|
+
const P = new v.Image({
|
|
3855
3890
|
image: W,
|
|
3856
3891
|
x: o - this.handlerWidth,
|
|
3857
3892
|
y: (e - this.handlerWidth) / 2,
|
|
3858
3893
|
width: this.handlerWidth,
|
|
3859
3894
|
height: this.handlerWidth
|
|
3860
3895
|
});
|
|
3861
|
-
(K = this.rightHandleGroup) == null || K.add(
|
|
3896
|
+
(K = this.rightHandleGroup) == null || K.add(P);
|
|
3862
3897
|
});
|
|
3863
3898
|
}
|
|
3864
|
-
(
|
|
3899
|
+
(S = this.rightHandleGroup.findOne("Rect")) == null || S.setAttrs({
|
|
3865
3900
|
x: o - this.handlerWidth,
|
|
3866
3901
|
width: this.handlerWidth,
|
|
3867
3902
|
height: e,
|
|
3868
|
-
fill:
|
|
3869
|
-
cornerRadius: [0,
|
|
3870
|
-
}), (
|
|
3903
|
+
fill: A,
|
|
3904
|
+
cornerRadius: [0, l[1], l[2], 0]
|
|
3905
|
+
}), (b = this.rightHandleGroup.findOne("Image")) == null || b.setAttrs({
|
|
3871
3906
|
x: o - this.handlerWidth,
|
|
3872
3907
|
y: (e - this.handlerWidth) / 2,
|
|
3873
3908
|
width: this.handlerWidth,
|
|
3874
3909
|
height: this.handlerWidth
|
|
3875
3910
|
});
|
|
3876
3911
|
} else this.rightHandleGroup && (this.rightHandleGroup.remove(), this.rightHandleGroup = null);
|
|
3877
|
-
this.renderText(o, e), (D = this.leftHandleGroup) == null || D.moveToTop(), (
|
|
3912
|
+
this.renderText(o, e), (D = this.leftHandleGroup) == null || D.moveToTop(), (I = this.rightHandleGroup) == null || I.moveToTop();
|
|
3878
3913
|
}
|
|
3879
3914
|
this.isDragging || this.sliderBar.setAttrs({
|
|
3880
3915
|
shadowColor: c,
|
|
3881
|
-
shadowBlur:
|
|
3882
|
-
shadowOffsetX:
|
|
3916
|
+
shadowBlur: g,
|
|
3917
|
+
shadowOffsetX: h,
|
|
3883
3918
|
shadowOffsetY: d
|
|
3884
3919
|
}), this.sliderGroup.add(this.slider), this.unpackFunc(this.context.getOptions().bar.show) === !1 ? this.sliderGroup.hide() : this.sliderGroup.show();
|
|
3885
3920
|
}
|
|
3886
3921
|
renderText(t, e) {
|
|
3887
3922
|
const i = `chart-slider-text-${this.task.id}`, s = () => {
|
|
3888
|
-
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((
|
|
3923
|
+
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((l) => l.remove());
|
|
3889
3924
|
};
|
|
3890
3925
|
if (!this.context.getOptions().bar.field && !this.context.getOptions().bar.label) {
|
|
3891
3926
|
s();
|
|
@@ -3896,7 +3931,7 @@ class Ie {
|
|
|
3896
3931
|
n ? o = this.unpackFunc(n) : this.context.getOptions().bar.field && (o = this.task.getField(this.context.getOptions().bar.field)), s();
|
|
3897
3932
|
const r = t - (this.leftHandleGroup ? this.handlerWidth : 0) - (this.rightHandleGroup ? this.handlerWidth : 0);
|
|
3898
3933
|
if (r > 20) {
|
|
3899
|
-
const
|
|
3934
|
+
const l = new v.Text({
|
|
3900
3935
|
id: i,
|
|
3901
3936
|
x: this.leftHandleGroup ? 10 : 0,
|
|
3902
3937
|
y: 0,
|
|
@@ -3911,11 +3946,11 @@ class Ie {
|
|
|
3911
3946
|
verticalAlign: this.unpackFunc(this.context.getOptions().bar.verticalAlign) || "middle",
|
|
3912
3947
|
ellipsis: !0
|
|
3913
3948
|
});
|
|
3914
|
-
this.slider.add(
|
|
3949
|
+
this.slider.add(l);
|
|
3915
3950
|
}
|
|
3916
3951
|
}
|
|
3917
3952
|
renderProgress(t, e) {
|
|
3918
|
-
var i, s, n, o, r,
|
|
3953
|
+
var i, s, n, o, r, l, c, g, h, d, m, p;
|
|
3919
3954
|
if (!this.unpackFunc((i = this.context.getOptions().bar.progress) == null ? void 0 : i.show)) {
|
|
3920
3955
|
this.progressGroup && (this.progressGroup.destroy(), this.progressGroup = null);
|
|
3921
3956
|
return;
|
|
@@ -3928,46 +3963,46 @@ class Ie {
|
|
|
3928
3963
|
if (u === 0) return;
|
|
3929
3964
|
const x = this.unpackFunc(
|
|
3930
3965
|
this.context.getOptions().bar.backgroundColor
|
|
3931
|
-
) || this.context.getOptions().primaryColor,
|
|
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(), E = nt(
|
|
3932
3967
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
3933
3968
|
), T = nt(
|
|
3934
3969
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
3935
3970
|
2
|
|
3936
3971
|
// 默认 2
|
|
3937
3972
|
);
|
|
3938
|
-
T[0] =
|
|
3939
|
-
const
|
|
3940
|
-
this.progressGroup ? (this.progressGroup.width(
|
|
3973
|
+
T[0] = E[0], T[3] = E[3], u === 1 && (T[1] = E[1], T[2] = E[2]);
|
|
3974
|
+
const O = t * u;
|
|
3975
|
+
this.progressGroup ? (this.progressGroup.width(O), this.progressGroup.destroyChildren()) : (this.progressGroup = new v.Group({
|
|
3941
3976
|
x: 0,
|
|
3942
3977
|
y: 0,
|
|
3943
|
-
width:
|
|
3978
|
+
width: O,
|
|
3944
3979
|
height: e,
|
|
3945
3980
|
listening: !1
|
|
3946
3981
|
}), this.slider.add(this.progressGroup));
|
|
3947
|
-
const
|
|
3982
|
+
const C = new v.Rect({
|
|
3948
3983
|
x: 0,
|
|
3949
3984
|
y: 0,
|
|
3950
|
-
width:
|
|
3985
|
+
width: O,
|
|
3951
3986
|
height: e,
|
|
3952
|
-
fill:
|
|
3987
|
+
fill: w,
|
|
3953
3988
|
cornerRadius: T,
|
|
3954
|
-
opacity: this.unpackFunc((
|
|
3989
|
+
opacity: this.unpackFunc((l = this.context.getOptions().bar.progress) == null ? void 0 : l.opacity)
|
|
3955
3990
|
});
|
|
3956
|
-
this.progressGroup.add(
|
|
3957
|
-
const
|
|
3991
|
+
this.progressGroup.add(C);
|
|
3992
|
+
const k = `${lt(
|
|
3958
3993
|
u * 100,
|
|
3959
3994
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
3960
|
-
)}%`,
|
|
3995
|
+
)}%`, S = new v.Text().measureSize(k).width, b = this.unpackFunc((g = this.context.getOptions().bar.progress) == null ? void 0 : g.textAlign), D = new v.Text({
|
|
3961
3996
|
x: 0,
|
|
3962
|
-
y:
|
|
3963
|
-
width:
|
|
3997
|
+
y: b === "top" ? -e : 0,
|
|
3998
|
+
width: b === "right" ? O + S : Math.max(O, S),
|
|
3964
3999
|
height: e,
|
|
3965
|
-
fill: this.unpackFunc((
|
|
3966
|
-
text:
|
|
4000
|
+
fill: this.unpackFunc((h = this.context.getOptions().bar.progress) == null ? void 0 : h.color) || F("#000000").mix(w, 50).alpha(0.7).toHex(),
|
|
4001
|
+
text: k,
|
|
3967
4002
|
fontSize: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.fontSize) || 10,
|
|
3968
4003
|
fontStyle: this.unpackFunc((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontStyle) || "italic",
|
|
3969
4004
|
fontFamily: "Arial",
|
|
3970
|
-
verticalAlign:
|
|
4005
|
+
verticalAlign: b === "top" ? "bottom" : "middle",
|
|
3971
4006
|
align: "right"
|
|
3972
4007
|
});
|
|
3973
4008
|
(p = this.progressGroup) == null || p.add(D);
|
|
@@ -3978,11 +4013,11 @@ class Ie {
|
|
|
3978
4013
|
this.slider && (this.slider.on("dragstart", (t) => this.handleDragStart(t)), this.slider.on("dragend", (t) => this.handleDragEnd(t)), this.slider.on("dragmove", (t) => this.handleDragMove(t)), this.slider.on("mouseover", () => this.handleMouseEnter()), this.slider.on("mouseout", () => this.handleMouseLeave()), this.slider.on("mousedown", (t) => {
|
|
3979
4014
|
if (t.evt.button !== 0) return;
|
|
3980
4015
|
const e = t.target.getStage();
|
|
3981
|
-
e && (e.container().style.cursor = "grabbing");
|
|
4016
|
+
e && this.slider.draggable() && (e.container().style.cursor = "grabbing");
|
|
3982
4017
|
}), this.slider.on("mouseup", (t) => {
|
|
3983
4018
|
if (t.evt.button !== 0) return;
|
|
3984
4019
|
const e = t.target.getStage();
|
|
3985
|
-
e && (e.container().style.cursor = "grab");
|
|
4020
|
+
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
3986
4021
|
}), this.slider.on("click", (t) => {
|
|
3987
4022
|
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(y.SLIDER_CLICK, t.evt, this.task));
|
|
3988
4023
|
}), this.slider.on("contextmenu", (t) => {
|
|
@@ -4014,14 +4049,31 @@ class Ie {
|
|
|
4014
4049
|
y.TASK_DRAG_END,
|
|
4015
4050
|
this.task,
|
|
4016
4051
|
this.oldTasks
|
|
4017
|
-
), this.oldTasks = [])
|
|
4052
|
+
), this.oldTasks = []);
|
|
4053
|
+
const e = t.target.getStage();
|
|
4054
|
+
if (e) {
|
|
4055
|
+
const i = e.getPointerPosition();
|
|
4056
|
+
if (i) {
|
|
4057
|
+
const s = this.context.getOptions().row.height, n = this.y + this.offsetY, o = n + s;
|
|
4058
|
+
if (i.y < n || i.y > o) {
|
|
4059
|
+
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", l = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, c = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, g = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4060
|
+
this.handleBarHighlight({
|
|
4061
|
+
shadowColor: r,
|
|
4062
|
+
shadowBlur: l,
|
|
4063
|
+
shadowOffsetX: c,
|
|
4064
|
+
shadowOffsetY: g
|
|
4065
|
+
}), this.handleResizeHighlight(0), e.container().style.cursor = "default";
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
this.context.event.emit(y.SLIDER_MOVING, !1);
|
|
4018
4070
|
}
|
|
4019
4071
|
handleMove(t, e) {
|
|
4020
4072
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth();
|
|
4021
4073
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4022
|
-
const r = t.target.width(),
|
|
4074
|
+
const r = t.target.width(), l = t.target.x() - this.offsetX, c = l + r, g = -this.offsetX, h = g + i, d = l <= g - this.offsetX + this.EDGE_THRESHOLD, m = c >= h - this.offsetX - this.EDGE_THRESHOLD;
|
|
4023
4075
|
if (d)
|
|
4024
|
-
if (
|
|
4076
|
+
if (g <= 0)
|
|
4025
4077
|
t.target.x(0), this.stopAutoScroll(), s || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4026
4078
|
else if (this.draggingDirection === "left") {
|
|
4027
4079
|
const p = n ? -o : -this.SCROLL_STEP;
|
|
@@ -4031,7 +4083,7 @@ class Ie {
|
|
|
4031
4083
|
} else
|
|
4032
4084
|
this.stopAutoScroll();
|
|
4033
4085
|
else if (m)
|
|
4034
|
-
if (
|
|
4086
|
+
if (h >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4035
4087
|
t.target.x(
|
|
4036
4088
|
this.context.store.getTimeAxis().getTotalWidth() - r
|
|
4037
4089
|
), this.stopAutoScroll(), s || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
@@ -4055,54 +4107,54 @@ class Ie {
|
|
|
4055
4107
|
if (!i) return;
|
|
4056
4108
|
this.isDragging = !0, this.context.event.emit(y.SLIDER_MOVING, !0);
|
|
4057
4109
|
let s = ((x = i.getPointerPosition()) == null ? void 0 : x.x) || 0;
|
|
4058
|
-
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock,
|
|
4059
|
-
let c = 0,
|
|
4110
|
+
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, l = i.width();
|
|
4111
|
+
let c = 0, g = 0;
|
|
4060
4112
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4061
|
-
const
|
|
4062
|
-
if (
|
|
4063
|
-
if (
|
|
4113
|
+
const w = this.slider.width(), E = this.slider.x(), T = E + w, O = -this.offsetX, C = O + l, k = E <= O + this.EDGE_THRESHOLD, S = T >= C - this.EDGE_THRESHOLD;
|
|
4114
|
+
if (k && e === "left") {
|
|
4115
|
+
if (O <= 0)
|
|
4064
4116
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4065
4117
|
else if (this.draggingDirection === "left") {
|
|
4066
|
-
const
|
|
4067
|
-
this.startAutoScroll(
|
|
4068
|
-
c +=
|
|
4118
|
+
const b = n ? -o : -this.SCROLL_STEP;
|
|
4119
|
+
this.startAutoScroll(b, n, () => {
|
|
4120
|
+
c += b, this.slider.x(this.slider.x() + b);
|
|
4069
4121
|
});
|
|
4070
4122
|
} else
|
|
4071
4123
|
this.stopAutoScroll();
|
|
4072
4124
|
this.emitUpdate("left");
|
|
4073
|
-
} else if (
|
|
4074
|
-
if (
|
|
4125
|
+
} else if (S && e === "right") {
|
|
4126
|
+
if (C >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4075
4127
|
this.slider.width(
|
|
4076
4128
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
4077
4129
|
), this.stopAutoScroll(), r || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
4078
4130
|
else if (this.draggingDirection === "right") {
|
|
4079
|
-
const
|
|
4080
|
-
this.startAutoScroll(
|
|
4081
|
-
|
|
4131
|
+
const b = n ? o : this.SCROLL_STEP;
|
|
4132
|
+
this.startAutoScroll(b, n, () => {
|
|
4133
|
+
g += b, this.slider.x(this.slider.x() + b);
|
|
4082
4134
|
});
|
|
4083
4135
|
} else
|
|
4084
4136
|
this.stopAutoScroll();
|
|
4085
4137
|
this.emitUpdate("right");
|
|
4086
|
-
} else if (e === "right" &&
|
|
4087
|
-
const
|
|
4088
|
-
this.startAutoScroll(
|
|
4089
|
-
|
|
4138
|
+
} else if (e === "right" && E <= O && T <= O + this.EDGE_THRESHOLD + o) {
|
|
4139
|
+
const b = n ? -o : -this.SCROLL_STEP;
|
|
4140
|
+
this.startAutoScroll(b, n, () => {
|
|
4141
|
+
g += b, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + b), this.emitUpdate("right");
|
|
4090
4142
|
});
|
|
4091
|
-
} else if (e === "left" && T >=
|
|
4092
|
-
const
|
|
4093
|
-
this.startAutoScroll(
|
|
4094
|
-
c +=
|
|
4143
|
+
} else if (e === "left" && T >= C && E >= C - this.EDGE_THRESHOLD - o) {
|
|
4144
|
+
const b = n ? o : this.SCROLL_STEP;
|
|
4145
|
+
this.startAutoScroll(b, n, () => {
|
|
4146
|
+
c += b, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + b), this.emitUpdate("left");
|
|
4095
4147
|
});
|
|
4096
4148
|
} else
|
|
4097
4149
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
4098
4150
|
}, this.MOVE_INTERVAL);
|
|
4099
|
-
let
|
|
4100
|
-
const d = this.slider.x(), m = this.slider.width(), p = (
|
|
4101
|
-
var
|
|
4102
|
-
|
|
4103
|
-
const
|
|
4104
|
-
let T =
|
|
4105
|
-
n && (T = pt(T, o)), (
|
|
4151
|
+
let h;
|
|
4152
|
+
const d = this.slider.x(), m = this.slider.width(), p = (w) => {
|
|
4153
|
+
var O;
|
|
4154
|
+
w.movementX > 0 ? this.draggingDirection = "right" : w.movementX < 0 && (this.draggingDirection = "left");
|
|
4155
|
+
const E = Math.max(((O = i.getPointerPosition()) == null ? void 0 : O.x) || 0, 0);
|
|
4156
|
+
let T = E - s;
|
|
4157
|
+
n && (T = pt(T, o)), (h === void 0 || h !== T) && (e === "left" ? m - T - c >= o && E < l - this.EDGE_THRESHOLD && (this.slider.width(m - T - c), this.slider.x(d + T + c), this.emitUpdate("left")) : m + T + g >= o && E > this.EDGE_THRESHOLD && (this.slider.width(m + T + g), this.emitUpdate("right")), h = T);
|
|
4106
4158
|
}, u = () => {
|
|
4107
4159
|
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", u);
|
|
4108
4160
|
};
|
|
@@ -4146,7 +4198,7 @@ class Ie {
|
|
|
4146
4198
|
}
|
|
4147
4199
|
// 鼠标离开
|
|
4148
4200
|
handleMouseLeave() {
|
|
4149
|
-
this.handleResizeHighlight(0);
|
|
4201
|
+
this.isDragging || this.handleResizeHighlight(0);
|
|
4150
4202
|
}
|
|
4151
4203
|
// 拖拽块的高亮动画
|
|
4152
4204
|
handleResizeHighlight(t) {
|
|
@@ -4169,13 +4221,13 @@ class Ie {
|
|
|
4169
4221
|
}).play();
|
|
4170
4222
|
}
|
|
4171
4223
|
}
|
|
4172
|
-
class
|
|
4224
|
+
class Ge {
|
|
4173
4225
|
constructor(t, e, i, s, n, o, r) {
|
|
4174
4226
|
a(this, "row");
|
|
4175
4227
|
a(this, "slider");
|
|
4176
4228
|
a(this, "cacheKey", "");
|
|
4177
4229
|
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new v.Group();
|
|
4178
|
-
const
|
|
4230
|
+
const l = new v.Rect({
|
|
4179
4231
|
x: s,
|
|
4180
4232
|
y: n,
|
|
4181
4233
|
width: o,
|
|
@@ -4183,7 +4235,7 @@ class Re {
|
|
|
4183
4235
|
id: i,
|
|
4184
4236
|
listening: !1
|
|
4185
4237
|
});
|
|
4186
|
-
this.row.add(
|
|
4238
|
+
this.row.add(l), this.slider = new Ie(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
4187
4239
|
}
|
|
4188
4240
|
update(t, e) {
|
|
4189
4241
|
this.slider.update(t, e);
|
|
@@ -4195,7 +4247,7 @@ class Re {
|
|
|
4195
4247
|
this.row.destroy();
|
|
4196
4248
|
}
|
|
4197
4249
|
}
|
|
4198
|
-
class
|
|
4250
|
+
class Re {
|
|
4199
4251
|
constructor(t, e, i, s) {
|
|
4200
4252
|
a(this, "rowsGroup");
|
|
4201
4253
|
// 包含所有行的容器
|
|
@@ -4238,7 +4290,7 @@ class Ge {
|
|
|
4238
4290
|
const o = `chart-row-${s.id}`;
|
|
4239
4291
|
let r = this.rowsCache.get(o);
|
|
4240
4292
|
const c = s.flatIndex * e + this.context.getOptions().header.height;
|
|
4241
|
-
r ? (r.update(0, c), r.setOffset(this.offsetX, this.offsetY)) : (r = new
|
|
4293
|
+
r ? (r.update(0, c), r.setOffset(this.offsetX, this.offsetY)) : (r = new Ge(
|
|
4242
4294
|
this.context,
|
|
4243
4295
|
s,
|
|
4244
4296
|
o,
|
|
@@ -4247,7 +4299,7 @@ class Ge {
|
|
|
4247
4299
|
this.width,
|
|
4248
4300
|
e
|
|
4249
4301
|
), 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);
|
|
4250
|
-
const
|
|
4302
|
+
const g = new v.Rect({
|
|
4251
4303
|
x: 0,
|
|
4252
4304
|
y: c + this.offsetY,
|
|
4253
4305
|
width: this.width,
|
|
@@ -4257,7 +4309,7 @@ class Ge {
|
|
|
4257
4309
|
listening: !1
|
|
4258
4310
|
// 不需要监听事件
|
|
4259
4311
|
});
|
|
4260
|
-
this.rowBgGroup.add(
|
|
4312
|
+
this.rowBgGroup.add(g), this.rowBgGroup.moveToBottom();
|
|
4261
4313
|
}), this.rowsCache.forEach((s, n) => {
|
|
4262
4314
|
s.cacheKey !== i && (s.destroy(), this.rowsCache.delete(n));
|
|
4263
4315
|
}), this.layer.batchDraw();
|
|
@@ -4370,7 +4422,7 @@ class Ge {
|
|
|
4370
4422
|
y: s + this.offsetY,
|
|
4371
4423
|
width: this.width,
|
|
4372
4424
|
height: this.context.getOptions().row.height,
|
|
4373
|
-
fill:
|
|
4425
|
+
fill: F(this.context.getOptions().row.hover.backgroundColor).alpha(this.context.getOptions().row.hover.opacity).toHex(),
|
|
4374
4426
|
name: "highlight-rect"
|
|
4375
4427
|
}), this.layer.add(this.highlightRect), this.highlightRect.moveToBottom(), this.layer.batchDraw());
|
|
4376
4428
|
}
|
|
@@ -4419,7 +4471,7 @@ class Ge {
|
|
|
4419
4471
|
y: s + this.offsetY,
|
|
4420
4472
|
width: this.width,
|
|
4421
4473
|
height: this.context.getOptions().row.height,
|
|
4422
|
-
fill:
|
|
4474
|
+
fill: F(this.context.getOptions().row.select.backgroundColor).alpha(this.context.getOptions().row.select.opacity).toHex(),
|
|
4423
4475
|
name: "selected-rect"
|
|
4424
4476
|
}), this.layer.add(this.selectedRect), this.selectedRect.moveToBottom(), this.layer.batchDraw();
|
|
4425
4477
|
}
|
|
@@ -4484,27 +4536,27 @@ class Wt {
|
|
|
4484
4536
|
angle: s = (t == null ? void 0 : t.angle) ?? 30,
|
|
4485
4537
|
spacing: n = (t == null ? void 0 : t.spacing) || 10
|
|
4486
4538
|
} = t || {}, o = s % 180, r = o * Math.PI / 180;
|
|
4487
|
-
let
|
|
4488
|
-
o === 0 ? (
|
|
4489
|
-
const
|
|
4539
|
+
let l, c;
|
|
4540
|
+
o === 0 ? (l = n, c = i + n) : o === 90 ? (l = i + n, c = n) : (l = Math.abs(Math.ceil((i + n) / Math.sin(r))), c = Math.abs(Math.ceil((i + n) / Math.cos(r))));
|
|
4541
|
+
const g = new v.Stage({
|
|
4490
4542
|
container: document.createElement("div"),
|
|
4491
|
-
width:
|
|
4543
|
+
width: l,
|
|
4492
4544
|
height: c
|
|
4493
|
-
}),
|
|
4494
|
-
|
|
4545
|
+
}), h = new v.Layer();
|
|
4546
|
+
g.add(h);
|
|
4495
4547
|
const d = new v.Group();
|
|
4496
4548
|
if (o === 0 || o === 90) {
|
|
4497
4549
|
const p = new v.Line({
|
|
4498
|
-
points: [0, 0, o === 0 ?
|
|
4550
|
+
points: [0, 0, o === 0 ? l : 0, o === 0 ? 0 : c],
|
|
4499
4551
|
stroke: e,
|
|
4500
4552
|
strokeWidth: i,
|
|
4501
4553
|
perfectDrawEnabled: !0
|
|
4502
4554
|
});
|
|
4503
4555
|
d.add(p);
|
|
4504
4556
|
} else
|
|
4505
|
-
for (let p = -
|
|
4506
|
-
const u = p + i / 2, x = 0,
|
|
4507
|
-
points: [Math.ceil(u), Math.ceil(x), Math.ceil(
|
|
4557
|
+
for (let p = -l; p < l * 2; p += l) {
|
|
4558
|
+
const u = p + i / 2, x = 0, w = p + i / 2 + (Math.cos(r) < 0 ? -l : l), E = c, T = new v.Line({
|
|
4559
|
+
points: [Math.ceil(u), Math.ceil(x), Math.ceil(w), Math.ceil(E)],
|
|
4508
4560
|
stroke: e,
|
|
4509
4561
|
strokeWidth: i,
|
|
4510
4562
|
perfectDrawEnabled: !0,
|
|
@@ -4513,9 +4565,9 @@ class Wt {
|
|
|
4513
4565
|
});
|
|
4514
4566
|
d.add(T);
|
|
4515
4567
|
}
|
|
4516
|
-
|
|
4568
|
+
h.add(d), h.draw();
|
|
4517
4569
|
const m = new Image();
|
|
4518
|
-
return m.src =
|
|
4570
|
+
return m.src = g.toDataURL(), g.destroy(), m;
|
|
4519
4571
|
}
|
|
4520
4572
|
/**
|
|
4521
4573
|
* 创建圆点图案
|
|
@@ -4525,12 +4577,12 @@ class Wt {
|
|
|
4525
4577
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
4526
4578
|
width: i = (t == null ? void 0 : t.width) || 2,
|
|
4527
4579
|
spacing: s = (t == null ? void 0 : t.spacing) || 4
|
|
4528
|
-
} = t || {}, n = i * 2 + s * 2, o = n, r =
|
|
4580
|
+
} = t || {}, n = i * 2 + s * 2, o = n, r = F(e), l = new v.Stage({
|
|
4529
4581
|
container: document.createElement("div"),
|
|
4530
4582
|
width: n,
|
|
4531
4583
|
height: o
|
|
4532
4584
|
}), c = new v.Layer();
|
|
4533
|
-
|
|
4585
|
+
l.add(c), [
|
|
4534
4586
|
{ x: s / 2 + i / 2, y: s / 2 + i / 2 },
|
|
4535
4587
|
{
|
|
4536
4588
|
x: n - s / 2 - i / 2,
|
|
@@ -4553,8 +4605,8 @@ class Wt {
|
|
|
4553
4605
|
});
|
|
4554
4606
|
c.add(m);
|
|
4555
4607
|
}), c.draw();
|
|
4556
|
-
const
|
|
4557
|
-
return
|
|
4608
|
+
const h = new Image();
|
|
4609
|
+
return h.src = l.toDataURL(), l.destroy(), h;
|
|
4558
4610
|
}
|
|
4559
4611
|
/**
|
|
4560
4612
|
* 创建网格图案
|
|
@@ -4564,30 +4616,30 @@ class Wt {
|
|
|
4564
4616
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
4565
4617
|
width: i = (t == null ? void 0 : t.width) || 1,
|
|
4566
4618
|
spacing: s = (t == null ? void 0 : t.spacing) || 20
|
|
4567
|
-
} = t || {}, n = i + s, o = n, r = n,
|
|
4619
|
+
} = t || {}, n = i + s, o = n, r = n, l = new v.Stage({
|
|
4568
4620
|
container: document.createElement("div"),
|
|
4569
4621
|
width: o,
|
|
4570
4622
|
height: r
|
|
4571
4623
|
}), c = new v.Layer();
|
|
4572
|
-
|
|
4573
|
-
const
|
|
4574
|
-
|
|
4624
|
+
l.add(c);
|
|
4625
|
+
const g = new v.Group();
|
|
4626
|
+
g.add(
|
|
4575
4627
|
new v.Line({
|
|
4576
4628
|
points: [0, 0, o, r],
|
|
4577
4629
|
stroke: e,
|
|
4578
4630
|
strokeWidth: i,
|
|
4579
4631
|
perfectDrawEnabled: !0
|
|
4580
4632
|
})
|
|
4581
|
-
),
|
|
4633
|
+
), g.add(
|
|
4582
4634
|
new v.Line({
|
|
4583
4635
|
points: [0, r, o, 0],
|
|
4584
4636
|
stroke: e,
|
|
4585
4637
|
strokeWidth: i,
|
|
4586
4638
|
perfectDrawEnabled: !0
|
|
4587
4639
|
})
|
|
4588
|
-
), c.add(
|
|
4589
|
-
const
|
|
4590
|
-
return
|
|
4640
|
+
), c.add(g), c.draw();
|
|
4641
|
+
const h = new Image();
|
|
4642
|
+
return h.src = l.toDataURL(), l.destroy(), h;
|
|
4591
4643
|
}
|
|
4592
4644
|
}
|
|
4593
4645
|
class We {
|
|
@@ -4640,21 +4692,21 @@ class We {
|
|
|
4640
4692
|
*/
|
|
4641
4693
|
async calculateWeekend() {
|
|
4642
4694
|
if (this.clearWeekend(), !this.context.getOptions().weekend.show) return;
|
|
4643
|
-
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,
|
|
4644
|
-
for (let
|
|
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, l = this.context.store.getDataManager().getVisibleSize() * o, c = Math.max(0, -this.offsetX), g = c + this.width;
|
|
4696
|
+
for (let h = t; h <= e; ) {
|
|
4645
4697
|
let d = s;
|
|
4646
|
-
if (d = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(
|
|
4647
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(
|
|
4698
|
+
if (d = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(h)) {
|
|
4699
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(h), p = n, u = l;
|
|
4648
4700
|
if (m + d < c) {
|
|
4649
|
-
|
|
4701
|
+
h = h.add(2, "day");
|
|
4650
4702
|
continue;
|
|
4651
4703
|
}
|
|
4652
|
-
if (m >
|
|
4704
|
+
if (m > g)
|
|
4653
4705
|
break;
|
|
4654
4706
|
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Wt.createPattern(
|
|
4655
4707
|
this.context.getOptions().weekend
|
|
4656
4708
|
));
|
|
4657
|
-
const
|
|
4709
|
+
const w = new v.Rect({
|
|
4658
4710
|
name: "weekend-rect",
|
|
4659
4711
|
x: m,
|
|
4660
4712
|
y: p,
|
|
@@ -4671,9 +4723,9 @@ class We {
|
|
|
4671
4723
|
},
|
|
4672
4724
|
opacity: this.context.getOptions().weekend.opacity
|
|
4673
4725
|
});
|
|
4674
|
-
this.weekendGroup.add(
|
|
4726
|
+
this.weekendGroup.add(w), h = h.add(2, "day");
|
|
4675
4727
|
} else
|
|
4676
|
-
|
|
4728
|
+
h = h.add(1, "day");
|
|
4677
4729
|
}
|
|
4678
4730
|
this.layer.batchDraw();
|
|
4679
4731
|
}
|
|
@@ -4710,7 +4762,7 @@ class $e {
|
|
|
4710
4762
|
{
|
|
4711
4763
|
show: !0,
|
|
4712
4764
|
type: "line",
|
|
4713
|
-
backgroundColor:
|
|
4765
|
+
backgroundColor: F("lightblue").toHex(),
|
|
4714
4766
|
opacity: 1,
|
|
4715
4767
|
width: 1
|
|
4716
4768
|
},
|
|
@@ -4720,22 +4772,22 @@ class $e {
|
|
|
4720
4772
|
let e = H();
|
|
4721
4773
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
4722
4774
|
t.type === "block" && (e = e.startOf(i));
|
|
4723
|
-
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, r =
|
|
4724
|
-
this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(
|
|
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(), l = (t.type === "block" ? s + n / 2 : s) + this.offsetX, c = [l, o, l, this.height], g = t.type === "line" ? t.width : n;
|
|
4776
|
+
this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(g)) : (this.todayLine = new v.Line({
|
|
4725
4777
|
points: c,
|
|
4726
4778
|
stroke: r,
|
|
4727
|
-
strokeWidth:
|
|
4728
|
-
}), this.bgLayer.add(this.todayLine)), t.type === "line" && (this.triangle ? (this.triangle.x(
|
|
4729
|
-
x:
|
|
4779
|
+
strokeWidth: g
|
|
4780
|
+
}), this.bgLayer.add(this.todayLine)), t.type === "line" && (this.triangle ? (this.triangle.x(l), this.triangle.fill(r)) : (this.triangle = new v.RegularPolygon({
|
|
4781
|
+
x: l,
|
|
4730
4782
|
y: o - 8,
|
|
4731
4783
|
sides: 3,
|
|
4732
4784
|
radius: 8,
|
|
4733
4785
|
fill: r,
|
|
4734
4786
|
rotation: 180,
|
|
4735
4787
|
name: "today-triangle"
|
|
4736
|
-
}), this.arrowAnimation = new v.Animation((
|
|
4788
|
+
}), this.arrowAnimation = new v.Animation((h) => {
|
|
4737
4789
|
var m;
|
|
4738
|
-
const d = Math.sin(
|
|
4790
|
+
const d = Math.sin(h.time * 4 * Math.PI / 2e3) + o - 8;
|
|
4739
4791
|
(m = this.triangle) == null || m.y(d);
|
|
4740
4792
|
}, this.headerLayer), this.headerLayer.add(this.triangle), this.triangle.moveToTop(), this.arrowAnimation.start())), this.bgLayer.batchDraw();
|
|
4741
4793
|
}
|
|
@@ -4795,17 +4847,17 @@ class Fe {
|
|
|
4795
4847
|
if (!t || t.length === 0) return;
|
|
4796
4848
|
const e = Math.max(0, -this.offsetX), i = e + this.width, s = this.context.store.getTimeAxis().getStartTime(), n = this.context.store.getTimeAxis().getEndTime();
|
|
4797
4849
|
this.context.store.getTimeAxis().getCellUnit();
|
|
4798
|
-
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height,
|
|
4799
|
-
for (let
|
|
4850
|
+
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height, l = this.context.getOptions().row.height, g = this.context.store.getDataManager().getVisibleSize() * l;
|
|
4851
|
+
for (let h = s; h <= n; h = h.add(1, "day")) {
|
|
4800
4852
|
const d = t.find((m) => {
|
|
4801
4853
|
if (V(m.date)) {
|
|
4802
|
-
if (m.date.some((p) => H(p).isSame(
|
|
4854
|
+
if (m.date.some((p) => H(p).isSame(h, "day")))
|
|
4803
4855
|
return m;
|
|
4804
|
-
} else if (H(m.date).isSame(
|
|
4856
|
+
} else if (H(m.date).isSame(h, "day"))
|
|
4805
4857
|
return m;
|
|
4806
4858
|
});
|
|
4807
4859
|
if (d) {
|
|
4808
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(
|
|
4860
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(h), p = r, u = g;
|
|
4809
4861
|
if (m + o < e)
|
|
4810
4862
|
continue;
|
|
4811
4863
|
if (m > i)
|
|
@@ -4818,7 +4870,7 @@ class Fe {
|
|
|
4818
4870
|
...this.context.getOptions().holiday
|
|
4819
4871
|
})
|
|
4820
4872
|
);
|
|
4821
|
-
const
|
|
4873
|
+
const w = new v.Rect({
|
|
4822
4874
|
name: "holiday-rect",
|
|
4823
4875
|
x: m,
|
|
4824
4876
|
y: p,
|
|
@@ -4836,7 +4888,7 @@ class Fe {
|
|
|
4836
4888
|
opacity: d.opacity || this.context.getOptions().holiday.opacity
|
|
4837
4889
|
}
|
|
4838
4890
|
});
|
|
4839
|
-
this.holidayGroup.add(
|
|
4891
|
+
this.holidayGroup.add(w);
|
|
4840
4892
|
}
|
|
4841
4893
|
}
|
|
4842
4894
|
this.layer.batchDraw();
|
|
@@ -4922,47 +4974,47 @@ class Be {
|
|
|
4922
4974
|
*/
|
|
4923
4975
|
calculatePoints() {
|
|
4924
4976
|
if (this.pointGroup.destroyChildren(), !this.context.getOptions().links.create.enabled) return;
|
|
4925
|
-
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 =
|
|
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(), l = this.context.getOptions().links.create.width;
|
|
4926
4978
|
this.tasks.forEach((c) => {
|
|
4927
4979
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, c) && this.context.store.getDataManager().isTaskVisible(c) && c.startTime && c.endTime) {
|
|
4928
|
-
const
|
|
4980
|
+
const g = this.context.store.getTimeAxis().getTimeLeft(c.startTime), h = this.context.store.getTimeAxis().getTimeLeft(c.endTime);
|
|
4929
4981
|
let d = this.context.getOptions().links.gap;
|
|
4930
4982
|
c.isMilestone() && (d += e / 2);
|
|
4931
4983
|
const m = i + e * c.flatIndex;
|
|
4932
4984
|
let p = !0, u = !0, x = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, c);
|
|
4933
|
-
if (mt(x) ? p = u = x :
|
|
4934
|
-
const
|
|
4985
|
+
if (mt(x) ? p = u = x : U(x) && (p = x === "S", u = x === "F"), p) {
|
|
4986
|
+
const w = new v.Circle({
|
|
4935
4987
|
id: `point-${c.id}-left`,
|
|
4936
|
-
x:
|
|
4988
|
+
x: g - d,
|
|
4937
4989
|
y: m,
|
|
4938
4990
|
radius: s,
|
|
4939
4991
|
opacity: n,
|
|
4940
4992
|
stroke: r,
|
|
4941
|
-
strokeWidth:
|
|
4993
|
+
strokeWidth: l
|
|
4942
4994
|
});
|
|
4943
|
-
this.pointGroup.add(
|
|
4944
|
-
this.isDragging = !0, this.createLink(
|
|
4945
|
-
}),
|
|
4995
|
+
this.pointGroup.add(w), w.on("mousedown", (E) => {
|
|
4996
|
+
this.isDragging = !0, this.createLink(E, "S", o, [g - d, m], c.id);
|
|
4997
|
+
}), w.on("mouseover", (E) => {
|
|
4946
4998
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
4947
|
-
}),
|
|
4999
|
+
}), w.on("mouseout", (E) => {
|
|
4948
5000
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
4949
5001
|
});
|
|
4950
5002
|
}
|
|
4951
5003
|
if (u) {
|
|
4952
|
-
const
|
|
5004
|
+
const w = new v.Circle({
|
|
4953
5005
|
id: `point-${c.id}-right`,
|
|
4954
|
-
x:
|
|
5006
|
+
x: h + d,
|
|
4955
5007
|
y: m,
|
|
4956
5008
|
radius: s,
|
|
4957
5009
|
opacity: n,
|
|
4958
5010
|
stroke: r,
|
|
4959
|
-
strokeWidth:
|
|
5011
|
+
strokeWidth: l
|
|
4960
5012
|
});
|
|
4961
|
-
this.pointGroup.add(
|
|
4962
|
-
this.isDragging = !0, this.createLink(
|
|
4963
|
-
}),
|
|
5013
|
+
this.pointGroup.add(w), w.on("mousedown", (E) => {
|
|
5014
|
+
this.isDragging = !0, this.createLink(E, "F", o, [h + d, m], c.id);
|
|
5015
|
+
}), w.on("mouseover", (E) => {
|
|
4964
5016
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
4965
|
-
}),
|
|
5017
|
+
}), w.on("mouseout", (E) => {
|
|
4966
5018
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
4967
5019
|
});
|
|
4968
5020
|
}
|
|
@@ -4974,141 +5026,109 @@ class Be {
|
|
|
4974
5026
|
*/
|
|
4975
5027
|
calculateLinks() {
|
|
4976
5028
|
if (this.linksGroup.destroyChildren(), !this.context.getOptions().links.show) return;
|
|
4977
|
-
const t = this.context.getOptions().links.data, e =
|
|
4978
|
-
t.forEach((
|
|
4979
|
-
const
|
|
4980
|
-
this.selectedMap.has(
|
|
4981
|
-
}), this.selectedMap.forEach((
|
|
4982
|
-
|
|
4983
|
-
}), t.forEach((
|
|
4984
|
-
var
|
|
4985
|
-
const
|
|
4986
|
-
if (
|
|
4987
|
-
`No corresponding FROM task [${
|
|
4988
|
-
|
|
4989
|
-
),
|
|
4990
|
-
`No corresponding TO task [${
|
|
4991
|
-
|
|
4992
|
-
),
|
|
4993
|
-
const
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
case "FF":
|
|
4997
|
-
x = this.createFF(
|
|
4998
|
-
s,
|
|
4999
|
-
n,
|
|
5000
|
-
o,
|
|
5001
|
-
l,
|
|
5002
|
-
d,
|
|
5003
|
-
p,
|
|
5004
|
-
u
|
|
5005
|
-
);
|
|
5006
|
-
break;
|
|
5007
|
-
case "SS":
|
|
5008
|
-
x = this.createSS(
|
|
5009
|
-
s,
|
|
5010
|
-
n,
|
|
5011
|
-
o,
|
|
5012
|
-
l,
|
|
5013
|
-
d,
|
|
5014
|
-
p,
|
|
5015
|
-
u
|
|
5016
|
-
);
|
|
5017
|
-
break;
|
|
5018
|
-
case "SF":
|
|
5019
|
-
x = this.createSF(
|
|
5020
|
-
s,
|
|
5021
|
-
n,
|
|
5022
|
-
o,
|
|
5023
|
-
l,
|
|
5024
|
-
d,
|
|
5025
|
-
p,
|
|
5026
|
-
u
|
|
5027
|
-
);
|
|
5028
|
-
break;
|
|
5029
|
-
case "FS":
|
|
5030
|
-
default:
|
|
5031
|
-
x = this.createFS(
|
|
5032
|
-
s,
|
|
5033
|
-
n,
|
|
5034
|
-
o,
|
|
5035
|
-
l,
|
|
5036
|
-
d,
|
|
5037
|
-
p,
|
|
5038
|
-
u
|
|
5039
|
-
);
|
|
5040
|
-
}
|
|
5041
|
-
if (x.length <= 2)
|
|
5042
|
-
O.warn("The link position has some error.", s);
|
|
5029
|
+
const t = this.context.getOptions().links.data, e = [];
|
|
5030
|
+
t.forEach((i) => {
|
|
5031
|
+
const s = this.createId(i);
|
|
5032
|
+
this.selectedMap.has(s) && e.push(s);
|
|
5033
|
+
}), this.selectedMap.forEach((i, s) => {
|
|
5034
|
+
e.includes(s) || this.selectedMap.delete(s);
|
|
5035
|
+
}), t.forEach((i) => {
|
|
5036
|
+
var o, r, l;
|
|
5037
|
+
const s = this.context.store.getDataManager().getTaskById(i.from), n = this.context.store.getDataManager().getTaskById(i.to);
|
|
5038
|
+
if (s || L.warn(
|
|
5039
|
+
`No corresponding FROM task [${i.from}] was found for the link. Info:`,
|
|
5040
|
+
i
|
|
5041
|
+
), n || L.warn(
|
|
5042
|
+
`No corresponding TO task [${i.to}] was found for the link. Info:`,
|
|
5043
|
+
i
|
|
5044
|
+
), 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 c = this.getPoints(s, n, i);
|
|
5046
|
+
if (c.length <= 2)
|
|
5047
|
+
L.warn("The link position has some error.", i);
|
|
5043
5048
|
else {
|
|
5044
|
-
const
|
|
5045
|
-
radius:
|
|
5046
|
-
fill:
|
|
5047
|
-
x:
|
|
5048
|
-
y:
|
|
5049
|
+
const g = this.createId(i), h = i.radius ?? this.context.getOptions().links.radius, d = ((o = i.arrow) == null ? void 0 : o.width) ?? this.context.getOptions().links.arrow.width, m = ((r = i.arrow) == null ? void 0 : r.height) ?? this.context.getOptions().links.arrow.height, p = i.width ?? this.context.getOptions().links.width, u = new v.Group({ id: g }), x = new v.Circle({
|
|
5050
|
+
radius: h,
|
|
5051
|
+
fill: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5052
|
+
x: c[0],
|
|
5053
|
+
y: c[1]
|
|
5049
5054
|
});
|
|
5050
|
-
|
|
5055
|
+
u.add(x);
|
|
5056
|
+
const w = Math.floor(c.length / 2), E = w % 2 === 0 ? w : w - 1, T = c.slice(0, E + 2), O = c.slice(E), C = new v.Line({
|
|
5057
|
+
points: T,
|
|
5058
|
+
stroke: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5059
|
+
strokeWidth: p,
|
|
5060
|
+
lineCap: "round",
|
|
5061
|
+
lineJoin: "round",
|
|
5062
|
+
dash: i.dash || this.context.getOptions().links.dash,
|
|
5063
|
+
hitStrokeWidth: 10,
|
|
5064
|
+
// 增加点击区域
|
|
5065
|
+
draggable: !0,
|
|
5066
|
+
dragBoundFunc: (S) => ({ x: 0, y: 0 })
|
|
5067
|
+
});
|
|
5068
|
+
u.add(C), C.on("dragstart", (S) => {
|
|
5051
5069
|
this.handleDrag(
|
|
5052
|
-
|
|
5053
|
-
|
|
5070
|
+
S,
|
|
5071
|
+
i,
|
|
5054
5072
|
"S",
|
|
5055
|
-
[
|
|
5056
|
-
|
|
5073
|
+
[c[c.length - 2], c[c.length - 1]],
|
|
5074
|
+
g
|
|
5057
5075
|
);
|
|
5058
5076
|
});
|
|
5059
|
-
const
|
|
5060
|
-
points:
|
|
5061
|
-
stroke:
|
|
5062
|
-
strokeWidth:
|
|
5063
|
-
pointerLength:
|
|
5064
|
-
pointerWidth:
|
|
5065
|
-
fill: ((
|
|
5077
|
+
const k = new v.Arrow({
|
|
5078
|
+
points: O,
|
|
5079
|
+
stroke: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5080
|
+
strokeWidth: p,
|
|
5081
|
+
pointerLength: m,
|
|
5082
|
+
pointerWidth: d,
|
|
5083
|
+
fill: ((l = i.arrow) == null ? void 0 : l.color) || this.context.getOptions().links.arrow.color || i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5066
5084
|
// 箭头填充色
|
|
5067
5085
|
lineJoin: "round",
|
|
5068
|
-
dash:
|
|
5069
|
-
hitStrokeWidth: 10
|
|
5086
|
+
dash: i.dash || this.context.getOptions().links.dash,
|
|
5087
|
+
hitStrokeWidth: 10,
|
|
5070
5088
|
// 增加点击区域
|
|
5089
|
+
draggable: !0,
|
|
5090
|
+
dragBoundFunc: (S) => ({ x: 0, y: 0 })
|
|
5071
5091
|
});
|
|
5072
|
-
|
|
5073
|
-
this.handleDrag(
|
|
5074
|
-
}), this.linksGroup.add(
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5092
|
+
u.add(k), k.on("dragstart", (S) => {
|
|
5093
|
+
this.handleDrag(S, i, "F", [c[0], c[1]], g);
|
|
5094
|
+
}), this.linksGroup.add(u), u.on("mouseover", (S) => {
|
|
5095
|
+
S.target.moveToTop(), this.context.getOptions().links.move.enabled === !0 && (this.stage.container().style.cursor = "pointer"), this.selectedMap.has(g) || this.handleHighlight(
|
|
5096
|
+
u,
|
|
5097
|
+
h,
|
|
5098
|
+
d,
|
|
5099
|
+
m,
|
|
5100
|
+
p,
|
|
5081
5101
|
2
|
|
5082
5102
|
);
|
|
5083
|
-
}),
|
|
5084
|
-
this.selectedMap.has(
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5103
|
+
}), u.on("mouseout", (S) => {
|
|
5104
|
+
this.selectedMap.has(g) || this.handleHighlight(
|
|
5105
|
+
u,
|
|
5106
|
+
h,
|
|
5107
|
+
d,
|
|
5108
|
+
m,
|
|
5109
|
+
p,
|
|
5090
5110
|
0
|
|
5091
5111
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
5092
|
-
}),
|
|
5112
|
+
}), u.on("mousedown", (S) => {
|
|
5093
5113
|
this.isDragging = !0;
|
|
5094
|
-
}),
|
|
5095
|
-
|
|
5114
|
+
}), u.on("click", (S) => {
|
|
5115
|
+
S.cancelBubble = !0, this.isDragging = !1, u.moveToTop(), S.evt.button === 0 ? this.selectedMap.has(g) ? (this.selectedMap.delete(g), this.context.event.emit(
|
|
5096
5116
|
y.SELECT_LINK,
|
|
5097
5117
|
null,
|
|
5098
|
-
|
|
5118
|
+
i,
|
|
5099
5119
|
this.selectedMap.values().toArray()
|
|
5100
|
-
)) : (this.selectedMap.set(
|
|
5120
|
+
)) : (this.selectedMap.set(g, i), this.context.event.emit(
|
|
5101
5121
|
y.SELECT_LINK,
|
|
5102
|
-
|
|
5122
|
+
i,
|
|
5103
5123
|
null,
|
|
5104
5124
|
this.selectedMap.values().toArray()
|
|
5105
|
-
)) :
|
|
5106
|
-
}), this.selectedMap.has(
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5125
|
+
)) : S.evt.button === 2 && this.context.event.emit(y.CONTEXT_LINK, S.evt, i);
|
|
5126
|
+
}), this.selectedMap.has(g) && this.handleHighlight(
|
|
5127
|
+
u,
|
|
5128
|
+
h,
|
|
5129
|
+
d,
|
|
5130
|
+
m,
|
|
5131
|
+
p,
|
|
5112
5132
|
2,
|
|
5113
5133
|
!0
|
|
5114
5134
|
);
|
|
@@ -5119,148 +5139,172 @@ class Be {
|
|
|
5119
5139
|
createId(t) {
|
|
5120
5140
|
return `link-group-${t[this.context.getOptions().links.key]}-${t.from}-${t.to}-${t.type || "FS"}`;
|
|
5121
5141
|
}
|
|
5142
|
+
getPoints(t, e, i) {
|
|
5143
|
+
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, l = e.isMilestone() ? s / 2 : 0, c = this.context.store.getTimeAxis().getTimeLeft(e.startTime) - l, g = this.context.store.getTimeAxis().getTimeLeft(e.endTime) + l;
|
|
5145
|
+
let h = [];
|
|
5146
|
+
switch (i.type || "FS") {
|
|
5147
|
+
case "FF":
|
|
5148
|
+
h = this.createFF(i, t, e, o, r, c, g);
|
|
5149
|
+
break;
|
|
5150
|
+
case "SS":
|
|
5151
|
+
h = this.createSS(i, t, e, o, r, c, g);
|
|
5152
|
+
break;
|
|
5153
|
+
case "SF":
|
|
5154
|
+
h = this.createSF(i, t, e, o, r, c, g);
|
|
5155
|
+
break;
|
|
5156
|
+
case "FS":
|
|
5157
|
+
default:
|
|
5158
|
+
h = this.createFS(i, t, e, o, r, c, g);
|
|
5159
|
+
}
|
|
5160
|
+
return h;
|
|
5161
|
+
}
|
|
5162
|
+
return [];
|
|
5163
|
+
}
|
|
5122
5164
|
/** 生成 FS 连线 */
|
|
5123
5165
|
createFS(t, e, i, s, n, o, r) {
|
|
5124
|
-
const
|
|
5125
|
-
n +
|
|
5126
|
-
0.05 +
|
|
5166
|
+
const l = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + l, h = t.gap || this.context.getOptions().links.gap, d = [
|
|
5167
|
+
n + h,
|
|
5168
|
+
0.05 + g + c * e.flatIndex
|
|
5127
5169
|
];
|
|
5128
5170
|
{
|
|
5129
5171
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5130
5172
|
if (isNaN(m))
|
|
5131
|
-
|
|
5173
|
+
L.error("Link's distance must be a Numeric");
|
|
5132
5174
|
else {
|
|
5133
|
-
const p = n +
|
|
5175
|
+
const p = n + h + m, u = o - h - m, x = [
|
|
5134
5176
|
Math.max(p, u),
|
|
5135
|
-
|
|
5177
|
+
g + c * e.flatIndex
|
|
5136
5178
|
];
|
|
5137
5179
|
d.push(...x);
|
|
5138
|
-
const
|
|
5139
|
-
d.push(x[0],
|
|
5180
|
+
const w = c * e.flatIndex + l + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
5181
|
+
d.push(x[0], w), d.push(u, w), d.push(u, g + c * i.flatIndex);
|
|
5140
5182
|
}
|
|
5141
5183
|
}
|
|
5142
|
-
return d.push(o -
|
|
5184
|
+
return d.push(o - h, g + c * i.flatIndex), d;
|
|
5143
5185
|
}
|
|
5144
5186
|
/** 生成 FF 连线 */
|
|
5145
5187
|
createFF(t, e, i, s, n, o, r) {
|
|
5146
|
-
const
|
|
5147
|
-
n +
|
|
5148
|
-
0.05 +
|
|
5188
|
+
const l = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + l, h = t.gap || this.context.getOptions().links.gap, d = [
|
|
5189
|
+
n + h,
|
|
5190
|
+
0.05 + g + c * e.flatIndex
|
|
5149
5191
|
];
|
|
5150
5192
|
{
|
|
5151
5193
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5152
5194
|
if (isNaN(m))
|
|
5153
|
-
|
|
5195
|
+
L.error("Link's distance must be a Numeric");
|
|
5154
5196
|
else {
|
|
5155
|
-
const p = n +
|
|
5197
|
+
const p = n + h + m, u = r + h + m, x = [
|
|
5156
5198
|
p <= u ? u : p,
|
|
5157
|
-
|
|
5199
|
+
g + c * e.flatIndex
|
|
5158
5200
|
];
|
|
5159
5201
|
d.push(...x), d.push(
|
|
5160
5202
|
Math.max(u, p),
|
|
5161
|
-
|
|
5203
|
+
g + c * i.flatIndex
|
|
5162
5204
|
);
|
|
5163
5205
|
}
|
|
5164
5206
|
}
|
|
5165
|
-
return d.push(r +
|
|
5207
|
+
return d.push(r + h, g + c * i.flatIndex), d;
|
|
5166
5208
|
}
|
|
5167
5209
|
/** 生成 SS 连线 */
|
|
5168
5210
|
createSS(t, e, i, s, n, o, r) {
|
|
5169
|
-
const
|
|
5170
|
-
s -
|
|
5171
|
-
0.05 +
|
|
5211
|
+
const l = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + l, h = t.gap || this.context.getOptions().links.gap, d = [
|
|
5212
|
+
s - h,
|
|
5213
|
+
0.05 + g + c * e.flatIndex
|
|
5172
5214
|
];
|
|
5173
5215
|
{
|
|
5174
5216
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5175
5217
|
if (isNaN(m))
|
|
5176
|
-
|
|
5218
|
+
L.error("Link's distance must be a Numeric");
|
|
5177
5219
|
else {
|
|
5178
|
-
const p = s -
|
|
5220
|
+
const p = s - h - m, u = o - h - m;
|
|
5179
5221
|
d.push(
|
|
5180
5222
|
Math.min(u, p),
|
|
5181
|
-
|
|
5223
|
+
g + c * e.flatIndex
|
|
5182
5224
|
), d.push(
|
|
5183
5225
|
Math.min(u, p),
|
|
5184
|
-
|
|
5226
|
+
g + c * i.flatIndex
|
|
5185
5227
|
);
|
|
5186
5228
|
}
|
|
5187
5229
|
}
|
|
5188
|
-
return d.push(o -
|
|
5230
|
+
return d.push(o - h, g + c * i.flatIndex), d;
|
|
5189
5231
|
}
|
|
5190
5232
|
/** 生成 SF 连线 */
|
|
5191
5233
|
createSF(t, e, i, s, n, o, r) {
|
|
5192
|
-
const
|
|
5193
|
-
s -
|
|
5194
|
-
0.05 +
|
|
5234
|
+
const l = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + l, h = t.gap || this.context.getOptions().links.gap, d = [
|
|
5235
|
+
s - h,
|
|
5236
|
+
0.05 + g + c * e.flatIndex
|
|
5195
5237
|
];
|
|
5196
5238
|
{
|
|
5197
5239
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
5198
5240
|
if (isNaN(m))
|
|
5199
|
-
|
|
5241
|
+
L.error("Link's distance must be a Numeric");
|
|
5200
5242
|
else {
|
|
5201
|
-
const p = s -
|
|
5243
|
+
const p = s - h - m, u = r + h + m, x = [
|
|
5202
5244
|
Math.min(p, u),
|
|
5203
|
-
|
|
5245
|
+
g + c * e.flatIndex
|
|
5204
5246
|
];
|
|
5205
5247
|
d.push(...x);
|
|
5206
|
-
const
|
|
5207
|
-
d.push(x[0],
|
|
5248
|
+
const w = c * e.flatIndex + l + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
5249
|
+
d.push(x[0], w), d.push(u, w), d.push(u, g + c * i.flatIndex);
|
|
5208
5250
|
}
|
|
5209
5251
|
}
|
|
5210
|
-
return d.push(r +
|
|
5252
|
+
return d.push(r + h, g + c * i.flatIndex), d;
|
|
5211
5253
|
}
|
|
5212
5254
|
/**
|
|
5213
5255
|
* 处理连线被点击后的移动
|
|
5214
5256
|
*/
|
|
5215
5257
|
handleDrag(t, e, i, s, n) {
|
|
5216
|
-
var
|
|
5217
|
-
if (!this.isDragging) return;
|
|
5258
|
+
var x, w, E;
|
|
5259
|
+
if (!this.isDragging || this.context.getOptions().links.move.enabled !== !0) return;
|
|
5218
5260
|
this.stage.container().style.cursor = "pointer";
|
|
5219
5261
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
5220
5262
|
this.templateArrow.setAttrs({
|
|
5221
5263
|
stroke: e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5222
5264
|
strokeWidth: e.width ?? this.context.getOptions().links.width,
|
|
5223
|
-
pointerLength: ((
|
|
5265
|
+
pointerLength: ((x = e.arrow) == null ? void 0 : x.height) ?? this.context.getOptions().links.arrow.height,
|
|
5224
5266
|
// 箭头长度
|
|
5225
|
-
pointerWidth: ((
|
|
5267
|
+
pointerWidth: ((w = e.arrow) == null ? void 0 : w.width) ?? this.context.getOptions().links.arrow.width,
|
|
5226
5268
|
// 箭头宽度
|
|
5227
|
-
fill: ((
|
|
5269
|
+
fill: ((E = e.arrow) == null ? void 0 : E.color) || this.context.getOptions().links.arrow.color || e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5228
5270
|
// 箭头填充色
|
|
5229
5271
|
lineJoin: "round",
|
|
5230
5272
|
dash: e.data || this.context.getOptions().links.dash
|
|
5231
5273
|
}), this.templateArrow.visible(!1);
|
|
5232
5274
|
let r = null;
|
|
5233
|
-
const
|
|
5275
|
+
const l = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + l, h = e.gap || this.context.getOptions().links.gap;
|
|
5234
5276
|
let d = null;
|
|
5235
5277
|
const m = () => {
|
|
5236
|
-
const
|
|
5237
|
-
if (!
|
|
5238
|
-
const { allowLeft:
|
|
5278
|
+
const T = this.stage.getPointerPosition();
|
|
5279
|
+
if (!T || (d = this.getTaskByPosition(T), !d)) return;
|
|
5280
|
+
const { allowLeft: O, allowRight: C } = this.isAllowDrop(d, e.from);
|
|
5239
5281
|
if (this.templateArrow.visible(!0), o == null || o.visible(!1), d != null && d.startTime && (d != null && d.endTime)) {
|
|
5240
|
-
const
|
|
5241
|
-
let
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5282
|
+
const k = this.context.store.getTimeAxis().getTimeLeft(d.startTime), S = this.context.store.getTimeAxis().getTimeLeft(d.endTime), b = (S + k) / 2 + this.offsetX;
|
|
5283
|
+
let D = k - h;
|
|
5284
|
+
T.x <= b ? r = "S" : (r = "F", D = S + h), i === "S" ? (this.templateArrow.points([
|
|
5285
|
+
D,
|
|
5286
|
+
g + c * d.flatIndex,
|
|
5245
5287
|
...s
|
|
5246
|
-
]),
|
|
5288
|
+
]), C ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed") : i === "F" && (this.templateArrow.points([
|
|
5247
5289
|
...s,
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
]),
|
|
5290
|
+
D,
|
|
5291
|
+
g + c * d.flatIndex
|
|
5292
|
+
]), O ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed");
|
|
5251
5293
|
}
|
|
5252
5294
|
}, p = () => {
|
|
5253
|
-
var
|
|
5254
|
-
let
|
|
5255
|
-
const
|
|
5256
|
-
if (r && d && (i === "S" ? (
|
|
5257
|
-
const { allowLeft:
|
|
5258
|
-
|
|
5295
|
+
var C, k;
|
|
5296
|
+
let T;
|
|
5297
|
+
const O = J(e);
|
|
5298
|
+
if (r && d && (i === "S" ? (T = `${r}${(e.type || "FS")[1]}`, O.from = d.id) : i === "F" && (T = `${(e.type || "FS")[0]}${r}`, O.to = d.id)), T && d && !(O.from === O.to && ["FF", "SS"].includes(T))) {
|
|
5299
|
+
const { allowLeft: S, allowRight: b } = this.isAllowDrop(d, O.from);
|
|
5300
|
+
O.type = T, ((C = O.type) == null ? void 0 : C.slice(1)) === "S" && S || ((k = O.type) == null ? void 0 : k.slice(1)) === "F" && b ? this.context.event.emit(y.UPDATE_LINK, O) : this.context.event.emit(y.ERROR, q.LINK_NOT_ALLOWED);
|
|
5259
5301
|
} else
|
|
5260
|
-
this.context.event.emit(y.ERROR, q.LINK_SAME)
|
|
5261
|
-
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
5302
|
+
this.context.event.emit(y.ERROR, q.LINK_SAME);
|
|
5303
|
+
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, this.calculateLinks(), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
5304
|
+
}, u = (T) => {
|
|
5305
|
+
T.key === "Escape" && (this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", u));
|
|
5262
5306
|
};
|
|
5263
|
-
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p);
|
|
5307
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown", u);
|
|
5264
5308
|
}
|
|
5265
5309
|
/**
|
|
5266
5310
|
* 处理连线被点击后的移动
|
|
@@ -5278,43 +5322,45 @@ class Be {
|
|
|
5278
5322
|
dash: this.context.getOptions().links.dash
|
|
5279
5323
|
}), this.templateArrow.visible(!1);
|
|
5280
5324
|
let o = null;
|
|
5281
|
-
const r = this.context.getOptions().header.height,
|
|
5282
|
-
let
|
|
5325
|
+
const r = this.context.getOptions().header.height, l = this.context.getOptions().row.height, c = l / 2 + r, g = this.context.getOptions().links.gap;
|
|
5326
|
+
let h = null;
|
|
5283
5327
|
const d = () => {
|
|
5284
|
-
const
|
|
5285
|
-
if (!
|
|
5286
|
-
const { allowLeft:
|
|
5287
|
-
if (this.templateArrow.visible(!0),
|
|
5288
|
-
const
|
|
5289
|
-
let
|
|
5290
|
-
|
|
5328
|
+
const u = this.stage.getPointerPosition();
|
|
5329
|
+
if (!u || (h = this.getTaskByPosition(u), !h)) return;
|
|
5330
|
+
const { allowLeft: x, allowRight: w } = this.isAllowDrop(h, n);
|
|
5331
|
+
if (this.templateArrow.visible(!0), h.startTime && h.endTime) {
|
|
5332
|
+
const E = this.context.store.getTimeAxis().getTimeLeft(h.startTime), T = this.context.store.getTimeAxis().getTimeLeft(h.endTime), O = (T + E) / 2 + this.offsetX;
|
|
5333
|
+
let C = E - g;
|
|
5334
|
+
u.x <= O ? o = "S" : (o = "F", C = T + g), this.templateArrow.points([
|
|
5291
5335
|
...s,
|
|
5292
|
-
|
|
5293
|
-
c +
|
|
5294
|
-
]), o === "S" && !
|
|
5336
|
+
C,
|
|
5337
|
+
c + l * h.flatIndex
|
|
5338
|
+
]), 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";
|
|
5295
5339
|
}
|
|
5296
5340
|
}, m = () => {
|
|
5297
|
-
let
|
|
5298
|
-
if (o && (
|
|
5299
|
-
if (this.context.getOptions().links.data.some((
|
|
5341
|
+
let u;
|
|
5342
|
+
if (o && (u = `${e}${o}`), u && h)
|
|
5343
|
+
if (this.context.getOptions().links.data.some((x) => x.from === n && x.to === h.id && x.type === u))
|
|
5300
5344
|
this.context.event.emit(y.ERROR, q.LINK_EXIST);
|
|
5301
|
-
else if (n ===
|
|
5345
|
+
else if (n === h.id && e === o)
|
|
5302
5346
|
this.context.event.emit(y.ERROR, q.LINK_SAME);
|
|
5303
5347
|
else {
|
|
5304
|
-
const { allowLeft:
|
|
5305
|
-
o === "S" &&
|
|
5348
|
+
const { allowLeft: x, allowRight: w } = this.isAllowDrop(h, n);
|
|
5349
|
+
o === "S" && x || o === "F" && w ? this.context.event.emit(y.CREATE_LINK, {
|
|
5306
5350
|
from: n,
|
|
5307
|
-
to:
|
|
5308
|
-
type:
|
|
5351
|
+
to: h.id,
|
|
5352
|
+
type: u,
|
|
5309
5353
|
color: i
|
|
5310
5354
|
}) : this.context.event.emit(
|
|
5311
5355
|
y.ERROR,
|
|
5312
5356
|
q.LINK_NOT_ALLOWED
|
|
5313
5357
|
);
|
|
5314
5358
|
}
|
|
5315
|
-
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", m);
|
|
5359
|
+
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, this.calculateLinks(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", m);
|
|
5360
|
+
}, p = (u) => {
|
|
5361
|
+
u.key === "Escape" && (this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", m), document.removeEventListener("keydown", p));
|
|
5316
5362
|
};
|
|
5317
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup", m);
|
|
5363
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", m), document.addEventListener("keydown", p);
|
|
5318
5364
|
}
|
|
5319
5365
|
/**
|
|
5320
5366
|
* 按照位置获取任务
|
|
@@ -5335,7 +5381,7 @@ class Be {
|
|
|
5335
5381
|
return j(n) && (n = n(
|
|
5336
5382
|
t.getEmitData(),
|
|
5337
5383
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
5338
|
-
)), mt(n) ? i = s = n :
|
|
5384
|
+
)), mt(n) ? i = s = n : U(n) && (i = n === "S", s = n === "F"), {
|
|
5339
5385
|
allowLeft: i,
|
|
5340
5386
|
allowRight: s
|
|
5341
5387
|
};
|
|
@@ -5344,9 +5390,9 @@ class Be {
|
|
|
5344
5390
|
* 操作高亮关联线
|
|
5345
5391
|
*/
|
|
5346
5392
|
handleHighlight(t, e, i, s, n, o, r = !1) {
|
|
5347
|
-
const
|
|
5348
|
-
|
|
5349
|
-
node:
|
|
5393
|
+
const l = t.findOne("Circle"), c = t.findOne("Arrow"), g = t.findOne("Line");
|
|
5394
|
+
l && new v.Tween({
|
|
5395
|
+
node: l,
|
|
5350
5396
|
radius: e + o,
|
|
5351
5397
|
duration: r ? 0 : 0.1
|
|
5352
5398
|
}).play(), c && new v.Tween({
|
|
@@ -5355,6 +5401,10 @@ class Be {
|
|
|
5355
5401
|
pointerLength: s + o,
|
|
5356
5402
|
strokeWidth: n + o,
|
|
5357
5403
|
duration: r ? 0 : 0.1
|
|
5404
|
+
}).play(), g && new v.Tween({
|
|
5405
|
+
node: g,
|
|
5406
|
+
strokeWidth: n + o,
|
|
5407
|
+
duration: r ? 0 : 0.1
|
|
5358
5408
|
}).play();
|
|
5359
5409
|
}
|
|
5360
5410
|
/** 高亮创建点 */
|
|
@@ -5438,59 +5488,59 @@ class ze {
|
|
|
5438
5488
|
), n = this.context.getOptions().baselines.opacity, o = this.context.getOptions().baselines.backgroundColor;
|
|
5439
5489
|
this.tasks.forEach((r) => {
|
|
5440
5490
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r) && this.context.store.getDataManager().isTaskVisible(r)) {
|
|
5441
|
-
const
|
|
5491
|
+
const l = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c = st(
|
|
5442
5492
|
this.context.getOptions().baselines.height || this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, r),
|
|
5443
5493
|
e
|
|
5444
|
-
),
|
|
5445
|
-
|
|
5446
|
-
if (!
|
|
5447
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(
|
|
5448
|
-
this.renderBaselineBar(u, r,
|
|
5449
|
-
const x = this.context.getOptions().baselines.compare,
|
|
5450
|
-
if (!x.enabled || !
|
|
5451
|
-
const
|
|
5452
|
-
|
|
5494
|
+
), g = this.context.getOptions().baselines.offset ?? 0;
|
|
5495
|
+
l.forEach((h, d) => {
|
|
5496
|
+
if (!h.validate()) return;
|
|
5497
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(h.startTime), p = this.context.store.getTimeAxis().getTimeLeft(h.endTime), u = new v.Group({ id: `baseline-group-${h.id}` });
|
|
5498
|
+
this.renderBaselineBar(u, r, h, m, p, i, e, c, t, o, n, s, g);
|
|
5499
|
+
const x = this.context.getOptions().baselines.compare, w = h.getTimeDiff();
|
|
5500
|
+
if (!x.enabled || !w) return;
|
|
5501
|
+
const E = x.mode;
|
|
5502
|
+
h.highlight && (E === "highlight" || E === "both") && this.renderCompareHighlight(u, r, h, w), d === 0 && (E === "indicator" || E === "both") && this.renderCompareIndicator(r, h, w), this.bindEvents(u, r, h), this.baselineGroup.add(u);
|
|
5453
5503
|
});
|
|
5454
5504
|
}
|
|
5455
5505
|
});
|
|
5456
5506
|
}
|
|
5457
|
-
renderBaselineBar(t, e, i, s, n, o, r,
|
|
5507
|
+
renderBaselineBar(t, e, i, s, n, o, r, l, c, g, h, d, m) {
|
|
5458
5508
|
if (this.context.getOptions().baselines.mode === "shadow") {
|
|
5459
|
-
const p = o + r * e.flatIndex -
|
|
5509
|
+
const p = o + r * e.flatIndex - l / 2 + m, u = new v.Rect({
|
|
5460
5510
|
id: `baseline-item-${i.id}`,
|
|
5461
5511
|
x: s,
|
|
5462
5512
|
y: p,
|
|
5463
5513
|
width: n - s,
|
|
5464
|
-
height:
|
|
5514
|
+
height: l,
|
|
5465
5515
|
cornerRadius: d,
|
|
5466
|
-
fill:
|
|
5467
|
-
opacity:
|
|
5516
|
+
fill: g,
|
|
5517
|
+
opacity: h
|
|
5468
5518
|
});
|
|
5469
|
-
t.add(u), this.renderText(t, e, i, s, n, p,
|
|
5519
|
+
t.add(u), this.renderText(t, e, i, s, n, p, l);
|
|
5470
5520
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
5471
5521
|
const p = st(this.context.getOptions().baselines.height ?? 5, r);
|
|
5472
5522
|
let u = c + r * e.flatIndex + m;
|
|
5473
5523
|
const x = this.context.getOptions().baselines.position;
|
|
5474
|
-
let
|
|
5475
|
-
x === "top" ? (u += +p / 2,
|
|
5476
|
-
const
|
|
5524
|
+
let w = "";
|
|
5525
|
+
x === "top" ? (u += +p / 2, w = "line_top") : x === "center" ? (u += r / 2, w = "line_center") : (u += r - p / 2, w = "line_bottom");
|
|
5526
|
+
const E = new v.Line({
|
|
5477
5527
|
id: `baseline-item-${i.id}`,
|
|
5478
5528
|
points: [s, u, n, u],
|
|
5479
|
-
stroke:
|
|
5480
|
-
opacity:
|
|
5529
|
+
stroke: g,
|
|
5530
|
+
opacity: h,
|
|
5481
5531
|
strokeWidth: p,
|
|
5482
5532
|
lineCap: "butt",
|
|
5483
5533
|
lineJoin: "round"
|
|
5484
5534
|
});
|
|
5485
|
-
t.add(
|
|
5535
|
+
t.add(E), this.renderText(t, e, i, s, n, u, p, w);
|
|
5486
5536
|
}
|
|
5487
5537
|
}
|
|
5488
|
-
renderText(t, e, i, s, n, o, r,
|
|
5538
|
+
renderText(t, e, i, s, n, o, r, l) {
|
|
5489
5539
|
const c = `chart-baseline-text-${i.id}`;
|
|
5490
5540
|
if ((() => {
|
|
5491
|
-
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((
|
|
5541
|
+
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((w) => w.remove());
|
|
5492
5542
|
})(), !this.context.getOptions().baselines.label.show) return;
|
|
5493
|
-
const
|
|
5543
|
+
const h = this.context.getOptions().baselines.label.field, d = h ? i.getField(h) : i.name;
|
|
5494
5544
|
if (!d || d === "") return;
|
|
5495
5545
|
const m = n - s - 10, p = Math.max(this.context.getOptions().baselines.label.fontSize, r), u = new v.Text({
|
|
5496
5546
|
text: d,
|
|
@@ -5505,13 +5555,13 @@ class ze {
|
|
|
5505
5555
|
align: this.context.getOptions().baselines.label.position,
|
|
5506
5556
|
verticalAlign: "bottom"
|
|
5507
5557
|
});
|
|
5508
|
-
|
|
5558
|
+
l === "line_bottom" ? u.setAttrs({
|
|
5509
5559
|
y: o - p / 2,
|
|
5510
5560
|
verticalAlign: "top"
|
|
5511
|
-
}) :
|
|
5561
|
+
}) : l === "line_center" ? u.setAttrs({
|
|
5512
5562
|
y: o - p / 2,
|
|
5513
5563
|
verticalAlign: "middle"
|
|
5514
|
-
}) :
|
|
5564
|
+
}) : l === "line_top" && u.setAttrs({
|
|
5515
5565
|
y: o - r / 2,
|
|
5516
5566
|
verticalAlign: "bottom"
|
|
5517
5567
|
}), r >= p && u.setAttrs({
|
|
@@ -5525,10 +5575,10 @@ class ze {
|
|
|
5525
5575
|
if (!n || n === "ontime") return;
|
|
5526
5576
|
const o = t.findOne(`#baseline-item-${i.id}`);
|
|
5527
5577
|
if (!o) return;
|
|
5528
|
-
const r = this.context.getOptions().baselines.compare,
|
|
5529
|
-
if (
|
|
5578
|
+
const r = this.context.getOptions().baselines.compare, l = this.context.getOptions().baselines.mode, c = { fill: "", stroke: "", opacity: r[n].opacity };
|
|
5579
|
+
if (l === "shadow")
|
|
5530
5580
|
c.fill = r[n].backgroundColor;
|
|
5531
|
-
else if (
|
|
5581
|
+
else if (l === "line")
|
|
5532
5582
|
c.stroke = r[n].backgroundColor;
|
|
5533
5583
|
else
|
|
5534
5584
|
return;
|
|
@@ -5537,19 +5587,19 @@ class ze {
|
|
|
5537
5587
|
renderCompareIndicator(t, e, i) {
|
|
5538
5588
|
const s = this.context.getOptions().baselines, n = s.compare.indicator;
|
|
5539
5589
|
if (!n || !n.show) return;
|
|
5540
|
-
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height,
|
|
5590
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, l = st(
|
|
5541
5591
|
this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, t),
|
|
5542
5592
|
r
|
|
5543
5593
|
);
|
|
5544
5594
|
let c = s.backgroundColor;
|
|
5545
|
-
const
|
|
5546
|
-
let d = (r -
|
|
5547
|
-
if (n.position === "bottom" && (d +=
|
|
5595
|
+
const g = this.context.store.getTimeAxis().getTimeLeft(t.startTime), h = this.context.store.getTimeAxis().getTimeLeft(t.endTime);
|
|
5596
|
+
let d = (r - l) / 2 + r * t.flatIndex + o;
|
|
5597
|
+
if (n.position === "bottom" && (d += l), n.show === "start" || n.show === "both" || n.show === !0) {
|
|
5548
5598
|
const m = i.startStatus;
|
|
5549
5599
|
if (m && s.compare.indicator[m].show) {
|
|
5550
|
-
c =
|
|
5600
|
+
c = F(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
5551
5601
|
const p = new v.Circle({
|
|
5552
|
-
x:
|
|
5602
|
+
x: g - n.size,
|
|
5553
5603
|
y: d,
|
|
5554
5604
|
fill: c,
|
|
5555
5605
|
radius: n.size / 2
|
|
@@ -5557,23 +5607,23 @@ class ze {
|
|
|
5557
5607
|
this.indicatorGroup.add(p);
|
|
5558
5608
|
let u = `${lt(i.startDiff)}${i.unit} ${m}`;
|
|
5559
5609
|
const x = s.compare.indicator[m].text;
|
|
5560
|
-
j(x) ? u = x(i.startDiff, { ...t.getEmitData(), baseline: e }) :
|
|
5561
|
-
const
|
|
5610
|
+
j(x) ? u = x(i.startDiff, { ...t.getEmitData(), baseline: e }) : U(x) && (u = x);
|
|
5611
|
+
const w = new v.Text({
|
|
5562
5612
|
y: d - n.fontSize / 2,
|
|
5563
5613
|
text: u,
|
|
5564
5614
|
fill: c,
|
|
5565
5615
|
fontSize: n.fontSize,
|
|
5566
5616
|
fontFamily: n.fontFamily || "Arial"
|
|
5567
|
-
}),
|
|
5568
|
-
|
|
5617
|
+
}), E = w.measureSize(u);
|
|
5618
|
+
w.x(g - n.size - E.width - 5), this.indicatorGroup.add(w);
|
|
5569
5619
|
}
|
|
5570
5620
|
}
|
|
5571
5621
|
if (n.show === "end" || n.show === "both" || n.show === !0) {
|
|
5572
5622
|
const m = i.endStatus;
|
|
5573
5623
|
if (m && s.compare.indicator[m].show) {
|
|
5574
|
-
c =
|
|
5624
|
+
c = F(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
5575
5625
|
const p = new v.Circle({
|
|
5576
|
-
x:
|
|
5626
|
+
x: h + n.size,
|
|
5577
5627
|
y: d,
|
|
5578
5628
|
fill: c,
|
|
5579
5629
|
radius: n.size / 2
|
|
@@ -5581,16 +5631,16 @@ class ze {
|
|
|
5581
5631
|
this.indicatorGroup.add(p);
|
|
5582
5632
|
let u = `${lt(i.endDiff)}${i.unit} ${m}`;
|
|
5583
5633
|
const x = s.compare.indicator[m].text;
|
|
5584
|
-
j(x) ? u = x(i.endDiff, { ...t.getEmitData(), baseline: e }) :
|
|
5585
|
-
const
|
|
5586
|
-
x:
|
|
5634
|
+
j(x) ? u = x(i.endDiff, { ...t.getEmitData(), baseline: e }) : U(x) && (u = x);
|
|
5635
|
+
const w = new v.Text({
|
|
5636
|
+
x: h + n.size + 5,
|
|
5587
5637
|
y: d - n.fontSize / 2,
|
|
5588
5638
|
text: u,
|
|
5589
5639
|
fill: c,
|
|
5590
5640
|
fontSize: n.fontSize,
|
|
5591
5641
|
fontFamily: n.fontFamily || "Arial"
|
|
5592
5642
|
});
|
|
5593
|
-
this.indicatorGroup.add(
|
|
5643
|
+
this.indicatorGroup.add(w);
|
|
5594
5644
|
}
|
|
5595
5645
|
}
|
|
5596
5646
|
}
|
|
@@ -5604,7 +5654,7 @@ class ze {
|
|
|
5604
5654
|
});
|
|
5605
5655
|
}
|
|
5606
5656
|
}
|
|
5607
|
-
class
|
|
5657
|
+
class Pe {
|
|
5608
5658
|
constructor(t, e) {
|
|
5609
5659
|
// Konva 元素
|
|
5610
5660
|
a(this, "stage");
|
|
@@ -5628,7 +5678,7 @@ class Ye {
|
|
|
5628
5678
|
this.context,
|
|
5629
5679
|
this.bgLayer,
|
|
5630
5680
|
this.headerLayer.layer
|
|
5631
|
-
), this.bodyLayer = new v.Layer(), this.linkGroup = new Be(this.context, this.stage, this.bodyLayer), this.baselineGroup = new ze(this.context, this.stage, this.bodyLayer), this.bodyGroup = new
|
|
5681
|
+
), this.bodyLayer = new v.Layer(), this.linkGroup = new Be(this.context, this.stage, this.bodyLayer), this.baselineGroup = new ze(this.context, this.stage, this.bodyLayer), this.bodyGroup = new Re(
|
|
5632
5682
|
this.context,
|
|
5633
5683
|
this.stage,
|
|
5634
5684
|
this.bodyLayer,
|
|
@@ -5660,7 +5710,7 @@ class Ye {
|
|
|
5660
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();
|
|
5661
5711
|
}
|
|
5662
5712
|
}
|
|
5663
|
-
const
|
|
5713
|
+
const Ye = '<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>';
|
|
5664
5714
|
class Ne {
|
|
5665
5715
|
constructor(t, e) {
|
|
5666
5716
|
a(this, "line");
|
|
@@ -5671,7 +5721,7 @@ class Ne {
|
|
|
5671
5721
|
"border-left-color",
|
|
5672
5722
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
5673
5723
|
"important"
|
|
5674
|
-
), 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 =
|
|
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 = Ye, this.collapseButton.addEventListener("click", (i) => {
|
|
5675
5725
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
5676
5726
|
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
5677
5727
|
}
|
|
@@ -5683,23 +5733,23 @@ class Ne {
|
|
|
5683
5733
|
*/
|
|
5684
5734
|
addDragEvents() {
|
|
5685
5735
|
let t = 0, e = null;
|
|
5686
|
-
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (
|
|
5687
|
-
|
|
5736
|
+
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (l) => {
|
|
5737
|
+
l.preventDefault(), l.stopPropagation(), t = l.clientX, e = this.container.getBoundingClientRect();
|
|
5688
5738
|
const c = s[s.length - 1].key;
|
|
5689
5739
|
this.initialWidth = i.getColumnWidth(c);
|
|
5690
|
-
const
|
|
5691
|
-
this.root.event.emit(y.SHOW_GUIDELINE,
|
|
5692
|
-
const
|
|
5693
|
-
document.addEventListener("mousemove",
|
|
5694
|
-
}, o = (
|
|
5695
|
-
if (
|
|
5696
|
-
const c =
|
|
5740
|
+
const g = parseInt(this.line.style.left) + 2;
|
|
5741
|
+
this.root.event.emit(y.SHOW_GUIDELINE, g);
|
|
5742
|
+
const h = (m) => o(m), d = (m) => r(m, h, d);
|
|
5743
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", d);
|
|
5744
|
+
}, o = (l) => {
|
|
5745
|
+
if (l.preventDefault(), !e) return;
|
|
5746
|
+
const c = l.clientX - t;
|
|
5697
5747
|
s[s.length - 1].key;
|
|
5698
|
-
const
|
|
5748
|
+
const g = 50 - this.initialWidth, d = e.width - 20 - this.initialX, m = Math.max(g, Math.min(d, c)), p = this.initialX + m;
|
|
5699
5749
|
this.root.event.emit(y.MOVE_GUIDELINE, p);
|
|
5700
|
-
}, r = (
|
|
5701
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup",
|
|
5702
|
-
const
|
|
5750
|
+
}, r = (l, c, g) => {
|
|
5751
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(y.HIDE_GUIDELINE);
|
|
5752
|
+
const h = l.clientX - t, d = s[s.length - 1].key, m = Math.max(50, this.initialWidth + h);
|
|
5703
5753
|
i.setColumnWidth(d, m), this.root.event.emit(y.UPDATE_TABLE_HEADER);
|
|
5704
5754
|
};
|
|
5705
5755
|
this.line.addEventListener("mousedown", n);
|
|
@@ -5790,7 +5840,7 @@ class Xe {
|
|
|
5790
5840
|
a(this, "delay");
|
|
5791
5841
|
// 使用 debounce 来延迟执行,避免短时间内多次触发
|
|
5792
5842
|
a(this, "debouncedFlush");
|
|
5793
|
-
this.delay = t, this.debouncedFlush =
|
|
5843
|
+
this.delay = t, this.debouncedFlush = Yt(() => {
|
|
5794
5844
|
this.flushTaskQueue();
|
|
5795
5845
|
}, t);
|
|
5796
5846
|
}
|
|
@@ -5800,7 +5850,7 @@ class Xe {
|
|
|
5800
5850
|
* @param handler 处理器配置
|
|
5801
5851
|
*/
|
|
5802
5852
|
registerHandler(t, e) {
|
|
5803
|
-
this.taskHandlers.set(t, e),
|
|
5853
|
+
this.taskHandlers.set(t, e), L.debug(`RenderScheduler: 注册任务处理器 ${t}`);
|
|
5804
5854
|
}
|
|
5805
5855
|
/**
|
|
5806
5856
|
* 注册任务处理器(简化版本,只传回调函数)
|
|
@@ -5820,7 +5870,7 @@ class Xe {
|
|
|
5820
5870
|
scheduleTask(t, e = [], i = {}) {
|
|
5821
5871
|
const s = this.taskHandlers.get(t);
|
|
5822
5872
|
if (!s) {
|
|
5823
|
-
|
|
5873
|
+
L.warn(`RenderScheduler: 未找到任务类型 ${t} 的处理器`);
|
|
5824
5874
|
return;
|
|
5825
5875
|
}
|
|
5826
5876
|
const n = {
|
|
@@ -5831,10 +5881,10 @@ class Xe {
|
|
|
5831
5881
|
immediate: i.immediate ?? s.immediate ?? !1
|
|
5832
5882
|
};
|
|
5833
5883
|
if (n.immediate) {
|
|
5834
|
-
|
|
5884
|
+
L.debug(`RenderScheduler: 立即执行任务 ${t}`), this.executeTask(n);
|
|
5835
5885
|
return;
|
|
5836
5886
|
}
|
|
5837
|
-
this.taskQueue.set(t, n),
|
|
5887
|
+
this.taskQueue.set(t, n), L.debug(`RenderScheduler: 添加任务到队列 ${t}`), this.debouncedFlush();
|
|
5838
5888
|
}
|
|
5839
5889
|
/**
|
|
5840
5890
|
* 立即执行指定类型的任务(跳过队列)
|
|
@@ -5845,10 +5895,10 @@ class Xe {
|
|
|
5845
5895
|
immediateExecuteTask(t, e = [], i = !1) {
|
|
5846
5896
|
const s = this.taskHandlers.get(t);
|
|
5847
5897
|
if (!s) {
|
|
5848
|
-
|
|
5898
|
+
L.warn(`RenderScheduler: 未找到任务类型 ${t} 的处理器`);
|
|
5849
5899
|
return;
|
|
5850
5900
|
}
|
|
5851
|
-
|
|
5901
|
+
L.debug(`RenderScheduler: 立即执行任务 ${t}`);
|
|
5852
5902
|
const n = {
|
|
5853
5903
|
type: t,
|
|
5854
5904
|
refresh: i,
|
|
@@ -5862,7 +5912,7 @@ class Xe {
|
|
|
5862
5912
|
* 立即执行所有队列中的任务
|
|
5863
5913
|
*/
|
|
5864
5914
|
immediateFlushAll() {
|
|
5865
|
-
|
|
5915
|
+
L.debug("RenderScheduler: 立即执行所有队列任务"), this.cancelScheduled(), this.flushTaskQueue();
|
|
5866
5916
|
}
|
|
5867
5917
|
/**
|
|
5868
5918
|
* 执行单个任务
|
|
@@ -5872,7 +5922,7 @@ class Xe {
|
|
|
5872
5922
|
try {
|
|
5873
5923
|
t.callback(...t.args || []);
|
|
5874
5924
|
} catch (e) {
|
|
5875
|
-
|
|
5925
|
+
L.error(`RenderScheduler: 执行任务 ${t.type} 时出错:`, e);
|
|
5876
5926
|
}
|
|
5877
5927
|
}
|
|
5878
5928
|
/**
|
|
@@ -5881,7 +5931,7 @@ class Xe {
|
|
|
5881
5931
|
flushTaskQueue() {
|
|
5882
5932
|
if (this.taskQueue.size === 0)
|
|
5883
5933
|
return;
|
|
5884
|
-
|
|
5934
|
+
L.debug(
|
|
5885
5935
|
`RenderScheduler: 执行任务队列,任务数量: ${this.taskQueue.size}`
|
|
5886
5936
|
);
|
|
5887
5937
|
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);
|
|
@@ -5900,7 +5950,7 @@ class Xe {
|
|
|
5900
5950
|
* @param taskType 任务类型
|
|
5901
5951
|
*/
|
|
5902
5952
|
unregisterHandler(t) {
|
|
5903
|
-
this.taskHandlers.delete(t), this.taskQueue.delete(t),
|
|
5953
|
+
this.taskHandlers.delete(t), this.taskQueue.delete(t), L.debug(`RenderScheduler: 移除任务处理器 ${t}`);
|
|
5904
5954
|
}
|
|
5905
5955
|
/**
|
|
5906
5956
|
* 获取当前队列中的任务数量
|
|
@@ -5918,7 +5968,7 @@ class Xe {
|
|
|
5918
5968
|
* 销毁调度器
|
|
5919
5969
|
*/
|
|
5920
5970
|
destroy() {
|
|
5921
|
-
this.cancelScheduled(), this.taskHandlers.clear(),
|
|
5971
|
+
this.cancelScheduled(), this.taskHandlers.clear(), L.debug("RenderScheduler: 已销毁");
|
|
5922
5972
|
}
|
|
5923
5973
|
}
|
|
5924
5974
|
class Ve {
|
|
@@ -5970,12 +6020,12 @@ class Ve {
|
|
|
5970
6020
|
`${t.border.color}`
|
|
5971
6021
|
), this.rootElement.style.setProperty(
|
|
5972
6022
|
"--x-gantt-row-hover-color",
|
|
5973
|
-
`${
|
|
6023
|
+
`${F(t.row.hover.backgroundColor).alpha(
|
|
5974
6024
|
t.row.hover.opacity
|
|
5975
6025
|
)}`
|
|
5976
6026
|
), this.rootElement.style.setProperty(
|
|
5977
6027
|
"--x-gantt-row-selected-color",
|
|
5978
|
-
`${
|
|
6028
|
+
`${F(t.row.select.backgroundColor).alpha(
|
|
5979
6029
|
t.row.select.opacity
|
|
5980
6030
|
)}`
|
|
5981
6031
|
), this.rootElement.style.setProperty(
|
|
@@ -5989,7 +6039,7 @@ class Ve {
|
|
|
5989
6039
|
a(this, "handleColumnWidthChange", () => {
|
|
5990
6040
|
this.table.updateWidth(), this.updateSize();
|
|
5991
6041
|
});
|
|
5992
|
-
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 Ue(this.context, this.container), this.middleLine = new Ne(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
|
|
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 Ue(this.context, this.container), this.middleLine = new Ne(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 Pe(this.context, this.chartContainer), this.scrollbar = new Le(
|
|
5993
6043
|
this.context,
|
|
5994
6044
|
this.rootElement,
|
|
5995
6045
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
@@ -6056,8 +6106,8 @@ class Ve {
|
|
|
6056
6106
|
*/
|
|
6057
6107
|
performRender(t = !1) {
|
|
6058
6108
|
this.setStyleValue();
|
|
6059
|
-
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),
|
|
6060
|
-
this.updateSize(), t ? (this.table.refresh(i,
|
|
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), l = 2, c = Math.max(0, o), g = r + l, h = this.context.store.getDataManager().getVisibleTasks().slice(c, c + g);
|
|
6110
|
+
this.updateSize(), t ? (this.table.refresh(i, h), this.chart.refresh(e, i, h)) : (this.table.render(i, h), this.chart.render(e, i, h)), this.isInitialized && (this.context.event.emit(y.LOADED), this.isInitialized = !1), L.debug("execute render");
|
|
6061
6111
|
}
|
|
6062
6112
|
/**
|
|
6063
6113
|
* 公共渲染方法,向后兼容
|
|
@@ -6078,7 +6128,7 @@ class Ve {
|
|
|
6078
6128
|
);
|
|
6079
6129
|
}
|
|
6080
6130
|
destroy() {
|
|
6081
|
-
|
|
6131
|
+
L.debug("Renderer destroy"), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
6082
6132
|
}
|
|
6083
6133
|
}
|
|
6084
6134
|
class Ke {
|
|
@@ -6087,7 +6137,7 @@ class Ke {
|
|
|
6087
6137
|
a(this, "store");
|
|
6088
6138
|
a(this, "event", new Xt());
|
|
6089
6139
|
a(this, "renderer");
|
|
6090
|
-
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new
|
|
6140
|
+
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new Me(this, i), this.renderer = new Ve(this, this.container), this.render(), this.registerEvents(), L.debug(
|
|
6091
6141
|
"----Gantt initialized for element:",
|
|
6092
6142
|
this._id,
|
|
6093
6143
|
this.container
|
|
@@ -6108,10 +6158,10 @@ class Ke {
|
|
|
6108
6158
|
this.renderer.render();
|
|
6109
6159
|
}
|
|
6110
6160
|
updateOptions(t, e) {
|
|
6111
|
-
this.setOptions(t, e),
|
|
6161
|
+
this.setOptions(t, e), L.debug("GanttChart options updated"), this.render();
|
|
6112
6162
|
}
|
|
6113
6163
|
destroy() {
|
|
6114
|
-
|
|
6164
|
+
L.debug("Gantt destroying..."), this.event.offAll(), this.renderer.destroy(), this.container.innerHTML = "";
|
|
6115
6165
|
}
|
|
6116
6166
|
/**
|
|
6117
6167
|
* 跳转到指定日期。默认为今天
|
|
@@ -6201,7 +6251,7 @@ class Ze {
|
|
|
6201
6251
|
a(this, "context");
|
|
6202
6252
|
// 管理对外事件
|
|
6203
6253
|
a(this, "events", /* @__PURE__ */ new Map());
|
|
6204
|
-
e != null && e.logLevel &&
|
|
6254
|
+
e != null && e.logLevel && L.setOptions({
|
|
6205
6255
|
showTimestamp: e.logLevel === "debug",
|
|
6206
6256
|
level: {
|
|
6207
6257
|
debug: 1,
|
|
@@ -6213,7 +6263,7 @@ class Ze {
|
|
|
6213
6263
|
});
|
|
6214
6264
|
const i = typeof t == "string" ? document.querySelector(t) : t;
|
|
6215
6265
|
if (!i)
|
|
6216
|
-
throw
|
|
6266
|
+
throw L.exception(`Container ${t} not found or invalid.`);
|
|
6217
6267
|
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new Ke(i, this.events, e);
|
|
6218
6268
|
}
|
|
6219
6269
|
// *** Public API Methods ***/
|
|
@@ -6268,7 +6318,7 @@ class Ze {
|
|
|
6268
6318
|
* @description 此方法通常不需要主动调用,初始化以及 `update` 中都会自动更新。 如果你需要强制刷新页面,可以在合适的时候调用此方法
|
|
6269
6319
|
*/
|
|
6270
6320
|
render() {
|
|
6271
|
-
this.context.render(),
|
|
6321
|
+
this.context.render(), L.info("Gantt rendered successfully.");
|
|
6272
6322
|
}
|
|
6273
6323
|
/**
|
|
6274
6324
|
* 销毁甘特图实例,清理所有资源
|
|
@@ -6305,7 +6355,7 @@ class Ze {
|
|
|
6305
6355
|
* @warning 销毁后的实例不能再次使用,调用任何方法都可能导致错误
|
|
6306
6356
|
*/
|
|
6307
6357
|
destroy() {
|
|
6308
|
-
|
|
6358
|
+
L.info("Gantt destroying..."), this.events.clear(), this.context.destroy(), L.info("Gantt destroyed successfully.");
|
|
6309
6359
|
}
|
|
6310
6360
|
/**
|
|
6311
6361
|
* 跳转到指定日期
|
|
@@ -6435,7 +6485,7 @@ Nt();
|
|
|
6435
6485
|
const ti = St;
|
|
6436
6486
|
export {
|
|
6437
6487
|
Ze as XGantt,
|
|
6438
|
-
|
|
6488
|
+
F as colorjs,
|
|
6439
6489
|
si as dayjs,
|
|
6440
6490
|
Z as generateId,
|
|
6441
6491
|
ti as version
|