@xpyjs/gantt-core 0.0.1-beta.2 → 0.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/x-gantt.js +220 -222
- package/dist/x-gantt.umd.cjs +2 -2
- package/package.json +1 -1
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 I 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
|
|
6
|
+
import { merge as rt, isArray as X, isString as V, isFunction as j, cloneDeep as Z, isObject as Ct, 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 Lt = "0.0.1-beta.
|
|
8
|
+
const Lt = "0.0.1-beta.3";
|
|
9
9
|
function Vt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
@@ -401,8 +401,8 @@ class jt {
|
|
|
401
401
|
this.events.clear();
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
var
|
|
405
|
-
function
|
|
404
|
+
var L = /* @__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_MOVING = "slider-moving", 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_MOUSEOVER = "baseline-mouseover", f.BASELINE_MOUSEOUT = "baseline-mouseout", f.ERROR = "error", f))(L || {}), 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
|
+
function Q() {
|
|
406
406
|
return Math.random().toString(36).substring(2, 15);
|
|
407
407
|
}
|
|
408
408
|
function $(f, t, e) {
|
|
@@ -471,7 +471,7 @@ function bt(f, t = 16, e = 16) {
|
|
|
471
471
|
}
|
|
472
472
|
class mt {
|
|
473
473
|
constructor(t, e, i, s, n) {
|
|
474
|
-
a(this, "__key__",
|
|
474
|
+
a(this, "__key__", Q());
|
|
475
475
|
/**
|
|
476
476
|
* 任务ID
|
|
477
477
|
* 如果没有提供,则会自动生成一个唯一ID
|
|
@@ -529,7 +529,7 @@ class mt {
|
|
|
529
529
|
*/
|
|
530
530
|
a(this, "data");
|
|
531
531
|
a(this, "fields");
|
|
532
|
-
this.store = t, this.event = e, this.fields = this.store.getOptionManager().getOptions().fields, this.id = n || i[this.fields.id] ||
|
|
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
535
|
if (!t || V(t) && t.trim() === "")
|
|
@@ -544,7 +544,7 @@ class mt {
|
|
|
544
544
|
return;
|
|
545
545
|
i = i[n];
|
|
546
546
|
}
|
|
547
|
-
return Ct(i) ?
|
|
547
|
+
return Ct(i) ? Z(i) : i;
|
|
548
548
|
}
|
|
549
549
|
/** 切换展示模式时,需要调整时间 */
|
|
550
550
|
updateMode() {
|
|
@@ -554,19 +554,19 @@ 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(L.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(L.UPDATE_TASK, this);
|
|
564
564
|
}
|
|
565
565
|
clone() {
|
|
566
566
|
return new mt(
|
|
567
567
|
this.store,
|
|
568
568
|
this.event,
|
|
569
|
-
|
|
569
|
+
Z(this.data),
|
|
570
570
|
this.parent,
|
|
571
571
|
this.id
|
|
572
572
|
);
|
|
@@ -613,7 +613,7 @@ class Qt {
|
|
|
613
613
|
a(this, "target", !1);
|
|
614
614
|
this.store = t, this.event = e;
|
|
615
615
|
const s = this.store.getOptionManager().getOptions().fields, n = this.store.getOptionManager().getOptions().baselines.fields;
|
|
616
|
-
this.taskId = i[t.getOptionManager().getOptions().baselines.taskKey], this.id = i[s.id] || i[n.id] ||
|
|
616
|
+
this.taskId = i[t.getOptionManager().getOptions().baselines.taskKey], this.id = i[s.id] || i[n.id] || Q(), this.name = i[s.name] || i[n.name] || "", this.highlight = i[n.highlight] !== !1, this.target = i[n.target] === !0;
|
|
617
617
|
const o = i[s.startTime] || i[n.startTime];
|
|
618
618
|
o && (this.startTime = I(o));
|
|
619
619
|
const r = i[s.endTime] || i[n.endTime];
|
|
@@ -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(L.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(L.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(L.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(L.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(L.TASK_UNSELECTED, t);
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
/**
|
|
@@ -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(L.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
|
+
L.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(L.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
|
+
L.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(L.CHECK_TASK, this.updateState.bind(this));
|
|
1310
1310
|
}
|
|
1311
1311
|
/** 获取元素 */
|
|
1312
1312
|
getElement() {
|
|
@@ -1408,7 +1408,7 @@ class ee {
|
|
|
1408
1408
|
p.children.reduce((x, w) => Math.max(x, w.maxLevel), 0)
|
|
1409
1409
|
);
|
|
1410
1410
|
}
|
|
1411
|
-
}), this.temporaryLeafColumns =
|
|
1411
|
+
}), this.temporaryLeafColumns = Z(this.leafColumns);
|
|
1412
1412
|
}
|
|
1413
1413
|
/**
|
|
1414
1414
|
* 根据 key 查找列
|
|
@@ -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(L.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;
|
|
@@ -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(L.TOGGLE_COLLAPSE);
|
|
1485
1485
|
}
|
|
1486
1486
|
isCollapsed() {
|
|
1487
1487
|
return this.collapseTable;
|
|
@@ -1696,8 +1696,8 @@ const tt = class tt {
|
|
|
1696
1696
|
if (k.length === 0)
|
|
1697
1697
|
E = [[w]];
|
|
1698
1698
|
else {
|
|
1699
|
-
for (const
|
|
1700
|
-
const v = r(
|
|
1699
|
+
for (const C of k) {
|
|
1700
|
+
const v = r(C, T, b);
|
|
1701
1701
|
for (const M of v)
|
|
1702
1702
|
E.push([w, ...M]);
|
|
1703
1703
|
}
|
|
@@ -1716,8 +1716,8 @@ const tt = class tt {
|
|
|
1716
1716
|
if (k.length === 0)
|
|
1717
1717
|
E = [[w]];
|
|
1718
1718
|
else {
|
|
1719
|
-
for (const
|
|
1720
|
-
const v = h(
|
|
1719
|
+
for (const C of k) {
|
|
1720
|
+
const v = h(C, T, b);
|
|
1721
1721
|
for (const M of v)
|
|
1722
1722
|
E.push([...M, w]);
|
|
1723
1723
|
}
|
|
@@ -1733,7 +1733,7 @@ const tt = class tt {
|
|
|
1733
1733
|
for (const y of w) {
|
|
1734
1734
|
y.forEach((k) => l.set(k.id, k));
|
|
1735
1735
|
for (let k = 0; k < y.length - 1; k++) {
|
|
1736
|
-
const E = y[k].id,
|
|
1736
|
+
const E = y[k].id, C = y[k + 1].id, v = this.findLinkFast(E, C);
|
|
1737
1737
|
if (v) {
|
|
1738
1738
|
const M = `${v.from}-${v.to}-${v.type || "default"}`;
|
|
1739
1739
|
p.has(M) || (b.push(v), p.set(M, v));
|
|
@@ -2093,8 +2093,8 @@ var Mt = { exports: {} };
|
|
|
2093
2093
|
})(P, function() {
|
|
2094
2094
|
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 }, p = function(E) {
|
|
2095
2095
|
return E instanceof y;
|
|
2096
|
-
}, m = function(E,
|
|
2097
|
-
return new y(E, v,
|
|
2096
|
+
}, m = function(E, C, v) {
|
|
2097
|
+
return new y(E, v, C.$l);
|
|
2098
2098
|
}, u = function(E) {
|
|
2099
2099
|
return i.p(E) + "s";
|
|
2100
2100
|
}, x = function(E) {
|
|
@@ -2103,8 +2103,8 @@ var Mt = { exports: {} };
|
|
|
2103
2103
|
return x(E) ? Math.ceil(E) : Math.floor(E);
|
|
2104
2104
|
}, T = function(E) {
|
|
2105
2105
|
return Math.abs(E);
|
|
2106
|
-
}, b = function(E,
|
|
2107
|
-
return E ? x(E) ? { negative: !0, format: "" + T(E) +
|
|
2106
|
+
}, b = function(E, C) {
|
|
2107
|
+
return E ? x(E) ? { negative: !0, format: "" + T(E) + C } : { negative: !1, format: "" + E + C } : { negative: !1, format: "" };
|
|
2108
2108
|
}, y = function() {
|
|
2109
2109
|
function E(v, M, A) {
|
|
2110
2110
|
var _ = this;
|
|
@@ -2124,93 +2124,93 @@ var Mt = { exports: {} };
|
|
|
2124
2124
|
}
|
|
2125
2125
|
return this;
|
|
2126
2126
|
}
|
|
2127
|
-
var
|
|
2128
|
-
return
|
|
2127
|
+
var C = E.prototype;
|
|
2128
|
+
return C.calMilliseconds = function() {
|
|
2129
2129
|
var v = this;
|
|
2130
2130
|
this.$ms = Object.keys(this.$d).reduce(function(M, A) {
|
|
2131
2131
|
return M + (v.$d[A] || 0) * l[A];
|
|
2132
2132
|
}, 0);
|
|
2133
|
-
},
|
|
2133
|
+
}, C.parseFromMilliseconds = function() {
|
|
2134
2134
|
var v = this.$ms;
|
|
2135
2135
|
this.$d.years = w(v / c), v %= c, this.$d.months = w(v / g), v %= g, this.$d.days = w(v / r), v %= r, this.$d.hours = w(v / o), v %= o, this.$d.minutes = w(v / n), v %= n, this.$d.seconds = w(v / s), v %= s, this.$d.milliseconds = v;
|
|
2136
|
-
},
|
|
2136
|
+
}, C.toISOString = function() {
|
|
2137
2137
|
var v = b(this.$d.years, "Y"), M = b(this.$d.months, "M"), A = +this.$d.days || 0;
|
|
2138
2138
|
this.$d.weeks && (A += 7 * this.$d.weeks);
|
|
2139
2139
|
var _ = b(A, "D"), D = b(this.$d.hours, "H"), H = b(this.$d.minutes, "M"), W = this.$d.seconds || 0;
|
|
2140
2140
|
this.$d.milliseconds && (W += this.$d.milliseconds / 1e3, W = Math.round(1e3 * W) / 1e3);
|
|
2141
2141
|
var G = b(W, "S"), R = v.negative || M.negative || _.negative || D.negative || H.negative || G.negative, F = D.format || H.format || G.format ? "T" : "", z = (R ? "-" : "") + "P" + v.format + M.format + _.format + F + D.format + H.format + G.format;
|
|
2142
2142
|
return z === "P" || z === "-P" ? "P0D" : z;
|
|
2143
|
-
},
|
|
2143
|
+
}, C.toJSON = function() {
|
|
2144
2144
|
return this.toISOString();
|
|
2145
|
-
},
|
|
2145
|
+
}, C.format = function(v) {
|
|
2146
2146
|
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") };
|
|
2147
2147
|
return M.replace(h, function(_, D) {
|
|
2148
2148
|
return D || String(A[_]);
|
|
2149
2149
|
});
|
|
2150
|
-
},
|
|
2150
|
+
}, C.as = function(v) {
|
|
2151
2151
|
return this.$ms / l[u(v)];
|
|
2152
|
-
},
|
|
2152
|
+
}, C.get = function(v) {
|
|
2153
2153
|
var M = this.$ms, A = u(v);
|
|
2154
2154
|
return A === "milliseconds" ? M %= 1e3 : M = A === "weeks" ? w(M / l[A]) : this.$d[A], M || 0;
|
|
2155
|
-
},
|
|
2155
|
+
}, C.add = function(v, M, A) {
|
|
2156
2156
|
var _;
|
|
2157
2157
|
return _ = M ? v * l[u(M)] : p(v) ? v.$ms : m(v, this).$ms, m(this.$ms + _ * (A ? -1 : 1), this);
|
|
2158
|
-
},
|
|
2158
|
+
}, C.subtract = function(v, M) {
|
|
2159
2159
|
return this.add(v, M, !0);
|
|
2160
|
-
},
|
|
2160
|
+
}, C.locale = function(v) {
|
|
2161
2161
|
var M = this.clone();
|
|
2162
2162
|
return M.$l = v, M;
|
|
2163
|
-
},
|
|
2163
|
+
}, C.clone = function() {
|
|
2164
2164
|
return m(this.$ms, this);
|
|
2165
|
-
},
|
|
2165
|
+
}, C.humanize = function(v) {
|
|
2166
2166
|
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!v);
|
|
2167
|
-
},
|
|
2167
|
+
}, C.valueOf = function() {
|
|
2168
2168
|
return this.asMilliseconds();
|
|
2169
|
-
},
|
|
2169
|
+
}, C.milliseconds = function() {
|
|
2170
2170
|
return this.get("milliseconds");
|
|
2171
|
-
},
|
|
2171
|
+
}, C.asMilliseconds = function() {
|
|
2172
2172
|
return this.as("milliseconds");
|
|
2173
|
-
},
|
|
2173
|
+
}, C.seconds = function() {
|
|
2174
2174
|
return this.get("seconds");
|
|
2175
|
-
},
|
|
2175
|
+
}, C.asSeconds = function() {
|
|
2176
2176
|
return this.as("seconds");
|
|
2177
|
-
},
|
|
2177
|
+
}, C.minutes = function() {
|
|
2178
2178
|
return this.get("minutes");
|
|
2179
|
-
},
|
|
2179
|
+
}, C.asMinutes = function() {
|
|
2180
2180
|
return this.as("minutes");
|
|
2181
|
-
},
|
|
2181
|
+
}, C.hours = function() {
|
|
2182
2182
|
return this.get("hours");
|
|
2183
|
-
},
|
|
2183
|
+
}, C.asHours = function() {
|
|
2184
2184
|
return this.as("hours");
|
|
2185
|
-
},
|
|
2185
|
+
}, C.days = function() {
|
|
2186
2186
|
return this.get("days");
|
|
2187
|
-
},
|
|
2187
|
+
}, C.asDays = function() {
|
|
2188
2188
|
return this.as("days");
|
|
2189
|
-
},
|
|
2189
|
+
}, C.weeks = function() {
|
|
2190
2190
|
return this.get("weeks");
|
|
2191
|
-
},
|
|
2191
|
+
}, C.asWeeks = function() {
|
|
2192
2192
|
return this.as("weeks");
|
|
2193
|
-
},
|
|
2193
|
+
}, C.months = function() {
|
|
2194
2194
|
return this.get("months");
|
|
2195
|
-
},
|
|
2195
|
+
}, C.asMonths = function() {
|
|
2196
2196
|
return this.as("months");
|
|
2197
|
-
},
|
|
2197
|
+
}, C.years = function() {
|
|
2198
2198
|
return this.get("years");
|
|
2199
|
-
},
|
|
2199
|
+
}, C.asYears = function() {
|
|
2200
2200
|
return this.as("years");
|
|
2201
2201
|
}, E;
|
|
2202
|
-
}(), k = function(E,
|
|
2203
|
-
return E.add(
|
|
2202
|
+
}(), k = function(E, C, v) {
|
|
2203
|
+
return E.add(C.years() * v, "y").add(C.months() * v, "M").add(C.days() * v, "d").add(C.hours() * v, "h").add(C.minutes() * v, "m").add(C.seconds() * v, "s").add(C.milliseconds() * v, "ms");
|
|
2204
2204
|
};
|
|
2205
|
-
return function(E,
|
|
2205
|
+
return function(E, C, v) {
|
|
2206
2206
|
e = v, i = v().$utils(), v.duration = function(_, D) {
|
|
2207
2207
|
var H = v.locale();
|
|
2208
2208
|
return m(_, { $l: H }, D);
|
|
2209
2209
|
}, v.isDuration = p;
|
|
2210
|
-
var M =
|
|
2211
|
-
|
|
2210
|
+
var M = C.prototype.add, A = C.prototype.subtract;
|
|
2211
|
+
C.prototype.add = function(_, D) {
|
|
2212
2212
|
return p(_) ? k(this, _, 1) : M.bind(this)(_, D);
|
|
2213
|
-
},
|
|
2213
|
+
}, C.prototype.subtract = function(_, D) {
|
|
2214
2214
|
return p(_) ? k(this, _, -1) : A.bind(this)(_, D);
|
|
2215
2215
|
};
|
|
2216
2216
|
};
|
|
@@ -2495,8 +2495,8 @@ var $t = { exports: {} };
|
|
|
2495
2495
|
var w = m[x], T = w.type, b = w.value, y = e[T];
|
|
2496
2496
|
y >= 0 && (u[y] = parseInt(b, 10));
|
|
2497
2497
|
}
|
|
2498
|
-
var k = u[3], E = k === 24 ? 0 : k,
|
|
2499
|
-
return (o.utc(
|
|
2498
|
+
var k = u[3], E = k === 24 ? 0 : k, C = u[0] + "-" + u[1] + "-" + u[2] + " " + E + ":" + u[4] + ":" + u[5] + ":000", v = +l;
|
|
2499
|
+
return (o.utc(C).valueOf() - (v -= v % 1e3)) / 6e4;
|
|
2500
2500
|
}, g = n.prototype;
|
|
2501
2501
|
g.tz = function(l, p) {
|
|
2502
2502
|
l === void 0 && (l = r);
|
|
@@ -2521,10 +2521,10 @@ var $t = { exports: {} };
|
|
|
2521
2521
|
}, o.tz = function(l, p, m) {
|
|
2522
2522
|
var u = m && p, x = m || p || r, w = c(+o(), x);
|
|
2523
2523
|
if (typeof l != "string") return o(l).tz(x);
|
|
2524
|
-
var T = function(E,
|
|
2525
|
-
var M = E - 60 *
|
|
2526
|
-
if (
|
|
2527
|
-
var _ = c(M -= 60 * (A -
|
|
2524
|
+
var T = function(E, C, v) {
|
|
2525
|
+
var M = E - 60 * C * 1e3, A = c(M, v);
|
|
2526
|
+
if (C === A) return [M, C];
|
|
2527
|
+
var _ = c(M -= 60 * (A - C) * 1e3, v);
|
|
2528
2528
|
return A === _ ? [M, A] : [E - 60 * Math.min(A, _) * 1e3, Math.max(A, _)];
|
|
2529
2529
|
}(o.utc(l, u).valueOf(), w, x), b = T[0], y = T[1], k = o(b).utcOffset(y);
|
|
2530
2530
|
return k.$x.$timezone = x, k;
|
|
@@ -2574,7 +2574,7 @@ var Ft = { exports: {} };
|
|
|
2574
2574
|
k === void 0 && (k = "");
|
|
2575
2575
|
var E = k.match(i);
|
|
2576
2576
|
if (!E) return null;
|
|
2577
|
-
var
|
|
2577
|
+
var C = ("" + E[0]).match(s) || ["-", 0, 0], v = C[0], M = 60 * +C[1] + +C[2];
|
|
2578
2578
|
return M === 0 ? 0 : v === "+" ? M : -M;
|
|
2579
2579
|
}(u), u === null)) return this;
|
|
2580
2580
|
var T = Math.abs(u) <= 16 ? 60 * u : u, b = this;
|
|
@@ -2723,7 +2723,7 @@ class Oe {
|
|
|
2723
2723
|
a(this, "cellWidth");
|
|
2724
2724
|
/** 用户设定的单位 */
|
|
2725
2725
|
a(this, "unit", "day");
|
|
2726
|
-
this.cellWidth =
|
|
2726
|
+
this.cellWidth = Z(ut().normal);
|
|
2727
2727
|
}
|
|
2728
2728
|
getStartTime() {
|
|
2729
2729
|
return this.startTime;
|
|
@@ -2787,7 +2787,7 @@ class Oe {
|
|
|
2787
2787
|
week: s.cellWidth,
|
|
2788
2788
|
month: s.cellWidth,
|
|
2789
2789
|
quarter: s.cellWidth
|
|
2790
|
-
} : V(s.cellWidth) ? this.cellWidth =
|
|
2790
|
+
} : V(s.cellWidth) ? this.cellWidth = Z(
|
|
2791
2791
|
ut()[s.cellWidth] || ut().normal
|
|
2792
2792
|
) : Ct(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2793
2793
|
}
|
|
@@ -2958,7 +2958,7 @@ class De {
|
|
|
2958
2958
|
const i = yt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
2959
2959
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((c) => {
|
|
2960
2960
|
c.updateMode();
|
|
2961
|
-
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data), this.linkManager.setCycleDetection(((h = t.links) == null ? void 0 : h.enableCycleDetection) ?? !0), i.locale && vt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
2961
|
+
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((h = t.links) == null ? void 0 : h.enableCycleDetection) ?? !0), i.locale && vt(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
2962
2962
|
}
|
|
2963
2963
|
updateTime(t, e) {
|
|
2964
2964
|
this.timeAxis.setDate(t, e);
|
|
@@ -3171,7 +3171,7 @@ class _e {
|
|
|
3171
3171
|
}
|
|
3172
3172
|
// --- 事件处理 ---
|
|
3173
3173
|
emit(t, e, i) {
|
|
3174
|
-
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(
|
|
3174
|
+
this.scrollLeft = $(e, 0, this.contentWidth - this.viewportWidth), this.scrollTop = $(i, 0, this.contentHeight - this.viewportHeight), this.updateThumbStyles(), this.root.event.emit(L.SCROLL, {
|
|
3175
3175
|
x: this.scrollLeft,
|
|
3176
3176
|
y: this.scrollTop,
|
|
3177
3177
|
source: t
|
|
@@ -3373,7 +3373,7 @@ class _e {
|
|
|
3373
3373
|
this.unbindEvents(), this.clearTimeouts(), this.cancelAnimation(), this.scrollbarContainer.parentNode && this.scrollbarContainer.parentNode.removeChild(this.scrollbarContainer), this.rootElement = null, this.eventManager = null, this.hScrollbar = null, this.vScrollbar = null, this.hScrollThumb = null, this.vScrollThumb = null, this.scrollbarContainer = null, O.debug("Scrollbar destroyed");
|
|
3374
3374
|
}
|
|
3375
3375
|
}
|
|
3376
|
-
function
|
|
3376
|
+
function J(f, t = "") {
|
|
3377
3377
|
const e = ["px", "%", "vh", "vw", "rem", "em"];
|
|
3378
3378
|
if (f == null)
|
|
3379
3379
|
return t;
|
|
@@ -3424,7 +3424,7 @@ class st {
|
|
|
3424
3424
|
}
|
|
3425
3425
|
setContent() {
|
|
3426
3426
|
const t = document.createElement("div");
|
|
3427
|
-
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", (this.column.column.ellipsis ?? this.context.getOptions().table.ellipsis ?? !0) && (t.style.textOverflow = "ellipsis"), t.style.whiteSpace = "nowrap", t.style.flex = "1", t.style.height = "100%", t.style.alignContent = "center", this.colIndex === 0 && (t.style.paddingLeft =
|
|
3427
|
+
if (t.className = "x-gantt-table-cell__content", t.style.overflow = "hidden", (this.column.column.ellipsis ?? this.context.getOptions().table.ellipsis ?? !0) && (t.style.textOverflow = "ellipsis"), t.style.whiteSpace = "nowrap", t.style.flex = "1", t.style.height = "100%", t.style.alignContent = "center", this.colIndex === 0 && (t.style.paddingLeft = J(
|
|
3428
3428
|
this.task.level * this.context.getOptions().row.indent,
|
|
3429
3429
|
"16px"
|
|
3430
3430
|
)), typeof this.column.column.render == "function")
|
|
@@ -3466,20 +3466,20 @@ class st {
|
|
|
3466
3466
|
*/
|
|
3467
3467
|
updateWidth() {
|
|
3468
3468
|
if (this.isHandler) {
|
|
3469
|
-
this.element.style.width =
|
|
3469
|
+
this.element.style.width = J(
|
|
3470
3470
|
this.context.store.getColumnManager().getHandlerColumn().width
|
|
3471
3471
|
);
|
|
3472
3472
|
return;
|
|
3473
3473
|
}
|
|
3474
3474
|
const t = this.context.store.getColumnManager().getLeafColumns().slice(this.colIndex, this.colIndex + Math.max(1, this.colspan)).reduce((e, i) => e + i.width, 0);
|
|
3475
|
-
this.element.style.width =
|
|
3475
|
+
this.element.style.width = J(t);
|
|
3476
3476
|
}
|
|
3477
3477
|
/**
|
|
3478
3478
|
* 更新高度
|
|
3479
3479
|
*/
|
|
3480
3480
|
updateHeight() {
|
|
3481
3481
|
const t = this.context.getOptions().row.height;
|
|
3482
|
-
this.element.style.height =
|
|
3482
|
+
this.element.style.height = J(t * Math.max(1, this.rowspan));
|
|
3483
3483
|
}
|
|
3484
3484
|
}
|
|
3485
3485
|
class St {
|
|
@@ -3501,28 +3501,28 @@ class St {
|
|
|
3501
3501
|
*/
|
|
3502
3502
|
bindEvents() {
|
|
3503
3503
|
this.element.addEventListener("mouseenter", () => {
|
|
3504
|
-
this.context.event.emit(
|
|
3504
|
+
this.context.event.emit(L.ROW_HIGHLIGHT, this.task.id);
|
|
3505
3505
|
}), this.element.addEventListener("mouseleave", () => {
|
|
3506
|
-
this.context.event.emit(
|
|
3506
|
+
this.context.event.emit(L.ROW_UNHIGHLIGHT, this.task.id);
|
|
3507
3507
|
}), this.element.addEventListener("click", (t) => {
|
|
3508
|
-
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3508
|
+
this.context.store.getDataManager().isTaskSelected(this.task.id) || (this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(L.ROW_CLICK, t, this.task));
|
|
3509
3509
|
}), this.element.addEventListener("dblclick", (t) => {
|
|
3510
|
-
this.context.event.emit(
|
|
3510
|
+
this.context.event.emit(L.ROW_DBL_CLICK, t, this.task);
|
|
3511
3511
|
}), this.element.addEventListener("contextmenu", (t) => {
|
|
3512
|
-
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(
|
|
3512
|
+
t.preventDefault(), this.context.store.getDataManager().selectTask(this.task.id), this.context.event.emit(L.ROW_CONTEXTMENU, t, this.task.id);
|
|
3513
3513
|
});
|
|
3514
3514
|
}
|
|
3515
3515
|
/**
|
|
3516
3516
|
* 注册全局接收事件
|
|
3517
3517
|
*/
|
|
3518
3518
|
registerEvents() {
|
|
3519
|
-
this.context.event.on(
|
|
3519
|
+
this.context.event.on(L.ROW_HIGHLIGHT, (t) => {
|
|
3520
3520
|
this.task.id === t ? this.element.classList.add("hover") : this.element.classList.remove("hover");
|
|
3521
|
-
}), this.context.event.on(
|
|
3521
|
+
}), this.context.event.on(L.ROW_UNHIGHLIGHT, (t) => {
|
|
3522
3522
|
this.task.id === t && this.element.classList.remove("hover");
|
|
3523
|
-
}), this.context.event.on(
|
|
3523
|
+
}), this.context.event.on(L.TASK_SELECTED, (t) => {
|
|
3524
3524
|
this.task.id === t.id && this.element.classList.add("selected");
|
|
3525
|
-
}), this.context.event.on(
|
|
3525
|
+
}), this.context.event.on(L.TASK_UNSELECTED, (t) => {
|
|
3526
3526
|
this.task.id === t && this.element.classList.remove("selected");
|
|
3527
3527
|
});
|
|
3528
3528
|
}
|
|
@@ -3762,7 +3762,7 @@ class pt {
|
|
|
3762
3762
|
"important"
|
|
3763
3763
|
);
|
|
3764
3764
|
const n = document.createElement("div");
|
|
3765
|
-
if (n.className = "x-gantt-table-header-cell__content", n.style.flex = "1", n.style.textAlign = i, n.style.overflow = "hidden", n.style.whiteSpace = "nowrap", s && (n.style.textOverflow = "ellipsis"), n.style.position = "relative", n.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, n.style.fontSize =
|
|
3765
|
+
if (n.className = "x-gantt-table-header-cell__content", n.style.flex = "1", n.style.textAlign = i, n.style.overflow = "hidden", n.style.whiteSpace = "nowrap", s && (n.style.textOverflow = "ellipsis"), n.style.position = "relative", n.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, n.style.fontSize = J(
|
|
3766
3766
|
this.context.getOptions().header.fontSize
|
|
3767
3767
|
), n.style.setProperty(
|
|
3768
3768
|
"color",
|
|
@@ -3793,14 +3793,14 @@ class pt {
|
|
|
3793
3793
|
const o = (c) => {
|
|
3794
3794
|
c.preventDefault(), c.stopPropagation(), e = c.clientX, i = this.columnElement.offsetWidth, s = this.root.getBoundingClientRect();
|
|
3795
3795
|
const g = (l) => r(l), d = (l) => h(l, g, d);
|
|
3796
|
-
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(
|
|
3796
|
+
document.addEventListener("mousemove", g), document.addEventListener("mouseup", d), n = e - s.left, this.context.event.emit(L.SHOW_GUIDELINE, n);
|
|
3797
3797
|
}, r = (c) => {
|
|
3798
3798
|
if (c.preventDefault(), !s) return;
|
|
3799
3799
|
const g = c.clientX - e, d = i + g, l = Math.max(50, d), p = e - s.left - i, u = this.root.clientWidth - 20;
|
|
3800
3800
|
let x = p + l;
|
|
3801
|
-
x = Math.min(u, x), this.context.event.emit(
|
|
3801
|
+
x = Math.min(u, x), this.context.event.emit(L.MOVE_GUIDELINE, x);
|
|
3802
3802
|
}, h = (c, g, d) => {
|
|
3803
|
-
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(
|
|
3803
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", d), this.context.event.emit(L.HIDE_GUIDELINE);
|
|
3804
3804
|
const l = c.clientX - e, p = Math.max(50, i + l);
|
|
3805
3805
|
this.setWidth(p);
|
|
3806
3806
|
};
|
|
@@ -3821,7 +3821,7 @@ class xt {
|
|
|
3821
3821
|
"border-color",
|
|
3822
3822
|
this.context.getOptions().border.color,
|
|
3823
3823
|
"important"
|
|
3824
|
-
), this.titleContainer.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, this.titleContainer.style.fontSize =
|
|
3824
|
+
), this.titleContainer.style.fontWeight = `${this.context.getOptions().header.fontWeight}`, this.titleContainer.style.fontSize = J(
|
|
3825
3825
|
this.context.getOptions().header.fontSize
|
|
3826
3826
|
), this.titleContainer.style.fontFamily = this.context.getOptions().header.fontFamily, this.titleContainer.style.setProperty(
|
|
3827
3827
|
"color",
|
|
@@ -3931,9 +3931,9 @@ class Ie {
|
|
|
3931
3931
|
this.tableBody.updateTask(t);
|
|
3932
3932
|
}
|
|
3933
3933
|
listenEvents() {
|
|
3934
|
-
this.context.event.on(
|
|
3934
|
+
this.context.event.on(L.UPDATE_TABLE_HEADER, () => {
|
|
3935
3935
|
this.tableHeader.render();
|
|
3936
|
-
}), this.context.event.on(
|
|
3936
|
+
}), this.context.event.on(L.UPDATE_TABLE_BODY, () => {
|
|
3937
3937
|
this.tableBody.update();
|
|
3938
3938
|
});
|
|
3939
3939
|
}
|
|
@@ -3973,11 +3973,11 @@ class Ge {
|
|
|
3973
3973
|
* 注册事件监听
|
|
3974
3974
|
*/
|
|
3975
3975
|
registerEvents() {
|
|
3976
|
-
this.context.event.on(
|
|
3976
|
+
this.context.event.on(L.ROW_HIGHLIGHT, (t) => {
|
|
3977
3977
|
this.highlightDate(t);
|
|
3978
|
-
}), this.context.event.on(
|
|
3978
|
+
}), this.context.event.on(L.ROW_UNHIGHLIGHT, (t) => {
|
|
3979
3979
|
this.unhighlightDate(t);
|
|
3980
|
-
}), this.context.event.on(
|
|
3980
|
+
}), this.context.event.on(L.UPDATE_TASK, (t) => {
|
|
3981
3981
|
this.highlightDate(t.id);
|
|
3982
3982
|
});
|
|
3983
3983
|
}
|
|
@@ -4283,12 +4283,12 @@ class We {
|
|
|
4283
4283
|
return this.context.store.getOptionManager().unpackFunc(t, this.task);
|
|
4284
4284
|
}
|
|
4285
4285
|
registerEvents() {
|
|
4286
|
-
this.context.event.on(
|
|
4286
|
+
this.context.event.on(L.SLIDER_BLINK, (t) => {
|
|
4287
4287
|
t === this.task.id && this.handleBarBlink();
|
|
4288
4288
|
});
|
|
4289
4289
|
}
|
|
4290
4290
|
render() {
|
|
4291
|
-
var m, u, x, w, T, b, y, k, E,
|
|
4291
|
+
var m, u, x, w, T, b, y, k, E, C, v, M, A;
|
|
4292
4292
|
if (!this.task.startTime || !this.task.endTime) return;
|
|
4293
4293
|
if (this.task.endTime.isBefore(this.task.startTime)) {
|
|
4294
4294
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
@@ -4328,14 +4328,14 @@ class We {
|
|
|
4328
4328
|
shadowBlur: Math.max((g || 1) * 2, 4),
|
|
4329
4329
|
shadowOffsetX: Math.max(d || 1, 2),
|
|
4330
4330
|
shadowOffsetY: Math.max((l || 1) * 1.5, 4)
|
|
4331
|
-
}), this.context.event.emit(
|
|
4331
|
+
}), this.context.event.emit(L.SLIDER_HOVER, _.evt, this.task);
|
|
4332
4332
|
}), this.slider.on("mouseout", (_) => {
|
|
4333
4333
|
p && !this.isDragging && (_.target.getStage().container().style.cursor = "default"), this.isDragging || this.handleBarHighlight({
|
|
4334
4334
|
shadowColor: c,
|
|
4335
4335
|
shadowBlur: g,
|
|
4336
4336
|
shadowOffsetX: d,
|
|
4337
4337
|
shadowOffsetY: l
|
|
4338
|
-
}), this.context.event.emit(
|
|
4338
|
+
}), this.context.event.emit(L.SLIDER_LEAVE, _.evt, this.task);
|
|
4339
4339
|
}), this.task.isMilestone()) {
|
|
4340
4340
|
this.sliderBar && !this.sliderType.startsWith("milestone") && (this.slider.destroyChildren(), this.sliderBar = null, this.progressGroup = null, this.leftHandleGroup = null, this.rightHandleGroup = null);
|
|
4341
4341
|
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), G = this.unpackFunc(this.context.getOptions().milestone.border.width), R = this.unpackFunc(this.context.getOptions().milestone.shape);
|
|
@@ -4524,7 +4524,7 @@ class We {
|
|
|
4524
4524
|
(q = this.rightHandleGroup) == null || q.add(z);
|
|
4525
4525
|
});
|
|
4526
4526
|
}
|
|
4527
|
-
(
|
|
4527
|
+
(C = this.rightHandleGroup.findOne("Rect")) == null || C.setAttrs({
|
|
4528
4528
|
x: o - this.handlerWidth,
|
|
4529
4529
|
width: this.handlerWidth,
|
|
4530
4530
|
height: e,
|
|
@@ -4620,10 +4620,10 @@ class We {
|
|
|
4620
4620
|
const E = `${gt(
|
|
4621
4621
|
u * 100,
|
|
4622
4622
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4623
|
-
)}%`,
|
|
4623
|
+
)}%`, C = new S.Text().measureSize(E).width, v = this.unpackFunc((g = this.context.getOptions().bar.progress) == null ? void 0 : g.textAlign), M = new S.Text({
|
|
4624
4624
|
x: 0,
|
|
4625
4625
|
y: v === "top" ? -e : 0,
|
|
4626
|
-
width: v === "right" ? y +
|
|
4626
|
+
width: v === "right" ? y + C : Math.max(y, C),
|
|
4627
4627
|
height: e,
|
|
4628
4628
|
fill: this.unpackFunc((d = this.context.getOptions().bar.progress) == null ? void 0 : d.color) || B("#000000").mix(w, 50).alpha(0.7).toHex(),
|
|
4629
4629
|
text: E,
|
|
@@ -4647,11 +4647,11 @@ class We {
|
|
|
4647
4647
|
const e = t.target.getStage();
|
|
4648
4648
|
e && this.slider.draggable() && (e.container().style.cursor = "grab");
|
|
4649
4649
|
}), this.slider.on("click", (t) => {
|
|
4650
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(
|
|
4650
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.isDragging = !1, this.context.event.emit(L.SLIDER_CLICK, t.evt, this.task));
|
|
4651
4651
|
}), this.slider.on("contextmenu", (t) => {
|
|
4652
|
-
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(
|
|
4652
|
+
t.cancelBubble = !0, t.evt.stopPropagation(), t.evt.preventDefault(), this.context.event.emit(L.SLIDER_CONTEXTMENU, t.evt, this.task);
|
|
4653
4653
|
}), this.slider.on("dblclick", (t) => {
|
|
4654
|
-
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(
|
|
4654
|
+
t.evt.button === 0 && (t.cancelBubble = !0, this.context.event.emit(L.SLIDER_DBL_CLICK, t.evt, this.task));
|
|
4655
4655
|
}));
|
|
4656
4656
|
}
|
|
4657
4657
|
/**
|
|
@@ -4664,7 +4664,7 @@ class We {
|
|
|
4664
4664
|
handleDragStart(t) {
|
|
4665
4665
|
const e = t.target.getStage();
|
|
4666
4666
|
if (!e) return;
|
|
4667
|
-
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(
|
|
4667
|
+
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(L.SLIDER_MOVING, !0), e.container().style.cursor = "grabbing";
|
|
4668
4668
|
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = ct(i, s);
|
|
4669
4669
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4670
4670
|
}
|
|
@@ -4677,7 +4677,7 @@ class We {
|
|
|
4677
4677
|
}
|
|
4678
4678
|
handleDragEnd(t) {
|
|
4679
4679
|
this.stopAutoMove(), this.stopAutoScroll(), this.stopAutoExpand(), this.isDragging = !1, this.dragDiffX = 0, this.draggingDirection = "none", this.oldTasks.length > 0 && (this.context.event.emit(
|
|
4680
|
-
|
|
4680
|
+
L.TASK_DRAG_END,
|
|
4681
4681
|
this.task,
|
|
4682
4682
|
this.oldTasks
|
|
4683
4683
|
), this.oldTasks = []);
|
|
@@ -4697,7 +4697,7 @@ class We {
|
|
|
4697
4697
|
}
|
|
4698
4698
|
}
|
|
4699
4699
|
}
|
|
4700
|
-
this.context.event.emit(
|
|
4700
|
+
this.context.event.emit(L.SLIDER_MOVING, !1);
|
|
4701
4701
|
}
|
|
4702
4702
|
handleMove(t, e) {
|
|
4703
4703
|
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));
|
|
@@ -4739,12 +4739,12 @@ class We {
|
|
|
4739
4739
|
t.cancelBubble = !0;
|
|
4740
4740
|
const i = t.target.getStage();
|
|
4741
4741
|
if (!i) return;
|
|
4742
|
-
this.isDragging = !0, this.context.event.emit(
|
|
4742
|
+
this.isDragging = !0, this.context.event.emit(L.SLIDER_MOVING, !0);
|
|
4743
4743
|
let s = ((x = i.getPointerPosition()) == null ? void 0 : x.x) || 0;
|
|
4744
4744
|
const n = !!this.context.getOptions().bar.move.byUnit, o = this.context.store.getTimeAxis().getCellWidth(), r = !!this.context.getOptions().bar.move.lock, h = i.width();
|
|
4745
4745
|
let c = 0, g = 0;
|
|
4746
4746
|
this.autoMoveTimer = window.setInterval(() => {
|
|
4747
|
-
const w = this.slider.width(), T = this.slider.x(), b = T + w, y = -this.offsetX, k = y + h, E = T <= y + this.EDGE_THRESHOLD,
|
|
4747
|
+
const w = this.slider.width(), T = this.slider.x(), b = T + w, y = -this.offsetX, k = y + h, E = T <= y + this.EDGE_THRESHOLD, C = b >= k - this.EDGE_THRESHOLD;
|
|
4748
4748
|
if (E && e === "left") {
|
|
4749
4749
|
if (y <= 0)
|
|
4750
4750
|
this.slider.x(0), this.stopAutoScroll(), r || (this.draggingDirection === "left" ? this.startAutoExpand("left") : this.stopAutoExpand());
|
|
@@ -4756,7 +4756,7 @@ class We {
|
|
|
4756
4756
|
} else
|
|
4757
4757
|
this.stopAutoScroll();
|
|
4758
4758
|
this.emitUpdate("left");
|
|
4759
|
-
} else if (
|
|
4759
|
+
} else if (C && e === "right") {
|
|
4760
4760
|
if (k >= this.context.store.getTimeAxis().getTotalWidth())
|
|
4761
4761
|
this.slider.width(
|
|
4762
4762
|
this.context.store.getTimeAxis().getTotalWidth() - this.slider.x()
|
|
@@ -4799,7 +4799,7 @@ class We {
|
|
|
4799
4799
|
if (this.autoExpandTimer) return;
|
|
4800
4800
|
const s = this.context.store.getTimeAxis();
|
|
4801
4801
|
this.autoExpandTimer = window.setInterval(() => {
|
|
4802
|
-
s.expand(t, 1), this.context.event.emit(
|
|
4802
|
+
s.expand(t, 1), this.context.event.emit(L.CHART_OFFSET_CHANGE), t === "left" && this.slider.x(e);
|
|
4803
4803
|
}, this.AUTO_EXPAND_INTERVAL);
|
|
4804
4804
|
}
|
|
4805
4805
|
// 开始自动滚动
|
|
@@ -4938,7 +4938,7 @@ class Fe {
|
|
|
4938
4938
|
*/
|
|
4939
4939
|
render(t) {
|
|
4940
4940
|
this.tasks = t;
|
|
4941
|
-
const e = this.context.getOptions().row.height, i =
|
|
4941
|
+
const e = this.context.getOptions().row.height, i = Q();
|
|
4942
4942
|
this.rowBgGroup.destroyChildren(), this.tasks.forEach((s, n) => {
|
|
4943
4943
|
const o = `chart-row-${s.id}`;
|
|
4944
4944
|
let r = this.rowsCache.get(o);
|
|
@@ -4987,13 +4987,13 @@ class Fe {
|
|
|
4987
4987
|
* 注册事件监听
|
|
4988
4988
|
*/
|
|
4989
4989
|
registerEvents() {
|
|
4990
|
-
this.context.event.on(
|
|
4990
|
+
this.context.event.on(L.ROW_HIGHLIGHT, (t) => {
|
|
4991
4991
|
this.highlightRow(t);
|
|
4992
|
-
}), this.context.event.on(
|
|
4992
|
+
}), this.context.event.on(L.ROW_UNHIGHLIGHT, (t) => {
|
|
4993
4993
|
this.unhighlightRow(t);
|
|
4994
|
-
}), this.context.event.on(
|
|
4994
|
+
}), this.context.event.on(L.TASK_SELECTED, (t) => {
|
|
4995
4995
|
this.selectRow(t.id);
|
|
4996
|
-
}), this.context.event.on(
|
|
4996
|
+
}), this.context.event.on(L.TASK_UNSELECTED, (t) => {
|
|
4997
4997
|
this.unselectRow(t);
|
|
4998
4998
|
});
|
|
4999
4999
|
}
|
|
@@ -5005,9 +5005,9 @@ class Fe {
|
|
|
5005
5005
|
if (!e) return;
|
|
5006
5006
|
const i = this.getTaskByPosition(e);
|
|
5007
5007
|
this.highlightedRowId && i && i.id !== this.highlightedRowId && this.context.event.emit(
|
|
5008
|
-
|
|
5008
|
+
L.ROW_UNHIGHLIGHT,
|
|
5009
5009
|
this.highlightedRowId
|
|
5010
|
-
), i && this.context.event.emit(
|
|
5010
|
+
), i && this.context.event.emit(L.ROW_HIGHLIGHT, i.id);
|
|
5011
5011
|
}
|
|
5012
5012
|
/**
|
|
5013
5013
|
* 处理鼠标离开
|
|
@@ -5025,7 +5025,7 @@ class Fe {
|
|
|
5025
5025
|
const i = this.getTaskByPosition(e);
|
|
5026
5026
|
if (i) {
|
|
5027
5027
|
if (this.context.store.getDataManager().isTaskSelected(i.id)) return;
|
|
5028
|
-
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(
|
|
5028
|
+
this.context.store.getDataManager().selectTask(i.id), this.context.event.emit(L.ROW_CLICK, t.evt, i);
|
|
5029
5029
|
}
|
|
5030
5030
|
}
|
|
5031
5031
|
/**
|
|
@@ -5036,7 +5036,7 @@ class Fe {
|
|
|
5036
5036
|
const e = this.stage.getPointerPosition();
|
|
5037
5037
|
if (!e) return;
|
|
5038
5038
|
const i = this.getTaskByPosition(e);
|
|
5039
|
-
i && this.context.event.emit(
|
|
5039
|
+
i && this.context.event.emit(L.ROW_DBL_CLICK, t.evt, i);
|
|
5040
5040
|
}
|
|
5041
5041
|
/**
|
|
5042
5042
|
* 处理右键菜单
|
|
@@ -5047,7 +5047,7 @@ class Fe {
|
|
|
5047
5047
|
const e = this.stage.getPointerPosition();
|
|
5048
5048
|
if (!e) return;
|
|
5049
5049
|
const i = this.getTaskByPosition(e);
|
|
5050
|
-
i && this.context.event.emit(
|
|
5050
|
+
i && this.context.event.emit(L.ROW_CONTEXTMENU, t.evt, i);
|
|
5051
5051
|
}
|
|
5052
5052
|
/**
|
|
5053
5053
|
* 按照位置获取任务
|
|
@@ -5433,7 +5433,7 @@ class ze {
|
|
|
5433
5433
|
stroke: r,
|
|
5434
5434
|
strokeWidth: g
|
|
5435
5435
|
}), this.bgLayer.add(this.todayLine)), (d = this.context.getOptions().today.text) != null && d.show) {
|
|
5436
|
-
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((p = this.context.getOptions().today.text) == null ? void 0 : p.fontFamily) || "Arial", y = ((m = this.context.getOptions().today.text) == null ? void 0 : m.content) || "今天", k = new S.Text({ fontSize: T, fontFamily: b }).measureSize(y), E = ((u = this.context.getOptions().today.text) == null ? void 0 : u.color) || "white",
|
|
5436
|
+
const T = ((l = this.context.getOptions().today.text) == null ? void 0 : l.fontSize) || 10, b = ((p = this.context.getOptions().today.text) == null ? void 0 : p.fontFamily) || "Arial", y = ((m = this.context.getOptions().today.text) == null ? void 0 : m.content) || "今天", k = new S.Text({ fontSize: T, fontFamily: b }).measureSize(y), E = ((u = this.context.getOptions().today.text) == null ? void 0 : u.color) || "white", C = ((x = this.context.getOptions().today.text) == null ? void 0 : x.backgroundColor) || r;
|
|
5437
5437
|
if (!this.todayTextGroup)
|
|
5438
5438
|
this.todayTextGroup = new S.Group({
|
|
5439
5439
|
x: s + this.offsetX + g,
|
|
@@ -5444,7 +5444,7 @@ class ze {
|
|
|
5444
5444
|
y: 0,
|
|
5445
5445
|
width: k.width + 12,
|
|
5446
5446
|
height: k.height + 8,
|
|
5447
|
-
fill:
|
|
5447
|
+
fill: C,
|
|
5448
5448
|
cornerRadius: 0,
|
|
5449
5449
|
name: "today-text-bg"
|
|
5450
5450
|
})), this.todayTextGroup.add(new S.Text({
|
|
@@ -5473,7 +5473,7 @@ class ze {
|
|
|
5473
5473
|
M == null || M.setAttrs({
|
|
5474
5474
|
width: k.width + 12,
|
|
5475
5475
|
height: k.height + 8,
|
|
5476
|
-
fill:
|
|
5476
|
+
fill: C
|
|
5477
5477
|
});
|
|
5478
5478
|
}
|
|
5479
5479
|
} else this.todayTextGroup && (this.todayTextGroup.destroy(), this.todayTextGroup = void 0);
|
|
@@ -5558,7 +5558,7 @@ class Ne {
|
|
|
5558
5558
|
return k;
|
|
5559
5559
|
});
|
|
5560
5560
|
if (y) {
|
|
5561
|
-
const k = this.context.store.getTimeAxis().getTimeLeft(b), E = r,
|
|
5561
|
+
const k = this.context.store.getTimeAxis().getTimeLeft(b), E = r, C = g;
|
|
5562
5562
|
if (k + o < e)
|
|
5563
5563
|
continue;
|
|
5564
5564
|
if (k > i)
|
|
@@ -5576,7 +5576,7 @@ class Ne {
|
|
|
5576
5576
|
x: k,
|
|
5577
5577
|
y: E,
|
|
5578
5578
|
width: o,
|
|
5579
|
-
height:
|
|
5579
|
+
height: C,
|
|
5580
5580
|
// 根据模式设置填充
|
|
5581
5581
|
...this.patternImage.get(y) ? {
|
|
5582
5582
|
fillPatternImage: this.patternImage.get(y) ?? void 0,
|
|
@@ -5668,8 +5668,8 @@ class Pe {
|
|
|
5668
5668
|
const b = I(T.date), y = this.context.store.getTimeAxis().getTimeLeft(b), k = g;
|
|
5669
5669
|
if (y + c < r || y > h)
|
|
5670
5670
|
return;
|
|
5671
|
-
const
|
|
5672
|
-
points:
|
|
5671
|
+
const C = [y, g, y, this.height], v = new S.Line({
|
|
5672
|
+
points: C,
|
|
5673
5673
|
stroke: T.backgroundColor || e,
|
|
5674
5674
|
opacity: T.opacity || i,
|
|
5675
5675
|
strokeWidth: 1
|
|
@@ -5784,11 +5784,11 @@ class Ye {
|
|
|
5784
5784
|
* 注册事件
|
|
5785
5785
|
*/
|
|
5786
5786
|
registerEvents() {
|
|
5787
|
-
this.context.event.on(
|
|
5787
|
+
this.context.event.on(L.ROW_HIGHLIGHT, (t) => {
|
|
5788
5788
|
this.highlightPoint(t);
|
|
5789
|
-
}), this.context.event.on(
|
|
5789
|
+
}), this.context.event.on(L.ROW_UNHIGHLIGHT, (t) => {
|
|
5790
5790
|
this.unhighlightPoint(t);
|
|
5791
|
-
}), this.context.event.on(
|
|
5791
|
+
}), this.context.event.on(L.SLIDER_MOVING, (t) => {
|
|
5792
5792
|
this.isSliderMoving = t;
|
|
5793
5793
|
});
|
|
5794
5794
|
}
|
|
@@ -5898,12 +5898,10 @@ class Ye {
|
|
|
5898
5898
|
const o = this.linksGroup.findOne(`#${n}`);
|
|
5899
5899
|
o && o.destroy();
|
|
5900
5900
|
});
|
|
5901
|
-
const i =
|
|
5901
|
+
const i = Q();
|
|
5902
5902
|
e.forEach((s) => {
|
|
5903
5903
|
var g, d, l, p, m, u, x, w;
|
|
5904
|
-
const n = this.createId(s);
|
|
5905
|
-
this.selectedMap.has(n) && i.push(n);
|
|
5906
|
-
const o = this.context.store.getDataManager().getTaskById(s.from), r = this.context.store.getDataManager().getTaskById(s.to);
|
|
5904
|
+
const n = this.createId(s), o = this.context.store.getDataManager().getTaskById(s.from), r = this.context.store.getDataManager().getTaskById(s.to);
|
|
5907
5905
|
if (!o) {
|
|
5908
5906
|
O.warn(
|
|
5909
5907
|
`No corresponding FROM task [${s.from}] was found for the link. Info:`,
|
|
@@ -5927,9 +5925,9 @@ class Ye {
|
|
|
5927
5925
|
O.warn("The link position has some error.", s);
|
|
5928
5926
|
else {
|
|
5929
5927
|
const b = s.radius ?? this.context.getOptions().links.radius, y = ((m = s.arrow) == null ? void 0 : m.width) ?? this.context.getOptions().links.arrow.width, k = ((u = s.arrow) == null ? void 0 : u.height) ?? this.context.getOptions().links.arrow.height, E = s.width ?? this.context.getOptions().links.width;
|
|
5930
|
-
let
|
|
5931
|
-
|
|
5932
|
-
const v =
|
|
5928
|
+
let C = this.linkCache.get(n);
|
|
5929
|
+
C === void 0 && (C = new S.Group({ id: n })), C._ = i;
|
|
5930
|
+
const v = C.findOne("Circle");
|
|
5933
5931
|
if (v)
|
|
5934
5932
|
v.radius(b), v.fill(
|
|
5935
5933
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
@@ -5941,9 +5939,9 @@ class Ye {
|
|
|
5941
5939
|
x: T[0],
|
|
5942
5940
|
y: T[1]
|
|
5943
5941
|
});
|
|
5944
|
-
|
|
5942
|
+
C.add(G);
|
|
5945
5943
|
}
|
|
5946
|
-
const M = Math.floor(T.length / 2), A = M % 2 === 0 ? M : M - 1, _ = T.slice(0, A + 2), D = T.slice(A), H =
|
|
5944
|
+
const M = Math.floor(T.length / 2), A = M % 2 === 0 ? M : M - 1, _ = T.slice(0, A + 2), D = T.slice(A), H = C.findOne("Line");
|
|
5947
5945
|
if (H)
|
|
5948
5946
|
H.points(_), H.stroke(
|
|
5949
5947
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
@@ -5961,7 +5959,7 @@ class Ye {
|
|
|
5961
5959
|
draggable: !0,
|
|
5962
5960
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
5963
5961
|
});
|
|
5964
|
-
|
|
5962
|
+
C.add(G), G.on("dragstart", (R) => {
|
|
5965
5963
|
this.handleDrag(
|
|
5966
5964
|
R,
|
|
5967
5965
|
s,
|
|
@@ -5971,7 +5969,7 @@ class Ye {
|
|
|
5971
5969
|
);
|
|
5972
5970
|
});
|
|
5973
5971
|
}
|
|
5974
|
-
const W =
|
|
5972
|
+
const W = C.findOne("Arrow");
|
|
5975
5973
|
if (W)
|
|
5976
5974
|
W.points(D), W.stroke(
|
|
5977
5975
|
s.color || this.context.getOptions().links.color || this.context.getOptions().primaryColor
|
|
@@ -5994,44 +5992,44 @@ class Ye {
|
|
|
5994
5992
|
draggable: !0,
|
|
5995
5993
|
dragBoundFunc: (R) => ({ x: 0, y: 0 })
|
|
5996
5994
|
});
|
|
5997
|
-
|
|
5995
|
+
C.add(G), G.on("dragstart", (R) => {
|
|
5998
5996
|
this.handleDrag(R, s, "F", [T[0], T[1]], n);
|
|
5999
5997
|
});
|
|
6000
5998
|
}
|
|
6001
|
-
this.linkCache.has(n) || (this.linksGroup.add(
|
|
5999
|
+
this.linkCache.has(n) || (this.linksGroup.add(C), C.on("mouseover", (G) => {
|
|
6002
6000
|
G.target.moveToTop(), this.context.getOptions().links.move.enabled === !0 && (this.stage.container().style.cursor = "pointer"), this.selectedMap.has(n) || this.handleHighlight(
|
|
6003
|
-
|
|
6001
|
+
C,
|
|
6004
6002
|
b,
|
|
6005
6003
|
y,
|
|
6006
6004
|
k,
|
|
6007
6005
|
E,
|
|
6008
6006
|
2
|
|
6009
6007
|
);
|
|
6010
|
-
}),
|
|
6008
|
+
}), C.on("mouseout", (G) => {
|
|
6011
6009
|
this.selectedMap.has(n) || this.handleHighlight(
|
|
6012
|
-
|
|
6010
|
+
C,
|
|
6013
6011
|
b,
|
|
6014
6012
|
y,
|
|
6015
6013
|
k,
|
|
6016
6014
|
E,
|
|
6017
6015
|
0
|
|
6018
6016
|
), !this.isDragging && (this.stage.container().style.cursor = "default");
|
|
6019
|
-
}),
|
|
6017
|
+
}), C.on("mousedown", (G) => {
|
|
6020
6018
|
this.isDragging = !0;
|
|
6021
|
-
}),
|
|
6022
|
-
G.cancelBubble = !0, this.isDragging = !1,
|
|
6023
|
-
|
|
6019
|
+
}), C.on("click", (G) => {
|
|
6020
|
+
G.cancelBubble = !0, this.isDragging = !1, C.moveToTop(), G.evt.button === 0 ? this.selectedMap.has(n) ? (this.selectedMap.delete(n), this.context.event.emit(
|
|
6021
|
+
L.SELECT_LINK,
|
|
6024
6022
|
null,
|
|
6025
6023
|
s,
|
|
6026
6024
|
this.selectedMap.values().toArray()
|
|
6027
6025
|
)) : (this.selectedMap.set(n, s), this.context.event.emit(
|
|
6028
|
-
|
|
6026
|
+
L.SELECT_LINK,
|
|
6029
6027
|
s,
|
|
6030
6028
|
null,
|
|
6031
6029
|
this.selectedMap.values().toArray()
|
|
6032
|
-
)) : G.evt.button === 2 && this.context.event.emit(
|
|
6033
|
-
}), this.linkCache.set(n,
|
|
6034
|
-
|
|
6030
|
+
)) : G.evt.button === 2 && this.context.event.emit(L.CONTEXT_LINK, G.evt, s);
|
|
6031
|
+
}), this.linkCache.set(n, C)), this.selectedMap.has(n) && this.handleHighlight(
|
|
6032
|
+
C,
|
|
6035
6033
|
b,
|
|
6036
6034
|
y,
|
|
6037
6035
|
k,
|
|
@@ -6041,8 +6039,8 @@ class Ye {
|
|
|
6041
6039
|
);
|
|
6042
6040
|
}
|
|
6043
6041
|
}
|
|
6044
|
-
}), this.
|
|
6045
|
-
i.
|
|
6042
|
+
}), this.linkCache.forEach((s, n) => {
|
|
6043
|
+
s._ !== i && (s.destroy(), this.linkCache.delete(n));
|
|
6046
6044
|
}), this.layer.batchDraw();
|
|
6047
6045
|
}
|
|
6048
6046
|
createId(t) {
|
|
@@ -6187,13 +6185,13 @@ class Ye {
|
|
|
6187
6185
|
const b = this.stage.getPointerPosition();
|
|
6188
6186
|
if (b && (l = this.getTaskByPosition(b), !!l && (this.templateArrow.visible(!0), o == null || o.visible(!1), l != null && l.startTime && (l != null && l.endTime)))) {
|
|
6189
6187
|
const y = this.context.store.getTimeAxis().getTimeLeft(l.startTime), k = this.context.store.getTimeAxis().getTimeLeft(l.endTime), E = (k + y) / 2 + this.offsetX;
|
|
6190
|
-
let
|
|
6191
|
-
b.x <= E ? r = "S" : (r = "F",
|
|
6188
|
+
let C = y - d;
|
|
6189
|
+
b.x <= E ? r = "S" : (r = "F", C = k + d);
|
|
6192
6190
|
let v;
|
|
6193
6191
|
if (i === "S" ? v = `${r}${(e.type || "FS")[1]}` : v = `${(e.type || "FS")[0]}${r}`, i === "S") {
|
|
6194
6192
|
const { allowLeft: M, allowRight: A } = this.isAllowStartDrop(l, e.to, v);
|
|
6195
6193
|
this.templateArrow.points([
|
|
6196
|
-
|
|
6194
|
+
C,
|
|
6197
6195
|
g + c * l.flatIndex,
|
|
6198
6196
|
...s
|
|
6199
6197
|
]), A ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
@@ -6201,7 +6199,7 @@ class Ye {
|
|
|
6201
6199
|
const { allowLeft: M, allowRight: A } = this.isAllowEndDrop(l, e.from, v);
|
|
6202
6200
|
this.templateArrow.points([
|
|
6203
6201
|
...s,
|
|
6204
|
-
|
|
6202
|
+
C,
|
|
6205
6203
|
g + c * l.flatIndex
|
|
6206
6204
|
]), M ? this.stage.container().style.cursor = "pointer" : this.stage.container().style.cursor = "not-allowed";
|
|
6207
6205
|
}
|
|
@@ -6209,13 +6207,13 @@ class Ye {
|
|
|
6209
6207
|
}, m = () => {
|
|
6210
6208
|
var k, E;
|
|
6211
6209
|
let b;
|
|
6212
|
-
const y =
|
|
6210
|
+
const y = Z(e);
|
|
6213
6211
|
if (r && l && (i === "S" ? (b = `${r}${(e.type || "FS")[1]}`, y.from = l.id) : i === "F" && (b = `${(e.type || "FS")[0]}${r}`, y.to = l.id)), b && l) {
|
|
6214
6212
|
y.type = b;
|
|
6215
|
-
let
|
|
6216
|
-
i === "S" ? { allowLeft:
|
|
6213
|
+
let C = !1, v = !1;
|
|
6214
|
+
i === "S" ? { allowLeft: C, allowRight: v } = this.isAllowStartDrop(l, y.to, y.type, !0) : i === "F" && ({ allowLeft: C, allowRight: v } = this.isAllowEndDrop(l, y.from, y.type, !0)), ((k = y.type) == null ? void 0 : k.slice(1)) === "S" && C || ((E = y.type) == null ? void 0 : E.slice(1)) === "F" && v ? (this.context.event.emit(L.UPDATE_LINK, y), this.context.store.getLinkManager().update()) : this.context.event.emit(L.ERROR, Y.LINK_NOT_ALLOWED);
|
|
6217
6215
|
} else
|
|
6218
|
-
this.context.event.emit(
|
|
6216
|
+
this.context.event.emit(L.ERROR, Y.TASK_NOT_FOUND);
|
|
6219
6217
|
this.cleanupTempLink(), this.calculateLinks(l || void 0), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m);
|
|
6220
6218
|
}, u = (b) => {
|
|
6221
6219
|
b.key === "Escape" && (this.cleanupTempLink(), o == null || o.visible(!0), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m), document.removeEventListener("keydown", u));
|
|
@@ -6258,18 +6256,18 @@ class Ye {
|
|
|
6258
6256
|
let x;
|
|
6259
6257
|
if (r && (x = o.convertPointsToLinkType(e, r)), x && l)
|
|
6260
6258
|
if (o.isLinkExist(n, l.id, x))
|
|
6261
|
-
this.context.event.emit(
|
|
6259
|
+
this.context.event.emit(L.ERROR, Y.LINK_EXIST);
|
|
6262
6260
|
else if (n === l.id && e === r)
|
|
6263
|
-
this.context.event.emit(
|
|
6261
|
+
this.context.event.emit(L.ERROR, Y.LINK_SAME);
|
|
6264
6262
|
else {
|
|
6265
6263
|
const { allowLeft: w, allowRight: T } = this.isAllowEndDrop(l, n, x, !0);
|
|
6266
|
-
r === "S" && w || r === "F" && T ? (this.context.event.emit(
|
|
6264
|
+
r === "S" && w || r === "F" && T ? (this.context.event.emit(L.CREATE_LINK, {
|
|
6267
6265
|
from: n,
|
|
6268
6266
|
to: l.id,
|
|
6269
6267
|
type: x,
|
|
6270
6268
|
color: i
|
|
6271
6269
|
}), this.context.store.getLinkManager().update()) : this.context.event.emit(
|
|
6272
|
-
|
|
6270
|
+
L.ERROR,
|
|
6273
6271
|
Y.LINK_NOT_ALLOWED
|
|
6274
6272
|
);
|
|
6275
6273
|
}
|
|
@@ -6331,7 +6329,7 @@ class Ye {
|
|
|
6331
6329
|
*/
|
|
6332
6330
|
validateChain(t, e, i, s = !1) {
|
|
6333
6331
|
const o = this.context.store.getLinkManager().validateLink({ from: t, to: e, type: i });
|
|
6334
|
-
return o.ok ? !0 : (s && o.reason === Y.LINK_CYCLE && o.cycleInfo && this.highlightCycleNodes(o.cycleInfo.nodes), this.context.event.emit(
|
|
6332
|
+
return o.ok ? !0 : (s && o.reason === Y.LINK_CYCLE && o.cycleInfo && this.highlightCycleNodes(o.cycleInfo.nodes), this.context.event.emit(L.ERROR, o.reason), !1);
|
|
6335
6333
|
}
|
|
6336
6334
|
/**
|
|
6337
6335
|
* 操作高亮关联线
|
|
@@ -6381,7 +6379,7 @@ class Ye {
|
|
|
6381
6379
|
*/
|
|
6382
6380
|
highlightCycleNodes(t) {
|
|
6383
6381
|
t.forEach((e) => {
|
|
6384
|
-
this.context.event.emit(
|
|
6382
|
+
this.context.event.emit(L.SLIDER_BLINK, e);
|
|
6385
6383
|
});
|
|
6386
6384
|
}
|
|
6387
6385
|
}
|
|
@@ -6601,11 +6599,11 @@ class Ue {
|
|
|
6601
6599
|
}
|
|
6602
6600
|
bindEvents(t, e, i) {
|
|
6603
6601
|
t.on("mouseover", (s) => {
|
|
6604
|
-
this.context.event.emit(
|
|
6602
|
+
this.context.event.emit(L.BASELINE_MOUSEOVER, s.evt, e, i);
|
|
6605
6603
|
}), t.on("mouseout", (s) => {
|
|
6606
|
-
this.context.event.emit(
|
|
6604
|
+
this.context.event.emit(L.BASELINE_MOUSEOUT, s.evt, e, i);
|
|
6607
6605
|
}), t.on("click", (s) => {
|
|
6608
|
-
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(
|
|
6606
|
+
s.cancelBubble = !0, s.evt.button === 0 ? this.context.event.emit(L.BASELINE_CLICK, s.evt, e, i) : s.evt.button === 2 && this.context.event.emit(L.BASELINE_CONTEXTMENU, s.evt, e, i);
|
|
6609
6607
|
});
|
|
6610
6608
|
}
|
|
6611
6609
|
}
|
|
@@ -6686,7 +6684,7 @@ class Ke {
|
|
|
6686
6684
|
const c = s[s.length - 1].key;
|
|
6687
6685
|
this.initialWidth = i.getColumnWidth(c);
|
|
6688
6686
|
const g = this.initialX;
|
|
6689
|
-
this.root.event.emit(
|
|
6687
|
+
this.root.event.emit(L.SHOW_GUIDELINE, g);
|
|
6690
6688
|
const d = (p) => o(p), l = (p) => r(p, d, l);
|
|
6691
6689
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", l);
|
|
6692
6690
|
}, o = (h) => {
|
|
@@ -6694,11 +6692,11 @@ class Ke {
|
|
|
6694
6692
|
const c = h.clientX - t;
|
|
6695
6693
|
s[s.length - 1].key;
|
|
6696
6694
|
const g = 50 - this.initialWidth, l = e.width - 20 - this.initialX, p = Math.max(g, Math.min(l, c)), m = this.initialX + p;
|
|
6697
|
-
this.root.event.emit(
|
|
6695
|
+
this.root.event.emit(L.MOVE_GUIDELINE, m);
|
|
6698
6696
|
}, r = (h, c, g) => {
|
|
6699
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(
|
|
6697
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", g), this.root.event.emit(L.HIDE_GUIDELINE);
|
|
6700
6698
|
const d = h.clientX - t, l = s[s.length - 1].key, p = Math.max(50, this.initialWidth + d);
|
|
6701
|
-
i.setColumnWidth(l, p), this.root.event.emit(
|
|
6699
|
+
i.setColumnWidth(l, p), this.root.event.emit(L.UPDATE_TABLE_HEADER);
|
|
6702
6700
|
};
|
|
6703
6701
|
this.line.addEventListener("mousedown", n);
|
|
6704
6702
|
}
|
|
@@ -6729,11 +6727,11 @@ class je {
|
|
|
6729
6727
|
* 初始化事件监听
|
|
6730
6728
|
*/
|
|
6731
6729
|
initEvents() {
|
|
6732
|
-
this.context.event.on(
|
|
6730
|
+
this.context.event.on(L.SHOW_GUIDELINE, (t) => {
|
|
6733
6731
|
this.show(t);
|
|
6734
|
-
}), this.context.event.on(
|
|
6732
|
+
}), this.context.event.on(L.HIDE_GUIDELINE, () => {
|
|
6735
6733
|
this.hide();
|
|
6736
|
-
}), this.context.event.on(
|
|
6734
|
+
}), this.context.event.on(L.MOVE_GUIDELINE, (t) => {
|
|
6737
6735
|
this.setLeft(t);
|
|
6738
6736
|
});
|
|
6739
6737
|
}
|
|
@@ -6933,7 +6931,7 @@ class Qe {
|
|
|
6933
6931
|
a(this, "middleLine");
|
|
6934
6932
|
a(this, "renderScheduler");
|
|
6935
6933
|
// 渲染调度器
|
|
6936
|
-
a(this, "_id",
|
|
6934
|
+
a(this, "_id", Q());
|
|
6937
6935
|
// 尺寸和状态
|
|
6938
6936
|
a(this, "width", 0);
|
|
6939
6937
|
a(this, "height", 0);
|
|
@@ -7030,21 +7028,21 @@ class Qe {
|
|
|
7030
7028
|
* 设置事件监听器
|
|
7031
7029
|
*/
|
|
7032
7030
|
setupEventListeners() {
|
|
7033
|
-
this.context.event.on(
|
|
7031
|
+
this.context.event.on(L.DATA_UPDATE, () => {
|
|
7034
7032
|
this.renderScheduler.scheduleTask("DATA_UPDATE", [!0]);
|
|
7035
|
-
}), this.context.event.on(
|
|
7033
|
+
}), this.context.event.on(L.SCROLL, () => {
|
|
7036
7034
|
this.renderScheduler.scheduleTask("SCROLL", [!0], { immediate: !0 });
|
|
7037
|
-
}), this.context.event.on(
|
|
7035
|
+
}), this.context.event.on(L.COLUMN_WIDTH_CHANGE, () => {
|
|
7038
7036
|
this.renderScheduler.scheduleTask("COLUMN_WIDTH_CHANGE");
|
|
7039
|
-
}), this.context.event.on(
|
|
7037
|
+
}), this.context.event.on(L.VIEW_UPDATE, () => {
|
|
7040
7038
|
this.renderScheduler.scheduleTask("VIEW_UPDATE", [!0]);
|
|
7041
|
-
}), this.context.event.on(
|
|
7039
|
+
}), this.context.event.on(L.UPDATE_TASK, (t) => {
|
|
7042
7040
|
this.renderScheduler.scheduleTask("UPDATE_TASK", [t], {
|
|
7043
7041
|
immediate: !0
|
|
7044
7042
|
});
|
|
7045
|
-
}), this.context.event.on(
|
|
7043
|
+
}), this.context.event.on(L.CHART_OFFSET_CHANGE, () => {
|
|
7046
7044
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1]);
|
|
7047
|
-
}), this.context.event.on(
|
|
7045
|
+
}), this.context.event.on(L.TOGGLE_COLLAPSE, () => {
|
|
7048
7046
|
this.renderScheduler.scheduleTask("CHART_OFFSET_CHANGE", [!1], { immediate: !0 });
|
|
7049
7047
|
});
|
|
7050
7048
|
}
|
|
@@ -7055,7 +7053,7 @@ class Qe {
|
|
|
7055
7053
|
performRender(t = !1, e = !1) {
|
|
7056
7054
|
this.setStyleValue();
|
|
7057
7055
|
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);
|
|
7058
|
-
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(
|
|
7056
|
+
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(L.LOADED), this.isInitialized = !1), O.debug("execute render");
|
|
7059
7057
|
}
|
|
7060
7058
|
/**
|
|
7061
7059
|
* 公共渲染方法,向后兼容
|
|
@@ -7081,7 +7079,7 @@ class Qe {
|
|
|
7081
7079
|
}
|
|
7082
7080
|
class Je {
|
|
7083
7081
|
constructor(t, e, i) {
|
|
7084
|
-
a(this, "_id",
|
|
7082
|
+
a(this, "_id", Q());
|
|
7085
7083
|
a(this, "store");
|
|
7086
7084
|
a(this, "event", new jt());
|
|
7087
7085
|
a(this, "renderer");
|
|
@@ -7140,11 +7138,11 @@ class Je {
|
|
|
7140
7138
|
}
|
|
7141
7139
|
// 注册对外事件
|
|
7142
7140
|
registerEvents() {
|
|
7143
|
-
this.event.on(
|
|
7141
|
+
this.event.on(L.ERROR, (t, e) => {
|
|
7144
7142
|
this._emit("error", t, e);
|
|
7145
|
-
}), this.event.on(
|
|
7143
|
+
}), this.event.on(L.LOADED, () => {
|
|
7146
7144
|
this._emit("loaded");
|
|
7147
|
-
}), this.event.on(
|
|
7145
|
+
}), this.event.on(L.TASK_DRAG_END, (t, e) => {
|
|
7148
7146
|
this._emit(
|
|
7149
7147
|
"move",
|
|
7150
7148
|
e.map((i) => {
|
|
@@ -7155,47 +7153,47 @@ class Je {
|
|
|
7155
7153
|
};
|
|
7156
7154
|
})
|
|
7157
7155
|
);
|
|
7158
|
-
}), this.event.on(
|
|
7156
|
+
}), this.event.on(L.CHECK_TASK, (t, e) => {
|
|
7159
7157
|
this._emit(
|
|
7160
7158
|
"select",
|
|
7161
7159
|
t.map((i) => i.data),
|
|
7162
7160
|
e,
|
|
7163
7161
|
this.store.getDataManager().getCheckedList().map((i) => i.data)
|
|
7164
7162
|
);
|
|
7165
|
-
}), this.event.on(
|
|
7163
|
+
}), this.event.on(L.UPDATE_LINK, (t) => {
|
|
7166
7164
|
this._emit("update:link", t);
|
|
7167
|
-
}), this.event.on(
|
|
7165
|
+
}), this.event.on(L.CREATE_LINK, (t) => {
|
|
7168
7166
|
this._emit("create:link", t);
|
|
7169
7167
|
}), this.event.on(
|
|
7170
|
-
|
|
7168
|
+
L.SELECT_LINK,
|
|
7171
7169
|
(t, e, i) => {
|
|
7172
7170
|
this._emit("select:link", t, e, i);
|
|
7173
7171
|
}
|
|
7174
|
-
), this.event.on(
|
|
7172
|
+
), this.event.on(L.CONTEXT_LINK, (t, e) => {
|
|
7175
7173
|
this._emit("contextmenu:link", t, e);
|
|
7176
|
-
}), this.event.on(
|
|
7174
|
+
}), this.event.on(L.ROW_CLICK, (t, e) => {
|
|
7177
7175
|
this._emit("click:row", t, e.data);
|
|
7178
|
-
}), this.event.on(
|
|
7176
|
+
}), this.event.on(L.ROW_DBL_CLICK, (t, e) => {
|
|
7179
7177
|
this._emit("dblclick:row", t, e.data);
|
|
7180
|
-
}), this.event.on(
|
|
7178
|
+
}), this.event.on(L.ROW_CONTEXTMENU, (t, e) => {
|
|
7181
7179
|
this._emit("contextmenu:row", t, e.data);
|
|
7182
|
-
}), this.event.on(
|
|
7180
|
+
}), this.event.on(L.SLIDER_CLICK, (t, e) => {
|
|
7183
7181
|
this._emit("click:slider", t, e.data);
|
|
7184
|
-
}), this.event.on(
|
|
7182
|
+
}), this.event.on(L.SLIDER_DBL_CLICK, (t, e) => {
|
|
7185
7183
|
this._emit("dblclick:slider", t, e.data);
|
|
7186
|
-
}), this.event.on(
|
|
7184
|
+
}), this.event.on(L.SLIDER_CONTEXTMENU, (t, e) => {
|
|
7187
7185
|
this._emit("contextmenu:slider", t, e.data);
|
|
7188
|
-
}), this.event.on(
|
|
7186
|
+
}), this.event.on(L.SLIDER_HOVER, (t, e) => {
|
|
7189
7187
|
this._emit("hover:slider", t, e.data);
|
|
7190
|
-
}), this.event.on(
|
|
7188
|
+
}), this.event.on(L.SLIDER_LEAVE, (t, e) => {
|
|
7191
7189
|
this._emit("leave:slider", t, e.data);
|
|
7192
|
-
}), this.event.on(
|
|
7190
|
+
}), this.event.on(L.BASELINE_CLICK, (t, e, i) => {
|
|
7193
7191
|
this._emit("click:baseline", t, e.data, i.data);
|
|
7194
|
-
}), this.event.on(
|
|
7192
|
+
}), this.event.on(L.BASELINE_CONTEXTMENU, (t, e, i) => {
|
|
7195
7193
|
this._emit("contextmenu:baseline", t, e.data, i.data);
|
|
7196
|
-
}), this.event.on(
|
|
7194
|
+
}), this.event.on(L.BASELINE_MOUSEOVER, (t, e, i) => {
|
|
7197
7195
|
this._emit("hover:baseline", t, e.data, i.data);
|
|
7198
|
-
}), this.event.on(
|
|
7196
|
+
}), this.event.on(L.BASELINE_MOUSEOUT, (t, e, i) => {
|
|
7199
7197
|
this._emit("leave:baseline", t, e.data, i.data);
|
|
7200
7198
|
});
|
|
7201
7199
|
}
|
|
@@ -7483,6 +7481,6 @@ export {
|
|
|
7483
7481
|
si as XGantt,
|
|
7484
7482
|
B as colorjs,
|
|
7485
7483
|
ai as dayjs,
|
|
7486
|
-
|
|
7484
|
+
Q as generateId,
|
|
7487
7485
|
ni as version
|
|
7488
7486
|
};
|