@xpyjs/gantt-core 0.0.1-beta.4 → 0.0.1-rc.2
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 +418 -309
- 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/store/DataManager.d.ts +4 -0
- package/types/types/event.d.ts +27 -0
package/dist/x-gantt.js
CHANGED
|
@@ -3,9 +3,9 @@ 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 V, isFunction as j, cloneDeep as Z, isObject as
|
|
6
|
+
import { merge as rt, isArray as X, isString as V, isFunction as j, cloneDeep as Z, isObject as Et, isNumber as Ut, omit as yt, throttle as wt, isBoolean as ht, debounce as Xt } from "lodash-es";
|
|
7
7
|
import S from "konva";
|
|
8
|
-
const
|
|
8
|
+
const Ct = "0.0.1-rc.2";
|
|
9
9
|
function Vt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
@@ -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
|
);
|
|
@@ -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
|
}
|
|
@@ -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
|
* 按条件筛选任务
|
|
@@ -844,6 +844,18 @@ class Jt {
|
|
|
844
844
|
};
|
|
845
845
|
return this.tasks.forEach((s) => i(s)), this.visibleTasksCache = t, this.isDirty = !1, t;
|
|
846
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* 获取一个任务是否可展示
|
|
849
|
+
*/
|
|
850
|
+
isTaskVisible(t) {
|
|
851
|
+
let e = t.parent;
|
|
852
|
+
for (; e; ) {
|
|
853
|
+
if (this.collapsedTaskIds.has(e.id))
|
|
854
|
+
return !1;
|
|
855
|
+
e = e.parent;
|
|
856
|
+
}
|
|
857
|
+
return !0;
|
|
858
|
+
}
|
|
847
859
|
/**
|
|
848
860
|
* 获取可展示任务数量
|
|
849
861
|
*/
|
|
@@ -854,7 +866,7 @@ class Jt {
|
|
|
854
866
|
* 清空所有数据
|
|
855
867
|
*/
|
|
856
868
|
clear() {
|
|
857
|
-
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(
|
|
869
|
+
this.rawData = [], this.tasks = [], this.taskMap.clear(), this.visibleTasksCache = [], this.isDirty = !0, this.collapsedTaskIds.clear(), this.event.emit(k.DATA_UPDATE);
|
|
858
870
|
}
|
|
859
871
|
/**
|
|
860
872
|
* 更新子任务的层级
|
|
@@ -882,7 +894,7 @@ class Jt {
|
|
|
882
894
|
*/
|
|
883
895
|
selectTask(t) {
|
|
884
896
|
const e = this.getTaskById(t);
|
|
885
|
-
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(
|
|
897
|
+
return e ? (this.selectedTaskId === t || (this.unselectTask(), this.selectedTaskId = t, this.event.emit(k.TASK_SELECTED, e)), !0) : !1;
|
|
886
898
|
}
|
|
887
899
|
/**
|
|
888
900
|
* 取消任务选择
|
|
@@ -890,7 +902,7 @@ class Jt {
|
|
|
890
902
|
unselectTask() {
|
|
891
903
|
if (this.selectedTaskId) {
|
|
892
904
|
const t = this.selectedTaskId;
|
|
893
|
-
this.selectedTaskId = null, this.event.emit(
|
|
905
|
+
this.selectedTaskId = null, this.event.emit(k.TASK_UNSELECTED, t);
|
|
894
906
|
}
|
|
895
907
|
}
|
|
896
908
|
/**
|
|
@@ -1184,7 +1196,7 @@ class et {
|
|
|
1184
1196
|
}
|
|
1185
1197
|
}
|
|
1186
1198
|
const B = (f) => f instanceof et ? f : new et(f);
|
|
1187
|
-
class
|
|
1199
|
+
class Lt {
|
|
1188
1200
|
constructor(t, e, i) {
|
|
1189
1201
|
a(this, "element");
|
|
1190
1202
|
a(this, "iconElement");
|
|
@@ -1261,14 +1273,14 @@ class Et {
|
|
|
1261
1273
|
)) : (this.context.store.getDataManager().updateCheckedList(!0, this.task), this.setState(
|
|
1262
1274
|
1
|
|
1263
1275
|
/* CHECKED */
|
|
1264
|
-
)), this.context.event.emit(
|
|
1276
|
+
)), this.context.event.emit(k.CHECK_TASK, [this.task], !e);
|
|
1265
1277
|
} else {
|
|
1266
1278
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1267
1279
|
this.setState(
|
|
1268
1280
|
e ? 1 : 0
|
|
1269
1281
|
/* UNCHECKED */
|
|
1270
1282
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1271
|
-
|
|
1283
|
+
k.CHECK_TASK,
|
|
1272
1284
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1273
1285
|
!e
|
|
1274
1286
|
);
|
|
@@ -1291,14 +1303,14 @@ class Et {
|
|
|
1291
1303
|
}), this.setState(
|
|
1292
1304
|
1
|
|
1293
1305
|
/* CHECKED */
|
|
1294
|
-
)), this.context.event.emit(
|
|
1306
|
+
)), this.context.event.emit(k.CHECK_TASK, e, !i);
|
|
1295
1307
|
} else {
|
|
1296
1308
|
const e = this.context.store.getDataManager().getCheckedList().length === this.context.store.getDataManager().getVisibleSize();
|
|
1297
1309
|
this.setState(
|
|
1298
1310
|
e ? 1 : 0
|
|
1299
1311
|
/* UNCHECKED */
|
|
1300
1312
|
), this.context.store.getDataManager().toggleAllChecked(!e), this.context.event.emit(
|
|
1301
|
-
|
|
1313
|
+
k.CHECK_TASK,
|
|
1302
1314
|
this.context.store.getDataManager().getVisibleTasks(),
|
|
1303
1315
|
!e
|
|
1304
1316
|
);
|
|
@@ -1306,7 +1318,7 @@ class Et {
|
|
|
1306
1318
|
});
|
|
1307
1319
|
}
|
|
1308
1320
|
registerEvents() {
|
|
1309
|
-
this.context.event.on(
|
|
1321
|
+
this.context.event.on(k.CHECK_TASK, this.updateState.bind(this));
|
|
1310
1322
|
}
|
|
1311
1323
|
/** 获取元素 */
|
|
1312
1324
|
getElement() {
|
|
@@ -1438,7 +1450,7 @@ class ee {
|
|
|
1438
1450
|
}
|
|
1439
1451
|
setColumnWidth(t, e) {
|
|
1440
1452
|
const i = this.leafColumns.find((s) => s.key === t);
|
|
1441
|
-
i && (i.width = e), this.context.event.emit(
|
|
1453
|
+
i && (i.width = e), this.context.event.emit(k.COLUMN_WIDTH_CHANGE, t, e);
|
|
1442
1454
|
}
|
|
1443
1455
|
isLastColumn(t) {
|
|
1444
1456
|
return this.leafColumns.findIndex((i) => i.key === t) === this.leafColumns.length - 1;
|
|
@@ -1467,7 +1479,7 @@ class ee {
|
|
|
1467
1479
|
customStyle: {
|
|
1468
1480
|
paddingLeft: this.context.store.getOptionManager().getOptions().expand.show ? "8px" : 0
|
|
1469
1481
|
},
|
|
1470
|
-
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new
|
|
1482
|
+
headerRender: () => this.context.store.getOptionManager().getOptions().selection.enabled ? new Lt(this.context).getElement() : null,
|
|
1471
1483
|
ellipsis: !1
|
|
1472
1484
|
},
|
|
1473
1485
|
children: [],
|
|
@@ -1481,7 +1493,7 @@ class ee {
|
|
|
1481
1493
|
return this.columns.some((t) => t.maxLevel > 1);
|
|
1482
1494
|
}
|
|
1483
1495
|
collapse() {
|
|
1484
|
-
this.collapseTable = !this.collapseTable, this.context.event.emit(
|
|
1496
|
+
this.collapseTable = !this.collapseTable, this.context.event.emit(k.TOGGLE_COLLAPSE);
|
|
1485
1497
|
}
|
|
1486
1498
|
isCollapsed() {
|
|
1487
1499
|
return this.collapseTable;
|
|
@@ -1698,18 +1710,18 @@ const tt = class tt {
|
|
|
1698
1710
|
return [];
|
|
1699
1711
|
T.add(x.id), b.add(x.id);
|
|
1700
1712
|
const C = n(x.id);
|
|
1701
|
-
let
|
|
1713
|
+
let L = [];
|
|
1702
1714
|
if (C.length === 0)
|
|
1703
|
-
|
|
1715
|
+
L = [[x]];
|
|
1704
1716
|
else {
|
|
1705
|
-
for (const
|
|
1706
|
-
const v = r(
|
|
1717
|
+
for (const E of C) {
|
|
1718
|
+
const v = r(E, T, b);
|
|
1707
1719
|
for (const M of v)
|
|
1708
|
-
|
|
1720
|
+
L.push([x, ...M]);
|
|
1709
1721
|
}
|
|
1710
|
-
|
|
1722
|
+
L.length === 0 && (L = [[x]]);
|
|
1711
1723
|
}
|
|
1712
|
-
return T.delete(x.id),
|
|
1724
|
+
return T.delete(x.id), L.length < 100 && (this.forwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1713
1725
|
}, h = (x, T, b = /* @__PURE__ */ new Set()) => {
|
|
1714
1726
|
const w = x.id;
|
|
1715
1727
|
if (this.backwardMemo.has(w))
|
|
@@ -1718,18 +1730,18 @@ const tt = class tt {
|
|
|
1718
1730
|
return [];
|
|
1719
1731
|
T.add(x.id), b.add(x.id);
|
|
1720
1732
|
const C = o(x.id);
|
|
1721
|
-
let
|
|
1733
|
+
let L = [];
|
|
1722
1734
|
if (C.length === 0)
|
|
1723
|
-
|
|
1735
|
+
L = [[x]];
|
|
1724
1736
|
else {
|
|
1725
|
-
for (const
|
|
1726
|
-
const v = h(
|
|
1737
|
+
for (const E of C) {
|
|
1738
|
+
const v = h(E, T, b);
|
|
1727
1739
|
for (const M of v)
|
|
1728
|
-
|
|
1740
|
+
L.push([...M, x]);
|
|
1729
1741
|
}
|
|
1730
|
-
|
|
1742
|
+
L.length === 0 && (L = [[x]]);
|
|
1731
1743
|
}
|
|
1732
|
-
return T.delete(x.id),
|
|
1744
|
+
return T.delete(x.id), L.length < 100 && (this.backwardMemo.set(w, L), this.recordCacheAccess(w, !1)), L;
|
|
1733
1745
|
}, c = h(e, /* @__PURE__ */ new Set()), g = r(e, /* @__PURE__ */ new Set());
|
|
1734
1746
|
this.getDirectlyConnectedTasks(t).forEach((x) => {
|
|
1735
1747
|
this.establishCacheDependency(t, x.id), this.establishCacheDependency(x.id, t);
|
|
@@ -1739,7 +1751,7 @@ const tt = class tt {
|
|
|
1739
1751
|
for (const w of x) {
|
|
1740
1752
|
w.forEach((C) => l.set(C.id, C));
|
|
1741
1753
|
for (let C = 0; C < w.length - 1; C++) {
|
|
1742
|
-
const
|
|
1754
|
+
const L = w[C].id, E = w[C + 1].id, v = this.findLinkFast(L, E);
|
|
1743
1755
|
if (v) {
|
|
1744
1756
|
const M = `${v.from}-${v.to}-${v.type || "default"}`;
|
|
1745
1757
|
m.has(M) || (b.push(v), m.set(M, v));
|
|
@@ -2111,22 +2123,22 @@ var Mt = { exports: {} };
|
|
|
2111
2123
|
(function(e, i) {
|
|
2112
2124
|
f.exports = i();
|
|
2113
2125
|
})(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
|
|
2126
|
+
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) {
|
|
2127
|
+
return L instanceof w;
|
|
2128
|
+
}, p = function(L, E, v) {
|
|
2129
|
+
return new w(L, v, E.$l);
|
|
2130
|
+
}, u = function(L) {
|
|
2131
|
+
return i.p(L) + "s";
|
|
2132
|
+
}, y = function(L) {
|
|
2133
|
+
return L < 0;
|
|
2134
|
+
}, x = function(L) {
|
|
2135
|
+
return y(L) ? Math.ceil(L) : Math.floor(L);
|
|
2136
|
+
}, T = function(L) {
|
|
2137
|
+
return Math.abs(L);
|
|
2138
|
+
}, b = function(L, E) {
|
|
2139
|
+
return L ? y(L) ? { negative: !0, format: "" + T(L) + E } : { negative: !1, format: "" + L + E } : { negative: !1, format: "" };
|
|
2128
2140
|
}, w = function() {
|
|
2129
|
-
function
|
|
2141
|
+
function L(v, M, A) {
|
|
2130
2142
|
var _ = this;
|
|
2131
2143
|
if (this.$d = {}, this.$l = A, v === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), M) return p(v * l[u(M)], this);
|
|
2132
2144
|
if (typeof v == "number") return this.$ms = v, this.parseFromMilliseconds(), this;
|
|
@@ -2136,101 +2148,101 @@ var Mt = { exports: {} };
|
|
|
2136
2148
|
if (typeof v == "string") {
|
|
2137
2149
|
var D = v.match(d);
|
|
2138
2150
|
if (D) {
|
|
2139
|
-
var
|
|
2151
|
+
var H = D.slice(2).map(function(W) {
|
|
2140
2152
|
return W != null ? Number(W) : 0;
|
|
2141
2153
|
});
|
|
2142
|
-
return this.$d.years =
|
|
2154
|
+
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
2155
|
}
|
|
2144
2156
|
}
|
|
2145
2157
|
return this;
|
|
2146
2158
|
}
|
|
2147
|
-
var
|
|
2148
|
-
return
|
|
2159
|
+
var E = L.prototype;
|
|
2160
|
+
return E.calMilliseconds = function() {
|
|
2149
2161
|
var v = this;
|
|
2150
2162
|
this.$ms = Object.keys(this.$d).reduce(function(M, A) {
|
|
2151
2163
|
return M + (v.$d[A] || 0) * l[A];
|
|
2152
2164
|
}, 0);
|
|
2153
|
-
},
|
|
2165
|
+
}, E.parseFromMilliseconds = function() {
|
|
2154
2166
|
var v = this.$ms;
|
|
2155
2167
|
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
|
-
},
|
|
2168
|
+
}, E.toISOString = function() {
|
|
2157
2169
|
var v = b(this.$d.years, "Y"), M = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2158
2170
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
2159
|
-
var _ = b(A, "D"), D = b(this.$d.hours, "H"),
|
|
2171
|
+
var _ = b(A, "D"), D = b(this.$d.hours, "H"), H = b(this.$d.minutes, "M"), W = this.$d.seconds || 0;
|
|
2160
2172
|
this.$d.milliseconds && (W += this.$d.milliseconds / 1e3, W = Math.round(1e3 * W) / 1e3);
|
|
2161
|
-
var
|
|
2173
|
+
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
2174
|
return z === "P" || z === "-P" ? "P0D" : z;
|
|
2163
|
-
},
|
|
2175
|
+
}, E.toJSON = function() {
|
|
2164
2176
|
return this.toISOString();
|
|
2165
|
-
},
|
|
2177
|
+
}, E.format = function(v) {
|
|
2166
2178
|
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
2179
|
return M.replace(h, function(_, D) {
|
|
2168
2180
|
return D || String(A[_]);
|
|
2169
2181
|
});
|
|
2170
|
-
},
|
|
2182
|
+
}, E.as = function(v) {
|
|
2171
2183
|
return this.$ms / l[u(v)];
|
|
2172
|
-
},
|
|
2184
|
+
}, E.get = function(v) {
|
|
2173
2185
|
var M = this.$ms, A = u(v);
|
|
2174
2186
|
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ? x(M / l[A]) : this.$d[A], M || 0;
|
|
2175
|
-
},
|
|
2187
|
+
}, E.add = function(v, M, A) {
|
|
2176
2188
|
var _;
|
|
2177
2189
|
return _ = M ? v * l[u(M)] : m(v) ? v.$ms : p(v, this).$ms, p(this.$ms + _ * (A ? -1 : 1), this);
|
|
2178
|
-
},
|
|
2190
|
+
}, E.subtract = function(v, M) {
|
|
2179
2191
|
return this.add(v, M, !0);
|
|
2180
|
-
},
|
|
2192
|
+
}, E.locale = function(v) {
|
|
2181
2193
|
var M = this.clone();
|
|
2182
2194
|
return M.$l = v, M;
|
|
2183
|
-
},
|
|
2195
|
+
}, E.clone = function() {
|
|
2184
2196
|
return p(this.$ms, this);
|
|
2185
|
-
},
|
|
2197
|
+
}, E.humanize = function(v) {
|
|
2186
2198
|
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!v);
|
|
2187
|
-
},
|
|
2199
|
+
}, E.valueOf = function() {
|
|
2188
2200
|
return this.asMilliseconds();
|
|
2189
|
-
},
|
|
2201
|
+
}, E.milliseconds = function() {
|
|
2190
2202
|
return this.get("milliseconds");
|
|
2191
|
-
},
|
|
2203
|
+
}, E.asMilliseconds = function() {
|
|
2192
2204
|
return this.as("milliseconds");
|
|
2193
|
-
},
|
|
2205
|
+
}, E.seconds = function() {
|
|
2194
2206
|
return this.get("seconds");
|
|
2195
|
-
},
|
|
2207
|
+
}, E.asSeconds = function() {
|
|
2196
2208
|
return this.as("seconds");
|
|
2197
|
-
},
|
|
2209
|
+
}, E.minutes = function() {
|
|
2198
2210
|
return this.get("minutes");
|
|
2199
|
-
},
|
|
2211
|
+
}, E.asMinutes = function() {
|
|
2200
2212
|
return this.as("minutes");
|
|
2201
|
-
},
|
|
2213
|
+
}, E.hours = function() {
|
|
2202
2214
|
return this.get("hours");
|
|
2203
|
-
},
|
|
2215
|
+
}, E.asHours = function() {
|
|
2204
2216
|
return this.as("hours");
|
|
2205
|
-
},
|
|
2217
|
+
}, E.days = function() {
|
|
2206
2218
|
return this.get("days");
|
|
2207
|
-
},
|
|
2219
|
+
}, E.asDays = function() {
|
|
2208
2220
|
return this.as("days");
|
|
2209
|
-
},
|
|
2221
|
+
}, E.weeks = function() {
|
|
2210
2222
|
return this.get("weeks");
|
|
2211
|
-
},
|
|
2223
|
+
}, E.asWeeks = function() {
|
|
2212
2224
|
return this.as("weeks");
|
|
2213
|
-
},
|
|
2225
|
+
}, E.months = function() {
|
|
2214
2226
|
return this.get("months");
|
|
2215
|
-
},
|
|
2227
|
+
}, E.asMonths = function() {
|
|
2216
2228
|
return this.as("months");
|
|
2217
|
-
},
|
|
2229
|
+
}, E.years = function() {
|
|
2218
2230
|
return this.get("years");
|
|
2219
|
-
},
|
|
2231
|
+
}, E.asYears = function() {
|
|
2220
2232
|
return this.as("years");
|
|
2221
|
-
},
|
|
2222
|
-
}(), C = function(
|
|
2223
|
-
return
|
|
2233
|
+
}, L;
|
|
2234
|
+
}(), C = function(L, E, v) {
|
|
2235
|
+
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
2236
|
};
|
|
2225
|
-
return function(
|
|
2237
|
+
return function(L, E, v) {
|
|
2226
2238
|
e = v, i = v().$utils(), v.duration = function(_, D) {
|
|
2227
|
-
var
|
|
2228
|
-
return p(_, { $l:
|
|
2239
|
+
var H = v.locale();
|
|
2240
|
+
return p(_, { $l: H }, D);
|
|
2229
2241
|
}, v.isDuration = m;
|
|
2230
|
-
var M =
|
|
2231
|
-
|
|
2242
|
+
var M = E.prototype.add, A = E.prototype.subtract;
|
|
2243
|
+
E.prototype.add = function(_, D) {
|
|
2232
2244
|
return m(_) ? C(this, _, 1) : M.bind(this)(_, D);
|
|
2233
|
-
},
|
|
2245
|
+
}, E.prototype.subtract = function(_, D) {
|
|
2234
2246
|
return m(_) ? C(this, _, -1) : A.bind(this)(_, D);
|
|
2235
2247
|
};
|
|
2236
2248
|
};
|
|
@@ -2295,8 +2307,8 @@ var At = { exports: {} };
|
|
|
2295
2307
|
});
|
|
2296
2308
|
if (!u) return b;
|
|
2297
2309
|
var w = y.weekStart;
|
|
2298
|
-
return b.map(function(C,
|
|
2299
|
-
return b[(
|
|
2310
|
+
return b.map(function(C, L) {
|
|
2311
|
+
return b[(L + (w || 0)) % 7];
|
|
2300
2312
|
});
|
|
2301
2313
|
}, h = function() {
|
|
2302
2314
|
return s.Ls[s.locale()];
|
|
@@ -2359,7 +2371,7 @@ var At = { exports: {} };
|
|
|
2359
2371
|
})(At);
|
|
2360
2372
|
var ce = At.exports;
|
|
2361
2373
|
const de = /* @__PURE__ */ U(ce);
|
|
2362
|
-
var
|
|
2374
|
+
var It = { exports: {} };
|
|
2363
2375
|
(function(f, t) {
|
|
2364
2376
|
(function(e, i) {
|
|
2365
2377
|
f.exports = i();
|
|
@@ -2381,10 +2393,10 @@ var Ht = { exports: {} };
|
|
|
2381
2393
|
};
|
|
2382
2394
|
};
|
|
2383
2395
|
});
|
|
2384
|
-
})(
|
|
2385
|
-
var ue =
|
|
2396
|
+
})(It);
|
|
2397
|
+
var ue = It.exports;
|
|
2386
2398
|
const ge = /* @__PURE__ */ U(ue);
|
|
2387
|
-
var
|
|
2399
|
+
var Ht = { exports: {} };
|
|
2388
2400
|
(function(f, t) {
|
|
2389
2401
|
(function(e, i) {
|
|
2390
2402
|
f.exports = i();
|
|
@@ -2396,8 +2408,8 @@ var It = { exports: {} };
|
|
|
2396
2408
|
};
|
|
2397
2409
|
};
|
|
2398
2410
|
});
|
|
2399
|
-
})(
|
|
2400
|
-
var fe =
|
|
2411
|
+
})(Ht);
|
|
2412
|
+
var fe = Ht.exports;
|
|
2401
2413
|
const pe = /* @__PURE__ */ U(fe);
|
|
2402
2414
|
var Gt = { exports: {} };
|
|
2403
2415
|
(function(f, t) {
|
|
@@ -2515,8 +2527,8 @@ var $t = { exports: {} };
|
|
|
2515
2527
|
var x = p[y], T = x.type, b = x.value, w = e[T];
|
|
2516
2528
|
w >= 0 && (u[w] = parseInt(b, 10));
|
|
2517
2529
|
}
|
|
2518
|
-
var C = u[3],
|
|
2519
|
-
return (o.utc(
|
|
2530
|
+
var C = u[3], L = C === 24 ? 0 : C, E = u[0] + "-" + u[1] + "-" + u[2] + " " + L + ":" + u[4] + ":" + u[5] + ":000", v = +l;
|
|
2531
|
+
return (o.utc(E).valueOf() - (v -= v % 1e3)) / 6e4;
|
|
2520
2532
|
}, g = n.prototype;
|
|
2521
2533
|
g.tz = function(l, m) {
|
|
2522
2534
|
l === void 0 && (l = r);
|
|
@@ -2541,11 +2553,11 @@ var $t = { exports: {} };
|
|
|
2541
2553
|
}, o.tz = function(l, m, p) {
|
|
2542
2554
|
var u = p && m, y = p || m || r, x = c(+o(), y);
|
|
2543
2555
|
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] : [
|
|
2556
|
+
var T = function(L, E, v) {
|
|
2557
|
+
var M = L - 60 * E * 1e3, A = c(M, v);
|
|
2558
|
+
if (E === A) return [M, E];
|
|
2559
|
+
var _ = c(M -= 60 * (A - E) * 1e3, v);
|
|
2560
|
+
return A === _ ? [M, A] : [L - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
2549
2561
|
}(o.utc(l, u).valueOf(), x, y), b = T[0], w = T[1], C = o(b).utcOffset(w);
|
|
2550
2562
|
return C.$x.$timezone = y, C;
|
|
2551
2563
|
}, o.tz.guess = function() {
|
|
@@ -2592,9 +2604,9 @@ var Ft = { exports: {} };
|
|
|
2592
2604
|
if (x(u)) return this.$u ? 0 : x(this.$offset) ? d.call(this) : this.$offset;
|
|
2593
2605
|
if (typeof u == "string" && (u = function(C) {
|
|
2594
2606
|
C === void 0 && (C = "");
|
|
2595
|
-
var
|
|
2596
|
-
if (!
|
|
2597
|
-
var
|
|
2607
|
+
var L = C.match(i);
|
|
2608
|
+
if (!L) return null;
|
|
2609
|
+
var E = ("" + L[0]).match(s) || ["-", 0, 0], v = E[0], M = 60 * +E[1] + +E[2];
|
|
2598
2610
|
return M === 0 ? 0 : v === "+" ? M : -M;
|
|
2599
2611
|
}(u), u === null)) return this;
|
|
2600
2612
|
var T = Math.abs(u) <= 16 ? 60 * u : u, b = this;
|
|
@@ -2633,8 +2645,8 @@ var Ft = { exports: {} };
|
|
|
2633
2645
|
});
|
|
2634
2646
|
})(Ft);
|
|
2635
2647
|
var ke = Ft.exports;
|
|
2636
|
-
const
|
|
2637
|
-
var
|
|
2648
|
+
const Ee = /* @__PURE__ */ U(ke);
|
|
2649
|
+
var Ce = { exports: {} };
|
|
2638
2650
|
(function(f, t) {
|
|
2639
2651
|
(function(e, i) {
|
|
2640
2652
|
f.exports = i();
|
|
@@ -2644,8 +2656,8 @@ var Le = { exports: {} };
|
|
|
2644
2656
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
2645
2657
|
} };
|
|
2646
2658
|
});
|
|
2647
|
-
})(
|
|
2648
|
-
var
|
|
2659
|
+
})(Ce);
|
|
2660
|
+
var Le = { exports: {} };
|
|
2649
2661
|
(function(f, t) {
|
|
2650
2662
|
(function(e, i) {
|
|
2651
2663
|
f.exports = i(G);
|
|
@@ -2661,7 +2673,7 @@ var Ee = { exports: {} };
|
|
|
2661
2673
|
} };
|
|
2662
2674
|
return s.default.locale(n, null, !0), n;
|
|
2663
2675
|
});
|
|
2664
|
-
})(
|
|
2676
|
+
})(Le);
|
|
2665
2677
|
const Me = (f, t) => {
|
|
2666
2678
|
const e = t.prototype;
|
|
2667
2679
|
e.setLocale = function(s) {
|
|
@@ -2683,7 +2695,7 @@ G.extend(xe);
|
|
|
2683
2695
|
G.extend(we);
|
|
2684
2696
|
G.extend(Te);
|
|
2685
2697
|
G.extend(Se);
|
|
2686
|
-
G.extend(
|
|
2698
|
+
G.extend(Ee);
|
|
2687
2699
|
G.extend(Me);
|
|
2688
2700
|
function vt(f) {
|
|
2689
2701
|
try {
|
|
@@ -2809,7 +2821,7 @@ class Oe {
|
|
|
2809
2821
|
quarter: s.cellWidth
|
|
2810
2822
|
} : V(s.cellWidth) ? this.cellWidth = Z(
|
|
2811
2823
|
ut()[s.cellWidth] || ut().normal
|
|
2812
|
-
) :
|
|
2824
|
+
) : Et(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2813
2825
|
}
|
|
2814
2826
|
update(t) {
|
|
2815
2827
|
this.init(t, !1), this.endTime = this.targetEnd.clone();
|
|
@@ -3191,7 +3203,7 @@ class _e {
|
|
|
3191
3203
|
}
|
|
3192
3204
|
// --- 事件处理 ---
|
|
3193
3205
|
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(
|
|
3206
|
+
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
3207
|
x: this.scrollLeft,
|
|
3196
3208
|
y: this.scrollTop,
|
|
3197
3209
|
source: t
|
|
@@ -3465,7 +3477,7 @@ class st {
|
|
|
3465
3477
|
const t = document.createElement("div");
|
|
3466
3478
|
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
3479
|
const e = document.createElement("div");
|
|
3468
|
-
e.style.display = "flex", e.style.flex = "0.5", e.style.justifyContent = "center", e.style.alignItems = "center", new
|
|
3480
|
+
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
3481
|
}
|
|
3470
3482
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
3471
3483
|
const e = document.createElement("div");
|
|
@@ -3521,28 +3533,28 @@ class St {
|
|
|
3521
3533
|
*/
|
|
3522
3534
|
bindEvents() {
|
|
3523
3535
|
this.element.addEventListener("mouseenter", () => {
|
|
3524
|
-
this.context.event.emit(
|
|
3536
|
+
this.context.event.emit(k.ROW_HIGHLIGHT, this.task.id);
|
|
3525
3537
|
}), this.element.addEventListener("mouseleave", () => {
|
|
3526
|
-
this.context.event.emit(
|
|
3538
|
+
this.context.event.emit(k.ROW_UNHIGHLIGHT, this.task.id);
|
|
3527
3539
|
}), 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(
|
|
3540
|
+
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
3541
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
3530
|
-
this.context.event.emit(
|
|
3542
|
+
this.context.event.emit(k.ROW_DBL_CLICK, t, this.task);
|
|
3531
3543
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
3532
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3544
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(k.ROW_CONTEXTMENU, t, this.task);
|
|
3533
3545
|
});
|
|
3534
3546
|
}
|
|
3535
3547
|
/**
|
|
3536
3548
|
* 注册全局接收事件
|
|
3537
3549
|
*/
|
|
3538
3550
|
registerEvents() {
|
|
3539
|
-
this.context.event.on(
|
|
3551
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
3540
3552
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
3541
|
-
}), this.context.event.on(
|
|
3553
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
3542
3554
|
this.task.id === t && this.element.classList.remove("hover");
|
|
3543
|
-
}), this.context.event.on(
|
|
3555
|
+
}), this.context.event.on(k.TASK_SELECTED, (t) => {
|
|
3544
3556
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
3545
|
-
}), this.context.event.on(
|
|
3557
|
+
}), this.context.event.on(k.TASK_UNSELECTED, (t) => {
|
|
3546
3558
|
this.task.id === t && this.element.classList.remove("selected");
|
|
3547
3559
|
});
|
|
3548
3560
|
}
|
|
@@ -3813,14 +3825,14 @@ class pt {
|
|
|
3813
3825
|
const o = (c) => {
|
|
3814
3826
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3815
3827
|
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(
|
|
3828
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(k.SHOW_GUIDELINE, n);
|
|
3817
3829
|
}, r = (c) => {
|
|
3818
3830
|
if (c.preventDefault(), !s) return;
|
|
3819
3831
|
const g = c.clientX - e, d = i + g, l = Math.max(50, d), m = e - s.left - i, u = this.root.clientWidth - 20;
|
|
3820
3832
|
let y = m + l;
|
|
3821
|
-
y = Math.min(u, y), this.context.event.emit(
|
|
3833
|
+
y = Math.min(u, y), this.context.event.emit(k.MOVE_GUIDELINE, y);
|
|
3822
3834
|
}, h = (c, g, d) => {
|
|
3823
|
-
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(
|
|
3835
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(k.HIDE_GUIDELINE);
|
|
3824
3836
|
const l = c.clientX - e, m = Math.max(50, i + l);
|
|
3825
3837
|
this.setWidth(m);
|
|
3826
3838
|
};
|
|
@@ -3871,7 +3883,7 @@ class xt {
|
|
|
3871
3883
|
});
|
|
3872
3884
|
}
|
|
3873
3885
|
}
|
|
3874
|
-
class
|
|
3886
|
+
class Ie {
|
|
3875
3887
|
constructor(t, e) {
|
|
3876
3888
|
a(this, "headerElement");
|
|
3877
3889
|
a(this, "headerColumns", []);
|
|
@@ -3931,12 +3943,12 @@ class He {
|
|
|
3931
3943
|
});
|
|
3932
3944
|
}
|
|
3933
3945
|
}
|
|
3934
|
-
class
|
|
3946
|
+
class He {
|
|
3935
3947
|
constructor(t, e) {
|
|
3936
3948
|
a(this, "tableContainer");
|
|
3937
3949
|
a(this, "tableHeader");
|
|
3938
3950
|
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
|
|
3951
|
+
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
3952
|
}
|
|
3941
3953
|
render(t, e) {
|
|
3942
3954
|
this.tableHeader.render(), this.refresh(t, e);
|
|
@@ -3951,9 +3963,9 @@ class Ie {
|
|
|
3951
3963
|
this.tableBody.updateTask(t);
|
|
3952
3964
|
}
|
|
3953
3965
|
listenEvents() {
|
|
3954
|
-
this.context.event.on(
|
|
3966
|
+
this.context.event.on(k.UPDATE_TABLE_HEADER, () => {
|
|
3955
3967
|
this.tableHeader.render();
|
|
3956
|
-
}), this.context.event.on(
|
|
3968
|
+
}), this.context.event.on(k.UPDATE_TABLE_BODY, () => {
|
|
3957
3969
|
this.tableBody.update();
|
|
3958
3970
|
});
|
|
3959
3971
|
}
|
|
@@ -3993,11 +4005,11 @@ class Ge {
|
|
|
3993
4005
|
* 注册事件监听
|
|
3994
4006
|
*/
|
|
3995
4007
|
registerEvents() {
|
|
3996
|
-
this.context.event.on(
|
|
4008
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
3997
4009
|
this.highlightDate(t);
|
|
3998
|
-
}), this.context.event.on(
|
|
4010
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
3999
4011
|
this.unhighlightDate(t);
|
|
4000
|
-
}), this.context.event.on(
|
|
4012
|
+
}), this.context.event.on(k.UPDATE_TASK, (t) => {
|
|
4001
4013
|
this.highlightDate(t.id);
|
|
4002
4014
|
});
|
|
4003
4015
|
}
|
|
@@ -4054,10 +4066,10 @@ class Ge {
|
|
|
4054
4066
|
for (; d.children[y + T] && x.label === d.children[y + T].label; )
|
|
4055
4067
|
T++;
|
|
4056
4068
|
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
|
-
|
|
4069
|
+
let L = 0;
|
|
4070
|
+
for (; r[g + 1].children[L] && x.label === r[g + 1].children[L].label; )
|
|
4071
|
+
r[g + 1].children[L].hide = !0, L++;
|
|
4072
|
+
L > 0 && (T += L);
|
|
4061
4073
|
}
|
|
4062
4074
|
const b = e * T;
|
|
4063
4075
|
if (u + b < i) {
|
|
@@ -4303,12 +4315,12 @@ class We {
|
|
|
4303
4315
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
4304
4316
|
}
|
|
4305
4317
|
registerEvents() {
|
|
4306
|
-
this.context.event.on(
|
|
4318
|
+
this.context.event.on(k.SLIDER_BLINK, (t) => {
|
|
4307
4319
|
t === this.task.id && this.handleBarBlink();
|
|
4308
4320
|
});
|
|
4309
4321
|
}
|
|
4310
4322
|
render() {
|
|
4311
|
-
var p, u, y, x, T, b, w, C,
|
|
4323
|
+
var p, u, y, x, T, b, w, C, L, E, v, M, A;
|
|
4312
4324
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4313
4325
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4314
4326
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
@@ -4323,8 +4335,8 @@ class We {
|
|
|
4323
4335
|
this.slider || (this.slider = new S.Group({
|
|
4324
4336
|
dragBoundFunc: (_) => {
|
|
4325
4337
|
let D = Math.min(0, -(-this.offsetX - this.slider.x()));
|
|
4326
|
-
const
|
|
4327
|
-
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(
|
|
4338
|
+
const H = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime);
|
|
4339
|
+
let W = this.sliderGroup.getStage().width() - this.slider.width() + Math.abs(H - (-this.offsetX + this.sliderGroup.getStage().width()));
|
|
4328
4340
|
if (this.context.getOptions().bar.move.link.parent === "strict" && this.task.parent) {
|
|
4329
4341
|
if (this.task.parent.startTime) {
|
|
4330
4342
|
const R = this.task.parent.startTime;
|
|
@@ -4348,17 +4360,19 @@ class We {
|
|
|
4348
4360
|
shadowBlur: Math.max((g || 1) * 2, 4),
|
|
4349
4361
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4350
4362
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4351
|
-
}), this.context.event.emit(
|
|
4363
|
+
}), this.context.event.emit(k.SLIDER_ENTER, _.evt, this.task);
|
|
4364
|
+
}), this.slider.on("mousemove", (_) => {
|
|
4365
|
+
this.context.event.emit(k.SLIDER_HOVER, _.evt, this.task);
|
|
4352
4366
|
}), this.slider.on("mouseout", (_) => {
|
|
4353
4367
|
m && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4354
4368
|
shadowColor: c,
|
|
4355
4369
|
shadowBlur: g,
|
|
4356
4370
|
shadowOffsetX: d,
|
|
4357
4371
|
shadowOffsetY: l
|
|
4358
|
-
}), this.context.event.emit(
|
|
4372
|
+
}), this.context.event.emit(k.SLIDER_LEAVE, _.evt, this.task);
|
|
4359
4373
|
}), this.task.isMilestone()) {
|
|
4360
4374
|
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),
|
|
4375
|
+
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
4376
|
if (!this.sliderBar) {
|
|
4363
4377
|
switch (R) {
|
|
4364
4378
|
case "triangle":
|
|
@@ -4366,9 +4380,9 @@ class We {
|
|
|
4366
4380
|
sides: 3,
|
|
4367
4381
|
radius: D,
|
|
4368
4382
|
rotation: 0,
|
|
4369
|
-
fill:
|
|
4383
|
+
fill: H,
|
|
4370
4384
|
stroke: W,
|
|
4371
|
-
strokeWidth:
|
|
4385
|
+
strokeWidth: I,
|
|
4372
4386
|
y: D / 3 * 2
|
|
4373
4387
|
// 居中
|
|
4374
4388
|
});
|
|
@@ -4376,9 +4390,9 @@ class We {
|
|
|
4376
4390
|
case "circle":
|
|
4377
4391
|
this.sliderBar = new S.Circle({
|
|
4378
4392
|
radius: D,
|
|
4379
|
-
fill:
|
|
4393
|
+
fill: H,
|
|
4380
4394
|
stroke: W,
|
|
4381
|
-
strokeWidth:
|
|
4395
|
+
strokeWidth: I,
|
|
4382
4396
|
y: D / 2
|
|
4383
4397
|
// 居中
|
|
4384
4398
|
});
|
|
@@ -4388,9 +4402,9 @@ class We {
|
|
|
4388
4402
|
numPoints: 5,
|
|
4389
4403
|
innerRadius: D / 2,
|
|
4390
4404
|
outerRadius: D,
|
|
4391
|
-
fill:
|
|
4405
|
+
fill: H,
|
|
4392
4406
|
stroke: W,
|
|
4393
|
-
strokeWidth:
|
|
4407
|
+
strokeWidth: I,
|
|
4394
4408
|
y: D / 2
|
|
4395
4409
|
// 居中
|
|
4396
4410
|
});
|
|
@@ -4401,9 +4415,9 @@ class We {
|
|
|
4401
4415
|
sides: 4,
|
|
4402
4416
|
radius: D,
|
|
4403
4417
|
rotation: 0,
|
|
4404
|
-
fill:
|
|
4418
|
+
fill: H,
|
|
4405
4419
|
stroke: W,
|
|
4406
|
-
strokeWidth:
|
|
4420
|
+
strokeWidth: I,
|
|
4407
4421
|
y: D / 2
|
|
4408
4422
|
// 居中
|
|
4409
4423
|
});
|
|
@@ -4412,7 +4426,7 @@ class We {
|
|
|
4412
4426
|
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
4427
|
height: e,
|
|
4414
4428
|
text: F,
|
|
4415
|
-
fill: Nt ||
|
|
4429
|
+
fill: Nt || H,
|
|
4416
4430
|
fontSize: q,
|
|
4417
4431
|
fontFamily: zt
|
|
4418
4432
|
}), at = it.measureSize(F);
|
|
@@ -4439,18 +4453,18 @@ class We {
|
|
|
4439
4453
|
this.sliderType = "milestone";
|
|
4440
4454
|
} else if (this.task.isSummary() && (this.context.getOptions().summary.mode === "always" || this.task.expanded)) {
|
|
4441
4455
|
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,
|
|
4456
|
+
const _ = this.unpackFunc(this.context.getOptions().summary.color) || r, D = t * 0.2, H = t * 0.3, W = (I) => new S.Shape({
|
|
4443
4457
|
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 +
|
|
4458
|
+
const z = H * 0.5;
|
|
4459
|
+
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
4460
|
},
|
|
4447
|
-
width:
|
|
4461
|
+
width: I,
|
|
4448
4462
|
fill: _,
|
|
4449
4463
|
shadowColor: c,
|
|
4450
4464
|
shadowBlur: g,
|
|
4451
4465
|
shadowOffsetX: d,
|
|
4452
4466
|
shadowOffsetY: l,
|
|
4453
|
-
y: -(
|
|
4467
|
+
y: -(H + D) / 2 - i / 2
|
|
4454
4468
|
});
|
|
4455
4469
|
!this.sliderBar || this.sliderBar.width() !== o ? (this.sliderBar && this.sliderBar.destroy(), this.sliderBar = W(o), this.slider.add(this.sliderBar)) : this.sliderBar.setAttrs({
|
|
4456
4470
|
fill: _,
|
|
@@ -4469,7 +4483,7 @@ class We {
|
|
|
4469
4483
|
fill: r,
|
|
4470
4484
|
cornerRadius: h
|
|
4471
4485
|
}), 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,
|
|
4486
|
+
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
4487
|
if (!!this.unpackFunc((b = this.context.getOptions().bar.move.single) == null ? void 0 : b.left)) {
|
|
4474
4488
|
if (!this.leftHandleGroup) {
|
|
4475
4489
|
this.leftHandleGroup = new S.Group({
|
|
@@ -4504,7 +4518,7 @@ class We {
|
|
|
4504
4518
|
(w = this.leftHandleGroup.findOne("Rect")) == null || w.setAttrs({
|
|
4505
4519
|
width: this.handlerWidth,
|
|
4506
4520
|
height: e,
|
|
4507
|
-
fill:
|
|
4521
|
+
fill: H,
|
|
4508
4522
|
cornerRadius: [h[0], 0, 0, h[3]]
|
|
4509
4523
|
}), (C = this.leftHandleGroup.findOne("Image")) == null || C.setAttrs({
|
|
4510
4524
|
x: 0,
|
|
@@ -4513,7 +4527,7 @@ class We {
|
|
|
4513
4527
|
height: this.handlerWidth
|
|
4514
4528
|
});
|
|
4515
4529
|
} else this.leftHandleGroup && (this.leftHandleGroup.remove(), this.leftHandleGroup = null);
|
|
4516
|
-
if (!!this.unpackFunc((
|
|
4530
|
+
if (!!this.unpackFunc((L = this.context.getOptions().bar.move.single) == null ? void 0 : L.right)) {
|
|
4517
4531
|
if (!this.rightHandleGroup) {
|
|
4518
4532
|
this.rightHandleGroup = new S.Group({
|
|
4519
4533
|
x: 0,
|
|
@@ -4544,11 +4558,11 @@ class We {
|
|
|
4544
4558
|
(q = this.rightHandleGroup) == null || q.add(z);
|
|
4545
4559
|
});
|
|
4546
4560
|
}
|
|
4547
|
-
(
|
|
4561
|
+
(E = this.rightHandleGroup.findOne("Rect")) == null || E.setAttrs({
|
|
4548
4562
|
x: o - this.handlerWidth,
|
|
4549
4563
|
width: this.handlerWidth,
|
|
4550
4564
|
height: e,
|
|
4551
|
-
fill:
|
|
4565
|
+
fill: H,
|
|
4552
4566
|
cornerRadius: [0, h[1], h[2], 0]
|
|
4553
4567
|
}), (v = this.rightHandleGroup.findOne("Image")) == null || v.setAttrs({
|
|
4554
4568
|
x: o - this.handlerWidth,
|
|
@@ -4637,16 +4651,16 @@ class We {
|
|
|
4637
4651
|
opacity: this.unpackFunc((h = this.context.getOptions().bar.progress) == null ? void 0 : h.opacity)
|
|
4638
4652
|
});
|
|
4639
4653
|
this.progressGroup.add(C);
|
|
4640
|
-
const
|
|
4654
|
+
const L = `${gt(
|
|
4641
4655
|
u * 100,
|
|
4642
4656
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4643
|
-
)}%`,
|
|
4657
|
+
)}%`, 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
4658
|
x: 0,
|
|
4645
4659
|
y: v === "top" ? -e : 0,
|
|
4646
|
-
width: v === "right" ? w +
|
|
4660
|
+
width: v === "right" ? w + E : Math.max(w, E),
|
|
4647
4661
|
height: e,
|
|
4648
4662
|
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:
|
|
4663
|
+
text: L,
|
|
4650
4664
|
fontSize: this.unpackFunc((l = this.context.getOptions().bar.progress) == null ? void 0 : l.fontSize) || 10,
|
|
4651
4665
|
fontStyle: this.unpackFunc((m = this.context.getOptions().bar.progress) == null ? void 0 : m.fontStyle) || "italic",
|
|
4652
4666
|
fontFamily: "Arial",
|
|
@@ -4667,11 +4681,11 @@ class We {
|
|
|
4667
4681
|
const e = t.target.getStage();
|
|
4668
4682
|
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
4669
4683
|
}), this.slider.on("click", (t) => {
|
|
4670
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
4684
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(k.SLIDER_CLICK, t.evt, this.task));
|
|
4671
4685
|
}), this.slider.on("contextmenu", (t) => {
|
|
4672
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
4686
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(k.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
4673
4687
|
}), this.slider.on("dblclick", (t) => {
|
|
4674
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
4688
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(k.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
4675
4689
|
}));
|
|
4676
4690
|
}
|
|
4677
4691
|
/**
|
|
@@ -4684,7 +4698,7 @@ class We {
|
|
|
4684
4698
|
handleDragStart(t) {
|
|
4685
4699
|
const e = t.target.getStage();
|
|
4686
4700
|
if (!e) return;
|
|
4687
|
-
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(
|
|
4701
|
+
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(k.SLIDER_DRAGGING, !0), e.container().style.cursor = "grabbing";
|
|
4688
4702
|
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ct(i, s);
|
|
4689
4703
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4690
4704
|
}
|
|
@@ -4697,7 +4711,7 @@ class We {
|
|
|
4697
4711
|
}
|
|
4698
4712
|
handleDragEnd(t) {
|
|
4699
4713
|
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.dragDiffX = 0, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
4700
|
-
|
|
4714
|
+
k.TASK_DRAG_END,
|
|
4701
4715
|
this.task,
|
|
4702
4716
|
this.oldTasks
|
|
4703
4717
|
), this.oldTasks = []);
|
|
@@ -4717,7 +4731,7 @@ class We {
|
|
|
4717
4731
|
}
|
|
4718
4732
|
}
|
|
4719
4733
|
}
|
|
4720
|
-
this.context.event.emit(
|
|
4734
|
+
this.context.event.emit(k.SLIDER_DRAGGING, !1);
|
|
4721
4735
|
}
|
|
4722
4736
|
handleMove(t, e) {
|
|
4723
4737
|
const i = e.width(), s = !!this.context.getOptions().bar.move.lock, n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = t.target.width(), h = t.target.x(), c = h + r, g = Math.max(0, -this.offsetX - h), d = Math.max(0, c - (-this.offsetX + i));
|
|
@@ -4759,13 +4773,13 @@ class We {
|
|
|
4759
4773
|
t.cancelBubble = !0;
|
|
4760
4774
|
const i = t.target.getStage();
|
|
4761
4775
|
if (!i) return;
|
|
4762
|
-
this.isDragging = !0, this.context.event.emit(
|
|
4776
|
+
this.isDragging = !0, this.context.event.emit(k.SLIDER_DRAGGING, !0);
|
|
4763
4777
|
let s = ((y = i.getPointerPosition()) == null ? void 0 : y.x) || 0;
|
|
4764
4778
|
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
4779
|
let c = 0, g = 0;
|
|
4766
4780
|
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 (
|
|
4781
|
+
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;
|
|
4782
|
+
if (L && e === "left") {
|
|
4769
4783
|
if (w <= 0)
|
|
4770
4784
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
4771
4785
|
else if (this.draggingDirection === "left") {
|
|
@@ -4776,7 +4790,7 @@ class We {
|
|
|
4776
4790
|
} else
|
|
4777
4791
|
this.stopAutoScroll();
|
|
4778
4792
|
this.emitUpdate("left");
|
|
4779
|
-
} else if (
|
|
4793
|
+
} else if (E && e === "right") {
|
|
4780
4794
|
if (C >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4781
4795
|
this.slider.width(
|
|
4782
4796
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
@@ -4819,7 +4833,7 @@ class We {
|
|
|
4819
4833
|
if (this.autoExpandTimer) return;
|
|
4820
4834
|
const s = this.context.store.getTimeAxis();
|
|
4821
4835
|
this.autoExpandTimer = window.setInterval(() => {
|
|
4822
|
-
s.expand(t, 1), this.context.event.emit(
|
|
4836
|
+
s.expand(t, 1), this.context.event.emit(k.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(e);
|
|
4823
4837
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
4824
4838
|
}
|
|
4825
4839
|
// 开始自动滚动
|
|
@@ -5007,13 +5021,13 @@ class Fe {
|
|
|
5007
5021
|
* 注册事件监听
|
|
5008
5022
|
*/
|
|
5009
5023
|
registerEvents() {
|
|
5010
|
-
this.context.event.on(
|
|
5024
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
5011
5025
|
this.highlightRow(t);
|
|
5012
|
-
}), this.context.event.on(
|
|
5026
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
5013
5027
|
this.unhighlightRow(t);
|
|
5014
|
-
}), this.context.event.on(
|
|
5028
|
+
}), this.context.event.on(k.TASK_SELECTED, (t) => {
|
|
5015
5029
|
this.selectRow(t.id);
|
|
5016
|
-
}), this.context.event.on(
|
|
5030
|
+
}), this.context.event.on(k.TASK_UNSELECTED, (t) => {
|
|
5017
5031
|
this.unselectRow(t);
|
|
5018
5032
|
});
|
|
5019
5033
|
}
|
|
@@ -5025,9 +5039,9 @@ class Fe {
|
|
|
5025
5039
|
if (!e) return;
|
|
5026
5040
|
const i = this.getTaskByPosition(e);
|
|
5027
5041
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
5028
|
-
|
|
5042
|
+
k.ROW_UNHIGHLIGHT,
|
|
5029
5043
|
this.highlightedRowId
|
|
5030
|
-
), i && this.context.event.emit(
|
|
5044
|
+
), i && this.context.event.emit(k.ROW_HIGHLIGHT, i.id);
|
|
5031
5045
|
}
|
|
5032
5046
|
/**
|
|
5033
5047
|
* 处理鼠标离开
|
|
@@ -5045,7 +5059,7 @@ class Fe {
|
|
|
5045
5059
|
const i = this.getTaskByPosition(e);
|
|
5046
5060
|
if (i) {
|
|
5047
5061
|
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
5048
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(
|
|
5062
|
+
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(k.ROW_CLICK, t.evt, i);
|
|
5049
5063
|
}
|
|
5050
5064
|
}
|
|
5051
5065
|
/**
|
|
@@ -5056,7 +5070,7 @@ class Fe {
|
|
|
5056
5070
|
const e = this.stage.getPointerPosition();
|
|
5057
5071
|
if (!e) return;
|
|
5058
5072
|
const i = this.getTaskByPosition(e);
|
|
5059
|
-
i && this.context.event.emit(
|
|
5073
|
+
i && this.context.event.emit(k.ROW_DBL_CLICK, t.evt, i);
|
|
5060
5074
|
}
|
|
5061
5075
|
/**
|
|
5062
5076
|
* 处理右键菜单
|
|
@@ -5067,7 +5081,7 @@ class Fe {
|
|
|
5067
5081
|
const e = this.stage.getPointerPosition();
|
|
5068
5082
|
if (!e) return;
|
|
5069
5083
|
const i = this.getTaskByPosition(e);
|
|
5070
|
-
i && this.context.event.emit(
|
|
5084
|
+
i && this.context.event.emit(k.ROW_CONTEXTMENU, t.evt, i);
|
|
5071
5085
|
}
|
|
5072
5086
|
/**
|
|
5073
5087
|
* 按照位置获取任务
|
|
@@ -5161,7 +5175,7 @@ class Fe {
|
|
|
5161
5175
|
if (!this.selectedRect || this.selectedRowId === null) return;
|
|
5162
5176
|
const e = this.rowsCache.get(`chart-row-${this.selectedRowId}`);
|
|
5163
5177
|
if (e)
|
|
5164
|
-
if (this.
|
|
5178
|
+
if (this.context.store.getDataManager().getVisibleTasks().find((i) => i.id === e.task.id)) {
|
|
5165
5179
|
const s = e.task.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height;
|
|
5166
5180
|
this.selectedRect.y(s + this.offsetY), this.layer.batchDraw();
|
|
5167
5181
|
} else
|
|
@@ -5453,7 +5467,7 @@ class ze {
|
|
|
5453
5467
|
stroke: r,
|
|
5454
5468
|
strokeWidth: g
|
|
5455
5469
|
}), 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),
|
|
5470
|
+
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((m = this.context.getOptions().today.text) == null ? void 0 : m.fontFamily) || "Arial", w = ((p = this.context.getOptions().today.text) == null ? void 0 : p.content) || "今天", C = new S.Text({ fontSize: T, fontFamily: b }).measureSize(w), L = ((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
5471
|
if (!this.todayTextGroup)
|
|
5458
5472
|
this.todayTextGroup = new S.Group({
|
|
5459
5473
|
x: s + this.offsetX + g,
|
|
@@ -5464,7 +5478,7 @@ class ze {
|
|
|
5464
5478
|
y: 0,
|
|
5465
5479
|
width: C.width + 12,
|
|
5466
5480
|
height: C.height + 8,
|
|
5467
|
-
fill:
|
|
5481
|
+
fill: E,
|
|
5468
5482
|
cornerRadius: 0,
|
|
5469
5483
|
name: "today-text-bg"
|
|
5470
5484
|
})), this.todayTextGroup.add(new S.Text({
|
|
@@ -5474,7 +5488,7 @@ class ze {
|
|
|
5474
5488
|
fontSize: T,
|
|
5475
5489
|
fontFamily: b,
|
|
5476
5490
|
padding: 5,
|
|
5477
|
-
fill:
|
|
5491
|
+
fill: L,
|
|
5478
5492
|
align: "center",
|
|
5479
5493
|
verticalAlign: "middle",
|
|
5480
5494
|
name: "today-text"
|
|
@@ -5484,7 +5498,7 @@ class ze {
|
|
|
5484
5498
|
const v = this.todayTextGroup.findOne(".today-text");
|
|
5485
5499
|
v == null || v.setAttrs({
|
|
5486
5500
|
text: w,
|
|
5487
|
-
fill:
|
|
5501
|
+
fill: L,
|
|
5488
5502
|
fontSize: T,
|
|
5489
5503
|
fontFamily: b,
|
|
5490
5504
|
padding: 5
|
|
@@ -5493,7 +5507,7 @@ class ze {
|
|
|
5493
5507
|
M == null || M.setAttrs({
|
|
5494
5508
|
width: C.width + 12,
|
|
5495
5509
|
height: C.height + 8,
|
|
5496
|
-
fill:
|
|
5510
|
+
fill: E
|
|
5497
5511
|
});
|
|
5498
5512
|
}
|
|
5499
5513
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
@@ -5572,13 +5586,13 @@ class Ne {
|
|
|
5572
5586
|
for (let b = s; b <= n; b = b.add(1, "day")) {
|
|
5573
5587
|
const w = t.find((C) => {
|
|
5574
5588
|
if (X(C.date)) {
|
|
5575
|
-
if (C.date.some((
|
|
5589
|
+
if (C.date.some((L) => G(L).isSame(b, "day")))
|
|
5576
5590
|
return C;
|
|
5577
5591
|
} else if (G(C.date).isSame(b, "day"))
|
|
5578
5592
|
return C;
|
|
5579
5593
|
});
|
|
5580
5594
|
if (w) {
|
|
5581
|
-
const C = this.context.store.getTimeAxis().getTimeLeft(b),
|
|
5595
|
+
const C = this.context.store.getTimeAxis().getTimeLeft(b), L = r, E = g;
|
|
5582
5596
|
if (C + o < e)
|
|
5583
5597
|
continue;
|
|
5584
5598
|
if (C > i)
|
|
@@ -5594,9 +5608,9 @@ class Ne {
|
|
|
5594
5608
|
const M = new S.Rect({
|
|
5595
5609
|
name: "holiday-rect",
|
|
5596
5610
|
x: C,
|
|
5597
|
-
y:
|
|
5611
|
+
y: L,
|
|
5598
5612
|
width: o,
|
|
5599
|
-
height:
|
|
5613
|
+
height: E,
|
|
5600
5614
|
// 根据模式设置填充
|
|
5601
5615
|
...this.patternImage.get(w) ? {
|
|
5602
5616
|
fillPatternImage: this.patternImage.get(w) ?? void 0,
|
|
@@ -5612,10 +5626,10 @@ class Ne {
|
|
|
5612
5626
|
if (this.holidayGroup.add(M), (d = w.text) != null && d.show) {
|
|
5613
5627
|
if (X(w.date) && !G(w.date[0]).isSame(b, "day"))
|
|
5614
5628
|
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) || "",
|
|
5629
|
+
const A = ((l = w.text) == null ? void 0 : l.fontSize) || 10, _ = ((m = w.text) == null ? void 0 : m.fontFamily) || "Arial", D = ((p = w.text) == null ? void 0 : p.content) || "", H = new S.Text({ fontSize: A, fontFamily: _ }).measureSize(D), W = ((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
5630
|
name: "holiday-text-group",
|
|
5617
5631
|
x: C,
|
|
5618
|
-
y:
|
|
5632
|
+
y: L,
|
|
5619
5633
|
opacity: (T = w.text) == null ? void 0 : T.opacity
|
|
5620
5634
|
}), F = new S.Text({
|
|
5621
5635
|
text: D,
|
|
@@ -5626,9 +5640,9 @@ class Ne {
|
|
|
5626
5640
|
}), z = new S.Rect({
|
|
5627
5641
|
x: 0,
|
|
5628
5642
|
y: 0,
|
|
5629
|
-
width:
|
|
5630
|
-
height:
|
|
5631
|
-
fill:
|
|
5643
|
+
width: H.width + 12,
|
|
5644
|
+
height: H.height + 8,
|
|
5645
|
+
fill: I
|
|
5632
5646
|
});
|
|
5633
5647
|
R.add(z), R.add(F), this.holidayGroup.add(R);
|
|
5634
5648
|
}
|
|
@@ -5688,8 +5702,8 @@ class Pe {
|
|
|
5688
5702
|
const b = G(T.date), w = this.context.store.getTimeAxis().getTimeLeft(b), C = g;
|
|
5689
5703
|
if (w + c < r || w > h)
|
|
5690
5704
|
return;
|
|
5691
|
-
const
|
|
5692
|
-
points:
|
|
5705
|
+
const E = [w, g, w, this.height], v = new S.Line({
|
|
5706
|
+
points: E,
|
|
5693
5707
|
stroke: T.backgroundColor || e,
|
|
5694
5708
|
opacity: T.opacity || i,
|
|
5695
5709
|
strokeWidth: 1
|
|
@@ -5804,11 +5818,11 @@ class Ye {
|
|
|
5804
5818
|
* 注册事件
|
|
5805
5819
|
*/
|
|
5806
5820
|
registerEvents() {
|
|
5807
|
-
this.context.event.on(
|
|
5821
|
+
this.context.event.on(k.ROW_HIGHLIGHT, (t) => {
|
|
5808
5822
|
this.highlightPoint(t);
|
|
5809
|
-
}), this.context.event.on(
|
|
5823
|
+
}), this.context.event.on(k.ROW_UNHIGHLIGHT, (t) => {
|
|
5810
5824
|
this.unhighlightPoint(t);
|
|
5811
|
-
}), this.context.event.on(
|
|
5825
|
+
}), this.context.event.on(k.SLIDER_DRAGGING, (t) => {
|
|
5812
5826
|
this.isSliderMoving = t;
|
|
5813
5827
|
});
|
|
5814
5828
|
}
|
|
@@ -5934,7 +5948,7 @@ class Ye {
|
|
|
5934
5948
|
);
|
|
5935
5949
|
return;
|
|
5936
5950
|
}
|
|
5937
|
-
if (o.flatIndex < this.tasks[0].flatIndex && r.flatIndex < this.tasks[0].flatIndex || o.flatIndex > this.tasks[this.tasks.length - 1].flatIndex && r.flatIndex > this.tasks[this.tasks.length - 1].flatIndex)
|
|
5951
|
+
if (!this.context.store.getDataManager().isTaskVisible(o) || !this.context.store.getDataManager().isTaskVisible(r) || o.flatIndex < this.tasks[0].flatIndex && r.flatIndex < this.tasks[0].flatIndex || o.flatIndex > this.tasks[this.tasks.length - 1].flatIndex && r.flatIndex > this.tasks[this.tasks.length - 1].flatIndex)
|
|
5938
5952
|
return;
|
|
5939
5953
|
const h = Math.max(0, -this.offsetX), c = h + this.width;
|
|
5940
5954
|
if (!(this.context.store.getTimeAxis().getTimeLeft(((g = s.type) == null ? void 0 : g[0]) === "S" ? o.startTime : o.endTime) < h && this.context.store.getTimeAxis().getTimeLeft(((d = s.type) == null ? void 0 : d[1]) === "F" ? r.endTime : r.startTime) < h) && !(this.context.store.getTimeAxis().getTimeLeft(((l = s.type) == null ? void 0 : l[0]) === "S" ? o.startTime : o.endTime) > c && this.context.store.getTimeAxis().getTimeLeft(((m = s.type) == null ? void 0 : m[1]) === "F" ? r.endTime : r.startTime) > c) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, o) && this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
@@ -5942,33 +5956,33 @@ class Ye {
|
|
|
5942
5956
|
if (T.length <= 2)
|
|
5943
5957
|
O.warn("The link position has some error.", s);
|
|
5944
5958
|
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 =
|
|
5959
|
+
const b = s.radius ?? this.context.getOptions().links.radius, w = ((p = s.arrow) == null ? void 0 : p.width) ?? this.context.getOptions().links.arrow.width, C = ((u = s.arrow) == null ? void 0 : u.height) ?? this.context.getOptions().links.arrow.height, L = s.width ?? this.context.getOptions().links.width;
|
|
5960
|
+
let E = this.linkCache.get(n);
|
|
5961
|
+
E === void 0 && (E = new S.Group({ id: n })), t != null && t.length || (E._ = i);
|
|
5962
|
+
const v = E.findOne("Circle");
|
|
5949
5963
|
if (v)
|
|
5950
5964
|
v.radius(b), v.fill(
|
|
5951
5965
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5952
5966
|
), v.x(T[0]), v.y(T[1]);
|
|
5953
5967
|
else {
|
|
5954
|
-
const
|
|
5968
|
+
const I = new S.Circle({
|
|
5955
5969
|
radius: b,
|
|
5956
5970
|
fill: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5957
5971
|
x: T[0],
|
|
5958
5972
|
y: T[1]
|
|
5959
5973
|
});
|
|
5960
|
-
|
|
5974
|
+
E.add(I);
|
|
5961
5975
|
}
|
|
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
|
-
|
|
5976
|
+
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");
|
|
5977
|
+
if (H)
|
|
5978
|
+
H.points(_), H.stroke(
|
|
5965
5979
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5966
|
-
),
|
|
5980
|
+
), H.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), H.dash(s.dash || this.context.getOptions().links.dash);
|
|
5967
5981
|
else {
|
|
5968
|
-
const
|
|
5982
|
+
const I = new S.Line({
|
|
5969
5983
|
points: _,
|
|
5970
5984
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
5971
|
-
strokeWidth:
|
|
5985
|
+
strokeWidth: L,
|
|
5972
5986
|
lineCap: "round",
|
|
5973
5987
|
lineJoin: "round",
|
|
5974
5988
|
dash: s.dash || this.context.getOptions().links.dash,
|
|
@@ -5977,7 +5991,7 @@ class Ye {
|
|
|
5977
5991
|
draggable: !0,
|
|
5978
5992
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
5979
5993
|
});
|
|
5980
|
-
|
|
5994
|
+
E.add(I), I.on("dragstart", (R) => {
|
|
5981
5995
|
this.handleDrag(
|
|
5982
5996
|
R,
|
|
5983
5997
|
s,
|
|
@@ -5987,18 +6001,18 @@ class Ye {
|
|
|
5987
6001
|
);
|
|
5988
6002
|
});
|
|
5989
6003
|
}
|
|
5990
|
-
const W =
|
|
6004
|
+
const W = E.findOne("Arrow");
|
|
5991
6005
|
if (W)
|
|
5992
6006
|
W.points(D), W.stroke(
|
|
5993
6007
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
5994
|
-
), W.strokeWidth(
|
|
6008
|
+
), W.strokeWidth(L + (this.selectedMap.has(n) ? 2 : 0)), W.pointerLength(C), W.pointerWidth(w), W.fill(
|
|
5995
6009
|
((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
6010
|
), W.lineJoin("round"), W.dash(s.dash || this.context.getOptions().links.dash);
|
|
5997
6011
|
else {
|
|
5998
|
-
const
|
|
6012
|
+
const I = new S.Arrow({
|
|
5999
6013
|
points: D,
|
|
6000
6014
|
stroke: s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor,
|
|
6001
|
-
strokeWidth:
|
|
6015
|
+
strokeWidth: L,
|
|
6002
6016
|
pointerLength: C,
|
|
6003
6017
|
pointerWidth: w,
|
|
6004
6018
|
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 +6024,50 @@ class Ye {
|
|
|
6010
6024
|
draggable: !0,
|
|
6011
6025
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
6012
6026
|
});
|
|
6013
|
-
|
|
6027
|
+
E.add(I), I.on("dragstart", (R) => {
|
|
6014
6028
|
this.handleDrag(R, s, "F", [T[0], T[1]], n);
|
|
6015
6029
|
});
|
|
6016
6030
|
}
|
|
6017
|
-
this.linkCache.has(n) || (this.linksGroup.add(
|
|
6018
|
-
|
|
6019
|
-
|
|
6031
|
+
this.linkCache.has(n) || (this.linksGroup.add(E), E.on("mouseover", (I) => {
|
|
6032
|
+
I.target.moveToTop(), this.context.getOptions().links.move.enabled === !0 && (this.stage.container().style.cursor = "pointer"), this.selectedMap.has(n) || this.handleHighlight(
|
|
6033
|
+
E,
|
|
6020
6034
|
b,
|
|
6021
6035
|
w,
|
|
6022
6036
|
C,
|
|
6023
|
-
|
|
6037
|
+
L,
|
|
6024
6038
|
2
|
|
6025
6039
|
);
|
|
6026
|
-
}),
|
|
6040
|
+
}), E.on("mouseout", (I) => {
|
|
6027
6041
|
this.selectedMap.has(n) || this.handleHighlight(
|
|
6028
|
-
|
|
6042
|
+
E,
|
|
6029
6043
|
b,
|
|
6030
6044
|
w,
|
|
6031
6045
|
C,
|
|
6032
|
-
|
|
6046
|
+
L,
|
|
6033
6047
|
0
|
|
6034
6048
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
6035
|
-
}),
|
|
6049
|
+
}), E.on("mousedown", (I) => {
|
|
6036
6050
|
this.isDragging = !0;
|
|
6037
|
-
}),
|
|
6038
|
-
|
|
6039
|
-
|
|
6051
|
+
}), E.on("click", (I) => {
|
|
6052
|
+
I.cancelBubble = !0, this.isDragging = !1, E.moveToTop(), I.evt.button === 0 && (this.selectedMap.has(n) ? (this.selectedMap.delete(n), this.context.event.emit(
|
|
6053
|
+
k.SELECT_LINK,
|
|
6040
6054
|
null,
|
|
6041
6055
|
s,
|
|
6042
6056
|
this.selectedMap.values().toArray()
|
|
6043
6057
|
)) : (this.selectedMap.set(n, s), this.context.event.emit(
|
|
6044
|
-
|
|
6058
|
+
k.SELECT_LINK,
|
|
6045
6059
|
s,
|
|
6046
6060
|
null,
|
|
6047
6061
|
this.selectedMap.values().toArray()
|
|
6048
6062
|
)));
|
|
6049
|
-
}),
|
|
6050
|
-
|
|
6051
|
-
}), this.linkCache.set(n,
|
|
6052
|
-
|
|
6063
|
+
}), E.on("contextmenu", (I) => {
|
|
6064
|
+
I.evt.preventDefault(), I.cancelBubble = !0, this.context.event.emit(k.CONTEXT_LINK, I.evt, s);
|
|
6065
|
+
}), this.linkCache.set(n, E)), this.selectedMap.has(n) && this.handleHighlight(
|
|
6066
|
+
E,
|
|
6053
6067
|
b,
|
|
6054
6068
|
w,
|
|
6055
6069
|
C,
|
|
6056
|
-
|
|
6070
|
+
L,
|
|
6057
6071
|
2,
|
|
6058
6072
|
!0
|
|
6059
6073
|
);
|
|
@@ -6204,14 +6218,14 @@ class Ye {
|
|
|
6204
6218
|
const m = () => {
|
|
6205
6219
|
const b = this.stage.getPointerPosition();
|
|
6206
6220
|
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 <=
|
|
6221
|
+
const w = this.context.store.getTimeAxis().getTimeLeft(l.startTime), C = this.context.store.getTimeAxis().getTimeLeft(l.endTime), L = (C + w) / 2 + this.offsetX;
|
|
6222
|
+
let E = w - d;
|
|
6223
|
+
b.x <= L ? r = "S" : (r = "F", E = C + d);
|
|
6210
6224
|
let v;
|
|
6211
6225
|
if (i === "S" ? v = `${r}${(e.type || "FS")[1]}` : v = `${(e.type || "FS")[0]}${r}`, i === "S") {
|
|
6212
6226
|
const { allowLeft: M, allowRight: A } = this.isAllowStartDrop(l, e.to, v);
|
|
6213
6227
|
this.templateArrow.points([
|
|
6214
|
-
|
|
6228
|
+
E,
|
|
6215
6229
|
g + c * l.flatIndex,
|
|
6216
6230
|
...s
|
|
6217
6231
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
@@ -6219,22 +6233,22 @@ class Ye {
|
|
|
6219
6233
|
const { allowLeft: M, allowRight: A } = this.isAllowEndDrop(l, e.from, v);
|
|
6220
6234
|
this.templateArrow.points([
|
|
6221
6235
|
...s,
|
|
6222
|
-
|
|
6236
|
+
E,
|
|
6223
6237
|
g + c * l.flatIndex
|
|
6224
6238
|
]), M ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6225
6239
|
}
|
|
6226
6240
|
}
|
|
6227
6241
|
}, p = () => {
|
|
6228
|
-
var C,
|
|
6242
|
+
var C, L;
|
|
6229
6243
|
let b;
|
|
6230
6244
|
const w = Z(e);
|
|
6231
6245
|
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
6246
|
w.type = b;
|
|
6233
|
-
let
|
|
6234
|
-
i === "S" ? { allowLeft:
|
|
6247
|
+
let E = !1, v = !1, M;
|
|
6248
|
+
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
6249
|
} 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((
|
|
6250
|
+
this.context.event.emit(k.ERROR, Y.TASK_NOT_FOUND);
|
|
6251
|
+
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
6252
|
}, u = (b) => {
|
|
6239
6253
|
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), document.removeEventListener("keydown", u));
|
|
6240
6254
|
};
|
|
@@ -6269,24 +6283,24 @@ class Ye {
|
|
|
6269
6283
|
w,
|
|
6270
6284
|
g + c * l.flatIndex
|
|
6271
6285
|
]);
|
|
6272
|
-
const { allowLeft: C, allowRight:
|
|
6273
|
-
r === "S" && !C ? this.stage.container().style.cursor = "not-allowed" : r === "F" && !
|
|
6286
|
+
const { allowLeft: C, allowRight: L } = this.isAllowEndDrop(l, n, o.convertPointsToLinkType(e, r));
|
|
6287
|
+
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
6288
|
}
|
|
6275
6289
|
}, p = () => {
|
|
6276
6290
|
let y;
|
|
6277
6291
|
if (r && (y = o.convertPointsToLinkType(e, r)), y && l)
|
|
6278
6292
|
if (o.isLinkExist(n, l.id, y))
|
|
6279
|
-
this.context.event.emit(
|
|
6293
|
+
this.context.event.emit(k.ERROR, Y.LINK_EXIST);
|
|
6280
6294
|
else if (n === l.id && e === r)
|
|
6281
|
-
this.context.event.emit(
|
|
6295
|
+
this.context.event.emit(k.ERROR, Y.LINK_SAME);
|
|
6282
6296
|
else {
|
|
6283
6297
|
const { allowLeft: x, allowRight: T, reason: b } = this.isAllowEndDrop(l, n, y, !0);
|
|
6284
|
-
r === "S" && x || r === "F" && T ? (this.context.event.emit(
|
|
6298
|
+
r === "S" && x || r === "F" && T ? (this.context.event.emit(k.CREATE_LINK, {
|
|
6285
6299
|
from: n,
|
|
6286
6300
|
to: l.id,
|
|
6287
6301
|
type: y,
|
|
6288
6302
|
color: i
|
|
6289
|
-
}), this.context.store.getLinkManager().update()) : this.context.event.emit(
|
|
6303
|
+
}), this.context.store.getLinkManager().update()) : this.context.event.emit(k.ERROR, b || Y.LINK_NOT_ALLOWED);
|
|
6290
6304
|
}
|
|
6291
6305
|
this.cleanupTempLink(), this.calculateLinks([l].filter((x) => !!x)), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
6292
6306
|
}, u = (y) => {
|
|
@@ -6398,7 +6412,7 @@ class Ye {
|
|
|
6398
6412
|
*/
|
|
6399
6413
|
highlightCycleNodes(t) {
|
|
6400
6414
|
t.forEach((e) => {
|
|
6401
|
-
this.context.event.emit(
|
|
6415
|
+
this.context.event.emit(k.SLIDER_BLINK, e);
|
|
6402
6416
|
});
|
|
6403
6417
|
}
|
|
6404
6418
|
}
|
|
@@ -6617,12 +6631,14 @@ class Ue {
|
|
|
6617
6631
|
}
|
|
6618
6632
|
}
|
|
6619
6633
|
bindEvents(t, e, i) {
|
|
6620
|
-
t.on("
|
|
6621
|
-
this.context.event.emit(
|
|
6634
|
+
t.on("mouseenter", (s) => {
|
|
6635
|
+
this.context.event.emit(k.BASELINE_MOUSEENTER, s.evt, e, i);
|
|
6636
|
+
}), t.on("mousemove", (s) => {
|
|
6637
|
+
this.context.event.emit(k.BASELINE_MOUSEMOVE, s.evt, e, i);
|
|
6622
6638
|
}), t.on("mouseout", (s) => {
|
|
6623
|
-
this.context.event.emit(
|
|
6639
|
+
this.context.event.emit(k.BASELINE_MOUSEOUT, s.evt, e, i);
|
|
6624
6640
|
}), t.on("click", (s) => {
|
|
6625
|
-
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(
|
|
6641
|
+
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
6642
|
});
|
|
6627
6643
|
}
|
|
6628
6644
|
}
|
|
@@ -6703,7 +6719,7 @@ class Ke {
|
|
|
6703
6719
|
const c = s[s.length - 1].key;
|
|
6704
6720
|
this.initialWidth = i.getColumnWidth(c);
|
|
6705
6721
|
const g = this.initialX;
|
|
6706
|
-
this.root.event.emit(
|
|
6722
|
+
this.root.event.emit(k.SHOW_GUIDELINE, g);
|
|
6707
6723
|
const d = (m) => o(m), l = (m) => r(m, d, l);
|
|
6708
6724
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6709
6725
|
}, o = (h) => {
|
|
@@ -6711,11 +6727,11 @@ class Ke {
|
|
|
6711
6727
|
const c = h.clientX - t;
|
|
6712
6728
|
s[s.length - 1].key;
|
|
6713
6729
|
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(
|
|
6730
|
+
this.root.event.emit(k.MOVE_GUIDELINE, p);
|
|
6715
6731
|
}, r = (h, c, g) => {
|
|
6716
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(
|
|
6732
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(k.HIDE_GUIDELINE);
|
|
6717
6733
|
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(
|
|
6734
|
+
i.setColumnWidth(l, m), this.root.event.emit(k.UPDATE_TABLE_HEADER);
|
|
6719
6735
|
};
|
|
6720
6736
|
this.line.addEventListener("mousedown", n);
|
|
6721
6737
|
}
|
|
@@ -6746,11 +6762,11 @@ class je {
|
|
|
6746
6762
|
* 初始化事件监听
|
|
6747
6763
|
*/
|
|
6748
6764
|
initEvents() {
|
|
6749
|
-
this.context.event.on(
|
|
6765
|
+
this.context.event.on(k.SHOW_GUIDELINE, (t) => {
|
|
6750
6766
|
this.show(t);
|
|
6751
|
-
}), this.context.event.on(
|
|
6767
|
+
}), this.context.event.on(k.HIDE_GUIDELINE, () => {
|
|
6752
6768
|
this.hide();
|
|
6753
|
-
}), this.context.event.on(
|
|
6769
|
+
}), this.context.event.on(k.MOVE_GUIDELINE, (t) => {
|
|
6754
6770
|
this.setLeft(t);
|
|
6755
6771
|
});
|
|
6756
6772
|
}
|
|
@@ -7004,7 +7020,7 @@ class Qe {
|
|
|
7004
7020
|
a(this, "handleColumnWidthChange", () => {
|
|
7005
7021
|
this.table.updateWidth(), this.updateSize();
|
|
7006
7022
|
});
|
|
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 Ke(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new
|
|
7023
|
+
this.context = t, this.container = e, this.rootElement = document.createElement("div"), this.rootElement.id = `x-gantt-${this._id}`, this.rootElement.className = "x-gantt", this.rootElement.style.overflow = "hidden", this.rootElement.style.display = "flex", this.rootElement.style.position = "relative", this.container.appendChild(this.rootElement), this.tableContainer = document.createElement("div"), this.tableContainer.className = "x-gantt-table", this.rootElement.appendChild(this.tableContainer), new je(this.context, this.container), this.middleLine = new Ke(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new He(this.context, this.tableContainer), this.chart = new Xe(this.context, this.chartContainer), this.scrollbar = new _e(
|
|
7008
7024
|
this.context,
|
|
7009
7025
|
this.rootElement,
|
|
7010
7026
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
@@ -7047,21 +7063,21 @@ class Qe {
|
|
|
7047
7063
|
* 设置事件监听器
|
|
7048
7064
|
*/
|
|
7049
7065
|
setupEventListeners() {
|
|
7050
|
-
this.context.event.on(
|
|
7066
|
+
this.context.event.on(k.DATA_UPDATE, () => {
|
|
7051
7067
|
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
7052
|
-
}), this.context.event.on(
|
|
7068
|
+
}), this.context.event.on(k.SCROLL, () => {
|
|
7053
7069
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
7054
|
-
}), this.context.event.on(
|
|
7070
|
+
}), this.context.event.on(k.COLUMN_WIDTH_CHANGE, () => {
|
|
7055
7071
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
7056
|
-
}), this.context.event.on(
|
|
7072
|
+
}), this.context.event.on(k.VIEW_UPDATE, () => {
|
|
7057
7073
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
7058
|
-
}), this.context.event.on(
|
|
7074
|
+
}), this.context.event.on(k.UPDATE_TASK, (t) => {
|
|
7059
7075
|
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
7060
7076
|
immediate: !0
|
|
7061
7077
|
});
|
|
7062
|
-
}), this.context.event.on(
|
|
7078
|
+
}), this.context.event.on(k.CHART_OFFSET_CHANGE, () => {
|
|
7063
7079
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
7064
|
-
}), this.context.event.on(
|
|
7080
|
+
}), this.context.event.on(k.TOGGLE_COLLAPSE, () => {
|
|
7065
7081
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1], { immediate: !0 });
|
|
7066
7082
|
});
|
|
7067
7083
|
}
|
|
@@ -7072,7 +7088,7 @@ class Qe {
|
|
|
7072
7088
|
performRender(t = !1, e = !1) {
|
|
7073
7089
|
this.setStyleValue();
|
|
7074
7090
|
const { x: i, y: s } = this.scrollbar.getScrollPosition(), n = this.context.store.getOptionManager().getOptions().row.height, o = this.context.store.getOptionManager().getOptions().header.height, r = Math.floor(s / n), 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(
|
|
7091
|
+
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
7092
|
}
|
|
7077
7093
|
/**
|
|
7078
7094
|
* 公共渲染方法,向后兼容
|
|
@@ -7139,6 +7155,25 @@ class Je {
|
|
|
7139
7155
|
const i = this.store.getTimeAxis().getTimeLeft(e) - 100;
|
|
7140
7156
|
return this.renderer.getScrollbar().scrollTo({ x: Math.max(i, 0) }), !0;
|
|
7141
7157
|
}
|
|
7158
|
+
/**
|
|
7159
|
+
* 滚动到指定任务节点。默认为第一个任务
|
|
7160
|
+
*
|
|
7161
|
+
* @return {boolean} 是否成功跳转
|
|
7162
|
+
*/
|
|
7163
|
+
scrollTo(t, e) {
|
|
7164
|
+
var o;
|
|
7165
|
+
let i = 0, s;
|
|
7166
|
+
const n = Math.max(100, ((o = this.getOptions().scrollbar) == null ? void 0 : o.animationDuration) || 100);
|
|
7167
|
+
if (t) {
|
|
7168
|
+
if (s = this.store.getDataManager().getTaskById(t), !s) return !1;
|
|
7169
|
+
i = s.flatIndex * this.store.getOptionManager().getOptions().row.height - 100, setTimeout(() => {
|
|
7170
|
+
this.jumpTo(s == null ? void 0 : s.startTime);
|
|
7171
|
+
}, n);
|
|
7172
|
+
}
|
|
7173
|
+
return this.renderer.getScrollbar().scrollTo({ y: i }), e && s && setTimeout(() => {
|
|
7174
|
+
this.event.emit(k.SLIDER_BLINK, s.id);
|
|
7175
|
+
}, n * 2), !0;
|
|
7176
|
+
}
|
|
7142
7177
|
/**
|
|
7143
7178
|
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
7144
7179
|
*/
|
|
@@ -7157,11 +7192,11 @@ class Je {
|
|
|
7157
7192
|
}
|
|
7158
7193
|
// 注册对外事件
|
|
7159
7194
|
registerEvents() {
|
|
7160
|
-
this.event.on(
|
|
7195
|
+
this.event.on(k.ERROR, (t, e) => {
|
|
7161
7196
|
this._emit("error", t, e);
|
|
7162
|
-
}), this.event.on(
|
|
7197
|
+
}), this.event.on(k.LOADED, () => {
|
|
7163
7198
|
this._emit("loaded");
|
|
7164
|
-
}), this.event.on(
|
|
7199
|
+
}), this.event.on(k.TASK_DRAG_END, (t, e) => {
|
|
7165
7200
|
this._emit(
|
|
7166
7201
|
"move",
|
|
7167
7202
|
e.map((i) => {
|
|
@@ -7172,47 +7207,51 @@ class Je {
|
|
|
7172
7207
|
};
|
|
7173
7208
|
})
|
|
7174
7209
|
);
|
|
7175
|
-
}), this.event.on(
|
|
7210
|
+
}), this.event.on(k.CHECK_TASK, (t, e) => {
|
|
7176
7211
|
this._emit(
|
|
7177
7212
|
"select",
|
|
7178
7213
|
t.map((i) => i.data),
|
|
7179
7214
|
e,
|
|
7180
7215
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
7181
7216
|
);
|
|
7182
|
-
}), this.event.on(
|
|
7217
|
+
}), this.event.on(k.UPDATE_LINK, (t) => {
|
|
7183
7218
|
this._emit("update:link", t);
|
|
7184
|
-
}), this.event.on(
|
|
7219
|
+
}), this.event.on(k.CREATE_LINK, (t) => {
|
|
7185
7220
|
this._emit("create:link", t);
|
|
7186
7221
|
}), this.event.on(
|
|
7187
|
-
|
|
7222
|
+
k.SELECT_LINK,
|
|
7188
7223
|
(t, e, i) => {
|
|
7189
7224
|
this._emit("select:link", t, e, i);
|
|
7190
7225
|
}
|
|
7191
|
-
), this.event.on(
|
|
7226
|
+
), this.event.on(k.CONTEXT_LINK, (t, e) => {
|
|
7192
7227
|
this._emit("contextmenu:link", t, e);
|
|
7193
|
-
}), this.event.on(
|
|
7228
|
+
}), this.event.on(k.ROW_CLICK, (t, e) => {
|
|
7194
7229
|
this._emit("click:row", t, e.data);
|
|
7195
|
-
}), this.event.on(
|
|
7230
|
+
}), this.event.on(k.ROW_DBL_CLICK, (t, e) => {
|
|
7196
7231
|
this._emit("dblclick:row", t, e.data);
|
|
7197
|
-
}), this.event.on(
|
|
7232
|
+
}), this.event.on(k.ROW_CONTEXTMENU, (t, e) => {
|
|
7198
7233
|
this._emit("contextmenu:row", t, e.data);
|
|
7199
|
-
}), this.event.on(
|
|
7234
|
+
}), this.event.on(k.SLIDER_CLICK, (t, e) => {
|
|
7200
7235
|
this._emit("click:slider", t, e.data);
|
|
7201
|
-
}), this.event.on(
|
|
7236
|
+
}), this.event.on(k.SLIDER_DBL_CLICK, (t, e) => {
|
|
7202
7237
|
this._emit("dblclick:slider", t, e.data);
|
|
7203
|
-
}), this.event.on(
|
|
7238
|
+
}), this.event.on(k.SLIDER_CONTEXTMENU, (t, e) => {
|
|
7204
7239
|
this._emit("contextmenu:slider", t, e.data);
|
|
7205
|
-
}), this.event.on(
|
|
7240
|
+
}), this.event.on(k.SLIDER_ENTER, (t, e) => {
|
|
7241
|
+
this._emit("enter:slider", t, e.data);
|
|
7242
|
+
}), this.event.on(k.SLIDER_HOVER, (t, e) => {
|
|
7206
7243
|
this._emit("hover:slider", t, e.data);
|
|
7207
|
-
}), this.event.on(
|
|
7244
|
+
}), this.event.on(k.SLIDER_LEAVE, (t, e) => {
|
|
7208
7245
|
this._emit("leave:slider", t, e.data);
|
|
7209
|
-
}), this.event.on(
|
|
7246
|
+
}), this.event.on(k.BASELINE_CLICK, (t, e, i) => {
|
|
7210
7247
|
this._emit("click:baseline", t, e.data, i.data);
|
|
7211
|
-
}), this.event.on(
|
|
7248
|
+
}), this.event.on(k.BASELINE_CONTEXTMENU, (t, e, i) => {
|
|
7212
7249
|
this._emit("contextmenu:baseline", t, e.data, i.data);
|
|
7213
|
-
}), this.event.on(
|
|
7250
|
+
}), this.event.on(k.BASELINE_MOUSEENTER, (t, e, i) => {
|
|
7251
|
+
this._emit("enter:baseline", t, e.data, i.data);
|
|
7252
|
+
}), this.event.on(k.BASELINE_MOUSEMOVE, (t, e, i) => {
|
|
7214
7253
|
this._emit("hover:baseline", t, e.data, i.data);
|
|
7215
|
-
}), this.event.on(
|
|
7254
|
+
}), this.event.on(k.BASELINE_MOUSEOUT, (t, e, i) => {
|
|
7216
7255
|
this._emit("leave:baseline", t, e.data, i.data);
|
|
7217
7256
|
});
|
|
7218
7257
|
}
|
|
@@ -7376,8 +7415,55 @@ class si {
|
|
|
7376
7415
|
jumpTo(t) {
|
|
7377
7416
|
return this.context.jumpTo(t);
|
|
7378
7417
|
}
|
|
7418
|
+
/**
|
|
7419
|
+
* 滚动到指定任务
|
|
7420
|
+
* @param id - 任务 ID,如果不传入则滚动到顶部
|
|
7421
|
+
* @param highlight - 是否高亮任务,默认为 false
|
|
7422
|
+
*
|
|
7423
|
+
* @returns 是否成功滚动到指定任务
|
|
7424
|
+
* - `true`: 成功滚动,任务已在视图中可见
|
|
7425
|
+
* - `false`: 滚动失败,可能是任务 ID 无效或任务不可见
|
|
7426
|
+
*
|
|
7427
|
+
* @description 此方法将甘特图的视图滚动到指定任务的位置,使该任务在当前视窗中可见。并且支持跳转后高亮当前任务。
|
|
7428
|
+
*
|
|
7429
|
+
* @example
|
|
7430
|
+
* ```typescript
|
|
7431
|
+
* // 滚动到指定任务
|
|
7432
|
+
* const success1 = gantt.scrollTo('task-1');
|
|
7433
|
+
* const success2 = gantt.scrollTo('non-existent-id'); // 任务不存在,返回 false
|
|
7434
|
+
*
|
|
7435
|
+
* // 滚动到顶部
|
|
7436
|
+
* const success3 = gantt.scrollTo();
|
|
7437
|
+
*
|
|
7438
|
+
* // 检查滚动结果
|
|
7439
|
+
* if (gantt.scrollTo('task-2')) {
|
|
7440
|
+
* console.log('成功滚动到任务 task-2');
|
|
7441
|
+
* } else {
|
|
7442
|
+
* console.log('滚动失败,任务 ID 可能无效');
|
|
7443
|
+
* }
|
|
7444
|
+
*
|
|
7445
|
+
* // 滚动到任务并高亮
|
|
7446
|
+
* gantt.scrollTo('task-3', true);
|
|
7447
|
+
* ```
|
|
7448
|
+
*/
|
|
7449
|
+
scrollTo(t, e) {
|
|
7450
|
+
return this.context.scrollTo(t, e);
|
|
7451
|
+
}
|
|
7379
7452
|
/**
|
|
7380
7453
|
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
7454
|
+
*
|
|
7455
|
+
* 结果集中包含前置链路信息、后置链路信息、所有节点、关联线的信息等
|
|
7456
|
+
* - prev: 前置链路信息
|
|
7457
|
+
* - chain: 所有源 -> 当前任务的完整路径(每条路径末尾为当前节点)
|
|
7458
|
+
* - nodes: 前置方向所有唯一节点
|
|
7459
|
+
* - links: 前置方向所有连线
|
|
7460
|
+
* - next: 后置链路信息
|
|
7461
|
+
* - chain: 当前任务 -> 所有汇的完整路径(每条路径首元素为当前节点)
|
|
7462
|
+
* - nodes: 后置方向所有唯一节点
|
|
7463
|
+
* - links: 后置方向所有连线
|
|
7464
|
+
* - allNodes: 所有相关联的节点
|
|
7465
|
+
* - allLinks: 所有相关联的连线
|
|
7466
|
+
* - current: 当前任务
|
|
7381
7467
|
*/
|
|
7382
7468
|
getDataChain(t) {
|
|
7383
7469
|
return this.context.getDataChain(t);
|
|
@@ -7493,9 +7579,32 @@ class si {
|
|
|
7493
7579
|
} else
|
|
7494
7580
|
this.events.delete(t);
|
|
7495
7581
|
}
|
|
7582
|
+
/**
|
|
7583
|
+
* 根据任务 ID 获取对应的任务数据
|
|
7584
|
+
* @param id 任务 ID
|
|
7585
|
+
* @returns 任务数据
|
|
7586
|
+
*
|
|
7587
|
+
* @example
|
|
7588
|
+
* ```typescript
|
|
7589
|
+
* const data = gantt.getDataById('task-1');
|
|
7590
|
+
* if (data) {
|
|
7591
|
+
* console.log('任务名称:', data.name);
|
|
7592
|
+
* }
|
|
7593
|
+
* ```
|
|
7594
|
+
*/
|
|
7595
|
+
getDataById(t) {
|
|
7596
|
+
var e;
|
|
7597
|
+
return (e = this.context.store.getDataManager().getTaskById(t)) == null ? void 0 : e.data;
|
|
7598
|
+
}
|
|
7599
|
+
/**
|
|
7600
|
+
* 获取当前数据量总数。该数量为所有数据展开后的数据条数
|
|
7601
|
+
*/
|
|
7602
|
+
getDataSize() {
|
|
7603
|
+
return this.context.store.getDataManager().getVisibleSize();
|
|
7604
|
+
}
|
|
7496
7605
|
}
|
|
7497
7606
|
Vt();
|
|
7498
|
-
const ni =
|
|
7607
|
+
const ni = Ct;
|
|
7499
7608
|
export {
|
|
7500
7609
|
si as XGantt,
|
|
7501
7610
|
B as colorjs,
|