@xpyjs/gantt-core 0.0.1 → 0.0.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
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (f, t, e) =>
|
|
1
|
+
var Yt = Object.defineProperty;
|
|
2
|
+
var Ut = (f, t, e) => t in f ? Yt(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
|
|
3
|
+
var h = (f, t, e) => Ut(f, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import R from "dayjs";
|
|
5
|
-
import { default as
|
|
6
|
-
import { merge as
|
|
5
|
+
import { default as li } from "dayjs";
|
|
6
|
+
import { merge as at, isArray as X, isString as V, isFunction as j, cloneDeep as J, isObject as Ct, remove as st, isNumber as Xt, omit as wt, throttle as bt, isBoolean as lt, debounce as Vt } from "lodash-es";
|
|
7
7
|
import k from "konva";
|
|
8
|
-
const
|
|
9
|
-
function
|
|
8
|
+
const Mt = "0.0.2";
|
|
9
|
+
function Kt() {
|
|
10
10
|
const f = "#eca710", t = "#ffffff", e = "#e7209e", i = "#ffffff", s = "#1c42e8";
|
|
11
11
|
[
|
|
12
12
|
" __ __ _____ _____ _____ _____ _____ ",
|
|
@@ -19,7 +19,7 @@ function Vt() {
|
|
|
19
19
|
`color: ${f}; font-weight: bold; font-family: monospace;`
|
|
20
20
|
);
|
|
21
21
|
}), console.log(
|
|
22
|
-
`%c 🚀 欢迎使用 XGantt %c Version: ${
|
|
22
|
+
`%c 🚀 欢迎使用 XGantt %c Version: ${Mt} `,
|
|
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
|
);
|
|
@@ -124,7 +124,7 @@ h(P, "Prefix", "[XGantt]"), h(P, "options", {
|
|
|
124
124
|
showTimestamp: !1
|
|
125
125
|
});
|
|
126
126
|
let O = P;
|
|
127
|
-
const
|
|
127
|
+
const ct = () => ({
|
|
128
128
|
data: [],
|
|
129
129
|
links: {
|
|
130
130
|
show: !1,
|
|
@@ -321,16 +321,16 @@ const lt = () => ({
|
|
|
321
321
|
opacity: 0.1
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
-
class
|
|
324
|
+
class jt {
|
|
325
325
|
constructor() {
|
|
326
|
-
h(this, "options",
|
|
326
|
+
h(this, "options", ct());
|
|
327
327
|
}
|
|
328
328
|
getOptions() {
|
|
329
329
|
return this.options;
|
|
330
330
|
}
|
|
331
331
|
setOptions(t, e = { merge: !0 }) {
|
|
332
332
|
var i;
|
|
333
|
-
if (this.options = e.merge ?
|
|
333
|
+
if (this.options = e.merge ? at(ct(), this.options, t) : at(ct(), t), (i = t.holiday) != null && i.holidays && t.holiday.holidays.length > 0) {
|
|
334
334
|
const s = [];
|
|
335
335
|
t.holiday.holidays.forEach((n) => {
|
|
336
336
|
if (X(n.date)) {
|
|
@@ -365,7 +365,7 @@ class Kt {
|
|
|
365
365
|
return j(t) ? t(e.getEmitData()) : t;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
class
|
|
368
|
+
class qt {
|
|
369
369
|
constructor() {
|
|
370
370
|
h(this, "events", /* @__PURE__ */ new Map());
|
|
371
371
|
}
|
|
@@ -416,11 +416,11 @@ function $(f, t, e) {
|
|
|
416
416
|
const i = Math.min(t, e), s = Math.max(t, e);
|
|
417
417
|
return Math.min(Math.max(i, f), s);
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function ot(f, t) {
|
|
420
420
|
let e = f;
|
|
421
421
|
return V(e) && (/%$/.test(e) ? e = t * parseFloat(e) / 100 : e = parseFloat(e)), isNaN(e) ? 0 : e;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function dt(f, t, e = "round") {
|
|
424
424
|
if (t === 0)
|
|
425
425
|
throw new Error("基准值不能为0");
|
|
426
426
|
if (Math.abs(f) <= t / 2)
|
|
@@ -428,7 +428,7 @@ function ct(f, t, e = "round") {
|
|
|
428
428
|
const i = Math.floor(f / t), s = Math.ceil(f / t), n = i * t, o = s * t, r = Math.abs(f - n), a = Math.abs(f - o);
|
|
429
429
|
return e === "floor" ? n : e === "ceil" ? o : r <= a ? n : o;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function rt(f, t = 4) {
|
|
432
432
|
return typeof f == "number" ? [f, f, f, f] : Array.isArray(f) ? [
|
|
433
433
|
f[0] ?? t,
|
|
434
434
|
f[1] ?? t,
|
|
@@ -436,19 +436,19 @@ function ot(f, t = 4) {
|
|
|
436
436
|
f[3] ?? t
|
|
437
437
|
] : [t, t, t, t];
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function Qt(f, t = 100) {
|
|
440
440
|
if (!Number.isFinite(f) || !Number.isFinite(t) || t === 0 || f < 0)
|
|
441
441
|
return 0;
|
|
442
442
|
const e = f / Math.abs(t);
|
|
443
443
|
return Math.min(e, 1);
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function ft(f, t = 2, e = !1) {
|
|
446
446
|
const i = f.toFixed(t);
|
|
447
447
|
return e ? i : i.replace(/\.?0+$/, "");
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
451
|
-
const i =
|
|
449
|
+
const ut = /* @__PURE__ */ new Map();
|
|
450
|
+
function vt(f, t = 16, e = 16) {
|
|
451
|
+
const i = ut.get(f);
|
|
452
452
|
if (i) return i;
|
|
453
453
|
const s = new Promise((n, o) => {
|
|
454
454
|
let r = f;
|
|
@@ -467,14 +467,14 @@ function bt(f, t = 16, e = 16) {
|
|
|
467
467
|
c.onload = () => {
|
|
468
468
|
URL.revokeObjectURL(c.src), n(c);
|
|
469
469
|
}, c.onerror = (l) => {
|
|
470
|
-
URL.revokeObjectURL(c.src),
|
|
470
|
+
URL.revokeObjectURL(c.src), ut.delete(f), o(l);
|
|
471
471
|
};
|
|
472
472
|
const u = new Blob([r], { type: "image/svg+xml" }), d = URL.createObjectURL(u);
|
|
473
473
|
c.src = d;
|
|
474
474
|
});
|
|
475
|
-
return
|
|
475
|
+
return ut.set(f, s), s;
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class xt {
|
|
478
478
|
constructor(t, e, i, s, n) {
|
|
479
479
|
h(this, "__key__", Q());
|
|
480
480
|
/**
|
|
@@ -549,7 +549,7 @@ class mt {
|
|
|
549
549
|
return;
|
|
550
550
|
i = i[n];
|
|
551
551
|
}
|
|
552
|
-
return
|
|
552
|
+
return Ct(i) ? J(i) : i;
|
|
553
553
|
}
|
|
554
554
|
/** 切换展示模式时,需要调整时间 */
|
|
555
555
|
updateMode() {
|
|
@@ -568,7 +568,7 @@ class mt {
|
|
|
568
568
|
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(S.UPDATE_TASK, this);
|
|
569
569
|
}
|
|
570
570
|
clone() {
|
|
571
|
-
return new
|
|
571
|
+
return new xt(
|
|
572
572
|
this.store,
|
|
573
573
|
this.event,
|
|
574
574
|
J(this.data),
|
|
@@ -607,7 +607,7 @@ class mt {
|
|
|
607
607
|
return !1;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
class
|
|
610
|
+
class Zt {
|
|
611
611
|
constructor(t, e, i) {
|
|
612
612
|
/** 基线ID */
|
|
613
613
|
h(this, "id");
|
|
@@ -653,7 +653,7 @@ class Qt {
|
|
|
653
653
|
return { startDiff: i, endDiff: s, startStatus: o, endStatus: r, progressDiff: u, unit: e };
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
|
-
class
|
|
656
|
+
class Jt {
|
|
657
657
|
constructor(t, e) {
|
|
658
658
|
/**
|
|
659
659
|
* 原始数据
|
|
@@ -707,7 +707,7 @@ class Zt {
|
|
|
707
707
|
}));
|
|
708
708
|
}
|
|
709
709
|
createTask(t, e, i = !0) {
|
|
710
|
-
const s = this.store.getOptionManager().getOptions().fields, n = new
|
|
710
|
+
const s = this.store.getOptionManager().getOptions().fields, n = new xt(this.store, this.event, t, e);
|
|
711
711
|
return i && Array.isArray(t[s.children]) && (n.children = t[s.children].map(
|
|
712
712
|
(o) => this.createTask(o, n)
|
|
713
713
|
)), this.taskMap.set(n.id, n), this.dataLevel = Math.max(this.dataLevel, n.level), n;
|
|
@@ -788,24 +788,23 @@ class Zt {
|
|
|
788
788
|
* 移动任务位置
|
|
789
789
|
*/
|
|
790
790
|
moveTask(t, e, i) {
|
|
791
|
+
var r;
|
|
791
792
|
const s = this.getVisibleTasks()[i];
|
|
792
793
|
if (!e || !s || t === "inside" && e.isSomeoneChildren(s) || t !== "inside" && e.isSomeoneChildren(s.parent)) return;
|
|
793
794
|
const n = this.store.getOptionManager().getOptions().fields.id, o = this.store.getOptionManager().getOptions().fields.children;
|
|
794
795
|
if (e.parent && e.parent.children) {
|
|
795
|
-
e.parent.children
|
|
796
|
-
|
|
797
|
-
);
|
|
798
|
-
const r = e.parent.data[o] || [];
|
|
799
|
-
e.parent.data[o] = r.filter((a) => a[n] !== e.id);
|
|
796
|
+
st(e.parent.children, (c) => (c == null ? void 0 : c.id) === e.id);
|
|
797
|
+
const a = (r = e.parent.data) == null ? void 0 : r[o];
|
|
798
|
+
st(a, (c) => (c == null ? void 0 : c[n]) === e.id);
|
|
800
799
|
} else
|
|
801
|
-
this.tasks
|
|
800
|
+
st(this.tasks, (a) => (a == null ? void 0 : a.id) === e.id), st(this.rawData, (a) => (a == null ? void 0 : a[n]) === e.id);
|
|
802
801
|
if (t === "inside")
|
|
803
802
|
s.children = s.children || [], s.children.push(e), e.parent = s, s.data[o] = s.data[o] || [], s.data[o].push(e.data);
|
|
804
803
|
else {
|
|
805
|
-
const
|
|
806
|
-
t === "before" ? (
|
|
804
|
+
const a = s.parent ? s.parent.children : this.tasks, c = a.findIndex((l) => l.id === s.id), u = s.parent ? s.parent.data[o] || [] : this.rawData, d = u.findIndex((l) => l[n] === s.id);
|
|
805
|
+
t === "before" ? (a.splice(c, 0, e), u.splice(d, 0, e.data)) : t === "after" && (a.splice(c + 1, 0, e), u.splice(d + 1, 0, e.data)), e.parent = s.parent;
|
|
807
806
|
}
|
|
808
|
-
e.parent ? e.level = e.parent.level + 1 : e.level = 0, this.updateChildrenLevel(e), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE),
|
|
807
|
+
e.parent ? e.level = e.parent.level + 1 : e.level = 0, this.updateChildrenLevel(e), this.invalidateCache(), this.event.emit(S.VIEW_UPDATE), this.event.emit(S.ROW_DRAG_END, s, e);
|
|
809
808
|
}
|
|
810
809
|
/**
|
|
811
810
|
* 展开任务
|
|
@@ -970,7 +969,7 @@ class Zt {
|
|
|
970
969
|
setBaselines(t) {
|
|
971
970
|
this.baselines = [], this.baselineMap.clear(), this.baselineTaskMap.clear(), t.forEach((e) => {
|
|
972
971
|
var s, n;
|
|
973
|
-
const i = new
|
|
972
|
+
const i = new Zt(this.store, this.event, e);
|
|
974
973
|
this.baselines.push(i), this.baselineMap.set(i.id, i), this.baselineTaskMap.has(i.taskId) || this.baselineTaskMap.set(i.taskId, []), i.target ? (s = this.baselineTaskMap.get(i.taskId)) == null || s.unshift(i) : (n = this.baselineTaskMap.get(i.taskId)) == null || n.push(i);
|
|
975
974
|
});
|
|
976
975
|
}
|
|
@@ -986,7 +985,7 @@ class Zt {
|
|
|
986
985
|
return this.baselineTaskMap.get(t) || [];
|
|
987
986
|
}
|
|
988
987
|
}
|
|
989
|
-
function
|
|
988
|
+
function te(f) {
|
|
990
989
|
var s;
|
|
991
990
|
if (typeof f == "object" && f !== null)
|
|
992
991
|
return {
|
|
@@ -1031,7 +1030,7 @@ function Jt(f) {
|
|
|
1031
1030
|
}
|
|
1032
1031
|
return O.warn(`Could not parse color: ${f}`), null;
|
|
1033
1032
|
}
|
|
1034
|
-
function
|
|
1033
|
+
function ee(f, t, e, i, s = !1, n = !1) {
|
|
1035
1034
|
const o = (l) => {
|
|
1036
1035
|
const m = Math.round($(l, 0, 255)).toString(16);
|
|
1037
1036
|
return m.length === 1 ? "0" + m : m;
|
|
@@ -1055,7 +1054,7 @@ class et {
|
|
|
1055
1054
|
h(this, "_g");
|
|
1056
1055
|
h(this, "_b");
|
|
1057
1056
|
h(this, "_a");
|
|
1058
|
-
const e =
|
|
1057
|
+
const e = te(t);
|
|
1059
1058
|
e === null ? (O.error(`Failed to parse color: ${t}. Using default black.`), this._r = 0, this._g = 0, this._b = 0, this._a = 1) : (this._r = Math.round(e.r), this._g = Math.round(e.g), this._b = Math.round(e.b), this._a = e.a);
|
|
1060
1059
|
}
|
|
1061
1060
|
// --- Getters ---
|
|
@@ -1095,7 +1094,7 @@ class et {
|
|
|
1095
1094
|
* @returns Hex/HexA 字符串。
|
|
1096
1095
|
*/
|
|
1097
1096
|
toHex(t = !1, e = !1) {
|
|
1098
|
-
return
|
|
1097
|
+
return ee(
|
|
1099
1098
|
this._r,
|
|
1100
1099
|
this._g,
|
|
1101
1100
|
this._b,
|
|
@@ -1208,7 +1207,7 @@ class et {
|
|
|
1208
1207
|
}
|
|
1209
1208
|
}
|
|
1210
1209
|
const B = (f) => f instanceof et ? f : new et(f);
|
|
1211
|
-
class
|
|
1210
|
+
class Lt {
|
|
1212
1211
|
constructor(t, e, i) {
|
|
1213
1212
|
h(this, "element");
|
|
1214
1213
|
h(this, "iconElement");
|
|
@@ -1367,8 +1366,8 @@ class Mt {
|
|
|
1367
1366
|
this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
1368
1367
|
}
|
|
1369
1368
|
}
|
|
1370
|
-
const
|
|
1371
|
-
class
|
|
1369
|
+
const Tt = "handler_column";
|
|
1370
|
+
class ie {
|
|
1372
1371
|
constructor(t) {
|
|
1373
1372
|
/** 源列数据 */
|
|
1374
1373
|
h(this, "sourceColumns", []);
|
|
@@ -1456,7 +1455,7 @@ class ee {
|
|
|
1456
1455
|
return this.isCollapsed() ? 0 : this.leafColumns.reduce((t, e) => t + e.width, this.getHandlerColumn().width);
|
|
1457
1456
|
}
|
|
1458
1457
|
getColumnWidth(t) {
|
|
1459
|
-
if (t ===
|
|
1458
|
+
if (t === Tt) return this.getHandlerColumn().width;
|
|
1460
1459
|
const e = this.leafColumns.find((i) => i.key === t);
|
|
1461
1460
|
return typeof (e == null ? void 0 : e.width) == "number" ? e.width : 0;
|
|
1462
1461
|
}
|
|
@@ -1496,12 +1495,12 @@ class ee {
|
|
|
1496
1495
|
customStyle: {
|
|
1497
1496
|
paddingLeft: s ? `${e ? 40 : 8}px` : 0
|
|
1498
1497
|
},
|
|
1499
|
-
headerRender: () => i ? new
|
|
1498
|
+
headerRender: () => i ? new Lt(this.context).getElement() : null,
|
|
1500
1499
|
ellipsis: !1
|
|
1501
1500
|
},
|
|
1502
1501
|
children: [],
|
|
1503
1502
|
path: [],
|
|
1504
|
-
key:
|
|
1503
|
+
key: Tt,
|
|
1505
1504
|
isLeaf: !0,
|
|
1506
1505
|
width: t
|
|
1507
1506
|
};
|
|
@@ -2130,12 +2129,12 @@ h(tt, "LINK_TYPE_MAP", {
|
|
|
2130
2129
|
FF: { from: "F", to: "F", description: "结束到结束" },
|
|
2131
2130
|
SS: { from: "S", to: "S", description: "开始到开始" }
|
|
2132
2131
|
});
|
|
2133
|
-
let
|
|
2132
|
+
let pt = tt;
|
|
2134
2133
|
var N = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2135
2134
|
function U(f) {
|
|
2136
2135
|
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
2137
2136
|
}
|
|
2138
|
-
var
|
|
2137
|
+
var Ot = { exports: {} };
|
|
2139
2138
|
(function(f, t) {
|
|
2140
2139
|
(function(e, i) {
|
|
2141
2140
|
f.exports = i();
|
|
@@ -2264,10 +2263,10 @@ var Lt = { exports: {} };
|
|
|
2264
2263
|
};
|
|
2265
2264
|
};
|
|
2266
2265
|
});
|
|
2267
|
-
})(
|
|
2268
|
-
var
|
|
2269
|
-
const
|
|
2270
|
-
var
|
|
2266
|
+
})(Ot);
|
|
2267
|
+
var se = Ot.exports;
|
|
2268
|
+
const ne = /* @__PURE__ */ U(se);
|
|
2269
|
+
var Dt = { exports: {} };
|
|
2271
2270
|
(function(f, t) {
|
|
2272
2271
|
(function(e, i) {
|
|
2273
2272
|
f.exports = i();
|
|
@@ -2279,10 +2278,10 @@ var Ot = { exports: {} };
|
|
|
2279
2278
|
};
|
|
2280
2279
|
};
|
|
2281
2280
|
});
|
|
2282
|
-
})(
|
|
2283
|
-
var
|
|
2284
|
-
const
|
|
2285
|
-
var
|
|
2281
|
+
})(Dt);
|
|
2282
|
+
var oe = Dt.exports;
|
|
2283
|
+
const re = /* @__PURE__ */ U(oe);
|
|
2284
|
+
var _t = { exports: {} };
|
|
2286
2285
|
(function(f, t) {
|
|
2287
2286
|
(function(e, i) {
|
|
2288
2287
|
f.exports = i();
|
|
@@ -2293,10 +2292,10 @@ var Dt = { exports: {} };
|
|
|
2293
2292
|
};
|
|
2294
2293
|
};
|
|
2295
2294
|
});
|
|
2296
|
-
})(
|
|
2297
|
-
var
|
|
2298
|
-
const
|
|
2299
|
-
var
|
|
2295
|
+
})(_t);
|
|
2296
|
+
var ae = _t.exports;
|
|
2297
|
+
const he = /* @__PURE__ */ U(ae);
|
|
2298
|
+
var At = { exports: {} };
|
|
2300
2299
|
(function(f, t) {
|
|
2301
2300
|
(function(e, i) {
|
|
2302
2301
|
f.exports = i();
|
|
@@ -2307,10 +2306,10 @@ var _t = { exports: {} };
|
|
|
2307
2306
|
};
|
|
2308
2307
|
};
|
|
2309
2308
|
});
|
|
2310
|
-
})(
|
|
2311
|
-
var
|
|
2312
|
-
const
|
|
2313
|
-
var
|
|
2309
|
+
})(At);
|
|
2310
|
+
var le = At.exports;
|
|
2311
|
+
const ce = /* @__PURE__ */ U(le);
|
|
2312
|
+
var It = { exports: {} };
|
|
2314
2313
|
(function(f, t) {
|
|
2315
2314
|
(function(e, i) {
|
|
2316
2315
|
f.exports = i();
|
|
@@ -2385,10 +2384,10 @@ var At = { exports: {} };
|
|
|
2385
2384
|
};
|
|
2386
2385
|
};
|
|
2387
2386
|
});
|
|
2388
|
-
})(
|
|
2389
|
-
var
|
|
2390
|
-
const
|
|
2391
|
-
var
|
|
2387
|
+
})(It);
|
|
2388
|
+
var de = It.exports;
|
|
2389
|
+
const ue = /* @__PURE__ */ U(de);
|
|
2390
|
+
var Ht = { exports: {} };
|
|
2392
2391
|
(function(f, t) {
|
|
2393
2392
|
(function(e, i) {
|
|
2394
2393
|
f.exports = i();
|
|
@@ -2410,10 +2409,10 @@ var It = { exports: {} };
|
|
|
2410
2409
|
};
|
|
2411
2410
|
};
|
|
2412
2411
|
});
|
|
2413
|
-
})(
|
|
2414
|
-
var
|
|
2415
|
-
const
|
|
2416
|
-
var
|
|
2412
|
+
})(Ht);
|
|
2413
|
+
var ge = Ht.exports;
|
|
2414
|
+
const fe = /* @__PURE__ */ U(ge);
|
|
2415
|
+
var Rt = { exports: {} };
|
|
2417
2416
|
(function(f, t) {
|
|
2418
2417
|
(function(e, i) {
|
|
2419
2418
|
f.exports = i();
|
|
@@ -2425,10 +2424,10 @@ var Ht = { exports: {} };
|
|
|
2425
2424
|
};
|
|
2426
2425
|
};
|
|
2427
2426
|
});
|
|
2428
|
-
})(
|
|
2429
|
-
var
|
|
2430
|
-
const
|
|
2431
|
-
var
|
|
2427
|
+
})(Rt);
|
|
2428
|
+
var pe = Rt.exports;
|
|
2429
|
+
const me = /* @__PURE__ */ U(pe);
|
|
2430
|
+
var Gt = { exports: {} };
|
|
2432
2431
|
(function(f, t) {
|
|
2433
2432
|
(function(e, i) {
|
|
2434
2433
|
f.exports = i();
|
|
@@ -2475,10 +2474,10 @@ var Rt = { exports: {} };
|
|
|
2475
2474
|
};
|
|
2476
2475
|
};
|
|
2477
2476
|
});
|
|
2478
|
-
})(
|
|
2479
|
-
var
|
|
2480
|
-
const
|
|
2481
|
-
var
|
|
2477
|
+
})(Gt);
|
|
2478
|
+
var xe = Gt.exports;
|
|
2479
|
+
const ye = /* @__PURE__ */ U(xe);
|
|
2480
|
+
var Wt = { exports: {} };
|
|
2482
2481
|
(function(f, t) {
|
|
2483
2482
|
(function(e, i) {
|
|
2484
2483
|
f.exports = i();
|
|
@@ -2492,10 +2491,10 @@ var Gt = { exports: {} };
|
|
|
2492
2491
|
};
|
|
2493
2492
|
};
|
|
2494
2493
|
});
|
|
2495
|
-
})(
|
|
2496
|
-
var
|
|
2497
|
-
const
|
|
2498
|
-
var
|
|
2494
|
+
})(Wt);
|
|
2495
|
+
var we = Wt.exports;
|
|
2496
|
+
const be = /* @__PURE__ */ U(we);
|
|
2497
|
+
var $t = { exports: {} };
|
|
2499
2498
|
(function(f, t) {
|
|
2500
2499
|
(function(e, i) {
|
|
2501
2500
|
f.exports = i();
|
|
@@ -2521,10 +2520,10 @@ var Wt = { exports: {} };
|
|
|
2521
2520
|
};
|
|
2522
2521
|
};
|
|
2523
2522
|
});
|
|
2524
|
-
})(
|
|
2525
|
-
var
|
|
2526
|
-
const
|
|
2527
|
-
var
|
|
2523
|
+
})($t);
|
|
2524
|
+
var ve = $t.exports;
|
|
2525
|
+
const Te = /* @__PURE__ */ U(ve);
|
|
2526
|
+
var Ft = { exports: {} };
|
|
2528
2527
|
(function(f, t) {
|
|
2529
2528
|
(function(e, i) {
|
|
2530
2529
|
f.exports = i();
|
|
@@ -2584,10 +2583,10 @@ var $t = { exports: {} };
|
|
|
2584
2583
|
};
|
|
2585
2584
|
};
|
|
2586
2585
|
});
|
|
2587
|
-
})(
|
|
2588
|
-
var
|
|
2589
|
-
const
|
|
2590
|
-
var
|
|
2586
|
+
})(Ft);
|
|
2587
|
+
var Se = Ft.exports;
|
|
2588
|
+
const ke = /* @__PURE__ */ U(Se);
|
|
2589
|
+
var Bt = { exports: {} };
|
|
2591
2590
|
(function(f, t) {
|
|
2592
2591
|
(function(e, i) {
|
|
2593
2592
|
f.exports = i();
|
|
@@ -2660,10 +2659,10 @@ var Ft = { exports: {} };
|
|
|
2660
2659
|
};
|
|
2661
2660
|
};
|
|
2662
2661
|
});
|
|
2663
|
-
})(
|
|
2664
|
-
var
|
|
2665
|
-
const
|
|
2666
|
-
var
|
|
2662
|
+
})(Bt);
|
|
2663
|
+
var Ee = Bt.exports;
|
|
2664
|
+
const Ce = /* @__PURE__ */ U(Ee);
|
|
2665
|
+
var Me = { exports: {} };
|
|
2667
2666
|
(function(f, t) {
|
|
2668
2667
|
(function(e, i) {
|
|
2669
2668
|
f.exports = i();
|
|
@@ -2673,8 +2672,8 @@ var Ce = { exports: {} };
|
|
|
2673
2672
|
return "[" + e + (i[(s - 20) % 10] || i[s] || i[0]) + "]";
|
|
2674
2673
|
} };
|
|
2675
2674
|
});
|
|
2676
|
-
})(
|
|
2677
|
-
var
|
|
2675
|
+
})(Me);
|
|
2676
|
+
var Le = { exports: {} };
|
|
2678
2677
|
(function(f, t) {
|
|
2679
2678
|
(function(e, i) {
|
|
2680
2679
|
f.exports = i(R);
|
|
@@ -2690,8 +2689,8 @@ var Me = { exports: {} };
|
|
|
2690
2689
|
} };
|
|
2691
2690
|
return s.default.locale(n, null, !0), n;
|
|
2692
2691
|
});
|
|
2693
|
-
})(
|
|
2694
|
-
const
|
|
2692
|
+
})(Le);
|
|
2693
|
+
const Oe = (f, t) => {
|
|
2695
2694
|
const e = t.prototype;
|
|
2696
2695
|
e.setLocale = function(s) {
|
|
2697
2696
|
return this.$locale = s || R().locale(), this.$L = this.$locale, this;
|
|
@@ -2701,20 +2700,20 @@ const Le = (f, t) => {
|
|
|
2701
2700
|
return this.$L = R().locale(), i.bind(this)(s);
|
|
2702
2701
|
};
|
|
2703
2702
|
};
|
|
2704
|
-
R.extend(
|
|
2705
|
-
R.extend(
|
|
2706
|
-
R.extend(
|
|
2707
|
-
R.extend(
|
|
2708
|
-
R.extend(
|
|
2709
|
-
R.extend(
|
|
2710
|
-
R.extend(
|
|
2711
|
-
R.extend(
|
|
2712
|
-
R.extend(
|
|
2713
|
-
R.extend(
|
|
2714
|
-
R.extend(
|
|
2715
|
-
R.extend(
|
|
2716
|
-
R.extend(
|
|
2717
|
-
function
|
|
2703
|
+
R.extend(ne);
|
|
2704
|
+
R.extend(re);
|
|
2705
|
+
R.extend(he);
|
|
2706
|
+
R.extend(ce);
|
|
2707
|
+
R.extend(fe);
|
|
2708
|
+
R.extend(ue);
|
|
2709
|
+
R.extend(me);
|
|
2710
|
+
R.extend(ye);
|
|
2711
|
+
R.extend(be);
|
|
2712
|
+
R.extend(Te);
|
|
2713
|
+
R.extend(ke);
|
|
2714
|
+
R.extend(Ce);
|
|
2715
|
+
R.extend(Oe);
|
|
2716
|
+
function St(f) {
|
|
2718
2717
|
try {
|
|
2719
2718
|
if (R.locale() === f) return;
|
|
2720
2719
|
if (R.locale(f) !== f) throw Error();
|
|
@@ -2723,7 +2722,7 @@ function Tt(f) {
|
|
|
2723
2722
|
O.warn(`Failed to set locale ${f}, fallback to en`), R.locale("en");
|
|
2724
2723
|
}
|
|
2725
2724
|
}
|
|
2726
|
-
const
|
|
2725
|
+
const gt = () => ({
|
|
2727
2726
|
small: {
|
|
2728
2727
|
hour: 15,
|
|
2729
2728
|
day: 15,
|
|
@@ -2746,7 +2745,7 @@ const ut = () => ({
|
|
|
2746
2745
|
quarter: 14
|
|
2747
2746
|
}
|
|
2748
2747
|
});
|
|
2749
|
-
class
|
|
2748
|
+
class De {
|
|
2750
2749
|
constructor() {
|
|
2751
2750
|
h(this, "startTime", R().startOf("day"));
|
|
2752
2751
|
h(this, "endTime", R().endOf("day"));
|
|
@@ -2772,7 +2771,7 @@ class Oe {
|
|
|
2772
2771
|
h(this, "cellWidth");
|
|
2773
2772
|
/** 用户设定的单位 */
|
|
2774
2773
|
h(this, "unit", "day");
|
|
2775
|
-
this.cellWidth = J(
|
|
2774
|
+
this.cellWidth = J(gt().normal);
|
|
2776
2775
|
}
|
|
2777
2776
|
getStartTime() {
|
|
2778
2777
|
return this.startTime;
|
|
@@ -2830,15 +2829,15 @@ class Oe {
|
|
|
2830
2829
|
month: "month",
|
|
2831
2830
|
quarter: "quarter"
|
|
2832
2831
|
}[i];
|
|
2833
|
-
n || O.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime = R(s.startTime).startOf(this.getFinelyUnit()), this.strictStart = !0), s.endTime && (this.endTime = R(s.endTime).endOf(this.getFinelyUnit()), this.strictEnd = !0), s.cellWidth && (
|
|
2832
|
+
n || O.warn(`Unknown unit: [${i}]. Falling back to "day".`), this.unit = n || "day", s.startTime && (this.startTime = R(s.startTime).startOf(this.getFinelyUnit()), this.strictStart = !0), s.endTime && (this.endTime = R(s.endTime).endOf(this.getFinelyUnit()), this.strictEnd = !0), s.cellWidth && (Xt(s.cellWidth) ? this.cellWidth = {
|
|
2834
2833
|
hour: s.cellWidth,
|
|
2835
2834
|
day: s.cellWidth,
|
|
2836
2835
|
week: s.cellWidth,
|
|
2837
2836
|
month: s.cellWidth,
|
|
2838
2837
|
quarter: s.cellWidth
|
|
2839
2838
|
} : V(s.cellWidth) ? this.cellWidth = J(
|
|
2840
|
-
|
|
2841
|
-
) :
|
|
2839
|
+
gt()[s.cellWidth] || gt().normal
|
|
2840
|
+
) : Ct(s.cellWidth) && (this.cellWidth = Object.assign(this.cellWidth, s.cellWidth))), this.headerCellFormat = s.headerCellFormat, this.headerGroupFormat = s.headerGroupFormat;
|
|
2842
2841
|
}
|
|
2843
2842
|
update(t) {
|
|
2844
2843
|
this.init(t, !1), this.endTime = this.targetEnd.clone();
|
|
@@ -2971,7 +2970,7 @@ class Oe {
|
|
|
2971
2970
|
return t.isSameOrAfter(this.startTime) && t.isSameOrBefore(this.endTime);
|
|
2972
2971
|
}
|
|
2973
2972
|
}
|
|
2974
|
-
class
|
|
2973
|
+
class _e {
|
|
2975
2974
|
// 使用私有构造函数防止直接创建实例
|
|
2976
2975
|
constructor(t, e) {
|
|
2977
2976
|
// 声明成员属性类型
|
|
@@ -2982,10 +2981,10 @@ class De {
|
|
|
2982
2981
|
h(this, "timeAxis");
|
|
2983
2982
|
var n, o, r;
|
|
2984
2983
|
this.context = t;
|
|
2985
|
-
const i =
|
|
2984
|
+
const i = wt(e, ["data"]), s = e == null ? void 0 : e.data;
|
|
2986
2985
|
if (s && !X(s))
|
|
2987
2986
|
throw O.exception("Data should be a array.");
|
|
2988
|
-
this.optionManager = new
|
|
2987
|
+
this.optionManager = new jt(), this.optionManager.setOptions(i), i.locale && St(i.locale), this.timeAxis = new De(), this.timeAxis.init(this.optionManager.getOptions()), this.columnManager = new ie(this.context), i.table && i.table.columns && this.columnManager.init(i.table.columns), this.dataManager = new Jt(this, this.context.event), s && this.dataManager.setData(s, !0), (n = e == null ? void 0 : e.baselines) != null && n.data && this.dataManager.setBaselines(e.baselines.data), this.linkManager = new pt(this, this.context.event), X((o = e == null ? void 0 : e.links) == null ? void 0 : o.data) && this.linkManager.setLinks(e.links.data, !0), this.linkManager.setCycleDetection(((r = e == null ? void 0 : e.links) == null ? void 0 : r.enableCycleDetection) ?? !0);
|
|
2989
2988
|
}
|
|
2990
2989
|
getOptionManager() {
|
|
2991
2990
|
return this.optionManager;
|
|
@@ -3004,16 +3003,16 @@ class De {
|
|
|
3004
3003
|
}
|
|
3005
3004
|
setOption(t, e = { merge: !0 }) {
|
|
3006
3005
|
var n, o, r, a;
|
|
3007
|
-
const i =
|
|
3006
|
+
const i = wt(t, ["data"]), s = t == null ? void 0 : t.data;
|
|
3008
3007
|
this.optionManager.setOptions(i, e), ((n = i.milestone) == null ? void 0 : n.show) !== void 0 && this.dataManager.getVisibleTasks().forEach((c) => {
|
|
3009
3008
|
c.updateMode();
|
|
3010
|
-
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((a = t.links) == null ? void 0 : a.enableCycleDetection) ?? !0), i.locale &&
|
|
3009
|
+
}), X(s) && this.dataManager.setData(s, !1), X((o = t.baselines) == null ? void 0 : o.data) && this.dataManager.setBaselines(t.baselines.data), X((r = t.links) == null ? void 0 : r.data) && this.linkManager.setLinks(t.links.data, !0), this.linkManager.setCycleDetection(((a = t.links) == null ? void 0 : a.enableCycleDetection) ?? !0), i.locale && St(i.locale), i.table && i.table.columns && this.columnManager.update(i.table.columns), this.timeAxis.update(this.optionManager.getOptions());
|
|
3011
3010
|
}
|
|
3012
3011
|
updateTime(t, e) {
|
|
3013
3012
|
this.timeAxis.setDate(t, e);
|
|
3014
3013
|
}
|
|
3015
3014
|
}
|
|
3016
|
-
class
|
|
3015
|
+
class Ae {
|
|
3017
3016
|
constructor(t, e, i) {
|
|
3018
3017
|
h(this, "rootElement");
|
|
3019
3018
|
h(this, "options");
|
|
@@ -3102,7 +3101,7 @@ class _e {
|
|
|
3102
3101
|
const e = t - this.animationStartTime, i = this.options.animationDuration, s = Math.min(1, e / i), n = s * (2 - s), o = this.animationStartScrollLeft + (this.animationTargetScrollLeft - this.animationStartScrollLeft) * n, r = this.animationStartScrollTop + (this.animationTargetScrollTop - this.animationStartScrollTop) * n, a = this.scrollLeft !== o, c = this.scrollTop !== r;
|
|
3103
3102
|
(a || c) && this.emit(this.animationSource, o, r), s < 1 ? this.animationFrameId = requestAnimationFrame(this.animationStep) : (this.isAnimating = !1, this.animationFrameId = null, (this.scrollLeft !== this.animationTargetScrollLeft || this.scrollTop !== this.animationTargetScrollTop) && this.emit(this.animationSource, this.animationTargetScrollLeft, this.animationTargetScrollTop), this.scheduleHide());
|
|
3104
3103
|
});
|
|
3105
|
-
this.root = t, this.rootElement = e, this.options =
|
|
3104
|
+
this.root = t, this.rootElement = e, this.options = at(
|
|
3106
3105
|
{
|
|
3107
3106
|
showHorizontal: !0,
|
|
3108
3107
|
showVertical: !0,
|
|
@@ -3128,10 +3127,10 @@ class _e {
|
|
|
3128
3127
|
// 滚动条隐藏动画时长 (ms)
|
|
3129
3128
|
},
|
|
3130
3129
|
i
|
|
3131
|
-
), this.throttledHandleMouseMove =
|
|
3130
|
+
), this.throttledHandleMouseMove = bt(
|
|
3132
3131
|
this.handleMouseMove.bind(this),
|
|
3133
3132
|
16
|
|
3134
|
-
), this.throttledHandleWheel =
|
|
3133
|
+
), this.throttledHandleWheel = bt(this.handleWheel.bind(this), 16, {
|
|
3135
3134
|
leading: !0,
|
|
3136
3135
|
trailing: !1
|
|
3137
3136
|
}), this.createElements(), this.applyStyles(), this.bindEvents(), this.rootElement.matches(":hover") ? this.handleMouseEnter() : (this.clearTimeouts(), this.hideScrollbars(!0));
|
|
@@ -3392,7 +3391,7 @@ class _e {
|
|
|
3392
3391
|
*/
|
|
3393
3392
|
scrollTo(t, e = "api") {
|
|
3394
3393
|
this.scheduleShow();
|
|
3395
|
-
const i = this.clampScroll(
|
|
3394
|
+
const i = this.clampScroll(at(this.getScrollPosition(), t));
|
|
3396
3395
|
if (this.scrollLeft === i.x && this.scrollTop === i.y) {
|
|
3397
3396
|
if (this.isAnimating && this.animationTargetScrollLeft === i.x && this.animationTargetScrollTop === i.y)
|
|
3398
3397
|
return;
|
|
@@ -3445,7 +3444,7 @@ function Z(f, t = "") {
|
|
|
3445
3444
|
}
|
|
3446
3445
|
return t;
|
|
3447
3446
|
}
|
|
3448
|
-
class
|
|
3447
|
+
class Ie {
|
|
3449
3448
|
constructor(t, e, i) {
|
|
3450
3449
|
h(this, "element");
|
|
3451
3450
|
h(this, "isDragging", !1);
|
|
@@ -3588,7 +3587,7 @@ class Ae {
|
|
|
3588
3587
|
this.cleanup(), this.element.removeEventListener("mousedown", this.handleMouseDown), this.element.removeEventListener("selectstart", (t) => t.preventDefault()), this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element), O.debug("DragHandler destroyed");
|
|
3589
3588
|
}
|
|
3590
3589
|
}
|
|
3591
|
-
class
|
|
3590
|
+
class nt {
|
|
3592
3591
|
/**
|
|
3593
3592
|
* 创建表格单元格
|
|
3594
3593
|
* @param container 父容器(tr元素)
|
|
@@ -3639,11 +3638,11 @@ class st {
|
|
|
3639
3638
|
const e = this.context.getOptions().drag.enabled !== !1, i = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().drag.enabled, this.task), s = ["0.3", "0.3", "0.4"];
|
|
3640
3639
|
if (e || (s[0] = "0", s[1] = "0.5", s[2] = "0.5"), e) {
|
|
3641
3640
|
const n = document.createElement("div");
|
|
3642
|
-
n.style.flex = s[0], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", i && new
|
|
3641
|
+
n.style.flex = s[0], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", i && new Ie(this.context, n, this.task), t.appendChild(n);
|
|
3643
3642
|
}
|
|
3644
3643
|
if (this.context.getOptions().selection.enabled) {
|
|
3645
3644
|
const n = document.createElement("div");
|
|
3646
|
-
n.style.flex = s[1], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", new
|
|
3645
|
+
n.style.flex = s[1], n.style.display = "flex", n.style.justifyContent = "center", n.style.alignItems = "center", new Lt(this.context, n, this.task), t.appendChild(n);
|
|
3647
3646
|
}
|
|
3648
3647
|
if (this.context.getOptions().expand.show && this.task.children && this.task.children.length > 0) {
|
|
3649
3648
|
const n = document.createElement("div");
|
|
@@ -3680,7 +3679,7 @@ class st {
|
|
|
3680
3679
|
this.element.style.height = Z(t * Math.max(1, this.rowspan));
|
|
3681
3680
|
}
|
|
3682
3681
|
}
|
|
3683
|
-
class
|
|
3682
|
+
class kt {
|
|
3684
3683
|
/**
|
|
3685
3684
|
* 创建表格行
|
|
3686
3685
|
* @param context 上下文
|
|
@@ -3752,7 +3751,7 @@ class St {
|
|
|
3752
3751
|
this.clearCells();
|
|
3753
3752
|
const t = this.context.store.getColumnManager().getHandlerColumn();
|
|
3754
3753
|
if (t.width !== 0) {
|
|
3755
|
-
const n = new
|
|
3754
|
+
const n = new nt(
|
|
3756
3755
|
this.context,
|
|
3757
3756
|
this.element,
|
|
3758
3757
|
t,
|
|
@@ -3770,7 +3769,7 @@ class St {
|
|
|
3770
3769
|
const o = e[n], r = this.context.store.getColumnManager().getMergeInfo(this.task.id, n);
|
|
3771
3770
|
if (r) {
|
|
3772
3771
|
if (r.task.id !== this.task.id) {
|
|
3773
|
-
const a = new
|
|
3772
|
+
const a = new nt(
|
|
3774
3773
|
this.context,
|
|
3775
3774
|
this.element,
|
|
3776
3775
|
o,
|
|
@@ -3783,7 +3782,7 @@ class St {
|
|
|
3783
3782
|
);
|
|
3784
3783
|
this.element.style.backgroundColor = "transparent", this.raise(), this.cells.push(a);
|
|
3785
3784
|
} else if (r.originColumnIndex === n) {
|
|
3786
|
-
const a = new
|
|
3785
|
+
const a = new nt(
|
|
3787
3786
|
this.context,
|
|
3788
3787
|
this.element,
|
|
3789
3788
|
o,
|
|
@@ -3829,7 +3828,7 @@ class St {
|
|
|
3829
3828
|
for (let p = 0; p < a; p++)
|
|
3830
3829
|
this.context.store.getColumnManager().addMergeInfo(this.task.id, p + n, l);
|
|
3831
3830
|
}
|
|
3832
|
-
const d = new
|
|
3831
|
+
const d = new nt(
|
|
3833
3832
|
this.context,
|
|
3834
3833
|
this.element,
|
|
3835
3834
|
o,
|
|
@@ -3870,7 +3869,7 @@ class St {
|
|
|
3870
3869
|
this.clearCells(), this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
3871
3870
|
}
|
|
3872
3871
|
}
|
|
3873
|
-
class
|
|
3872
|
+
class He {
|
|
3874
3873
|
constructor(t, e) {
|
|
3875
3874
|
h(this, "element");
|
|
3876
3875
|
h(this, "rows", /* @__PURE__ */ new Map());
|
|
@@ -3895,7 +3894,7 @@ class Ie {
|
|
|
3895
3894
|
const a = this.rows.get(r);
|
|
3896
3895
|
a.update(n), a.updateTop(t);
|
|
3897
3896
|
} else {
|
|
3898
|
-
const a = new
|
|
3897
|
+
const a = new kt(this.context, this.element, n, t);
|
|
3899
3898
|
a.create(), this.rows.set(r, a);
|
|
3900
3899
|
}
|
|
3901
3900
|
this.context.store.getColumnManager().getLeafColumns().forEach((a, c) => {
|
|
@@ -3903,7 +3902,7 @@ class Ie {
|
|
|
3903
3902
|
if (u && u.rowspan > 1) {
|
|
3904
3903
|
const d = u.task.id;
|
|
3905
3904
|
if (!this.rows.has(d) && !this.mergeRows.has(d)) {
|
|
3906
|
-
const l = new
|
|
3905
|
+
const l = new kt(
|
|
3907
3906
|
this.context,
|
|
3908
3907
|
this.element,
|
|
3909
3908
|
u.task,
|
|
@@ -3947,7 +3946,7 @@ class Ie {
|
|
|
3947
3946
|
});
|
|
3948
3947
|
}
|
|
3949
3948
|
}
|
|
3950
|
-
class
|
|
3949
|
+
class mt {
|
|
3951
3950
|
constructor(t, e, i, s) {
|
|
3952
3951
|
h(this, "columnElement");
|
|
3953
3952
|
this.context = t, this.root = e, this.container = i, this.column = s, this.columnElement = document.createElement("div"), this.initElement(), this.container.appendChild(this.columnElement);
|
|
@@ -4005,7 +4004,7 @@ class pt {
|
|
|
4005
4004
|
t.addEventListener("mousedown", o);
|
|
4006
4005
|
}
|
|
4007
4006
|
}
|
|
4008
|
-
class
|
|
4007
|
+
class yt {
|
|
4009
4008
|
constructor(t, e, i, s) {
|
|
4010
4009
|
h(this, "groupElement");
|
|
4011
4010
|
h(this, "titleContainer");
|
|
@@ -4030,7 +4029,7 @@ class xt {
|
|
|
4030
4029
|
initChildren() {
|
|
4031
4030
|
this.column.children.forEach((t) => {
|
|
4032
4031
|
if (t.isLeaf) {
|
|
4033
|
-
const e = new
|
|
4032
|
+
const e = new mt(
|
|
4034
4033
|
this.context,
|
|
4035
4034
|
this.root,
|
|
4036
4035
|
this.childContainer,
|
|
@@ -4038,7 +4037,7 @@ class xt {
|
|
|
4038
4037
|
);
|
|
4039
4038
|
this.children.push(e);
|
|
4040
4039
|
} else if (t.children.length > 0) {
|
|
4041
|
-
const e = new
|
|
4040
|
+
const e = new yt(
|
|
4042
4041
|
this.context,
|
|
4043
4042
|
this.root,
|
|
4044
4043
|
this.childContainer,
|
|
@@ -4049,7 +4048,7 @@ class xt {
|
|
|
4049
4048
|
});
|
|
4050
4049
|
}
|
|
4051
4050
|
}
|
|
4052
|
-
class
|
|
4051
|
+
class Re {
|
|
4053
4052
|
constructor(t, e) {
|
|
4054
4053
|
h(this, "headerElement");
|
|
4055
4054
|
h(this, "headerColumns", []);
|
|
@@ -4080,7 +4079,7 @@ class He {
|
|
|
4080
4079
|
this.headerColumns = [], this.headerElement.innerHTML = "", this.initElement();
|
|
4081
4080
|
const t = this.context.store.getColumnManager(), e = t.getColumns();
|
|
4082
4081
|
if (t.getHandlerColumn().width !== 0) {
|
|
4083
|
-
const i = new
|
|
4082
|
+
const i = new mt(
|
|
4084
4083
|
this.context,
|
|
4085
4084
|
this.headerElement,
|
|
4086
4085
|
this.headerElement,
|
|
@@ -4090,7 +4089,7 @@ class He {
|
|
|
4090
4089
|
}
|
|
4091
4090
|
e.forEach((i) => {
|
|
4092
4091
|
if (i.isLeaf) {
|
|
4093
|
-
const s = new
|
|
4092
|
+
const s = new mt(
|
|
4094
4093
|
this.context,
|
|
4095
4094
|
this.headerElement,
|
|
4096
4095
|
this.headerElement,
|
|
@@ -4098,7 +4097,7 @@ class He {
|
|
|
4098
4097
|
);
|
|
4099
4098
|
this.headerColumns.push(s);
|
|
4100
4099
|
} else if (i.children.length > 0) {
|
|
4101
|
-
const s = new
|
|
4100
|
+
const s = new yt(
|
|
4102
4101
|
this.context,
|
|
4103
4102
|
this.headerElement,
|
|
4104
4103
|
this.headerElement,
|
|
@@ -4109,12 +4108,12 @@ class He {
|
|
|
4109
4108
|
});
|
|
4110
4109
|
}
|
|
4111
4110
|
}
|
|
4112
|
-
class
|
|
4111
|
+
class Ge {
|
|
4113
4112
|
constructor(t, e) {
|
|
4114
4113
|
h(this, "tableContainer");
|
|
4115
4114
|
h(this, "tableHeader");
|
|
4116
4115
|
h(this, "tableBody");
|
|
4117
|
-
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
|
|
4116
|
+
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 Re(t, this.tableContainer), this.tableBody = new He(t, this.tableContainer), this.listenEvents();
|
|
4118
4117
|
}
|
|
4119
4118
|
render(t, e) {
|
|
4120
4119
|
this.tableHeader.render(), this.refresh(t, e);
|
|
@@ -4136,7 +4135,7 @@ class Re {
|
|
|
4136
4135
|
});
|
|
4137
4136
|
}
|
|
4138
4137
|
}
|
|
4139
|
-
class
|
|
4138
|
+
class We {
|
|
4140
4139
|
constructor(t, e) {
|
|
4141
4140
|
h(this, "background");
|
|
4142
4141
|
// 表头背景
|
|
@@ -4352,7 +4351,7 @@ class Ge {
|
|
|
4352
4351
|
}).play()));
|
|
4353
4352
|
}
|
|
4354
4353
|
}
|
|
4355
|
-
class
|
|
4354
|
+
class $e {
|
|
4356
4355
|
constructor(t, e) {
|
|
4357
4356
|
// 网格线组
|
|
4358
4357
|
h(this, "verticalLines");
|
|
@@ -4433,8 +4432,8 @@ class We {
|
|
|
4433
4432
|
this.verticalLines.destroyChildren(), this.horizontalLines.destroyChildren();
|
|
4434
4433
|
}
|
|
4435
4434
|
}
|
|
4436
|
-
const
|
|
4437
|
-
class
|
|
4435
|
+
const Et = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><path fill="currentColor" fill-rule="evenodd" d="M5.5 4.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m4 0a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25M10.625 7.5a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 8.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m5.125 2.875a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 12.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25" clip-rule="evenodd"/></svg>';
|
|
4436
|
+
class Fe {
|
|
4438
4437
|
constructor(t, e, i, s, n) {
|
|
4439
4438
|
h(this, "offsetX", 0);
|
|
4440
4439
|
h(this, "offsetY", 0);
|
|
@@ -4470,8 +4469,8 @@ class $e {
|
|
|
4470
4469
|
id: `chart-slider-bar-${s.id}`
|
|
4471
4470
|
}), this.render(), this.bindEvents(), this.registerEvents();
|
|
4472
4471
|
}
|
|
4473
|
-
update(t, e) {
|
|
4474
|
-
this.x = t, this.y = e, this.sliderGroup.position({ x: t, y: e }), this.render();
|
|
4472
|
+
update(t, e, i) {
|
|
4473
|
+
this.task = i, this.x = t, this.y = e, this.sliderGroup.position({ x: t, y: e }), this.render();
|
|
4475
4474
|
}
|
|
4476
4475
|
setOffset(t, e) {
|
|
4477
4476
|
this.offsetX = t, this.offsetY = e;
|
|
@@ -4492,10 +4491,10 @@ class $e {
|
|
|
4492
4491
|
O.error("The endTime of the current task is earlier than the startTime.", this.task);
|
|
4493
4492
|
return;
|
|
4494
4493
|
}
|
|
4495
|
-
const t = this.context.getOptions().row.height, e =
|
|
4494
|
+
const t = this.context.getOptions().row.height, e = ot(
|
|
4496
4495
|
this.unpackFunc(this.context.getOptions().bar.height),
|
|
4497
4496
|
t
|
|
4498
|
-
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, r = this.unpackFunc(this.context.getOptions().bar.backgroundColor) || this.context.getOptions().primaryColor, a =
|
|
4497
|
+
), i = (t - e) / 2, s = this.context.store.getTimeAxis().getTimeLeft(this.task.startTime), o = this.context.store.getTimeAxis().getTimeLeft(this.task.endTime) - s, r = this.unpackFunc(this.context.getOptions().bar.backgroundColor) || this.context.getOptions().primaryColor, a = rt(
|
|
4499
4498
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4500
4499
|
), c = this.unpackFunc(this.context.getOptions().bar.shadowColor) || "rgba(0, 0, 0, 0.2)", u = this.unpackFunc(this.context.getOptions().bar.shadowBlur) || 0, d = this.unpackFunc(this.context.getOptions().bar.shadowOffsetX) || 0, l = this.unpackFunc(this.context.getOptions().bar.shadowOffsetY) || 0;
|
|
4501
4500
|
this.slider || (this.slider = new k.Group({
|
|
@@ -4589,21 +4588,21 @@ class $e {
|
|
|
4589
4588
|
});
|
|
4590
4589
|
}
|
|
4591
4590
|
if (this.slider.add(this.sliderBar), this.unpackFunc(this.context.getOptions().milestone.label.show)) {
|
|
4592
|
-
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),
|
|
4591
|
+
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), Pt = this.unpackFunc(this.context.getOptions().milestone.label.fontFamily), Nt = this.unpackFunc(this.context.getOptions().milestone.label.color), it = new k.Text({
|
|
4593
4592
|
height: e,
|
|
4594
4593
|
text: F,
|
|
4595
|
-
fill:
|
|
4594
|
+
fill: Nt || H,
|
|
4596
4595
|
fontSize: q,
|
|
4597
|
-
fontFamily:
|
|
4598
|
-
}),
|
|
4599
|
-
it.width(
|
|
4596
|
+
fontFamily: Pt
|
|
4597
|
+
}), ht = it.measureSize(F);
|
|
4598
|
+
it.width(ht.width);
|
|
4600
4599
|
const K = { x: 0, y: 0 };
|
|
4601
4600
|
switch (z) {
|
|
4602
4601
|
case "top-left":
|
|
4603
|
-
K.x = -(12 +
|
|
4602
|
+
K.x = -(12 + ht.width), K.y = -8;
|
|
4604
4603
|
break;
|
|
4605
4604
|
case "bottom-left":
|
|
4606
|
-
K.x = -(12 +
|
|
4605
|
+
K.x = -(12 + ht.width), K.y = 10;
|
|
4607
4606
|
break;
|
|
4608
4607
|
case "bottom-right":
|
|
4609
4608
|
K.x = 12, K.y = 10;
|
|
@@ -4669,7 +4668,7 @@ class $e {
|
|
|
4669
4668
|
x: 0,
|
|
4670
4669
|
y: 0
|
|
4671
4670
|
});
|
|
4672
|
-
this.leftHandleGroup.add(G), _ !== null &&
|
|
4671
|
+
this.leftHandleGroup.add(G), _ !== null && vt(_ || Et, this.handlerWidth, e).then((F) => {
|
|
4673
4672
|
var q;
|
|
4674
4673
|
const z = new k.Image({
|
|
4675
4674
|
image: F,
|
|
@@ -4712,7 +4711,7 @@ class $e {
|
|
|
4712
4711
|
x: 0,
|
|
4713
4712
|
y: 0
|
|
4714
4713
|
});
|
|
4715
|
-
this.rightHandleGroup.add(G), _ !== null &&
|
|
4714
|
+
this.rightHandleGroup.add(G), _ !== null && vt(_ || Et, this.handlerWidth, e).then((F) => {
|
|
4716
4715
|
var q;
|
|
4717
4716
|
const z = new k.Image({
|
|
4718
4717
|
image: F,
|
|
@@ -4784,16 +4783,16 @@ class $e {
|
|
|
4784
4783
|
return;
|
|
4785
4784
|
}
|
|
4786
4785
|
if (this.task.progress) {
|
|
4787
|
-
const g =
|
|
4786
|
+
const g = Qt(
|
|
4788
4787
|
this.task.progress,
|
|
4789
4788
|
((s = this.context.getOptions().bar.progress) == null ? void 0 : s.targetVal) ?? 100
|
|
4790
4789
|
);
|
|
4791
4790
|
if (g === 0) return;
|
|
4792
4791
|
const y = this.unpackFunc(
|
|
4793
4792
|
this.context.getOptions().bar.backgroundColor
|
|
4794
|
-
) || this.context.getOptions().primaryColor, x = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || B(y).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), v =
|
|
4793
|
+
) || this.context.getOptions().primaryColor, x = this.unpackFunc((n = this.context.getOptions().bar.progress) == null ? void 0 : n.backgroundColor) || B(y).brighten(((o = this.context.getOptions().bar.progress) == null ? void 0 : o.amount) || 30).toHex(), v = rt(
|
|
4795
4794
|
this.unpackFunc(this.context.getOptions().bar.radius)
|
|
4796
|
-
), b =
|
|
4795
|
+
), b = rt(
|
|
4797
4796
|
this.unpackFunc((r = this.context.getOptions().bar.progress) == null ? void 0 : r.radius),
|
|
4798
4797
|
2
|
|
4799
4798
|
// 默认 2
|
|
@@ -4817,7 +4816,7 @@ class $e {
|
|
|
4817
4816
|
opacity: this.unpackFunc((a = this.context.getOptions().bar.progress) == null ? void 0 : a.opacity)
|
|
4818
4817
|
});
|
|
4819
4818
|
this.progressGroup.add(C);
|
|
4820
|
-
const M = `${
|
|
4819
|
+
const M = `${ft(
|
|
4821
4820
|
g * 100,
|
|
4822
4821
|
(c = this.context.getOptions().bar.progress) == null ? void 0 : c.decimal
|
|
4823
4822
|
)}%`, E = new k.Text().measureSize(M).width, T = this.unpackFunc((u = this.context.getOptions().bar.progress) == null ? void 0 : u.textAlign), L = new k.Text({
|
|
@@ -4865,13 +4864,13 @@ class $e {
|
|
|
4865
4864
|
const e = t.target.getStage();
|
|
4866
4865
|
if (!e) return;
|
|
4867
4866
|
this.isDragging = !0, this.oldTasks = [], this.context.event.emit(S.SLIDER_DRAGGING, !0), e.container().style.cursor = "grabbing";
|
|
4868
|
-
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n =
|
|
4867
|
+
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = dt(i, s);
|
|
4869
4868
|
this.dragDiffX = n - i, this.handleMove(t, e);
|
|
4870
4869
|
}
|
|
4871
4870
|
handleDragMove(t) {
|
|
4872
4871
|
if (!this.isDragging) return;
|
|
4873
4872
|
if (t.evt.movementX > 0 ? this.draggingDirection !== "right" && (this.draggingDirection = "right", this.stopAutoScroll(), this.stopAutoExpand()) : t.evt.movementX < 0 && this.draggingDirection !== "left" && (this.draggingDirection = "left", this.stopAutoScroll(), this.stopAutoExpand()), !!this.context.getOptions().bar.move.byUnit) {
|
|
4874
|
-
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n =
|
|
4873
|
+
const i = t.target.x(), s = this.context.store.getTimeAxis().getCellWidth(), n = dt(i, s);
|
|
4875
4874
|
t.target.x(n - this.dragDiffX);
|
|
4876
4875
|
}
|
|
4877
4876
|
}
|
|
@@ -4988,7 +4987,7 @@ class $e {
|
|
|
4988
4987
|
x.movementX > 0 ? this.draggingDirection = "right" : x.movementX < 0 && (this.draggingDirection = "left");
|
|
4989
4988
|
const v = Math.max(((w = i.getPointerPosition()) == null ? void 0 : w.x) || 0, 0);
|
|
4990
4989
|
let b = v - s;
|
|
4991
|
-
n && (b =
|
|
4990
|
+
n && (b = dt(b, o)), (d === void 0 || d !== b) && (e === "left" ? m - b - c >= o && v < a - this.EDGE_THRESHOLD && (this.slider.width(m - b - c), this.slider.x(l + b + c), this.emitUpdate("left")) : m + b + u >= o && v > this.EDGE_THRESHOLD && (this.slider.width(m + b + u), this.emitUpdate("right")), d = b);
|
|
4992
4991
|
}, g = () => {
|
|
4993
4992
|
this.handleDragEnd(t), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
4994
4993
|
};
|
|
@@ -5071,7 +5070,7 @@ class $e {
|
|
|
5071
5070
|
n.start();
|
|
5072
5071
|
}
|
|
5073
5072
|
}
|
|
5074
|
-
class
|
|
5073
|
+
class Be {
|
|
5075
5074
|
constructor(t, e, i, s, n, o, r) {
|
|
5076
5075
|
h(this, "row");
|
|
5077
5076
|
h(this, "slider");
|
|
@@ -5085,10 +5084,10 @@ class Fe {
|
|
|
5085
5084
|
id: i,
|
|
5086
5085
|
listening: !1
|
|
5087
5086
|
});
|
|
5088
|
-
this.row.add(a), this.slider = new
|
|
5087
|
+
this.row.add(a), this.slider = new Fe(this.context, 0, n, this.task, this.width), this.row.add(this.slider.sliderGroup);
|
|
5089
5088
|
}
|
|
5090
|
-
update(t, e) {
|
|
5091
|
-
this.slider.update(t, e);
|
|
5089
|
+
update(t, e, i) {
|
|
5090
|
+
this.slider.update(t, e, i);
|
|
5092
5091
|
}
|
|
5093
5092
|
setOffset(t, e) {
|
|
5094
5093
|
this.slider.setOffset(t, e);
|
|
@@ -5097,7 +5096,7 @@ class Fe {
|
|
|
5097
5096
|
this.row.destroy();
|
|
5098
5097
|
}
|
|
5099
5098
|
}
|
|
5100
|
-
class
|
|
5099
|
+
class ze {
|
|
5101
5100
|
constructor(t, e, i, s) {
|
|
5102
5101
|
h(this, "tasks", []);
|
|
5103
5102
|
// 当前渲染的任务列表
|
|
@@ -5143,7 +5142,7 @@ class Be {
|
|
|
5143
5142
|
const o = `chart-row-${s.id}`;
|
|
5144
5143
|
let r = this.rowsCache.get(o);
|
|
5145
5144
|
const c = s.flatIndex * e + this.context.getOptions().header.height;
|
|
5146
|
-
r ? (r.update(0, c), r.setOffset(this.offsetX, this.offsetY)) : (r = new
|
|
5145
|
+
r ? (r.update(0, c, s), r.setOffset(this.offsetX, this.offsetY)) : (r = new Be(
|
|
5147
5146
|
this.context,
|
|
5148
5147
|
s,
|
|
5149
5148
|
o,
|
|
@@ -5174,7 +5173,8 @@ class Be {
|
|
|
5174
5173
|
const e = this.rowsCache.get(`chart-row-${t.id}`);
|
|
5175
5174
|
e && e.update(
|
|
5176
5175
|
0,
|
|
5177
|
-
t.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height
|
|
5176
|
+
t.flatIndex * this.context.getOptions().row.height + this.context.getOptions().header.height,
|
|
5177
|
+
t
|
|
5178
5178
|
);
|
|
5179
5179
|
}
|
|
5180
5180
|
/**
|
|
@@ -5371,7 +5371,7 @@ class Be {
|
|
|
5371
5371
|
this.rowsCache.clear(), this.rowsGroup.destroy(), this.rowBgGroup.destroy();
|
|
5372
5372
|
}
|
|
5373
5373
|
}
|
|
5374
|
-
class
|
|
5374
|
+
class zt {
|
|
5375
5375
|
constructor() {
|
|
5376
5376
|
}
|
|
5377
5377
|
static async createPattern(t) {
|
|
@@ -5512,7 +5512,7 @@ class Bt {
|
|
|
5512
5512
|
return d.src = a.toDataURL(), a.destroy(), d;
|
|
5513
5513
|
}
|
|
5514
5514
|
}
|
|
5515
|
-
class
|
|
5515
|
+
class Pe {
|
|
5516
5516
|
constructor(t, e) {
|
|
5517
5517
|
// 状态变量
|
|
5518
5518
|
h(this, "width", 0);
|
|
@@ -5573,7 +5573,7 @@ class ze {
|
|
|
5573
5573
|
}
|
|
5574
5574
|
if (m > u)
|
|
5575
5575
|
break;
|
|
5576
|
-
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await
|
|
5576
|
+
!this.patternImage && this.context.getOptions().weekend.pattern && (this.patternImage = await zt.createPattern(
|
|
5577
5577
|
this.context.getOptions().weekend
|
|
5578
5578
|
));
|
|
5579
5579
|
const x = new k.Rect({
|
|
@@ -5600,7 +5600,7 @@ class ze {
|
|
|
5600
5600
|
this.layer.batchDraw();
|
|
5601
5601
|
}
|
|
5602
5602
|
}
|
|
5603
|
-
class
|
|
5603
|
+
class Ne {
|
|
5604
5604
|
constructor(t, e, i) {
|
|
5605
5605
|
h(this, "arrowAnimation");
|
|
5606
5606
|
h(this, "todayLine");
|
|
@@ -5716,7 +5716,7 @@ class Pe {
|
|
|
5716
5716
|
(t = this.todayLine) == null || t.destroy(), (e = this.triangle) == null || e.destroy(), (i = this.todayTextGroup) == null || i.destroy(), (s = this.arrowAnimation) == null || s.stop(), this.arrowAnimation = void 0;
|
|
5717
5717
|
}
|
|
5718
5718
|
}
|
|
5719
|
-
class
|
|
5719
|
+
class Ye {
|
|
5720
5720
|
constructor(t, e) {
|
|
5721
5721
|
// 状态变量
|
|
5722
5722
|
h(this, "width", 0);
|
|
@@ -5782,7 +5782,7 @@ class Ne {
|
|
|
5782
5782
|
break;
|
|
5783
5783
|
!this.patternImage.has(w) && (w.pattern || this.context.getOptions().holiday.pattern) && this.patternImage.set(
|
|
5784
5784
|
w,
|
|
5785
|
-
await
|
|
5785
|
+
await zt.createPattern({
|
|
5786
5786
|
backgroundColor: this.context.getOptions().primaryColor,
|
|
5787
5787
|
...w,
|
|
5788
5788
|
...this.context.getOptions().holiday
|
|
@@ -5834,7 +5834,7 @@ class Ne {
|
|
|
5834
5834
|
this.layer.batchDraw();
|
|
5835
5835
|
}
|
|
5836
5836
|
}
|
|
5837
|
-
class
|
|
5837
|
+
class Ue {
|
|
5838
5838
|
constructor(t, e) {
|
|
5839
5839
|
// 状态变量
|
|
5840
5840
|
h(this, "width", 0);
|
|
@@ -5962,7 +5962,7 @@ class Ye {
|
|
|
5962
5962
|
}), this.layer.batchDraw();
|
|
5963
5963
|
}
|
|
5964
5964
|
}
|
|
5965
|
-
class
|
|
5965
|
+
class Xe {
|
|
5966
5966
|
constructor(t, e, i) {
|
|
5967
5967
|
h(this, "tasks", []);
|
|
5968
5968
|
// 创建点组
|
|
@@ -6057,7 +6057,7 @@ class Ue {
|
|
|
6057
6057
|
l.isMilestone() && (g += i / 2);
|
|
6058
6058
|
const y = s + i * l.flatIndex;
|
|
6059
6059
|
let x = !0, v = !0, b = this.context.store.getOptionManager().unpackFunc(this.context.getOptions().links.create.from, l);
|
|
6060
|
-
if (
|
|
6060
|
+
if (lt(b) ? x = v = b : V(b) && (x = b === "S", v = b === "F"), x) {
|
|
6061
6061
|
const w = new k.Circle({
|
|
6062
6062
|
id: `point-${l.id}-left`,
|
|
6063
6063
|
x: m - g,
|
|
@@ -6517,7 +6517,7 @@ class Ue {
|
|
|
6517
6517
|
j(r) && (r = r(
|
|
6518
6518
|
t.getEmitData(),
|
|
6519
6519
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6520
|
-
)),
|
|
6520
|
+
)), lt(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6521
6521
|
const a = this.validateChain(t.id, e, i, s);
|
|
6522
6522
|
return {
|
|
6523
6523
|
allowLeft: n && a.ok,
|
|
@@ -6533,7 +6533,7 @@ class Ue {
|
|
|
6533
6533
|
j(r) && (r = r(
|
|
6534
6534
|
t.getEmitData(),
|
|
6535
6535
|
this.context.store.getDataManager().getTaskById(e).getEmitData()
|
|
6536
|
-
)),
|
|
6536
|
+
)), lt(r) ? n = o = r : V(r) && (n = r === "S", o = r === "F");
|
|
6537
6537
|
const a = this.validateChain(e, t.id, i, s);
|
|
6538
6538
|
return {
|
|
6539
6539
|
allowLeft: n && a.ok,
|
|
@@ -6600,7 +6600,7 @@ class Ue {
|
|
|
6600
6600
|
});
|
|
6601
6601
|
}
|
|
6602
6602
|
}
|
|
6603
|
-
class
|
|
6603
|
+
class Ve {
|
|
6604
6604
|
constructor(t, e, i) {
|
|
6605
6605
|
h(this, "tasks", []);
|
|
6606
6606
|
h(this, "chartBaselineGroup");
|
|
@@ -6653,12 +6653,12 @@ class Xe {
|
|
|
6653
6653
|
*/
|
|
6654
6654
|
calculateBaselines() {
|
|
6655
6655
|
if (this.baselineGroup.destroyChildren(), this.indicatorGroup.destroyChildren(), !this.context.getOptions().baselines.show) return;
|
|
6656
|
-
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s =
|
|
6656
|
+
const t = this.context.getOptions().header.height, e = this.context.getOptions().row.height, i = e / 2 + t, s = rt(
|
|
6657
6657
|
this.context.getOptions().baselines.radius
|
|
6658
6658
|
), n = this.context.getOptions().baselines.opacity, o = this.context.getOptions().baselines.backgroundColor;
|
|
6659
6659
|
this.tasks.forEach((r) => {
|
|
6660
6660
|
if (this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.show, r)) {
|
|
6661
|
-
const a = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c =
|
|
6661
|
+
const a = this.context.store.getDataManager().getBaselinesByTaskId(r.id), c = ot(
|
|
6662
6662
|
this.context.getOptions().baselines.height || this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, r),
|
|
6663
6663
|
e
|
|
6664
6664
|
), u = this.context.getOptions().baselines.offset ?? 0;
|
|
@@ -6688,7 +6688,7 @@ class Xe {
|
|
|
6688
6688
|
});
|
|
6689
6689
|
t.add(g), this.renderText(t, e, i, s, n, p, a);
|
|
6690
6690
|
} else if (this.context.getOptions().baselines.mode === "line") {
|
|
6691
|
-
const p =
|
|
6691
|
+
const p = ot(this.context.getOptions().baselines.height ?? 5, r);
|
|
6692
6692
|
let g = c + r * e.flatIndex + m;
|
|
6693
6693
|
const y = this.context.getOptions().baselines.position;
|
|
6694
6694
|
let x = "";
|
|
@@ -6757,7 +6757,7 @@ class Xe {
|
|
|
6757
6757
|
renderCompareIndicator(t, e, i) {
|
|
6758
6758
|
const s = this.context.getOptions().baselines, n = s.compare.indicator;
|
|
6759
6759
|
if (!n || !n.show) return;
|
|
6760
|
-
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, a =
|
|
6760
|
+
const o = this.context.getOptions().header.height, r = this.context.getOptions().row.height, a = ot(
|
|
6761
6761
|
this.context.store.getOptionManager().unpackFunc(this.context.getOptions().bar.height, t),
|
|
6762
6762
|
r
|
|
6763
6763
|
);
|
|
@@ -6775,7 +6775,7 @@ class Xe {
|
|
|
6775
6775
|
radius: n.size / 2
|
|
6776
6776
|
});
|
|
6777
6777
|
this.indicatorGroup.add(p);
|
|
6778
|
-
let g = `${
|
|
6778
|
+
let g = `${ft(i.startDiff)}${i.unit} ${m}`;
|
|
6779
6779
|
const y = s.compare.indicator[m].text;
|
|
6780
6780
|
j(y) ? g = y(i.startDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (g = y);
|
|
6781
6781
|
const x = new k.Text({
|
|
@@ -6799,7 +6799,7 @@ class Xe {
|
|
|
6799
6799
|
radius: n.size / 2
|
|
6800
6800
|
});
|
|
6801
6801
|
this.indicatorGroup.add(p);
|
|
6802
|
-
let g = `${
|
|
6802
|
+
let g = `${ft(i.endDiff)}${i.unit} ${m}`;
|
|
6803
6803
|
const y = s.compare.indicator[m].text;
|
|
6804
6804
|
j(y) ? g = y(i.endDiff, { ...t.getEmitData(), baseline: e }) : V(y) && (g = y);
|
|
6805
6805
|
const x = new k.Text({
|
|
@@ -6826,7 +6826,7 @@ class Xe {
|
|
|
6826
6826
|
});
|
|
6827
6827
|
}
|
|
6828
6828
|
}
|
|
6829
|
-
class
|
|
6829
|
+
class Ke {
|
|
6830
6830
|
constructor(t, e) {
|
|
6831
6831
|
// Konva 元素
|
|
6832
6832
|
h(this, "stage");
|
|
@@ -6848,7 +6848,7 @@ class Ve {
|
|
|
6848
6848
|
container: this.container,
|
|
6849
6849
|
width: this.container.clientWidth,
|
|
6850
6850
|
height: this.container.clientHeight
|
|
6851
|
-
}), this.bgLayer = new k.Layer(), this.weekendGroup = new
|
|
6851
|
+
}), this.bgLayer = new k.Layer(), this.weekendGroup = new Pe(this.context, this.bgLayer), this.holidayGroup = new Ye(this.context, this.bgLayer), this.flagGroup = new Ue(this.context, this.bgLayer), this.gridGroup = new $e(this.context, this.bgLayer), this.stage.add(this.bgLayer), this.axisLayer = new k.Layer(), this.headerLayer = new We(this.context, this.axisLayer), this.todayLayer = new Ne(this.context, this.bgLayer, this.axisLayer), this.stage.add(this.axisLayer), this.bodyLayer = new k.Layer(), this.linkGroup = new Xe(this.context, this.stage, this.bodyLayer), this.baselineGroup = new Ve(this.context, this.stage, this.bodyLayer), this.bodyGroup = new ze(this.context, this.stage, this.bodyLayer, this.bgLayer), this.stage.add(this.bodyLayer);
|
|
6852
6852
|
}
|
|
6853
6853
|
/**
|
|
6854
6854
|
* 调整大小
|
|
@@ -6875,8 +6875,8 @@ class Ve {
|
|
|
6875
6875
|
this.headerLayer.destroy(), this.gridGroup.destroy(), this.bodyLayer.destroy(), this.todayLayer.destroy(), this.holidayGroup.destroy(), this.flagGroup.destroy(), this.weekendGroup.destroy(), this.linkGroup.destroy(), this.baselineGroup.destroy(), this.axisLayer.destroy(), this.bgLayer.destroy(), this.stage.destroy();
|
|
6876
6876
|
}
|
|
6877
6877
|
}
|
|
6878
|
-
const
|
|
6879
|
-
class
|
|
6878
|
+
const je = '<svg style="transition: all 0.3s" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>';
|
|
6879
|
+
class qe {
|
|
6880
6880
|
constructor(t, e) {
|
|
6881
6881
|
h(this, "line");
|
|
6882
6882
|
h(this, "initialX", 0);
|
|
@@ -6886,7 +6886,7 @@ class je {
|
|
|
6886
6886
|
"border-left-color",
|
|
6887
6887
|
this.root.store.getOptionManager().getOptions().border.color,
|
|
6888
6888
|
"important"
|
|
6889
|
-
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML =
|
|
6889
|
+
), this.line.style.cursor = "col-resize", this.collapseButton = document.createElement("div"), this.collapseButton.className = "x-gantt-collapse-button", this.collapseButton.style.position = "absolute", this.collapseButton.style.top = "50%", this.collapseButton.style.left = "0", this.collapseButton.style.transform = "translateY(-50%)", this.collapseButton.style.cursor = "pointer", this.collapseButton.style.width = "16px", this.collapseButton.style.height = "30px", this.collapseButton.style.backgroundColor = "#fff", this.collapseButton.style.borderRadius = "0 6px 6px 0", this.collapseButton.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.2)", this.collapseButton.style.display = "flex", this.collapseButton.style.alignItems = "center", this.collapseButton.style.justifyContent = "center", this.collapseButton.innerHTML = je, this.collapseButton.addEventListener("click", (i) => {
|
|
6890
6890
|
i.stopPropagation(), this.root.store.getColumnManager().collapse();
|
|
6891
6891
|
}), this.line.appendChild(this.collapseButton), this.container.appendChild(this.line), this.addDragEvents();
|
|
6892
6892
|
}
|
|
@@ -6920,7 +6920,7 @@ class je {
|
|
|
6920
6920
|
this.line.addEventListener("mousedown", n);
|
|
6921
6921
|
}
|
|
6922
6922
|
}
|
|
6923
|
-
class
|
|
6923
|
+
class Qe {
|
|
6924
6924
|
/**
|
|
6925
6925
|
* @param container 指示线的容器元素
|
|
6926
6926
|
*/
|
|
@@ -6995,7 +6995,7 @@ class qe {
|
|
|
6995
6995
|
return this.element.offsetLeft;
|
|
6996
6996
|
}
|
|
6997
6997
|
}
|
|
6998
|
-
class
|
|
6998
|
+
class Ze {
|
|
6999
6999
|
constructor(t = 16) {
|
|
7000
7000
|
h(this, "taskQueue", /* @__PURE__ */ new Map());
|
|
7001
7001
|
// 使用 Map 避免同类型重复任务
|
|
@@ -7005,7 +7005,7 @@ class Qe {
|
|
|
7005
7005
|
h(this, "delay");
|
|
7006
7006
|
// 使用 debounce 来延迟执行,避免短时间内多次触发
|
|
7007
7007
|
h(this, "debouncedFlush");
|
|
7008
|
-
this.delay = t, this.debouncedFlush =
|
|
7008
|
+
this.delay = t, this.debouncedFlush = Vt(() => {
|
|
7009
7009
|
this.flushTaskQueue();
|
|
7010
7010
|
}, t);
|
|
7011
7011
|
}
|
|
@@ -7136,7 +7136,7 @@ class Qe {
|
|
|
7136
7136
|
this.cancelScheduled(), this.taskHandlers.clear(), O.debug("RenderScheduler: 已销毁");
|
|
7137
7137
|
}
|
|
7138
7138
|
}
|
|
7139
|
-
class
|
|
7139
|
+
class Je {
|
|
7140
7140
|
constructor(t, e) {
|
|
7141
7141
|
h(this, "scrollbar");
|
|
7142
7142
|
h(this, "rootElement");
|
|
@@ -7206,12 +7206,12 @@ class Ze {
|
|
|
7206
7206
|
this.table.updateWidth(), this.updateSize();
|
|
7207
7207
|
});
|
|
7208
7208
|
var i;
|
|
7209
|
-
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
|
|
7209
|
+
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 Qe(this.context, this.container), this.middleLine = new qe(this.context, this.rootElement), this.chartContainer = document.createElement("div"), this.chartContainer.className = "x-gantt-chart", this.rootElement.appendChild(this.chartContainer), this.table = new Ge(this.context, this.tableContainer), this.chart = new Ke(this.context, this.chartContainer), this.scrollbar = new Ae(
|
|
7210
7210
|
this.context,
|
|
7211
7211
|
this.rootElement,
|
|
7212
7212
|
this.context.store.getOptionManager().getOptions().scrollbar || {}
|
|
7213
7213
|
// 传入配置项
|
|
7214
|
-
), this.renderScheduler = new
|
|
7214
|
+
), this.renderScheduler = new Ze(16), this.setupTaskHandlers(), this.updateSize(), this.setupEventListeners(), (i = this.context.store.getOptionManager().getOptions().resize) != null && i.enabled && (typeof window.ResizeObserver > "u" ? O.warn(
|
|
7215
7215
|
"Current environment does not support ResizeObserver, please include a polyfill to enable auto-resize feature."
|
|
7216
7216
|
) : (this.resizeObserver = new ResizeObserver(() => {
|
|
7217
7217
|
this.updateSize(), this.renderScheduler.scheduleTask("VIEW_UPDATE", [!1]);
|
|
@@ -7305,13 +7305,13 @@ class Ze {
|
|
|
7305
7305
|
O.debug("Renderer destroy"), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.renderScheduler.destroy(), this.scrollbar.destroy(), this.context.event.offAll();
|
|
7306
7306
|
}
|
|
7307
7307
|
}
|
|
7308
|
-
class
|
|
7308
|
+
class ti {
|
|
7309
7309
|
constructor(t, e, i) {
|
|
7310
7310
|
h(this, "_id", Q());
|
|
7311
7311
|
h(this, "store");
|
|
7312
|
-
h(this, "event", new
|
|
7312
|
+
h(this, "event", new qt());
|
|
7313
7313
|
h(this, "renderer");
|
|
7314
|
-
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new
|
|
7314
|
+
this.container = t, this.events = e, this.container.innerHTML = "", this.store = new _e(this, i), this.renderer = new Je(this, this.container), this.render(), this.registerEvents(), O.debug(
|
|
7315
7315
|
"----Gantt initialized for element:",
|
|
7316
7316
|
this._id,
|
|
7317
7317
|
this.container
|
|
@@ -7459,7 +7459,7 @@ class Je {
|
|
|
7459
7459
|
});
|
|
7460
7460
|
}
|
|
7461
7461
|
}
|
|
7462
|
-
class
|
|
7462
|
+
class oi {
|
|
7463
7463
|
constructor(t, e) {
|
|
7464
7464
|
h(this, "context");
|
|
7465
7465
|
// 管理对外事件
|
|
@@ -7477,7 +7477,7 @@ class ni {
|
|
|
7477
7477
|
const i = typeof t == "string" ? document.querySelector(t) : t;
|
|
7478
7478
|
if (!i)
|
|
7479
7479
|
throw O.exception(`Container ${t} not found or invalid.`);
|
|
7480
|
-
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new
|
|
7480
|
+
i.innerHTML = "", i.classList.add("x-gantt-container"), this.context = new ti(i, this.events, e);
|
|
7481
7481
|
}
|
|
7482
7482
|
// *** Public API Methods ***/
|
|
7483
7483
|
/**
|
|
@@ -7819,12 +7819,12 @@ class ni {
|
|
|
7819
7819
|
return this.context.store.getDataManager().deleteTaskById(t);
|
|
7820
7820
|
}
|
|
7821
7821
|
}
|
|
7822
|
-
|
|
7823
|
-
const
|
|
7822
|
+
Kt();
|
|
7823
|
+
const ri = Mt;
|
|
7824
7824
|
export {
|
|
7825
|
-
|
|
7825
|
+
oi as XGantt,
|
|
7826
7826
|
B as colorjs,
|
|
7827
|
-
|
|
7827
|
+
li as dayjs,
|
|
7828
7828
|
Q as generateId,
|
|
7829
|
-
|
|
7829
|
+
ri as version
|
|
7830
7830
|
};
|