@xpyjs/gantt-core 0.0.1-rc.3 → 0.0.1-rc.4
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 +911 -870
- package/dist/x-gantt.umd.cjs +2 -2
- package/package.json +1 -1
- package/types/XGantt.d.ts +11 -0
- package/types/store/DataManager.d.ts +4 -0
package/dist/x-gantt.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var Pt = Object.defineProperty;
|
|
2
2
|
var Yt = (f, t, e) => t in f ? Pt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
|
-
var
|
|
3
|
+
var h = (f, t, e) => Yt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import G from "dayjs";
|
|
5
5
|
import { default as ai } from "dayjs";
|
|
6
6
|
import { merge as rt, isArray as X, isString as K, isFunction as j, cloneDeep as Z, isObject as Et, isNumber as Ut, omit as yt, throttle as wt, isBoolean as ht, debounce as Xt } from "lodash-es";
|
|
7
7
|
import S from "konva";
|
|
8
|
-
const Ct = "0.0.1-rc.
|
|
8
|
+
const Ct = "0.0.1-rc.4";
|
|
9
9
|
function Kt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
@@ -117,7 +117,7 @@ const N = class N {
|
|
|
117
117
|
return N.options.showTimestamp && e.unshift(`[${G().format("YYYY-MM-DD HH:mm:ss.SSS")}]`), [e.join(""), ...t];
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
|
|
120
|
+
h(N, "Prefix", "[XGantt]"), h(N, "options", {
|
|
121
121
|
// 默认级别,INFO 及以上会被打印
|
|
122
122
|
level: 2,
|
|
123
123
|
// 默认不显示时间戳
|
|
@@ -318,7 +318,7 @@ const lt = () => ({
|
|
|
318
318
|
});
|
|
319
319
|
class Vt {
|
|
320
320
|
constructor() {
|
|
321
|
-
|
|
321
|
+
h(this, "options", lt());
|
|
322
322
|
}
|
|
323
323
|
getOptions() {
|
|
324
324
|
return this.options;
|
|
@@ -329,12 +329,12 @@ class Vt {
|
|
|
329
329
|
const s = [];
|
|
330
330
|
t.holiday.holidays.forEach((n) => {
|
|
331
331
|
if (X(n.date)) {
|
|
332
|
-
const o = n.date.map((r) => G(r)).sort((r,
|
|
332
|
+
const o = n.date.map((r) => G(r)).sort((r, a) => r.diff(a));
|
|
333
333
|
for (let r = 1; r < o.length; r++)
|
|
334
334
|
if (o[r].diff(o[r - 1], "day") > 1) {
|
|
335
335
|
s.push({
|
|
336
336
|
...n,
|
|
337
|
-
date: o.slice(0, r).map((
|
|
337
|
+
date: o.slice(0, r).map((a) => a.valueOf())
|
|
338
338
|
}), o.splice(0, r);
|
|
339
339
|
break;
|
|
340
340
|
}
|
|
@@ -362,7 +362,7 @@ class Vt {
|
|
|
362
362
|
}
|
|
363
363
|
class jt {
|
|
364
364
|
constructor() {
|
|
365
|
-
|
|
365
|
+
h(this, "events", /* @__PURE__ */ new Map());
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* 注册事件监听器
|
|
@@ -448,10 +448,10 @@ function bt(f, t = 16, e = 16) {
|
|
|
448
448
|
const s = new Promise((n, o) => {
|
|
449
449
|
let r = f;
|
|
450
450
|
if (!/viewBox\s*=\s*["'][^"']*["']/.test(r)) {
|
|
451
|
-
const l = r.match(/width\s*=\s*["']([^"']*)["']/), m = r.match(/height\s*=\s*["']([^"']*)["']/), p = l ? parseFloat(l[1]) : t,
|
|
451
|
+
const l = r.match(/width\s*=\s*["']([^"']*)["']/), m = r.match(/height\s*=\s*["']([^"']*)["']/), p = l ? parseFloat(l[1]) : t, g = m ? parseFloat(m[1]) : e;
|
|
452
452
|
r = r.replace(
|
|
453
453
|
/<svg([^>]*)>/,
|
|
454
|
-
`<svg$1 viewBox="0 0 ${p} ${
|
|
454
|
+
`<svg$1 viewBox="0 0 ${p} ${g}">`
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
457
|
r = r.replace(/width\s*=\s*["'][^"']*["']/, `width="${t}"`), r = r.replace(/height\s*=\s*["'][^"']*["']/, `height="${e}"`), /width\s*=/.test(r) || (r = r.replace(/<svg/, `<svg width="${t}"`)), /height\s*=/.test(r) || (r = r.replace(/<svg/, `<svg height="${e}"`)), /preserveAspectRatio\s*=/.test(r) || (r = r.replace(
|
|
@@ -464,71 +464,71 @@ function bt(f, t = 16, e = 16) {
|
|
|
464
464
|
}, c.onerror = (l) => {
|
|
465
465
|
URL.revokeObjectURL(c.src), dt.delete(f), o(l);
|
|
466
466
|
};
|
|
467
|
-
const
|
|
467
|
+
const u = new Blob([r], { type: "image/svg+xml" }), d = URL.createObjectURL(u);
|
|
468
468
|
c.src = d;
|
|
469
469
|
});
|
|
470
470
|
return dt.set(f, s), s;
|
|
471
471
|
}
|
|
472
472
|
class mt {
|
|
473
473
|
constructor(t, e, i, s, n) {
|
|
474
|
-
|
|
474
|
+
h(this, "__key__", Q());
|
|
475
475
|
/**
|
|
476
476
|
* 任务ID
|
|
477
477
|
* 如果没有提供,则会自动生成一个唯一ID
|
|
478
478
|
*/
|
|
479
|
-
|
|
479
|
+
h(this, "id");
|
|
480
480
|
/**
|
|
481
481
|
* 任务名称
|
|
482
482
|
*/
|
|
483
|
-
|
|
483
|
+
h(this, "name");
|
|
484
484
|
/**
|
|
485
485
|
* 任务开始时间
|
|
486
486
|
* 如果没有提供,则默认为 undefined
|
|
487
487
|
*/
|
|
488
|
-
|
|
488
|
+
h(this, "startTime");
|
|
489
489
|
/**
|
|
490
490
|
* 任务结束时间
|
|
491
491
|
* 如果没有提供,则默认为 undefined
|
|
492
492
|
*/
|
|
493
|
-
|
|
493
|
+
h(this, "endTime");
|
|
494
494
|
/**
|
|
495
495
|
* 任务进度
|
|
496
496
|
*/
|
|
497
|
-
|
|
497
|
+
h(this, "progress");
|
|
498
498
|
/** 任务类型 */
|
|
499
|
-
|
|
499
|
+
h(this, "type");
|
|
500
500
|
/**
|
|
501
501
|
* 是否展开
|
|
502
502
|
* 如果没有提供,则默认为 true
|
|
503
503
|
*/
|
|
504
|
-
|
|
504
|
+
h(this, "expanded");
|
|
505
505
|
/**
|
|
506
506
|
* 子任务列表
|
|
507
507
|
* 如果没有子任务,则默认为空数组
|
|
508
508
|
*/
|
|
509
|
-
|
|
509
|
+
h(this, "children");
|
|
510
510
|
/**
|
|
511
511
|
* 父任务
|
|
512
512
|
* 如果没有父任务,则默认为 undefined
|
|
513
513
|
*/
|
|
514
|
-
|
|
514
|
+
h(this, "parent");
|
|
515
515
|
/**
|
|
516
516
|
* 任务层级,从0开始
|
|
517
517
|
*/
|
|
518
|
-
|
|
518
|
+
h(this, "level");
|
|
519
519
|
/**
|
|
520
520
|
* 在扁平化列表中的索引位置,从0开始
|
|
521
521
|
*/
|
|
522
|
-
|
|
522
|
+
h(this, "flatIndex");
|
|
523
523
|
/**
|
|
524
524
|
* 时间持续间隔
|
|
525
525
|
*/
|
|
526
|
-
|
|
526
|
+
h(this, "duration", 0);
|
|
527
527
|
/**
|
|
528
528
|
* 原始数据
|
|
529
529
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
530
|
+
h(this, "data");
|
|
531
|
+
h(this, "fields");
|
|
532
532
|
this.store = t, this.event = e, this.fields = this.store.getOptionManager().getOptions().fields, this.id = n || i[this.fields.id] || Q(), this.data = i, this.name = i[this.fields.name] || "", this.type = i[this.fields.type] || "task", this.updateMode(), this.progress = i[this.fields.progress], this.expanded = this.store.getOptionManager().getOptions().expand.show ? this.store.getOptionManager().getOptions().expand.enabled : !0, this.children = [], this.level = s && s.level !== void 0 ? s.level + 1 : 0, this.parent = s, this.flatIndex = 0, this.store.updateTime(this.startTime, this.endTime);
|
|
533
533
|
}
|
|
534
534
|
getField(t) {
|
|
@@ -596,21 +596,21 @@ class mt {
|
|
|
596
596
|
class Qt {
|
|
597
597
|
constructor(t, e, i) {
|
|
598
598
|
/** 基线ID */
|
|
599
|
-
|
|
599
|
+
h(this, "id");
|
|
600
600
|
/** 任务ID */
|
|
601
|
-
|
|
601
|
+
h(this, "taskId");
|
|
602
602
|
/** 开始时间 */
|
|
603
|
-
|
|
603
|
+
h(this, "startTime");
|
|
604
604
|
/** 结束时间 */
|
|
605
|
-
|
|
605
|
+
h(this, "endTime");
|
|
606
606
|
/** 基线名称 */
|
|
607
|
-
|
|
607
|
+
h(this, "name");
|
|
608
608
|
/** 原始数据 */
|
|
609
|
-
|
|
609
|
+
h(this, "data");
|
|
610
610
|
/** 是否高亮 */
|
|
611
|
-
|
|
611
|
+
h(this, "highlight", !0);
|
|
612
612
|
/** 是否为指示器对比基线 */
|
|
613
|
-
|
|
613
|
+
h(this, "target", !1);
|
|
614
614
|
this.store = t, this.event = e;
|
|
615
615
|
const s = this.store.getOptionManager().getOptions().fields, n = this.store.getOptionManager().getOptions().baselines.fields;
|
|
616
616
|
this.taskId = i[t.getOptionManager().getOptions().baselines.taskKey], this.id = i[s.id] || i[n.id] || Q(), this.name = i[s.name] || i[n.name] || "", this.highlight = i[n.highlight] !== !1, this.target = i[n.target] === !0;
|
|
@@ -635,8 +635,8 @@ class Qt {
|
|
|
635
635
|
if (!this.validate()) return null;
|
|
636
636
|
const t = this.store.getDataManager().getTaskById(this.taskId);
|
|
637
637
|
if (!t || !t.startTime || !t.endTime) return null;
|
|
638
|
-
const e = this.store.getTimeAxis().getCellUnit(), i = this.startTime.diff(t.startTime, e, !0), s = this.endTime.diff(t.endTime, e, !0), n = this.store.getOptionManager().getOptions().baselines.compare.tolerance, o = i < -n ? "delayed" : i > n ? "ahead" : "ontime", r = s < -n ? "delayed" : s > n ? "ahead" : "ontime",
|
|
639
|
-
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff:
|
|
638
|
+
const e = this.store.getTimeAxis().getCellUnit(), i = this.startTime.diff(t.startTime, e, !0), s = this.endTime.diff(t.endTime, e, !0), n = this.store.getOptionManager().getOptions().baselines.compare.tolerance, o = i < -n ? "delayed" : i > n ? "ahead" : "ontime", r = s < -n ? "delayed" : s > n ? "ahead" : "ontime", a = this.endTime.diff(this.startTime, e, !0), c = t.endTime.diff(t.startTime, e, !0), u = a > 0 ? (c - a) / a * 100 : 0;
|
|
639
|
+
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: u, unit: e };
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
class Jt {
|
|
@@ -644,36 +644,36 @@ class Jt {
|
|
|
644
644
|
/**
|
|
645
645
|
* 原始数据
|
|
646
646
|
*/
|
|
647
|
-
|
|
647
|
+
h(this, "rawData", []);
|
|
648
648
|
/**
|
|
649
649
|
* 任务列表。树形结构
|
|
650
650
|
*/
|
|
651
|
-
|
|
651
|
+
h(this, "tasks", []);
|
|
652
652
|
/**
|
|
653
653
|
* 任务映射,使用ID作为键,便于快速查找
|
|
654
654
|
*/
|
|
655
|
-
|
|
655
|
+
h(this, "taskMap", /* @__PURE__ */ new Map());
|
|
656
656
|
/**
|
|
657
657
|
* 缓存扁平化的可视任务列表
|
|
658
658
|
* 用于提高性能,避免每次都遍历树形结构
|
|
659
659
|
*/
|
|
660
|
-
|
|
660
|
+
h(this, "visibleTasksCache", []);
|
|
661
661
|
/** 标记缓存是否需要更新 */
|
|
662
|
-
|
|
662
|
+
h(this, "isDirty", !0);
|
|
663
663
|
/** 缓存被折叠的任务 ID */
|
|
664
|
-
|
|
664
|
+
h(this, "collapsedTaskIds", /* @__PURE__ */ new Set());
|
|
665
665
|
/** 存储当前选中的任务ID */
|
|
666
|
-
|
|
666
|
+
h(this, "selectedTaskId", null);
|
|
667
667
|
/** 选中列表 */
|
|
668
|
-
|
|
668
|
+
h(this, "checkedList", []);
|
|
669
669
|
/** 基线数据 */
|
|
670
|
-
|
|
670
|
+
h(this, "baselines", []);
|
|
671
671
|
/** 基线映射,使用ID作为键 */
|
|
672
|
-
|
|
672
|
+
h(this, "baselineMap", /* @__PURE__ */ new Map());
|
|
673
673
|
/** 任务与基线映射,使用任务ID作为键。 一个任务可以对应多条基线 */
|
|
674
|
-
|
|
674
|
+
h(this, "baselineTaskMap", /* @__PURE__ */ new Map());
|
|
675
675
|
/** 数据最大层级。 0 开始 */
|
|
676
|
-
|
|
676
|
+
h(this, "dataLevel", 0);
|
|
677
677
|
this.store = t, this.event = e;
|
|
678
678
|
}
|
|
679
679
|
/**
|
|
@@ -686,9 +686,11 @@ class Jt {
|
|
|
686
686
|
* 初始化任务
|
|
687
687
|
*/
|
|
688
688
|
initTasks(t = !1) {
|
|
689
|
-
this.dataLevel = 0, this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear(), this.rawData.forEach((e) => {
|
|
689
|
+
t ? (this.dataLevel = 0, this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear(), this.rawData.forEach((e) => {
|
|
690
690
|
this.tasks.push(this.createTask(e));
|
|
691
|
-
})
|
|
691
|
+
})) : (this.dataLevel = 0, this.tasks = [], this.taskMap.clear(), this.rawData.forEach((e) => {
|
|
692
|
+
this.tasks.push(this.createTask(e));
|
|
693
|
+
}));
|
|
692
694
|
}
|
|
693
695
|
createTask(t, e, i = !0) {
|
|
694
696
|
const s = this.store.getOptionManager().getOptions().fields, n = new mt(this.store, this.event, t, e);
|
|
@@ -701,18 +703,18 @@ class Jt {
|
|
|
701
703
|
for (; s < t.length; ) {
|
|
702
704
|
const n = t[s], o = e[s];
|
|
703
705
|
if (n && !o) {
|
|
704
|
-
const
|
|
705
|
-
e.push(
|
|
706
|
+
const a = this.createTask(n, i, !1);
|
|
707
|
+
e.push(a), this.dataLevel = Math.max(this.dataLevel, a.level);
|
|
706
708
|
} else !n && o ? e.splice(s, 1) : n && o && (n[this.store.getOptionManager().getOptions().fields.id] === o.id ? (o.updateData(n), this.taskMap.set(o.id, o), this.dataLevel = Math.max(this.dataLevel, o.level)) : (e[s] = this.createTask(n, o.parent, !1), this.dataLevel = Math.max(this.dataLevel, e[s].level)));
|
|
707
709
|
const r = n[this.store.getOptionManager().getOptions().fields.children];
|
|
708
710
|
if (r)
|
|
709
711
|
if (o && o.children)
|
|
710
712
|
this.updateTask(r, o.children, o);
|
|
711
713
|
else {
|
|
712
|
-
const
|
|
714
|
+
const a = r.map(
|
|
713
715
|
(c) => this.createTask(c, e[s], !1)
|
|
714
716
|
);
|
|
715
|
-
e[s].children =
|
|
717
|
+
e[s].children = a;
|
|
716
718
|
}
|
|
717
719
|
else o && o.children && (o.children = []);
|
|
718
720
|
s++;
|
|
@@ -741,6 +743,33 @@ class Jt {
|
|
|
741
743
|
getTaskById(t) {
|
|
742
744
|
return this.taskMap.get(t);
|
|
743
745
|
}
|
|
746
|
+
/**
|
|
747
|
+
* 删除某个任务数据
|
|
748
|
+
*/
|
|
749
|
+
deleteTaskById(t) {
|
|
750
|
+
var o;
|
|
751
|
+
const e = this.getTaskById(t);
|
|
752
|
+
if (!e) return !1;
|
|
753
|
+
let i = !1;
|
|
754
|
+
const s = this.store.getOptionManager().getOptions().fields.id, n = (o = e.parent) == null ? void 0 : o.children.findIndex((r) => r.id === t);
|
|
755
|
+
if (n !== void 0 && n > -1 && e.parent) {
|
|
756
|
+
e.parent.children.splice(n, 1);
|
|
757
|
+
const r = this.store.getOptionManager().getOptions().fields.children, a = e.parent.data[r] || [], c = a.findIndex((u) => u[s] === t);
|
|
758
|
+
c !== -1 && (a.splice(c, 1), i = !0);
|
|
759
|
+
} else {
|
|
760
|
+
const r = this.tasks.findIndex((a) => a.id === t);
|
|
761
|
+
if (r !== -1) {
|
|
762
|
+
this.tasks.splice(r, 1);
|
|
763
|
+
const a = this.rawData.findIndex((c) => c[s] === t);
|
|
764
|
+
a !== -1 && (this.rawData.splice(a, 1), i = !0);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
if (this.selectedTaskId === t && this.unselectTask(), this.checkedList.length > 0) {
|
|
768
|
+
const r = this.checkedList.findIndex((a) => a.id === t);
|
|
769
|
+
r !== -1 && this.checkedList.splice(r, 1);
|
|
770
|
+
}
|
|
771
|
+
return this.taskMap.delete(t), this.invalidateCache(), this.event.emit(k.DATA_UPDATE), i;
|
|
772
|
+
}
|
|
744
773
|
/**
|
|
745
774
|
* 移动任务位置
|
|
746
775
|
*/
|
|
@@ -937,21 +966,21 @@ class Jt {
|
|
|
937
966
|
}
|
|
938
967
|
updateTaskTime(t, e, i, s, n = []) {
|
|
939
968
|
let o = e, r = i;
|
|
940
|
-
const
|
|
969
|
+
const a = this.store.getOptionManager().getOptions().bar.move.link.child, c = this.store.getOptionManager().getOptions().bar.move.link.parent, u = this.store.getTimeAxis().getCellUnit();
|
|
941
970
|
let d = t.parent;
|
|
942
971
|
for (; c !== "none" && d; ) {
|
|
943
972
|
if (c === "expand") {
|
|
944
973
|
let m = d.startTime || o, p = d.endTime || r;
|
|
945
|
-
(!d.startTime || o.isBefore(d.startTime)) && (m = o), (!d.endTime || r.isAfter(d.endTime)) && (p = r), (d.startTime === void 0 || d.endTime === void 0 || !m.isSame(d.startTime) || !p.isSame(d.endTime)) && (n.findIndex((
|
|
946
|
-
} else c === "strict" && (d.startTime && o.isBefore(d.startTime) && (o = d.startTime, r.isSameOrBefore(o) && (r = o.add(1,
|
|
974
|
+
(!d.startTime || o.isBefore(d.startTime)) && (m = o), (!d.endTime || r.isAfter(d.endTime)) && (p = r), (d.startTime === void 0 || d.endTime === void 0 || !m.isSame(d.startTime) || !p.isSame(d.endTime)) && (n.findIndex((g) => g.id === d.id) === -1 && n.push(d.clone()), d.updateTime(m, p));
|
|
975
|
+
} else c === "strict" && (d.startTime && o.isBefore(d.startTime) && (o = d.startTime, r.isSameOrBefore(o) && (r = o.add(1, u))), d.endTime && r.isAfter(d.endTime) && (r = d.endTime, o.isAfter(r) && (o = r.subtract(1, u))));
|
|
947
976
|
d = d.parent;
|
|
948
977
|
}
|
|
949
978
|
let l = t.children || [];
|
|
950
|
-
for (;
|
|
979
|
+
for (; a !== "none" && l.length > 0; ) {
|
|
951
980
|
const m = [];
|
|
952
981
|
l.forEach((p) => {
|
|
953
|
-
let
|
|
954
|
-
|
|
982
|
+
let g = p.startTime || o, x = p.endTime || r, y = o.diff(t.startTime), T = r.diff(t.endTime);
|
|
983
|
+
a === "scale" ? s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g.add(y), x.add(T))) : s === "left" ? (g = g.add(y), g.isSameOrAfter(x.subtract(1, u)) && (x.isBefore(t.endTime) ? x = g.add(1, u) : g = x.subtract(1, u), g.isSameOrBefore(o) && (o = g)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, x)) : s === "right" && (x = x.add(T), x.isSameOrBefore(g.add(1, u)) && (g.isAfter(t.startTime) ? g = x.subtract(1, u) : x = g.add(1, u)), x.isSameOrAfter(r) && (r = x), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, x)) : a === "fixed" && (s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g.add(y), x.add(T))) : s === "left" ? g.isSameOrBefore(o) && (g = o, g.isSameOrAfter(x.subtract(1, u)) && (x.isBefore(t.endTime) ? x = g.add(1, u) : g = x.subtract(1, u), g.isSameOrBefore(o) && (o = g)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, x)) : s === "right" && x.isSameOrAfter(r) && (x = r, x.isSameOrBefore(g.add(1, u)) && (g.isAfter(t.startTime) ? g = x.subtract(1, u) : x = g.add(1, u)), x.isSameOrAfter(r) && (r = x), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g, x))), p.children && p.children.length > 0 && m.push(...p.children);
|
|
955
984
|
}), l = m;
|
|
956
985
|
}
|
|
957
986
|
n.findIndex((m) => m.id === t.id) === -1 && n.push(t.clone()), t.updateTime(o, r);
|
|
@@ -991,21 +1020,21 @@ function Zt(f) {
|
|
|
991
1020
|
const e = (s = document == null ? void 0 : document.createElement("canvas")) == null ? void 0 : s.getContext("2d");
|
|
992
1021
|
if (e && (e.fillStyle = t, t = e.fillStyle), t.startsWith("#")) {
|
|
993
1022
|
const n = t.slice(1);
|
|
994
|
-
let o, r,
|
|
1023
|
+
let o, r, a, c, u = 1;
|
|
995
1024
|
try {
|
|
996
1025
|
o = parseInt(n, 16);
|
|
997
1026
|
} catch {
|
|
998
1027
|
return O.warn(`Invalid hex color: ${f}`), null;
|
|
999
1028
|
}
|
|
1000
1029
|
if (n.length === 3)
|
|
1001
|
-
r = (o >> 8 & 15) * 17,
|
|
1030
|
+
r = (o >> 8 & 15) * 17, a = (o >> 4 & 15) * 17, c = (o & 15) * 17;
|
|
1002
1031
|
else if (n.length === 6)
|
|
1003
|
-
r = o >> 16 & 255,
|
|
1032
|
+
r = o >> 16 & 255, a = o >> 8 & 255, c = o & 255;
|
|
1004
1033
|
else if (n.length === 8)
|
|
1005
|
-
r = o >> 24 & 255,
|
|
1034
|
+
r = o >> 24 & 255, a = o >> 16 & 255, c = o >> 8 & 255, u = (o & 255) / 255;
|
|
1006
1035
|
else
|
|
1007
1036
|
return O.warn(`Invalid hex color length: ${f}`), null;
|
|
1008
|
-
return { r, g:
|
|
1037
|
+
return { r, g: a, b: c, a: u };
|
|
1009
1038
|
}
|
|
1010
1039
|
let i = t.match(
|
|
1011
1040
|
/rgba?\(\s*(\d+%?)\s*,\s*(\d+%?)\s*,\s*(\d+%?)\s*(?:,\s*([\d.]+)\s*)?\)/i
|
|
@@ -1025,12 +1054,12 @@ function te(f, t, e, i, s = !1, n = !1) {
|
|
|
1025
1054
|
const o = (l) => {
|
|
1026
1055
|
const m = Math.round($(l, 0, 255)).toString(16);
|
|
1027
1056
|
return m.length === 1 ? "0" + m : m;
|
|
1028
|
-
}, r = o(f),
|
|
1029
|
-
if (s && r[0] === r[1] &&
|
|
1057
|
+
}, r = o(f), a = o(t), c = o(e), u = o(i * 255);
|
|
1058
|
+
if (s && r[0] === r[1] && a[0] === a[1] && c[0] === c[1] && i === 1 && // Alpha 必须为 1 才能缩写
|
|
1030
1059
|
!n)
|
|
1031
|
-
return `#${r[0]}${
|
|
1032
|
-
const d = `#${r}${
|
|
1033
|
-
return n || i < 1 ? `${d}${
|
|
1060
|
+
return `#${r[0]}${a[0]}${c[0]}`;
|
|
1061
|
+
const d = `#${r}${a}${c}`;
|
|
1062
|
+
return n || i < 1 ? `${d}${u}` : d;
|
|
1034
1063
|
}
|
|
1035
1064
|
class et {
|
|
1036
1065
|
/**
|
|
@@ -1041,10 +1070,10 @@ class et {
|
|
|
1041
1070
|
*/
|
|
1042
1071
|
constructor(t) {
|
|
1043
1072
|
// 使用 private 属性,强制通过方法访问和修改
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1073
|
+
h(this, "_r");
|
|
1074
|
+
h(this, "_g");
|
|
1075
|
+
h(this, "_b");
|
|
1076
|
+
h(this, "_a");
|
|
1048
1077
|
const e = Zt(t);
|
|
1049
1078
|
e === null ? (O.error(`Failed to parse color: ${t}. Using default black.`), this._r = 0, this._g = 0, this._b = 0, this._a = 1) : (this._r = Math.round(e.r), this._g = Math.round(e.g), this._b = Math.round(e.b), this._a = e.a);
|
|
1050
1079
|
}
|
|
@@ -1200,10 +1229,10 @@ class et {
|
|
|
1200
1229
|
const B = (f) => f instanceof et ? f : new et(f);
|
|
1201
1230
|
class Lt {
|
|
1202
1231
|
constructor(t, e, i) {
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1232
|
+
h(this, "element");
|
|
1233
|
+
h(this, "iconElement");
|
|
1234
|
+
h(this, "_state", 0);
|
|
1235
|
+
h(this, "options");
|
|
1207
1236
|
var o;
|
|
1208
1237
|
this.context = t, this.container = e, this.task = i;
|
|
1209
1238
|
const n = (this.task ? this.context.store.getDataManager().isTaskChecked(this.task) : !1) ? 1 : 0;
|
|
@@ -1361,23 +1390,23 @@ const Tt = "handler_column";
|
|
|
1361
1390
|
class ee {
|
|
1362
1391
|
constructor(t) {
|
|
1363
1392
|
/** 源列数据 */
|
|
1364
|
-
|
|
1393
|
+
h(this, "sourceColumns", []);
|
|
1365
1394
|
/** 处理后的所有列数据 */
|
|
1366
|
-
|
|
1395
|
+
h(this, "columns", []);
|
|
1367
1396
|
/** 叶子列数据,只包含最终显示的列 */
|
|
1368
|
-
|
|
1397
|
+
h(this, "leafColumns", []);
|
|
1369
1398
|
/** 临时叶子列数据,用于更新源数据,读取宽度等原信息 */
|
|
1370
|
-
|
|
1399
|
+
h(this, "temporaryLeafColumns", []);
|
|
1371
1400
|
/**
|
|
1372
1401
|
* 保存所有行列合并的信息
|
|
1373
1402
|
*
|
|
1374
1403
|
* Map<task_id, Map<col_index, object>>
|
|
1375
1404
|
*/
|
|
1376
|
-
|
|
1405
|
+
h(this, "mergeInfo", /* @__PURE__ */ new Map());
|
|
1377
1406
|
/**
|
|
1378
1407
|
* 收起表格
|
|
1379
1408
|
*/
|
|
1380
|
-
|
|
1409
|
+
h(this, "collapseTable", !1);
|
|
1381
1410
|
this.context = t;
|
|
1382
1411
|
}
|
|
1383
1412
|
/**
|
|
@@ -1392,34 +1421,34 @@ class ee {
|
|
|
1392
1421
|
processColumns(t, e = [], i, s = 1) {
|
|
1393
1422
|
t.forEach((n, o) => {
|
|
1394
1423
|
var p;
|
|
1395
|
-
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0,
|
|
1424
|
+
const r = "children" in n && Array.isArray(n.children) && n.children.length > 0, a = !r;
|
|
1396
1425
|
let c = "";
|
|
1397
1426
|
r ? c = `group-${o}` : c = `field-${n.field}`;
|
|
1398
|
-
const
|
|
1399
|
-
c = "column-" + o + "-" +
|
|
1400
|
-
const d = n.label || (
|
|
1427
|
+
const u = [...(i == null ? void 0 : i.path) || [], c];
|
|
1428
|
+
c = "column-" + o + "-" + u.join("-");
|
|
1429
|
+
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 = {
|
|
1401
1430
|
label: d,
|
|
1402
1431
|
level: s,
|
|
1403
1432
|
maxLevel: s,
|
|
1404
1433
|
column: n,
|
|
1405
1434
|
children: [],
|
|
1406
|
-
path:
|
|
1435
|
+
path: u,
|
|
1407
1436
|
key: c,
|
|
1408
|
-
isLeaf:
|
|
1437
|
+
isLeaf: a,
|
|
1409
1438
|
width: l
|
|
1410
1439
|
};
|
|
1411
|
-
if (e.push(m),
|
|
1440
|
+
if (e.push(m), a)
|
|
1412
1441
|
this.leafColumns.push(m);
|
|
1413
1442
|
else if (r) {
|
|
1414
|
-
const
|
|
1443
|
+
const g = n.children;
|
|
1415
1444
|
this.processColumns(
|
|
1416
|
-
|
|
1445
|
+
g,
|
|
1417
1446
|
m.children,
|
|
1418
1447
|
m,
|
|
1419
1448
|
s + 1
|
|
1420
1449
|
), m.maxLevel = Math.max(
|
|
1421
1450
|
m.maxLevel,
|
|
1422
|
-
m.children.reduce((
|
|
1451
|
+
m.children.reduce((x, y) => Math.max(x, y.maxLevel), 0)
|
|
1423
1452
|
);
|
|
1424
1453
|
}
|
|
1425
1454
|
}), this.temporaryLeafColumns = Z(this.leafColumns);
|
|
@@ -1506,36 +1535,36 @@ const tt = class tt {
|
|
|
1506
1535
|
constructor(t, e) {
|
|
1507
1536
|
// ==================== 核心数据结构 ====================
|
|
1508
1537
|
/** 原始连线数据集合 */
|
|
1509
|
-
|
|
1538
|
+
h(this, "links", []);
|
|
1510
1539
|
/** 以起点任务 id 为 key 的出边邻接表 */
|
|
1511
|
-
|
|
1540
|
+
h(this, "fromLinksMap", /* @__PURE__ */ new Map());
|
|
1512
1541
|
/** 以终点任务 id 为 key 的入边邻接表 */
|
|
1513
|
-
|
|
1542
|
+
h(this, "toLinksMap", /* @__PURE__ */ new Map());
|
|
1514
1543
|
// ==================== 缓存系统(简化版) ====================
|
|
1515
1544
|
/** 拓扑序(无环情况下才有效,懒计算) */
|
|
1516
|
-
|
|
1545
|
+
h(this, "topoOrder", null);
|
|
1517
1546
|
/** 节点 id -> 拓扑序索引 */
|
|
1518
|
-
|
|
1547
|
+
h(this, "topoIndex", /* @__PURE__ */ new Map());
|
|
1519
1548
|
/** 最近一次全量环检测报告 */
|
|
1520
|
-
|
|
1549
|
+
h(this, "lastCycleReport", null);
|
|
1521
1550
|
/** 直接连接关系缓存(轻量级) */
|
|
1522
|
-
|
|
1551
|
+
h(this, "directConnectionCache", /* @__PURE__ */ new Map());
|
|
1523
1552
|
/** 记忆化缓存(用于链路查询优化) */
|
|
1524
|
-
|
|
1525
|
-
|
|
1553
|
+
h(this, "forwardMemo", /* @__PURE__ */ new Map());
|
|
1554
|
+
h(this, "backwardMemo", /* @__PURE__ */ new Map());
|
|
1526
1555
|
// ==================== 增强缓存系统 ====================
|
|
1527
1556
|
/** 缓存依赖关系追踪 */
|
|
1528
|
-
|
|
1557
|
+
h(this, "cacheDependencies", /* @__PURE__ */ new Map());
|
|
1529
1558
|
/** 缓存访问频率统计 */
|
|
1530
|
-
|
|
1559
|
+
h(this, "cacheAccessStats", /* @__PURE__ */ new Map());
|
|
1531
1560
|
/** 缓存大小限制 */
|
|
1532
|
-
|
|
1561
|
+
h(this, "MAX_CACHE_SIZE", 1e3);
|
|
1533
1562
|
/** 缓存生存时间(毫秒) */
|
|
1534
|
-
|
|
1563
|
+
h(this, "CACHE_TTL", 5 * 60 * 1e3);
|
|
1535
1564
|
// 5分钟
|
|
1536
1565
|
// ==================== 配置选项 ====================
|
|
1537
1566
|
/** 是否启用环检测 */
|
|
1538
|
-
|
|
1567
|
+
h(this, "enableCycleDetection", !0);
|
|
1539
1568
|
this.store = t, this.event = e;
|
|
1540
1569
|
}
|
|
1541
1570
|
/** 开启/关闭环检测 */
|
|
@@ -1704,53 +1733,53 @@ const tt = class tt {
|
|
|
1704
1733
|
};
|
|
1705
1734
|
const i = this.forwardMemo.get(t), s = this.backwardMemo.get(t);
|
|
1706
1735
|
this.recordCacheAccess(t, !!(i && s));
|
|
1707
|
-
const n = (
|
|
1708
|
-
const w =
|
|
1736
|
+
const n = (y) => (this.fromLinksMap.get(y) || []).map((b) => this.getTask(b.to)).filter((b) => !!b), o = (y) => (this.toLinksMap.get(y) || []).map((b) => this.getTask(b.from)).filter((b) => !!b), r = (y, T, b = /* @__PURE__ */ new Set()) => {
|
|
1737
|
+
const w = y.id;
|
|
1709
1738
|
if (this.forwardMemo.has(w))
|
|
1710
1739
|
return this.recordCacheAccess(w, !0), this.forwardMemo.get(w);
|
|
1711
|
-
if (T.has(
|
|
1740
|
+
if (T.has(y.id) || b.has(y.id))
|
|
1712
1741
|
return [];
|
|
1713
|
-
T.add(
|
|
1714
|
-
const C = n(
|
|
1742
|
+
T.add(y.id), b.add(y.id);
|
|
1743
|
+
const C = n(y.id);
|
|
1715
1744
|
let L = [];
|
|
1716
1745
|
if (C.length === 0)
|
|
1717
|
-
L = [[
|
|
1746
|
+
L = [[y]];
|
|
1718
1747
|
else {
|
|
1719
1748
|
for (const E of C) {
|
|
1720
1749
|
const v = r(E, T, b);
|
|
1721
1750
|
for (const M of v)
|
|
1722
|
-
L.push([
|
|
1751
|
+
L.push([y, ...M]);
|
|
1723
1752
|
}
|
|
1724
|
-
L.length === 0 && (L = [[
|
|
1753
|
+
L.length === 0 && (L = [[y]]);
|
|
1725
1754
|
}
|
|
1726
|
-
return T.delete(
|
|
1727
|
-
},
|
|
1728
|
-
const w =
|
|
1755
|
+
return T.delete(y.id), L.length < 100 && (this.forwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1756
|
+
}, a = (y, T, b = /* @__PURE__ */ new Set()) => {
|
|
1757
|
+
const w = y.id;
|
|
1729
1758
|
if (this.backwardMemo.has(w))
|
|
1730
1759
|
return this.recordCacheAccess(w, !0), this.backwardMemo.get(w);
|
|
1731
|
-
if (T.has(
|
|
1760
|
+
if (T.has(y.id) || b.has(y.id))
|
|
1732
1761
|
return [];
|
|
1733
|
-
T.add(
|
|
1734
|
-
const C = o(
|
|
1762
|
+
T.add(y.id), b.add(y.id);
|
|
1763
|
+
const C = o(y.id);
|
|
1735
1764
|
let L = [];
|
|
1736
1765
|
if (C.length === 0)
|
|
1737
|
-
L = [[
|
|
1766
|
+
L = [[y]];
|
|
1738
1767
|
else {
|
|
1739
1768
|
for (const E of C) {
|
|
1740
|
-
const v =
|
|
1769
|
+
const v = a(E, T, b);
|
|
1741
1770
|
for (const M of v)
|
|
1742
|
-
L.push([...M,
|
|
1771
|
+
L.push([...M, y]);
|
|
1743
1772
|
}
|
|
1744
|
-
L.length === 0 && (L = [[
|
|
1773
|
+
L.length === 0 && (L = [[y]]);
|
|
1745
1774
|
}
|
|
1746
|
-
return T.delete(
|
|
1747
|
-
}, c =
|
|
1748
|
-
this.getDirectlyConnectedTasks(t).forEach((
|
|
1749
|
-
this.establishCacheDependency(t,
|
|
1775
|
+
return T.delete(y.id), L.length < 100 && (this.backwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1776
|
+
}, c = a(e, /* @__PURE__ */ new Set()), u = r(e, /* @__PURE__ */ new Set());
|
|
1777
|
+
this.getDirectlyConnectedTasks(t).forEach((y) => {
|
|
1778
|
+
this.establishCacheDependency(t, y.id), this.establishCacheDependency(y.id, t);
|
|
1750
1779
|
});
|
|
1751
|
-
const l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), p = (
|
|
1780
|
+
const l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), p = (y, T) => {
|
|
1752
1781
|
const b = [];
|
|
1753
|
-
for (const w of
|
|
1782
|
+
for (const w of y) {
|
|
1754
1783
|
w.forEach((C) => l.set(C.id, C));
|
|
1755
1784
|
for (let C = 0; C < w.length - 1; C++) {
|
|
1756
1785
|
const L = w[C].id, E = w[C + 1].id, v = this.findLinkFast(L, E);
|
|
@@ -1761,23 +1790,23 @@ const tt = class tt {
|
|
|
1761
1790
|
}
|
|
1762
1791
|
}
|
|
1763
1792
|
return b;
|
|
1764
|
-
},
|
|
1793
|
+
}, g = p(c), x = p(u);
|
|
1765
1794
|
return {
|
|
1766
1795
|
prev: {
|
|
1767
|
-
chain: c.map((
|
|
1796
|
+
chain: c.map((y) => y.map((T) => T.getEmitData().data)),
|
|
1768
1797
|
nodes: c.flat().filter(
|
|
1769
|
-
(
|
|
1770
|
-
).map((
|
|
1771
|
-
links:
|
|
1798
|
+
(y, T, b) => b.findIndex((w) => w.id === y.id) === T
|
|
1799
|
+
).map((y) => y.getEmitData().data),
|
|
1800
|
+
links: g
|
|
1772
1801
|
},
|
|
1773
1802
|
next: {
|
|
1774
|
-
chain:
|
|
1775
|
-
nodes:
|
|
1776
|
-
(
|
|
1777
|
-
).map((
|
|
1778
|
-
links:
|
|
1803
|
+
chain: u.map((y) => y.map((T) => T.getEmitData().data)),
|
|
1804
|
+
nodes: u.flat().filter(
|
|
1805
|
+
(y, T, b) => b.findIndex((w) => w.id === y.id) === T
|
|
1806
|
+
).map((y) => y.getEmitData().data),
|
|
1807
|
+
links: x
|
|
1779
1808
|
},
|
|
1780
|
-
allNodes: Array.from(l.values()).map((
|
|
1809
|
+
allNodes: Array.from(l.values()).map((y) => y.getEmitData().data),
|
|
1781
1810
|
allLinks: Array.from(m.values()),
|
|
1782
1811
|
current: e.getEmitData().data
|
|
1783
1812
|
};
|
|
@@ -1791,27 +1820,27 @@ const tt = class tt {
|
|
|
1791
1820
|
detectAllCycles(t = !0) {
|
|
1792
1821
|
const e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), n = [];
|
|
1793
1822
|
let o = 0;
|
|
1794
|
-
const r = [],
|
|
1823
|
+
const r = [], a = (l) => {
|
|
1795
1824
|
e.set(l, o), i.set(l, o), o++, n.push(l), s.add(l);
|
|
1796
1825
|
const m = this.fromLinksMap.get(l) || [];
|
|
1797
1826
|
for (const p of m)
|
|
1798
|
-
e.has(p.to) ? s.has(p.to) && i.set(l, Math.min(i.get(l), e.get(p.to))) : (
|
|
1827
|
+
e.has(p.to) ? s.has(p.to) && i.set(l, Math.min(i.get(l), e.get(p.to))) : (a(p.to), i.set(l, Math.min(i.get(l), i.get(p.to))));
|
|
1799
1828
|
if (i.get(l) === e.get(l)) {
|
|
1800
1829
|
const p = [];
|
|
1801
1830
|
for (; ; ) {
|
|
1802
|
-
const
|
|
1803
|
-
if (s.delete(
|
|
1831
|
+
const g = n.pop();
|
|
1832
|
+
if (s.delete(g), p.push(g), g === l) break;
|
|
1804
1833
|
}
|
|
1805
1834
|
r.push(p);
|
|
1806
1835
|
}
|
|
1807
1836
|
};
|
|
1808
1837
|
this.store.getDataManager().getTasks(!1).forEach((l) => {
|
|
1809
|
-
e.has(l.id) ||
|
|
1838
|
+
e.has(l.id) || a(l.id);
|
|
1810
1839
|
});
|
|
1811
|
-
const c = r.filter((l) => l.length > 1 || this.hasSelfLoop(l[0])),
|
|
1840
|
+
const c = r.filter((l) => l.length > 1 || this.hasSelfLoop(l[0])), u = c.map((l) => l.slice()), d = {
|
|
1812
1841
|
hasCycle: c.length > 0,
|
|
1813
1842
|
sccs: c,
|
|
1814
|
-
cycles:
|
|
1843
|
+
cycles: u,
|
|
1815
1844
|
nodes: Array.from(new Set(c.flat()))
|
|
1816
1845
|
};
|
|
1817
1846
|
return this.lastCycleReport = d, t && d.hasCycle && O.warn("Cycle detected in task dependencies", d), d;
|
|
@@ -1823,12 +1852,12 @@ const tt = class tt {
|
|
|
1823
1852
|
// ==================== 冲突检测 ====================
|
|
1824
1853
|
/** 检测同一对任务间是否存在冲突的连线类型 */
|
|
1825
1854
|
detectLinkConflicts(t, e) {
|
|
1826
|
-
const i = this.links.filter((d) => d.from === t && d.to === e), s = this.links.filter((d) => d.from === e && d.to === t), n = [...i, ...s], o = [], r = [],
|
|
1855
|
+
const i = this.links.filter((d) => d.from === t && d.to === e), s = this.links.filter((d) => d.from === e && d.to === t), n = [...i, ...s], o = [], r = [], a = /* @__PURE__ */ new Map();
|
|
1827
1856
|
n.forEach((d) => {
|
|
1828
|
-
d.type &&
|
|
1857
|
+
d.type && a.set(d.type, (a.get(d.type) || 0) + 1);
|
|
1829
1858
|
});
|
|
1830
|
-
const c =
|
|
1831
|
-
return c &&
|
|
1859
|
+
const c = a.has("FS"), u = a.has("SF");
|
|
1860
|
+
return c && u && (o.push(...n.filter((d) => d.type === "FS" || d.type === "SF")), r.push("FS-SF conflict")), {
|
|
1832
1861
|
hasConflict: o.length > 0,
|
|
1833
1862
|
conflicts: o,
|
|
1834
1863
|
conflictTypes: r
|
|
@@ -1865,19 +1894,19 @@ const tt = class tt {
|
|
|
1865
1894
|
/** 增量环检测(基于拓扑序 + DFS) */
|
|
1866
1895
|
willCreateCycle(t, e) {
|
|
1867
1896
|
if (this.computeTopo()) {
|
|
1868
|
-
const r = this.topoIndex.get(t),
|
|
1869
|
-
if (r != null &&
|
|
1897
|
+
const r = this.topoIndex.get(t), a = this.topoIndex.get(e);
|
|
1898
|
+
if (r != null && a != null && r < a) return null;
|
|
1870
1899
|
}
|
|
1871
1900
|
const s = [e], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
1872
1901
|
for (; s.length; ) {
|
|
1873
1902
|
const r = s.pop();
|
|
1874
1903
|
if (n.has(r)) continue;
|
|
1875
1904
|
n.add(r);
|
|
1876
|
-
const
|
|
1877
|
-
for (const c of
|
|
1878
|
-
const
|
|
1879
|
-
if (!n.has(
|
|
1880
|
-
o.has(
|
|
1905
|
+
const a = this.fromLinksMap.get(r) || [];
|
|
1906
|
+
for (const c of a) {
|
|
1907
|
+
const u = c.to;
|
|
1908
|
+
if (!n.has(u) && !o.has(u) && o.set(u, r), u === t) {
|
|
1909
|
+
o.has(u) || o.set(u, r);
|
|
1881
1910
|
const d = [];
|
|
1882
1911
|
let l = t;
|
|
1883
1912
|
for (; l !== void 0; )
|
|
@@ -1889,7 +1918,7 @@ const tt = class tt {
|
|
|
1889
1918
|
sccs: []
|
|
1890
1919
|
};
|
|
1891
1920
|
}
|
|
1892
|
-
s.push(
|
|
1921
|
+
s.push(u);
|
|
1893
1922
|
}
|
|
1894
1923
|
}
|
|
1895
1924
|
return null;
|
|
@@ -2005,8 +2034,8 @@ const tt = class tt {
|
|
|
2005
2034
|
const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = (o, r) => {
|
|
2006
2035
|
if (r >= e || s.has(o)) return;
|
|
2007
2036
|
s.add(o);
|
|
2008
|
-
const
|
|
2009
|
-
for (const c of
|
|
2037
|
+
const a = this.getTaskPredecessors(o).tasks;
|
|
2038
|
+
for (const c of a)
|
|
2010
2039
|
i.add(c.id), n(c.id, r + 1);
|
|
2011
2040
|
};
|
|
2012
2041
|
return n(t, 0), Array.from(i);
|
|
@@ -2016,8 +2045,8 @@ const tt = class tt {
|
|
|
2016
2045
|
const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = (o, r) => {
|
|
2017
2046
|
if (r >= e || s.has(o)) return;
|
|
2018
2047
|
s.add(o);
|
|
2019
|
-
const
|
|
2020
|
-
for (const c of
|
|
2048
|
+
const a = this.getTaskSuccessors(o).tasks;
|
|
2049
|
+
for (const c of a)
|
|
2021
2050
|
i.add(c.id), n(c.id, r + 1);
|
|
2022
2051
|
};
|
|
2023
2052
|
return n(t, 0), Array.from(i);
|
|
@@ -2109,7 +2138,7 @@ const tt = class tt {
|
|
|
2109
2138
|
};
|
|
2110
2139
|
// ==================== 连线类型映射表 ====================
|
|
2111
2140
|
/** 连线类型映射表 */
|
|
2112
|
-
|
|
2141
|
+
h(tt, "LINK_TYPE_MAP", {
|
|
2113
2142
|
FS: { from: "F", to: "S", description: "结束到开始" },
|
|
2114
2143
|
SF: { from: "S", to: "F", description: "开始到结束" },
|
|
2115
2144
|
FF: { from: "F", to: "F", description: "结束到结束" },
|
|
@@ -2125,27 +2154,27 @@ var Mt = { exports: {} };
|
|
|
2125
2154
|
(function(e, i) {
|
|
2126
2155
|
f.exports = i();
|
|
2127
2156
|
})(P, function() {
|
|
2128
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5,
|
|
2157
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, a = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, u = 2628e6, d = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = { years: c, months: u, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(L) {
|
|
2129
2158
|
return L instanceof w;
|
|
2130
2159
|
}, p = function(L, E, v) {
|
|
2131
2160
|
return new w(L, v, E.$l);
|
|
2132
|
-
},
|
|
2161
|
+
}, g = function(L) {
|
|
2133
2162
|
return i.p(L) + "s";
|
|
2134
|
-
}, y = function(L) {
|
|
2135
|
-
return L < 0;
|
|
2136
2163
|
}, x = function(L) {
|
|
2137
|
-
return
|
|
2164
|
+
return L < 0;
|
|
2165
|
+
}, y = function(L) {
|
|
2166
|
+
return x(L) ? Math.ceil(L) : Math.floor(L);
|
|
2138
2167
|
}, T = function(L) {
|
|
2139
2168
|
return Math.abs(L);
|
|
2140
2169
|
}, b = function(L, E) {
|
|
2141
|
-
return L ?
|
|
2170
|
+
return L ? x(L) ? { negative: !0, format: "" + T(L) + E } : { negative: !1, format: "" + L + E } : { negative: !1, format: "" };
|
|
2142
2171
|
}, w = function() {
|
|
2143
2172
|
function L(v, M, A) {
|
|
2144
2173
|
var _ = this;
|
|
2145
|
-
if (this.$d = {}, this.$l = A, v === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), M) return p(v * l[
|
|
2174
|
+
if (this.$d = {}, this.$l = A, v === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), M) return p(v * l[g(M)], this);
|
|
2146
2175
|
if (typeof v == "number") return this.$ms = v, this.parseFromMilliseconds(), this;
|
|
2147
2176
|
if (typeof v == "object") return Object.keys(v).forEach(function(W) {
|
|
2148
|
-
_.$d[
|
|
2177
|
+
_.$d[g(W)] = v[W];
|
|
2149
2178
|
}), this.calMilliseconds(), this;
|
|
2150
2179
|
if (typeof v == "string") {
|
|
2151
2180
|
var D = v.match(d);
|
|
@@ -2166,7 +2195,7 @@ var Mt = { exports: {} };
|
|
|
2166
2195
|
}, 0);
|
|
2167
2196
|
}, E.parseFromMilliseconds = function() {
|
|
2168
2197
|
var v = this.$ms;
|
|
2169
|
-
this.$d.years =
|
|
2198
|
+
this.$d.years = y(v / c), v %= c, this.$d.months = y(v / u), v %= u, this.$d.days = y(v / r), v %= r, this.$d.hours = y(v / o), v %= o, this.$d.minutes = y(v / n), v %= n, this.$d.seconds = y(v / s), v %= s, this.$d.milliseconds = v;
|
|
2170
2199
|
}, E.toISOString = function() {
|
|
2171
2200
|
var v = b(this.$d.years, "Y"), M = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2172
2201
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
@@ -2178,17 +2207,17 @@ var Mt = { exports: {} };
|
|
|
2178
2207
|
return this.toISOString();
|
|
2179
2208
|
}, E.format = function(v) {
|
|
2180
2209
|
var M = v || "YYYY-MM-DDTHH:mm:ss", A = { Y: this.$d.years, YY: i.s(this.$d.years, 2, "0"), YYYY: i.s(this.$d.years, 4, "0"), M: this.$d.months, MM: i.s(this.$d.months, 2, "0"), D: this.$d.days, DD: i.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: i.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: i.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: i.s(this.$d.seconds, 2, "0"), SSS: i.s(this.$d.milliseconds, 3, "0") };
|
|
2181
|
-
return M.replace(
|
|
2210
|
+
return M.replace(a, function(_, D) {
|
|
2182
2211
|
return D || String(A[_]);
|
|
2183
2212
|
});
|
|
2184
2213
|
}, E.as = function(v) {
|
|
2185
|
-
return this.$ms / l[
|
|
2214
|
+
return this.$ms / l[g(v)];
|
|
2186
2215
|
}, E.get = function(v) {
|
|
2187
|
-
var M = this.$ms, A =
|
|
2188
|
-
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ?
|
|
2216
|
+
var M = this.$ms, A = g(v);
|
|
2217
|
+
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ? y(M / l[A]) : this.$d[A], M || 0;
|
|
2189
2218
|
}, E.add = function(v, M, A) {
|
|
2190
2219
|
var _;
|
|
2191
|
-
return _ = M ? v * l[
|
|
2220
|
+
return _ = M ? v * l[g(M)] : m(v) ? v.$ms : p(v, this).$ms, p(this.$ms + _ * (A ? -1 : 1), this);
|
|
2192
2221
|
}, E.subtract = function(v, M) {
|
|
2193
2222
|
return this.add(v, M, !0);
|
|
2194
2223
|
}, E.locale = function(v) {
|
|
@@ -2258,9 +2287,9 @@ var Ot = { exports: {} };
|
|
|
2258
2287
|
f.exports = i();
|
|
2259
2288
|
})(P, function() {
|
|
2260
2289
|
return function(e, i, s) {
|
|
2261
|
-
i.prototype.isBetween = function(n, o, r,
|
|
2262
|
-
var c = s(n),
|
|
2263
|
-
return (d ? this.isAfter(c, r) : !this.isBefore(c, r)) && (l ? this.isBefore(
|
|
2290
|
+
i.prototype.isBetween = function(n, o, r, a) {
|
|
2291
|
+
var c = s(n), u = s(o), d = (a = a || "()")[0] === "(", l = a[1] === ")";
|
|
2292
|
+
return (d ? this.isAfter(c, r) : !this.isBefore(c, r)) && (l ? this.isBefore(u, r) : !this.isAfter(u, r)) || (d ? this.isBefore(c, r) : !this.isAfter(c, r)) && (l ? this.isAfter(u, r) : !this.isBefore(u, r));
|
|
2264
2293
|
};
|
|
2265
2294
|
};
|
|
2266
2295
|
});
|
|
@@ -2303,24 +2332,24 @@ var At = { exports: {} };
|
|
|
2303
2332
|
return function(e, i, s) {
|
|
2304
2333
|
var n = i.prototype, o = function(d) {
|
|
2305
2334
|
return d && (d.indexOf ? d : d.s);
|
|
2306
|
-
}, r = function(d, l, m, p,
|
|
2307
|
-
var
|
|
2335
|
+
}, r = function(d, l, m, p, g) {
|
|
2336
|
+
var x = d.name ? d : d.$locale(), y = o(x[l]), T = o(x[m]), b = y || T.map(function(C) {
|
|
2308
2337
|
return C.slice(0, p);
|
|
2309
2338
|
});
|
|
2310
|
-
if (!
|
|
2311
|
-
var w =
|
|
2339
|
+
if (!g) return b;
|
|
2340
|
+
var w = x.weekStart;
|
|
2312
2341
|
return b.map(function(C, L) {
|
|
2313
2342
|
return b[(L + (w || 0)) % 7];
|
|
2314
2343
|
});
|
|
2315
|
-
},
|
|
2344
|
+
}, a = function() {
|
|
2316
2345
|
return s.Ls[s.locale()];
|
|
2317
2346
|
}, c = function(d, l) {
|
|
2318
2347
|
return d.formats[l] || function(m) {
|
|
2319
|
-
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p,
|
|
2320
|
-
return
|
|
2348
|
+
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p, g, x) {
|
|
2349
|
+
return g || x.slice(1);
|
|
2321
2350
|
});
|
|
2322
2351
|
}(d.formats[l.toUpperCase()]);
|
|
2323
|
-
},
|
|
2352
|
+
}, u = function() {
|
|
2324
2353
|
var d = this;
|
|
2325
2354
|
return { months: function(l) {
|
|
2326
2355
|
return l ? l.format("MMMM") : r(d, "months");
|
|
@@ -2339,9 +2368,9 @@ var At = { exports: {} };
|
|
|
2339
2368
|
}, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
|
|
2340
2369
|
};
|
|
2341
2370
|
n.localeData = function() {
|
|
2342
|
-
return
|
|
2371
|
+
return u.bind(this)();
|
|
2343
2372
|
}, s.localeData = function() {
|
|
2344
|
-
var d =
|
|
2373
|
+
var d = a();
|
|
2345
2374
|
return { firstDayOfWeek: function() {
|
|
2346
2375
|
return d.weekStart || 0;
|
|
2347
2376
|
}, weekdays: function() {
|
|
@@ -2358,15 +2387,15 @@ var At = { exports: {} };
|
|
|
2358
2387
|
return c(d, l);
|
|
2359
2388
|
}, meridiem: d.meridiem, ordinal: d.ordinal };
|
|
2360
2389
|
}, s.months = function() {
|
|
2361
|
-
return r(
|
|
2390
|
+
return r(a(), "months");
|
|
2362
2391
|
}, s.monthsShort = function() {
|
|
2363
|
-
return r(
|
|
2392
|
+
return r(a(), "monthsShort", "months", 3);
|
|
2364
2393
|
}, s.weekdays = function(d) {
|
|
2365
|
-
return r(
|
|
2394
|
+
return r(a(), "weekdays", null, null, d);
|
|
2366
2395
|
}, s.weekdaysShort = function(d) {
|
|
2367
|
-
return r(
|
|
2396
|
+
return r(a(), "weekdaysShort", "weekdays", 3, d);
|
|
2368
2397
|
}, s.weekdaysMin = function(d) {
|
|
2369
|
-
return r(
|
|
2398
|
+
return r(a(), "weekdaysMin", "weekdays", 2, d);
|
|
2370
2399
|
};
|
|
2371
2400
|
};
|
|
2372
2401
|
});
|
|
@@ -2381,17 +2410,17 @@ var It = { exports: {} };
|
|
|
2381
2410
|
var e = "week", i = "year";
|
|
2382
2411
|
return function(s, n, o) {
|
|
2383
2412
|
var r = n.prototype;
|
|
2384
|
-
r.week = function(
|
|
2385
|
-
if (
|
|
2413
|
+
r.week = function(a) {
|
|
2414
|
+
if (a === void 0 && (a = null), a !== null) return this.add(7 * (a - this.week()), "day");
|
|
2386
2415
|
var c = this.$locale().yearStart || 1;
|
|
2387
2416
|
if (this.month() === 11 && this.date() > 25) {
|
|
2388
|
-
var
|
|
2389
|
-
if (
|
|
2417
|
+
var u = o(this).startOf(i).add(1, i).date(c), d = o(this).endOf(e);
|
|
2418
|
+
if (u.isBefore(d)) return 1;
|
|
2390
2419
|
}
|
|
2391
2420
|
var l = o(this).startOf(i).date(c).startOf(e).subtract(1, "millisecond"), m = this.diff(l, e, !0);
|
|
2392
2421
|
return m < 0 ? o(this).startOf("week").week() : Math.ceil(m);
|
|
2393
|
-
}, r.weeks = function(
|
|
2394
|
-
return
|
|
2422
|
+
}, r.weeks = function(a) {
|
|
2423
|
+
return a === void 0 && (a = null), this.week(a);
|
|
2395
2424
|
};
|
|
2396
2425
|
};
|
|
2397
2426
|
});
|
|
@@ -2421,20 +2450,20 @@ var Gt = { exports: {} };
|
|
|
2421
2450
|
return function(e, i) {
|
|
2422
2451
|
var s = i.prototype, n = s.format;
|
|
2423
2452
|
s.format = function(o) {
|
|
2424
|
-
var r = this,
|
|
2453
|
+
var r = this, a = this.$locale();
|
|
2425
2454
|
if (!this.isValid()) return n.bind(this)(o);
|
|
2426
|
-
var c = this.$utils(),
|
|
2455
|
+
var c = this.$utils(), u = (o || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(d) {
|
|
2427
2456
|
switch (d) {
|
|
2428
2457
|
case "Q":
|
|
2429
2458
|
return Math.ceil((r.$M + 1) / 3);
|
|
2430
2459
|
case "Do":
|
|
2431
|
-
return
|
|
2460
|
+
return a.ordinal(r.$D);
|
|
2432
2461
|
case "gggg":
|
|
2433
2462
|
return r.weekYear();
|
|
2434
2463
|
case "GGGG":
|
|
2435
2464
|
return r.isoWeekYear();
|
|
2436
2465
|
case "wo":
|
|
2437
|
-
return
|
|
2466
|
+
return a.ordinal(r.week(), "W");
|
|
2438
2467
|
case "w":
|
|
2439
2468
|
case "ww":
|
|
2440
2469
|
return c.s(r.week(), d === "w" ? 1 : 2, "0");
|
|
@@ -2456,7 +2485,7 @@ var Gt = { exports: {} };
|
|
|
2456
2485
|
return d;
|
|
2457
2486
|
}
|
|
2458
2487
|
});
|
|
2459
|
-
return n.bind(this)(
|
|
2488
|
+
return n.bind(this)(u);
|
|
2460
2489
|
};
|
|
2461
2490
|
};
|
|
2462
2491
|
});
|
|
@@ -2471,8 +2500,8 @@ var Rt = { exports: {} };
|
|
|
2471
2500
|
return function(e, i, s) {
|
|
2472
2501
|
s.updateLocale = function(n, o) {
|
|
2473
2502
|
var r = s.Ls[n];
|
|
2474
|
-
if (r) return (o ? Object.keys(o) : []).forEach(function(
|
|
2475
|
-
r[
|
|
2503
|
+
if (r) return (o ? Object.keys(o) : []).forEach(function(a) {
|
|
2504
|
+
r[a] = o[a];
|
|
2476
2505
|
}), r;
|
|
2477
2506
|
};
|
|
2478
2507
|
};
|
|
@@ -2494,15 +2523,15 @@ var Wt = { exports: {} };
|
|
|
2494
2523
|
return o(this).year();
|
|
2495
2524
|
}, r.isoWeek = function(c) {
|
|
2496
2525
|
if (!this.$utils().u(c)) return this.add(7 * (c - this.isoWeek()), e);
|
|
2497
|
-
var
|
|
2498
|
-
return p.diff(
|
|
2526
|
+
var u, d, l, m, p = o(this), g = (u = this.isoWeekYear(), d = this.$u, l = (d ? n.utc : n)().year(u).startOf("year"), m = 4 - l.isoWeekday(), l.isoWeekday() > 4 && (m += 7), l.add(m, e));
|
|
2527
|
+
return p.diff(g, "week") + 1;
|
|
2499
2528
|
}, r.isoWeekday = function(c) {
|
|
2500
2529
|
return this.$utils().u(c) ? this.day() || 7 : this.day(this.day() % 7 ? c : c - 7);
|
|
2501
2530
|
};
|
|
2502
|
-
var
|
|
2503
|
-
r.startOf = function(c,
|
|
2504
|
-
var d = this.$utils(), l = !!d.u(
|
|
2505
|
-
return d.p(c) === "isoweek" ? l ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") :
|
|
2531
|
+
var a = r.startOf;
|
|
2532
|
+
r.startOf = function(c, u) {
|
|
2533
|
+
var d = this.$utils(), l = !!d.u(u) || u;
|
|
2534
|
+
return d.p(c) === "isoweek" ? l ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : a.bind(this)(c, u);
|
|
2506
2535
|
};
|
|
2507
2536
|
};
|
|
2508
2537
|
});
|
|
@@ -2516,52 +2545,52 @@ var $t = { exports: {} };
|
|
|
2516
2545
|
})(P, function() {
|
|
2517
2546
|
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, i = {};
|
|
2518
2547
|
return function(s, n, o) {
|
|
2519
|
-
var r,
|
|
2548
|
+
var r, a = function(l, m, p) {
|
|
2520
2549
|
p === void 0 && (p = {});
|
|
2521
|
-
var
|
|
2550
|
+
var g = new Date(l), x = function(y, T) {
|
|
2522
2551
|
T === void 0 && (T = {});
|
|
2523
|
-
var b = T.timeZoneName || "short", w =
|
|
2524
|
-
return C || (C = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone:
|
|
2552
|
+
var b = T.timeZoneName || "short", w = y + "|" + b, C = i[w];
|
|
2553
|
+
return C || (C = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: y, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: b }), i[w] = C), C;
|
|
2525
2554
|
}(m, p);
|
|
2526
|
-
return
|
|
2555
|
+
return x.formatToParts(g);
|
|
2527
2556
|
}, c = function(l, m) {
|
|
2528
|
-
for (var p =
|
|
2529
|
-
var
|
|
2530
|
-
w >= 0 && (
|
|
2557
|
+
for (var p = a(l, m), g = [], x = 0; x < p.length; x += 1) {
|
|
2558
|
+
var y = p[x], T = y.type, b = y.value, w = e[T];
|
|
2559
|
+
w >= 0 && (g[w] = parseInt(b, 10));
|
|
2531
2560
|
}
|
|
2532
|
-
var C =
|
|
2561
|
+
var C = g[3], L = C === 24 ? 0 : C, E = g[0] + "-" + g[1] + "-" + g[2] + " " + L + ":" + g[4] + ":" + g[5] + ":000", v = +l;
|
|
2533
2562
|
return (o.utc(E).valueOf() - (v -= v % 1e3)) / 6e4;
|
|
2534
|
-
},
|
|
2535
|
-
|
|
2563
|
+
}, u = n.prototype;
|
|
2564
|
+
u.tz = function(l, m) {
|
|
2536
2565
|
l === void 0 && (l = r);
|
|
2537
|
-
var p,
|
|
2566
|
+
var p, g = this.utcOffset(), x = this.toDate(), y = x.toLocaleString("en-US", { timeZone: l }), T = Math.round((x - new Date(y)) / 1e3 / 60), b = 15 * -Math.round(x.getTimezoneOffset() / 15) - T;
|
|
2538
2567
|
if (!Number(b)) p = this.utcOffset(0, m);
|
|
2539
|
-
else if (p = o(
|
|
2568
|
+
else if (p = o(y, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(b, !0), m) {
|
|
2540
2569
|
var w = p.utcOffset();
|
|
2541
|
-
p = p.add(
|
|
2570
|
+
p = p.add(g - w, "minute");
|
|
2542
2571
|
}
|
|
2543
2572
|
return p.$x.$timezone = l, p;
|
|
2544
|
-
},
|
|
2545
|
-
var m = this.$x.$timezone || o.tz.guess(), p =
|
|
2546
|
-
return
|
|
2573
|
+
}, u.offsetName = function(l) {
|
|
2574
|
+
var m = this.$x.$timezone || o.tz.guess(), p = a(this.valueOf(), m, { timeZoneName: l }).find(function(g) {
|
|
2575
|
+
return g.type.toLowerCase() === "timezonename";
|
|
2547
2576
|
});
|
|
2548
2577
|
return p && p.value;
|
|
2549
2578
|
};
|
|
2550
|
-
var d =
|
|
2551
|
-
|
|
2579
|
+
var d = u.startOf;
|
|
2580
|
+
u.startOf = function(l, m) {
|
|
2552
2581
|
if (!this.$x || !this.$x.$timezone) return d.call(this, l, m);
|
|
2553
2582
|
var p = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
2554
2583
|
return d.call(p, l, m).tz(this.$x.$timezone, !0);
|
|
2555
2584
|
}, o.tz = function(l, m, p) {
|
|
2556
|
-
var
|
|
2557
|
-
if (typeof l != "string") return o(l).tz(
|
|
2585
|
+
var g = p && m, x = p || m || r, y = c(+o(), x);
|
|
2586
|
+
if (typeof l != "string") return o(l).tz(x);
|
|
2558
2587
|
var T = function(L, E, v) {
|
|
2559
2588
|
var M = L - 60 * E * 1e3, A = c(M, v);
|
|
2560
2589
|
if (E === A) return [M, E];
|
|
2561
2590
|
var _ = c(M -= 60 * (A - E) * 1e3, v);
|
|
2562
2591
|
return A === _ ? [M, A] : [L - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
2563
|
-
}(o.utc(l,
|
|
2564
|
-
return C.$x.$timezone =
|
|
2592
|
+
}(o.utc(l, g).valueOf(), y, x), b = T[0], w = T[1], C = o(b).utcOffset(w);
|
|
2593
|
+
return C.$x.$timezone = x, C;
|
|
2565
2594
|
}, o.tz.guess = function() {
|
|
2566
2595
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2567
2596
|
}, o.tz.setDefault = function(l) {
|
|
@@ -2579,69 +2608,68 @@ var Ft = { exports: {} };
|
|
|
2579
2608
|
})(P, function() {
|
|
2580
2609
|
var e = "minute", i = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
|
|
2581
2610
|
return function(n, o, r) {
|
|
2582
|
-
var
|
|
2583
|
-
r.utc = function(
|
|
2584
|
-
var
|
|
2585
|
-
return new o(
|
|
2586
|
-
},
|
|
2587
|
-
var
|
|
2588
|
-
return
|
|
2589
|
-
},
|
|
2611
|
+
var a = o.prototype;
|
|
2612
|
+
r.utc = function(g) {
|
|
2613
|
+
var x = { date: g, utc: !0, args: arguments };
|
|
2614
|
+
return new o(x);
|
|
2615
|
+
}, a.utc = function(g) {
|
|
2616
|
+
var x = r(this.toDate(), { locale: this.$L, utc: !0 });
|
|
2617
|
+
return g ? x.add(this.utcOffset(), e) : x;
|
|
2618
|
+
}, a.local = function() {
|
|
2590
2619
|
return r(this.toDate(), { locale: this.$L, utc: !1 });
|
|
2591
2620
|
};
|
|
2592
|
-
var c =
|
|
2593
|
-
|
|
2594
|
-
|
|
2621
|
+
var c = a.parse;
|
|
2622
|
+
a.parse = function(g) {
|
|
2623
|
+
g.utc && (this.$u = !0), this.$utils().u(g.$offset) || (this.$offset = g.$offset), c.call(this, g);
|
|
2595
2624
|
};
|
|
2596
|
-
var
|
|
2597
|
-
|
|
2625
|
+
var u = a.init;
|
|
2626
|
+
a.init = function() {
|
|
2598
2627
|
if (this.$u) {
|
|
2599
|
-
var
|
|
2600
|
-
this.$y =
|
|
2601
|
-
} else
|
|
2628
|
+
var g = this.$d;
|
|
2629
|
+
this.$y = g.getUTCFullYear(), this.$M = g.getUTCMonth(), this.$D = g.getUTCDate(), this.$W = g.getUTCDay(), this.$H = g.getUTCHours(), this.$m = g.getUTCMinutes(), this.$s = g.getUTCSeconds(), this.$ms = g.getUTCMilliseconds();
|
|
2630
|
+
} else u.call(this);
|
|
2602
2631
|
};
|
|
2603
|
-
var d =
|
|
2604
|
-
|
|
2605
|
-
var
|
|
2606
|
-
if (
|
|
2607
|
-
if (typeof
|
|
2632
|
+
var d = a.utcOffset;
|
|
2633
|
+
a.utcOffset = function(g, x) {
|
|
2634
|
+
var y = this.$utils().u;
|
|
2635
|
+
if (y(g)) return this.$u ? 0 : y(this.$offset) ? d.call(this) : this.$offset;
|
|
2636
|
+
if (typeof g == "string" && (g = function(C) {
|
|
2608
2637
|
C === void 0 && (C = "");
|
|
2609
2638
|
var L = C.match(i);
|
|
2610
2639
|
if (!L) return null;
|
|
2611
2640
|
var E = ("" + L[0]).match(s) || ["-", 0, 0], v = E[0], M = 60 * +E[1] + +E[2];
|
|
2612
2641
|
return M === 0 ? 0 : v === "+" ? M : -M;
|
|
2613
|
-
}(
|
|
2614
|
-
var T = Math.abs(
|
|
2615
|
-
if (
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
return b;
|
|
2642
|
+
}(g), g === null)) return this;
|
|
2643
|
+
var T = Math.abs(g) <= 16 ? 60 * g : g;
|
|
2644
|
+
if (T === 0) return this.utc(x);
|
|
2645
|
+
var b = this.clone();
|
|
2646
|
+
if (x) return b.$offset = T, b.$u = !1, b;
|
|
2647
|
+
var w = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
2648
|
+
return (b = this.local().add(T + w, e)).$offset = T, b.$x.$localOffset = w, b;
|
|
2621
2649
|
};
|
|
2622
|
-
var l =
|
|
2623
|
-
|
|
2624
|
-
var
|
|
2625
|
-
return l.call(this,
|
|
2626
|
-
},
|
|
2627
|
-
var
|
|
2628
|
-
return this.$d.valueOf() - 6e4 *
|
|
2629
|
-
},
|
|
2650
|
+
var l = a.format;
|
|
2651
|
+
a.format = function(g) {
|
|
2652
|
+
var x = g || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
2653
|
+
return l.call(this, x);
|
|
2654
|
+
}, a.valueOf = function() {
|
|
2655
|
+
var g = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
2656
|
+
return this.$d.valueOf() - 6e4 * g;
|
|
2657
|
+
}, a.isUTC = function() {
|
|
2630
2658
|
return !!this.$u;
|
|
2631
|
-
},
|
|
2659
|
+
}, a.toISOString = function() {
|
|
2632
2660
|
return this.toDate().toISOString();
|
|
2633
|
-
},
|
|
2661
|
+
}, a.toString = function() {
|
|
2634
2662
|
return this.toDate().toUTCString();
|
|
2635
2663
|
};
|
|
2636
|
-
var m =
|
|
2637
|
-
|
|
2638
|
-
return
|
|
2664
|
+
var m = a.toDate;
|
|
2665
|
+
a.toDate = function(g) {
|
|
2666
|
+
return g === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
|
|
2639
2667
|
};
|
|
2640
|
-
var p =
|
|
2641
|
-
|
|
2642
|
-
if (
|
|
2643
|
-
var T = this.local(), b = r(
|
|
2644
|
-
return p.call(T, b,
|
|
2668
|
+
var p = a.diff;
|
|
2669
|
+
a.diff = function(g, x, y) {
|
|
2670
|
+
if (g && this.$u === g.$u) return p.call(this, g, x, y);
|
|
2671
|
+
var T = this.local(), b = r(g).local();
|
|
2672
|
+
return p.call(T, b, x, y);
|
|
2645
2673
|
};
|
|
2646
2674
|
};
|
|
2647
2675
|
});
|
|
@@ -2670,8 +2698,8 @@ var Le = { exports: {} };
|
|
|
2670
2698
|
var s = i(e), n = { name: "zh", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(o, r) {
|
|
2671
2699
|
return r === "W" ? o + "周" : o + "日";
|
|
2672
2700
|
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s后", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(o, r) {
|
|
2673
|
-
var
|
|
2674
|
-
return
|
|
2701
|
+
var a = 100 * o + r;
|
|
2702
|
+
return a < 600 ? "凌晨" : a < 900 ? "早上" : a < 1100 ? "上午" : a < 1300 ? "中午" : a < 1800 ? "下午" : "晚上";
|
|
2675
2703
|
} };
|
|
2676
2704
|
return s.default.locale(n, null, !0), n;
|
|
2677
2705
|
});
|
|
@@ -2733,30 +2761,30 @@ const ut = () => ({
|
|
|
2733
2761
|
});
|
|
2734
2762
|
class Oe {
|
|
2735
2763
|
constructor() {
|
|
2736
|
-
|
|
2737
|
-
|
|
2764
|
+
h(this, "startTime", G().startOf("day"));
|
|
2765
|
+
h(this, "endTime", G().endOf("day"));
|
|
2738
2766
|
/** 结束的标准时间。切换单位会影响结尾的扩展,需要单独记录一个标准时间 */
|
|
2739
|
-
|
|
2767
|
+
h(this, "targetEnd", G().endOf("day"));
|
|
2740
2768
|
/** 固定起始日期 */
|
|
2741
|
-
|
|
2769
|
+
h(this, "strictStart", !1);
|
|
2742
2770
|
/** 固定截止日期 */
|
|
2743
|
-
|
|
2771
|
+
h(this, "strictEnd", !1);
|
|
2744
2772
|
/** 是否自适应宽度 */
|
|
2745
|
-
|
|
2773
|
+
h(this, "isAuto", !1);
|
|
2746
2774
|
/** 表头的日期列表 */
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2775
|
+
h(this, "timeline", []);
|
|
2776
|
+
h(this, "headerGroupFormat");
|
|
2777
|
+
h(this, "headerCellFormat");
|
|
2778
|
+
h(this, "isDirty", !0);
|
|
2751
2779
|
// 标记缓存是否需要更新
|
|
2752
2780
|
/** 是否第一次赋值,如果第一次赋值,允许全部赋值 */
|
|
2753
|
-
|
|
2781
|
+
h(this, "isFirstTime", !0);
|
|
2754
2782
|
/** 总宽度 */
|
|
2755
|
-
|
|
2783
|
+
h(this, "allWidth", 0);
|
|
2756
2784
|
/** 每一格的宽度 */
|
|
2757
|
-
|
|
2785
|
+
h(this, "cellWidth");
|
|
2758
2786
|
/** 用户设定的单位 */
|
|
2759
|
-
|
|
2787
|
+
h(this, "unit", "day");
|
|
2760
2788
|
this.cellWidth = Z(ut().normal);
|
|
2761
2789
|
}
|
|
2762
2790
|
getStartTime() {
|
|
@@ -2960,11 +2988,11 @@ class De {
|
|
|
2960
2988
|
// 使用私有构造函数防止直接创建实例
|
|
2961
2989
|
constructor(t, e) {
|
|
2962
2990
|
// 声明成员属性类型
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2991
|
+
h(this, "optionManager");
|
|
2992
|
+
h(this, "dataManager");
|
|
2993
|
+
h(this, "columnManager");
|
|
2994
|
+
h(this, "linkManager");
|
|
2995
|
+
h(this, "timeAxis");
|
|
2968
2996
|
var n, o, r;
|
|
2969
2997
|
this.context = t;
|
|
2970
2998
|
const i = yt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
@@ -2988,11 +3016,11 @@ class De {
|
|
|
2988
3016
|
return this.timeAxis;
|
|
2989
3017
|
}
|
|
2990
3018
|
setOption(t, e = { merge: !0 }) {
|
|
2991
|
-
var n, o, r,
|
|
3019
|
+
var n, o, r, a;
|
|
2992
3020
|
const i = yt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
2993
3021
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((c) => {
|
|
2994
3022
|
c.updateMode();
|
|
2995
|
-
}), 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(((
|
|
3023
|
+
}), 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 && vt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
2996
3024
|
}
|
|
2997
3025
|
updateTime(t, e) {
|
|
2998
3026
|
this.timeAxis.setDate(t, e);
|
|
@@ -3000,92 +3028,92 @@ class De {
|
|
|
3000
3028
|
}
|
|
3001
3029
|
class _e {
|
|
3002
3030
|
constructor(t, e, i) {
|
|
3003
|
-
|
|
3004
|
-
|
|
3031
|
+
h(this, "rootElement");
|
|
3032
|
+
h(this, "options");
|
|
3005
3033
|
// 滚动条元素
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3034
|
+
h(this, "hScrollbar");
|
|
3035
|
+
h(this, "vScrollbar");
|
|
3036
|
+
h(this, "hScrollThumb");
|
|
3037
|
+
h(this, "vScrollThumb");
|
|
3038
|
+
h(this, "scrollbarContainer");
|
|
3011
3039
|
// 内容尺寸和滚动位置
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3040
|
+
h(this, "viewportWidth", 0);
|
|
3041
|
+
h(this, "viewportHeight", 0);
|
|
3042
|
+
h(this, "contentWidth", 0);
|
|
3043
|
+
h(this, "contentHeight", 0);
|
|
3044
|
+
h(this, "scrollLeft", 0);
|
|
3045
|
+
h(this, "scrollTop", 0);
|
|
3018
3046
|
// 滚动条状态
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3047
|
+
h(this, "isDraggingHScroll", !1);
|
|
3048
|
+
h(this, "isDraggingVScroll", !1);
|
|
3049
|
+
h(this, "isMouseOverRoot", !1);
|
|
3050
|
+
h(this, "isMouseOverScrollbar", !1);
|
|
3051
|
+
h(this, "hideTimeout", null);
|
|
3052
|
+
h(this, "showTimeout", null);
|
|
3025
3053
|
// 新增:显示计时器
|
|
3026
|
-
|
|
3054
|
+
h(this, "isVisible", !1);
|
|
3027
3055
|
// 拖拽状态
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3056
|
+
h(this, "dragStartX", 0);
|
|
3057
|
+
h(this, "dragStartY", 0);
|
|
3058
|
+
h(this, "thumbStartScrollLeft", 0);
|
|
3059
|
+
h(this, "thumbStartScrollTop", 0);
|
|
3032
3060
|
// 动画状态
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3061
|
+
h(this, "isAnimating", !1);
|
|
3062
|
+
h(this, "animationFrameId", null);
|
|
3063
|
+
h(this, "animationStartTime", 0);
|
|
3064
|
+
h(this, "animationStartScrollLeft", 0);
|
|
3065
|
+
h(this, "animationStartScrollTop", 0);
|
|
3066
|
+
h(this, "animationTargetScrollLeft", 0);
|
|
3067
|
+
h(this, "animationTargetScrollTop", 0);
|
|
3068
|
+
h(this, "animationSource", "api");
|
|
3041
3069
|
// 记录动画触发源
|
|
3042
3070
|
// 节流处理
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3071
|
+
h(this, "throttledHandleMouseMove");
|
|
3072
|
+
h(this, "throttledHandleWheel");
|
|
3073
|
+
h(this, "handleRootMouseMove", () => {
|
|
3046
3074
|
!this.isVisible && this.isMouseOverRoot ? this.scheduleShow() : this.isVisible && !this.isMouseOverScrollbar && this.scheduleHide();
|
|
3047
3075
|
});
|
|
3048
|
-
|
|
3076
|
+
h(this, "handleScrollbarMouseEnter", () => {
|
|
3049
3077
|
this.isMouseOverScrollbar = !0, this.scheduleShow();
|
|
3050
3078
|
});
|
|
3051
|
-
|
|
3079
|
+
h(this, "handleScrollbarMouseLeave", () => {
|
|
3052
3080
|
this.isMouseOverScrollbar = !1, this.isMouseOverRoot && this.scheduleHide();
|
|
3053
3081
|
});
|
|
3054
|
-
|
|
3082
|
+
h(this, "handleMouseEnter", () => {
|
|
3055
3083
|
this.isMouseOverRoot = !0, this.scheduleShow();
|
|
3056
3084
|
});
|
|
3057
|
-
|
|
3085
|
+
h(this, "handleMouseLeave", () => {
|
|
3058
3086
|
this.isMouseOverRoot = !1, !this.isDraggingHScroll && !this.isDraggingVScroll && !this.isMouseOverScrollbar && (this.clearTimeouts(!0, !1), this.scheduleHide());
|
|
3059
3087
|
});
|
|
3060
|
-
|
|
3088
|
+
h(this, "handleHorizontalThumbMouseDown", (t) => {
|
|
3061
3089
|
t.preventDefault(), t.stopPropagation(), this.isDraggingHScroll = !0, this.dragStartX = t.clientX, this.thumbStartScrollLeft = this.scrollLeft, this.hScrollThumb.style.backgroundColor = this.options.thumb.color, this.scheduleShow(), document.addEventListener("mousemove", this.throttledHandleMouseMove), document.addEventListener("mouseup", this.handleMouseUp);
|
|
3062
3090
|
});
|
|
3063
|
-
|
|
3091
|
+
h(this, "handleVerticalThumbMouseDown", (t) => {
|
|
3064
3092
|
t.preventDefault(), t.stopPropagation(), this.isDraggingVScroll = !0, this.dragStartY = t.clientY, this.thumbStartScrollTop = this.scrollTop, this.vScrollThumb.style.backgroundColor = this.options.thumb.color, this.scheduleShow(), document.addEventListener("mousemove", this.throttledHandleMouseMove), document.addEventListener("mouseup", this.handleMouseUp);
|
|
3065
3093
|
});
|
|
3066
|
-
|
|
3094
|
+
h(this, "handleHorizontalTrackMouseDown", (t) => {
|
|
3067
3095
|
if (t.target !== this.hScrollbar) return;
|
|
3068
3096
|
t.preventDefault();
|
|
3069
|
-
const e = this.hScrollbar.getBoundingClientRect(), i = this.hScrollThumb.offsetWidth, s = t.clientX - e.left, n = this.hScrollbar.clientWidth, o = this.contentWidth - this.viewportWidth, r = n - i,
|
|
3070
|
-
this.scrollTo({ x:
|
|
3097
|
+
const e = this.hScrollbar.getBoundingClientRect(), i = this.hScrollThumb.offsetWidth, s = t.clientX - e.left, n = this.hScrollbar.clientWidth, o = this.contentWidth - this.viewportWidth, r = n - i, a = (s - i / 2) / r * o;
|
|
3098
|
+
this.scrollTo({ x: a, y: this.scrollTop }, "track");
|
|
3071
3099
|
});
|
|
3072
|
-
|
|
3100
|
+
h(this, "handleVerticalTrackMouseDown", (t) => {
|
|
3073
3101
|
if (t.target !== this.vScrollbar) return;
|
|
3074
3102
|
t.preventDefault();
|
|
3075
|
-
const e = this.vScrollbar.getBoundingClientRect(), i = this.vScrollThumb.offsetHeight, s = t.clientY - e.top, n = this.vScrollbar.clientHeight, o = this.contentHeight - this.viewportHeight, r = n - i,
|
|
3076
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
3103
|
+
const e = this.vScrollbar.getBoundingClientRect(), i = this.vScrollThumb.offsetHeight, s = t.clientY - e.top, n = this.vScrollbar.clientHeight, o = this.contentHeight - this.viewportHeight, r = n - i, a = (s - i / 2) / r * o;
|
|
3104
|
+
this.scrollTo({ x: this.scrollLeft, y: a }, "track");
|
|
3077
3105
|
});
|
|
3078
|
-
|
|
3106
|
+
h(this, "handleMouseUp", () => {
|
|
3079
3107
|
if (this.isDraggingHScroll || this.isDraggingVScroll) {
|
|
3080
3108
|
const t = this.isDraggingHScroll, e = this.isDraggingVScroll;
|
|
3081
3109
|
this.isDraggingHScroll = !1, this.isDraggingVScroll = !1, t && (this.hScrollThumb.style.backgroundColor = this.options.thumb.color), e && (this.vScrollThumb.style.backgroundColor = this.options.thumb.color), document.removeEventListener("mousemove", this.throttledHandleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), !this.isMouseOverRoot && !this.isMouseOverScrollbar ? this.scheduleHide() : this.scheduleHide();
|
|
3082
3110
|
}
|
|
3083
3111
|
});
|
|
3084
3112
|
// --- 动画处理 ---
|
|
3085
|
-
|
|
3113
|
+
h(this, "animationStep", (t) => {
|
|
3086
3114
|
if (!this.isAnimating) return;
|
|
3087
|
-
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,
|
|
3088
|
-
(
|
|
3115
|
+
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;
|
|
3116
|
+
(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());
|
|
3089
3117
|
});
|
|
3090
3118
|
this.root = t, this.rootElement = e, this.options = rt(
|
|
3091
3119
|
{
|
|
@@ -3216,8 +3244,8 @@ class _e {
|
|
|
3216
3244
|
if (this.scheduleShow(), this.isDraggingHScroll) {
|
|
3217
3245
|
const e = t.clientX - this.dragStartX, i = this.hScrollbar.clientWidth, s = this.hScrollThumb.offsetWidth, n = Math.max(0, i - s), o = Math.max(0, this.contentWidth - this.viewportWidth);
|
|
3218
3246
|
if (n === 0 || o === 0) return;
|
|
3219
|
-
const r = e / n * o,
|
|
3220
|
-
this.scrollTo({ x:
|
|
3247
|
+
const r = e / n * o, a = this.thumbStartScrollLeft + r;
|
|
3248
|
+
this.scrollTo({ x: a, y: this.scrollTop }, "drag");
|
|
3221
3249
|
}
|
|
3222
3250
|
if (this.isDraggingVScroll) {
|
|
3223
3251
|
const e = t.clientY - this.dragStartY, i = this.vScrollbar.clientHeight, s = this.vScrollThumb.offsetHeight, n = Math.max(0, i - s), o = Math.max(
|
|
@@ -3225,8 +3253,8 @@ class _e {
|
|
|
3225
3253
|
this.contentHeight - this.viewportHeight
|
|
3226
3254
|
);
|
|
3227
3255
|
if (n === 0 || o === 0) return;
|
|
3228
|
-
const r = e / n * o,
|
|
3229
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
3256
|
+
const r = e / n * o, a = this.thumbStartScrollTop + r;
|
|
3257
|
+
this.scrollTo({ x: this.scrollLeft, y: a }, "drag");
|
|
3230
3258
|
}
|
|
3231
3259
|
}
|
|
3232
3260
|
}
|
|
@@ -3259,8 +3287,8 @@ class _e {
|
|
|
3259
3287
|
this.isAnimating = !0, this.animationStartTime = performance.now(), this.animationStartScrollLeft = this.scrollLeft, this.animationStartScrollTop = this.scrollTop, this.animationTargetScrollLeft = i.x, this.animationTargetScrollTop = i.y, this.animationSource = "wheel";
|
|
3260
3288
|
const s = 150, n = (o) => {
|
|
3261
3289
|
if (!this.isAnimating) return;
|
|
3262
|
-
const r = o - this.animationStartTime,
|
|
3263
|
-
(l || m) && this.emit("wheel",
|
|
3290
|
+
const r = o - this.animationStartTime, a = Math.min(1, r / s), c = a * (2 - a), u = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * c, d = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * c, l = this.scrollLeft !== u, m = this.scrollTop !== d;
|
|
3291
|
+
(l || m) && this.emit("wheel", u, d), a < 1 ? this.animationFrameId = requestAnimationFrame(n) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && this.emit("wheel", this.animationTargetScrollLeft, this.animationTargetScrollTop), this.scheduleHide());
|
|
3264
3292
|
};
|
|
3265
3293
|
this.animationFrameId = requestAnimationFrame(n);
|
|
3266
3294
|
}
|
|
@@ -3308,15 +3336,15 @@ class _e {
|
|
|
3308
3336
|
*/
|
|
3309
3337
|
updateSize(t, e, i, s, n = 0, o = 0) {
|
|
3310
3338
|
this.viewportWidth = Math.max(0, t), this.viewportHeight = Math.max(0, e), this.contentWidth = Math.max(this.viewportWidth, i), this.contentHeight = Math.max(this.viewportHeight, s);
|
|
3311
|
-
const r = this.canScrollHorizontal() && this.options.showHorizontal,
|
|
3339
|
+
const r = this.canScrollHorizontal() && this.options.showHorizontal, a = this.canScrollVertical() && this.options.showVertical;
|
|
3312
3340
|
if (r) {
|
|
3313
|
-
const
|
|
3314
|
-
this.hScrollbar.style.display = "block", this.hScrollbar.style.transform = `translateX(${n}px)`, this.hScrollbar.style.width = `${Math.max(0,
|
|
3341
|
+
const u = this.viewportWidth - (a ? this.options.track.size : 0);
|
|
3342
|
+
this.hScrollbar.style.display = "block", this.hScrollbar.style.transform = `translateX(${n}px)`, this.hScrollbar.style.width = `${Math.max(0, u)}px`, this.hScrollbar.style.bottom = "0px", this.hScrollbar.style.right = a ? `${this.options.track.size}px` : "0px";
|
|
3315
3343
|
} else
|
|
3316
3344
|
this.hScrollbar.style.display = "none";
|
|
3317
|
-
if (
|
|
3318
|
-
const
|
|
3319
|
-
this.vScrollbar.style.display = "block", this.vScrollbar.style.transform = `translateY(${o}px)`, this.vScrollbar.style.height = `${Math.max(0,
|
|
3345
|
+
if (a) {
|
|
3346
|
+
const u = this.viewportHeight - o - (r ? this.options.track.size : 0);
|
|
3347
|
+
this.vScrollbar.style.display = "block", this.vScrollbar.style.transform = `translateY(${o}px)`, this.vScrollbar.style.height = `${Math.max(0, u)}px`, this.vScrollbar.style.right = "0px", this.vScrollbar.style.bottom = r ? `${this.options.track.size}px` : "0px";
|
|
3320
3348
|
} else
|
|
3321
3349
|
this.vScrollbar.style.display = "none";
|
|
3322
3350
|
this.updateThumbStyles();
|
|
@@ -3324,7 +3352,7 @@ class _e {
|
|
|
3324
3352
|
x: this.scrollLeft,
|
|
3325
3353
|
y: this.scrollTop
|
|
3326
3354
|
});
|
|
3327
|
-
(c.x !== this.scrollLeft || c.y !== this.scrollTop) && this.emit("api", c.x, c.y), this.isMouseOverRoot || this.isDraggingHScroll || this.isDraggingVScroll ? this.scheduleShow() : !r && !
|
|
3355
|
+
(c.x !== this.scrollLeft || c.y !== this.scrollTop) && this.emit("api", c.x, c.y), this.isMouseOverRoot || this.isDraggingHScroll || this.isDraggingVScroll ? this.scheduleShow() : !r && !a ? this.hideScrollbars(!0) : this.isVisible ? this.scheduleShow() : this.hideScrollbars(!0);
|
|
3328
3356
|
}
|
|
3329
3357
|
updateThumbStyles() {
|
|
3330
3358
|
if (this.canScrollHorizontal() && this.options.showHorizontal) {
|
|
@@ -3442,11 +3470,11 @@ class st {
|
|
|
3442
3470
|
* @param colspan 横向合并的列数
|
|
3443
3471
|
* @param rowspan 纵向合并的行数
|
|
3444
3472
|
*/
|
|
3445
|
-
constructor(t, e, i, s, n, o, r = 1,
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
this.context = t, this.container = e, this.column = i, this.task = s, this.rowIndex = n, this.colIndex = o, this.colspan = r, this.rowspan =
|
|
3473
|
+
constructor(t, e, i, s, n, o, r = 1, a = 1, c) {
|
|
3474
|
+
h(this, "element");
|
|
3475
|
+
h(this, "isEmpty", !1);
|
|
3476
|
+
h(this, "isHandler", !1);
|
|
3477
|
+
this.context = t, this.container = e, this.column = i, this.task = s, this.rowIndex = n, this.colIndex = o, this.colspan = r, this.rowspan = a, this.isEmpty = c === "empty", this.isHandler = c === "handler", this.element = document.createElement("div"), this.element.className = "x-gantt-table-cell", this.element.style.boxSizing = "border-box", this.element.style.display = "inline-flex", this.element.style.flexShrink = "0", this.element.style.flexGrow = "0", this.element.style.flexBasis = "auto", this.element.style.pointerEvents = "all", this.element.style.setProperty(
|
|
3450
3478
|
"border-color",
|
|
3451
3479
|
this.context.getOptions().border.color,
|
|
3452
3480
|
"important"
|
|
@@ -3525,9 +3553,9 @@ class St {
|
|
|
3525
3553
|
*/
|
|
3526
3554
|
constructor(t, e, i, s, n = !1) {
|
|
3527
3555
|
// 行元素
|
|
3528
|
-
|
|
3556
|
+
h(this, "element");
|
|
3529
3557
|
// 行内单元格集合
|
|
3530
|
-
|
|
3558
|
+
h(this, "cells", []);
|
|
3531
3559
|
this.context = t, this.container = e, this.task = i, this.top = s, this.element = document.createElement("div"), this.element.className = "x-gantt-table-row", this.element.style.display = "flex", this.element.style.flexDirection = "row", this.element.style.flexWrap = "nowrap", this.element.style.position = "absolute", this.element.style.pointerEvents = "none", this.element.style.width = `${this.context.store.getColumnManager().getTotalWidth()}px`, n && this.raise(), this.updateStyles(), this.container.appendChild(this.element), this.bindEvents(), this.registerEvents();
|
|
3532
3560
|
}
|
|
3533
3561
|
/**
|
|
@@ -3606,7 +3634,7 @@ class St {
|
|
|
3606
3634
|
const o = e[n], r = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
3607
3635
|
if (r) {
|
|
3608
3636
|
if (r.task.id !== this.task.id) {
|
|
3609
|
-
const
|
|
3637
|
+
const a = new st(
|
|
3610
3638
|
this.context,
|
|
3611
3639
|
this.element,
|
|
3612
3640
|
o,
|
|
@@ -3617,9 +3645,9 @@ class St {
|
|
|
3617
3645
|
1,
|
|
3618
3646
|
"empty"
|
|
3619
3647
|
);
|
|
3620
|
-
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(
|
|
3648
|
+
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(a);
|
|
3621
3649
|
} else if (r.originColumnIndex === n) {
|
|
3622
|
-
const
|
|
3650
|
+
const a = new st(
|
|
3623
3651
|
this.context,
|
|
3624
3652
|
this.element,
|
|
3625
3653
|
o,
|
|
@@ -3629,22 +3657,22 @@ class St {
|
|
|
3629
3657
|
r.colspan,
|
|
3630
3658
|
r.rowspan
|
|
3631
3659
|
);
|
|
3632
|
-
this.cells.push(
|
|
3660
|
+
this.cells.push(a);
|
|
3633
3661
|
}
|
|
3634
3662
|
} else {
|
|
3635
|
-
let
|
|
3636
|
-
const
|
|
3663
|
+
let a = 1, c = 1;
|
|
3664
|
+
const u = (s = (i = o.column).merge) == null ? void 0 : s.call(
|
|
3637
3665
|
i,
|
|
3638
3666
|
this.task.getField(o.column.field),
|
|
3639
3667
|
this.task.data,
|
|
3640
3668
|
n,
|
|
3641
3669
|
this.task.level + 1
|
|
3642
3670
|
);
|
|
3643
|
-
if (
|
|
3671
|
+
if (u && (typeof u.col != "number" ? O.error("colspan function must returned a number") : a = u.col, typeof u.row != "number" ? O.error("rowspan function must returned a number") : c = u.row), a > 1 || c > 1) {
|
|
3644
3672
|
if (c > 1)
|
|
3645
3673
|
for (let p = 1; p < c; p++) {
|
|
3646
|
-
const
|
|
3647
|
-
if (
|
|
3674
|
+
const g = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + p];
|
|
3675
|
+
if (g && this.task.level !== g.level) {
|
|
3648
3676
|
c = p;
|
|
3649
3677
|
break;
|
|
3650
3678
|
}
|
|
@@ -3652,17 +3680,17 @@ class St {
|
|
|
3652
3680
|
const l = {
|
|
3653
3681
|
task: this.task,
|
|
3654
3682
|
originColumnIndex: n,
|
|
3655
|
-
colspan:
|
|
3683
|
+
colspan: a,
|
|
3656
3684
|
rowspan: c
|
|
3657
3685
|
};
|
|
3658
3686
|
let m = this.task;
|
|
3659
3687
|
for (let p = c; p > 0; p--)
|
|
3660
3688
|
if (m) {
|
|
3661
|
-
for (let
|
|
3662
|
-
this.context.store.getColumnManager().addMergeInfo(m.id,
|
|
3689
|
+
for (let g = 0; g < a; g++)
|
|
3690
|
+
this.context.store.getColumnManager().addMergeInfo(m.id, g + n, l);
|
|
3663
3691
|
m = this.context.store.getDataManager().getVisibleTasks().at(m.flatIndex + 1);
|
|
3664
3692
|
}
|
|
3665
|
-
for (let p = 0; p <
|
|
3693
|
+
for (let p = 0; p < a; p++)
|
|
3666
3694
|
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, l);
|
|
3667
3695
|
}
|
|
3668
3696
|
const d = new st(
|
|
@@ -3672,7 +3700,7 @@ class St {
|
|
|
3672
3700
|
this.task,
|
|
3673
3701
|
this.task.flatIndex,
|
|
3674
3702
|
n,
|
|
3675
|
-
|
|
3703
|
+
a,
|
|
3676
3704
|
c
|
|
3677
3705
|
);
|
|
3678
3706
|
this.cells.push(d);
|
|
@@ -3708,9 +3736,9 @@ class St {
|
|
|
3708
3736
|
}
|
|
3709
3737
|
class Ae {
|
|
3710
3738
|
constructor(t, e) {
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3739
|
+
h(this, "element");
|
|
3740
|
+
h(this, "rows", /* @__PURE__ */ new Map());
|
|
3741
|
+
h(this, "mergeRows", /* @__PURE__ */ new Map());
|
|
3714
3742
|
this.context = t, this.container = e, this.element = document.createElement("div"), this.element.className = "x-gantt-table-body", this.element.style.width = "100%", this.element.style.position = "relative", this.container.appendChild(this.element);
|
|
3715
3743
|
}
|
|
3716
3744
|
render(t, e) {
|
|
@@ -3728,21 +3756,21 @@ class Ae {
|
|
|
3728
3756
|
}), e.forEach((n, o) => {
|
|
3729
3757
|
const r = n.id;
|
|
3730
3758
|
if (this.rows.has(r)) {
|
|
3731
|
-
const
|
|
3732
|
-
|
|
3759
|
+
const a = this.rows.get(r);
|
|
3760
|
+
a.update(n), a.updateTop(t);
|
|
3733
3761
|
} else {
|
|
3734
|
-
const
|
|
3735
|
-
|
|
3762
|
+
const a = new St(this.context, this.element, n, t);
|
|
3763
|
+
a.create(), this.rows.set(r, a);
|
|
3736
3764
|
}
|
|
3737
|
-
this.context.store.getColumnManager().getLeafColumns().forEach((
|
|
3738
|
-
const
|
|
3739
|
-
if (
|
|
3740
|
-
const d =
|
|
3765
|
+
this.context.store.getColumnManager().getLeafColumns().forEach((a, c) => {
|
|
3766
|
+
const u = this.context.store.getColumnManager().getMergeInfo(n.id, c);
|
|
3767
|
+
if (u && u.rowspan > 1) {
|
|
3768
|
+
const d = u.task.id;
|
|
3741
3769
|
if (!this.rows.has(d) && !this.mergeRows.has(d)) {
|
|
3742
3770
|
const l = new St(
|
|
3743
3771
|
this.context,
|
|
3744
3772
|
this.element,
|
|
3745
|
-
|
|
3773
|
+
u.task,
|
|
3746
3774
|
t,
|
|
3747
3775
|
!0
|
|
3748
3776
|
);
|
|
@@ -3785,7 +3813,7 @@ class Ae {
|
|
|
3785
3813
|
}
|
|
3786
3814
|
class pt {
|
|
3787
3815
|
constructor(t, e, i, s) {
|
|
3788
|
-
|
|
3816
|
+
h(this, "columnElement");
|
|
3789
3817
|
this.context = t, this.root = e, this.container = i, this.column = s, this.columnElement = document.createElement("div"), this.initElement(), this.container.appendChild(this.columnElement);
|
|
3790
3818
|
}
|
|
3791
3819
|
initElement() {
|
|
@@ -3826,15 +3854,15 @@ class pt {
|
|
|
3826
3854
|
let e = 0, i = 0, s = null, n = 0;
|
|
3827
3855
|
const o = (c) => {
|
|
3828
3856
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3829
|
-
const
|
|
3830
|
-
document.addEventListener("mousemove",
|
|
3857
|
+
const u = (l) => r(l), d = (l) => a(l, u, d);
|
|
3858
|
+
document.addEventListener("mousemove", u), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(k.SHOW_GUIDELINE, n);
|
|
3831
3859
|
}, r = (c) => {
|
|
3832
3860
|
if (c.preventDefault(), !s) return;
|
|
3833
|
-
const
|
|
3834
|
-
let
|
|
3835
|
-
|
|
3836
|
-
},
|
|
3837
|
-
document.removeEventListener("mousemove",
|
|
3861
|
+
const u = c.clientX - e, d = i + u, l = Math.max(50, d), m = e - s.left - i, g = this.root.clientWidth - 20;
|
|
3862
|
+
let x = m + l;
|
|
3863
|
+
x = Math.min(g, x), this.context.event.emit(k.MOVE_GUIDELINE, x);
|
|
3864
|
+
}, a = (c, u, d) => {
|
|
3865
|
+
document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", d), this.context.event.emit(k.HIDE_GUIDELINE);
|
|
3838
3866
|
const l = c.clientX - e, m = Math.max(50, i + l);
|
|
3839
3867
|
this.setWidth(m);
|
|
3840
3868
|
};
|
|
@@ -3843,10 +3871,10 @@ class pt {
|
|
|
3843
3871
|
}
|
|
3844
3872
|
class xt {
|
|
3845
3873
|
constructor(t, e, i, s) {
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3874
|
+
h(this, "groupElement");
|
|
3875
|
+
h(this, "titleContainer");
|
|
3876
|
+
h(this, "childContainer");
|
|
3877
|
+
h(this, "children", []);
|
|
3850
3878
|
this.context = t, this.root = e, this.container = i, this.column = s, this.groupElement = document.createElement("div"), this.titleContainer = document.createElement("div"), this.childContainer = document.createElement("div"), this.initElement(), this.initChildren(), this.container.appendChild(this.groupElement);
|
|
3851
3879
|
}
|
|
3852
3880
|
initElement() {
|
|
@@ -3887,8 +3915,8 @@ class xt {
|
|
|
3887
3915
|
}
|
|
3888
3916
|
class Ie {
|
|
3889
3917
|
constructor(t, e) {
|
|
3890
|
-
|
|
3891
|
-
|
|
3918
|
+
h(this, "headerElement");
|
|
3919
|
+
h(this, "headerColumns", []);
|
|
3892
3920
|
this.context = t, this.container = e, this.headerElement = document.createElement("div"), this.initElement(), this.container.appendChild(this.headerElement);
|
|
3893
3921
|
}
|
|
3894
3922
|
initElement() {
|
|
@@ -3947,9 +3975,9 @@ class Ie {
|
|
|
3947
3975
|
}
|
|
3948
3976
|
class He {
|
|
3949
3977
|
constructor(t, e) {
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3978
|
+
h(this, "tableContainer");
|
|
3979
|
+
h(this, "tableHeader");
|
|
3980
|
+
h(this, "tableBody");
|
|
3953
3981
|
this.context = t, this.container = e, this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table-container", this.tableContainer.style.position = "relative", this.tableContainer.style.width = "100%", this.tableContainer.style.height = "100%", this.tableContainer.style.overflow = "hidden", this.tableContainer.style.display = "flex", this.tableContainer.style.flexDirection = "column", this.container.appendChild(this.tableContainer), this.tableHeader = new Ie(t, this.tableContainer), this.tableBody = new Ae(t, this.tableContainer), this.listenEvents();
|
|
3954
3982
|
}
|
|
3955
3983
|
render(t, e) {
|
|
@@ -3974,17 +4002,17 @@ class He {
|
|
|
3974
4002
|
}
|
|
3975
4003
|
class Ge {
|
|
3976
4004
|
constructor(t, e) {
|
|
3977
|
-
|
|
4005
|
+
h(this, "background");
|
|
3978
4006
|
// 表头背景
|
|
3979
|
-
|
|
4007
|
+
h(this, "groupHeader");
|
|
3980
4008
|
// 主表头 (年/月)
|
|
3981
|
-
|
|
4009
|
+
h(this, "cellHeader");
|
|
3982
4010
|
// 次表头 (月/日)
|
|
3983
|
-
|
|
4011
|
+
h(this, "cellCache", /* @__PURE__ */ new Map());
|
|
3984
4012
|
// 状态变量
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4013
|
+
h(this, "width", 0);
|
|
4014
|
+
h(this, "height", 0);
|
|
4015
|
+
h(this, "offsetX", 0);
|
|
3988
4016
|
this.context = t, this.layer = e, this.background = new S.Rect({
|
|
3989
4017
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
3990
4018
|
name: "header-background"
|
|
@@ -4042,18 +4070,18 @@ class Ge {
|
|
|
4042
4070
|
})
|
|
4043
4071
|
);
|
|
4044
4072
|
const r = t.getTimeline();
|
|
4045
|
-
let
|
|
4046
|
-
for (let
|
|
4047
|
-
const d = r[
|
|
4048
|
-
if (
|
|
4049
|
-
|
|
4073
|
+
let a = 0;
|
|
4074
|
+
for (let u = 0; u < r.length; u++) {
|
|
4075
|
+
const d = r[u], l = e * (((c = d.children) == null ? void 0 : c.length) ?? 0);
|
|
4076
|
+
if (a + l < i) {
|
|
4077
|
+
a += l;
|
|
4050
4078
|
continue;
|
|
4051
4079
|
}
|
|
4052
|
-
if (
|
|
4080
|
+
if (a > s)
|
|
4053
4081
|
break;
|
|
4054
4082
|
const p = this.createCell(
|
|
4055
4083
|
`group-${d.date.format("YYYY-MM-DD")}`,
|
|
4056
|
-
|
|
4084
|
+
a,
|
|
4057
4085
|
0,
|
|
4058
4086
|
l,
|
|
4059
4087
|
n,
|
|
@@ -4061,44 +4089,44 @@ class Ge {
|
|
|
4061
4089
|
d.label
|
|
4062
4090
|
);
|
|
4063
4091
|
if (this.groupHeader.add(p), X(d.children) && d.children.length > 0) {
|
|
4064
|
-
let
|
|
4065
|
-
for (let
|
|
4066
|
-
const
|
|
4092
|
+
let g = a;
|
|
4093
|
+
for (let x = 0; x < d.children.length; ) {
|
|
4094
|
+
const y = d.children[x];
|
|
4067
4095
|
let T = 1;
|
|
4068
|
-
for (; d.children[
|
|
4096
|
+
for (; d.children[x + T] && y.label === d.children[x + T].label; )
|
|
4069
4097
|
T++;
|
|
4070
|
-
if (
|
|
4098
|
+
if (x += T, x >= d.children.length && r[u + 1] && r[u + 1].children) {
|
|
4071
4099
|
let L = 0;
|
|
4072
|
-
for (; r[
|
|
4073
|
-
r[
|
|
4100
|
+
for (; r[u + 1].children[L] && y.label === r[u + 1].children[L].label; )
|
|
4101
|
+
r[u + 1].children[L].hide = !0, L++;
|
|
4074
4102
|
L > 0 && (T += L);
|
|
4075
4103
|
}
|
|
4076
4104
|
const b = e * T;
|
|
4077
|
-
if (
|
|
4078
|
-
|
|
4105
|
+
if (g + b < i) {
|
|
4106
|
+
g += b;
|
|
4079
4107
|
continue;
|
|
4080
4108
|
}
|
|
4081
|
-
if (
|
|
4109
|
+
if (g > s)
|
|
4082
4110
|
break;
|
|
4083
4111
|
const C = this.createCell(
|
|
4084
|
-
`cell-${
|
|
4085
|
-
|
|
4112
|
+
`cell-${y.date.format("YYYY-MM-DD")}`,
|
|
4113
|
+
g,
|
|
4086
4114
|
n,
|
|
4087
4115
|
b,
|
|
4088
4116
|
n,
|
|
4089
|
-
|
|
4090
|
-
|
|
4117
|
+
y.hide ? "transparent" : o,
|
|
4118
|
+
y.hide ? "" : y.label
|
|
4091
4119
|
);
|
|
4092
|
-
this.cellHeader.add(C),
|
|
4120
|
+
this.cellHeader.add(C), y.hide && C.visible(!1), g += b;
|
|
4093
4121
|
}
|
|
4094
4122
|
}
|
|
4095
|
-
|
|
4123
|
+
a += l;
|
|
4096
4124
|
}
|
|
4097
4125
|
this.layer.batchDraw();
|
|
4098
4126
|
}
|
|
4099
4127
|
createCell(t, e, i, s, n, o, r) {
|
|
4100
|
-
const
|
|
4101
|
-
|
|
4128
|
+
const a = new S.Group();
|
|
4129
|
+
a.x(e), a.y(i);
|
|
4102
4130
|
const c = new S.Rect({
|
|
4103
4131
|
id: t,
|
|
4104
4132
|
x: 0,
|
|
@@ -4108,23 +4136,23 @@ class Ge {
|
|
|
4108
4136
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
4109
4137
|
name: "header-cell-bg"
|
|
4110
4138
|
});
|
|
4111
|
-
|
|
4112
|
-
let
|
|
4113
|
-
t.startsWith("cell-") && (this.cellCache.set(t, c),
|
|
4139
|
+
a.add(c);
|
|
4140
|
+
let u = this.context.getOptions().header.fontSize;
|
|
4141
|
+
t.startsWith("cell-") && (this.cellCache.set(t, c), u -= 2);
|
|
4114
4142
|
const d = new S.Line({
|
|
4115
4143
|
points: [s, 0, s, n],
|
|
4116
4144
|
stroke: o,
|
|
4117
4145
|
strokeWidth: 1,
|
|
4118
4146
|
name: "header-cell-right-border"
|
|
4119
4147
|
});
|
|
4120
|
-
|
|
4148
|
+
a.add(d);
|
|
4121
4149
|
const l = new S.Text({
|
|
4122
4150
|
x: 0,
|
|
4123
4151
|
y: 0,
|
|
4124
4152
|
width: s,
|
|
4125
4153
|
height: n,
|
|
4126
4154
|
text: r,
|
|
4127
|
-
fontSize:
|
|
4155
|
+
fontSize: u,
|
|
4128
4156
|
fontFamily: this.context.getOptions().header.fontFamily,
|
|
4129
4157
|
fontStyle: `${this.context.getOptions().header.fontWeight}`,
|
|
4130
4158
|
fill: this.context.getOptions().header.color,
|
|
@@ -4134,7 +4162,7 @@ class Ge {
|
|
|
4134
4162
|
ellipsis: !0,
|
|
4135
4163
|
name: "header-cell-text"
|
|
4136
4164
|
});
|
|
4137
|
-
return
|
|
4165
|
+
return a.add(l), a;
|
|
4138
4166
|
}
|
|
4139
4167
|
/**
|
|
4140
4168
|
* 清除表头内容
|
|
@@ -4171,9 +4199,9 @@ class Ge {
|
|
|
4171
4199
|
), s = this.cellCache.get(
|
|
4172
4200
|
`cell-${(r = e == null ? void 0 : e.endTime) == null ? void 0 : r.format("YYYY-MM-DD")}`
|
|
4173
4201
|
), n = this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor;
|
|
4174
|
-
n && (this.cellCache.forEach((
|
|
4202
|
+
n && (this.cellCache.forEach((a) => {
|
|
4175
4203
|
new S.Tween({
|
|
4176
|
-
node:
|
|
4204
|
+
node: a,
|
|
4177
4205
|
fill: n,
|
|
4178
4206
|
duration: 0.02
|
|
4179
4207
|
}).play();
|
|
@@ -4191,13 +4219,13 @@ class Ge {
|
|
|
4191
4219
|
class Re {
|
|
4192
4220
|
constructor(t, e) {
|
|
4193
4221
|
// 网格线组
|
|
4194
|
-
|
|
4195
|
-
|
|
4222
|
+
h(this, "verticalLines");
|
|
4223
|
+
h(this, "horizontalLines");
|
|
4196
4224
|
// 状态变量
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4225
|
+
h(this, "width", 0);
|
|
4226
|
+
h(this, "height", 0);
|
|
4227
|
+
h(this, "offsetX", 0);
|
|
4228
|
+
h(this, "offsetY", 0);
|
|
4201
4229
|
this.context = t, this.layer = e, this.verticalLines = new S.Group({ name: "vertical-grid-lines" }), this.horizontalLines = new S.Group({ name: "horizontal-grid-lines" }), this.layer.add(this.verticalLines), this.layer.add(this.horizontalLines);
|
|
4202
4230
|
}
|
|
4203
4231
|
/**
|
|
@@ -4232,18 +4260,18 @@ class Re {
|
|
|
4232
4260
|
const t = this.context.getOptions().header.height, e = this.width, i = this.context.store.getTimeAxis().getCellWidth(), s = this.context.getOptions().row.height, n = this.context.store.getDataManager().getVisibleSize(), o = n * s, r = Math.max(
|
|
4233
4261
|
0,
|
|
4234
4262
|
Math.floor(-this.offsetX / i) - 2
|
|
4235
|
-
),
|
|
4263
|
+
), a = Math.min(
|
|
4236
4264
|
this.context.store.getTimeAxis().getCellCount(),
|
|
4237
4265
|
Math.ceil((-this.offsetX + this.width) / i) + 2
|
|
4238
4266
|
), c = Math.max(
|
|
4239
4267
|
0,
|
|
4240
4268
|
Math.floor((-this.offsetY + t) / s) - 2
|
|
4241
|
-
),
|
|
4269
|
+
), u = Math.min(
|
|
4242
4270
|
n,
|
|
4243
4271
|
Math.ceil((-this.offsetY + this.height) / s) + 2
|
|
4244
4272
|
);
|
|
4245
4273
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
4246
|
-
for (let d = r; d <=
|
|
4274
|
+
for (let d = r; d <= a; d++) {
|
|
4247
4275
|
const l = d * i, m = new S.Line({
|
|
4248
4276
|
points: [l, t, l, o + t],
|
|
4249
4277
|
stroke: this.context.getOptions().border.color,
|
|
@@ -4252,7 +4280,7 @@ class Re {
|
|
|
4252
4280
|
});
|
|
4253
4281
|
this.verticalLines.add(m);
|
|
4254
4282
|
}
|
|
4255
|
-
for (let d = c; d <=
|
|
4283
|
+
for (let d = c; d <= u; d++) {
|
|
4256
4284
|
const l = d * s + t, m = new S.Line({
|
|
4257
4285
|
points: [0, l, Math.max(this.width, e), l],
|
|
4258
4286
|
stroke: this.context.getOptions().border.color,
|
|
@@ -4272,34 +4300,34 @@ class Re {
|
|
|
4272
4300
|
const kt = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><path fill="currentColor" fill-rule="evenodd" d="M5.5 4.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m4 0a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25M10.625 7.5a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 8.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m5.125 2.875a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 12.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25" clip-rule="evenodd"/></svg>';
|
|
4273
4301
|
class We {
|
|
4274
4302
|
constructor(t, e, i, s, n) {
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4303
|
+
h(this, "offsetX", 0);
|
|
4304
|
+
h(this, "offsetY", 0);
|
|
4305
|
+
h(this, "sliderGroup");
|
|
4306
|
+
h(this, "slider");
|
|
4307
|
+
h(this, "sliderBar", null);
|
|
4308
|
+
h(this, "sliderType", "");
|
|
4309
|
+
h(this, "leftHandleGroup", null);
|
|
4310
|
+
h(this, "rightHandleGroup", null);
|
|
4311
|
+
h(this, "progressGroup", null);
|
|
4312
|
+
h(this, "handlerWidth", 10);
|
|
4285
4313
|
// 自动滚动相关变量
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4314
|
+
h(this, "autoMoveTimer", null);
|
|
4315
|
+
h(this, "autoScrollTimer", null);
|
|
4316
|
+
h(this, "autoExpandTimer", null);
|
|
4317
|
+
h(this, "EDGE_THRESHOLD", 20);
|
|
4290
4318
|
// 边缘检测阈值,单位px
|
|
4291
|
-
|
|
4319
|
+
h(this, "SCROLL_STEP", 5);
|
|
4292
4320
|
// 每次滚动的步长,单位px
|
|
4293
|
-
|
|
4321
|
+
h(this, "MOVE_INTERVAL", 1e3 / 60);
|
|
4294
4322
|
// 移动间隔,单位ms,约60fps
|
|
4295
|
-
|
|
4323
|
+
h(this, "AUTO_EXPAND_INTERVAL", 500);
|
|
4296
4324
|
// 自动扩展间隔,单位ms
|
|
4297
4325
|
// 拖拽状态变量
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4326
|
+
h(this, "isDragging", !1);
|
|
4327
|
+
h(this, "draggingDirection", "none");
|
|
4328
|
+
h(this, "dragDiffX", 0);
|
|
4301
4329
|
// 记录拖拽时的原始数据
|
|
4302
|
-
|
|
4330
|
+
h(this, "oldTasks", []);
|
|
4303
4331
|
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new S.Group({
|
|
4304
4332
|
x: e,
|
|
4305
4333
|
y: i,
|
|
@@ -4322,7 +4350,7 @@ class We {
|
|
|
4322
4350
|
});
|
|
4323
4351
|
}
|
|
4324
4352
|
render() {
|
|
4325
|
-
var p,
|
|
4353
|
+
var p, g, x, y, T, b, w, C, L, E, v, M, A;
|
|
4326
4354
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4327
4355
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4328
4356
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
@@ -4331,9 +4359,9 @@ class We {
|
|
|
4331
4359
|
const t = this.context.getOptions().row.height, e = nt(
|
|
4332
4360
|
this.unpackFunc(this.context.getOptions().bar.height),
|
|
4333
4361
|
t
|
|
4334
|
-
), 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,
|
|
4362
|
+
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, r = this.unpackFunc(this.context.getOptions().bar.backgroundColor) || this.context.getOptions().primaryColor, a = ot(
|
|
4335
4363
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4336
|
-
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)",
|
|
4364
|
+
), 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;
|
|
4337
4365
|
this.slider || (this.slider = new S.Group({
|
|
4338
4366
|
dragBoundFunc: (_) => {
|
|
4339
4367
|
let D = Math.min(0, -(-this.offsetX - this.slider.x()));
|
|
@@ -4359,7 +4387,7 @@ class We {
|
|
|
4359
4387
|
if (this.slider.draggable(m), this.slider.on("mouseover", (_) => {
|
|
4360
4388
|
m && !this.isDragging && (_.target.getStage().container().style.cursor = "grab"), this.handleBarHighlight({
|
|
4361
4389
|
shadowColor: B(c).alpha(B(c).alpha() + 0.1).toHex(),
|
|
4362
|
-
shadowBlur: Math.max((
|
|
4390
|
+
shadowBlur: Math.max((u || 1) * 2, 4),
|
|
4363
4391
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4364
4392
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4365
4393
|
}), this.context.event.emit(k.SLIDER_ENTER, _.evt, this.task);
|
|
@@ -4368,7 +4396,7 @@ class We {
|
|
|
4368
4396
|
}), this.slider.on("mouseout", (_) => {
|
|
4369
4397
|
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4370
4398
|
shadowColor: c,
|
|
4371
|
-
shadowBlur:
|
|
4399
|
+
shadowBlur: u,
|
|
4372
4400
|
shadowOffsetX: d,
|
|
4373
4401
|
shadowOffsetY: l
|
|
4374
4402
|
}), this.context.event.emit(k.SLIDER_LEAVE, _.evt, this.task);
|
|
@@ -4463,7 +4491,7 @@ class We {
|
|
|
4463
4491
|
width: I,
|
|
4464
4492
|
fill: _,
|
|
4465
4493
|
shadowColor: c,
|
|
4466
|
-
shadowBlur:
|
|
4494
|
+
shadowBlur: u,
|
|
4467
4495
|
shadowOffsetX: d,
|
|
4468
4496
|
shadowOffsetY: l,
|
|
4469
4497
|
y: -(H + D) / 2 - i / 2
|
|
@@ -4471,7 +4499,7 @@ class We {
|
|
|
4471
4499
|
!this.sliderBar || this.sliderBar.width() !== o ? (this.sliderBar && this.sliderBar.destroy(), this.sliderBar = W(o), this.slider.add(this.sliderBar)) : this.sliderBar.setAttrs({
|
|
4472
4500
|
fill: _,
|
|
4473
4501
|
shadowColor: c,
|
|
4474
|
-
shadowBlur:
|
|
4502
|
+
shadowBlur: u,
|
|
4475
4503
|
shadowOffsetX: d,
|
|
4476
4504
|
shadowOffsetY: l
|
|
4477
4505
|
}), this.sliderType = "summary";
|
|
@@ -4483,9 +4511,9 @@ class We {
|
|
|
4483
4511
|
width: o,
|
|
4484
4512
|
height: e,
|
|
4485
4513
|
fill: r,
|
|
4486
|
-
cornerRadius:
|
|
4514
|
+
cornerRadius: a
|
|
4487
4515
|
}), this.renderProgress(o, e);
|
|
4488
|
-
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (
|
|
4516
|
+
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (g = this.context.getOptions().bar.move.single) == null ? void 0 : g.backgroundColor, H = D ? B(D).alpha(((x = this.context.getOptions().bar.move.single) == null ? void 0 : x.opacity) ?? 1).toHex() : B(r).brighten(30 * (this.unpackFunc((y = this.context.getOptions().bar.progress) == null ? void 0 : y.show) ? -1 : 1)).alpha(((T = this.context.getOptions().bar.move.single) == null ? void 0 : T.opacity) ?? 1).toHex();
|
|
4489
4517
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
4490
4518
|
if (!this.leftHandleGroup) {
|
|
4491
4519
|
this.leftHandleGroup = new S.Group({
|
|
@@ -4521,7 +4549,7 @@ class We {
|
|
|
4521
4549
|
width: this.handlerWidth,
|
|
4522
4550
|
height: e,
|
|
4523
4551
|
fill: H,
|
|
4524
|
-
cornerRadius: [
|
|
4552
|
+
cornerRadius: [a[0], 0, 0, a[3]]
|
|
4525
4553
|
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
4526
4554
|
x: 0,
|
|
4527
4555
|
y: (e - this.handlerWidth) / 2,
|
|
@@ -4565,7 +4593,7 @@ class We {
|
|
|
4565
4593
|
width: this.handlerWidth,
|
|
4566
4594
|
height: e,
|
|
4567
4595
|
fill: H,
|
|
4568
|
-
cornerRadius: [0,
|
|
4596
|
+
cornerRadius: [0, a[1], a[2], 0]
|
|
4569
4597
|
}), (v = this.rightHandleGroup.findOne("Image")) == null || v.setAttrs({
|
|
4570
4598
|
x: o - this.handlerWidth,
|
|
4571
4599
|
y: (e - this.handlerWidth) / 2,
|
|
@@ -4577,14 +4605,14 @@ class We {
|
|
|
4577
4605
|
}
|
|
4578
4606
|
this.isDragging || this.sliderBar.setAttrs({
|
|
4579
4607
|
shadowColor: c,
|
|
4580
|
-
shadowBlur:
|
|
4608
|
+
shadowBlur: u,
|
|
4581
4609
|
shadowOffsetX: d,
|
|
4582
4610
|
shadowOffsetY: l
|
|
4583
4611
|
}), this.sliderGroup.add(this.slider), this.unpackFunc(this.context.getOptions().bar.show) === !1 ? this.sliderGroup.hide() : this.sliderGroup.show();
|
|
4584
4612
|
}
|
|
4585
4613
|
renderText(t, e) {
|
|
4586
4614
|
const i = `chart-slider-text-${this.task.id}`, s = () => {
|
|
4587
|
-
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((
|
|
4615
|
+
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((a) => a.remove());
|
|
4588
4616
|
};
|
|
4589
4617
|
if (!this.context.getOptions().bar.field && !this.context.getOptions().bar.label) {
|
|
4590
4618
|
s();
|
|
@@ -4595,7 +4623,7 @@ class We {
|
|
|
4595
4623
|
n ? o = this.unpackFunc(n) : this.context.getOptions().bar.field && (o = this.task.getField(this.context.getOptions().bar.field)), s();
|
|
4596
4624
|
const r = t - (this.leftHandleGroup ? this.handlerWidth : 0) - (this.rightHandleGroup ? this.handlerWidth : 0);
|
|
4597
4625
|
if (r > 20) {
|
|
4598
|
-
const
|
|
4626
|
+
const a = new S.Text({
|
|
4599
4627
|
id: i,
|
|
4600
4628
|
x: this.leftHandleGroup ? 10 : 0,
|
|
4601
4629
|
y: 0,
|
|
@@ -4610,32 +4638,32 @@ class We {
|
|
|
4610
4638
|
verticalAlign: this.unpackFunc(this.context.getOptions().bar.verticalAlign) || "middle",
|
|
4611
4639
|
ellipsis: !0
|
|
4612
4640
|
});
|
|
4613
|
-
this.slider.add(
|
|
4641
|
+
this.slider.add(a);
|
|
4614
4642
|
}
|
|
4615
4643
|
}
|
|
4616
4644
|
renderProgress(t, e) {
|
|
4617
|
-
var i, s, n, o, r,
|
|
4645
|
+
var i, s, n, o, r, a, c, u, d, l, m, p;
|
|
4618
4646
|
if (!this.unpackFunc((i = this.context.getOptions().bar.progress) == null ? void 0 : i.show)) {
|
|
4619
4647
|
this.progressGroup && (this.progressGroup.destroy(), this.progressGroup = null);
|
|
4620
4648
|
return;
|
|
4621
4649
|
}
|
|
4622
4650
|
if (this.task.progress) {
|
|
4623
|
-
const
|
|
4651
|
+
const g = qt(
|
|
4624
4652
|
this.task.progress,
|
|
4625
4653
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
4626
4654
|
);
|
|
4627
|
-
if (
|
|
4628
|
-
const
|
|
4655
|
+
if (g === 0) return;
|
|
4656
|
+
const x = this.unpackFunc(
|
|
4629
4657
|
this.context.getOptions().bar.backgroundColor
|
|
4630
|
-
) || this.context.getOptions().primaryColor,
|
|
4658
|
+
) || this.context.getOptions().primaryColor, y = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || B(x).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), T = ot(
|
|
4631
4659
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4632
4660
|
), b = ot(
|
|
4633
4661
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
4634
4662
|
2
|
|
4635
4663
|
// 默认 2
|
|
4636
4664
|
);
|
|
4637
|
-
b[0] = T[0], b[3] = T[3],
|
|
4638
|
-
const w = t *
|
|
4665
|
+
b[0] = T[0], b[3] = T[3], g === 1 && (b[1] = T[1], b[2] = T[2]);
|
|
4666
|
+
const w = t * g;
|
|
4639
4667
|
this.progressGroup ? (this.progressGroup.width(w), this.progressGroup.destroyChildren()) : (this.progressGroup = new S.Group({
|
|
4640
4668
|
x: 0,
|
|
4641
4669
|
y: 0,
|
|
@@ -4648,20 +4676,20 @@ class We {
|
|
|
4648
4676
|
y: 0,
|
|
4649
4677
|
width: w,
|
|
4650
4678
|
height: e,
|
|
4651
|
-
fill:
|
|
4679
|
+
fill: y,
|
|
4652
4680
|
cornerRadius: b,
|
|
4653
|
-
opacity: this.unpackFunc((
|
|
4681
|
+
opacity: this.unpackFunc((a = this.context.getOptions().bar.progress) == null ? void 0 : a.opacity)
|
|
4654
4682
|
});
|
|
4655
4683
|
this.progressGroup.add(C);
|
|
4656
4684
|
const L = `${gt(
|
|
4657
|
-
|
|
4685
|
+
g * 100,
|
|
4658
4686
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4659
|
-
)}%`, E = new S.Text().measureSize(L).width, v = this.unpackFunc((
|
|
4687
|
+
)}%`, E = new S.Text().measureSize(L).width, v = this.unpackFunc((u = this.context.getOptions().bar.progress) == null ? void 0 : u.textAlign), M = new S.Text({
|
|
4660
4688
|
x: 0,
|
|
4661
4689
|
y: v === "top" ? -e : 0,
|
|
4662
4690
|
width: v === "right" ? w + E : Math.max(w, E),
|
|
4663
4691
|
height: e,
|
|
4664
|
-
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(
|
|
4692
|
+
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(y, 50).alpha(0.7).toHex(),
|
|
4665
4693
|
text: L,
|
|
4666
4694
|
fontSize: this.unpackFunc((l = this.context.getOptions().bar.progress) == null ? void 0 : l.fontSize) || 10,
|
|
4667
4695
|
fontStyle: this.unpackFunc((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontStyle) || "italic",
|
|
@@ -4723,12 +4751,12 @@ class We {
|
|
|
4723
4751
|
if (i) {
|
|
4724
4752
|
const s = this.context.getOptions().row.height, n = this.y + this.offsetY, o = n + s;
|
|
4725
4753
|
if (i.y < n || i.y > o) {
|
|
4726
|
-
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)",
|
|
4754
|
+
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", a = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, c = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, u = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4727
4755
|
this.handleBarHighlight({
|
|
4728
4756
|
shadowColor: r,
|
|
4729
|
-
shadowBlur:
|
|
4757
|
+
shadowBlur: a,
|
|
4730
4758
|
shadowOffsetX: c,
|
|
4731
|
-
shadowOffsetY:
|
|
4759
|
+
shadowOffsetY: u
|
|
4732
4760
|
}), this.handleResizeHighlight(0), e.container().style.cursor = "default";
|
|
4733
4761
|
}
|
|
4734
4762
|
}
|
|
@@ -4736,12 +4764,12 @@ class We {
|
|
|
4736
4764
|
this.context.event.emit(k.SLIDER_DRAGGING, !1);
|
|
4737
4765
|
}
|
|
4738
4766
|
handleMove(t, e) {
|
|
4739
|
-
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(),
|
|
4767
|
+
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));
|
|
4740
4768
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4741
|
-
const l = t.target.width(), m = t.target.x(), p = m + l,
|
|
4769
|
+
const l = t.target.width(), m = t.target.x(), p = m + l, g = -this.offsetX, x = g + i, y = this.context.store.getTimeAxis().getTotalWidth(), T = m <= g + this.EDGE_THRESHOLD, b = p >= x - this.EDGE_THRESHOLD;
|
|
4742
4770
|
if (T)
|
|
4743
|
-
if (
|
|
4744
|
-
this.draggingDirection === "left" && t.target.x(-
|
|
4771
|
+
if (g <= 0)
|
|
4772
|
+
this.draggingDirection === "left" && t.target.x(-u), this.stopAutoScroll(), s || (this.draggingDirection === "left" ? this.startAutoExpand("left", -u) : this.stopAutoExpand());
|
|
4745
4773
|
else if (this.draggingDirection === "left") {
|
|
4746
4774
|
const w = n ? -o : -this.SCROLL_STEP;
|
|
4747
4775
|
this.startAutoScroll(
|
|
@@ -4750,13 +4778,13 @@ class We {
|
|
|
4750
4778
|
() => {
|
|
4751
4779
|
t.target.x(t.target.x() + w);
|
|
4752
4780
|
},
|
|
4753
|
-
() => t.target.x(t.target.x() -
|
|
4781
|
+
() => t.target.x(t.target.x() - u)
|
|
4754
4782
|
);
|
|
4755
4783
|
} else
|
|
4756
4784
|
this.stopAutoScroll();
|
|
4757
4785
|
else if (b)
|
|
4758
|
-
if (
|
|
4759
|
-
this.draggingDirection === "right" && t.target.x(
|
|
4786
|
+
if (x >= y)
|
|
4787
|
+
this.draggingDirection === "right" && t.target.x(y - l + d), this.stopAutoScroll(), s || (this.draggingDirection === "right" ? this.startAutoExpand("right", 0, d) : this.stopAutoExpand());
|
|
4760
4788
|
else if (this.draggingDirection === "right") {
|
|
4761
4789
|
const w = n ? o : this.SCROLL_STEP;
|
|
4762
4790
|
this.startAutoScroll(w, n, () => {
|
|
@@ -4771,16 +4799,16 @@ class We {
|
|
|
4771
4799
|
}
|
|
4772
4800
|
// 左右操作拖拽
|
|
4773
4801
|
resizeMove(t, e) {
|
|
4774
|
-
var
|
|
4802
|
+
var x;
|
|
4775
4803
|
t.cancelBubble = !0;
|
|
4776
4804
|
const i = t.target.getStage();
|
|
4777
4805
|
if (!i) return;
|
|
4778
4806
|
this.isDragging = !0, this.context.event.emit(k.SLIDER_DRAGGING, !0);
|
|
4779
|
-
let s = ((
|
|
4780
|
-
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock,
|
|
4781
|
-
let c = 0,
|
|
4807
|
+
let s = ((x = i.getPointerPosition()) == null ? void 0 : x.x) || 0;
|
|
4808
|
+
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, a = i.width();
|
|
4809
|
+
let c = 0, u = 0;
|
|
4782
4810
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4783
|
-
const
|
|
4811
|
+
const y = this.slider.width(), T = this.slider.x(), b = T + y, w = -this.offsetX, C = w + a, L = T <= w + this.EDGE_THRESHOLD, E = b >= C - this.EDGE_THRESHOLD;
|
|
4784
4812
|
if (L && e === "left") {
|
|
4785
4813
|
if (w <= 0)
|
|
4786
4814
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
@@ -4800,7 +4828,7 @@ class We {
|
|
|
4800
4828
|
else if (this.draggingDirection === "right") {
|
|
4801
4829
|
const v = n ? o : this.SCROLL_STEP;
|
|
4802
4830
|
this.startAutoScroll(v, n, () => {
|
|
4803
|
-
|
|
4831
|
+
u += v, this.slider.x(this.slider.x() + v);
|
|
4804
4832
|
});
|
|
4805
4833
|
} else
|
|
4806
4834
|
this.stopAutoScroll();
|
|
@@ -4808,7 +4836,7 @@ class We {
|
|
|
4808
4836
|
} else if (e === "right" && T <= w && b <= w + this.EDGE_THRESHOLD + o) {
|
|
4809
4837
|
const v = n ? -o : -this.SCROLL_STEP;
|
|
4810
4838
|
this.startAutoScroll(v, n, () => {
|
|
4811
|
-
|
|
4839
|
+
u += v, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + v), this.emitUpdate("right");
|
|
4812
4840
|
});
|
|
4813
4841
|
} else if (e === "left" && b >= C && T >= C - this.EDGE_THRESHOLD - o) {
|
|
4814
4842
|
const v = n ? o : this.SCROLL_STEP;
|
|
@@ -4819,16 +4847,16 @@ class We {
|
|
|
4819
4847
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
4820
4848
|
}, this.MOVE_INTERVAL);
|
|
4821
4849
|
let d;
|
|
4822
|
-
const l = this.slider.x(), m = this.slider.width(), p = (
|
|
4850
|
+
const l = this.slider.x(), m = this.slider.width(), p = (y) => {
|
|
4823
4851
|
var w;
|
|
4824
|
-
|
|
4852
|
+
y.movementX > 0 ? this.draggingDirection = "right" : y.movementX < 0 && (this.draggingDirection = "left");
|
|
4825
4853
|
const T = Math.max(((w = i.getPointerPosition()) == null ? void 0 : w.x) || 0, 0);
|
|
4826
4854
|
let b = T - s;
|
|
4827
|
-
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && T <
|
|
4828
|
-
},
|
|
4829
|
-
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup",
|
|
4855
|
+
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && T < a - this.EDGE_THRESHOLD && (this.slider.width(m - b - c), this.slider.x(l + b + c), this.emitUpdate("left")) : m + b + u >= o && T > this.EDGE_THRESHOLD && (this.slider.width(m + b + u), this.emitUpdate("right")), d = b);
|
|
4856
|
+
}, g = () => {
|
|
4857
|
+
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
4830
4858
|
};
|
|
4831
|
-
document.addEventListener("mousemove", p), document.addEventListener("mouseup",
|
|
4859
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
4832
4860
|
}
|
|
4833
4861
|
// 开始自动扩展
|
|
4834
4862
|
startAutoExpand(t, e = 0, i = 0) {
|
|
@@ -4900,20 +4928,20 @@ class We {
|
|
|
4900
4928
|
this.sliderGroup.opacity(t), n.stop();
|
|
4901
4929
|
return;
|
|
4902
4930
|
}
|
|
4903
|
-
const
|
|
4931
|
+
const a = r % e / e;
|
|
4904
4932
|
let c;
|
|
4905
|
-
|
|
4933
|
+
a < 0.5 ? c = t * (1 - a * 2) : c = t * ((a - 0.5) * 2), this.sliderGroup.opacity(Math.max(0, Math.min(t, c)));
|
|
4906
4934
|
}, this.sliderGroup.getLayer());
|
|
4907
4935
|
n.start();
|
|
4908
4936
|
}
|
|
4909
4937
|
}
|
|
4910
4938
|
class $e {
|
|
4911
4939
|
constructor(t, e, i, s, n, o, r) {
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4940
|
+
h(this, "row");
|
|
4941
|
+
h(this, "slider");
|
|
4942
|
+
h(this, "cacheKey", "");
|
|
4915
4943
|
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new S.Group();
|
|
4916
|
-
const
|
|
4944
|
+
const a = new S.Rect({
|
|
4917
4945
|
x: s,
|
|
4918
4946
|
y: n,
|
|
4919
4947
|
width: o,
|
|
@@ -4921,7 +4949,7 @@ class $e {
|
|
|
4921
4949
|
id: i,
|
|
4922
4950
|
listening: !1
|
|
4923
4951
|
});
|
|
4924
|
-
this.row.add(
|
|
4952
|
+
this.row.add(a), this.slider = new We(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
4925
4953
|
}
|
|
4926
4954
|
update(t, e) {
|
|
4927
4955
|
this.slider.update(t, e);
|
|
@@ -4935,24 +4963,24 @@ class $e {
|
|
|
4935
4963
|
}
|
|
4936
4964
|
class Fe {
|
|
4937
4965
|
constructor(t, e, i, s) {
|
|
4938
|
-
|
|
4966
|
+
h(this, "tasks", []);
|
|
4939
4967
|
// 当前渲染的任务列表
|
|
4940
|
-
|
|
4968
|
+
h(this, "rowsGroup");
|
|
4941
4969
|
// 包含所有行的容器
|
|
4942
|
-
|
|
4943
|
-
|
|
4970
|
+
h(this, "rowsCache", /* @__PURE__ */ new Map());
|
|
4971
|
+
h(this, "rowBgGroup");
|
|
4944
4972
|
// 行背景容器
|
|
4945
4973
|
// 状态变量
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4974
|
+
h(this, "width", 0);
|
|
4975
|
+
h(this, "height", 0);
|
|
4976
|
+
h(this, "offsetX", 0);
|
|
4977
|
+
h(this, "offsetY", 0);
|
|
4950
4978
|
// 高亮相关
|
|
4951
|
-
|
|
4952
|
-
|
|
4979
|
+
h(this, "highlightedRowId", null);
|
|
4980
|
+
h(this, "highlightRect", null);
|
|
4953
4981
|
// 选中相关
|
|
4954
|
-
|
|
4955
|
-
|
|
4982
|
+
h(this, "selectedRowId", null);
|
|
4983
|
+
h(this, "selectedRect", null);
|
|
4956
4984
|
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new S.Group({ name: "chart-body-rows" }), this.layer.add(this.rowsGroup), this.rowBgGroup = new S.Group({ name: "chart-body-row-bgs" }), this.bgLayer.add(this.rowBgGroup), this.registerEvents(), this.bindEvents();
|
|
4957
4985
|
}
|
|
4958
4986
|
/**
|
|
@@ -4988,7 +5016,7 @@ class Fe {
|
|
|
4988
5016
|
this.width,
|
|
4989
5017
|
e
|
|
4990
5018
|
), r.setOffset(this.offsetX, this.offsetY), this.rowsGroup.add(r.row), this.rowsCache.set(o, r)), r.cacheKey = i, this.context.store.getDataManager().isTaskSelected(s.id) && this.selectRow(s.id);
|
|
4991
|
-
const
|
|
5019
|
+
const u = new S.Rect({
|
|
4992
5020
|
x: 0,
|
|
4993
5021
|
y: c + this.offsetY,
|
|
4994
5022
|
width: this.width,
|
|
@@ -4998,7 +5026,7 @@ class Fe {
|
|
|
4998
5026
|
listening: !1
|
|
4999
5027
|
// 不需要监听事件
|
|
5000
5028
|
});
|
|
5001
|
-
this.rowBgGroup.add(
|
|
5029
|
+
this.rowBgGroup.add(u), this.rowBgGroup.moveToBottom();
|
|
5002
5030
|
}), this.rowsCache.forEach((s, n) => {
|
|
5003
5031
|
s.cacheKey !== i && (s.destroy(), this.rowsCache.delete(n));
|
|
5004
5032
|
}), this.layer.batchDraw();
|
|
@@ -5183,7 +5211,7 @@ class Fe {
|
|
|
5183
5211
|
if (!this.selectedRect || this.selectedRowId === null) return;
|
|
5184
5212
|
const e = this.rowsCache.get(`chart-row-${this.selectedRowId}`);
|
|
5185
5213
|
if (e)
|
|
5186
|
-
if (this.context.store.getDataManager().
|
|
5214
|
+
if (this.context.store.getDataManager().isTaskVisible(e.task)) {
|
|
5187
5215
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
5188
5216
|
this.selectedRect.y(s + this.offsetY), this.layer.batchDraw();
|
|
5189
5217
|
} else
|
|
@@ -5231,27 +5259,27 @@ class Bt {
|
|
|
5231
5259
|
angle: s = (t == null ? void 0 : t.angle) ?? 30,
|
|
5232
5260
|
spacing: n = (t == null ? void 0 : t.spacing) || 10
|
|
5233
5261
|
} = t || {}, o = s % 180, r = o * Math.PI / 180;
|
|
5234
|
-
let
|
|
5235
|
-
o === 0 ? (
|
|
5236
|
-
const
|
|
5262
|
+
let a, c;
|
|
5263
|
+
o === 0 ? (a = n, c = i + n) : o === 90 ? (a = i + n, c = n) : (a = Math.abs(Math.ceil((i + n) / Math.sin(r))), c = Math.abs(Math.ceil((i + n) / Math.cos(r))));
|
|
5264
|
+
const u = new S.Stage({
|
|
5237
5265
|
container: document.createElement("div"),
|
|
5238
|
-
width:
|
|
5266
|
+
width: a,
|
|
5239
5267
|
height: c
|
|
5240
5268
|
}), d = new S.Layer();
|
|
5241
|
-
|
|
5269
|
+
u.add(d);
|
|
5242
5270
|
const l = new S.Group();
|
|
5243
5271
|
if (o === 0 || o === 90) {
|
|
5244
5272
|
const p = new S.Line({
|
|
5245
|
-
points: [0, 0, o === 0 ?
|
|
5273
|
+
points: [0, 0, o === 0 ? a : 0, o === 0 ? 0 : c],
|
|
5246
5274
|
stroke: e,
|
|
5247
5275
|
strokeWidth: i,
|
|
5248
5276
|
perfectDrawEnabled: !0
|
|
5249
5277
|
});
|
|
5250
5278
|
l.add(p);
|
|
5251
5279
|
} else
|
|
5252
|
-
for (let p = -
|
|
5253
|
-
const
|
|
5254
|
-
points: [Math.ceil(
|
|
5280
|
+
for (let p = -a; p < a * 2; p += a) {
|
|
5281
|
+
const g = p + i / 2, x = 0, y = p + i / 2 + (Math.cos(r) < 0 ? -a : a), T = c, b = new S.Line({
|
|
5282
|
+
points: [Math.ceil(g), Math.ceil(x), Math.ceil(y), Math.ceil(T)],
|
|
5255
5283
|
stroke: e,
|
|
5256
5284
|
strokeWidth: i,
|
|
5257
5285
|
perfectDrawEnabled: !0,
|
|
@@ -5262,7 +5290,7 @@ class Bt {
|
|
|
5262
5290
|
}
|
|
5263
5291
|
d.add(l), d.draw();
|
|
5264
5292
|
const m = new Image();
|
|
5265
|
-
return m.src =
|
|
5293
|
+
return m.src = u.toDataURL(), u.destroy(), m;
|
|
5266
5294
|
}
|
|
5267
5295
|
/**
|
|
5268
5296
|
* 创建圆点图案
|
|
@@ -5272,12 +5300,12 @@ class Bt {
|
|
|
5272
5300
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
5273
5301
|
width: i = (t == null ? void 0 : t.width) || 2,
|
|
5274
5302
|
spacing: s = (t == null ? void 0 : t.spacing) || 4
|
|
5275
|
-
} = t || {}, n = i * 2 + s * 2, o = n, r = B(e),
|
|
5303
|
+
} = t || {}, n = i * 2 + s * 2, o = n, r = B(e), a = new S.Stage({
|
|
5276
5304
|
container: document.createElement("div"),
|
|
5277
5305
|
width: n,
|
|
5278
5306
|
height: o
|
|
5279
5307
|
}), c = new S.Layer();
|
|
5280
|
-
|
|
5308
|
+
a.add(c), [
|
|
5281
5309
|
{ x: s / 2 + i / 2, y: s / 2 + i / 2 },
|
|
5282
5310
|
{
|
|
5283
5311
|
x: n - s / 2 - i / 2,
|
|
@@ -5301,7 +5329,7 @@ class Bt {
|
|
|
5301
5329
|
c.add(m);
|
|
5302
5330
|
}), c.draw();
|
|
5303
5331
|
const d = new Image();
|
|
5304
|
-
return d.src =
|
|
5332
|
+
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5305
5333
|
}
|
|
5306
5334
|
/**
|
|
5307
5335
|
* 创建网格图案
|
|
@@ -5311,42 +5339,42 @@ class Bt {
|
|
|
5311
5339
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
5312
5340
|
width: i = (t == null ? void 0 : t.width) || 1,
|
|
5313
5341
|
spacing: s = (t == null ? void 0 : t.spacing) || 20
|
|
5314
|
-
} = t || {}, n = i + s, o = n, r = n,
|
|
5342
|
+
} = t || {}, n = i + s, o = n, r = n, a = new S.Stage({
|
|
5315
5343
|
container: document.createElement("div"),
|
|
5316
5344
|
width: o,
|
|
5317
5345
|
height: r
|
|
5318
5346
|
}), c = new S.Layer();
|
|
5319
|
-
|
|
5320
|
-
const
|
|
5321
|
-
|
|
5347
|
+
a.add(c);
|
|
5348
|
+
const u = new S.Group();
|
|
5349
|
+
u.add(
|
|
5322
5350
|
new S.Line({
|
|
5323
5351
|
points: [0, 0, o, r],
|
|
5324
5352
|
stroke: e,
|
|
5325
5353
|
strokeWidth: i,
|
|
5326
5354
|
perfectDrawEnabled: !0
|
|
5327
5355
|
})
|
|
5328
|
-
),
|
|
5356
|
+
), u.add(
|
|
5329
5357
|
new S.Line({
|
|
5330
5358
|
points: [0, r, o, 0],
|
|
5331
5359
|
stroke: e,
|
|
5332
5360
|
strokeWidth: i,
|
|
5333
5361
|
perfectDrawEnabled: !0
|
|
5334
5362
|
})
|
|
5335
|
-
), c.add(
|
|
5363
|
+
), c.add(u), c.draw();
|
|
5336
5364
|
const d = new Image();
|
|
5337
|
-
return d.src =
|
|
5365
|
+
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5338
5366
|
}
|
|
5339
5367
|
}
|
|
5340
5368
|
class Be {
|
|
5341
5369
|
constructor(t, e) {
|
|
5342
5370
|
// 状态变量
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5371
|
+
h(this, "width", 0);
|
|
5372
|
+
h(this, "height", 0);
|
|
5373
|
+
h(this, "offsetX", 0);
|
|
5374
|
+
h(this, "offsetY", 0);
|
|
5347
5375
|
// 保存周末
|
|
5348
|
-
|
|
5349
|
-
|
|
5376
|
+
h(this, "weekendGroup");
|
|
5377
|
+
h(this, "patternImage", null);
|
|
5350
5378
|
this.context = t, this.layer = e, this.weekendGroup = new S.Group(), this.layer.add(this.weekendGroup);
|
|
5351
5379
|
}
|
|
5352
5380
|
/**
|
|
@@ -5387,26 +5415,26 @@ class Be {
|
|
|
5387
5415
|
*/
|
|
5388
5416
|
async calculateWeekend() {
|
|
5389
5417
|
if (this.clearWeekend(), !this.context.getOptions().weekend.show) return;
|
|
5390
|
-
const t = this.context.store.getTimeAxis().getStartTime(), e = this.context.store.getTimeAxis().getEndTime(), i = this.context.store.getTimeAxis().getCellUnit(), s = this.context.store.getTimeAxis().getCellWidth(), n = this.context.getOptions().header.height, o = this.context.getOptions().row.height,
|
|
5418
|
+
const t = this.context.store.getTimeAxis().getStartTime(), e = this.context.store.getTimeAxis().getEndTime(), i = this.context.store.getTimeAxis().getCellUnit(), s = this.context.store.getTimeAxis().getCellWidth(), n = this.context.getOptions().header.height, o = this.context.getOptions().row.height, a = this.context.store.getDataManager().getVisibleSize() * o, c = Math.max(0, -this.offsetX), u = c + this.width;
|
|
5391
5419
|
for (let d = t; d <= e; ) {
|
|
5392
5420
|
let l = s;
|
|
5393
5421
|
if (l = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(d)) {
|
|
5394
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(d), p = n,
|
|
5422
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(d), p = n, g = a;
|
|
5395
5423
|
if (m + l < c) {
|
|
5396
5424
|
d = d.add(2, "day");
|
|
5397
5425
|
continue;
|
|
5398
5426
|
}
|
|
5399
|
-
if (m >
|
|
5427
|
+
if (m > u)
|
|
5400
5428
|
break;
|
|
5401
5429
|
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Bt.createPattern(
|
|
5402
5430
|
this.context.getOptions().weekend
|
|
5403
5431
|
));
|
|
5404
|
-
const
|
|
5432
|
+
const y = new S.Rect({
|
|
5405
5433
|
name: "weekend-rect",
|
|
5406
5434
|
x: m,
|
|
5407
5435
|
y: p,
|
|
5408
5436
|
width: l,
|
|
5409
|
-
height:
|
|
5437
|
+
height: g,
|
|
5410
5438
|
// 根据模式设置填充
|
|
5411
5439
|
...this.patternImage ? {
|
|
5412
5440
|
fillPatternImage: this.patternImage,
|
|
@@ -5418,7 +5446,7 @@ class Be {
|
|
|
5418
5446
|
},
|
|
5419
5447
|
opacity: this.context.getOptions().weekend.opacity
|
|
5420
5448
|
});
|
|
5421
|
-
this.weekendGroup.add(
|
|
5449
|
+
this.weekendGroup.add(y), d = d.add(2, "day");
|
|
5422
5450
|
} else
|
|
5423
5451
|
d = d.add(1, "day");
|
|
5424
5452
|
}
|
|
@@ -5427,15 +5455,15 @@ class Be {
|
|
|
5427
5455
|
}
|
|
5428
5456
|
class ze {
|
|
5429
5457
|
constructor(t, e, i) {
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5458
|
+
h(this, "arrowAnimation");
|
|
5459
|
+
h(this, "todayLine");
|
|
5460
|
+
h(this, "todayTextGroup");
|
|
5461
|
+
h(this, "triangle");
|
|
5434
5462
|
// 状态变量
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5463
|
+
h(this, "width", 0);
|
|
5464
|
+
h(this, "height", 0);
|
|
5465
|
+
h(this, "offsetX", 0);
|
|
5466
|
+
h(this, "offsetY", 0);
|
|
5439
5467
|
this.context = t, this.bgLayer = e, this.headerLayer = i;
|
|
5440
5468
|
}
|
|
5441
5469
|
/**
|
|
@@ -5454,7 +5482,7 @@ class ze {
|
|
|
5454
5482
|
* 渲染今日线
|
|
5455
5483
|
*/
|
|
5456
5484
|
render() {
|
|
5457
|
-
var d, l, m, p,
|
|
5485
|
+
var d, l, m, p, g, x, y;
|
|
5458
5486
|
const t = Object.assign(
|
|
5459
5487
|
{
|
|
5460
5488
|
show: !0,
|
|
@@ -5469,18 +5497,18 @@ class ze {
|
|
|
5469
5497
|
let e = G();
|
|
5470
5498
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
5471
5499
|
t.type === "block" && (e = e.startOf(i));
|
|
5472
|
-
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(),
|
|
5473
|
-
if (this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(
|
|
5500
|
+
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;
|
|
5501
|
+
if (this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(u)) : (this.todayLine = new S.Line({
|
|
5474
5502
|
points: c,
|
|
5475
5503
|
stroke: r,
|
|
5476
|
-
strokeWidth:
|
|
5504
|
+
strokeWidth: u
|
|
5477
5505
|
}), this.bgLayer.add(this.todayLine)), (d = this.context.getOptions().today.text) != null && d.show) {
|
|
5478
|
-
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.fontFamily) || "Arial", w = ((p = this.context.getOptions().today.text) == null ? void 0 : p.content) || "今天", C = new S.Text({ fontSize: T, fontFamily: b }).measureSize(w), L = ((
|
|
5506
|
+
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.fontFamily) || "Arial", w = ((p = this.context.getOptions().today.text) == null ? void 0 : p.content) || "今天", C = new S.Text({ fontSize: T, fontFamily: b }).measureSize(w), L = ((g = this.context.getOptions().today.text) == null ? void 0 : g.color) || "white", E = ((x = this.context.getOptions().today.text) == null ? void 0 : x.backgroundColor) || r;
|
|
5479
5507
|
if (!this.todayTextGroup)
|
|
5480
5508
|
this.todayTextGroup = new S.Group({
|
|
5481
|
-
x: s + this.offsetX +
|
|
5509
|
+
x: s + this.offsetX + u,
|
|
5482
5510
|
y: o,
|
|
5483
|
-
opacity: (
|
|
5511
|
+
opacity: (y = this.context.getOptions().today.text) == null ? void 0 : y.opacity
|
|
5484
5512
|
}), this.todayTextGroup.add(new S.Rect({
|
|
5485
5513
|
x: 0,
|
|
5486
5514
|
y: 0,
|
|
@@ -5502,7 +5530,7 @@ class ze {
|
|
|
5502
5530
|
name: "today-text"
|
|
5503
5531
|
})), this.bgLayer.add(this.todayTextGroup);
|
|
5504
5532
|
else {
|
|
5505
|
-
this.todayTextGroup.x(s + this.offsetX +
|
|
5533
|
+
this.todayTextGroup.x(s + this.offsetX + u);
|
|
5506
5534
|
const v = this.todayTextGroup.findOne(".today-text");
|
|
5507
5535
|
v == null || v.setAttrs({
|
|
5508
5536
|
text: w,
|
|
@@ -5519,8 +5547,8 @@ class ze {
|
|
|
5519
5547
|
});
|
|
5520
5548
|
}
|
|
5521
5549
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
5522
|
-
t.type === "line" && (this.triangle ? (this.triangle.x(
|
|
5523
|
-
x:
|
|
5550
|
+
t.type === "line" && (this.triangle ? (this.triangle.x(a), this.triangle.fill(r)) : (this.triangle = new S.RegularPolygon({
|
|
5551
|
+
x: a,
|
|
5524
5552
|
y: o - 8,
|
|
5525
5553
|
sides: 3,
|
|
5526
5554
|
radius: 8,
|
|
@@ -5544,13 +5572,13 @@ class ze {
|
|
|
5544
5572
|
class Ne {
|
|
5545
5573
|
constructor(t, e) {
|
|
5546
5574
|
// 状态变量
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5575
|
+
h(this, "width", 0);
|
|
5576
|
+
h(this, "height", 0);
|
|
5577
|
+
h(this, "offsetX", 0);
|
|
5578
|
+
h(this, "offsetY", 0);
|
|
5551
5579
|
// 保存假期
|
|
5552
|
-
|
|
5553
|
-
|
|
5580
|
+
h(this, "holidayGroup");
|
|
5581
|
+
h(this, "patternImage", /* @__PURE__ */ new WeakMap());
|
|
5554
5582
|
this.context = t, this.layer = e, this.holidayGroup = new S.Group(), this.layer.add(this.holidayGroup);
|
|
5555
5583
|
}
|
|
5556
5584
|
/**
|
|
@@ -5584,13 +5612,13 @@ class Ne {
|
|
|
5584
5612
|
* 计算假期
|
|
5585
5613
|
*/
|
|
5586
5614
|
async calculateHoliday() {
|
|
5587
|
-
var d, l, m, p,
|
|
5615
|
+
var d, l, m, p, g, x, y, T;
|
|
5588
5616
|
if (this.clearHoliday(), !this.context.getOptions().holiday.show) return;
|
|
5589
5617
|
const t = this.context.getOptions().holiday.holidays;
|
|
5590
5618
|
if (!t || t.length === 0) return;
|
|
5591
5619
|
const e = Math.max(0, -this.offsetX), i = e + this.width, s = this.context.store.getTimeAxis().getStartTime(), n = this.context.store.getTimeAxis().getEndTime();
|
|
5592
5620
|
this.context.store.getTimeAxis().getCellUnit();
|
|
5593
|
-
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height,
|
|
5621
|
+
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height, a = this.context.getOptions().row.height, u = this.context.store.getDataManager().getVisibleSize() * a;
|
|
5594
5622
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5595
5623
|
const w = t.find((C) => {
|
|
5596
5624
|
if (X(C.date)) {
|
|
@@ -5600,7 +5628,7 @@ class Ne {
|
|
|
5600
5628
|
return C;
|
|
5601
5629
|
});
|
|
5602
5630
|
if (w) {
|
|
5603
|
-
const C = this.context.store.getTimeAxis().getTimeLeft(b), L = r, E =
|
|
5631
|
+
const C = this.context.store.getTimeAxis().getTimeLeft(b), L = r, E = u;
|
|
5604
5632
|
if (C + o < e)
|
|
5605
5633
|
continue;
|
|
5606
5634
|
if (C > i)
|
|
@@ -5634,7 +5662,7 @@ class Ne {
|
|
|
5634
5662
|
if (this.holidayGroup.add(M), (d = w.text) != null && d.show) {
|
|
5635
5663
|
if (X(w.date) && !G(w.date[0]).isSame(b, "day"))
|
|
5636
5664
|
continue;
|
|
5637
|
-
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "", H = new S.Text({ fontSize: A, fontFamily: _ }).measureSize(D), W = ((
|
|
5665
|
+
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "", H = new S.Text({ fontSize: A, fontFamily: _ }).measureSize(D), W = ((g = w.text) == null ? void 0 : g.color) || "white", I = ((x = w.text) == null ? void 0 : x.backgroundColor) || w.backgroundColor || ((y = this.context.getOptions().holiday) == null ? void 0 : y.backgroundColor) || this.context.getOptions().primaryColor, R = new S.Group({
|
|
5638
5666
|
name: "holiday-text-group",
|
|
5639
5667
|
x: C,
|
|
5640
5668
|
y: L,
|
|
@@ -5662,12 +5690,12 @@ class Ne {
|
|
|
5662
5690
|
class Pe {
|
|
5663
5691
|
constructor(t, e) {
|
|
5664
5692
|
// 状态变量
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5693
|
+
h(this, "width", 0);
|
|
5694
|
+
h(this, "height", 0);
|
|
5695
|
+
h(this, "offsetX", 0);
|
|
5696
|
+
h(this, "offsetY", 0);
|
|
5669
5697
|
// 保存标志日期渲染组
|
|
5670
|
-
|
|
5698
|
+
h(this, "flagGroup");
|
|
5671
5699
|
this.context = t, this.layer = e, this.flagGroup = new S.Group(), this.layer.add(this.flagGroup);
|
|
5672
5700
|
}
|
|
5673
5701
|
/**
|
|
@@ -5701,16 +5729,16 @@ class Pe {
|
|
|
5701
5729
|
* 计算标志日期
|
|
5702
5730
|
*/
|
|
5703
5731
|
async calculateFlag() {
|
|
5704
|
-
var d, l, m, p,
|
|
5732
|
+
var d, l, m, p, g, x, y;
|
|
5705
5733
|
if (this.clearFlag(), !((d = this.context.getOptions().flag) != null && d.show)) return;
|
|
5706
5734
|
const t = (l = this.context.getOptions().flag) == null ? void 0 : l.data;
|
|
5707
5735
|
if (!t || t.length === 0) return;
|
|
5708
|
-
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 = ((
|
|
5736
|
+
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 = ((x = this.context.getOptions().flag) == null ? void 0 : x.fontFamily) || "Arial", o = ((y = this.context.getOptions().flag) == null ? void 0 : y.fontSize) || 10, r = Math.max(0, -this.offsetX), a = r + this.width, c = this.context.store.getTimeAxis().getCellWidth(), u = this.context.getOptions().header.height;
|
|
5709
5737
|
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((T) => {
|
|
5710
|
-
const b = G(T.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C =
|
|
5711
|
-
if (w + c < r || w >
|
|
5738
|
+
const b = G(T.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = u;
|
|
5739
|
+
if (w + c < r || w > a)
|
|
5712
5740
|
return;
|
|
5713
|
-
const E = [w,
|
|
5741
|
+
const E = [w, u, w, this.height], v = new S.Line({
|
|
5714
5742
|
points: E,
|
|
5715
5743
|
stroke: T.backgroundColor || e,
|
|
5716
5744
|
opacity: T.opacity || i,
|
|
@@ -5789,24 +5817,24 @@ class Pe {
|
|
|
5789
5817
|
}
|
|
5790
5818
|
class Ye {
|
|
5791
5819
|
constructor(t, e, i) {
|
|
5792
|
-
|
|
5820
|
+
h(this, "tasks", []);
|
|
5793
5821
|
// 创建点组
|
|
5794
|
-
|
|
5822
|
+
h(this, "pointGroup");
|
|
5795
5823
|
// 关联线组
|
|
5796
|
-
|
|
5824
|
+
h(this, "linksGroup");
|
|
5797
5825
|
// 临时箭头
|
|
5798
|
-
|
|
5826
|
+
h(this, "templateArrow");
|
|
5799
5827
|
// 对所有已存在的连线进行缓存
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5828
|
+
h(this, "linkCache", /* @__PURE__ */ new Map());
|
|
5829
|
+
h(this, "isDragging", !1);
|
|
5830
|
+
h(this, "isSliderMoving", !1);
|
|
5803
5831
|
// 选中的连线
|
|
5804
|
-
|
|
5832
|
+
h(this, "selectedMap", /* @__PURE__ */ new Map());
|
|
5805
5833
|
// 状态变量
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5834
|
+
h(this, "width", 0);
|
|
5835
|
+
h(this, "height", 0);
|
|
5836
|
+
h(this, "offsetX", 0);
|
|
5837
|
+
h(this, "offsetY", 0);
|
|
5810
5838
|
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new S.Group({ name: "links-group" }), this.pointGroup = new S.Group({ name: "point-group" }), this.templateArrow = new S.Arrow({
|
|
5811
5839
|
points: [],
|
|
5812
5840
|
stroke: this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
@@ -5868,32 +5896,32 @@ class Ye {
|
|
|
5868
5896
|
* 计算点组位置
|
|
5869
5897
|
*/
|
|
5870
5898
|
calculatePoints(t) {
|
|
5871
|
-
var
|
|
5899
|
+
var u, d;
|
|
5872
5900
|
if (!this.context.getOptions().links.show || !this.context.getOptions().links.create.enabled) {
|
|
5873
5901
|
this.pointGroup.destroyChildren();
|
|
5874
5902
|
return;
|
|
5875
5903
|
}
|
|
5876
|
-
t ? ((
|
|
5877
|
-
const e = this.context.getOptions().header.height, i = this.context.getOptions().row.height, s = i / 2 + e, n = this.context.getOptions().links.create.radius, o = this.context.getOptions().links.create.mode === "always" ? 0.5 : 0, r = this.context.getOptions().links.create.color || this.context.getOptions().primaryColor,
|
|
5904
|
+
t ? ((u = this.pointGroup.findOne(`#point-${t.id}-left`)) == null || u.destroy(), (d = this.pointGroup.findOne(`#point-${t.id}-right`)) == null || d.destroy()) : this.pointGroup.destroyChildren();
|
|
5905
|
+
const e = this.context.getOptions().header.height, i = this.context.getOptions().row.height, s = i / 2 + e, n = this.context.getOptions().links.create.radius, o = this.context.getOptions().links.create.mode === "always" ? 0.5 : 0, r = this.context.getOptions().links.create.color || this.context.getOptions().primaryColor, a = B(r).alpha(this.context.getOptions().links.create.opacity ?? 1).toHex(), c = this.context.getOptions().links.create.width;
|
|
5878
5906
|
this.tasks.forEach((l) => {
|
|
5879
5907
|
if (!(t && l.id !== t.id) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, l) && l.startTime && l.endTime) {
|
|
5880
5908
|
const m = this.context.store.getTimeAxis().getTimeLeft(l.startTime), p = this.context.store.getTimeAxis().getTimeLeft(l.endTime);
|
|
5881
|
-
let
|
|
5882
|
-
l.isMilestone() && (
|
|
5883
|
-
const
|
|
5884
|
-
let
|
|
5885
|
-
if (ht(b) ?
|
|
5909
|
+
let g = this.context.getOptions().links.gap;
|
|
5910
|
+
l.isMilestone() && (g += i / 2);
|
|
5911
|
+
const x = s + i * l.flatIndex;
|
|
5912
|
+
let y = !0, T = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
5913
|
+
if (ht(b) ? y = T = b : K(b) && (y = b === "S", T = b === "F"), y) {
|
|
5886
5914
|
const w = new S.Circle({
|
|
5887
5915
|
id: `point-${l.id}-left`,
|
|
5888
|
-
x: m -
|
|
5889
|
-
y,
|
|
5916
|
+
x: m - g,
|
|
5917
|
+
y: x,
|
|
5890
5918
|
radius: n,
|
|
5891
5919
|
opacity: o,
|
|
5892
|
-
stroke:
|
|
5920
|
+
stroke: a,
|
|
5893
5921
|
strokeWidth: c
|
|
5894
5922
|
});
|
|
5895
5923
|
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
5896
|
-
this.isDragging = !0, this.createLink(C, "S", r, [m -
|
|
5924
|
+
this.isDragging = !0, this.createLink(C, "S", r, [m - g, x], l.id);
|
|
5897
5925
|
}), w.on("mouseover", (C) => {
|
|
5898
5926
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5899
5927
|
}), w.on("mouseout", (C) => {
|
|
@@ -5903,15 +5931,15 @@ class Ye {
|
|
|
5903
5931
|
if (T) {
|
|
5904
5932
|
const w = new S.Circle({
|
|
5905
5933
|
id: `point-${l.id}-right`,
|
|
5906
|
-
x: p +
|
|
5907
|
-
y,
|
|
5934
|
+
x: p + g,
|
|
5935
|
+
y: x,
|
|
5908
5936
|
radius: n,
|
|
5909
5937
|
opacity: o,
|
|
5910
|
-
stroke:
|
|
5938
|
+
stroke: a,
|
|
5911
5939
|
strokeWidth: c
|
|
5912
5940
|
});
|
|
5913
5941
|
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
5914
|
-
this.isDragging = !0, this.createLink(C, "F", r, [p +
|
|
5942
|
+
this.isDragging = !0, this.createLink(C, "F", r, [p + g, x], l.id);
|
|
5915
5943
|
}), w.on("mouseover", (C) => {
|
|
5916
5944
|
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
5917
5945
|
}), w.on("mouseout", (C) => {
|
|
@@ -5940,7 +5968,7 @@ class Ye {
|
|
|
5940
5968
|
});
|
|
5941
5969
|
const i = Q();
|
|
5942
5970
|
e.forEach((s) => {
|
|
5943
|
-
var
|
|
5971
|
+
var u, d, l, m, p, g, x, y;
|
|
5944
5972
|
if (s.valid === !1) return;
|
|
5945
5973
|
const n = this.createId(s), o = this.context.store.getDataManager().getTaskById(s.from), r = this.context.store.getDataManager().getTaskById(s.to);
|
|
5946
5974
|
if (!o) {
|
|
@@ -5959,13 +5987,13 @@ class Ye {
|
|
|
5959
5987
|
}
|
|
5960
5988
|
if (!this.context.store.getDataManager().isTaskVisible(o) || !this.context.store.getDataManager().isTaskVisible(r) || o.flatIndex < this.tasks[0].flatIndex && r.flatIndex < this.tasks[0].flatIndex || o.flatIndex > this.tasks[this.tasks.length - 1].flatIndex && r.flatIndex > this.tasks[this.tasks.length - 1].flatIndex)
|
|
5961
5989
|
return;
|
|
5962
|
-
const
|
|
5963
|
-
if (!(this.context.store.getTimeAxis().getTimeLeft(((
|
|
5990
|
+
const a = Math.max(0, -this.offsetX), c = a + this.width;
|
|
5991
|
+
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)) {
|
|
5964
5992
|
const T = this.getPoints(o, r, s);
|
|
5965
5993
|
if (T.length <= 2)
|
|
5966
5994
|
O.warn("The link position has some error.", s);
|
|
5967
5995
|
else {
|
|
5968
|
-
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 = ((
|
|
5996
|
+
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, L = s.width ?? this.context.getOptions().links.width;
|
|
5969
5997
|
let E = this.linkCache.get(n);
|
|
5970
5998
|
E === void 0 && (E = new S.Group({ id: n })), t != null && t.length || (E._ = i);
|
|
5971
5999
|
const v = E.findOne("Circle");
|
|
@@ -6015,7 +6043,7 @@ class Ye {
|
|
|
6015
6043
|
W.points(D), W.stroke(
|
|
6016
6044
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6017
6045
|
), W.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), W.pointerLength(C), W.pointerWidth(w), W.fill(
|
|
6018
|
-
((
|
|
6046
|
+
((x = s.arrow) == null ? void 0 : x.color) || this.context.getOptions().links.arrow.color || s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
6019
6047
|
), W.lineJoin("round"), W.dash(s.dash || this.context.getOptions().links.dash);
|
|
6020
6048
|
else {
|
|
6021
6049
|
const I = new S.Arrow({
|
|
@@ -6024,7 +6052,7 @@ class Ye {
|
|
|
6024
6052
|
strokeWidth: L,
|
|
6025
6053
|
pointerLength: C,
|
|
6026
6054
|
pointerWidth: w,
|
|
6027
|
-
fill: ((
|
|
6055
|
+
fill: ((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,
|
|
6028
6056
|
// 箭头填充色
|
|
6029
6057
|
lineJoin: "round",
|
|
6030
6058
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
@@ -6091,21 +6119,21 @@ class Ye {
|
|
|
6091
6119
|
}
|
|
6092
6120
|
getPoints(t, e, i) {
|
|
6093
6121
|
if (t.startTime && t.endTime && e.startTime && e.endTime) {
|
|
6094
|
-
const s = this.context.getOptions().row.height, n = t.isMilestone() ? s / 2 : 0, o = this.context.store.getTimeAxis().getTimeLeft(t.startTime) - n, r = this.context.store.getTimeAxis().getTimeLeft(t.endTime) + n,
|
|
6122
|
+
const s = this.context.getOptions().row.height, n = t.isMilestone() ? s / 2 : 0, o = this.context.store.getTimeAxis().getTimeLeft(t.startTime) - n, r = this.context.store.getTimeAxis().getTimeLeft(t.endTime) + n, a = e.isMilestone() ? s / 2 : 0, c = this.context.store.getTimeAxis().getTimeLeft(e.startTime) - a, u = this.context.store.getTimeAxis().getTimeLeft(e.endTime) + a;
|
|
6095
6123
|
let d = [];
|
|
6096
6124
|
switch (i.type || "FS") {
|
|
6097
6125
|
case "FF":
|
|
6098
|
-
d = this.createFF(i, t, e, o, r, c,
|
|
6126
|
+
d = this.createFF(i, t, e, o, r, c, u);
|
|
6099
6127
|
break;
|
|
6100
6128
|
case "SS":
|
|
6101
|
-
d = this.createSS(i, t, e, o, r, c,
|
|
6129
|
+
d = this.createSS(i, t, e, o, r, c, u);
|
|
6102
6130
|
break;
|
|
6103
6131
|
case "SF":
|
|
6104
|
-
d = this.createSF(i, t, e, o, r, c,
|
|
6132
|
+
d = this.createSF(i, t, e, o, r, c, u);
|
|
6105
6133
|
break;
|
|
6106
6134
|
case "FS":
|
|
6107
6135
|
default:
|
|
6108
|
-
d = this.createFS(i, t, e, o, r, c,
|
|
6136
|
+
d = this.createFS(i, t, e, o, r, c, u);
|
|
6109
6137
|
}
|
|
6110
6138
|
return d;
|
|
6111
6139
|
}
|
|
@@ -6113,108 +6141,108 @@ class Ye {
|
|
|
6113
6141
|
}
|
|
6114
6142
|
/** 生成 FS 连线 */
|
|
6115
6143
|
createFS(t, e, i, s, n, o, r) {
|
|
6116
|
-
const
|
|
6144
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6117
6145
|
n + d,
|
|
6118
|
-
0.05 +
|
|
6146
|
+
0.05 + u + c * e.flatIndex
|
|
6119
6147
|
];
|
|
6120
6148
|
{
|
|
6121
6149
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6122
6150
|
if (isNaN(m))
|
|
6123
6151
|
O.error("Link's distance must be a Numeric");
|
|
6124
6152
|
else {
|
|
6125
|
-
const p = n + d + m,
|
|
6126
|
-
Math.max(p,
|
|
6127
|
-
|
|
6153
|
+
const p = n + d + m, g = o - d - m, x = [
|
|
6154
|
+
Math.max(p, g),
|
|
6155
|
+
u + c * e.flatIndex
|
|
6128
6156
|
];
|
|
6129
|
-
l.push(...
|
|
6130
|
-
const
|
|
6131
|
-
l.push(
|
|
6157
|
+
l.push(...x);
|
|
6158
|
+
const y = c * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6159
|
+
l.push(x[0], y), l.push(g, y), l.push(g, u + c * i.flatIndex);
|
|
6132
6160
|
}
|
|
6133
6161
|
}
|
|
6134
|
-
return l.push(o - d,
|
|
6162
|
+
return l.push(o - d, u + c * i.flatIndex), l;
|
|
6135
6163
|
}
|
|
6136
6164
|
/** 生成 FF 连线 */
|
|
6137
6165
|
createFF(t, e, i, s, n, o, r) {
|
|
6138
|
-
const
|
|
6166
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6139
6167
|
n + d,
|
|
6140
|
-
0.05 +
|
|
6168
|
+
0.05 + u + c * e.flatIndex
|
|
6141
6169
|
];
|
|
6142
6170
|
{
|
|
6143
6171
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6144
6172
|
if (isNaN(m))
|
|
6145
6173
|
O.error("Link's distance must be a Numeric");
|
|
6146
6174
|
else {
|
|
6147
|
-
const p = n + d + m,
|
|
6148
|
-
p <=
|
|
6149
|
-
|
|
6175
|
+
const p = n + d + m, g = r + d + m, x = [
|
|
6176
|
+
p <= g ? g : p,
|
|
6177
|
+
u + c * e.flatIndex
|
|
6150
6178
|
];
|
|
6151
|
-
l.push(...
|
|
6152
|
-
Math.max(
|
|
6153
|
-
|
|
6179
|
+
l.push(...x), l.push(
|
|
6180
|
+
Math.max(g, p),
|
|
6181
|
+
u + c * i.flatIndex
|
|
6154
6182
|
);
|
|
6155
6183
|
}
|
|
6156
6184
|
}
|
|
6157
|
-
return l.push(r + d,
|
|
6185
|
+
return l.push(r + d, u + c * i.flatIndex), l;
|
|
6158
6186
|
}
|
|
6159
6187
|
/** 生成 SS 连线 */
|
|
6160
6188
|
createSS(t, e, i, s, n, o, r) {
|
|
6161
|
-
const
|
|
6189
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6162
6190
|
s - d,
|
|
6163
|
-
0.05 +
|
|
6191
|
+
0.05 + u + c * e.flatIndex
|
|
6164
6192
|
];
|
|
6165
6193
|
{
|
|
6166
6194
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6167
6195
|
if (isNaN(m))
|
|
6168
6196
|
O.error("Link's distance must be a Numeric");
|
|
6169
6197
|
else {
|
|
6170
|
-
const p = s - d - m,
|
|
6198
|
+
const p = s - d - m, g = o - d - m;
|
|
6171
6199
|
l.push(
|
|
6172
|
-
Math.min(
|
|
6173
|
-
|
|
6200
|
+
Math.min(g, p),
|
|
6201
|
+
u + c * e.flatIndex
|
|
6174
6202
|
), l.push(
|
|
6175
|
-
Math.min(
|
|
6176
|
-
|
|
6203
|
+
Math.min(g, p),
|
|
6204
|
+
u + c * i.flatIndex
|
|
6177
6205
|
);
|
|
6178
6206
|
}
|
|
6179
6207
|
}
|
|
6180
|
-
return l.push(o - d,
|
|
6208
|
+
return l.push(o - d, u + c * i.flatIndex), l;
|
|
6181
6209
|
}
|
|
6182
6210
|
/** 生成 SF 连线 */
|
|
6183
6211
|
createSF(t, e, i, s, n, o, r) {
|
|
6184
|
-
const
|
|
6212
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6185
6213
|
s - d,
|
|
6186
|
-
0.05 +
|
|
6214
|
+
0.05 + u + c * e.flatIndex
|
|
6187
6215
|
];
|
|
6188
6216
|
{
|
|
6189
6217
|
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
6190
6218
|
if (isNaN(m))
|
|
6191
6219
|
O.error("Link's distance must be a Numeric");
|
|
6192
6220
|
else {
|
|
6193
|
-
const p = s - d - m,
|
|
6194
|
-
Math.min(p,
|
|
6195
|
-
|
|
6221
|
+
const p = s - d - m, g = r + d + m, x = [
|
|
6222
|
+
Math.min(p, g),
|
|
6223
|
+
u + c * e.flatIndex
|
|
6196
6224
|
];
|
|
6197
|
-
l.push(...
|
|
6198
|
-
const
|
|
6199
|
-
l.push(
|
|
6225
|
+
l.push(...x);
|
|
6226
|
+
const y = c * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6227
|
+
l.push(x[0], y), l.push(g, y), l.push(g, u + c * i.flatIndex);
|
|
6200
6228
|
}
|
|
6201
6229
|
}
|
|
6202
|
-
return l.push(r + d,
|
|
6230
|
+
return l.push(r + d, u + c * i.flatIndex), l;
|
|
6203
6231
|
}
|
|
6204
6232
|
/**
|
|
6205
6233
|
* 处理连线被点击后的移动
|
|
6206
6234
|
*/
|
|
6207
6235
|
handleDrag(t, e, i, s, n) {
|
|
6208
|
-
var
|
|
6236
|
+
var x, y, T;
|
|
6209
6237
|
if (!this.isDragging || this.context.getOptions().links.move.enabled !== !0) return;
|
|
6210
6238
|
this.stage.container().style.cursor = "pointer";
|
|
6211
6239
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
6212
6240
|
this.templateArrow.setAttrs({
|
|
6213
6241
|
stroke: e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6214
6242
|
strokeWidth: e.width ?? this.context.getOptions().links.width,
|
|
6215
|
-
pointerLength: ((
|
|
6243
|
+
pointerLength: ((x = e.arrow) == null ? void 0 : x.height) ?? this.context.getOptions().links.arrow.height,
|
|
6216
6244
|
// 箭头长度
|
|
6217
|
-
pointerWidth: ((
|
|
6245
|
+
pointerWidth: ((y = e.arrow) == null ? void 0 : y.width) ?? this.context.getOptions().links.arrow.width,
|
|
6218
6246
|
// 箭头宽度
|
|
6219
6247
|
fill: ((T = e.arrow) == null ? void 0 : T.color) || this.context.getOptions().links.arrow.color || e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6220
6248
|
// 箭头填充色
|
|
@@ -6222,7 +6250,7 @@ class Ye {
|
|
|
6222
6250
|
dash: e.data || this.context.getOptions().links.dash
|
|
6223
6251
|
}), this.templateArrow.visible(!1);
|
|
6224
6252
|
let r = null;
|
|
6225
|
-
const
|
|
6253
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = e.gap || this.context.getOptions().links.gap;
|
|
6226
6254
|
let l = null;
|
|
6227
6255
|
const m = () => {
|
|
6228
6256
|
const b = this.stage.getPointerPosition();
|
|
@@ -6235,7 +6263,7 @@ class Ye {
|
|
|
6235
6263
|
const { allowLeft: M, allowRight: A } = this.isAllowStartDrop(l, e.to, v);
|
|
6236
6264
|
this.templateArrow.points([
|
|
6237
6265
|
E,
|
|
6238
|
-
|
|
6266
|
+
u + c * l.flatIndex,
|
|
6239
6267
|
...s
|
|
6240
6268
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6241
6269
|
} else if (i === "F") {
|
|
@@ -6243,7 +6271,7 @@ class Ye {
|
|
|
6243
6271
|
this.templateArrow.points([
|
|
6244
6272
|
...s,
|
|
6245
6273
|
E,
|
|
6246
|
-
|
|
6274
|
+
u + c * l.flatIndex
|
|
6247
6275
|
]), M ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6248
6276
|
}
|
|
6249
6277
|
}
|
|
@@ -6258,10 +6286,10 @@ class Ye {
|
|
|
6258
6286
|
} else
|
|
6259
6287
|
this.context.event.emit(k.ERROR, Y.TASK_NOT_FOUND);
|
|
6260
6288
|
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);
|
|
6261
|
-
},
|
|
6262
|
-
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown",
|
|
6289
|
+
}, g = (b) => {
|
|
6290
|
+
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", g));
|
|
6263
6291
|
};
|
|
6264
|
-
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown",
|
|
6292
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown", g);
|
|
6265
6293
|
}
|
|
6266
6294
|
/**
|
|
6267
6295
|
* 处理连线被点击后的移动
|
|
@@ -6280,42 +6308,42 @@ class Ye {
|
|
|
6280
6308
|
}), this.templateArrow.visible(!1);
|
|
6281
6309
|
const o = this.context.store.getLinkManager();
|
|
6282
6310
|
let r = null;
|
|
6283
|
-
const
|
|
6311
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, u = c / 2 + a, d = this.context.getOptions().links.gap;
|
|
6284
6312
|
let l = null;
|
|
6285
6313
|
const m = () => {
|
|
6286
|
-
const
|
|
6287
|
-
if (
|
|
6288
|
-
const
|
|
6289
|
-
let w =
|
|
6290
|
-
|
|
6314
|
+
const x = this.stage.getPointerPosition();
|
|
6315
|
+
if (x && (l = this.getTaskByPosition(x), !!l && (this.templateArrow.visible(!0), l.startTime && l.endTime))) {
|
|
6316
|
+
const y = this.context.store.getTimeAxis().getTimeLeft(l.startTime), T = this.context.store.getTimeAxis().getTimeLeft(l.endTime), b = (T + y) / 2 + this.offsetX;
|
|
6317
|
+
let w = y - d;
|
|
6318
|
+
x.x <= b ? r = "S" : (r = "F", w = T + d), this.templateArrow.points([
|
|
6291
6319
|
...s,
|
|
6292
6320
|
w,
|
|
6293
|
-
|
|
6321
|
+
u + c * l.flatIndex
|
|
6294
6322
|
]);
|
|
6295
6323
|
const { allowLeft: C, allowRight: L } = this.isAllowEndDrop(l, n, o.convertPointsToLinkType(e, r));
|
|
6296
6324
|
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !L ? this.stage.container().style.cursor = "not-allowed" : this.stage.container().style.cursor = "pointer";
|
|
6297
6325
|
}
|
|
6298
6326
|
}, p = () => {
|
|
6299
|
-
let
|
|
6300
|
-
if (r && (
|
|
6301
|
-
if (o.isLinkExist(n, l.id,
|
|
6327
|
+
let x;
|
|
6328
|
+
if (r && (x = o.convertPointsToLinkType(e, r)), x && l)
|
|
6329
|
+
if (o.isLinkExist(n, l.id, x))
|
|
6302
6330
|
this.context.event.emit(k.ERROR, Y.LINK_EXIST);
|
|
6303
6331
|
else if (n === l.id && e === r)
|
|
6304
6332
|
this.context.event.emit(k.ERROR, Y.LINK_SAME);
|
|
6305
6333
|
else {
|
|
6306
|
-
const { allowLeft:
|
|
6307
|
-
r === "S" &&
|
|
6334
|
+
const { allowLeft: y, allowRight: T, reason: b } = this.isAllowEndDrop(l, n, x, !0);
|
|
6335
|
+
r === "S" && y || r === "F" && T ? (this.context.event.emit(k.CREATE_LINK, {
|
|
6308
6336
|
from: n,
|
|
6309
6337
|
to: l.id,
|
|
6310
|
-
type:
|
|
6338
|
+
type: x,
|
|
6311
6339
|
color: i
|
|
6312
6340
|
}), this.context.store.getLinkManager().update()) : this.context.event.emit(k.ERROR, b || Y.LINK_NOT_ALLOWED);
|
|
6313
6341
|
}
|
|
6314
|
-
this.cleanupTempLink(), this.calculateLinks([l].filter((
|
|
6315
|
-
},
|
|
6316
|
-
|
|
6342
|
+
this.cleanupTempLink(), this.calculateLinks([l].filter((y) => !!y)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6343
|
+
}, g = (x) => {
|
|
6344
|
+
x.key === "Escape" && (this.cleanupTempLink(), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", g));
|
|
6317
6345
|
};
|
|
6318
|
-
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown",
|
|
6346
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p), document.addEventListener("keydown", g);
|
|
6319
6347
|
}
|
|
6320
6348
|
/**
|
|
6321
6349
|
* 清理临时连线状态
|
|
@@ -6343,11 +6371,11 @@ class Ye {
|
|
|
6343
6371
|
t.getEmitData(),
|
|
6344
6372
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6345
6373
|
)), ht(r) ? n = o = r : K(r) && (n = r === "S", o = r === "F");
|
|
6346
|
-
const
|
|
6374
|
+
const a = this.validateChain(t.id, e, i, s);
|
|
6347
6375
|
return {
|
|
6348
|
-
allowLeft: n &&
|
|
6349
|
-
allowRight: o &&
|
|
6350
|
-
reason:
|
|
6376
|
+
allowLeft: n && a.ok,
|
|
6377
|
+
allowRight: o && a.ok,
|
|
6378
|
+
reason: a.reason
|
|
6351
6379
|
};
|
|
6352
6380
|
}
|
|
6353
6381
|
/**
|
|
@@ -6359,11 +6387,11 @@ class Ye {
|
|
|
6359
6387
|
t.getEmitData(),
|
|
6360
6388
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6361
6389
|
)), ht(r) ? n = o = r : K(r) && (n = r === "S", o = r === "F");
|
|
6362
|
-
const
|
|
6390
|
+
const a = this.validateChain(e, t.id, i, s);
|
|
6363
6391
|
return {
|
|
6364
|
-
allowLeft: n &&
|
|
6365
|
-
allowRight: o &&
|
|
6366
|
-
reason:
|
|
6392
|
+
allowLeft: n && a.ok,
|
|
6393
|
+
allowRight: o && a.ok,
|
|
6394
|
+
reason: a.reason
|
|
6367
6395
|
};
|
|
6368
6396
|
}
|
|
6369
6397
|
/**
|
|
@@ -6377,9 +6405,9 @@ class Ye {
|
|
|
6377
6405
|
* 操作高亮关联线
|
|
6378
6406
|
*/
|
|
6379
6407
|
handleHighlight(t, e, i, s, n, o, r = !1) {
|
|
6380
|
-
const
|
|
6381
|
-
|
|
6382
|
-
node:
|
|
6408
|
+
const a = t.findOne("Circle"), c = t.findOne("Arrow"), u = t.findOne("Line");
|
|
6409
|
+
a && new S.Tween({
|
|
6410
|
+
node: a,
|
|
6383
6411
|
radius: e + o,
|
|
6384
6412
|
duration: r ? 0 : 0.1
|
|
6385
6413
|
}).play(), c && new S.Tween({
|
|
@@ -6388,8 +6416,8 @@ class Ye {
|
|
|
6388
6416
|
pointerLength: s + o,
|
|
6389
6417
|
strokeWidth: n + o,
|
|
6390
6418
|
duration: r ? 0 : 0.1
|
|
6391
|
-
}).play(),
|
|
6392
|
-
node:
|
|
6419
|
+
}).play(), u && new S.Tween({
|
|
6420
|
+
node: u,
|
|
6393
6421
|
strokeWidth: n + o,
|
|
6394
6422
|
duration: r ? 0 : 0.1
|
|
6395
6423
|
}).play();
|
|
@@ -6427,15 +6455,15 @@ class Ye {
|
|
|
6427
6455
|
}
|
|
6428
6456
|
class Ue {
|
|
6429
6457
|
constructor(t, e, i) {
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6458
|
+
h(this, "tasks", []);
|
|
6459
|
+
h(this, "chartBaselineGroup");
|
|
6460
|
+
h(this, "indicatorGroup");
|
|
6461
|
+
h(this, "baselineGroup");
|
|
6434
6462
|
// 状态变量
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6463
|
+
h(this, "width", 0);
|
|
6464
|
+
h(this, "height", 0);
|
|
6465
|
+
h(this, "offsetX", 0);
|
|
6466
|
+
h(this, "offsetY", 0);
|
|
6439
6467
|
this.context = t, this.stage = e, this.layer = i, this.chartBaselineGroup = new S.Group({ name: "chart-baseline-group" }), this.baselineGroup = new S.Group({ name: "baseline-group" }), this.chartBaselineGroup.add(this.baselineGroup), this.indicatorGroup = new S.Group({ name: "baseline-indicator-group" }), this.chartBaselineGroup.add(this.indicatorGroup), this.layer.add(this.chartBaselineGroup), this.registerEvents();
|
|
6440
6468
|
}
|
|
6441
6469
|
/**
|
|
@@ -6483,61 +6511,61 @@ class Ue {
|
|
|
6483
6511
|
), n = this.context.getOptions().baselines.opacity, o = this.context.getOptions().baselines.backgroundColor;
|
|
6484
6512
|
this.tasks.forEach((r) => {
|
|
6485
6513
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
6486
|
-
const
|
|
6514
|
+
const a = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c = nt(
|
|
6487
6515
|
this.context.getOptions().baselines.height || this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, r),
|
|
6488
6516
|
e
|
|
6489
|
-
),
|
|
6490
|
-
|
|
6517
|
+
), u = this.context.getOptions().baselines.offset ?? 0;
|
|
6518
|
+
a.forEach((d, l) => {
|
|
6491
6519
|
if (!d.validate()) return;
|
|
6492
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(d.startTime), p = this.context.store.getTimeAxis().getTimeLeft(d.endTime),
|
|
6493
|
-
this.renderBaselineBar(
|
|
6494
|
-
const
|
|
6495
|
-
if (!
|
|
6496
|
-
const T =
|
|
6497
|
-
d.highlight && (T === "highlight" || T === "both") && this.renderCompareHighlight(
|
|
6520
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(d.startTime), p = this.context.store.getTimeAxis().getTimeLeft(d.endTime), g = new S.Group({ id: `baseline-group-${d.id}` });
|
|
6521
|
+
this.renderBaselineBar(g, r, d, m, p, i, e, c, t, o, n, s, u), this.baselineGroup.add(g);
|
|
6522
|
+
const x = this.context.getOptions().baselines.compare, y = d.getTimeDiff();
|
|
6523
|
+
if (!x.enabled || !y) return;
|
|
6524
|
+
const T = x.mode;
|
|
6525
|
+
d.highlight && (T === "highlight" || T === "both") && this.renderCompareHighlight(g, r, d, y), l === 0 && (T === "indicator" || T === "both") && this.renderCompareIndicator(r, d, y), this.bindEvents(g, r, d);
|
|
6498
6526
|
});
|
|
6499
6527
|
}
|
|
6500
6528
|
});
|
|
6501
6529
|
}
|
|
6502
|
-
renderBaselineBar(t, e, i, s, n, o, r,
|
|
6530
|
+
renderBaselineBar(t, e, i, s, n, o, r, a, c, u, d, l, m) {
|
|
6503
6531
|
if (this.context.getOptions().baselines.mode === "shadow") {
|
|
6504
|
-
const p = o + r * e.flatIndex -
|
|
6532
|
+
const p = o + r * e.flatIndex - a / 2 + m, g = new S.Rect({
|
|
6505
6533
|
id: `baseline-item-${i.id}`,
|
|
6506
6534
|
x: s,
|
|
6507
6535
|
y: p,
|
|
6508
6536
|
width: n - s,
|
|
6509
|
-
height:
|
|
6537
|
+
height: a,
|
|
6510
6538
|
cornerRadius: l,
|
|
6511
|
-
fill:
|
|
6539
|
+
fill: u,
|
|
6512
6540
|
opacity: d
|
|
6513
6541
|
});
|
|
6514
|
-
t.add(
|
|
6542
|
+
t.add(g), this.renderText(t, e, i, s, n, p, a);
|
|
6515
6543
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
6516
6544
|
const p = nt(this.context.getOptions().baselines.height ?? 5, r);
|
|
6517
|
-
let
|
|
6518
|
-
const
|
|
6519
|
-
let
|
|
6520
|
-
|
|
6545
|
+
let g = c + r * e.flatIndex + m;
|
|
6546
|
+
const x = this.context.getOptions().baselines.position;
|
|
6547
|
+
let y = "";
|
|
6548
|
+
x === "top" ? (g += +p / 2, y = "line_top") : x === "center" ? (g += r / 2, y = "line_center") : (g += r - p / 2, y = "line_bottom");
|
|
6521
6549
|
const T = new S.Line({
|
|
6522
6550
|
id: `baseline-item-${i.id}`,
|
|
6523
|
-
points: [s,
|
|
6524
|
-
stroke:
|
|
6551
|
+
points: [s, g, n, g],
|
|
6552
|
+
stroke: u,
|
|
6525
6553
|
opacity: d,
|
|
6526
6554
|
strokeWidth: p,
|
|
6527
6555
|
lineCap: "butt",
|
|
6528
6556
|
lineJoin: "round"
|
|
6529
6557
|
});
|
|
6530
|
-
t.add(T), this.renderText(t, e, i, s, n,
|
|
6558
|
+
t.add(T), this.renderText(t, e, i, s, n, g, p, y);
|
|
6531
6559
|
}
|
|
6532
6560
|
}
|
|
6533
|
-
renderText(t, e, i, s, n, o, r,
|
|
6561
|
+
renderText(t, e, i, s, n, o, r, a) {
|
|
6534
6562
|
const c = `chart-baseline-text-${i.id}`;
|
|
6535
6563
|
if ((() => {
|
|
6536
|
-
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((
|
|
6564
|
+
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((y) => y.remove());
|
|
6537
6565
|
})(), !this.context.getOptions().baselines.label.show) return;
|
|
6538
6566
|
const d = this.context.getOptions().baselines.label.field, l = d ? i.getField(d) : i.name;
|
|
6539
6567
|
if (!l || l === "") return;
|
|
6540
|
-
const m = n - s - 10, p = Math.max(this.context.getOptions().baselines.label.fontSize, r),
|
|
6568
|
+
const m = n - s - 10, p = Math.max(this.context.getOptions().baselines.label.fontSize, r), g = new S.Text({
|
|
6541
6569
|
text: l,
|
|
6542
6570
|
id: c,
|
|
6543
6571
|
x: s + 5,
|
|
@@ -6550,30 +6578,30 @@ class Ue {
|
|
|
6550
6578
|
align: this.context.getOptions().baselines.label.position,
|
|
6551
6579
|
verticalAlign: "bottom"
|
|
6552
6580
|
});
|
|
6553
|
-
|
|
6581
|
+
a === "line_bottom" ? g.setAttrs({
|
|
6554
6582
|
y: o - p / 2,
|
|
6555
6583
|
verticalAlign: "top"
|
|
6556
|
-
}) :
|
|
6584
|
+
}) : a === "line_center" ? g.setAttrs({
|
|
6557
6585
|
y: o - p / 2,
|
|
6558
6586
|
verticalAlign: "middle"
|
|
6559
|
-
}) :
|
|
6587
|
+
}) : a === "line_top" && g.setAttrs({
|
|
6560
6588
|
y: o - r / 2,
|
|
6561
6589
|
verticalAlign: "bottom"
|
|
6562
|
-
}), r >= p &&
|
|
6590
|
+
}), r >= p && g.setAttrs({
|
|
6563
6591
|
verticalAlign: "middle"
|
|
6564
6592
|
});
|
|
6565
|
-
const
|
|
6566
|
-
(this.context.getOptions().baselines.label.forceDisplay || m >
|
|
6593
|
+
const x = g.measureSize(l);
|
|
6594
|
+
(this.context.getOptions().baselines.label.forceDisplay || m > x.width) && t.add(g);
|
|
6567
6595
|
}
|
|
6568
6596
|
renderCompareHighlight(t, e, i, s) {
|
|
6569
6597
|
const n = s[`${this.context.getOptions().baselines.compare.target}Status`];
|
|
6570
6598
|
if (!n || n === "ontime") return;
|
|
6571
6599
|
const o = t.findOne(`#baseline-item-${i.id}`);
|
|
6572
6600
|
if (!o) return;
|
|
6573
|
-
const r = this.context.getOptions().baselines.compare,
|
|
6574
|
-
if (
|
|
6601
|
+
const r = this.context.getOptions().baselines.compare, a = this.context.getOptions().baselines.mode, c = { fill: "", stroke: "", opacity: r[n].opacity };
|
|
6602
|
+
if (a === "shadow")
|
|
6575
6603
|
c.fill = r[n].backgroundColor;
|
|
6576
|
-
else if (
|
|
6604
|
+
else if (a === "line")
|
|
6577
6605
|
c.stroke = r[n].backgroundColor;
|
|
6578
6606
|
else
|
|
6579
6607
|
return;
|
|
@@ -6582,35 +6610,35 @@ class Ue {
|
|
|
6582
6610
|
renderCompareIndicator(t, e, i) {
|
|
6583
6611
|
const s = this.context.getOptions().baselines, n = s.compare.indicator;
|
|
6584
6612
|
if (!n || !n.show) return;
|
|
6585
|
-
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height,
|
|
6613
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, a = nt(
|
|
6586
6614
|
this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, t),
|
|
6587
6615
|
r
|
|
6588
6616
|
);
|
|
6589
6617
|
let c = s.backgroundColor;
|
|
6590
|
-
const
|
|
6591
|
-
let l = (r -
|
|
6592
|
-
if (n.position === "bottom" && (l +=
|
|
6618
|
+
const u = this.context.store.getTimeAxis().getTimeLeft(t.startTime), d = this.context.store.getTimeAxis().getTimeLeft(t.endTime);
|
|
6619
|
+
let l = (r - a) / 2 + r * t.flatIndex + o;
|
|
6620
|
+
if (n.position === "bottom" && (l += a), n.show === "start" || n.show === "both" || n.show === !0) {
|
|
6593
6621
|
const m = i.startStatus;
|
|
6594
6622
|
if (m && s.compare.indicator[m].show) {
|
|
6595
6623
|
c = B(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
6596
6624
|
const p = new S.Circle({
|
|
6597
|
-
x:
|
|
6625
|
+
x: u - n.size,
|
|
6598
6626
|
y: l,
|
|
6599
6627
|
fill: c,
|
|
6600
6628
|
radius: n.size / 2
|
|
6601
6629
|
});
|
|
6602
6630
|
this.indicatorGroup.add(p);
|
|
6603
|
-
let
|
|
6604
|
-
const
|
|
6605
|
-
j(
|
|
6606
|
-
const
|
|
6631
|
+
let g = `${gt(i.startDiff)}${i.unit} ${m}`;
|
|
6632
|
+
const x = s.compare.indicator[m].text;
|
|
6633
|
+
j(x) ? g = x(i.startDiff, { ...t.getEmitData(), baseline: e }) : K(x) && (g = x);
|
|
6634
|
+
const y = new S.Text({
|
|
6607
6635
|
y: l - n.fontSize / 2,
|
|
6608
|
-
text:
|
|
6636
|
+
text: g,
|
|
6609
6637
|
fill: c,
|
|
6610
6638
|
fontSize: n.fontSize,
|
|
6611
6639
|
fontFamily: n.fontFamily || "Arial"
|
|
6612
|
-
}), T =
|
|
6613
|
-
|
|
6640
|
+
}), T = y.measureSize(g);
|
|
6641
|
+
y.x(u - n.size - T.width - 5), this.indicatorGroup.add(y);
|
|
6614
6642
|
}
|
|
6615
6643
|
}
|
|
6616
6644
|
if (n.show === "end" || n.show === "both" || n.show === !0) {
|
|
@@ -6624,18 +6652,18 @@ class Ue {
|
|
|
6624
6652
|
radius: n.size / 2
|
|
6625
6653
|
});
|
|
6626
6654
|
this.indicatorGroup.add(p);
|
|
6627
|
-
let
|
|
6628
|
-
const
|
|
6629
|
-
j(
|
|
6630
|
-
const
|
|
6655
|
+
let g = `${gt(i.endDiff)}${i.unit} ${m}`;
|
|
6656
|
+
const x = s.compare.indicator[m].text;
|
|
6657
|
+
j(x) ? g = x(i.endDiff, { ...t.getEmitData(), baseline: e }) : K(x) && (g = x);
|
|
6658
|
+
const y = new S.Text({
|
|
6631
6659
|
x: d + n.size + 5,
|
|
6632
6660
|
y: l - n.fontSize / 2,
|
|
6633
|
-
text:
|
|
6661
|
+
text: g,
|
|
6634
6662
|
fill: c,
|
|
6635
6663
|
fontSize: n.fontSize,
|
|
6636
6664
|
fontFamily: n.fontFamily || "Arial"
|
|
6637
6665
|
});
|
|
6638
|
-
this.indicatorGroup.add(
|
|
6666
|
+
this.indicatorGroup.add(y);
|
|
6639
6667
|
}
|
|
6640
6668
|
}
|
|
6641
6669
|
}
|
|
@@ -6654,21 +6682,21 @@ class Ue {
|
|
|
6654
6682
|
class Xe {
|
|
6655
6683
|
constructor(t, e) {
|
|
6656
6684
|
// Konva 元素
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6685
|
+
h(this, "stage");
|
|
6686
|
+
h(this, "headerLayer");
|
|
6687
|
+
h(this, "bodyGroup");
|
|
6688
|
+
h(this, "gridGroup");
|
|
6689
|
+
h(this, "weekendGroup");
|
|
6690
|
+
h(this, "holidayGroup");
|
|
6691
|
+
h(this, "flagGroup");
|
|
6692
|
+
h(this, "todayLayer");
|
|
6693
|
+
h(this, "linkGroup");
|
|
6694
|
+
h(this, "baselineGroup");
|
|
6695
|
+
h(this, "axisLayer");
|
|
6696
|
+
h(this, "bgLayer");
|
|
6697
|
+
h(this, "bodyLayer");
|
|
6698
|
+
h(this, "width", 0);
|
|
6699
|
+
h(this, "height", 0);
|
|
6672
6700
|
this.context = t, this.container = e, this.stage = new S.Stage({
|
|
6673
6701
|
container: this.container,
|
|
6674
6702
|
width: this.container.clientWidth,
|
|
@@ -6703,10 +6731,10 @@ class Xe {
|
|
|
6703
6731
|
const Ke = '<svg style="transition: all 0.3s" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>';
|
|
6704
6732
|
class Ve {
|
|
6705
6733
|
constructor(t, e) {
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6734
|
+
h(this, "line");
|
|
6735
|
+
h(this, "initialX", 0);
|
|
6736
|
+
h(this, "initialWidth", 0);
|
|
6737
|
+
h(this, "collapseButton", null);
|
|
6710
6738
|
this.root = t, this.container = e, this.line = document.createElement("div"), this.line.className = "x-gantt-middle-resize-line", this.line.style.position = "absolute", this.line.style.zIndex = "99", this.line.style.width = "5px", this.line.style.height = "100%", this.line.style.borderLeft = "2px solid", this.line.style.setProperty(
|
|
6711
6739
|
"border-left-color",
|
|
6712
6740
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
@@ -6723,23 +6751,23 @@ class Ve {
|
|
|
6723
6751
|
*/
|
|
6724
6752
|
addDragEvents() {
|
|
6725
6753
|
let t = 0, e = null;
|
|
6726
|
-
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (
|
|
6727
|
-
|
|
6754
|
+
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (a) => {
|
|
6755
|
+
a.preventDefault(), a.stopPropagation(), t = a.clientX, e = this.container.getBoundingClientRect();
|
|
6728
6756
|
const c = s[s.length - 1].key;
|
|
6729
6757
|
this.initialWidth = i.getColumnWidth(c);
|
|
6730
|
-
const
|
|
6731
|
-
this.root.event.emit(k.SHOW_GUIDELINE,
|
|
6758
|
+
const u = this.initialX;
|
|
6759
|
+
this.root.event.emit(k.SHOW_GUIDELINE, u);
|
|
6732
6760
|
const d = (m) => o(m), l = (m) => r(m, d, l);
|
|
6733
6761
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6734
|
-
}, o = (
|
|
6735
|
-
if (
|
|
6736
|
-
const c =
|
|
6762
|
+
}, o = (a) => {
|
|
6763
|
+
if (a.preventDefault(), !e) return;
|
|
6764
|
+
const c = a.clientX - t;
|
|
6737
6765
|
s[s.length - 1].key;
|
|
6738
|
-
const
|
|
6766
|
+
const u = 50 - this.initialWidth, l = e.width - 20 - this.initialX, m = Math.max(u, Math.min(l, c)), p = this.initialX + m;
|
|
6739
6767
|
this.root.event.emit(k.MOVE_GUIDELINE, p);
|
|
6740
|
-
}, r = (
|
|
6741
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup",
|
|
6742
|
-
const d =
|
|
6768
|
+
}, r = (a, c, u) => {
|
|
6769
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), this.root.event.emit(k.HIDE_GUIDELINE);
|
|
6770
|
+
const d = a.clientX - t, l = s[s.length - 1].key, m = Math.max(50, this.initialWidth + d);
|
|
6743
6771
|
i.setColumnWidth(l, m), this.root.event.emit(k.UPDATE_TABLE_HEADER);
|
|
6744
6772
|
};
|
|
6745
6773
|
this.line.addEventListener("mousedown", n);
|
|
@@ -6750,9 +6778,9 @@ class je {
|
|
|
6750
6778
|
* @param container 指示线的容器元素
|
|
6751
6779
|
*/
|
|
6752
6780
|
constructor(t, e) {
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6781
|
+
h(this, "element");
|
|
6782
|
+
h(this, "container");
|
|
6783
|
+
h(this, "visible", !1);
|
|
6756
6784
|
if (this.context = t, !e)
|
|
6757
6785
|
throw new Error("Container is required for GuideLine instance");
|
|
6758
6786
|
this.container = e, this.element = document.createElement("div"), this.initElement(), this.initEvents();
|
|
@@ -6822,14 +6850,14 @@ class je {
|
|
|
6822
6850
|
}
|
|
6823
6851
|
class qe {
|
|
6824
6852
|
constructor(t = 16) {
|
|
6825
|
-
|
|
6853
|
+
h(this, "taskQueue", /* @__PURE__ */ new Map());
|
|
6826
6854
|
// 使用 Map 避免同类型重复任务
|
|
6827
|
-
|
|
6855
|
+
h(this, "taskHandlers", /* @__PURE__ */ new Map());
|
|
6828
6856
|
// 任务类型处理器映射
|
|
6829
|
-
|
|
6830
|
-
|
|
6857
|
+
h(this, "isScheduled", !1);
|
|
6858
|
+
h(this, "delay");
|
|
6831
6859
|
// 使用 debounce 来延迟执行,避免短时间内多次触发
|
|
6832
|
-
|
|
6860
|
+
h(this, "debouncedFlush");
|
|
6833
6861
|
this.delay = t, this.debouncedFlush = Xt(() => {
|
|
6834
6862
|
this.flushTaskQueue();
|
|
6835
6863
|
}, t);
|
|
@@ -6963,25 +6991,25 @@ class qe {
|
|
|
6963
6991
|
}
|
|
6964
6992
|
class Qe {
|
|
6965
6993
|
constructor(t, e) {
|
|
6966
|
-
|
|
6967
|
-
|
|
6994
|
+
h(this, "scrollbar");
|
|
6995
|
+
h(this, "rootElement");
|
|
6968
6996
|
// 根容器
|
|
6969
|
-
|
|
6997
|
+
h(this, "tableContainer");
|
|
6970
6998
|
// 表格容器
|
|
6971
|
-
|
|
6999
|
+
h(this, "chartContainer");
|
|
6972
7000
|
// 用于放置右侧图表内容(Konva Stage)并作为滚动内容的容器
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
7001
|
+
h(this, "table");
|
|
7002
|
+
h(this, "chart");
|
|
7003
|
+
h(this, "middleLine");
|
|
7004
|
+
h(this, "renderScheduler");
|
|
6977
7005
|
// 渲染调度器
|
|
6978
|
-
|
|
7006
|
+
h(this, "_id", Q());
|
|
6979
7007
|
// 尺寸和状态
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
7008
|
+
h(this, "width", 0);
|
|
7009
|
+
h(this, "height", 0);
|
|
7010
|
+
h(this, "isInitialized", !0);
|
|
6983
7011
|
// 更新尺寸
|
|
6984
|
-
|
|
7012
|
+
h(this, "updateSize", () => {
|
|
6985
7013
|
this.width = this.context.store.getOptionManager().getOptions().width || this.container.clientWidth, this.height = this.context.store.getOptionManager().getOptions().height || this.container.clientHeight, this.rootElement.style.width = this.width ? `${this.width}px` : "100%", this.rootElement.style.height = this.height ? `${this.height}px` : "100%";
|
|
6986
7014
|
const t = this.context.store.getColumnManager().getTotalWidth();
|
|
6987
7015
|
this.tableContainer.style.width = `${t}px`, this.tableContainer.style.height = this.height ? `${this.height}px` : "100%";
|
|
@@ -7000,7 +7028,7 @@ class Qe {
|
|
|
7000
7028
|
/**
|
|
7001
7029
|
* 设置样式值
|
|
7002
7030
|
*/
|
|
7003
|
-
|
|
7031
|
+
h(this, "setStyleValue", () => {
|
|
7004
7032
|
const t = this.context.store.getOptionManager().getOptions();
|
|
7005
7033
|
this.rootElement.style.setProperty(
|
|
7006
7034
|
"--x-gantt-primary-color",
|
|
@@ -7023,10 +7051,10 @@ class Qe {
|
|
|
7023
7051
|
`${t.header.fontWeight}`
|
|
7024
7052
|
);
|
|
7025
7053
|
});
|
|
7026
|
-
|
|
7054
|
+
h(this, "handleUpdateTask", (t) => {
|
|
7027
7055
|
this.table.updateTask(t), this.chart.updateTask(t);
|
|
7028
7056
|
});
|
|
7029
|
-
|
|
7057
|
+
h(this, "handleColumnWidthChange", () => {
|
|
7030
7058
|
this.table.updateWidth(), this.updateSize();
|
|
7031
7059
|
});
|
|
7032
7060
|
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new je(this.context, this.container), this.middleLine = new Ve(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new He(this.context, this.tableContainer), this.chart = new Xe(this.context, this.chartContainer), this.scrollbar = new _e(
|
|
@@ -7096,7 +7124,7 @@ class Qe {
|
|
|
7096
7124
|
*/
|
|
7097
7125
|
performRender(t = !1, e = !1) {
|
|
7098
7126
|
this.setStyleValue();
|
|
7099
|
-
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),
|
|
7127
|
+
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);
|
|
7100
7128
|
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(k.LOADED), this.isInitialized = !1), O.debug("execute render");
|
|
7101
7129
|
}
|
|
7102
7130
|
/**
|
|
@@ -7123,10 +7151,10 @@ class Qe {
|
|
|
7123
7151
|
}
|
|
7124
7152
|
class Je {
|
|
7125
7153
|
constructor(t, e, i) {
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7154
|
+
h(this, "_id", Q());
|
|
7155
|
+
h(this, "store");
|
|
7156
|
+
h(this, "event", new jt());
|
|
7157
|
+
h(this, "renderer");
|
|
7130
7158
|
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new De(this, i), this.renderer = new Qe(this, this.container), this.render(), this.registerEvents(), O.debug(
|
|
7131
7159
|
"----Gantt initialized for element:",
|
|
7132
7160
|
this._id,
|
|
@@ -7267,9 +7295,9 @@ class Je {
|
|
|
7267
7295
|
}
|
|
7268
7296
|
class si {
|
|
7269
7297
|
constructor(t, e) {
|
|
7270
|
-
|
|
7298
|
+
h(this, "context");
|
|
7271
7299
|
// 管理对外事件
|
|
7272
|
-
|
|
7300
|
+
h(this, "events", /* @__PURE__ */ new Map());
|
|
7273
7301
|
e != null && e.logLevel && O.setOptions({
|
|
7274
7302
|
showTimestamp: e.logLevel === "debug",
|
|
7275
7303
|
level: {
|
|
@@ -7611,6 +7639,19 @@ class si {
|
|
|
7611
7639
|
getDataSize() {
|
|
7612
7640
|
return this.context.store.getDataManager().getDataSize();
|
|
7613
7641
|
}
|
|
7642
|
+
/**
|
|
7643
|
+
* 移除指定 ID 的数据。该操作会直接修改当前数据源,并且不可逆,请谨慎使用
|
|
7644
|
+
* @param id 数据 ID
|
|
7645
|
+
* @returns 是否成功移除
|
|
7646
|
+
*
|
|
7647
|
+
* @example
|
|
7648
|
+
* ```typescript
|
|
7649
|
+
* const success = gantt.removeDataById('task-1');
|
|
7650
|
+
* ```
|
|
7651
|
+
*/
|
|
7652
|
+
removeDataById(t) {
|
|
7653
|
+
return this.context.store.getDataManager().deleteTaskById(t);
|
|
7654
|
+
}
|
|
7614
7655
|
}
|
|
7615
7656
|
Kt();
|
|
7616
7657
|
const ni = Ct;
|