@xpyjs/gantt-core 0.0.1-alpha.1 → 0.0.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -1
- package/dist/x-gantt.js +813 -753
- package/dist/x-gantt.umd.cjs +2 -2
- package/package.json +2 -2
- package/types/XGantt.d.ts +13 -8
- package/types/event/index.d.ts +5 -3
- package/types/index.d.ts +3 -2
- package/types/rendering/Renderer.d.ts +1 -0
- package/types/rendering/chart/ChartLink.d.ts +2 -0
- package/types/rendering/table/TableRow.d.ts +1 -1
- package/types/types/event.d.ts +1 -0
- package/types/types/options.d.ts +14 -7
- package/types/types/table.d.ts +1 -1
package/dist/x-gantt.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var _t = Object.defineProperty;
|
|
2
|
-
var Ht = (
|
|
3
|
-
var r = (
|
|
2
|
+
var Ht = (f, t, e) => t in f ? _t(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
|
+
var r = (f, t, e) => Ht(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import D from "dayjs";
|
|
5
5
|
import { default as Be } from "dayjs";
|
|
6
|
-
import { merge as
|
|
7
|
-
import
|
|
8
|
-
const ft = "0.0.1-alpha.
|
|
6
|
+
import { merge as q, isArray as F, isString as N, isFunction as z, cloneDeep as B, isObject as gt, isNumber as At, omit as rt, throttle as ht, isBoolean as V, debounce as It } from "lodash-es";
|
|
7
|
+
import E from "konva";
|
|
8
|
+
const ft = "0.0.1-alpha.3";
|
|
9
9
|
function Rt() {
|
|
10
|
-
const
|
|
10
|
+
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
13
13
|
"| | || __|| _ || | ||_ _||_ _|",
|
|
@@ -16,7 +16,7 @@ function Rt() {
|
|
|
16
16
|
].forEach((o) => {
|
|
17
17
|
console.log(
|
|
18
18
|
`%c${o}`,
|
|
19
|
-
`color: ${
|
|
19
|
+
`color: ${f}; font-weight: bold; font-family: monospace;`
|
|
20
20
|
);
|
|
21
21
|
}), console.log(
|
|
22
22
|
`%c 🚀 欢迎使用 XGantt %c Version: ${ft} `,
|
|
@@ -124,7 +124,7 @@ r(I, "Prefix", "[XGantt]"), r(I, "options", {
|
|
|
124
124
|
showTimestamp: !1
|
|
125
125
|
});
|
|
126
126
|
let C = I;
|
|
127
|
-
const
|
|
127
|
+
const tt = () => ({
|
|
128
128
|
data: [],
|
|
129
129
|
links: {
|
|
130
130
|
show: !1,
|
|
@@ -229,14 +229,14 @@ const J = () => ({
|
|
|
229
229
|
});
|
|
230
230
|
class Wt {
|
|
231
231
|
constructor() {
|
|
232
|
-
r(this, "options",
|
|
232
|
+
r(this, "options", tt());
|
|
233
233
|
}
|
|
234
234
|
getOptions() {
|
|
235
235
|
return this.options;
|
|
236
236
|
}
|
|
237
237
|
setOptions(t, e = { merge: !0 }) {
|
|
238
238
|
var i;
|
|
239
|
-
this.options = e.merge ?
|
|
239
|
+
this.options = e.merge ? q(tt(), this.options, t) : q(tt(), t), F((i = t.links) == null ? void 0 : i.data) && (this.options.links.data = t.links.data);
|
|
240
240
|
}
|
|
241
241
|
update(t) {
|
|
242
242
|
this.setOptions(t);
|
|
@@ -245,7 +245,7 @@ class Wt {
|
|
|
245
245
|
var s;
|
|
246
246
|
let e = "";
|
|
247
247
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
248
|
-
return
|
|
248
|
+
return N(i) ? e = i : F(i) && i.length > 0 ? e = i[t.level] : z(i) && (e = i(t.getEmitData())), e;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
class $t {
|
|
@@ -289,7 +289,7 @@ class $t {
|
|
|
289
289
|
this.events.clear();
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
var
|
|
292
|
+
var y = /* @__PURE__ */ ((f) => (f.LOADED = "loaded", f.COLUMN_WIDTH_CHANGE = "column-width-change", f.MOVE_GUIDELINE = "move-guideline", f.SHOW_GUIDELINE = "show-guideline", f.HIDE_GUIDELINE = "hide-guideline", f.SCROLL = "scroll", f.CHART_OFFSET_CHANGE = "chart_offset_change", f.DATA_UPDATE = "data-update", f.VIEW_UPDATE = "view-update", f.UPDATE_TABLE_HEADER = "update_table_header", f.UPDATE_TABLE_BODY = "update_table_body", f.UPDATE_CHART_HEADER = "update_chart_header", f.UPDATE_TASK = "update_task", f.UPDATE_LINK = "update_link", f.CREATE_LINK = "create_link", f.TASK_SELECTED = "task_selected", f.TASK_UNSELECTED = "task_unselected", f.SELECT_LINK = "select_link", f.CHECK_TASK = "check_task", f.ROW_CLICK = "row-click", f.ROW_DBL_CLICK = "row-dbl-click", f.ROW_CONTEXTMENU = "row-contextmenu", f.SLIDER_CLICK = "slider-click", f.SLIDER_DBL_CLICK = "slider-dbl-click", f.SLIDER_CONTEXTMENU = "slider-contextmenu", f.SLIDER_MOVING = "slider-moving", f.ROW_HIGHLIGHT = "row-highlight", f.ROW_UNHIGHLIGHT = "row-unhighlight", f.TASK_DRAG_START = "task-drag-start", f.TASK_DRAG_MOVE = "task-drag-move", f.TASK_DRAG_END = "task-drag-end", f.ERROR = "error", f))(y || {}), U = /* @__PURE__ */ ((f) => (f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f))(U || {});
|
|
293
293
|
function K() {
|
|
294
294
|
return Math.random().toString(36).substring(2, 15);
|
|
295
295
|
}
|
|
@@ -354,7 +354,7 @@ class nt {
|
|
|
354
354
|
this.endTime = h ? D(h) : void 0, 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);
|
|
355
355
|
}
|
|
356
356
|
getField(t) {
|
|
357
|
-
if (!t ||
|
|
357
|
+
if (!t || N(t) && t.trim() === "")
|
|
358
358
|
return;
|
|
359
359
|
if (!t.includes("."))
|
|
360
360
|
return this.data[t];
|
|
@@ -369,13 +369,13 @@ class nt {
|
|
|
369
369
|
return gt(i) ? B(i) : i;
|
|
370
370
|
}
|
|
371
371
|
updateData(t) {
|
|
372
|
-
this.data = t, t[this.fields.name] && (this.name = t[this.fields.name]), t[this.fields.startTime] && (this.startTime = D(t[this.fields.startTime])), t[this.fields.endTime] && (this.endTime = D(t[this.fields.endTime])), t[this.fields.progress] !== void 0 && (this.progress = t[this.fields.progress]), this.event.emit(
|
|
372
|
+
this.data = t, t[this.fields.name] && (this.name = t[this.fields.name]), t[this.fields.startTime] && (this.startTime = D(t[this.fields.startTime])), t[this.fields.endTime] && (this.endTime = D(t[this.fields.endTime])), t[this.fields.progress] !== void 0 && (this.progress = t[this.fields.progress]), this.event.emit(y.UPDATE_TASK, this);
|
|
373
373
|
}
|
|
374
374
|
updateTime(t, e) {
|
|
375
375
|
var s, n;
|
|
376
376
|
this.startTime = t, this.endTime = e;
|
|
377
377
|
const i = (n = (s = this.store) == null ? void 0 : s.getOptionManager().getOptions()) == null ? void 0 : n.dateFormat;
|
|
378
|
-
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(
|
|
378
|
+
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(y.UPDATE_TASK, this);
|
|
379
379
|
}
|
|
380
380
|
clone() {
|
|
381
381
|
return new nt(
|
|
@@ -396,7 +396,7 @@ class nt {
|
|
|
396
396
|
getAllChildren() {
|
|
397
397
|
const t = [], e = (i) => {
|
|
398
398
|
i.forEach((s) => {
|
|
399
|
-
t.push(s),
|
|
399
|
+
t.push(s), F(s.children) && s.children.length > 0 && e(s.children);
|
|
400
400
|
});
|
|
401
401
|
};
|
|
402
402
|
return e(this.children), t;
|
|
@@ -437,7 +437,7 @@ class Gt {
|
|
|
437
437
|
* 设置源数据并初始化任务
|
|
438
438
|
*/
|
|
439
439
|
setData(t, e = !1) {
|
|
440
|
-
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(
|
|
440
|
+
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(y.DATA_UPDATE);
|
|
441
441
|
}
|
|
442
442
|
/**
|
|
443
443
|
* 初始化任务
|
|
@@ -445,7 +445,7 @@ class Gt {
|
|
|
445
445
|
initTasks(t = !1) {
|
|
446
446
|
this.dataLevel = 0, t ? (this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear(), this.rawData.forEach((e) => {
|
|
447
447
|
this.tasks.push(this.createTask(e));
|
|
448
|
-
})) : this.updateTask(this.rawData, this.tasks);
|
|
448
|
+
})) : this.rawData.length > 0 ? this.updateTask(this.rawData, this.tasks) : (this.tasks = [], this.taskMap.clear(), this.collapsedTaskIds.clear());
|
|
449
449
|
}
|
|
450
450
|
createTask(t, e) {
|
|
451
451
|
const i = this.store.getOptionManager().getOptions().fields, s = new nt(this.store, this.event, t, e);
|
|
@@ -464,7 +464,7 @@ class Gt {
|
|
|
464
464
|
if (n[this.store.getOptionManager().getOptions().fields.children]) {
|
|
465
465
|
const h = n[this.store.getOptionManager().getOptions().fields.children];
|
|
466
466
|
if (o && o.children)
|
|
467
|
-
this.updateTask(h, o.children, o
|
|
467
|
+
this.updateTask(h, o.children, o);
|
|
468
468
|
else {
|
|
469
469
|
const a = h.map(
|
|
470
470
|
(d) => this.createTask(d, e[s])
|
|
@@ -474,6 +474,9 @@ class Gt {
|
|
|
474
474
|
} else o && o.children && (o.children = []);
|
|
475
475
|
s++;
|
|
476
476
|
}
|
|
477
|
+
e.length >= s && e.splice(s).forEach((o) => {
|
|
478
|
+
this.taskMap.delete(o.id);
|
|
479
|
+
});
|
|
477
480
|
}
|
|
478
481
|
/**
|
|
479
482
|
* 获取源数据
|
|
@@ -554,7 +557,7 @@ class Gt {
|
|
|
554
557
|
const i = this.getTaskById(t);
|
|
555
558
|
return i ? (i.expanded = !i.expanded, i.expanded ? this.collapsedTaskIds.delete(i.id) : this.collapsedTaskIds.add(i.id), e && i.children && i.children.length > 0 && i.children.forEach((s) => {
|
|
556
559
|
this.expandTask(s.id, e);
|
|
557
|
-
}), this.invalidateCache(), this.event.emit(
|
|
560
|
+
}), this.invalidateCache(), this.event.emit(y.VIEW_UPDATE), !0) : !1;
|
|
558
561
|
}
|
|
559
562
|
/**
|
|
560
563
|
* 按条件筛选任务
|
|
@@ -612,7 +615,7 @@ class Gt {
|
|
|
612
615
|
* 清空所有数据
|
|
613
616
|
*/
|
|
614
617
|
clear() {
|
|
615
|
-
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(
|
|
618
|
+
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(y.DATA_UPDATE);
|
|
616
619
|
}
|
|
617
620
|
/**
|
|
618
621
|
* 更新子任务的层级
|
|
@@ -640,7 +643,7 @@ class Gt {
|
|
|
640
643
|
*/
|
|
641
644
|
selectTask(t) {
|
|
642
645
|
const e = this.getTaskById(t);
|
|
643
|
-
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(
|
|
646
|
+
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(y.TASK_SELECTED, e)), !0) : !1;
|
|
644
647
|
}
|
|
645
648
|
/**
|
|
646
649
|
* 取消任务选择
|
|
@@ -648,7 +651,7 @@ class Gt {
|
|
|
648
651
|
unselectTask() {
|
|
649
652
|
if (this.selectedTaskId) {
|
|
650
653
|
const t = this.selectedTaskId;
|
|
651
|
-
this.selectedTaskId = null, this.event.emit(
|
|
654
|
+
this.selectedTaskId = null, this.event.emit(y.TASK_UNSELECTED, t);
|
|
652
655
|
}
|
|
653
656
|
}
|
|
654
657
|
/**
|
|
@@ -685,70 +688,70 @@ class Gt {
|
|
|
685
688
|
let l = t.parent;
|
|
686
689
|
for (; d !== "none" && l; ) {
|
|
687
690
|
if (d === "expand") {
|
|
688
|
-
let
|
|
689
|
-
(!l.startTime || o.isBefore(l.startTime)) && (
|
|
691
|
+
let m = l.startTime || o, p = l.endTime || h;
|
|
692
|
+
(!l.startTime || o.isBefore(l.startTime)) && (m = o), (!l.endTime || h.isAfter(l.endTime)) && (p = h), (l.startTime === void 0 || l.endTime === void 0 || !m.isSame(l.startTime) || !p.isSame(l.endTime)) && (n.findIndex((g) => g.id === l.id) === -1 && n.push(l.clone()), l.updateTime(m, p));
|
|
690
693
|
} else d === "strict" && (l.startTime && o.isBefore(l.startTime) && (o = l.startTime, h.isSameOrBefore(o) && (h = o.add(1, u))), l.endTime && h.isAfter(l.endTime) && (h = l.endTime, o.isAfter(h) && (o = h.subtract(1, u))));
|
|
691
694
|
l = l.parent;
|
|
692
695
|
}
|
|
693
696
|
let c = t.children || [];
|
|
694
697
|
for (; a !== "none" && c.length > 0; ) {
|
|
695
|
-
const
|
|
696
|
-
c.forEach((
|
|
697
|
-
let
|
|
698
|
-
a === "scale" ? s === "both" ? (n.findIndex((
|
|
699
|
-
}), c =
|
|
698
|
+
const m = [];
|
|
699
|
+
c.forEach((p) => {
|
|
700
|
+
let g = p.startTime || o, x = p.endTime || h, v = o.diff(t.startTime), S = h.diff(t.endTime);
|
|
701
|
+
a === "scale" ? s === "both" ? (n.findIndex((b) => b.id === p.id) === -1 && n.push(p.clone()), p.updateTime(g.add(v), x.add(S))) : s === "left" ? (g = g.add(v), 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(S), x.isSameOrBefore(g.add(1, u)) && (g.isAfter(t.startTime) ? g = x.subtract(1, u) : x = g.add(1, u)), x.isSameOrAfter(h) && (h = 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(v), x.add(S))) : 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(h) && (x = h, x.isSameOrBefore(g.add(1, u)) && (g.isAfter(t.startTime) ? g = x.subtract(1, u) : x = g.add(1, u)), x.isSameOrAfter(h) && (h = 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);
|
|
702
|
+
}), c = m;
|
|
700
703
|
}
|
|
701
|
-
n.findIndex((
|
|
704
|
+
n.findIndex((m) => m.id === t.id) === -1 && n.push(t.clone()), t.updateTime(o, h);
|
|
702
705
|
}
|
|
703
706
|
}
|
|
704
|
-
function H(
|
|
705
|
-
if (!Number.isFinite(
|
|
707
|
+
function H(f, t, e) {
|
|
708
|
+
if (!Number.isFinite(f) || !Number.isFinite(t) || !Number.isFinite(e))
|
|
706
709
|
return Number.isFinite(t) ? t : 0;
|
|
707
710
|
const i = Math.min(t, e), s = Math.max(t, e);
|
|
708
|
-
return Math.min(Math.max(i,
|
|
711
|
+
return Math.min(Math.max(i, f), s);
|
|
709
712
|
}
|
|
710
|
-
function at(
|
|
711
|
-
let e =
|
|
712
|
-
return
|
|
713
|
+
function at(f, t) {
|
|
714
|
+
let e = f;
|
|
715
|
+
return N(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
713
716
|
}
|
|
714
|
-
function lt(
|
|
717
|
+
function lt(f, t) {
|
|
715
718
|
if (t === 0)
|
|
716
719
|
throw new Error("基准值不能为0");
|
|
717
|
-
if (Math.abs(
|
|
720
|
+
if (Math.abs(f) <= t / 2)
|
|
718
721
|
return 0;
|
|
719
|
-
const e = Math.floor(
|
|
722
|
+
const e = Math.floor(f / t), i = Math.ceil(f / t), s = e * t, n = i * t, o = Math.abs(f - s), h = Math.abs(f - n);
|
|
720
723
|
return o <= h ? s : n;
|
|
721
724
|
}
|
|
722
|
-
function
|
|
723
|
-
return typeof
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
function et(f, t = 4) {
|
|
726
|
+
return typeof f == "number" ? [f, f, f, f] : Array.isArray(f) ? [
|
|
727
|
+
f[0] ?? t,
|
|
728
|
+
f[1] ?? t,
|
|
729
|
+
f[2] ?? t,
|
|
730
|
+
f[3] ?? t
|
|
728
731
|
] : [t, t, t, t];
|
|
729
732
|
}
|
|
730
|
-
function Yt(
|
|
731
|
-
if (!Number.isFinite(
|
|
733
|
+
function Yt(f, t = 100) {
|
|
734
|
+
if (!Number.isFinite(f) || !Number.isFinite(t) || t === 0 || f < 0)
|
|
732
735
|
return 0;
|
|
733
|
-
const e =
|
|
736
|
+
const e = f / Math.abs(t);
|
|
734
737
|
return Math.min(e, 1);
|
|
735
738
|
}
|
|
736
|
-
function Pt(
|
|
737
|
-
const i =
|
|
739
|
+
function Pt(f, t = 2, e = !1) {
|
|
740
|
+
const i = f.toFixed(t);
|
|
738
741
|
return e ? i : i.replace(/\.?0+$/, "");
|
|
739
742
|
}
|
|
740
|
-
function zt(
|
|
743
|
+
function zt(f) {
|
|
741
744
|
var s;
|
|
742
|
-
if (typeof
|
|
745
|
+
if (typeof f == "object" && f !== null)
|
|
743
746
|
return {
|
|
744
|
-
r: H(
|
|
745
|
-
g: H(
|
|
746
|
-
b: H(
|
|
747
|
-
a: H(
|
|
747
|
+
r: H(f.r ?? 0, 0, 255),
|
|
748
|
+
g: H(f.g ?? 0, 0, 255),
|
|
749
|
+
b: H(f.b ?? 0, 0, 255),
|
|
750
|
+
a: H(f.a ?? 1, 0, 1)
|
|
748
751
|
};
|
|
749
|
-
if (typeof
|
|
750
|
-
return C.warn(`Invalid color value type: ${typeof
|
|
751
|
-
let t =
|
|
752
|
+
if (typeof f != "string")
|
|
753
|
+
return C.warn(`Invalid color value type: ${typeof f}`), null;
|
|
754
|
+
let t = f.trim();
|
|
752
755
|
const e = (s = document == null ? void 0 : document.createElement("canvas")) == null ? void 0 : s.getContext("2d");
|
|
753
756
|
if (e && (e.fillStyle = t, t = e.fillStyle), t.startsWith("#")) {
|
|
754
757
|
const n = t.slice(1);
|
|
@@ -756,7 +759,7 @@ function zt(g) {
|
|
|
756
759
|
try {
|
|
757
760
|
o = parseInt(n, 16);
|
|
758
761
|
} catch {
|
|
759
|
-
return C.warn(`Invalid hex color: ${
|
|
762
|
+
return C.warn(`Invalid hex color: ${f}`), null;
|
|
760
763
|
}
|
|
761
764
|
if (n.length === 3)
|
|
762
765
|
h = (o >> 8 & 15) * 17, a = (o >> 4 & 15) * 17, d = (o & 15) * 17;
|
|
@@ -765,7 +768,7 @@ function zt(g) {
|
|
|
765
768
|
else if (n.length === 8)
|
|
766
769
|
h = o >> 24 & 255, a = o >> 16 & 255, d = o >> 8 & 255, u = (o & 255) / 255;
|
|
767
770
|
else
|
|
768
|
-
return C.warn(`Invalid hex color length: ${
|
|
771
|
+
return C.warn(`Invalid hex color length: ${f}`), null;
|
|
769
772
|
return { r: h, g: a, b: d, a: u };
|
|
770
773
|
}
|
|
771
774
|
let i = t.match(
|
|
@@ -780,13 +783,13 @@ function zt(g) {
|
|
|
780
783
|
a: i[4] !== void 0 ? H(parseFloat(i[4]), 0, 1) : 1
|
|
781
784
|
};
|
|
782
785
|
}
|
|
783
|
-
return C.warn(`Could not parse color: ${
|
|
786
|
+
return C.warn(`Could not parse color: ${f}`), null;
|
|
784
787
|
}
|
|
785
|
-
function
|
|
788
|
+
function Nt(f, t, e, i, s = !1, n = !1) {
|
|
786
789
|
const o = (c) => {
|
|
787
|
-
const
|
|
788
|
-
return
|
|
789
|
-
}, h = o(
|
|
790
|
+
const m = Math.round(H(c, 0, 255)).toString(16);
|
|
791
|
+
return m.length === 1 ? "0" + m : m;
|
|
792
|
+
}, h = o(f), a = o(t), d = o(e), u = o(i * 255);
|
|
790
793
|
if (s && h[0] === h[1] && a[0] === a[1] && d[0] === d[1] && i === 1 && // Alpha 必须为 1 才能缩写
|
|
791
794
|
!n)
|
|
792
795
|
return `#${h[0]}${a[0]}${d[0]}`;
|
|
@@ -846,7 +849,7 @@ class j {
|
|
|
846
849
|
* @returns Hex/HexA 字符串。
|
|
847
850
|
*/
|
|
848
851
|
toHex(t = !1, e = !1) {
|
|
849
|
-
return
|
|
852
|
+
return Nt(
|
|
850
853
|
this._r,
|
|
851
854
|
this._g,
|
|
852
855
|
this._b,
|
|
@@ -958,7 +961,7 @@ class j {
|
|
|
958
961
|
);
|
|
959
962
|
}
|
|
960
963
|
}
|
|
961
|
-
const R = (
|
|
964
|
+
const R = (f) => f instanceof j ? f : new j(f);
|
|
962
965
|
class mt {
|
|
963
966
|
constructor(t, e, i) {
|
|
964
967
|
r(this, "element");
|
|
@@ -1036,14 +1039,14 @@ class mt {
|
|
|
1036
1039
|
)) : (this.context.store.getDataManager().updateCheckedList(!0, this.task), this.setState(
|
|
1037
1040
|
1
|
|
1038
1041
|
/* CHECKED */
|
|
1039
|
-
)), this.context.event.emit(
|
|
1042
|
+
)), this.context.event.emit(y.CHECK_TASK, [this.task], !e);
|
|
1040
1043
|
} else {
|
|
1041
1044
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1042
1045
|
this.setState(
|
|
1043
1046
|
e ? 1 : 0
|
|
1044
1047
|
/* UNCHECKED */
|
|
1045
1048
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1046
|
-
|
|
1049
|
+
y.CHECK_TASK,
|
|
1047
1050
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1048
1051
|
!e
|
|
1049
1052
|
);
|
|
@@ -1066,14 +1069,14 @@ class mt {
|
|
|
1066
1069
|
}), this.setState(
|
|
1067
1070
|
1
|
|
1068
1071
|
/* CHECKED */
|
|
1069
|
-
)), this.context.event.emit(
|
|
1072
|
+
)), this.context.event.emit(y.CHECK_TASK, e, !i);
|
|
1070
1073
|
} else {
|
|
1071
1074
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1072
1075
|
this.setState(
|
|
1073
1076
|
e ? 1 : 0
|
|
1074
1077
|
/* UNCHECKED */
|
|
1075
1078
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1076
|
-
|
|
1079
|
+
y.CHECK_TASK,
|
|
1077
1080
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1078
1081
|
!e
|
|
1079
1082
|
);
|
|
@@ -1081,7 +1084,7 @@ class mt {
|
|
|
1081
1084
|
});
|
|
1082
1085
|
}
|
|
1083
1086
|
registerEvents() {
|
|
1084
|
-
this.context.event.on(
|
|
1087
|
+
this.context.event.on(y.CHECK_TASK, this.updateState.bind(this));
|
|
1085
1088
|
}
|
|
1086
1089
|
/** 获取元素 */
|
|
1087
1090
|
getElement() {
|
|
@@ -1119,7 +1122,7 @@ class mt {
|
|
|
1119
1122
|
}
|
|
1120
1123
|
}
|
|
1121
1124
|
const ct = "handler_column";
|
|
1122
|
-
class
|
|
1125
|
+
class Ft {
|
|
1123
1126
|
constructor(t) {
|
|
1124
1127
|
/** 源列数据 */
|
|
1125
1128
|
r(this, "sourceColumns", []);
|
|
@@ -1148,13 +1151,13 @@ class Nt {
|
|
|
1148
1151
|
*/
|
|
1149
1152
|
processColumns(t, e = [], i, s = 1) {
|
|
1150
1153
|
t.forEach((n, o) => {
|
|
1151
|
-
var
|
|
1154
|
+
var p;
|
|
1152
1155
|
const h = "children" in n && Array.isArray(n.children) && n.children.length > 0, a = !h;
|
|
1153
1156
|
let d = "";
|
|
1154
1157
|
h ? d = `group-${o}` : d = `field-${n.field}`;
|
|
1155
1158
|
const u = [...(i == null ? void 0 : i.path) || [], d];
|
|
1156
1159
|
d = "column-" + o + "-" + u.join("-");
|
|
1157
|
-
const l = n.label || (a ? n.field : ""), c = a ? ((
|
|
1160
|
+
const l = n.label || (a ? n.field : ""), c = a ? ((p = this.temporaryLeafColumns.find((g) => g.key === d)) == null ? void 0 : p.width) || n.width || 100 : "auto", m = {
|
|
1158
1161
|
label: l,
|
|
1159
1162
|
level: s,
|
|
1160
1163
|
maxLevel: s,
|
|
@@ -1165,18 +1168,18 @@ class Nt {
|
|
|
1165
1168
|
isLeaf: a,
|
|
1166
1169
|
width: c
|
|
1167
1170
|
};
|
|
1168
|
-
if (e.push(
|
|
1169
|
-
this.leafColumns.push(
|
|
1171
|
+
if (e.push(m), a)
|
|
1172
|
+
this.leafColumns.push(m);
|
|
1170
1173
|
else if (h) {
|
|
1171
|
-
const
|
|
1174
|
+
const g = n.children;
|
|
1172
1175
|
this.processColumns(
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
+
g,
|
|
1177
|
+
m.children,
|
|
1178
|
+
m,
|
|
1176
1179
|
s + 1
|
|
1177
|
-
),
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
+
), m.maxLevel = Math.max(
|
|
1181
|
+
m.maxLevel,
|
|
1182
|
+
m.children.reduce((x, v) => Math.max(x, v.maxLevel), 0)
|
|
1180
1183
|
);
|
|
1181
1184
|
}
|
|
1182
1185
|
}), this.temporaryLeafColumns = B(this.leafColumns);
|
|
@@ -1188,7 +1191,7 @@ class Nt {
|
|
|
1188
1191
|
return this.columns.find((e) => e.key === t);
|
|
1189
1192
|
}
|
|
1190
1193
|
update(t) {
|
|
1191
|
-
this.init(t);
|
|
1194
|
+
this.init(t), this.clearMergeInfo();
|
|
1192
1195
|
}
|
|
1193
1196
|
getColumns() {
|
|
1194
1197
|
return this.columns;
|
|
@@ -1209,7 +1212,7 @@ class Nt {
|
|
|
1209
1212
|
}
|
|
1210
1213
|
setColumnWidth(t, e) {
|
|
1211
1214
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1212
|
-
i && (i.width = e), this.context.event.emit(
|
|
1215
|
+
i && (i.width = e), this.context.event.emit(y.COLUMN_WIDTH_CHANGE, t, e);
|
|
1213
1216
|
}
|
|
1214
1217
|
isLastColumn(t) {
|
|
1215
1218
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1253,35 +1256,35 @@ class Nt {
|
|
|
1253
1256
|
}
|
|
1254
1257
|
}
|
|
1255
1258
|
var $ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1256
|
-
function Y(
|
|
1257
|
-
return
|
|
1259
|
+
function Y(f) {
|
|
1260
|
+
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
1258
1261
|
}
|
|
1259
1262
|
var pt = { exports: {} };
|
|
1260
|
-
(function(
|
|
1263
|
+
(function(f, t) {
|
|
1261
1264
|
(function(e, i) {
|
|
1262
|
-
|
|
1265
|
+
f.exports = i();
|
|
1263
1266
|
})($, function() {
|
|
1264
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, h = 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, d = 31536e6, u = 2628e6, l = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, c = { years: d, months: u, days: h, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 },
|
|
1267
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, h = 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, d = 31536e6, u = 2628e6, l = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, c = { years: d, months: u, days: h, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(k) {
|
|
1265
1268
|
return k instanceof M;
|
|
1266
|
-
},
|
|
1267
|
-
return new M(k, w,
|
|
1268
|
-
},
|
|
1269
|
+
}, p = function(k, T, w) {
|
|
1270
|
+
return new M(k, w, T.$l);
|
|
1271
|
+
}, g = function(k) {
|
|
1269
1272
|
return i.p(k) + "s";
|
|
1270
1273
|
}, x = function(k) {
|
|
1271
1274
|
return k < 0;
|
|
1272
|
-
}, T = function(k) {
|
|
1273
|
-
return x(k) ? Math.ceil(k) : Math.floor(k);
|
|
1274
1275
|
}, v = function(k) {
|
|
1276
|
+
return x(k) ? Math.ceil(k) : Math.floor(k);
|
|
1277
|
+
}, S = function(k) {
|
|
1275
1278
|
return Math.abs(k);
|
|
1276
|
-
},
|
|
1277
|
-
return k ? x(k) ? { negative: !0, format: "" +
|
|
1279
|
+
}, b = function(k, T) {
|
|
1280
|
+
return k ? x(k) ? { negative: !0, format: "" + S(k) + T } : { negative: !1, format: "" + k + T } : { negative: !1, format: "" };
|
|
1278
1281
|
}, M = function() {
|
|
1279
1282
|
function k(w, O, _) {
|
|
1280
1283
|
var A = this;
|
|
1281
|
-
if (this.$d = {}, this.$l = _, w === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), O) return
|
|
1284
|
+
if (this.$d = {}, this.$l = _, w === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), O) return p(w * c[g(O)], this);
|
|
1282
1285
|
if (typeof w == "number") return this.$ms = w, this.parseFromMilliseconds(), this;
|
|
1283
1286
|
if (typeof w == "object") return Object.keys(w).forEach(function(P) {
|
|
1284
|
-
A.$d[
|
|
1287
|
+
A.$d[g(P)] = w[P];
|
|
1285
1288
|
}), this.calMilliseconds(), this;
|
|
1286
1289
|
if (typeof w == "string") {
|
|
1287
1290
|
var W = w.match(l);
|
|
@@ -1294,94 +1297,94 @@ var pt = { exports: {} };
|
|
|
1294
1297
|
}
|
|
1295
1298
|
return this;
|
|
1296
1299
|
}
|
|
1297
|
-
var
|
|
1298
|
-
return
|
|
1300
|
+
var T = k.prototype;
|
|
1301
|
+
return T.calMilliseconds = function() {
|
|
1299
1302
|
var w = this;
|
|
1300
1303
|
this.$ms = Object.keys(this.$d).reduce(function(O, _) {
|
|
1301
1304
|
return O + (w.$d[_] || 0) * c[_];
|
|
1302
1305
|
}, 0);
|
|
1303
|
-
},
|
|
1306
|
+
}, T.parseFromMilliseconds = function() {
|
|
1304
1307
|
var w = this.$ms;
|
|
1305
|
-
this.$d.years =
|
|
1306
|
-
},
|
|
1307
|
-
var w =
|
|
1308
|
+
this.$d.years = v(w / d), w %= d, this.$d.months = v(w / u), w %= u, this.$d.days = v(w / h), w %= h, this.$d.hours = v(w / o), w %= o, this.$d.minutes = v(w / n), w %= n, this.$d.seconds = v(w / s), w %= s, this.$d.milliseconds = w;
|
|
1309
|
+
}, T.toISOString = function() {
|
|
1310
|
+
var w = b(this.$d.years, "Y"), O = b(this.$d.months, "M"), _ = +this.$d.days || 0;
|
|
1308
1311
|
this.$d.weeks && (_ += 7 * this.$d.weeks);
|
|
1309
|
-
var A =
|
|
1312
|
+
var A = b(_, "D"), W = b(this.$d.hours, "H"), G = b(this.$d.minutes, "M"), P = this.$d.seconds || 0;
|
|
1310
1313
|
this.$d.milliseconds && (P += this.$d.milliseconds / 1e3, P = Math.round(1e3 * P) / 1e3);
|
|
1311
|
-
var
|
|
1312
|
-
return
|
|
1313
|
-
},
|
|
1314
|
+
var Z = b(P, "S"), Ot = w.negative || O.negative || A.negative || W.negative || G.negative || Z.negative, Dt = W.format || G.format || Z.format ? "T" : "", J = (Ot ? "-" : "") + "P" + w.format + O.format + A.format + Dt + W.format + G.format + Z.format;
|
|
1315
|
+
return J === "P" || J === "-P" ? "P0D" : J;
|
|
1316
|
+
}, T.toJSON = function() {
|
|
1314
1317
|
return this.toISOString();
|
|
1315
|
-
},
|
|
1318
|
+
}, T.format = function(w) {
|
|
1316
1319
|
var O = w || "YYYY-MM-DDTHH:mm:ss", _ = { 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") };
|
|
1317
1320
|
return O.replace(a, function(A, W) {
|
|
1318
1321
|
return W || String(_[A]);
|
|
1319
1322
|
});
|
|
1320
|
-
},
|
|
1321
|
-
return this.$ms / c[
|
|
1322
|
-
},
|
|
1323
|
-
var O = this.$ms, _ =
|
|
1324
|
-
return _ === "milliseconds" ? O %= 1e3 : O = _ === "weeks" ?
|
|
1325
|
-
},
|
|
1323
|
+
}, T.as = function(w) {
|
|
1324
|
+
return this.$ms / c[g(w)];
|
|
1325
|
+
}, T.get = function(w) {
|
|
1326
|
+
var O = this.$ms, _ = g(w);
|
|
1327
|
+
return _ === "milliseconds" ? O %= 1e3 : O = _ === "weeks" ? v(O / c[_]) : this.$d[_], O || 0;
|
|
1328
|
+
}, T.add = function(w, O, _) {
|
|
1326
1329
|
var A;
|
|
1327
|
-
return A = O ? w * c[
|
|
1328
|
-
},
|
|
1330
|
+
return A = O ? w * c[g(O)] : m(w) ? w.$ms : p(w, this).$ms, p(this.$ms + A * (_ ? -1 : 1), this);
|
|
1331
|
+
}, T.subtract = function(w, O) {
|
|
1329
1332
|
return this.add(w, O, !0);
|
|
1330
|
-
},
|
|
1333
|
+
}, T.locale = function(w) {
|
|
1331
1334
|
var O = this.clone();
|
|
1332
1335
|
return O.$l = w, O;
|
|
1333
|
-
},
|
|
1334
|
-
return
|
|
1335
|
-
},
|
|
1336
|
+
}, T.clone = function() {
|
|
1337
|
+
return p(this.$ms, this);
|
|
1338
|
+
}, T.humanize = function(w) {
|
|
1336
1339
|
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!w);
|
|
1337
|
-
},
|
|
1340
|
+
}, T.valueOf = function() {
|
|
1338
1341
|
return this.asMilliseconds();
|
|
1339
|
-
},
|
|
1342
|
+
}, T.milliseconds = function() {
|
|
1340
1343
|
return this.get("milliseconds");
|
|
1341
|
-
},
|
|
1344
|
+
}, T.asMilliseconds = function() {
|
|
1342
1345
|
return this.as("milliseconds");
|
|
1343
|
-
},
|
|
1346
|
+
}, T.seconds = function() {
|
|
1344
1347
|
return this.get("seconds");
|
|
1345
|
-
},
|
|
1348
|
+
}, T.asSeconds = function() {
|
|
1346
1349
|
return this.as("seconds");
|
|
1347
|
-
},
|
|
1350
|
+
}, T.minutes = function() {
|
|
1348
1351
|
return this.get("minutes");
|
|
1349
|
-
},
|
|
1352
|
+
}, T.asMinutes = function() {
|
|
1350
1353
|
return this.as("minutes");
|
|
1351
|
-
},
|
|
1354
|
+
}, T.hours = function() {
|
|
1352
1355
|
return this.get("hours");
|
|
1353
|
-
},
|
|
1356
|
+
}, T.asHours = function() {
|
|
1354
1357
|
return this.as("hours");
|
|
1355
|
-
},
|
|
1358
|
+
}, T.days = function() {
|
|
1356
1359
|
return this.get("days");
|
|
1357
|
-
},
|
|
1360
|
+
}, T.asDays = function() {
|
|
1358
1361
|
return this.as("days");
|
|
1359
|
-
},
|
|
1362
|
+
}, T.weeks = function() {
|
|
1360
1363
|
return this.get("weeks");
|
|
1361
|
-
},
|
|
1364
|
+
}, T.asWeeks = function() {
|
|
1362
1365
|
return this.as("weeks");
|
|
1363
|
-
},
|
|
1366
|
+
}, T.months = function() {
|
|
1364
1367
|
return this.get("months");
|
|
1365
|
-
},
|
|
1368
|
+
}, T.asMonths = function() {
|
|
1366
1369
|
return this.as("months");
|
|
1367
|
-
},
|
|
1370
|
+
}, T.years = function() {
|
|
1368
1371
|
return this.get("years");
|
|
1369
|
-
},
|
|
1372
|
+
}, T.asYears = function() {
|
|
1370
1373
|
return this.as("years");
|
|
1371
1374
|
}, k;
|
|
1372
|
-
}(), L = function(k,
|
|
1373
|
-
return k.add(
|
|
1375
|
+
}(), L = function(k, T, w) {
|
|
1376
|
+
return k.add(T.years() * w, "y").add(T.months() * w, "M").add(T.days() * w, "d").add(T.hours() * w, "h").add(T.minutes() * w, "m").add(T.seconds() * w, "s").add(T.milliseconds() * w, "ms");
|
|
1374
1377
|
};
|
|
1375
|
-
return function(k,
|
|
1378
|
+
return function(k, T, w) {
|
|
1376
1379
|
e = w, i = w().$utils(), w.duration = function(A, W) {
|
|
1377
1380
|
var G = w.locale();
|
|
1378
|
-
return
|
|
1379
|
-
}, w.isDuration =
|
|
1380
|
-
var O =
|
|
1381
|
-
|
|
1382
|
-
return
|
|
1383
|
-
},
|
|
1384
|
-
return
|
|
1381
|
+
return p(A, { $l: G }, W);
|
|
1382
|
+
}, w.isDuration = m;
|
|
1383
|
+
var O = T.prototype.add, _ = T.prototype.subtract;
|
|
1384
|
+
T.prototype.add = function(A, W) {
|
|
1385
|
+
return m(A) ? L(this, A, 1) : O.bind(this)(A, W);
|
|
1386
|
+
}, T.prototype.subtract = function(A, W) {
|
|
1387
|
+
return m(A) ? L(this, A, -1) : _.bind(this)(A, W);
|
|
1385
1388
|
};
|
|
1386
1389
|
};
|
|
1387
1390
|
});
|
|
@@ -1389,9 +1392,9 @@ var pt = { exports: {} };
|
|
|
1389
1392
|
var Ut = pt.exports;
|
|
1390
1393
|
const Xt = /* @__PURE__ */ Y(Ut);
|
|
1391
1394
|
var xt = { exports: {} };
|
|
1392
|
-
(function(
|
|
1395
|
+
(function(f, t) {
|
|
1393
1396
|
(function(e, i) {
|
|
1394
|
-
|
|
1397
|
+
f.exports = i();
|
|
1395
1398
|
})($, function() {
|
|
1396
1399
|
return function(e, i, s) {
|
|
1397
1400
|
i.prototype.isBetween = function(n, o, h, a) {
|
|
@@ -1404,9 +1407,9 @@ var xt = { exports: {} };
|
|
|
1404
1407
|
var Bt = xt.exports;
|
|
1405
1408
|
const Vt = /* @__PURE__ */ Y(Bt);
|
|
1406
1409
|
var yt = { exports: {} };
|
|
1407
|
-
(function(
|
|
1410
|
+
(function(f, t) {
|
|
1408
1411
|
(function(e, i) {
|
|
1409
|
-
|
|
1412
|
+
f.exports = i();
|
|
1410
1413
|
})($, function() {
|
|
1411
1414
|
return function(e, i) {
|
|
1412
1415
|
i.prototype.isSameOrBefore = function(s, n) {
|
|
@@ -1418,9 +1421,9 @@ var yt = { exports: {} };
|
|
|
1418
1421
|
var Kt = yt.exports;
|
|
1419
1422
|
const jt = /* @__PURE__ */ Y(Kt);
|
|
1420
1423
|
var wt = { exports: {} };
|
|
1421
|
-
(function(
|
|
1424
|
+
(function(f, t) {
|
|
1422
1425
|
(function(e, i) {
|
|
1423
|
-
|
|
1426
|
+
f.exports = i();
|
|
1424
1427
|
})($, function() {
|
|
1425
1428
|
return function(e, i) {
|
|
1426
1429
|
i.prototype.isSameOrAfter = function(s, n) {
|
|
@@ -1432,28 +1435,28 @@ var wt = { exports: {} };
|
|
|
1432
1435
|
var Qt = wt.exports;
|
|
1433
1436
|
const qt = /* @__PURE__ */ Y(Qt);
|
|
1434
1437
|
var bt = { exports: {} };
|
|
1435
|
-
(function(
|
|
1438
|
+
(function(f, t) {
|
|
1436
1439
|
(function(e, i) {
|
|
1437
|
-
|
|
1440
|
+
f.exports = i();
|
|
1438
1441
|
})($, function() {
|
|
1439
1442
|
return function(e, i, s) {
|
|
1440
1443
|
var n = i.prototype, o = function(l) {
|
|
1441
1444
|
return l && (l.indexOf ? l : l.s);
|
|
1442
|
-
}, h = function(l, c,
|
|
1443
|
-
var x = l.name ? l : l.$locale(),
|
|
1444
|
-
return L.slice(0,
|
|
1445
|
+
}, h = function(l, c, m, p, g) {
|
|
1446
|
+
var x = l.name ? l : l.$locale(), v = o(x[c]), S = o(x[m]), b = v || S.map(function(L) {
|
|
1447
|
+
return L.slice(0, p);
|
|
1445
1448
|
});
|
|
1446
|
-
if (!
|
|
1449
|
+
if (!g) return b;
|
|
1447
1450
|
var M = x.weekStart;
|
|
1448
|
-
return
|
|
1449
|
-
return
|
|
1451
|
+
return b.map(function(L, k) {
|
|
1452
|
+
return b[(k + (M || 0)) % 7];
|
|
1450
1453
|
});
|
|
1451
1454
|
}, a = function() {
|
|
1452
1455
|
return s.Ls[s.locale()];
|
|
1453
1456
|
}, d = function(l, c) {
|
|
1454
|
-
return l.formats[c] || function(
|
|
1455
|
-
return
|
|
1456
|
-
return
|
|
1457
|
+
return l.formats[c] || function(m) {
|
|
1458
|
+
return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(p, g, x) {
|
|
1459
|
+
return g || x.slice(1);
|
|
1457
1460
|
});
|
|
1458
1461
|
}(l.formats[c.toUpperCase()]);
|
|
1459
1462
|
}, u = function() {
|
|
@@ -1509,10 +1512,10 @@ var bt = { exports: {} };
|
|
|
1509
1512
|
})(bt);
|
|
1510
1513
|
var Zt = bt.exports;
|
|
1511
1514
|
const Jt = /* @__PURE__ */ Y(Zt);
|
|
1512
|
-
var
|
|
1513
|
-
(function(
|
|
1515
|
+
var vt = { exports: {} };
|
|
1516
|
+
(function(f, t) {
|
|
1514
1517
|
(function(e, i) {
|
|
1515
|
-
|
|
1518
|
+
f.exports = i();
|
|
1516
1519
|
})($, function() {
|
|
1517
1520
|
var e = "week", i = "year";
|
|
1518
1521
|
return function(s, n, o) {
|
|
@@ -1524,20 +1527,20 @@ var Tt = { exports: {} };
|
|
|
1524
1527
|
var u = o(this).startOf(i).add(1, i).date(d), l = o(this).endOf(e);
|
|
1525
1528
|
if (u.isBefore(l)) return 1;
|
|
1526
1529
|
}
|
|
1527
|
-
var c = o(this).startOf(i).date(d).startOf(e).subtract(1, "millisecond"),
|
|
1528
|
-
return
|
|
1530
|
+
var c = o(this).startOf(i).date(d).startOf(e).subtract(1, "millisecond"), m = this.diff(c, e, !0);
|
|
1531
|
+
return m < 0 ? o(this).startOf("week").week() : Math.ceil(m);
|
|
1529
1532
|
}, h.weeks = function(a) {
|
|
1530
1533
|
return a === void 0 && (a = null), this.week(a);
|
|
1531
1534
|
};
|
|
1532
1535
|
};
|
|
1533
1536
|
});
|
|
1534
|
-
})(
|
|
1535
|
-
var te =
|
|
1537
|
+
})(vt);
|
|
1538
|
+
var te = vt.exports;
|
|
1536
1539
|
const ee = /* @__PURE__ */ Y(te);
|
|
1537
|
-
var
|
|
1538
|
-
(function(
|
|
1540
|
+
var Tt = { exports: {} };
|
|
1541
|
+
(function(f, t) {
|
|
1539
1542
|
(function(e, i) {
|
|
1540
|
-
|
|
1543
|
+
f.exports = i();
|
|
1541
1544
|
})($, function() {
|
|
1542
1545
|
return function(e, i) {
|
|
1543
1546
|
i.prototype.weekYear = function() {
|
|
@@ -1546,13 +1549,13 @@ var vt = { exports: {} };
|
|
|
1546
1549
|
};
|
|
1547
1550
|
};
|
|
1548
1551
|
});
|
|
1549
|
-
})(
|
|
1550
|
-
var ie =
|
|
1552
|
+
})(Tt);
|
|
1553
|
+
var ie = Tt.exports;
|
|
1551
1554
|
const se = /* @__PURE__ */ Y(ie);
|
|
1552
1555
|
var St = { exports: {} };
|
|
1553
|
-
(function(
|
|
1556
|
+
(function(f, t) {
|
|
1554
1557
|
(function(e, i) {
|
|
1555
|
-
|
|
1558
|
+
f.exports = i();
|
|
1556
1559
|
})($, function() {
|
|
1557
1560
|
return function(e, i) {
|
|
1558
1561
|
var s = i.prototype, n = s.format;
|
|
@@ -1600,9 +1603,9 @@ var St = { exports: {} };
|
|
|
1600
1603
|
var ne = St.exports;
|
|
1601
1604
|
const oe = /* @__PURE__ */ Y(ne);
|
|
1602
1605
|
var Et = { exports: {} };
|
|
1603
|
-
(function(
|
|
1606
|
+
(function(f, t) {
|
|
1604
1607
|
(function(e, i) {
|
|
1605
|
-
|
|
1608
|
+
f.exports = i();
|
|
1606
1609
|
})($, function() {
|
|
1607
1610
|
return function(e, i, s) {
|
|
1608
1611
|
s.updateLocale = function(n, o) {
|
|
@@ -1616,10 +1619,10 @@ var Et = { exports: {} };
|
|
|
1616
1619
|
})(Et);
|
|
1617
1620
|
var re = Et.exports;
|
|
1618
1621
|
const he = /* @__PURE__ */ Y(re);
|
|
1619
|
-
var
|
|
1620
|
-
(function(
|
|
1622
|
+
var Lt = { exports: {} };
|
|
1623
|
+
(function(f, t) {
|
|
1621
1624
|
(function(e, i) {
|
|
1622
|
-
|
|
1625
|
+
f.exports = i();
|
|
1623
1626
|
})($, function() {
|
|
1624
1627
|
var e = "day";
|
|
1625
1628
|
return function(i, s, n) {
|
|
@@ -1630,8 +1633,8 @@ var kt = { exports: {} };
|
|
|
1630
1633
|
return o(this).year();
|
|
1631
1634
|
}, h.isoWeek = function(d) {
|
|
1632
1635
|
if (!this.$utils().u(d)) return this.add(7 * (d - this.isoWeek()), e);
|
|
1633
|
-
var u, l, c,
|
|
1634
|
-
return
|
|
1636
|
+
var u, l, c, m, p = o(this), g = (u = this.isoWeekYear(), l = this.$u, c = (l ? n.utc : n)().year(u).startOf("year"), m = 4 - c.isoWeekday(), c.isoWeekday() > 4 && (m += 7), c.add(m, e));
|
|
1637
|
+
return p.diff(g, "week") + 1;
|
|
1635
1638
|
}, h.isoWeekday = function(d) {
|
|
1636
1639
|
return this.$utils().u(d) ? this.day() || 7 : this.day(this.day() % 7 ? d : d - 7);
|
|
1637
1640
|
};
|
|
@@ -1642,61 +1645,61 @@ var kt = { exports: {} };
|
|
|
1642
1645
|
};
|
|
1643
1646
|
};
|
|
1644
1647
|
});
|
|
1645
|
-
})(
|
|
1646
|
-
var ae =
|
|
1648
|
+
})(Lt);
|
|
1649
|
+
var ae = Lt.exports;
|
|
1647
1650
|
const le = /* @__PURE__ */ Y(ae);
|
|
1648
|
-
var
|
|
1649
|
-
(function(
|
|
1651
|
+
var kt = { exports: {} };
|
|
1652
|
+
(function(f, t) {
|
|
1650
1653
|
(function(e, i) {
|
|
1651
|
-
|
|
1654
|
+
f.exports = i();
|
|
1652
1655
|
})($, function() {
|
|
1653
1656
|
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, i = {};
|
|
1654
1657
|
return function(s, n, o) {
|
|
1655
|
-
var h, a = function(c,
|
|
1656
|
-
|
|
1657
|
-
var
|
|
1658
|
-
|
|
1659
|
-
var
|
|
1660
|
-
return L || (L = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone:
|
|
1661
|
-
}(
|
|
1662
|
-
return x.formatToParts(
|
|
1663
|
-
}, d = function(c,
|
|
1664
|
-
for (var
|
|
1665
|
-
var
|
|
1666
|
-
M >= 0 && (
|
|
1658
|
+
var h, a = function(c, m, p) {
|
|
1659
|
+
p === void 0 && (p = {});
|
|
1660
|
+
var g = new Date(c), x = function(v, S) {
|
|
1661
|
+
S === void 0 && (S = {});
|
|
1662
|
+
var b = S.timeZoneName || "short", M = v + "|" + b, L = i[M];
|
|
1663
|
+
return L || (L = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: v, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: b }), i[M] = L), L;
|
|
1664
|
+
}(m, p);
|
|
1665
|
+
return x.formatToParts(g);
|
|
1666
|
+
}, d = function(c, m) {
|
|
1667
|
+
for (var p = a(c, m), g = [], x = 0; x < p.length; x += 1) {
|
|
1668
|
+
var v = p[x], S = v.type, b = v.value, M = e[S];
|
|
1669
|
+
M >= 0 && (g[M] = parseInt(b, 10));
|
|
1667
1670
|
}
|
|
1668
|
-
var L =
|
|
1669
|
-
return (o.utc(
|
|
1671
|
+
var L = g[3], k = L === 24 ? 0 : L, T = g[0] + "-" + g[1] + "-" + g[2] + " " + k + ":" + g[4] + ":" + g[5] + ":000", w = +c;
|
|
1672
|
+
return (o.utc(T).valueOf() - (w -= w % 1e3)) / 6e4;
|
|
1670
1673
|
}, u = n.prototype;
|
|
1671
|
-
u.tz = function(c,
|
|
1674
|
+
u.tz = function(c, m) {
|
|
1672
1675
|
c === void 0 && (c = h);
|
|
1673
|
-
var
|
|
1674
|
-
if (!Number(
|
|
1675
|
-
else if (
|
|
1676
|
-
var M =
|
|
1677
|
-
|
|
1676
|
+
var p, g = this.utcOffset(), x = this.toDate(), v = x.toLocaleString("en-US", { timeZone: c }), S = Math.round((x - new Date(v)) / 1e3 / 60), b = 15 * -Math.round(x.getTimezoneOffset() / 15) - S;
|
|
1677
|
+
if (!Number(b)) p = this.utcOffset(0, m);
|
|
1678
|
+
else if (p = o(v, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(b, !0), m) {
|
|
1679
|
+
var M = p.utcOffset();
|
|
1680
|
+
p = p.add(g - M, "minute");
|
|
1678
1681
|
}
|
|
1679
|
-
return
|
|
1682
|
+
return p.$x.$timezone = c, p;
|
|
1680
1683
|
}, u.offsetName = function(c) {
|
|
1681
|
-
var
|
|
1682
|
-
return
|
|
1684
|
+
var m = this.$x.$timezone || o.tz.guess(), p = a(this.valueOf(), m, { timeZoneName: c }).find(function(g) {
|
|
1685
|
+
return g.type.toLowerCase() === "timezonename";
|
|
1683
1686
|
});
|
|
1684
|
-
return
|
|
1687
|
+
return p && p.value;
|
|
1685
1688
|
};
|
|
1686
1689
|
var l = u.startOf;
|
|
1687
|
-
u.startOf = function(c,
|
|
1688
|
-
if (!this.$x || !this.$x.$timezone) return l.call(this, c,
|
|
1689
|
-
var
|
|
1690
|
-
return l.call(
|
|
1691
|
-
}, o.tz = function(c,
|
|
1692
|
-
var
|
|
1690
|
+
u.startOf = function(c, m) {
|
|
1691
|
+
if (!this.$x || !this.$x.$timezone) return l.call(this, c, m);
|
|
1692
|
+
var p = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
1693
|
+
return l.call(p, c, m).tz(this.$x.$timezone, !0);
|
|
1694
|
+
}, o.tz = function(c, m, p) {
|
|
1695
|
+
var g = p && m, x = p || m || h, v = d(+o(), x);
|
|
1693
1696
|
if (typeof c != "string") return o(c).tz(x);
|
|
1694
|
-
var
|
|
1695
|
-
var O = k - 60 *
|
|
1696
|
-
if (
|
|
1697
|
-
var A = d(O -= 60 * (_ -
|
|
1697
|
+
var S = function(k, T, w) {
|
|
1698
|
+
var O = k - 60 * T * 1e3, _ = d(O, w);
|
|
1699
|
+
if (T === _) return [O, T];
|
|
1700
|
+
var A = d(O -= 60 * (_ - T) * 1e3, w);
|
|
1698
1701
|
return _ === A ? [O, _] : [k - 60 * Math.min(_, A) * 1e3, Math.max(_, A)];
|
|
1699
|
-
}(o.utc(c,
|
|
1702
|
+
}(o.utc(c, g).valueOf(), v, x), b = S[0], M = S[1], L = o(b).utcOffset(M);
|
|
1700
1703
|
return L.$x.$timezone = x, L;
|
|
1701
1704
|
}, o.tz.guess = function() {
|
|
1702
1705
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -1705,63 +1708,63 @@ var Lt = { exports: {} };
|
|
|
1705
1708
|
};
|
|
1706
1709
|
};
|
|
1707
1710
|
});
|
|
1708
|
-
})(
|
|
1709
|
-
var ce =
|
|
1711
|
+
})(kt);
|
|
1712
|
+
var ce = kt.exports;
|
|
1710
1713
|
const de = /* @__PURE__ */ Y(ce);
|
|
1711
1714
|
var Mt = { exports: {} };
|
|
1712
|
-
(function(
|
|
1715
|
+
(function(f, t) {
|
|
1713
1716
|
(function(e, i) {
|
|
1714
|
-
|
|
1717
|
+
f.exports = i();
|
|
1715
1718
|
})($, function() {
|
|
1716
1719
|
var e = "minute", i = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
|
|
1717
1720
|
return function(n, o, h) {
|
|
1718
1721
|
var a = o.prototype;
|
|
1719
|
-
h.utc = function(
|
|
1720
|
-
var x = { date:
|
|
1722
|
+
h.utc = function(g) {
|
|
1723
|
+
var x = { date: g, utc: !0, args: arguments };
|
|
1721
1724
|
return new o(x);
|
|
1722
|
-
}, a.utc = function(
|
|
1725
|
+
}, a.utc = function(g) {
|
|
1723
1726
|
var x = h(this.toDate(), { locale: this.$L, utc: !0 });
|
|
1724
|
-
return
|
|
1727
|
+
return g ? x.add(this.utcOffset(), e) : x;
|
|
1725
1728
|
}, a.local = function() {
|
|
1726
1729
|
return h(this.toDate(), { locale: this.$L, utc: !1 });
|
|
1727
1730
|
};
|
|
1728
1731
|
var d = a.parse;
|
|
1729
|
-
a.parse = function(
|
|
1730
|
-
|
|
1732
|
+
a.parse = function(g) {
|
|
1733
|
+
g.utc && (this.$u = !0), this.$utils().u(g.$offset) || (this.$offset = g.$offset), d.call(this, g);
|
|
1731
1734
|
};
|
|
1732
1735
|
var u = a.init;
|
|
1733
1736
|
a.init = function() {
|
|
1734
1737
|
if (this.$u) {
|
|
1735
|
-
var
|
|
1736
|
-
this.$y =
|
|
1738
|
+
var g = this.$d;
|
|
1739
|
+
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();
|
|
1737
1740
|
} else u.call(this);
|
|
1738
1741
|
};
|
|
1739
1742
|
var l = a.utcOffset;
|
|
1740
|
-
a.utcOffset = function(
|
|
1741
|
-
var
|
|
1742
|
-
if (
|
|
1743
|
-
if (typeof
|
|
1743
|
+
a.utcOffset = function(g, x) {
|
|
1744
|
+
var v = this.$utils().u;
|
|
1745
|
+
if (v(g)) return this.$u ? 0 : v(this.$offset) ? l.call(this) : this.$offset;
|
|
1746
|
+
if (typeof g == "string" && (g = function(L) {
|
|
1744
1747
|
L === void 0 && (L = "");
|
|
1745
1748
|
var k = L.match(i);
|
|
1746
1749
|
if (!k) return null;
|
|
1747
|
-
var
|
|
1750
|
+
var T = ("" + k[0]).match(s) || ["-", 0, 0], w = T[0], O = 60 * +T[1] + +T[2];
|
|
1748
1751
|
return O === 0 ? 0 : w === "+" ? O : -O;
|
|
1749
|
-
}(
|
|
1750
|
-
var
|
|
1751
|
-
if (x) return
|
|
1752
|
-
if (
|
|
1752
|
+
}(g), g === null)) return this;
|
|
1753
|
+
var S = Math.abs(g) <= 16 ? 60 * g : g, b = this;
|
|
1754
|
+
if (x) return b.$offset = S, b.$u = g === 0, b;
|
|
1755
|
+
if (g !== 0) {
|
|
1753
1756
|
var M = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
1754
|
-
(
|
|
1755
|
-
} else
|
|
1756
|
-
return
|
|
1757
|
+
(b = this.local().add(S + M, e)).$offset = S, b.$x.$localOffset = M;
|
|
1758
|
+
} else b = this.utc();
|
|
1759
|
+
return b;
|
|
1757
1760
|
};
|
|
1758
1761
|
var c = a.format;
|
|
1759
|
-
a.format = function(
|
|
1760
|
-
var x =
|
|
1762
|
+
a.format = function(g) {
|
|
1763
|
+
var x = g || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
1761
1764
|
return c.call(this, x);
|
|
1762
1765
|
}, a.valueOf = function() {
|
|
1763
|
-
var
|
|
1764
|
-
return this.$d.valueOf() - 6e4 *
|
|
1766
|
+
var g = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
1767
|
+
return this.$d.valueOf() - 6e4 * g;
|
|
1765
1768
|
}, a.isUTC = function() {
|
|
1766
1769
|
return !!this.$u;
|
|
1767
1770
|
}, a.toISOString = function() {
|
|
@@ -1769,15 +1772,15 @@ var Mt = { exports: {} };
|
|
|
1769
1772
|
}, a.toString = function() {
|
|
1770
1773
|
return this.toDate().toUTCString();
|
|
1771
1774
|
};
|
|
1772
|
-
var
|
|
1773
|
-
a.toDate = function(
|
|
1774
|
-
return
|
|
1775
|
+
var m = a.toDate;
|
|
1776
|
+
a.toDate = function(g) {
|
|
1777
|
+
return g === "s" && this.$offset ? h(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
|
|
1775
1778
|
};
|
|
1776
|
-
var
|
|
1777
|
-
a.diff = function(
|
|
1778
|
-
if (
|
|
1779
|
-
var
|
|
1780
|
-
return
|
|
1779
|
+
var p = a.diff;
|
|
1780
|
+
a.diff = function(g, x, v) {
|
|
1781
|
+
if (g && this.$u === g.$u) return p.call(this, g, x, v);
|
|
1782
|
+
var S = this.local(), b = h(g).local();
|
|
1783
|
+
return p.call(S, b, x, v);
|
|
1781
1784
|
};
|
|
1782
1785
|
};
|
|
1783
1786
|
});
|
|
@@ -1785,9 +1788,9 @@ var Mt = { exports: {} };
|
|
|
1785
1788
|
var ue = Mt.exports;
|
|
1786
1789
|
const ge = /* @__PURE__ */ Y(ue);
|
|
1787
1790
|
var fe = { exports: {} };
|
|
1788
|
-
(function(
|
|
1791
|
+
(function(f, t) {
|
|
1789
1792
|
(function(e, i) {
|
|
1790
|
-
|
|
1793
|
+
f.exports = i();
|
|
1791
1794
|
})($, function() {
|
|
1792
1795
|
return { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(e) {
|
|
1793
1796
|
var i = ["th", "st", "nd", "rd"], s = e % 100;
|
|
@@ -1796,9 +1799,9 @@ var fe = { exports: {} };
|
|
|
1796
1799
|
});
|
|
1797
1800
|
})(fe);
|
|
1798
1801
|
var me = { exports: {} };
|
|
1799
|
-
(function(
|
|
1802
|
+
(function(f, t) {
|
|
1800
1803
|
(function(e, i) {
|
|
1801
|
-
|
|
1804
|
+
f.exports = i(D);
|
|
1802
1805
|
})($, function(e) {
|
|
1803
1806
|
function i(o) {
|
|
1804
1807
|
return o && typeof o == "object" && "default" in o ? o : { default: o };
|
|
@@ -1812,7 +1815,7 @@ var me = { exports: {} };
|
|
|
1812
1815
|
return s.default.locale(n, null, !0), n;
|
|
1813
1816
|
});
|
|
1814
1817
|
})(me);
|
|
1815
|
-
const pe = (
|
|
1818
|
+
const pe = (f, t) => {
|
|
1816
1819
|
const e = t.prototype;
|
|
1817
1820
|
e.setLocale = function(s) {
|
|
1818
1821
|
return this.$locale = s || D().locale(), this.$L = this.$locale, this;
|
|
@@ -1835,16 +1838,16 @@ D.extend(le);
|
|
|
1835
1838
|
D.extend(de);
|
|
1836
1839
|
D.extend(ge);
|
|
1837
1840
|
D.extend(pe);
|
|
1838
|
-
function dt(
|
|
1841
|
+
function dt(f) {
|
|
1839
1842
|
try {
|
|
1840
|
-
if (D.locale() ===
|
|
1841
|
-
if (D.locale(
|
|
1842
|
-
C.info(`Locale set to ${
|
|
1843
|
+
if (D.locale() === f) return;
|
|
1844
|
+
if (D.locale(f) !== f) throw Error();
|
|
1845
|
+
C.info(`Locale set to ${f}`);
|
|
1843
1846
|
} catch {
|
|
1844
|
-
C.warn(`Failed to set locale ${
|
|
1847
|
+
C.warn(`Failed to set locale ${f}, fallback to en`), D.locale("en");
|
|
1845
1848
|
}
|
|
1846
1849
|
}
|
|
1847
|
-
const
|
|
1850
|
+
const it = () => ({
|
|
1848
1851
|
small: {
|
|
1849
1852
|
hour: 15,
|
|
1850
1853
|
day: 15,
|
|
@@ -1895,7 +1898,7 @@ class xe {
|
|
|
1895
1898
|
r(this, "cellWidth");
|
|
1896
1899
|
/** 用户设定的单位 */
|
|
1897
1900
|
r(this, "unit", "day");
|
|
1898
|
-
this.cellWidth = B(
|
|
1901
|
+
this.cellWidth = B(it().normal);
|
|
1899
1902
|
}
|
|
1900
1903
|
getStartTime() {
|
|
1901
1904
|
return this.startTime;
|
|
@@ -1959,8 +1962,8 @@ class xe {
|
|
|
1959
1962
|
week: i.cellWidth,
|
|
1960
1963
|
month: i.cellWidth,
|
|
1961
1964
|
quarter: i.cellWidth
|
|
1962
|
-
} :
|
|
1963
|
-
|
|
1965
|
+
} : N(i.cellWidth) ? this.cellWidth = B(
|
|
1966
|
+
it()[i.cellWidth] || it().normal
|
|
1964
1967
|
) : gt(i.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, i.cellWidth))), this.headerCellFormat = i.headerCellFormat, this.headerGroupFormat = i.headerGroupFormat;
|
|
1965
1968
|
}
|
|
1966
1969
|
update(t) {
|
|
@@ -2039,7 +2042,7 @@ class xe {
|
|
|
2039
2042
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2040
2043
|
if (i) return i;
|
|
2041
2044
|
}
|
|
2042
|
-
if (
|
|
2045
|
+
if (N(this.headerGroupFormat))
|
|
2043
2046
|
return t.format(this.headerGroupFormat);
|
|
2044
2047
|
switch (this.getGroupUnit()) {
|
|
2045
2048
|
case "month":
|
|
@@ -2059,7 +2062,7 @@ class xe {
|
|
|
2059
2062
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2060
2063
|
if (i) return i;
|
|
2061
2064
|
}
|
|
2062
|
-
if (
|
|
2065
|
+
if (N(this.headerCellFormat))
|
|
2063
2066
|
return t.format(this.headerCellFormat);
|
|
2064
2067
|
switch (this.getChildUnit()) {
|
|
2065
2068
|
case "hour":
|
|
@@ -2104,9 +2107,9 @@ class ye {
|
|
|
2104
2107
|
r(this, "timeAxis");
|
|
2105
2108
|
this.context = t;
|
|
2106
2109
|
const i = rt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2107
|
-
if (s && !
|
|
2110
|
+
if (s && !F(s))
|
|
2108
2111
|
throw C.exception("Data should be a array.");
|
|
2109
|
-
this.optionManager = new Wt(), this.optionManager.setOptions(i), i.locale && dt(i.locale), this.timeAxis = new xe(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new
|
|
2112
|
+
this.optionManager = new Wt(), this.optionManager.setOptions(i), i.locale && dt(i.locale), this.timeAxis = new xe(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new Ft(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new Gt(this, this.context.event), s && this.dataManager.setData(s, !0);
|
|
2110
2113
|
}
|
|
2111
2114
|
getOptionManager() {
|
|
2112
2115
|
return this.optionManager;
|
|
@@ -2122,7 +2125,7 @@ class ye {
|
|
|
2122
2125
|
}
|
|
2123
2126
|
setOption(t, e = { merge: !0 }) {
|
|
2124
2127
|
const i = rt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
2125
|
-
|
|
2128
|
+
F(s) && this.dataManager.setData(s, !1), this.optionManager.setOptions(i, e), i.locale && dt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
2126
2129
|
}
|
|
2127
2130
|
updateTime(t, e) {
|
|
2128
2131
|
this.timeAxis.setDate(t, e);
|
|
@@ -2216,19 +2219,19 @@ class we {
|
|
|
2216
2219
|
r(this, "animationStep", (t) => {
|
|
2217
2220
|
if (!this.isAnimating) return;
|
|
2218
2221
|
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, h = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * n, a = this.scrollLeft !== o, d = this.scrollTop !== h;
|
|
2219
|
-
(a || d) && (this.scrollLeft = o, this.scrollTop = h, this.updateThumbStyles(), this.root.event.emit(
|
|
2222
|
+
(a || d) && (this.scrollLeft = o, this.scrollTop = h, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2220
2223
|
// 触发滚动事件
|
|
2221
2224
|
x: this.scrollLeft,
|
|
2222
2225
|
y: this.scrollTop,
|
|
2223
2226
|
source: this.animationSource
|
|
2224
2227
|
// 使用动画触发源
|
|
2225
|
-
})), s < 1 ? this.animationFrameId = requestAnimationFrame(this.animationStep) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && (this.scrollLeft = this.animationTargetScrollLeft, this.scrollTop = this.animationTargetScrollTop, this.updateThumbStyles(), this.root.event.emit(
|
|
2228
|
+
})), s < 1 ? this.animationFrameId = requestAnimationFrame(this.animationStep) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && (this.scrollLeft = this.animationTargetScrollLeft, this.scrollTop = this.animationTargetScrollTop, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2226
2229
|
x: this.scrollLeft,
|
|
2227
2230
|
y: this.scrollTop,
|
|
2228
2231
|
source: this.animationSource
|
|
2229
2232
|
})), this.scheduleHide());
|
|
2230
2233
|
});
|
|
2231
|
-
this.root = t, this.rootElement = e, this.options =
|
|
2234
|
+
this.root = t, this.rootElement = e, this.options = q(
|
|
2232
2235
|
{
|
|
2233
2236
|
showHorizontal: !0,
|
|
2234
2237
|
showVertical: !0,
|
|
@@ -2378,7 +2381,7 @@ class we {
|
|
|
2378
2381
|
let s = t.deltaX, n = t.deltaY;
|
|
2379
2382
|
Math.abs(t.deltaX) < Math.abs(t.deltaY) && t.shiftKey && e && (s = n, n = 0);
|
|
2380
2383
|
const o = this.scrollLeft + s, h = this.scrollTop + n;
|
|
2381
|
-
this.scrollLeft = o, this.scrollTop = h, this.updateThumbStyles(), this.root.event.emit(
|
|
2384
|
+
this.scrollLeft = o, this.scrollTop = h, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2382
2385
|
x: this.scrollLeft,
|
|
2383
2386
|
y: this.scrollTop,
|
|
2384
2387
|
source: "wheel"
|
|
@@ -2396,12 +2399,12 @@ class we {
|
|
|
2396
2399
|
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";
|
|
2397
2400
|
const s = 150, n = (o) => {
|
|
2398
2401
|
if (!this.isAnimating) return;
|
|
2399
|
-
const h = o - this.animationStartTime, a = Math.min(1, h / s), d = a * (2 - a), u = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * d, l = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * d, c = this.scrollLeft !== u,
|
|
2400
|
-
(c ||
|
|
2402
|
+
const h = o - this.animationStartTime, a = Math.min(1, h / s), d = a * (2 - a), u = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * d, l = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * d, c = this.scrollLeft !== u, m = this.scrollTop !== l;
|
|
2403
|
+
(c || m) && (this.scrollLeft = u, this.scrollTop = l, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2401
2404
|
x: this.scrollLeft,
|
|
2402
2405
|
y: this.scrollTop,
|
|
2403
2406
|
source: "wheel"
|
|
2404
|
-
})), a < 1 ? this.animationFrameId = requestAnimationFrame(n) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && (this.scrollLeft = this.animationTargetScrollLeft, this.scrollTop = this.animationTargetScrollTop, this.updateThumbStyles(), this.root.event.emit(
|
|
2407
|
+
})), a < 1 ? this.animationFrameId = requestAnimationFrame(n) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && (this.scrollLeft = this.animationTargetScrollLeft, this.scrollTop = this.animationTargetScrollTop, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2405
2408
|
x: this.scrollLeft,
|
|
2406
2409
|
y: this.scrollTop,
|
|
2407
2410
|
source: "wheel"
|
|
@@ -2469,7 +2472,7 @@ class we {
|
|
|
2469
2472
|
x: this.scrollLeft,
|
|
2470
2473
|
y: this.scrollTop
|
|
2471
2474
|
});
|
|
2472
|
-
(d.x !== this.scrollLeft || d.y !== this.scrollTop) && (this.scrollLeft = d.x, this.scrollTop = d.y, this.updateThumbStyles(), this.root.event.emit(
|
|
2475
|
+
(d.x !== this.scrollLeft || d.y !== this.scrollTop) && (this.scrollLeft = d.x, this.scrollTop = d.y, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2473
2476
|
// 触发一次校准事件
|
|
2474
2477
|
x: this.scrollLeft,
|
|
2475
2478
|
y: this.scrollTop,
|
|
@@ -2527,7 +2530,7 @@ class we {
|
|
|
2527
2530
|
*/
|
|
2528
2531
|
scrollTo(t, e = "api") {
|
|
2529
2532
|
this.scheduleShow();
|
|
2530
|
-
const i = this.clampScroll(
|
|
2533
|
+
const i = this.clampScroll(q(this.getScrollPosition(), t));
|
|
2531
2534
|
if (this.scrollLeft === i.x && this.scrollTop === i.y) {
|
|
2532
2535
|
if (this.isAnimating && this.animationTargetScrollLeft === i.x && this.animationTargetScrollTop === i.y)
|
|
2533
2536
|
return;
|
|
@@ -2540,7 +2543,7 @@ class we {
|
|
|
2540
2543
|
else {
|
|
2541
2544
|
this.isAnimating = !1;
|
|
2542
2545
|
const n = this.scrollLeft !== i.x, o = this.scrollTop !== i.y;
|
|
2543
|
-
(n || o) && (this.scrollLeft = i.x, this.scrollTop = i.y, this.updateThumbStyles(), this.root.event.emit(
|
|
2546
|
+
(n || o) && (this.scrollLeft = i.x, this.scrollTop = i.y, this.updateThumbStyles(), this.root.event.emit(y.SCROLL, {
|
|
2544
2547
|
// 触发滚动事件
|
|
2545
2548
|
x: this.scrollLeft,
|
|
2546
2549
|
y: this.scrollTop,
|
|
@@ -2562,14 +2565,14 @@ class we {
|
|
|
2562
2565
|
this.unbindEvents(), this.clearTimeouts(), this.cancelAnimation(), this.scrollbarContainer.parentNode && this.scrollbarContainer.parentNode.removeChild(this.scrollbarContainer), this.rootElement = null, this.eventManager = null, this.hScrollbar = null, this.vScrollbar = null, this.hScrollThumb = null, this.vScrollThumb = null, this.scrollbarContainer = null, C.debug("Scrollbar destroyed");
|
|
2563
2566
|
}
|
|
2564
2567
|
}
|
|
2565
|
-
function X(
|
|
2568
|
+
function X(f, t = "") {
|
|
2566
2569
|
const e = ["px", "%", "vh", "vw", "rem", "em"];
|
|
2567
|
-
if (
|
|
2570
|
+
if (f == null)
|
|
2568
2571
|
return t;
|
|
2569
|
-
if (typeof
|
|
2570
|
-
return isFinite(
|
|
2571
|
-
if (typeof
|
|
2572
|
-
const i =
|
|
2572
|
+
if (typeof f == "number")
|
|
2573
|
+
return isFinite(f) ? `${f}px` : t;
|
|
2574
|
+
if (typeof f == "string") {
|
|
2575
|
+
const i = f.trim();
|
|
2573
2576
|
if (i === "")
|
|
2574
2577
|
return t;
|
|
2575
2578
|
for (const n of e)
|
|
@@ -2585,7 +2588,7 @@ function X(g, t = "") {
|
|
|
2585
2588
|
}
|
|
2586
2589
|
return t;
|
|
2587
2590
|
}
|
|
2588
|
-
class
|
|
2591
|
+
class Q {
|
|
2589
2592
|
/**
|
|
2590
2593
|
* 创建表格单元格
|
|
2591
2594
|
* @param container 父容器(tr元素)
|
|
@@ -2690,28 +2693,28 @@ class ut {
|
|
|
2690
2693
|
*/
|
|
2691
2694
|
bindEvents() {
|
|
2692
2695
|
this.element.addEventListener("mouseenter", () => {
|
|
2693
|
-
this.context.event.emit(
|
|
2696
|
+
this.context.event.emit(y.ROW_HIGHLIGHT, this.task.id);
|
|
2694
2697
|
}), this.element.addEventListener("mouseleave", () => {
|
|
2695
|
-
this.context.event.emit(
|
|
2698
|
+
this.context.event.emit(y.ROW_UNHIGHLIGHT, this.task.id);
|
|
2696
2699
|
}), this.element.addEventListener("click", (t) => {
|
|
2697
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
2700
|
+
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(y.ROW_CLICK, t, this.task));
|
|
2698
2701
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
2699
|
-
this.context.event.emit(
|
|
2702
|
+
this.context.event.emit(y.ROW_DBL_CLICK, t, this.task);
|
|
2700
2703
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
2701
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
2704
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(y.ROW_CONTEXTMENU, t, this.task.id);
|
|
2702
2705
|
});
|
|
2703
2706
|
}
|
|
2704
2707
|
/**
|
|
2705
2708
|
* 注册全局接收事件
|
|
2706
2709
|
*/
|
|
2707
2710
|
registerEvents() {
|
|
2708
|
-
this.context.event.on(
|
|
2711
|
+
this.context.event.on(y.ROW_HIGHLIGHT, (t) => {
|
|
2709
2712
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
2710
|
-
}), this.context.event.on(
|
|
2713
|
+
}), this.context.event.on(y.ROW_UNHIGHLIGHT, (t) => {
|
|
2711
2714
|
this.task.id === t && this.element.classList.remove("hover");
|
|
2712
|
-
}), this.context.event.on(
|
|
2715
|
+
}), this.context.event.on(y.TASK_SELECTED, (t) => {
|
|
2713
2716
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
2714
|
-
}), this.context.event.on(
|
|
2717
|
+
}), this.context.event.on(y.TASK_UNSELECTED, (t) => {
|
|
2715
2718
|
this.task.id === t && this.element.classList.remove("selected");
|
|
2716
2719
|
});
|
|
2717
2720
|
}
|
|
@@ -2743,7 +2746,7 @@ class ut {
|
|
|
2743
2746
|
this.clearCells();
|
|
2744
2747
|
const t = this.context.store.getColumnManager().getHandlerColumn();
|
|
2745
2748
|
if (t.width !== 0) {
|
|
2746
|
-
const n = new
|
|
2749
|
+
const n = new Q(
|
|
2747
2750
|
this.context,
|
|
2748
2751
|
this.element,
|
|
2749
2752
|
t,
|
|
@@ -2759,9 +2762,9 @@ class ut {
|
|
|
2759
2762
|
const e = this.context.store.getColumnManager().getLeafColumns();
|
|
2760
2763
|
for (let n = 0; n < e.length; n++) {
|
|
2761
2764
|
const o = e[n], h = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
2762
|
-
if (h)
|
|
2765
|
+
if (h)
|
|
2763
2766
|
if (h.task.id !== this.task.id) {
|
|
2764
|
-
const a = new
|
|
2767
|
+
const a = new Q(
|
|
2765
2768
|
this.context,
|
|
2766
2769
|
this.element,
|
|
2767
2770
|
o,
|
|
@@ -2773,22 +2776,34 @@ class ut {
|
|
|
2773
2776
|
"empty"
|
|
2774
2777
|
);
|
|
2775
2778
|
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(a);
|
|
2779
|
+
} else {
|
|
2780
|
+
const a = new Q(
|
|
2781
|
+
this.context,
|
|
2782
|
+
this.element,
|
|
2783
|
+
o,
|
|
2784
|
+
h.task,
|
|
2785
|
+
h.task.flatIndex,
|
|
2786
|
+
n,
|
|
2787
|
+
h.colspan,
|
|
2788
|
+
h.rowspan
|
|
2789
|
+
);
|
|
2790
|
+
this.cells.push(a);
|
|
2776
2791
|
}
|
|
2777
|
-
|
|
2792
|
+
else {
|
|
2778
2793
|
let a = 1, d = 1;
|
|
2779
2794
|
const u = (s = (i = o.column).merge) == null ? void 0 : s.call(
|
|
2780
2795
|
i,
|
|
2781
2796
|
this.task.getField(o.column.field),
|
|
2782
2797
|
this.task.data,
|
|
2783
2798
|
n,
|
|
2784
|
-
this.task.level
|
|
2799
|
+
this.task.level + 1
|
|
2785
2800
|
);
|
|
2786
2801
|
if (u && (typeof u.col != "number" ? C.error("colspan function must returned a number") : a = u.col, typeof u.row != "number" ? C.error("rowspan function must returned a number") : d = u.row), a > 1 || d > 1) {
|
|
2787
2802
|
if (d > 1)
|
|
2788
|
-
for (let
|
|
2789
|
-
const
|
|
2790
|
-
if (
|
|
2791
|
-
d =
|
|
2803
|
+
for (let p = 1; p < d; p++) {
|
|
2804
|
+
const g = this.context.store.getDataManager().getVisibleTasks()[this.task.flatIndex + p];
|
|
2805
|
+
if (g && this.task.level !== g.level) {
|
|
2806
|
+
d = p;
|
|
2792
2807
|
break;
|
|
2793
2808
|
}
|
|
2794
2809
|
}
|
|
@@ -2798,17 +2813,17 @@ class ut {
|
|
|
2798
2813
|
colspan: a,
|
|
2799
2814
|
rowspan: d
|
|
2800
2815
|
};
|
|
2801
|
-
let
|
|
2802
|
-
for (let
|
|
2803
|
-
if (
|
|
2804
|
-
for (let
|
|
2805
|
-
this.context.store.getColumnManager().addMergeInfo(
|
|
2806
|
-
|
|
2816
|
+
let m = this.task;
|
|
2817
|
+
for (let p = d; p > 0; p--)
|
|
2818
|
+
if (m) {
|
|
2819
|
+
for (let g = 0; g < a; g++)
|
|
2820
|
+
this.context.store.getColumnManager().addMergeInfo(m.id, g + n, c);
|
|
2821
|
+
m = this.context.store.getDataManager().getVisibleTasks().at(m.flatIndex + 1);
|
|
2807
2822
|
}
|
|
2808
|
-
for (let
|
|
2809
|
-
this.context.store.getColumnManager().addMergeInfo(this.task.id,
|
|
2823
|
+
for (let p = 0; p < a; p++)
|
|
2824
|
+
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, c);
|
|
2810
2825
|
}
|
|
2811
|
-
const l = new
|
|
2826
|
+
const l = new Q(
|
|
2812
2827
|
this.context,
|
|
2813
2828
|
this.element,
|
|
2814
2829
|
o,
|
|
@@ -2826,8 +2841,8 @@ class ut {
|
|
|
2826
2841
|
/**
|
|
2827
2842
|
* 更新行
|
|
2828
2843
|
*/
|
|
2829
|
-
update() {
|
|
2830
|
-
this.create();
|
|
2844
|
+
update(t) {
|
|
2845
|
+
this.task = t, this.create();
|
|
2831
2846
|
}
|
|
2832
2847
|
/**
|
|
2833
2848
|
* 更新宽度
|
|
@@ -2872,7 +2887,7 @@ class be {
|
|
|
2872
2887
|
const h = n.id;
|
|
2873
2888
|
if (this.rows.has(h)) {
|
|
2874
2889
|
const a = this.rows.get(h);
|
|
2875
|
-
a.update(), a.updateTop(t);
|
|
2890
|
+
a.update(n), a.updateTop(t);
|
|
2876
2891
|
} else {
|
|
2877
2892
|
const a = new ut(this.context, this.element, n, t);
|
|
2878
2893
|
a.create(), this.rows.set(h, a);
|
|
@@ -2907,12 +2922,12 @@ class be {
|
|
|
2907
2922
|
* 更新任务
|
|
2908
2923
|
*/
|
|
2909
2924
|
updateTask(t) {
|
|
2910
|
-
this.rows.has(t.id) && this.rows.get(t.id).update();
|
|
2925
|
+
this.rows.has(t.id) && this.rows.get(t.id).update(t);
|
|
2911
2926
|
}
|
|
2912
2927
|
/** 更新全部行 */
|
|
2913
2928
|
update() {
|
|
2914
2929
|
this.rows.forEach((t) => {
|
|
2915
|
-
t.
|
|
2930
|
+
t.create();
|
|
2916
2931
|
});
|
|
2917
2932
|
}
|
|
2918
2933
|
/**
|
|
@@ -2970,16 +2985,16 @@ class st {
|
|
|
2970
2985
|
const o = (d) => {
|
|
2971
2986
|
d.preventDefault(), d.stopPropagation(), e = d.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
2972
2987
|
const u = (c) => h(c), l = (c) => a(c, u, l);
|
|
2973
|
-
document.addEventListener("mousemove", u), document.addEventListener("mouseup", l), n = e - s.left, this.context.event.emit(
|
|
2988
|
+
document.addEventListener("mousemove", u), document.addEventListener("mouseup", l), n = e - s.left, this.context.event.emit(y.SHOW_GUIDELINE, n);
|
|
2974
2989
|
}, h = (d) => {
|
|
2975
2990
|
if (d.preventDefault(), !s) return;
|
|
2976
|
-
const u = d.clientX - e, l = i + u, c = Math.max(50, l),
|
|
2977
|
-
let x =
|
|
2978
|
-
x = Math.min(
|
|
2991
|
+
const u = d.clientX - e, l = i + u, c = Math.max(50, l), m = e - s.left - i, g = this.root.clientWidth - 20;
|
|
2992
|
+
let x = m + c;
|
|
2993
|
+
x = Math.min(g, x), this.context.event.emit(y.MOVE_GUIDELINE, x);
|
|
2979
2994
|
}, a = (d, u, l) => {
|
|
2980
|
-
document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", l), this.context.event.emit(
|
|
2981
|
-
const c = d.clientX - e,
|
|
2982
|
-
this.setWidth(
|
|
2995
|
+
document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", l), this.context.event.emit(y.HIDE_GUIDELINE);
|
|
2996
|
+
const c = d.clientX - e, m = Math.max(50, i + c);
|
|
2997
|
+
this.setWidth(m);
|
|
2983
2998
|
};
|
|
2984
2999
|
t.addEventListener("mousedown", o);
|
|
2985
3000
|
}
|
|
@@ -3028,7 +3043,7 @@ class ot {
|
|
|
3028
3043
|
});
|
|
3029
3044
|
}
|
|
3030
3045
|
}
|
|
3031
|
-
class
|
|
3046
|
+
class ve {
|
|
3032
3047
|
constructor(t, e) {
|
|
3033
3048
|
r(this, "headerElement");
|
|
3034
3049
|
r(this, "headerColumns", []);
|
|
@@ -3088,18 +3103,18 @@ class Te {
|
|
|
3088
3103
|
});
|
|
3089
3104
|
}
|
|
3090
3105
|
}
|
|
3091
|
-
class
|
|
3106
|
+
class Te {
|
|
3092
3107
|
constructor(t, e) {
|
|
3093
3108
|
r(this, "tableContainer");
|
|
3094
3109
|
r(this, "tableHeader");
|
|
3095
3110
|
r(this, "tableBody");
|
|
3096
|
-
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
|
|
3111
|
+
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 ve(t, this.tableContainer), this.tableBody = new be(t, this.tableContainer), this.listenEvents();
|
|
3097
3112
|
}
|
|
3098
3113
|
render(t, e) {
|
|
3099
|
-
this.tableHeader.render(), this.
|
|
3114
|
+
this.tableHeader.render(), this.refresh(t, e);
|
|
3100
3115
|
}
|
|
3101
3116
|
refresh(t, e) {
|
|
3102
|
-
this.tableBody.render(t, e);
|
|
3117
|
+
this.context.store.getColumnManager().clearMergeInfo(), this.tableBody.render(t, e);
|
|
3103
3118
|
}
|
|
3104
3119
|
updateWidth() {
|
|
3105
3120
|
this.tableBody.updateWidth();
|
|
@@ -3108,9 +3123,9 @@ class ve {
|
|
|
3108
3123
|
this.tableBody.updateTask(t);
|
|
3109
3124
|
}
|
|
3110
3125
|
listenEvents() {
|
|
3111
|
-
this.context.event.on(
|
|
3126
|
+
this.context.event.on(y.UPDATE_TABLE_HEADER, () => {
|
|
3112
3127
|
this.tableHeader.render();
|
|
3113
|
-
}), this.context.event.on(
|
|
3128
|
+
}), this.context.event.on(y.UPDATE_TABLE_BODY, () => {
|
|
3114
3129
|
this.tableBody.update();
|
|
3115
3130
|
});
|
|
3116
3131
|
}
|
|
@@ -3129,10 +3144,10 @@ class Se {
|
|
|
3129
3144
|
r(this, "width", 0);
|
|
3130
3145
|
r(this, "height", 0);
|
|
3131
3146
|
r(this, "offsetX", 0);
|
|
3132
|
-
this.context = t, this.stage = e, this.layer = new
|
|
3147
|
+
this.context = t, this.stage = e, this.layer = new E.Layer(), this.stage.add(this.layer), this.background = new E.Rect({
|
|
3133
3148
|
fill: this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor,
|
|
3134
3149
|
name: "header-background"
|
|
3135
|
-
}), this.layer.add(this.background), this.groupHeader = new
|
|
3150
|
+
}), this.layer.add(this.background), this.groupHeader = new E.Group({ name: "primary-header" }), this.cellHeader = new E.Group({ name: "secondary-header" }), this.layer.add(this.groupHeader), this.layer.add(this.cellHeader), this.resize(this.stage.width()), this.registerEvents();
|
|
3136
3151
|
}
|
|
3137
3152
|
/**
|
|
3138
3153
|
* 调整表头大小
|
|
@@ -3151,11 +3166,11 @@ class Se {
|
|
|
3151
3166
|
* 注册事件监听
|
|
3152
3167
|
*/
|
|
3153
3168
|
registerEvents() {
|
|
3154
|
-
this.context.event.on(
|
|
3169
|
+
this.context.event.on(y.ROW_HIGHLIGHT, (t) => {
|
|
3155
3170
|
this.highlightDate(t);
|
|
3156
|
-
}), this.context.event.on(
|
|
3171
|
+
}), this.context.event.on(y.ROW_UNHIGHLIGHT, (t) => {
|
|
3157
3172
|
this.unhighlightDate(t);
|
|
3158
|
-
}), this.context.event.on(
|
|
3173
|
+
}), this.context.event.on(y.UPDATE_TASK, (t) => {
|
|
3159
3174
|
this.highlightDate(t.id);
|
|
3160
3175
|
});
|
|
3161
3176
|
}
|
|
@@ -3173,13 +3188,13 @@ class Se {
|
|
|
3173
3188
|
this.clearHeader();
|
|
3174
3189
|
const t = this.context.store.getTimeAxis(), e = t.getCellWidth(), i = Math.max(0, -this.offsetX), s = i + this.width, n = Math.floor(this.height / 2), o = this.context.getOptions().border.color;
|
|
3175
3190
|
this.layer.add(
|
|
3176
|
-
new
|
|
3191
|
+
new E.Line({
|
|
3177
3192
|
points: [0, n, this.width, n],
|
|
3178
3193
|
stroke: o,
|
|
3179
3194
|
strokeWidth: 1
|
|
3180
3195
|
})
|
|
3181
3196
|
), this.layer.add(
|
|
3182
|
-
new
|
|
3197
|
+
new E.Line({
|
|
3183
3198
|
points: [0, this.height, this.width, this.height],
|
|
3184
3199
|
stroke: o,
|
|
3185
3200
|
strokeWidth: 1
|
|
@@ -3195,7 +3210,7 @@ class Se {
|
|
|
3195
3210
|
}
|
|
3196
3211
|
if (a > s)
|
|
3197
3212
|
break;
|
|
3198
|
-
const
|
|
3213
|
+
const p = this.createCell(
|
|
3199
3214
|
`group-${l.date.format("YYYY-MM-DD")}`,
|
|
3200
3215
|
a,
|
|
3201
3216
|
0,
|
|
@@ -3204,36 +3219,36 @@ class Se {
|
|
|
3204
3219
|
o,
|
|
3205
3220
|
l.label
|
|
3206
3221
|
);
|
|
3207
|
-
if (this.groupHeader.add(
|
|
3208
|
-
let
|
|
3222
|
+
if (this.groupHeader.add(p), F(l.children) && l.children.length > 0) {
|
|
3223
|
+
let g = a;
|
|
3209
3224
|
for (let x = 0; x < l.children.length; ) {
|
|
3210
|
-
const
|
|
3211
|
-
let
|
|
3212
|
-
for (; l.children[x +
|
|
3213
|
-
|
|
3214
|
-
if (x +=
|
|
3225
|
+
const v = l.children[x];
|
|
3226
|
+
let S = 1;
|
|
3227
|
+
for (; l.children[x + S] && v.label === l.children[x + S].label; )
|
|
3228
|
+
S++;
|
|
3229
|
+
if (x += S, x >= l.children.length && h[u + 1] && h[u + 1].children) {
|
|
3215
3230
|
let k = 0;
|
|
3216
|
-
for (; h[u + 1].children[k] &&
|
|
3231
|
+
for (; h[u + 1].children[k] && v.label === h[u + 1].children[k].label; )
|
|
3217
3232
|
h[u + 1].children[k].hide = !0, k++;
|
|
3218
|
-
k > 0 && (
|
|
3233
|
+
k > 0 && (S += k);
|
|
3219
3234
|
}
|
|
3220
|
-
const
|
|
3221
|
-
if (
|
|
3222
|
-
|
|
3235
|
+
const b = e * S;
|
|
3236
|
+
if (g + b < i) {
|
|
3237
|
+
g += b;
|
|
3223
3238
|
continue;
|
|
3224
3239
|
}
|
|
3225
|
-
if (
|
|
3240
|
+
if (g > s)
|
|
3226
3241
|
break;
|
|
3227
3242
|
const L = this.createCell(
|
|
3228
|
-
`cell-${
|
|
3229
|
-
|
|
3243
|
+
`cell-${v.date.format("YYYY-MM-DD")}`,
|
|
3244
|
+
g,
|
|
3230
3245
|
n,
|
|
3231
|
-
|
|
3246
|
+
b,
|
|
3232
3247
|
n,
|
|
3233
|
-
|
|
3234
|
-
|
|
3248
|
+
v.hide ? "transparent" : o,
|
|
3249
|
+
v.hide ? "" : v.label
|
|
3235
3250
|
);
|
|
3236
|
-
this.cellHeader.add(L),
|
|
3251
|
+
this.cellHeader.add(L), v.hide && L.visible(!1), g += b;
|
|
3237
3252
|
}
|
|
3238
3253
|
}
|
|
3239
3254
|
a += c;
|
|
@@ -3241,9 +3256,9 @@ class Se {
|
|
|
3241
3256
|
this.layer.batchDraw();
|
|
3242
3257
|
}
|
|
3243
3258
|
createCell(t, e, i, s, n, o, h) {
|
|
3244
|
-
const a = new
|
|
3259
|
+
const a = new E.Group();
|
|
3245
3260
|
a.x(e), a.y(i);
|
|
3246
|
-
const d = new
|
|
3261
|
+
const d = new E.Rect({
|
|
3247
3262
|
id: t,
|
|
3248
3263
|
x: 0,
|
|
3249
3264
|
y: 0,
|
|
@@ -3255,14 +3270,14 @@ class Se {
|
|
|
3255
3270
|
a.add(d);
|
|
3256
3271
|
let u = this.context.getOptions().header.fontSize;
|
|
3257
3272
|
t.startsWith("cell-") && (this.cellCache.set(t, d), u -= 2);
|
|
3258
|
-
const l = new
|
|
3273
|
+
const l = new E.Line({
|
|
3259
3274
|
points: [s, 0, s, n],
|
|
3260
3275
|
stroke: o,
|
|
3261
3276
|
strokeWidth: 1,
|
|
3262
3277
|
name: "header-cell-right-border"
|
|
3263
3278
|
});
|
|
3264
3279
|
a.add(l);
|
|
3265
|
-
const c = new
|
|
3280
|
+
const c = new E.Text({
|
|
3266
3281
|
x: 0,
|
|
3267
3282
|
y: 0,
|
|
3268
3283
|
width: s,
|
|
@@ -3316,16 +3331,16 @@ class Se {
|
|
|
3316
3331
|
`cell-${(h = e == null ? void 0 : e.endTime) == null ? void 0 : h.format("YYYY-MM-DD")}`
|
|
3317
3332
|
), n = this.context.getOptions().header.backgroundColor || this.context.getOptions().primaryColor;
|
|
3318
3333
|
n && (this.cellCache.forEach((a) => {
|
|
3319
|
-
new
|
|
3334
|
+
new E.Tween({
|
|
3320
3335
|
node: a,
|
|
3321
3336
|
fill: n,
|
|
3322
3337
|
duration: 0.02
|
|
3323
3338
|
}).play();
|
|
3324
|
-
}), t === "in" && (i && new
|
|
3339
|
+
}), t === "in" && (i && new E.Tween({
|
|
3325
3340
|
node: i,
|
|
3326
3341
|
fill: R(n).brighten(30).toHex(),
|
|
3327
3342
|
duration: 0.02
|
|
3328
|
-
}).play(), s && new
|
|
3343
|
+
}).play(), s && new E.Tween({
|
|
3329
3344
|
node: s,
|
|
3330
3345
|
fill: R(n).brighten(30).toHex(),
|
|
3331
3346
|
duration: 0
|
|
@@ -3342,7 +3357,7 @@ class Ee {
|
|
|
3342
3357
|
r(this, "height", 0);
|
|
3343
3358
|
r(this, "offsetX", 0);
|
|
3344
3359
|
r(this, "offsetY", 0);
|
|
3345
|
-
this.context = t, this.layer = e, this.verticalLines = new
|
|
3360
|
+
this.context = t, this.layer = e, this.verticalLines = new E.Group({ name: "vertical-grid-lines" }), this.horizontalLines = new E.Group({ name: "horizontal-grid-lines" }), this.layer.add(this.verticalLines), this.layer.add(this.horizontalLines);
|
|
3346
3361
|
}
|
|
3347
3362
|
/**
|
|
3348
3363
|
* 调整网格大小
|
|
@@ -3388,22 +3403,22 @@ class Ee {
|
|
|
3388
3403
|
);
|
|
3389
3404
|
if (this.context.getOptions().border.show && ["day", "hour"].includes(this.context.getOptions().unit))
|
|
3390
3405
|
for (let l = h; l <= a; l++) {
|
|
3391
|
-
const c = l * i,
|
|
3406
|
+
const c = l * i, m = new E.Line({
|
|
3392
3407
|
points: [c, t, c, o + t],
|
|
3393
3408
|
stroke: this.context.getOptions().border.color,
|
|
3394
3409
|
strokeWidth: 0.5,
|
|
3395
3410
|
name: "vertical-grid-line"
|
|
3396
3411
|
});
|
|
3397
|
-
this.verticalLines.add(
|
|
3412
|
+
this.verticalLines.add(m);
|
|
3398
3413
|
}
|
|
3399
3414
|
for (let l = d; l <= u; l++) {
|
|
3400
|
-
const c = l * s + t,
|
|
3415
|
+
const c = l * s + t, m = new E.Line({
|
|
3401
3416
|
points: [0, c, Math.max(this.width, e), c],
|
|
3402
3417
|
stroke: this.context.getOptions().border.color,
|
|
3403
3418
|
strokeWidth: 0.5,
|
|
3404
3419
|
name: "horizontal-grid-line"
|
|
3405
3420
|
});
|
|
3406
|
-
this.horizontalLines.add(
|
|
3421
|
+
this.horizontalLines.add(m);
|
|
3407
3422
|
}
|
|
3408
3423
|
}
|
|
3409
3424
|
/**
|
|
@@ -3413,7 +3428,7 @@ class Ee {
|
|
|
3413
3428
|
this.verticalLines.destroyChildren(), this.horizontalLines.destroyChildren();
|
|
3414
3429
|
}
|
|
3415
3430
|
}
|
|
3416
|
-
class
|
|
3431
|
+
class Le {
|
|
3417
3432
|
constructor(t, e, i, s, n) {
|
|
3418
3433
|
r(this, "offsetX", 0);
|
|
3419
3434
|
r(this, "offsetY", 0);
|
|
@@ -3441,7 +3456,7 @@ class ke {
|
|
|
3441
3456
|
r(this, "draggingDirection", "none");
|
|
3442
3457
|
// 记录拖拽时的原始数据
|
|
3443
3458
|
r(this, "oldTasks", []);
|
|
3444
|
-
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new
|
|
3459
|
+
this.context = t, this.x = e, this.y = i, this.task = s, this.rowWidth = n, this.sliderGroup = new E.Group({
|
|
3445
3460
|
x: e,
|
|
3446
3461
|
y: i,
|
|
3447
3462
|
id: `chart-slider-bar-${s.id}`
|
|
@@ -3464,17 +3479,17 @@ class ke {
|
|
|
3464
3479
|
})), this.renderProgress(o, e), this.renderText(o, e);
|
|
3465
3480
|
}
|
|
3466
3481
|
render() {
|
|
3467
|
-
var x,
|
|
3482
|
+
var x, v, S, b, M;
|
|
3468
3483
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
3469
3484
|
const t = this.context.getOptions().row.height, e = at(
|
|
3470
3485
|
this.context.getOptions().bar.height,
|
|
3471
3486
|
t
|
|
3472
|
-
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, h = this.context.getOptions().bar.backgroundColor || this.context.getOptions().primaryColor, a =
|
|
3487
|
+
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, h = this.context.getOptions().bar.backgroundColor || this.context.getOptions().primaryColor, a = et(
|
|
3473
3488
|
this.context.getOptions().bar.radius
|
|
3474
3489
|
);
|
|
3475
|
-
this.slider || (this.slider = new
|
|
3490
|
+
this.slider || (this.slider = new E.Group({
|
|
3476
3491
|
dragBoundFunc: (L) => {
|
|
3477
|
-
let k = 0,
|
|
3492
|
+
let k = 0, T = Math.abs(this.rowWidth - this.slider.width());
|
|
3478
3493
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
3479
3494
|
if (this.task.parent.startTime) {
|
|
3480
3495
|
const O = this.task.parent.startTime;
|
|
@@ -3482,18 +3497,22 @@ class ke {
|
|
|
3482
3497
|
}
|
|
3483
3498
|
if (this.task.parent.endTime) {
|
|
3484
3499
|
const O = this.task.parent.endTime, _ = this.context.store.getTimeAxis().getTimeLeft(O);
|
|
3485
|
-
|
|
3500
|
+
T = Math.abs(_ - this.slider.width());
|
|
3486
3501
|
}
|
|
3487
3502
|
}
|
|
3488
3503
|
return {
|
|
3489
|
-
x: H(L.x, k,
|
|
3504
|
+
x: H(L.x, k, T),
|
|
3490
3505
|
y: this.y + i + this.offsetY
|
|
3491
3506
|
};
|
|
3492
3507
|
}
|
|
3493
3508
|
})), this.slider.position({ x: s, y: i }), this.slider.size({ width: o, height: e });
|
|
3494
3509
|
const d = this.context.getOptions().bar.move.enabled;
|
|
3495
3510
|
let u = !1;
|
|
3496
|
-
V(d) ? u = d : z(d) && (u = d(this.task.getEmitData())), this.slider.draggable(u),
|
|
3511
|
+
V(d) ? u = d : z(d) && (u = d(this.task.getEmitData())), this.slider.draggable(u), u && (this.slider.on("pointerover", (L) => {
|
|
3512
|
+
this.isDragging || (L.target.getStage().container().style.cursor = "grab");
|
|
3513
|
+
}), this.slider.on("pointerout", (L) => {
|
|
3514
|
+
this.isDragging || (L.target.getStage().container().style.cursor = "default");
|
|
3515
|
+
})), this.sliderBg || (this.sliderBg = new E.Rect({
|
|
3497
3516
|
x: 0,
|
|
3498
3517
|
y: 0
|
|
3499
3518
|
}), this.slider.add(this.sliderBg)), this.sliderBg.setAttrs({
|
|
@@ -3506,34 +3525,46 @@ class ke {
|
|
|
3506
3525
|
shadowOffsetX: this.context.getOptions().bar.shadowOffsetX,
|
|
3507
3526
|
shadowOffsetY: this.context.getOptions().bar.shadowOffsetY
|
|
3508
3527
|
}), this.renderProgress(o, e);
|
|
3509
|
-
const l = R(h).brighten(30 * ((x = this.context.getOptions().bar.progress) != null && x.show ? -1 : 1)).toHex(), c = (
|
|
3510
|
-
let
|
|
3511
|
-
V(c) ?
|
|
3528
|
+
const l = R(h).brighten(30 * ((x = this.context.getOptions().bar.progress) != null && x.show ? -1 : 1)).toHex(), c = (v = this.context.getOptions().bar.move.single) == null ? void 0 : v.left;
|
|
3529
|
+
let m = !1;
|
|
3530
|
+
V(c) ? m = c : z(c) && (m = c(this.task.getEmitData())), m ? (this.leftHandler || (this.leftHandler = new E.Rect({
|
|
3512
3531
|
x: 0,
|
|
3513
3532
|
y: 0,
|
|
3514
3533
|
opacity: 0
|
|
3515
3534
|
}), this.slider.add(this.leftHandler), this.leftHandler.on("mousedown", (L) => {
|
|
3516
3535
|
this.resizeMove(L, "left");
|
|
3536
|
+
}), this.leftHandler.on("pointerover", (L) => {
|
|
3537
|
+
setTimeout(() => {
|
|
3538
|
+
L.target.getStage().container().style.cursor = "ew-resize";
|
|
3539
|
+
}, 0);
|
|
3540
|
+
}), this.leftHandler.on("pointerout", (L) => {
|
|
3541
|
+
this.isDragging || (L.target.getStage().container().style.cursor = "default");
|
|
3517
3542
|
})), this.leftHandler.setAttrs({
|
|
3518
3543
|
width: this.handlerWidth,
|
|
3519
3544
|
height: e,
|
|
3520
3545
|
fill: l,
|
|
3521
3546
|
cornerRadius: [a[0], 0, 0, a[3]]
|
|
3522
3547
|
})) : this.leftHandler && (this.leftHandler.remove(), this.leftHandler = null);
|
|
3523
|
-
const
|
|
3524
|
-
let
|
|
3525
|
-
V(
|
|
3548
|
+
const p = (S = this.context.getOptions().bar.move.single) == null ? void 0 : S.right;
|
|
3549
|
+
let g = !1;
|
|
3550
|
+
V(p) ? g = p : z(p) && (g = p(this.task.getEmitData())), g ? (this.rightHandler || (this.rightHandler = new E.Rect({
|
|
3526
3551
|
y: 0,
|
|
3527
3552
|
opacity: 0
|
|
3528
3553
|
}), this.slider.add(this.rightHandler), this.rightHandler.on("mousedown", (L) => {
|
|
3529
3554
|
this.resizeMove(L, "right");
|
|
3555
|
+
}), this.rightHandler.on("pointerover", (L) => {
|
|
3556
|
+
setTimeout(() => {
|
|
3557
|
+
L.target.getStage().container().style.cursor = "ew-resize";
|
|
3558
|
+
}, 0);
|
|
3559
|
+
}), this.rightHandler.on("pointerout", (L) => {
|
|
3560
|
+
this.isDragging || (L.target.getStage().container().style.cursor = "default");
|
|
3530
3561
|
})), this.rightHandler.setAttrs({
|
|
3531
3562
|
x: o - this.handlerWidth,
|
|
3532
3563
|
width: this.handlerWidth,
|
|
3533
3564
|
height: e,
|
|
3534
3565
|
fill: l,
|
|
3535
3566
|
cornerRadius: [0, a[1], a[2], 0]
|
|
3536
|
-
})) : this.rightHandler && (this.rightHandler.remove(), this.rightHandler = null), this.renderText(o, e), this.sliderGroup.add(this.slider), (
|
|
3567
|
+
})) : this.rightHandler && (this.rightHandler.remove(), this.rightHandler = null), this.renderText(o, e), this.sliderGroup.add(this.slider), (b = this.leftHandler) == null || b.moveToTop(), (M = this.rightHandler) == null || M.moveToTop();
|
|
3537
3568
|
}
|
|
3538
3569
|
renderText(t, e) {
|
|
3539
3570
|
const i = `chart-slider-text-${this.task.id}`, s = () => {
|
|
@@ -3545,14 +3576,10 @@ class ke {
|
|
|
3545
3576
|
}
|
|
3546
3577
|
const n = this.context.getOptions().bar.label;
|
|
3547
3578
|
let o = "";
|
|
3548
|
-
|
|
3549
|
-
C.info("Bar content is empty");
|
|
3550
|
-
return;
|
|
3551
|
-
}
|
|
3552
|
-
s();
|
|
3579
|
+
n ? N(n) ? o = n : z(n) && (o = n(this.task.getEmitData())) : this.context.getOptions().bar.field && (o = this.task.getField(this.context.getOptions().bar.field)), s();
|
|
3553
3580
|
const h = t - (this.leftHandler ? this.handlerWidth : 0) - (this.rightHandler ? this.handlerWidth : 0);
|
|
3554
3581
|
if (h > 20) {
|
|
3555
|
-
const a = new
|
|
3582
|
+
const a = new E.Text({
|
|
3556
3583
|
id: i,
|
|
3557
3584
|
x: this.leftHandler ? 10 : 0,
|
|
3558
3585
|
y: 0,
|
|
@@ -3571,57 +3598,57 @@ class ke {
|
|
|
3571
3598
|
}
|
|
3572
3599
|
}
|
|
3573
3600
|
renderProgress(t, e) {
|
|
3574
|
-
var i, s, n, o, h, a, d, u, l, c,
|
|
3601
|
+
var i, s, n, o, h, a, d, u, l, c, m, p, g, x;
|
|
3575
3602
|
if (!((i = this.context.getOptions().bar.progress) != null && i.show)) {
|
|
3576
3603
|
this.progressGroup && (this.progressGroup.destroy(), this.progressGroup = null);
|
|
3577
3604
|
return;
|
|
3578
3605
|
}
|
|
3579
3606
|
if (this.task.progress) {
|
|
3580
|
-
const
|
|
3607
|
+
const v = Yt(
|
|
3581
3608
|
this.task.progress,
|
|
3582
3609
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
3583
3610
|
);
|
|
3584
|
-
if (
|
|
3585
|
-
const
|
|
3611
|
+
if (v === 0) return;
|
|
3612
|
+
const S = ((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || R(
|
|
3586
3613
|
this.context.getOptions().bar.backgroundColor || this.context.getOptions().primaryColor
|
|
3587
|
-
).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(),
|
|
3614
|
+
).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), b = et(
|
|
3588
3615
|
this.context.getOptions().bar.radius
|
|
3589
|
-
), M =
|
|
3616
|
+
), M = et(
|
|
3590
3617
|
(h = this.context.getOptions().bar.progress) == null ? void 0 : h.radius
|
|
3591
3618
|
);
|
|
3592
|
-
M[0] =
|
|
3593
|
-
const L = t *
|
|
3594
|
-
this.progressGroup ? (this.progressGroup.width(L), this.progressGroup.destroyChildren()) : (this.progressGroup = new
|
|
3619
|
+
M[0] = b[0], M[3] = b[3], v === 1 && (M[1] = b[1], M[2] = b[2]);
|
|
3620
|
+
const L = t * v;
|
|
3621
|
+
this.progressGroup ? (this.progressGroup.width(L), this.progressGroup.destroyChildren()) : (this.progressGroup = new E.Group({
|
|
3595
3622
|
x: 0,
|
|
3596
3623
|
y: 0,
|
|
3597
3624
|
width: L,
|
|
3598
3625
|
height: e,
|
|
3599
3626
|
listening: !1
|
|
3600
3627
|
}), this.slider.add(this.progressGroup));
|
|
3601
|
-
const k = new
|
|
3628
|
+
const k = new E.Rect({
|
|
3602
3629
|
x: 0,
|
|
3603
3630
|
y: 0,
|
|
3604
3631
|
width: L,
|
|
3605
3632
|
height: e,
|
|
3606
|
-
fill:
|
|
3633
|
+
fill: S,
|
|
3607
3634
|
cornerRadius: M,
|
|
3608
3635
|
opacity: (a = this.context.getOptions().bar.progress) == null ? void 0 : a.opacity
|
|
3609
3636
|
});
|
|
3610
3637
|
this.progressGroup.add(k);
|
|
3611
|
-
const
|
|
3612
|
-
|
|
3638
|
+
const T = `${Pt(
|
|
3639
|
+
v * 100,
|
|
3613
3640
|
(d = this.context.getOptions().bar.progress) == null ? void 0 : d.decimal
|
|
3614
|
-
)}%`, w = new
|
|
3641
|
+
)}%`, w = new E.Text().measureSize(T).width, O = new E.Text({
|
|
3615
3642
|
x: 0,
|
|
3616
3643
|
y: ((u = this.context.getOptions().bar.progress) == null ? void 0 : u.textAlign) === "top" ? -e : 0,
|
|
3617
3644
|
width: ((l = this.context.getOptions().bar.progress) == null ? void 0 : l.textAlign) === "right" ? L + w : Math.max(L, w),
|
|
3618
3645
|
height: e,
|
|
3619
|
-
fill: ((c = this.context.getOptions().bar.progress) == null ? void 0 : c.color) || R("#000000").mix(
|
|
3620
|
-
text:
|
|
3621
|
-
fontSize: ((
|
|
3622
|
-
fontStyle: ((
|
|
3646
|
+
fill: ((c = this.context.getOptions().bar.progress) == null ? void 0 : c.color) || R("#000000").mix(S, 50).alpha(0.7).toHex(),
|
|
3647
|
+
text: T,
|
|
3648
|
+
fontSize: ((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontSize) || 10,
|
|
3649
|
+
fontStyle: ((p = this.context.getOptions().bar.progress) == null ? void 0 : p.fontStyle) || "italic",
|
|
3623
3650
|
fontFamily: "Arial",
|
|
3624
|
-
verticalAlign: ((
|
|
3651
|
+
verticalAlign: ((g = this.context.getOptions().bar.progress) == null ? void 0 : g.textAlign) === "top" ? "bottom" : "middle",
|
|
3625
3652
|
align: "right"
|
|
3626
3653
|
});
|
|
3627
3654
|
(x = this.progressGroup) == null || x.add(O);
|
|
@@ -3629,12 +3656,12 @@ class ke {
|
|
|
3629
3656
|
}
|
|
3630
3657
|
// 绑定事件,包括拖拽和边缘检测
|
|
3631
3658
|
bindEvents() {
|
|
3632
|
-
this.slider && (this.slider.on("dragstart", (t) => this.handleDragStart(t)), this.slider.on("dragend", () => this.handleDragEnd()), this.slider.on("dragmove", (t) => this.handleDragMove(t)), this.slider.on("pointerover", () => this.handleMouseEnter()), this.slider.on("pointerout", () => this.handleMouseLeave()), this.slider.on("click", (t) => {
|
|
3633
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
3659
|
+
this.slider && (this.slider.on("dragstart", (t) => this.handleDragStart(t)), this.slider.on("dragend", (t) => this.handleDragEnd(t)), this.slider.on("dragmove", (t) => this.handleDragMove(t)), this.slider.on("pointerover", () => this.handleMouseEnter()), this.slider.on("pointerout", () => this.handleMouseLeave()), this.slider.on("click", (t) => {
|
|
3660
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(y.SLIDER_CLICK, t.evt, this.task));
|
|
3634
3661
|
}), this.slider.on("contextmenu", (t) => {
|
|
3635
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
3662
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(y.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
3636
3663
|
}), this.slider.on("dblclick", (t) => {
|
|
3637
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
3664
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(y.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
3638
3665
|
}));
|
|
3639
3666
|
}
|
|
3640
3667
|
/**
|
|
@@ -3646,7 +3673,7 @@ class ke {
|
|
|
3646
3673
|
}
|
|
3647
3674
|
handleDragStart(t) {
|
|
3648
3675
|
const e = t.target.getStage();
|
|
3649
|
-
e && (this.isDragging = !0, this.oldTasks = [], this.handleMove(t, e));
|
|
3676
|
+
e && (this.isDragging = !0, this.oldTasks = [], this.context.event.emit(y.SLIDER_MOVING, !0), e.container().style.cursor = "grabbing", this.handleMove(t, e));
|
|
3650
3677
|
}
|
|
3651
3678
|
handleDragMove(t) {
|
|
3652
3679
|
if (!this.isDragging) return;
|
|
@@ -3655,36 +3682,36 @@ class ke {
|
|
|
3655
3682
|
t.target.x(n);
|
|
3656
3683
|
}
|
|
3657
3684
|
}
|
|
3658
|
-
handleDragEnd() {
|
|
3659
|
-
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
3660
|
-
|
|
3685
|
+
handleDragEnd(t) {
|
|
3686
|
+
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.draggingDirection = "none", t.target.getStage().container().style.cursor = "default", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
3687
|
+
y.TASK_DRAG_END,
|
|
3661
3688
|
this.task,
|
|
3662
3689
|
this.oldTasks
|
|
3663
|
-
), this.oldTasks = []);
|
|
3690
|
+
), this.oldTasks = []), this.context.event.emit(y.SLIDER_MOVING, !1);
|
|
3664
3691
|
}
|
|
3665
3692
|
handleMove(t, e) {
|
|
3666
3693
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth();
|
|
3667
3694
|
this.autoMoveTimer = window.setInterval(() => {
|
|
3668
|
-
const h = t.target.width(), a = t.target.x() - this.offsetX, d = a + h, u = -this.offsetX, l = u + i, c = a <= u - this.offsetX + this.EDGE_THRESHOLD,
|
|
3695
|
+
const h = t.target.width(), a = t.target.x() - this.offsetX, d = a + h, u = -this.offsetX, l = u + i, c = a <= u - this.offsetX + this.EDGE_THRESHOLD, m = d >= l - this.offsetX - this.EDGE_THRESHOLD;
|
|
3669
3696
|
if (c)
|
|
3670
3697
|
if (u <= 0)
|
|
3671
3698
|
t.target.x(0), this.stopAutoScroll(), s || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
3672
3699
|
else if (this.draggingDirection === "left") {
|
|
3673
|
-
const
|
|
3674
|
-
this.startAutoScroll(
|
|
3675
|
-
t.target.x(t.target.x() +
|
|
3700
|
+
const p = n ? -o : -this.SCROLL_STEP;
|
|
3701
|
+
this.startAutoScroll(p, n, () => {
|
|
3702
|
+
t.target.x(t.target.x() + p);
|
|
3676
3703
|
});
|
|
3677
3704
|
} else
|
|
3678
3705
|
this.stopAutoScroll();
|
|
3679
|
-
else if (
|
|
3706
|
+
else if (m)
|
|
3680
3707
|
if (l >= this.context.store.getTimeAxis().getTotalWidth())
|
|
3681
3708
|
t.target.x(
|
|
3682
3709
|
this.context.store.getTimeAxis().getTotalWidth() - h
|
|
3683
3710
|
), this.stopAutoScroll(), s || (this.draggingDirection === "right" ? this.startAutoExpand("right") : this.stopAutoExpand());
|
|
3684
3711
|
else if (this.draggingDirection === "right") {
|
|
3685
|
-
const
|
|
3686
|
-
this.startAutoScroll(
|
|
3687
|
-
t.target.x(t.target.x() +
|
|
3712
|
+
const p = n ? o : this.SCROLL_STEP;
|
|
3713
|
+
this.startAutoScroll(p, n, () => {
|
|
3714
|
+
t.target.x(t.target.x() + p);
|
|
3688
3715
|
});
|
|
3689
3716
|
} else
|
|
3690
3717
|
this.stopAutoScroll();
|
|
@@ -3699,11 +3726,12 @@ class ke {
|
|
|
3699
3726
|
t.cancelBubble = !0;
|
|
3700
3727
|
const i = t.target.getStage();
|
|
3701
3728
|
if (!i) return;
|
|
3729
|
+
this.isDragging = !0, this.context.event.emit(y.SLIDER_MOVING, !0);
|
|
3702
3730
|
let s = ((x = i.getPointerPosition()) == null ? void 0 : x.x) || 0;
|
|
3703
3731
|
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), h = !!this.context.getOptions().bar.move.lock, a = i.width();
|
|
3704
3732
|
let d = 0, u = 0;
|
|
3705
3733
|
this.autoMoveTimer = window.setInterval(() => {
|
|
3706
|
-
const
|
|
3734
|
+
const v = this.slider.width(), S = this.slider.x(), b = S + v, M = -this.offsetX, L = M + a, k = S <= M + this.EDGE_THRESHOLD, T = b >= L - this.EDGE_THRESHOLD;
|
|
3707
3735
|
if (k && e === "left") {
|
|
3708
3736
|
if (M <= 0)
|
|
3709
3737
|
this.slider.x(0), this.stopAutoScroll(), h || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
@@ -3715,7 +3743,7 @@ class ke {
|
|
|
3715
3743
|
} else
|
|
3716
3744
|
this.stopAutoScroll();
|
|
3717
3745
|
this.emitUpdate("left");
|
|
3718
|
-
} else if (
|
|
3746
|
+
} else if (T && e === "right") {
|
|
3719
3747
|
if (L >= this.context.store.getTimeAxis().getTotalWidth())
|
|
3720
3748
|
this.slider.width(
|
|
3721
3749
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
@@ -3728,12 +3756,12 @@ class ke {
|
|
|
3728
3756
|
} else
|
|
3729
3757
|
this.stopAutoScroll();
|
|
3730
3758
|
this.emitUpdate("right");
|
|
3731
|
-
} else if (e === "right" &&
|
|
3759
|
+
} else if (e === "right" && S <= M && b <= M + this.EDGE_THRESHOLD + o) {
|
|
3732
3760
|
const w = n ? -o : -this.SCROLL_STEP;
|
|
3733
3761
|
this.startAutoScroll(w, n, () => {
|
|
3734
3762
|
u += w, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + w), this.emitUpdate("right");
|
|
3735
3763
|
});
|
|
3736
|
-
} else if (e === "left" &&
|
|
3764
|
+
} else if (e === "left" && b >= L && S >= L - this.EDGE_THRESHOLD - o) {
|
|
3737
3765
|
const w = n ? o : this.SCROLL_STEP;
|
|
3738
3766
|
this.startAutoScroll(w, n, () => {
|
|
3739
3767
|
d += w, this.slider.width(Math.max(this.slider.width(), o)), this.slider.width() > o && this.slider.x(this.slider.x() + w), this.emitUpdate("left");
|
|
@@ -3742,23 +3770,23 @@ class ke {
|
|
|
3742
3770
|
this.stopAutoExpand(), this.stopAutoScroll();
|
|
3743
3771
|
}, this.MOVE_INTERVAL);
|
|
3744
3772
|
let l;
|
|
3745
|
-
const c = this.slider.x(),
|
|
3773
|
+
const c = this.slider.x(), m = this.slider.width(), p = (v) => {
|
|
3746
3774
|
var M;
|
|
3747
|
-
|
|
3748
|
-
const
|
|
3749
|
-
let
|
|
3750
|
-
n && (
|
|
3751
|
-
},
|
|
3752
|
-
this.handleDragEnd(), document.removeEventListener("mousemove",
|
|
3775
|
+
v.movementX > 0 ? this.draggingDirection = "right" : v.movementX < 0 && (this.draggingDirection = "left");
|
|
3776
|
+
const S = Math.max(((M = i.getPointerPosition()) == null ? void 0 : M.x) || 0, 0);
|
|
3777
|
+
let b = S - s;
|
|
3778
|
+
n && (b = lt(b, o)), (l === void 0 || l !== b) && (e === "left" ? m - b - d >= o && S < a - this.EDGE_THRESHOLD && (this.slider.width(m - b - d), this.slider.x(c + b + d), this.emitUpdate("left")) : m + b + u >= o && S > this.EDGE_THRESHOLD && (this.slider.width(m + b + u), this.emitUpdate("right")), l = b);
|
|
3779
|
+
}, g = () => {
|
|
3780
|
+
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
3753
3781
|
};
|
|
3754
|
-
document.addEventListener("mousemove",
|
|
3782
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3755
3783
|
}
|
|
3756
3784
|
// 开始自动扩展
|
|
3757
3785
|
startAutoExpand(t) {
|
|
3758
3786
|
if (this.autoExpandTimer) return;
|
|
3759
3787
|
const e = this.context.store.getTimeAxis();
|
|
3760
3788
|
this.autoExpandTimer = window.setInterval(() => {
|
|
3761
|
-
e.expand(t, 1), this.context.event.emit(
|
|
3789
|
+
e.expand(t, 1), this.context.event.emit(y.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(0);
|
|
3762
3790
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
3763
3791
|
}
|
|
3764
3792
|
// 开始自动滚动
|
|
@@ -3795,24 +3823,24 @@ class ke {
|
|
|
3795
3823
|
}
|
|
3796
3824
|
// 拖拽块的高亮动画
|
|
3797
3825
|
handleResizeHighlight(t) {
|
|
3798
|
-
this.leftHandler && new
|
|
3826
|
+
this.leftHandler && new E.Tween({
|
|
3799
3827
|
node: this.leftHandler,
|
|
3800
3828
|
opacity: t,
|
|
3801
3829
|
duration: 0.2
|
|
3802
|
-
}).play(), this.rightHandler && new
|
|
3830
|
+
}).play(), this.rightHandler && new E.Tween({
|
|
3803
3831
|
node: this.rightHandler,
|
|
3804
3832
|
opacity: t,
|
|
3805
3833
|
duration: 0.2
|
|
3806
3834
|
}).play();
|
|
3807
3835
|
}
|
|
3808
3836
|
}
|
|
3809
|
-
class
|
|
3837
|
+
class ke {
|
|
3810
3838
|
constructor(t, e, i, s, n, o, h) {
|
|
3811
3839
|
r(this, "row");
|
|
3812
3840
|
r(this, "slider");
|
|
3813
3841
|
r(this, "cacheKey", "");
|
|
3814
|
-
this.context = t, this.task = e, this.width = o, this.height = h, this.row = new
|
|
3815
|
-
const a = new
|
|
3842
|
+
this.context = t, this.task = e, this.width = o, this.height = h, this.row = new E.Group();
|
|
3843
|
+
const a = new E.Rect({
|
|
3816
3844
|
x: s,
|
|
3817
3845
|
y: n,
|
|
3818
3846
|
width: o,
|
|
@@ -3820,7 +3848,7 @@ class Le {
|
|
|
3820
3848
|
id: i,
|
|
3821
3849
|
listening: !1
|
|
3822
3850
|
});
|
|
3823
|
-
this.row.add(a), this.slider = new
|
|
3851
|
+
this.row.add(a), this.slider = new Le(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
3824
3852
|
}
|
|
3825
3853
|
update(t, e) {
|
|
3826
3854
|
this.slider.update(t, e);
|
|
@@ -3850,7 +3878,7 @@ class Me {
|
|
|
3850
3878
|
// 选中相关
|
|
3851
3879
|
r(this, "selectedRowId", null);
|
|
3852
3880
|
r(this, "selectedRect", null);
|
|
3853
|
-
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new
|
|
3881
|
+
this.context = t, this.stage = e, this.layer = i, this.bgLayer = s, this.rowsGroup = new E.Group({ name: "chart-body-rows" }), this.layer.add(this.rowsGroup), this.rowBgGroup = new E.Group({ name: "chart-body-row-bgs" }), this.bgLayer.add(this.rowBgGroup), this.registerEvents(), this.bindEvents();
|
|
3854
3882
|
}
|
|
3855
3883
|
/**
|
|
3856
3884
|
* 调整大小
|
|
@@ -3875,7 +3903,7 @@ class Me {
|
|
|
3875
3903
|
const o = `chart-row-${s.id}`;
|
|
3876
3904
|
let h = this.rowsCache.get(o);
|
|
3877
3905
|
const d = s.flatIndex * e + this.context.getOptions().header.height;
|
|
3878
|
-
h ? (h.update(0, d), h.setOffset(this.offsetX, this.offsetY)) : (h = new
|
|
3906
|
+
h ? (h.update(0, d), h.setOffset(this.offsetX, this.offsetY)) : (h = new ke(
|
|
3879
3907
|
this.context,
|
|
3880
3908
|
s,
|
|
3881
3909
|
o,
|
|
@@ -3884,7 +3912,7 @@ class Me {
|
|
|
3884
3912
|
this.width,
|
|
3885
3913
|
e
|
|
3886
3914
|
), h.setOffset(this.offsetX, this.offsetY), this.rowsGroup.add(h.row), this.rowsCache.set(o, h)), h.cacheKey = i, this.context.store.getDataManager().isTaskSelected(s.id) && this.selectRow(s.id);
|
|
3887
|
-
const u = new
|
|
3915
|
+
const u = new E.Rect({
|
|
3888
3916
|
x: 0,
|
|
3889
3917
|
y: d + this.offsetY,
|
|
3890
3918
|
width: this.width,
|
|
@@ -3919,13 +3947,13 @@ class Me {
|
|
|
3919
3947
|
* 注册事件监听
|
|
3920
3948
|
*/
|
|
3921
3949
|
registerEvents() {
|
|
3922
|
-
this.context.event.on(
|
|
3950
|
+
this.context.event.on(y.ROW_HIGHLIGHT, (t) => {
|
|
3923
3951
|
this.highlightRow(t);
|
|
3924
|
-
}), this.context.event.on(
|
|
3952
|
+
}), this.context.event.on(y.ROW_UNHIGHLIGHT, (t) => {
|
|
3925
3953
|
this.unhighlightRow(t);
|
|
3926
|
-
}), this.context.event.on(
|
|
3954
|
+
}), this.context.event.on(y.TASK_SELECTED, (t) => {
|
|
3927
3955
|
this.selectRow(t.id);
|
|
3928
|
-
}), this.context.event.on(
|
|
3956
|
+
}), this.context.event.on(y.TASK_UNSELECTED, (t) => {
|
|
3929
3957
|
this.unselectRow(t);
|
|
3930
3958
|
});
|
|
3931
3959
|
}
|
|
@@ -3937,9 +3965,9 @@ class Me {
|
|
|
3937
3965
|
if (!e) return;
|
|
3938
3966
|
const i = this.getTaskByPosition(e);
|
|
3939
3967
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
3940
|
-
|
|
3968
|
+
y.ROW_UNHIGHLIGHT,
|
|
3941
3969
|
this.highlightedRowId
|
|
3942
|
-
), i && this.context.event.emit(
|
|
3970
|
+
), i && this.context.event.emit(y.ROW_HIGHLIGHT, i.id);
|
|
3943
3971
|
}
|
|
3944
3972
|
/**
|
|
3945
3973
|
* 处理鼠标离开
|
|
@@ -3957,7 +3985,7 @@ class Me {
|
|
|
3957
3985
|
const i = this.getTaskByPosition(e);
|
|
3958
3986
|
if (i) {
|
|
3959
3987
|
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
3960
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(
|
|
3988
|
+
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(y.ROW_CLICK, t.evt, i);
|
|
3961
3989
|
}
|
|
3962
3990
|
}
|
|
3963
3991
|
/**
|
|
@@ -3968,7 +3996,7 @@ class Me {
|
|
|
3968
3996
|
const e = this.stage.getPointerPosition();
|
|
3969
3997
|
if (!e) return;
|
|
3970
3998
|
const i = this.getTaskByPosition(e);
|
|
3971
|
-
i && this.context.event.emit(
|
|
3999
|
+
i && this.context.event.emit(y.ROW_DBL_CLICK, t.evt, i);
|
|
3972
4000
|
}
|
|
3973
4001
|
/**
|
|
3974
4002
|
* 处理右键菜单
|
|
@@ -3979,7 +4007,7 @@ class Me {
|
|
|
3979
4007
|
const e = this.stage.getPointerPosition();
|
|
3980
4008
|
if (!e) return;
|
|
3981
4009
|
const i = this.getTaskByPosition(e);
|
|
3982
|
-
i && this.context.event.emit(
|
|
4010
|
+
i && this.context.event.emit(y.ROW_CONTEXTMENU, t.evt, i);
|
|
3983
4011
|
}
|
|
3984
4012
|
/**
|
|
3985
4013
|
* 按照位置获取任务
|
|
@@ -4002,7 +4030,7 @@ class Me {
|
|
|
4002
4030
|
if (!e) return;
|
|
4003
4031
|
this.highlightRect && this.highlightRect.destroy();
|
|
4004
4032
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
4005
|
-
this.selectedRowId !== t && (this.highlightRect = new
|
|
4033
|
+
this.selectedRowId !== t && (this.highlightRect = new E.Rect({
|
|
4006
4034
|
x: 0,
|
|
4007
4035
|
y: s + this.offsetY,
|
|
4008
4036
|
width: this.width,
|
|
@@ -4051,7 +4079,7 @@ class Me {
|
|
|
4051
4079
|
if (!e) return;
|
|
4052
4080
|
this.selectedRect && this.selectedRect.destroy(), this.selectedRowId === this.highlightedRowId && ((n = this.highlightRect) == null || n.fill("transparent"));
|
|
4053
4081
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
4054
|
-
this.selectedRect = new
|
|
4082
|
+
this.selectedRect = new E.Rect({
|
|
4055
4083
|
x: 0,
|
|
4056
4084
|
y: s + this.offsetY,
|
|
4057
4085
|
width: this.width,
|
|
@@ -4072,10 +4100,12 @@ class Me {
|
|
|
4072
4100
|
updateSelectedPosition(t) {
|
|
4073
4101
|
if (!this.selectedRect || this.selectedRowId === null) return;
|
|
4074
4102
|
const e = this.rowsCache.get(`chart-row-${this.selectedRowId}`);
|
|
4075
|
-
if (
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4103
|
+
if (e)
|
|
4104
|
+
if (this.context.store.getDataManager().isTaskVisible(e.task)) {
|
|
4105
|
+
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
4106
|
+
this.selectedRect.y(s + this.offsetY), this.layer.batchDraw();
|
|
4107
|
+
} else
|
|
4108
|
+
this.selectedRect.destroy(), this.selectedRect = null, this.selectedRowId = null;
|
|
4079
4109
|
}
|
|
4080
4110
|
/**
|
|
4081
4111
|
* 销毁层
|
|
@@ -4121,36 +4151,36 @@ class Ct {
|
|
|
4121
4151
|
} = t || {}, o = s % 180, h = o * Math.PI / 180;
|
|
4122
4152
|
let a, d;
|
|
4123
4153
|
o === 0 ? (a = n, d = i + n) : o === 90 ? (a = i + n, d = n) : (a = Math.abs(Math.ceil((i + n) / Math.sin(h))), d = Math.abs(Math.ceil((i + n) / Math.cos(h))));
|
|
4124
|
-
const u = new
|
|
4154
|
+
const u = new E.Stage({
|
|
4125
4155
|
container: document.createElement("div"),
|
|
4126
4156
|
width: a,
|
|
4127
4157
|
height: d
|
|
4128
|
-
}), l = new
|
|
4158
|
+
}), l = new E.Layer();
|
|
4129
4159
|
u.add(l);
|
|
4130
|
-
const c = new
|
|
4160
|
+
const c = new E.Group();
|
|
4131
4161
|
if (o === 0 || o === 90) {
|
|
4132
|
-
const
|
|
4162
|
+
const p = new E.Line({
|
|
4133
4163
|
points: [0, 0, o === 0 ? a : 0, o === 0 ? 0 : d],
|
|
4134
4164
|
stroke: e,
|
|
4135
4165
|
strokeWidth: i,
|
|
4136
4166
|
perfectDrawEnabled: !0
|
|
4137
4167
|
});
|
|
4138
|
-
c.add(
|
|
4168
|
+
c.add(p);
|
|
4139
4169
|
} else
|
|
4140
|
-
for (let
|
|
4141
|
-
const
|
|
4142
|
-
points: [Math.ceil(
|
|
4170
|
+
for (let p = -a; p < a * 2; p += a) {
|
|
4171
|
+
const g = p + i / 2, x = 0, v = p + i / 2 + (Math.cos(h) < 0 ? -a : a), S = d, b = new E.Line({
|
|
4172
|
+
points: [Math.ceil(g), Math.ceil(x), Math.ceil(v), Math.ceil(S)],
|
|
4143
4173
|
stroke: e,
|
|
4144
4174
|
strokeWidth: i,
|
|
4145
4175
|
perfectDrawEnabled: !0,
|
|
4146
4176
|
lineCap: "square",
|
|
4147
4177
|
lineJoin: "miter"
|
|
4148
4178
|
});
|
|
4149
|
-
c.add(
|
|
4179
|
+
c.add(b);
|
|
4150
4180
|
}
|
|
4151
4181
|
l.add(c), l.draw();
|
|
4152
|
-
const
|
|
4153
|
-
return
|
|
4182
|
+
const m = new Image();
|
|
4183
|
+
return m.src = u.toDataURL(), u.destroy(), m;
|
|
4154
4184
|
}
|
|
4155
4185
|
/**
|
|
4156
4186
|
* 创建圆点图案
|
|
@@ -4160,11 +4190,11 @@ class Ct {
|
|
|
4160
4190
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
4161
4191
|
width: i = (t == null ? void 0 : t.width) || 2,
|
|
4162
4192
|
spacing: s = (t == null ? void 0 : t.spacing) || 4
|
|
4163
|
-
} = t || {}, n = i * 2 + s * 2, o = n, h = R(e), a = new
|
|
4193
|
+
} = t || {}, n = i * 2 + s * 2, o = n, h = R(e), a = new E.Stage({
|
|
4164
4194
|
container: document.createElement("div"),
|
|
4165
4195
|
width: n,
|
|
4166
4196
|
height: o
|
|
4167
|
-
}), d = new
|
|
4197
|
+
}), d = new E.Layer();
|
|
4168
4198
|
a.add(d), [
|
|
4169
4199
|
{ x: s / 2 + i / 2, y: s / 2 + i / 2 },
|
|
4170
4200
|
{
|
|
@@ -4180,13 +4210,13 @@ class Ct {
|
|
|
4180
4210
|
y: o - s / 2 - i / 2
|
|
4181
4211
|
}
|
|
4182
4212
|
].forEach((c) => {
|
|
4183
|
-
const
|
|
4213
|
+
const m = new E.Circle({
|
|
4184
4214
|
x: c.x,
|
|
4185
4215
|
y: c.y,
|
|
4186
4216
|
radius: i / 2,
|
|
4187
4217
|
fill: h.toString()
|
|
4188
4218
|
});
|
|
4189
|
-
d.add(
|
|
4219
|
+
d.add(m);
|
|
4190
4220
|
}), d.draw();
|
|
4191
4221
|
const l = new Image();
|
|
4192
4222
|
return l.src = a.toDataURL(), a.destroy(), l;
|
|
@@ -4199,22 +4229,22 @@ class Ct {
|
|
|
4199
4229
|
color: e = (t == null ? void 0 : t.color) || "#f9f9f9",
|
|
4200
4230
|
width: i = (t == null ? void 0 : t.width) || 1,
|
|
4201
4231
|
spacing: s = (t == null ? void 0 : t.spacing) || 20
|
|
4202
|
-
} = t || {}, n = i + s, o = n, h = n, a = new
|
|
4232
|
+
} = t || {}, n = i + s, o = n, h = n, a = new E.Stage({
|
|
4203
4233
|
container: document.createElement("div"),
|
|
4204
4234
|
width: o,
|
|
4205
4235
|
height: h
|
|
4206
|
-
}), d = new
|
|
4236
|
+
}), d = new E.Layer();
|
|
4207
4237
|
a.add(d);
|
|
4208
|
-
const u = new
|
|
4238
|
+
const u = new E.Group();
|
|
4209
4239
|
u.add(
|
|
4210
|
-
new
|
|
4240
|
+
new E.Line({
|
|
4211
4241
|
points: [0, 0, o, h],
|
|
4212
4242
|
stroke: e,
|
|
4213
4243
|
strokeWidth: i,
|
|
4214
4244
|
perfectDrawEnabled: !0
|
|
4215
4245
|
})
|
|
4216
4246
|
), u.add(
|
|
4217
|
-
new
|
|
4247
|
+
new E.Line({
|
|
4218
4248
|
points: [0, h, o, 0],
|
|
4219
4249
|
stroke: e,
|
|
4220
4250
|
strokeWidth: i,
|
|
@@ -4235,7 +4265,7 @@ class Ce {
|
|
|
4235
4265
|
// 保存周末
|
|
4236
4266
|
r(this, "weekendGroup");
|
|
4237
4267
|
r(this, "patternImage", null);
|
|
4238
|
-
this.context = t, this.layer = e, this.weekendGroup = new
|
|
4268
|
+
this.context = t, this.layer = e, this.weekendGroup = new E.Group(), this.layer.add(this.weekendGroup);
|
|
4239
4269
|
}
|
|
4240
4270
|
/**
|
|
4241
4271
|
* 检查日期是否为周末
|
|
@@ -4279,22 +4309,22 @@ class Ce {
|
|
|
4279
4309
|
for (let l = t; l <= e; ) {
|
|
4280
4310
|
let c = s;
|
|
4281
4311
|
if (c = s * 2 * (i === "day" ? 1 : 24), this.isWeekend(l)) {
|
|
4282
|
-
const
|
|
4283
|
-
if (
|
|
4312
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(l), p = n, g = a;
|
|
4313
|
+
if (m + c < d) {
|
|
4284
4314
|
l = l.add(2, "day");
|
|
4285
4315
|
continue;
|
|
4286
4316
|
}
|
|
4287
|
-
if (
|
|
4317
|
+
if (m > u)
|
|
4288
4318
|
break;
|
|
4289
4319
|
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await Ct.createPattern(
|
|
4290
4320
|
this.context.getOptions().weekend
|
|
4291
4321
|
));
|
|
4292
|
-
const
|
|
4322
|
+
const v = new E.Rect({
|
|
4293
4323
|
name: "weekend-rect",
|
|
4294
|
-
x:
|
|
4295
|
-
y:
|
|
4324
|
+
x: m,
|
|
4325
|
+
y: p,
|
|
4296
4326
|
width: c,
|
|
4297
|
-
height:
|
|
4327
|
+
height: g,
|
|
4298
4328
|
// 根据模式设置填充
|
|
4299
4329
|
...this.patternImage ? {
|
|
4300
4330
|
fillPatternImage: this.patternImage,
|
|
@@ -4306,7 +4336,7 @@ class Ce {
|
|
|
4306
4336
|
},
|
|
4307
4337
|
opacity: this.context.getOptions().weekend.opacity
|
|
4308
4338
|
});
|
|
4309
|
-
this.weekendGroup.add(
|
|
4339
|
+
this.weekendGroup.add(v), l = l.add(2, "day");
|
|
4310
4340
|
} else
|
|
4311
4341
|
l = l.add(1, "day");
|
|
4312
4342
|
}
|
|
@@ -4356,11 +4386,11 @@ class Oe {
|
|
|
4356
4386
|
const i = this.context.store.getTimeAxis().getCellUnit();
|
|
4357
4387
|
t.type === "block" && (e = e.startOf(i));
|
|
4358
4388
|
const s = this.context.store.getTimeAxis().getTimeLeft(e), n = this.context.store.getTimeAxis().getCellWidth(), o = this.context.getOptions().header.height, h = R(t.backgroundColor).alpha(t.opacity).toHex(), a = (t.type === "block" ? s + n / 2 : s) + this.offsetX, d = [a, o, a, this.height], u = t.type === "line" ? t.width : n;
|
|
4359
|
-
this.todayLine ? (this.todayLine.points(d), this.todayLine.stroke(h), this.todayLine.strokeWidth(u)) : (this.todayLine = new
|
|
4389
|
+
this.todayLine ? (this.todayLine.points(d), this.todayLine.stroke(h), this.todayLine.strokeWidth(u)) : (this.todayLine = new E.Line({
|
|
4360
4390
|
points: d,
|
|
4361
4391
|
stroke: h,
|
|
4362
4392
|
strokeWidth: u
|
|
4363
|
-
}), this.bgLayer.add(this.todayLine)), t.type === "line" && (this.triangle ? (this.triangle.x(a), this.triangle.fill(h)) : (this.triangle = new
|
|
4393
|
+
}), this.bgLayer.add(this.todayLine)), t.type === "line" && (this.triangle ? (this.triangle.x(a), this.triangle.fill(h)) : (this.triangle = new E.RegularPolygon({
|
|
4364
4394
|
x: a,
|
|
4365
4395
|
y: o - 8,
|
|
4366
4396
|
sides: 3,
|
|
@@ -4368,10 +4398,10 @@ class Oe {
|
|
|
4368
4398
|
fill: h,
|
|
4369
4399
|
rotation: 180,
|
|
4370
4400
|
name: "today-triangle"
|
|
4371
|
-
}), this.arrowAnimation = new
|
|
4372
|
-
var
|
|
4401
|
+
}), this.arrowAnimation = new E.Animation((l) => {
|
|
4402
|
+
var m;
|
|
4373
4403
|
const c = Math.sin(l.time * 4 * Math.PI / 2e3) + o - 8;
|
|
4374
|
-
(
|
|
4404
|
+
(m = this.triangle) == null || m.y(c);
|
|
4375
4405
|
}, this.headerLayer), this.headerLayer.add(this.triangle), this.triangle.moveToTop(), this.arrowAnimation.start())), this.bgLayer.batchDraw();
|
|
4376
4406
|
}
|
|
4377
4407
|
/**
|
|
@@ -4391,8 +4421,8 @@ class De {
|
|
|
4391
4421
|
r(this, "offsetY", 0);
|
|
4392
4422
|
// 保存假期
|
|
4393
4423
|
r(this, "holidayGroup");
|
|
4394
|
-
r(this, "patternImage",
|
|
4395
|
-
this.context = t, this.layer = e, this.holidayGroup = new
|
|
4424
|
+
r(this, "patternImage", /* @__PURE__ */ new WeakMap());
|
|
4425
|
+
this.context = t, this.layer = e, this.holidayGroup = new E.Group(), this.layer.add(this.holidayGroup);
|
|
4396
4426
|
}
|
|
4397
4427
|
/**
|
|
4398
4428
|
* 调整假期大小
|
|
@@ -4416,10 +4446,10 @@ class De {
|
|
|
4416
4446
|
* 销毁假期层
|
|
4417
4447
|
*/
|
|
4418
4448
|
destroy() {
|
|
4419
|
-
this.holidayGroup.destroy()
|
|
4449
|
+
this.holidayGroup.destroy();
|
|
4420
4450
|
}
|
|
4421
4451
|
clearHoliday() {
|
|
4422
|
-
this.holidayGroup.destroyChildren()
|
|
4452
|
+
this.holidayGroup.destroyChildren();
|
|
4423
4453
|
}
|
|
4424
4454
|
/**
|
|
4425
4455
|
* 计算假期
|
|
@@ -4432,41 +4462,46 @@ class De {
|
|
|
4432
4462
|
this.context.store.getTimeAxis().getCellUnit();
|
|
4433
4463
|
const o = this.context.store.getTimeAxis().getCellWidth(), h = this.context.getOptions().header.height, a = this.context.getOptions().row.height, u = this.context.store.getDataManager().getVisibleSize() * a;
|
|
4434
4464
|
for (let l = s; l <= n; l = l.add(1, "day")) {
|
|
4435
|
-
const c = t.find((
|
|
4436
|
-
if (
|
|
4437
|
-
if (
|
|
4438
|
-
return
|
|
4439
|
-
} else if (D(
|
|
4440
|
-
return
|
|
4465
|
+
const c = t.find((m) => {
|
|
4466
|
+
if (F(m.date)) {
|
|
4467
|
+
if (m.date.some((p) => D(p).isSame(l, "day")))
|
|
4468
|
+
return m;
|
|
4469
|
+
} else if (D(m.date).isSame(l, "day"))
|
|
4470
|
+
return m;
|
|
4441
4471
|
});
|
|
4442
4472
|
if (c) {
|
|
4443
|
-
const
|
|
4444
|
-
if (
|
|
4473
|
+
const m = this.context.store.getTimeAxis().getTimeLeft(l), p = h, g = u;
|
|
4474
|
+
if (m + o < e)
|
|
4445
4475
|
continue;
|
|
4446
|
-
if (
|
|
4476
|
+
if (m > i)
|
|
4447
4477
|
break;
|
|
4448
|
-
!this.patternImage && this.context.getOptions().holiday.pattern &&
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4478
|
+
!this.patternImage.has(c) && (c.pattern || this.context.getOptions().holiday.pattern) && this.patternImage.set(
|
|
4479
|
+
c,
|
|
4480
|
+
await Ct.createPattern({
|
|
4481
|
+
backgroundColor: this.context.getOptions().primaryColor,
|
|
4482
|
+
...c,
|
|
4483
|
+
...this.context.getOptions().holiday
|
|
4484
|
+
})
|
|
4485
|
+
);
|
|
4486
|
+
const v = new E.Rect({
|
|
4452
4487
|
name: "holiday-rect",
|
|
4453
|
-
x:
|
|
4454
|
-
y:
|
|
4488
|
+
x: m,
|
|
4489
|
+
y: p,
|
|
4455
4490
|
width: o,
|
|
4456
|
-
height:
|
|
4491
|
+
height: g,
|
|
4457
4492
|
// 根据模式设置填充
|
|
4458
|
-
...this.patternImage ? {
|
|
4459
|
-
fillPatternImage: this.patternImage,
|
|
4493
|
+
...this.patternImage.get(c) ? {
|
|
4494
|
+
fillPatternImage: this.patternImage.get(c) ?? void 0,
|
|
4460
4495
|
fillPatternRepeat: "repeat",
|
|
4461
4496
|
fillPatternOffset: { x: 0, y: 0 },
|
|
4462
4497
|
fillPatternScale: { x: 1, y: 1 },
|
|
4463
|
-
opacity: this.context.getOptions().holiday.opacity
|
|
4498
|
+
opacity: c.opacity || this.context.getOptions().holiday.opacity
|
|
4464
4499
|
} : {
|
|
4465
4500
|
fill: c.backgroundColor || this.context.getOptions().holiday.backgroundColor || this.context.getOptions().primaryColor,
|
|
4466
4501
|
opacity: c.opacity || this.context.getOptions().holiday.opacity
|
|
4467
4502
|
}
|
|
4468
4503
|
});
|
|
4469
|
-
this.holidayGroup.add(
|
|
4504
|
+
this.holidayGroup.add(v);
|
|
4470
4505
|
}
|
|
4471
4506
|
}
|
|
4472
4507
|
this.layer.batchDraw();
|
|
@@ -4482,6 +4517,7 @@ class _e {
|
|
|
4482
4517
|
// 临时箭头
|
|
4483
4518
|
r(this, "templateArrow");
|
|
4484
4519
|
r(this, "isDragging", !1);
|
|
4520
|
+
r(this, "isSliderMoving", !1);
|
|
4485
4521
|
// 选中的连线
|
|
4486
4522
|
r(this, "selectedMap", /* @__PURE__ */ new Map());
|
|
4487
4523
|
// 状态变量
|
|
@@ -4489,7 +4525,7 @@ class _e {
|
|
|
4489
4525
|
r(this, "height", 0);
|
|
4490
4526
|
r(this, "offsetX", 0);
|
|
4491
4527
|
r(this, "offsetY", 0);
|
|
4492
|
-
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new
|
|
4528
|
+
this.context = t, this.stage = e, this.layer = i, this.linksGroup = new E.Group({ name: "links-group" }), this.pointGroup = new E.Group({ name: "point-group" }), this.templateArrow = new E.Arrow({
|
|
4493
4529
|
points: [],
|
|
4494
4530
|
stroke: this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4495
4531
|
strokeWidth: this.context.getOptions().links.width,
|
|
@@ -4508,10 +4544,12 @@ class _e {
|
|
|
4508
4544
|
* 注册事件
|
|
4509
4545
|
*/
|
|
4510
4546
|
registerEvents() {
|
|
4511
|
-
this.context.event.on(
|
|
4547
|
+
this.context.event.on(y.ROW_HIGHLIGHT, (t) => {
|
|
4512
4548
|
this.highlightPoint(t);
|
|
4513
|
-
}), this.context.event.on(
|
|
4549
|
+
}), this.context.event.on(y.ROW_UNHIGHLIGHT, (t) => {
|
|
4514
4550
|
this.unhighlightPoint(t);
|
|
4551
|
+
}), this.context.event.on(y.SLIDER_MOVING, (t) => {
|
|
4552
|
+
this.isSliderMoving = t;
|
|
4515
4553
|
});
|
|
4516
4554
|
}
|
|
4517
4555
|
/**
|
|
@@ -4552,42 +4590,42 @@ class _e {
|
|
|
4552
4590
|
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s = this.context.getOptions().links.gap, n = this.context.getOptions().links.create.radius, o = this.context.getOptions().links.create.mode === "always" ? 0.5 : 0, h = this.context.getOptions().links.create.color || this.context.getOptions().primaryColor, a = R(h).alpha(this.context.getOptions().links.create.opacity ?? 1).toHex(), d = this.context.getOptions().links.create.width;
|
|
4553
4591
|
this.tasks.forEach((u) => {
|
|
4554
4592
|
if (this.context.store.getDataManager().isTaskVisible(u) && u.startTime && u.endTime) {
|
|
4555
|
-
const l = this.context.store.getTimeAxis().getTimeLeft(u.startTime), c = this.context.store.getTimeAxis().getTimeLeft(u.endTime),
|
|
4556
|
-
let
|
|
4557
|
-
if (z(x) && (x = x(u.getEmitData())), V(x) ?
|
|
4558
|
-
const
|
|
4593
|
+
const l = this.context.store.getTimeAxis().getTimeLeft(u.startTime), c = this.context.store.getTimeAxis().getTimeLeft(u.endTime), m = i + e * u.flatIndex;
|
|
4594
|
+
let p = !0, g = !0, x = this.context.getOptions().links.create.from;
|
|
4595
|
+
if (z(x) && (x = x(u.getEmitData())), V(x) ? p = g = x : N(x) && (p = x === "S", g = x === "F"), p) {
|
|
4596
|
+
const v = new E.Circle({
|
|
4559
4597
|
id: `point-${u.id}-left`,
|
|
4560
4598
|
x: l - s,
|
|
4561
|
-
y:
|
|
4599
|
+
y: m,
|
|
4562
4600
|
radius: n,
|
|
4563
4601
|
opacity: o,
|
|
4564
4602
|
stroke: a,
|
|
4565
4603
|
strokeWidth: d
|
|
4566
4604
|
});
|
|
4567
|
-
this.pointGroup.add(
|
|
4568
|
-
this.isDragging = !0, this.createLink(
|
|
4569
|
-
}),
|
|
4570
|
-
this.stage.container().style.cursor = "pointer";
|
|
4571
|
-
}),
|
|
4572
|
-
this.isDragging || (this.stage.container().style.cursor = "default");
|
|
4605
|
+
this.pointGroup.add(v), v.on("mousedown", (S) => {
|
|
4606
|
+
this.isDragging = !0, this.createLink(S, "S", h, [l - s, m], u.id);
|
|
4607
|
+
}), v.on("mouseover", (S) => {
|
|
4608
|
+
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
4609
|
+
}), v.on("mouseout", (S) => {
|
|
4610
|
+
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
4573
4611
|
});
|
|
4574
4612
|
}
|
|
4575
|
-
if (
|
|
4576
|
-
const
|
|
4613
|
+
if (g) {
|
|
4614
|
+
const v = new E.Circle({
|
|
4577
4615
|
id: `point-${u.id}-right`,
|
|
4578
4616
|
x: c + s,
|
|
4579
|
-
y:
|
|
4617
|
+
y: m,
|
|
4580
4618
|
radius: n,
|
|
4581
4619
|
opacity: o,
|
|
4582
4620
|
stroke: a,
|
|
4583
4621
|
strokeWidth: d
|
|
4584
4622
|
});
|
|
4585
|
-
this.pointGroup.add(
|
|
4586
|
-
this.isDragging = !0, this.createLink(
|
|
4587
|
-
}),
|
|
4588
|
-
this.stage.container().style.cursor = "pointer";
|
|
4589
|
-
}),
|
|
4590
|
-
this.isDragging || (this.stage.container().style.cursor = "default");
|
|
4623
|
+
this.pointGroup.add(v), v.on("mousedown", (S) => {
|
|
4624
|
+
this.isDragging = !0, this.createLink(S, "F", h, [c + s, m], u.id);
|
|
4625
|
+
}), v.on("mouseover", (S) => {
|
|
4626
|
+
this.isSliderMoving || (this.stage.container().style.cursor = "pointer");
|
|
4627
|
+
}), v.on("mouseout", (S) => {
|
|
4628
|
+
this.isDragging || this.isSliderMoving || (this.stage.container().style.cursor = "default");
|
|
4591
4629
|
});
|
|
4592
4630
|
}
|
|
4593
4631
|
}
|
|
@@ -4598,135 +4636,141 @@ class _e {
|
|
|
4598
4636
|
*/
|
|
4599
4637
|
calculateLinks() {
|
|
4600
4638
|
if (this.linksGroup.destroyChildren(), !this.context.getOptions().links.show) return;
|
|
4601
|
-
this.context.getOptions().links.data
|
|
4602
|
-
|
|
4603
|
-
const
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4639
|
+
const t = this.context.getOptions().links.data, e = [];
|
|
4640
|
+
t.forEach((i) => {
|
|
4641
|
+
const s = this.createId(i);
|
|
4642
|
+
this.selectedMap.has(s) && e.push(s);
|
|
4643
|
+
}), this.selectedMap.forEach((i, s) => {
|
|
4644
|
+
e.includes(s) || this.selectedMap.delete(s);
|
|
4645
|
+
}), t.forEach((i) => {
|
|
4646
|
+
var o, h, a;
|
|
4647
|
+
const s = this.context.store.getDataManager().getTaskById(i.from), n = this.context.store.getDataManager().getTaskById(i.to);
|
|
4648
|
+
if (s || C.warn(
|
|
4649
|
+
`No corresponding FROM task [${i.from}] was found for the link. Info:`,
|
|
4650
|
+
i
|
|
4651
|
+
), n || C.warn(
|
|
4652
|
+
`No corresponding TO task [${i.to}] was found for the link. Info:`,
|
|
4653
|
+
i
|
|
4654
|
+
), s && this.context.store.getDataManager().isTaskVisible(s) && s.startTime && s.endTime && n && this.context.store.getDataManager().isTaskVisible(n) && n.startTime && n.endTime) {
|
|
4655
|
+
const d = this.context.store.getTimeAxis().getTimeLeft(s.startTime), u = this.context.store.getTimeAxis().getTimeLeft(s.endTime), l = this.context.store.getTimeAxis().getTimeLeft(n.startTime), c = this.context.store.getTimeAxis().getTimeLeft(n.endTime);
|
|
4656
|
+
let m = [];
|
|
4657
|
+
switch (i.type || "FS") {
|
|
4614
4658
|
case "FF":
|
|
4615
|
-
|
|
4616
|
-
e,
|
|
4659
|
+
m = this.createFF(
|
|
4617
4660
|
i,
|
|
4618
4661
|
s,
|
|
4619
|
-
|
|
4662
|
+
n,
|
|
4620
4663
|
d,
|
|
4621
4664
|
u,
|
|
4622
|
-
l
|
|
4665
|
+
l,
|
|
4666
|
+
c
|
|
4623
4667
|
);
|
|
4624
4668
|
break;
|
|
4625
4669
|
case "SS":
|
|
4626
|
-
|
|
4627
|
-
e,
|
|
4670
|
+
m = this.createSS(
|
|
4628
4671
|
i,
|
|
4629
4672
|
s,
|
|
4630
|
-
|
|
4673
|
+
n,
|
|
4631
4674
|
d,
|
|
4632
4675
|
u,
|
|
4633
|
-
l
|
|
4676
|
+
l,
|
|
4677
|
+
c
|
|
4634
4678
|
);
|
|
4635
4679
|
break;
|
|
4636
4680
|
case "SF":
|
|
4637
|
-
|
|
4638
|
-
e,
|
|
4681
|
+
m = this.createSF(
|
|
4639
4682
|
i,
|
|
4640
4683
|
s,
|
|
4641
|
-
|
|
4684
|
+
n,
|
|
4642
4685
|
d,
|
|
4643
4686
|
u,
|
|
4644
|
-
l
|
|
4687
|
+
l,
|
|
4688
|
+
c
|
|
4645
4689
|
);
|
|
4646
4690
|
break;
|
|
4647
4691
|
case "FS":
|
|
4648
4692
|
default:
|
|
4649
|
-
|
|
4650
|
-
e,
|
|
4693
|
+
m = this.createFS(
|
|
4651
4694
|
i,
|
|
4652
4695
|
s,
|
|
4653
|
-
|
|
4696
|
+
n,
|
|
4654
4697
|
d,
|
|
4655
4698
|
u,
|
|
4656
|
-
l
|
|
4699
|
+
l,
|
|
4700
|
+
c
|
|
4657
4701
|
);
|
|
4658
4702
|
}
|
|
4659
|
-
if (
|
|
4660
|
-
C.warn("The link position has some error.",
|
|
4703
|
+
if (m.length <= 2)
|
|
4704
|
+
C.warn("The link position has some error.", i);
|
|
4661
4705
|
else {
|
|
4662
|
-
const
|
|
4663
|
-
radius:
|
|
4664
|
-
fill:
|
|
4665
|
-
x:
|
|
4666
|
-
y:
|
|
4706
|
+
const g = this.createId(i), x = i.radius ?? this.context.getOptions().links.radius, v = ((o = i.arrow) == null ? void 0 : o.width) ?? this.context.getOptions().links.arrow.width, S = ((h = i.arrow) == null ? void 0 : h.height) ?? this.context.getOptions().links.arrow.height, b = i.width ?? this.context.getOptions().links.width, M = new E.Group({ id: g }), L = new E.Circle({
|
|
4707
|
+
radius: x,
|
|
4708
|
+
fill: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4709
|
+
x: m[0],
|
|
4710
|
+
y: m[1]
|
|
4667
4711
|
});
|
|
4668
|
-
|
|
4712
|
+
M.add(L), L.on("mousedown", (T) => {
|
|
4669
4713
|
this.handleDrag(
|
|
4670
|
-
|
|
4671
|
-
|
|
4714
|
+
T,
|
|
4715
|
+
i,
|
|
4672
4716
|
"S",
|
|
4673
|
-
[
|
|
4674
|
-
|
|
4717
|
+
[m[m.length - 2], m[m.length - 1]],
|
|
4718
|
+
g
|
|
4675
4719
|
);
|
|
4676
4720
|
});
|
|
4677
|
-
const
|
|
4678
|
-
points:
|
|
4679
|
-
stroke:
|
|
4680
|
-
strokeWidth:
|
|
4681
|
-
pointerLength:
|
|
4682
|
-
pointerWidth:
|
|
4683
|
-
fill: ((
|
|
4721
|
+
const k = new E.Arrow({
|
|
4722
|
+
points: m,
|
|
4723
|
+
stroke: i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4724
|
+
strokeWidth: b,
|
|
4725
|
+
pointerLength: S,
|
|
4726
|
+
pointerWidth: v,
|
|
4727
|
+
fill: ((a = i.arrow) == null ? void 0 : a.color) || this.context.getOptions().links.arrow.color || i.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4684
4728
|
// 箭头填充色
|
|
4685
4729
|
lineJoin: "round",
|
|
4686
|
-
dash:
|
|
4730
|
+
dash: i.data || this.context.getOptions().links.dash,
|
|
4687
4731
|
hitStrokeWidth: 10
|
|
4688
4732
|
// 增加点击区域
|
|
4689
4733
|
});
|
|
4690
|
-
|
|
4691
|
-
this.handleDrag(
|
|
4692
|
-
}), this.linksGroup.add(
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
f,
|
|
4734
|
+
M.add(k), k.on("mousedown", (T) => {
|
|
4735
|
+
this.handleDrag(T, i, "F", [m[0], m[1]], g);
|
|
4736
|
+
}), this.linksGroup.add(M), M.on("mouseover", (T) => {
|
|
4737
|
+
T.target.moveToTop(), this.stage.container().style.cursor = "pointer", this.selectedMap.has(g) || this.handleHighlight(
|
|
4738
|
+
M,
|
|
4696
4739
|
x,
|
|
4697
|
-
T,
|
|
4698
4740
|
v,
|
|
4741
|
+
S,
|
|
4742
|
+
b,
|
|
4699
4743
|
2
|
|
4700
4744
|
);
|
|
4701
|
-
}),
|
|
4702
|
-
this.selectedMap.has(
|
|
4703
|
-
|
|
4704
|
-
f,
|
|
4745
|
+
}), M.on("mouseout", (T) => {
|
|
4746
|
+
this.selectedMap.has(g) || this.handleHighlight(
|
|
4747
|
+
M,
|
|
4705
4748
|
x,
|
|
4706
|
-
T,
|
|
4707
4749
|
v,
|
|
4750
|
+
S,
|
|
4751
|
+
b,
|
|
4708
4752
|
0
|
|
4709
4753
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
4710
|
-
}),
|
|
4754
|
+
}), M.on("mousedown", (T) => {
|
|
4711
4755
|
this.isDragging = !0;
|
|
4712
|
-
}),
|
|
4713
|
-
|
|
4714
|
-
|
|
4756
|
+
}), M.on("click", (T) => {
|
|
4757
|
+
T.cancelBubble = !0, this.isDragging = !1, T.target.moveToTop(), this.selectedMap.has(g) ? (this.selectedMap.delete(g), this.context.event.emit(
|
|
4758
|
+
y.SELECT_LINK,
|
|
4715
4759
|
null,
|
|
4716
|
-
|
|
4760
|
+
i,
|
|
4717
4761
|
this.selectedMap.values().toArray()
|
|
4718
|
-
)) : (this.selectedMap.set(
|
|
4719
|
-
|
|
4720
|
-
|
|
4762
|
+
)) : (this.selectedMap.set(g, i), this.context.event.emit(
|
|
4763
|
+
y.SELECT_LINK,
|
|
4764
|
+
i,
|
|
4721
4765
|
null,
|
|
4722
4766
|
this.selectedMap.values().toArray()
|
|
4723
4767
|
));
|
|
4724
|
-
}), this.selectedMap.has(
|
|
4725
|
-
|
|
4726
|
-
f,
|
|
4768
|
+
}), this.selectedMap.has(g) && this.handleHighlight(
|
|
4769
|
+
M,
|
|
4727
4770
|
x,
|
|
4728
|
-
T,
|
|
4729
4771
|
v,
|
|
4772
|
+
S,
|
|
4773
|
+
b,
|
|
4730
4774
|
2,
|
|
4731
4775
|
!0
|
|
4732
4776
|
);
|
|
@@ -4734,6 +4778,9 @@ class _e {
|
|
|
4734
4778
|
}
|
|
4735
4779
|
});
|
|
4736
4780
|
}
|
|
4781
|
+
createId(t) {
|
|
4782
|
+
return `link-group-${t[this.context.getOptions().links.key]}-${t.from}-${t.to}-${t.type || "FS"}`;
|
|
4783
|
+
}
|
|
4737
4784
|
/** 生成 FS 连线 */
|
|
4738
4785
|
createFS(t, e, i, s, n, o, h) {
|
|
4739
4786
|
const a = this.context.getOptions().header.height, d = this.context.getOptions().row.height, u = d / 2 + a, l = t.gap || this.context.getOptions().links.gap, c = [
|
|
@@ -4741,17 +4788,17 @@ class _e {
|
|
|
4741
4788
|
u + d * e.flatIndex
|
|
4742
4789
|
];
|
|
4743
4790
|
{
|
|
4744
|
-
const
|
|
4745
|
-
if (isNaN(
|
|
4791
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
4792
|
+
if (isNaN(m))
|
|
4746
4793
|
C.error("Link's distance must be a Numeric");
|
|
4747
4794
|
else {
|
|
4748
|
-
const
|
|
4749
|
-
Math.max(
|
|
4795
|
+
const p = n + l + m, g = o - l - m, x = [
|
|
4796
|
+
Math.max(p, g),
|
|
4750
4797
|
u + d * e.flatIndex
|
|
4751
4798
|
];
|
|
4752
4799
|
c.push(...x);
|
|
4753
|
-
const
|
|
4754
|
-
c.push(x[0],
|
|
4800
|
+
const v = d * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? d : 0);
|
|
4801
|
+
c.push(x[0], v), c.push(g, v), c.push(g, u + d * i.flatIndex);
|
|
4755
4802
|
}
|
|
4756
4803
|
}
|
|
4757
4804
|
return c.push(o - l, u + d * i.flatIndex), c;
|
|
@@ -4763,16 +4810,16 @@ class _e {
|
|
|
4763
4810
|
u + d * e.flatIndex
|
|
4764
4811
|
];
|
|
4765
4812
|
{
|
|
4766
|
-
const
|
|
4767
|
-
if (isNaN(
|
|
4813
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
4814
|
+
if (isNaN(m))
|
|
4768
4815
|
C.error("Link's distance must be a Numeric");
|
|
4769
4816
|
else {
|
|
4770
|
-
const
|
|
4771
|
-
|
|
4817
|
+
const p = n + l + m, g = h + l + m, x = [
|
|
4818
|
+
p <= g ? g : p,
|
|
4772
4819
|
u + d * e.flatIndex
|
|
4773
4820
|
];
|
|
4774
4821
|
c.push(...x), c.push(
|
|
4775
|
-
Math.max(
|
|
4822
|
+
Math.max(g, p),
|
|
4776
4823
|
u + d * i.flatIndex
|
|
4777
4824
|
);
|
|
4778
4825
|
}
|
|
@@ -4783,16 +4830,16 @@ class _e {
|
|
|
4783
4830
|
createSS(t, e, i, s, n, o, h) {
|
|
4784
4831
|
const a = this.context.getOptions().header.height, d = this.context.getOptions().row.height, u = d / 2 + a, l = t.gap || this.context.getOptions().links.gap, c = [s - l, u + d * e.flatIndex];
|
|
4785
4832
|
{
|
|
4786
|
-
const
|
|
4787
|
-
if (isNaN(
|
|
4833
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
4834
|
+
if (isNaN(m))
|
|
4788
4835
|
C.error("Link's distance must be a Numeric");
|
|
4789
4836
|
else {
|
|
4790
|
-
const
|
|
4837
|
+
const p = s - l - m, g = o - l - m;
|
|
4791
4838
|
c.push(
|
|
4792
|
-
Math.min(
|
|
4839
|
+
Math.min(g, p),
|
|
4793
4840
|
u + d * e.flatIndex
|
|
4794
4841
|
), c.push(
|
|
4795
|
-
Math.min(
|
|
4842
|
+
Math.min(g, p),
|
|
4796
4843
|
u + d * i.flatIndex
|
|
4797
4844
|
);
|
|
4798
4845
|
}
|
|
@@ -4803,17 +4850,17 @@ class _e {
|
|
|
4803
4850
|
createSF(t, e, i, s, n, o, h) {
|
|
4804
4851
|
const a = this.context.getOptions().header.height, d = this.context.getOptions().row.height, u = d / 2 + a, l = t.gap || this.context.getOptions().links.gap, c = [s - l, u + d * e.flatIndex];
|
|
4805
4852
|
{
|
|
4806
|
-
const
|
|
4807
|
-
if (isNaN(
|
|
4853
|
+
const m = t.distance ? parseInt(t.distance) : this.context.getOptions().links.distance;
|
|
4854
|
+
if (isNaN(m))
|
|
4808
4855
|
C.error("Link's distance must be a Numeric");
|
|
4809
4856
|
else {
|
|
4810
|
-
const
|
|
4811
|
-
Math.min(
|
|
4857
|
+
const p = s - l - m, g = h + l + m, x = [
|
|
4858
|
+
Math.min(p, g),
|
|
4812
4859
|
u + d * e.flatIndex
|
|
4813
4860
|
];
|
|
4814
4861
|
c.push(...x);
|
|
4815
|
-
const
|
|
4816
|
-
c.push(x[0],
|
|
4862
|
+
const v = d * e.flatIndex + a + (e.flatIndex <= i.flatIndex ? d : 0);
|
|
4863
|
+
c.push(x[0], v), c.push(g, v), c.push(g, u + d * i.flatIndex);
|
|
4817
4864
|
}
|
|
4818
4865
|
}
|
|
4819
4866
|
return c.push(h + l, u + d * i.flatIndex), c;
|
|
@@ -4822,18 +4869,18 @@ class _e {
|
|
|
4822
4869
|
* 处理连线被点击后的移动
|
|
4823
4870
|
*/
|
|
4824
4871
|
handleDrag(t, e, i, s, n) {
|
|
4825
|
-
var
|
|
4872
|
+
var g, x, v;
|
|
4826
4873
|
if (!this.isDragging) return;
|
|
4827
4874
|
this.stage.container().style.cursor = "pointer";
|
|
4828
4875
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
4829
4876
|
this.templateArrow.setAttrs({
|
|
4830
4877
|
stroke: e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4831
4878
|
strokeWidth: e.width ?? this.context.getOptions().links.width,
|
|
4832
|
-
pointerLength: ((
|
|
4879
|
+
pointerLength: ((g = e.arrow) == null ? void 0 : g.height) ?? this.context.getOptions().links.arrow.height,
|
|
4833
4880
|
// 箭头长度
|
|
4834
4881
|
pointerWidth: ((x = e.arrow) == null ? void 0 : x.width) ?? this.context.getOptions().links.arrow.width,
|
|
4835
4882
|
// 箭头宽度
|
|
4836
|
-
fill: ((
|
|
4883
|
+
fill: ((v = e.arrow) == null ? void 0 : v.color) || this.context.getOptions().links.arrow.color || e.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
4837
4884
|
// 箭头填充色
|
|
4838
4885
|
lineJoin: "round",
|
|
4839
4886
|
dash: e.data || this.context.getOptions().links.dash
|
|
@@ -4841,14 +4888,14 @@ class _e {
|
|
|
4841
4888
|
let h = null;
|
|
4842
4889
|
const a = this.context.getOptions().header.height, d = this.context.getOptions().row.height, u = d / 2 + a, l = e.gap || this.context.getOptions().links.gap;
|
|
4843
4890
|
let c = null;
|
|
4844
|
-
const
|
|
4845
|
-
const
|
|
4846
|
-
if (!
|
|
4847
|
-
const { allowLeft:
|
|
4891
|
+
const m = () => {
|
|
4892
|
+
const S = this.stage.getPointerPosition();
|
|
4893
|
+
if (!S || (c = this.getTaskByPosition(S), !c)) return;
|
|
4894
|
+
const { allowLeft: b, allowRight: M } = this.isAllowDrop(c, e.from);
|
|
4848
4895
|
if (this.templateArrow.visible(!0), o == null || o.visible(!1), c != null && c.startTime && (c != null && c.endTime)) {
|
|
4849
|
-
const L = this.context.store.getTimeAxis().getTimeLeft(c.startTime), k = this.context.store.getTimeAxis().getTimeLeft(c.endTime),
|
|
4896
|
+
const L = this.context.store.getTimeAxis().getTimeLeft(c.startTime), k = this.context.store.getTimeAxis().getTimeLeft(c.endTime), T = (k + L) / 2 + this.offsetX;
|
|
4850
4897
|
let w = L - l;
|
|
4851
|
-
|
|
4898
|
+
S.x <= T ? h = "S" : (h = "F", w = k + l), i === "S" ? (this.templateArrow.points([
|
|
4852
4899
|
w,
|
|
4853
4900
|
u + d * c.flatIndex,
|
|
4854
4901
|
...s
|
|
@@ -4856,20 +4903,20 @@ class _e {
|
|
|
4856
4903
|
...s,
|
|
4857
4904
|
w,
|
|
4858
4905
|
u + d * c.flatIndex
|
|
4859
|
-
]),
|
|
4906
|
+
]), b ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed");
|
|
4860
4907
|
}
|
|
4861
|
-
},
|
|
4908
|
+
}, p = () => {
|
|
4862
4909
|
var M, L;
|
|
4863
|
-
let
|
|
4864
|
-
const
|
|
4865
|
-
if (h && c && (i === "S" ? (
|
|
4866
|
-
const { allowLeft: k, allowRight:
|
|
4867
|
-
|
|
4910
|
+
let S;
|
|
4911
|
+
const b = B(e);
|
|
4912
|
+
if (h && c && (i === "S" ? (S = `${h}${(e.type || "FS")[1]}`, b.from = c.id) : i === "F" && (S = `${(e.type || "FS")[0]}${h}`, b.to = c.id)), S && c && !(b.from === b.to && ["FF", "SS"].includes(S))) {
|
|
4913
|
+
const { allowLeft: k, allowRight: T } = this.isAllowDrop(c, b.from);
|
|
4914
|
+
b.type = S, ((M = b.type) == null ? void 0 : M.slice(1)) === "S" && k || ((L = b.type) == null ? void 0 : L.slice(1)) === "F" && T ? this.context.event.emit(y.UPDATE_LINK, b) : (this.context.event.emit(y.ERROR, U.LINK_NOT_ALLOWED), this.calculateLinks());
|
|
4868
4915
|
} else
|
|
4869
|
-
this.context.event.emit(
|
|
4870
|
-
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove",
|
|
4916
|
+
this.context.event.emit(y.ERROR, U.LINK_SAME), this.calculateLinks();
|
|
4917
|
+
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
4871
4918
|
};
|
|
4872
|
-
document.addEventListener("mousemove",
|
|
4919
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p);
|
|
4873
4920
|
}
|
|
4874
4921
|
/**
|
|
4875
4922
|
* 处理连线被点击后的移动
|
|
@@ -4890,40 +4937,40 @@ class _e {
|
|
|
4890
4937
|
const h = this.context.getOptions().header.height, a = this.context.getOptions().row.height, d = a / 2 + h, u = this.context.getOptions().links.gap;
|
|
4891
4938
|
let l = null;
|
|
4892
4939
|
const c = () => {
|
|
4893
|
-
const
|
|
4894
|
-
if (!
|
|
4895
|
-
const { allowLeft:
|
|
4940
|
+
const p = this.stage.getPointerPosition();
|
|
4941
|
+
if (!p || (l = this.getTaskByPosition(p), !l)) return;
|
|
4942
|
+
const { allowLeft: g, allowRight: x } = this.isAllowDrop(l, n);
|
|
4896
4943
|
if (this.templateArrow.visible(!0), l.startTime && l.endTime) {
|
|
4897
|
-
const
|
|
4898
|
-
let M =
|
|
4899
|
-
|
|
4944
|
+
const v = this.context.store.getTimeAxis().getTimeLeft(l.startTime), S = this.context.store.getTimeAxis().getTimeLeft(l.endTime), b = (S + v) / 2 + this.offsetX;
|
|
4945
|
+
let M = v - u;
|
|
4946
|
+
p.x <= b ? o = "S" : (o = "F", M = S + u), this.templateArrow.points([
|
|
4900
4947
|
...s,
|
|
4901
4948
|
M,
|
|
4902
4949
|
d + a * l.flatIndex
|
|
4903
|
-
]), o === "S" && !
|
|
4950
|
+
]), o === "S" && !g ? this.stage.container().style.cursor = "not-allowed" : o === "F" && !x ? this.stage.container().style.cursor = "not-allowed" : this.stage.container().style.cursor = "pointer";
|
|
4904
4951
|
}
|
|
4905
|
-
},
|
|
4906
|
-
let
|
|
4907
|
-
if (o && (
|
|
4908
|
-
if (this.context.getOptions().links.data.some((
|
|
4909
|
-
this.context.event.emit(
|
|
4952
|
+
}, m = () => {
|
|
4953
|
+
let p;
|
|
4954
|
+
if (o && (p = `${e}${o}`), p && l)
|
|
4955
|
+
if (this.context.getOptions().links.data.some((g) => g.from === n && g.to === l.id && g.type === p))
|
|
4956
|
+
this.context.event.emit(y.ERROR, U.LINK_EXIST);
|
|
4910
4957
|
else if (n === l.id && e === o)
|
|
4911
|
-
this.context.event.emit(
|
|
4958
|
+
this.context.event.emit(y.ERROR, U.LINK_SAME);
|
|
4912
4959
|
else {
|
|
4913
|
-
const { allowLeft:
|
|
4914
|
-
o === "S" &&
|
|
4960
|
+
const { allowLeft: g, allowRight: x } = this.isAllowDrop(l, n);
|
|
4961
|
+
o === "S" && g || o === "F" && x ? this.context.event.emit(y.CREATE_LINK, {
|
|
4915
4962
|
from: n,
|
|
4916
4963
|
to: l.id,
|
|
4917
|
-
type:
|
|
4964
|
+
type: p,
|
|
4918
4965
|
color: i
|
|
4919
4966
|
}) : this.context.event.emit(
|
|
4920
|
-
|
|
4967
|
+
y.ERROR,
|
|
4921
4968
|
U.LINK_NOT_ALLOWED
|
|
4922
4969
|
);
|
|
4923
4970
|
}
|
|
4924
|
-
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", c), document.removeEventListener("mouseup",
|
|
4971
|
+
this.templateArrow.visible(!1), this.stage.container().style.cursor = "default", this.isDragging = !1, document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", m);
|
|
4925
4972
|
};
|
|
4926
|
-
document.addEventListener("mousemove", c), document.addEventListener("mouseup",
|
|
4973
|
+
document.addEventListener("mousemove", c), document.addEventListener("mouseup", m);
|
|
4927
4974
|
}
|
|
4928
4975
|
/**
|
|
4929
4976
|
* 按照位置获取任务
|
|
@@ -4939,11 +4986,14 @@ class _e {
|
|
|
4939
4986
|
/**
|
|
4940
4987
|
* 检查当前连接点是否可以被创建
|
|
4941
4988
|
*/
|
|
4942
|
-
isAllowDrop(t) {
|
|
4943
|
-
let
|
|
4944
|
-
return z(
|
|
4945
|
-
|
|
4946
|
-
|
|
4989
|
+
isAllowDrop(t, e) {
|
|
4990
|
+
let i = !0, s = !0, n = this.context.getOptions().links.create.to;
|
|
4991
|
+
return z(n) && (n = n(
|
|
4992
|
+
t.getEmitData(),
|
|
4993
|
+
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
4994
|
+
)), V(n) ? i = s = n : N(n) && (i = n === "S", s = n === "F"), {
|
|
4995
|
+
allowLeft: i,
|
|
4996
|
+
allowRight: s
|
|
4947
4997
|
};
|
|
4948
4998
|
}
|
|
4949
4999
|
/**
|
|
@@ -4951,11 +5001,11 @@ class _e {
|
|
|
4951
5001
|
*/
|
|
4952
5002
|
handleHighlight(t, e, i, s, n, o, h = !1) {
|
|
4953
5003
|
const a = t.findOne("Circle"), d = t.findOne("Arrow");
|
|
4954
|
-
a && new
|
|
5004
|
+
a && new E.Tween({
|
|
4955
5005
|
node: a,
|
|
4956
5006
|
radius: e + o,
|
|
4957
5007
|
duration: h ? 0 : 0.1
|
|
4958
|
-
}).play(), d && new
|
|
5008
|
+
}).play(), d && new E.Tween({
|
|
4959
5009
|
node: d,
|
|
4960
5010
|
pointerWidth: i + o,
|
|
4961
5011
|
pointerLength: s + o,
|
|
@@ -4975,11 +5025,11 @@ class _e {
|
|
|
4975
5025
|
/** 操作创建点的高亮 */
|
|
4976
5026
|
handlePointHighlight(t, e) {
|
|
4977
5027
|
const i = this.pointGroup.findOne(`#point-${t}-left`), s = this.pointGroup.findOne(`#point-${t}-right`);
|
|
4978
|
-
i && new
|
|
5028
|
+
i && new E.Tween({
|
|
4979
5029
|
node: i,
|
|
4980
5030
|
opacity: e,
|
|
4981
5031
|
duration: 0.1
|
|
4982
|
-
}).play(), s && new
|
|
5032
|
+
}).play(), s && new E.Tween({
|
|
4983
5033
|
node: s,
|
|
4984
5034
|
opacity: e,
|
|
4985
5035
|
duration: 0.1
|
|
@@ -5001,15 +5051,15 @@ class He {
|
|
|
5001
5051
|
r(this, "bodyLayer");
|
|
5002
5052
|
r(this, "width", 0);
|
|
5003
5053
|
r(this, "height", 0);
|
|
5004
|
-
this.context = t, this.container = e, this.stage = new
|
|
5054
|
+
this.context = t, this.container = e, this.stage = new E.Stage({
|
|
5005
5055
|
container: this.container,
|
|
5006
5056
|
width: this.container.clientWidth,
|
|
5007
5057
|
height: this.container.clientHeight
|
|
5008
|
-
}), this.bgLayer = new
|
|
5058
|
+
}), this.bgLayer = new E.Layer(), this.weekendGroup = new Ce(this.context, this.bgLayer), this.holidayGroup = new De(this.context, this.bgLayer), this.gridGroup = new Ee(this.context, this.bgLayer), this.stage.add(this.bgLayer), this.headerLayer = new Se(this.context, this.stage), this.todayLayer = new Oe(
|
|
5009
5059
|
this.context,
|
|
5010
5060
|
this.bgLayer,
|
|
5011
5061
|
this.headerLayer.layer
|
|
5012
|
-
), this.bodyLayer = new
|
|
5062
|
+
), this.bodyLayer = new E.Layer(), this.linkGroup = new _e(this.context, this.stage, this.bodyLayer), this.bodyGroup = new Me(
|
|
5013
5063
|
this.context,
|
|
5014
5064
|
this.stage,
|
|
5015
5065
|
this.bodyLayer,
|
|
@@ -5065,19 +5115,19 @@ class Ae {
|
|
|
5065
5115
|
const d = s[s.length - 1].key;
|
|
5066
5116
|
this.initialWidth = i.getColumnWidth(d);
|
|
5067
5117
|
const u = parseInt(this.line.style.left) + 2;
|
|
5068
|
-
this.root.event.emit(
|
|
5069
|
-
const l = (
|
|
5118
|
+
this.root.event.emit(y.SHOW_GUIDELINE, u);
|
|
5119
|
+
const l = (m) => o(m), c = (m) => h(m, l, c);
|
|
5070
5120
|
document.addEventListener("mousemove", l), document.addEventListener("mouseup", c);
|
|
5071
5121
|
}, o = (a) => {
|
|
5072
5122
|
if (a.preventDefault(), !e) return;
|
|
5073
5123
|
const d = a.clientX - t;
|
|
5074
5124
|
s[s.length - 1].key;
|
|
5075
|
-
const u = 50 - this.initialWidth, c = e.width - 20 - this.initialX,
|
|
5076
|
-
this.root.event.emit(
|
|
5125
|
+
const u = 50 - this.initialWidth, c = e.width - 20 - this.initialX, m = Math.max(u, Math.min(c, d)), p = this.initialX + m;
|
|
5126
|
+
this.root.event.emit(y.MOVE_GUIDELINE, p);
|
|
5077
5127
|
}, h = (a, d, u) => {
|
|
5078
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.root.event.emit(
|
|
5079
|
-
const l = a.clientX - t, c = s[s.length - 1].key,
|
|
5080
|
-
i.setColumnWidth(c,
|
|
5128
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.root.event.emit(y.HIDE_GUIDELINE);
|
|
5129
|
+
const l = a.clientX - t, c = s[s.length - 1].key, m = Math.max(50, this.initialWidth + l);
|
|
5130
|
+
i.setColumnWidth(c, m), this.root.event.emit(y.UPDATE_TABLE_HEADER);
|
|
5081
5131
|
};
|
|
5082
5132
|
this.line.addEventListener("mousedown", n);
|
|
5083
5133
|
}
|
|
@@ -5108,11 +5158,11 @@ class Ie {
|
|
|
5108
5158
|
* 初始化事件监听
|
|
5109
5159
|
*/
|
|
5110
5160
|
initEvents() {
|
|
5111
|
-
this.context.event.on(
|
|
5161
|
+
this.context.event.on(y.SHOW_GUIDELINE, (t) => {
|
|
5112
5162
|
this.show(t);
|
|
5113
|
-
}), this.context.event.on(
|
|
5163
|
+
}), this.context.event.on(y.HIDE_GUIDELINE, () => {
|
|
5114
5164
|
this.hide();
|
|
5115
|
-
}), this.context.event.on(
|
|
5165
|
+
}), this.context.event.on(y.MOVE_GUIDELINE, (t) => {
|
|
5116
5166
|
this.setLeft(t);
|
|
5117
5167
|
});
|
|
5118
5168
|
}
|
|
@@ -5316,6 +5366,7 @@ class We {
|
|
|
5316
5366
|
// 尺寸和状态
|
|
5317
5367
|
r(this, "width", 0);
|
|
5318
5368
|
r(this, "height", 0);
|
|
5369
|
+
r(this, "isInitialized", !0);
|
|
5319
5370
|
// 更新尺寸
|
|
5320
5371
|
r(this, "updateSize", () => {
|
|
5321
5372
|
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%";
|
|
@@ -5365,7 +5416,7 @@ class We {
|
|
|
5365
5416
|
r(this, "handleColumnWidthChange", () => {
|
|
5366
5417
|
this.table.updateWidth(), this.updateSize();
|
|
5367
5418
|
});
|
|
5368
|
-
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 Ie(this.context, this.container), this.middleLine = new Ae(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new
|
|
5419
|
+
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 Ie(this.context, this.container), this.middleLine = new Ae(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new Te(this.context, this.tableContainer), this.chart = new He(this.context, this.chartContainer), this.scrollbar = new we(
|
|
5369
5420
|
this.context,
|
|
5370
5421
|
this.rootElement,
|
|
5371
5422
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
@@ -5381,7 +5432,7 @@ class We {
|
|
|
5381
5432
|
setupTaskHandlers() {
|
|
5382
5433
|
this.renderScheduler.registerSimpleHandler(
|
|
5383
5434
|
"DATA_UPDATE",
|
|
5384
|
-
(t = !
|
|
5435
|
+
(t = !0) => this.performRender(t)
|
|
5385
5436
|
), this.renderScheduler.registerSimpleHandler(
|
|
5386
5437
|
"VIEW_UPDATE",
|
|
5387
5438
|
(t = !0) => this.performRender(t)
|
|
@@ -5408,17 +5459,19 @@ class We {
|
|
|
5408
5459
|
* 设置事件监听器
|
|
5409
5460
|
*/
|
|
5410
5461
|
setupEventListeners() {
|
|
5411
|
-
this.context.event.on(
|
|
5412
|
-
this.renderScheduler.scheduleTask("DATA_UPDATE", [!
|
|
5413
|
-
}), this.context.event.on(
|
|
5462
|
+
this.context.event.on(y.DATA_UPDATE, () => {
|
|
5463
|
+
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
5464
|
+
}), this.context.event.on(y.SCROLL, () => {
|
|
5414
5465
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
5415
|
-
}), this.context.event.on(
|
|
5466
|
+
}), this.context.event.on(y.COLUMN_WIDTH_CHANGE, () => {
|
|
5416
5467
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
5417
|
-
}), this.context.event.on(
|
|
5468
|
+
}), this.context.event.on(y.VIEW_UPDATE, () => {
|
|
5418
5469
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
5419
|
-
}), this.context.event.on(
|
|
5420
|
-
this.renderScheduler.scheduleTask("UPDATE_TASK", [t]
|
|
5421
|
-
|
|
5470
|
+
}), this.context.event.on(y.UPDATE_TASK, (t) => {
|
|
5471
|
+
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
5472
|
+
immediate: !0
|
|
5473
|
+
});
|
|
5474
|
+
}), this.context.event.on(y.CHART_OFFSET_CHANGE, () => {
|
|
5422
5475
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
5423
5476
|
});
|
|
5424
5477
|
}
|
|
@@ -5429,7 +5482,7 @@ class We {
|
|
|
5429
5482
|
performRender(t = !1) {
|
|
5430
5483
|
this.setStyleValue();
|
|
5431
5484
|
const { x: e, y: i } = this.scrollbar.getScrollPosition(), s = this.context.store.getOptionManager().getOptions().row.height, n = this.context.store.getOptionManager().getOptions().header.height, o = Math.floor(i / s), h = Math.ceil((this.height - n) / s), a = 2, d = Math.max(0, o), u = h + a, l = this.context.store.getDataManager().getVisibleTasks().slice(d, d + u);
|
|
5432
|
-
t ? (this.table.refresh(i, l), this.chart.refresh(e, i, l)) : (this.table.render(i, l), this.chart.render(e, i, l)), this.updateSize();
|
|
5485
|
+
t ? (this.table.refresh(i, l), this.chart.refresh(e, i, l)) : (this.table.render(i, l), this.chart.render(e, i, l)), this.updateSize(), this.isInitialized && (this.context.event.emit(y.LOADED), this.isInitialized = !1), C.debug("execute render");
|
|
5433
5486
|
}
|
|
5434
5487
|
/**
|
|
5435
5488
|
* 公共渲染方法,向后兼容
|
|
@@ -5508,9 +5561,11 @@ class $e {
|
|
|
5508
5561
|
}
|
|
5509
5562
|
// 注册对外事件
|
|
5510
5563
|
registerEvents() {
|
|
5511
|
-
this.event.on(
|
|
5564
|
+
this.event.on(y.ERROR, (t) => {
|
|
5512
5565
|
this._emit("error", t);
|
|
5513
|
-
}), this.event.on(
|
|
5566
|
+
}), this.event.on(y.LOADED, () => {
|
|
5567
|
+
this._emit("loaded");
|
|
5568
|
+
}), this.event.on(y.TASK_DRAG_END, (t, e) => {
|
|
5514
5569
|
this._emit(
|
|
5515
5570
|
"move",
|
|
5516
5571
|
e.map((i) => {
|
|
@@ -5521,38 +5576,38 @@ class $e {
|
|
|
5521
5576
|
};
|
|
5522
5577
|
})
|
|
5523
5578
|
);
|
|
5524
|
-
}), this.event.on(
|
|
5579
|
+
}), this.event.on(y.CHECK_TASK, (t, e) => {
|
|
5525
5580
|
this._emit(
|
|
5526
5581
|
"select",
|
|
5527
5582
|
t.map((i) => i.data),
|
|
5528
5583
|
e,
|
|
5529
5584
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
5530
5585
|
);
|
|
5531
|
-
}), this.event.on(
|
|
5586
|
+
}), this.event.on(y.UPDATE_LINK, (t) => {
|
|
5532
5587
|
this._emit("update:link", t);
|
|
5533
|
-
}), this.event.on(
|
|
5588
|
+
}), this.event.on(y.CREATE_LINK, (t) => {
|
|
5534
5589
|
this._emit("create:link", t);
|
|
5535
5590
|
}), this.event.on(
|
|
5536
|
-
|
|
5591
|
+
y.SELECT_LINK,
|
|
5537
5592
|
(t, e, i) => {
|
|
5538
5593
|
this._emit("select:link", t, e, i);
|
|
5539
5594
|
}
|
|
5540
|
-
), this.event.on(
|
|
5595
|
+
), this.event.on(y.ROW_CLICK, (t, e) => {
|
|
5541
5596
|
this._emit("click:row", t, e.data);
|
|
5542
|
-
}), this.event.on(
|
|
5597
|
+
}), this.event.on(y.ROW_DBL_CLICK, (t, e) => {
|
|
5543
5598
|
this._emit("dblclick:row", t, e.data);
|
|
5544
|
-
}), this.event.on(
|
|
5599
|
+
}), this.event.on(y.ROW_CONTEXTMENU, (t, e) => {
|
|
5545
5600
|
this._emit("contextmenu:row", t, e.data);
|
|
5546
|
-
}), this.event.on(
|
|
5601
|
+
}), this.event.on(y.SLIDER_CLICK, (t, e) => {
|
|
5547
5602
|
this._emit("click:slider", t, e.data);
|
|
5548
|
-
}), this.event.on(
|
|
5603
|
+
}), this.event.on(y.SLIDER_DBL_CLICK, (t, e) => {
|
|
5549
5604
|
this._emit("dblclick:slider", t, e.data);
|
|
5550
|
-
}), this.event.on(
|
|
5605
|
+
}), this.event.on(y.SLIDER_CONTEXTMENU, (t, e) => {
|
|
5551
5606
|
this._emit("contextmenu:slider", t, e.data);
|
|
5552
5607
|
});
|
|
5553
5608
|
}
|
|
5554
5609
|
}
|
|
5555
|
-
class
|
|
5610
|
+
class Ne {
|
|
5556
5611
|
constructor(t, e) {
|
|
5557
5612
|
r(this, "context");
|
|
5558
5613
|
// 管理对外事件
|
|
@@ -5570,7 +5625,7 @@ class Fe {
|
|
|
5570
5625
|
const i = typeof t == "string" ? document.querySelector(t) : t;
|
|
5571
5626
|
if (!i)
|
|
5572
5627
|
throw C.exception(`Container ${t} not found or invalid.`);
|
|
5573
|
-
i.innerHTML = "", this.context = new $e(i, this.events, e);
|
|
5628
|
+
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new $e(i, this.events, e);
|
|
5574
5629
|
}
|
|
5575
5630
|
// *** Public API Methods ***/
|
|
5576
5631
|
/**
|
|
@@ -5585,23 +5640,23 @@ class Fe {
|
|
|
5585
5640
|
*
|
|
5586
5641
|
* @example
|
|
5587
5642
|
* ```typescript
|
|
5588
|
-
* //
|
|
5589
|
-
* gantt.
|
|
5643
|
+
* // 更新数据源。数据会被完全替换,除非原数据的 key 一致
|
|
5644
|
+
* gantt.update({
|
|
5590
5645
|
* data: newTaskData
|
|
5591
5646
|
* });
|
|
5592
5647
|
*
|
|
5593
5648
|
* // 更新显示单位
|
|
5594
|
-
* gantt.
|
|
5649
|
+
* gantt.update({
|
|
5595
5650
|
* unit: 'month'
|
|
5596
5651
|
* });
|
|
5597
5652
|
*
|
|
5598
5653
|
* // 更新主题色
|
|
5599
|
-
* gantt.
|
|
5654
|
+
* gantt.update({
|
|
5600
5655
|
* primaryColor: '#ff6b6b'
|
|
5601
5656
|
* });
|
|
5602
5657
|
*
|
|
5603
5658
|
* // 批量更新多个配置
|
|
5604
|
-
* gantt.
|
|
5659
|
+
* gantt.update({
|
|
5605
5660
|
* unit: 'week',
|
|
5606
5661
|
* primaryColor: '#4ecdc4',
|
|
5607
5662
|
* dateFormat: 'YYYY-MM-DD',
|
|
@@ -5609,15 +5664,19 @@ class Fe {
|
|
|
5609
5664
|
* height: 40
|
|
5610
5665
|
* }
|
|
5611
5666
|
* });
|
|
5667
|
+
*
|
|
5668
|
+
* // 完全替换配置(不合并)
|
|
5669
|
+
* gantt.update(newOptions, { merge: false });
|
|
5612
5670
|
* ```
|
|
5671
|
+
*
|
|
5613
5672
|
*/
|
|
5614
|
-
|
|
5673
|
+
update(t, e = { merge: !0 }) {
|
|
5615
5674
|
this.context.updateOptions(t, e);
|
|
5616
5675
|
}
|
|
5617
5676
|
/**
|
|
5618
5677
|
* 渲染甘特图视图
|
|
5619
5678
|
*
|
|
5620
|
-
* @description 此方法通常不需要主动调用,初始化以及 `
|
|
5679
|
+
* @description 此方法通常不需要主动调用,初始化以及 `update` 中都会自动更新。 如果你需要强制刷新页面,可以在合适的时候调用此方法
|
|
5621
5680
|
*/
|
|
5622
5681
|
render() {
|
|
5623
5682
|
this.context.render(), C.info("Gantt rendered successfully.");
|
|
@@ -5718,6 +5777,7 @@ class Fe {
|
|
|
5718
5777
|
* 同一个事件注册多个,只会执行最后一个监听器。
|
|
5719
5778
|
*
|
|
5720
5779
|
* 支持的事件类型包括:
|
|
5780
|
+
* - `loaded`: 加载完成事件,组件初始化完成后触发
|
|
5721
5781
|
* - `error`: 错误事件,当组件发生错误时触发
|
|
5722
5782
|
* - `update:link`: 关联线更新事件
|
|
5723
5783
|
* - `create:link`: 关联线创建事件
|
|
@@ -5783,11 +5843,11 @@ class Fe {
|
|
|
5783
5843
|
}
|
|
5784
5844
|
}
|
|
5785
5845
|
Rt();
|
|
5786
|
-
const
|
|
5846
|
+
const Fe = ft;
|
|
5787
5847
|
export {
|
|
5788
|
-
|
|
5848
|
+
Ne as XGantt,
|
|
5789
5849
|
R as colorjs,
|
|
5790
5850
|
Be as dayjs,
|
|
5791
5851
|
K as generateId,
|
|
5792
|
-
|
|
5852
|
+
Fe as version
|
|
5793
5853
|
};
|