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