@xpyjs/gantt-core 0.0.1 → 0.0.3
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 +503 -465
- package/dist/x-gantt.umd.cjs +4 -4
- package/package.json +1 -1
- package/types/event/index.d.ts +1 -0
- package/types/rendering/chart/ChartRow.d.ts +1 -1
- package/types/rendering/chart/ChartSlider.d.ts +1 -1
- package/types/rendering/other/GuideLine.d.ts +4 -0
- package/types/rendering/other/MiddleResizeLine.d.ts +8 -0
- package/types/rendering/scrollbar/index.d.ts +1 -0
- package/types/store/ColumnManager.d.ts +2 -0
- package/types/store/DataManager.d.ts +5 -0
- package/types/types/options.d.ts +11 -1
- package/types/types/table.d.ts +0 -5
- package/types/utils/color.d.ts +2 -0
package/dist/x-gantt.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (f, t, e) =>
|
|
4
|
-
import
|
|
5
|
-
import { default as
|
|
6
|
-
import { merge as
|
|
1
|
+
var Ut = Object.defineProperty;
|
|
2
|
+
var Xt = (f, t, e) => t in f ? Ut(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
|
+
var h = (f, t, e) => Xt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import H from "dayjs";
|
|
5
|
+
import { default as ci } from "dayjs";
|
|
6
|
+
import { merge as at, isArray as X, isString as V, isFunction as j, cloneDeep as J, isObject as Mt, remove as st, isNumber as Vt, omit as bt, throttle as vt, isBoolean as ct, debounce as Kt } from "lodash-es";
|
|
7
7
|
import k from "konva";
|
|
8
|
-
const
|
|
9
|
-
function
|
|
8
|
+
const Ot = "0.0.3";
|
|
9
|
+
function jt() {
|
|
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: ${Ot} `,
|
|
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 P = class P {
|
|
|
114
114
|
*/
|
|
115
115
|
static formatArgs(...t) {
|
|
116
116
|
const e = [P.Prefix];
|
|
117
|
-
return P.options.showTimestamp && e.unshift(`[${
|
|
117
|
+
return P.options.showTimestamp && e.unshift(`[${H().format("YYYY-MM-DD HH:mm:ss.SSS")}]`), [e.join(""), ...t];
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
h(P, "Prefix", "[XGantt]"), h(P, "options", {
|
|
@@ -123,8 +123,8 @@ h(P, "Prefix", "[XGantt]"), h(P, "options", {
|
|
|
123
123
|
// 默认不显示时间戳
|
|
124
124
|
showTimestamp: !1
|
|
125
125
|
});
|
|
126
|
-
let
|
|
127
|
-
const
|
|
126
|
+
let L = P;
|
|
127
|
+
const dt = () => ({
|
|
128
128
|
data: [],
|
|
129
129
|
links: {
|
|
130
130
|
show: !1,
|
|
@@ -275,9 +275,14 @@ const lt = () => ({
|
|
|
275
275
|
border: {
|
|
276
276
|
color: "#e5e5e5"
|
|
277
277
|
},
|
|
278
|
+
collapse: {
|
|
279
|
+
show: !0,
|
|
280
|
+
backgroundColor: "#fff",
|
|
281
|
+
radius: 6
|
|
282
|
+
},
|
|
278
283
|
header: {
|
|
279
284
|
height: 80,
|
|
280
|
-
color: "
|
|
285
|
+
color: "auto",
|
|
281
286
|
fontSize: 14,
|
|
282
287
|
fontWeight: 600,
|
|
283
288
|
fontFamily: "Arial"
|
|
@@ -321,20 +326,20 @@ const lt = () => ({
|
|
|
321
326
|
opacity: 0.1
|
|
322
327
|
}
|
|
323
328
|
});
|
|
324
|
-
class
|
|
329
|
+
class qt {
|
|
325
330
|
constructor() {
|
|
326
|
-
h(this, "options",
|
|
331
|
+
h(this, "options", dt());
|
|
327
332
|
}
|
|
328
333
|
getOptions() {
|
|
329
334
|
return this.options;
|
|
330
335
|
}
|
|
331
336
|
setOptions(t, e = { merge: !0 }) {
|
|
332
337
|
var i;
|
|
333
|
-
if (this.options = e.merge ?
|
|
338
|
+
if (this.options = e.merge ? at(dt(), this.options, t) : at(dt(), t), (i = t.holiday) != null && i.holidays && t.holiday.holidays.length > 0) {
|
|
334
339
|
const s = [];
|
|
335
340
|
t.holiday.holidays.forEach((n) => {
|
|
336
341
|
if (X(n.date)) {
|
|
337
|
-
const o = n.date.map((r) =>
|
|
342
|
+
const o = n.date.map((r) => H(r)).sort((r, a) => r.diff(a));
|
|
338
343
|
for (let r = 1; r < o.length; r++)
|
|
339
344
|
if (o[r].diff(o[r - 1], "day") > 1) {
|
|
340
345
|
s.push({
|
|
@@ -365,7 +370,7 @@ class Kt {
|
|
|
365
370
|
return j(t) ? t(e.getEmitData()) : t;
|
|
366
371
|
}
|
|
367
372
|
}
|
|
368
|
-
class
|
|
373
|
+
class Qt {
|
|
369
374
|
constructor() {
|
|
370
375
|
h(this, "events", /* @__PURE__ */ new Map());
|
|
371
376
|
}
|
|
@@ -406,7 +411,7 @@ class jt {
|
|
|
406
411
|
this.events.clear();
|
|
407
412
|
}
|
|
408
413
|
}
|
|
409
|
-
var S = /* @__PURE__ */ ((f) => (f.LOADED = "loaded", f.COLUMN_WIDTH_CHANGE = "column-width-change", f.MOVE_GUIDELINE = "move-guideline", f.SHOW_GUIDELINE = "show-guideline", f.HIDE_GUIDELINE = "hide-guideline", f.TOGGLE_COLLAPSE = "toggle-collapse", f.SCROLL = "scroll", f.CHART_OFFSET_CHANGE = "chart_offset_change", f.DATA_UPDATE = "data-update", f.VIEW_UPDATE = "view-update", f.UPDATE_TABLE_HEADER = "update_table_header", f.UPDATE_TABLE_BODY = "update_table_body", f.UPDATE_CHART_HEADER = "update_chart_header", f.UPDATE_TASK = "update_task", f.UPDATE_LINK = "update_link", f.CREATE_LINK = "create_link", f.TASK_SELECTED = "task_selected", f.TASK_UNSELECTED = "task_unselected", f.SELECT_LINK = "select_link", f.CHECK_TASK = "check_task", f.CONTEXT_LINK = "context_link", f.ROW_CLICK = "row-click", f.ROW_DBL_CLICK = "row-dbl-click", f.ROW_CONTEXTMENU = "row-contextmenu", f.SLIDER_CLICK = "slider-click", f.SLIDER_DBL_CLICK = "slider-dbl-click", f.SLIDER_CONTEXTMENU = "slider-contextmenu", f.SLIDER_DRAGGING = "slider-dragging", f.SLIDER_ENTER = "slider-enter", f.SLIDER_HOVER = "slider-hover", f.SLIDER_LEAVE = "slider-leave", f.SLIDER_BLINK = "slider-blink", f.LINK_BLINK = "link-blink", f.ROW_HIGHLIGHT = "row-highlight", f.ROW_UNHIGHLIGHT = "row-unhighlight", f.TASK_DRAG_START = "task-drag-start", f.TASK_DRAG_MOVE = "task-drag-move", f.TASK_DRAG_END = "task-drag-end", f.BASELINE_CLICK = "baseline-click", f.BASELINE_CONTEXTMENU = "baseline-contextmenu", f.BASELINE_MOUSEENTER = "baseline-mouseenter", f.BASELINE_MOUSEMOVE = "baseline-mousemove", f.BASELINE_MOUSEOUT = "baseline-mouseout", f.ROW_DRAG_START = "row-drag-start", f.ROW_DRAGGING = "row-dragging", f.ROW_DRAG_END = "row-drag-end", f.ERROR = "error", f))(S || {}), Y = /* @__PURE__ */ ((f) => (f.INVALID_TYPE = "INVALID_TYPE", f.TASK_NOT_FOUND = "TASK_NOT_FOUND", f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f.LINK_INVALID_ARG = "LINK_INVALID_ARG", f.LINK_CYCLE = "LINK_CYCLE", f))(Y || {});
|
|
414
|
+
var S = /* @__PURE__ */ ((f) => (f.LOADED = "loaded", f.COLUMN_WIDTH_CHANGE = "column-width-change", f.MOVE_GUIDELINE = "move-guideline", f.SHOW_GUIDELINE = "show-guideline", f.HIDE_GUIDELINE = "hide-guideline", f.TOGGLE_COLLAPSE = "toggle-collapse", f.SCROLL = "scroll", f.CHART_OFFSET_CHANGE = "chart_offset_change", f.DATA_UPDATE = "data-update", f.VIEW_UPDATE = "view-update", f.OPTIONS_UPDATE = "options-update", f.UPDATE_TABLE_HEADER = "update_table_header", f.UPDATE_TABLE_BODY = "update_table_body", f.UPDATE_CHART_HEADER = "update_chart_header", f.UPDATE_TASK = "update_task", f.UPDATE_LINK = "update_link", f.CREATE_LINK = "create_link", f.TASK_SELECTED = "task_selected", f.TASK_UNSELECTED = "task_unselected", f.SELECT_LINK = "select_link", f.CHECK_TASK = "check_task", f.CONTEXT_LINK = "context_link", f.ROW_CLICK = "row-click", f.ROW_DBL_CLICK = "row-dbl-click", f.ROW_CONTEXTMENU = "row-contextmenu", f.SLIDER_CLICK = "slider-click", f.SLIDER_DBL_CLICK = "slider-dbl-click", f.SLIDER_CONTEXTMENU = "slider-contextmenu", f.SLIDER_DRAGGING = "slider-dragging", f.SLIDER_ENTER = "slider-enter", f.SLIDER_HOVER = "slider-hover", f.SLIDER_LEAVE = "slider-leave", f.SLIDER_BLINK = "slider-blink", f.LINK_BLINK = "link-blink", f.ROW_HIGHLIGHT = "row-highlight", f.ROW_UNHIGHLIGHT = "row-unhighlight", f.TASK_DRAG_START = "task-drag-start", f.TASK_DRAG_MOVE = "task-drag-move", f.TASK_DRAG_END = "task-drag-end", f.BASELINE_CLICK = "baseline-click", f.BASELINE_CONTEXTMENU = "baseline-contextmenu", f.BASELINE_MOUSEENTER = "baseline-mouseenter", f.BASELINE_MOUSEMOVE = "baseline-mousemove", f.BASELINE_MOUSEOUT = "baseline-mouseout", f.ROW_DRAG_START = "row-drag-start", f.ROW_DRAGGING = "row-dragging", f.ROW_DRAG_END = "row-drag-end", f.ERROR = "error", f))(S || {}), Y = /* @__PURE__ */ ((f) => (f.INVALID_TYPE = "INVALID_TYPE", f.TASK_NOT_FOUND = "TASK_NOT_FOUND", f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f.LINK_INVALID_ARG = "LINK_INVALID_ARG", f.LINK_CYCLE = "LINK_CYCLE", f))(Y || {});
|
|
410
415
|
function Q() {
|
|
411
416
|
return Math.random().toString(36).substring(2, 15);
|
|
412
417
|
}
|
|
@@ -416,11 +421,11 @@ function $(f, t, e) {
|
|
|
416
421
|
const i = Math.min(t, e), s = Math.max(t, e);
|
|
417
422
|
return Math.min(Math.max(i, f), s);
|
|
418
423
|
}
|
|
419
|
-
function
|
|
424
|
+
function ot(f, t) {
|
|
420
425
|
let e = f;
|
|
421
426
|
return V(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
422
427
|
}
|
|
423
|
-
function
|
|
428
|
+
function ut(f, t, e = "round") {
|
|
424
429
|
if (t === 0)
|
|
425
430
|
throw new Error("基准值不能为0");
|
|
426
431
|
if (Math.abs(f) <= t / 2)
|
|
@@ -428,7 +433,7 @@ function ct(f, t, e = "round") {
|
|
|
428
433
|
const i = Math.floor(f / t), s = Math.ceil(f / t), n = i * t, o = s * t, r = Math.abs(f - n), a = Math.abs(f - o);
|
|
429
434
|
return e === "floor" ? n : e === "ceil" ? o : r <= a ? n : o;
|
|
430
435
|
}
|
|
431
|
-
function
|
|
436
|
+
function rt(f, t = 4) {
|
|
432
437
|
return typeof f == "number" ? [f, f, f, f] : Array.isArray(f) ? [
|
|
433
438
|
f[0] ?? t,
|
|
434
439
|
f[1] ?? t,
|
|
@@ -436,19 +441,19 @@ function ot(f, t = 4) {
|
|
|
436
441
|
f[3] ?? t
|
|
437
442
|
] : [t, t, t, t];
|
|
438
443
|
}
|
|
439
|
-
function
|
|
444
|
+
function Zt(f, t = 100) {
|
|
440
445
|
if (!Number.isFinite(f) || !Number.isFinite(t) || t === 0 || f < 0)
|
|
441
446
|
return 0;
|
|
442
447
|
const e = f / Math.abs(t);
|
|
443
448
|
return Math.min(e, 1);
|
|
444
449
|
}
|
|
445
|
-
function
|
|
450
|
+
function pt(f, t = 2, e = !1) {
|
|
446
451
|
const i = f.toFixed(t);
|
|
447
452
|
return e ? i : i.replace(/\.?0+$/, "");
|
|
448
453
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
451
|
-
const i =
|
|
454
|
+
const gt = /* @__PURE__ */ new Map();
|
|
455
|
+
function Tt(f, t = 16, e = 16) {
|
|
456
|
+
const i = gt.get(f);
|
|
452
457
|
if (i) return i;
|
|
453
458
|
const s = new Promise((n, o) => {
|
|
454
459
|
let r = f;
|
|
@@ -467,14 +472,14 @@ function bt(f, t = 16, e = 16) {
|
|
|
467
472
|
c.onload = () => {
|
|
468
473
|
URL.revokeObjectURL(c.src), n(c);
|
|
469
474
|
}, c.onerror = (l) => {
|
|
470
|
-
URL.revokeObjectURL(c.src),
|
|
475
|
+
URL.revokeObjectURL(c.src), gt.delete(f), o(l);
|
|
471
476
|
};
|
|
472
477
|
const u = new Blob([r], { type: "image/svg+xml" }), d = URL.createObjectURL(u);
|
|
473
478
|
c.src = d;
|
|
474
479
|
});
|
|
475
|
-
return
|
|
480
|
+
return gt.set(f, s), s;
|
|
476
481
|
}
|
|
477
|
-
class
|
|
482
|
+
class yt {
|
|
478
483
|
constructor(t, e, i, s, n) {
|
|
479
484
|
h(this, "__key__", Q());
|
|
480
485
|
/**
|
|
@@ -549,12 +554,12 @@ class mt {
|
|
|
549
554
|
return;
|
|
550
555
|
i = i[n];
|
|
551
556
|
}
|
|
552
|
-
return
|
|
557
|
+
return Mt(i) ? J(i) : i;
|
|
553
558
|
}
|
|
554
559
|
/** 切换展示模式时,需要调整时间 */
|
|
555
560
|
updateMode() {
|
|
556
561
|
let t = !1, e = !1;
|
|
557
|
-
return this.data[this.fields.startTime] && (!this.startTime || !this.startTime.isSame(
|
|
562
|
+
return this.data[this.fields.startTime] && (!this.startTime || !this.startTime.isSame(H(this.data[this.fields.startTime]))) && (this.startTime = H(this.data[this.fields.startTime]), t = !0, e = !0), this.data[this.fields.endTime] && (!this.endTime || !this.endTime.isSame(H(this.data[this.fields.endTime]))) && (this.endTime = H(this.data[this.fields.endTime]), t = !0, e = !0), e && this.store.updateTime(this.startTime, this.endTime), this.startTime && this.endTime && this.duration === 0 && (this.duration = this.endTime.diff(this.startTime)), this.isMilestone() && (!this.endTime || !this.endTime.isSame(this.startTime)) && (this.endTime = this.startTime, t = !0), t;
|
|
558
563
|
}
|
|
559
564
|
updateData(t) {
|
|
560
565
|
this.data = t;
|
|
@@ -568,7 +573,7 @@ class mt {
|
|
|
568
573
|
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.isMilestone() ? this.data[this.fields.endTime || "endTime"] = this.startTime.add(this.duration).format(i) : this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(S.UPDATE_TASK, this);
|
|
569
574
|
}
|
|
570
575
|
clone() {
|
|
571
|
-
return new
|
|
576
|
+
return new yt(
|
|
572
577
|
this.store,
|
|
573
578
|
this.event,
|
|
574
579
|
J(this.data),
|
|
@@ -607,7 +612,7 @@ class mt {
|
|
|
607
612
|
return !1;
|
|
608
613
|
}
|
|
609
614
|
}
|
|
610
|
-
class
|
|
615
|
+
class Jt {
|
|
611
616
|
constructor(t, e, i) {
|
|
612
617
|
/** 基线ID */
|
|
613
618
|
h(this, "id");
|
|
@@ -629,9 +634,9 @@ class Qt {
|
|
|
629
634
|
const s = this.store.getOptionManager().getOptions().fields, n = this.store.getOptionManager().getOptions().baselines.fields;
|
|
630
635
|
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;
|
|
631
636
|
const o = i[s.startTime] || i[n.startTime];
|
|
632
|
-
o && (this.startTime =
|
|
637
|
+
o && (this.startTime = H(o));
|
|
633
638
|
const r = i[s.endTime] || i[n.endTime];
|
|
634
|
-
r && (this.endTime =
|
|
639
|
+
r && (this.endTime = H(r)), this.data = i;
|
|
635
640
|
}
|
|
636
641
|
getField(t) {
|
|
637
642
|
return this.data[t];
|
|
@@ -653,7 +658,7 @@ class Qt {
|
|
|
653
658
|
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: u, unit: e };
|
|
654
659
|
}
|
|
655
660
|
}
|
|
656
|
-
class
|
|
661
|
+
class te {
|
|
657
662
|
constructor(t, e) {
|
|
658
663
|
/**
|
|
659
664
|
* 原始数据
|
|
@@ -702,38 +707,36 @@ class Zt {
|
|
|
702
707
|
initTasks(t = !1) {
|
|
703
708
|
t ? (this.dataLevel = 0, this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear(), this.rawData.forEach((e) => {
|
|
704
709
|
this.tasks.push(this.createTask(e));
|
|
705
|
-
})) : (this.dataLevel = 0, this.tasks = [], this.taskMap.clear(), this.
|
|
706
|
-
this.tasks.push(this.createTask(e));
|
|
707
|
-
}));
|
|
710
|
+
})) : this.rawData.length > 0 ? (this.dataLevel = 0, this.updateTask(this.rawData, this.tasks)) : (this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear(), this.dataLevel = 0);
|
|
708
711
|
}
|
|
709
712
|
createTask(t, e, i = !0) {
|
|
710
|
-
const s = this.store.getOptionManager().getOptions().fields, n = new
|
|
713
|
+
const s = this.store.getOptionManager().getOptions().fields, n = new yt(this.store, this.event, t, e);
|
|
711
714
|
return i && Array.isArray(t[s.children]) && (n.children = t[s.children].map(
|
|
712
715
|
(o) => this.createTask(o, n)
|
|
713
716
|
)), this.taskMap.set(n.id, n), this.dataLevel = Math.max(this.dataLevel, n.level), n;
|
|
714
717
|
}
|
|
715
718
|
updateTask(t, e, i) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
if (r)
|
|
725
|
-
if (o && o.children)
|
|
726
|
-
this.updateTask(r, o.children, o);
|
|
727
|
-
else {
|
|
728
|
-
const a = r.map(
|
|
729
|
-
(c) => this.createTask(c, e[s], !1)
|
|
730
|
-
);
|
|
731
|
-
e[s].children = a;
|
|
732
|
-
}
|
|
733
|
-
else o && o.children && (o.children = []);
|
|
734
|
-
s++;
|
|
719
|
+
const s = this.store.getOptionManager().getOptions(), n = s.fields.id, o = s.fields.children, r = /* @__PURE__ */ new Map();
|
|
720
|
+
e.forEach((a) => r.set(a.id, a)), e.length = 0;
|
|
721
|
+
for (const a of t) {
|
|
722
|
+
const c = a[n];
|
|
723
|
+
let u = r.get(c);
|
|
724
|
+
u ? (u.updateData(a), u.parent = i, r.delete(c)) : u = this.createTask(a, i, !1), u.level = i ? i.level + 1 : 0, this.dataLevel = Math.max(this.dataLevel, u.level);
|
|
725
|
+
const d = a[o];
|
|
726
|
+
Array.isArray(d) && d.length > 0 ? (u.children || (u.children = []), this.updateTask(d, u.children, u)) : u.children && u.children.length > 0 && (this.removeTasksRecursive(u.children), u.children = []), e.push(u);
|
|
735
727
|
}
|
|
736
|
-
|
|
728
|
+
r.size > 0 && this.removeTasksRecursive(Array.from(r.values()));
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* 递归清理任务(从全局 Map、选中状态等中移除)
|
|
732
|
+
* 这是一个内部辅助方法,不触发视图更新事件,仅清理数据引用
|
|
733
|
+
*/
|
|
734
|
+
removeTasksRecursive(t) {
|
|
735
|
+
t.forEach((e) => {
|
|
736
|
+
this.taskMap.delete(e.id), this.collapsedTaskIds.delete(e.id), this.selectedTaskId === e.id && (this.selectedTaskId = null, this.event.emit(S.TASK_UNSELECTED, e.id));
|
|
737
|
+
const i = this.checkedList.findIndex((s) => s.id === e.id);
|
|
738
|
+
i !== -1 && this.checkedList.splice(i, 1), e.children && e.children.length > 0 && this.removeTasksRecursive(e.children);
|
|
739
|
+
});
|
|
737
740
|
}
|
|
738
741
|
/**
|
|
739
742
|
* 获取源数据
|
|
@@ -788,24 +791,23 @@ class Zt {
|
|
|
788
791
|
* 移动任务位置
|
|
789
792
|
*/
|
|
790
793
|
moveTask(t, e, i) {
|
|
794
|
+
var r;
|
|
791
795
|
const s = this.getVisibleTasks()[i];
|
|
792
796
|
if (!e || !s || t === "inside" && e.isSomeoneChildren(s) || t !== "inside" && e.isSomeoneChildren(s.parent)) return;
|
|
793
797
|
const n = this.store.getOptionManager().getOptions().fields.id, o = this.store.getOptionManager().getOptions().fields.children;
|
|
794
798
|
if (e.parent && e.parent.children) {
|
|
795
|
-
e.parent.children
|
|
796
|
-
|
|
797
|
-
);
|
|
798
|
-
const r = e.parent.data[o] || [];
|
|
799
|
-
e.parent.data[o] = r.filter((a) => a[n] !== e.id);
|
|
799
|
+
st(e.parent.children, (c) => (c == null ? void 0 : c.id) === e.id);
|
|
800
|
+
const a = (r = e.parent.data) == null ? void 0 : r[o];
|
|
801
|
+
st(a, (c) => (c == null ? void 0 : c[n]) === e.id);
|
|
800
802
|
} else
|
|
801
|
-
this.tasks
|
|
803
|
+
st(this.tasks, (a) => (a == null ? void 0 : a.id) === e.id), st(this.rawData, (a) => (a == null ? void 0 : a[n]) === e.id);
|
|
802
804
|
if (t === "inside")
|
|
803
805
|
s.children = s.children || [], s.children.push(e), e.parent = s, s.data[o] = s.data[o] || [], s.data[o].push(e.data);
|
|
804
806
|
else {
|
|
805
|
-
const
|
|
806
|
-
t === "before" ? (
|
|
807
|
+
const a = s.parent ? s.parent.children : this.tasks, c = a.findIndex((l) => l.id === s.id), u = s.parent ? s.parent.data[o] || [] : this.rawData, d = u.findIndex((l) => l[n] === s.id);
|
|
808
|
+
t === "before" ? (a.splice(c, 0, e), u.splice(d, 0, e.data)) : t === "after" && (a.splice(c + 1, 0, e), u.splice(d + 1, 0, e.data)), e.parent = s.parent;
|
|
807
809
|
}
|
|
808
|
-
e.parent ? e.level = e.parent.level + 1 : e.level = 0, this.updateChildrenLevel(e), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE),
|
|
810
|
+
e.parent ? e.level = e.parent.level + 1 : e.level = 0, this.updateChildrenLevel(e), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE), this.event.emit(S.ROW_DRAG_END, s, e);
|
|
809
811
|
}
|
|
810
812
|
/**
|
|
811
813
|
* 展开任务
|
|
@@ -970,7 +972,7 @@ class Zt {
|
|
|
970
972
|
setBaselines(t) {
|
|
971
973
|
this.baselines = [], this.baselineMap.clear(), this.baselineTaskMap.clear(), t.forEach((e) => {
|
|
972
974
|
var s, n;
|
|
973
|
-
const i = new
|
|
975
|
+
const i = new Jt(this.store, this.event, e);
|
|
974
976
|
this.baselines.push(i), this.baselineMap.set(i.id, i), this.baselineTaskMap.has(i.taskId) || this.baselineTaskMap.set(i.taskId, []), i.target ? (s = this.baselineTaskMap.get(i.taskId)) == null || s.unshift(i) : (n = this.baselineTaskMap.get(i.taskId)) == null || n.push(i);
|
|
975
977
|
});
|
|
976
978
|
}
|
|
@@ -986,7 +988,7 @@ class Zt {
|
|
|
986
988
|
return this.baselineTaskMap.get(t) || [];
|
|
987
989
|
}
|
|
988
990
|
}
|
|
989
|
-
function
|
|
991
|
+
function ee(f) {
|
|
990
992
|
var s;
|
|
991
993
|
if (typeof f == "object" && f !== null)
|
|
992
994
|
return {
|
|
@@ -996,7 +998,7 @@ function Jt(f) {
|
|
|
996
998
|
a: $(f.a ?? 1, 0, 1)
|
|
997
999
|
};
|
|
998
1000
|
if (typeof f != "string")
|
|
999
|
-
return
|
|
1001
|
+
return L.warn(`Invalid color value type: ${typeof f}`), null;
|
|
1000
1002
|
let t = f.trim();
|
|
1001
1003
|
const e = (s = document == null ? void 0 : document.createElement("canvas")) == null ? void 0 : s.getContext("2d");
|
|
1002
1004
|
if (e && (e.fillStyle = t, t = e.fillStyle), t.startsWith("#")) {
|
|
@@ -1005,7 +1007,7 @@ function Jt(f) {
|
|
|
1005
1007
|
try {
|
|
1006
1008
|
o = parseInt(n, 16);
|
|
1007
1009
|
} catch {
|
|
1008
|
-
return
|
|
1010
|
+
return L.warn(`Invalid hex color: ${f}`), null;
|
|
1009
1011
|
}
|
|
1010
1012
|
if (n.length === 3)
|
|
1011
1013
|
r = (o >> 8 & 15) * 17, a = (o >> 4 & 15) * 17, c = (o & 15) * 17;
|
|
@@ -1014,7 +1016,7 @@ function Jt(f) {
|
|
|
1014
1016
|
else if (n.length === 8)
|
|
1015
1017
|
r = o >> 24 & 255, a = o >> 16 & 255, c = o >> 8 & 255, u = (o & 255) / 255;
|
|
1016
1018
|
else
|
|
1017
|
-
return
|
|
1019
|
+
return L.warn(`Invalid hex color length: ${f}`), null;
|
|
1018
1020
|
return { r, g: a, b: c, a: u };
|
|
1019
1021
|
}
|
|
1020
1022
|
let i = t.match(
|
|
@@ -1029,9 +1031,9 @@ function Jt(f) {
|
|
|
1029
1031
|
a: i[4] !== void 0 ? $(parseFloat(i[4]), 0, 1) : 1
|
|
1030
1032
|
};
|
|
1031
1033
|
}
|
|
1032
|
-
return
|
|
1034
|
+
return L.warn(`Could not parse color: ${f}`), null;
|
|
1033
1035
|
}
|
|
1034
|
-
function
|
|
1036
|
+
function ie(f, t, e, i, s = !1, n = !1) {
|
|
1035
1037
|
const o = (l) => {
|
|
1036
1038
|
const m = Math.round($(l, 0, 255)).toString(16);
|
|
1037
1039
|
return m.length === 1 ? "0" + m : m;
|
|
@@ -1055,8 +1057,8 @@ class et {
|
|
|
1055
1057
|
h(this, "_g");
|
|
1056
1058
|
h(this, "_b");
|
|
1057
1059
|
h(this, "_a");
|
|
1058
|
-
const e =
|
|
1059
|
-
e === null ? (
|
|
1060
|
+
const e = ee(t);
|
|
1061
|
+
e === null ? (L.error(`Failed to parse color: ${t}. Using default black.`), this._r = 0, this._g = 0, this._b = 0, this._a = 1) : (this._r = Math.round(e.r), this._g = Math.round(e.g), this._b = Math.round(e.b), this._a = e.a);
|
|
1060
1062
|
}
|
|
1061
1063
|
// --- Getters ---
|
|
1062
1064
|
/** 获取 Red 通道值 (0-255) */
|
|
@@ -1095,7 +1097,7 @@ class et {
|
|
|
1095
1097
|
* @returns Hex/HexA 字符串。
|
|
1096
1098
|
*/
|
|
1097
1099
|
toHex(t = !1, e = !1) {
|
|
1098
|
-
return
|
|
1100
|
+
return ie(
|
|
1099
1101
|
this._r,
|
|
1100
1102
|
this._g,
|
|
1101
1103
|
this._b,
|
|
@@ -1202,13 +1204,13 @@ class et {
|
|
|
1202
1204
|
* @param option - 传递给插件的选项 (可选)。
|
|
1203
1205
|
*/
|
|
1204
1206
|
static extend(t, e) {
|
|
1205
|
-
typeof t == "function" ? t(e, et, B) :
|
|
1207
|
+
typeof t == "function" ? t(e, et, B) : L.warn(
|
|
1206
1208
|
"Invalid plugin provided to Colorjs.extend. Expected a function."
|
|
1207
1209
|
);
|
|
1208
1210
|
}
|
|
1209
1211
|
}
|
|
1210
|
-
const B = (f) => f instanceof et ? f : new et(f);
|
|
1211
|
-
class
|
|
1212
|
+
const B = (f) => f instanceof et ? f : new et(f), ht = (f, t) => f.toLowerCase() === "auto" ? B(t).isLight() ? "#000000" : "#FFFFFF" : f;
|
|
1213
|
+
class Lt {
|
|
1212
1214
|
constructor(t, e, i) {
|
|
1213
1215
|
h(this, "element");
|
|
1214
1216
|
h(this, "iconElement");
|
|
@@ -1367,8 +1369,8 @@ class Mt {
|
|
|
1367
1369
|
this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
1368
1370
|
}
|
|
1369
1371
|
}
|
|
1370
|
-
const
|
|
1371
|
-
class
|
|
1372
|
+
const St = "handler_column";
|
|
1373
|
+
class se {
|
|
1372
1374
|
constructor(t) {
|
|
1373
1375
|
/** 源列数据 */
|
|
1374
1376
|
h(this, "sourceColumns", []);
|
|
@@ -1378,6 +1380,8 @@ class ee {
|
|
|
1378
1380
|
h(this, "leafColumns", []);
|
|
1379
1381
|
/** 临时叶子列数据,用于更新源数据,读取宽度等原信息 */
|
|
1380
1382
|
h(this, "temporaryLeafColumns", []);
|
|
1383
|
+
/** 记录每一列的列宽 */
|
|
1384
|
+
h(this, "columnWidths", /* @__PURE__ */ new Map());
|
|
1381
1385
|
/**
|
|
1382
1386
|
* 保存所有行列合并的信息
|
|
1383
1387
|
*
|
|
@@ -1407,7 +1411,7 @@ class ee {
|
|
|
1407
1411
|
r ? c = `group-${o}` : c = `field-${n.field}`;
|
|
1408
1412
|
const u = [...(i == null ? void 0 : i.path) || [], c];
|
|
1409
1413
|
c = "column-" + o + "-" + u.join("-");
|
|
1410
|
-
const d = n.label || (a ? n.field : ""), l = a ? ((p = this.temporaryLeafColumns.find((g) => g.key === c)) == null ? void 0 : p.width) || n.width || 100 : "auto", m = {
|
|
1414
|
+
const d = n.label || (a ? n.field : ""), l = this.columnWidths.get(c) ?? (a ? ((p = this.temporaryLeafColumns.find((g) => g.key === c)) == null ? void 0 : p.width) || n.width || 100 : "auto"), m = {
|
|
1411
1415
|
label: d,
|
|
1412
1416
|
level: s,
|
|
1413
1417
|
maxLevel: s,
|
|
@@ -1456,13 +1460,13 @@ class ee {
|
|
|
1456
1460
|
return this.isCollapsed() ? 0 : this.leafColumns.reduce((t, e) => t + e.width, this.getHandlerColumn().width);
|
|
1457
1461
|
}
|
|
1458
1462
|
getColumnWidth(t) {
|
|
1459
|
-
if (t ===
|
|
1463
|
+
if (t === St) return this.getHandlerColumn().width;
|
|
1460
1464
|
const e = this.leafColumns.find((i) => i.key === t);
|
|
1461
1465
|
return typeof (e == null ? void 0 : e.width) == "number" ? e.width : 0;
|
|
1462
1466
|
}
|
|
1463
1467
|
setColumnWidth(t, e) {
|
|
1464
1468
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1465
|
-
i && (i.width = e), this.context.event.emit(S.COLUMN_WIDTH_CHANGE, t, e);
|
|
1469
|
+
i && (i.width = e, this.columnWidths.set(t, e)), this.context.event.emit(S.COLUMN_WIDTH_CHANGE, t, e);
|
|
1466
1470
|
}
|
|
1467
1471
|
isLastColumn(t) {
|
|
1468
1472
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1496,12 +1500,12 @@ class ee {
|
|
|
1496
1500
|
customStyle: {
|
|
1497
1501
|
paddingLeft: s ? `${e ? 40 : 8}px` : 0
|
|
1498
1502
|
},
|
|
1499
|
-
headerRender: () => i ? new
|
|
1503
|
+
headerRender: () => i ? new Lt(this.context).getElement() : null,
|
|
1500
1504
|
ellipsis: !1
|
|
1501
1505
|
},
|
|
1502
1506
|
children: [],
|
|
1503
1507
|
path: [],
|
|
1504
|
-
key:
|
|
1508
|
+
key: St,
|
|
1505
1509
|
isLeaf: !0,
|
|
1506
1510
|
width: t
|
|
1507
1511
|
};
|
|
@@ -1603,23 +1607,23 @@ const tt = class tt {
|
|
|
1603
1607
|
return !t || t.from == null || t.to == null ? {
|
|
1604
1608
|
ok: !1,
|
|
1605
1609
|
reason: Y.LINK_INVALID_ARG,
|
|
1606
|
-
message:
|
|
1610
|
+
message: L.getMessage("Missing endpoint")
|
|
1607
1611
|
} : t.from === t.to ? {
|
|
1608
1612
|
ok: !1,
|
|
1609
1613
|
reason: Y.LINK_SAME,
|
|
1610
|
-
message:
|
|
1614
|
+
message: L.getMessage("Cannot link task to itself")
|
|
1611
1615
|
} : !this.getTask(t.from) || !this.getTask(t.to) ? {
|
|
1612
1616
|
ok: !1,
|
|
1613
1617
|
reason: Y.TASK_NOT_FOUND,
|
|
1614
|
-
message:
|
|
1618
|
+
message: L.getMessage("Task not found")
|
|
1615
1619
|
} : t.type && !this.validateLinkType(t.type) ? {
|
|
1616
1620
|
ok: !1,
|
|
1617
1621
|
reason: Y.INVALID_TYPE,
|
|
1618
|
-
message:
|
|
1622
|
+
message: L.getMessage(`Invalid link type: ${t.type}. It must be one of: ${Object.keys(tt.LINK_TYPE_MAP).join(", ")}`)
|
|
1619
1623
|
} : this.isLinkExist(t.from, t.to, t.type) ? {
|
|
1620
1624
|
ok: !1,
|
|
1621
1625
|
reason: Y.LINK_EXIST,
|
|
1622
|
-
message:
|
|
1626
|
+
message: L.getMessage("Link already exists")
|
|
1623
1627
|
} : { ok: !0 };
|
|
1624
1628
|
}
|
|
1625
1629
|
/** 校验新增连线是否会产生环 */
|
|
@@ -1632,7 +1636,7 @@ const tt = class tt {
|
|
|
1632
1636
|
return {
|
|
1633
1637
|
ok: !1,
|
|
1634
1638
|
reason: Y.LINK_CYCLE,
|
|
1635
|
-
message:
|
|
1639
|
+
message: L.getMessage("Adding this link would create a cycle"),
|
|
1636
1640
|
cycleInfo: o
|
|
1637
1641
|
};
|
|
1638
1642
|
}
|
|
@@ -1733,8 +1737,8 @@ const tt = class tt {
|
|
|
1733
1737
|
else {
|
|
1734
1738
|
for (const E of C) {
|
|
1735
1739
|
const T = r(E, v, b);
|
|
1736
|
-
for (const
|
|
1737
|
-
M.push([x, ...
|
|
1740
|
+
for (const O of T)
|
|
1741
|
+
M.push([x, ...O]);
|
|
1738
1742
|
}
|
|
1739
1743
|
M.length === 0 && (M = [[x]]);
|
|
1740
1744
|
}
|
|
@@ -1753,8 +1757,8 @@ const tt = class tt {
|
|
|
1753
1757
|
else {
|
|
1754
1758
|
for (const E of C) {
|
|
1755
1759
|
const T = a(E, v, b);
|
|
1756
|
-
for (const
|
|
1757
|
-
M.push([...
|
|
1760
|
+
for (const O of T)
|
|
1761
|
+
M.push([...O, x]);
|
|
1758
1762
|
}
|
|
1759
1763
|
M.length === 0 && (M = [[x]]);
|
|
1760
1764
|
}
|
|
@@ -1770,8 +1774,8 @@ const tt = class tt {
|
|
|
1770
1774
|
for (let C = 0; C < w.length - 1; C++) {
|
|
1771
1775
|
const M = w[C].id, E = w[C + 1].id, T = this.findLinkFast(M, E);
|
|
1772
1776
|
if (T) {
|
|
1773
|
-
const
|
|
1774
|
-
m.has(
|
|
1777
|
+
const O = `${T.from}-${T.to}-${T.type || "default"}`;
|
|
1778
|
+
m.has(O) || (b.push(T), m.set(O, T));
|
|
1775
1779
|
}
|
|
1776
1780
|
}
|
|
1777
1781
|
}
|
|
@@ -1829,7 +1833,7 @@ const tt = class tt {
|
|
|
1829
1833
|
cycles: u,
|
|
1830
1834
|
nodes: Array.from(new Set(c.flat()))
|
|
1831
1835
|
};
|
|
1832
|
-
return this.lastCycleReport = d, t && d.hasCycle &&
|
|
1836
|
+
return this.lastCycleReport = d, t && d.hasCycle && L.warn("Cycle detected in task dependencies", d), d;
|
|
1833
1837
|
}
|
|
1834
1838
|
/** 获取最近一次环检测报告 */
|
|
1835
1839
|
getCycleReport() {
|
|
@@ -2130,12 +2134,12 @@ h(tt, "LINK_TYPE_MAP", {
|
|
|
2130
2134
|
FF: { from: "F", to: "F", description: "结束到结束" },
|
|
2131
2135
|
SS: { from: "S", to: "S", description: "开始到开始" }
|
|
2132
2136
|
});
|
|
2133
|
-
let
|
|
2137
|
+
let mt = tt;
|
|
2134
2138
|
var N = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2135
2139
|
function U(f) {
|
|
2136
2140
|
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
2137
2141
|
}
|
|
2138
|
-
var
|
|
2142
|
+
var Dt = { exports: {} };
|
|
2139
2143
|
(function(f, t) {
|
|
2140
2144
|
(function(e, i) {
|
|
2141
2145
|
f.exports = i();
|
|
@@ -2155,20 +2159,20 @@ var Lt = { exports: {} };
|
|
|
2155
2159
|
}, b = function(M, E) {
|
|
2156
2160
|
return M ? y(M) ? { negative: !0, format: "" + v(M) + E } : { negative: !1, format: "" + M + E } : { negative: !1, format: "" };
|
|
2157
2161
|
}, w = function() {
|
|
2158
|
-
function M(T,
|
|
2159
|
-
var
|
|
2160
|
-
if (this.$d = {}, this.$l = A, T === void 0 && (this.$ms = 0, this.parseFromMilliseconds()),
|
|
2162
|
+
function M(T, O, A) {
|
|
2163
|
+
var D = this;
|
|
2164
|
+
if (this.$d = {}, this.$l = A, T === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), O) return p(T * l[g(O)], this);
|
|
2161
2165
|
if (typeof T == "number") return this.$ms = T, this.parseFromMilliseconds(), this;
|
|
2162
2166
|
if (typeof T == "object") return Object.keys(T).forEach(function(W) {
|
|
2163
|
-
|
|
2167
|
+
D.$d[g(W)] = T[W];
|
|
2164
2168
|
}), this.calMilliseconds(), this;
|
|
2165
2169
|
if (typeof T == "string") {
|
|
2166
|
-
var
|
|
2167
|
-
if (
|
|
2168
|
-
var
|
|
2170
|
+
var _ = T.match(d);
|
|
2171
|
+
if (_) {
|
|
2172
|
+
var R = _.slice(2).map(function(W) {
|
|
2169
2173
|
return W != null ? Number(W) : 0;
|
|
2170
2174
|
});
|
|
2171
|
-
return this.$d.years =
|
|
2175
|
+
return this.$d.years = R[0], this.$d.months = R[1], this.$d.weeks = R[2], this.$d.days = R[3], this.$d.hours = R[4], this.$d.minutes = R[5], this.$d.seconds = R[6], this.calMilliseconds(), this;
|
|
2172
2176
|
}
|
|
2173
2177
|
}
|
|
2174
2178
|
return this;
|
|
@@ -2176,39 +2180,39 @@ var Lt = { exports: {} };
|
|
|
2176
2180
|
var E = M.prototype;
|
|
2177
2181
|
return E.calMilliseconds = function() {
|
|
2178
2182
|
var T = this;
|
|
2179
|
-
this.$ms = Object.keys(this.$d).reduce(function(
|
|
2180
|
-
return
|
|
2183
|
+
this.$ms = Object.keys(this.$d).reduce(function(O, A) {
|
|
2184
|
+
return O + (T.$d[A] || 0) * l[A];
|
|
2181
2185
|
}, 0);
|
|
2182
2186
|
}, E.parseFromMilliseconds = function() {
|
|
2183
2187
|
var T = this.$ms;
|
|
2184
2188
|
this.$d.years = x(T / c), T %= c, this.$d.months = x(T / u), T %= u, this.$d.days = x(T / r), T %= r, this.$d.hours = x(T / o), T %= o, this.$d.minutes = x(T / n), T %= n, this.$d.seconds = x(T / s), T %= s, this.$d.milliseconds = T;
|
|
2185
2189
|
}, E.toISOString = function() {
|
|
2186
|
-
var T = b(this.$d.years, "Y"),
|
|
2190
|
+
var T = b(this.$d.years, "Y"), O = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2187
2191
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
2188
|
-
var
|
|
2192
|
+
var D = b(A, "D"), _ = b(this.$d.hours, "H"), R = b(this.$d.minutes, "M"), W = this.$d.seconds || 0;
|
|
2189
2193
|
this.$d.milliseconds && (W += this.$d.milliseconds / 1e3, W = Math.round(1e3 * W) / 1e3);
|
|
2190
|
-
var I = b(W, "S"), G = T.negative ||
|
|
2194
|
+
var I = b(W, "S"), G = T.negative || O.negative || D.negative || _.negative || R.negative || I.negative, F = _.format || R.format || I.format ? "T" : "", z = (G ? "-" : "") + "P" + T.format + O.format + D.format + F + _.format + R.format + I.format;
|
|
2191
2195
|
return z === "P" || z === "-P" ? "P0D" : z;
|
|
2192
2196
|
}, E.toJSON = function() {
|
|
2193
2197
|
return this.toISOString();
|
|
2194
2198
|
}, E.format = function(T) {
|
|
2195
|
-
var
|
|
2196
|
-
return
|
|
2197
|
-
return
|
|
2199
|
+
var O = T || "YYYY-MM-DDTHH:mm:ss", A = { Y: this.$d.years, YY: i.s(this.$d.years, 2, "0"), YYYY: i.s(this.$d.years, 4, "0"), M: this.$d.months, MM: i.s(this.$d.months, 2, "0"), D: this.$d.days, DD: i.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: i.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: i.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: i.s(this.$d.seconds, 2, "0"), SSS: i.s(this.$d.milliseconds, 3, "0") };
|
|
2200
|
+
return O.replace(a, function(D, _) {
|
|
2201
|
+
return _ || String(A[D]);
|
|
2198
2202
|
});
|
|
2199
2203
|
}, E.as = function(T) {
|
|
2200
2204
|
return this.$ms / l[g(T)];
|
|
2201
2205
|
}, E.get = function(T) {
|
|
2202
|
-
var
|
|
2203
|
-
return A === "milliseconds" ?
|
|
2204
|
-
}, E.add = function(T,
|
|
2205
|
-
var
|
|
2206
|
-
return
|
|
2207
|
-
}, E.subtract = function(T,
|
|
2208
|
-
return this.add(T,
|
|
2206
|
+
var O = this.$ms, A = g(T);
|
|
2207
|
+
return A === "milliseconds" ? O %= 1e3 : O = A === "weeks" ? x(O / l[A]) : this.$d[A], O || 0;
|
|
2208
|
+
}, E.add = function(T, O, A) {
|
|
2209
|
+
var D;
|
|
2210
|
+
return D = O ? T * l[g(O)] : m(T) ? T.$ms : p(T, this).$ms, p(this.$ms + D * (A ? -1 : 1), this);
|
|
2211
|
+
}, E.subtract = function(T, O) {
|
|
2212
|
+
return this.add(T, O, !0);
|
|
2209
2213
|
}, E.locale = function(T) {
|
|
2210
|
-
var
|
|
2211
|
-
return
|
|
2214
|
+
var O = this.clone();
|
|
2215
|
+
return O.$l = T, O;
|
|
2212
2216
|
}, E.clone = function() {
|
|
2213
2217
|
return p(this.$ms, this);
|
|
2214
2218
|
}, E.humanize = function(T) {
|
|
@@ -2252,22 +2256,22 @@ var Lt = { exports: {} };
|
|
|
2252
2256
|
return M.add(E.years() * T, "y").add(E.months() * T, "M").add(E.days() * T, "d").add(E.hours() * T, "h").add(E.minutes() * T, "m").add(E.seconds() * T, "s").add(E.milliseconds() * T, "ms");
|
|
2253
2257
|
};
|
|
2254
2258
|
return function(M, E, T) {
|
|
2255
|
-
e = T, i = T().$utils(), T.duration = function(
|
|
2256
|
-
var
|
|
2257
|
-
return p(
|
|
2259
|
+
e = T, i = T().$utils(), T.duration = function(D, _) {
|
|
2260
|
+
var R = T.locale();
|
|
2261
|
+
return p(D, { $l: R }, _);
|
|
2258
2262
|
}, T.isDuration = m;
|
|
2259
|
-
var
|
|
2260
|
-
E.prototype.add = function(
|
|
2261
|
-
return m(
|
|
2262
|
-
}, E.prototype.subtract = function(
|
|
2263
|
-
return m(
|
|
2263
|
+
var O = E.prototype.add, A = E.prototype.subtract;
|
|
2264
|
+
E.prototype.add = function(D, _) {
|
|
2265
|
+
return m(D) ? C(this, D, 1) : O.bind(this)(D, _);
|
|
2266
|
+
}, E.prototype.subtract = function(D, _) {
|
|
2267
|
+
return m(D) ? C(this, D, -1) : A.bind(this)(D, _);
|
|
2264
2268
|
};
|
|
2265
2269
|
};
|
|
2266
2270
|
});
|
|
2267
|
-
})(
|
|
2268
|
-
var
|
|
2269
|
-
const
|
|
2270
|
-
var
|
|
2271
|
+
})(Dt);
|
|
2272
|
+
var ne = Dt.exports;
|
|
2273
|
+
const oe = /* @__PURE__ */ U(ne);
|
|
2274
|
+
var _t = { exports: {} };
|
|
2271
2275
|
(function(f, t) {
|
|
2272
2276
|
(function(e, i) {
|
|
2273
2277
|
f.exports = i();
|
|
@@ -2279,10 +2283,10 @@ var Ot = { exports: {} };
|
|
|
2279
2283
|
};
|
|
2280
2284
|
};
|
|
2281
2285
|
});
|
|
2282
|
-
})(
|
|
2283
|
-
var
|
|
2284
|
-
const
|
|
2285
|
-
var
|
|
2286
|
+
})(_t);
|
|
2287
|
+
var re = _t.exports;
|
|
2288
|
+
const ae = /* @__PURE__ */ U(re);
|
|
2289
|
+
var At = { exports: {} };
|
|
2286
2290
|
(function(f, t) {
|
|
2287
2291
|
(function(e, i) {
|
|
2288
2292
|
f.exports = i();
|
|
@@ -2293,10 +2297,10 @@ var Dt = { exports: {} };
|
|
|
2293
2297
|
};
|
|
2294
2298
|
};
|
|
2295
2299
|
});
|
|
2296
|
-
})(
|
|
2297
|
-
var
|
|
2298
|
-
const
|
|
2299
|
-
var
|
|
2300
|
+
})(At);
|
|
2301
|
+
var he = At.exports;
|
|
2302
|
+
const le = /* @__PURE__ */ U(he);
|
|
2303
|
+
var It = { exports: {} };
|
|
2300
2304
|
(function(f, t) {
|
|
2301
2305
|
(function(e, i) {
|
|
2302
2306
|
f.exports = i();
|
|
@@ -2307,10 +2311,10 @@ var _t = { exports: {} };
|
|
|
2307
2311
|
};
|
|
2308
2312
|
};
|
|
2309
2313
|
});
|
|
2310
|
-
})(
|
|
2311
|
-
var
|
|
2312
|
-
const
|
|
2313
|
-
var
|
|
2314
|
+
})(It);
|
|
2315
|
+
var ce = It.exports;
|
|
2316
|
+
const de = /* @__PURE__ */ U(ce);
|
|
2317
|
+
var Ht = { exports: {} };
|
|
2314
2318
|
(function(f, t) {
|
|
2315
2319
|
(function(e, i) {
|
|
2316
2320
|
f.exports = i();
|
|
@@ -2385,10 +2389,10 @@ var At = { exports: {} };
|
|
|
2385
2389
|
};
|
|
2386
2390
|
};
|
|
2387
2391
|
});
|
|
2388
|
-
})(
|
|
2389
|
-
var
|
|
2390
|
-
const
|
|
2391
|
-
var
|
|
2392
|
+
})(Ht);
|
|
2393
|
+
var ue = Ht.exports;
|
|
2394
|
+
const ge = /* @__PURE__ */ U(ue);
|
|
2395
|
+
var Rt = { exports: {} };
|
|
2392
2396
|
(function(f, t) {
|
|
2393
2397
|
(function(e, i) {
|
|
2394
2398
|
f.exports = i();
|
|
@@ -2410,10 +2414,10 @@ var It = { exports: {} };
|
|
|
2410
2414
|
};
|
|
2411
2415
|
};
|
|
2412
2416
|
});
|
|
2413
|
-
})(
|
|
2414
|
-
var
|
|
2415
|
-
const
|
|
2416
|
-
var
|
|
2417
|
+
})(Rt);
|
|
2418
|
+
var fe = Rt.exports;
|
|
2419
|
+
const pe = /* @__PURE__ */ U(fe);
|
|
2420
|
+
var Gt = { exports: {} };
|
|
2417
2421
|
(function(f, t) {
|
|
2418
2422
|
(function(e, i) {
|
|
2419
2423
|
f.exports = i();
|
|
@@ -2425,10 +2429,10 @@ var Ht = { exports: {} };
|
|
|
2425
2429
|
};
|
|
2426
2430
|
};
|
|
2427
2431
|
});
|
|
2428
|
-
})(
|
|
2429
|
-
var
|
|
2430
|
-
const
|
|
2431
|
-
var
|
|
2432
|
+
})(Gt);
|
|
2433
|
+
var me = Gt.exports;
|
|
2434
|
+
const xe = /* @__PURE__ */ U(me);
|
|
2435
|
+
var Wt = { exports: {} };
|
|
2432
2436
|
(function(f, t) {
|
|
2433
2437
|
(function(e, i) {
|
|
2434
2438
|
f.exports = i();
|
|
@@ -2475,10 +2479,10 @@ var Rt = { exports: {} };
|
|
|
2475
2479
|
};
|
|
2476
2480
|
};
|
|
2477
2481
|
});
|
|
2478
|
-
})(
|
|
2479
|
-
var
|
|
2480
|
-
const
|
|
2481
|
-
var
|
|
2482
|
+
})(Wt);
|
|
2483
|
+
var ye = Wt.exports;
|
|
2484
|
+
const we = /* @__PURE__ */ U(ye);
|
|
2485
|
+
var $t = { exports: {} };
|
|
2482
2486
|
(function(f, t) {
|
|
2483
2487
|
(function(e, i) {
|
|
2484
2488
|
f.exports = i();
|
|
@@ -2492,10 +2496,10 @@ var Gt = { exports: {} };
|
|
|
2492
2496
|
};
|
|
2493
2497
|
};
|
|
2494
2498
|
});
|
|
2495
|
-
})(
|
|
2496
|
-
var
|
|
2497
|
-
const
|
|
2498
|
-
var
|
|
2499
|
+
})($t);
|
|
2500
|
+
var be = $t.exports;
|
|
2501
|
+
const ve = /* @__PURE__ */ U(be);
|
|
2502
|
+
var Ft = { exports: {} };
|
|
2499
2503
|
(function(f, t) {
|
|
2500
2504
|
(function(e, i) {
|
|
2501
2505
|
f.exports = i();
|
|
@@ -2521,10 +2525,10 @@ var Wt = { exports: {} };
|
|
|
2521
2525
|
};
|
|
2522
2526
|
};
|
|
2523
2527
|
});
|
|
2524
|
-
})(
|
|
2525
|
-
var
|
|
2526
|
-
const
|
|
2527
|
-
var
|
|
2528
|
+
})(Ft);
|
|
2529
|
+
var Te = Ft.exports;
|
|
2530
|
+
const Se = /* @__PURE__ */ U(Te);
|
|
2531
|
+
var Bt = { exports: {} };
|
|
2528
2532
|
(function(f, t) {
|
|
2529
2533
|
(function(e, i) {
|
|
2530
2534
|
f.exports = i();
|
|
@@ -2571,10 +2575,10 @@ var $t = { exports: {} };
|
|
|
2571
2575
|
var g = p && m, y = p || m || r, x = c(+o(), y);
|
|
2572
2576
|
if (typeof l != "string") return o(l).tz(y);
|
|
2573
2577
|
var v = function(M, E, T) {
|
|
2574
|
-
var
|
|
2575
|
-
if (E === A) return [
|
|
2576
|
-
var
|
|
2577
|
-
return A ===
|
|
2578
|
+
var O = M - 60 * E * 1e3, A = c(O, T);
|
|
2579
|
+
if (E === A) return [O, E];
|
|
2580
|
+
var D = c(O -= 60 * (A - E) * 1e3, T);
|
|
2581
|
+
return A === D ? [O, A] : [M - 60 * Math.min(A, D) * 1e3, Math.max(A, D)];
|
|
2578
2582
|
}(o.utc(l, g).valueOf(), x, y), b = v[0], w = v[1], C = o(b).utcOffset(w);
|
|
2579
2583
|
return C.$x.$timezone = y, C;
|
|
2580
2584
|
}, o.tz.guess = function() {
|
|
@@ -2584,10 +2588,10 @@ var $t = { exports: {} };
|
|
|
2584
2588
|
};
|
|
2585
2589
|
};
|
|
2586
2590
|
});
|
|
2587
|
-
})(
|
|
2588
|
-
var
|
|
2589
|
-
const
|
|
2590
|
-
var
|
|
2591
|
+
})(Bt);
|
|
2592
|
+
var ke = Bt.exports;
|
|
2593
|
+
const Ee = /* @__PURE__ */ U(ke);
|
|
2594
|
+
var zt = { exports: {} };
|
|
2591
2595
|
(function(f, t) {
|
|
2592
2596
|
(function(e, i) {
|
|
2593
2597
|
f.exports = i();
|
|
@@ -2623,8 +2627,8 @@ var Ft = { exports: {} };
|
|
|
2623
2627
|
C === void 0 && (C = "");
|
|
2624
2628
|
var M = C.match(i);
|
|
2625
2629
|
if (!M) return null;
|
|
2626
|
-
var E = ("" + M[0]).match(s) || ["-", 0, 0], T = E[0],
|
|
2627
|
-
return
|
|
2630
|
+
var E = ("" + M[0]).match(s) || ["-", 0, 0], T = E[0], O = 60 * +E[1] + +E[2];
|
|
2631
|
+
return O === 0 ? 0 : T === "+" ? O : -O;
|
|
2628
2632
|
}(g), g === null)) return this;
|
|
2629
2633
|
var v = Math.abs(g) <= 16 ? 60 * g : g, b = this;
|
|
2630
2634
|
if (y) return b.$offset = v, b.$u = g === 0, b;
|
|
@@ -2660,10 +2664,10 @@ var Ft = { exports: {} };
|
|
|
2660
2664
|
};
|
|
2661
2665
|
};
|
|
2662
2666
|
});
|
|
2663
|
-
})(
|
|
2664
|
-
var
|
|
2665
|
-
const
|
|
2666
|
-
var
|
|
2667
|
+
})(zt);
|
|
2668
|
+
var Ce = zt.exports;
|
|
2669
|
+
const Me = /* @__PURE__ */ U(Ce);
|
|
2670
|
+
var Oe = { exports: {} };
|
|
2667
2671
|
(function(f, t) {
|
|
2668
2672
|
(function(e, i) {
|
|
2669
2673
|
f.exports = i();
|
|
@@ -2673,11 +2677,11 @@ var Ce = { exports: {} };
|
|
|
2673
2677
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
2674
2678
|
} };
|
|
2675
2679
|
});
|
|
2676
|
-
})(
|
|
2677
|
-
var
|
|
2680
|
+
})(Oe);
|
|
2681
|
+
var Le = { exports: {} };
|
|
2678
2682
|
(function(f, t) {
|
|
2679
2683
|
(function(e, i) {
|
|
2680
|
-
f.exports = i(
|
|
2684
|
+
f.exports = i(H);
|
|
2681
2685
|
})(N, function(e) {
|
|
2682
2686
|
function i(o) {
|
|
2683
2687
|
return o && typeof o == "object" && "default" in o ? o : { default: o };
|
|
@@ -2690,40 +2694,40 @@ var Me = { exports: {} };
|
|
|
2690
2694
|
} };
|
|
2691
2695
|
return s.default.locale(n, null, !0), n;
|
|
2692
2696
|
});
|
|
2693
|
-
})(
|
|
2694
|
-
const
|
|
2697
|
+
})(Le);
|
|
2698
|
+
const De = (f, t) => {
|
|
2695
2699
|
const e = t.prototype;
|
|
2696
2700
|
e.setLocale = function(s) {
|
|
2697
|
-
return this.$locale = s ||
|
|
2701
|
+
return this.$locale = s || H().locale(), this.$L = this.$locale, this;
|
|
2698
2702
|
};
|
|
2699
2703
|
const i = e.format;
|
|
2700
2704
|
e.format = function(s) {
|
|
2701
|
-
return this.$L =
|
|
2705
|
+
return this.$L = H().locale(), i.bind(this)(s);
|
|
2702
2706
|
};
|
|
2703
2707
|
};
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
function
|
|
2708
|
+
H.extend(oe);
|
|
2709
|
+
H.extend(ae);
|
|
2710
|
+
H.extend(le);
|
|
2711
|
+
H.extend(de);
|
|
2712
|
+
H.extend(pe);
|
|
2713
|
+
H.extend(ge);
|
|
2714
|
+
H.extend(xe);
|
|
2715
|
+
H.extend(we);
|
|
2716
|
+
H.extend(ve);
|
|
2717
|
+
H.extend(Se);
|
|
2718
|
+
H.extend(Ee);
|
|
2719
|
+
H.extend(Me);
|
|
2720
|
+
H.extend(De);
|
|
2721
|
+
function kt(f) {
|
|
2718
2722
|
try {
|
|
2719
|
-
if (
|
|
2720
|
-
if (
|
|
2721
|
-
|
|
2723
|
+
if (H.locale() === f) return;
|
|
2724
|
+
if (H.locale(f) !== f) throw Error();
|
|
2725
|
+
L.info(`Locale set to ${f}`);
|
|
2722
2726
|
} catch {
|
|
2723
|
-
|
|
2727
|
+
L.warn(`Failed to set locale ${f}, fallback to en`), H.locale("en");
|
|
2724
2728
|
}
|
|
2725
2729
|
}
|
|
2726
|
-
const
|
|
2730
|
+
const ft = () => ({
|
|
2727
2731
|
small: {
|
|
2728
2732
|
hour: 15,
|
|
2729
2733
|
day: 15,
|
|
@@ -2746,12 +2750,12 @@ const ut = () => ({
|
|
|
2746
2750
|
quarter: 14
|
|
2747
2751
|
}
|
|
2748
2752
|
});
|
|
2749
|
-
class
|
|
2753
|
+
class _e {
|
|
2750
2754
|
constructor() {
|
|
2751
|
-
h(this, "startTime",
|
|
2752
|
-
h(this, "endTime",
|
|
2755
|
+
h(this, "startTime", H().startOf("day"));
|
|
2756
|
+
h(this, "endTime", H().endOf("day"));
|
|
2753
2757
|
/** 结束的标准时间。切换单位会影响结尾的扩展,需要单独记录一个标准时间 */
|
|
2754
|
-
h(this, "targetEnd",
|
|
2758
|
+
h(this, "targetEnd", H().endOf("day"));
|
|
2755
2759
|
/** 固定起始日期 */
|
|
2756
2760
|
h(this, "strictStart", !1);
|
|
2757
2761
|
/** 固定截止日期 */
|
|
@@ -2772,7 +2776,7 @@ class Oe {
|
|
|
2772
2776
|
h(this, "cellWidth");
|
|
2773
2777
|
/** 用户设定的单位 */
|
|
2774
2778
|
h(this, "unit", "day");
|
|
2775
|
-
this.cellWidth = J(
|
|
2779
|
+
this.cellWidth = J(ft().normal);
|
|
2776
2780
|
}
|
|
2777
2781
|
getStartTime() {
|
|
2778
2782
|
return this.startTime;
|
|
@@ -2830,15 +2834,15 @@ class Oe {
|
|
|
2830
2834
|
month: "month",
|
|
2831
2835
|
quarter: "quarter"
|
|
2832
2836
|
}[i];
|
|
2833
|
-
n ||
|
|
2837
|
+
n || L.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime = H(s.startTime).startOf(this.getFinelyUnit()), this.strictStart = !0), s.endTime && (this.endTime = H(s.endTime).endOf(this.getFinelyUnit()), this.strictEnd = !0), s.cellWidth && (Vt(s.cellWidth) ? this.cellWidth = {
|
|
2834
2838
|
hour: s.cellWidth,
|
|
2835
2839
|
day: s.cellWidth,
|
|
2836
2840
|
week: s.cellWidth,
|
|
2837
2841
|
month: s.cellWidth,
|
|
2838
2842
|
quarter: s.cellWidth
|
|
2839
2843
|
} : V(s.cellWidth) ? this.cellWidth = J(
|
|
2840
|
-
|
|
2841
|
-
) :
|
|
2844
|
+
ft()[s.cellWidth] || ft().normal
|
|
2845
|
+
) : Mt(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2842
2846
|
}
|
|
2843
2847
|
update(t) {
|
|
2844
2848
|
this.init(t, !1), this.endTime = this.targetEnd.clone();
|
|
@@ -2971,7 +2975,7 @@ class Oe {
|
|
|
2971
2975
|
return t.isSameOrAfter(this.startTime) && t.isSameOrBefore(this.endTime);
|
|
2972
2976
|
}
|
|
2973
2977
|
}
|
|
2974
|
-
class
|
|
2978
|
+
class Ae {
|
|
2975
2979
|
// 使用私有构造函数防止直接创建实例
|
|
2976
2980
|
constructor(t, e) {
|
|
2977
2981
|
// 声明成员属性类型
|
|
@@ -2982,10 +2986,10 @@ class De {
|
|
|
2982
2986
|
h(this, "timeAxis");
|
|
2983
2987
|
var n, o, r;
|
|
2984
2988
|
this.context = t;
|
|
2985
|
-
const i =
|
|
2989
|
+
const i = bt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2986
2990
|
if (s && !X(s))
|
|
2987
|
-
throw
|
|
2988
|
-
this.optionManager = new
|
|
2991
|
+
throw L.exception("Data should be a array.");
|
|
2992
|
+
this.optionManager = new qt(), this.optionManager.setOptions(i), i.locale && kt(i.locale), this.timeAxis = new _e(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new se(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new te(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 mt(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);
|
|
2989
2993
|
}
|
|
2990
2994
|
getOptionManager() {
|
|
2991
2995
|
return this.optionManager;
|
|
@@ -3004,16 +3008,18 @@ class De {
|
|
|
3004
3008
|
}
|
|
3005
3009
|
setOption(t, e = { merge: !0 }) {
|
|
3006
3010
|
var n, o, r, a;
|
|
3007
|
-
const i =
|
|
3011
|
+
const i = bt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
3008
3012
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((c) => {
|
|
3009
3013
|
c.updateMode();
|
|
3010
|
-
}),
|
|
3014
|
+
}), this.context.getScrollbar().updateOptions(
|
|
3015
|
+
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
3016
|
+
), this.context.event.emit(S.OPTIONS_UPDATE), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((a = t.links) == null ? void 0 : a.enableCycleDetection) ?? !0), i.locale && kt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
3011
3017
|
}
|
|
3012
3018
|
updateTime(t, e) {
|
|
3013
3019
|
this.timeAxis.setDate(t, e);
|
|
3014
3020
|
}
|
|
3015
3021
|
}
|
|
3016
|
-
class
|
|
3022
|
+
class Ie {
|
|
3017
3023
|
constructor(t, e, i) {
|
|
3018
3024
|
h(this, "rootElement");
|
|
3019
3025
|
h(this, "options");
|
|
@@ -3102,7 +3108,16 @@ class _e {
|
|
|
3102
3108
|
const e = t - this.animationStartTime, i = this.options.animationDuration, s = Math.min(1, e / i), n = s * (2 - s), o = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * n, r = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * n, a = this.scrollLeft !== o, c = this.scrollTop !== r;
|
|
3103
3109
|
(a || c) && this.emit(this.animationSource, o, r), s < 1 ? this.animationFrameId = requestAnimationFrame(this.animationStep) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && this.emit(this.animationSource, this.animationTargetScrollLeft, this.animationTargetScrollTop), this.scheduleHide());
|
|
3104
3110
|
});
|
|
3105
|
-
this.root = t, this.rootElement = e, this.
|
|
3111
|
+
this.root = t, this.rootElement = e, this.createElements(), this.updateOptions(i), this.throttledHandleMouseMove = vt(
|
|
3112
|
+
this.handleMouseMove.bind(this),
|
|
3113
|
+
16
|
|
3114
|
+
), this.throttledHandleWheel = vt(this.handleWheel.bind(this), 16, {
|
|
3115
|
+
leading: !0,
|
|
3116
|
+
trailing: !1
|
|
3117
|
+
}), this.bindEvents(), this.rootElement.matches(":hover") ? this.handleMouseEnter() : (this.clearTimeouts(), this.hideScrollbars(!0));
|
|
3118
|
+
}
|
|
3119
|
+
updateOptions(t) {
|
|
3120
|
+
this.options = at(
|
|
3106
3121
|
{
|
|
3107
3122
|
showHorizontal: !0,
|
|
3108
3123
|
showVertical: !0,
|
|
@@ -3127,14 +3142,8 @@ class _e {
|
|
|
3127
3142
|
hideDuration: 200
|
|
3128
3143
|
// 滚动条隐藏动画时长 (ms)
|
|
3129
3144
|
},
|
|
3130
|
-
|
|
3131
|
-
), this.
|
|
3132
|
-
this.handleMouseMove.bind(this),
|
|
3133
|
-
16
|
|
3134
|
-
), this.throttledHandleWheel = wt(this.handleWheel.bind(this), 16, {
|
|
3135
|
-
leading: !0,
|
|
3136
|
-
trailing: !1
|
|
3137
|
-
}), this.createElements(), this.applyStyles(), this.bindEvents(), this.rootElement.matches(":hover") ? this.handleMouseEnter() : (this.clearTimeouts(), this.hideScrollbars(!0));
|
|
3145
|
+
t
|
|
3146
|
+
), this.applyStyles();
|
|
3138
3147
|
}
|
|
3139
3148
|
// --- 元素创建与管理 ---
|
|
3140
3149
|
createElements() {
|
|
@@ -3246,11 +3255,11 @@ class _e {
|
|
|
3246
3255
|
}
|
|
3247
3256
|
}
|
|
3248
3257
|
handleWheel(t) {
|
|
3249
|
-
if (t.target !== this.rootElement && !this.rootElement.contains(t.target) &&
|
|
3258
|
+
if (t.target !== this.rootElement && !this.rootElement.contains(t.target) && L.debug(
|
|
3250
3259
|
"Wheel event ignored, target not root or descendant:",
|
|
3251
3260
|
t.target
|
|
3252
3261
|
), !this.isMouseOverRoot && !this.isMouseOverScrollbar) {
|
|
3253
|
-
|
|
3262
|
+
L.debug("Wheel event ignored, mouse not over root or scrollbar");
|
|
3254
3263
|
return;
|
|
3255
3264
|
}
|
|
3256
3265
|
const e = this.canScrollHorizontal(), i = this.canScrollVertical();
|
|
@@ -3392,7 +3401,7 @@ class _e {
|
|
|
3392
3401
|
*/
|
|
3393
3402
|
scrollTo(t, e = "api") {
|
|
3394
3403
|
this.scheduleShow();
|
|
3395
|
-
const i = this.clampScroll(
|
|
3404
|
+
const i = this.clampScroll(at(this.getScrollPosition(), t));
|
|
3396
3405
|
if (this.scrollLeft === i.x && this.scrollTop === i.y) {
|
|
3397
3406
|
if (this.isAnimating && this.animationTargetScrollLeft === i.x && this.animationTargetScrollTop === i.y)
|
|
3398
3407
|
return;
|
|
@@ -3419,7 +3428,7 @@ class _e {
|
|
|
3419
3428
|
}
|
|
3420
3429
|
// --- 销毁 ---
|
|
3421
3430
|
destroy() {
|
|
3422
|
-
this.unbindEvents(), this.clearTimeouts(), this.cancelAnimation(), this.scrollbarContainer.parentNode && this.scrollbarContainer.parentNode.removeChild(this.scrollbarContainer), this.rootElement = null, this.eventManager = null, this.hScrollbar = null, this.vScrollbar = null, this.hScrollThumb = null, this.vScrollThumb = null, this.scrollbarContainer = null,
|
|
3431
|
+
this.unbindEvents(), this.clearTimeouts(), this.cancelAnimation(), this.scrollbarContainer.parentNode && this.scrollbarContainer.parentNode.removeChild(this.scrollbarContainer), this.rootElement = null, this.eventManager = null, this.hScrollbar = null, this.vScrollbar = null, this.hScrollThumb = null, this.vScrollThumb = null, this.scrollbarContainer = null, L.debug("Scrollbar destroyed");
|
|
3423
3432
|
}
|
|
3424
3433
|
}
|
|
3425
3434
|
function Z(f, t = "") {
|
|
@@ -3445,7 +3454,7 @@ function Z(f, t = "") {
|
|
|
3445
3454
|
}
|
|
3446
3455
|
return t;
|
|
3447
3456
|
}
|
|
3448
|
-
class
|
|
3457
|
+
class He {
|
|
3449
3458
|
constructor(t, e, i) {
|
|
3450
3459
|
h(this, "element");
|
|
3451
3460
|
h(this, "isDragging", !1);
|
|
@@ -3460,16 +3469,16 @@ class Ae {
|
|
|
3460
3469
|
h(this, "rowElement", null);
|
|
3461
3470
|
h(this, "handleMouseDown", (t) => {
|
|
3462
3471
|
if (!this.task || !this.container) {
|
|
3463
|
-
|
|
3472
|
+
L.warn("DragHandler: task or container is not defined");
|
|
3464
3473
|
return;
|
|
3465
3474
|
}
|
|
3466
3475
|
if (this.rowElement = this.container.closest(".x-gantt-table-row"), !this.rowElement) {
|
|
3467
|
-
|
|
3476
|
+
L.warn("Row element not found", this.container);
|
|
3468
3477
|
return;
|
|
3469
3478
|
}
|
|
3470
3479
|
t.preventDefault(), t.stopPropagation(), this.isDragging = !0, this.dragStartY = t.clientY + this.context.getScrollbar().getScrollPosition().y, this.dragStartIndex = this.task.flatIndex, this.currentIndex = this.dragStartIndex, this.createGhostElement(t), this.createPlaceholderElement(t), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", (e) => {
|
|
3471
3480
|
e.key === "Escape" && this.isDragging && this.cleanup();
|
|
3472
|
-
}),
|
|
3481
|
+
}), L.debug(`Drag started for task ${this.task.id} at index ${this.dragStartIndex}`);
|
|
3473
3482
|
});
|
|
3474
3483
|
h(this, "handleMouseMove", (t) => {
|
|
3475
3484
|
!this.isDragging || !this.task || !this.container || (this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.animationFrameId = requestAnimationFrame(() => {
|
|
@@ -3517,7 +3526,7 @@ class Ae {
|
|
|
3517
3526
|
rgba(255,255,255,0.3) 50%,
|
|
3518
3527
|
rgba(255,255,255,0.9) 100%);
|
|
3519
3528
|
pointer-events: none;
|
|
3520
|
-
`, (this.context.getRootElement() || document.body).appendChild(this.ghostElement),
|
|
3529
|
+
`, (this.context.getRootElement() || document.body).appendChild(this.ghostElement), L.debug("Ghost element created");
|
|
3521
3530
|
}
|
|
3522
3531
|
/**
|
|
3523
3532
|
* 更新 ghost 元素位置
|
|
@@ -3585,10 +3594,10 @@ class Ae {
|
|
|
3585
3594
|
* 销毁组件
|
|
3586
3595
|
*/
|
|
3587
3596
|
destroy() {
|
|
3588
|
-
this.cleanup(), this.element.removeEventListener("mousedown", this.handleMouseDown), this.element.removeEventListener("selectstart", (t) => t.preventDefault()), this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element),
|
|
3597
|
+
this.cleanup(), this.element.removeEventListener("mousedown", this.handleMouseDown), this.element.removeEventListener("selectstart", (t) => t.preventDefault()), this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element), L.debug("DragHandler destroyed");
|
|
3589
3598
|
}
|
|
3590
3599
|
}
|
|
3591
|
-
class
|
|
3600
|
+
class nt {
|
|
3592
3601
|
/**
|
|
3593
3602
|
* 创建表格单元格
|
|
3594
3603
|
* @param container 父容器(tr元素)
|
|
@@ -3622,12 +3631,12 @@ class st {
|
|
|
3622
3631
|
)), typeof this.column.column.render == "function")
|
|
3623
3632
|
try {
|
|
3624
3633
|
const e = this.column.column.render(this.task.getEmitData());
|
|
3625
|
-
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement ? t.appendChild(e) :
|
|
3634
|
+
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement ? t.appendChild(e) : L.warn(
|
|
3626
3635
|
"Table cell render function does not return a valid value.",
|
|
3627
3636
|
e
|
|
3628
3637
|
);
|
|
3629
3638
|
} catch (e) {
|
|
3630
|
-
|
|
3639
|
+
L.error("Table cell render error:", e), t.textContent = this.task.getField(this.column.column.field) ?? this.context.getOptions().table.emptyText;
|
|
3631
3640
|
}
|
|
3632
3641
|
else
|
|
3633
3642
|
t.textContent = this.task.getField(this.column.column.field) ?? this.context.getOptions().table.emptyText;
|
|
@@ -3639,16 +3648,18 @@ class st {
|
|
|
3639
3648
|
const e = this.context.getOptions().drag.enabled !== !1, i = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().drag.enabled, this.task), s = ["0.3", "0.3", "0.4"];
|
|
3640
3649
|
if (e || (s[0] = "0", s[1] = "0.5", s[2] = "0.5"), e) {
|
|
3641
3650
|
const n = document.createElement("div");
|
|
3642
|
-
n.style.flex = s[0], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", i && new
|
|
3651
|
+
n.style.flex = s[0], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", i && new He(this.context, n, this.task), t.appendChild(n);
|
|
3643
3652
|
}
|
|
3644
3653
|
if (this.context.getOptions().selection.enabled) {
|
|
3645
3654
|
const n = document.createElement("div");
|
|
3646
|
-
n.style.flex = s[1], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", new
|
|
3655
|
+
n.style.flex = s[1], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", new Lt(this.context, n, this.task), t.appendChild(n);
|
|
3647
3656
|
}
|
|
3648
3657
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
3649
3658
|
const n = document.createElement("div");
|
|
3650
3659
|
n.className = "x-gantt-table-cell__expand", n.style.flex = s[2], n.style.color = this.context.getOptions().primaryColor, n.style.display = "flex", n.style.alignItems = "center", n.style.justifyContent = "center", n.style.height = "100%", n.style.width = "14px", n.style.height = "100%", n.style.cursor = "pointer", n.innerHTML = '<svg t="1746693752280" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2612" width="14" height="14"><path d="M724.48 521.728c-1.8432 7.7824-5.7344 14.848-11.3664 20.48l-341.9136 342.016c-16.6912 16.6912-43.7248 16.6912-60.3136 0s-16.6912-43.7248 0-60.3136L622.6944 512 310.8864 200.0896c-16.6912-16.6912-16.6912-43.7248 0-60.3136 16.6912-16.6912 43.7248-16.6912 60.3136 0l341.9136 341.9136c10.8544 10.8544 14.6432 26.112 11.3664 40.0384z" fill="currentColor" p-id="2613"></path></svg>', n.style.transform = this.task.expanded ? "rotate(90deg)" : "", n.addEventListener("click", (o) => {
|
|
3651
3660
|
o.stopPropagation(), this.context.store.getDataManager().expandTask(this.task.id, !1);
|
|
3661
|
+
}), n.addEventListener("dblclick", (o) => {
|
|
3662
|
+
o.stopPropagation();
|
|
3652
3663
|
}), t.appendChild(n);
|
|
3653
3664
|
}
|
|
3654
3665
|
this.element.appendChild(t);
|
|
@@ -3680,7 +3691,7 @@ class st {
|
|
|
3680
3691
|
this.element.style.height = Z(t * Math.max(1, this.rowspan));
|
|
3681
3692
|
}
|
|
3682
3693
|
}
|
|
3683
|
-
class
|
|
3694
|
+
class Et {
|
|
3684
3695
|
/**
|
|
3685
3696
|
* 创建表格行
|
|
3686
3697
|
* @param context 上下文
|
|
@@ -3752,7 +3763,7 @@ class St {
|
|
|
3752
3763
|
this.clearCells();
|
|
3753
3764
|
const t = this.context.store.getColumnManager().getHandlerColumn();
|
|
3754
3765
|
if (t.width !== 0) {
|
|
3755
|
-
const n = new
|
|
3766
|
+
const n = new nt(
|
|
3756
3767
|
this.context,
|
|
3757
3768
|
this.element,
|
|
3758
3769
|
t,
|
|
@@ -3770,7 +3781,7 @@ class St {
|
|
|
3770
3781
|
const o = e[n], r = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
3771
3782
|
if (r) {
|
|
3772
3783
|
if (r.task.id !== this.task.id) {
|
|
3773
|
-
const a = new
|
|
3784
|
+
const a = new nt(
|
|
3774
3785
|
this.context,
|
|
3775
3786
|
this.element,
|
|
3776
3787
|
o,
|
|
@@ -3783,7 +3794,7 @@ class St {
|
|
|
3783
3794
|
);
|
|
3784
3795
|
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(a);
|
|
3785
3796
|
} else if (r.originColumnIndex === n) {
|
|
3786
|
-
const a = new
|
|
3797
|
+
const a = new nt(
|
|
3787
3798
|
this.context,
|
|
3788
3799
|
this.element,
|
|
3789
3800
|
o,
|
|
@@ -3804,7 +3815,7 @@ class St {
|
|
|
3804
3815
|
n,
|
|
3805
3816
|
this.task.level + 1
|
|
3806
3817
|
);
|
|
3807
|
-
if (u && (typeof u.col != "number" ?
|
|
3818
|
+
if (u && (typeof u.col != "number" ? L.error("colspan function must returned a number") : a = u.col, typeof u.row != "number" ? L.error("rowspan function must returned a number") : c = u.row), a > 1 || c > 1) {
|
|
3808
3819
|
if (c > 1)
|
|
3809
3820
|
for (let p = 1; p < c; p++) {
|
|
3810
3821
|
const g = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + p];
|
|
@@ -3829,7 +3840,7 @@ class St {
|
|
|
3829
3840
|
for (let p = 0; p < a; p++)
|
|
3830
3841
|
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, l);
|
|
3831
3842
|
}
|
|
3832
|
-
const d = new
|
|
3843
|
+
const d = new nt(
|
|
3833
3844
|
this.context,
|
|
3834
3845
|
this.element,
|
|
3835
3846
|
o,
|
|
@@ -3870,7 +3881,7 @@ class St {
|
|
|
3870
3881
|
this.clearCells(), this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
3871
3882
|
}
|
|
3872
3883
|
}
|
|
3873
|
-
class
|
|
3884
|
+
class Re {
|
|
3874
3885
|
constructor(t, e) {
|
|
3875
3886
|
h(this, "element");
|
|
3876
3887
|
h(this, "rows", /* @__PURE__ */ new Map());
|
|
@@ -3895,7 +3906,7 @@ class Ie {
|
|
|
3895
3906
|
const a = this.rows.get(r);
|
|
3896
3907
|
a.update(n), a.updateTop(t);
|
|
3897
3908
|
} else {
|
|
3898
|
-
const a = new
|
|
3909
|
+
const a = new Et(this.context, this.element, n, t);
|
|
3899
3910
|
a.create(), this.rows.set(r, a);
|
|
3900
3911
|
}
|
|
3901
3912
|
this.context.store.getColumnManager().getLeafColumns().forEach((a, c) => {
|
|
@@ -3903,7 +3914,7 @@ class Ie {
|
|
|
3903
3914
|
if (u && u.rowspan > 1) {
|
|
3904
3915
|
const d = u.task.id;
|
|
3905
3916
|
if (!this.rows.has(d) && !this.mergeRows.has(d)) {
|
|
3906
|
-
const l = new
|
|
3917
|
+
const l = new Et(
|
|
3907
3918
|
this.context,
|
|
3908
3919
|
this.element,
|
|
3909
3920
|
u.task,
|
|
@@ -3947,7 +3958,7 @@ class Ie {
|
|
|
3947
3958
|
});
|
|
3948
3959
|
}
|
|
3949
3960
|
}
|
|
3950
|
-
class
|
|
3961
|
+
class xt {
|
|
3951
3962
|
constructor(t, e, i, s) {
|
|
3952
3963
|
h(this, "columnElement");
|
|
3953
3964
|
this.context = t, this.root = e, this.container = i, this.column = s, this.columnElement = document.createElement("div"), this.initElement(), this.container.appendChild(this.columnElement);
|
|
@@ -3964,7 +3975,7 @@ class pt {
|
|
|
3964
3975
|
this.context.getOptions().header.fontSize
|
|
3965
3976
|
), n.style.setProperty(
|
|
3966
3977
|
"color",
|
|
3967
|
-
this.context.getOptions().header.color,
|
|
3978
|
+
ht(this.context.getOptions().header.color, this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor),
|
|
3968
3979
|
"important"
|
|
3969
3980
|
), n.style.fontFamily = this.context.getOptions().header.fontFamily, this.column.column.headerRender) {
|
|
3970
3981
|
const o = this.column.column.headerRender();
|
|
@@ -4005,7 +4016,7 @@ class pt {
|
|
|
4005
4016
|
t.addEventListener("mousedown", o);
|
|
4006
4017
|
}
|
|
4007
4018
|
}
|
|
4008
|
-
class
|
|
4019
|
+
class wt {
|
|
4009
4020
|
constructor(t, e, i, s) {
|
|
4010
4021
|
h(this, "groupElement");
|
|
4011
4022
|
h(this, "titleContainer");
|
|
@@ -4023,14 +4034,14 @@ class xt {
|
|
|
4023
4034
|
this.context.getOptions().header.fontSize
|
|
4024
4035
|
), this.titleContainer.style.fontFamily = this.context.getOptions().header.fontFamily, this.titleContainer.style.setProperty(
|
|
4025
4036
|
"color",
|
|
4026
|
-
this.context.getOptions().header.color,
|
|
4037
|
+
ht(this.context.getOptions().header.color, this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor),
|
|
4027
4038
|
"important"
|
|
4028
4039
|
), this.titleContainer.textContent = this.column.label || "", this.childContainer.className = "x-gantt-table-header-children", this.childContainer.style.flex = "1 0 auto", this.childContainer.style.display = "flex", this.childContainer.style.width = "100%", this.groupElement.appendChild(this.titleContainer), this.groupElement.appendChild(this.childContainer);
|
|
4029
4040
|
}
|
|
4030
4041
|
initChildren() {
|
|
4031
4042
|
this.column.children.forEach((t) => {
|
|
4032
4043
|
if (t.isLeaf) {
|
|
4033
|
-
const e = new
|
|
4044
|
+
const e = new xt(
|
|
4034
4045
|
this.context,
|
|
4035
4046
|
this.root,
|
|
4036
4047
|
this.childContainer,
|
|
@@ -4038,7 +4049,7 @@ class xt {
|
|
|
4038
4049
|
);
|
|
4039
4050
|
this.children.push(e);
|
|
4040
4051
|
} else if (t.children.length > 0) {
|
|
4041
|
-
const e = new
|
|
4052
|
+
const e = new wt(
|
|
4042
4053
|
this.context,
|
|
4043
4054
|
this.root,
|
|
4044
4055
|
this.childContainer,
|
|
@@ -4049,7 +4060,7 @@ class xt {
|
|
|
4049
4060
|
});
|
|
4050
4061
|
}
|
|
4051
4062
|
}
|
|
4052
|
-
class
|
|
4063
|
+
class Ge {
|
|
4053
4064
|
constructor(t, e) {
|
|
4054
4065
|
h(this, "headerElement");
|
|
4055
4066
|
h(this, "headerColumns", []);
|
|
@@ -4065,7 +4076,7 @@ class He {
|
|
|
4065
4076
|
"important"
|
|
4066
4077
|
), this.headerElement.style.setProperty(
|
|
4067
4078
|
"color",
|
|
4068
|
-
this.context.getOptions().header.color,
|
|
4079
|
+
ht(this.context.getOptions().header.color, this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor),
|
|
4069
4080
|
"important"
|
|
4070
4081
|
), this.headerElement.style.fontSize = `${this.context.getOptions().header.fontSize}px`, this.headerElement.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, this.headerElement.style.zIndex = "10", this.headerElement.style.width = "100%", this.headerElement.style.flexShrink = "0", this.headerElement.style.borderBottom = `1px solid ${this.context.getOptions().border.color}`, this.headerElement.style.setProperty(
|
|
4071
4082
|
"border-color",
|
|
@@ -4080,7 +4091,7 @@ class He {
|
|
|
4080
4091
|
this.headerColumns = [], this.headerElement.innerHTML = "", this.initElement();
|
|
4081
4092
|
const t = this.context.store.getColumnManager(), e = t.getColumns();
|
|
4082
4093
|
if (t.getHandlerColumn().width !== 0) {
|
|
4083
|
-
const i = new
|
|
4094
|
+
const i = new xt(
|
|
4084
4095
|
this.context,
|
|
4085
4096
|
this.headerElement,
|
|
4086
4097
|
this.headerElement,
|
|
@@ -4090,7 +4101,7 @@ class He {
|
|
|
4090
4101
|
}
|
|
4091
4102
|
e.forEach((i) => {
|
|
4092
4103
|
if (i.isLeaf) {
|
|
4093
|
-
const s = new
|
|
4104
|
+
const s = new xt(
|
|
4094
4105
|
this.context,
|
|
4095
4106
|
this.headerElement,
|
|
4096
4107
|
this.headerElement,
|
|
@@ -4098,7 +4109,7 @@ class He {
|
|
|
4098
4109
|
);
|
|
4099
4110
|
this.headerColumns.push(s);
|
|
4100
4111
|
} else if (i.children.length > 0) {
|
|
4101
|
-
const s = new
|
|
4112
|
+
const s = new wt(
|
|
4102
4113
|
this.context,
|
|
4103
4114
|
this.headerElement,
|
|
4104
4115
|
this.headerElement,
|
|
@@ -4109,12 +4120,12 @@ class He {
|
|
|
4109
4120
|
});
|
|
4110
4121
|
}
|
|
4111
4122
|
}
|
|
4112
|
-
class
|
|
4123
|
+
class We {
|
|
4113
4124
|
constructor(t, e) {
|
|
4114
4125
|
h(this, "tableContainer");
|
|
4115
4126
|
h(this, "tableHeader");
|
|
4116
4127
|
h(this, "tableBody");
|
|
4117
|
-
this.context = t, this.container = e, this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table-container", this.tableContainer.style.position = "relative", this.tableContainer.style.width = "100%", this.tableContainer.style.height = "100%", this.tableContainer.style.overflow = "hidden", this.tableContainer.style.display = "flex", this.tableContainer.style.flexDirection = "column", this.container.appendChild(this.tableContainer), this.tableHeader = new
|
|
4128
|
+
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 Ge(t, this.tableContainer), this.tableBody = new Re(t, this.tableContainer), this.listenEvents();
|
|
4118
4129
|
}
|
|
4119
4130
|
render(t, e) {
|
|
4120
4131
|
this.tableHeader.render(), this.refresh(t, e);
|
|
@@ -4136,7 +4147,7 @@ class Re {
|
|
|
4136
4147
|
});
|
|
4137
4148
|
}
|
|
4138
4149
|
}
|
|
4139
|
-
class
|
|
4150
|
+
class $e {
|
|
4140
4151
|
constructor(t, e) {
|
|
4141
4152
|
h(this, "background");
|
|
4142
4153
|
// 表头背景
|
|
@@ -4291,7 +4302,7 @@ class Ge {
|
|
|
4291
4302
|
fontSize: u,
|
|
4292
4303
|
fontFamily: this.context.getOptions().header.fontFamily,
|
|
4293
4304
|
fontStyle: `${this.context.getOptions().header.fontWeight}`,
|
|
4294
|
-
fill: this.context.getOptions().header.color,
|
|
4305
|
+
fill: ht(this.context.getOptions().header.color, this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor),
|
|
4295
4306
|
align: "center",
|
|
4296
4307
|
verticalAlign: "middle",
|
|
4297
4308
|
wrap: "none",
|
|
@@ -4352,7 +4363,7 @@ class Ge {
|
|
|
4352
4363
|
}).play()));
|
|
4353
4364
|
}
|
|
4354
4365
|
}
|
|
4355
|
-
class
|
|
4366
|
+
class Fe {
|
|
4356
4367
|
constructor(t, e) {
|
|
4357
4368
|
// 网格线组
|
|
4358
4369
|
h(this, "verticalLines");
|
|
@@ -4433,8 +4444,8 @@ class We {
|
|
|
4433
4444
|
this.verticalLines.destroyChildren(), this.horizontalLines.destroyChildren();
|
|
4434
4445
|
}
|
|
4435
4446
|
}
|
|
4436
|
-
const
|
|
4437
|
-
class
|
|
4447
|
+
const Ct = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><path fill="currentColor" fill-rule="evenodd" d="M5.5 4.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m4 0a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25M10.625 7.5a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 8.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m5.125 2.875a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 12.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25" clip-rule="evenodd"/></svg>';
|
|
4448
|
+
class Be {
|
|
4438
4449
|
constructor(t, e, i, s, n) {
|
|
4439
4450
|
h(this, "offsetX", 0);
|
|
4440
4451
|
h(this, "offsetY", 0);
|
|
@@ -4470,8 +4481,8 @@ class $e {
|
|
|
4470
4481
|
id: `chart-slider-bar-${s.id}`
|
|
4471
4482
|
}), this.render(), this.bindEvents(), this.registerEvents();
|
|
4472
4483
|
}
|
|
4473
|
-
update(t, e) {
|
|
4474
|
-
this.x = t, this.y = e, this.sliderGroup.position({ x: t, y: e }), this.render();
|
|
4484
|
+
update(t, e, i) {
|
|
4485
|
+
this.task = i, this.x = t, this.y = e, this.sliderGroup.position({ x: t, y: e }), this.render();
|
|
4475
4486
|
}
|
|
4476
4487
|
setOffset(t, e) {
|
|
4477
4488
|
this.offsetX = t, this.offsetY = e;
|
|
@@ -4486,27 +4497,25 @@ class $e {
|
|
|
4486
4497
|
});
|
|
4487
4498
|
}
|
|
4488
4499
|
render() {
|
|
4489
|
-
var p, g, y, x, v, b, w, C, M, E, T,
|
|
4500
|
+
var p, g, y, x, v, b, w, C, M, E, T, O, A;
|
|
4490
4501
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4491
4502
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4492
|
-
|
|
4503
|
+
L.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
4493
4504
|
return;
|
|
4494
4505
|
}
|
|
4495
|
-
const t = this.context.getOptions().row.height, e =
|
|
4506
|
+
const t = this.context.getOptions().row.height, e = ot(
|
|
4496
4507
|
this.unpackFunc(this.context.getOptions().bar.height),
|
|
4497
4508
|
t
|
|
4498
|
-
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, r = this.unpackFunc(this.context.getOptions().bar.backgroundColor) || this.context.getOptions().primaryColor, a =
|
|
4509
|
+
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, r = this.unpackFunc(this.context.getOptions().bar.backgroundColor) || this.context.getOptions().primaryColor, a = rt(
|
|
4499
4510
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4500
4511
|
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", u = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, d = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, l = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4501
4512
|
this.slider || (this.slider = new k.Group({
|
|
4502
|
-
dragBoundFunc: (
|
|
4503
|
-
let
|
|
4504
|
-
const H = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime);
|
|
4505
|
-
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(H - (-this.offsetX + this.sliderGroup.getStage().width()));
|
|
4513
|
+
dragBoundFunc: (D) => {
|
|
4514
|
+
let _ = Math.min(0, -(-this.offsetX - this.slider.x())), W = this.context.store.getTimeAxis().getTimeLeft(this.context.store.getTimeAxis().getEndTime()) + this.offsetX - this.slider.width();
|
|
4506
4515
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
4507
4516
|
if (this.task.parent.startTime) {
|
|
4508
4517
|
const G = this.task.parent.startTime;
|
|
4509
|
-
|
|
4518
|
+
_ = this.context.store.getTimeAxis().getTimeLeft(G);
|
|
4510
4519
|
}
|
|
4511
4520
|
if (this.task.parent.endTime) {
|
|
4512
4521
|
const G = this.task.parent.endTime, F = this.context.store.getTimeAxis().getTimeLeft(G);
|
|
@@ -4514,64 +4523,64 @@ class $e {
|
|
|
4514
4523
|
}
|
|
4515
4524
|
}
|
|
4516
4525
|
return {
|
|
4517
|
-
x: $(
|
|
4526
|
+
x: $(D.x, _, W),
|
|
4518
4527
|
y: this.y + i + this.offsetY
|
|
4519
4528
|
};
|
|
4520
4529
|
}
|
|
4521
4530
|
})), this.slider.position({ x: s, y: i }), this.slider.size({ width: o, height: e });
|
|
4522
4531
|
const m = !!this.unpackFunc(this.context.getOptions().bar.move.enabled) && (this.task.isSummary() ? this.context.getOptions().summary.move.enabled : !0);
|
|
4523
|
-
if (this.slider.draggable(m), this.slider.on("mouseover", (
|
|
4524
|
-
m && !this.isDragging && (
|
|
4532
|
+
if (this.slider.draggable(m), this.slider.on("mouseover", (D) => {
|
|
4533
|
+
m && !this.isDragging && (D.target.getStage().container().style.cursor = "grab"), this.handleBarHighlight({
|
|
4525
4534
|
shadowColor: B(c).alpha(B(c).alpha() + 0.1).toHex(),
|
|
4526
4535
|
shadowBlur: Math.max((u || 1) * 2, 4),
|
|
4527
4536
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4528
4537
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4529
|
-
}), this.context.event.emit(S.SLIDER_ENTER,
|
|
4530
|
-
}), this.slider.on("mousemove", (
|
|
4531
|
-
this.context.event.emit(S.SLIDER_HOVER,
|
|
4532
|
-
}), this.slider.on("mouseout", (
|
|
4533
|
-
m && !this.isDragging && (
|
|
4538
|
+
}), this.context.event.emit(S.SLIDER_ENTER, D.evt, this.task);
|
|
4539
|
+
}), this.slider.on("mousemove", (D) => {
|
|
4540
|
+
this.context.event.emit(S.SLIDER_HOVER, D.evt, this.task);
|
|
4541
|
+
}), this.slider.on("mouseout", (D) => {
|
|
4542
|
+
m && !this.isDragging && (D.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4534
4543
|
shadowColor: c,
|
|
4535
4544
|
shadowBlur: u,
|
|
4536
4545
|
shadowOffsetX: d,
|
|
4537
4546
|
shadowOffsetY: l
|
|
4538
|
-
}), this.context.event.emit(S.SLIDER_LEAVE,
|
|
4547
|
+
}), this.context.event.emit(S.SLIDER_LEAVE, D.evt, this.task);
|
|
4539
4548
|
}), this.task.isMilestone()) {
|
|
4540
4549
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4541
|
-
const
|
|
4550
|
+
const D = this.unpackFunc(this.context.getOptions().milestone.size), _ = Math.min(D || e, t / 2), R = this.unpackFunc(this.context.getOptions().milestone.color) || r, W = this.unpackFunc(this.context.getOptions().milestone.border.color), I = this.unpackFunc(this.context.getOptions().milestone.border.width), G = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
4542
4551
|
if (!this.sliderBar) {
|
|
4543
4552
|
switch (G) {
|
|
4544
4553
|
case "triangle":
|
|
4545
4554
|
this.sliderBar = new k.RegularPolygon({
|
|
4546
4555
|
sides: 3,
|
|
4547
|
-
radius:
|
|
4556
|
+
radius: _,
|
|
4548
4557
|
rotation: 0,
|
|
4549
|
-
fill:
|
|
4558
|
+
fill: R,
|
|
4550
4559
|
stroke: W,
|
|
4551
4560
|
strokeWidth: I,
|
|
4552
|
-
y:
|
|
4561
|
+
y: e / 2
|
|
4553
4562
|
// 居中
|
|
4554
4563
|
});
|
|
4555
4564
|
break;
|
|
4556
4565
|
case "circle":
|
|
4557
4566
|
this.sliderBar = new k.Circle({
|
|
4558
|
-
radius:
|
|
4559
|
-
fill:
|
|
4567
|
+
radius: _,
|
|
4568
|
+
fill: R,
|
|
4560
4569
|
stroke: W,
|
|
4561
4570
|
strokeWidth: I,
|
|
4562
|
-
y:
|
|
4571
|
+
y: e / 2
|
|
4563
4572
|
// 居中
|
|
4564
4573
|
});
|
|
4565
4574
|
break;
|
|
4566
4575
|
case "star":
|
|
4567
4576
|
this.sliderBar = new k.Star({
|
|
4568
4577
|
numPoints: 5,
|
|
4569
|
-
innerRadius:
|
|
4570
|
-
outerRadius:
|
|
4571
|
-
fill:
|
|
4578
|
+
innerRadius: _ / 2,
|
|
4579
|
+
outerRadius: _,
|
|
4580
|
+
fill: R,
|
|
4572
4581
|
stroke: W,
|
|
4573
4582
|
strokeWidth: I,
|
|
4574
|
-
y:
|
|
4583
|
+
y: e / 2
|
|
4575
4584
|
// 居中
|
|
4576
4585
|
});
|
|
4577
4586
|
break;
|
|
@@ -4579,31 +4588,31 @@ class $e {
|
|
|
4579
4588
|
default:
|
|
4580
4589
|
this.sliderBar = new k.RegularPolygon({
|
|
4581
4590
|
sides: 4,
|
|
4582
|
-
radius:
|
|
4591
|
+
radius: _,
|
|
4583
4592
|
rotation: 0,
|
|
4584
|
-
fill:
|
|
4593
|
+
fill: R,
|
|
4585
4594
|
stroke: W,
|
|
4586
4595
|
strokeWidth: I,
|
|
4587
|
-
y:
|
|
4596
|
+
y: e / 2
|
|
4588
4597
|
// 居中
|
|
4589
4598
|
});
|
|
4590
4599
|
}
|
|
4591
4600
|
if (this.slider.add(this.sliderBar), this.unpackFunc(this.context.getOptions().milestone.label.show)) {
|
|
4592
|
-
const F = this.unpackFunc(this.context.getOptions().milestone.label.text), z = this.unpackFunc(this.context.getOptions().milestone.label.position), q = this.unpackFunc(this.context.getOptions().milestone.label.fontSize),
|
|
4601
|
+
const F = this.unpackFunc(this.context.getOptions().milestone.label.text), z = this.unpackFunc(this.context.getOptions().milestone.label.position), q = this.unpackFunc(this.context.getOptions().milestone.label.fontSize), Nt = this.unpackFunc(this.context.getOptions().milestone.label.fontFamily), Yt = this.unpackFunc(this.context.getOptions().milestone.label.color), it = new k.Text({
|
|
4593
4602
|
height: e,
|
|
4594
4603
|
text: F,
|
|
4595
|
-
fill:
|
|
4604
|
+
fill: Yt || R,
|
|
4596
4605
|
fontSize: q,
|
|
4597
|
-
fontFamily:
|
|
4598
|
-
}),
|
|
4599
|
-
it.width(
|
|
4606
|
+
fontFamily: Nt
|
|
4607
|
+
}), lt = it.measureSize(F);
|
|
4608
|
+
it.width(lt.width);
|
|
4600
4609
|
const K = { x: 0, y: 0 };
|
|
4601
4610
|
switch (z) {
|
|
4602
4611
|
case "top-left":
|
|
4603
|
-
K.x = -(12 +
|
|
4612
|
+
K.x = -(12 + lt.width), K.y = -8;
|
|
4604
4613
|
break;
|
|
4605
4614
|
case "bottom-left":
|
|
4606
|
-
K.x = -(12 +
|
|
4615
|
+
K.x = -(12 + lt.width), K.y = 10;
|
|
4607
4616
|
break;
|
|
4608
4617
|
case "bottom-right":
|
|
4609
4618
|
K.x = 12, K.y = 10;
|
|
@@ -4619,21 +4628,21 @@ class $e {
|
|
|
4619
4628
|
this.sliderType = "milestone";
|
|
4620
4629
|
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
4621
4630
|
this.sliderBar && this.sliderType !== "summary" && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4622
|
-
const
|
|
4631
|
+
const D = this.unpackFunc(this.context.getOptions().summary.color) || r, _ = t * 0.2, R = t * 0.3, W = (I) => new k.Shape({
|
|
4623
4632
|
sceneFunc: (G, F) => {
|
|
4624
|
-
const z =
|
|
4625
|
-
G.beginPath(), G.moveTo(0, (t -
|
|
4633
|
+
const z = R * 0.5;
|
|
4634
|
+
G.beginPath(), G.moveTo(0, (t - _) / 2), G.lineTo(z, (t - _) / 2), G.lineTo(z, (t - _) / 2 + _), G.lineTo(0, (t - _) / 2 + _ + R), G.lineTo(0, (t - _) / 2), G.rect(z, (t - _) / 2, I - 2 * z, _), G.moveTo(I - z, (t - _) / 2), G.lineTo(I, (t - _) / 2), G.lineTo(I, (t - _) / 2 + _ + R), G.lineTo(I - z, (t - _) / 2 + _), G.lineTo(I - z, (t - _) / 2), G.fillStrokeShape(F);
|
|
4626
4635
|
},
|
|
4627
4636
|
width: I,
|
|
4628
|
-
fill:
|
|
4637
|
+
fill: D,
|
|
4629
4638
|
shadowColor: c,
|
|
4630
4639
|
shadowBlur: u,
|
|
4631
4640
|
shadowOffsetX: d,
|
|
4632
4641
|
shadowOffsetY: l,
|
|
4633
|
-
y: -(
|
|
4642
|
+
y: -(R + _) / 2 - i / 2
|
|
4634
4643
|
});
|
|
4635
4644
|
!this.sliderBar || this.sliderBar.width() !== o ? (this.sliderBar && this.sliderBar.destroy(), this.sliderBar = W(o), this.slider.add(this.sliderBar)) : this.sliderBar.setAttrs({
|
|
4636
|
-
fill:
|
|
4645
|
+
fill: D,
|
|
4637
4646
|
shadowColor: c,
|
|
4638
4647
|
shadowBlur: u,
|
|
4639
4648
|
shadowOffsetX: d,
|
|
@@ -4649,7 +4658,7 @@ class $e {
|
|
|
4649
4658
|
fill: r,
|
|
4650
4659
|
cornerRadius: a
|
|
4651
4660
|
}), this.renderProgress(o, e);
|
|
4652
|
-
const
|
|
4661
|
+
const D = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, _ = (g = this.context.getOptions().bar.move.single) == null ? void 0 : g.backgroundColor, R = _ ? B(_).alpha(((y = this.context.getOptions().bar.move.single) == null ? void 0 : y.opacity) ?? 1).toHex() : B(r).brighten(30 * (this.unpackFunc((x = this.context.getOptions().bar.progress) == null ? void 0 : x.show) ? -1 : 1)).alpha(((v = this.context.getOptions().bar.move.single) == null ? void 0 : v.opacity) ?? 1).toHex();
|
|
4653
4662
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
4654
4663
|
if (!this.leftHandleGroup) {
|
|
4655
4664
|
this.leftHandleGroup = new k.Group({
|
|
@@ -4669,7 +4678,7 @@ class $e {
|
|
|
4669
4678
|
x: 0,
|
|
4670
4679
|
y: 0
|
|
4671
4680
|
});
|
|
4672
|
-
this.leftHandleGroup.add(G),
|
|
4681
|
+
this.leftHandleGroup.add(G), D !== null && Tt(D || Ct, this.handlerWidth, e).then((F) => {
|
|
4673
4682
|
var q;
|
|
4674
4683
|
const z = new k.Image({
|
|
4675
4684
|
image: F,
|
|
@@ -4684,7 +4693,7 @@ class $e {
|
|
|
4684
4693
|
(w = this.leftHandleGroup.findOne("Rect")) == null || w.setAttrs({
|
|
4685
4694
|
width: this.handlerWidth,
|
|
4686
4695
|
height: e,
|
|
4687
|
-
fill:
|
|
4696
|
+
fill: R,
|
|
4688
4697
|
cornerRadius: [a[0], 0, 0, a[3]]
|
|
4689
4698
|
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
4690
4699
|
x: 0,
|
|
@@ -4712,7 +4721,7 @@ class $e {
|
|
|
4712
4721
|
x: 0,
|
|
4713
4722
|
y: 0
|
|
4714
4723
|
});
|
|
4715
|
-
this.rightHandleGroup.add(G),
|
|
4724
|
+
this.rightHandleGroup.add(G), D !== null && Tt(D || Ct, this.handlerWidth, e).then((F) => {
|
|
4716
4725
|
var q;
|
|
4717
4726
|
const z = new k.Image({
|
|
4718
4727
|
image: F,
|
|
@@ -4728,7 +4737,7 @@ class $e {
|
|
|
4728
4737
|
x: o - this.handlerWidth,
|
|
4729
4738
|
width: this.handlerWidth,
|
|
4730
4739
|
height: e,
|
|
4731
|
-
fill:
|
|
4740
|
+
fill: R,
|
|
4732
4741
|
cornerRadius: [0, a[1], a[2], 0]
|
|
4733
4742
|
}), (T = this.rightHandleGroup.findOne("Image")) == null || T.setAttrs({
|
|
4734
4743
|
x: o - this.handlerWidth,
|
|
@@ -4737,7 +4746,7 @@ class $e {
|
|
|
4737
4746
|
height: this.handlerWidth
|
|
4738
4747
|
});
|
|
4739
4748
|
} else this.rightHandleGroup && (this.rightHandleGroup.remove(), this.rightHandleGroup = null);
|
|
4740
|
-
this.renderText(o, e), (
|
|
4749
|
+
this.renderText(o, e), (O = this.leftHandleGroup) == null || O.moveToTop(), (A = this.rightHandleGroup) == null || A.moveToTop();
|
|
4741
4750
|
}
|
|
4742
4751
|
this.isDragging || this.sliderBar.setAttrs({
|
|
4743
4752
|
shadowColor: c,
|
|
@@ -4784,16 +4793,16 @@ class $e {
|
|
|
4784
4793
|
return;
|
|
4785
4794
|
}
|
|
4786
4795
|
if (this.task.progress) {
|
|
4787
|
-
const g =
|
|
4796
|
+
const g = Zt(
|
|
4788
4797
|
this.task.progress,
|
|
4789
4798
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
4790
4799
|
);
|
|
4791
4800
|
if (g === 0) return;
|
|
4792
4801
|
const y = this.unpackFunc(
|
|
4793
4802
|
this.context.getOptions().bar.backgroundColor
|
|
4794
|
-
) || this.context.getOptions().primaryColor, x = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || B(y).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), v =
|
|
4803
|
+
) || this.context.getOptions().primaryColor, x = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || B(y).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), v = rt(
|
|
4795
4804
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4796
|
-
), b =
|
|
4805
|
+
), b = rt(
|
|
4797
4806
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
4798
4807
|
2
|
|
4799
4808
|
// 默认 2
|
|
@@ -4817,10 +4826,10 @@ class $e {
|
|
|
4817
4826
|
opacity: this.unpackFunc((a = this.context.getOptions().bar.progress) == null ? void 0 : a.opacity)
|
|
4818
4827
|
});
|
|
4819
4828
|
this.progressGroup.add(C);
|
|
4820
|
-
const M = `${
|
|
4829
|
+
const M = `${pt(
|
|
4821
4830
|
g * 100,
|
|
4822
4831
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4823
|
-
)}%`, E = new k.Text().measureSize(M).width, T = this.unpackFunc((u = this.context.getOptions().bar.progress) == null ? void 0 : u.textAlign),
|
|
4832
|
+
)}%`, E = new k.Text().measureSize(M).width, T = this.unpackFunc((u = this.context.getOptions().bar.progress) == null ? void 0 : u.textAlign), O = new k.Text({
|
|
4824
4833
|
x: 0,
|
|
4825
4834
|
y: T === "top" ? -e : 0,
|
|
4826
4835
|
width: T === "right" ? w + E : Math.max(w, E),
|
|
@@ -4833,7 +4842,7 @@ class $e {
|
|
|
4833
4842
|
verticalAlign: T === "top" ? "bottom" : "middle",
|
|
4834
4843
|
align: "right"
|
|
4835
4844
|
});
|
|
4836
|
-
(p = this.progressGroup) == null || p.add(
|
|
4845
|
+
(p = this.progressGroup) == null || p.add(O);
|
|
4837
4846
|
}
|
|
4838
4847
|
}
|
|
4839
4848
|
// 绑定事件,包括拖拽和边缘检测
|
|
@@ -4865,13 +4874,13 @@ class $e {
|
|
|
4865
4874
|
const e = t.target.getStage();
|
|
4866
4875
|
if (!e) return;
|
|
4867
4876
|
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(S.SLIDER_DRAGGING, !0), e.container().style.cursor = "grabbing";
|
|
4868
|
-
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n =
|
|
4877
|
+
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ut(i, s);
|
|
4869
4878
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4870
4879
|
}
|
|
4871
4880
|
handleDragMove(t) {
|
|
4872
4881
|
if (!this.isDragging) return;
|
|
4873
4882
|
if (t.evt.movementX > 0 ? this.draggingDirection !== "right" && (this.draggingDirection = "right", this.stopAutoScroll(), this.stopAutoExpand()) : t.evt.movementX < 0 && this.draggingDirection !== "left" && (this.draggingDirection = "left", this.stopAutoScroll(), this.stopAutoExpand()), !!this.context.getOptions().bar.move.byUnit) {
|
|
4874
|
-
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n =
|
|
4883
|
+
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ut(i, s);
|
|
4875
4884
|
t.target.x(n - this.dragDiffX);
|
|
4876
4885
|
}
|
|
4877
4886
|
}
|
|
@@ -4903,10 +4912,10 @@ class $e {
|
|
|
4903
4912
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = t.target.width(), a = t.target.x(), c = a + r, u = Math.max(0, -this.offsetX - a), d = Math.max(0, c - (-this.offsetX + i));
|
|
4904
4913
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4905
4914
|
const l = t.target.width(), m = t.target.x(), p = m + l, g = -this.offsetX, y = g + i, x = this.context.store.getTimeAxis().getTotalWidth(), v = m <= g + this.EDGE_THRESHOLD, b = p >= y - this.EDGE_THRESHOLD;
|
|
4906
|
-
if (v)
|
|
4915
|
+
if (this.draggingDirection === "left" && v)
|
|
4907
4916
|
if (g <= 0)
|
|
4908
|
-
|
|
4909
|
-
else
|
|
4917
|
+
t.target.x(-u), this.stopAutoScroll(), s || this.startAutoExpand("left", -u);
|
|
4918
|
+
else {
|
|
4910
4919
|
const w = n ? -o : -this.SCROLL_STEP;
|
|
4911
4920
|
this.startAutoScroll(
|
|
4912
4921
|
w,
|
|
@@ -4916,18 +4925,16 @@ class $e {
|
|
|
4916
4925
|
},
|
|
4917
4926
|
() => t.target.x(t.target.x() - u)
|
|
4918
4927
|
);
|
|
4919
|
-
}
|
|
4920
|
-
|
|
4921
|
-
else if (b)
|
|
4928
|
+
}
|
|
4929
|
+
else if (this.draggingDirection === "right" && b)
|
|
4922
4930
|
if (y >= x)
|
|
4923
|
-
|
|
4924
|
-
else
|
|
4931
|
+
t.target.x(x - l + d), this.stopAutoScroll(), s || this.startAutoExpand("right", 0, d);
|
|
4932
|
+
else {
|
|
4925
4933
|
const w = n ? o : this.SCROLL_STEP;
|
|
4926
4934
|
this.startAutoScroll(w, n, () => {
|
|
4927
4935
|
t.target.x(t.target.x() + w);
|
|
4928
4936
|
});
|
|
4929
|
-
}
|
|
4930
|
-
this.stopAutoScroll();
|
|
4937
|
+
}
|
|
4931
4938
|
else
|
|
4932
4939
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
4933
4940
|
this.emitUpdate("both");
|
|
@@ -4988,7 +4995,7 @@ class $e {
|
|
|
4988
4995
|
x.movementX > 0 ? this.draggingDirection = "right" : x.movementX < 0 && (this.draggingDirection = "left");
|
|
4989
4996
|
const v = Math.max(((w = i.getPointerPosition()) == null ? void 0 : w.x) || 0, 0);
|
|
4990
4997
|
let b = v - s;
|
|
4991
|
-
n && (b =
|
|
4998
|
+
n && (b = ut(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && v < a - this.EDGE_THRESHOLD && (this.slider.width(m - b - c), this.slider.x(l + b + c), this.emitUpdate("left")) : m + b + u >= o && v > this.EDGE_THRESHOLD && (this.slider.width(m + b + u), this.emitUpdate("right")), d = b);
|
|
4992
4999
|
}, g = () => {
|
|
4993
5000
|
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
4994
5001
|
};
|
|
@@ -5071,7 +5078,7 @@ class $e {
|
|
|
5071
5078
|
n.start();
|
|
5072
5079
|
}
|
|
5073
5080
|
}
|
|
5074
|
-
class
|
|
5081
|
+
class ze {
|
|
5075
5082
|
constructor(t, e, i, s, n, o, r) {
|
|
5076
5083
|
h(this, "row");
|
|
5077
5084
|
h(this, "slider");
|
|
@@ -5085,10 +5092,10 @@ class Fe {
|
|
|
5085
5092
|
id: i,
|
|
5086
5093
|
listening: !1
|
|
5087
5094
|
});
|
|
5088
|
-
this.row.add(a), this.slider = new
|
|
5095
|
+
this.row.add(a), this.slider = new Be(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
5089
5096
|
}
|
|
5090
|
-
update(t, e) {
|
|
5091
|
-
this.slider.update(t, e);
|
|
5097
|
+
update(t, e, i) {
|
|
5098
|
+
this.slider.update(t, e, i);
|
|
5092
5099
|
}
|
|
5093
5100
|
setOffset(t, e) {
|
|
5094
5101
|
this.slider.setOffset(t, e);
|
|
@@ -5097,7 +5104,7 @@ class Fe {
|
|
|
5097
5104
|
this.row.destroy();
|
|
5098
5105
|
}
|
|
5099
5106
|
}
|
|
5100
|
-
class
|
|
5107
|
+
class Pe {
|
|
5101
5108
|
constructor(t, e, i, s) {
|
|
5102
5109
|
h(this, "tasks", []);
|
|
5103
5110
|
// 当前渲染的任务列表
|
|
@@ -5143,7 +5150,7 @@ class Be {
|
|
|
5143
5150
|
const o = `chart-row-${s.id}`;
|
|
5144
5151
|
let r = this.rowsCache.get(o);
|
|
5145
5152
|
const c = s.flatIndex * e + this.context.getOptions().header.height;
|
|
5146
|
-
r ? (r.update(0, c), r.setOffset(this.offsetX, this.offsetY)) : (r = new
|
|
5153
|
+
r ? (r.update(0, c, s), r.setOffset(this.offsetX, this.offsetY)) : (r = new ze(
|
|
5147
5154
|
this.context,
|
|
5148
5155
|
s,
|
|
5149
5156
|
o,
|
|
@@ -5174,7 +5181,8 @@ class Be {
|
|
|
5174
5181
|
const e = this.rowsCache.get(`chart-row-${t.id}`);
|
|
5175
5182
|
e && e.update(
|
|
5176
5183
|
0,
|
|
5177
|
-
t.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height
|
|
5184
|
+
t.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height,
|
|
5185
|
+
t
|
|
5178
5186
|
);
|
|
5179
5187
|
}
|
|
5180
5188
|
/**
|
|
@@ -5371,7 +5379,7 @@ class Be {
|
|
|
5371
5379
|
this.rowsCache.clear(), this.rowsGroup.destroy(), this.rowBgGroup.destroy();
|
|
5372
5380
|
}
|
|
5373
5381
|
}
|
|
5374
|
-
class
|
|
5382
|
+
class Pt {
|
|
5375
5383
|
constructor() {
|
|
5376
5384
|
}
|
|
5377
5385
|
static async createPattern(t) {
|
|
@@ -5512,7 +5520,7 @@ class Bt {
|
|
|
5512
5520
|
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5513
5521
|
}
|
|
5514
5522
|
}
|
|
5515
|
-
class
|
|
5523
|
+
class Ne {
|
|
5516
5524
|
constructor(t, e) {
|
|
5517
5525
|
// 状态变量
|
|
5518
5526
|
h(this, "width", 0);
|
|
@@ -5573,7 +5581,7 @@ class ze {
|
|
|
5573
5581
|
}
|
|
5574
5582
|
if (m > u)
|
|
5575
5583
|
break;
|
|
5576
|
-
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await
|
|
5584
|
+
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Pt.createPattern(
|
|
5577
5585
|
this.context.getOptions().weekend
|
|
5578
5586
|
));
|
|
5579
5587
|
const x = new k.Rect({
|
|
@@ -5600,7 +5608,7 @@ class ze {
|
|
|
5600
5608
|
this.layer.batchDraw();
|
|
5601
5609
|
}
|
|
5602
5610
|
}
|
|
5603
|
-
class
|
|
5611
|
+
class Ye {
|
|
5604
5612
|
constructor(t, e, i) {
|
|
5605
5613
|
h(this, "arrowAnimation");
|
|
5606
5614
|
h(this, "todayLine");
|
|
@@ -5641,7 +5649,7 @@ class Pe {
|
|
|
5641
5649
|
this.context.getOptions().today || {}
|
|
5642
5650
|
);
|
|
5643
5651
|
if (!t.show) return;
|
|
5644
|
-
let e =
|
|
5652
|
+
let e = H();
|
|
5645
5653
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
5646
5654
|
t.type === "block" && (e = e.startOf(i));
|
|
5647
5655
|
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, r = B(t.backgroundColor).alpha(t.opacity).toHex(), a = (t.type === "block" ? s + n / 2 : s) + this.offsetX, c = [a, o, a, this.height], u = t.type === "line" ? t.width : n;
|
|
@@ -5686,8 +5694,8 @@ class Pe {
|
|
|
5686
5694
|
fontFamily: b,
|
|
5687
5695
|
padding: 5
|
|
5688
5696
|
});
|
|
5689
|
-
const
|
|
5690
|
-
|
|
5697
|
+
const O = this.todayTextGroup.findOne(".today-text-bg");
|
|
5698
|
+
O == null || O.setAttrs({
|
|
5691
5699
|
width: C.width + 12,
|
|
5692
5700
|
height: C.height + 8,
|
|
5693
5701
|
fill: E
|
|
@@ -5716,7 +5724,7 @@ class Pe {
|
|
|
5716
5724
|
(t = this.todayLine) == null || t.destroy(), (e = this.triangle) == null || e.destroy(), (i = this.todayTextGroup) == null || i.destroy(), (s = this.arrowAnimation) == null || s.stop(), this.arrowAnimation = void 0;
|
|
5717
5725
|
}
|
|
5718
5726
|
}
|
|
5719
|
-
class
|
|
5727
|
+
class Ue {
|
|
5720
5728
|
constructor(t, e) {
|
|
5721
5729
|
// 状态变量
|
|
5722
5730
|
h(this, "width", 0);
|
|
@@ -5769,9 +5777,9 @@ class Ne {
|
|
|
5769
5777
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5770
5778
|
const w = t.find((C) => {
|
|
5771
5779
|
if (X(C.date)) {
|
|
5772
|
-
if (C.date.some((M) =>
|
|
5780
|
+
if (C.date.some((M) => H(M).isSame(b, "day")))
|
|
5773
5781
|
return C;
|
|
5774
|
-
} else if (
|
|
5782
|
+
} else if (H(C.date).isSame(b, "day"))
|
|
5775
5783
|
return C;
|
|
5776
5784
|
});
|
|
5777
5785
|
if (w) {
|
|
@@ -5782,13 +5790,13 @@ class Ne {
|
|
|
5782
5790
|
break;
|
|
5783
5791
|
!this.patternImage.has(w) && (w.pattern || this.context.getOptions().holiday.pattern) && this.patternImage.set(
|
|
5784
5792
|
w,
|
|
5785
|
-
await
|
|
5793
|
+
await Pt.createPattern({
|
|
5786
5794
|
backgroundColor: this.context.getOptions().primaryColor,
|
|
5787
5795
|
...w,
|
|
5788
5796
|
...this.context.getOptions().holiday
|
|
5789
5797
|
})
|
|
5790
5798
|
);
|
|
5791
|
-
const
|
|
5799
|
+
const O = new k.Rect({
|
|
5792
5800
|
name: "holiday-rect",
|
|
5793
5801
|
x: C,
|
|
5794
5802
|
y: M,
|
|
@@ -5806,25 +5814,25 @@ class Ne {
|
|
|
5806
5814
|
opacity: w.opacity || this.context.getOptions().holiday.opacity
|
|
5807
5815
|
}
|
|
5808
5816
|
});
|
|
5809
|
-
if (this.holidayGroup.add(
|
|
5810
|
-
if (X(w.date) && !
|
|
5817
|
+
if (this.holidayGroup.add(O), (d = w.text) != null && d.show) {
|
|
5818
|
+
if (X(w.date) && !H(w.date[0]).isSame(b, "day"))
|
|
5811
5819
|
continue;
|
|
5812
|
-
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10,
|
|
5820
|
+
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, D = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", _ = ((p = w.text) == null ? void 0 : p.content) || "", R = new k.Text({ fontSize: A, fontFamily: D }).measureSize(_), W = ((g = w.text) == null ? void 0 : g.color) || "white", I = ((y = w.text) == null ? void 0 : y.backgroundColor) || w.backgroundColor || ((x = this.context.getOptions().holiday) == null ? void 0 : x.backgroundColor) || this.context.getOptions().primaryColor, G = new k.Group({
|
|
5813
5821
|
name: "holiday-text-group",
|
|
5814
5822
|
x: C,
|
|
5815
5823
|
y: M,
|
|
5816
5824
|
opacity: (v = w.text) == null ? void 0 : v.opacity
|
|
5817
5825
|
}), F = new k.Text({
|
|
5818
|
-
text:
|
|
5826
|
+
text: _,
|
|
5819
5827
|
fill: W,
|
|
5820
5828
|
fontSize: A,
|
|
5821
|
-
fontFamily:
|
|
5829
|
+
fontFamily: D,
|
|
5822
5830
|
padding: 5
|
|
5823
5831
|
}), z = new k.Rect({
|
|
5824
5832
|
x: 0,
|
|
5825
5833
|
y: 0,
|
|
5826
|
-
width:
|
|
5827
|
-
height:
|
|
5834
|
+
width: R.width + 12,
|
|
5835
|
+
height: R.height + 8,
|
|
5828
5836
|
fill: I
|
|
5829
5837
|
});
|
|
5830
5838
|
G.add(z), G.add(F), this.holidayGroup.add(G);
|
|
@@ -5834,7 +5842,7 @@ class Ne {
|
|
|
5834
5842
|
this.layer.batchDraw();
|
|
5835
5843
|
}
|
|
5836
5844
|
}
|
|
5837
|
-
class
|
|
5845
|
+
class Xe {
|
|
5838
5846
|
constructor(t, e) {
|
|
5839
5847
|
// 状态变量
|
|
5840
5848
|
h(this, "width", 0);
|
|
@@ -5882,7 +5890,7 @@ class Ye {
|
|
|
5882
5890
|
if (!t || t.length === 0) return;
|
|
5883
5891
|
const e = ((m = this.context.getOptions().flag) == null ? void 0 : m.backgroundColor) || this.context.getOptions().primaryColor, i = ((p = this.context.getOptions().flag) == null ? void 0 : p.opacity) || 1, s = ((g = this.context.getOptions().flag) == null ? void 0 : g.color) || (B(e).isDark() ? "white" : "black"), n = ((y = this.context.getOptions().flag) == null ? void 0 : y.fontFamily) || "Arial", o = ((x = this.context.getOptions().flag) == null ? void 0 : x.fontSize) || 10, r = Math.max(0, -this.offsetX), a = r + this.width, c = this.context.store.getTimeAxis().getCellWidth(), u = this.context.getOptions().header.height;
|
|
5884
5892
|
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((v) => {
|
|
5885
|
-
const b =
|
|
5893
|
+
const b = H(v.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = u;
|
|
5886
5894
|
if (w + c < r || w > a)
|
|
5887
5895
|
return;
|
|
5888
5896
|
const E = [w, u, w, this.height], T = new k.Line({
|
|
@@ -5892,10 +5900,10 @@ class Ye {
|
|
|
5892
5900
|
strokeWidth: 1
|
|
5893
5901
|
});
|
|
5894
5902
|
this.flagGroup.add(T);
|
|
5895
|
-
const
|
|
5896
|
-
if (
|
|
5903
|
+
const O = v.content || "";
|
|
5904
|
+
if (O) {
|
|
5897
5905
|
const A = new k.Text({
|
|
5898
|
-
text:
|
|
5906
|
+
text: O,
|
|
5899
5907
|
x: w + 5,
|
|
5900
5908
|
// 添加一些内边距
|
|
5901
5909
|
y: C + 5,
|
|
@@ -5905,14 +5913,14 @@ class Ye {
|
|
|
5905
5913
|
fill: v.color || s,
|
|
5906
5914
|
verticalAlign: "middle",
|
|
5907
5915
|
align: "left"
|
|
5908
|
-
}),
|
|
5916
|
+
}), D = new k.Rect({
|
|
5909
5917
|
x: w,
|
|
5910
5918
|
y: C,
|
|
5911
|
-
width: A.measureSize(
|
|
5912
|
-
height: A.measureSize(
|
|
5919
|
+
width: A.measureSize(O).width + 12,
|
|
5920
|
+
height: A.measureSize(O).height + 8,
|
|
5913
5921
|
fill: v.backgroundColor || e
|
|
5914
5922
|
});
|
|
5915
|
-
this.flagGroup.add(
|
|
5923
|
+
this.flagGroup.add(D), this.flagGroup.add(A);
|
|
5916
5924
|
} else if (v.flag)
|
|
5917
5925
|
switch (v.flag) {
|
|
5918
5926
|
case "banner":
|
|
@@ -5962,7 +5970,7 @@ class Ye {
|
|
|
5962
5970
|
}), this.layer.batchDraw();
|
|
5963
5971
|
}
|
|
5964
5972
|
}
|
|
5965
|
-
class
|
|
5973
|
+
class Ve {
|
|
5966
5974
|
constructor(t, e, i) {
|
|
5967
5975
|
h(this, "tasks", []);
|
|
5968
5976
|
// 创建点组
|
|
@@ -6057,7 +6065,7 @@ class Ue {
|
|
|
6057
6065
|
l.isMilestone() && (g += i / 2);
|
|
6058
6066
|
const y = s + i * l.flatIndex;
|
|
6059
6067
|
let x = !0, v = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
6060
|
-
if (
|
|
6068
|
+
if (ct(b) ? x = v = b : V(b) && (x = b === "S", v = b === "F"), x) {
|
|
6061
6069
|
const w = new k.Circle({
|
|
6062
6070
|
id: `point-${l.id}-left`,
|
|
6063
6071
|
x: m - g,
|
|
@@ -6101,11 +6109,11 @@ class Ue {
|
|
|
6101
6109
|
*/
|
|
6102
6110
|
calculateLinks(t) {
|
|
6103
6111
|
if (!this.context.getOptions().links.show) {
|
|
6104
|
-
this.
|
|
6112
|
+
this.linksGroup.destroyChildren(), this.linkCache.clear();
|
|
6105
6113
|
return;
|
|
6106
6114
|
}
|
|
6107
6115
|
if (this.tasks.length === 0) {
|
|
6108
|
-
this.
|
|
6116
|
+
this.linksGroup.destroyChildren(), this.linkCache.clear();
|
|
6109
6117
|
return;
|
|
6110
6118
|
}
|
|
6111
6119
|
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();
|
|
@@ -6119,14 +6127,14 @@ class Ue {
|
|
|
6119
6127
|
if (s.valid === !1) return;
|
|
6120
6128
|
const n = this.createId(s), o = this.context.store.getDataManager().getTaskById(s.from), r = this.context.store.getDataManager().getTaskById(s.to);
|
|
6121
6129
|
if (!o) {
|
|
6122
|
-
|
|
6130
|
+
L.warn(
|
|
6123
6131
|
`No corresponding FROM task [${s.from}] was found for the link. Info:`,
|
|
6124
6132
|
s
|
|
6125
6133
|
), s.valid = !1;
|
|
6126
6134
|
return;
|
|
6127
6135
|
}
|
|
6128
6136
|
if (!r) {
|
|
6129
|
-
|
|
6137
|
+
L.warn(
|
|
6130
6138
|
`No corresponding TO task [${s.to}] was found for the link. Info:`,
|
|
6131
6139
|
s
|
|
6132
6140
|
), s.valid = !1;
|
|
@@ -6138,7 +6146,7 @@ class Ue {
|
|
|
6138
6146
|
if (!(this.context.store.getTimeAxis().getTimeLeft(((u = s.type) == null ? void 0 : u[0]) === "S" ? o.startTime : o.endTime) < a && this.context.store.getTimeAxis().getTimeLeft(((d = s.type) == null ? void 0 : d[1]) === "F" ? r.endTime : r.startTime) < a) && !(this.context.store.getTimeAxis().getTimeLeft(((l = s.type) == null ? void 0 : l[0]) === "S" ? o.startTime : o.endTime) > c && this.context.store.getTimeAxis().getTimeLeft(((m = s.type) == null ? void 0 : m[1]) === "F" ? r.endTime : r.startTime) > c) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, o) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
6139
6147
|
const v = this.getPoints(o, r, s);
|
|
6140
6148
|
if (v.length <= 2)
|
|
6141
|
-
|
|
6149
|
+
L.warn("The link position has some error.", s);
|
|
6142
6150
|
else {
|
|
6143
6151
|
const b = s.radius ?? this.context.getOptions().links.radius, w = ((p = s.arrow) == null ? void 0 : p.width) ?? this.context.getOptions().links.arrow.width, C = ((g = s.arrow) == null ? void 0 : g.height) ?? this.context.getOptions().links.arrow.height, M = s.width ?? this.context.getOptions().links.width;
|
|
6144
6152
|
let E = this.linkCache.get(n);
|
|
@@ -6157,14 +6165,14 @@ class Ue {
|
|
|
6157
6165
|
});
|
|
6158
6166
|
E.add(I);
|
|
6159
6167
|
}
|
|
6160
|
-
const
|
|
6161
|
-
if (
|
|
6162
|
-
|
|
6168
|
+
const O = Math.floor(v.length / 2), A = O % 2 === 0 ? O : O - 1, D = v.slice(0, A + 2), _ = v.slice(A), R = E.findOne("Line");
|
|
6169
|
+
if (R)
|
|
6170
|
+
R.points(D), R.stroke(
|
|
6163
6171
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6164
|
-
),
|
|
6172
|
+
), R.strokeWidth(M + (this.selectedMap.has(n) ? 2 : 0)), R.dash(s.dash || this.context.getOptions().links.dash);
|
|
6165
6173
|
else {
|
|
6166
6174
|
const I = new k.Line({
|
|
6167
|
-
points:
|
|
6175
|
+
points: D,
|
|
6168
6176
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6169
6177
|
strokeWidth: M,
|
|
6170
6178
|
lineCap: "round",
|
|
@@ -6187,14 +6195,14 @@ class Ue {
|
|
|
6187
6195
|
}
|
|
6188
6196
|
const W = E.findOne("Arrow");
|
|
6189
6197
|
if (W)
|
|
6190
|
-
W.points(
|
|
6198
|
+
W.points(_), W.stroke(
|
|
6191
6199
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6192
6200
|
), W.strokeWidth(M + (this.selectedMap.has(n) ? 2 : 0)), W.pointerLength(C), W.pointerWidth(w), W.fill(
|
|
6193
6201
|
((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
|
|
6194
6202
|
), W.lineJoin("round"), W.dash(s.dash || this.context.getOptions().links.dash);
|
|
6195
6203
|
else {
|
|
6196
6204
|
const I = new k.Arrow({
|
|
6197
|
-
points:
|
|
6205
|
+
points: _,
|
|
6198
6206
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6199
6207
|
strokeWidth: M,
|
|
6200
6208
|
pointerLength: C,
|
|
@@ -6295,7 +6303,7 @@ class Ue {
|
|
|
6295
6303
|
{
|
|
6296
6304
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6297
6305
|
if (isNaN(m))
|
|
6298
|
-
|
|
6306
|
+
L.error("Link's distance must be a Numeric");
|
|
6299
6307
|
else {
|
|
6300
6308
|
const p = n + d + m, g = o - d - m, y = [
|
|
6301
6309
|
Math.max(p, g),
|
|
@@ -6317,7 +6325,7 @@ class Ue {
|
|
|
6317
6325
|
{
|
|
6318
6326
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6319
6327
|
if (isNaN(m))
|
|
6320
|
-
|
|
6328
|
+
L.error("Link's distance must be a Numeric");
|
|
6321
6329
|
else {
|
|
6322
6330
|
const p = n + d + m, g = r + d + m, y = [
|
|
6323
6331
|
p <= g ? g : p,
|
|
@@ -6340,7 +6348,7 @@ class Ue {
|
|
|
6340
6348
|
{
|
|
6341
6349
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6342
6350
|
if (isNaN(m))
|
|
6343
|
-
|
|
6351
|
+
L.error("Link's distance must be a Numeric");
|
|
6344
6352
|
else {
|
|
6345
6353
|
const p = s - d - m, g = o - d - m;
|
|
6346
6354
|
l.push(
|
|
@@ -6363,7 +6371,7 @@ class Ue {
|
|
|
6363
6371
|
{
|
|
6364
6372
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6365
6373
|
if (isNaN(m))
|
|
6366
|
-
|
|
6374
|
+
L.error("Link's distance must be a Numeric");
|
|
6367
6375
|
else {
|
|
6368
6376
|
const p = s - d - m, g = r + d + m, y = [
|
|
6369
6377
|
Math.min(p, g),
|
|
@@ -6407,19 +6415,19 @@ class Ue {
|
|
|
6407
6415
|
b.x <= M ? r = "S" : (r = "F", E = C + d);
|
|
6408
6416
|
let T;
|
|
6409
6417
|
if (i === "S" ? T = `${r}${(e.type || "FS")[1]}` : T = `${(e.type || "FS")[0]}${r}`, i === "S") {
|
|
6410
|
-
const { allowLeft:
|
|
6418
|
+
const { allowLeft: O, allowRight: A } = this.isAllowStartDrop(l, e.to, T);
|
|
6411
6419
|
this.templateArrow.points([
|
|
6412
6420
|
E,
|
|
6413
6421
|
u + c * l.flatIndex,
|
|
6414
6422
|
...s
|
|
6415
6423
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6416
6424
|
} else if (i === "F") {
|
|
6417
|
-
const { allowLeft:
|
|
6425
|
+
const { allowLeft: O, allowRight: A } = this.isAllowEndDrop(l, e.from, T);
|
|
6418
6426
|
this.templateArrow.points([
|
|
6419
6427
|
...s,
|
|
6420
6428
|
E,
|
|
6421
6429
|
u + c * l.flatIndex
|
|
6422
|
-
]),
|
|
6430
|
+
]), O ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6423
6431
|
}
|
|
6424
6432
|
}
|
|
6425
6433
|
}, p = () => {
|
|
@@ -6428,8 +6436,8 @@ class Ue {
|
|
|
6428
6436
|
const w = J(e);
|
|
6429
6437
|
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) {
|
|
6430
6438
|
w.type = b;
|
|
6431
|
-
let E = !1, T = !1,
|
|
6432
|
-
i === "S" ? { allowLeft: E, allowRight: T, reason:
|
|
6439
|
+
let E = !1, T = !1, O;
|
|
6440
|
+
i === "S" ? { allowLeft: E, allowRight: T, reason: O } = this.isAllowStartDrop(l, w.to, w.type, !0) : i === "F" && ({ allowLeft: E, allowRight: T, reason: O } = this.isAllowEndDrop(l, w.from, w.type, !0)), ((C = w.type) == null ? void 0 : C.slice(1)) === "S" && E || ((M = w.type) == null ? void 0 : M.slice(1)) === "F" && T ? (this.context.event.emit(S.UPDATE_LINK, w), this.context.store.getLinkManager().update(), this.calculateLinks()) : this.context.event.emit(S.ERROR, O || Y.LINK_NOT_ALLOWED);
|
|
6433
6441
|
} else
|
|
6434
6442
|
this.context.event.emit(S.ERROR, Y.TASK_NOT_FOUND);
|
|
6435
6443
|
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);
|
|
@@ -6517,7 +6525,7 @@ class Ue {
|
|
|
6517
6525
|
j(r) && (r = r(
|
|
6518
6526
|
t.getEmitData(),
|
|
6519
6527
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6520
|
-
)),
|
|
6528
|
+
)), ct(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6521
6529
|
const a = this.validateChain(t.id, e, i, s);
|
|
6522
6530
|
return {
|
|
6523
6531
|
allowLeft: n && a.ok,
|
|
@@ -6533,7 +6541,7 @@ class Ue {
|
|
|
6533
6541
|
j(r) && (r = r(
|
|
6534
6542
|
t.getEmitData(),
|
|
6535
6543
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6536
|
-
)),
|
|
6544
|
+
)), ct(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6537
6545
|
const a = this.validateChain(e, t.id, i, s);
|
|
6538
6546
|
return {
|
|
6539
6547
|
allowLeft: n && a.ok,
|
|
@@ -6600,7 +6608,7 @@ class Ue {
|
|
|
6600
6608
|
});
|
|
6601
6609
|
}
|
|
6602
6610
|
}
|
|
6603
|
-
class
|
|
6611
|
+
class Ke {
|
|
6604
6612
|
constructor(t, e, i) {
|
|
6605
6613
|
h(this, "tasks", []);
|
|
6606
6614
|
h(this, "chartBaselineGroup");
|
|
@@ -6653,12 +6661,12 @@ class Xe {
|
|
|
6653
6661
|
*/
|
|
6654
6662
|
calculateBaselines() {
|
|
6655
6663
|
if (this.baselineGroup.destroyChildren(), this.indicatorGroup.destroyChildren(), !this.context.getOptions().baselines.show) return;
|
|
6656
|
-
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s =
|
|
6664
|
+
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s = rt(
|
|
6657
6665
|
this.context.getOptions().baselines.radius
|
|
6658
6666
|
), n = this.context.getOptions().baselines.opacity, o = this.context.getOptions().baselines.backgroundColor;
|
|
6659
6667
|
this.tasks.forEach((r) => {
|
|
6660
6668
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
6661
|
-
const a = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c =
|
|
6669
|
+
const a = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c = ot(
|
|
6662
6670
|
this.context.getOptions().baselines.height || this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, r),
|
|
6663
6671
|
e
|
|
6664
6672
|
), u = this.context.getOptions().baselines.offset ?? 0;
|
|
@@ -6688,7 +6696,7 @@ class Xe {
|
|
|
6688
6696
|
});
|
|
6689
6697
|
t.add(g), this.renderText(t, e, i, s, n, p, a);
|
|
6690
6698
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
6691
|
-
const p =
|
|
6699
|
+
const p = ot(this.context.getOptions().baselines.height ?? 5, r);
|
|
6692
6700
|
let g = c + r * e.flatIndex + m;
|
|
6693
6701
|
const y = this.context.getOptions().baselines.position;
|
|
6694
6702
|
let x = "";
|
|
@@ -6757,7 +6765,7 @@ class Xe {
|
|
|
6757
6765
|
renderCompareIndicator(t, e, i) {
|
|
6758
6766
|
const s = this.context.getOptions().baselines, n = s.compare.indicator;
|
|
6759
6767
|
if (!n || !n.show) return;
|
|
6760
|
-
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, a =
|
|
6768
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, a = ot(
|
|
6761
6769
|
this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, t),
|
|
6762
6770
|
r
|
|
6763
6771
|
);
|
|
@@ -6775,7 +6783,7 @@ class Xe {
|
|
|
6775
6783
|
radius: n.size / 2
|
|
6776
6784
|
});
|
|
6777
6785
|
this.indicatorGroup.add(p);
|
|
6778
|
-
let g = `${
|
|
6786
|
+
let g = `${pt(i.startDiff)}${i.unit} ${m}`;
|
|
6779
6787
|
const y = s.compare.indicator[m].text;
|
|
6780
6788
|
j(y) ? g = y(i.startDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (g = y);
|
|
6781
6789
|
const x = new k.Text({
|
|
@@ -6799,7 +6807,7 @@ class Xe {
|
|
|
6799
6807
|
radius: n.size / 2
|
|
6800
6808
|
});
|
|
6801
6809
|
this.indicatorGroup.add(p);
|
|
6802
|
-
let g = `${
|
|
6810
|
+
let g = `${pt(i.endDiff)}${i.unit} ${m}`;
|
|
6803
6811
|
const y = s.compare.indicator[m].text;
|
|
6804
6812
|
j(y) ? g = y(i.endDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (g = y);
|
|
6805
6813
|
const x = new k.Text({
|
|
@@ -6826,7 +6834,7 @@ class Xe {
|
|
|
6826
6834
|
});
|
|
6827
6835
|
}
|
|
6828
6836
|
}
|
|
6829
|
-
class
|
|
6837
|
+
class je {
|
|
6830
6838
|
constructor(t, e) {
|
|
6831
6839
|
// Konva 元素
|
|
6832
6840
|
h(this, "stage");
|
|
@@ -6848,7 +6856,7 @@ class Ve {
|
|
|
6848
6856
|
container: this.container,
|
|
6849
6857
|
width: this.container.clientWidth,
|
|
6850
6858
|
height: this.container.clientHeight
|
|
6851
|
-
}), this.bgLayer = new k.Layer(), this.weekendGroup = new
|
|
6859
|
+
}), this.bgLayer = new k.Layer(), this.weekendGroup = new Ne(this.context, this.bgLayer), this.holidayGroup = new Ue(this.context, this.bgLayer), this.flagGroup = new Xe(this.context, this.bgLayer), this.gridGroup = new Fe(this.context, this.bgLayer), this.stage.add(this.bgLayer), this.axisLayer = new k.Layer(), this.headerLayer = new $e(this.context, this.axisLayer), this.todayLayer = new Ye(this.context, this.bgLayer, this.axisLayer), this.stage.add(this.axisLayer), this.bodyLayer = new k.Layer(), this.linkGroup = new Ve(this.context, this.stage, this.bodyLayer), this.baselineGroup = new Ke(this.context, this.stage, this.bodyLayer), this.bodyGroup = new Pe(this.context, this.stage, this.bodyLayer, this.bgLayer), this.stage.add(this.bodyLayer);
|
|
6852
6860
|
}
|
|
6853
6861
|
/**
|
|
6854
6862
|
* 调整大小
|
|
@@ -6875,8 +6883,8 @@ class Ve {
|
|
|
6875
6883
|
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();
|
|
6876
6884
|
}
|
|
6877
6885
|
}
|
|
6878
|
-
const
|
|
6879
|
-
class
|
|
6886
|
+
const qe = '<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>';
|
|
6887
|
+
class Qe {
|
|
6880
6888
|
constructor(t, e) {
|
|
6881
6889
|
h(this, "line");
|
|
6882
6890
|
h(this, "initialX", 0);
|
|
@@ -6886,9 +6894,17 @@ class je {
|
|
|
6886
6894
|
"border-left-color",
|
|
6887
6895
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
6888
6896
|
"important"
|
|
6889
|
-
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius =
|
|
6897
|
+
), this.line.style.cursor = "col-resize", this.root.store.getOptionManager().getOptions().collapse.show && (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 = this.root.store.getOptionManager().getOptions().collapse.backgroundColor || "#fff", this.collapseButton.style.borderRadius = `0 ${this.root.store.getOptionManager().getOptions().collapse.radius}px ${this.root.store.getOptionManager().getOptions().collapse.radius}px 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 = qe, this.collapseButton.addEventListener("click", (i) => {
|
|
6890
6898
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
6891
|
-
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
6899
|
+
}), this.line.appendChild(this.collapseButton)), this.container.appendChild(this.line), this.addDragEvents(), this.initEvents();
|
|
6900
|
+
}
|
|
6901
|
+
/**
|
|
6902
|
+
* 初始化事件
|
|
6903
|
+
*/
|
|
6904
|
+
initEvents() {
|
|
6905
|
+
this.root.event.on(S.OPTIONS_UPDATE, () => {
|
|
6906
|
+
this.updateOptions();
|
|
6907
|
+
});
|
|
6892
6908
|
}
|
|
6893
6909
|
setOffset(t) {
|
|
6894
6910
|
this.line.style.transform = `translateX(${t - 2}px)`, this.initialX = t, this.collapseButton && (this.root.store.getColumnManager().isCollapsed() ? this.collapseButton.querySelector("svg").style.transform = "rotate(180deg)" : this.collapseButton.querySelector("svg").style.transform = "rotate(0deg)");
|
|
@@ -6919,8 +6935,18 @@ class je {
|
|
|
6919
6935
|
};
|
|
6920
6936
|
this.line.addEventListener("mousedown", n);
|
|
6921
6937
|
}
|
|
6938
|
+
/**
|
|
6939
|
+
* 更新配置
|
|
6940
|
+
*/
|
|
6941
|
+
updateOptions() {
|
|
6942
|
+
this.line.style.setProperty(
|
|
6943
|
+
"border-left-color",
|
|
6944
|
+
this.root.store.getOptionManager().getOptions().border.color,
|
|
6945
|
+
"important"
|
|
6946
|
+
), this.collapseButton && (this.collapseButton.style.backgroundColor = this.root.store.getOptionManager().getOptions().collapse.backgroundColor || "#fff", this.collapseButton.style.borderRadius = `0 ${this.root.store.getOptionManager().getOptions().collapse.radius}px ${this.root.store.getOptionManager().getOptions().collapse.radius}px 0`);
|
|
6947
|
+
}
|
|
6922
6948
|
}
|
|
6923
|
-
class
|
|
6949
|
+
class Ze {
|
|
6924
6950
|
/**
|
|
6925
6951
|
* @param container 指示线的容器元素
|
|
6926
6952
|
*/
|
|
@@ -6952,6 +6978,8 @@ class qe {
|
|
|
6952
6978
|
this.hide();
|
|
6953
6979
|
}), this.context.event.on(S.MOVE_GUIDELINE, (t) => {
|
|
6954
6980
|
this.setLeft(t);
|
|
6981
|
+
}), this.context.event.on(S.OPTIONS_UPDATE, () => {
|
|
6982
|
+
this.updateOptions();
|
|
6955
6983
|
});
|
|
6956
6984
|
}
|
|
6957
6985
|
/**
|
|
@@ -6994,8 +7022,18 @@ class qe {
|
|
|
6994
7022
|
getLeft() {
|
|
6995
7023
|
return this.element.offsetLeft;
|
|
6996
7024
|
}
|
|
7025
|
+
/**
|
|
7026
|
+
* 更新参数
|
|
7027
|
+
*/
|
|
7028
|
+
updateOptions() {
|
|
7029
|
+
this.element.style.setProperty(
|
|
7030
|
+
"border-left",
|
|
7031
|
+
`1px dashed ${this.context.getOptions().border.color}`,
|
|
7032
|
+
"important"
|
|
7033
|
+
);
|
|
7034
|
+
}
|
|
6997
7035
|
}
|
|
6998
|
-
class
|
|
7036
|
+
class Je {
|
|
6999
7037
|
constructor(t = 16) {
|
|
7000
7038
|
h(this, "taskQueue", /* @__PURE__ */ new Map());
|
|
7001
7039
|
// 使用 Map 避免同类型重复任务
|
|
@@ -7005,7 +7043,7 @@ class Qe {
|
|
|
7005
7043
|
h(this, "delay");
|
|
7006
7044
|
// 使用 debounce 来延迟执行,避免短时间内多次触发
|
|
7007
7045
|
h(this, "debouncedFlush");
|
|
7008
|
-
this.delay = t, this.debouncedFlush =
|
|
7046
|
+
this.delay = t, this.debouncedFlush = Kt(() => {
|
|
7009
7047
|
this.flushTaskQueue();
|
|
7010
7048
|
}, t);
|
|
7011
7049
|
}
|
|
@@ -7015,7 +7053,7 @@ class Qe {
|
|
|
7015
7053
|
* @param handler 处理器配置
|
|
7016
7054
|
*/
|
|
7017
7055
|
registerHandler(t, e) {
|
|
7018
|
-
this.taskHandlers.set(t, e),
|
|
7056
|
+
this.taskHandlers.set(t, e), L.debug(`RenderScheduler: 注册任务处理器 ${t}`);
|
|
7019
7057
|
}
|
|
7020
7058
|
/**
|
|
7021
7059
|
* 注册任务处理器(简化版本,只传回调函数)
|
|
@@ -7035,7 +7073,7 @@ class Qe {
|
|
|
7035
7073
|
scheduleTask(t, e = [], i = {}) {
|
|
7036
7074
|
const s = this.taskHandlers.get(t);
|
|
7037
7075
|
if (!s) {
|
|
7038
|
-
|
|
7076
|
+
L.warn(`RenderScheduler: 未找到任务类型 ${t} 的处理器`);
|
|
7039
7077
|
return;
|
|
7040
7078
|
}
|
|
7041
7079
|
const n = {
|
|
@@ -7046,10 +7084,10 @@ class Qe {
|
|
|
7046
7084
|
immediate: i.immediate ?? s.immediate ?? !1
|
|
7047
7085
|
};
|
|
7048
7086
|
if (n.immediate) {
|
|
7049
|
-
|
|
7087
|
+
L.debug(`RenderScheduler: 立即执行任务 ${t}`), this.executeTask(n);
|
|
7050
7088
|
return;
|
|
7051
7089
|
}
|
|
7052
|
-
this.taskQueue.set(t, n),
|
|
7090
|
+
this.taskQueue.set(t, n), L.debug(`RenderScheduler: 添加任务到队列 ${t}`), this.debouncedFlush();
|
|
7053
7091
|
}
|
|
7054
7092
|
/**
|
|
7055
7093
|
* 立即执行指定类型的任务(跳过队列)
|
|
@@ -7060,10 +7098,10 @@ class Qe {
|
|
|
7060
7098
|
immediateExecuteTask(t, e = [], i = !1) {
|
|
7061
7099
|
const s = this.taskHandlers.get(t);
|
|
7062
7100
|
if (!s) {
|
|
7063
|
-
|
|
7101
|
+
L.warn(`RenderScheduler: 未找到任务类型 ${t} 的处理器`);
|
|
7064
7102
|
return;
|
|
7065
7103
|
}
|
|
7066
|
-
|
|
7104
|
+
L.debug(`RenderScheduler: 立即执行任务 ${t}`);
|
|
7067
7105
|
const n = {
|
|
7068
7106
|
type: t,
|
|
7069
7107
|
refresh: i,
|
|
@@ -7077,7 +7115,7 @@ class Qe {
|
|
|
7077
7115
|
* 立即执行所有队列中的任务
|
|
7078
7116
|
*/
|
|
7079
7117
|
immediateFlushAll() {
|
|
7080
|
-
|
|
7118
|
+
L.debug("RenderScheduler: 立即执行所有队列任务"), this.cancelScheduled(), this.flushTaskQueue();
|
|
7081
7119
|
}
|
|
7082
7120
|
/**
|
|
7083
7121
|
* 执行单个任务
|
|
@@ -7087,7 +7125,7 @@ class Qe {
|
|
|
7087
7125
|
try {
|
|
7088
7126
|
t.callback(...t.args || []);
|
|
7089
7127
|
} catch (e) {
|
|
7090
|
-
|
|
7128
|
+
L.error(`RenderScheduler: 执行任务 ${t.type} 时出错:`, e);
|
|
7091
7129
|
}
|
|
7092
7130
|
}
|
|
7093
7131
|
/**
|
|
@@ -7096,7 +7134,7 @@ class Qe {
|
|
|
7096
7134
|
flushTaskQueue() {
|
|
7097
7135
|
if (this.taskQueue.size === 0)
|
|
7098
7136
|
return;
|
|
7099
|
-
|
|
7137
|
+
L.debug(
|
|
7100
7138
|
`RenderScheduler: 执行任务队列,任务数量: ${this.taskQueue.size}`
|
|
7101
7139
|
);
|
|
7102
7140
|
const t = Array.from(this.taskQueue.values()).sort((e, i) => e.immediate !== i.immediate ? e.immediate ? -1 : 1 : e.refresh !== i.refresh ? e.refresh ? -1 : 1 : 0);
|
|
@@ -7115,7 +7153,7 @@ class Qe {
|
|
|
7115
7153
|
* @param taskType 任务类型
|
|
7116
7154
|
*/
|
|
7117
7155
|
unregisterHandler(t) {
|
|
7118
|
-
this.taskHandlers.delete(t), this.taskQueue.delete(t),
|
|
7156
|
+
this.taskHandlers.delete(t), this.taskQueue.delete(t), L.debug(`RenderScheduler: 移除任务处理器 ${t}`);
|
|
7119
7157
|
}
|
|
7120
7158
|
/**
|
|
7121
7159
|
* 获取当前队列中的任务数量
|
|
@@ -7133,10 +7171,10 @@ class Qe {
|
|
|
7133
7171
|
* 销毁调度器
|
|
7134
7172
|
*/
|
|
7135
7173
|
destroy() {
|
|
7136
|
-
this.cancelScheduled(), this.taskHandlers.clear(),
|
|
7174
|
+
this.cancelScheduled(), this.taskHandlers.clear(), L.debug("RenderScheduler: 已销毁");
|
|
7137
7175
|
}
|
|
7138
7176
|
}
|
|
7139
|
-
class
|
|
7177
|
+
class ti {
|
|
7140
7178
|
constructor(t, e) {
|
|
7141
7179
|
h(this, "scrollbar");
|
|
7142
7180
|
h(this, "rootElement");
|
|
@@ -7206,12 +7244,12 @@ class Ze {
|
|
|
7206
7244
|
this.table.updateWidth(), this.updateSize();
|
|
7207
7245
|
});
|
|
7208
7246
|
var i;
|
|
7209
|
-
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new
|
|
7247
|
+
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 Ze(this.context, this.container), this.middleLine = new Qe(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new We(this.context, this.tableContainer), this.chart = new je(this.context, this.chartContainer), this.scrollbar = new Ie(
|
|
7210
7248
|
this.context,
|
|
7211
7249
|
this.rootElement,
|
|
7212
7250
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
7213
7251
|
// 传入配置项
|
|
7214
|
-
), this.renderScheduler = new
|
|
7252
|
+
), this.renderScheduler = new Je(16), this.setupTaskHandlers(), this.updateSize(), this.setupEventListeners(), (i = this.context.store.getOptionManager().getOptions().resize) != null && i.enabled && (typeof window.ResizeObserver > "u" ? L.warn(
|
|
7215
7253
|
"Current environment does not support ResizeObserver, please include a polyfill to enable auto-resize feature."
|
|
7216
7254
|
) : (this.resizeObserver = new ResizeObserver(() => {
|
|
7217
7255
|
this.updateSize(), this.renderScheduler.scheduleTask("VIEW_UPDATE", [!1]);
|
|
@@ -7281,7 +7319,7 @@ class Ze {
|
|
|
7281
7319
|
performRender(t = !1, e = !1) {
|
|
7282
7320
|
this.setStyleValue();
|
|
7283
7321
|
const { x: i, y: s } = this.scrollbar.getScrollPosition(), n = this.context.store.getOptionManager().getOptions().row.height, o = this.context.store.getOptionManager().getOptions().header.height, r = Math.floor(s / n), a = Math.ceil((this.height - o) / n), c = 2, u = Math.max(0, r), d = a + c, l = this.context.store.getDataManager().getVisibleTasks().slice(u, u + d);
|
|
7284
|
-
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(S.LOADED), this.isInitialized = !1),
|
|
7322
|
+
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(S.LOADED), this.isInitialized = !1), L.debug("execute render");
|
|
7285
7323
|
}
|
|
7286
7324
|
/**
|
|
7287
7325
|
* 公共渲染方法,向后兼容
|
|
@@ -7302,16 +7340,16 @@ class Ze {
|
|
|
7302
7340
|
);
|
|
7303
7341
|
}
|
|
7304
7342
|
destroy() {
|
|
7305
|
-
|
|
7343
|
+
L.debug("Renderer destroy"), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
7306
7344
|
}
|
|
7307
7345
|
}
|
|
7308
|
-
class
|
|
7346
|
+
class ei {
|
|
7309
7347
|
constructor(t, e, i) {
|
|
7310
7348
|
h(this, "_id", Q());
|
|
7311
7349
|
h(this, "store");
|
|
7312
|
-
h(this, "event", new
|
|
7350
|
+
h(this, "event", new Qt());
|
|
7313
7351
|
h(this, "renderer");
|
|
7314
|
-
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new
|
|
7352
|
+
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new Ae(this, i), this.renderer = new ti(this, this.container), this.render(), this.registerEvents(), L.debug(
|
|
7315
7353
|
"----Gantt initialized for element:",
|
|
7316
7354
|
this._id,
|
|
7317
7355
|
this.container
|
|
@@ -7336,10 +7374,10 @@ class Je {
|
|
|
7336
7374
|
this.renderer.render();
|
|
7337
7375
|
}
|
|
7338
7376
|
updateOptions(t, e) {
|
|
7339
|
-
this.setOptions(t, e),
|
|
7377
|
+
this.setOptions(t, e), L.debug("GanttChart options updated"), this.render();
|
|
7340
7378
|
}
|
|
7341
7379
|
destroy() {
|
|
7342
|
-
|
|
7380
|
+
L.debug("Gantt destroying..."), this.event.offAll(), this.renderer.destroy(), this.container.innerHTML = "";
|
|
7343
7381
|
}
|
|
7344
7382
|
/**
|
|
7345
7383
|
* 跳转到指定日期。默认为今天
|
|
@@ -7347,7 +7385,7 @@ class Je {
|
|
|
7347
7385
|
* @return {boolean} 是否成功跳转
|
|
7348
7386
|
*/
|
|
7349
7387
|
jumpTo(t) {
|
|
7350
|
-
const e =
|
|
7388
|
+
const e = H(t);
|
|
7351
7389
|
if (!this.store.getTimeAxis().isInTimeAxis(e)) return !1;
|
|
7352
7390
|
const i = this.store.getTimeAxis().getTimeLeft(e) - 100;
|
|
7353
7391
|
return this.renderer.getScrollbar().scrollTo({ x: Math.max(i, 0) }), !0;
|
|
@@ -7459,12 +7497,12 @@ class Je {
|
|
|
7459
7497
|
});
|
|
7460
7498
|
}
|
|
7461
7499
|
}
|
|
7462
|
-
class
|
|
7500
|
+
class ri {
|
|
7463
7501
|
constructor(t, e) {
|
|
7464
7502
|
h(this, "context");
|
|
7465
7503
|
// 管理对外事件
|
|
7466
7504
|
h(this, "events", /* @__PURE__ */ new Map());
|
|
7467
|
-
e != null && e.logLevel &&
|
|
7505
|
+
e != null && e.logLevel && L.setOptions({
|
|
7468
7506
|
showTimestamp: e.logLevel === "debug",
|
|
7469
7507
|
level: {
|
|
7470
7508
|
debug: 1,
|
|
@@ -7476,8 +7514,8 @@ class ni {
|
|
|
7476
7514
|
});
|
|
7477
7515
|
const i = typeof t == "string" ? document.querySelector(t) : t;
|
|
7478
7516
|
if (!i)
|
|
7479
|
-
throw
|
|
7480
|
-
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new
|
|
7517
|
+
throw L.exception(`Container ${t} not found or invalid.`);
|
|
7518
|
+
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new ei(i, this.events, e);
|
|
7481
7519
|
}
|
|
7482
7520
|
// *** Public API Methods ***/
|
|
7483
7521
|
/**
|
|
@@ -7531,7 +7569,7 @@ class ni {
|
|
|
7531
7569
|
* @description 此方法通常不需要主动调用,初始化以及 `update` 中都会自动更新。 如果你需要强制刷新页面,可以在合适的时候调用此方法
|
|
7532
7570
|
*/
|
|
7533
7571
|
render() {
|
|
7534
|
-
this.context.render(),
|
|
7572
|
+
this.context.render(), L.info("Gantt rendered successfully.");
|
|
7535
7573
|
}
|
|
7536
7574
|
/**
|
|
7537
7575
|
* 销毁甘特图实例,清理所有资源
|
|
@@ -7568,7 +7606,7 @@ class ni {
|
|
|
7568
7606
|
* @warning 销毁后的实例不能再次使用,调用任何方法都可能导致错误
|
|
7569
7607
|
*/
|
|
7570
7608
|
destroy() {
|
|
7571
|
-
|
|
7609
|
+
L.info("Gantt destroying..."), this.events.clear(), this.context.destroy(), L.info("Gantt destroyed successfully.");
|
|
7572
7610
|
}
|
|
7573
7611
|
/**
|
|
7574
7612
|
* 跳转到指定日期
|
|
@@ -7819,12 +7857,12 @@ class ni {
|
|
|
7819
7857
|
return this.context.store.getDataManager().deleteTaskById(t);
|
|
7820
7858
|
}
|
|
7821
7859
|
}
|
|
7822
|
-
|
|
7823
|
-
const
|
|
7860
|
+
jt();
|
|
7861
|
+
const ai = Ot;
|
|
7824
7862
|
export {
|
|
7825
|
-
|
|
7863
|
+
ri as XGantt,
|
|
7826
7864
|
B as colorjs,
|
|
7827
|
-
|
|
7865
|
+
ci as dayjs,
|
|
7828
7866
|
Q as generateId,
|
|
7829
|
-
|
|
7867
|
+
ai as version
|
|
7830
7868
|
};
|