@xpyjs/gantt-core 0.0.1-beta.4 → 0.0.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/x-gantt.js +428 -331
- package/dist/x-gantt.umd.cjs +2 -2
- package/package.json +1 -1
- package/types/GanttContext.d.ts +6 -0
- package/types/XGantt.d.ts +63 -0
- package/types/event/index.d.ts +4 -2
- package/types/types/event.d.ts +27 -0
package/dist/x-gantt.js
CHANGED
|
@@ -3,10 +3,10 @@ var Yt = (f, t, e) => t in f ? Pt(f, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var a = (f, t, e) => Yt(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import G from "dayjs";
|
|
5
5
|
import { default as ai } from "dayjs";
|
|
6
|
-
import { merge as rt, isArray as X, isString as
|
|
6
|
+
import { merge as rt, isArray as X, isString as K, isFunction as j, cloneDeep as Z, isObject as Et, isNumber as Ut, omit as yt, throttle as wt, isBoolean as ht, debounce as Xt } from "lodash-es";
|
|
7
7
|
import S from "konva";
|
|
8
|
-
const
|
|
9
|
-
function
|
|
8
|
+
const Ct = "0.0.1-rc.1";
|
|
9
|
+
function Kt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
@@ -19,7 +19,7 @@ function Vt() {
|
|
|
19
19
|
`color: ${f}; font-weight: bold; font-family: monospace;`
|
|
20
20
|
);
|
|
21
21
|
}), console.log(
|
|
22
|
-
`%c 🚀 欢迎使用 XGantt %c Version: ${
|
|
22
|
+
`%c 🚀 欢迎使用 XGantt %c Version: ${Ct} `,
|
|
23
23
|
`background-color: ${e}; color: ${t}; padding: 2px 4px; border-radius: 6px 0 0 6px; font-weight: bold; margin: 4px 0;`,
|
|
24
24
|
`background-color: ${s}; color: ${i}; padding: 2px 4px; border-radius: 0 6px 6px 0; font-weight: normal; margin: 4px 0;`
|
|
25
25
|
);
|
|
@@ -316,7 +316,7 @@ const lt = () => ({
|
|
|
316
316
|
opacity: 0.1
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
|
-
class
|
|
319
|
+
class Vt {
|
|
320
320
|
constructor() {
|
|
321
321
|
a(this, "options", lt());
|
|
322
322
|
}
|
|
@@ -354,7 +354,7 @@ class Kt {
|
|
|
354
354
|
var s;
|
|
355
355
|
let e = "";
|
|
356
356
|
const i = (s = this.options.row) == null ? void 0 : s.backgroundColor;
|
|
357
|
-
return
|
|
357
|
+
return K(i) ? e = i : X(i) && i.length > 0 ? e = i[t.level] : j(i) && (e = i(t.getEmitData())), e;
|
|
358
358
|
}
|
|
359
359
|
unpackFunc(t, e) {
|
|
360
360
|
return j(t) ? t(e.getEmitData()) : t;
|
|
@@ -401,7 +401,7 @@ class jt {
|
|
|
401
401
|
this.events.clear();
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
var
|
|
404
|
+
var k = /* @__PURE__ */ ((f) => (f.LOADED = "loaded", f.COLUMN_WIDTH_CHANGE = "column-width-change", f.MOVE_GUIDELINE = "move-guideline", f.SHOW_GUIDELINE = "show-guideline", f.HIDE_GUIDELINE = "hide-guideline", f.TOGGLE_COLLAPSE = "toggle-collapse", f.SCROLL = "scroll", f.CHART_OFFSET_CHANGE = "chart_offset_change", f.DATA_UPDATE = "data-update", f.VIEW_UPDATE = "view-update", f.UPDATE_TABLE_HEADER = "update_table_header", f.UPDATE_TABLE_BODY = "update_table_body", f.UPDATE_CHART_HEADER = "update_chart_header", f.UPDATE_TASK = "update_task", f.UPDATE_LINK = "update_link", f.CREATE_LINK = "create_link", f.TASK_SELECTED = "task_selected", f.TASK_UNSELECTED = "task_unselected", f.SELECT_LINK = "select_link", f.CHECK_TASK = "check_task", f.CONTEXT_LINK = "context_link", f.ROW_CLICK = "row-click", f.ROW_DBL_CLICK = "row-dbl-click", f.ROW_CONTEXTMENU = "row-contextmenu", f.SLIDER_CLICK = "slider-click", f.SLIDER_DBL_CLICK = "slider-dbl-click", f.SLIDER_CONTEXTMENU = "slider-contextmenu", f.SLIDER_DRAGGING = "slider-dragging", f.SLIDER_ENTER = "slider-enter", f.SLIDER_HOVER = "slider-hover", f.SLIDER_LEAVE = "slider-leave", f.SLIDER_BLINK = "slider-blink", f.LINK_BLINK = "link-blink", f.ROW_HIGHLIGHT = "row-highlight", f.ROW_UNHIGHLIGHT = "row-unhighlight", f.TASK_DRAG_START = "task-drag-start", f.TASK_DRAG_MOVE = "task-drag-move", f.TASK_DRAG_END = "task-drag-end", f.BASELINE_CLICK = "baseline-click", f.BASELINE_CONTEXTMENU = "baseline-contextmenu", f.BASELINE_MOUSEENTER = "baseline-mouseenter", f.BASELINE_MOUSEMOVE = "baseline-mousemove", f.BASELINE_MOUSEOUT = "baseline-mouseout", f.ERROR = "error", f))(k || {}), Y = /* @__PURE__ */ ((f) => (f.INVALID_TYPE = "INVALID_TYPE", f.TASK_NOT_FOUND = "TASK_NOT_FOUND", f.LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED", f.LINK_SAME = "LINK_SAME", f.LINK_EXIST = "LINK_EXIST", f.LINK_INVALID_ARG = "LINK_INVALID_ARG", f.LINK_CYCLE = "LINK_CYCLE", f))(Y || {});
|
|
405
405
|
function Q() {
|
|
406
406
|
return Math.random().toString(36).substring(2, 15);
|
|
407
407
|
}
|
|
@@ -413,7 +413,7 @@ function $(f, t, e) {
|
|
|
413
413
|
}
|
|
414
414
|
function nt(f, t) {
|
|
415
415
|
let e = f;
|
|
416
|
-
return
|
|
416
|
+
return K(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
417
417
|
}
|
|
418
418
|
function ct(f, t) {
|
|
419
419
|
if (t === 0)
|
|
@@ -532,7 +532,7 @@ class mt {
|
|
|
532
532
|
this.store = t, this.event = e, this.fields = this.store.getOptionManager().getOptions().fields, this.id = n || i[this.fields.id] || Q(), this.data = i, this.name = i[this.fields.name] || "", this.type = i[this.fields.type] || "task", this.updateMode(), this.progress = i[this.fields.progress], this.expanded = this.store.getOptionManager().getOptions().expand.show ? this.store.getOptionManager().getOptions().expand.enabled : !0, this.children = [], this.level = s && s.level !== void 0 ? s.level + 1 : 0, this.parent = s, this.flatIndex = 0, this.store.updateTime(this.startTime, this.endTime);
|
|
533
533
|
}
|
|
534
534
|
getField(t) {
|
|
535
|
-
if (!t ||
|
|
535
|
+
if (!t || K(t) && t.trim() === "")
|
|
536
536
|
return;
|
|
537
537
|
if (!t.includes("."))
|
|
538
538
|
return this.data[t];
|
|
@@ -544,7 +544,7 @@ class mt {
|
|
|
544
544
|
return;
|
|
545
545
|
i = i[n];
|
|
546
546
|
}
|
|
547
|
-
return
|
|
547
|
+
return Et(i) ? Z(i) : i;
|
|
548
548
|
}
|
|
549
549
|
/** 切换展示模式时,需要调整时间 */
|
|
550
550
|
updateMode() {
|
|
@@ -554,13 +554,13 @@ class mt {
|
|
|
554
554
|
updateData(t) {
|
|
555
555
|
this.data = t;
|
|
556
556
|
let e = !1;
|
|
557
|
-
t[this.fields.name] && this.name !== t[this.fields.name] && (this.name = t[this.fields.name], e = !0), t[this.fields.type] && this.type !== t[this.fields.type] && (this.type = t[this.fields.type], e = !0), e = this.updateMode(), t[this.fields.progress] !== void 0 && (this.progress !== t[this.fields.progress] && (e = !0), this.progress = $(t[this.fields.progress], 0, 100)), e && this.event.emit(
|
|
557
|
+
t[this.fields.name] && this.name !== t[this.fields.name] && (this.name = t[this.fields.name], e = !0), t[this.fields.type] && this.type !== t[this.fields.type] && (this.type = t[this.fields.type], e = !0), e = this.updateMode(), t[this.fields.progress] !== void 0 && (this.progress !== t[this.fields.progress] && (e = !0), this.progress = $(t[this.fields.progress], 0, 100)), e && this.event.emit(k.UPDATE_TASK, this);
|
|
558
558
|
}
|
|
559
559
|
updateTime(t, e) {
|
|
560
560
|
var s, n;
|
|
561
561
|
this.startTime = t, this.endTime = this.isMilestone() ? t : e;
|
|
562
562
|
const i = (n = (s = this.store) == null ? void 0 : s.getOptionManager().getOptions()) == null ? void 0 : n.dateFormat;
|
|
563
|
-
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.isMilestone() ? this.data[this.fields.endTime || "endTime"] = this.startTime.add(this.duration).format(i) : this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(
|
|
563
|
+
this.data[this.fields.startTime || "startTime"] = this.startTime.format(i), this.isMilestone() ? this.data[this.fields.endTime || "endTime"] = this.startTime.add(this.duration).format(i) : this.data[this.fields.endTime || "endTime"] = this.endTime.format(i), this.event.emit(k.UPDATE_TASK, this);
|
|
564
564
|
}
|
|
565
565
|
clone() {
|
|
566
566
|
return new mt(
|
|
@@ -680,7 +680,7 @@ class Jt {
|
|
|
680
680
|
* 设置源数据并初始化任务
|
|
681
681
|
*/
|
|
682
682
|
setData(t, e = !1) {
|
|
683
|
-
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(
|
|
683
|
+
this.rawData = t, this.initTasks(e), this.invalidateCache(), this.event.emit(k.DATA_UPDATE);
|
|
684
684
|
}
|
|
685
685
|
/**
|
|
686
686
|
* 初始化任务
|
|
@@ -800,7 +800,7 @@ class Jt {
|
|
|
800
800
|
const i = this.getTaskById(t);
|
|
801
801
|
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) => {
|
|
802
802
|
this.expandTask(s.id, e);
|
|
803
|
-
}), this.invalidateCache(), this.event.emit(
|
|
803
|
+
}), this.invalidateCache(), this.event.emit(k.VIEW_UPDATE), !0) : !1;
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
806
806
|
* 按条件筛选任务
|
|
@@ -854,7 +854,7 @@ class Jt {
|
|
|
854
854
|
* 清空所有数据
|
|
855
855
|
*/
|
|
856
856
|
clear() {
|
|
857
|
-
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(
|
|
857
|
+
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(k.DATA_UPDATE);
|
|
858
858
|
}
|
|
859
859
|
/**
|
|
860
860
|
* 更新子任务的层级
|
|
@@ -882,7 +882,7 @@ class Jt {
|
|
|
882
882
|
*/
|
|
883
883
|
selectTask(t) {
|
|
884
884
|
const e = this.getTaskById(t);
|
|
885
|
-
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(
|
|
885
|
+
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(k.TASK_SELECTED, e)), !0) : !1;
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
888
|
* 取消任务选择
|
|
@@ -890,7 +890,7 @@ class Jt {
|
|
|
890
890
|
unselectTask() {
|
|
891
891
|
if (this.selectedTaskId) {
|
|
892
892
|
const t = this.selectedTaskId;
|
|
893
|
-
this.selectedTaskId = null, this.event.emit(
|
|
893
|
+
this.selectedTaskId = null, this.event.emit(k.TASK_UNSELECTED, t);
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
/**
|
|
@@ -1184,7 +1184,7 @@ class et {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
1186
|
const B = (f) => f instanceof et ? f : new et(f);
|
|
1187
|
-
class
|
|
1187
|
+
class Lt {
|
|
1188
1188
|
constructor(t, e, i) {
|
|
1189
1189
|
a(this, "element");
|
|
1190
1190
|
a(this, "iconElement");
|
|
@@ -1261,14 +1261,14 @@ class Et {
|
|
|
1261
1261
|
)) : (this.context.store.getDataManager().updateCheckedList(!0, this.task), this.setState(
|
|
1262
1262
|
1
|
|
1263
1263
|
/* CHECKED */
|
|
1264
|
-
)), this.context.event.emit(
|
|
1264
|
+
)), this.context.event.emit(k.CHECK_TASK, [this.task], !e);
|
|
1265
1265
|
} else {
|
|
1266
1266
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1267
1267
|
this.setState(
|
|
1268
1268
|
e ? 1 : 0
|
|
1269
1269
|
/* UNCHECKED */
|
|
1270
1270
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1271
|
-
|
|
1271
|
+
k.CHECK_TASK,
|
|
1272
1272
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1273
1273
|
!e
|
|
1274
1274
|
);
|
|
@@ -1291,14 +1291,14 @@ class Et {
|
|
|
1291
1291
|
}), this.setState(
|
|
1292
1292
|
1
|
|
1293
1293
|
/* CHECKED */
|
|
1294
|
-
)), this.context.event.emit(
|
|
1294
|
+
)), this.context.event.emit(k.CHECK_TASK, e, !i);
|
|
1295
1295
|
} else {
|
|
1296
1296
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1297
1297
|
this.setState(
|
|
1298
1298
|
e ? 1 : 0
|
|
1299
1299
|
/* UNCHECKED */
|
|
1300
1300
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1301
|
-
|
|
1301
|
+
k.CHECK_TASK,
|
|
1302
1302
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1303
1303
|
!e
|
|
1304
1304
|
);
|
|
@@ -1306,7 +1306,7 @@ class Et {
|
|
|
1306
1306
|
});
|
|
1307
1307
|
}
|
|
1308
1308
|
registerEvents() {
|
|
1309
|
-
this.context.event.on(
|
|
1309
|
+
this.context.event.on(k.CHECK_TASK, this.updateState.bind(this));
|
|
1310
1310
|
}
|
|
1311
1311
|
/** 获取元素 */
|
|
1312
1312
|
getElement() {
|
|
@@ -1438,7 +1438,7 @@ class ee {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
setColumnWidth(t, e) {
|
|
1440
1440
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1441
|
-
i && (i.width = e), this.context.event.emit(
|
|
1441
|
+
i && (i.width = e), this.context.event.emit(k.COLUMN_WIDTH_CHANGE, t, e);
|
|
1442
1442
|
}
|
|
1443
1443
|
isLastColumn(t) {
|
|
1444
1444
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1467,7 +1467,7 @@ class ee {
|
|
|
1467
1467
|
customStyle: {
|
|
1468
1468
|
paddingLeft: this.context.store.getOptionManager().getOptions().expand.show ? "8px" : 0
|
|
1469
1469
|
},
|
|
1470
|
-
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new
|
|
1470
|
+
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new Lt(this.context).getElement() : null,
|
|
1471
1471
|
ellipsis: !1
|
|
1472
1472
|
},
|
|
1473
1473
|
children: [],
|
|
@@ -1481,7 +1481,7 @@ class ee {
|
|
|
1481
1481
|
return this.columns.some((t) => t.maxLevel > 1);
|
|
1482
1482
|
}
|
|
1483
1483
|
collapse() {
|
|
1484
|
-
this.collapseTable = !this.collapseTable, this.context.event.emit(
|
|
1484
|
+
this.collapseTable = !this.collapseTable, this.context.event.emit(k.TOGGLE_COLLAPSE);
|
|
1485
1485
|
}
|
|
1486
1486
|
isCollapsed() {
|
|
1487
1487
|
return this.collapseTable;
|
|
@@ -1698,18 +1698,18 @@ const tt = class tt {
|
|
|
1698
1698
|
return [];
|
|
1699
1699
|
T.add(x.id), b.add(x.id);
|
|
1700
1700
|
const C = n(x.id);
|
|
1701
|
-
let
|
|
1701
|
+
let L = [];
|
|
1702
1702
|
if (C.length === 0)
|
|
1703
|
-
|
|
1703
|
+
L = [[x]];
|
|
1704
1704
|
else {
|
|
1705
|
-
for (const
|
|
1706
|
-
const v = r(
|
|
1705
|
+
for (const E of C) {
|
|
1706
|
+
const v = r(E, T, b);
|
|
1707
1707
|
for (const M of v)
|
|
1708
|
-
|
|
1708
|
+
L.push([x, ...M]);
|
|
1709
1709
|
}
|
|
1710
|
-
|
|
1710
|
+
L.length === 0 && (L = [[x]]);
|
|
1711
1711
|
}
|
|
1712
|
-
return T.delete(x.id),
|
|
1712
|
+
return T.delete(x.id), L.length < 100 && (this.forwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1713
1713
|
}, h = (x, T, b = /* @__PURE__ */ new Set()) => {
|
|
1714
1714
|
const w = x.id;
|
|
1715
1715
|
if (this.backwardMemo.has(w))
|
|
@@ -1718,18 +1718,18 @@ const tt = class tt {
|
|
|
1718
1718
|
return [];
|
|
1719
1719
|
T.add(x.id), b.add(x.id);
|
|
1720
1720
|
const C = o(x.id);
|
|
1721
|
-
let
|
|
1721
|
+
let L = [];
|
|
1722
1722
|
if (C.length === 0)
|
|
1723
|
-
|
|
1723
|
+
L = [[x]];
|
|
1724
1724
|
else {
|
|
1725
|
-
for (const
|
|
1726
|
-
const v = h(
|
|
1725
|
+
for (const E of C) {
|
|
1726
|
+
const v = h(E, T, b);
|
|
1727
1727
|
for (const M of v)
|
|
1728
|
-
|
|
1728
|
+
L.push([...M, x]);
|
|
1729
1729
|
}
|
|
1730
|
-
|
|
1730
|
+
L.length === 0 && (L = [[x]]);
|
|
1731
1731
|
}
|
|
1732
|
-
return T.delete(x.id),
|
|
1732
|
+
return T.delete(x.id), L.length < 100 && (this.backwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1733
1733
|
}, c = h(e, /* @__PURE__ */ new Set()), g = r(e, /* @__PURE__ */ new Set());
|
|
1734
1734
|
this.getDirectlyConnectedTasks(t).forEach((x) => {
|
|
1735
1735
|
this.establishCacheDependency(t, x.id), this.establishCacheDependency(x.id, t);
|
|
@@ -1739,7 +1739,7 @@ const tt = class tt {
|
|
|
1739
1739
|
for (const w of x) {
|
|
1740
1740
|
w.forEach((C) => l.set(C.id, C));
|
|
1741
1741
|
for (let C = 0; C < w.length - 1; C++) {
|
|
1742
|
-
const
|
|
1742
|
+
const L = w[C].id, E = w[C + 1].id, v = this.findLinkFast(L, E);
|
|
1743
1743
|
if (v) {
|
|
1744
1744
|
const M = `${v.from}-${v.to}-${v.type || "default"}`;
|
|
1745
1745
|
m.has(M) || (b.push(v), m.set(M, v));
|
|
@@ -2111,22 +2111,22 @@ var Mt = { exports: {} };
|
|
|
2111
2111
|
(function(e, i) {
|
|
2112
2112
|
f.exports = i();
|
|
2113
2113
|
})(P, function() {
|
|
2114
|
-
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, h = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, g = 2628e6, d = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = { years: c, months: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(
|
|
2115
|
-
return
|
|
2116
|
-
}, p = function(
|
|
2117
|
-
return new w(
|
|
2118
|
-
}, u = function(
|
|
2119
|
-
return i.p(
|
|
2120
|
-
}, y = function(
|
|
2121
|
-
return
|
|
2122
|
-
}, x = function(
|
|
2123
|
-
return y(
|
|
2124
|
-
}, T = function(
|
|
2125
|
-
return Math.abs(
|
|
2126
|
-
}, b = function(
|
|
2127
|
-
return
|
|
2114
|
+
var e, i, s = 1e3, n = 6e4, o = 36e5, r = 864e5, h = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, c = 31536e6, g = 2628e6, d = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = { years: c, months: g, days: r, hours: o, minutes: n, seconds: s, milliseconds: 1, weeks: 6048e5 }, m = function(L) {
|
|
2115
|
+
return L instanceof w;
|
|
2116
|
+
}, p = function(L, E, v) {
|
|
2117
|
+
return new w(L, v, E.$l);
|
|
2118
|
+
}, u = function(L) {
|
|
2119
|
+
return i.p(L) + "s";
|
|
2120
|
+
}, y = function(L) {
|
|
2121
|
+
return L < 0;
|
|
2122
|
+
}, x = function(L) {
|
|
2123
|
+
return y(L) ? Math.ceil(L) : Math.floor(L);
|
|
2124
|
+
}, T = function(L) {
|
|
2125
|
+
return Math.abs(L);
|
|
2126
|
+
}, b = function(L, E) {
|
|
2127
|
+
return L ? y(L) ? { negative: !0, format: "" + T(L) + E } : { negative: !1, format: "" + L + E } : { negative: !1, format: "" };
|
|
2128
2128
|
}, w = function() {
|
|
2129
|
-
function
|
|
2129
|
+
function L(v, M, A) {
|
|
2130
2130
|
var _ = this;
|
|
2131
2131
|
if (this.$d = {}, this.$l = A, v === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), M) return p(v * l[u(M)], this);
|
|
2132
2132
|
if (typeof v == "number") return this.$ms = v, this.parseFromMilliseconds(), this;
|
|
@@ -2136,101 +2136,101 @@ var Mt = { exports: {} };
|
|
|
2136
2136
|
if (typeof v == "string") {
|
|
2137
2137
|
var D = v.match(d);
|
|
2138
2138
|
if (D) {
|
|
2139
|
-
var
|
|
2139
|
+
var H = D.slice(2).map(function(W) {
|
|
2140
2140
|
return W != null ? Number(W) : 0;
|
|
2141
2141
|
});
|
|
2142
|
-
return this.$d.years =
|
|
2142
|
+
return this.$d.years = H[0], this.$d.months = H[1], this.$d.weeks = H[2], this.$d.days = H[3], this.$d.hours = H[4], this.$d.minutes = H[5], this.$d.seconds = H[6], this.calMilliseconds(), this;
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
2145
2145
|
return this;
|
|
2146
2146
|
}
|
|
2147
|
-
var
|
|
2148
|
-
return
|
|
2147
|
+
var E = L.prototype;
|
|
2148
|
+
return E.calMilliseconds = function() {
|
|
2149
2149
|
var v = this;
|
|
2150
2150
|
this.$ms = Object.keys(this.$d).reduce(function(M, A) {
|
|
2151
2151
|
return M + (v.$d[A] || 0) * l[A];
|
|
2152
2152
|
}, 0);
|
|
2153
|
-
},
|
|
2153
|
+
}, E.parseFromMilliseconds = function() {
|
|
2154
2154
|
var v = this.$ms;
|
|
2155
2155
|
this.$d.years = x(v / c), v %= c, this.$d.months = x(v / g), v %= g, this.$d.days = x(v / r), v %= r, this.$d.hours = x(v / o), v %= o, this.$d.minutes = x(v / n), v %= n, this.$d.seconds = x(v / s), v %= s, this.$d.milliseconds = v;
|
|
2156
|
-
},
|
|
2156
|
+
}, E.toISOString = function() {
|
|
2157
2157
|
var v = b(this.$d.years, "Y"), M = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2158
2158
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
2159
|
-
var _ = b(A, "D"), D = b(this.$d.hours, "H"),
|
|
2159
|
+
var _ = b(A, "D"), D = b(this.$d.hours, "H"), H = b(this.$d.minutes, "M"), W = this.$d.seconds || 0;
|
|
2160
2160
|
this.$d.milliseconds && (W += this.$d.milliseconds / 1e3, W = Math.round(1e3 * W) / 1e3);
|
|
2161
|
-
var
|
|
2161
|
+
var I = b(W, "S"), R = v.negative || M.negative || _.negative || D.negative || H.negative || I.negative, F = D.format || H.format || I.format ? "T" : "", z = (R ? "-" : "") + "P" + v.format + M.format + _.format + F + D.format + H.format + I.format;
|
|
2162
2162
|
return z === "P" || z === "-P" ? "P0D" : z;
|
|
2163
|
-
},
|
|
2163
|
+
}, E.toJSON = function() {
|
|
2164
2164
|
return this.toISOString();
|
|
2165
|
-
},
|
|
2165
|
+
}, E.format = function(v) {
|
|
2166
2166
|
var M = v || "YYYY-MM-DDTHH:mm:ss", A = { Y: this.$d.years, YY: i.s(this.$d.years, 2, "0"), YYYY: i.s(this.$d.years, 4, "0"), M: this.$d.months, MM: i.s(this.$d.months, 2, "0"), D: this.$d.days, DD: i.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: i.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: i.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: i.s(this.$d.seconds, 2, "0"), SSS: i.s(this.$d.milliseconds, 3, "0") };
|
|
2167
2167
|
return M.replace(h, function(_, D) {
|
|
2168
2168
|
return D || String(A[_]);
|
|
2169
2169
|
});
|
|
2170
|
-
},
|
|
2170
|
+
}, E.as = function(v) {
|
|
2171
2171
|
return this.$ms / l[u(v)];
|
|
2172
|
-
},
|
|
2172
|
+
}, E.get = function(v) {
|
|
2173
2173
|
var M = this.$ms, A = u(v);
|
|
2174
2174
|
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ? x(M / l[A]) : this.$d[A], M || 0;
|
|
2175
|
-
},
|
|
2175
|
+
}, E.add = function(v, M, A) {
|
|
2176
2176
|
var _;
|
|
2177
2177
|
return _ = M ? v * l[u(M)] : m(v) ? v.$ms : p(v, this).$ms, p(this.$ms + _ * (A ? -1 : 1), this);
|
|
2178
|
-
},
|
|
2178
|
+
}, E.subtract = function(v, M) {
|
|
2179
2179
|
return this.add(v, M, !0);
|
|
2180
|
-
},
|
|
2180
|
+
}, E.locale = function(v) {
|
|
2181
2181
|
var M = this.clone();
|
|
2182
2182
|
return M.$l = v, M;
|
|
2183
|
-
},
|
|
2183
|
+
}, E.clone = function() {
|
|
2184
2184
|
return p(this.$ms, this);
|
|
2185
|
-
},
|
|
2185
|
+
}, E.humanize = function(v) {
|
|
2186
2186
|
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!v);
|
|
2187
|
-
},
|
|
2187
|
+
}, E.valueOf = function() {
|
|
2188
2188
|
return this.asMilliseconds();
|
|
2189
|
-
},
|
|
2189
|
+
}, E.milliseconds = function() {
|
|
2190
2190
|
return this.get("milliseconds");
|
|
2191
|
-
},
|
|
2191
|
+
}, E.asMilliseconds = function() {
|
|
2192
2192
|
return this.as("milliseconds");
|
|
2193
|
-
},
|
|
2193
|
+
}, E.seconds = function() {
|
|
2194
2194
|
return this.get("seconds");
|
|
2195
|
-
},
|
|
2195
|
+
}, E.asSeconds = function() {
|
|
2196
2196
|
return this.as("seconds");
|
|
2197
|
-
},
|
|
2197
|
+
}, E.minutes = function() {
|
|
2198
2198
|
return this.get("minutes");
|
|
2199
|
-
},
|
|
2199
|
+
}, E.asMinutes = function() {
|
|
2200
2200
|
return this.as("minutes");
|
|
2201
|
-
},
|
|
2201
|
+
}, E.hours = function() {
|
|
2202
2202
|
return this.get("hours");
|
|
2203
|
-
},
|
|
2203
|
+
}, E.asHours = function() {
|
|
2204
2204
|
return this.as("hours");
|
|
2205
|
-
},
|
|
2205
|
+
}, E.days = function() {
|
|
2206
2206
|
return this.get("days");
|
|
2207
|
-
},
|
|
2207
|
+
}, E.asDays = function() {
|
|
2208
2208
|
return this.as("days");
|
|
2209
|
-
},
|
|
2209
|
+
}, E.weeks = function() {
|
|
2210
2210
|
return this.get("weeks");
|
|
2211
|
-
},
|
|
2211
|
+
}, E.asWeeks = function() {
|
|
2212
2212
|
return this.as("weeks");
|
|
2213
|
-
},
|
|
2213
|
+
}, E.months = function() {
|
|
2214
2214
|
return this.get("months");
|
|
2215
|
-
},
|
|
2215
|
+
}, E.asMonths = function() {
|
|
2216
2216
|
return this.as("months");
|
|
2217
|
-
},
|
|
2217
|
+
}, E.years = function() {
|
|
2218
2218
|
return this.get("years");
|
|
2219
|
-
},
|
|
2219
|
+
}, E.asYears = function() {
|
|
2220
2220
|
return this.as("years");
|
|
2221
|
-
},
|
|
2222
|
-
}(), C = function(
|
|
2223
|
-
return
|
|
2221
|
+
}, L;
|
|
2222
|
+
}(), C = function(L, E, v) {
|
|
2223
|
+
return L.add(E.years() * v, "y").add(E.months() * v, "M").add(E.days() * v, "d").add(E.hours() * v, "h").add(E.minutes() * v, "m").add(E.seconds() * v, "s").add(E.milliseconds() * v, "ms");
|
|
2224
2224
|
};
|
|
2225
|
-
return function(
|
|
2225
|
+
return function(L, E, v) {
|
|
2226
2226
|
e = v, i = v().$utils(), v.duration = function(_, D) {
|
|
2227
|
-
var
|
|
2228
|
-
return p(_, { $l:
|
|
2227
|
+
var H = v.locale();
|
|
2228
|
+
return p(_, { $l: H }, D);
|
|
2229
2229
|
}, v.isDuration = m;
|
|
2230
|
-
var M =
|
|
2231
|
-
|
|
2230
|
+
var M = E.prototype.add, A = E.prototype.subtract;
|
|
2231
|
+
E.prototype.add = function(_, D) {
|
|
2232
2232
|
return m(_) ? C(this, _, 1) : M.bind(this)(_, D);
|
|
2233
|
-
},
|
|
2233
|
+
}, E.prototype.subtract = function(_, D) {
|
|
2234
2234
|
return m(_) ? C(this, _, -1) : A.bind(this)(_, D);
|
|
2235
2235
|
};
|
|
2236
2236
|
};
|
|
@@ -2295,8 +2295,8 @@ var At = { exports: {} };
|
|
|
2295
2295
|
});
|
|
2296
2296
|
if (!u) return b;
|
|
2297
2297
|
var w = y.weekStart;
|
|
2298
|
-
return b.map(function(C,
|
|
2299
|
-
return b[(
|
|
2298
|
+
return b.map(function(C, L) {
|
|
2299
|
+
return b[(L + (w || 0)) % 7];
|
|
2300
2300
|
});
|
|
2301
2301
|
}, h = function() {
|
|
2302
2302
|
return s.Ls[s.locale()];
|
|
@@ -2359,7 +2359,7 @@ var At = { exports: {} };
|
|
|
2359
2359
|
})(At);
|
|
2360
2360
|
var ce = At.exports;
|
|
2361
2361
|
const de = /* @__PURE__ */ U(ce);
|
|
2362
|
-
var
|
|
2362
|
+
var It = { exports: {} };
|
|
2363
2363
|
(function(f, t) {
|
|
2364
2364
|
(function(e, i) {
|
|
2365
2365
|
f.exports = i();
|
|
@@ -2381,10 +2381,10 @@ var Ht = { exports: {} };
|
|
|
2381
2381
|
};
|
|
2382
2382
|
};
|
|
2383
2383
|
});
|
|
2384
|
-
})(
|
|
2385
|
-
var ue =
|
|
2384
|
+
})(It);
|
|
2385
|
+
var ue = It.exports;
|
|
2386
2386
|
const ge = /* @__PURE__ */ U(ue);
|
|
2387
|
-
var
|
|
2387
|
+
var Ht = { exports: {} };
|
|
2388
2388
|
(function(f, t) {
|
|
2389
2389
|
(function(e, i) {
|
|
2390
2390
|
f.exports = i();
|
|
@@ -2396,8 +2396,8 @@ var It = { exports: {} };
|
|
|
2396
2396
|
};
|
|
2397
2397
|
};
|
|
2398
2398
|
});
|
|
2399
|
-
})(
|
|
2400
|
-
var fe =
|
|
2399
|
+
})(Ht);
|
|
2400
|
+
var fe = Ht.exports;
|
|
2401
2401
|
const pe = /* @__PURE__ */ U(fe);
|
|
2402
2402
|
var Gt = { exports: {} };
|
|
2403
2403
|
(function(f, t) {
|
|
@@ -2515,8 +2515,8 @@ var $t = { exports: {} };
|
|
|
2515
2515
|
var x = p[y], T = x.type, b = x.value, w = e[T];
|
|
2516
2516
|
w >= 0 && (u[w] = parseInt(b, 10));
|
|
2517
2517
|
}
|
|
2518
|
-
var C = u[3],
|
|
2519
|
-
return (o.utc(
|
|
2518
|
+
var C = u[3], L = C === 24 ? 0 : C, E = u[0] + "-" + u[1] + "-" + u[2] + " " + L + ":" + u[4] + ":" + u[5] + ":000", v = +l;
|
|
2519
|
+
return (o.utc(E).valueOf() - (v -= v % 1e3)) / 6e4;
|
|
2520
2520
|
}, g = n.prototype;
|
|
2521
2521
|
g.tz = function(l, m) {
|
|
2522
2522
|
l === void 0 && (l = r);
|
|
@@ -2541,11 +2541,11 @@ var $t = { exports: {} };
|
|
|
2541
2541
|
}, o.tz = function(l, m, p) {
|
|
2542
2542
|
var u = p && m, y = p || m || r, x = c(+o(), y);
|
|
2543
2543
|
if (typeof l != "string") return o(l).tz(y);
|
|
2544
|
-
var T = function(
|
|
2545
|
-
var M =
|
|
2546
|
-
if (
|
|
2547
|
-
var _ = c(M -= 60 * (A -
|
|
2548
|
-
return A === _ ? [M, A] : [
|
|
2544
|
+
var T = function(L, E, v) {
|
|
2545
|
+
var M = L - 60 * E * 1e3, A = c(M, v);
|
|
2546
|
+
if (E === A) return [M, E];
|
|
2547
|
+
var _ = c(M -= 60 * (A - E) * 1e3, v);
|
|
2548
|
+
return A === _ ? [M, A] : [L - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
2549
2549
|
}(o.utc(l, u).valueOf(), x, y), b = T[0], w = T[1], C = o(b).utcOffset(w);
|
|
2550
2550
|
return C.$x.$timezone = y, C;
|
|
2551
2551
|
}, o.tz.guess = function() {
|
|
@@ -2592,9 +2592,9 @@ var Ft = { exports: {} };
|
|
|
2592
2592
|
if (x(u)) return this.$u ? 0 : x(this.$offset) ? d.call(this) : this.$offset;
|
|
2593
2593
|
if (typeof u == "string" && (u = function(C) {
|
|
2594
2594
|
C === void 0 && (C = "");
|
|
2595
|
-
var
|
|
2596
|
-
if (!
|
|
2597
|
-
var
|
|
2595
|
+
var L = C.match(i);
|
|
2596
|
+
if (!L) return null;
|
|
2597
|
+
var E = ("" + L[0]).match(s) || ["-", 0, 0], v = E[0], M = 60 * +E[1] + +E[2];
|
|
2598
2598
|
return M === 0 ? 0 : v === "+" ? M : -M;
|
|
2599
2599
|
}(u), u === null)) return this;
|
|
2600
2600
|
var T = Math.abs(u) <= 16 ? 60 * u : u, b = this;
|
|
@@ -2633,8 +2633,8 @@ var Ft = { exports: {} };
|
|
|
2633
2633
|
});
|
|
2634
2634
|
})(Ft);
|
|
2635
2635
|
var ke = Ft.exports;
|
|
2636
|
-
const
|
|
2637
|
-
var
|
|
2636
|
+
const Ee = /* @__PURE__ */ U(ke);
|
|
2637
|
+
var Ce = { exports: {} };
|
|
2638
2638
|
(function(f, t) {
|
|
2639
2639
|
(function(e, i) {
|
|
2640
2640
|
f.exports = i();
|
|
@@ -2644,8 +2644,8 @@ var Le = { exports: {} };
|
|
|
2644
2644
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
2645
2645
|
} };
|
|
2646
2646
|
});
|
|
2647
|
-
})(
|
|
2648
|
-
var
|
|
2647
|
+
})(Ce);
|
|
2648
|
+
var Le = { exports: {} };
|
|
2649
2649
|
(function(f, t) {
|
|
2650
2650
|
(function(e, i) {
|
|
2651
2651
|
f.exports = i(G);
|
|
@@ -2661,7 +2661,7 @@ var Ee = { exports: {} };
|
|
|
2661
2661
|
} };
|
|
2662
2662
|
return s.default.locale(n, null, !0), n;
|
|
2663
2663
|
});
|
|
2664
|
-
})(
|
|
2664
|
+
})(Le);
|
|
2665
2665
|
const Me = (f, t) => {
|
|
2666
2666
|
const e = t.prototype;
|
|
2667
2667
|
e.setLocale = function(s) {
|
|
@@ -2683,7 +2683,7 @@ G.extend(xe);
|
|
|
2683
2683
|
G.extend(we);
|
|
2684
2684
|
G.extend(Te);
|
|
2685
2685
|
G.extend(Se);
|
|
2686
|
-
G.extend(
|
|
2686
|
+
G.extend(Ee);
|
|
2687
2687
|
G.extend(Me);
|
|
2688
2688
|
function vt(f) {
|
|
2689
2689
|
try {
|
|
@@ -2807,9 +2807,9 @@ class Oe {
|
|
|
2807
2807
|
week: s.cellWidth,
|
|
2808
2808
|
month: s.cellWidth,
|
|
2809
2809
|
quarter: s.cellWidth
|
|
2810
|
-
} :
|
|
2810
|
+
} : K(s.cellWidth) ? this.cellWidth = Z(
|
|
2811
2811
|
ut()[s.cellWidth] || ut().normal
|
|
2812
|
-
) :
|
|
2812
|
+
) : Et(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2813
2813
|
}
|
|
2814
2814
|
update(t) {
|
|
2815
2815
|
this.init(t, !1), this.endTime = this.targetEnd.clone();
|
|
@@ -2887,7 +2887,7 @@ class Oe {
|
|
|
2887
2887
|
const i = this.headerGroupFormat(t.toDate(), this.unit);
|
|
2888
2888
|
if (i) return i;
|
|
2889
2889
|
}
|
|
2890
|
-
if (
|
|
2890
|
+
if (K(this.headerGroupFormat))
|
|
2891
2891
|
return t.format(this.headerGroupFormat);
|
|
2892
2892
|
switch (this.getGroupUnit()) {
|
|
2893
2893
|
case "month":
|
|
@@ -2907,7 +2907,7 @@ class Oe {
|
|
|
2907
2907
|
const i = this.headerCellFormat(t.toDate(), this.unit);
|
|
2908
2908
|
if (i) return i;
|
|
2909
2909
|
}
|
|
2910
|
-
if (
|
|
2910
|
+
if (K(this.headerCellFormat))
|
|
2911
2911
|
return t.format(this.headerCellFormat);
|
|
2912
2912
|
switch (this.getChildUnit()) {
|
|
2913
2913
|
case "hour":
|
|
@@ -2956,7 +2956,7 @@ class De {
|
|
|
2956
2956
|
const i = yt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2957
2957
|
if (s && !X(s))
|
|
2958
2958
|
throw O.exception("Data should be a array.");
|
|
2959
|
-
this.optionManager = new
|
|
2959
|
+
this.optionManager = new Vt(), this.optionManager.setOptions(i), i.locale && vt(i.locale), this.timeAxis = new Oe(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new ee(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new Jt(this, this.context.event), s && this.dataManager.setData(s, !0), (n = e == null ? void 0 : e.baselines) != null && n.data && this.dataManager.setBaselines(e.baselines.data), this.linkManager = new ft(this, this.context.event), X((o = e == null ? void 0 : e.links) == null ? void 0 : o.data) && this.linkManager.setLinks(e.links.data, !0), this.linkManager.setCycleDetection(((r = e == null ? void 0 : e.links) == null ? void 0 : r.enableCycleDetection) ?? !0);
|
|
2960
2960
|
}
|
|
2961
2961
|
getOptionManager() {
|
|
2962
2962
|
return this.optionManager;
|
|
@@ -3191,7 +3191,7 @@ class _e {
|
|
|
3191
3191
|
}
|
|
3192
3192
|
// --- 事件处理 ---
|
|
3193
3193
|
emit(t, e, i) {
|
|
3194
|
-
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(
|
|
3194
|
+
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(k.SCROLL, {
|
|
3195
3195
|
x: this.scrollLeft,
|
|
3196
3196
|
y: this.scrollTop,
|
|
3197
3197
|
source: t
|
|
@@ -3465,7 +3465,7 @@ class st {
|
|
|
3465
3465
|
const t = document.createElement("div");
|
|
3466
3466
|
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", t.style.whiteSpace = "nowrap", t.style.display = "inline-flex", t.style.flex = "1", t.style.height = "100%", this.context.getOptions().selection.enabled) {
|
|
3467
3467
|
const e = document.createElement("div");
|
|
3468
|
-
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new
|
|
3468
|
+
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new Lt(this.context, e, this.task), t.appendChild(e);
|
|
3469
3469
|
}
|
|
3470
3470
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
3471
3471
|
const e = document.createElement("div");
|
|
@@ -3521,28 +3521,28 @@ class St {
|
|
|
3521
3521
|
*/
|
|
3522
3522
|
bindEvents() {
|
|
3523
3523
|
this.element.addEventListener("mouseenter", () => {
|
|
3524
|
-
this.context.event.emit(
|
|
3524
|
+
this.context.event.emit(k.ROW_HIGHLIGHT, this.task.id);
|
|
3525
3525
|
}), this.element.addEventListener("mouseleave", () => {
|
|
3526
|
-
this.context.event.emit(
|
|
3526
|
+
this.context.event.emit(k.ROW_UNHIGHLIGHT, this.task.id);
|
|
3527
3527
|
}), this.element.addEventListener("click", (t) => {
|
|
3528
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3528
|
+
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(k.ROW_CLICK, t, this.task));
|
|
3529
3529
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
3530
|
-
this.context.event.emit(
|
|
3530
|
+
this.context.event.emit(k.ROW_DBL_CLICK, t, this.task);
|
|
3531
3531
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
3532
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3532
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(k.ROW_CONTEXTMENU, t, this.task);
|
|
3533
3533
|
});
|
|
3534
3534
|
}
|
|
3535
3535
|
/**
|
|
3536
3536
|
* 注册全局接收事件
|
|
3537
3537
|
*/
|
|
3538
3538
|
registerEvents() {
|
|
3539
|
-
this.context.event.on(
|
|
3539
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
3540
3540
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
3541
|
-
}), this.context.event.on(
|
|
3541
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
3542
3542
|
this.task.id === t && this.element.classList.remove("hover");
|
|
3543
|
-
}), this.context.event.on(
|
|
3543
|
+
}), this.context.event.on(k.TASK_SELECTED, (t) => {
|
|
3544
3544
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
3545
|
-
}), this.context.event.on(
|
|
3545
|
+
}), this.context.event.on(k.TASK_UNSELECTED, (t) => {
|
|
3546
3546
|
this.task.id === t && this.element.classList.remove("selected");
|
|
3547
3547
|
});
|
|
3548
3548
|
}
|
|
@@ -3813,14 +3813,14 @@ class pt {
|
|
|
3813
3813
|
const o = (c) => {
|
|
3814
3814
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3815
3815
|
const g = (l) => r(l), d = (l) => h(l, g, d);
|
|
3816
|
-
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(
|
|
3816
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(k.SHOW_GUIDELINE, n);
|
|
3817
3817
|
}, r = (c) => {
|
|
3818
3818
|
if (c.preventDefault(), !s) return;
|
|
3819
3819
|
const g = c.clientX - e, d = i + g, l = Math.max(50, d), m = e - s.left - i, u = this.root.clientWidth - 20;
|
|
3820
3820
|
let y = m + l;
|
|
3821
|
-
y = Math.min(u, y), this.context.event.emit(
|
|
3821
|
+
y = Math.min(u, y), this.context.event.emit(k.MOVE_GUIDELINE, y);
|
|
3822
3822
|
}, h = (c, g, d) => {
|
|
3823
|
-
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(
|
|
3823
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(k.HIDE_GUIDELINE);
|
|
3824
3824
|
const l = c.clientX - e, m = Math.max(50, i + l);
|
|
3825
3825
|
this.setWidth(m);
|
|
3826
3826
|
};
|
|
@@ -3871,7 +3871,7 @@ class xt {
|
|
|
3871
3871
|
});
|
|
3872
3872
|
}
|
|
3873
3873
|
}
|
|
3874
|
-
class
|
|
3874
|
+
class Ie {
|
|
3875
3875
|
constructor(t, e) {
|
|
3876
3876
|
a(this, "headerElement");
|
|
3877
3877
|
a(this, "headerColumns", []);
|
|
@@ -3931,12 +3931,12 @@ class He {
|
|
|
3931
3931
|
});
|
|
3932
3932
|
}
|
|
3933
3933
|
}
|
|
3934
|
-
class
|
|
3934
|
+
class He {
|
|
3935
3935
|
constructor(t, e) {
|
|
3936
3936
|
a(this, "tableContainer");
|
|
3937
3937
|
a(this, "tableHeader");
|
|
3938
3938
|
a(this, "tableBody");
|
|
3939
|
-
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
|
|
3939
|
+
this.context = t, this.container = e, this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table-container", this.tableContainer.style.position = "relative", this.tableContainer.style.width = "100%", this.tableContainer.style.height = "100%", this.tableContainer.style.overflow = "hidden", this.tableContainer.style.display = "flex", this.tableContainer.style.flexDirection = "column", this.container.appendChild(this.tableContainer), this.tableHeader = new Ie(t, this.tableContainer), this.tableBody = new Ae(t, this.tableContainer), this.listenEvents();
|
|
3940
3940
|
}
|
|
3941
3941
|
render(t, e) {
|
|
3942
3942
|
this.tableHeader.render(), this.refresh(t, e);
|
|
@@ -3951,9 +3951,9 @@ class Ie {
|
|
|
3951
3951
|
this.tableBody.updateTask(t);
|
|
3952
3952
|
}
|
|
3953
3953
|
listenEvents() {
|
|
3954
|
-
this.context.event.on(
|
|
3954
|
+
this.context.event.on(k.UPDATE_TABLE_HEADER, () => {
|
|
3955
3955
|
this.tableHeader.render();
|
|
3956
|
-
}), this.context.event.on(
|
|
3956
|
+
}), this.context.event.on(k.UPDATE_TABLE_BODY, () => {
|
|
3957
3957
|
this.tableBody.update();
|
|
3958
3958
|
});
|
|
3959
3959
|
}
|
|
@@ -3993,11 +3993,11 @@ class Ge {
|
|
|
3993
3993
|
* 注册事件监听
|
|
3994
3994
|
*/
|
|
3995
3995
|
registerEvents() {
|
|
3996
|
-
this.context.event.on(
|
|
3996
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
3997
3997
|
this.highlightDate(t);
|
|
3998
|
-
}), this.context.event.on(
|
|
3998
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
3999
3999
|
this.unhighlightDate(t);
|
|
4000
|
-
}), this.context.event.on(
|
|
4000
|
+
}), this.context.event.on(k.UPDATE_TASK, (t) => {
|
|
4001
4001
|
this.highlightDate(t.id);
|
|
4002
4002
|
});
|
|
4003
4003
|
}
|
|
@@ -4054,10 +4054,10 @@ class Ge {
|
|
|
4054
4054
|
for (; d.children[y + T] && x.label === d.children[y + T].label; )
|
|
4055
4055
|
T++;
|
|
4056
4056
|
if (y += T, y >= d.children.length && r[g + 1] && r[g + 1].children) {
|
|
4057
|
-
let
|
|
4058
|
-
for (; r[g + 1].children[
|
|
4059
|
-
r[g + 1].children[
|
|
4060
|
-
|
|
4057
|
+
let L = 0;
|
|
4058
|
+
for (; r[g + 1].children[L] && x.label === r[g + 1].children[L].label; )
|
|
4059
|
+
r[g + 1].children[L].hide = !0, L++;
|
|
4060
|
+
L > 0 && (T += L);
|
|
4061
4061
|
}
|
|
4062
4062
|
const b = e * T;
|
|
4063
4063
|
if (u + b < i) {
|
|
@@ -4303,12 +4303,12 @@ class We {
|
|
|
4303
4303
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
4304
4304
|
}
|
|
4305
4305
|
registerEvents() {
|
|
4306
|
-
this.context.event.on(
|
|
4306
|
+
this.context.event.on(k.SLIDER_BLINK, (t) => {
|
|
4307
4307
|
t === this.task.id && this.handleBarBlink();
|
|
4308
4308
|
});
|
|
4309
4309
|
}
|
|
4310
4310
|
render() {
|
|
4311
|
-
var p, u, y, x, T, b, w, C,
|
|
4311
|
+
var p, u, y, x, T, b, w, C, L, E, v, M, A;
|
|
4312
4312
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4313
4313
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4314
4314
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
@@ -4323,8 +4323,8 @@ class We {
|
|
|
4323
4323
|
this.slider || (this.slider = new S.Group({
|
|
4324
4324
|
dragBoundFunc: (_) => {
|
|
4325
4325
|
let D = Math.min(0, -(-this.offsetX - this.slider.x()));
|
|
4326
|
-
const
|
|
4327
|
-
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(
|
|
4326
|
+
const H = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime);
|
|
4327
|
+
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(H - (-this.offsetX + this.sliderGroup.getStage().width()));
|
|
4328
4328
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
4329
4329
|
if (this.task.parent.startTime) {
|
|
4330
4330
|
const R = this.task.parent.startTime;
|
|
@@ -4348,17 +4348,19 @@ class We {
|
|
|
4348
4348
|
shadowBlur: Math.max((g || 1) * 2, 4),
|
|
4349
4349
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4350
4350
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4351
|
-
}), this.context.event.emit(
|
|
4351
|
+
}), this.context.event.emit(k.SLIDER_ENTER, _.evt, this.task);
|
|
4352
|
+
}), this.slider.on("mousemove", (_) => {
|
|
4353
|
+
this.context.event.emit(k.SLIDER_HOVER, _.evt, this.task);
|
|
4352
4354
|
}), this.slider.on("mouseout", (_) => {
|
|
4353
4355
|
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4354
4356
|
shadowColor: c,
|
|
4355
4357
|
shadowBlur: g,
|
|
4356
4358
|
shadowOffsetX: d,
|
|
4357
4359
|
shadowOffsetY: l
|
|
4358
|
-
}), this.context.event.emit(
|
|
4360
|
+
}), this.context.event.emit(k.SLIDER_LEAVE, _.evt, this.task);
|
|
4359
4361
|
}), this.task.isMilestone()) {
|
|
4360
4362
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4361
|
-
const _ = this.unpackFunc(this.context.getOptions().milestone.size), D = Math.min(_ || e, t / 2),
|
|
4363
|
+
const _ = this.unpackFunc(this.context.getOptions().milestone.size), D = Math.min(_ || e, t / 2), H = this.unpackFunc(this.context.getOptions().milestone.color) || r, W = this.unpackFunc(this.context.getOptions().milestone.border.color), I = this.unpackFunc(this.context.getOptions().milestone.border.width), R = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
4362
4364
|
if (!this.sliderBar) {
|
|
4363
4365
|
switch (R) {
|
|
4364
4366
|
case "triangle":
|
|
@@ -4366,9 +4368,9 @@ class We {
|
|
|
4366
4368
|
sides: 3,
|
|
4367
4369
|
radius: D,
|
|
4368
4370
|
rotation: 0,
|
|
4369
|
-
fill:
|
|
4371
|
+
fill: H,
|
|
4370
4372
|
stroke: W,
|
|
4371
|
-
strokeWidth:
|
|
4373
|
+
strokeWidth: I,
|
|
4372
4374
|
y: D / 3 * 2
|
|
4373
4375
|
// 居中
|
|
4374
4376
|
});
|
|
@@ -4376,9 +4378,9 @@ class We {
|
|
|
4376
4378
|
case "circle":
|
|
4377
4379
|
this.sliderBar = new S.Circle({
|
|
4378
4380
|
radius: D,
|
|
4379
|
-
fill:
|
|
4381
|
+
fill: H,
|
|
4380
4382
|
stroke: W,
|
|
4381
|
-
strokeWidth:
|
|
4383
|
+
strokeWidth: I,
|
|
4382
4384
|
y: D / 2
|
|
4383
4385
|
// 居中
|
|
4384
4386
|
});
|
|
@@ -4388,9 +4390,9 @@ class We {
|
|
|
4388
4390
|
numPoints: 5,
|
|
4389
4391
|
innerRadius: D / 2,
|
|
4390
4392
|
outerRadius: D,
|
|
4391
|
-
fill:
|
|
4393
|
+
fill: H,
|
|
4392
4394
|
stroke: W,
|
|
4393
|
-
strokeWidth:
|
|
4395
|
+
strokeWidth: I,
|
|
4394
4396
|
y: D / 2
|
|
4395
4397
|
// 居中
|
|
4396
4398
|
});
|
|
@@ -4401,9 +4403,9 @@ class We {
|
|
|
4401
4403
|
sides: 4,
|
|
4402
4404
|
radius: D,
|
|
4403
4405
|
rotation: 0,
|
|
4404
|
-
fill:
|
|
4406
|
+
fill: H,
|
|
4405
4407
|
stroke: W,
|
|
4406
|
-
strokeWidth:
|
|
4408
|
+
strokeWidth: I,
|
|
4407
4409
|
y: D / 2
|
|
4408
4410
|
// 居中
|
|
4409
4411
|
});
|
|
@@ -4412,45 +4414,45 @@ class We {
|
|
|
4412
4414
|
const F = this.unpackFunc(this.context.getOptions().milestone.label.text), z = this.unpackFunc(this.context.getOptions().milestone.label.position), q = this.unpackFunc(this.context.getOptions().milestone.label.fontSize), zt = this.unpackFunc(this.context.getOptions().milestone.label.fontFamily), Nt = this.unpackFunc(this.context.getOptions().milestone.label.color), it = new S.Text({
|
|
4413
4415
|
height: e,
|
|
4414
4416
|
text: F,
|
|
4415
|
-
fill: Nt ||
|
|
4417
|
+
fill: Nt || H,
|
|
4416
4418
|
fontSize: q,
|
|
4417
4419
|
fontFamily: zt
|
|
4418
4420
|
}), at = it.measureSize(F);
|
|
4419
4421
|
it.width(at.width);
|
|
4420
|
-
const
|
|
4422
|
+
const V = { x: 0, y: 0 };
|
|
4421
4423
|
switch (z) {
|
|
4422
4424
|
case "top-left":
|
|
4423
|
-
|
|
4425
|
+
V.x = -(12 + at.width), V.y = -8;
|
|
4424
4426
|
break;
|
|
4425
4427
|
case "bottom-left":
|
|
4426
|
-
|
|
4428
|
+
V.x = -(12 + at.width), V.y = 10;
|
|
4427
4429
|
break;
|
|
4428
4430
|
case "bottom-right":
|
|
4429
|
-
|
|
4431
|
+
V.x = 12, V.y = 10;
|
|
4430
4432
|
break;
|
|
4431
4433
|
case "top-right":
|
|
4432
4434
|
default:
|
|
4433
|
-
|
|
4435
|
+
V.x = 12, V.y = -8;
|
|
4434
4436
|
break;
|
|
4435
4437
|
}
|
|
4436
|
-
it.setAttrs(
|
|
4438
|
+
it.setAttrs(V), this.slider.add(it);
|
|
4437
4439
|
}
|
|
4438
4440
|
}
|
|
4439
4441
|
this.sliderType = "milestone";
|
|
4440
4442
|
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
4441
4443
|
this.sliderBar && this.sliderType !== "summary" && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4442
|
-
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2,
|
|
4444
|
+
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2, H = t * 0.3, W = (I) => new S.Shape({
|
|
4443
4445
|
sceneFunc: (R, F) => {
|
|
4444
|
-
const z =
|
|
4445
|
-
R.beginPath(), R.moveTo(0, (t - D) / 2), R.lineTo(z, (t - D) / 2), R.lineTo(z, (t - D) / 2 + D), R.lineTo(0, (t - D) / 2 + D +
|
|
4446
|
+
const z = H * 0.5;
|
|
4447
|
+
R.beginPath(), R.moveTo(0, (t - D) / 2), R.lineTo(z, (t - D) / 2), R.lineTo(z, (t - D) / 2 + D), R.lineTo(0, (t - D) / 2 + D + H), R.lineTo(0, (t - D) / 2), R.rect(z, (t - D) / 2, I - 2 * z, D), R.moveTo(I - z, (t - D) / 2), R.lineTo(I, (t - D) / 2), R.lineTo(I, (t - D) / 2 + D + H), R.lineTo(I - z, (t - D) / 2 + D), R.lineTo(I - z, (t - D) / 2), R.fillStrokeShape(F);
|
|
4446
4448
|
},
|
|
4447
|
-
width:
|
|
4449
|
+
width: I,
|
|
4448
4450
|
fill: _,
|
|
4449
4451
|
shadowColor: c,
|
|
4450
4452
|
shadowBlur: g,
|
|
4451
4453
|
shadowOffsetX: d,
|
|
4452
4454
|
shadowOffsetY: l,
|
|
4453
|
-
y: -(
|
|
4455
|
+
y: -(H + D) / 2 - i / 2
|
|
4454
4456
|
});
|
|
4455
4457
|
!this.sliderBar || this.sliderBar.width() !== o ? (this.sliderBar && this.sliderBar.destroy(), this.sliderBar = W(o), this.slider.add(this.sliderBar)) : this.sliderBar.setAttrs({
|
|
4456
4458
|
fill: _,
|
|
@@ -4469,7 +4471,7 @@ class We {
|
|
|
4469
4471
|
fill: r,
|
|
4470
4472
|
cornerRadius: h
|
|
4471
4473
|
}), this.renderProgress(o, e);
|
|
4472
|
-
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (u = this.context.getOptions().bar.move.single) == null ? void 0 : u.backgroundColor,
|
|
4474
|
+
const _ = (p = this.context.getOptions().bar.move.single) == null ? void 0 : p.icon, D = (u = this.context.getOptions().bar.move.single) == null ? void 0 : u.backgroundColor, H = D ? B(D).alpha(((y = this.context.getOptions().bar.move.single) == null ? void 0 : y.opacity) ?? 1).toHex() : B(r).brighten(30 * (this.unpackFunc((x = this.context.getOptions().bar.progress) == null ? void 0 : x.show) ? -1 : 1)).alpha(((T = this.context.getOptions().bar.move.single) == null ? void 0 : T.opacity) ?? 1).toHex();
|
|
4473
4475
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
4474
4476
|
if (!this.leftHandleGroup) {
|
|
4475
4477
|
this.leftHandleGroup = new S.Group({
|
|
@@ -4504,7 +4506,7 @@ class We {
|
|
|
4504
4506
|
(w = this.leftHandleGroup.findOne("Rect")) == null || w.setAttrs({
|
|
4505
4507
|
width: this.handlerWidth,
|
|
4506
4508
|
height: e,
|
|
4507
|
-
fill:
|
|
4509
|
+
fill: H,
|
|
4508
4510
|
cornerRadius: [h[0], 0, 0, h[3]]
|
|
4509
4511
|
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
4510
4512
|
x: 0,
|
|
@@ -4513,7 +4515,7 @@ class We {
|
|
|
4513
4515
|
height: this.handlerWidth
|
|
4514
4516
|
});
|
|
4515
4517
|
} else this.leftHandleGroup && (this.leftHandleGroup.remove(), this.leftHandleGroup = null);
|
|
4516
|
-
if (!!this.unpackFunc((
|
|
4518
|
+
if (!!this.unpackFunc((L = this.context.getOptions().bar.move.single) == null ? void 0 : L.right)) {
|
|
4517
4519
|
if (!this.rightHandleGroup) {
|
|
4518
4520
|
this.rightHandleGroup = new S.Group({
|
|
4519
4521
|
x: 0,
|
|
@@ -4544,11 +4546,11 @@ class We {
|
|
|
4544
4546
|
(q = this.rightHandleGroup) == null || q.add(z);
|
|
4545
4547
|
});
|
|
4546
4548
|
}
|
|
4547
|
-
(
|
|
4549
|
+
(E = this.rightHandleGroup.findOne("Rect")) == null || E.setAttrs({
|
|
4548
4550
|
x: o - this.handlerWidth,
|
|
4549
4551
|
width: this.handlerWidth,
|
|
4550
4552
|
height: e,
|
|
4551
|
-
fill:
|
|
4553
|
+
fill: H,
|
|
4552
4554
|
cornerRadius: [0, h[1], h[2], 0]
|
|
4553
4555
|
}), (v = this.rightHandleGroup.findOne("Image")) == null || v.setAttrs({
|
|
4554
4556
|
x: o - this.handlerWidth,
|
|
@@ -4637,16 +4639,16 @@ class We {
|
|
|
4637
4639
|
opacity: this.unpackFunc((h = this.context.getOptions().bar.progress) == null ? void 0 : h.opacity)
|
|
4638
4640
|
});
|
|
4639
4641
|
this.progressGroup.add(C);
|
|
4640
|
-
const
|
|
4642
|
+
const L = `${gt(
|
|
4641
4643
|
u * 100,
|
|
4642
4644
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4643
|
-
)}%`,
|
|
4645
|
+
)}%`, E = new S.Text().measureSize(L).width, v = this.unpackFunc((g = this.context.getOptions().bar.progress) == null ? void 0 : g.textAlign), M = new S.Text({
|
|
4644
4646
|
x: 0,
|
|
4645
4647
|
y: v === "top" ? -e : 0,
|
|
4646
|
-
width: v === "right" ? w +
|
|
4648
|
+
width: v === "right" ? w + E : Math.max(w, E),
|
|
4647
4649
|
height: e,
|
|
4648
4650
|
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(x, 50).alpha(0.7).toHex(),
|
|
4649
|
-
text:
|
|
4651
|
+
text: L,
|
|
4650
4652
|
fontSize: this.unpackFunc((l = this.context.getOptions().bar.progress) == null ? void 0 : l.fontSize) || 10,
|
|
4651
4653
|
fontStyle: this.unpackFunc((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontStyle) || "italic",
|
|
4652
4654
|
fontFamily: "Arial",
|
|
@@ -4667,11 +4669,11 @@ class We {
|
|
|
4667
4669
|
const e = t.target.getStage();
|
|
4668
4670
|
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
4669
4671
|
}), this.slider.on("click", (t) => {
|
|
4670
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
4672
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(k.SLIDER_CLICK, t.evt, this.task));
|
|
4671
4673
|
}), this.slider.on("contextmenu", (t) => {
|
|
4672
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
4674
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(k.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
4673
4675
|
}), this.slider.on("dblclick", (t) => {
|
|
4674
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
4676
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(k.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
4675
4677
|
}));
|
|
4676
4678
|
}
|
|
4677
4679
|
/**
|
|
@@ -4684,7 +4686,7 @@ class We {
|
|
|
4684
4686
|
handleDragStart(t) {
|
|
4685
4687
|
const e = t.target.getStage();
|
|
4686
4688
|
if (!e) return;
|
|
4687
|
-
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(
|
|
4689
|
+
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(k.SLIDER_DRAGGING, !0), e.container().style.cursor = "grabbing";
|
|
4688
4690
|
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ct(i, s);
|
|
4689
4691
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4690
4692
|
}
|
|
@@ -4697,7 +4699,7 @@ class We {
|
|
|
4697
4699
|
}
|
|
4698
4700
|
handleDragEnd(t) {
|
|
4699
4701
|
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.dragDiffX = 0, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
4700
|
-
|
|
4702
|
+
k.TASK_DRAG_END,
|
|
4701
4703
|
this.task,
|
|
4702
4704
|
this.oldTasks
|
|
4703
4705
|
), this.oldTasks = []);
|
|
@@ -4717,7 +4719,7 @@ class We {
|
|
|
4717
4719
|
}
|
|
4718
4720
|
}
|
|
4719
4721
|
}
|
|
4720
|
-
this.context.event.emit(
|
|
4722
|
+
this.context.event.emit(k.SLIDER_DRAGGING, !1);
|
|
4721
4723
|
}
|
|
4722
4724
|
handleMove(t, e) {
|
|
4723
4725
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = t.target.width(), h = t.target.x(), c = h + r, g = Math.max(0, -this.offsetX - h), d = Math.max(0, c - (-this.offsetX + i));
|
|
@@ -4759,13 +4761,13 @@ class We {
|
|
|
4759
4761
|
t.cancelBubble = !0;
|
|
4760
4762
|
const i = t.target.getStage();
|
|
4761
4763
|
if (!i) return;
|
|
4762
|
-
this.isDragging = !0, this.context.event.emit(
|
|
4764
|
+
this.isDragging = !0, this.context.event.emit(k.SLIDER_DRAGGING, !0);
|
|
4763
4765
|
let s = ((y = i.getPointerPosition()) == null ? void 0 : y.x) || 0;
|
|
4764
4766
|
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, h = i.width();
|
|
4765
4767
|
let c = 0, g = 0;
|
|
4766
4768
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4767
|
-
const x = this.slider.width(), T = this.slider.x(), b = T + x, w = -this.offsetX, C = w + h,
|
|
4768
|
-
if (
|
|
4769
|
+
const x = this.slider.width(), T = this.slider.x(), b = T + x, w = -this.offsetX, C = w + h, L = T <= w + this.EDGE_THRESHOLD, E = b >= C - this.EDGE_THRESHOLD;
|
|
4770
|
+
if (L && e === "left") {
|
|
4769
4771
|
if (w <= 0)
|
|
4770
4772
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4771
4773
|
else if (this.draggingDirection === "left") {
|
|
@@ -4776,7 +4778,7 @@ class We {
|
|
|
4776
4778
|
} else
|
|
4777
4779
|
this.stopAutoScroll();
|
|
4778
4780
|
this.emitUpdate("left");
|
|
4779
|
-
} else if (
|
|
4781
|
+
} else if (E && e === "right") {
|
|
4780
4782
|
if (C >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4781
4783
|
this.slider.width(
|
|
4782
4784
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
@@ -4819,7 +4821,7 @@ class We {
|
|
|
4819
4821
|
if (this.autoExpandTimer) return;
|
|
4820
4822
|
const s = this.context.store.getTimeAxis();
|
|
4821
4823
|
this.autoExpandTimer = window.setInterval(() => {
|
|
4822
|
-
s.expand(t, 1), this.context.event.emit(
|
|
4824
|
+
s.expand(t, 1), this.context.event.emit(k.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(e);
|
|
4823
4825
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
4824
4826
|
}
|
|
4825
4827
|
// 开始自动滚动
|
|
@@ -5007,13 +5009,13 @@ class Fe {
|
|
|
5007
5009
|
* 注册事件监听
|
|
5008
5010
|
*/
|
|
5009
5011
|
registerEvents() {
|
|
5010
|
-
this.context.event.on(
|
|
5012
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
5011
5013
|
this.highlightRow(t);
|
|
5012
|
-
}), this.context.event.on(
|
|
5014
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
5013
5015
|
this.unhighlightRow(t);
|
|
5014
|
-
}), this.context.event.on(
|
|
5016
|
+
}), this.context.event.on(k.TASK_SELECTED, (t) => {
|
|
5015
5017
|
this.selectRow(t.id);
|
|
5016
|
-
}), this.context.event.on(
|
|
5018
|
+
}), this.context.event.on(k.TASK_UNSELECTED, (t) => {
|
|
5017
5019
|
this.unselectRow(t);
|
|
5018
5020
|
});
|
|
5019
5021
|
}
|
|
@@ -5025,9 +5027,9 @@ class Fe {
|
|
|
5025
5027
|
if (!e) return;
|
|
5026
5028
|
const i = this.getTaskByPosition(e);
|
|
5027
5029
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
5028
|
-
|
|
5030
|
+
k.ROW_UNHIGHLIGHT,
|
|
5029
5031
|
this.highlightedRowId
|
|
5030
|
-
), i && this.context.event.emit(
|
|
5032
|
+
), i && this.context.event.emit(k.ROW_HIGHLIGHT, i.id);
|
|
5031
5033
|
}
|
|
5032
5034
|
/**
|
|
5033
5035
|
* 处理鼠标离开
|
|
@@ -5045,7 +5047,7 @@ class Fe {
|
|
|
5045
5047
|
const i = this.getTaskByPosition(e);
|
|
5046
5048
|
if (i) {
|
|
5047
5049
|
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
5048
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(
|
|
5050
|
+
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(k.ROW_CLICK, t.evt, i);
|
|
5049
5051
|
}
|
|
5050
5052
|
}
|
|
5051
5053
|
/**
|
|
@@ -5056,7 +5058,7 @@ class Fe {
|
|
|
5056
5058
|
const e = this.stage.getPointerPosition();
|
|
5057
5059
|
if (!e) return;
|
|
5058
5060
|
const i = this.getTaskByPosition(e);
|
|
5059
|
-
i && this.context.event.emit(
|
|
5061
|
+
i && this.context.event.emit(k.ROW_DBL_CLICK, t.evt, i);
|
|
5060
5062
|
}
|
|
5061
5063
|
/**
|
|
5062
5064
|
* 处理右键菜单
|
|
@@ -5067,7 +5069,7 @@ class Fe {
|
|
|
5067
5069
|
const e = this.stage.getPointerPosition();
|
|
5068
5070
|
if (!e) return;
|
|
5069
5071
|
const i = this.getTaskByPosition(e);
|
|
5070
|
-
i && this.context.event.emit(
|
|
5072
|
+
i && this.context.event.emit(k.ROW_CONTEXTMENU, t.evt, i);
|
|
5071
5073
|
}
|
|
5072
5074
|
/**
|
|
5073
5075
|
* 按照位置获取任务
|
|
@@ -5453,7 +5455,7 @@ class ze {
|
|
|
5453
5455
|
stroke: r,
|
|
5454
5456
|
strokeWidth: g
|
|
5455
5457
|
}), this.bgLayer.add(this.todayLine)), (d = this.context.getOptions().today.text) != null && d.show) {
|
|
5456
|
-
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.fontFamily) || "Arial", w = ((p = this.context.getOptions().today.text) == null ? void 0 : p.content) || "今天", C = new S.Text({ fontSize: T, fontFamily: b }).measureSize(w),
|
|
5458
|
+
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.fontFamily) || "Arial", w = ((p = this.context.getOptions().today.text) == null ? void 0 : p.content) || "今天", C = new S.Text({ fontSize: T, fontFamily: b }).measureSize(w), L = ((u = this.context.getOptions().today.text) == null ? void 0 : u.color) || "white", E = ((y = this.context.getOptions().today.text) == null ? void 0 : y.backgroundColor) || r;
|
|
5457
5459
|
if (!this.todayTextGroup)
|
|
5458
5460
|
this.todayTextGroup = new S.Group({
|
|
5459
5461
|
x: s + this.offsetX + g,
|
|
@@ -5464,7 +5466,7 @@ class ze {
|
|
|
5464
5466
|
y: 0,
|
|
5465
5467
|
width: C.width + 12,
|
|
5466
5468
|
height: C.height + 8,
|
|
5467
|
-
fill:
|
|
5469
|
+
fill: E,
|
|
5468
5470
|
cornerRadius: 0,
|
|
5469
5471
|
name: "today-text-bg"
|
|
5470
5472
|
})), this.todayTextGroup.add(new S.Text({
|
|
@@ -5474,7 +5476,7 @@ class ze {
|
|
|
5474
5476
|
fontSize: T,
|
|
5475
5477
|
fontFamily: b,
|
|
5476
5478
|
padding: 5,
|
|
5477
|
-
fill:
|
|
5479
|
+
fill: L,
|
|
5478
5480
|
align: "center",
|
|
5479
5481
|
verticalAlign: "middle",
|
|
5480
5482
|
name: "today-text"
|
|
@@ -5484,7 +5486,7 @@ class ze {
|
|
|
5484
5486
|
const v = this.todayTextGroup.findOne(".today-text");
|
|
5485
5487
|
v == null || v.setAttrs({
|
|
5486
5488
|
text: w,
|
|
5487
|
-
fill:
|
|
5489
|
+
fill: L,
|
|
5488
5490
|
fontSize: T,
|
|
5489
5491
|
fontFamily: b,
|
|
5490
5492
|
padding: 5
|
|
@@ -5493,7 +5495,7 @@ class ze {
|
|
|
5493
5495
|
M == null || M.setAttrs({
|
|
5494
5496
|
width: C.width + 12,
|
|
5495
5497
|
height: C.height + 8,
|
|
5496
|
-
fill:
|
|
5498
|
+
fill: E
|
|
5497
5499
|
});
|
|
5498
5500
|
}
|
|
5499
5501
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
@@ -5572,13 +5574,13 @@ class Ne {
|
|
|
5572
5574
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5573
5575
|
const w = t.find((C) => {
|
|
5574
5576
|
if (X(C.date)) {
|
|
5575
|
-
if (C.date.some((
|
|
5577
|
+
if (C.date.some((L) => G(L).isSame(b, "day")))
|
|
5576
5578
|
return C;
|
|
5577
5579
|
} else if (G(C.date).isSame(b, "day"))
|
|
5578
5580
|
return C;
|
|
5579
5581
|
});
|
|
5580
5582
|
if (w) {
|
|
5581
|
-
const C = this.context.store.getTimeAxis().getTimeLeft(b),
|
|
5583
|
+
const C = this.context.store.getTimeAxis().getTimeLeft(b), L = r, E = g;
|
|
5582
5584
|
if (C + o < e)
|
|
5583
5585
|
continue;
|
|
5584
5586
|
if (C > i)
|
|
@@ -5594,9 +5596,9 @@ class Ne {
|
|
|
5594
5596
|
const M = new S.Rect({
|
|
5595
5597
|
name: "holiday-rect",
|
|
5596
5598
|
x: C,
|
|
5597
|
-
y:
|
|
5599
|
+
y: L,
|
|
5598
5600
|
width: o,
|
|
5599
|
-
height:
|
|
5601
|
+
height: E,
|
|
5600
5602
|
// 根据模式设置填充
|
|
5601
5603
|
...this.patternImage.get(w) ? {
|
|
5602
5604
|
fillPatternImage: this.patternImage.get(w) ?? void 0,
|
|
@@ -5612,10 +5614,10 @@ class Ne {
|
|
|
5612
5614
|
if (this.holidayGroup.add(M), (d = w.text) != null && d.show) {
|
|
5613
5615
|
if (X(w.date) && !G(w.date[0]).isSame(b, "day"))
|
|
5614
5616
|
continue;
|
|
5615
|
-
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "",
|
|
5617
|
+
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "", H = new S.Text({ fontSize: A, fontFamily: _ }).measureSize(D), W = ((u = w.text) == null ? void 0 : u.color) || "white", I = ((y = w.text) == null ? void 0 : y.backgroundColor) || w.backgroundColor || ((x = this.context.getOptions().holiday) == null ? void 0 : x.backgroundColor) || this.context.getOptions().primaryColor, R = new S.Group({
|
|
5616
5618
|
name: "holiday-text-group",
|
|
5617
5619
|
x: C,
|
|
5618
|
-
y:
|
|
5620
|
+
y: L,
|
|
5619
5621
|
opacity: (T = w.text) == null ? void 0 : T.opacity
|
|
5620
5622
|
}), F = new S.Text({
|
|
5621
5623
|
text: D,
|
|
@@ -5626,9 +5628,9 @@ class Ne {
|
|
|
5626
5628
|
}), z = new S.Rect({
|
|
5627
5629
|
x: 0,
|
|
5628
5630
|
y: 0,
|
|
5629
|
-
width:
|
|
5630
|
-
height:
|
|
5631
|
-
fill:
|
|
5631
|
+
width: H.width + 12,
|
|
5632
|
+
height: H.height + 8,
|
|
5633
|
+
fill: I
|
|
5632
5634
|
});
|
|
5633
5635
|
R.add(z), R.add(F), this.holidayGroup.add(R);
|
|
5634
5636
|
}
|
|
@@ -5688,8 +5690,8 @@ class Pe {
|
|
|
5688
5690
|
const b = G(T.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = g;
|
|
5689
5691
|
if (w + c < r || w > h)
|
|
5690
5692
|
return;
|
|
5691
|
-
const
|
|
5692
|
-
points:
|
|
5693
|
+
const E = [w, g, w, this.height], v = new S.Line({
|
|
5694
|
+
points: E,
|
|
5693
5695
|
stroke: T.backgroundColor || e,
|
|
5694
5696
|
opacity: T.opacity || i,
|
|
5695
5697
|
strokeWidth: 1
|
|
@@ -5804,11 +5806,11 @@ class Ye {
|
|
|
5804
5806
|
* 注册事件
|
|
5805
5807
|
*/
|
|
5806
5808
|
registerEvents() {
|
|
5807
|
-
this.context.event.on(
|
|
5809
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
5808
5810
|
this.highlightPoint(t);
|
|
5809
|
-
}), this.context.event.on(
|
|
5811
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
5810
5812
|
this.unhighlightPoint(t);
|
|
5811
|
-
}), this.context.event.on(
|
|
5813
|
+
}), this.context.event.on(k.SLIDER_DRAGGING, (t) => {
|
|
5812
5814
|
this.isSliderMoving = t;
|
|
5813
5815
|
});
|
|
5814
5816
|
}
|
|
@@ -5860,7 +5862,7 @@ class Ye {
|
|
|
5860
5862
|
l.isMilestone() && (u += i / 2);
|
|
5861
5863
|
const y = s + i * l.flatIndex;
|
|
5862
5864
|
let x = !0, T = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
5863
|
-
if (ht(b) ? x = T = b :
|
|
5865
|
+
if (ht(b) ? x = T = b : K(b) && (x = b === "S", T = b === "F"), x) {
|
|
5864
5866
|
const w = new S.Circle({
|
|
5865
5867
|
id: `point-${l.id}-left`,
|
|
5866
5868
|
x: m - u,
|
|
@@ -5942,33 +5944,33 @@ class Ye {
|
|
|
5942
5944
|
if (T.length <= 2)
|
|
5943
5945
|
O.warn("The link position has some error.", s);
|
|
5944
5946
|
else {
|
|
5945
|
-
const b = s.radius ?? this.context.getOptions().links.radius, w = ((p = s.arrow) == null ? void 0 : p.width) ?? this.context.getOptions().links.arrow.width, C = ((u = s.arrow) == null ? void 0 : u.height) ?? this.context.getOptions().links.arrow.height,
|
|
5946
|
-
let
|
|
5947
|
-
|
|
5948
|
-
const v =
|
|
5947
|
+
const b = s.radius ?? this.context.getOptions().links.radius, w = ((p = s.arrow) == null ? void 0 : p.width) ?? this.context.getOptions().links.arrow.width, C = ((u = s.arrow) == null ? void 0 : u.height) ?? this.context.getOptions().links.arrow.height, L = s.width ?? this.context.getOptions().links.width;
|
|
5948
|
+
let E = this.linkCache.get(n);
|
|
5949
|
+
E === void 0 && (E = new S.Group({ id: n })), t != null && t.length || (E._ = i);
|
|
5950
|
+
const v = E.findOne("Circle");
|
|
5949
5951
|
if (v)
|
|
5950
5952
|
v.radius(b), v.fill(
|
|
5951
5953
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5952
5954
|
), v.x(T[0]), v.y(T[1]);
|
|
5953
5955
|
else {
|
|
5954
|
-
const
|
|
5956
|
+
const I = new S.Circle({
|
|
5955
5957
|
radius: b,
|
|
5956
5958
|
fill: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5957
5959
|
x: T[0],
|
|
5958
5960
|
y: T[1]
|
|
5959
5961
|
});
|
|
5960
|
-
|
|
5962
|
+
E.add(I);
|
|
5961
5963
|
}
|
|
5962
|
-
const M = Math.floor(T.length / 2), A = M % 2 === 0 ? M : M - 1, _ = T.slice(0, A + 2), D = T.slice(A),
|
|
5963
|
-
if (
|
|
5964
|
-
|
|
5964
|
+
const M = Math.floor(T.length / 2), A = M % 2 === 0 ? M : M - 1, _ = T.slice(0, A + 2), D = T.slice(A), H = E.findOne("Line");
|
|
5965
|
+
if (H)
|
|
5966
|
+
H.points(_), H.stroke(
|
|
5965
5967
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5966
|
-
),
|
|
5968
|
+
), H.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), H.dash(s.dash || this.context.getOptions().links.dash);
|
|
5967
5969
|
else {
|
|
5968
|
-
const
|
|
5970
|
+
const I = new S.Line({
|
|
5969
5971
|
points: _,
|
|
5970
5972
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5971
|
-
strokeWidth:
|
|
5973
|
+
strokeWidth: L,
|
|
5972
5974
|
lineCap: "round",
|
|
5973
5975
|
lineJoin: "round",
|
|
5974
5976
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
@@ -5977,7 +5979,7 @@ class Ye {
|
|
|
5977
5979
|
draggable: !0,
|
|
5978
5980
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
5979
5981
|
});
|
|
5980
|
-
|
|
5982
|
+
E.add(I), I.on("dragstart", (R) => {
|
|
5981
5983
|
this.handleDrag(
|
|
5982
5984
|
R,
|
|
5983
5985
|
s,
|
|
@@ -5987,18 +5989,18 @@ class Ye {
|
|
|
5987
5989
|
);
|
|
5988
5990
|
});
|
|
5989
5991
|
}
|
|
5990
|
-
const W =
|
|
5992
|
+
const W = E.findOne("Arrow");
|
|
5991
5993
|
if (W)
|
|
5992
5994
|
W.points(D), W.stroke(
|
|
5993
5995
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5994
|
-
), W.strokeWidth(
|
|
5996
|
+
), W.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), W.pointerLength(C), W.pointerWidth(w), W.fill(
|
|
5995
5997
|
((y = s.arrow) == null ? void 0 : y.color) || this.context.getOptions().links.arrow.color || s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5996
5998
|
), W.lineJoin("round"), W.dash(s.dash || this.context.getOptions().links.dash);
|
|
5997
5999
|
else {
|
|
5998
|
-
const
|
|
6000
|
+
const I = new S.Arrow({
|
|
5999
6001
|
points: D,
|
|
6000
6002
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6001
|
-
strokeWidth:
|
|
6003
|
+
strokeWidth: L,
|
|
6002
6004
|
pointerLength: C,
|
|
6003
6005
|
pointerWidth: w,
|
|
6004
6006
|
fill: ((x = s.arrow) == null ? void 0 : x.color) || this.context.getOptions().links.arrow.color || s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
@@ -6010,50 +6012,50 @@ class Ye {
|
|
|
6010
6012
|
draggable: !0,
|
|
6011
6013
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
6012
6014
|
});
|
|
6013
|
-
|
|
6015
|
+
E.add(I), I.on("dragstart", (R) => {
|
|
6014
6016
|
this.handleDrag(R, s, "F", [T[0], T[1]], n);
|
|
6015
6017
|
});
|
|
6016
6018
|
}
|
|
6017
|
-
this.linkCache.has(n) || (this.linksGroup.add(
|
|
6018
|
-
|
|
6019
|
-
|
|
6019
|
+
this.linkCache.has(n) || (this.linksGroup.add(E), E.on("mouseover", (I) => {
|
|
6020
|
+
I.target.moveToTop(), this.context.getOptions().links.move.enabled === !0 && (this.stage.container().style.cursor = "pointer"), this.selectedMap.has(n) || this.handleHighlight(
|
|
6021
|
+
E,
|
|
6020
6022
|
b,
|
|
6021
6023
|
w,
|
|
6022
6024
|
C,
|
|
6023
|
-
|
|
6025
|
+
L,
|
|
6024
6026
|
2
|
|
6025
6027
|
);
|
|
6026
|
-
}),
|
|
6028
|
+
}), E.on("mouseout", (I) => {
|
|
6027
6029
|
this.selectedMap.has(n) || this.handleHighlight(
|
|
6028
|
-
|
|
6030
|
+
E,
|
|
6029
6031
|
b,
|
|
6030
6032
|
w,
|
|
6031
6033
|
C,
|
|
6032
|
-
|
|
6034
|
+
L,
|
|
6033
6035
|
0
|
|
6034
6036
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
6035
|
-
}),
|
|
6037
|
+
}), E.on("mousedown", (I) => {
|
|
6036
6038
|
this.isDragging = !0;
|
|
6037
|
-
}),
|
|
6038
|
-
|
|
6039
|
-
|
|
6039
|
+
}), E.on("click", (I) => {
|
|
6040
|
+
I.cancelBubble = !0, this.isDragging = !1, E.moveToTop(), I.evt.button === 0 && (this.selectedMap.has(n) ? (this.selectedMap.delete(n), this.context.event.emit(
|
|
6041
|
+
k.SELECT_LINK,
|
|
6040
6042
|
null,
|
|
6041
6043
|
s,
|
|
6042
6044
|
this.selectedMap.values().toArray()
|
|
6043
6045
|
)) : (this.selectedMap.set(n, s), this.context.event.emit(
|
|
6044
|
-
|
|
6046
|
+
k.SELECT_LINK,
|
|
6045
6047
|
s,
|
|
6046
6048
|
null,
|
|
6047
6049
|
this.selectedMap.values().toArray()
|
|
6048
6050
|
)));
|
|
6049
|
-
}),
|
|
6050
|
-
|
|
6051
|
-
}), this.linkCache.set(n,
|
|
6052
|
-
|
|
6051
|
+
}), E.on("contextmenu", (I) => {
|
|
6052
|
+
I.evt.preventDefault(), I.cancelBubble = !0, this.context.event.emit(k.CONTEXT_LINK, I.evt, s);
|
|
6053
|
+
}), this.linkCache.set(n, E)), this.selectedMap.has(n) && this.handleHighlight(
|
|
6054
|
+
E,
|
|
6053
6055
|
b,
|
|
6054
6056
|
w,
|
|
6055
6057
|
C,
|
|
6056
|
-
|
|
6058
|
+
L,
|
|
6057
6059
|
2,
|
|
6058
6060
|
!0
|
|
6059
6061
|
);
|
|
@@ -6204,14 +6206,14 @@ class Ye {
|
|
|
6204
6206
|
const m = () => {
|
|
6205
6207
|
const b = this.stage.getPointerPosition();
|
|
6206
6208
|
if (b && (l = this.getTaskByPosition(b), !!l && (this.templateArrow.visible(!0), o == null || o.visible(!1), l != null && l.startTime && (l != null && l.endTime)))) {
|
|
6207
|
-
const w = this.context.store.getTimeAxis().getTimeLeft(l.startTime), C = this.context.store.getTimeAxis().getTimeLeft(l.endTime),
|
|
6208
|
-
let
|
|
6209
|
-
b.x <=
|
|
6209
|
+
const w = this.context.store.getTimeAxis().getTimeLeft(l.startTime), C = this.context.store.getTimeAxis().getTimeLeft(l.endTime), L = (C + w) / 2 + this.offsetX;
|
|
6210
|
+
let E = w - d;
|
|
6211
|
+
b.x <= L ? r = "S" : (r = "F", E = C + d);
|
|
6210
6212
|
let v;
|
|
6211
6213
|
if (i === "S" ? v = `${r}${(e.type || "FS")[1]}` : v = `${(e.type || "FS")[0]}${r}`, i === "S") {
|
|
6212
6214
|
const { allowLeft: M, allowRight: A } = this.isAllowStartDrop(l, e.to, v);
|
|
6213
6215
|
this.templateArrow.points([
|
|
6214
|
-
|
|
6216
|
+
E,
|
|
6215
6217
|
g + c * l.flatIndex,
|
|
6216
6218
|
...s
|
|
6217
6219
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
@@ -6219,22 +6221,22 @@ class Ye {
|
|
|
6219
6221
|
const { allowLeft: M, allowRight: A } = this.isAllowEndDrop(l, e.from, v);
|
|
6220
6222
|
this.templateArrow.points([
|
|
6221
6223
|
...s,
|
|
6222
|
-
|
|
6224
|
+
E,
|
|
6223
6225
|
g + c * l.flatIndex
|
|
6224
6226
|
]), M ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6225
6227
|
}
|
|
6226
6228
|
}
|
|
6227
6229
|
}, p = () => {
|
|
6228
|
-
var C,
|
|
6230
|
+
var C, L;
|
|
6229
6231
|
let b;
|
|
6230
6232
|
const w = Z(e);
|
|
6231
6233
|
if (r && l && (i === "S" ? (b = `${r}${(e.type || "FS")[1]}`, w.from = l.id) : i === "F" && (b = `${(e.type || "FS")[0]}${r}`, w.to = l.id)), b && l) {
|
|
6232
6234
|
w.type = b;
|
|
6233
|
-
let
|
|
6234
|
-
i === "S" ? { allowLeft:
|
|
6235
|
+
let E = !1, v = !1, M;
|
|
6236
|
+
i === "S" ? { allowLeft: E, allowRight: v, reason: M } = this.isAllowStartDrop(l, w.to, w.type, !0) : i === "F" && ({ allowLeft: E, allowRight: v, reason: M } = this.isAllowEndDrop(l, w.from, w.type, !0)), ((C = w.type) == null ? void 0 : C.slice(1)) === "S" && E || ((L = w.type) == null ? void 0 : L.slice(1)) === "F" && v ? (this.context.event.emit(k.UPDATE_LINK, w), this.context.store.getLinkManager().update(), this.calculateLinks()) : this.context.event.emit(k.ERROR, M || Y.LINK_NOT_ALLOWED);
|
|
6235
6237
|
} else
|
|
6236
|
-
this.context.event.emit(
|
|
6237
|
-
this.cleanupTempLink(), this.calculateLinks([l, this.context.store.getDataManager().getTaskById(e.from), this.context.store.getDataManager().getTaskById(e.to)].filter((
|
|
6238
|
+
this.context.event.emit(k.ERROR, Y.TASK_NOT_FOUND);
|
|
6239
|
+
this.cleanupTempLink(), this.calculateLinks([l, this.context.store.getDataManager().getTaskById(e.from), this.context.store.getDataManager().getTaskById(e.to)].filter((E) => !!E)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6238
6240
|
}, u = (b) => {
|
|
6239
6241
|
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", u));
|
|
6240
6242
|
};
|
|
@@ -6269,24 +6271,24 @@ class Ye {
|
|
|
6269
6271
|
w,
|
|
6270
6272
|
g + c * l.flatIndex
|
|
6271
6273
|
]);
|
|
6272
|
-
const { allowLeft: C, allowRight:
|
|
6273
|
-
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !
|
|
6274
|
+
const { allowLeft: C, allowRight: L } = this.isAllowEndDrop(l, n, o.convertPointsToLinkType(e, r));
|
|
6275
|
+
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !L ? this.stage.container().style.cursor = "not-allowed" : this.stage.container().style.cursor = "pointer";
|
|
6274
6276
|
}
|
|
6275
6277
|
}, p = () => {
|
|
6276
6278
|
let y;
|
|
6277
6279
|
if (r && (y = o.convertPointsToLinkType(e, r)), y && l)
|
|
6278
6280
|
if (o.isLinkExist(n, l.id, y))
|
|
6279
|
-
this.context.event.emit(
|
|
6281
|
+
this.context.event.emit(k.ERROR, Y.LINK_EXIST);
|
|
6280
6282
|
else if (n === l.id && e === r)
|
|
6281
|
-
this.context.event.emit(
|
|
6283
|
+
this.context.event.emit(k.ERROR, Y.LINK_SAME);
|
|
6282
6284
|
else {
|
|
6283
6285
|
const { allowLeft: x, allowRight: T, reason: b } = this.isAllowEndDrop(l, n, y, !0);
|
|
6284
|
-
r === "S" && x || r === "F" && T ? (this.context.event.emit(
|
|
6286
|
+
r === "S" && x || r === "F" && T ? (this.context.event.emit(k.CREATE_LINK, {
|
|
6285
6287
|
from: n,
|
|
6286
6288
|
to: l.id,
|
|
6287
6289
|
type: y,
|
|
6288
6290
|
color: i
|
|
6289
|
-
}), this.context.store.getLinkManager().update()) : this.context.event.emit(
|
|
6291
|
+
}), this.context.store.getLinkManager().update()) : this.context.event.emit(k.ERROR, b || Y.LINK_NOT_ALLOWED);
|
|
6290
6292
|
}
|
|
6291
6293
|
this.cleanupTempLink(), this.calculateLinks([l].filter((x) => !!x)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6292
6294
|
}, u = (y) => {
|
|
@@ -6319,7 +6321,7 @@ class Ye {
|
|
|
6319
6321
|
j(r) && (r = r(
|
|
6320
6322
|
t.getEmitData(),
|
|
6321
6323
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6322
|
-
)), ht(r) ? n = o = r :
|
|
6324
|
+
)), ht(r) ? n = o = r : K(r) && (n = r === "S", o = r === "F");
|
|
6323
6325
|
const h = this.validateChain(t.id, e, i, s);
|
|
6324
6326
|
return {
|
|
6325
6327
|
allowLeft: n && h.ok,
|
|
@@ -6335,7 +6337,7 @@ class Ye {
|
|
|
6335
6337
|
j(r) && (r = r(
|
|
6336
6338
|
t.getEmitData(),
|
|
6337
6339
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6338
|
-
)), ht(r) ? n = o = r :
|
|
6340
|
+
)), ht(r) ? n = o = r : K(r) && (n = r === "S", o = r === "F");
|
|
6339
6341
|
const h = this.validateChain(e, t.id, i, s);
|
|
6340
6342
|
return {
|
|
6341
6343
|
allowLeft: n && h.ok,
|
|
@@ -6398,7 +6400,7 @@ class Ye {
|
|
|
6398
6400
|
*/
|
|
6399
6401
|
highlightCycleNodes(t) {
|
|
6400
6402
|
t.forEach((e) => {
|
|
6401
|
-
this.context.event.emit(
|
|
6403
|
+
this.context.event.emit(k.SLIDER_BLINK, e);
|
|
6402
6404
|
});
|
|
6403
6405
|
}
|
|
6404
6406
|
}
|
|
@@ -6579,7 +6581,7 @@ class Ue {
|
|
|
6579
6581
|
this.indicatorGroup.add(p);
|
|
6580
6582
|
let u = `${gt(i.startDiff)}${i.unit} ${m}`;
|
|
6581
6583
|
const y = s.compare.indicator[m].text;
|
|
6582
|
-
j(y) ? u = y(i.startDiff, { ...t.getEmitData(), baseline: e }) :
|
|
6584
|
+
j(y) ? u = y(i.startDiff, { ...t.getEmitData(), baseline: e }) : K(y) && (u = y);
|
|
6583
6585
|
const x = new S.Text({
|
|
6584
6586
|
y: l - n.fontSize / 2,
|
|
6585
6587
|
text: u,
|
|
@@ -6603,7 +6605,7 @@ class Ue {
|
|
|
6603
6605
|
this.indicatorGroup.add(p);
|
|
6604
6606
|
let u = `${gt(i.endDiff)}${i.unit} ${m}`;
|
|
6605
6607
|
const y = s.compare.indicator[m].text;
|
|
6606
|
-
j(y) ? u = y(i.endDiff, { ...t.getEmitData(), baseline: e }) :
|
|
6608
|
+
j(y) ? u = y(i.endDiff, { ...t.getEmitData(), baseline: e }) : K(y) && (u = y);
|
|
6607
6609
|
const x = new S.Text({
|
|
6608
6610
|
x: d + n.size + 5,
|
|
6609
6611
|
y: l - n.fontSize / 2,
|
|
@@ -6617,12 +6619,14 @@ class Ue {
|
|
|
6617
6619
|
}
|
|
6618
6620
|
}
|
|
6619
6621
|
bindEvents(t, e, i) {
|
|
6620
|
-
t.on("
|
|
6621
|
-
this.context.event.emit(
|
|
6622
|
+
t.on("mouseenter", (s) => {
|
|
6623
|
+
this.context.event.emit(k.BASELINE_MOUSEENTER, s.evt, e, i);
|
|
6624
|
+
}), t.on("mousemove", (s) => {
|
|
6625
|
+
this.context.event.emit(k.BASELINE_MOUSEMOVE, s.evt, e, i);
|
|
6622
6626
|
}), t.on("mouseout", (s) => {
|
|
6623
|
-
this.context.event.emit(
|
|
6627
|
+
this.context.event.emit(k.BASELINE_MOUSEOUT, s.evt, e, i);
|
|
6624
6628
|
}), t.on("click", (s) => {
|
|
6625
|
-
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(
|
|
6629
|
+
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(k.BASELINE_CLICK, s.evt, e, i) : s.evt.button === 2 && this.context.event.emit(k.BASELINE_CONTEXTMENU, s.evt, e, i);
|
|
6626
6630
|
});
|
|
6627
6631
|
}
|
|
6628
6632
|
}
|
|
@@ -6675,8 +6679,8 @@ class Xe {
|
|
|
6675
6679
|
this.headerLayer.destroy(), this.gridGroup.destroy(), this.bodyLayer.destroy(), this.todayLayer.destroy(), this.holidayGroup.destroy(), this.flagGroup.destroy(), this.weekendGroup.destroy(), this.linkGroup.destroy(), this.baselineGroup.destroy(), this.axisLayer.destroy(), this.bgLayer.destroy(), this.stage.destroy();
|
|
6676
6680
|
}
|
|
6677
6681
|
}
|
|
6678
|
-
const
|
|
6679
|
-
class
|
|
6682
|
+
const Ke = '<svg style="transition: all 0.3s" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>';
|
|
6683
|
+
class Ve {
|
|
6680
6684
|
constructor(t, e) {
|
|
6681
6685
|
a(this, "line");
|
|
6682
6686
|
a(this, "initialX", 0);
|
|
@@ -6686,7 +6690,7 @@ class Ke {
|
|
|
6686
6690
|
"border-left-color",
|
|
6687
6691
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
6688
6692
|
"important"
|
|
6689
|
-
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML =
|
|
6693
|
+
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML = Ke, this.collapseButton.addEventListener("click", (i) => {
|
|
6690
6694
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
6691
6695
|
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
6692
6696
|
}
|
|
@@ -6703,7 +6707,7 @@ class Ke {
|
|
|
6703
6707
|
const c = s[s.length - 1].key;
|
|
6704
6708
|
this.initialWidth = i.getColumnWidth(c);
|
|
6705
6709
|
const g = this.initialX;
|
|
6706
|
-
this.root.event.emit(
|
|
6710
|
+
this.root.event.emit(k.SHOW_GUIDELINE, g);
|
|
6707
6711
|
const d = (m) => o(m), l = (m) => r(m, d, l);
|
|
6708
6712
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6709
6713
|
}, o = (h) => {
|
|
@@ -6711,11 +6715,11 @@ class Ke {
|
|
|
6711
6715
|
const c = h.clientX - t;
|
|
6712
6716
|
s[s.length - 1].key;
|
|
6713
6717
|
const g = 50 - this.initialWidth, l = e.width - 20 - this.initialX, m = Math.max(g, Math.min(l, c)), p = this.initialX + m;
|
|
6714
|
-
this.root.event.emit(
|
|
6718
|
+
this.root.event.emit(k.MOVE_GUIDELINE, p);
|
|
6715
6719
|
}, r = (h, c, g) => {
|
|
6716
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(
|
|
6720
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(k.HIDE_GUIDELINE);
|
|
6717
6721
|
const d = h.clientX - t, l = s[s.length - 1].key, m = Math.max(50, this.initialWidth + d);
|
|
6718
|
-
i.setColumnWidth(l, m), this.root.event.emit(
|
|
6722
|
+
i.setColumnWidth(l, m), this.root.event.emit(k.UPDATE_TABLE_HEADER);
|
|
6719
6723
|
};
|
|
6720
6724
|
this.line.addEventListener("mousedown", n);
|
|
6721
6725
|
}
|
|
@@ -6746,11 +6750,11 @@ class je {
|
|
|
6746
6750
|
* 初始化事件监听
|
|
6747
6751
|
*/
|
|
6748
6752
|
initEvents() {
|
|
6749
|
-
this.context.event.on(
|
|
6753
|
+
this.context.event.on(k.SHOW_GUIDELINE, (t) => {
|
|
6750
6754
|
this.show(t);
|
|
6751
|
-
}), this.context.event.on(
|
|
6755
|
+
}), this.context.event.on(k.HIDE_GUIDELINE, () => {
|
|
6752
6756
|
this.hide();
|
|
6753
|
-
}), this.context.event.on(
|
|
6757
|
+
}), this.context.event.on(k.MOVE_GUIDELINE, (t) => {
|
|
6754
6758
|
this.setLeft(t);
|
|
6755
6759
|
});
|
|
6756
6760
|
}
|
|
@@ -7004,7 +7008,7 @@ class Qe {
|
|
|
7004
7008
|
a(this, "handleColumnWidthChange", () => {
|
|
7005
7009
|
this.table.updateWidth(), this.updateSize();
|
|
7006
7010
|
});
|
|
7007
|
-
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new je(this.context, this.container), this.middleLine = new
|
|
7011
|
+
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new je(this.context, this.container), this.middleLine = new Ve(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new He(this.context, this.tableContainer), this.chart = new Xe(this.context, this.chartContainer), this.scrollbar = new _e(
|
|
7008
7012
|
this.context,
|
|
7009
7013
|
this.rootElement,
|
|
7010
7014
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
@@ -7047,21 +7051,21 @@ class Qe {
|
|
|
7047
7051
|
* 设置事件监听器
|
|
7048
7052
|
*/
|
|
7049
7053
|
setupEventListeners() {
|
|
7050
|
-
this.context.event.on(
|
|
7054
|
+
this.context.event.on(k.DATA_UPDATE, () => {
|
|
7051
7055
|
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
7052
|
-
}), this.context.event.on(
|
|
7056
|
+
}), this.context.event.on(k.SCROLL, () => {
|
|
7053
7057
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
7054
|
-
}), this.context.event.on(
|
|
7058
|
+
}), this.context.event.on(k.COLUMN_WIDTH_CHANGE, () => {
|
|
7055
7059
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
7056
|
-
}), this.context.event.on(
|
|
7060
|
+
}), this.context.event.on(k.VIEW_UPDATE, () => {
|
|
7057
7061
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
7058
|
-
}), this.context.event.on(
|
|
7062
|
+
}), this.context.event.on(k.UPDATE_TASK, (t) => {
|
|
7059
7063
|
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
7060
7064
|
immediate: !0
|
|
7061
7065
|
});
|
|
7062
|
-
}), this.context.event.on(
|
|
7066
|
+
}), this.context.event.on(k.CHART_OFFSET_CHANGE, () => {
|
|
7063
7067
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
7064
|
-
}), this.context.event.on(
|
|
7068
|
+
}), this.context.event.on(k.TOGGLE_COLLAPSE, () => {
|
|
7065
7069
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1], { immediate: !0 });
|
|
7066
7070
|
});
|
|
7067
7071
|
}
|
|
@@ -7072,7 +7076,7 @@ class Qe {
|
|
|
7072
7076
|
performRender(t = !1, e = !1) {
|
|
7073
7077
|
this.setStyleValue();
|
|
7074
7078
|
const { x: i, y: s } = this.scrollbar.getScrollPosition(), n = this.context.store.getOptionManager().getOptions().row.height, o = this.context.store.getOptionManager().getOptions().header.height, r = Math.floor(s / n), h = Math.ceil((this.height - o) / n), c = 2, g = Math.max(0, r), d = h + c, l = this.context.store.getDataManager().getVisibleTasks().slice(g, g + d);
|
|
7075
|
-
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(
|
|
7079
|
+
this.updateSize(), e ? (this.table.refresh(s, l), this.chart.refresh(i, s, l, !0)) : t ? (this.table.refresh(s, l), this.chart.refresh(i, s, l)) : (this.table.render(s, l), this.chart.render(i, s, l)), this.isInitialized && (this.context.event.emit(k.LOADED), this.isInitialized = !1), O.debug("execute render");
|
|
7076
7080
|
}
|
|
7077
7081
|
/**
|
|
7078
7082
|
* 公共渲染方法,向后兼容
|
|
@@ -7139,6 +7143,25 @@ class Je {
|
|
|
7139
7143
|
const i = this.store.getTimeAxis().getTimeLeft(e) - 100;
|
|
7140
7144
|
return this.renderer.getScrollbar().scrollTo({ x: Math.max(i, 0) }), !0;
|
|
7141
7145
|
}
|
|
7146
|
+
/**
|
|
7147
|
+
* 滚动到指定任务节点。默认为第一个任务
|
|
7148
|
+
*
|
|
7149
|
+
* @return {boolean} 是否成功跳转
|
|
7150
|
+
*/
|
|
7151
|
+
scrollTo(t, e) {
|
|
7152
|
+
var o;
|
|
7153
|
+
let i = 0, s;
|
|
7154
|
+
const n = Math.max(100, ((o = this.getOptions().scrollbar) == null ? void 0 : o.animationDuration) || 100);
|
|
7155
|
+
if (t) {
|
|
7156
|
+
if (s = this.store.getDataManager().getTaskById(t), !s) return !1;
|
|
7157
|
+
i = s.flatIndex * this.store.getOptionManager().getOptions().row.height - 100, setTimeout(() => {
|
|
7158
|
+
this.jumpTo(s == null ? void 0 : s.startTime);
|
|
7159
|
+
}, n);
|
|
7160
|
+
}
|
|
7161
|
+
return this.renderer.getScrollbar().scrollTo({ y: i }), e && s && setTimeout(() => {
|
|
7162
|
+
this.event.emit(k.SLIDER_BLINK, s.id);
|
|
7163
|
+
}, n * 2), !0;
|
|
7164
|
+
}
|
|
7142
7165
|
/**
|
|
7143
7166
|
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
7144
7167
|
*/
|
|
@@ -7157,11 +7180,11 @@ class Je {
|
|
|
7157
7180
|
}
|
|
7158
7181
|
// 注册对外事件
|
|
7159
7182
|
registerEvents() {
|
|
7160
|
-
this.event.on(
|
|
7183
|
+
this.event.on(k.ERROR, (t, e) => {
|
|
7161
7184
|
this._emit("error", t, e);
|
|
7162
|
-
}), this.event.on(
|
|
7185
|
+
}), this.event.on(k.LOADED, () => {
|
|
7163
7186
|
this._emit("loaded");
|
|
7164
|
-
}), this.event.on(
|
|
7187
|
+
}), this.event.on(k.TASK_DRAG_END, (t, e) => {
|
|
7165
7188
|
this._emit(
|
|
7166
7189
|
"move",
|
|
7167
7190
|
e.map((i) => {
|
|
@@ -7172,47 +7195,51 @@ class Je {
|
|
|
7172
7195
|
};
|
|
7173
7196
|
})
|
|
7174
7197
|
);
|
|
7175
|
-
}), this.event.on(
|
|
7198
|
+
}), this.event.on(k.CHECK_TASK, (t, e) => {
|
|
7176
7199
|
this._emit(
|
|
7177
7200
|
"select",
|
|
7178
7201
|
t.map((i) => i.data),
|
|
7179
7202
|
e,
|
|
7180
7203
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
7181
7204
|
);
|
|
7182
|
-
}), this.event.on(
|
|
7205
|
+
}), this.event.on(k.UPDATE_LINK, (t) => {
|
|
7183
7206
|
this._emit("update:link", t);
|
|
7184
|
-
}), this.event.on(
|
|
7207
|
+
}), this.event.on(k.CREATE_LINK, (t) => {
|
|
7185
7208
|
this._emit("create:link", t);
|
|
7186
7209
|
}), this.event.on(
|
|
7187
|
-
|
|
7210
|
+
k.SELECT_LINK,
|
|
7188
7211
|
(t, e, i) => {
|
|
7189
7212
|
this._emit("select:link", t, e, i);
|
|
7190
7213
|
}
|
|
7191
|
-
), this.event.on(
|
|
7214
|
+
), this.event.on(k.CONTEXT_LINK, (t, e) => {
|
|
7192
7215
|
this._emit("contextmenu:link", t, e);
|
|
7193
|
-
}), this.event.on(
|
|
7216
|
+
}), this.event.on(k.ROW_CLICK, (t, e) => {
|
|
7194
7217
|
this._emit("click:row", t, e.data);
|
|
7195
|
-
}), this.event.on(
|
|
7218
|
+
}), this.event.on(k.ROW_DBL_CLICK, (t, e) => {
|
|
7196
7219
|
this._emit("dblclick:row", t, e.data);
|
|
7197
|
-
}), this.event.on(
|
|
7220
|
+
}), this.event.on(k.ROW_CONTEXTMENU, (t, e) => {
|
|
7198
7221
|
this._emit("contextmenu:row", t, e.data);
|
|
7199
|
-
}), this.event.on(
|
|
7222
|
+
}), this.event.on(k.SLIDER_CLICK, (t, e) => {
|
|
7200
7223
|
this._emit("click:slider", t, e.data);
|
|
7201
|
-
}), this.event.on(
|
|
7224
|
+
}), this.event.on(k.SLIDER_DBL_CLICK, (t, e) => {
|
|
7202
7225
|
this._emit("dblclick:slider", t, e.data);
|
|
7203
|
-
}), this.event.on(
|
|
7226
|
+
}), this.event.on(k.SLIDER_CONTEXTMENU, (t, e) => {
|
|
7204
7227
|
this._emit("contextmenu:slider", t, e.data);
|
|
7205
|
-
}), this.event.on(
|
|
7228
|
+
}), this.event.on(k.SLIDER_ENTER, (t, e) => {
|
|
7229
|
+
this._emit("enter:slider", t, e.data);
|
|
7230
|
+
}), this.event.on(k.SLIDER_HOVER, (t, e) => {
|
|
7206
7231
|
this._emit("hover:slider", t, e.data);
|
|
7207
|
-
}), this.event.on(
|
|
7232
|
+
}), this.event.on(k.SLIDER_LEAVE, (t, e) => {
|
|
7208
7233
|
this._emit("leave:slider", t, e.data);
|
|
7209
|
-
}), this.event.on(
|
|
7234
|
+
}), this.event.on(k.BASELINE_CLICK, (t, e, i) => {
|
|
7210
7235
|
this._emit("click:baseline", t, e.data, i.data);
|
|
7211
|
-
}), this.event.on(
|
|
7236
|
+
}), this.event.on(k.BASELINE_CONTEXTMENU, (t, e, i) => {
|
|
7212
7237
|
this._emit("contextmenu:baseline", t, e.data, i.data);
|
|
7213
|
-
}), this.event.on(
|
|
7238
|
+
}), this.event.on(k.BASELINE_MOUSEENTER, (t, e, i) => {
|
|
7239
|
+
this._emit("enter:baseline", t, e.data, i.data);
|
|
7240
|
+
}), this.event.on(k.BASELINE_MOUSEMOVE, (t, e, i) => {
|
|
7214
7241
|
this._emit("hover:baseline", t, e.data, i.data);
|
|
7215
|
-
}), this.event.on(
|
|
7242
|
+
}), this.event.on(k.BASELINE_MOUSEOUT, (t, e, i) => {
|
|
7216
7243
|
this._emit("leave:baseline", t, e.data, i.data);
|
|
7217
7244
|
});
|
|
7218
7245
|
}
|
|
@@ -7376,8 +7403,55 @@ class si {
|
|
|
7376
7403
|
jumpTo(t) {
|
|
7377
7404
|
return this.context.jumpTo(t);
|
|
7378
7405
|
}
|
|
7406
|
+
/**
|
|
7407
|
+
* 滚动到指定任务
|
|
7408
|
+
* @param id - 任务 ID,如果不传入则滚动到顶部
|
|
7409
|
+
* @param highlight - 是否高亮任务,默认为 false
|
|
7410
|
+
*
|
|
7411
|
+
* @returns 是否成功滚动到指定任务
|
|
7412
|
+
* - `true`: 成功滚动,任务已在视图中可见
|
|
7413
|
+
* - `false`: 滚动失败,可能是任务 ID 无效或任务不可见
|
|
7414
|
+
*
|
|
7415
|
+
* @description 此方法将甘特图的视图滚动到指定任务的位置,使该任务在当前视窗中可见。并且支持跳转后高亮当前任务。
|
|
7416
|
+
*
|
|
7417
|
+
* @example
|
|
7418
|
+
* ```typescript
|
|
7419
|
+
* // 滚动到指定任务
|
|
7420
|
+
* const success1 = gantt.scrollTo('task-1');
|
|
7421
|
+
* const success2 = gantt.scrollTo('non-existent-id'); // 任务不存在,返回 false
|
|
7422
|
+
*
|
|
7423
|
+
* // 滚动到顶部
|
|
7424
|
+
* const success3 = gantt.scrollTo();
|
|
7425
|
+
*
|
|
7426
|
+
* // 检查滚动结果
|
|
7427
|
+
* if (gantt.scrollTo('task-2')) {
|
|
7428
|
+
* console.log('成功滚动到任务 task-2');
|
|
7429
|
+
* } else {
|
|
7430
|
+
* console.log('滚动失败,任务 ID 可能无效');
|
|
7431
|
+
* }
|
|
7432
|
+
*
|
|
7433
|
+
* // 滚动到任务并高亮
|
|
7434
|
+
* gantt.scrollTo('task-3', true);
|
|
7435
|
+
* ```
|
|
7436
|
+
*/
|
|
7437
|
+
scrollTo(t, e) {
|
|
7438
|
+
return this.context.scrollTo(t, e);
|
|
7439
|
+
}
|
|
7379
7440
|
/**
|
|
7380
7441
|
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
7442
|
+
*
|
|
7443
|
+
* 结果集中包含前置链路信息、后置链路信息、所有节点、关联线的信息等
|
|
7444
|
+
* - prev: 前置链路信息
|
|
7445
|
+
* - chain: 所有源 -> 当前任务的完整路径(每条路径末尾为当前节点)
|
|
7446
|
+
* - nodes: 前置方向所有唯一节点
|
|
7447
|
+
* - links: 前置方向所有连线
|
|
7448
|
+
* - next: 后置链路信息
|
|
7449
|
+
* - chain: 当前任务 -> 所有汇的完整路径(每条路径首元素为当前节点)
|
|
7450
|
+
* - nodes: 后置方向所有唯一节点
|
|
7451
|
+
* - links: 后置方向所有连线
|
|
7452
|
+
* - allNodes: 所有相关联的节点
|
|
7453
|
+
* - allLinks: 所有相关联的连线
|
|
7454
|
+
* - current: 当前任务
|
|
7381
7455
|
*/
|
|
7382
7456
|
getDataChain(t) {
|
|
7383
7457
|
return this.context.getDataChain(t);
|
|
@@ -7493,9 +7567,32 @@ class si {
|
|
|
7493
7567
|
} else
|
|
7494
7568
|
this.events.delete(t);
|
|
7495
7569
|
}
|
|
7570
|
+
/**
|
|
7571
|
+
* 根据任务 ID 获取对应的任务数据
|
|
7572
|
+
* @param id 任务 ID
|
|
7573
|
+
* @returns 任务数据
|
|
7574
|
+
*
|
|
7575
|
+
* @example
|
|
7576
|
+
* ```typescript
|
|
7577
|
+
* const data = gantt.getDataById('task-1');
|
|
7578
|
+
* if (data) {
|
|
7579
|
+
* console.log('任务名称:', data.name);
|
|
7580
|
+
* }
|
|
7581
|
+
* ```
|
|
7582
|
+
*/
|
|
7583
|
+
getDataById(t) {
|
|
7584
|
+
var e;
|
|
7585
|
+
return (e = this.context.store.getDataManager().getTaskById(t)) == null ? void 0 : e.data;
|
|
7586
|
+
}
|
|
7587
|
+
/**
|
|
7588
|
+
* 获取当前数据量总数。该数量为所有数据展开后的数据条数
|
|
7589
|
+
*/
|
|
7590
|
+
getDataSize() {
|
|
7591
|
+
return this.context.store.getDataManager().getVisibleSize();
|
|
7592
|
+
}
|
|
7496
7593
|
}
|
|
7497
|
-
|
|
7498
|
-
const ni =
|
|
7594
|
+
Kt();
|
|
7595
|
+
const ni = Ct;
|
|
7499
7596
|
export {
|
|
7500
7597
|
si as XGantt,
|
|
7501
7598
|
B as colorjs,
|