@xpyjs/gantt-core 0.0.1-beta.3 → 0.0.1-rc.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/x-gantt.js +891 -775
- package/dist/x-gantt.umd.cjs +2 -2
- package/package.json +1 -1
- package/types/GanttContext.d.ts +6 -0
- package/types/XGantt.d.ts +63 -0
- package/types/event/index.d.ts +4 -2
- package/types/types/event.d.ts +27 -0
package/dist/x-gantt.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Pt = Object.defineProperty;
|
|
2
2
|
var Yt = (f, t, e) => t in f ? Pt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
3
|
var a = (f, t, e) => Yt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import
|
|
4
|
+
import G from "dayjs";
|
|
5
5
|
import { default as ai } from "dayjs";
|
|
6
|
-
import { merge as rt, isArray as X, isString as
|
|
6
|
+
import { merge as rt, isArray as X, isString as K, isFunction as j, cloneDeep as Z, isObject as Et, isNumber as Ut, omit as yt, throttle as wt, isBoolean as ht, debounce as Xt } from "lodash-es";
|
|
7
7
|
import S from "konva";
|
|
8
|
-
const
|
|
9
|
-
function
|
|
8
|
+
const Ct = "0.0.1-rc.1";
|
|
9
|
+
function Kt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
@@ -19,7 +19,7 @@ function Vt() {
|
|
|
19
19
|
`color: ${f}; font-weight: bold; font-family: monospace;`
|
|
20
20
|
);
|
|
21
21
|
}), console.log(
|
|
22
|
-
`%c 🚀 欢迎使用 XGantt %c Version: ${
|
|
22
|
+
`%c 🚀 欢迎使用 XGantt %c Version: ${Ct} `,
|
|
23
23
|
`background-color: ${e}; color: ${t}; padding: 2px 4px; border-radius: 6px 0 0 6px; font-weight: bold; margin: 4px 0;`,
|
|
24
24
|
`background-color: ${s}; color: ${i}; padding: 2px 4px; border-radius: 0 6px 6px 0; font-weight: normal; margin: 4px 0;`
|
|
25
25
|
);
|
|
@@ -114,7 +114,7 @@ const N = class N {
|
|
|
114
114
|
*/
|
|
115
115
|
static formatArgs(...t) {
|
|
116
116
|
const e = [N.Prefix];
|
|
117
|
-
return N.options.showTimestamp && e.unshift(`[${
|
|
117
|
+
return N.options.showTimestamp && e.unshift(`[${G().format("YYYY-MM-DD HH:mm:ss.SSS")}]`), [e.join(""), ...t];
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
a(N, "Prefix", "[XGantt]"), a(N, "options", {
|
|
@@ -316,7 +316,7 @@ const lt = () => ({
|
|
|
316
316
|
opacity: 0.1
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
|
-
class
|
|
319
|
+
class Vt {
|
|
320
320
|
constructor() {
|
|
321
321
|
a(this, "options", lt());
|
|
322
322
|
}
|
|
@@ -329,7 +329,7 @@ class Kt {
|
|
|
329
329
|
const s = [];
|
|
330
330
|
t.holiday.holidays.forEach((n) => {
|
|
331
331
|
if (X(n.date)) {
|
|
332
|
-
const o = n.date.map((r) =>
|
|
332
|
+
const o = n.date.map((r) => G(r)).sort((r, h) => r.diff(h));
|
|
333
333
|
for (let r = 1; r < o.length; r++)
|
|
334
334
|
if (o[r].diff(o[r - 1], "day") > 1) {
|
|
335
335
|
s.push({
|
|
@@ -354,7 +354,7 @@ class Kt {
|
|
|
354
354
|
var s;
|
|
355
355
|
let e = "";
|
|
356
356
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
357
|
-
return
|
|
357
|
+
return K(i) ? e = i : X(i) && i.length > 0 ? e = i[t.level] : j(i) && (e = i(t.getEmitData())), e;
|
|
358
358
|
}
|
|
359
359
|
unpackFunc(t, e) {
|
|
360
360
|
return j(t) ? t(e.getEmitData()) : t;
|
|
@@ -401,7 +401,7 @@ class jt {
|
|
|
401
401
|
this.events.clear();
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
var
|
|
404
|
+
var k = /* @__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.ERROR = "error", f))(k || {}), 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
405
|
function Q() {
|
|
406
406
|
return Math.random().toString(36).substring(2, 15);
|
|
407
407
|
}
|
|
@@ -413,7 +413,7 @@ function $(f, t, e) {
|
|
|
413
413
|
}
|
|
414
414
|
function nt(f, t) {
|
|
415
415
|
let e = f;
|
|
416
|
-
return
|
|
416
|
+
return K(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
417
417
|
}
|
|
418
418
|
function ct(f, t) {
|
|
419
419
|
if (t === 0)
|
|
@@ -448,10 +448,10 @@ function bt(f, t = 16, e = 16) {
|
|
|
448
448
|
const s = new Promise((n, o) => {
|
|
449
449
|
let r = f;
|
|
450
450
|
if (!/viewBox\s*=\s*["'][^"']*["']/.test(r)) {
|
|
451
|
-
const l = r.match(/width\s*=\s*["']([^"']*)["']/),
|
|
451
|
+
const l = r.match(/width\s*=\s*["']([^"']*)["']/), m = r.match(/height\s*=\s*["']([^"']*)["']/), p = l ? parseFloat(l[1]) : t, u = m ? parseFloat(m[1]) : e;
|
|
452
452
|
r = r.replace(
|
|
453
453
|
/<svg([^>]*)>/,
|
|
454
|
-
`<svg$1 viewBox="0 0 ${
|
|
454
|
+
`<svg$1 viewBox="0 0 ${p} ${u}">`
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
457
|
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(
|
|
@@ -532,7 +532,7 @@ class mt {
|
|
|
532
532
|
this.store = t, this.event = e, this.fields = this.store.getOptionManager().getOptions().fields, this.id = n || i[this.fields.id] || Q(), this.data = i, this.name = i[this.fields.name] || "", this.type = i[this.fields.type] || "task", this.updateMode(), this.progress = i[this.fields.progress], this.expanded = this.store.getOptionManager().getOptions().expand.show ? this.store.getOptionManager().getOptions().expand.enabled : !0, this.children = [], this.level = s && s.level !== void 0 ? s.level + 1 : 0, this.parent = s, this.flatIndex = 0, this.store.updateTime(this.startTime, this.endTime);
|
|
533
533
|
}
|
|
534
534
|
getField(t) {
|
|
535
|
-
if (!t ||
|
|
535
|
+
if (!t || K(t) && t.trim() === "")
|
|
536
536
|
return;
|
|
537
537
|
if (!t.includes("."))
|
|
538
538
|
return this.data[t];
|
|
@@ -544,23 +544,23 @@ class mt {
|
|
|
544
544
|
return;
|
|
545
545
|
i = i[n];
|
|
546
546
|
}
|
|
547
|
-
return
|
|
547
|
+
return Et(i) ? Z(i) : i;
|
|
548
548
|
}
|
|
549
549
|
/** 切换展示模式时,需要调整时间 */
|
|
550
550
|
updateMode() {
|
|
551
551
|
let t = !1;
|
|
552
|
-
return this.data[this.fields.startTime] && (!this.startTime || !this.startTime.isSame(
|
|
552
|
+
return this.data[this.fields.startTime] && (!this.startTime || !this.startTime.isSame(G(this.data[this.fields.startTime]))) && (this.startTime = G(this.data[this.fields.startTime]), t = !0), this.data[this.fields.endTime] && (!this.endTime || !this.endTime.isSame(G(this.data[this.fields.endTime]))) && (this.endTime = G(this.data[this.fields.endTime]), t = !0), 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
553
|
}
|
|
554
554
|
updateData(t) {
|
|
555
555
|
this.data = t;
|
|
556
556
|
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(
|
|
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(k.UPDATE_TASK, this);
|
|
558
558
|
}
|
|
559
559
|
updateTime(t, e) {
|
|
560
560
|
var s, n;
|
|
561
561
|
this.startTime = t, this.endTime = this.isMilestone() ? t : e;
|
|
562
562
|
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(
|
|
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(k.UPDATE_TASK, this);
|
|
564
564
|
}
|
|
565
565
|
clone() {
|
|
566
566
|
return new mt(
|
|
@@ -615,9 +615,9 @@ class Qt {
|
|
|
615
615
|
const s = this.store.getOptionManager().getOptions().fields, n = this.store.getOptionManager().getOptions().baselines.fields;
|
|
616
616
|
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
617
|
const o = i[s.startTime] || i[n.startTime];
|
|
618
|
-
o && (this.startTime =
|
|
618
|
+
o && (this.startTime = G(o));
|
|
619
619
|
const r = i[s.endTime] || i[n.endTime];
|
|
620
|
-
r && (this.endTime =
|
|
620
|
+
r && (this.endTime = G(r)), this.data = i;
|
|
621
621
|
}
|
|
622
622
|
getField(t) {
|
|
623
623
|
return this.data[t];
|
|
@@ -680,7 +680,7 @@ class Jt {
|
|
|
680
680
|
* 设置源数据并初始化任务
|
|
681
681
|
*/
|
|
682
682
|
setData(t, e = !1) {
|
|
683
|
-
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(
|
|
683
|
+
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(k.DATA_UPDATE);
|
|
684
684
|
}
|
|
685
685
|
/**
|
|
686
686
|
* 初始化任务
|
|
@@ -800,7 +800,7 @@ class Jt {
|
|
|
800
800
|
const i = this.getTaskById(t);
|
|
801
801
|
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) => {
|
|
802
802
|
this.expandTask(s.id, e);
|
|
803
|
-
}), this.invalidateCache(), this.event.emit(
|
|
803
|
+
}), this.invalidateCache(), this.event.emit(k.VIEW_UPDATE), !0) : !1;
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
806
806
|
* 按条件筛选任务
|
|
@@ -854,7 +854,7 @@ class Jt {
|
|
|
854
854
|
* 清空所有数据
|
|
855
855
|
*/
|
|
856
856
|
clear() {
|
|
857
|
-
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(
|
|
857
|
+
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(k.DATA_UPDATE);
|
|
858
858
|
}
|
|
859
859
|
/**
|
|
860
860
|
* 更新子任务的层级
|
|
@@ -882,7 +882,7 @@ class Jt {
|
|
|
882
882
|
*/
|
|
883
883
|
selectTask(t) {
|
|
884
884
|
const e = this.getTaskById(t);
|
|
885
|
-
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(
|
|
885
|
+
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(k.TASK_SELECTED, e)), !0) : !1;
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
888
|
* 取消任务选择
|
|
@@ -890,7 +890,7 @@ class Jt {
|
|
|
890
890
|
unselectTask() {
|
|
891
891
|
if (this.selectedTaskId) {
|
|
892
892
|
const t = this.selectedTaskId;
|
|
893
|
-
this.selectedTaskId = null, this.event.emit(
|
|
893
|
+
this.selectedTaskId = null, this.event.emit(k.TASK_UNSELECTED, t);
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
/**
|
|
@@ -927,20 +927,20 @@ class Jt {
|
|
|
927
927
|
let d = t.parent;
|
|
928
928
|
for (; c !== "none" && d; ) {
|
|
929
929
|
if (c === "expand") {
|
|
930
|
-
let
|
|
931
|
-
(!d.startTime || o.isBefore(d.startTime)) && (
|
|
930
|
+
let m = d.startTime || o, p = d.endTime || r;
|
|
931
|
+
(!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((u) => u.id === d.id) === -1 && n.push(d.clone()), d.updateTime(m, p));
|
|
932
932
|
} else c === "strict" && (d.startTime && o.isBefore(d.startTime) && (o = d.startTime, r.isSameOrBefore(o) && (r = o.add(1, g))), d.endTime && r.isAfter(d.endTime) && (r = d.endTime, o.isAfter(r) && (o = r.subtract(1, g))));
|
|
933
933
|
d = d.parent;
|
|
934
934
|
}
|
|
935
935
|
let l = t.children || [];
|
|
936
936
|
for (; h !== "none" && l.length > 0; ) {
|
|
937
|
-
const
|
|
938
|
-
l.forEach((
|
|
939
|
-
let u =
|
|
940
|
-
h === "scale" ? s === "both" ? (n.findIndex((b) => b.id ===
|
|
941
|
-
}), l =
|
|
937
|
+
const m = [];
|
|
938
|
+
l.forEach((p) => {
|
|
939
|
+
let u = p.startTime || o, y = p.endTime || r, x = o.diff(t.startTime), T = r.diff(t.endTime);
|
|
940
|
+
h === "scale" ? s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u.add(x), y.add(T))) : s === "left" ? (u = u.add(x), u.isSameOrAfter(y.subtract(1, g)) && (y.isBefore(t.endTime) ? y = u.add(1, g) : u = y.subtract(1, g), u.isSameOrBefore(o) && (o = u)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y)) : s === "right" && (y = y.add(T), y.isSameOrBefore(u.add(1, g)) && (u.isAfter(t.startTime) ? u = y.subtract(1, g) : y = u.add(1, g)), y.isSameOrAfter(r) && (r = y), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y)) : h === "fixed" && (s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u.add(x), y.add(T))) : s === "left" ? u.isSameOrBefore(o) && (u = o, u.isSameOrAfter(y.subtract(1, g)) && (y.isBefore(t.endTime) ? y = u.add(1, g) : u = y.subtract(1, g), u.isSameOrBefore(o) && (o = u)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y)) : s === "right" && y.isSameOrAfter(r) && (y = r, y.isSameOrBefore(u.add(1, g)) && (u.isAfter(t.startTime) ? u = y.subtract(1, g) : y = u.add(1, g)), y.isSameOrAfter(r) && (r = y), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y))), p.children && p.children.length > 0 && m.push(...p.children);
|
|
941
|
+
}), l = m;
|
|
942
942
|
}
|
|
943
|
-
n.findIndex((
|
|
943
|
+
n.findIndex((m) => m.id === t.id) === -1 && n.push(t.clone()), t.updateTime(o, r);
|
|
944
944
|
}
|
|
945
945
|
//** 基线数据操作 */
|
|
946
946
|
setBaselines(t) {
|
|
@@ -1009,8 +1009,8 @@ function Zt(f) {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
function te(f, t, e, i, s = !1, n = !1) {
|
|
1011
1011
|
const o = (l) => {
|
|
1012
|
-
const
|
|
1013
|
-
return
|
|
1012
|
+
const m = Math.round($(l, 0, 255)).toString(16);
|
|
1013
|
+
return m.length === 1 ? "0" + m : m;
|
|
1014
1014
|
}, r = o(f), h = o(t), c = o(e), g = o(i * 255);
|
|
1015
1015
|
if (s && r[0] === r[1] && h[0] === h[1] && c[0] === c[1] && i === 1 && // Alpha 必须为 1 才能缩写
|
|
1016
1016
|
!n)
|
|
@@ -1184,7 +1184,7 @@ class et {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
1186
|
const B = (f) => f instanceof et ? f : new et(f);
|
|
1187
|
-
class
|
|
1187
|
+
class Lt {
|
|
1188
1188
|
constructor(t, e, i) {
|
|
1189
1189
|
a(this, "element");
|
|
1190
1190
|
a(this, "iconElement");
|
|
@@ -1261,14 +1261,14 @@ class Et {
|
|
|
1261
1261
|
)) : (this.context.store.getDataManager().updateCheckedList(!0, this.task), this.setState(
|
|
1262
1262
|
1
|
|
1263
1263
|
/* CHECKED */
|
|
1264
|
-
)), this.context.event.emit(
|
|
1264
|
+
)), this.context.event.emit(k.CHECK_TASK, [this.task], !e);
|
|
1265
1265
|
} else {
|
|
1266
1266
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1267
1267
|
this.setState(
|
|
1268
1268
|
e ? 1 : 0
|
|
1269
1269
|
/* UNCHECKED */
|
|
1270
1270
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1271
|
-
|
|
1271
|
+
k.CHECK_TASK,
|
|
1272
1272
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1273
1273
|
!e
|
|
1274
1274
|
);
|
|
@@ -1291,14 +1291,14 @@ class Et {
|
|
|
1291
1291
|
}), this.setState(
|
|
1292
1292
|
1
|
|
1293
1293
|
/* CHECKED */
|
|
1294
|
-
)), this.context.event.emit(
|
|
1294
|
+
)), this.context.event.emit(k.CHECK_TASK, e, !i);
|
|
1295
1295
|
} else {
|
|
1296
1296
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1297
1297
|
this.setState(
|
|
1298
1298
|
e ? 1 : 0
|
|
1299
1299
|
/* UNCHECKED */
|
|
1300
1300
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1301
|
-
|
|
1301
|
+
k.CHECK_TASK,
|
|
1302
1302
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1303
1303
|
!e
|
|
1304
1304
|
);
|
|
@@ -1306,7 +1306,7 @@ class Et {
|
|
|
1306
1306
|
});
|
|
1307
1307
|
}
|
|
1308
1308
|
registerEvents() {
|
|
1309
|
-
this.context.event.on(
|
|
1309
|
+
this.context.event.on(k.CHECK_TASK, this.updateState.bind(this));
|
|
1310
1310
|
}
|
|
1311
1311
|
/** 获取元素 */
|
|
1312
1312
|
getElement() {
|
|
@@ -1377,13 +1377,13 @@ class ee {
|
|
|
1377
1377
|
*/
|
|
1378
1378
|
processColumns(t, e = [], i, s = 1) {
|
|
1379
1379
|
t.forEach((n, o) => {
|
|
1380
|
-
var
|
|
1380
|
+
var p;
|
|
1381
1381
|
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0, h = !r;
|
|
1382
1382
|
let c = "";
|
|
1383
1383
|
r ? c = `group-${o}` : c = `field-${n.field}`;
|
|
1384
1384
|
const g = [...(i == null ? void 0 : i.path) || [], c];
|
|
1385
1385
|
c = "column-" + o + "-" + g.join("-");
|
|
1386
|
-
const d = n.label || (h ? n.field : ""), l = h ? ((
|
|
1386
|
+
const d = n.label || (h ? n.field : ""), l = h ? ((p = this.temporaryLeafColumns.find((u) => u.key === c)) == null ? void 0 : p.width) || n.width || 100 : "auto", m = {
|
|
1387
1387
|
label: d,
|
|
1388
1388
|
level: s,
|
|
1389
1389
|
maxLevel: s,
|
|
@@ -1394,18 +1394,18 @@ class ee {
|
|
|
1394
1394
|
isLeaf: h,
|
|
1395
1395
|
width: l
|
|
1396
1396
|
};
|
|
1397
|
-
if (e.push(
|
|
1398
|
-
this.leafColumns.push(
|
|
1397
|
+
if (e.push(m), h)
|
|
1398
|
+
this.leafColumns.push(m);
|
|
1399
1399
|
else if (r) {
|
|
1400
1400
|
const u = n.children;
|
|
1401
1401
|
this.processColumns(
|
|
1402
1402
|
u,
|
|
1403
|
-
|
|
1404
|
-
|
|
1403
|
+
m.children,
|
|
1404
|
+
m,
|
|
1405
1405
|
s + 1
|
|
1406
|
-
),
|
|
1407
|
-
|
|
1408
|
-
|
|
1406
|
+
), m.maxLevel = Math.max(
|
|
1407
|
+
m.maxLevel,
|
|
1408
|
+
m.children.reduce((y, x) => Math.max(y, x.maxLevel), 0)
|
|
1409
1409
|
);
|
|
1410
1410
|
}
|
|
1411
1411
|
}), this.temporaryLeafColumns = Z(this.leafColumns);
|
|
@@ -1438,7 +1438,7 @@ class ee {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
setColumnWidth(t, e) {
|
|
1440
1440
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1441
|
-
i && (i.width = e), this.context.event.emit(
|
|
1441
|
+
i && (i.width = e), this.context.event.emit(k.COLUMN_WIDTH_CHANGE, t, e);
|
|
1442
1442
|
}
|
|
1443
1443
|
isLastColumn(t) {
|
|
1444
1444
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1467,7 +1467,7 @@ class ee {
|
|
|
1467
1467
|
customStyle: {
|
|
1468
1468
|
paddingLeft: this.context.store.getOptionManager().getOptions().expand.show ? "8px" : 0
|
|
1469
1469
|
},
|
|
1470
|
-
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new
|
|
1470
|
+
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new Lt(this.context).getElement() : null,
|
|
1471
1471
|
ellipsis: !1
|
|
1472
1472
|
},
|
|
1473
1473
|
children: [],
|
|
@@ -1481,7 +1481,7 @@ class ee {
|
|
|
1481
1481
|
return this.columns.some((t) => t.maxLevel > 1);
|
|
1482
1482
|
}
|
|
1483
1483
|
collapse() {
|
|
1484
|
-
this.collapseTable = !this.collapseTable, this.context.event.emit(
|
|
1484
|
+
this.collapseTable = !this.collapseTable, this.context.event.emit(k.TOGGLE_COLLAPSE);
|
|
1485
1485
|
}
|
|
1486
1486
|
isCollapsed() {
|
|
1487
1487
|
return this.collapseTable;
|
|
@@ -1551,7 +1551,7 @@ const tt = class tt {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
/** 更新各种缓存配置 */
|
|
1553
1553
|
update() {
|
|
1554
|
-
this.setLinks(this.links);
|
|
1554
|
+
this.setLinks(this.links, !0);
|
|
1555
1555
|
}
|
|
1556
1556
|
/** 检查连线是否存在 */
|
|
1557
1557
|
isLinkExist(t, e, i) {
|
|
@@ -1596,12 +1596,18 @@ const tt = class tt {
|
|
|
1596
1596
|
/** 校验新增连线是否会产生环 */
|
|
1597
1597
|
validateChain(t, e, i) {
|
|
1598
1598
|
const s = { from: t, to: e, type: i }, n = this.validateLink(s);
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1599
|
+
if (!n.ok) return n;
|
|
1600
|
+
if (this.enableCycleDetection) {
|
|
1601
|
+
const o = this.willCreateCycle(t, e);
|
|
1602
|
+
if (o)
|
|
1603
|
+
return {
|
|
1604
|
+
ok: !1,
|
|
1605
|
+
reason: Y.LINK_CYCLE,
|
|
1606
|
+
message: O.getMessage("Adding this link would create a cycle"),
|
|
1607
|
+
cycleInfo: o
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
return { ok: !0 };
|
|
1605
1611
|
}
|
|
1606
1612
|
/** 批量校验连线 */
|
|
1607
1613
|
validateLinks(t) {
|
|
@@ -1684,81 +1690,81 @@ const tt = class tt {
|
|
|
1684
1690
|
};
|
|
1685
1691
|
const i = this.forwardMemo.get(t), s = this.backwardMemo.get(t);
|
|
1686
1692
|
this.recordCacheAccess(t, !!(i && s));
|
|
1687
|
-
const n = (
|
|
1688
|
-
const
|
|
1689
|
-
if (this.forwardMemo.has(
|
|
1690
|
-
return this.recordCacheAccess(
|
|
1691
|
-
if (T.has(
|
|
1693
|
+
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, T, b = /* @__PURE__ */ new Set()) => {
|
|
1694
|
+
const w = x.id;
|
|
1695
|
+
if (this.forwardMemo.has(w))
|
|
1696
|
+
return this.recordCacheAccess(w, !0), this.forwardMemo.get(w);
|
|
1697
|
+
if (T.has(x.id) || b.has(x.id))
|
|
1692
1698
|
return [];
|
|
1693
|
-
T.add(
|
|
1694
|
-
const
|
|
1695
|
-
let
|
|
1696
|
-
if (
|
|
1697
|
-
|
|
1699
|
+
T.add(x.id), b.add(x.id);
|
|
1700
|
+
const C = n(x.id);
|
|
1701
|
+
let L = [];
|
|
1702
|
+
if (C.length === 0)
|
|
1703
|
+
L = [[x]];
|
|
1698
1704
|
else {
|
|
1699
|
-
for (const
|
|
1700
|
-
const v = r(
|
|
1705
|
+
for (const E of C) {
|
|
1706
|
+
const v = r(E, T, b);
|
|
1701
1707
|
for (const M of v)
|
|
1702
|
-
|
|
1708
|
+
L.push([x, ...M]);
|
|
1703
1709
|
}
|
|
1704
|
-
|
|
1710
|
+
L.length === 0 && (L = [[x]]);
|
|
1705
1711
|
}
|
|
1706
|
-
return T.delete(
|
|
1707
|
-
}, h = (
|
|
1708
|
-
const
|
|
1709
|
-
if (this.backwardMemo.has(
|
|
1710
|
-
return this.recordCacheAccess(
|
|
1711
|
-
if (T.has(
|
|
1712
|
+
return T.delete(x.id), L.length < 100 && (this.forwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1713
|
+
}, h = (x, T, b = /* @__PURE__ */ new Set()) => {
|
|
1714
|
+
const w = x.id;
|
|
1715
|
+
if (this.backwardMemo.has(w))
|
|
1716
|
+
return this.recordCacheAccess(w, !0), this.backwardMemo.get(w);
|
|
1717
|
+
if (T.has(x.id) || b.has(x.id))
|
|
1712
1718
|
return [];
|
|
1713
|
-
T.add(
|
|
1714
|
-
const
|
|
1715
|
-
let
|
|
1716
|
-
if (
|
|
1717
|
-
|
|
1719
|
+
T.add(x.id), b.add(x.id);
|
|
1720
|
+
const C = o(x.id);
|
|
1721
|
+
let L = [];
|
|
1722
|
+
if (C.length === 0)
|
|
1723
|
+
L = [[x]];
|
|
1718
1724
|
else {
|
|
1719
|
-
for (const
|
|
1720
|
-
const v = h(
|
|
1725
|
+
for (const E of C) {
|
|
1726
|
+
const v = h(E, T, b);
|
|
1721
1727
|
for (const M of v)
|
|
1722
|
-
|
|
1728
|
+
L.push([...M, x]);
|
|
1723
1729
|
}
|
|
1724
|
-
|
|
1730
|
+
L.length === 0 && (L = [[x]]);
|
|
1725
1731
|
}
|
|
1726
|
-
return T.delete(
|
|
1732
|
+
return T.delete(x.id), L.length < 100 && (this.backwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1727
1733
|
}, c = h(e, /* @__PURE__ */ new Set()), g = r(e, /* @__PURE__ */ new Set());
|
|
1728
|
-
this.getDirectlyConnectedTasks(t).forEach((
|
|
1729
|
-
this.establishCacheDependency(t,
|
|
1734
|
+
this.getDirectlyConnectedTasks(t).forEach((x) => {
|
|
1735
|
+
this.establishCacheDependency(t, x.id), this.establishCacheDependency(x.id, t);
|
|
1730
1736
|
});
|
|
1731
|
-
const l = /* @__PURE__ */ new Map(),
|
|
1737
|
+
const l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), p = (x, T) => {
|
|
1732
1738
|
const b = [];
|
|
1733
|
-
for (const
|
|
1734
|
-
|
|
1735
|
-
for (let
|
|
1736
|
-
const
|
|
1739
|
+
for (const w of x) {
|
|
1740
|
+
w.forEach((C) => l.set(C.id, C));
|
|
1741
|
+
for (let C = 0; C < w.length - 1; C++) {
|
|
1742
|
+
const L = w[C].id, E = w[C + 1].id, v = this.findLinkFast(L, E);
|
|
1737
1743
|
if (v) {
|
|
1738
1744
|
const M = `${v.from}-${v.to}-${v.type || "default"}`;
|
|
1739
|
-
|
|
1745
|
+
m.has(M) || (b.push(v), m.set(M, v));
|
|
1740
1746
|
}
|
|
1741
1747
|
}
|
|
1742
1748
|
}
|
|
1743
1749
|
return b;
|
|
1744
|
-
}, u =
|
|
1750
|
+
}, u = p(c), y = p(g);
|
|
1745
1751
|
return {
|
|
1746
1752
|
prev: {
|
|
1747
|
-
chain: c.map((
|
|
1753
|
+
chain: c.map((x) => x.map((T) => T.getEmitData().data)),
|
|
1748
1754
|
nodes: c.flat().filter(
|
|
1749
|
-
(
|
|
1750
|
-
).map((
|
|
1755
|
+
(x, T, b) => b.findIndex((w) => w.id === x.id) === T
|
|
1756
|
+
).map((x) => x.getEmitData().data),
|
|
1751
1757
|
links: u
|
|
1752
1758
|
},
|
|
1753
1759
|
next: {
|
|
1754
|
-
chain: g.map((
|
|
1760
|
+
chain: g.map((x) => x.map((T) => T.getEmitData().data)),
|
|
1755
1761
|
nodes: g.flat().filter(
|
|
1756
|
-
(
|
|
1757
|
-
).map((
|
|
1758
|
-
links:
|
|
1762
|
+
(x, T, b) => b.findIndex((w) => w.id === x.id) === T
|
|
1763
|
+
).map((x) => x.getEmitData().data),
|
|
1764
|
+
links: y
|
|
1759
1765
|
},
|
|
1760
|
-
allNodes: Array.from(l.values()).map((
|
|
1761
|
-
allLinks: Array.from(
|
|
1766
|
+
allNodes: Array.from(l.values()).map((x) => x.getEmitData().data),
|
|
1767
|
+
allLinks: Array.from(m.values()),
|
|
1762
1768
|
current: e.getEmitData().data
|
|
1763
1769
|
};
|
|
1764
1770
|
}
|
|
@@ -1773,16 +1779,16 @@ const tt = class tt {
|
|
|
1773
1779
|
let o = 0;
|
|
1774
1780
|
const r = [], h = (l) => {
|
|
1775
1781
|
e.set(l, o), i.set(l, o), o++, n.push(l), s.add(l);
|
|
1776
|
-
const
|
|
1777
|
-
for (const
|
|
1778
|
-
e.has(
|
|
1782
|
+
const m = this.fromLinksMap.get(l) || [];
|
|
1783
|
+
for (const p of m)
|
|
1784
|
+
e.has(p.to) ? s.has(p.to) && i.set(l, Math.min(i.get(l), e.get(p.to))) : (h(p.to), i.set(l, Math.min(i.get(l), i.get(p.to))));
|
|
1779
1785
|
if (i.get(l) === e.get(l)) {
|
|
1780
|
-
const
|
|
1786
|
+
const p = [];
|
|
1781
1787
|
for (; ; ) {
|
|
1782
1788
|
const u = n.pop();
|
|
1783
|
-
if (s.delete(u),
|
|
1789
|
+
if (s.delete(u), p.push(u), u === l) break;
|
|
1784
1790
|
}
|
|
1785
|
-
r.push(
|
|
1791
|
+
r.push(p);
|
|
1786
1792
|
}
|
|
1787
1793
|
};
|
|
1788
1794
|
this.store.getDataManager().getTasks(!1).forEach((l) => {
|
|
@@ -1845,19 +1851,34 @@ const tt = class tt {
|
|
|
1845
1851
|
/** 增量环检测(基于拓扑序 + DFS) */
|
|
1846
1852
|
willCreateCycle(t, e) {
|
|
1847
1853
|
if (this.computeTopo()) {
|
|
1848
|
-
const
|
|
1849
|
-
if (
|
|
1854
|
+
const r = this.topoIndex.get(t), h = this.topoIndex.get(e);
|
|
1855
|
+
if (r != null && h != null && r < h) return null;
|
|
1850
1856
|
}
|
|
1851
|
-
const s = [e], n = /* @__PURE__ */ new Set();
|
|
1857
|
+
const s = [e], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
1852
1858
|
for (; s.length; ) {
|
|
1853
|
-
const
|
|
1854
|
-
if (
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1859
|
+
const r = s.pop();
|
|
1860
|
+
if (n.has(r)) continue;
|
|
1861
|
+
n.add(r);
|
|
1862
|
+
const h = this.fromLinksMap.get(r) || [];
|
|
1863
|
+
for (const c of h) {
|
|
1864
|
+
const g = c.to;
|
|
1865
|
+
if (!n.has(g) && !o.has(g) && o.set(g, r), g === t) {
|
|
1866
|
+
o.has(g) || o.set(g, r);
|
|
1867
|
+
const d = [];
|
|
1868
|
+
let l = t;
|
|
1869
|
+
for (; l !== void 0; )
|
|
1870
|
+
d.push(l), l = o.get(l);
|
|
1871
|
+
const m = d.slice().reverse(), p = [t, ...m];
|
|
1872
|
+
return {
|
|
1873
|
+
cycles: [p],
|
|
1874
|
+
nodes: Array.from(new Set(p)),
|
|
1875
|
+
sccs: []
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
s.push(g);
|
|
1879
|
+
}
|
|
1859
1880
|
}
|
|
1860
|
-
return
|
|
1881
|
+
return null;
|
|
1861
1882
|
}
|
|
1862
1883
|
/** 构建/重建邻接表 */
|
|
1863
1884
|
rebuildAdjacency() {
|
|
@@ -1897,7 +1918,6 @@ const tt = class tt {
|
|
|
1897
1918
|
sccs: []
|
|
1898
1919
|
};
|
|
1899
1920
|
}
|
|
1900
|
-
// 优化后的缓存失效策略
|
|
1901
1921
|
/**
|
|
1902
1922
|
* 精细化缓存失效策略
|
|
1903
1923
|
* 根据操作类型和影响范围进行精确的缓存失效
|
|
@@ -2091,24 +2111,24 @@ var Mt = { exports: {} };
|
|
|
2091
2111
|
(function(e, i) {
|
|
2092
2112
|
f.exports = i();
|
|
2093
2113
|
})(P, function() {
|
|
2094
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, h = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, g = 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: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 },
|
|
2095
|
-
return
|
|
2096
|
-
},
|
|
2097
|
-
return new
|
|
2098
|
-
}, u = function(
|
|
2099
|
-
return i.p(
|
|
2100
|
-
},
|
|
2101
|
-
return
|
|
2102
|
-
},
|
|
2103
|
-
return
|
|
2104
|
-
}, T = function(
|
|
2105
|
-
return Math.abs(
|
|
2106
|
-
}, b = function(
|
|
2107
|
-
return
|
|
2108
|
-
},
|
|
2109
|
-
function
|
|
2114
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, h = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, g = 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: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(L) {
|
|
2115
|
+
return L instanceof w;
|
|
2116
|
+
}, p = function(L, E, v) {
|
|
2117
|
+
return new w(L, v, E.$l);
|
|
2118
|
+
}, u = function(L) {
|
|
2119
|
+
return i.p(L) + "s";
|
|
2120
|
+
}, y = function(L) {
|
|
2121
|
+
return L < 0;
|
|
2122
|
+
}, x = function(L) {
|
|
2123
|
+
return y(L) ? Math.ceil(L) : Math.floor(L);
|
|
2124
|
+
}, T = function(L) {
|
|
2125
|
+
return Math.abs(L);
|
|
2126
|
+
}, b = function(L, E) {
|
|
2127
|
+
return L ? y(L) ? { negative: !0, format: "" + T(L) + E } : { negative: !1, format: "" + L + E } : { negative: !1, format: "" };
|
|
2128
|
+
}, w = function() {
|
|
2129
|
+
function L(v, M, A) {
|
|
2110
2130
|
var _ = this;
|
|
2111
|
-
if (this.$d = {}, this.$l = A, v === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), M) return
|
|
2131
|
+
if (this.$d = {}, this.$l = A, v === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), M) return p(v * l[u(M)], this);
|
|
2112
2132
|
if (typeof v == "number") return this.$ms = v, this.parseFromMilliseconds(), this;
|
|
2113
2133
|
if (typeof v == "object") return Object.keys(v).forEach(function(W) {
|
|
2114
2134
|
_.$d[u(W)] = v[W];
|
|
@@ -2124,94 +2144,94 @@ var Mt = { exports: {} };
|
|
|
2124
2144
|
}
|
|
2125
2145
|
return this;
|
|
2126
2146
|
}
|
|
2127
|
-
var
|
|
2128
|
-
return
|
|
2147
|
+
var E = L.prototype;
|
|
2148
|
+
return E.calMilliseconds = function() {
|
|
2129
2149
|
var v = this;
|
|
2130
2150
|
this.$ms = Object.keys(this.$d).reduce(function(M, A) {
|
|
2131
2151
|
return M + (v.$d[A] || 0) * l[A];
|
|
2132
2152
|
}, 0);
|
|
2133
|
-
},
|
|
2153
|
+
}, E.parseFromMilliseconds = function() {
|
|
2134
2154
|
var v = this.$ms;
|
|
2135
|
-
this.$d.years =
|
|
2136
|
-
},
|
|
2155
|
+
this.$d.years = x(v / c), v %= c, this.$d.months = x(v / g), v %= g, this.$d.days = x(v / r), v %= r, this.$d.hours = x(v / o), v %= o, this.$d.minutes = x(v / n), v %= n, this.$d.seconds = x(v / s), v %= s, this.$d.milliseconds = v;
|
|
2156
|
+
}, E.toISOString = function() {
|
|
2137
2157
|
var v = b(this.$d.years, "Y"), M = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2138
2158
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
2139
2159
|
var _ = b(A, "D"), D = b(this.$d.hours, "H"), H = b(this.$d.minutes, "M"), W = this.$d.seconds || 0;
|
|
2140
2160
|
this.$d.milliseconds && (W += this.$d.milliseconds / 1e3, W = Math.round(1e3 * W) / 1e3);
|
|
2141
|
-
var
|
|
2161
|
+
var I = b(W, "S"), R = v.negative || M.negative || _.negative || D.negative || H.negative || I.negative, F = D.format || H.format || I.format ? "T" : "", z = (R ? "-" : "") + "P" + v.format + M.format + _.format + F + D.format + H.format + I.format;
|
|
2142
2162
|
return z === "P" || z === "-P" ? "P0D" : z;
|
|
2143
|
-
},
|
|
2163
|
+
}, E.toJSON = function() {
|
|
2144
2164
|
return this.toISOString();
|
|
2145
|
-
},
|
|
2165
|
+
}, E.format = function(v) {
|
|
2146
2166
|
var M = v || "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") };
|
|
2147
2167
|
return M.replace(h, function(_, D) {
|
|
2148
2168
|
return D || String(A[_]);
|
|
2149
2169
|
});
|
|
2150
|
-
},
|
|
2170
|
+
}, E.as = function(v) {
|
|
2151
2171
|
return this.$ms / l[u(v)];
|
|
2152
|
-
},
|
|
2172
|
+
}, E.get = function(v) {
|
|
2153
2173
|
var M = this.$ms, A = u(v);
|
|
2154
|
-
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ?
|
|
2155
|
-
},
|
|
2174
|
+
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ? x(M / l[A]) : this.$d[A], M || 0;
|
|
2175
|
+
}, E.add = function(v, M, A) {
|
|
2156
2176
|
var _;
|
|
2157
|
-
return _ = M ? v * l[u(M)] :
|
|
2158
|
-
},
|
|
2177
|
+
return _ = M ? v * l[u(M)] : m(v) ? v.$ms : p(v, this).$ms, p(this.$ms + _ * (A ? -1 : 1), this);
|
|
2178
|
+
}, E.subtract = function(v, M) {
|
|
2159
2179
|
return this.add(v, M, !0);
|
|
2160
|
-
},
|
|
2180
|
+
}, E.locale = function(v) {
|
|
2161
2181
|
var M = this.clone();
|
|
2162
2182
|
return M.$l = v, M;
|
|
2163
|
-
},
|
|
2164
|
-
return
|
|
2165
|
-
},
|
|
2183
|
+
}, E.clone = function() {
|
|
2184
|
+
return p(this.$ms, this);
|
|
2185
|
+
}, E.humanize = function(v) {
|
|
2166
2186
|
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!v);
|
|
2167
|
-
},
|
|
2187
|
+
}, E.valueOf = function() {
|
|
2168
2188
|
return this.asMilliseconds();
|
|
2169
|
-
},
|
|
2189
|
+
}, E.milliseconds = function() {
|
|
2170
2190
|
return this.get("milliseconds");
|
|
2171
|
-
},
|
|
2191
|
+
}, E.asMilliseconds = function() {
|
|
2172
2192
|
return this.as("milliseconds");
|
|
2173
|
-
},
|
|
2193
|
+
}, E.seconds = function() {
|
|
2174
2194
|
return this.get("seconds");
|
|
2175
|
-
},
|
|
2195
|
+
}, E.asSeconds = function() {
|
|
2176
2196
|
return this.as("seconds");
|
|
2177
|
-
},
|
|
2197
|
+
}, E.minutes = function() {
|
|
2178
2198
|
return this.get("minutes");
|
|
2179
|
-
},
|
|
2199
|
+
}, E.asMinutes = function() {
|
|
2180
2200
|
return this.as("minutes");
|
|
2181
|
-
},
|
|
2201
|
+
}, E.hours = function() {
|
|
2182
2202
|
return this.get("hours");
|
|
2183
|
-
},
|
|
2203
|
+
}, E.asHours = function() {
|
|
2184
2204
|
return this.as("hours");
|
|
2185
|
-
},
|
|
2205
|
+
}, E.days = function() {
|
|
2186
2206
|
return this.get("days");
|
|
2187
|
-
},
|
|
2207
|
+
}, E.asDays = function() {
|
|
2188
2208
|
return this.as("days");
|
|
2189
|
-
},
|
|
2209
|
+
}, E.weeks = function() {
|
|
2190
2210
|
return this.get("weeks");
|
|
2191
|
-
},
|
|
2211
|
+
}, E.asWeeks = function() {
|
|
2192
2212
|
return this.as("weeks");
|
|
2193
|
-
},
|
|
2213
|
+
}, E.months = function() {
|
|
2194
2214
|
return this.get("months");
|
|
2195
|
-
},
|
|
2215
|
+
}, E.asMonths = function() {
|
|
2196
2216
|
return this.as("months");
|
|
2197
|
-
},
|
|
2217
|
+
}, E.years = function() {
|
|
2198
2218
|
return this.get("years");
|
|
2199
|
-
},
|
|
2219
|
+
}, E.asYears = function() {
|
|
2200
2220
|
return this.as("years");
|
|
2201
|
-
},
|
|
2202
|
-
}(),
|
|
2203
|
-
return
|
|
2221
|
+
}, L;
|
|
2222
|
+
}(), C = function(L, E, v) {
|
|
2223
|
+
return L.add(E.years() * v, "y").add(E.months() * v, "M").add(E.days() * v, "d").add(E.hours() * v, "h").add(E.minutes() * v, "m").add(E.seconds() * v, "s").add(E.milliseconds() * v, "ms");
|
|
2204
2224
|
};
|
|
2205
|
-
return function(
|
|
2225
|
+
return function(L, E, v) {
|
|
2206
2226
|
e = v, i = v().$utils(), v.duration = function(_, D) {
|
|
2207
2227
|
var H = v.locale();
|
|
2208
|
-
return
|
|
2209
|
-
}, v.isDuration =
|
|
2210
|
-
var M =
|
|
2211
|
-
|
|
2212
|
-
return
|
|
2213
|
-
},
|
|
2214
|
-
return
|
|
2228
|
+
return p(_, { $l: H }, D);
|
|
2229
|
+
}, v.isDuration = m;
|
|
2230
|
+
var M = E.prototype.add, A = E.prototype.subtract;
|
|
2231
|
+
E.prototype.add = function(_, D) {
|
|
2232
|
+
return m(_) ? C(this, _, 1) : M.bind(this)(_, D);
|
|
2233
|
+
}, E.prototype.subtract = function(_, D) {
|
|
2234
|
+
return m(_) ? C(this, _, -1) : A.bind(this)(_, D);
|
|
2215
2235
|
};
|
|
2216
2236
|
};
|
|
2217
2237
|
});
|
|
@@ -2269,21 +2289,21 @@ var At = { exports: {} };
|
|
|
2269
2289
|
return function(e, i, s) {
|
|
2270
2290
|
var n = i.prototype, o = function(d) {
|
|
2271
2291
|
return d && (d.indexOf ? d : d.s);
|
|
2272
|
-
}, r = function(d, l,
|
|
2273
|
-
var
|
|
2274
|
-
return
|
|
2292
|
+
}, r = function(d, l, m, p, u) {
|
|
2293
|
+
var y = d.name ? d : d.$locale(), x = o(y[l]), T = o(y[m]), b = x || T.map(function(C) {
|
|
2294
|
+
return C.slice(0, p);
|
|
2275
2295
|
});
|
|
2276
2296
|
if (!u) return b;
|
|
2277
|
-
var
|
|
2278
|
-
return b.map(function(
|
|
2279
|
-
return b[(
|
|
2297
|
+
var w = y.weekStart;
|
|
2298
|
+
return b.map(function(C, L) {
|
|
2299
|
+
return b[(L + (w || 0)) % 7];
|
|
2280
2300
|
});
|
|
2281
2301
|
}, h = function() {
|
|
2282
2302
|
return s.Ls[s.locale()];
|
|
2283
2303
|
}, c = function(d, l) {
|
|
2284
|
-
return d.formats[l] || function(
|
|
2285
|
-
return
|
|
2286
|
-
return u ||
|
|
2304
|
+
return d.formats[l] || function(m) {
|
|
2305
|
+
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p, u, y) {
|
|
2306
|
+
return u || y.slice(1);
|
|
2287
2307
|
});
|
|
2288
2308
|
}(d.formats[l.toUpperCase()]);
|
|
2289
2309
|
}, g = function() {
|
|
@@ -2339,7 +2359,7 @@ var At = { exports: {} };
|
|
|
2339
2359
|
})(At);
|
|
2340
2360
|
var ce = At.exports;
|
|
2341
2361
|
const de = /* @__PURE__ */ U(ce);
|
|
2342
|
-
var
|
|
2362
|
+
var It = { exports: {} };
|
|
2343
2363
|
(function(f, t) {
|
|
2344
2364
|
(function(e, i) {
|
|
2345
2365
|
f.exports = i();
|
|
@@ -2354,17 +2374,17 @@ var Ht = { exports: {} };
|
|
|
2354
2374
|
var g = o(this).startOf(i).add(1, i).date(c), d = o(this).endOf(e);
|
|
2355
2375
|
if (g.isBefore(d)) return 1;
|
|
2356
2376
|
}
|
|
2357
|
-
var l = o(this).startOf(i).date(c).startOf(e).subtract(1, "millisecond"),
|
|
2358
|
-
return
|
|
2377
|
+
var l = o(this).startOf(i).date(c).startOf(e).subtract(1, "millisecond"), m = this.diff(l, e, !0);
|
|
2378
|
+
return m < 0 ? o(this).startOf("week").week() : Math.ceil(m);
|
|
2359
2379
|
}, r.weeks = function(h) {
|
|
2360
2380
|
return h === void 0 && (h = null), this.week(h);
|
|
2361
2381
|
};
|
|
2362
2382
|
};
|
|
2363
2383
|
});
|
|
2364
|
-
})(
|
|
2365
|
-
var ue =
|
|
2384
|
+
})(It);
|
|
2385
|
+
var ue = It.exports;
|
|
2366
2386
|
const ge = /* @__PURE__ */ U(ue);
|
|
2367
|
-
var
|
|
2387
|
+
var Ht = { exports: {} };
|
|
2368
2388
|
(function(f, t) {
|
|
2369
2389
|
(function(e, i) {
|
|
2370
2390
|
f.exports = i();
|
|
@@ -2376,8 +2396,8 @@ var It = { exports: {} };
|
|
|
2376
2396
|
};
|
|
2377
2397
|
};
|
|
2378
2398
|
});
|
|
2379
|
-
})(
|
|
2380
|
-
var fe =
|
|
2399
|
+
})(Ht);
|
|
2400
|
+
var fe = Ht.exports;
|
|
2381
2401
|
const pe = /* @__PURE__ */ U(fe);
|
|
2382
2402
|
var Gt = { exports: {} };
|
|
2383
2403
|
(function(f, t) {
|
|
@@ -2460,8 +2480,8 @@ var Wt = { exports: {} };
|
|
|
2460
2480
|
return o(this).year();
|
|
2461
2481
|
}, r.isoWeek = function(c) {
|
|
2462
2482
|
if (!this.$utils().u(c)) return this.add(7 * (c - this.isoWeek()), e);
|
|
2463
|
-
var g, d, l,
|
|
2464
|
-
return
|
|
2483
|
+
var g, d, l, m, p = o(this), u = (g = this.isoWeekYear(), d = this.$u, l = (d ? n.utc : n)().year(g).startOf("year"), m = 4 - l.isoWeekday(), l.isoWeekday() > 4 && (m += 7), l.add(m, e));
|
|
2484
|
+
return p.diff(u, "week") + 1;
|
|
2465
2485
|
}, r.isoWeekday = function(c) {
|
|
2466
2486
|
return this.$utils().u(c) ? this.day() || 7 : this.day(this.day() % 7 ? c : c - 7);
|
|
2467
2487
|
};
|
|
@@ -2482,52 +2502,52 @@ var $t = { exports: {} };
|
|
|
2482
2502
|
})(P, function() {
|
|
2483
2503
|
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, i = {};
|
|
2484
2504
|
return function(s, n, o) {
|
|
2485
|
-
var r, h = function(l,
|
|
2486
|
-
|
|
2487
|
-
var u = new Date(l),
|
|
2505
|
+
var r, h = function(l, m, p) {
|
|
2506
|
+
p === void 0 && (p = {});
|
|
2507
|
+
var u = new Date(l), y = function(x, T) {
|
|
2488
2508
|
T === void 0 && (T = {});
|
|
2489
|
-
var b = T.timeZoneName || "short",
|
|
2490
|
-
return
|
|
2491
|
-
}(
|
|
2492
|
-
return
|
|
2493
|
-
}, c = function(l,
|
|
2494
|
-
for (var
|
|
2495
|
-
var
|
|
2496
|
-
|
|
2509
|
+
var b = T.timeZoneName || "short", w = x + "|" + b, C = i[w];
|
|
2510
|
+
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;
|
|
2511
|
+
}(m, p);
|
|
2512
|
+
return y.formatToParts(u);
|
|
2513
|
+
}, c = function(l, m) {
|
|
2514
|
+
for (var p = h(l, m), u = [], y = 0; y < p.length; y += 1) {
|
|
2515
|
+
var x = p[y], T = x.type, b = x.value, w = e[T];
|
|
2516
|
+
w >= 0 && (u[w] = parseInt(b, 10));
|
|
2497
2517
|
}
|
|
2498
|
-
var
|
|
2499
|
-
return (o.utc(
|
|
2518
|
+
var C = u[3], L = C === 24 ? 0 : C, E = u[0] + "-" + u[1] + "-" + u[2] + " " + L + ":" + u[4] + ":" + u[5] + ":000", v = +l;
|
|
2519
|
+
return (o.utc(E).valueOf() - (v -= v % 1e3)) / 6e4;
|
|
2500
2520
|
}, g = n.prototype;
|
|
2501
|
-
g.tz = function(l,
|
|
2521
|
+
g.tz = function(l, m) {
|
|
2502
2522
|
l === void 0 && (l = r);
|
|
2503
|
-
var
|
|
2504
|
-
if (!Number(b))
|
|
2505
|
-
else if (
|
|
2506
|
-
var
|
|
2507
|
-
|
|
2523
|
+
var p, u = this.utcOffset(), y = this.toDate(), x = y.toLocaleString("en-US", { timeZone: l }), T = Math.round((y - new Date(x)) / 1e3 / 60), b = 15 * -Math.round(y.getTimezoneOffset() / 15) - T;
|
|
2524
|
+
if (!Number(b)) p = this.utcOffset(0, m);
|
|
2525
|
+
else if (p = o(x, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(b, !0), m) {
|
|
2526
|
+
var w = p.utcOffset();
|
|
2527
|
+
p = p.add(u - w, "minute");
|
|
2508
2528
|
}
|
|
2509
|
-
return
|
|
2529
|
+
return p.$x.$timezone = l, p;
|
|
2510
2530
|
}, g.offsetName = function(l) {
|
|
2511
|
-
var
|
|
2531
|
+
var m = this.$x.$timezone || o.tz.guess(), p = h(this.valueOf(), m, { timeZoneName: l }).find(function(u) {
|
|
2512
2532
|
return u.type.toLowerCase() === "timezonename";
|
|
2513
2533
|
});
|
|
2514
|
-
return
|
|
2534
|
+
return p && p.value;
|
|
2515
2535
|
};
|
|
2516
2536
|
var d = g.startOf;
|
|
2517
|
-
g.startOf = function(l,
|
|
2518
|
-
if (!this.$x || !this.$x.$timezone) return d.call(this, l,
|
|
2519
|
-
var
|
|
2520
|
-
return d.call(
|
|
2521
|
-
}, o.tz = function(l,
|
|
2522
|
-
var u =
|
|
2523
|
-
if (typeof l != "string") return o(l).tz(
|
|
2524
|
-
var T = function(
|
|
2525
|
-
var M =
|
|
2526
|
-
if (
|
|
2527
|
-
var _ = c(M -= 60 * (A -
|
|
2528
|
-
return A === _ ? [M, A] : [
|
|
2529
|
-
}(o.utc(l, u).valueOf(),
|
|
2530
|
-
return
|
|
2537
|
+
g.startOf = function(l, m) {
|
|
2538
|
+
if (!this.$x || !this.$x.$timezone) return d.call(this, l, m);
|
|
2539
|
+
var p = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
2540
|
+
return d.call(p, l, m).tz(this.$x.$timezone, !0);
|
|
2541
|
+
}, o.tz = function(l, m, p) {
|
|
2542
|
+
var u = p && m, y = p || m || r, x = c(+o(), y);
|
|
2543
|
+
if (typeof l != "string") return o(l).tz(y);
|
|
2544
|
+
var T = function(L, E, v) {
|
|
2545
|
+
var M = L - 60 * E * 1e3, A = c(M, v);
|
|
2546
|
+
if (E === A) return [M, E];
|
|
2547
|
+
var _ = c(M -= 60 * (A - E) * 1e3, v);
|
|
2548
|
+
return A === _ ? [M, A] : [L - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
2549
|
+
}(o.utc(l, u).valueOf(), x, y), b = T[0], w = T[1], C = o(b).utcOffset(w);
|
|
2550
|
+
return C.$x.$timezone = y, C;
|
|
2531
2551
|
}, o.tz.guess = function() {
|
|
2532
2552
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2533
2553
|
}, o.tz.setDefault = function(l) {
|
|
@@ -2547,11 +2567,11 @@ var Ft = { exports: {} };
|
|
|
2547
2567
|
return function(n, o, r) {
|
|
2548
2568
|
var h = o.prototype;
|
|
2549
2569
|
r.utc = function(u) {
|
|
2550
|
-
var
|
|
2551
|
-
return new o(
|
|
2570
|
+
var y = { date: u, utc: !0, args: arguments };
|
|
2571
|
+
return new o(y);
|
|
2552
2572
|
}, h.utc = function(u) {
|
|
2553
|
-
var
|
|
2554
|
-
return u ?
|
|
2573
|
+
var y = r(this.toDate(), { locale: this.$L, utc: !0 });
|
|
2574
|
+
return u ? y.add(this.utcOffset(), e) : y;
|
|
2555
2575
|
}, h.local = function() {
|
|
2556
2576
|
return r(this.toDate(), { locale: this.$L, utc: !1 });
|
|
2557
2577
|
};
|
|
@@ -2567,28 +2587,28 @@ var Ft = { exports: {} };
|
|
|
2567
2587
|
} else g.call(this);
|
|
2568
2588
|
};
|
|
2569
2589
|
var d = h.utcOffset;
|
|
2570
|
-
h.utcOffset = function(u,
|
|
2571
|
-
var
|
|
2572
|
-
if (
|
|
2573
|
-
if (typeof u == "string" && (u = function(
|
|
2574
|
-
|
|
2575
|
-
var
|
|
2576
|
-
if (!
|
|
2577
|
-
var
|
|
2590
|
+
h.utcOffset = function(u, y) {
|
|
2591
|
+
var x = this.$utils().u;
|
|
2592
|
+
if (x(u)) return this.$u ? 0 : x(this.$offset) ? d.call(this) : this.$offset;
|
|
2593
|
+
if (typeof u == "string" && (u = function(C) {
|
|
2594
|
+
C === void 0 && (C = "");
|
|
2595
|
+
var L = C.match(i);
|
|
2596
|
+
if (!L) return null;
|
|
2597
|
+
var E = ("" + L[0]).match(s) || ["-", 0, 0], v = E[0], M = 60 * +E[1] + +E[2];
|
|
2578
2598
|
return M === 0 ? 0 : v === "+" ? M : -M;
|
|
2579
2599
|
}(u), u === null)) return this;
|
|
2580
2600
|
var T = Math.abs(u) <= 16 ? 60 * u : u, b = this;
|
|
2581
|
-
if (
|
|
2601
|
+
if (y) return b.$offset = T, b.$u = u === 0, b;
|
|
2582
2602
|
if (u !== 0) {
|
|
2583
|
-
var
|
|
2584
|
-
(b = this.local().add(T +
|
|
2603
|
+
var w = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
2604
|
+
(b = this.local().add(T + w, e)).$offset = T, b.$x.$localOffset = w;
|
|
2585
2605
|
} else b = this.utc();
|
|
2586
2606
|
return b;
|
|
2587
2607
|
};
|
|
2588
2608
|
var l = h.format;
|
|
2589
2609
|
h.format = function(u) {
|
|
2590
|
-
var
|
|
2591
|
-
return l.call(this,
|
|
2610
|
+
var y = u || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
2611
|
+
return l.call(this, y);
|
|
2592
2612
|
}, h.valueOf = function() {
|
|
2593
2613
|
var u = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
2594
2614
|
return this.$d.valueOf() - 6e4 * u;
|
|
@@ -2599,22 +2619,22 @@ var Ft = { exports: {} };
|
|
|
2599
2619
|
}, h.toString = function() {
|
|
2600
2620
|
return this.toDate().toUTCString();
|
|
2601
2621
|
};
|
|
2602
|
-
var
|
|
2622
|
+
var m = h.toDate;
|
|
2603
2623
|
h.toDate = function(u) {
|
|
2604
|
-
return u === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() :
|
|
2624
|
+
return u === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
|
|
2605
2625
|
};
|
|
2606
|
-
var
|
|
2607
|
-
h.diff = function(u,
|
|
2608
|
-
if (u && this.$u === u.$u) return
|
|
2626
|
+
var p = h.diff;
|
|
2627
|
+
h.diff = function(u, y, x) {
|
|
2628
|
+
if (u && this.$u === u.$u) return p.call(this, u, y, x);
|
|
2609
2629
|
var T = this.local(), b = r(u).local();
|
|
2610
|
-
return
|
|
2630
|
+
return p.call(T, b, y, x);
|
|
2611
2631
|
};
|
|
2612
2632
|
};
|
|
2613
2633
|
});
|
|
2614
2634
|
})(Ft);
|
|
2615
2635
|
var ke = Ft.exports;
|
|
2616
|
-
const
|
|
2617
|
-
var
|
|
2636
|
+
const Ee = /* @__PURE__ */ U(ke);
|
|
2637
|
+
var Ce = { exports: {} };
|
|
2618
2638
|
(function(f, t) {
|
|
2619
2639
|
(function(e, i) {
|
|
2620
2640
|
f.exports = i();
|
|
@@ -2624,11 +2644,11 @@ var Le = { exports: {} };
|
|
|
2624
2644
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
2625
2645
|
} };
|
|
2626
2646
|
});
|
|
2627
|
-
})(
|
|
2628
|
-
var
|
|
2647
|
+
})(Ce);
|
|
2648
|
+
var Le = { exports: {} };
|
|
2629
2649
|
(function(f, t) {
|
|
2630
2650
|
(function(e, i) {
|
|
2631
|
-
f.exports = i(
|
|
2651
|
+
f.exports = i(G);
|
|
2632
2652
|
})(P, function(e) {
|
|
2633
2653
|
function i(o) {
|
|
2634
2654
|
return o && typeof o == "object" && "default" in o ? o : { default: o };
|
|
@@ -2641,37 +2661,37 @@ var Ee = { exports: {} };
|
|
|
2641
2661
|
} };
|
|
2642
2662
|
return s.default.locale(n, null, !0), n;
|
|
2643
2663
|
});
|
|
2644
|
-
})(
|
|
2664
|
+
})(Le);
|
|
2645
2665
|
const Me = (f, t) => {
|
|
2646
2666
|
const e = t.prototype;
|
|
2647
2667
|
e.setLocale = function(s) {
|
|
2648
|
-
return this.$locale = s ||
|
|
2668
|
+
return this.$locale = s || G().locale(), this.$L = this.$locale, this;
|
|
2649
2669
|
};
|
|
2650
2670
|
const i = e.format;
|
|
2651
2671
|
e.format = function(s) {
|
|
2652
|
-
return this.$L =
|
|
2672
|
+
return this.$L = G().locale(), i.bind(this)(s);
|
|
2653
2673
|
};
|
|
2654
2674
|
};
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2675
|
+
G.extend(se);
|
|
2676
|
+
G.extend(oe);
|
|
2677
|
+
G.extend(ae);
|
|
2678
|
+
G.extend(le);
|
|
2679
|
+
G.extend(ge);
|
|
2680
|
+
G.extend(de);
|
|
2681
|
+
G.extend(pe);
|
|
2682
|
+
G.extend(xe);
|
|
2683
|
+
G.extend(we);
|
|
2684
|
+
G.extend(Te);
|
|
2685
|
+
G.extend(Se);
|
|
2686
|
+
G.extend(Ee);
|
|
2687
|
+
G.extend(Me);
|
|
2668
2688
|
function vt(f) {
|
|
2669
2689
|
try {
|
|
2670
|
-
if (
|
|
2671
|
-
if (
|
|
2690
|
+
if (G.locale() === f) return;
|
|
2691
|
+
if (G.locale(f) !== f) throw Error();
|
|
2672
2692
|
O.info(`Locale set to ${f}`);
|
|
2673
2693
|
} catch {
|
|
2674
|
-
O.warn(`Failed to set locale ${f}, fallback to en`),
|
|
2694
|
+
O.warn(`Failed to set locale ${f}, fallback to en`), G.locale("en");
|
|
2675
2695
|
}
|
|
2676
2696
|
}
|
|
2677
2697
|
const ut = () => ({
|
|
@@ -2699,10 +2719,10 @@ const ut = () => ({
|
|
|
2699
2719
|
});
|
|
2700
2720
|
class Oe {
|
|
2701
2721
|
constructor() {
|
|
2702
|
-
a(this, "startTime",
|
|
2703
|
-
a(this, "endTime",
|
|
2722
|
+
a(this, "startTime", G().startOf("day"));
|
|
2723
|
+
a(this, "endTime", G().endOf("day"));
|
|
2704
2724
|
/** 结束的标准时间。切换单位会影响结尾的扩展,需要单独记录一个标准时间 */
|
|
2705
|
-
a(this, "targetEnd",
|
|
2725
|
+
a(this, "targetEnd", G().endOf("day"));
|
|
2706
2726
|
/** 固定起始日期 */
|
|
2707
2727
|
a(this, "strictStart", !1);
|
|
2708
2728
|
/** 固定截止日期 */
|
|
@@ -2781,15 +2801,15 @@ class Oe {
|
|
|
2781
2801
|
month: "month",
|
|
2782
2802
|
quarter: "quarter"
|
|
2783
2803
|
}[i];
|
|
2784
|
-
n || O.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime =
|
|
2804
|
+
n || O.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime = G(s.startTime).startOf(this.getFinelyUnit()), this.strictStart = !0), s.endTime && (this.endTime = G(s.endTime).endOf(this.getFinelyUnit()), this.strictEnd = !0), s.cellWidth && (Ut(s.cellWidth) ? this.cellWidth = {
|
|
2785
2805
|
hour: s.cellWidth,
|
|
2786
2806
|
day: s.cellWidth,
|
|
2787
2807
|
week: s.cellWidth,
|
|
2788
2808
|
month: s.cellWidth,
|
|
2789
2809
|
quarter: s.cellWidth
|
|
2790
|
-
} :
|
|
2810
|
+
} : K(s.cellWidth) ? this.cellWidth = Z(
|
|
2791
2811
|
ut()[s.cellWidth] || ut().normal
|
|
2792
|
-
) :
|
|
2812
|
+
) : Et(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2793
2813
|
}
|
|
2794
2814
|
update(t) {
|
|
2795
2815
|
this.init(t, !1), this.endTime = this.targetEnd.clone();
|
|
@@ -2867,7 +2887,7 @@ class Oe {
|
|
|
2867
2887
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2868
2888
|
if (i) return i;
|
|
2869
2889
|
}
|
|
2870
|
-
if (
|
|
2890
|
+
if (K(this.headerGroupFormat))
|
|
2871
2891
|
return t.format(this.headerGroupFormat);
|
|
2872
2892
|
switch (this.getGroupUnit()) {
|
|
2873
2893
|
case "month":
|
|
@@ -2887,7 +2907,7 @@ class Oe {
|
|
|
2887
2907
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2888
2908
|
if (i) return i;
|
|
2889
2909
|
}
|
|
2890
|
-
if (
|
|
2910
|
+
if (K(this.headerCellFormat))
|
|
2891
2911
|
return t.format(this.headerCellFormat);
|
|
2892
2912
|
switch (this.getChildUnit()) {
|
|
2893
2913
|
case "hour":
|
|
@@ -2936,7 +2956,7 @@ class De {
|
|
|
2936
2956
|
const i = yt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2937
2957
|
if (s && !X(s))
|
|
2938
2958
|
throw O.exception("Data should be a array.");
|
|
2939
|
-
this.optionManager = new
|
|
2959
|
+
this.optionManager = new Vt(), this.optionManager.setOptions(i), i.locale && vt(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 Jt(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);
|
|
2940
2960
|
}
|
|
2941
2961
|
getOptionManager() {
|
|
2942
2962
|
return this.optionManager;
|
|
@@ -3171,7 +3191,7 @@ class _e {
|
|
|
3171
3191
|
}
|
|
3172
3192
|
// --- 事件处理 ---
|
|
3173
3193
|
emit(t, e, i) {
|
|
3174
|
-
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(
|
|
3194
|
+
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(k.SCROLL, {
|
|
3175
3195
|
x: this.scrollLeft,
|
|
3176
3196
|
y: this.scrollTop,
|
|
3177
3197
|
source: t
|
|
@@ -3225,8 +3245,8 @@ class _e {
|
|
|
3225
3245
|
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";
|
|
3226
3246
|
const s = 150, n = (o) => {
|
|
3227
3247
|
if (!this.isAnimating) return;
|
|
3228
|
-
const r = o - this.animationStartTime, h = Math.min(1, r / s), c = h * (2 - h), g = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * c, d = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * c, l = this.scrollLeft !== g,
|
|
3229
|
-
(l ||
|
|
3248
|
+
const r = o - this.animationStartTime, h = Math.min(1, r / s), c = h * (2 - h), g = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * c, d = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * c, l = this.scrollLeft !== g, m = this.scrollTop !== d;
|
|
3249
|
+
(l || m) && this.emit("wheel", g, d), h < 1 ? this.animationFrameId = requestAnimationFrame(n) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && this.emit("wheel", this.animationTargetScrollLeft, this.animationTargetScrollTop), this.scheduleHide());
|
|
3230
3250
|
};
|
|
3231
3251
|
this.animationFrameId = requestAnimationFrame(n);
|
|
3232
3252
|
}
|
|
@@ -3445,7 +3465,7 @@ class st {
|
|
|
3445
3465
|
const t = document.createElement("div");
|
|
3446
3466
|
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", t.style.whiteSpace = "nowrap", t.style.display = "inline-flex", t.style.flex = "1", t.style.height = "100%", this.context.getOptions().selection.enabled) {
|
|
3447
3467
|
const e = document.createElement("div");
|
|
3448
|
-
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new
|
|
3468
|
+
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new Lt(this.context, e, this.task), t.appendChild(e);
|
|
3449
3469
|
}
|
|
3450
3470
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
3451
3471
|
const e = document.createElement("div");
|
|
@@ -3501,28 +3521,28 @@ class St {
|
|
|
3501
3521
|
*/
|
|
3502
3522
|
bindEvents() {
|
|
3503
3523
|
this.element.addEventListener("mouseenter", () => {
|
|
3504
|
-
this.context.event.emit(
|
|
3524
|
+
this.context.event.emit(k.ROW_HIGHLIGHT, this.task.id);
|
|
3505
3525
|
}), this.element.addEventListener("mouseleave", () => {
|
|
3506
|
-
this.context.event.emit(
|
|
3526
|
+
this.context.event.emit(k.ROW_UNHIGHLIGHT, this.task.id);
|
|
3507
3527
|
}), this.element.addEventListener("click", (t) => {
|
|
3508
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3528
|
+
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(k.ROW_CLICK, t, this.task));
|
|
3509
3529
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
3510
|
-
this.context.event.emit(
|
|
3530
|
+
this.context.event.emit(k.ROW_DBL_CLICK, t, this.task);
|
|
3511
3531
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
3512
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3532
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(k.ROW_CONTEXTMENU, t, this.task);
|
|
3513
3533
|
});
|
|
3514
3534
|
}
|
|
3515
3535
|
/**
|
|
3516
3536
|
* 注册全局接收事件
|
|
3517
3537
|
*/
|
|
3518
3538
|
registerEvents() {
|
|
3519
|
-
this.context.event.on(
|
|
3539
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
3520
3540
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
3521
|
-
}), this.context.event.on(
|
|
3541
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
3522
3542
|
this.task.id === t && this.element.classList.remove("hover");
|
|
3523
|
-
}), this.context.event.on(
|
|
3543
|
+
}), this.context.event.on(k.TASK_SELECTED, (t) => {
|
|
3524
3544
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
3525
|
-
}), this.context.event.on(
|
|
3545
|
+
}), this.context.event.on(k.TASK_UNSELECTED, (t) => {
|
|
3526
3546
|
this.task.id === t && this.element.classList.remove("selected");
|
|
3527
3547
|
});
|
|
3528
3548
|
}
|
|
@@ -3608,10 +3628,10 @@ class St {
|
|
|
3608
3628
|
);
|
|
3609
3629
|
if (g && (typeof g.col != "number" ? O.error("colspan function must returned a number") : h = g.col, typeof g.row != "number" ? O.error("rowspan function must returned a number") : c = g.row), h > 1 || c > 1) {
|
|
3610
3630
|
if (c > 1)
|
|
3611
|
-
for (let
|
|
3612
|
-
const u = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex +
|
|
3631
|
+
for (let p = 1; p < c; p++) {
|
|
3632
|
+
const u = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + p];
|
|
3613
3633
|
if (u && this.task.level !== u.level) {
|
|
3614
|
-
c =
|
|
3634
|
+
c = p;
|
|
3615
3635
|
break;
|
|
3616
3636
|
}
|
|
3617
3637
|
}
|
|
@@ -3621,15 +3641,15 @@ class St {
|
|
|
3621
3641
|
colspan: h,
|
|
3622
3642
|
rowspan: c
|
|
3623
3643
|
};
|
|
3624
|
-
let
|
|
3625
|
-
for (let
|
|
3626
|
-
if (
|
|
3644
|
+
let m = this.task;
|
|
3645
|
+
for (let p = c; p > 0; p--)
|
|
3646
|
+
if (m) {
|
|
3627
3647
|
for (let u = 0; u < h; u++)
|
|
3628
|
-
this.context.store.getColumnManager().addMergeInfo(
|
|
3629
|
-
|
|
3648
|
+
this.context.store.getColumnManager().addMergeInfo(m.id, u + n, l);
|
|
3649
|
+
m = this.context.store.getDataManager().getVisibleTasks().at(m.flatIndex + 1);
|
|
3630
3650
|
}
|
|
3631
|
-
for (let
|
|
3632
|
-
this.context.store.getColumnManager().addMergeInfo(this.task.id,
|
|
3651
|
+
for (let p = 0; p < h; p++)
|
|
3652
|
+
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, l);
|
|
3633
3653
|
}
|
|
3634
3654
|
const d = new st(
|
|
3635
3655
|
this.context,
|
|
@@ -3793,16 +3813,16 @@ class pt {
|
|
|
3793
3813
|
const o = (c) => {
|
|
3794
3814
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3795
3815
|
const g = (l) => r(l), d = (l) => h(l, g, d);
|
|
3796
|
-
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(
|
|
3816
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(k.SHOW_GUIDELINE, n);
|
|
3797
3817
|
}, r = (c) => {
|
|
3798
3818
|
if (c.preventDefault(), !s) return;
|
|
3799
|
-
const g = c.clientX - e, d = i + g, l = Math.max(50, d),
|
|
3800
|
-
let
|
|
3801
|
-
|
|
3819
|
+
const g = c.clientX - e, d = i + g, l = Math.max(50, d), m = e - s.left - i, u = this.root.clientWidth - 20;
|
|
3820
|
+
let y = m + l;
|
|
3821
|
+
y = Math.min(u, y), this.context.event.emit(k.MOVE_GUIDELINE, y);
|
|
3802
3822
|
}, h = (c, g, d) => {
|
|
3803
|
-
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(
|
|
3804
|
-
const l = c.clientX - e,
|
|
3805
|
-
this.setWidth(
|
|
3823
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(k.HIDE_GUIDELINE);
|
|
3824
|
+
const l = c.clientX - e, m = Math.max(50, i + l);
|
|
3825
|
+
this.setWidth(m);
|
|
3806
3826
|
};
|
|
3807
3827
|
t.addEventListener("mousedown", o);
|
|
3808
3828
|
}
|
|
@@ -3851,7 +3871,7 @@ class xt {
|
|
|
3851
3871
|
});
|
|
3852
3872
|
}
|
|
3853
3873
|
}
|
|
3854
|
-
class
|
|
3874
|
+
class Ie {
|
|
3855
3875
|
constructor(t, e) {
|
|
3856
3876
|
a(this, "headerElement");
|
|
3857
3877
|
a(this, "headerColumns", []);
|
|
@@ -3911,12 +3931,12 @@ class He {
|
|
|
3911
3931
|
});
|
|
3912
3932
|
}
|
|
3913
3933
|
}
|
|
3914
|
-
class
|
|
3934
|
+
class He {
|
|
3915
3935
|
constructor(t, e) {
|
|
3916
3936
|
a(this, "tableContainer");
|
|
3917
3937
|
a(this, "tableHeader");
|
|
3918
3938
|
a(this, "tableBody");
|
|
3919
|
-
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
|
|
3939
|
+
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 Ie(t, this.tableContainer), this.tableBody = new Ae(t, this.tableContainer), this.listenEvents();
|
|
3920
3940
|
}
|
|
3921
3941
|
render(t, e) {
|
|
3922
3942
|
this.tableHeader.render(), this.refresh(t, e);
|
|
@@ -3931,9 +3951,9 @@ class Ie {
|
|
|
3931
3951
|
this.tableBody.updateTask(t);
|
|
3932
3952
|
}
|
|
3933
3953
|
listenEvents() {
|
|
3934
|
-
this.context.event.on(
|
|
3954
|
+
this.context.event.on(k.UPDATE_TABLE_HEADER, () => {
|
|
3935
3955
|
this.tableHeader.render();
|
|
3936
|
-
}), this.context.event.on(
|
|
3956
|
+
}), this.context.event.on(k.UPDATE_TABLE_BODY, () => {
|
|
3937
3957
|
this.tableBody.update();
|
|
3938
3958
|
});
|
|
3939
3959
|
}
|
|
@@ -3973,11 +3993,11 @@ class Ge {
|
|
|
3973
3993
|
* 注册事件监听
|
|
3974
3994
|
*/
|
|
3975
3995
|
registerEvents() {
|
|
3976
|
-
this.context.event.on(
|
|
3996
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
3977
3997
|
this.highlightDate(t);
|
|
3978
|
-
}), this.context.event.on(
|
|
3998
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
3979
3999
|
this.unhighlightDate(t);
|
|
3980
|
-
}), this.context.event.on(
|
|
4000
|
+
}), this.context.event.on(k.UPDATE_TASK, (t) => {
|
|
3981
4001
|
this.highlightDate(t.id);
|
|
3982
4002
|
});
|
|
3983
4003
|
}
|
|
@@ -4017,7 +4037,7 @@ class Ge {
|
|
|
4017
4037
|
}
|
|
4018
4038
|
if (h > s)
|
|
4019
4039
|
break;
|
|
4020
|
-
const
|
|
4040
|
+
const p = this.createCell(
|
|
4021
4041
|
`group-${d.date.format("YYYY-MM-DD")}`,
|
|
4022
4042
|
h,
|
|
4023
4043
|
0,
|
|
@@ -4026,18 +4046,18 @@ class Ge {
|
|
|
4026
4046
|
o,
|
|
4027
4047
|
d.label
|
|
4028
4048
|
);
|
|
4029
|
-
if (this.groupHeader.add(
|
|
4049
|
+
if (this.groupHeader.add(p), X(d.children) && d.children.length > 0) {
|
|
4030
4050
|
let u = h;
|
|
4031
|
-
for (let
|
|
4032
|
-
const
|
|
4051
|
+
for (let y = 0; y < d.children.length; ) {
|
|
4052
|
+
const x = d.children[y];
|
|
4033
4053
|
let T = 1;
|
|
4034
|
-
for (; d.children[
|
|
4054
|
+
for (; d.children[y + T] && x.label === d.children[y + T].label; )
|
|
4035
4055
|
T++;
|
|
4036
|
-
if (
|
|
4037
|
-
let
|
|
4038
|
-
for (; r[g + 1].children[
|
|
4039
|
-
r[g + 1].children[
|
|
4040
|
-
|
|
4056
|
+
if (y += T, y >= d.children.length && r[g + 1] && r[g + 1].children) {
|
|
4057
|
+
let L = 0;
|
|
4058
|
+
for (; r[g + 1].children[L] && x.label === r[g + 1].children[L].label; )
|
|
4059
|
+
r[g + 1].children[L].hide = !0, L++;
|
|
4060
|
+
L > 0 && (T += L);
|
|
4041
4061
|
}
|
|
4042
4062
|
const b = e * T;
|
|
4043
4063
|
if (u + b < i) {
|
|
@@ -4046,16 +4066,16 @@ class Ge {
|
|
|
4046
4066
|
}
|
|
4047
4067
|
if (u > s)
|
|
4048
4068
|
break;
|
|
4049
|
-
const
|
|
4050
|
-
`cell-${
|
|
4069
|
+
const C = this.createCell(
|
|
4070
|
+
`cell-${x.date.format("YYYY-MM-DD")}`,
|
|
4051
4071
|
u,
|
|
4052
4072
|
n,
|
|
4053
4073
|
b,
|
|
4054
4074
|
n,
|
|
4055
|
-
|
|
4056
|
-
|
|
4075
|
+
x.hide ? "transparent" : o,
|
|
4076
|
+
x.hide ? "" : x.label
|
|
4057
4077
|
);
|
|
4058
|
-
this.cellHeader.add(
|
|
4078
|
+
this.cellHeader.add(C), x.hide && C.visible(!1), u += b;
|
|
4059
4079
|
}
|
|
4060
4080
|
}
|
|
4061
4081
|
h += l;
|
|
@@ -4210,22 +4230,22 @@ class Re {
|
|
|
4210
4230
|
);
|
|
4211
4231
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
4212
4232
|
for (let d = r; d <= h; d++) {
|
|
4213
|
-
const l = d * i,
|
|
4233
|
+
const l = d * i, m = new S.Line({
|
|
4214
4234
|
points: [l, t, l, o + t],
|
|
4215
4235
|
stroke: this.context.getOptions().border.color,
|
|
4216
4236
|
strokeWidth: 0.5,
|
|
4217
4237
|
name: "vertical-grid-line"
|
|
4218
4238
|
});
|
|
4219
|
-
this.verticalLines.add(
|
|
4239
|
+
this.verticalLines.add(m);
|
|
4220
4240
|
}
|
|
4221
4241
|
for (let d = c; d <= g; d++) {
|
|
4222
|
-
const l = d * s + t,
|
|
4242
|
+
const l = d * s + t, m = new S.Line({
|
|
4223
4243
|
points: [0, l, Math.max(this.width, e), l],
|
|
4224
4244
|
stroke: this.context.getOptions().border.color,
|
|
4225
4245
|
strokeWidth: 0.5,
|
|
4226
4246
|
name: "horizontal-grid-line"
|
|
4227
4247
|
});
|
|
4228
|
-
this.horizontalLines.add(
|
|
4248
|
+
this.horizontalLines.add(m);
|
|
4229
4249
|
}
|
|
4230
4250
|
}
|
|
4231
4251
|
/**
|
|
@@ -4283,12 +4303,12 @@ class We {
|
|
|
4283
4303
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
4284
4304
|
}
|
|
4285
4305
|
registerEvents() {
|
|
4286
|
-
this.context.event.on(
|
|
4306
|
+
this.context.event.on(k.SLIDER_BLINK, (t) => {
|
|
4287
4307
|
t === this.task.id && this.handleBarBlink();
|
|
4288
4308
|
});
|
|
4289
4309
|
}
|
|
4290
4310
|
render() {
|
|
4291
|
-
var
|
|
4311
|
+
var p, u, y, x, T, b, w, C, L, E, v, M, A;
|
|
4292
4312
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4293
4313
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4294
4314
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
@@ -4304,7 +4324,7 @@ class We {
|
|
|
4304
4324
|
dragBoundFunc: (_) => {
|
|
4305
4325
|
let D = Math.min(0, -(-this.offsetX - this.slider.x()));
|
|
4306
4326
|
const H = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime);
|
|
4307
|
-
let W = this.
|
|
4327
|
+
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(H - (-this.offsetX + this.sliderGroup.getStage().width()));
|
|
4308
4328
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
4309
4329
|
if (this.task.parent.startTime) {
|
|
4310
4330
|
const R = this.task.parent.startTime;
|
|
@@ -4321,24 +4341,26 @@ class We {
|
|
|
4321
4341
|
};
|
|
4322
4342
|
}
|
|
4323
4343
|
})), this.slider.position({ x: s, y: i }), this.slider.size({ width: o, height: e });
|
|
4324
|
-
const
|
|
4325
|
-
if (this.slider.draggable(
|
|
4326
|
-
|
|
4344
|
+
const m = !!this.unpackFunc(this.context.getOptions().bar.move.enabled) && (this.task.isSummary() ? this.context.getOptions().summary.move.enabled : !0);
|
|
4345
|
+
if (this.slider.draggable(m), this.slider.on("mouseover", (_) => {
|
|
4346
|
+
m && !this.isDragging && (_.target.getStage().container().style.cursor = "grab"), this.handleBarHighlight({
|
|
4327
4347
|
shadowColor: B(c).alpha(B(c).alpha() + 0.1).toHex(),
|
|
4328
4348
|
shadowBlur: Math.max((g || 1) * 2, 4),
|
|
4329
4349
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4330
4350
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4331
|
-
}), this.context.event.emit(
|
|
4351
|
+
}), this.context.event.emit(k.SLIDER_ENTER, _.evt, this.task);
|
|
4352
|
+
}), this.slider.on("mousemove", (_) => {
|
|
4353
|
+
this.context.event.emit(k.SLIDER_HOVER, _.evt, this.task);
|
|
4332
4354
|
}), this.slider.on("mouseout", (_) => {
|
|
4333
|
-
|
|
4355
|
+
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4334
4356
|
shadowColor: c,
|
|
4335
4357
|
shadowBlur: g,
|
|
4336
4358
|
shadowOffsetX: d,
|
|
4337
4359
|
shadowOffsetY: l
|
|
4338
|
-
}), this.context.event.emit(
|
|
4360
|
+
}), this.context.event.emit(k.SLIDER_LEAVE, _.evt, this.task);
|
|
4339
4361
|
}), this.task.isMilestone()) {
|
|
4340
4362
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4341
|
-
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),
|
|
4363
|
+
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), R = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
4342
4364
|
if (!this.sliderBar) {
|
|
4343
4365
|
switch (R) {
|
|
4344
4366
|
case "triangle":
|
|
@@ -4348,7 +4370,7 @@ class We {
|
|
|
4348
4370
|
rotation: 0,
|
|
4349
4371
|
fill: H,
|
|
4350
4372
|
stroke: W,
|
|
4351
|
-
strokeWidth:
|
|
4373
|
+
strokeWidth: I,
|
|
4352
4374
|
y: D / 3 * 2
|
|
4353
4375
|
// 居中
|
|
4354
4376
|
});
|
|
@@ -4358,7 +4380,7 @@ class We {
|
|
|
4358
4380
|
radius: D,
|
|
4359
4381
|
fill: H,
|
|
4360
4382
|
stroke: W,
|
|
4361
|
-
strokeWidth:
|
|
4383
|
+
strokeWidth: I,
|
|
4362
4384
|
y: D / 2
|
|
4363
4385
|
// 居中
|
|
4364
4386
|
});
|
|
@@ -4370,7 +4392,7 @@ class We {
|
|
|
4370
4392
|
outerRadius: D,
|
|
4371
4393
|
fill: H,
|
|
4372
4394
|
stroke: W,
|
|
4373
|
-
strokeWidth:
|
|
4395
|
+
strokeWidth: I,
|
|
4374
4396
|
y: D / 2
|
|
4375
4397
|
// 居中
|
|
4376
4398
|
});
|
|
@@ -4383,7 +4405,7 @@ class We {
|
|
|
4383
4405
|
rotation: 0,
|
|
4384
4406
|
fill: H,
|
|
4385
4407
|
stroke: W,
|
|
4386
|
-
strokeWidth:
|
|
4408
|
+
strokeWidth: I,
|
|
4387
4409
|
y: D / 2
|
|
4388
4410
|
// 居中
|
|
4389
4411
|
});
|
|
@@ -4397,34 +4419,34 @@ class We {
|
|
|
4397
4419
|
fontFamily: zt
|
|
4398
4420
|
}), at = it.measureSize(F);
|
|
4399
4421
|
it.width(at.width);
|
|
4400
|
-
const
|
|
4422
|
+
const V = { x: 0, y: 0 };
|
|
4401
4423
|
switch (z) {
|
|
4402
4424
|
case "top-left":
|
|
4403
|
-
|
|
4425
|
+
V.x = -(12 + at.width), V.y = -8;
|
|
4404
4426
|
break;
|
|
4405
4427
|
case "bottom-left":
|
|
4406
|
-
|
|
4428
|
+
V.x = -(12 + at.width), V.y = 10;
|
|
4407
4429
|
break;
|
|
4408
4430
|
case "bottom-right":
|
|
4409
|
-
|
|
4431
|
+
V.x = 12, V.y = 10;
|
|
4410
4432
|
break;
|
|
4411
4433
|
case "top-right":
|
|
4412
4434
|
default:
|
|
4413
|
-
|
|
4435
|
+
V.x = 12, V.y = -8;
|
|
4414
4436
|
break;
|
|
4415
4437
|
}
|
|
4416
|
-
it.setAttrs(
|
|
4438
|
+
it.setAttrs(V), this.slider.add(it);
|
|
4417
4439
|
}
|
|
4418
4440
|
}
|
|
4419
4441
|
this.sliderType = "milestone";
|
|
4420
4442
|
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
4421
4443
|
this.sliderBar && this.sliderType !== "summary" && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4422
|
-
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2, H = t * 0.3, W = (
|
|
4444
|
+
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2, H = t * 0.3, W = (I) => new S.Shape({
|
|
4423
4445
|
sceneFunc: (R, F) => {
|
|
4424
4446
|
const z = H * 0.5;
|
|
4425
|
-
R.beginPath(), R.moveTo(0, (t - D) / 2), R.lineTo(z, (t - D) / 2), R.lineTo(z, (t - D) / 2 + D), R.lineTo(0, (t - D) / 2 + D + H), R.lineTo(0, (t - D) / 2), R.rect(z, (t - D) / 2,
|
|
4447
|
+
R.beginPath(), R.moveTo(0, (t - D) / 2), R.lineTo(z, (t - D) / 2), R.lineTo(z, (t - D) / 2 + D), R.lineTo(0, (t - D) / 2 + D + H), R.lineTo(0, (t - D) / 2), R.rect(z, (t - D) / 2, I - 2 * z, D), R.moveTo(I - z, (t - D) / 2), R.lineTo(I, (t - D) / 2), R.lineTo(I, (t - D) / 2 + D + H), R.lineTo(I - z, (t - D) / 2 + D), R.lineTo(I - z, (t - D) / 2), R.fillStrokeShape(F);
|
|
4426
4448
|
},
|
|
4427
|
-
width:
|
|
4449
|
+
width: I,
|
|
4428
4450
|
fill: _,
|
|
4429
4451
|
shadowColor: c,
|
|
4430
4452
|
shadowBlur: g,
|
|
@@ -4449,7 +4471,7 @@ class We {
|
|
|
4449
4471
|
fill: r,
|
|
4450
4472
|
cornerRadius: h
|
|
4451
4473
|
}), this.renderProgress(o, e);
|
|
4452
|
-
const _ = (
|
|
4474
|
+
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (u = this.context.getOptions().bar.move.single) == null ? void 0 : u.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(((T = this.context.getOptions().bar.move.single) == null ? void 0 : T.opacity) ?? 1).toHex();
|
|
4453
4475
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
4454
4476
|
if (!this.leftHandleGroup) {
|
|
4455
4477
|
this.leftHandleGroup = new S.Group({
|
|
@@ -4481,19 +4503,19 @@ class We {
|
|
|
4481
4503
|
(q = this.leftHandleGroup) == null || q.add(z);
|
|
4482
4504
|
});
|
|
4483
4505
|
}
|
|
4484
|
-
(
|
|
4506
|
+
(w = this.leftHandleGroup.findOne("Rect")) == null || w.setAttrs({
|
|
4485
4507
|
width: this.handlerWidth,
|
|
4486
4508
|
height: e,
|
|
4487
4509
|
fill: H,
|
|
4488
4510
|
cornerRadius: [h[0], 0, 0, h[3]]
|
|
4489
|
-
}), (
|
|
4511
|
+
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
4490
4512
|
x: 0,
|
|
4491
4513
|
y: (e - this.handlerWidth) / 2,
|
|
4492
4514
|
width: this.handlerWidth,
|
|
4493
4515
|
height: this.handlerWidth
|
|
4494
4516
|
});
|
|
4495
4517
|
} else this.leftHandleGroup && (this.leftHandleGroup.remove(), this.leftHandleGroup = null);
|
|
4496
|
-
if (!!this.unpackFunc((
|
|
4518
|
+
if (!!this.unpackFunc((L = this.context.getOptions().bar.move.single) == null ? void 0 : L.right)) {
|
|
4497
4519
|
if (!this.rightHandleGroup) {
|
|
4498
4520
|
this.rightHandleGroup = new S.Group({
|
|
4499
4521
|
x: 0,
|
|
@@ -4524,7 +4546,7 @@ class We {
|
|
|
4524
4546
|
(q = this.rightHandleGroup) == null || q.add(z);
|
|
4525
4547
|
});
|
|
4526
4548
|
}
|
|
4527
|
-
(
|
|
4549
|
+
(E = this.rightHandleGroup.findOne("Rect")) == null || E.setAttrs({
|
|
4528
4550
|
x: o - this.handlerWidth,
|
|
4529
4551
|
width: this.handlerWidth,
|
|
4530
4552
|
height: e,
|
|
@@ -4578,7 +4600,7 @@ class We {
|
|
|
4578
4600
|
}
|
|
4579
4601
|
}
|
|
4580
4602
|
renderProgress(t, e) {
|
|
4581
|
-
var i, s, n, o, r, h, c, g, d, l,
|
|
4603
|
+
var i, s, n, o, r, h, c, g, d, l, m, p;
|
|
4582
4604
|
if (!this.unpackFunc((i = this.context.getOptions().bar.progress) == null ? void 0 : i.show)) {
|
|
4583
4605
|
this.progressGroup && (this.progressGroup.destroy(), this.progressGroup = null);
|
|
4584
4606
|
return;
|
|
@@ -4589,9 +4611,9 @@ class We {
|
|
|
4589
4611
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
4590
4612
|
);
|
|
4591
4613
|
if (u === 0) return;
|
|
4592
|
-
const
|
|
4614
|
+
const y = this.unpackFunc(
|
|
4593
4615
|
this.context.getOptions().bar.backgroundColor
|
|
4594
|
-
) || this.context.getOptions().primaryColor,
|
|
4616
|
+
) || 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(), T = ot(
|
|
4595
4617
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4596
4618
|
), b = ot(
|
|
4597
4619
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
@@ -4599,41 +4621,41 @@ class We {
|
|
|
4599
4621
|
// 默认 2
|
|
4600
4622
|
);
|
|
4601
4623
|
b[0] = T[0], b[3] = T[3], u === 1 && (b[1] = T[1], b[2] = T[2]);
|
|
4602
|
-
const
|
|
4603
|
-
this.progressGroup ? (this.progressGroup.width(
|
|
4624
|
+
const w = t * u;
|
|
4625
|
+
this.progressGroup ? (this.progressGroup.width(w), this.progressGroup.destroyChildren()) : (this.progressGroup = new S.Group({
|
|
4604
4626
|
x: 0,
|
|
4605
4627
|
y: 0,
|
|
4606
|
-
width:
|
|
4628
|
+
width: w,
|
|
4607
4629
|
height: e,
|
|
4608
4630
|
listening: !1
|
|
4609
4631
|
}), this.slider.add(this.progressGroup));
|
|
4610
|
-
const
|
|
4632
|
+
const C = new S.Rect({
|
|
4611
4633
|
x: 0,
|
|
4612
4634
|
y: 0,
|
|
4613
|
-
width:
|
|
4635
|
+
width: w,
|
|
4614
4636
|
height: e,
|
|
4615
|
-
fill:
|
|
4637
|
+
fill: x,
|
|
4616
4638
|
cornerRadius: b,
|
|
4617
4639
|
opacity: this.unpackFunc((h = this.context.getOptions().bar.progress) == null ? void 0 : h.opacity)
|
|
4618
4640
|
});
|
|
4619
|
-
this.progressGroup.add(
|
|
4620
|
-
const
|
|
4641
|
+
this.progressGroup.add(C);
|
|
4642
|
+
const L = `${gt(
|
|
4621
4643
|
u * 100,
|
|
4622
4644
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4623
|
-
)}%`,
|
|
4645
|
+
)}%`, E = new S.Text().measureSize(L).width, v = this.unpackFunc((g = this.context.getOptions().bar.progress) == null ? void 0 : g.textAlign), M = new S.Text({
|
|
4624
4646
|
x: 0,
|
|
4625
4647
|
y: v === "top" ? -e : 0,
|
|
4626
|
-
width: v === "right" ?
|
|
4648
|
+
width: v === "right" ? w + E : Math.max(w, E),
|
|
4627
4649
|
height: e,
|
|
4628
|
-
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(
|
|
4629
|
-
text:
|
|
4650
|
+
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(x, 50).alpha(0.7).toHex(),
|
|
4651
|
+
text: L,
|
|
4630
4652
|
fontSize: this.unpackFunc((l = this.context.getOptions().bar.progress) == null ? void 0 : l.fontSize) || 10,
|
|
4631
|
-
fontStyle: this.unpackFunc((
|
|
4653
|
+
fontStyle: this.unpackFunc((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontStyle) || "italic",
|
|
4632
4654
|
fontFamily: "Arial",
|
|
4633
4655
|
verticalAlign: v === "top" ? "bottom" : "middle",
|
|
4634
4656
|
align: "right"
|
|
4635
4657
|
});
|
|
4636
|
-
(
|
|
4658
|
+
(p = this.progressGroup) == null || p.add(M);
|
|
4637
4659
|
}
|
|
4638
4660
|
}
|
|
4639
4661
|
// 绑定事件,包括拖拽和边缘检测
|
|
@@ -4647,11 +4669,11 @@ class We {
|
|
|
4647
4669
|
const e = t.target.getStage();
|
|
4648
4670
|
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
4649
4671
|
}), this.slider.on("click", (t) => {
|
|
4650
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
4672
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(k.SLIDER_CLICK, t.evt, this.task));
|
|
4651
4673
|
}), this.slider.on("contextmenu", (t) => {
|
|
4652
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
4674
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(k.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
4653
4675
|
}), this.slider.on("dblclick", (t) => {
|
|
4654
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
4676
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(k.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
4655
4677
|
}));
|
|
4656
4678
|
}
|
|
4657
4679
|
/**
|
|
@@ -4664,7 +4686,7 @@ class We {
|
|
|
4664
4686
|
handleDragStart(t) {
|
|
4665
4687
|
const e = t.target.getStage();
|
|
4666
4688
|
if (!e) return;
|
|
4667
|
-
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(
|
|
4689
|
+
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(k.SLIDER_DRAGGING, !0), e.container().style.cursor = "grabbing";
|
|
4668
4690
|
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ct(i, s);
|
|
4669
4691
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4670
4692
|
}
|
|
@@ -4677,7 +4699,7 @@ class We {
|
|
|
4677
4699
|
}
|
|
4678
4700
|
handleDragEnd(t) {
|
|
4679
4701
|
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.dragDiffX = 0, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
4680
|
-
|
|
4702
|
+
k.TASK_DRAG_END,
|
|
4681
4703
|
this.task,
|
|
4682
4704
|
this.oldTasks
|
|
4683
4705
|
), this.oldTasks = []);
|
|
@@ -4697,34 +4719,34 @@ class We {
|
|
|
4697
4719
|
}
|
|
4698
4720
|
}
|
|
4699
4721
|
}
|
|
4700
|
-
this.context.event.emit(
|
|
4722
|
+
this.context.event.emit(k.SLIDER_DRAGGING, !1);
|
|
4701
4723
|
}
|
|
4702
4724
|
handleMove(t, e) {
|
|
4703
4725
|
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(), h = t.target.x(), c = h + r, g = Math.max(0, -this.offsetX - h), d = Math.max(0, c - (-this.offsetX + i));
|
|
4704
4726
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4705
|
-
const l = t.target.width(),
|
|
4727
|
+
const l = t.target.width(), m = t.target.x(), p = m + l, u = -this.offsetX, y = u + i, x = this.context.store.getTimeAxis().getTotalWidth(), T = m <= u + this.EDGE_THRESHOLD, b = p >= y - this.EDGE_THRESHOLD;
|
|
4706
4728
|
if (T)
|
|
4707
4729
|
if (u <= 0)
|
|
4708
4730
|
this.draggingDirection === "left" && t.target.x(-g), this.stopAutoScroll(), s || (this.draggingDirection === "left" ? this.startAutoExpand("left", -g) : this.stopAutoExpand());
|
|
4709
4731
|
else if (this.draggingDirection === "left") {
|
|
4710
|
-
const
|
|
4732
|
+
const w = n ? -o : -this.SCROLL_STEP;
|
|
4711
4733
|
this.startAutoScroll(
|
|
4712
|
-
|
|
4734
|
+
w,
|
|
4713
4735
|
n,
|
|
4714
4736
|
() => {
|
|
4715
|
-
t.target.x(t.target.x() +
|
|
4737
|
+
t.target.x(t.target.x() + w);
|
|
4716
4738
|
},
|
|
4717
4739
|
() => t.target.x(t.target.x() - g)
|
|
4718
4740
|
);
|
|
4719
4741
|
} else
|
|
4720
4742
|
this.stopAutoScroll();
|
|
4721
4743
|
else if (b)
|
|
4722
|
-
if (
|
|
4723
|
-
this.draggingDirection === "right" && t.target.x(
|
|
4744
|
+
if (y >= x)
|
|
4745
|
+
this.draggingDirection === "right" && t.target.x(x - l + d), this.stopAutoScroll(), s || (this.draggingDirection === "right" ? this.startAutoExpand("right", 0, d) : this.stopAutoExpand());
|
|
4724
4746
|
else if (this.draggingDirection === "right") {
|
|
4725
|
-
const
|
|
4726
|
-
this.startAutoScroll(
|
|
4727
|
-
t.target.x(t.target.x() +
|
|
4747
|
+
const w = n ? o : this.SCROLL_STEP;
|
|
4748
|
+
this.startAutoScroll(w, n, () => {
|
|
4749
|
+
t.target.x(t.target.x() + w);
|
|
4728
4750
|
});
|
|
4729
4751
|
} else
|
|
4730
4752
|
this.stopAutoScroll();
|
|
@@ -4735,18 +4757,18 @@ class We {
|
|
|
4735
4757
|
}
|
|
4736
4758
|
// 左右操作拖拽
|
|
4737
4759
|
resizeMove(t, e) {
|
|
4738
|
-
var
|
|
4760
|
+
var y;
|
|
4739
4761
|
t.cancelBubble = !0;
|
|
4740
4762
|
const i = t.target.getStage();
|
|
4741
4763
|
if (!i) return;
|
|
4742
|
-
this.isDragging = !0, this.context.event.emit(
|
|
4743
|
-
let s = ((
|
|
4764
|
+
this.isDragging = !0, this.context.event.emit(k.SLIDER_DRAGGING, !0);
|
|
4765
|
+
let s = ((y = i.getPointerPosition()) == null ? void 0 : y.x) || 0;
|
|
4744
4766
|
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, h = i.width();
|
|
4745
4767
|
let c = 0, g = 0;
|
|
4746
4768
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4747
|
-
const
|
|
4748
|
-
if (
|
|
4749
|
-
if (
|
|
4769
|
+
const x = this.slider.width(), T = this.slider.x(), b = T + x, w = -this.offsetX, C = w + h, L = T <= w + this.EDGE_THRESHOLD, E = b >= C - this.EDGE_THRESHOLD;
|
|
4770
|
+
if (L && e === "left") {
|
|
4771
|
+
if (w <= 0)
|
|
4750
4772
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4751
4773
|
else if (this.draggingDirection === "left") {
|
|
4752
4774
|
const v = n ? -o : -this.SCROLL_STEP;
|
|
@@ -4756,8 +4778,8 @@ class We {
|
|
|
4756
4778
|
} else
|
|
4757
4779
|
this.stopAutoScroll();
|
|
4758
4780
|
this.emitUpdate("left");
|
|
4759
|
-
} else if (
|
|
4760
|
-
if (
|
|
4781
|
+
} else if (E && e === "right") {
|
|
4782
|
+
if (C >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4761
4783
|
this.slider.width(
|
|
4762
4784
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
4763
4785
|
), this.stopAutoScroll(), r || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
@@ -4769,12 +4791,12 @@ class We {
|
|
|
4769
4791
|
} else
|
|
4770
4792
|
this.stopAutoScroll();
|
|
4771
4793
|
this.emitUpdate("right");
|
|
4772
|
-
} else if (e === "right" && T <=
|
|
4794
|
+
} else if (e === "right" && T <= w && b <= w + this.EDGE_THRESHOLD + o) {
|
|
4773
4795
|
const v = n ? -o : -this.SCROLL_STEP;
|
|
4774
4796
|
this.startAutoScroll(v, n, () => {
|
|
4775
4797
|
g += v, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + v), this.emitUpdate("right");
|
|
4776
4798
|
});
|
|
4777
|
-
} else if (e === "left" && b >=
|
|
4799
|
+
} else if (e === "left" && b >= C && T >= C - this.EDGE_THRESHOLD - o) {
|
|
4778
4800
|
const v = n ? o : this.SCROLL_STEP;
|
|
4779
4801
|
this.startAutoScroll(v, n, () => {
|
|
4780
4802
|
c += v, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + v), this.emitUpdate("left");
|
|
@@ -4783,23 +4805,23 @@ class We {
|
|
|
4783
4805
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
4784
4806
|
}, this.MOVE_INTERVAL);
|
|
4785
4807
|
let d;
|
|
4786
|
-
const l = this.slider.x(),
|
|
4787
|
-
var
|
|
4788
|
-
|
|
4789
|
-
const T = Math.max(((
|
|
4808
|
+
const l = this.slider.x(), m = this.slider.width(), p = (x) => {
|
|
4809
|
+
var w;
|
|
4810
|
+
x.movementX > 0 ? this.draggingDirection = "right" : x.movementX < 0 && (this.draggingDirection = "left");
|
|
4811
|
+
const T = Math.max(((w = i.getPointerPosition()) == null ? void 0 : w.x) || 0, 0);
|
|
4790
4812
|
let b = T - s;
|
|
4791
|
-
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ?
|
|
4813
|
+
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && T < h - this.EDGE_THRESHOLD && (this.slider.width(m - b - c), this.slider.x(l + b + c), this.emitUpdate("left")) : m + b + g >= o && T > this.EDGE_THRESHOLD && (this.slider.width(m + b + g), this.emitUpdate("right")), d = b);
|
|
4792
4814
|
}, u = () => {
|
|
4793
|
-
this.handleDragEnd(t), document.removeEventListener("mousemove",
|
|
4815
|
+
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", u);
|
|
4794
4816
|
};
|
|
4795
|
-
document.addEventListener("mousemove",
|
|
4817
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", u);
|
|
4796
4818
|
}
|
|
4797
4819
|
// 开始自动扩展
|
|
4798
4820
|
startAutoExpand(t, e = 0, i = 0) {
|
|
4799
4821
|
if (this.autoExpandTimer) return;
|
|
4800
4822
|
const s = this.context.store.getTimeAxis();
|
|
4801
4823
|
this.autoExpandTimer = window.setInterval(() => {
|
|
4802
|
-
s.expand(t, 1), this.context.event.emit(
|
|
4824
|
+
s.expand(t, 1), this.context.event.emit(k.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(e);
|
|
4803
4825
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
4804
4826
|
}
|
|
4805
4827
|
// 开始自动滚动
|
|
@@ -4856,18 +4878,18 @@ class We {
|
|
|
4856
4878
|
}
|
|
4857
4879
|
/** 闪烁 */
|
|
4858
4880
|
handleBarBlink() {
|
|
4859
|
-
if (!this.
|
|
4860
|
-
const t = this.
|
|
4861
|
-
if (!this.
|
|
4881
|
+
if (!this.sliderGroup) return;
|
|
4882
|
+
const t = this.sliderGroup.opacity(), e = 500, s = e * 2, n = new S.Animation((o) => {
|
|
4883
|
+
if (!this.sliderGroup || !o) return;
|
|
4862
4884
|
const r = o.time;
|
|
4863
4885
|
if (r >= s) {
|
|
4864
|
-
this.
|
|
4886
|
+
this.sliderGroup.opacity(t), n.stop();
|
|
4865
4887
|
return;
|
|
4866
4888
|
}
|
|
4867
4889
|
const h = r % e / e;
|
|
4868
4890
|
let c;
|
|
4869
|
-
h < 0.5 ? c = t * (1 - h * 2) : c = t * ((h - 0.5) * 2), this.
|
|
4870
|
-
}, this.
|
|
4891
|
+
h < 0.5 ? c = t * (1 - h * 2) : c = t * ((h - 0.5) * 2), this.sliderGroup.opacity(Math.max(0, Math.min(t, c)));
|
|
4892
|
+
}, this.sliderGroup.getLayer());
|
|
4871
4893
|
n.start();
|
|
4872
4894
|
}
|
|
4873
4895
|
}
|
|
@@ -4987,13 +5009,13 @@ class Fe {
|
|
|
4987
5009
|
* 注册事件监听
|
|
4988
5010
|
*/
|
|
4989
5011
|
registerEvents() {
|
|
4990
|
-
this.context.event.on(
|
|
5012
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
4991
5013
|
this.highlightRow(t);
|
|
4992
|
-
}), this.context.event.on(
|
|
5014
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
4993
5015
|
this.unhighlightRow(t);
|
|
4994
|
-
}), this.context.event.on(
|
|
5016
|
+
}), this.context.event.on(k.TASK_SELECTED, (t) => {
|
|
4995
5017
|
this.selectRow(t.id);
|
|
4996
|
-
}), this.context.event.on(
|
|
5018
|
+
}), this.context.event.on(k.TASK_UNSELECTED, (t) => {
|
|
4997
5019
|
this.unselectRow(t);
|
|
4998
5020
|
});
|
|
4999
5021
|
}
|
|
@@ -5005,9 +5027,9 @@ class Fe {
|
|
|
5005
5027
|
if (!e) return;
|
|
5006
5028
|
const i = this.getTaskByPosition(e);
|
|
5007
5029
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
5008
|
-
|
|
5030
|
+
k.ROW_UNHIGHLIGHT,
|
|
5009
5031
|
this.highlightedRowId
|
|
5010
|
-
), i && this.context.event.emit(
|
|
5032
|
+
), i && this.context.event.emit(k.ROW_HIGHLIGHT, i.id);
|
|
5011
5033
|
}
|
|
5012
5034
|
/**
|
|
5013
5035
|
* 处理鼠标离开
|
|
@@ -5025,7 +5047,7 @@ class Fe {
|
|
|
5025
5047
|
const i = this.getTaskByPosition(e);
|
|
5026
5048
|
if (i) {
|
|
5027
5049
|
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
5028
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(
|
|
5050
|
+
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(k.ROW_CLICK, t.evt, i);
|
|
5029
5051
|
}
|
|
5030
5052
|
}
|
|
5031
5053
|
/**
|
|
@@ -5036,7 +5058,7 @@ class Fe {
|
|
|
5036
5058
|
const e = this.stage.getPointerPosition();
|
|
5037
5059
|
if (!e) return;
|
|
5038
5060
|
const i = this.getTaskByPosition(e);
|
|
5039
|
-
i && this.context.event.emit(
|
|
5061
|
+
i && this.context.event.emit(k.ROW_DBL_CLICK, t.evt, i);
|
|
5040
5062
|
}
|
|
5041
5063
|
/**
|
|
5042
5064
|
* 处理右键菜单
|
|
@@ -5047,7 +5069,7 @@ class Fe {
|
|
|
5047
5069
|
const e = this.stage.getPointerPosition();
|
|
5048
5070
|
if (!e) return;
|
|
5049
5071
|
const i = this.getTaskByPosition(e);
|
|
5050
|
-
i && this.context.event.emit(
|
|
5072
|
+
i && this.context.event.emit(k.ROW_CONTEXTMENU, t.evt, i);
|
|
5051
5073
|
}
|
|
5052
5074
|
/**
|
|
5053
5075
|
* 按照位置获取任务
|
|
@@ -5199,17 +5221,17 @@ class Bt {
|
|
|
5199
5221
|
g.add(d);
|
|
5200
5222
|
const l = new S.Group();
|
|
5201
5223
|
if (o === 0 || o === 90) {
|
|
5202
|
-
const
|
|
5224
|
+
const p = new S.Line({
|
|
5203
5225
|
points: [0, 0, o === 0 ? h : 0, o === 0 ? 0 : c],
|
|
5204
5226
|
stroke: e,
|
|
5205
5227
|
strokeWidth: i,
|
|
5206
5228
|
perfectDrawEnabled: !0
|
|
5207
5229
|
});
|
|
5208
|
-
l.add(
|
|
5230
|
+
l.add(p);
|
|
5209
5231
|
} else
|
|
5210
|
-
for (let
|
|
5211
|
-
const u =
|
|
5212
|
-
points: [Math.ceil(u), Math.ceil(
|
|
5232
|
+
for (let p = -h; p < h * 2; p += h) {
|
|
5233
|
+
const u = p + i / 2, y = 0, x = p + i / 2 + (Math.cos(r) < 0 ? -h : h), T = c, b = new S.Line({
|
|
5234
|
+
points: [Math.ceil(u), Math.ceil(y), Math.ceil(x), Math.ceil(T)],
|
|
5213
5235
|
stroke: e,
|
|
5214
5236
|
strokeWidth: i,
|
|
5215
5237
|
perfectDrawEnabled: !0,
|
|
@@ -5219,8 +5241,8 @@ class Bt {
|
|
|
5219
5241
|
l.add(b);
|
|
5220
5242
|
}
|
|
5221
5243
|
d.add(l), d.draw();
|
|
5222
|
-
const
|
|
5223
|
-
return
|
|
5244
|
+
const m = new Image();
|
|
5245
|
+
return m.src = g.toDataURL(), g.destroy(), m;
|
|
5224
5246
|
}
|
|
5225
5247
|
/**
|
|
5226
5248
|
* 创建圆点图案
|
|
@@ -5250,13 +5272,13 @@ class Bt {
|
|
|
5250
5272
|
y: o - s / 2 - i / 2
|
|
5251
5273
|
}
|
|
5252
5274
|
].forEach((l) => {
|
|
5253
|
-
const
|
|
5275
|
+
const m = new S.Circle({
|
|
5254
5276
|
x: l.x,
|
|
5255
5277
|
y: l.y,
|
|
5256
5278
|
radius: i / 2,
|
|
5257
5279
|
fill: r.toString()
|
|
5258
5280
|
});
|
|
5259
|
-
c.add(
|
|
5281
|
+
c.add(m);
|
|
5260
5282
|
}), c.draw();
|
|
5261
5283
|
const d = new Image();
|
|
5262
5284
|
return d.src = h.toDataURL(), h.destroy(), d;
|
|
@@ -5349,20 +5371,20 @@ class Be {
|
|
|
5349
5371
|
for (let d = t; d <= e; ) {
|
|
5350
5372
|
let l = s;
|
|
5351
5373
|
if (l = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(d)) {
|
|
5352
|
-
const
|
|
5353
|
-
if (
|
|
5374
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(d), p = n, u = h;
|
|
5375
|
+
if (m + l < c) {
|
|
5354
5376
|
d = d.add(2, "day");
|
|
5355
5377
|
continue;
|
|
5356
5378
|
}
|
|
5357
|
-
if (
|
|
5379
|
+
if (m > g)
|
|
5358
5380
|
break;
|
|
5359
5381
|
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Bt.createPattern(
|
|
5360
5382
|
this.context.getOptions().weekend
|
|
5361
5383
|
));
|
|
5362
|
-
const
|
|
5384
|
+
const x = new S.Rect({
|
|
5363
5385
|
name: "weekend-rect",
|
|
5364
|
-
x:
|
|
5365
|
-
y:
|
|
5386
|
+
x: m,
|
|
5387
|
+
y: p,
|
|
5366
5388
|
width: l,
|
|
5367
5389
|
height: u,
|
|
5368
5390
|
// 根据模式设置填充
|
|
@@ -5376,7 +5398,7 @@ class Be {
|
|
|
5376
5398
|
},
|
|
5377
5399
|
opacity: this.context.getOptions().weekend.opacity
|
|
5378
5400
|
});
|
|
5379
|
-
this.weekendGroup.add(
|
|
5401
|
+
this.weekendGroup.add(x), d = d.add(2, "day");
|
|
5380
5402
|
} else
|
|
5381
5403
|
d = d.add(1, "day");
|
|
5382
5404
|
}
|
|
@@ -5412,7 +5434,7 @@ class ze {
|
|
|
5412
5434
|
* 渲染今日线
|
|
5413
5435
|
*/
|
|
5414
5436
|
render() {
|
|
5415
|
-
var d, l,
|
|
5437
|
+
var d, l, m, p, u, y, x;
|
|
5416
5438
|
const t = Object.assign(
|
|
5417
5439
|
{
|
|
5418
5440
|
show: !0,
|
|
@@ -5424,7 +5446,7 @@ class ze {
|
|
|
5424
5446
|
this.context.getOptions().today || {}
|
|
5425
5447
|
);
|
|
5426
5448
|
if (!t.show) return;
|
|
5427
|
-
let e =
|
|
5449
|
+
let e = G();
|
|
5428
5450
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
5429
5451
|
t.type === "block" && (e = e.startOf(i));
|
|
5430
5452
|
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(), h = (t.type === "block" ? s + n / 2 : s) + this.offsetX, c = [h, o, h, this.height], g = t.type === "line" ? t.width : n;
|
|
@@ -5433,28 +5455,28 @@ class ze {
|
|
|
5433
5455
|
stroke: r,
|
|
5434
5456
|
strokeWidth: g
|
|
5435
5457
|
}), this.bgLayer.add(this.todayLine)), (d = this.context.getOptions().today.text) != null && d.show) {
|
|
5436
|
-
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((
|
|
5458
|
+
const T = ((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 S.Text({ fontSize: T, fontFamily: b }).measureSize(w), L = ((u = this.context.getOptions().today.text) == null ? void 0 : u.color) || "white", E = ((y = this.context.getOptions().today.text) == null ? void 0 : y.backgroundColor) || r;
|
|
5437
5459
|
if (!this.todayTextGroup)
|
|
5438
5460
|
this.todayTextGroup = new S.Group({
|
|
5439
5461
|
x: s + this.offsetX + g,
|
|
5440
5462
|
y: o,
|
|
5441
|
-
opacity: (
|
|
5463
|
+
opacity: (x = this.context.getOptions().today.text) == null ? void 0 : x.opacity
|
|
5442
5464
|
}), this.todayTextGroup.add(new S.Rect({
|
|
5443
5465
|
x: 0,
|
|
5444
5466
|
y: 0,
|
|
5445
|
-
width:
|
|
5446
|
-
height:
|
|
5447
|
-
fill:
|
|
5467
|
+
width: C.width + 12,
|
|
5468
|
+
height: C.height + 8,
|
|
5469
|
+
fill: E,
|
|
5448
5470
|
cornerRadius: 0,
|
|
5449
5471
|
name: "today-text-bg"
|
|
5450
5472
|
})), this.todayTextGroup.add(new S.Text({
|
|
5451
5473
|
x: 0,
|
|
5452
5474
|
y: 0,
|
|
5453
|
-
text:
|
|
5475
|
+
text: w,
|
|
5454
5476
|
fontSize: T,
|
|
5455
5477
|
fontFamily: b,
|
|
5456
5478
|
padding: 5,
|
|
5457
|
-
fill:
|
|
5479
|
+
fill: L,
|
|
5458
5480
|
align: "center",
|
|
5459
5481
|
verticalAlign: "middle",
|
|
5460
5482
|
name: "today-text"
|
|
@@ -5463,17 +5485,17 @@ class ze {
|
|
|
5463
5485
|
this.todayTextGroup.x(s + this.offsetX + g);
|
|
5464
5486
|
const v = this.todayTextGroup.findOne(".today-text");
|
|
5465
5487
|
v == null || v.setAttrs({
|
|
5466
|
-
text:
|
|
5467
|
-
fill:
|
|
5488
|
+
text: w,
|
|
5489
|
+
fill: L,
|
|
5468
5490
|
fontSize: T,
|
|
5469
5491
|
fontFamily: b,
|
|
5470
5492
|
padding: 5
|
|
5471
5493
|
});
|
|
5472
5494
|
const M = this.todayTextGroup.findOne(".today-text-bg");
|
|
5473
5495
|
M == null || M.setAttrs({
|
|
5474
|
-
width:
|
|
5475
|
-
height:
|
|
5476
|
-
fill:
|
|
5496
|
+
width: C.width + 12,
|
|
5497
|
+
height: C.height + 8,
|
|
5498
|
+
fill: E
|
|
5477
5499
|
});
|
|
5478
5500
|
}
|
|
5479
5501
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
@@ -5486,9 +5508,9 @@ class ze {
|
|
|
5486
5508
|
rotation: 180,
|
|
5487
5509
|
name: "today-triangle"
|
|
5488
5510
|
}), this.arrowAnimation = new S.Animation((T) => {
|
|
5489
|
-
var
|
|
5511
|
+
var w;
|
|
5490
5512
|
const b = Math.sin(T.time * 4 * Math.PI / 2e3) + o - 8;
|
|
5491
|
-
(
|
|
5513
|
+
(w = this.triangle) == null || w.y(b);
|
|
5492
5514
|
}, this.headerLayer), this.headerLayer.add(this.triangle), this.triangle.moveToTop(), this.arrowAnimation.start())), this.bgLayer.batchDraw();
|
|
5493
5515
|
}
|
|
5494
5516
|
/**
|
|
@@ -5542,7 +5564,7 @@ class Ne {
|
|
|
5542
5564
|
* 计算假期
|
|
5543
5565
|
*/
|
|
5544
5566
|
async calculateHoliday() {
|
|
5545
|
-
var d, l,
|
|
5567
|
+
var d, l, m, p, u, y, x, T;
|
|
5546
5568
|
if (this.clearHoliday(), !this.context.getOptions().holiday.show) return;
|
|
5547
5569
|
const t = this.context.getOptions().holiday.holidays;
|
|
5548
5570
|
if (!t || t.length === 0) return;
|
|
@@ -5550,53 +5572,53 @@ class Ne {
|
|
|
5550
5572
|
this.context.store.getTimeAxis().getCellUnit();
|
|
5551
5573
|
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height, h = this.context.getOptions().row.height, g = this.context.store.getDataManager().getVisibleSize() * h;
|
|
5552
5574
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5553
|
-
const
|
|
5554
|
-
if (X(
|
|
5555
|
-
if (
|
|
5556
|
-
return
|
|
5557
|
-
} else if (
|
|
5558
|
-
return
|
|
5575
|
+
const w = t.find((C) => {
|
|
5576
|
+
if (X(C.date)) {
|
|
5577
|
+
if (C.date.some((L) => G(L).isSame(b, "day")))
|
|
5578
|
+
return C;
|
|
5579
|
+
} else if (G(C.date).isSame(b, "day"))
|
|
5580
|
+
return C;
|
|
5559
5581
|
});
|
|
5560
|
-
if (
|
|
5561
|
-
const
|
|
5562
|
-
if (
|
|
5582
|
+
if (w) {
|
|
5583
|
+
const C = this.context.store.getTimeAxis().getTimeLeft(b), L = r, E = g;
|
|
5584
|
+
if (C + o < e)
|
|
5563
5585
|
continue;
|
|
5564
|
-
if (
|
|
5586
|
+
if (C > i)
|
|
5565
5587
|
break;
|
|
5566
|
-
!this.patternImage.has(
|
|
5567
|
-
|
|
5588
|
+
!this.patternImage.has(w) && (w.pattern || this.context.getOptions().holiday.pattern) && this.patternImage.set(
|
|
5589
|
+
w,
|
|
5568
5590
|
await Bt.createPattern({
|
|
5569
5591
|
backgroundColor: this.context.getOptions().primaryColor,
|
|
5570
|
-
...
|
|
5592
|
+
...w,
|
|
5571
5593
|
...this.context.getOptions().holiday
|
|
5572
5594
|
})
|
|
5573
5595
|
);
|
|
5574
5596
|
const M = new S.Rect({
|
|
5575
5597
|
name: "holiday-rect",
|
|
5576
|
-
x:
|
|
5577
|
-
y:
|
|
5598
|
+
x: C,
|
|
5599
|
+
y: L,
|
|
5578
5600
|
width: o,
|
|
5579
|
-
height:
|
|
5601
|
+
height: E,
|
|
5580
5602
|
// 根据模式设置填充
|
|
5581
|
-
...this.patternImage.get(
|
|
5582
|
-
fillPatternImage: this.patternImage.get(
|
|
5603
|
+
...this.patternImage.get(w) ? {
|
|
5604
|
+
fillPatternImage: this.patternImage.get(w) ?? void 0,
|
|
5583
5605
|
fillPatternRepeat: "repeat",
|
|
5584
5606
|
fillPatternOffset: { x: 0, y: 0 },
|
|
5585
5607
|
fillPatternScale: { x: 1, y: 1 },
|
|
5586
|
-
opacity:
|
|
5608
|
+
opacity: w.opacity || this.context.getOptions().holiday.opacity
|
|
5587
5609
|
} : {
|
|
5588
|
-
fill:
|
|
5589
|
-
opacity:
|
|
5610
|
+
fill: w.backgroundColor || this.context.getOptions().holiday.backgroundColor || this.context.getOptions().primaryColor,
|
|
5611
|
+
opacity: w.opacity || this.context.getOptions().holiday.opacity
|
|
5590
5612
|
}
|
|
5591
5613
|
});
|
|
5592
|
-
if (this.holidayGroup.add(M), (d =
|
|
5593
|
-
if (X(
|
|
5614
|
+
if (this.holidayGroup.add(M), (d = w.text) != null && d.show) {
|
|
5615
|
+
if (X(w.date) && !G(w.date[0]).isSame(b, "day"))
|
|
5594
5616
|
continue;
|
|
5595
|
-
const A = ((l =
|
|
5617
|
+
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 S.Text({ fontSize: A, fontFamily: _ }).measureSize(D), W = ((u = w.text) == null ? void 0 : u.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, R = new S.Group({
|
|
5596
5618
|
name: "holiday-text-group",
|
|
5597
|
-
x:
|
|
5598
|
-
y:
|
|
5599
|
-
opacity: (T =
|
|
5619
|
+
x: C,
|
|
5620
|
+
y: L,
|
|
5621
|
+
opacity: (T = w.text) == null ? void 0 : T.opacity
|
|
5600
5622
|
}), F = new S.Text({
|
|
5601
5623
|
text: D,
|
|
5602
5624
|
fill: W,
|
|
@@ -5608,7 +5630,7 @@ class Ne {
|
|
|
5608
5630
|
y: 0,
|
|
5609
5631
|
width: H.width + 12,
|
|
5610
5632
|
height: H.height + 8,
|
|
5611
|
-
fill:
|
|
5633
|
+
fill: I
|
|
5612
5634
|
});
|
|
5613
5635
|
R.add(z), R.add(F), this.holidayGroup.add(R);
|
|
5614
5636
|
}
|
|
@@ -5659,17 +5681,17 @@ class Pe {
|
|
|
5659
5681
|
* 计算标志日期
|
|
5660
5682
|
*/
|
|
5661
5683
|
async calculateFlag() {
|
|
5662
|
-
var d, l,
|
|
5684
|
+
var d, l, m, p, u, y, x;
|
|
5663
5685
|
if (this.clearFlag(), !((d = this.context.getOptions().flag) != null && d.show)) return;
|
|
5664
5686
|
const t = (l = this.context.getOptions().flag) == null ? void 0 : l.data;
|
|
5665
5687
|
if (!t || t.length === 0) return;
|
|
5666
|
-
const e = ((
|
|
5688
|
+
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 = ((u = this.context.getOptions().flag) == null ? void 0 : u.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), h = r + this.width, c = this.context.store.getTimeAxis().getCellWidth(), g = this.context.getOptions().header.height;
|
|
5667
5689
|
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((T) => {
|
|
5668
|
-
const b =
|
|
5669
|
-
if (
|
|
5690
|
+
const b = G(T.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = g;
|
|
5691
|
+
if (w + c < r || w > h)
|
|
5670
5692
|
return;
|
|
5671
|
-
const
|
|
5672
|
-
points:
|
|
5693
|
+
const E = [w, g, w, this.height], v = new S.Line({
|
|
5694
|
+
points: E,
|
|
5673
5695
|
stroke: T.backgroundColor || e,
|
|
5674
5696
|
opacity: T.opacity || i,
|
|
5675
5697
|
strokeWidth: 1
|
|
@@ -5679,9 +5701,9 @@ class Pe {
|
|
|
5679
5701
|
if (M) {
|
|
5680
5702
|
const A = new S.Text({
|
|
5681
5703
|
text: M,
|
|
5682
|
-
x:
|
|
5704
|
+
x: w + 5,
|
|
5683
5705
|
// 添加一些内边距
|
|
5684
|
-
y:
|
|
5706
|
+
y: C + 5,
|
|
5685
5707
|
// 添加一些内边距
|
|
5686
5708
|
fontSize: o,
|
|
5687
5709
|
fontFamily: n,
|
|
@@ -5689,8 +5711,8 @@ class Pe {
|
|
|
5689
5711
|
verticalAlign: "middle",
|
|
5690
5712
|
align: "left"
|
|
5691
5713
|
}), _ = new S.Rect({
|
|
5692
|
-
x:
|
|
5693
|
-
y:
|
|
5714
|
+
x: w,
|
|
5715
|
+
y: C,
|
|
5694
5716
|
width: A.measureSize(M).width + 12,
|
|
5695
5717
|
height: A.measureSize(M).height + 8,
|
|
5696
5718
|
fill: T.backgroundColor || e
|
|
@@ -5700,8 +5722,8 @@ class Pe {
|
|
|
5700
5722
|
switch (T.flag) {
|
|
5701
5723
|
case "banner":
|
|
5702
5724
|
this.flagGroup.add(new S.Rect({
|
|
5703
|
-
x:
|
|
5704
|
-
y:
|
|
5725
|
+
x: w,
|
|
5726
|
+
y: C,
|
|
5705
5727
|
width: 20,
|
|
5706
5728
|
height: 10,
|
|
5707
5729
|
fill: T.backgroundColor || e,
|
|
@@ -5710,7 +5732,7 @@ class Pe {
|
|
|
5710
5732
|
break;
|
|
5711
5733
|
case "pennant":
|
|
5712
5734
|
this.flagGroup.add(new S.Line({
|
|
5713
|
-
points: [
|
|
5735
|
+
points: [w, C, w + 20, C + 5, w, C + 10],
|
|
5714
5736
|
fill: T.backgroundColor || e,
|
|
5715
5737
|
opacity: T.opacity || i,
|
|
5716
5738
|
closed: !0
|
|
@@ -5718,7 +5740,7 @@ class Pe {
|
|
|
5718
5740
|
break;
|
|
5719
5741
|
case "tag":
|
|
5720
5742
|
this.flagGroup.add(new S.Line({
|
|
5721
|
-
points: [
|
|
5743
|
+
points: [w, C, w + 20, C, w + 15, C + 5, w + 20, C + 10, w, C + 10],
|
|
5722
5744
|
fill: T.backgroundColor || e,
|
|
5723
5745
|
opacity: T.opacity || i,
|
|
5724
5746
|
closed: !0
|
|
@@ -5726,7 +5748,7 @@ class Pe {
|
|
|
5726
5748
|
break;
|
|
5727
5749
|
case "wedge":
|
|
5728
5750
|
this.flagGroup.add(new S.Line({
|
|
5729
|
-
points: [
|
|
5751
|
+
points: [w, C, w + 20, C, w + 25, C + 5, w + 20, C + 10, w, C + 10],
|
|
5730
5752
|
fill: T.backgroundColor || e,
|
|
5731
5753
|
opacity: T.opacity || i,
|
|
5732
5754
|
closed: !0
|
|
@@ -5734,7 +5756,7 @@ class Pe {
|
|
|
5734
5756
|
break;
|
|
5735
5757
|
case "ribbon":
|
|
5736
5758
|
this.flagGroup.add(new S.Line({
|
|
5737
|
-
points: [
|
|
5759
|
+
points: [w, C, w + 15, C + 2, w + 20, C, w + 20, C + 10, w + 15, C + 12, w, C + 10],
|
|
5738
5760
|
fill: T.backgroundColor || e,
|
|
5739
5761
|
opacity: T.opacity || i,
|
|
5740
5762
|
closed: !0,
|
|
@@ -5784,11 +5806,11 @@ class Ye {
|
|
|
5784
5806
|
* 注册事件
|
|
5785
5807
|
*/
|
|
5786
5808
|
registerEvents() {
|
|
5787
|
-
this.context.event.on(
|
|
5809
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
5788
5810
|
this.highlightPoint(t);
|
|
5789
|
-
}), this.context.event.on(
|
|
5811
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
5790
5812
|
this.unhighlightPoint(t);
|
|
5791
|
-
}), this.context.event.on(
|
|
5813
|
+
}), this.context.event.on(k.SLIDER_DRAGGING, (t) => {
|
|
5792
5814
|
this.isSliderMoving = t;
|
|
5793
5815
|
});
|
|
5794
5816
|
}
|
|
@@ -5808,7 +5830,7 @@ class Ye {
|
|
|
5808
5830
|
* 更新某一条数据
|
|
5809
5831
|
*/
|
|
5810
5832
|
updateTask(t) {
|
|
5811
|
-
this.calculateLinks(t), this.calculatePoints(t);
|
|
5833
|
+
this.calculateLinks([t]), this.calculatePoints(t);
|
|
5812
5834
|
}
|
|
5813
5835
|
/**
|
|
5814
5836
|
* 渲染关联线
|
|
@@ -5835,44 +5857,44 @@ class Ye {
|
|
|
5835
5857
|
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, h = B(r).alpha(this.context.getOptions().links.create.opacity ?? 1).toHex(), c = this.context.getOptions().links.create.width;
|
|
5836
5858
|
this.tasks.forEach((l) => {
|
|
5837
5859
|
if (!(t && l.id !== t.id) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, l) && l.startTime && l.endTime) {
|
|
5838
|
-
const
|
|
5860
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(l.startTime), p = this.context.store.getTimeAxis().getTimeLeft(l.endTime);
|
|
5839
5861
|
let u = this.context.getOptions().links.gap;
|
|
5840
5862
|
l.isMilestone() && (u += i / 2);
|
|
5841
|
-
const
|
|
5842
|
-
let
|
|
5843
|
-
if (ht(b) ?
|
|
5844
|
-
const
|
|
5863
|
+
const y = s + i * l.flatIndex;
|
|
5864
|
+
let x = !0, T = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
5865
|
+
if (ht(b) ? x = T = b : K(b) && (x = b === "S", T = b === "F"), x) {
|
|
5866
|
+
const w = new S.Circle({
|
|
5845
5867
|
id: `point-${l.id}-left`,
|
|
5846
|
-
x:
|
|
5847
|
-
y
|
|
5868
|
+
x: m - u,
|
|
5869
|
+
y,
|
|
5848
5870
|
radius: n,
|
|
5849
5871
|
opacity: o,
|
|
5850
5872
|
stroke: h,
|
|
5851
5873
|
strokeWidth: c
|
|
5852
5874
|
});
|
|
5853
|
-
this.pointGroup.add(
|
|
5854
|
-
this.isDragging = !0, this.createLink(
|
|
5855
|
-
}),
|
|
5875
|
+
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
5876
|
+
this.isDragging = !0, this.createLink(C, "S", r, [m - u, y], l.id);
|
|
5877
|
+
}), w.on("mouseover", (C) => {
|
|
5856
5878
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5857
|
-
}),
|
|
5879
|
+
}), w.on("mouseout", (C) => {
|
|
5858
5880
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
5859
5881
|
});
|
|
5860
5882
|
}
|
|
5861
5883
|
if (T) {
|
|
5862
|
-
const
|
|
5884
|
+
const w = new S.Circle({
|
|
5863
5885
|
id: `point-${l.id}-right`,
|
|
5864
|
-
x:
|
|
5865
|
-
y
|
|
5886
|
+
x: p + u,
|
|
5887
|
+
y,
|
|
5866
5888
|
radius: n,
|
|
5867
5889
|
opacity: o,
|
|
5868
5890
|
stroke: h,
|
|
5869
5891
|
strokeWidth: c
|
|
5870
5892
|
});
|
|
5871
|
-
this.pointGroup.add(
|
|
5872
|
-
this.isDragging = !0, this.createLink(
|
|
5873
|
-
}),
|
|
5893
|
+
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
5894
|
+
this.isDragging = !0, this.createLink(C, "F", r, [p + u, y], l.id);
|
|
5895
|
+
}), w.on("mouseover", (C) => {
|
|
5874
5896
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5875
|
-
}),
|
|
5897
|
+
}), w.on("mouseout", (C) => {
|
|
5876
5898
|
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
5877
5899
|
});
|
|
5878
5900
|
}
|
|
@@ -5891,16 +5913,14 @@ class Ye {
|
|
|
5891
5913
|
this.destroy();
|
|
5892
5914
|
return;
|
|
5893
5915
|
}
|
|
5894
|
-
const e = t ? this.context.store.getLinkManager().getLinksByTaskId(
|
|
5895
|
-
t && e.forEach((s) => {
|
|
5896
|
-
const n = this.createId(s);
|
|
5897
|
-
this.linkCache.delete(n);
|
|
5898
|
-
const o = this.linksGroup.findOne(`#${n}`);
|
|
5899
|
-
o && o.destroy();
|
|
5916
|
+
const e = t != null && t.length ? t.reduce((s, n) => (s.push(...this.context.store.getLinkManager().getLinksByTaskId(n.id)), s), []) : this.context.store.getLinkManager().getLinks();
|
|
5917
|
+
t != null && t.length && e.forEach((s) => {
|
|
5918
|
+
const n = this.createId(s), o = this.linkCache.get(n);
|
|
5919
|
+
o == null || o.destroy(), this.linkCache.delete(n);
|
|
5900
5920
|
});
|
|
5901
5921
|
const i = Q();
|
|
5902
5922
|
e.forEach((s) => {
|
|
5903
|
-
var g, d, l,
|
|
5923
|
+
var g, d, l, m, p, u, y, x;
|
|
5904
5924
|
const n = this.createId(s), o = this.context.store.getDataManager().getTaskById(s.from), r = this.context.store.getDataManager().getTaskById(s.to);
|
|
5905
5925
|
if (!o) {
|
|
5906
5926
|
O.warn(
|
|
@@ -5919,38 +5939,38 @@ class Ye {
|
|
|
5919
5939
|
if (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)
|
|
5920
5940
|
return;
|
|
5921
5941
|
const h = Math.max(0, -this.offsetX), c = h + this.width;
|
|
5922
|
-
if (!(this.context.store.getTimeAxis().getTimeLeft(((g = s.type) == null ? void 0 : g[0]) === "S" ? o.startTime : o.endTime) < h && this.context.store.getTimeAxis().getTimeLeft(((d = s.type) == null ? void 0 : d[1]) === "F" ? r.endTime : r.startTime) < h) && !(this.context.store.getTimeAxis().getTimeLeft(((l = s.type) == null ? void 0 : l[0]) === "S" ? o.startTime : o.endTime) > c && this.context.store.getTimeAxis().getTimeLeft(((
|
|
5942
|
+
if (!(this.context.store.getTimeAxis().getTimeLeft(((g = s.type) == null ? void 0 : g[0]) === "S" ? o.startTime : o.endTime) < h && this.context.store.getTimeAxis().getTimeLeft(((d = s.type) == null ? void 0 : d[1]) === "F" ? r.endTime : r.startTime) < h) && !(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)) {
|
|
5923
5943
|
const T = this.getPoints(o, r, s);
|
|
5924
5944
|
if (T.length <= 2)
|
|
5925
5945
|
O.warn("The link position has some error.", s);
|
|
5926
5946
|
else {
|
|
5927
|
-
const b = s.radius ?? this.context.getOptions().links.radius,
|
|
5928
|
-
let
|
|
5929
|
-
|
|
5930
|
-
const v =
|
|
5947
|
+
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 = ((u = s.arrow) == null ? void 0 : u.height) ?? this.context.getOptions().links.arrow.height, L = s.width ?? this.context.getOptions().links.width;
|
|
5948
|
+
let E = this.linkCache.get(n);
|
|
5949
|
+
E === void 0 && (E = new S.Group({ id: n })), t != null && t.length || (E._ = i);
|
|
5950
|
+
const v = E.findOne("Circle");
|
|
5931
5951
|
if (v)
|
|
5932
5952
|
v.radius(b), v.fill(
|
|
5933
5953
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5934
5954
|
), v.x(T[0]), v.y(T[1]);
|
|
5935
5955
|
else {
|
|
5936
|
-
const
|
|
5956
|
+
const I = new S.Circle({
|
|
5937
5957
|
radius: b,
|
|
5938
5958
|
fill: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5939
5959
|
x: T[0],
|
|
5940
5960
|
y: T[1]
|
|
5941
5961
|
});
|
|
5942
|
-
|
|
5962
|
+
E.add(I);
|
|
5943
5963
|
}
|
|
5944
|
-
const M = Math.floor(T.length / 2), A = M % 2 === 0 ? M : M - 1, _ = T.slice(0, A + 2), D = T.slice(A), H =
|
|
5964
|
+
const M = Math.floor(T.length / 2), A = M % 2 === 0 ? M : M - 1, _ = T.slice(0, A + 2), D = T.slice(A), H = E.findOne("Line");
|
|
5945
5965
|
if (H)
|
|
5946
5966
|
H.points(_), H.stroke(
|
|
5947
5967
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5948
|
-
), H.strokeWidth(
|
|
5968
|
+
), H.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), H.dash(s.dash || this.context.getOptions().links.dash);
|
|
5949
5969
|
else {
|
|
5950
|
-
const
|
|
5970
|
+
const I = new S.Line({
|
|
5951
5971
|
points: _,
|
|
5952
5972
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5953
|
-
strokeWidth:
|
|
5973
|
+
strokeWidth: L,
|
|
5954
5974
|
lineCap: "round",
|
|
5955
5975
|
lineJoin: "round",
|
|
5956
5976
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
@@ -5959,7 +5979,7 @@ class Ye {
|
|
|
5959
5979
|
draggable: !0,
|
|
5960
5980
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
5961
5981
|
});
|
|
5962
|
-
|
|
5982
|
+
E.add(I), I.on("dragstart", (R) => {
|
|
5963
5983
|
this.handleDrag(
|
|
5964
5984
|
R,
|
|
5965
5985
|
s,
|
|
@@ -5969,21 +5989,21 @@ class Ye {
|
|
|
5969
5989
|
);
|
|
5970
5990
|
});
|
|
5971
5991
|
}
|
|
5972
|
-
const W =
|
|
5992
|
+
const W = E.findOne("Arrow");
|
|
5973
5993
|
if (W)
|
|
5974
5994
|
W.points(D), W.stroke(
|
|
5975
5995
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5976
|
-
), W.strokeWidth(
|
|
5977
|
-
((
|
|
5996
|
+
), W.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), W.pointerLength(C), W.pointerWidth(w), W.fill(
|
|
5997
|
+
((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
|
|
5978
5998
|
), W.lineJoin("round"), W.dash(s.dash || this.context.getOptions().links.dash);
|
|
5979
5999
|
else {
|
|
5980
|
-
const
|
|
6000
|
+
const I = new S.Arrow({
|
|
5981
6001
|
points: D,
|
|
5982
6002
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5983
|
-
strokeWidth:
|
|
5984
|
-
pointerLength:
|
|
5985
|
-
pointerWidth:
|
|
5986
|
-
fill: ((
|
|
6003
|
+
strokeWidth: L,
|
|
6004
|
+
pointerLength: C,
|
|
6005
|
+
pointerWidth: w,
|
|
6006
|
+
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,
|
|
5987
6007
|
// 箭头填充色
|
|
5988
6008
|
lineJoin: "round",
|
|
5989
6009
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
@@ -5992,54 +6012,56 @@ class Ye {
|
|
|
5992
6012
|
draggable: !0,
|
|
5993
6013
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
5994
6014
|
});
|
|
5995
|
-
|
|
6015
|
+
E.add(I), I.on("dragstart", (R) => {
|
|
5996
6016
|
this.handleDrag(R, s, "F", [T[0], T[1]], n);
|
|
5997
6017
|
});
|
|
5998
6018
|
}
|
|
5999
|
-
this.linkCache.has(n) || (this.linksGroup.add(
|
|
6000
|
-
|
|
6001
|
-
C,
|
|
6002
|
-
b,
|
|
6003
|
-
y,
|
|
6004
|
-
k,
|
|
6019
|
+
this.linkCache.has(n) || (this.linksGroup.add(E), E.on("mouseover", (I) => {
|
|
6020
|
+
I.target.moveToTop(), this.context.getOptions().links.move.enabled === !0 && (this.stage.container().style.cursor = "pointer"), this.selectedMap.has(n) || this.handleHighlight(
|
|
6005
6021
|
E,
|
|
6022
|
+
b,
|
|
6023
|
+
w,
|
|
6024
|
+
C,
|
|
6025
|
+
L,
|
|
6006
6026
|
2
|
|
6007
6027
|
);
|
|
6008
|
-
}),
|
|
6028
|
+
}), E.on("mouseout", (I) => {
|
|
6009
6029
|
this.selectedMap.has(n) || this.handleHighlight(
|
|
6010
|
-
C,
|
|
6011
|
-
b,
|
|
6012
|
-
y,
|
|
6013
|
-
k,
|
|
6014
6030
|
E,
|
|
6031
|
+
b,
|
|
6032
|
+
w,
|
|
6033
|
+
C,
|
|
6034
|
+
L,
|
|
6015
6035
|
0
|
|
6016
6036
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
6017
|
-
}),
|
|
6037
|
+
}), E.on("mousedown", (I) => {
|
|
6018
6038
|
this.isDragging = !0;
|
|
6019
|
-
}),
|
|
6020
|
-
|
|
6021
|
-
|
|
6039
|
+
}), E.on("click", (I) => {
|
|
6040
|
+
I.cancelBubble = !0, this.isDragging = !1, E.moveToTop(), I.evt.button === 0 && (this.selectedMap.has(n) ? (this.selectedMap.delete(n), this.context.event.emit(
|
|
6041
|
+
k.SELECT_LINK,
|
|
6022
6042
|
null,
|
|
6023
6043
|
s,
|
|
6024
6044
|
this.selectedMap.values().toArray()
|
|
6025
6045
|
)) : (this.selectedMap.set(n, s), this.context.event.emit(
|
|
6026
|
-
|
|
6046
|
+
k.SELECT_LINK,
|
|
6027
6047
|
s,
|
|
6028
6048
|
null,
|
|
6029
6049
|
this.selectedMap.values().toArray()
|
|
6030
|
-
))
|
|
6031
|
-
}),
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
y,
|
|
6035
|
-
k,
|
|
6050
|
+
)));
|
|
6051
|
+
}), E.on("contextmenu", (I) => {
|
|
6052
|
+
I.evt.preventDefault(), I.cancelBubble = !0, this.context.event.emit(k.CONTEXT_LINK, I.evt, s);
|
|
6053
|
+
}), this.linkCache.set(n, E)), this.selectedMap.has(n) && this.handleHighlight(
|
|
6036
6054
|
E,
|
|
6055
|
+
b,
|
|
6056
|
+
w,
|
|
6057
|
+
C,
|
|
6058
|
+
L,
|
|
6037
6059
|
2,
|
|
6038
6060
|
!0
|
|
6039
6061
|
);
|
|
6040
6062
|
}
|
|
6041
6063
|
}
|
|
6042
|
-
}), this.linkCache.forEach((s, n) => {
|
|
6064
|
+
}), t != null && t.length || this.linkCache.forEach((s, n) => {
|
|
6043
6065
|
s._ !== i && (s.destroy(), this.linkCache.delete(n));
|
|
6044
6066
|
}), this.layer.batchDraw();
|
|
6045
6067
|
}
|
|
@@ -6075,17 +6097,17 @@ class Ye {
|
|
|
6075
6097
|
0.05 + g + c * e.flatIndex
|
|
6076
6098
|
];
|
|
6077
6099
|
{
|
|
6078
|
-
const
|
|
6079
|
-
if (isNaN(
|
|
6100
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6101
|
+
if (isNaN(m))
|
|
6080
6102
|
O.error("Link's distance must be a Numeric");
|
|
6081
6103
|
else {
|
|
6082
|
-
const
|
|
6083
|
-
Math.max(
|
|
6104
|
+
const p = n + d + m, u = o - d - m, y = [
|
|
6105
|
+
Math.max(p, u),
|
|
6084
6106
|
g + c * e.flatIndex
|
|
6085
6107
|
];
|
|
6086
|
-
l.push(...
|
|
6087
|
-
const
|
|
6088
|
-
l.push(
|
|
6108
|
+
l.push(...y);
|
|
6109
|
+
const x = c * e.flatIndex + h + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6110
|
+
l.push(y[0], x), l.push(u, x), l.push(u, g + c * i.flatIndex);
|
|
6089
6111
|
}
|
|
6090
6112
|
}
|
|
6091
6113
|
return l.push(o - d, g + c * i.flatIndex), l;
|
|
@@ -6097,16 +6119,16 @@ class Ye {
|
|
|
6097
6119
|
0.05 + g + c * e.flatIndex
|
|
6098
6120
|
];
|
|
6099
6121
|
{
|
|
6100
|
-
const
|
|
6101
|
-
if (isNaN(
|
|
6122
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6123
|
+
if (isNaN(m))
|
|
6102
6124
|
O.error("Link's distance must be a Numeric");
|
|
6103
6125
|
else {
|
|
6104
|
-
const
|
|
6105
|
-
|
|
6126
|
+
const p = n + d + m, u = r + d + m, y = [
|
|
6127
|
+
p <= u ? u : p,
|
|
6106
6128
|
g + c * e.flatIndex
|
|
6107
6129
|
];
|
|
6108
|
-
l.push(...
|
|
6109
|
-
Math.max(u,
|
|
6130
|
+
l.push(...y), l.push(
|
|
6131
|
+
Math.max(u, p),
|
|
6110
6132
|
g + c * i.flatIndex
|
|
6111
6133
|
);
|
|
6112
6134
|
}
|
|
@@ -6120,16 +6142,16 @@ class Ye {
|
|
|
6120
6142
|
0.05 + g + c * e.flatIndex
|
|
6121
6143
|
];
|
|
6122
6144
|
{
|
|
6123
|
-
const
|
|
6124
|
-
if (isNaN(
|
|
6145
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6146
|
+
if (isNaN(m))
|
|
6125
6147
|
O.error("Link's distance must be a Numeric");
|
|
6126
6148
|
else {
|
|
6127
|
-
const
|
|
6149
|
+
const p = s - d - m, u = o - d - m;
|
|
6128
6150
|
l.push(
|
|
6129
|
-
Math.min(u,
|
|
6151
|
+
Math.min(u, p),
|
|
6130
6152
|
g + c * e.flatIndex
|
|
6131
6153
|
), l.push(
|
|
6132
|
-
Math.min(u,
|
|
6154
|
+
Math.min(u, p),
|
|
6133
6155
|
g + c * i.flatIndex
|
|
6134
6156
|
);
|
|
6135
6157
|
}
|
|
@@ -6143,17 +6165,17 @@ class Ye {
|
|
|
6143
6165
|
0.05 + g + c * e.flatIndex
|
|
6144
6166
|
];
|
|
6145
6167
|
{
|
|
6146
|
-
const
|
|
6147
|
-
if (isNaN(
|
|
6168
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6169
|
+
if (isNaN(m))
|
|
6148
6170
|
O.error("Link's distance must be a Numeric");
|
|
6149
6171
|
else {
|
|
6150
|
-
const
|
|
6151
|
-
Math.min(
|
|
6172
|
+
const p = s - d - m, u = r + d + m, y = [
|
|
6173
|
+
Math.min(p, u),
|
|
6152
6174
|
g + c * e.flatIndex
|
|
6153
6175
|
];
|
|
6154
|
-
l.push(...
|
|
6155
|
-
const
|
|
6156
|
-
l.push(
|
|
6176
|
+
l.push(...y);
|
|
6177
|
+
const x = c * e.flatIndex + h + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6178
|
+
l.push(y[0], x), l.push(u, x), l.push(u, g + c * i.flatIndex);
|
|
6157
6179
|
}
|
|
6158
6180
|
}
|
|
6159
6181
|
return l.push(r + d, g + c * i.flatIndex), l;
|
|
@@ -6162,16 +6184,16 @@ class Ye {
|
|
|
6162
6184
|
* 处理连线被点击后的移动
|
|
6163
6185
|
*/
|
|
6164
6186
|
handleDrag(t, e, i, s, n) {
|
|
6165
|
-
var
|
|
6187
|
+
var y, x, T;
|
|
6166
6188
|
if (!this.isDragging || this.context.getOptions().links.move.enabled !== !0) return;
|
|
6167
6189
|
this.stage.container().style.cursor = "pointer";
|
|
6168
6190
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
6169
6191
|
this.templateArrow.setAttrs({
|
|
6170
6192
|
stroke: e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6171
6193
|
strokeWidth: e.width ?? this.context.getOptions().links.width,
|
|
6172
|
-
pointerLength: ((
|
|
6194
|
+
pointerLength: ((y = e.arrow) == null ? void 0 : y.height) ?? this.context.getOptions().links.arrow.height,
|
|
6173
6195
|
// 箭头长度
|
|
6174
|
-
pointerWidth: ((
|
|
6196
|
+
pointerWidth: ((x = e.arrow) == null ? void 0 : x.width) ?? this.context.getOptions().links.arrow.width,
|
|
6175
6197
|
// 箭头宽度
|
|
6176
6198
|
fill: ((T = e.arrow) == null ? void 0 : T.color) || this.context.getOptions().links.arrow.color || e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6177
6199
|
// 箭头填充色
|
|
@@ -6181,17 +6203,17 @@ class Ye {
|
|
|
6181
6203
|
let r = null;
|
|
6182
6204
|
const h = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + h, d = e.gap || this.context.getOptions().links.gap;
|
|
6183
6205
|
let l = null;
|
|
6184
|
-
const
|
|
6206
|
+
const m = () => {
|
|
6185
6207
|
const b = this.stage.getPointerPosition();
|
|
6186
6208
|
if (b && (l = this.getTaskByPosition(b), !!l && (this.templateArrow.visible(!0), o == null || o.visible(!1), l != null && l.startTime && (l != null && l.endTime)))) {
|
|
6187
|
-
const
|
|
6188
|
-
let
|
|
6189
|
-
b.x <=
|
|
6209
|
+
const w = this.context.store.getTimeAxis().getTimeLeft(l.startTime), C = this.context.store.getTimeAxis().getTimeLeft(l.endTime), L = (C + w) / 2 + this.offsetX;
|
|
6210
|
+
let E = w - d;
|
|
6211
|
+
b.x <= L ? r = "S" : (r = "F", E = C + d);
|
|
6190
6212
|
let v;
|
|
6191
6213
|
if (i === "S" ? v = `${r}${(e.type || "FS")[1]}` : v = `${(e.type || "FS")[0]}${r}`, i === "S") {
|
|
6192
6214
|
const { allowLeft: M, allowRight: A } = this.isAllowStartDrop(l, e.to, v);
|
|
6193
6215
|
this.templateArrow.points([
|
|
6194
|
-
|
|
6216
|
+
E,
|
|
6195
6217
|
g + c * l.flatIndex,
|
|
6196
6218
|
...s
|
|
6197
6219
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
@@ -6199,26 +6221,26 @@ class Ye {
|
|
|
6199
6221
|
const { allowLeft: M, allowRight: A } = this.isAllowEndDrop(l, e.from, v);
|
|
6200
6222
|
this.templateArrow.points([
|
|
6201
6223
|
...s,
|
|
6202
|
-
|
|
6224
|
+
E,
|
|
6203
6225
|
g + c * l.flatIndex
|
|
6204
6226
|
]), M ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6205
6227
|
}
|
|
6206
6228
|
}
|
|
6207
|
-
},
|
|
6208
|
-
var
|
|
6229
|
+
}, p = () => {
|
|
6230
|
+
var C, L;
|
|
6209
6231
|
let b;
|
|
6210
|
-
const
|
|
6211
|
-
if (r && l && (i === "S" ? (b = `${r}${(e.type || "FS")[1]}`,
|
|
6212
|
-
|
|
6213
|
-
let
|
|
6214
|
-
i === "S" ? { allowLeft:
|
|
6232
|
+
const w = Z(e);
|
|
6233
|
+
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) {
|
|
6234
|
+
w.type = b;
|
|
6235
|
+
let E = !1, v = !1, M;
|
|
6236
|
+
i === "S" ? { allowLeft: E, allowRight: v, reason: M } = this.isAllowStartDrop(l, w.to, w.type, !0) : i === "F" && ({ allowLeft: E, allowRight: v, reason: M } = this.isAllowEndDrop(l, w.from, w.type, !0)), ((C = w.type) == null ? void 0 : C.slice(1)) === "S" && E || ((L = w.type) == null ? void 0 : L.slice(1)) === "F" && v ? (this.context.event.emit(k.UPDATE_LINK, w), this.context.store.getLinkManager().update(), this.calculateLinks()) : this.context.event.emit(k.ERROR, M || Y.LINK_NOT_ALLOWED);
|
|
6215
6237
|
} else
|
|
6216
|
-
this.context.event.emit(
|
|
6217
|
-
this.cleanupTempLink(), this.calculateLinks(l
|
|
6238
|
+
this.context.event.emit(k.ERROR, Y.TASK_NOT_FOUND);
|
|
6239
|
+
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);
|
|
6218
6240
|
}, u = (b) => {
|
|
6219
|
-
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove",
|
|
6241
|
+
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", u));
|
|
6220
6242
|
};
|
|
6221
|
-
document.addEventListener("mousemove",
|
|
6243
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown", u);
|
|
6222
6244
|
}
|
|
6223
6245
|
/**
|
|
6224
6246
|
* 处理连线被点击后的移动
|
|
@@ -6239,43 +6261,40 @@ class Ye {
|
|
|
6239
6261
|
let r = null;
|
|
6240
6262
|
const h = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + h, d = this.context.getOptions().links.gap;
|
|
6241
6263
|
let l = null;
|
|
6242
|
-
const
|
|
6243
|
-
const
|
|
6244
|
-
if (
|
|
6245
|
-
const
|
|
6246
|
-
let
|
|
6247
|
-
|
|
6264
|
+
const m = () => {
|
|
6265
|
+
const y = this.stage.getPointerPosition();
|
|
6266
|
+
if (y && (l = this.getTaskByPosition(y), !!l && (this.templateArrow.visible(!0), l.startTime && l.endTime))) {
|
|
6267
|
+
const x = this.context.store.getTimeAxis().getTimeLeft(l.startTime), T = this.context.store.getTimeAxis().getTimeLeft(l.endTime), b = (T + x) / 2 + this.offsetX;
|
|
6268
|
+
let w = x - d;
|
|
6269
|
+
y.x <= b ? r = "S" : (r = "F", w = T + d), this.templateArrow.points([
|
|
6248
6270
|
...s,
|
|
6249
|
-
|
|
6271
|
+
w,
|
|
6250
6272
|
g + c * l.flatIndex
|
|
6251
6273
|
]);
|
|
6252
|
-
const { allowLeft:
|
|
6253
|
-
r === "S" && !
|
|
6274
|
+
const { allowLeft: C, allowRight: L } = this.isAllowEndDrop(l, n, o.convertPointsToLinkType(e, r));
|
|
6275
|
+
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !L ? this.stage.container().style.cursor = "not-allowed" : this.stage.container().style.cursor = "pointer";
|
|
6254
6276
|
}
|
|
6255
|
-
},
|
|
6256
|
-
let
|
|
6257
|
-
if (r && (
|
|
6258
|
-
if (o.isLinkExist(n, l.id,
|
|
6259
|
-
this.context.event.emit(
|
|
6277
|
+
}, p = () => {
|
|
6278
|
+
let y;
|
|
6279
|
+
if (r && (y = o.convertPointsToLinkType(e, r)), y && l)
|
|
6280
|
+
if (o.isLinkExist(n, l.id, y))
|
|
6281
|
+
this.context.event.emit(k.ERROR, Y.LINK_EXIST);
|
|
6260
6282
|
else if (n === l.id && e === r)
|
|
6261
|
-
this.context.event.emit(
|
|
6283
|
+
this.context.event.emit(k.ERROR, Y.LINK_SAME);
|
|
6262
6284
|
else {
|
|
6263
|
-
const { allowLeft:
|
|
6264
|
-
r === "S" &&
|
|
6285
|
+
const { allowLeft: x, allowRight: T, reason: b } = this.isAllowEndDrop(l, n, y, !0);
|
|
6286
|
+
r === "S" && x || r === "F" && T ? (this.context.event.emit(k.CREATE_LINK, {
|
|
6265
6287
|
from: n,
|
|
6266
6288
|
to: l.id,
|
|
6267
|
-
type:
|
|
6289
|
+
type: y,
|
|
6268
6290
|
color: i
|
|
6269
|
-
}), this.context.store.getLinkManager().update()) : this.context.event.emit(
|
|
6270
|
-
L.ERROR,
|
|
6271
|
-
Y.LINK_NOT_ALLOWED
|
|
6272
|
-
);
|
|
6291
|
+
}), this.context.store.getLinkManager().update()) : this.context.event.emit(k.ERROR, b || Y.LINK_NOT_ALLOWED);
|
|
6273
6292
|
}
|
|
6274
|
-
this.cleanupTempLink(), this.calculateLinks(l
|
|
6275
|
-
}, u = (
|
|
6276
|
-
|
|
6293
|
+
this.cleanupTempLink(), this.calculateLinks([l].filter((x) => !!x)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6294
|
+
}, u = (y) => {
|
|
6295
|
+
y.key === "Escape" && (this.cleanupTempLink(), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", u));
|
|
6277
6296
|
};
|
|
6278
|
-
document.addEventListener("mousemove",
|
|
6297
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown", u);
|
|
6279
6298
|
}
|
|
6280
6299
|
/**
|
|
6281
6300
|
* 清理临时连线状态
|
|
@@ -6302,11 +6321,12 @@ class Ye {
|
|
|
6302
6321
|
j(r) && (r = r(
|
|
6303
6322
|
t.getEmitData(),
|
|
6304
6323
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6305
|
-
)), ht(r) ? n = o = r :
|
|
6324
|
+
)), ht(r) ? n = o = r : K(r) && (n = r === "S", o = r === "F");
|
|
6306
6325
|
const h = this.validateChain(t.id, e, i, s);
|
|
6307
6326
|
return {
|
|
6308
|
-
allowLeft: n && h,
|
|
6309
|
-
allowRight: o && h
|
|
6327
|
+
allowLeft: n && h.ok,
|
|
6328
|
+
allowRight: o && h.ok,
|
|
6329
|
+
reason: h.reason
|
|
6310
6330
|
};
|
|
6311
6331
|
}
|
|
6312
6332
|
/**
|
|
@@ -6317,19 +6337,20 @@ class Ye {
|
|
|
6317
6337
|
j(r) && (r = r(
|
|
6318
6338
|
t.getEmitData(),
|
|
6319
6339
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6320
|
-
)), ht(r) ? n = o = r :
|
|
6340
|
+
)), ht(r) ? n = o = r : K(r) && (n = r === "S", o = r === "F");
|
|
6321
6341
|
const h = this.validateChain(e, t.id, i, s);
|
|
6322
6342
|
return {
|
|
6323
|
-
allowLeft: n && h,
|
|
6324
|
-
allowRight: o && h
|
|
6343
|
+
allowLeft: n && h.ok,
|
|
6344
|
+
allowRight: o && h.ok,
|
|
6345
|
+
reason: h.reason
|
|
6325
6346
|
};
|
|
6326
6347
|
}
|
|
6327
6348
|
/**
|
|
6328
6349
|
* 校验连线创建是否合法
|
|
6329
6350
|
*/
|
|
6330
6351
|
validateChain(t, e, i, s = !1) {
|
|
6331
|
-
const o = this.context.store.getLinkManager().
|
|
6332
|
-
return o.ok ? !0 : (s && o.reason === Y.LINK_CYCLE && o.cycleInfo && this.highlightCycleNodes(o.cycleInfo.nodes),
|
|
6352
|
+
const o = this.context.store.getLinkManager().validateChain(t, e, i);
|
|
6353
|
+
return o.ok ? { ok: !0 } : (s && o.reason === Y.LINK_CYCLE && o.cycleInfo && this.highlightCycleNodes(o.cycleInfo.nodes), { ok: !1, reason: o.reason });
|
|
6333
6354
|
}
|
|
6334
6355
|
/**
|
|
6335
6356
|
* 操作高亮关联线
|
|
@@ -6379,7 +6400,7 @@ class Ye {
|
|
|
6379
6400
|
*/
|
|
6380
6401
|
highlightCycleNodes(t) {
|
|
6381
6402
|
t.forEach((e) => {
|
|
6382
|
-
this.context.event.emit(
|
|
6403
|
+
this.context.event.emit(k.SLIDER_BLINK, e);
|
|
6383
6404
|
});
|
|
6384
6405
|
}
|
|
6385
6406
|
}
|
|
@@ -6447,61 +6468,61 @@ class Ue {
|
|
|
6447
6468
|
), g = this.context.getOptions().baselines.offset ?? 0;
|
|
6448
6469
|
h.forEach((d, l) => {
|
|
6449
6470
|
if (!d.validate()) return;
|
|
6450
|
-
const
|
|
6451
|
-
this.renderBaselineBar(u, r, d,
|
|
6452
|
-
const
|
|
6453
|
-
if (!
|
|
6454
|
-
const T =
|
|
6455
|
-
d.highlight && (T === "highlight" || T === "both") && this.renderCompareHighlight(u, r, d,
|
|
6471
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(d.startTime), p = this.context.store.getTimeAxis().getTimeLeft(d.endTime), u = new S.Group({ id: `baseline-group-${d.id}` });
|
|
6472
|
+
this.renderBaselineBar(u, r, d, m, p, i, e, c, t, o, n, s, g), this.baselineGroup.add(u);
|
|
6473
|
+
const y = this.context.getOptions().baselines.compare, x = d.getTimeDiff();
|
|
6474
|
+
if (!y.enabled || !x) return;
|
|
6475
|
+
const T = y.mode;
|
|
6476
|
+
d.highlight && (T === "highlight" || T === "both") && this.renderCompareHighlight(u, r, d, x), l === 0 && (T === "indicator" || T === "both") && this.renderCompareIndicator(r, d, x), this.bindEvents(u, r, d);
|
|
6456
6477
|
});
|
|
6457
6478
|
}
|
|
6458
6479
|
});
|
|
6459
6480
|
}
|
|
6460
|
-
renderBaselineBar(t, e, i, s, n, o, r, h, c, g, d, l,
|
|
6481
|
+
renderBaselineBar(t, e, i, s, n, o, r, h, c, g, d, l, m) {
|
|
6461
6482
|
if (this.context.getOptions().baselines.mode === "shadow") {
|
|
6462
|
-
const
|
|
6483
|
+
const p = o + r * e.flatIndex - h / 2 + m, u = new S.Rect({
|
|
6463
6484
|
id: `baseline-item-${i.id}`,
|
|
6464
6485
|
x: s,
|
|
6465
|
-
y:
|
|
6486
|
+
y: p,
|
|
6466
6487
|
width: n - s,
|
|
6467
6488
|
height: h,
|
|
6468
6489
|
cornerRadius: l,
|
|
6469
6490
|
fill: g,
|
|
6470
6491
|
opacity: d
|
|
6471
6492
|
});
|
|
6472
|
-
t.add(u), this.renderText(t, e, i, s, n,
|
|
6493
|
+
t.add(u), this.renderText(t, e, i, s, n, p, h);
|
|
6473
6494
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
6474
|
-
const
|
|
6475
|
-
let u = c + r * e.flatIndex +
|
|
6476
|
-
const
|
|
6477
|
-
let
|
|
6478
|
-
|
|
6495
|
+
const p = nt(this.context.getOptions().baselines.height ?? 5, r);
|
|
6496
|
+
let u = c + r * e.flatIndex + m;
|
|
6497
|
+
const y = this.context.getOptions().baselines.position;
|
|
6498
|
+
let x = "";
|
|
6499
|
+
y === "top" ? (u += +p / 2, x = "line_top") : y === "center" ? (u += r / 2, x = "line_center") : (u += r - p / 2, x = "line_bottom");
|
|
6479
6500
|
const T = new S.Line({
|
|
6480
6501
|
id: `baseline-item-${i.id}`,
|
|
6481
6502
|
points: [s, u, n, u],
|
|
6482
6503
|
stroke: g,
|
|
6483
6504
|
opacity: d,
|
|
6484
|
-
strokeWidth:
|
|
6505
|
+
strokeWidth: p,
|
|
6485
6506
|
lineCap: "butt",
|
|
6486
6507
|
lineJoin: "round"
|
|
6487
6508
|
});
|
|
6488
|
-
t.add(T), this.renderText(t, e, i, s, n, u,
|
|
6509
|
+
t.add(T), this.renderText(t, e, i, s, n, u, p, x);
|
|
6489
6510
|
}
|
|
6490
6511
|
}
|
|
6491
6512
|
renderText(t, e, i, s, n, o, r, h) {
|
|
6492
6513
|
const c = `chart-baseline-text-${i.id}`;
|
|
6493
6514
|
if ((() => {
|
|
6494
|
-
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((
|
|
6515
|
+
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((x) => x.remove());
|
|
6495
6516
|
})(), !this.context.getOptions().baselines.label.show) return;
|
|
6496
6517
|
const d = this.context.getOptions().baselines.label.field, l = d ? i.getField(d) : i.name;
|
|
6497
6518
|
if (!l || l === "") return;
|
|
6498
|
-
const
|
|
6519
|
+
const m = n - s - 10, p = Math.max(this.context.getOptions().baselines.label.fontSize, r), u = new S.Text({
|
|
6499
6520
|
text: l,
|
|
6500
6521
|
id: c,
|
|
6501
6522
|
x: s + 5,
|
|
6502
6523
|
y: o,
|
|
6503
|
-
width:
|
|
6504
|
-
height:
|
|
6524
|
+
width: m,
|
|
6525
|
+
height: p,
|
|
6505
6526
|
fill: this.context.getOptions().baselines.label.color,
|
|
6506
6527
|
fontSize: this.context.getOptions().baselines.label.fontSize,
|
|
6507
6528
|
fontFamily: this.context.getOptions().baselines.label.fontFamily || "Arial",
|
|
@@ -6509,19 +6530,19 @@ class Ue {
|
|
|
6509
6530
|
verticalAlign: "bottom"
|
|
6510
6531
|
});
|
|
6511
6532
|
h === "line_bottom" ? u.setAttrs({
|
|
6512
|
-
y: o -
|
|
6533
|
+
y: o - p / 2,
|
|
6513
6534
|
verticalAlign: "top"
|
|
6514
6535
|
}) : h === "line_center" ? u.setAttrs({
|
|
6515
|
-
y: o -
|
|
6536
|
+
y: o - p / 2,
|
|
6516
6537
|
verticalAlign: "middle"
|
|
6517
6538
|
}) : h === "line_top" && u.setAttrs({
|
|
6518
6539
|
y: o - r / 2,
|
|
6519
6540
|
verticalAlign: "bottom"
|
|
6520
|
-
}), r >=
|
|
6541
|
+
}), r >= p && u.setAttrs({
|
|
6521
6542
|
verticalAlign: "middle"
|
|
6522
6543
|
});
|
|
6523
|
-
const
|
|
6524
|
-
(this.context.getOptions().baselines.label.forceDisplay ||
|
|
6544
|
+
const y = u.measureSize(l);
|
|
6545
|
+
(this.context.getOptions().baselines.label.forceDisplay || m > y.width) && t.add(u);
|
|
6525
6546
|
}
|
|
6526
6547
|
renderCompareHighlight(t, e, i, s) {
|
|
6527
6548
|
const n = s[`${this.context.getOptions().baselines.compare.target}Status`];
|
|
@@ -6548,44 +6569,44 @@ class Ue {
|
|
|
6548
6569
|
const g = this.context.store.getTimeAxis().getTimeLeft(t.startTime), d = this.context.store.getTimeAxis().getTimeLeft(t.endTime);
|
|
6549
6570
|
let l = (r - h) / 2 + r * t.flatIndex + o;
|
|
6550
6571
|
if (n.position === "bottom" && (l += h), n.show === "start" || n.show === "both" || n.show === !0) {
|
|
6551
|
-
const
|
|
6552
|
-
if (
|
|
6553
|
-
c = B(s.compare.indicator[
|
|
6554
|
-
const
|
|
6572
|
+
const m = i.startStatus;
|
|
6573
|
+
if (m && s.compare.indicator[m].show) {
|
|
6574
|
+
c = B(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
6575
|
+
const p = new S.Circle({
|
|
6555
6576
|
x: g - n.size,
|
|
6556
6577
|
y: l,
|
|
6557
6578
|
fill: c,
|
|
6558
6579
|
radius: n.size / 2
|
|
6559
6580
|
});
|
|
6560
|
-
this.indicatorGroup.add(
|
|
6561
|
-
let u = `${gt(i.startDiff)}${i.unit} ${
|
|
6562
|
-
const
|
|
6563
|
-
j(
|
|
6564
|
-
const
|
|
6581
|
+
this.indicatorGroup.add(p);
|
|
6582
|
+
let u = `${gt(i.startDiff)}${i.unit} ${m}`;
|
|
6583
|
+
const y = s.compare.indicator[m].text;
|
|
6584
|
+
j(y) ? u = y(i.startDiff, { ...t.getEmitData(), baseline: e }) : K(y) && (u = y);
|
|
6585
|
+
const x = new S.Text({
|
|
6565
6586
|
y: l - n.fontSize / 2,
|
|
6566
6587
|
text: u,
|
|
6567
6588
|
fill: c,
|
|
6568
6589
|
fontSize: n.fontSize,
|
|
6569
6590
|
fontFamily: n.fontFamily || "Arial"
|
|
6570
|
-
}), T =
|
|
6571
|
-
|
|
6591
|
+
}), T = x.measureSize(u);
|
|
6592
|
+
x.x(g - n.size - T.width - 5), this.indicatorGroup.add(x);
|
|
6572
6593
|
}
|
|
6573
6594
|
}
|
|
6574
6595
|
if (n.show === "end" || n.show === "both" || n.show === !0) {
|
|
6575
|
-
const
|
|
6576
|
-
if (
|
|
6577
|
-
c = B(s.compare.indicator[
|
|
6578
|
-
const
|
|
6596
|
+
const m = i.endStatus;
|
|
6597
|
+
if (m && s.compare.indicator[m].show) {
|
|
6598
|
+
c = B(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
6599
|
+
const p = new S.Circle({
|
|
6579
6600
|
x: d + n.size,
|
|
6580
6601
|
y: l,
|
|
6581
6602
|
fill: c,
|
|
6582
6603
|
radius: n.size / 2
|
|
6583
6604
|
});
|
|
6584
|
-
this.indicatorGroup.add(
|
|
6585
|
-
let u = `${gt(i.endDiff)}${i.unit} ${
|
|
6586
|
-
const
|
|
6587
|
-
j(
|
|
6588
|
-
const
|
|
6605
|
+
this.indicatorGroup.add(p);
|
|
6606
|
+
let u = `${gt(i.endDiff)}${i.unit} ${m}`;
|
|
6607
|
+
const y = s.compare.indicator[m].text;
|
|
6608
|
+
j(y) ? u = y(i.endDiff, { ...t.getEmitData(), baseline: e }) : K(y) && (u = y);
|
|
6609
|
+
const x = new S.Text({
|
|
6589
6610
|
x: d + n.size + 5,
|
|
6590
6611
|
y: l - n.fontSize / 2,
|
|
6591
6612
|
text: u,
|
|
@@ -6593,17 +6614,19 @@ class Ue {
|
|
|
6593
6614
|
fontSize: n.fontSize,
|
|
6594
6615
|
fontFamily: n.fontFamily || "Arial"
|
|
6595
6616
|
});
|
|
6596
|
-
this.indicatorGroup.add(
|
|
6617
|
+
this.indicatorGroup.add(x);
|
|
6597
6618
|
}
|
|
6598
6619
|
}
|
|
6599
6620
|
}
|
|
6600
6621
|
bindEvents(t, e, i) {
|
|
6601
|
-
t.on("
|
|
6602
|
-
this.context.event.emit(
|
|
6622
|
+
t.on("mouseenter", (s) => {
|
|
6623
|
+
this.context.event.emit(k.BASELINE_MOUSEENTER, s.evt, e, i);
|
|
6624
|
+
}), t.on("mousemove", (s) => {
|
|
6625
|
+
this.context.event.emit(k.BASELINE_MOUSEMOVE, s.evt, e, i);
|
|
6603
6626
|
}), t.on("mouseout", (s) => {
|
|
6604
|
-
this.context.event.emit(
|
|
6627
|
+
this.context.event.emit(k.BASELINE_MOUSEOUT, s.evt, e, i);
|
|
6605
6628
|
}), t.on("click", (s) => {
|
|
6606
|
-
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(
|
|
6629
|
+
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(k.BASELINE_CLICK, s.evt, e, i) : s.evt.button === 2 && this.context.event.emit(k.BASELINE_CONTEXTMENU, s.evt, e, i);
|
|
6607
6630
|
});
|
|
6608
6631
|
}
|
|
6609
6632
|
}
|
|
@@ -6656,8 +6679,8 @@ class Xe {
|
|
|
6656
6679
|
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();
|
|
6657
6680
|
}
|
|
6658
6681
|
}
|
|
6659
|
-
const
|
|
6660
|
-
class
|
|
6682
|
+
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>';
|
|
6683
|
+
class Ve {
|
|
6661
6684
|
constructor(t, e) {
|
|
6662
6685
|
a(this, "line");
|
|
6663
6686
|
a(this, "initialX", 0);
|
|
@@ -6667,7 +6690,7 @@ class Ke {
|
|
|
6667
6690
|
"border-left-color",
|
|
6668
6691
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
6669
6692
|
"important"
|
|
6670
|
-
), 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 =
|
|
6693
|
+
), 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) => {
|
|
6671
6694
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
6672
6695
|
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
6673
6696
|
}
|
|
@@ -6684,19 +6707,19 @@ class Ke {
|
|
|
6684
6707
|
const c = s[s.length - 1].key;
|
|
6685
6708
|
this.initialWidth = i.getColumnWidth(c);
|
|
6686
6709
|
const g = this.initialX;
|
|
6687
|
-
this.root.event.emit(
|
|
6688
|
-
const d = (
|
|
6710
|
+
this.root.event.emit(k.SHOW_GUIDELINE, g);
|
|
6711
|
+
const d = (m) => o(m), l = (m) => r(m, d, l);
|
|
6689
6712
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6690
6713
|
}, o = (h) => {
|
|
6691
6714
|
if (h.preventDefault(), !e) return;
|
|
6692
6715
|
const c = h.clientX - t;
|
|
6693
6716
|
s[s.length - 1].key;
|
|
6694
|
-
const g = 50 - this.initialWidth, l = e.width - 20 - this.initialX,
|
|
6695
|
-
this.root.event.emit(
|
|
6717
|
+
const g = 50 - this.initialWidth, l = e.width - 20 - this.initialX, m = Math.max(g, Math.min(l, c)), p = this.initialX + m;
|
|
6718
|
+
this.root.event.emit(k.MOVE_GUIDELINE, p);
|
|
6696
6719
|
}, r = (h, c, g) => {
|
|
6697
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(
|
|
6698
|
-
const d = h.clientX - t, l = s[s.length - 1].key,
|
|
6699
|
-
i.setColumnWidth(l,
|
|
6720
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(k.HIDE_GUIDELINE);
|
|
6721
|
+
const d = h.clientX - t, l = s[s.length - 1].key, m = Math.max(50, this.initialWidth + d);
|
|
6722
|
+
i.setColumnWidth(l, m), this.root.event.emit(k.UPDATE_TABLE_HEADER);
|
|
6700
6723
|
};
|
|
6701
6724
|
this.line.addEventListener("mousedown", n);
|
|
6702
6725
|
}
|
|
@@ -6727,11 +6750,11 @@ class je {
|
|
|
6727
6750
|
* 初始化事件监听
|
|
6728
6751
|
*/
|
|
6729
6752
|
initEvents() {
|
|
6730
|
-
this.context.event.on(
|
|
6753
|
+
this.context.event.on(k.SHOW_GUIDELINE, (t) => {
|
|
6731
6754
|
this.show(t);
|
|
6732
|
-
}), this.context.event.on(
|
|
6755
|
+
}), this.context.event.on(k.HIDE_GUIDELINE, () => {
|
|
6733
6756
|
this.hide();
|
|
6734
|
-
}), this.context.event.on(
|
|
6757
|
+
}), this.context.event.on(k.MOVE_GUIDELINE, (t) => {
|
|
6735
6758
|
this.setLeft(t);
|
|
6736
6759
|
});
|
|
6737
6760
|
}
|
|
@@ -6985,7 +7008,7 @@ class Qe {
|
|
|
6985
7008
|
a(this, "handleColumnWidthChange", () => {
|
|
6986
7009
|
this.table.updateWidth(), this.updateSize();
|
|
6987
7010
|
});
|
|
6988
|
-
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 je(this.context, this.container), this.middleLine = new
|
|
7011
|
+
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 je(this.context, this.container), this.middleLine = new Ve(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new He(this.context, this.tableContainer), this.chart = new Xe(this.context, this.chartContainer), this.scrollbar = new _e(
|
|
6989
7012
|
this.context,
|
|
6990
7013
|
this.rootElement,
|
|
6991
7014
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
@@ -7028,21 +7051,21 @@ class Qe {
|
|
|
7028
7051
|
* 设置事件监听器
|
|
7029
7052
|
*/
|
|
7030
7053
|
setupEventListeners() {
|
|
7031
|
-
this.context.event.on(
|
|
7054
|
+
this.context.event.on(k.DATA_UPDATE, () => {
|
|
7032
7055
|
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
7033
|
-
}), this.context.event.on(
|
|
7056
|
+
}), this.context.event.on(k.SCROLL, () => {
|
|
7034
7057
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
7035
|
-
}), this.context.event.on(
|
|
7058
|
+
}), this.context.event.on(k.COLUMN_WIDTH_CHANGE, () => {
|
|
7036
7059
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
7037
|
-
}), this.context.event.on(
|
|
7060
|
+
}), this.context.event.on(k.VIEW_UPDATE, () => {
|
|
7038
7061
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
7039
|
-
}), this.context.event.on(
|
|
7062
|
+
}), this.context.event.on(k.UPDATE_TASK, (t) => {
|
|
7040
7063
|
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
7041
7064
|
immediate: !0
|
|
7042
7065
|
});
|
|
7043
|
-
}), this.context.event.on(
|
|
7066
|
+
}), this.context.event.on(k.CHART_OFFSET_CHANGE, () => {
|
|
7044
7067
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
7045
|
-
}), this.context.event.on(
|
|
7068
|
+
}), this.context.event.on(k.TOGGLE_COLLAPSE, () => {
|
|
7046
7069
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1], { immediate: !0 });
|
|
7047
7070
|
});
|
|
7048
7071
|
}
|
|
@@ -7053,7 +7076,7 @@ class Qe {
|
|
|
7053
7076
|
performRender(t = !1, e = !1) {
|
|
7054
7077
|
this.setStyleValue();
|
|
7055
7078
|
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), h = Math.ceil((this.height - o) / n), c = 2, g = Math.max(0, r), d = h + c, l = this.context.store.getDataManager().getVisibleTasks().slice(g, g + d);
|
|
7056
|
-
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(
|
|
7079
|
+
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(k.LOADED), this.isInitialized = !1), O.debug("execute render");
|
|
7057
7080
|
}
|
|
7058
7081
|
/**
|
|
7059
7082
|
* 公共渲染方法,向后兼容
|
|
@@ -7115,11 +7138,30 @@ class Je {
|
|
|
7115
7138
|
* @return {boolean} 是否成功跳转
|
|
7116
7139
|
*/
|
|
7117
7140
|
jumpTo(t) {
|
|
7118
|
-
const e =
|
|
7141
|
+
const e = G(t);
|
|
7119
7142
|
if (!this.store.getTimeAxis().isInTimeAxis(e)) return !1;
|
|
7120
7143
|
const i = this.store.getTimeAxis().getTimeLeft(e) - 100;
|
|
7121
7144
|
return this.renderer.getScrollbar().scrollTo({ x: Math.max(i, 0) }), !0;
|
|
7122
7145
|
}
|
|
7146
|
+
/**
|
|
7147
|
+
* 滚动到指定任务节点。默认为第一个任务
|
|
7148
|
+
*
|
|
7149
|
+
* @return {boolean} 是否成功跳转
|
|
7150
|
+
*/
|
|
7151
|
+
scrollTo(t, e) {
|
|
7152
|
+
var o;
|
|
7153
|
+
let i = 0, s;
|
|
7154
|
+
const n = Math.max(100, ((o = this.getOptions().scrollbar) == null ? void 0 : o.animationDuration) || 100);
|
|
7155
|
+
if (t) {
|
|
7156
|
+
if (s = this.store.getDataManager().getTaskById(t), !s) return !1;
|
|
7157
|
+
i = s.flatIndex * this.store.getOptionManager().getOptions().row.height - 100, setTimeout(() => {
|
|
7158
|
+
this.jumpTo(s == null ? void 0 : s.startTime);
|
|
7159
|
+
}, n);
|
|
7160
|
+
}
|
|
7161
|
+
return this.renderer.getScrollbar().scrollTo({ y: i }), e && s && setTimeout(() => {
|
|
7162
|
+
this.event.emit(k.SLIDER_BLINK, s.id);
|
|
7163
|
+
}, n * 2), !0;
|
|
7164
|
+
}
|
|
7123
7165
|
/**
|
|
7124
7166
|
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
7125
7167
|
*/
|
|
@@ -7138,11 +7180,11 @@ class Je {
|
|
|
7138
7180
|
}
|
|
7139
7181
|
// 注册对外事件
|
|
7140
7182
|
registerEvents() {
|
|
7141
|
-
this.event.on(
|
|
7183
|
+
this.event.on(k.ERROR, (t, e) => {
|
|
7142
7184
|
this._emit("error", t, e);
|
|
7143
|
-
}), this.event.on(
|
|
7185
|
+
}), this.event.on(k.LOADED, () => {
|
|
7144
7186
|
this._emit("loaded");
|
|
7145
|
-
}), this.event.on(
|
|
7187
|
+
}), this.event.on(k.TASK_DRAG_END, (t, e) => {
|
|
7146
7188
|
this._emit(
|
|
7147
7189
|
"move",
|
|
7148
7190
|
e.map((i) => {
|
|
@@ -7153,47 +7195,51 @@ class Je {
|
|
|
7153
7195
|
};
|
|
7154
7196
|
})
|
|
7155
7197
|
);
|
|
7156
|
-
}), this.event.on(
|
|
7198
|
+
}), this.event.on(k.CHECK_TASK, (t, e) => {
|
|
7157
7199
|
this._emit(
|
|
7158
7200
|
"select",
|
|
7159
7201
|
t.map((i) => i.data),
|
|
7160
7202
|
e,
|
|
7161
7203
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
7162
7204
|
);
|
|
7163
|
-
}), this.event.on(
|
|
7205
|
+
}), this.event.on(k.UPDATE_LINK, (t) => {
|
|
7164
7206
|
this._emit("update:link", t);
|
|
7165
|
-
}), this.event.on(
|
|
7207
|
+
}), this.event.on(k.CREATE_LINK, (t) => {
|
|
7166
7208
|
this._emit("create:link", t);
|
|
7167
7209
|
}), this.event.on(
|
|
7168
|
-
|
|
7210
|
+
k.SELECT_LINK,
|
|
7169
7211
|
(t, e, i) => {
|
|
7170
7212
|
this._emit("select:link", t, e, i);
|
|
7171
7213
|
}
|
|
7172
|
-
), this.event.on(
|
|
7214
|
+
), this.event.on(k.CONTEXT_LINK, (t, e) => {
|
|
7173
7215
|
this._emit("contextmenu:link", t, e);
|
|
7174
|
-
}), this.event.on(
|
|
7216
|
+
}), this.event.on(k.ROW_CLICK, (t, e) => {
|
|
7175
7217
|
this._emit("click:row", t, e.data);
|
|
7176
|
-
}), this.event.on(
|
|
7218
|
+
}), this.event.on(k.ROW_DBL_CLICK, (t, e) => {
|
|
7177
7219
|
this._emit("dblclick:row", t, e.data);
|
|
7178
|
-
}), this.event.on(
|
|
7220
|
+
}), this.event.on(k.ROW_CONTEXTMENU, (t, e) => {
|
|
7179
7221
|
this._emit("contextmenu:row", t, e.data);
|
|
7180
|
-
}), this.event.on(
|
|
7222
|
+
}), this.event.on(k.SLIDER_CLICK, (t, e) => {
|
|
7181
7223
|
this._emit("click:slider", t, e.data);
|
|
7182
|
-
}), this.event.on(
|
|
7224
|
+
}), this.event.on(k.SLIDER_DBL_CLICK, (t, e) => {
|
|
7183
7225
|
this._emit("dblclick:slider", t, e.data);
|
|
7184
|
-
}), this.event.on(
|
|
7226
|
+
}), this.event.on(k.SLIDER_CONTEXTMENU, (t, e) => {
|
|
7185
7227
|
this._emit("contextmenu:slider", t, e.data);
|
|
7186
|
-
}), this.event.on(
|
|
7228
|
+
}), this.event.on(k.SLIDER_ENTER, (t, e) => {
|
|
7229
|
+
this._emit("enter:slider", t, e.data);
|
|
7230
|
+
}), this.event.on(k.SLIDER_HOVER, (t, e) => {
|
|
7187
7231
|
this._emit("hover:slider", t, e.data);
|
|
7188
|
-
}), this.event.on(
|
|
7232
|
+
}), this.event.on(k.SLIDER_LEAVE, (t, e) => {
|
|
7189
7233
|
this._emit("leave:slider", t, e.data);
|
|
7190
|
-
}), this.event.on(
|
|
7234
|
+
}), this.event.on(k.BASELINE_CLICK, (t, e, i) => {
|
|
7191
7235
|
this._emit("click:baseline", t, e.data, i.data);
|
|
7192
|
-
}), this.event.on(
|
|
7236
|
+
}), this.event.on(k.BASELINE_CONTEXTMENU, (t, e, i) => {
|
|
7193
7237
|
this._emit("contextmenu:baseline", t, e.data, i.data);
|
|
7194
|
-
}), this.event.on(
|
|
7238
|
+
}), this.event.on(k.BASELINE_MOUSEENTER, (t, e, i) => {
|
|
7239
|
+
this._emit("enter:baseline", t, e.data, i.data);
|
|
7240
|
+
}), this.event.on(k.BASELINE_MOUSEMOVE, (t, e, i) => {
|
|
7195
7241
|
this._emit("hover:baseline", t, e.data, i.data);
|
|
7196
|
-
}), this.event.on(
|
|
7242
|
+
}), this.event.on(k.BASELINE_MOUSEOUT, (t, e, i) => {
|
|
7197
7243
|
this._emit("leave:baseline", t, e.data, i.data);
|
|
7198
7244
|
});
|
|
7199
7245
|
}
|
|
@@ -7357,8 +7403,55 @@ class si {
|
|
|
7357
7403
|
jumpTo(t) {
|
|
7358
7404
|
return this.context.jumpTo(t);
|
|
7359
7405
|
}
|
|
7406
|
+
/**
|
|
7407
|
+
* 滚动到指定任务
|
|
7408
|
+
* @param id - 任务 ID,如果不传入则滚动到顶部
|
|
7409
|
+
* @param highlight - 是否高亮任务,默认为 false
|
|
7410
|
+
*
|
|
7411
|
+
* @returns 是否成功滚动到指定任务
|
|
7412
|
+
* - `true`: 成功滚动,任务已在视图中可见
|
|
7413
|
+
* - `false`: 滚动失败,可能是任务 ID 无效或任务不可见
|
|
7414
|
+
*
|
|
7415
|
+
* @description 此方法将甘特图的视图滚动到指定任务的位置,使该任务在当前视窗中可见。并且支持跳转后高亮当前任务。
|
|
7416
|
+
*
|
|
7417
|
+
* @example
|
|
7418
|
+
* ```typescript
|
|
7419
|
+
* // 滚动到指定任务
|
|
7420
|
+
* const success1 = gantt.scrollTo('task-1');
|
|
7421
|
+
* const success2 = gantt.scrollTo('non-existent-id'); // 任务不存在,返回 false
|
|
7422
|
+
*
|
|
7423
|
+
* // 滚动到顶部
|
|
7424
|
+
* const success3 = gantt.scrollTo();
|
|
7425
|
+
*
|
|
7426
|
+
* // 检查滚动结果
|
|
7427
|
+
* if (gantt.scrollTo('task-2')) {
|
|
7428
|
+
* console.log('成功滚动到任务 task-2');
|
|
7429
|
+
* } else {
|
|
7430
|
+
* console.log('滚动失败,任务 ID 可能无效');
|
|
7431
|
+
* }
|
|
7432
|
+
*
|
|
7433
|
+
* // 滚动到任务并高亮
|
|
7434
|
+
* gantt.scrollTo('task-3', true);
|
|
7435
|
+
* ```
|
|
7436
|
+
*/
|
|
7437
|
+
scrollTo(t, e) {
|
|
7438
|
+
return this.context.scrollTo(t, e);
|
|
7439
|
+
}
|
|
7360
7440
|
/**
|
|
7361
7441
|
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
7442
|
+
*
|
|
7443
|
+
* 结果集中包含前置链路信息、后置链路信息、所有节点、关联线的信息等
|
|
7444
|
+
* - prev: 前置链路信息
|
|
7445
|
+
* - chain: 所有源 -> 当前任务的完整路径(每条路径末尾为当前节点)
|
|
7446
|
+
* - nodes: 前置方向所有唯一节点
|
|
7447
|
+
* - links: 前置方向所有连线
|
|
7448
|
+
* - next: 后置链路信息
|
|
7449
|
+
* - chain: 当前任务 -> 所有汇的完整路径(每条路径首元素为当前节点)
|
|
7450
|
+
* - nodes: 后置方向所有唯一节点
|
|
7451
|
+
* - links: 后置方向所有连线
|
|
7452
|
+
* - allNodes: 所有相关联的节点
|
|
7453
|
+
* - allLinks: 所有相关联的连线
|
|
7454
|
+
* - current: 当前任务
|
|
7362
7455
|
*/
|
|
7363
7456
|
getDataChain(t) {
|
|
7364
7457
|
return this.context.getDataChain(t);
|
|
@@ -7474,9 +7567,32 @@ class si {
|
|
|
7474
7567
|
} else
|
|
7475
7568
|
this.events.delete(t);
|
|
7476
7569
|
}
|
|
7570
|
+
/**
|
|
7571
|
+
* 根据任务 ID 获取对应的任务数据
|
|
7572
|
+
* @param id 任务 ID
|
|
7573
|
+
* @returns 任务数据
|
|
7574
|
+
*
|
|
7575
|
+
* @example
|
|
7576
|
+
* ```typescript
|
|
7577
|
+
* const data = gantt.getDataById('task-1');
|
|
7578
|
+
* if (data) {
|
|
7579
|
+
* console.log('任务名称:', data.name);
|
|
7580
|
+
* }
|
|
7581
|
+
* ```
|
|
7582
|
+
*/
|
|
7583
|
+
getDataById(t) {
|
|
7584
|
+
var e;
|
|
7585
|
+
return (e = this.context.store.getDataManager().getTaskById(t)) == null ? void 0 : e.data;
|
|
7586
|
+
}
|
|
7587
|
+
/**
|
|
7588
|
+
* 获取当前数据量总数。该数量为所有数据展开后的数据条数
|
|
7589
|
+
*/
|
|
7590
|
+
getDataSize() {
|
|
7591
|
+
return this.context.store.getDataManager().getVisibleSize();
|
|
7592
|
+
}
|
|
7477
7593
|
}
|
|
7478
|
-
|
|
7479
|
-
const ni =
|
|
7594
|
+
Kt();
|
|
7595
|
+
const ni = Ct;
|
|
7480
7596
|
export {
|
|
7481
7597
|
si as XGantt,
|
|
7482
7598
|
B as colorjs,
|