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