@xpyjs/gantt-core 0.0.1-rc.3 → 0.0.1-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/x-gantt.js +603 -558
- package/dist/x-gantt.umd.cjs +2 -2
- package/package.json +1 -1
- package/types/XGantt.d.ts +11 -0
- package/types/rendering/Renderer.d.ts +1 -0
- package/types/store/DataManager.d.ts +4 -0
- package/types/types/options.d.ts +7 -1
package/dist/x-gantt.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Pt = Object.defineProperty;
|
|
2
2
|
var Yt = (f, t, e) => t in f ? Pt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
|
-
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
|
-
import { merge as rt, isArray as X, isString as
|
|
6
|
+
import { merge as rt, isArray as X, isString as V, 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.
|
|
9
|
-
function
|
|
8
|
+
const Ct = "0.0.1-rc.5";
|
|
9
|
+
function Vt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
@@ -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
|
// 默认不显示时间戳
|
|
@@ -316,9 +316,9 @@ const lt = () => ({
|
|
|
316
316
|
opacity: 0.1
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
|
-
class
|
|
319
|
+
class Kt {
|
|
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
|
}
|
|
@@ -354,7 +354,7 @@ class Vt {
|
|
|
354
354
|
var s;
|
|
355
355
|
let e = "";
|
|
356
356
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
357
|
-
return
|
|
357
|
+
return V(i) ? e = i : X(i) && i.length > 0 ? e = i[t.level] : j(i) && (e = i(t.getEmitData())), e;
|
|
358
358
|
}
|
|
359
359
|
unpackFunc(t, e) {
|
|
360
360
|
return j(t) ? t(e.getEmitData()) : t;
|
|
@@ -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
|
* 注册事件监听器
|
|
@@ -413,7 +413,7 @@ function $(f, t, e) {
|
|
|
413
413
|
}
|
|
414
414
|
function nt(f, t) {
|
|
415
415
|
let e = f;
|
|
416
|
-
return
|
|
416
|
+
return V(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
417
417
|
}
|
|
418
418
|
function ct(f, t) {
|
|
419
419
|
if (t === 0)
|
|
@@ -471,68 +471,68 @@ function bt(f, t = 16, e = 16) {
|
|
|
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) {
|
|
535
|
-
if (!t ||
|
|
535
|
+
if (!t || V(t) && t.trim() === "")
|
|
536
536
|
return;
|
|
537
537
|
if (!t.includes("."))
|
|
538
538
|
return this.data[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,7 +635,7 @@ 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",
|
|
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), g = a > 0 ? (c - a) / a * 100 : 0;
|
|
639
639
|
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: g, unit: e };
|
|
640
640
|
}
|
|
641
641
|
}
|
|
@@ -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((g) => g[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,7 +966,7 @@ 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, g = this.store.getTimeAxis().getCellUnit();
|
|
941
970
|
let d = t.parent;
|
|
942
971
|
for (; c !== "none" && d; ) {
|
|
943
972
|
if (c === "expand") {
|
|
@@ -947,11 +976,11 @@ class Jt {
|
|
|
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
982
|
let u = p.startTime || o, y = p.endTime || r, x = o.diff(t.startTime), T = r.diff(t.endTime);
|
|
954
|
-
|
|
983
|
+
a === "scale" ? s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u.add(x), y.add(T))) : s === "left" ? (u = u.add(x), u.isSameOrAfter(y.subtract(1, g)) && (y.isBefore(t.endTime) ? y = u.add(1, g) : u = y.subtract(1, g), u.isSameOrBefore(o) && (o = u)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y)) : s === "right" && (y = y.add(T), y.isSameOrBefore(u.add(1, g)) && (u.isAfter(t.startTime) ? u = y.subtract(1, g) : y = u.add(1, g)), y.isSameOrAfter(r) && (r = y), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y)) : a === "fixed" && (s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u.add(x), y.add(T))) : s === "left" ? u.isSameOrBefore(o) && (u = o, u.isSameOrAfter(y.subtract(1, g)) && (y.isBefore(t.endTime) ? y = u.add(1, g) : u = y.subtract(1, g), u.isSameOrBefore(o) && (o = u)), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y)) : s === "right" && y.isSameOrAfter(r) && (y = r, y.isSameOrBefore(u.add(1, g)) && (u.isAfter(t.startTime) ? u = y.subtract(1, g) : y = u.add(1, g)), y.isSameOrAfter(r) && (r = y), n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(u, y))), p.children && p.children.length > 0 && m.push(...p.children);
|
|
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, g = 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, g = (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: g };
|
|
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,11 +1054,11 @@ 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), g = 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}${
|
|
1060
|
+
return `#${r[0]}${a[0]}${c[0]}`;
|
|
1061
|
+
const d = `#${r}${a}${c}`;
|
|
1033
1062
|
return n || i < 1 ? `${d}${g}` : d;
|
|
1034
1063
|
}
|
|
1035
1064
|
class et {
|
|
@@ -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,12 +1421,12 @@ 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
1427
|
const g = [...(i == null ? void 0 : i.path) || [], c];
|
|
1399
1428
|
c = "column-" + o + "-" + g.join("-");
|
|
1400
|
-
const d = n.label || (
|
|
1429
|
+
const d = n.label || (a ? n.field : ""), l = a ? ((p = this.temporaryLeafColumns.find((u) => u.key === c)) == null ? void 0 : p.width) || n.width || 100 : "auto", m = {
|
|
1401
1430
|
label: d,
|
|
1402
1431
|
level: s,
|
|
1403
1432
|
maxLevel: s,
|
|
@@ -1405,10 +1434,10 @@ class ee {
|
|
|
1405
1434
|
children: [],
|
|
1406
1435
|
path: g,
|
|
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
1443
|
const u = n.children;
|
|
@@ -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
|
/** 开启/关闭环检测 */
|
|
@@ -1724,7 +1753,7 @@ const tt = class tt {
|
|
|
1724
1753
|
L.length === 0 && (L = [[x]]);
|
|
1725
1754
|
}
|
|
1726
1755
|
return T.delete(x.id), L.length < 100 && (this.forwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1727
|
-
},
|
|
1756
|
+
}, a = (x, T, b = /* @__PURE__ */ new Set()) => {
|
|
1728
1757
|
const w = x.id;
|
|
1729
1758
|
if (this.backwardMemo.has(w))
|
|
1730
1759
|
return this.recordCacheAccess(w, !0), this.backwardMemo.get(w);
|
|
@@ -1737,14 +1766,14 @@ const tt = class tt {
|
|
|
1737
1766
|
L = [[x]];
|
|
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
1771
|
L.push([...M, x]);
|
|
1743
1772
|
}
|
|
1744
1773
|
L.length === 0 && (L = [[x]]);
|
|
1745
1774
|
}
|
|
1746
1775
|
return T.delete(x.id), L.length < 100 && (this.backwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1747
|
-
}, c =
|
|
1776
|
+
}, c = a(e, /* @__PURE__ */ new Set()), g = r(e, /* @__PURE__ */ new Set());
|
|
1748
1777
|
this.getDirectlyConnectedTasks(t).forEach((x) => {
|
|
1749
1778
|
this.establishCacheDependency(t, x.id), this.establishCacheDependency(x.id, t);
|
|
1750
1779
|
});
|
|
@@ -1791,11 +1820,11 @@ 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 (; ; ) {
|
|
@@ -1806,7 +1835,7 @@ const tt = class tt {
|
|
|
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
1840
|
const c = r.filter((l) => l.length > 1 || this.hasSelfLoop(l[0])), g = c.map((l) => l.slice()), d = {
|
|
1812
1841
|
hasCycle: c.length > 0,
|
|
@@ -1823,11 +1852,11 @@ 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 =
|
|
1859
|
+
const c = a.has("FS"), g = a.has("SF");
|
|
1831
1860
|
return c && g && (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,
|
|
@@ -1865,16 +1894,16 @@ 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
|
|
1905
|
+
const a = this.fromLinksMap.get(r) || [];
|
|
1906
|
+
for (const c of a) {
|
|
1878
1907
|
const g = c.to;
|
|
1879
1908
|
if (!n.has(g) && !o.has(g) && o.set(g, r), g === t) {
|
|
1880
1909
|
o.has(g) || o.set(g, r);
|
|
@@ -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,7 +2154,7 @@ 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, g = 2628e6, d = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = { years: c, months: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(L) {
|
|
2129
2158
|
return L instanceof w;
|
|
2130
2159
|
}, p = function(L, E, v) {
|
|
2131
2160
|
return new w(L, v, E.$l);
|
|
@@ -2178,7 +2207,7 @@ 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) {
|
|
@@ -2258,8 +2287,8 @@ 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), g = s(o), d = (
|
|
2290
|
+
i.prototype.isBetween = function(n, o, r, a) {
|
|
2291
|
+
var c = s(n), g = s(o), d = (a = a || "()")[0] === "(", l = a[1] === ")";
|
|
2263
2292
|
return (d ? this.isAfter(c, r) : !this.isBefore(c, r)) && (l ? this.isBefore(g, r) : !this.isAfter(g, r)) || (d ? this.isBefore(c, r) : !this.isAfter(c, r)) && (l ? this.isAfter(g, r) : !this.isBefore(g, r));
|
|
2264
2293
|
};
|
|
2265
2294
|
};
|
|
@@ -2312,7 +2341,7 @@ var At = { exports: {} };
|
|
|
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) {
|
|
@@ -2341,7 +2370,7 @@ var At = { exports: {} };
|
|
|
2341
2370
|
n.localeData = function() {
|
|
2342
2371
|
return g.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,8 +2410,8 @@ 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
2417
|
var g = o(this).startOf(i).add(1, i).date(c), d = o(this).endOf(e);
|
|
@@ -2390,8 +2419,8 @@ var It = { exports: {} };
|
|
|
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
2455
|
var c = this.$utils(), g = (o || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(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");
|
|
@@ -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
|
};
|
|
@@ -2499,10 +2528,10 @@ var Wt = { exports: {} };
|
|
|
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
|
|
2531
|
+
var a = r.startOf;
|
|
2503
2532
|
r.startOf = function(c, g) {
|
|
2504
2533
|
var d = this.$utils(), l = !!d.u(g) || g;
|
|
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") :
|
|
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, g);
|
|
2506
2535
|
};
|
|
2507
2536
|
};
|
|
2508
2537
|
});
|
|
@@ -2516,7 +2545,7 @@ 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
2550
|
var u = new Date(l), y = function(x, T) {
|
|
2522
2551
|
T === void 0 && (T = {});
|
|
@@ -2525,7 +2554,7 @@ var $t = { exports: {} };
|
|
|
2525
2554
|
}(m, p);
|
|
2526
2555
|
return y.formatToParts(u);
|
|
2527
2556
|
}, c = function(l, m) {
|
|
2528
|
-
for (var p =
|
|
2557
|
+
for (var p = a(l, m), u = [], y = 0; y < p.length; y += 1) {
|
|
2529
2558
|
var x = p[y], T = x.type, b = x.value, w = e[T];
|
|
2530
2559
|
w >= 0 && (u[w] = parseInt(b, 10));
|
|
2531
2560
|
}
|
|
@@ -2542,7 +2571,7 @@ var $t = { exports: {} };
|
|
|
2542
2571
|
}
|
|
2543
2572
|
return p.$x.$timezone = l, p;
|
|
2544
2573
|
}, g.offsetName = function(l) {
|
|
2545
|
-
var m = this.$x.$timezone || o.tz.guess(), p =
|
|
2574
|
+
var m = this.$x.$timezone || o.tz.guess(), p = a(this.valueOf(), m, { timeZoneName: l }).find(function(u) {
|
|
2546
2575
|
return u.type.toLowerCase() === "timezonename";
|
|
2547
2576
|
});
|
|
2548
2577
|
return p && p.value;
|
|
@@ -2579,29 +2608,29 @@ 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
|
|
2611
|
+
var a = o.prototype;
|
|
2583
2612
|
r.utc = function(u) {
|
|
2584
2613
|
var y = { date: u, utc: !0, args: arguments };
|
|
2585
2614
|
return new o(y);
|
|
2586
|
-
},
|
|
2615
|
+
}, a.utc = function(u) {
|
|
2587
2616
|
var y = r(this.toDate(), { locale: this.$L, utc: !0 });
|
|
2588
2617
|
return u ? y.add(this.utcOffset(), e) : y;
|
|
2589
|
-
},
|
|
2618
|
+
}, a.local = function() {
|
|
2590
2619
|
return r(this.toDate(), { locale: this.$L, utc: !1 });
|
|
2591
2620
|
};
|
|
2592
|
-
var c =
|
|
2593
|
-
|
|
2621
|
+
var c = a.parse;
|
|
2622
|
+
a.parse = function(u) {
|
|
2594
2623
|
u.utc && (this.$u = !0), this.$utils().u(u.$offset) || (this.$offset = u.$offset), c.call(this, u);
|
|
2595
2624
|
};
|
|
2596
|
-
var g =
|
|
2597
|
-
|
|
2625
|
+
var g = a.init;
|
|
2626
|
+
a.init = function() {
|
|
2598
2627
|
if (this.$u) {
|
|
2599
2628
|
var u = this.$d;
|
|
2600
2629
|
this.$y = u.getUTCFullYear(), this.$M = u.getUTCMonth(), this.$D = u.getUTCDate(), this.$W = u.getUTCDay(), this.$H = u.getUTCHours(), this.$m = u.getUTCMinutes(), this.$s = u.getUTCSeconds(), this.$ms = u.getUTCMilliseconds();
|
|
2601
2630
|
} else g.call(this);
|
|
2602
2631
|
};
|
|
2603
|
-
var d =
|
|
2604
|
-
|
|
2632
|
+
var d = a.utcOffset;
|
|
2633
|
+
a.utcOffset = function(u, y) {
|
|
2605
2634
|
var x = this.$utils().u;
|
|
2606
2635
|
if (x(u)) return this.$u ? 0 : x(this.$offset) ? d.call(this) : this.$offset;
|
|
2607
2636
|
if (typeof u == "string" && (u = function(C) {
|
|
@@ -2619,26 +2648,26 @@ var Ft = { exports: {} };
|
|
|
2619
2648
|
} else b = this.utc();
|
|
2620
2649
|
return b;
|
|
2621
2650
|
};
|
|
2622
|
-
var l =
|
|
2623
|
-
|
|
2651
|
+
var l = a.format;
|
|
2652
|
+
a.format = function(u) {
|
|
2624
2653
|
var y = u || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
2625
2654
|
return l.call(this, y);
|
|
2626
|
-
},
|
|
2655
|
+
}, a.valueOf = function() {
|
|
2627
2656
|
var u = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
2628
2657
|
return this.$d.valueOf() - 6e4 * u;
|
|
2629
|
-
},
|
|
2658
|
+
}, a.isUTC = function() {
|
|
2630
2659
|
return !!this.$u;
|
|
2631
|
-
},
|
|
2660
|
+
}, a.toISOString = function() {
|
|
2632
2661
|
return this.toDate().toISOString();
|
|
2633
|
-
},
|
|
2662
|
+
}, a.toString = function() {
|
|
2634
2663
|
return this.toDate().toUTCString();
|
|
2635
2664
|
};
|
|
2636
|
-
var m =
|
|
2637
|
-
|
|
2665
|
+
var m = a.toDate;
|
|
2666
|
+
a.toDate = function(u) {
|
|
2638
2667
|
return u === "s" && this.$offset ? r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
|
|
2639
2668
|
};
|
|
2640
|
-
var p =
|
|
2641
|
-
|
|
2669
|
+
var p = a.diff;
|
|
2670
|
+
a.diff = function(u, y, x) {
|
|
2642
2671
|
if (u && this.$u === u.$u) return p.call(this, u, y, x);
|
|
2643
2672
|
var T = this.local(), b = r(u).local();
|
|
2644
2673
|
return p.call(T, b, y, x);
|
|
@@ -2670,8 +2699,8 @@ var Le = { exports: {} };
|
|
|
2670
2699
|
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
2700
|
return r === "W" ? o + "周" : o + "日";
|
|
2672
2701
|
}, 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
|
|
2702
|
+
var a = 100 * o + r;
|
|
2703
|
+
return a < 600 ? "凌晨" : a < 900 ? "早上" : a < 1100 ? "上午" : a < 1300 ? "中午" : a < 1800 ? "下午" : "晚上";
|
|
2675
2704
|
} };
|
|
2676
2705
|
return s.default.locale(n, null, !0), n;
|
|
2677
2706
|
});
|
|
@@ -2733,30 +2762,30 @@ const ut = () => ({
|
|
|
2733
2762
|
});
|
|
2734
2763
|
class Oe {
|
|
2735
2764
|
constructor() {
|
|
2736
|
-
|
|
2737
|
-
|
|
2765
|
+
h(this, "startTime", G().startOf("day"));
|
|
2766
|
+
h(this, "endTime", G().endOf("day"));
|
|
2738
2767
|
/** 结束的标准时间。切换单位会影响结尾的扩展,需要单独记录一个标准时间 */
|
|
2739
|
-
|
|
2768
|
+
h(this, "targetEnd", G().endOf("day"));
|
|
2740
2769
|
/** 固定起始日期 */
|
|
2741
|
-
|
|
2770
|
+
h(this, "strictStart", !1);
|
|
2742
2771
|
/** 固定截止日期 */
|
|
2743
|
-
|
|
2772
|
+
h(this, "strictEnd", !1);
|
|
2744
2773
|
/** 是否自适应宽度 */
|
|
2745
|
-
|
|
2774
|
+
h(this, "isAuto", !1);
|
|
2746
2775
|
/** 表头的日期列表 */
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2776
|
+
h(this, "timeline", []);
|
|
2777
|
+
h(this, "headerGroupFormat");
|
|
2778
|
+
h(this, "headerCellFormat");
|
|
2779
|
+
h(this, "isDirty", !0);
|
|
2751
2780
|
// 标记缓存是否需要更新
|
|
2752
2781
|
/** 是否第一次赋值,如果第一次赋值,允许全部赋值 */
|
|
2753
|
-
|
|
2782
|
+
h(this, "isFirstTime", !0);
|
|
2754
2783
|
/** 总宽度 */
|
|
2755
|
-
|
|
2784
|
+
h(this, "allWidth", 0);
|
|
2756
2785
|
/** 每一格的宽度 */
|
|
2757
|
-
|
|
2786
|
+
h(this, "cellWidth");
|
|
2758
2787
|
/** 用户设定的单位 */
|
|
2759
|
-
|
|
2788
|
+
h(this, "unit", "day");
|
|
2760
2789
|
this.cellWidth = Z(ut().normal);
|
|
2761
2790
|
}
|
|
2762
2791
|
getStartTime() {
|
|
@@ -2821,7 +2850,7 @@ class Oe {
|
|
|
2821
2850
|
week: s.cellWidth,
|
|
2822
2851
|
month: s.cellWidth,
|
|
2823
2852
|
quarter: s.cellWidth
|
|
2824
|
-
} :
|
|
2853
|
+
} : V(s.cellWidth) ? this.cellWidth = Z(
|
|
2825
2854
|
ut()[s.cellWidth] || ut().normal
|
|
2826
2855
|
) : Et(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2827
2856
|
}
|
|
@@ -2901,7 +2930,7 @@ class Oe {
|
|
|
2901
2930
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2902
2931
|
if (i) return i;
|
|
2903
2932
|
}
|
|
2904
|
-
if (
|
|
2933
|
+
if (V(this.headerGroupFormat))
|
|
2905
2934
|
return t.format(this.headerGroupFormat);
|
|
2906
2935
|
switch (this.getGroupUnit()) {
|
|
2907
2936
|
case "month":
|
|
@@ -2921,7 +2950,7 @@ class Oe {
|
|
|
2921
2950
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2922
2951
|
if (i) return i;
|
|
2923
2952
|
}
|
|
2924
|
-
if (
|
|
2953
|
+
if (V(this.headerCellFormat))
|
|
2925
2954
|
return t.format(this.headerCellFormat);
|
|
2926
2955
|
switch (this.getChildUnit()) {
|
|
2927
2956
|
case "hour":
|
|
@@ -2960,17 +2989,17 @@ class De {
|
|
|
2960
2989
|
// 使用私有构造函数防止直接创建实例
|
|
2961
2990
|
constructor(t, e) {
|
|
2962
2991
|
// 声明成员属性类型
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2992
|
+
h(this, "optionManager");
|
|
2993
|
+
h(this, "dataManager");
|
|
2994
|
+
h(this, "columnManager");
|
|
2995
|
+
h(this, "linkManager");
|
|
2996
|
+
h(this, "timeAxis");
|
|
2968
2997
|
var n, o, r;
|
|
2969
2998
|
this.context = t;
|
|
2970
2999
|
const i = yt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2971
3000
|
if (s && !X(s))
|
|
2972
3001
|
throw O.exception("Data should be a array.");
|
|
2973
|
-
this.optionManager = new
|
|
3002
|
+
this.optionManager = new Kt(), this.optionManager.setOptions(i), i.locale && vt(i.locale), this.timeAxis = new Oe(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new ee(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new Jt(this, this.context.event), s && this.dataManager.setData(s, !0), (n = e == null ? void 0 : e.baselines) != null && n.data && this.dataManager.setBaselines(e.baselines.data), this.linkManager = new ft(this, this.context.event), X((o = e == null ? void 0 : e.links) == null ? void 0 : o.data) && this.linkManager.setLinks(e.links.data, !0), this.linkManager.setCycleDetection(((r = e == null ? void 0 : e.links) == null ? void 0 : r.enableCycleDetection) ?? !0);
|
|
2974
3003
|
}
|
|
2975
3004
|
getOptionManager() {
|
|
2976
3005
|
return this.optionManager;
|
|
@@ -2988,11 +3017,11 @@ class De {
|
|
|
2988
3017
|
return this.timeAxis;
|
|
2989
3018
|
}
|
|
2990
3019
|
setOption(t, e = { merge: !0 }) {
|
|
2991
|
-
var n, o, r,
|
|
3020
|
+
var n, o, r, a;
|
|
2992
3021
|
const i = yt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
2993
3022
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((c) => {
|
|
2994
3023
|
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(((
|
|
3024
|
+
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((a = t.links) == null ? void 0 : a.enableCycleDetection) ?? !0), i.locale && vt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
2996
3025
|
}
|
|
2997
3026
|
updateTime(t, e) {
|
|
2998
3027
|
this.timeAxis.setDate(t, e);
|
|
@@ -3000,92 +3029,92 @@ class De {
|
|
|
3000
3029
|
}
|
|
3001
3030
|
class _e {
|
|
3002
3031
|
constructor(t, e, i) {
|
|
3003
|
-
|
|
3004
|
-
|
|
3032
|
+
h(this, "rootElement");
|
|
3033
|
+
h(this, "options");
|
|
3005
3034
|
// 滚动条元素
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3035
|
+
h(this, "hScrollbar");
|
|
3036
|
+
h(this, "vScrollbar");
|
|
3037
|
+
h(this, "hScrollThumb");
|
|
3038
|
+
h(this, "vScrollThumb");
|
|
3039
|
+
h(this, "scrollbarContainer");
|
|
3011
3040
|
// 内容尺寸和滚动位置
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3041
|
+
h(this, "viewportWidth", 0);
|
|
3042
|
+
h(this, "viewportHeight", 0);
|
|
3043
|
+
h(this, "contentWidth", 0);
|
|
3044
|
+
h(this, "contentHeight", 0);
|
|
3045
|
+
h(this, "scrollLeft", 0);
|
|
3046
|
+
h(this, "scrollTop", 0);
|
|
3018
3047
|
// 滚动条状态
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3048
|
+
h(this, "isDraggingHScroll", !1);
|
|
3049
|
+
h(this, "isDraggingVScroll", !1);
|
|
3050
|
+
h(this, "isMouseOverRoot", !1);
|
|
3051
|
+
h(this, "isMouseOverScrollbar", !1);
|
|
3052
|
+
h(this, "hideTimeout", null);
|
|
3053
|
+
h(this, "showTimeout", null);
|
|
3025
3054
|
// 新增:显示计时器
|
|
3026
|
-
|
|
3055
|
+
h(this, "isVisible", !1);
|
|
3027
3056
|
// 拖拽状态
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3057
|
+
h(this, "dragStartX", 0);
|
|
3058
|
+
h(this, "dragStartY", 0);
|
|
3059
|
+
h(this, "thumbStartScrollLeft", 0);
|
|
3060
|
+
h(this, "thumbStartScrollTop", 0);
|
|
3032
3061
|
// 动画状态
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3062
|
+
h(this, "isAnimating", !1);
|
|
3063
|
+
h(this, "animationFrameId", null);
|
|
3064
|
+
h(this, "animationStartTime", 0);
|
|
3065
|
+
h(this, "animationStartScrollLeft", 0);
|
|
3066
|
+
h(this, "animationStartScrollTop", 0);
|
|
3067
|
+
h(this, "animationTargetScrollLeft", 0);
|
|
3068
|
+
h(this, "animationTargetScrollTop", 0);
|
|
3069
|
+
h(this, "animationSource", "api");
|
|
3041
3070
|
// 记录动画触发源
|
|
3042
3071
|
// 节流处理
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3072
|
+
h(this, "throttledHandleMouseMove");
|
|
3073
|
+
h(this, "throttledHandleWheel");
|
|
3074
|
+
h(this, "handleRootMouseMove", () => {
|
|
3046
3075
|
!this.isVisible && this.isMouseOverRoot ? this.scheduleShow() : this.isVisible && !this.isMouseOverScrollbar && this.scheduleHide();
|
|
3047
3076
|
});
|
|
3048
|
-
|
|
3077
|
+
h(this, "handleScrollbarMouseEnter", () => {
|
|
3049
3078
|
this.isMouseOverScrollbar = !0, this.scheduleShow();
|
|
3050
3079
|
});
|
|
3051
|
-
|
|
3080
|
+
h(this, "handleScrollbarMouseLeave", () => {
|
|
3052
3081
|
this.isMouseOverScrollbar = !1, this.isMouseOverRoot && this.scheduleHide();
|
|
3053
3082
|
});
|
|
3054
|
-
|
|
3083
|
+
h(this, "handleMouseEnter", () => {
|
|
3055
3084
|
this.isMouseOverRoot = !0, this.scheduleShow();
|
|
3056
3085
|
});
|
|
3057
|
-
|
|
3086
|
+
h(this, "handleMouseLeave", () => {
|
|
3058
3087
|
this.isMouseOverRoot = !1, !this.isDraggingHScroll && !this.isDraggingVScroll && !this.isMouseOverScrollbar && (this.clearTimeouts(!0, !1), this.scheduleHide());
|
|
3059
3088
|
});
|
|
3060
|
-
|
|
3089
|
+
h(this, "handleHorizontalThumbMouseDown", (t) => {
|
|
3061
3090
|
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
3091
|
});
|
|
3063
|
-
|
|
3092
|
+
h(this, "handleVerticalThumbMouseDown", (t) => {
|
|
3064
3093
|
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
3094
|
});
|
|
3066
|
-
|
|
3095
|
+
h(this, "handleHorizontalTrackMouseDown", (t) => {
|
|
3067
3096
|
if (t.target !== this.hScrollbar) return;
|
|
3068
3097
|
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:
|
|
3098
|
+
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;
|
|
3099
|
+
this.scrollTo({ x: a, y: this.scrollTop }, "track");
|
|
3071
3100
|
});
|
|
3072
|
-
|
|
3101
|
+
h(this, "handleVerticalTrackMouseDown", (t) => {
|
|
3073
3102
|
if (t.target !== this.vScrollbar) return;
|
|
3074
3103
|
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:
|
|
3104
|
+
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;
|
|
3105
|
+
this.scrollTo({ x: this.scrollLeft, y: a }, "track");
|
|
3077
3106
|
});
|
|
3078
|
-
|
|
3107
|
+
h(this, "handleMouseUp", () => {
|
|
3079
3108
|
if (this.isDraggingHScroll || this.isDraggingVScroll) {
|
|
3080
3109
|
const t = this.isDraggingHScroll, e = this.isDraggingVScroll;
|
|
3081
3110
|
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
3111
|
}
|
|
3083
3112
|
});
|
|
3084
3113
|
// --- 动画处理 ---
|
|
3085
|
-
|
|
3114
|
+
h(this, "animationStep", (t) => {
|
|
3086
3115
|
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
|
-
(
|
|
3116
|
+
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;
|
|
3117
|
+
(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
3118
|
});
|
|
3090
3119
|
this.root = t, this.rootElement = e, this.options = rt(
|
|
3091
3120
|
{
|
|
@@ -3216,8 +3245,8 @@ class _e {
|
|
|
3216
3245
|
if (this.scheduleShow(), this.isDraggingHScroll) {
|
|
3217
3246
|
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
3247
|
if (n === 0 || o === 0) return;
|
|
3219
|
-
const r = e / n * o,
|
|
3220
|
-
this.scrollTo({ x:
|
|
3248
|
+
const r = e / n * o, a = this.thumbStartScrollLeft + r;
|
|
3249
|
+
this.scrollTo({ x: a, y: this.scrollTop }, "drag");
|
|
3221
3250
|
}
|
|
3222
3251
|
if (this.isDraggingVScroll) {
|
|
3223
3252
|
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 +3254,8 @@ class _e {
|
|
|
3225
3254
|
this.contentHeight - this.viewportHeight
|
|
3226
3255
|
);
|
|
3227
3256
|
if (n === 0 || o === 0) return;
|
|
3228
|
-
const r = e / n * o,
|
|
3229
|
-
this.scrollTo({ x: this.scrollLeft, y:
|
|
3257
|
+
const r = e / n * o, a = this.thumbStartScrollTop + r;
|
|
3258
|
+
this.scrollTo({ x: this.scrollLeft, y: a }, "drag");
|
|
3230
3259
|
}
|
|
3231
3260
|
}
|
|
3232
3261
|
}
|
|
@@ -3259,8 +3288,8 @@ class _e {
|
|
|
3259
3288
|
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
3289
|
const s = 150, n = (o) => {
|
|
3261
3290
|
if (!this.isAnimating) return;
|
|
3262
|
-
const r = o - this.animationStartTime,
|
|
3263
|
-
(l || m) && this.emit("wheel", g, d),
|
|
3291
|
+
const r = o - this.animationStartTime, a = Math.min(1, r / s), c = a * (2 - a), g = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * c, d = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * c, l = this.scrollLeft !== g, m = this.scrollTop !== d;
|
|
3292
|
+
(l || m) && this.emit("wheel", g, 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
3293
|
};
|
|
3265
3294
|
this.animationFrameId = requestAnimationFrame(n);
|
|
3266
3295
|
}
|
|
@@ -3308,13 +3337,13 @@ class _e {
|
|
|
3308
3337
|
*/
|
|
3309
3338
|
updateSize(t, e, i, s, n = 0, o = 0) {
|
|
3310
3339
|
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,
|
|
3340
|
+
const r = this.canScrollHorizontal() && this.options.showHorizontal, a = this.canScrollVertical() && this.options.showVertical;
|
|
3312
3341
|
if (r) {
|
|
3313
|
-
const g = this.viewportWidth - (
|
|
3314
|
-
this.hScrollbar.style.display = "block", this.hScrollbar.style.transform = `translateX(${n}px)`, this.hScrollbar.style.width = `${Math.max(0, g)}px`, this.hScrollbar.style.bottom = "0px", this.hScrollbar.style.right =
|
|
3342
|
+
const g = this.viewportWidth - (a ? this.options.track.size : 0);
|
|
3343
|
+
this.hScrollbar.style.display = "block", this.hScrollbar.style.transform = `translateX(${n}px)`, this.hScrollbar.style.width = `${Math.max(0, g)}px`, this.hScrollbar.style.bottom = "0px", this.hScrollbar.style.right = a ? `${this.options.track.size}px` : "0px";
|
|
3315
3344
|
} else
|
|
3316
3345
|
this.hScrollbar.style.display = "none";
|
|
3317
|
-
if (
|
|
3346
|
+
if (a) {
|
|
3318
3347
|
const g = this.viewportHeight - o - (r ? this.options.track.size : 0);
|
|
3319
3348
|
this.vScrollbar.style.display = "block", this.vScrollbar.style.transform = `translateY(${o}px)`, this.vScrollbar.style.height = `${Math.max(0, g)}px`, this.vScrollbar.style.right = "0px", this.vScrollbar.style.bottom = r ? `${this.options.track.size}px` : "0px";
|
|
3320
3349
|
} else
|
|
@@ -3324,7 +3353,7 @@ class _e {
|
|
|
3324
3353
|
x: this.scrollLeft,
|
|
3325
3354
|
y: this.scrollTop
|
|
3326
3355
|
});
|
|
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 && !
|
|
3356
|
+
(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
3357
|
}
|
|
3329
3358
|
updateThumbStyles() {
|
|
3330
3359
|
if (this.canScrollHorizontal() && this.options.showHorizontal) {
|
|
@@ -3442,11 +3471,11 @@ class st {
|
|
|
3442
3471
|
* @param colspan 横向合并的列数
|
|
3443
3472
|
* @param rowspan 纵向合并的行数
|
|
3444
3473
|
*/
|
|
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 =
|
|
3474
|
+
constructor(t, e, i, s, n, o, r = 1, a = 1, c) {
|
|
3475
|
+
h(this, "element");
|
|
3476
|
+
h(this, "isEmpty", !1);
|
|
3477
|
+
h(this, "isHandler", !1);
|
|
3478
|
+
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
3479
|
"border-color",
|
|
3451
3480
|
this.context.getOptions().border.color,
|
|
3452
3481
|
"important"
|
|
@@ -3525,9 +3554,9 @@ class St {
|
|
|
3525
3554
|
*/
|
|
3526
3555
|
constructor(t, e, i, s, n = !1) {
|
|
3527
3556
|
// 行元素
|
|
3528
|
-
|
|
3557
|
+
h(this, "element");
|
|
3529
3558
|
// 行内单元格集合
|
|
3530
|
-
|
|
3559
|
+
h(this, "cells", []);
|
|
3531
3560
|
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
3561
|
}
|
|
3533
3562
|
/**
|
|
@@ -3539,7 +3568,7 @@ class St {
|
|
|
3539
3568
|
}), this.element.addEventListener("mouseleave", () => {
|
|
3540
3569
|
this.context.event.emit(k.ROW_UNHIGHLIGHT, this.task.id);
|
|
3541
3570
|
}), this.element.addEventListener("click", (t) => {
|
|
3542
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) ||
|
|
3571
|
+
this.context.store.getDataManager().isTaskSelected(this.task.id) || this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(k.ROW_CLICK, t, this.task);
|
|
3543
3572
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
3544
3573
|
this.context.event.emit(k.ROW_DBL_CLICK, t, this.task);
|
|
3545
3574
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
@@ -3606,7 +3635,7 @@ class St {
|
|
|
3606
3635
|
const o = e[n], r = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
3607
3636
|
if (r) {
|
|
3608
3637
|
if (r.task.id !== this.task.id) {
|
|
3609
|
-
const
|
|
3638
|
+
const a = new st(
|
|
3610
3639
|
this.context,
|
|
3611
3640
|
this.element,
|
|
3612
3641
|
o,
|
|
@@ -3617,9 +3646,9 @@ class St {
|
|
|
3617
3646
|
1,
|
|
3618
3647
|
"empty"
|
|
3619
3648
|
);
|
|
3620
|
-
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(
|
|
3649
|
+
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(a);
|
|
3621
3650
|
} else if (r.originColumnIndex === n) {
|
|
3622
|
-
const
|
|
3651
|
+
const a = new st(
|
|
3623
3652
|
this.context,
|
|
3624
3653
|
this.element,
|
|
3625
3654
|
o,
|
|
@@ -3629,10 +3658,10 @@ class St {
|
|
|
3629
3658
|
r.colspan,
|
|
3630
3659
|
r.rowspan
|
|
3631
3660
|
);
|
|
3632
|
-
this.cells.push(
|
|
3661
|
+
this.cells.push(a);
|
|
3633
3662
|
}
|
|
3634
3663
|
} else {
|
|
3635
|
-
let
|
|
3664
|
+
let a = 1, c = 1;
|
|
3636
3665
|
const g = (s = (i = o.column).merge) == null ? void 0 : s.call(
|
|
3637
3666
|
i,
|
|
3638
3667
|
this.task.getField(o.column.field),
|
|
@@ -3640,7 +3669,7 @@ class St {
|
|
|
3640
3669
|
n,
|
|
3641
3670
|
this.task.level + 1
|
|
3642
3671
|
);
|
|
3643
|
-
if (g && (typeof g.col != "number" ? O.error("colspan function must returned a number") :
|
|
3672
|
+
if (g && (typeof g.col != "number" ? O.error("colspan function must returned a number") : a = g.col, typeof g.row != "number" ? O.error("rowspan function must returned a number") : c = g.row), a > 1 || c > 1) {
|
|
3644
3673
|
if (c > 1)
|
|
3645
3674
|
for (let p = 1; p < c; p++) {
|
|
3646
3675
|
const u = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + p];
|
|
@@ -3652,17 +3681,17 @@ class St {
|
|
|
3652
3681
|
const l = {
|
|
3653
3682
|
task: this.task,
|
|
3654
3683
|
originColumnIndex: n,
|
|
3655
|
-
colspan:
|
|
3684
|
+
colspan: a,
|
|
3656
3685
|
rowspan: c
|
|
3657
3686
|
};
|
|
3658
3687
|
let m = this.task;
|
|
3659
3688
|
for (let p = c; p > 0; p--)
|
|
3660
3689
|
if (m) {
|
|
3661
|
-
for (let u = 0; u <
|
|
3690
|
+
for (let u = 0; u < a; u++)
|
|
3662
3691
|
this.context.store.getColumnManager().addMergeInfo(m.id, u + n, l);
|
|
3663
3692
|
m = this.context.store.getDataManager().getVisibleTasks().at(m.flatIndex + 1);
|
|
3664
3693
|
}
|
|
3665
|
-
for (let p = 0; p <
|
|
3694
|
+
for (let p = 0; p < a; p++)
|
|
3666
3695
|
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, l);
|
|
3667
3696
|
}
|
|
3668
3697
|
const d = new st(
|
|
@@ -3672,7 +3701,7 @@ class St {
|
|
|
3672
3701
|
this.task,
|
|
3673
3702
|
this.task.flatIndex,
|
|
3674
3703
|
n,
|
|
3675
|
-
|
|
3704
|
+
a,
|
|
3676
3705
|
c
|
|
3677
3706
|
);
|
|
3678
3707
|
this.cells.push(d);
|
|
@@ -3708,9 +3737,9 @@ class St {
|
|
|
3708
3737
|
}
|
|
3709
3738
|
class Ae {
|
|
3710
3739
|
constructor(t, e) {
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3740
|
+
h(this, "element");
|
|
3741
|
+
h(this, "rows", /* @__PURE__ */ new Map());
|
|
3742
|
+
h(this, "mergeRows", /* @__PURE__ */ new Map());
|
|
3714
3743
|
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
3744
|
}
|
|
3716
3745
|
render(t, e) {
|
|
@@ -3728,13 +3757,13 @@ class Ae {
|
|
|
3728
3757
|
}), e.forEach((n, o) => {
|
|
3729
3758
|
const r = n.id;
|
|
3730
3759
|
if (this.rows.has(r)) {
|
|
3731
|
-
const
|
|
3732
|
-
|
|
3760
|
+
const a = this.rows.get(r);
|
|
3761
|
+
a.update(n), a.updateTop(t);
|
|
3733
3762
|
} else {
|
|
3734
|
-
const
|
|
3735
|
-
|
|
3763
|
+
const a = new St(this.context, this.element, n, t);
|
|
3764
|
+
a.create(), this.rows.set(r, a);
|
|
3736
3765
|
}
|
|
3737
|
-
this.context.store.getColumnManager().getLeafColumns().forEach((
|
|
3766
|
+
this.context.store.getColumnManager().getLeafColumns().forEach((a, c) => {
|
|
3738
3767
|
const g = this.context.store.getColumnManager().getMergeInfo(n.id, c);
|
|
3739
3768
|
if (g && g.rowspan > 1) {
|
|
3740
3769
|
const d = g.task.id;
|
|
@@ -3785,7 +3814,7 @@ class Ae {
|
|
|
3785
3814
|
}
|
|
3786
3815
|
class pt {
|
|
3787
3816
|
constructor(t, e, i, s) {
|
|
3788
|
-
|
|
3817
|
+
h(this, "columnElement");
|
|
3789
3818
|
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
3819
|
}
|
|
3791
3820
|
initElement() {
|
|
@@ -3826,14 +3855,14 @@ class pt {
|
|
|
3826
3855
|
let e = 0, i = 0, s = null, n = 0;
|
|
3827
3856
|
const o = (c) => {
|
|
3828
3857
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3829
|
-
const g = (l) => r(l), d = (l) =>
|
|
3858
|
+
const g = (l) => r(l), d = (l) => a(l, g, d);
|
|
3830
3859
|
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(k.SHOW_GUIDELINE, n);
|
|
3831
3860
|
}, r = (c) => {
|
|
3832
3861
|
if (c.preventDefault(), !s) return;
|
|
3833
3862
|
const g = c.clientX - e, d = i + g, l = Math.max(50, d), m = e - s.left - i, u = this.root.clientWidth - 20;
|
|
3834
3863
|
let y = m + l;
|
|
3835
3864
|
y = Math.min(u, y), this.context.event.emit(k.MOVE_GUIDELINE, y);
|
|
3836
|
-
},
|
|
3865
|
+
}, a = (c, g, d) => {
|
|
3837
3866
|
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(k.HIDE_GUIDELINE);
|
|
3838
3867
|
const l = c.clientX - e, m = Math.max(50, i + l);
|
|
3839
3868
|
this.setWidth(m);
|
|
@@ -3843,10 +3872,10 @@ class pt {
|
|
|
3843
3872
|
}
|
|
3844
3873
|
class xt {
|
|
3845
3874
|
constructor(t, e, i, s) {
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3875
|
+
h(this, "groupElement");
|
|
3876
|
+
h(this, "titleContainer");
|
|
3877
|
+
h(this, "childContainer");
|
|
3878
|
+
h(this, "children", []);
|
|
3850
3879
|
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
3880
|
}
|
|
3852
3881
|
initElement() {
|
|
@@ -3887,8 +3916,8 @@ class xt {
|
|
|
3887
3916
|
}
|
|
3888
3917
|
class Ie {
|
|
3889
3918
|
constructor(t, e) {
|
|
3890
|
-
|
|
3891
|
-
|
|
3919
|
+
h(this, "headerElement");
|
|
3920
|
+
h(this, "headerColumns", []);
|
|
3892
3921
|
this.context = t, this.container = e, this.headerElement = document.createElement("div"), this.initElement(), this.container.appendChild(this.headerElement);
|
|
3893
3922
|
}
|
|
3894
3923
|
initElement() {
|
|
@@ -3947,9 +3976,9 @@ class Ie {
|
|
|
3947
3976
|
}
|
|
3948
3977
|
class He {
|
|
3949
3978
|
constructor(t, e) {
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3979
|
+
h(this, "tableContainer");
|
|
3980
|
+
h(this, "tableHeader");
|
|
3981
|
+
h(this, "tableBody");
|
|
3953
3982
|
this.context = t, this.container = e, this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table-container", this.tableContainer.style.position = "relative", this.tableContainer.style.width = "100%", this.tableContainer.style.height = "100%", this.tableContainer.style.overflow = "hidden", this.tableContainer.style.display = "flex", this.tableContainer.style.flexDirection = "column", this.container.appendChild(this.tableContainer), this.tableHeader = new Ie(t, this.tableContainer), this.tableBody = new Ae(t, this.tableContainer), this.listenEvents();
|
|
3954
3983
|
}
|
|
3955
3984
|
render(t, e) {
|
|
@@ -3974,17 +4003,17 @@ class He {
|
|
|
3974
4003
|
}
|
|
3975
4004
|
class Ge {
|
|
3976
4005
|
constructor(t, e) {
|
|
3977
|
-
|
|
4006
|
+
h(this, "background");
|
|
3978
4007
|
// 表头背景
|
|
3979
|
-
|
|
4008
|
+
h(this, "groupHeader");
|
|
3980
4009
|
// 主表头 (年/月)
|
|
3981
|
-
|
|
4010
|
+
h(this, "cellHeader");
|
|
3982
4011
|
// 次表头 (月/日)
|
|
3983
|
-
|
|
4012
|
+
h(this, "cellCache", /* @__PURE__ */ new Map());
|
|
3984
4013
|
// 状态变量
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4014
|
+
h(this, "width", 0);
|
|
4015
|
+
h(this, "height", 0);
|
|
4016
|
+
h(this, "offsetX", 0);
|
|
3988
4017
|
this.context = t, this.layer = e, this.background = new S.Rect({
|
|
3989
4018
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
3990
4019
|
name: "header-background"
|
|
@@ -4042,18 +4071,18 @@ class Ge {
|
|
|
4042
4071
|
})
|
|
4043
4072
|
);
|
|
4044
4073
|
const r = t.getTimeline();
|
|
4045
|
-
let
|
|
4074
|
+
let a = 0;
|
|
4046
4075
|
for (let g = 0; g < r.length; g++) {
|
|
4047
4076
|
const d = r[g], l = e * (((c = d.children) == null ? void 0 : c.length) ?? 0);
|
|
4048
|
-
if (
|
|
4049
|
-
|
|
4077
|
+
if (a + l < i) {
|
|
4078
|
+
a += l;
|
|
4050
4079
|
continue;
|
|
4051
4080
|
}
|
|
4052
|
-
if (
|
|
4081
|
+
if (a > s)
|
|
4053
4082
|
break;
|
|
4054
4083
|
const p = this.createCell(
|
|
4055
4084
|
`group-${d.date.format("YYYY-MM-DD")}`,
|
|
4056
|
-
|
|
4085
|
+
a,
|
|
4057
4086
|
0,
|
|
4058
4087
|
l,
|
|
4059
4088
|
n,
|
|
@@ -4061,7 +4090,7 @@ class Ge {
|
|
|
4061
4090
|
d.label
|
|
4062
4091
|
);
|
|
4063
4092
|
if (this.groupHeader.add(p), X(d.children) && d.children.length > 0) {
|
|
4064
|
-
let u =
|
|
4093
|
+
let u = a;
|
|
4065
4094
|
for (let y = 0; y < d.children.length; ) {
|
|
4066
4095
|
const x = d.children[y];
|
|
4067
4096
|
let T = 1;
|
|
@@ -4092,13 +4121,13 @@ class Ge {
|
|
|
4092
4121
|
this.cellHeader.add(C), x.hide && C.visible(!1), u += b;
|
|
4093
4122
|
}
|
|
4094
4123
|
}
|
|
4095
|
-
|
|
4124
|
+
a += l;
|
|
4096
4125
|
}
|
|
4097
4126
|
this.layer.batchDraw();
|
|
4098
4127
|
}
|
|
4099
4128
|
createCell(t, e, i, s, n, o, r) {
|
|
4100
|
-
const
|
|
4101
|
-
|
|
4129
|
+
const a = new S.Group();
|
|
4130
|
+
a.x(e), a.y(i);
|
|
4102
4131
|
const c = new S.Rect({
|
|
4103
4132
|
id: t,
|
|
4104
4133
|
x: 0,
|
|
@@ -4108,7 +4137,7 @@ class Ge {
|
|
|
4108
4137
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
4109
4138
|
name: "header-cell-bg"
|
|
4110
4139
|
});
|
|
4111
|
-
|
|
4140
|
+
a.add(c);
|
|
4112
4141
|
let g = this.context.getOptions().header.fontSize;
|
|
4113
4142
|
t.startsWith("cell-") && (this.cellCache.set(t, c), g -= 2);
|
|
4114
4143
|
const d = new S.Line({
|
|
@@ -4117,7 +4146,7 @@ class Ge {
|
|
|
4117
4146
|
strokeWidth: 1,
|
|
4118
4147
|
name: "header-cell-right-border"
|
|
4119
4148
|
});
|
|
4120
|
-
|
|
4149
|
+
a.add(d);
|
|
4121
4150
|
const l = new S.Text({
|
|
4122
4151
|
x: 0,
|
|
4123
4152
|
y: 0,
|
|
@@ -4134,7 +4163,7 @@ class Ge {
|
|
|
4134
4163
|
ellipsis: !0,
|
|
4135
4164
|
name: "header-cell-text"
|
|
4136
4165
|
});
|
|
4137
|
-
return
|
|
4166
|
+
return a.add(l), a;
|
|
4138
4167
|
}
|
|
4139
4168
|
/**
|
|
4140
4169
|
* 清除表头内容
|
|
@@ -4171,9 +4200,9 @@ class Ge {
|
|
|
4171
4200
|
), s = this.cellCache.get(
|
|
4172
4201
|
`cell-${(r = e == null ? void 0 : e.endTime) == null ? void 0 : r.format("YYYY-MM-DD")}`
|
|
4173
4202
|
), n = this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor;
|
|
4174
|
-
n && (this.cellCache.forEach((
|
|
4203
|
+
n && (this.cellCache.forEach((a) => {
|
|
4175
4204
|
new S.Tween({
|
|
4176
|
-
node:
|
|
4205
|
+
node: a,
|
|
4177
4206
|
fill: n,
|
|
4178
4207
|
duration: 0.02
|
|
4179
4208
|
}).play();
|
|
@@ -4191,13 +4220,13 @@ class Ge {
|
|
|
4191
4220
|
class Re {
|
|
4192
4221
|
constructor(t, e) {
|
|
4193
4222
|
// 网格线组
|
|
4194
|
-
|
|
4195
|
-
|
|
4223
|
+
h(this, "verticalLines");
|
|
4224
|
+
h(this, "horizontalLines");
|
|
4196
4225
|
// 状态变量
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4226
|
+
h(this, "width", 0);
|
|
4227
|
+
h(this, "height", 0);
|
|
4228
|
+
h(this, "offsetX", 0);
|
|
4229
|
+
h(this, "offsetY", 0);
|
|
4201
4230
|
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
4231
|
}
|
|
4203
4232
|
/**
|
|
@@ -4232,7 +4261,7 @@ class Re {
|
|
|
4232
4261
|
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
4262
|
0,
|
|
4234
4263
|
Math.floor(-this.offsetX / i) - 2
|
|
4235
|
-
),
|
|
4264
|
+
), a = Math.min(
|
|
4236
4265
|
this.context.store.getTimeAxis().getCellCount(),
|
|
4237
4266
|
Math.ceil((-this.offsetX + this.width) / i) + 2
|
|
4238
4267
|
), c = Math.max(
|
|
@@ -4243,7 +4272,7 @@ class Re {
|
|
|
4243
4272
|
Math.ceil((-this.offsetY + this.height) / s) + 2
|
|
4244
4273
|
);
|
|
4245
4274
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
4246
|
-
for (let d = r; d <=
|
|
4275
|
+
for (let d = r; d <= a; d++) {
|
|
4247
4276
|
const l = d * i, m = new S.Line({
|
|
4248
4277
|
points: [l, t, l, o + t],
|
|
4249
4278
|
stroke: this.context.getOptions().border.color,
|
|
@@ -4272,34 +4301,34 @@ class Re {
|
|
|
4272
4301
|
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
4302
|
class We {
|
|
4274
4303
|
constructor(t, e, i, s, n) {
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4304
|
+
h(this, "offsetX", 0);
|
|
4305
|
+
h(this, "offsetY", 0);
|
|
4306
|
+
h(this, "sliderGroup");
|
|
4307
|
+
h(this, "slider");
|
|
4308
|
+
h(this, "sliderBar", null);
|
|
4309
|
+
h(this, "sliderType", "");
|
|
4310
|
+
h(this, "leftHandleGroup", null);
|
|
4311
|
+
h(this, "rightHandleGroup", null);
|
|
4312
|
+
h(this, "progressGroup", null);
|
|
4313
|
+
h(this, "handlerWidth", 10);
|
|
4285
4314
|
// 自动滚动相关变量
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4315
|
+
h(this, "autoMoveTimer", null);
|
|
4316
|
+
h(this, "autoScrollTimer", null);
|
|
4317
|
+
h(this, "autoExpandTimer", null);
|
|
4318
|
+
h(this, "EDGE_THRESHOLD", 20);
|
|
4290
4319
|
// 边缘检测阈值,单位px
|
|
4291
|
-
|
|
4320
|
+
h(this, "SCROLL_STEP", 5);
|
|
4292
4321
|
// 每次滚动的步长,单位px
|
|
4293
|
-
|
|
4322
|
+
h(this, "MOVE_INTERVAL", 1e3 / 60);
|
|
4294
4323
|
// 移动间隔,单位ms,约60fps
|
|
4295
|
-
|
|
4324
|
+
h(this, "AUTO_EXPAND_INTERVAL", 500);
|
|
4296
4325
|
// 自动扩展间隔,单位ms
|
|
4297
4326
|
// 拖拽状态变量
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4327
|
+
h(this, "isDragging", !1);
|
|
4328
|
+
h(this, "draggingDirection", "none");
|
|
4329
|
+
h(this, "dragDiffX", 0);
|
|
4301
4330
|
// 记录拖拽时的原始数据
|
|
4302
|
-
|
|
4331
|
+
h(this, "oldTasks", []);
|
|
4303
4332
|
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new S.Group({
|
|
4304
4333
|
x: e,
|
|
4305
4334
|
y: i,
|
|
@@ -4331,7 +4360,7 @@ class We {
|
|
|
4331
4360
|
const t = this.context.getOptions().row.height, e = nt(
|
|
4332
4361
|
this.unpackFunc(this.context.getOptions().bar.height),
|
|
4333
4362
|
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,
|
|
4363
|
+
), 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
4364
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4336
4365
|
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", g = 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
4366
|
this.slider || (this.slider = new S.Group({
|
|
@@ -4433,23 +4462,23 @@ class We {
|
|
|
4433
4462
|
fontFamily: zt
|
|
4434
4463
|
}), at = it.measureSize(F);
|
|
4435
4464
|
it.width(at.width);
|
|
4436
|
-
const
|
|
4465
|
+
const K = { x: 0, y: 0 };
|
|
4437
4466
|
switch (z) {
|
|
4438
4467
|
case "top-left":
|
|
4439
|
-
|
|
4468
|
+
K.x = -(12 + at.width), K.y = -8;
|
|
4440
4469
|
break;
|
|
4441
4470
|
case "bottom-left":
|
|
4442
|
-
|
|
4471
|
+
K.x = -(12 + at.width), K.y = 10;
|
|
4443
4472
|
break;
|
|
4444
4473
|
case "bottom-right":
|
|
4445
|
-
|
|
4474
|
+
K.x = 12, K.y = 10;
|
|
4446
4475
|
break;
|
|
4447
4476
|
case "top-right":
|
|
4448
4477
|
default:
|
|
4449
|
-
|
|
4478
|
+
K.x = 12, K.y = -8;
|
|
4450
4479
|
break;
|
|
4451
4480
|
}
|
|
4452
|
-
it.setAttrs(
|
|
4481
|
+
it.setAttrs(K), this.slider.add(it);
|
|
4453
4482
|
}
|
|
4454
4483
|
}
|
|
4455
4484
|
this.sliderType = "milestone";
|
|
@@ -4483,7 +4512,7 @@ class We {
|
|
|
4483
4512
|
width: o,
|
|
4484
4513
|
height: e,
|
|
4485
4514
|
fill: r,
|
|
4486
|
-
cornerRadius:
|
|
4515
|
+
cornerRadius: a
|
|
4487
4516
|
}), this.renderProgress(o, e);
|
|
4488
4517
|
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (u = this.context.getOptions().bar.move.single) == null ? void 0 : u.backgroundColor, H = D ? B(D).alpha(((y = this.context.getOptions().bar.move.single) == null ? void 0 : y.opacity) ?? 1).toHex() : B(r).brighten(30 * (this.unpackFunc((x = this.context.getOptions().bar.progress) == null ? void 0 : x.show) ? -1 : 1)).alpha(((T = this.context.getOptions().bar.move.single) == null ? void 0 : T.opacity) ?? 1).toHex();
|
|
4489
4518
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
@@ -4521,7 +4550,7 @@ class We {
|
|
|
4521
4550
|
width: this.handlerWidth,
|
|
4522
4551
|
height: e,
|
|
4523
4552
|
fill: H,
|
|
4524
|
-
cornerRadius: [
|
|
4553
|
+
cornerRadius: [a[0], 0, 0, a[3]]
|
|
4525
4554
|
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
4526
4555
|
x: 0,
|
|
4527
4556
|
y: (e - this.handlerWidth) / 2,
|
|
@@ -4565,7 +4594,7 @@ class We {
|
|
|
4565
4594
|
width: this.handlerWidth,
|
|
4566
4595
|
height: e,
|
|
4567
4596
|
fill: H,
|
|
4568
|
-
cornerRadius: [0,
|
|
4597
|
+
cornerRadius: [0, a[1], a[2], 0]
|
|
4569
4598
|
}), (v = this.rightHandleGroup.findOne("Image")) == null || v.setAttrs({
|
|
4570
4599
|
x: o - this.handlerWidth,
|
|
4571
4600
|
y: (e - this.handlerWidth) / 2,
|
|
@@ -4584,7 +4613,7 @@ class We {
|
|
|
4584
4613
|
}
|
|
4585
4614
|
renderText(t, e) {
|
|
4586
4615
|
const i = `chart-slider-text-${this.task.id}`, s = () => {
|
|
4587
|
-
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((
|
|
4616
|
+
this.slider.find(`#${i}`) && this.slider.find(`#${i}`).forEach((a) => a.remove());
|
|
4588
4617
|
};
|
|
4589
4618
|
if (!this.context.getOptions().bar.field && !this.context.getOptions().bar.label) {
|
|
4590
4619
|
s();
|
|
@@ -4595,7 +4624,7 @@ class We {
|
|
|
4595
4624
|
n ? o = this.unpackFunc(n) : this.context.getOptions().bar.field && (o = this.task.getField(this.context.getOptions().bar.field)), s();
|
|
4596
4625
|
const r = t - (this.leftHandleGroup ? this.handlerWidth : 0) - (this.rightHandleGroup ? this.handlerWidth : 0);
|
|
4597
4626
|
if (r > 20) {
|
|
4598
|
-
const
|
|
4627
|
+
const a = new S.Text({
|
|
4599
4628
|
id: i,
|
|
4600
4629
|
x: this.leftHandleGroup ? 10 : 0,
|
|
4601
4630
|
y: 0,
|
|
@@ -4610,11 +4639,11 @@ class We {
|
|
|
4610
4639
|
verticalAlign: this.unpackFunc(this.context.getOptions().bar.verticalAlign) || "middle",
|
|
4611
4640
|
ellipsis: !0
|
|
4612
4641
|
});
|
|
4613
|
-
this.slider.add(
|
|
4642
|
+
this.slider.add(a);
|
|
4614
4643
|
}
|
|
4615
4644
|
}
|
|
4616
4645
|
renderProgress(t, e) {
|
|
4617
|
-
var i, s, n, o, r,
|
|
4646
|
+
var i, s, n, o, r, a, c, g, d, l, m, p;
|
|
4618
4647
|
if (!this.unpackFunc((i = this.context.getOptions().bar.progress) == null ? void 0 : i.show)) {
|
|
4619
4648
|
this.progressGroup && (this.progressGroup.destroy(), this.progressGroup = null);
|
|
4620
4649
|
return;
|
|
@@ -4650,7 +4679,7 @@ class We {
|
|
|
4650
4679
|
height: e,
|
|
4651
4680
|
fill: x,
|
|
4652
4681
|
cornerRadius: b,
|
|
4653
|
-
opacity: this.unpackFunc((
|
|
4682
|
+
opacity: this.unpackFunc((a = this.context.getOptions().bar.progress) == null ? void 0 : a.opacity)
|
|
4654
4683
|
});
|
|
4655
4684
|
this.progressGroup.add(C);
|
|
4656
4685
|
const L = `${gt(
|
|
@@ -4723,10 +4752,10 @@ class We {
|
|
|
4723
4752
|
if (i) {
|
|
4724
4753
|
const s = this.context.getOptions().row.height, n = this.y + this.offsetY, o = n + s;
|
|
4725
4754
|
if (i.y < n || i.y > o) {
|
|
4726
|
-
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)",
|
|
4755
|
+
const r = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", a = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, c = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, g = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4727
4756
|
this.handleBarHighlight({
|
|
4728
4757
|
shadowColor: r,
|
|
4729
|
-
shadowBlur:
|
|
4758
|
+
shadowBlur: a,
|
|
4730
4759
|
shadowOffsetX: c,
|
|
4731
4760
|
shadowOffsetY: g
|
|
4732
4761
|
}), this.handleResizeHighlight(0), e.container().style.cursor = "default";
|
|
@@ -4736,7 +4765,7 @@ class We {
|
|
|
4736
4765
|
this.context.event.emit(k.SLIDER_DRAGGING, !1);
|
|
4737
4766
|
}
|
|
4738
4767
|
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(),
|
|
4768
|
+
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = t.target.width(), a = t.target.x(), c = a + r, g = Math.max(0, -this.offsetX - a), d = Math.max(0, c - (-this.offsetX + i));
|
|
4740
4769
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4741
4770
|
const l = t.target.width(), m = t.target.x(), p = m + l, u = -this.offsetX, y = u + i, x = this.context.store.getTimeAxis().getTotalWidth(), T = m <= u + this.EDGE_THRESHOLD, b = p >= y - this.EDGE_THRESHOLD;
|
|
4742
4771
|
if (T)
|
|
@@ -4777,10 +4806,10 @@ class We {
|
|
|
4777
4806
|
if (!i) return;
|
|
4778
4807
|
this.isDragging = !0, this.context.event.emit(k.SLIDER_DRAGGING, !0);
|
|
4779
4808
|
let s = ((y = i.getPointerPosition()) == null ? void 0 : y.x) || 0;
|
|
4780
|
-
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock,
|
|
4809
|
+
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, a = i.width();
|
|
4781
4810
|
let c = 0, g = 0;
|
|
4782
4811
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4783
|
-
const x = this.slider.width(), T = this.slider.x(), b = T + x, w = -this.offsetX, C = w +
|
|
4812
|
+
const x = this.slider.width(), T = this.slider.x(), b = T + x, w = -this.offsetX, C = w + a, L = T <= w + this.EDGE_THRESHOLD, E = b >= C - this.EDGE_THRESHOLD;
|
|
4784
4813
|
if (L && e === "left") {
|
|
4785
4814
|
if (w <= 0)
|
|
4786
4815
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
@@ -4824,7 +4853,7 @@ class We {
|
|
|
4824
4853
|
x.movementX > 0 ? this.draggingDirection = "right" : x.movementX < 0 && (this.draggingDirection = "left");
|
|
4825
4854
|
const T = Math.max(((w = i.getPointerPosition()) == null ? void 0 : w.x) || 0, 0);
|
|
4826
4855
|
let b = T - s;
|
|
4827
|
-
n && (b = ct(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && T <
|
|
4856
|
+
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 + g >= o && T > this.EDGE_THRESHOLD && (this.slider.width(m + b + g), this.emitUpdate("right")), d = b);
|
|
4828
4857
|
}, u = () => {
|
|
4829
4858
|
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", u);
|
|
4830
4859
|
};
|
|
@@ -4900,20 +4929,20 @@ class We {
|
|
|
4900
4929
|
this.sliderGroup.opacity(t), n.stop();
|
|
4901
4930
|
return;
|
|
4902
4931
|
}
|
|
4903
|
-
const
|
|
4932
|
+
const a = r % e / e;
|
|
4904
4933
|
let c;
|
|
4905
|
-
|
|
4934
|
+
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
4935
|
}, this.sliderGroup.getLayer());
|
|
4907
4936
|
n.start();
|
|
4908
4937
|
}
|
|
4909
4938
|
}
|
|
4910
4939
|
class $e {
|
|
4911
4940
|
constructor(t, e, i, s, n, o, r) {
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4941
|
+
h(this, "row");
|
|
4942
|
+
h(this, "slider");
|
|
4943
|
+
h(this, "cacheKey", "");
|
|
4915
4944
|
this.context = t, this.task = e, this.width = o, this.height = r, this.row = new S.Group();
|
|
4916
|
-
const
|
|
4945
|
+
const a = new S.Rect({
|
|
4917
4946
|
x: s,
|
|
4918
4947
|
y: n,
|
|
4919
4948
|
width: o,
|
|
@@ -4921,7 +4950,7 @@ class $e {
|
|
|
4921
4950
|
id: i,
|
|
4922
4951
|
listening: !1
|
|
4923
4952
|
});
|
|
4924
|
-
this.row.add(
|
|
4953
|
+
this.row.add(a), this.slider = new We(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
4925
4954
|
}
|
|
4926
4955
|
update(t, e) {
|
|
4927
4956
|
this.slider.update(t, e);
|
|
@@ -4935,24 +4964,24 @@ class $e {
|
|
|
4935
4964
|
}
|
|
4936
4965
|
class Fe {
|
|
4937
4966
|
constructor(t, e, i, s) {
|
|
4938
|
-
|
|
4967
|
+
h(this, "tasks", []);
|
|
4939
4968
|
// 当前渲染的任务列表
|
|
4940
|
-
|
|
4969
|
+
h(this, "rowsGroup");
|
|
4941
4970
|
// 包含所有行的容器
|
|
4942
|
-
|
|
4943
|
-
|
|
4971
|
+
h(this, "rowsCache", /* @__PURE__ */ new Map());
|
|
4972
|
+
h(this, "rowBgGroup");
|
|
4944
4973
|
// 行背景容器
|
|
4945
4974
|
// 状态变量
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4975
|
+
h(this, "width", 0);
|
|
4976
|
+
h(this, "height", 0);
|
|
4977
|
+
h(this, "offsetX", 0);
|
|
4978
|
+
h(this, "offsetY", 0);
|
|
4950
4979
|
// 高亮相关
|
|
4951
|
-
|
|
4952
|
-
|
|
4980
|
+
h(this, "highlightedRowId", null);
|
|
4981
|
+
h(this, "highlightRect", null);
|
|
4953
4982
|
// 选中相关
|
|
4954
|
-
|
|
4955
|
-
|
|
4983
|
+
h(this, "selectedRowId", null);
|
|
4984
|
+
h(this, "selectedRect", null);
|
|
4956
4985
|
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
4986
|
}
|
|
4958
4987
|
/**
|
|
@@ -5059,10 +5088,7 @@ class Fe {
|
|
|
5059
5088
|
const e = this.stage.getPointerPosition();
|
|
5060
5089
|
if (!e) return;
|
|
5061
5090
|
const i = this.getTaskByPosition(e);
|
|
5062
|
-
|
|
5063
|
-
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
5064
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(k.ROW_CLICK, t.evt, i);
|
|
5065
|
-
}
|
|
5091
|
+
i && (this.context.store.getDataManager().isTaskSelected(i.id) || this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(k.ROW_CLICK, t.evt, i));
|
|
5066
5092
|
}
|
|
5067
5093
|
/**
|
|
5068
5094
|
* 处理双击
|
|
@@ -5183,7 +5209,7 @@ class Fe {
|
|
|
5183
5209
|
if (!this.selectedRect || this.selectedRowId === null) return;
|
|
5184
5210
|
const e = this.rowsCache.get(`chart-row-${this.selectedRowId}`);
|
|
5185
5211
|
if (e)
|
|
5186
|
-
if (this.context.store.getDataManager().
|
|
5212
|
+
if (this.context.store.getDataManager().isTaskVisible(e.task)) {
|
|
5187
5213
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
5188
5214
|
this.selectedRect.y(s + this.offsetY), this.layer.batchDraw();
|
|
5189
5215
|
} else
|
|
@@ -5231,26 +5257,26 @@ class Bt {
|
|
|
5231
5257
|
angle: s = (t == null ? void 0 : t.angle) ?? 30,
|
|
5232
5258
|
spacing: n = (t == null ? void 0 : t.spacing) || 10
|
|
5233
5259
|
} = t || {}, o = s % 180, r = o * Math.PI / 180;
|
|
5234
|
-
let
|
|
5235
|
-
o === 0 ? (
|
|
5260
|
+
let a, c;
|
|
5261
|
+
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))));
|
|
5236
5262
|
const g = new S.Stage({
|
|
5237
5263
|
container: document.createElement("div"),
|
|
5238
|
-
width:
|
|
5264
|
+
width: a,
|
|
5239
5265
|
height: c
|
|
5240
5266
|
}), d = new S.Layer();
|
|
5241
5267
|
g.add(d);
|
|
5242
5268
|
const l = new S.Group();
|
|
5243
5269
|
if (o === 0 || o === 90) {
|
|
5244
5270
|
const p = new S.Line({
|
|
5245
|
-
points: [0, 0, o === 0 ?
|
|
5271
|
+
points: [0, 0, o === 0 ? a : 0, o === 0 ? 0 : c],
|
|
5246
5272
|
stroke: e,
|
|
5247
5273
|
strokeWidth: i,
|
|
5248
5274
|
perfectDrawEnabled: !0
|
|
5249
5275
|
});
|
|
5250
5276
|
l.add(p);
|
|
5251
5277
|
} else
|
|
5252
|
-
for (let p = -
|
|
5253
|
-
const u = p + i / 2, y = 0, x = p + i / 2 + (Math.cos(r) < 0 ? -
|
|
5278
|
+
for (let p = -a; p < a * 2; p += a) {
|
|
5279
|
+
const u = p + i / 2, y = 0, x = p + i / 2 + (Math.cos(r) < 0 ? -a : a), T = c, b = new S.Line({
|
|
5254
5280
|
points: [Math.ceil(u), Math.ceil(y), Math.ceil(x), Math.ceil(T)],
|
|
5255
5281
|
stroke: e,
|
|
5256
5282
|
strokeWidth: i,
|
|
@@ -5272,12 +5298,12 @@ class Bt {
|
|
|
5272
5298
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
5273
5299
|
width: i = (t == null ? void 0 : t.width) || 2,
|
|
5274
5300
|
spacing: s = (t == null ? void 0 : t.spacing) || 4
|
|
5275
|
-
} = t || {}, n = i * 2 + s * 2, o = n, r = B(e),
|
|
5301
|
+
} = t || {}, n = i * 2 + s * 2, o = n, r = B(e), a = new S.Stage({
|
|
5276
5302
|
container: document.createElement("div"),
|
|
5277
5303
|
width: n,
|
|
5278
5304
|
height: o
|
|
5279
5305
|
}), c = new S.Layer();
|
|
5280
|
-
|
|
5306
|
+
a.add(c), [
|
|
5281
5307
|
{ x: s / 2 + i / 2, y: s / 2 + i / 2 },
|
|
5282
5308
|
{
|
|
5283
5309
|
x: n - s / 2 - i / 2,
|
|
@@ -5301,7 +5327,7 @@ class Bt {
|
|
|
5301
5327
|
c.add(m);
|
|
5302
5328
|
}), c.draw();
|
|
5303
5329
|
const d = new Image();
|
|
5304
|
-
return d.src =
|
|
5330
|
+
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5305
5331
|
}
|
|
5306
5332
|
/**
|
|
5307
5333
|
* 创建网格图案
|
|
@@ -5311,12 +5337,12 @@ class Bt {
|
|
|
5311
5337
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
5312
5338
|
width: i = (t == null ? void 0 : t.width) || 1,
|
|
5313
5339
|
spacing: s = (t == null ? void 0 : t.spacing) || 20
|
|
5314
|
-
} = t || {}, n = i + s, o = n, r = n,
|
|
5340
|
+
} = t || {}, n = i + s, o = n, r = n, a = new S.Stage({
|
|
5315
5341
|
container: document.createElement("div"),
|
|
5316
5342
|
width: o,
|
|
5317
5343
|
height: r
|
|
5318
5344
|
}), c = new S.Layer();
|
|
5319
|
-
|
|
5345
|
+
a.add(c);
|
|
5320
5346
|
const g = new S.Group();
|
|
5321
5347
|
g.add(
|
|
5322
5348
|
new S.Line({
|
|
@@ -5334,19 +5360,19 @@ class Bt {
|
|
|
5334
5360
|
})
|
|
5335
5361
|
), c.add(g), c.draw();
|
|
5336
5362
|
const d = new Image();
|
|
5337
|
-
return d.src =
|
|
5363
|
+
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5338
5364
|
}
|
|
5339
5365
|
}
|
|
5340
5366
|
class Be {
|
|
5341
5367
|
constructor(t, e) {
|
|
5342
5368
|
// 状态变量
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5369
|
+
h(this, "width", 0);
|
|
5370
|
+
h(this, "height", 0);
|
|
5371
|
+
h(this, "offsetX", 0);
|
|
5372
|
+
h(this, "offsetY", 0);
|
|
5347
5373
|
// 保存周末
|
|
5348
|
-
|
|
5349
|
-
|
|
5374
|
+
h(this, "weekendGroup");
|
|
5375
|
+
h(this, "patternImage", null);
|
|
5350
5376
|
this.context = t, this.layer = e, this.weekendGroup = new S.Group(), this.layer.add(this.weekendGroup);
|
|
5351
5377
|
}
|
|
5352
5378
|
/**
|
|
@@ -5387,11 +5413,11 @@ class Be {
|
|
|
5387
5413
|
*/
|
|
5388
5414
|
async calculateWeekend() {
|
|
5389
5415
|
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,
|
|
5416
|
+
const t = this.context.store.getTimeAxis().getStartTime(), e = this.context.store.getTimeAxis().getEndTime(), i = this.context.store.getTimeAxis().getCellUnit(), s = this.context.store.getTimeAxis().getCellWidth(), n = this.context.getOptions().header.height, o = this.context.getOptions().row.height, a = this.context.store.getDataManager().getVisibleSize() * o, c = Math.max(0, -this.offsetX), g = c + this.width;
|
|
5391
5417
|
for (let d = t; d <= e; ) {
|
|
5392
5418
|
let l = s;
|
|
5393
5419
|
if (l = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(d)) {
|
|
5394
|
-
const m = this.context.store.getTimeAxis().getTimeLeft(d), p = n, u =
|
|
5420
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(d), p = n, u = a;
|
|
5395
5421
|
if (m + l < c) {
|
|
5396
5422
|
d = d.add(2, "day");
|
|
5397
5423
|
continue;
|
|
@@ -5427,15 +5453,15 @@ class Be {
|
|
|
5427
5453
|
}
|
|
5428
5454
|
class ze {
|
|
5429
5455
|
constructor(t, e, i) {
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5456
|
+
h(this, "arrowAnimation");
|
|
5457
|
+
h(this, "todayLine");
|
|
5458
|
+
h(this, "todayTextGroup");
|
|
5459
|
+
h(this, "triangle");
|
|
5434
5460
|
// 状态变量
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5461
|
+
h(this, "width", 0);
|
|
5462
|
+
h(this, "height", 0);
|
|
5463
|
+
h(this, "offsetX", 0);
|
|
5464
|
+
h(this, "offsetY", 0);
|
|
5439
5465
|
this.context = t, this.bgLayer = e, this.headerLayer = i;
|
|
5440
5466
|
}
|
|
5441
5467
|
/**
|
|
@@ -5469,7 +5495,7 @@ class ze {
|
|
|
5469
5495
|
let e = G();
|
|
5470
5496
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
5471
5497
|
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(),
|
|
5498
|
+
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, r = B(t.backgroundColor).alpha(t.opacity).toHex(), a = (t.type === "block" ? s + n / 2 : s) + this.offsetX, c = [a, o, a, this.height], g = t.type === "line" ? t.width : n;
|
|
5473
5499
|
if (this.todayLine ? (this.todayLine.points(c), this.todayLine.stroke(r), this.todayLine.strokeWidth(g)) : (this.todayLine = new S.Line({
|
|
5474
5500
|
points: c,
|
|
5475
5501
|
stroke: r,
|
|
@@ -5519,8 +5545,8 @@ class ze {
|
|
|
5519
5545
|
});
|
|
5520
5546
|
}
|
|
5521
5547
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
5522
|
-
t.type === "line" && (this.triangle ? (this.triangle.x(
|
|
5523
|
-
x:
|
|
5548
|
+
t.type === "line" && (this.triangle ? (this.triangle.x(a), this.triangle.fill(r)) : (this.triangle = new S.RegularPolygon({
|
|
5549
|
+
x: a,
|
|
5524
5550
|
y: o - 8,
|
|
5525
5551
|
sides: 3,
|
|
5526
5552
|
radius: 8,
|
|
@@ -5544,13 +5570,13 @@ class ze {
|
|
|
5544
5570
|
class Ne {
|
|
5545
5571
|
constructor(t, e) {
|
|
5546
5572
|
// 状态变量
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5573
|
+
h(this, "width", 0);
|
|
5574
|
+
h(this, "height", 0);
|
|
5575
|
+
h(this, "offsetX", 0);
|
|
5576
|
+
h(this, "offsetY", 0);
|
|
5551
5577
|
// 保存假期
|
|
5552
|
-
|
|
5553
|
-
|
|
5578
|
+
h(this, "holidayGroup");
|
|
5579
|
+
h(this, "patternImage", /* @__PURE__ */ new WeakMap());
|
|
5554
5580
|
this.context = t, this.layer = e, this.holidayGroup = new S.Group(), this.layer.add(this.holidayGroup);
|
|
5555
5581
|
}
|
|
5556
5582
|
/**
|
|
@@ -5590,7 +5616,7 @@ class Ne {
|
|
|
5590
5616
|
if (!t || t.length === 0) return;
|
|
5591
5617
|
const e = Math.max(0, -this.offsetX), i = e + this.width, s = this.context.store.getTimeAxis().getStartTime(), n = this.context.store.getTimeAxis().getEndTime();
|
|
5592
5618
|
this.context.store.getTimeAxis().getCellUnit();
|
|
5593
|
-
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height,
|
|
5619
|
+
const o = this.context.store.getTimeAxis().getCellWidth(), r = this.context.getOptions().header.height, a = this.context.getOptions().row.height, g = this.context.store.getDataManager().getVisibleSize() * a;
|
|
5594
5620
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5595
5621
|
const w = t.find((C) => {
|
|
5596
5622
|
if (X(C.date)) {
|
|
@@ -5662,12 +5688,12 @@ class Ne {
|
|
|
5662
5688
|
class Pe {
|
|
5663
5689
|
constructor(t, e) {
|
|
5664
5690
|
// 状态变量
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5691
|
+
h(this, "width", 0);
|
|
5692
|
+
h(this, "height", 0);
|
|
5693
|
+
h(this, "offsetX", 0);
|
|
5694
|
+
h(this, "offsetY", 0);
|
|
5669
5695
|
// 保存标志日期渲染组
|
|
5670
|
-
|
|
5696
|
+
h(this, "flagGroup");
|
|
5671
5697
|
this.context = t, this.layer = e, this.flagGroup = new S.Group(), this.layer.add(this.flagGroup);
|
|
5672
5698
|
}
|
|
5673
5699
|
/**
|
|
@@ -5705,10 +5731,10 @@ class Pe {
|
|
|
5705
5731
|
if (this.clearFlag(), !((d = this.context.getOptions().flag) != null && d.show)) return;
|
|
5706
5732
|
const t = (l = this.context.getOptions().flag) == null ? void 0 : l.data;
|
|
5707
5733
|
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 = ((u = this.context.getOptions().flag) == null ? void 0 : u.color) || (B(e).isDark() ? "white" : "black"), n = ((y = this.context.getOptions().flag) == null ? void 0 : y.fontFamily) || "Arial", o = ((x = this.context.getOptions().flag) == null ? void 0 : x.fontSize) || 10, r = Math.max(0, -this.offsetX),
|
|
5734
|
+
const e = ((m = this.context.getOptions().flag) == null ? void 0 : m.backgroundColor) || this.context.getOptions().primaryColor, i = ((p = this.context.getOptions().flag) == null ? void 0 : p.opacity) || 1, s = ((u = this.context.getOptions().flag) == null ? void 0 : u.color) || (B(e).isDark() ? "white" : "black"), n = ((y = this.context.getOptions().flag) == null ? void 0 : y.fontFamily) || "Arial", o = ((x = this.context.getOptions().flag) == null ? void 0 : x.fontSize) || 10, r = Math.max(0, -this.offsetX), a = r + this.width, c = this.context.store.getTimeAxis().getCellWidth(), g = this.context.getOptions().header.height;
|
|
5709
5735
|
this.context.getOptions().row.height, this.context.store.getDataManager().getVisibleSize(), t.forEach((T) => {
|
|
5710
5736
|
const b = G(T.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = g;
|
|
5711
|
-
if (w + c < r || w >
|
|
5737
|
+
if (w + c < r || w > a)
|
|
5712
5738
|
return;
|
|
5713
5739
|
const E = [w, g, w, this.height], v = new S.Line({
|
|
5714
5740
|
points: E,
|
|
@@ -5789,24 +5815,24 @@ class Pe {
|
|
|
5789
5815
|
}
|
|
5790
5816
|
class Ye {
|
|
5791
5817
|
constructor(t, e, i) {
|
|
5792
|
-
|
|
5818
|
+
h(this, "tasks", []);
|
|
5793
5819
|
// 创建点组
|
|
5794
|
-
|
|
5820
|
+
h(this, "pointGroup");
|
|
5795
5821
|
// 关联线组
|
|
5796
|
-
|
|
5822
|
+
h(this, "linksGroup");
|
|
5797
5823
|
// 临时箭头
|
|
5798
|
-
|
|
5824
|
+
h(this, "templateArrow");
|
|
5799
5825
|
// 对所有已存在的连线进行缓存
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5826
|
+
h(this, "linkCache", /* @__PURE__ */ new Map());
|
|
5827
|
+
h(this, "isDragging", !1);
|
|
5828
|
+
h(this, "isSliderMoving", !1);
|
|
5803
5829
|
// 选中的连线
|
|
5804
|
-
|
|
5830
|
+
h(this, "selectedMap", /* @__PURE__ */ new Map());
|
|
5805
5831
|
// 状态变量
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5832
|
+
h(this, "width", 0);
|
|
5833
|
+
h(this, "height", 0);
|
|
5834
|
+
h(this, "offsetX", 0);
|
|
5835
|
+
h(this, "offsetY", 0);
|
|
5810
5836
|
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
5837
|
points: [],
|
|
5812
5838
|
stroke: this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
@@ -5874,7 +5900,7 @@ class Ye {
|
|
|
5874
5900
|
return;
|
|
5875
5901
|
}
|
|
5876
5902
|
t ? ((g = this.pointGroup.findOne(`#point-${t.id}-left`)) == null || g.destroy(), (d = this.pointGroup.findOne(`#point-${t.id}-right`)) == null || d.destroy()) : this.pointGroup.destroyChildren();
|
|
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,
|
|
5903
|
+
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
5904
|
this.tasks.forEach((l) => {
|
|
5879
5905
|
if (!(t && l.id !== t.id) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, l) && l.startTime && l.endTime) {
|
|
5880
5906
|
const m = this.context.store.getTimeAxis().getTimeLeft(l.startTime), p = this.context.store.getTimeAxis().getTimeLeft(l.endTime);
|
|
@@ -5882,14 +5908,14 @@ class Ye {
|
|
|
5882
5908
|
l.isMilestone() && (u += i / 2);
|
|
5883
5909
|
const y = s + i * l.flatIndex;
|
|
5884
5910
|
let x = !0, T = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
5885
|
-
if (ht(b) ? x = T = b :
|
|
5911
|
+
if (ht(b) ? x = T = b : V(b) && (x = b === "S", T = b === "F"), x) {
|
|
5886
5912
|
const w = new S.Circle({
|
|
5887
5913
|
id: `point-${l.id}-left`,
|
|
5888
5914
|
x: m - u,
|
|
5889
5915
|
y,
|
|
5890
5916
|
radius: n,
|
|
5891
5917
|
opacity: o,
|
|
5892
|
-
stroke:
|
|
5918
|
+
stroke: a,
|
|
5893
5919
|
strokeWidth: c
|
|
5894
5920
|
});
|
|
5895
5921
|
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
@@ -5907,7 +5933,7 @@ class Ye {
|
|
|
5907
5933
|
y,
|
|
5908
5934
|
radius: n,
|
|
5909
5935
|
opacity: o,
|
|
5910
|
-
stroke:
|
|
5936
|
+
stroke: a,
|
|
5911
5937
|
strokeWidth: c
|
|
5912
5938
|
});
|
|
5913
5939
|
this.pointGroup.add(w), w.on("mousedown", (C) => {
|
|
@@ -5959,8 +5985,8 @@ class Ye {
|
|
|
5959
5985
|
}
|
|
5960
5986
|
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
5987
|
return;
|
|
5962
|
-
const
|
|
5963
|
-
if (!(this.context.store.getTimeAxis().getTimeLeft(((g = s.type) == null ? void 0 : g[0]) === "S" ? o.startTime : o.endTime) <
|
|
5988
|
+
const a = Math.max(0, -this.offsetX), c = a + this.width;
|
|
5989
|
+
if (!(this.context.store.getTimeAxis().getTimeLeft(((g = s.type) == null ? void 0 : g[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
5990
|
const T = this.getPoints(o, r, s);
|
|
5965
5991
|
if (T.length <= 2)
|
|
5966
5992
|
O.warn("The link position has some error.", s);
|
|
@@ -6091,7 +6117,7 @@ class Ye {
|
|
|
6091
6117
|
}
|
|
6092
6118
|
getPoints(t, e, i) {
|
|
6093
6119
|
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,
|
|
6120
|
+
const s = this.context.getOptions().row.height, n = t.isMilestone() ? s / 2 : 0, o = this.context.store.getTimeAxis().getTimeLeft(t.startTime) - n, r = this.context.store.getTimeAxis().getTimeLeft(t.endTime) + n, a = e.isMilestone() ? s / 2 : 0, c = this.context.store.getTimeAxis().getTimeLeft(e.startTime) - a, g = this.context.store.getTimeAxis().getTimeLeft(e.endTime) + a;
|
|
6095
6121
|
let d = [];
|
|
6096
6122
|
switch (i.type || "FS") {
|
|
6097
6123
|
case "FF":
|
|
@@ -6113,7 +6139,7 @@ class Ye {
|
|
|
6113
6139
|
}
|
|
6114
6140
|
/** 生成 FS 连线 */
|
|
6115
6141
|
createFS(t, e, i, s, n, o, r) {
|
|
6116
|
-
const
|
|
6142
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6117
6143
|
n + d,
|
|
6118
6144
|
0.05 + g + c * e.flatIndex
|
|
6119
6145
|
];
|
|
@@ -6127,7 +6153,7 @@ class Ye {
|
|
|
6127
6153
|
g + c * e.flatIndex
|
|
6128
6154
|
];
|
|
6129
6155
|
l.push(...y);
|
|
6130
|
-
const x = c * e.flatIndex +
|
|
6156
|
+
const x = c * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6131
6157
|
l.push(y[0], x), l.push(u, x), l.push(u, g + c * i.flatIndex);
|
|
6132
6158
|
}
|
|
6133
6159
|
}
|
|
@@ -6135,7 +6161,7 @@ class Ye {
|
|
|
6135
6161
|
}
|
|
6136
6162
|
/** 生成 FF 连线 */
|
|
6137
6163
|
createFF(t, e, i, s, n, o, r) {
|
|
6138
|
-
const
|
|
6164
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6139
6165
|
n + d,
|
|
6140
6166
|
0.05 + g + c * e.flatIndex
|
|
6141
6167
|
];
|
|
@@ -6158,7 +6184,7 @@ class Ye {
|
|
|
6158
6184
|
}
|
|
6159
6185
|
/** 生成 SS 连线 */
|
|
6160
6186
|
createSS(t, e, i, s, n, o, r) {
|
|
6161
|
-
const
|
|
6187
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6162
6188
|
s - d,
|
|
6163
6189
|
0.05 + g + c * e.flatIndex
|
|
6164
6190
|
];
|
|
@@ -6181,7 +6207,7 @@ class Ye {
|
|
|
6181
6207
|
}
|
|
6182
6208
|
/** 生成 SF 连线 */
|
|
6183
6209
|
createSF(t, e, i, s, n, o, r) {
|
|
6184
|
-
const
|
|
6210
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + a, d = t.gap || this.context.getOptions().links.gap, l = [
|
|
6185
6211
|
s - d,
|
|
6186
6212
|
0.05 + g + c * e.flatIndex
|
|
6187
6213
|
];
|
|
@@ -6195,7 +6221,7 @@ class Ye {
|
|
|
6195
6221
|
g + c * e.flatIndex
|
|
6196
6222
|
];
|
|
6197
6223
|
l.push(...y);
|
|
6198
|
-
const x = c * e.flatIndex +
|
|
6224
|
+
const x = c * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? c : 0);
|
|
6199
6225
|
l.push(y[0], x), l.push(u, x), l.push(u, g + c * i.flatIndex);
|
|
6200
6226
|
}
|
|
6201
6227
|
}
|
|
@@ -6222,7 +6248,7 @@ class Ye {
|
|
|
6222
6248
|
dash: e.data || this.context.getOptions().links.dash
|
|
6223
6249
|
}), this.templateArrow.visible(!1);
|
|
6224
6250
|
let r = null;
|
|
6225
|
-
const
|
|
6251
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + a, d = e.gap || this.context.getOptions().links.gap;
|
|
6226
6252
|
let l = null;
|
|
6227
6253
|
const m = () => {
|
|
6228
6254
|
const b = this.stage.getPointerPosition();
|
|
@@ -6280,7 +6306,7 @@ class Ye {
|
|
|
6280
6306
|
}), this.templateArrow.visible(!1);
|
|
6281
6307
|
const o = this.context.store.getLinkManager();
|
|
6282
6308
|
let r = null;
|
|
6283
|
-
const
|
|
6309
|
+
const a = this.context.getOptions().header.height, c = this.context.getOptions().row.height, g = c / 2 + a, d = this.context.getOptions().links.gap;
|
|
6284
6310
|
let l = null;
|
|
6285
6311
|
const m = () => {
|
|
6286
6312
|
const y = this.stage.getPointerPosition();
|
|
@@ -6342,12 +6368,12 @@ class Ye {
|
|
|
6342
6368
|
j(r) && (r = r(
|
|
6343
6369
|
t.getEmitData(),
|
|
6344
6370
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6345
|
-
)), ht(r) ? n = o = r :
|
|
6346
|
-
const
|
|
6371
|
+
)), ht(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6372
|
+
const a = this.validateChain(t.id, e, i, s);
|
|
6347
6373
|
return {
|
|
6348
|
-
allowLeft: n &&
|
|
6349
|
-
allowRight: o &&
|
|
6350
|
-
reason:
|
|
6374
|
+
allowLeft: n && a.ok,
|
|
6375
|
+
allowRight: o && a.ok,
|
|
6376
|
+
reason: a.reason
|
|
6351
6377
|
};
|
|
6352
6378
|
}
|
|
6353
6379
|
/**
|
|
@@ -6358,12 +6384,12 @@ class Ye {
|
|
|
6358
6384
|
j(r) && (r = r(
|
|
6359
6385
|
t.getEmitData(),
|
|
6360
6386
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6361
|
-
)), ht(r) ? n = o = r :
|
|
6362
|
-
const
|
|
6387
|
+
)), ht(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6388
|
+
const a = this.validateChain(e, t.id, i, s);
|
|
6363
6389
|
return {
|
|
6364
|
-
allowLeft: n &&
|
|
6365
|
-
allowRight: o &&
|
|
6366
|
-
reason:
|
|
6390
|
+
allowLeft: n && a.ok,
|
|
6391
|
+
allowRight: o && a.ok,
|
|
6392
|
+
reason: a.reason
|
|
6367
6393
|
};
|
|
6368
6394
|
}
|
|
6369
6395
|
/**
|
|
@@ -6377,9 +6403,9 @@ class Ye {
|
|
|
6377
6403
|
* 操作高亮关联线
|
|
6378
6404
|
*/
|
|
6379
6405
|
handleHighlight(t, e, i, s, n, o, r = !1) {
|
|
6380
|
-
const
|
|
6381
|
-
|
|
6382
|
-
node:
|
|
6406
|
+
const a = t.findOne("Circle"), c = t.findOne("Arrow"), g = t.findOne("Line");
|
|
6407
|
+
a && new S.Tween({
|
|
6408
|
+
node: a,
|
|
6383
6409
|
radius: e + o,
|
|
6384
6410
|
duration: r ? 0 : 0.1
|
|
6385
6411
|
}).play(), c && new S.Tween({
|
|
@@ -6427,15 +6453,15 @@ class Ye {
|
|
|
6427
6453
|
}
|
|
6428
6454
|
class Ue {
|
|
6429
6455
|
constructor(t, e, i) {
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6456
|
+
h(this, "tasks", []);
|
|
6457
|
+
h(this, "chartBaselineGroup");
|
|
6458
|
+
h(this, "indicatorGroup");
|
|
6459
|
+
h(this, "baselineGroup");
|
|
6434
6460
|
// 状态变量
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6461
|
+
h(this, "width", 0);
|
|
6462
|
+
h(this, "height", 0);
|
|
6463
|
+
h(this, "offsetX", 0);
|
|
6464
|
+
h(this, "offsetY", 0);
|
|
6439
6465
|
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
6466
|
}
|
|
6441
6467
|
/**
|
|
@@ -6483,11 +6509,11 @@ class Ue {
|
|
|
6483
6509
|
), n = this.context.getOptions().baselines.opacity, o = this.context.getOptions().baselines.backgroundColor;
|
|
6484
6510
|
this.tasks.forEach((r) => {
|
|
6485
6511
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
6486
|
-
const
|
|
6512
|
+
const a = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c = nt(
|
|
6487
6513
|
this.context.getOptions().baselines.height || this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, r),
|
|
6488
6514
|
e
|
|
6489
6515
|
), g = this.context.getOptions().baselines.offset ?? 0;
|
|
6490
|
-
|
|
6516
|
+
a.forEach((d, l) => {
|
|
6491
6517
|
if (!d.validate()) return;
|
|
6492
6518
|
const m = this.context.store.getTimeAxis().getTimeLeft(d.startTime), p = this.context.store.getTimeAxis().getTimeLeft(d.endTime), u = new S.Group({ id: `baseline-group-${d.id}` });
|
|
6493
6519
|
this.renderBaselineBar(u, r, d, m, p, i, e, c, t, o, n, s, g), this.baselineGroup.add(u);
|
|
@@ -6499,19 +6525,19 @@ class Ue {
|
|
|
6499
6525
|
}
|
|
6500
6526
|
});
|
|
6501
6527
|
}
|
|
6502
|
-
renderBaselineBar(t, e, i, s, n, o, r,
|
|
6528
|
+
renderBaselineBar(t, e, i, s, n, o, r, a, c, g, d, l, m) {
|
|
6503
6529
|
if (this.context.getOptions().baselines.mode === "shadow") {
|
|
6504
|
-
const p = o + r * e.flatIndex -
|
|
6530
|
+
const p = o + r * e.flatIndex - a / 2 + m, u = new S.Rect({
|
|
6505
6531
|
id: `baseline-item-${i.id}`,
|
|
6506
6532
|
x: s,
|
|
6507
6533
|
y: p,
|
|
6508
6534
|
width: n - s,
|
|
6509
|
-
height:
|
|
6535
|
+
height: a,
|
|
6510
6536
|
cornerRadius: l,
|
|
6511
6537
|
fill: g,
|
|
6512
6538
|
opacity: d
|
|
6513
6539
|
});
|
|
6514
|
-
t.add(u), this.renderText(t, e, i, s, n, p,
|
|
6540
|
+
t.add(u), this.renderText(t, e, i, s, n, p, a);
|
|
6515
6541
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
6516
6542
|
const p = nt(this.context.getOptions().baselines.height ?? 5, r);
|
|
6517
6543
|
let u = c + r * e.flatIndex + m;
|
|
@@ -6530,7 +6556,7 @@ class Ue {
|
|
|
6530
6556
|
t.add(T), this.renderText(t, e, i, s, n, u, p, x);
|
|
6531
6557
|
}
|
|
6532
6558
|
}
|
|
6533
|
-
renderText(t, e, i, s, n, o, r,
|
|
6559
|
+
renderText(t, e, i, s, n, o, r, a) {
|
|
6534
6560
|
const c = `chart-baseline-text-${i.id}`;
|
|
6535
6561
|
if ((() => {
|
|
6536
6562
|
this.baselineGroup.find(`#${c}`) && this.baselineGroup.find(`#${c}`).forEach((x) => x.remove());
|
|
@@ -6550,13 +6576,13 @@ class Ue {
|
|
|
6550
6576
|
align: this.context.getOptions().baselines.label.position,
|
|
6551
6577
|
verticalAlign: "bottom"
|
|
6552
6578
|
});
|
|
6553
|
-
|
|
6579
|
+
a === "line_bottom" ? u.setAttrs({
|
|
6554
6580
|
y: o - p / 2,
|
|
6555
6581
|
verticalAlign: "top"
|
|
6556
|
-
}) :
|
|
6582
|
+
}) : a === "line_center" ? u.setAttrs({
|
|
6557
6583
|
y: o - p / 2,
|
|
6558
6584
|
verticalAlign: "middle"
|
|
6559
|
-
}) :
|
|
6585
|
+
}) : a === "line_top" && u.setAttrs({
|
|
6560
6586
|
y: o - r / 2,
|
|
6561
6587
|
verticalAlign: "bottom"
|
|
6562
6588
|
}), r >= p && u.setAttrs({
|
|
@@ -6570,10 +6596,10 @@ class Ue {
|
|
|
6570
6596
|
if (!n || n === "ontime") return;
|
|
6571
6597
|
const o = t.findOne(`#baseline-item-${i.id}`);
|
|
6572
6598
|
if (!o) return;
|
|
6573
|
-
const r = this.context.getOptions().baselines.compare,
|
|
6574
|
-
if (
|
|
6599
|
+
const r = this.context.getOptions().baselines.compare, a = this.context.getOptions().baselines.mode, c = { fill: "", stroke: "", opacity: r[n].opacity };
|
|
6600
|
+
if (a === "shadow")
|
|
6575
6601
|
c.fill = r[n].backgroundColor;
|
|
6576
|
-
else if (
|
|
6602
|
+
else if (a === "line")
|
|
6577
6603
|
c.stroke = r[n].backgroundColor;
|
|
6578
6604
|
else
|
|
6579
6605
|
return;
|
|
@@ -6582,14 +6608,14 @@ class Ue {
|
|
|
6582
6608
|
renderCompareIndicator(t, e, i) {
|
|
6583
6609
|
const s = this.context.getOptions().baselines, n = s.compare.indicator;
|
|
6584
6610
|
if (!n || !n.show) return;
|
|
6585
|
-
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height,
|
|
6611
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, a = nt(
|
|
6586
6612
|
this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, t),
|
|
6587
6613
|
r
|
|
6588
6614
|
);
|
|
6589
6615
|
let c = s.backgroundColor;
|
|
6590
6616
|
const g = this.context.store.getTimeAxis().getTimeLeft(t.startTime), d = this.context.store.getTimeAxis().getTimeLeft(t.endTime);
|
|
6591
|
-
let l = (r -
|
|
6592
|
-
if (n.position === "bottom" && (l +=
|
|
6617
|
+
let l = (r - a) / 2 + r * t.flatIndex + o;
|
|
6618
|
+
if (n.position === "bottom" && (l += a), n.show === "start" || n.show === "both" || n.show === !0) {
|
|
6593
6619
|
const m = i.startStatus;
|
|
6594
6620
|
if (m && s.compare.indicator[m].show) {
|
|
6595
6621
|
c = B(s.compare.indicator[m].color).alpha(s.compare.indicator[m].opacity).toHex();
|
|
@@ -6602,7 +6628,7 @@ class Ue {
|
|
|
6602
6628
|
this.indicatorGroup.add(p);
|
|
6603
6629
|
let u = `${gt(i.startDiff)}${i.unit} ${m}`;
|
|
6604
6630
|
const y = s.compare.indicator[m].text;
|
|
6605
|
-
j(y) ? u = y(i.startDiff, { ...t.getEmitData(), baseline: e }) :
|
|
6631
|
+
j(y) ? u = y(i.startDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (u = y);
|
|
6606
6632
|
const x = new S.Text({
|
|
6607
6633
|
y: l - n.fontSize / 2,
|
|
6608
6634
|
text: u,
|
|
@@ -6626,7 +6652,7 @@ class Ue {
|
|
|
6626
6652
|
this.indicatorGroup.add(p);
|
|
6627
6653
|
let u = `${gt(i.endDiff)}${i.unit} ${m}`;
|
|
6628
6654
|
const y = s.compare.indicator[m].text;
|
|
6629
|
-
j(y) ? u = y(i.endDiff, { ...t.getEmitData(), baseline: e }) :
|
|
6655
|
+
j(y) ? u = y(i.endDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (u = y);
|
|
6630
6656
|
const x = new S.Text({
|
|
6631
6657
|
x: d + n.size + 5,
|
|
6632
6658
|
y: l - n.fontSize / 2,
|
|
@@ -6654,21 +6680,21 @@ class Ue {
|
|
|
6654
6680
|
class Xe {
|
|
6655
6681
|
constructor(t, e) {
|
|
6656
6682
|
// Konva 元素
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6683
|
+
h(this, "stage");
|
|
6684
|
+
h(this, "headerLayer");
|
|
6685
|
+
h(this, "bodyGroup");
|
|
6686
|
+
h(this, "gridGroup");
|
|
6687
|
+
h(this, "weekendGroup");
|
|
6688
|
+
h(this, "holidayGroup");
|
|
6689
|
+
h(this, "flagGroup");
|
|
6690
|
+
h(this, "todayLayer");
|
|
6691
|
+
h(this, "linkGroup");
|
|
6692
|
+
h(this, "baselineGroup");
|
|
6693
|
+
h(this, "axisLayer");
|
|
6694
|
+
h(this, "bgLayer");
|
|
6695
|
+
h(this, "bodyLayer");
|
|
6696
|
+
h(this, "width", 0);
|
|
6697
|
+
h(this, "height", 0);
|
|
6672
6698
|
this.context = t, this.container = e, this.stage = new S.Stage({
|
|
6673
6699
|
container: this.container,
|
|
6674
6700
|
width: this.container.clientWidth,
|
|
@@ -6700,18 +6726,18 @@ class Xe {
|
|
|
6700
6726
|
this.headerLayer.destroy(), this.gridGroup.destroy(), this.bodyLayer.destroy(), this.todayLayer.destroy(), this.holidayGroup.destroy(), this.flagGroup.destroy(), this.weekendGroup.destroy(), this.linkGroup.destroy(), this.baselineGroup.destroy(), this.axisLayer.destroy(), this.bgLayer.destroy(), this.stage.destroy();
|
|
6701
6727
|
}
|
|
6702
6728
|
}
|
|
6703
|
-
const
|
|
6704
|
-
class
|
|
6729
|
+
const Ve = '<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>';
|
|
6730
|
+
class Ke {
|
|
6705
6731
|
constructor(t, e) {
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6732
|
+
h(this, "line");
|
|
6733
|
+
h(this, "initialX", 0);
|
|
6734
|
+
h(this, "initialWidth", 0);
|
|
6735
|
+
h(this, "collapseButton", null);
|
|
6710
6736
|
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
6737
|
"border-left-color",
|
|
6712
6738
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
6713
6739
|
"important"
|
|
6714
|
-
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML =
|
|
6740
|
+
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML = Ve, this.collapseButton.addEventListener("click", (i) => {
|
|
6715
6741
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
6716
6742
|
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
6717
6743
|
}
|
|
@@ -6723,23 +6749,23 @@ class Ve {
|
|
|
6723
6749
|
*/
|
|
6724
6750
|
addDragEvents() {
|
|
6725
6751
|
let t = 0, e = null;
|
|
6726
|
-
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (
|
|
6727
|
-
|
|
6752
|
+
const i = this.root.store.getColumnManager(), s = i.getLeafColumns(), n = (a) => {
|
|
6753
|
+
a.preventDefault(), a.stopPropagation(), t = a.clientX, e = this.container.getBoundingClientRect();
|
|
6728
6754
|
const c = s[s.length - 1].key;
|
|
6729
6755
|
this.initialWidth = i.getColumnWidth(c);
|
|
6730
6756
|
const g = this.initialX;
|
|
6731
6757
|
this.root.event.emit(k.SHOW_GUIDELINE, g);
|
|
6732
6758
|
const d = (m) => o(m), l = (m) => r(m, d, l);
|
|
6733
6759
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6734
|
-
}, o = (
|
|
6735
|
-
if (
|
|
6736
|
-
const c =
|
|
6760
|
+
}, o = (a) => {
|
|
6761
|
+
if (a.preventDefault(), !e) return;
|
|
6762
|
+
const c = a.clientX - t;
|
|
6737
6763
|
s[s.length - 1].key;
|
|
6738
6764
|
const g = 50 - this.initialWidth, l = e.width - 20 - this.initialX, m = Math.max(g, Math.min(l, c)), p = this.initialX + m;
|
|
6739
6765
|
this.root.event.emit(k.MOVE_GUIDELINE, p);
|
|
6740
|
-
}, r = (
|
|
6766
|
+
}, r = (a, c, g) => {
|
|
6741
6767
|
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(k.HIDE_GUIDELINE);
|
|
6742
|
-
const d =
|
|
6768
|
+
const d = a.clientX - t, l = s[s.length - 1].key, m = Math.max(50, this.initialWidth + d);
|
|
6743
6769
|
i.setColumnWidth(l, m), this.root.event.emit(k.UPDATE_TABLE_HEADER);
|
|
6744
6770
|
};
|
|
6745
6771
|
this.line.addEventListener("mousedown", n);
|
|
@@ -6750,9 +6776,9 @@ class je {
|
|
|
6750
6776
|
* @param container 指示线的容器元素
|
|
6751
6777
|
*/
|
|
6752
6778
|
constructor(t, e) {
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6779
|
+
h(this, "element");
|
|
6780
|
+
h(this, "container");
|
|
6781
|
+
h(this, "visible", !1);
|
|
6756
6782
|
if (this.context = t, !e)
|
|
6757
6783
|
throw new Error("Container is required for GuideLine instance");
|
|
6758
6784
|
this.container = e, this.element = document.createElement("div"), this.initElement(), this.initEvents();
|
|
@@ -6822,14 +6848,14 @@ class je {
|
|
|
6822
6848
|
}
|
|
6823
6849
|
class qe {
|
|
6824
6850
|
constructor(t = 16) {
|
|
6825
|
-
|
|
6851
|
+
h(this, "taskQueue", /* @__PURE__ */ new Map());
|
|
6826
6852
|
// 使用 Map 避免同类型重复任务
|
|
6827
|
-
|
|
6853
|
+
h(this, "taskHandlers", /* @__PURE__ */ new Map());
|
|
6828
6854
|
// 任务类型处理器映射
|
|
6829
|
-
|
|
6830
|
-
|
|
6855
|
+
h(this, "isScheduled", !1);
|
|
6856
|
+
h(this, "delay");
|
|
6831
6857
|
// 使用 debounce 来延迟执行,避免短时间内多次触发
|
|
6832
|
-
|
|
6858
|
+
h(this, "debouncedFlush");
|
|
6833
6859
|
this.delay = t, this.debouncedFlush = Xt(() => {
|
|
6834
6860
|
this.flushTaskQueue();
|
|
6835
6861
|
}, t);
|
|
@@ -6963,25 +6989,26 @@ class qe {
|
|
|
6963
6989
|
}
|
|
6964
6990
|
class Qe {
|
|
6965
6991
|
constructor(t, e) {
|
|
6966
|
-
|
|
6967
|
-
|
|
6992
|
+
h(this, "scrollbar");
|
|
6993
|
+
h(this, "rootElement");
|
|
6968
6994
|
// 根容器
|
|
6969
|
-
|
|
6995
|
+
h(this, "tableContainer");
|
|
6970
6996
|
// 表格容器
|
|
6971
|
-
|
|
6997
|
+
h(this, "chartContainer");
|
|
6972
6998
|
// 用于放置右侧图表内容(Konva Stage)并作为滚动内容的容器
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6999
|
+
h(this, "table");
|
|
7000
|
+
h(this, "chart");
|
|
7001
|
+
h(this, "middleLine");
|
|
7002
|
+
h(this, "renderScheduler");
|
|
6977
7003
|
// 渲染调度器
|
|
6978
|
-
|
|
7004
|
+
h(this, "_id", Q());
|
|
6979
7005
|
// 尺寸和状态
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
7006
|
+
h(this, "width", 0);
|
|
7007
|
+
h(this, "height", 0);
|
|
7008
|
+
h(this, "isInitialized", !0);
|
|
7009
|
+
h(this, "resizeObserver");
|
|
6983
7010
|
// 更新尺寸
|
|
6984
|
-
|
|
7011
|
+
h(this, "updateSize", () => {
|
|
6985
7012
|
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
7013
|
const t = this.context.store.getColumnManager().getTotalWidth();
|
|
6987
7014
|
this.tableContainer.style.width = `${t}px`, this.tableContainer.style.height = this.height ? `${this.height}px` : "100%";
|
|
@@ -7000,7 +7027,7 @@ class Qe {
|
|
|
7000
7027
|
/**
|
|
7001
7028
|
* 设置样式值
|
|
7002
7029
|
*/
|
|
7003
|
-
|
|
7030
|
+
h(this, "setStyleValue", () => {
|
|
7004
7031
|
const t = this.context.store.getOptionManager().getOptions();
|
|
7005
7032
|
this.rootElement.style.setProperty(
|
|
7006
7033
|
"--x-gantt-primary-color",
|
|
@@ -7023,18 +7050,23 @@ class Qe {
|
|
|
7023
7050
|
`${t.header.fontWeight}`
|
|
7024
7051
|
);
|
|
7025
7052
|
});
|
|
7026
|
-
|
|
7053
|
+
h(this, "handleUpdateTask", (t) => {
|
|
7027
7054
|
this.table.updateTask(t), this.chart.updateTask(t);
|
|
7028
7055
|
});
|
|
7029
|
-
|
|
7056
|
+
h(this, "handleColumnWidthChange", () => {
|
|
7030
7057
|
this.table.updateWidth(), this.updateSize();
|
|
7031
7058
|
});
|
|
7032
|
-
|
|
7059
|
+
var i;
|
|
7060
|
+
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new je(this.context, this.container), this.middleLine = new Ke(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(
|
|
7033
7061
|
this.context,
|
|
7034
7062
|
this.rootElement,
|
|
7035
7063
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
7036
7064
|
// 传入配置项
|
|
7037
|
-
), this.renderScheduler = new qe(16), this.setupTaskHandlers(), this.updateSize(), this.setupEventListeners()
|
|
7065
|
+
), this.renderScheduler = new qe(16), this.setupTaskHandlers(), this.updateSize(), this.setupEventListeners(), (i = this.context.store.getOptionManager().getOptions().resize) != null && i.enabled && (typeof window.ResizeObserver > "u" ? O.warn(
|
|
7066
|
+
"Current environment does not support ResizeObserver, please include a polyfill to enable auto-resize feature."
|
|
7067
|
+
) : (this.resizeObserver = new ResizeObserver(() => {
|
|
7068
|
+
this.updateSize(), this.renderScheduler.scheduleTask("VIEW_UPDATE", [!1]);
|
|
7069
|
+
}), this.resizeObserver.observe(this.container)));
|
|
7038
7070
|
}
|
|
7039
7071
|
getScrollbar() {
|
|
7040
7072
|
return this.scrollbar;
|
|
@@ -7096,7 +7128,7 @@ class Qe {
|
|
|
7096
7128
|
*/
|
|
7097
7129
|
performRender(t = !1, e = !1) {
|
|
7098
7130
|
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),
|
|
7131
|
+
const { x: i, y: s } = this.scrollbar.getScrollPosition(), n = this.context.store.getOptionManager().getOptions().row.height, o = this.context.store.getOptionManager().getOptions().header.height, r = Math.floor(s / n), a = Math.ceil((this.height - o) / n), c = 2, g = Math.max(0, r), d = a + c, l = this.context.store.getDataManager().getVisibleTasks().slice(g, g + d);
|
|
7100
7132
|
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(k.LOADED), this.isInitialized = !1), O.debug("execute render");
|
|
7101
7133
|
}
|
|
7102
7134
|
/**
|
|
@@ -7118,15 +7150,15 @@ class Qe {
|
|
|
7118
7150
|
);
|
|
7119
7151
|
}
|
|
7120
7152
|
destroy() {
|
|
7121
|
-
O.debug("Renderer destroy"), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
7153
|
+
O.debug("Renderer destroy"), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
7122
7154
|
}
|
|
7123
7155
|
}
|
|
7124
7156
|
class Je {
|
|
7125
7157
|
constructor(t, e, i) {
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7158
|
+
h(this, "_id", Q());
|
|
7159
|
+
h(this, "store");
|
|
7160
|
+
h(this, "event", new jt());
|
|
7161
|
+
h(this, "renderer");
|
|
7130
7162
|
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
7163
|
"----Gantt initialized for element:",
|
|
7132
7164
|
this._id,
|
|
@@ -7267,9 +7299,9 @@ class Je {
|
|
|
7267
7299
|
}
|
|
7268
7300
|
class si {
|
|
7269
7301
|
constructor(t, e) {
|
|
7270
|
-
|
|
7302
|
+
h(this, "context");
|
|
7271
7303
|
// 管理对外事件
|
|
7272
|
-
|
|
7304
|
+
h(this, "events", /* @__PURE__ */ new Map());
|
|
7273
7305
|
e != null && e.logLevel && O.setOptions({
|
|
7274
7306
|
showTimestamp: e.logLevel === "debug",
|
|
7275
7307
|
level: {
|
|
@@ -7611,8 +7643,21 @@ class si {
|
|
|
7611
7643
|
getDataSize() {
|
|
7612
7644
|
return this.context.store.getDataManager().getDataSize();
|
|
7613
7645
|
}
|
|
7646
|
+
/**
|
|
7647
|
+
* 移除指定 ID 的数据。该操作会直接修改当前数据源,并且不可逆,请谨慎使用
|
|
7648
|
+
* @param id 数据 ID
|
|
7649
|
+
* @returns 是否成功移除
|
|
7650
|
+
*
|
|
7651
|
+
* @example
|
|
7652
|
+
* ```typescript
|
|
7653
|
+
* const success = gantt.removeDataById('task-1');
|
|
7654
|
+
* ```
|
|
7655
|
+
*/
|
|
7656
|
+
removeDataById(t) {
|
|
7657
|
+
return this.context.store.getDataManager().deleteTaskById(t);
|
|
7658
|
+
}
|
|
7614
7659
|
}
|
|
7615
|
-
|
|
7660
|
+
Vt();
|
|
7616
7661
|
const ni = Ct;
|
|
7617
7662
|
export {
|
|
7618
7663
|
si as XGantt,
|