@taskctrl/canvas-timeline 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as re, jsxs as Ve, Fragment as li } from "react/jsx-runtime";
|
|
2
|
-
import ce, { useRef as A, useMemo as
|
|
3
|
-
import { flushSync as
|
|
4
|
-
import
|
|
2
|
+
import ce, { useRef as A, useMemo as Q, useCallback as te, useEffect as ae, forwardRef as _i, useState as Ue, useImperativeHandle as Wi } from "react";
|
|
3
|
+
import { flushSync as Bi } from "react-dom";
|
|
4
|
+
import ve from "dayjs";
|
|
5
5
|
const Ee = {
|
|
6
6
|
primary: "#269bf7",
|
|
7
7
|
trainColors: {},
|
|
@@ -143,7 +143,7 @@ class wt {
|
|
|
143
143
|
return this.groupYOffsets[this.groupCount] ?? 0;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
class
|
|
146
|
+
class xi {
|
|
147
147
|
constructor() {
|
|
148
148
|
Object.defineProperty(this, "root", {
|
|
149
149
|
enumerable: !0,
|
|
@@ -251,28 +251,28 @@ class zi {
|
|
|
251
251
|
}
|
|
252
252
|
computeHierarchyLayout(e, i, n, r, u) {
|
|
253
253
|
const o = [], c = [];
|
|
254
|
-
for (const
|
|
255
|
-
i.isParent(
|
|
256
|
-
o.sort((
|
|
257
|
-
const
|
|
258
|
-
return
|
|
254
|
+
for (const m of e)
|
|
255
|
+
i.isParent(m.id) ? c.push(m) : o.push(m);
|
|
256
|
+
o.sort((m, f) => {
|
|
257
|
+
const T = m.start_time - f.start_time;
|
|
258
|
+
return T !== 0 ? T : f.end_time - f.start_time - (m.end_time - m.start_time);
|
|
259
259
|
});
|
|
260
260
|
const s = [];
|
|
261
|
-
let
|
|
262
|
-
for (const
|
|
261
|
+
let h = 0;
|
|
262
|
+
for (const m of o) {
|
|
263
263
|
let f = -1;
|
|
264
|
-
for (let
|
|
265
|
-
if (s[
|
|
266
|
-
f =
|
|
264
|
+
for (let T = 0; T < s.length; T++)
|
|
265
|
+
if (s[T] <= m.start_time) {
|
|
266
|
+
f = T;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
|
-
f === -1 ? (f = s.length, s.push(
|
|
269
|
+
f === -1 ? (f = s.length, s.push(m.end_time)) : s[f] = m.end_time, f > h && (h = f), this.layoutCache.set(m.id, { stackLevel: f, itemHeight: n });
|
|
270
270
|
}
|
|
271
|
-
c.sort((
|
|
272
|
-
let
|
|
273
|
-
for (const
|
|
274
|
-
this.layoutCache.set(
|
|
275
|
-
this.groupMaxStack.set(u,
|
|
271
|
+
c.sort((m, f) => i.getNestingDepth(f.id) - i.getNestingDepth(m.id));
|
|
272
|
+
let S = o.length > 0 ? h + 1 : 0;
|
|
273
|
+
for (const m of c)
|
|
274
|
+
this.layoutCache.set(m.id, { stackLevel: S, itemHeight: r }), S > h && (h = S), S++;
|
|
275
|
+
this.groupMaxStack.set(u, h);
|
|
276
276
|
}
|
|
277
277
|
getLayout(e) {
|
|
278
278
|
return this.layoutCache.get(e);
|
|
@@ -405,60 +405,60 @@ class Li {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
const { x: o, y: c, width: s, height:
|
|
410
|
-
t.globalAlpha = 0.15, t.fillStyle =
|
|
411
|
-
const
|
|
412
|
-
t.fillStyle =
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
408
|
+
function Ai(t, e, i, n, r, u) {
|
|
409
|
+
const { x: o, y: c, width: s, height: h } = i, S = u.primary;
|
|
410
|
+
t.globalAlpha = 0.15, t.fillStyle = S, t.fillRect(o, c, s, h), t.globalAlpha = 1, t.strokeStyle = S, t.lineWidth = 1.5, t.strokeRect(o, c, s, h);
|
|
411
|
+
const m = Math.min(h * 0.5, 6), f = c + h / 2;
|
|
412
|
+
t.fillStyle = S, t.beginPath(), t.moveTo(o, f), t.lineTo(o + m, f - m), t.lineTo(o + m * 2, f), t.lineTo(o + m, f + m), t.closePath(), t.fill(), t.beginPath(), t.moveTo(o + s, f), t.lineTo(o + s - m, f - m), t.lineTo(o + s - m * 2, f), t.lineTo(o + s - m, f + m), t.closePath(), t.fill();
|
|
413
|
+
const T = e.title;
|
|
414
|
+
if (T && s > 30) {
|
|
415
415
|
t.fillStyle = u.item.text, t.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', t.textBaseline = "middle";
|
|
416
|
-
const y = t.measureText(
|
|
417
|
-
if (
|
|
418
|
-
const
|
|
419
|
-
t.fillText(
|
|
416
|
+
const y = t.measureText(T).width, g = s - m * 4 - 4;
|
|
417
|
+
if (g > 20) {
|
|
418
|
+
const H = y > g ? T.slice(0, Math.floor(T.length * g / y)) + "..." : T;
|
|
419
|
+
t.fillText(H, o + s / 2 - Math.min(y, g) / 2, f);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
n.selected && (t.strokeStyle = u.item.selectedRing, t.lineWidth = 2, t.strokeRect(o - 1, c - 1, s + 2,
|
|
422
|
+
n.selected && (t.strokeStyle = u.item.selectedRing, t.lineWidth = 2, t.strokeRect(o - 1, c - 1, s + 2, h + 2));
|
|
423
423
|
}
|
|
424
424
|
function Ze(t, e, i, n, r, u) {
|
|
425
425
|
const o = i.xToTime(t), c = /* @__PURE__ */ new Map();
|
|
426
|
-
for (let
|
|
427
|
-
c.set(u[
|
|
426
|
+
for (let m = 0; m < u.length; m++)
|
|
427
|
+
c.set(u[m].id, m);
|
|
428
428
|
const s = n.query(o, o);
|
|
429
|
-
let
|
|
430
|
-
for (const
|
|
431
|
-
const f = c.get(
|
|
429
|
+
let h = null, S = -1 / 0;
|
|
430
|
+
for (const m of s) {
|
|
431
|
+
const f = c.get(m.group);
|
|
432
432
|
if (f === void 0)
|
|
433
433
|
continue;
|
|
434
|
-
const
|
|
435
|
-
if (!
|
|
434
|
+
const T = r.getLayout(m.id);
|
|
435
|
+
if (!T)
|
|
436
436
|
continue;
|
|
437
|
-
const y = i.timeToX(
|
|
438
|
-
if (t < y || t > y +
|
|
437
|
+
const y = i.timeToX(m.start_time), g = i.timeToX(m.end_time) - y;
|
|
438
|
+
if (t < y || t > y + g)
|
|
439
439
|
continue;
|
|
440
|
-
const
|
|
441
|
-
e <
|
|
440
|
+
const Y = i.groupIndexToY(f) + T.stackLevel * i.lineHeight + (i.lineHeight - T.itemHeight) / 2, $ = T.itemHeight;
|
|
441
|
+
e < Y || e > Y + $ || Y > S && (S = Y, h = m);
|
|
442
442
|
}
|
|
443
|
-
return
|
|
443
|
+
return h;
|
|
444
444
|
}
|
|
445
445
|
function kt(t, e, i) {
|
|
446
446
|
const n = e.yToGroupIndex(t);
|
|
447
447
|
return i[n] ?? null;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function Qt(t, e, i, n = 6) {
|
|
450
450
|
const r = i.timeToX(e.start_time), u = i.timeToX(e.end_time);
|
|
451
451
|
return t - r <= n ? "left" : u - t <= n ? "right" : "body";
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Ni(t, e) {
|
|
454
454
|
return t.canResize ?? e;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function ji(t, e) {
|
|
457
457
|
return t.canMove ?? e;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
460
|
-
const r =
|
|
461
|
-
return e === "left" && (r === "left" || r === "both") ? "resize-left" : e === "right" && (r === "right" || r === "both") ? "resize-right" : t.canResize === !1 && e !== "body" ? null :
|
|
459
|
+
function Jt(t, e, i, n) {
|
|
460
|
+
const r = Ni(t, i);
|
|
461
|
+
return e === "left" && (r === "left" || r === "both") ? "resize-left" : e === "right" && (r === "right" || r === "both") ? "resize-right" : t.canResize === !1 && e !== "body" ? null : ji(t, n) ? "move" : null;
|
|
462
462
|
}
|
|
463
463
|
function Ct(t, e, i) {
|
|
464
464
|
const n = window.devicePixelRatio || 1, r = Math.round(e * n), u = Math.round(i * n);
|
|
@@ -470,7 +470,7 @@ function Et(t, e) {
|
|
|
470
470
|
const i = window.devicePixelRatio || 1;
|
|
471
471
|
t.clearRect(0, 0, e.width / i, e.height / i);
|
|
472
472
|
}
|
|
473
|
-
class
|
|
473
|
+
class Gi {
|
|
474
474
|
constructor(e) {
|
|
475
475
|
Object.defineProperty(this, "dirty", {
|
|
476
476
|
enumerable: !0,
|
|
@@ -506,63 +506,63 @@ class ji {
|
|
|
506
506
|
}));
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
var
|
|
510
|
-
function
|
|
509
|
+
var Qe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
510
|
+
function Je(t) {
|
|
511
511
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
512
512
|
}
|
|
513
513
|
var ui = { exports: {} };
|
|
514
514
|
(function(t, e) {
|
|
515
515
|
(function(i, n) {
|
|
516
516
|
t.exports = n();
|
|
517
|
-
})(
|
|
517
|
+
})(Qe, function() {
|
|
518
518
|
var i = "minute", n = /[+-]\d\d(?::?\d\d)?/g, r = /([+-]|\d\d)/g;
|
|
519
519
|
return function(u, o, c) {
|
|
520
520
|
var s = o.prototype;
|
|
521
|
-
c.utc = function(
|
|
522
|
-
var
|
|
523
|
-
return new o(
|
|
524
|
-
}, s.utc = function(
|
|
525
|
-
var
|
|
526
|
-
return
|
|
521
|
+
c.utc = function(g) {
|
|
522
|
+
var H = { date: g, utc: !0, args: arguments };
|
|
523
|
+
return new o(H);
|
|
524
|
+
}, s.utc = function(g) {
|
|
525
|
+
var H = c(this.toDate(), { locale: this.$L, utc: !0 });
|
|
526
|
+
return g ? H.add(this.utcOffset(), i) : H;
|
|
527
527
|
}, s.local = function() {
|
|
528
528
|
return c(this.toDate(), { locale: this.$L, utc: !1 });
|
|
529
529
|
};
|
|
530
|
-
var
|
|
531
|
-
s.parse = function(
|
|
532
|
-
|
|
530
|
+
var h = s.parse;
|
|
531
|
+
s.parse = function(g) {
|
|
532
|
+
g.utc && (this.$u = !0), this.$utils().u(g.$offset) || (this.$offset = g.$offset), h.call(this, g);
|
|
533
533
|
};
|
|
534
|
-
var
|
|
534
|
+
var S = s.init;
|
|
535
535
|
s.init = function() {
|
|
536
536
|
if (this.$u) {
|
|
537
|
-
var
|
|
538
|
-
this.$y =
|
|
539
|
-
} else
|
|
537
|
+
var g = this.$d;
|
|
538
|
+
this.$y = g.getUTCFullYear(), this.$M = g.getUTCMonth(), this.$D = g.getUTCDate(), this.$W = g.getUTCDay(), this.$H = g.getUTCHours(), this.$m = g.getUTCMinutes(), this.$s = g.getUTCSeconds(), this.$ms = g.getUTCMilliseconds();
|
|
539
|
+
} else S.call(this);
|
|
540
540
|
};
|
|
541
|
-
var
|
|
542
|
-
s.utcOffset = function(
|
|
543
|
-
var
|
|
544
|
-
if (
|
|
545
|
-
if (typeof
|
|
546
|
-
|
|
547
|
-
var X =
|
|
541
|
+
var m = s.utcOffset;
|
|
542
|
+
s.utcOffset = function(g, H) {
|
|
543
|
+
var Y = this.$utils().u;
|
|
544
|
+
if (Y(g)) return this.$u ? 0 : Y(this.$offset) ? m.call(this) : this.$offset;
|
|
545
|
+
if (typeof g == "string" && (g = function(k) {
|
|
546
|
+
k === void 0 && (k = "");
|
|
547
|
+
var X = k.match(n);
|
|
548
548
|
if (!X) return null;
|
|
549
549
|
var B = ("" + X[0]).match(r) || ["-", 0, 0], I = B[0], x = 60 * +B[1] + +B[2];
|
|
550
550
|
return x === 0 ? 0 : I === "+" ? x : -x;
|
|
551
|
-
}(
|
|
552
|
-
var
|
|
553
|
-
if (
|
|
554
|
-
var
|
|
555
|
-
if (
|
|
556
|
-
var
|
|
557
|
-
return (
|
|
551
|
+
}(g), g === null)) return this;
|
|
552
|
+
var $ = Math.abs(g) <= 16 ? 60 * g : g;
|
|
553
|
+
if ($ === 0) return this.utc(H);
|
|
554
|
+
var w = this.clone();
|
|
555
|
+
if (H) return w.$offset = $, w.$u = !1, w;
|
|
556
|
+
var E = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
557
|
+
return (w = this.local().add($ + E, i)).$offset = $, w.$x.$localOffset = E, w;
|
|
558
558
|
};
|
|
559
559
|
var f = s.format;
|
|
560
|
-
s.format = function(
|
|
561
|
-
var
|
|
562
|
-
return f.call(this,
|
|
560
|
+
s.format = function(g) {
|
|
561
|
+
var H = g || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
562
|
+
return f.call(this, H);
|
|
563
563
|
}, s.valueOf = function() {
|
|
564
|
-
var
|
|
565
|
-
return this.$d.valueOf() - 6e4 *
|
|
564
|
+
var g = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
565
|
+
return this.$d.valueOf() - 6e4 * g;
|
|
566
566
|
}, s.isUTC = function() {
|
|
567
567
|
return !!this.$u;
|
|
568
568
|
}, s.toISOString = function() {
|
|
@@ -570,74 +570,74 @@ var ui = { exports: {} };
|
|
|
570
570
|
}, s.toString = function() {
|
|
571
571
|
return this.toDate().toUTCString();
|
|
572
572
|
};
|
|
573
|
-
var
|
|
574
|
-
s.toDate = function(
|
|
575
|
-
return
|
|
573
|
+
var T = s.toDate;
|
|
574
|
+
s.toDate = function(g) {
|
|
575
|
+
return g === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : T.call(this);
|
|
576
576
|
};
|
|
577
577
|
var y = s.diff;
|
|
578
|
-
s.diff = function(
|
|
579
|
-
if (
|
|
580
|
-
var
|
|
581
|
-
return y.call(
|
|
578
|
+
s.diff = function(g, H, Y) {
|
|
579
|
+
if (g && this.$u === g.$u) return y.call(this, g, H, Y);
|
|
580
|
+
var $ = this.local(), w = c(g).local();
|
|
581
|
+
return y.call($, w, H, Y);
|
|
582
582
|
};
|
|
583
583
|
};
|
|
584
584
|
});
|
|
585
585
|
})(ui);
|
|
586
|
-
var
|
|
587
|
-
const
|
|
586
|
+
var Ui = ui.exports;
|
|
587
|
+
const Zi = /* @__PURE__ */ Je(Ui);
|
|
588
588
|
var ci = { exports: {} };
|
|
589
589
|
(function(t, e) {
|
|
590
590
|
(function(i, n) {
|
|
591
591
|
t.exports = n();
|
|
592
|
-
})(
|
|
592
|
+
})(Qe, function() {
|
|
593
593
|
var i = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
|
|
594
594
|
return function(r, u, o) {
|
|
595
|
-
var c, s = function(f,
|
|
595
|
+
var c, s = function(f, T, y) {
|
|
596
596
|
y === void 0 && (y = {});
|
|
597
|
-
var
|
|
598
|
-
|
|
599
|
-
var
|
|
600
|
-
return
|
|
601
|
-
}(
|
|
602
|
-
return
|
|
603
|
-
},
|
|
604
|
-
for (var y = s(f,
|
|
605
|
-
var
|
|
606
|
-
|
|
597
|
+
var g = new Date(f), H = function(Y, $) {
|
|
598
|
+
$ === void 0 && ($ = {});
|
|
599
|
+
var w = $.timeZoneName || "short", E = Y + "|" + w, k = n[E];
|
|
600
|
+
return k || (k = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: Y, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: w }), n[E] = k), k;
|
|
601
|
+
}(T, y);
|
|
602
|
+
return H.formatToParts(g);
|
|
603
|
+
}, h = function(f, T) {
|
|
604
|
+
for (var y = s(f, T), g = [], H = 0; H < y.length; H += 1) {
|
|
605
|
+
var Y = y[H], $ = Y.type, w = Y.value, E = i[$];
|
|
606
|
+
E >= 0 && (g[E] = parseInt(w, 10));
|
|
607
607
|
}
|
|
608
|
-
var
|
|
608
|
+
var k = g[3], X = k === 24 ? 0 : k, B = g[0] + "-" + g[1] + "-" + g[2] + " " + X + ":" + g[4] + ":" + g[5] + ":000", I = +f;
|
|
609
609
|
return (o.utc(B).valueOf() - (I -= I % 1e3)) / 6e4;
|
|
610
|
-
},
|
|
611
|
-
|
|
610
|
+
}, S = u.prototype;
|
|
611
|
+
S.tz = function(f, T) {
|
|
612
612
|
f === void 0 && (f = c);
|
|
613
|
-
var y,
|
|
614
|
-
if (!Number(
|
|
615
|
-
else if (y = o(
|
|
616
|
-
var
|
|
617
|
-
y = y.add(
|
|
613
|
+
var y, g = this.utcOffset(), H = this.toDate(), Y = H.toLocaleString("en-US", { timeZone: f }), $ = Math.round((H - new Date(Y)) / 1e3 / 60), w = 15 * -Math.round(H.getTimezoneOffset() / 15) - $;
|
|
614
|
+
if (!Number(w)) y = this.utcOffset(0, T);
|
|
615
|
+
else if (y = o(Y, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(w, !0), T) {
|
|
616
|
+
var E = y.utcOffset();
|
|
617
|
+
y = y.add(g - E, "minute");
|
|
618
618
|
}
|
|
619
619
|
return y.$x.$timezone = f, y;
|
|
620
|
-
},
|
|
621
|
-
var
|
|
622
|
-
return
|
|
620
|
+
}, S.offsetName = function(f) {
|
|
621
|
+
var T = this.$x.$timezone || o.tz.guess(), y = s(this.valueOf(), T, { timeZoneName: f }).find(function(g) {
|
|
622
|
+
return g.type.toLowerCase() === "timezonename";
|
|
623
623
|
});
|
|
624
624
|
return y && y.value;
|
|
625
625
|
};
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
if (!this.$x || !this.$x.$timezone) return
|
|
626
|
+
var m = S.startOf;
|
|
627
|
+
S.startOf = function(f, T) {
|
|
628
|
+
if (!this.$x || !this.$x.$timezone) return m.call(this, f, T);
|
|
629
629
|
var y = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
630
|
-
return
|
|
631
|
-
}, o.tz = function(f,
|
|
632
|
-
var
|
|
633
|
-
if (typeof f != "string") return o(f).tz(
|
|
634
|
-
var
|
|
635
|
-
var x = X - 60 * B * 1e3,
|
|
636
|
-
if (B ===
|
|
637
|
-
var ie =
|
|
638
|
-
return
|
|
639
|
-
}(o.utc(f,
|
|
640
|
-
return
|
|
630
|
+
return m.call(y, f, T).tz(this.$x.$timezone, !0);
|
|
631
|
+
}, o.tz = function(f, T, y) {
|
|
632
|
+
var g = y && T, H = y || T || c, Y = h(+o(), H);
|
|
633
|
+
if (typeof f != "string") return o(f).tz(H);
|
|
634
|
+
var $ = function(X, B, I) {
|
|
635
|
+
var x = X - 60 * B * 1e3, _ = h(x, I);
|
|
636
|
+
if (B === _) return [x, B];
|
|
637
|
+
var ie = h(x -= 60 * (_ - B) * 1e3, I);
|
|
638
|
+
return _ === ie ? [x, _] : [X - 60 * Math.min(_, ie) * 1e3, Math.max(_, ie)];
|
|
639
|
+
}(o.utc(f, g).valueOf(), Y, H), w = $[0], E = $[1], k = o(w).utcOffset(E);
|
|
640
|
+
return k.$x.$timezone = H, k;
|
|
641
641
|
}, o.tz.guess = function() {
|
|
642
642
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
643
643
|
}, o.tz.setDefault = function(f) {
|
|
@@ -646,71 +646,71 @@ var ci = { exports: {} };
|
|
|
646
646
|
};
|
|
647
647
|
});
|
|
648
648
|
})(ci);
|
|
649
|
-
var
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
649
|
+
var Vi = ci.exports;
|
|
650
|
+
const qi = /* @__PURE__ */ Je(Vi);
|
|
651
|
+
ve.extend(Zi);
|
|
652
|
+
ve.extend(qi);
|
|
653
653
|
function he(t, e) {
|
|
654
|
-
return e ?
|
|
654
|
+
return e ? ve(t).tz(e) : ve(t);
|
|
655
655
|
}
|
|
656
|
-
class
|
|
656
|
+
class Ki {
|
|
657
657
|
draw(e, i, n, r, u, o, c, s) {
|
|
658
|
-
const { firstVisible:
|
|
659
|
-
for (let
|
|
660
|
-
const
|
|
658
|
+
const { firstVisible: h, lastVisible: S } = i.getVisibleGroupRange();
|
|
659
|
+
for (let w = h; w <= S; w++) {
|
|
660
|
+
const E = i.groupIndexToY(w), k = i.groupIndexToHeight(w), X = n[w];
|
|
661
661
|
if (!X)
|
|
662
662
|
continue;
|
|
663
663
|
let B;
|
|
664
664
|
const I = o == null ? void 0 : o(X);
|
|
665
|
-
I != null && I.backgroundColor ? B = I.backgroundColor : B =
|
|
665
|
+
I != null && I.backgroundColor ? B = I.backgroundColor : B = w % 2 === 0 ? "#FFFFFF" : r.grid.rowAlt, e.fillStyle = B, e.fillRect(0, E, i.canvasWidth, k), e.strokeStyle = (I == null ? void 0 : I.borderBottomColor) ?? r.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, E + k), e.lineTo(i.canvasWidth, E + k), e.stroke();
|
|
666
666
|
}
|
|
667
667
|
if (c && c.length > 0)
|
|
668
|
-
for (const
|
|
669
|
-
const
|
|
670
|
-
if (
|
|
668
|
+
for (const w of c) {
|
|
669
|
+
const E = i.timeToX(w.start), k = i.timeToX(w.end);
|
|
670
|
+
if (k < 0 || E > i.canvasWidth)
|
|
671
671
|
continue;
|
|
672
|
-
const X = Math.max(0,
|
|
673
|
-
e.fillStyle = `rgb(${Math.round(x * I + 255 * (1 - I))},${Math.round(
|
|
672
|
+
const X = Math.max(0, E), B = Math.min(i.canvasWidth, k) - X, I = w.opacity ?? 0.12, x = parseInt(w.color.slice(1, 3), 16), _ = parseInt(w.color.slice(3, 5), 16), ie = parseInt(w.color.slice(5, 7), 16);
|
|
673
|
+
e.fillStyle = `rgb(${Math.round(x * I + 255 * (1 - I))},${Math.round(_ * I + 255 * (1 - I))},${Math.round(ie * I + 255 * (1 - I))})`, e.fillRect(X, 0, B, i.canvasHeight);
|
|
674
674
|
}
|
|
675
|
-
const
|
|
676
|
-
let
|
|
677
|
-
|
|
675
|
+
const m = i.visibleTimeStart, f = i.visibleTimeEnd, g = 864e5 / (f - m) * i.canvasWidth;
|
|
676
|
+
let H = "day";
|
|
677
|
+
g < 2 ? H = "month" : g < 8 && (H = "week");
|
|
678
678
|
{
|
|
679
|
-
let
|
|
680
|
-
const
|
|
681
|
-
let
|
|
682
|
-
const I = [], x = (
|
|
683
|
-
|
|
679
|
+
let w = he(m, s).startOf("day");
|
|
680
|
+
const E = he(f, s).endOf("day");
|
|
681
|
+
let k = null, X = 1, B = 0;
|
|
682
|
+
const I = [], x = (_) => {
|
|
683
|
+
k !== null && (e.fillStyle = k, X !== 1 && (e.globalAlpha = X), e.fillRect(B, 0, _ - B, i.canvasHeight), X !== 1 && (e.globalAlpha = 1), k = null, X = 1);
|
|
684
684
|
};
|
|
685
|
-
for (;
|
|
686
|
-
const
|
|
687
|
-
let
|
|
685
|
+
for (; w.isBefore(E); ) {
|
|
686
|
+
const _ = i.timeToX(w.valueOf()), ie = w.toDate(), U = u == null ? void 0 : u(ie);
|
|
687
|
+
let J = null, me = 1;
|
|
688
688
|
if (U != null && U.backgroundColor)
|
|
689
|
-
|
|
689
|
+
J = U.backgroundColor, me = U.opacity ?? 1;
|
|
690
690
|
else {
|
|
691
|
-
const
|
|
692
|
-
(
|
|
691
|
+
const be = w.day();
|
|
692
|
+
(be === 0 || be === 6) && (J = r.grid.weekend);
|
|
693
693
|
}
|
|
694
|
-
U != null && U.borderColor && I.push({ x:
|
|
694
|
+
U != null && U.borderColor && I.push({ x: _, color: U.borderColor }), J === k && me === X || (x(_), J !== null && (k = J, X = me, B = _)), w = w.add(1, "day");
|
|
695
695
|
}
|
|
696
|
-
|
|
697
|
-
for (const
|
|
698
|
-
e.strokeStyle =
|
|
696
|
+
k !== null && x(i.timeToX(w.valueOf()));
|
|
697
|
+
for (const _ of I)
|
|
698
|
+
e.strokeStyle = _.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(_.x, 0), e.lineTo(_.x, i.canvasHeight), e.stroke();
|
|
699
699
|
}
|
|
700
|
-
let
|
|
701
|
-
const
|
|
702
|
-
for (e.strokeStyle = r.grid.line, e.lineWidth = 0.5, e.beginPath();
|
|
703
|
-
const
|
|
704
|
-
e.moveTo(
|
|
700
|
+
let Y = he(m, s).startOf(H);
|
|
701
|
+
const $ = he(f, s).add(1, H);
|
|
702
|
+
for (e.strokeStyle = r.grid.line, e.lineWidth = 0.5, e.beginPath(); Y.isBefore($); ) {
|
|
703
|
+
const w = i.timeToX(Y.valueOf());
|
|
704
|
+
e.moveTo(w, 0), e.lineTo(w, i.canvasHeight), Y = Y.add(1, H);
|
|
705
705
|
}
|
|
706
706
|
if (e.stroke(), c && c.length > 0)
|
|
707
|
-
for (const
|
|
708
|
-
const
|
|
709
|
-
if (!(
|
|
710
|
-
const X = Math.max(0,
|
|
707
|
+
for (const w of c) {
|
|
708
|
+
const E = i.timeToX(w.start), k = i.timeToX(w.end);
|
|
709
|
+
if (!(k < 0 || E > i.canvasWidth) && (e.strokeStyle = w.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), E >= 0 && E <= i.canvasWidth && (e.moveTo(E, 0), e.lineTo(E, i.canvasHeight)), k >= 0 && k <= i.canvasWidth && (e.moveTo(k, 0), e.lineTo(k, i.canvasHeight)), e.stroke(), e.globalAlpha = 1, w.label)) {
|
|
710
|
+
const X = Math.max(0, E), B = Math.min(i.canvasWidth, k) - X;
|
|
711
711
|
e.save(), e.font = '600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
712
|
-
const I = e.measureText(
|
|
713
|
-
e.fillStyle =
|
|
712
|
+
const I = e.measureText(w.label).width, x = 6, _ = I + x * 2, ie = 18, U = X + (B - _) / 2, J = 4;
|
|
713
|
+
e.fillStyle = w.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(U, J, _, ie, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(w.label, U + x, J + ie / 2), e.restore();
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
}
|
|
@@ -734,8 +734,8 @@ function di(t, e) {
|
|
|
734
734
|
if (t.font = ei, u !== void 0 && t.measureText(i).width > u) {
|
|
735
735
|
let o = 0, c = i.length;
|
|
736
736
|
for (; o < c; ) {
|
|
737
|
-
const s = Math.ceil((o + c) / 2),
|
|
738
|
-
t.measureText(
|
|
737
|
+
const s = Math.ceil((o + c) / 2), h = i.slice(0, s) + "...";
|
|
738
|
+
t.measureText(h).width <= u ? o = s : c = s - 1;
|
|
739
739
|
}
|
|
740
740
|
t.fillText(i.slice(0, o) + "...", n, r);
|
|
741
741
|
} else
|
|
@@ -771,8 +771,8 @@ function di(t, e) {
|
|
|
771
771
|
} else if (i === "danger-red" || i === "danger-yellow") {
|
|
772
772
|
const c = i === "danger-red" ? "#EF5350" : "#FBBF24";
|
|
773
773
|
t.fillStyle = c, t.beginPath(), t.moveTo(n + o, r), t.lineTo(n + u, r + u), t.lineTo(n, r + u), t.closePath(), t.fill(), t.fillStyle = "#ffffff";
|
|
774
|
-
const s = u * 0.12,
|
|
775
|
-
t.fillRect(
|
|
774
|
+
const s = u * 0.12, h = n + o - s / 2;
|
|
775
|
+
t.fillRect(h, r + u * 0.35, s, u * 0.35), t.beginPath(), t.arc(n + o, r + u * 0.82, s * 0.7, 0, Math.PI * 2), t.fill();
|
|
776
776
|
}
|
|
777
777
|
t.restore();
|
|
778
778
|
},
|
|
@@ -781,60 +781,60 @@ function di(t, e) {
|
|
|
781
781
|
*/
|
|
782
782
|
badge(i, n, r, u) {
|
|
783
783
|
t.save(), t.font = ei;
|
|
784
|
-
const c = t.measureText(i).width, s = 8,
|
|
785
|
-
t.fillStyle = u, t.beginPath(), t.roundRect(n, r,
|
|
784
|
+
const c = t.measureText(i).width, s = 8, S = 12 + 3 * 2, m = c + s * 2, f = S / 2;
|
|
785
|
+
t.fillStyle = u, t.beginPath(), t.roundRect(n, r, m, S, f), t.fill(), t.fillStyle = "#ffffff", t.textAlign = "center", t.textBaseline = "middle", t.fillText(i, n + m / 2, r + S / 2), t.restore();
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
788
|
}
|
|
789
|
-
class
|
|
790
|
-
draw(e, i, n, r, u, o, c, s,
|
|
791
|
-
const
|
|
789
|
+
class Qi {
|
|
790
|
+
draw(e, i, n, r, u, o, c, s, h, S, m, f, T, y) {
|
|
791
|
+
const g = (i.visibleTimeEnd - i.visibleTimeStart) * 0.1, H = i.visibleTimeStart - g, Y = i.visibleTimeEnd + g, $ = u.query(H, Y), w = /* @__PURE__ */ new Map();
|
|
792
792
|
for (let I = 0; I < n.length; I++)
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
for (const I of
|
|
796
|
-
const x =
|
|
793
|
+
w.set(n[I].id, I);
|
|
794
|
+
const E = new Set(S), k = /* @__PURE__ */ new Map(), X = -i.lineHeight, B = i.canvasHeight + i.lineHeight;
|
|
795
|
+
for (const I of $) {
|
|
796
|
+
const x = w.get(I.group);
|
|
797
797
|
if (x === void 0)
|
|
798
798
|
continue;
|
|
799
|
-
const
|
|
800
|
-
if (!
|
|
799
|
+
const _ = o.getLayout(I.id);
|
|
800
|
+
if (!_)
|
|
801
801
|
continue;
|
|
802
|
-
const U = i.groupIndexToY(x) +
|
|
803
|
-
if (U +
|
|
802
|
+
const U = i.groupIndexToY(x) + _.stackLevel * i.lineHeight + (i.lineHeight - _.itemHeight) / 2, J = _.itemHeight;
|
|
803
|
+
if (U + J < X || U > B)
|
|
804
804
|
continue;
|
|
805
|
-
const me = i.timeToX(I.start_time),
|
|
806
|
-
|
|
805
|
+
const me = i.timeToX(I.start_time), be = i.timeToX(I.end_time) - me, ye = { x: me, y: U, width: be, height: J };
|
|
806
|
+
k.set(I.id, ye);
|
|
807
807
|
const Ye = {
|
|
808
|
-
selected:
|
|
809
|
-
hovered:
|
|
808
|
+
selected: E.has(I.id),
|
|
809
|
+
hovered: m === I.id,
|
|
810
810
|
dragging: !1,
|
|
811
811
|
filtered: I.filtered !== !1
|
|
812
812
|
};
|
|
813
813
|
e.save();
|
|
814
|
-
const
|
|
814
|
+
const et = di(e, ye);
|
|
815
815
|
let He;
|
|
816
|
-
|
|
816
|
+
T && (y != null && y.isParent(I.id)) ? He = T : s && (I.type === "control_area_group" || I.type === "construction_train") ? He = s : He = c, He(e, I, ye, Ye, et), e.restore();
|
|
817
817
|
}
|
|
818
818
|
if (f && f.length > 0) {
|
|
819
819
|
const I = /* @__PURE__ */ new Set();
|
|
820
820
|
for (const x of f)
|
|
821
|
-
|
|
821
|
+
k.has(x.fromItemId) || I.add(x.fromItemId), k.has(x.toItemId) || I.add(x.toItemId);
|
|
822
822
|
if (I.size > 0) {
|
|
823
823
|
const x = /* @__PURE__ */ new Map();
|
|
824
|
-
for (const
|
|
825
|
-
I.has(
|
|
826
|
-
for (const [
|
|
827
|
-
const U =
|
|
824
|
+
for (const _ of r)
|
|
825
|
+
I.has(_.id) && x.set(_.id, _);
|
|
826
|
+
for (const [_, ie] of x) {
|
|
827
|
+
const U = w.get(ie.group);
|
|
828
828
|
if (U === void 0)
|
|
829
829
|
continue;
|
|
830
|
-
const
|
|
831
|
-
if (!
|
|
830
|
+
const J = o.getLayout(_);
|
|
831
|
+
if (!J)
|
|
832
832
|
continue;
|
|
833
|
-
const
|
|
834
|
-
|
|
833
|
+
const be = i.groupIndexToY(U) + J.stackLevel * i.lineHeight + (i.lineHeight - J.itemHeight) / 2, ye = i.timeToX(ie.start_time), Ye = i.timeToX(ie.end_time) - ye;
|
|
834
|
+
k.set(_, { x: ye, y: be, width: Ye, height: J.itemHeight });
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
|
-
this.drawDependencies(e, f,
|
|
837
|
+
this.drawDependencies(e, f, k, m, h);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
840
|
drawDependencies(e, i, n, r, u) {
|
|
@@ -842,12 +842,12 @@ class Ki {
|
|
|
842
842
|
const c = n.get(o.fromItemId), s = n.get(o.toItemId);
|
|
843
843
|
if (!c || !s)
|
|
844
844
|
continue;
|
|
845
|
-
const
|
|
846
|
-
e.strokeStyle =
|
|
847
|
-
const
|
|
848
|
-
e.beginPath(), e.moveTo(
|
|
849
|
-
const
|
|
850
|
-
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f,
|
|
845
|
+
const h = r === o.fromItemId || r === o.toItemId;
|
|
846
|
+
e.strokeStyle = h ? u.primary : o.color ?? "#94A3B8", e.lineWidth = h ? 2 : 1.5, e.setLineDash([]);
|
|
847
|
+
const S = c.x + c.width, m = c.y + c.height / 2, f = s.x, T = s.y + s.height / 2, y = Math.abs(f - S), g = Math.max(y * 0.4, 30);
|
|
848
|
+
e.beginPath(), e.moveTo(S, m), e.bezierCurveTo(S + g, m, f - g, T, f, T), e.stroke();
|
|
849
|
+
const H = 6;
|
|
850
|
+
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f, T), e.lineTo(f - H, T - H / 2), e.lineTo(f - H, T + H / 2), e.closePath(), e.fill();
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
}
|
|
@@ -855,29 +855,29 @@ class Ji {
|
|
|
855
855
|
draw(e, i, n, r) {
|
|
856
856
|
const { cursorX: u, snapX: o, markers: c, interaction: s } = r;
|
|
857
857
|
if (c)
|
|
858
|
-
for (const
|
|
859
|
-
const
|
|
860
|
-
if (e.fillStyle =
|
|
858
|
+
for (const h of c) {
|
|
859
|
+
const S = i.timeToX(h.date);
|
|
860
|
+
if (e.fillStyle = h.color, e.fillRect(S - h.width / 2, 0, h.width, i.canvasHeight), h.label) {
|
|
861
861
|
e.save(), e.font = '500 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
862
|
-
const
|
|
863
|
-
e.fillStyle =
|
|
864
|
-
const
|
|
865
|
-
e.fillText(
|
|
862
|
+
const m = e.measureText(h.label).width, f = 8, T = 200, y = Math.min(m + f * 2, T), g = 20, H = S - y / 2, Y = 4;
|
|
863
|
+
e.fillStyle = h.color, e.beginPath(), e.roundRect(H, Y, y, g, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
|
|
864
|
+
const $ = T - f * 2, w = m > $ ? h.label.slice(0, Math.floor(h.label.length * $ / m)) + "…" : h.label;
|
|
865
|
+
e.fillText(w, H + f, Y + g / 2), e.restore();
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
if (u != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(u, 0), e.lineTo(u, i.canvasHeight), e.stroke()), o != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(o, 0), e.lineTo(o, i.canvasHeight), e.stroke(), e.setLineDash([])), s) {
|
|
869
869
|
s.groupChanged && s.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, s.targetGroupY, i.canvasWidth, i.lineHeight)), e.save(), e.globalAlpha = 0.5;
|
|
870
|
-
const
|
|
871
|
-
s.renderer(e, s.item, s.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 },
|
|
870
|
+
const h = di(e, s.bounds);
|
|
871
|
+
s.renderer(e, s.item, s.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, h), e.restore();
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
const ti = 120;
|
|
876
|
-
function
|
|
876
|
+
function en(t) {
|
|
877
877
|
let e = t.deltaY || t.deltaX;
|
|
878
878
|
return t.deltaMode === 1 ? e *= 15 : t.deltaMode === 2 && (e *= 800), Math.max(-ti, Math.min(ti, e));
|
|
879
879
|
}
|
|
880
|
-
class
|
|
880
|
+
class tn {
|
|
881
881
|
constructor(e, i, n, r, u) {
|
|
882
882
|
Object.defineProperty(this, "onZoom", {
|
|
883
883
|
enumerable: !0,
|
|
@@ -910,14 +910,14 @@ class en {
|
|
|
910
910
|
this.visibleTimeStart = e, this.visibleTimeEnd = i;
|
|
911
911
|
}
|
|
912
912
|
handleWheelZoom(e, i) {
|
|
913
|
-
const n =
|
|
913
|
+
const n = en(e), r = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, u = n > 0 ? 1 + r * n / 500 : 1 / (1 + r * -n / 500), o = this.visibleTimeEnd - this.visibleTimeStart;
|
|
914
914
|
let c = Math.round(o * u);
|
|
915
915
|
c = Math.max(this.minZoom, Math.min(this.maxZoom, c));
|
|
916
|
-
const s = Math.round(this.visibleTimeStart + (o - c) * i),
|
|
917
|
-
this.onZoom(s,
|
|
916
|
+
const s = Math.round(this.visibleTimeStart + (o - c) * i), h = s + c;
|
|
917
|
+
this.onZoom(s, h);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
const
|
|
920
|
+
const ct = 864e5;
|
|
921
921
|
let ii = !1;
|
|
922
922
|
function Ht(t) {
|
|
923
923
|
return ii || (ii = !0, console.warn(`[canvas-timeline] dragSnap function returned ${t}; falling back to no snap. This warning is shown once per session.`)), 1;
|
|
@@ -936,14 +936,14 @@ function Ke(t, e, i) {
|
|
|
936
936
|
return !Number.isFinite(r) || r <= 0 || !Number.isFinite(u) ? t : Math.round((t - u) / r) * r + u;
|
|
937
937
|
}
|
|
938
938
|
const n = e;
|
|
939
|
-
if (i && n %
|
|
940
|
-
const r = n /
|
|
941
|
-
return
|
|
939
|
+
if (i && n % ct === 0) {
|
|
940
|
+
const r = n / ct, u = he(t, i), o = u.startOf("day"), c = o.add(1, "day").valueOf() - o.valueOf(), s = (t - o.valueOf()) / c, h = Math.round(ve.utc(u.format("YYYY-MM-DD")).valueOf() / ct), S = Math.round((h + s) / r) * r, m = ve.utc(S * ct).format("YYYY-MM-DD");
|
|
941
|
+
return ve.tz(m, i).valueOf();
|
|
942
942
|
}
|
|
943
943
|
return Math.round(t / n) * n;
|
|
944
944
|
}
|
|
945
|
-
const
|
|
946
|
-
class
|
|
945
|
+
const nn = 4;
|
|
946
|
+
class rn {
|
|
947
947
|
constructor(e) {
|
|
948
948
|
Object.defineProperty(this, "state", {
|
|
949
949
|
enumerable: !0,
|
|
@@ -976,7 +976,7 @@ class nn {
|
|
|
976
976
|
}, this.activated = !1;
|
|
977
977
|
}
|
|
978
978
|
update(e, i) {
|
|
979
|
-
this.state && (this.state.currentX = e, this.state.currentY = i, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >=
|
|
979
|
+
this.state && (this.state.currentX = e, this.state.currentY = i, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= nn && (this.activated = !0));
|
|
980
980
|
}
|
|
981
981
|
setCurrentGroup(e) {
|
|
982
982
|
this.state && (this.state.currentGroup = e);
|
|
@@ -1016,7 +1016,7 @@ function It(t, e, i) {
|
|
|
1016
1016
|
r.id !== e && (n.push(i(r.start_time)), n.push(i(r.end_time)));
|
|
1017
1017
|
return n;
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function dt(t, e, i, n, r) {
|
|
1020
1020
|
if (e.length === 0)
|
|
1021
1021
|
return null;
|
|
1022
1022
|
let u = e[0], o = Math.abs(t - u);
|
|
@@ -1027,22 +1027,22 @@ function ut(t, e, i, n, r) {
|
|
|
1027
1027
|
return o <= i ? u : null;
|
|
1028
1028
|
}
|
|
1029
1029
|
function fi(t, e, i) {
|
|
1030
|
-
const n = i.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = t.deltaX / n, u = t.item.start_time + r, o = qe(i.dragSnap, t.item), c = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, s = i.intervalTree.query(e.visibleTimeStart - c, e.visibleTimeEnd + c),
|
|
1031
|
-
if (
|
|
1032
|
-
return e.xToTime(
|
|
1033
|
-
const
|
|
1034
|
-
return
|
|
1030
|
+
const n = i.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = t.deltaX / n, u = t.item.start_time + r, o = qe(i.dragSnap, t.item), c = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, s = i.intervalTree.query(e.visibleTimeStart - c, e.visibleTimeEnd + c), h = It(s, t.item.id, (f) => e.timeToX(f)), S = dt(e.timeToX(u), h, 8);
|
|
1031
|
+
if (S !== null)
|
|
1032
|
+
return e.xToTime(S);
|
|
1033
|
+
const m = dt(e.timeToX(t.item.end_time + r), h, 8);
|
|
1034
|
+
return m !== null ? e.xToTime(m) - (t.item.end_time - t.item.start_time) : Ke(u, o, i.timezone);
|
|
1035
1035
|
}
|
|
1036
1036
|
function hi(t, e, i) {
|
|
1037
|
-
const n = i.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = t.deltaX / n, u = t.mode === "resize-left" ? "left" : "right", o = (u === "left" ? t.item.start_time : t.item.end_time) + r, c = qe(i.dragSnap, t.item, u), s = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1,
|
|
1038
|
-
let f =
|
|
1039
|
-
const
|
|
1040
|
-
return u === "left" && f >
|
|
1037
|
+
const n = i.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = t.deltaX / n, u = t.mode === "resize-left" ? "left" : "right", o = (u === "left" ? t.item.start_time : t.item.end_time) + r, c = qe(i.dragSnap, t.item, u), s = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, h = i.intervalTree.query(e.visibleTimeStart - s, e.visibleTimeEnd + s), S = It(h, t.item.id, (y) => e.timeToX(y)), m = dt(e.timeToX(o), S, 8);
|
|
1038
|
+
let f = m !== null ? e.xToTime(m) : Ke(o, c, i.timezone);
|
|
1039
|
+
const T = i.hierarchyEngine.getResizeConstraint(t.item.id, u);
|
|
1040
|
+
return u === "left" && f > T.max ? f = T.max : u === "right" && f < T.min && (f = T.min), { edge: u, time: f };
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1042
|
+
function on(t, e, i, n) {
|
|
1043
1043
|
if (t.mode === "move") {
|
|
1044
|
-
const s = fi(t, e, i),
|
|
1045
|
-
return { itemId: t.item.id, mode: "move", time: s, startTime: s, endTime: s +
|
|
1044
|
+
const s = fi(t, e, i), h = t.item.end_time - t.item.start_time;
|
|
1045
|
+
return { itemId: t.item.id, mode: "move", time: s, startTime: s, endTime: s + h, pointerX: n.x, pointerY: n.y };
|
|
1046
1046
|
}
|
|
1047
1047
|
const { edge: r, time: u } = hi(t, e, i), o = r === "left" ? u : t.item.start_time, c = r === "right" ? u : t.item.end_time;
|
|
1048
1048
|
return { itemId: t.item.id, mode: t.mode, edge: r, time: u, startTime: o, endTime: c, pointerX: n.x, pointerY: n.y };
|
|
@@ -1051,65 +1051,65 @@ var mi = { exports: {} };
|
|
|
1051
1051
|
(function(t, e) {
|
|
1052
1052
|
(function(i, n) {
|
|
1053
1053
|
t.exports = n();
|
|
1054
|
-
})(
|
|
1054
|
+
})(Qe, function() {
|
|
1055
1055
|
var i = "day";
|
|
1056
1056
|
return function(n, r, u) {
|
|
1057
|
-
var o = function(
|
|
1058
|
-
return
|
|
1057
|
+
var o = function(h) {
|
|
1058
|
+
return h.add(4 - h.isoWeekday(), i);
|
|
1059
1059
|
}, c = r.prototype;
|
|
1060
1060
|
c.isoWeekYear = function() {
|
|
1061
1061
|
return o(this).year();
|
|
1062
|
-
}, c.isoWeek = function(
|
|
1063
|
-
if (!this.$utils().u(
|
|
1064
|
-
var
|
|
1065
|
-
return y.diff(
|
|
1066
|
-
}, c.isoWeekday = function(
|
|
1067
|
-
return this.$utils().u(
|
|
1062
|
+
}, c.isoWeek = function(h) {
|
|
1063
|
+
if (!this.$utils().u(h)) return this.add(7 * (h - this.isoWeek()), i);
|
|
1064
|
+
var S, m, f, T, y = o(this), g = (S = this.isoWeekYear(), m = this.$u, f = (m ? u.utc : u)().year(S).startOf("year"), T = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (T += 7), f.add(T, i));
|
|
1065
|
+
return y.diff(g, "week") + 1;
|
|
1066
|
+
}, c.isoWeekday = function(h) {
|
|
1067
|
+
return this.$utils().u(h) ? this.day() || 7 : this.day(this.day() % 7 ? h : h - 7);
|
|
1068
1068
|
};
|
|
1069
1069
|
var s = c.startOf;
|
|
1070
|
-
c.startOf = function(
|
|
1071
|
-
var
|
|
1072
|
-
return
|
|
1070
|
+
c.startOf = function(h, S) {
|
|
1071
|
+
var m = this.$utils(), f = !!m.u(S) || S;
|
|
1072
|
+
return m.p(h) === "isoweek" ? f ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : s.bind(this)(h, S);
|
|
1073
1073
|
};
|
|
1074
1074
|
};
|
|
1075
1075
|
});
|
|
1076
1076
|
})(mi);
|
|
1077
|
-
var
|
|
1078
|
-
const
|
|
1077
|
+
var sn = mi.exports;
|
|
1078
|
+
const an = /* @__PURE__ */ Je(sn), ni = 200;
|
|
1079
1079
|
function ri({ groups: t, width: e, lineHeight: i, groupHeights: n, scrollTop: r, canvasHeight: u, theme: o, groupRenderer: c, onScroll: s }) {
|
|
1080
|
-
var
|
|
1081
|
-
const
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
for (let
|
|
1085
|
-
|
|
1086
|
-
return
|
|
1087
|
-
}, [t.length, n, i]), f =
|
|
1088
|
-
if (t.length === 0 ||
|
|
1080
|
+
var w;
|
|
1081
|
+
const h = A(null), S = A(!1), m = Q(() => {
|
|
1082
|
+
const E = new Array(t.length + 1);
|
|
1083
|
+
E[0] = 0;
|
|
1084
|
+
for (let k = 0; k < t.length; k++)
|
|
1085
|
+
E[k + 1] = E[k] + ((n == null ? void 0 : n[k]) ?? i);
|
|
1086
|
+
return E;
|
|
1087
|
+
}, [t.length, n, i]), f = m[t.length] ?? 0, T = u, y = te((E) => {
|
|
1088
|
+
if (t.length === 0 || E <= 0)
|
|
1089
1089
|
return 0;
|
|
1090
|
-
if (
|
|
1090
|
+
if (E >= f)
|
|
1091
1091
|
return t.length - 1;
|
|
1092
|
-
let
|
|
1093
|
-
for (;
|
|
1094
|
-
const B =
|
|
1095
|
-
|
|
1092
|
+
let k = 0, X = t.length - 1;
|
|
1093
|
+
for (; k < X; ) {
|
|
1094
|
+
const B = k + X >>> 1;
|
|
1095
|
+
m[B + 1] > E ? X = B : k = B + 1;
|
|
1096
1096
|
}
|
|
1097
|
-
return
|
|
1098
|
-
}, [t.length,
|
|
1099
|
-
|
|
1097
|
+
return k;
|
|
1098
|
+
}, [t.length, m, f]), g = y(r - ni), H = y(r + u + ni), Y = te((E) => {
|
|
1099
|
+
S.current || s(E.currentTarget.scrollTop);
|
|
1100
1100
|
}, [s]);
|
|
1101
1101
|
ae(() => {
|
|
1102
|
-
|
|
1103
|
-
|
|
1102
|
+
h.current && (S.current = !0, h.current.scrollTop = r, requestAnimationFrame(() => {
|
|
1103
|
+
S.current = !1;
|
|
1104
1104
|
}));
|
|
1105
1105
|
}, [r]);
|
|
1106
|
-
const
|
|
1107
|
-
for (let
|
|
1108
|
-
const
|
|
1109
|
-
if (!
|
|
1106
|
+
const $ = [];
|
|
1107
|
+
for (let E = g; E <= H; E++) {
|
|
1108
|
+
const k = t[E];
|
|
1109
|
+
if (!k)
|
|
1110
1110
|
continue;
|
|
1111
|
-
const X =
|
|
1112
|
-
|
|
1111
|
+
const X = m[E], B = m[E + 1] - X;
|
|
1112
|
+
$.push(re("div", { style: {
|
|
1113
1113
|
position: "absolute",
|
|
1114
1114
|
top: X,
|
|
1115
1115
|
height: B,
|
|
@@ -1117,34 +1117,34 @@ function ri({ groups: t, width: e, lineHeight: i, groupHeights: n, scrollTop: r,
|
|
|
1117
1117
|
overflow: "hidden",
|
|
1118
1118
|
display: "flex",
|
|
1119
1119
|
alignItems: "stretch",
|
|
1120
|
-
borderBottom: `1px solid ${((
|
|
1120
|
+
borderBottom: `1px solid ${((w = o.grid) == null ? void 0 : w.line) ?? "#E5E5E5"}`,
|
|
1121
1121
|
boxSizing: "border-box"
|
|
1122
|
-
}, children: c(
|
|
1122
|
+
}, children: c(k) }, k.id));
|
|
1123
1123
|
}
|
|
1124
|
-
return re("div", { ref:
|
|
1124
|
+
return re("div", { ref: h, onScroll: Y, style: {
|
|
1125
1125
|
width: e,
|
|
1126
|
-
height:
|
|
1126
|
+
height: T,
|
|
1127
1127
|
overflowY: f > u ? "auto" : "hidden",
|
|
1128
1128
|
overflowX: "hidden",
|
|
1129
1129
|
position: "relative",
|
|
1130
1130
|
borderRight: `1px solid ${o.sidebar.border}`,
|
|
1131
1131
|
backgroundColor: o.sidebar.bg
|
|
1132
|
-
}, children: re("div", { style: { height: f, position: "relative" }, children:
|
|
1132
|
+
}, children: re("div", { style: { height: f, position: "relative" }, children: $ }) });
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1134
|
+
function ln(t) {
|
|
1135
1135
|
return null;
|
|
1136
1136
|
}
|
|
1137
|
-
|
|
1137
|
+
ln.displayName = "TodayMarker";
|
|
1138
1138
|
function oi(t) {
|
|
1139
1139
|
return { date: Math.floor(Date.now() / 6e4) * 6e4, color: t.color ?? "#FD7171", width: t.width ?? 6, label: t.label };
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function un(t) {
|
|
1142
1142
|
return t.interval ?? 1e4;
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function cn(t) {
|
|
1145
1145
|
return null;
|
|
1146
1146
|
}
|
|
1147
|
-
|
|
1147
|
+
cn.displayName = "CustomMarker";
|
|
1148
1148
|
function si(t) {
|
|
1149
1149
|
return {
|
|
1150
1150
|
date: t.date,
|
|
@@ -1153,8 +1153,8 @@ function si(t) {
|
|
|
1153
1153
|
label: t.label
|
|
1154
1154
|
};
|
|
1155
1155
|
}
|
|
1156
|
-
|
|
1157
|
-
function
|
|
1156
|
+
ve.extend(an);
|
|
1157
|
+
function dn(t) {
|
|
1158
1158
|
return t ? {
|
|
1159
1159
|
...Ee,
|
|
1160
1160
|
...t,
|
|
@@ -1166,42 +1166,42 @@ function cn(t) {
|
|
|
1166
1166
|
header: { ...Ee.header, ...t.header }
|
|
1167
1167
|
} : Ee;
|
|
1168
1168
|
}
|
|
1169
|
-
const ai = 32,
|
|
1170
|
-
const { groups: n, items: r, defaultTimeStart: u, defaultTimeEnd: o, sidebarWidth: c, lineHeight: s, itemHeightRatio:
|
|
1171
|
-
for (let
|
|
1172
|
-
if (l[
|
|
1173
|
-
return
|
|
1169
|
+
const ai = 32, Hn = ce.memo(_i(function(e, i) {
|
|
1170
|
+
const { groups: n, items: r, defaultTimeStart: u, defaultTimeEnd: o, sidebarWidth: c, lineHeight: s, itemHeightRatio: h, stackItems: S, canMove: m, canChangeGroup: f, canResize: T, dragSnap: y, minZoom: g, maxZoom: H, theme: Y, dayStyle: $, rowStyle: w, showCursorLine: E, itemRenderer: k, groupRenderer: X, sidebarGroupRenderer: B, dependencies: I, highlights: x, onItemClick: _, onItemDoubleClick: ie, onItemContextMenu: U, onItemMove: J, onItemResize: me, moveResizeValidator: be, onItemHover: ye, onInteractionUpdate: Ye, onCanvasDoubleClick: et, onCanvasContextMenu: He, onTimeChange: Dt, onZoom: Ot, selected: Rt = [], rightSidebarWidth: ft, rightSidebarGroupRenderer: Pt, onReady: tt, maxHeight: Be, timezone: it, devBadge: vi, children: we } = e, Te = Q(() => dn(Y), [Y]), Yt = te((a, l) => {
|
|
1171
|
+
for (let p = 0; p < l.length; p++)
|
|
1172
|
+
if (l[p].id === a)
|
|
1173
|
+
return p;
|
|
1174
1174
|
return 0;
|
|
1175
|
-
}, []),
|
|
1175
|
+
}, []), bi = Rt.join(","), ht = Q(() => Rt, [bi]), $t = A(null), Xt = A(null), Ft = A(null), xe = A(null), _t = A(null), Wt = A(null), [yi, Ti] = Ue(800), [Si, Mi] = Ue(null);
|
|
1176
1176
|
ae(() => {
|
|
1177
1177
|
const a = _t.current;
|
|
1178
1178
|
if (!a)
|
|
1179
1179
|
return;
|
|
1180
|
-
const l = new ResizeObserver((
|
|
1181
|
-
const v =
|
|
1182
|
-
v &&
|
|
1180
|
+
const l = new ResizeObserver((p) => {
|
|
1181
|
+
const v = p[0];
|
|
1182
|
+
v && Ti(v.contentRect.width);
|
|
1183
1183
|
});
|
|
1184
1184
|
return l.observe(a), () => l.disconnect();
|
|
1185
1185
|
}, []), ae(() => {
|
|
1186
1186
|
const a = Wt.current;
|
|
1187
1187
|
if (!a || !Be)
|
|
1188
1188
|
return;
|
|
1189
|
-
const l = new ResizeObserver((
|
|
1190
|
-
const v =
|
|
1191
|
-
v &&
|
|
1189
|
+
const l = new ResizeObserver((p) => {
|
|
1190
|
+
const v = p[0];
|
|
1191
|
+
v && Mi(v.contentRect.height);
|
|
1192
1192
|
});
|
|
1193
1193
|
return l.observe(a), () => l.disconnect();
|
|
1194
1194
|
}, [Be]);
|
|
1195
|
-
const ke = Math.max(0,
|
|
1195
|
+
const ke = Math.max(0, yi - c - (ft ?? 0)), Ie = Q(() => {
|
|
1196
1196
|
const a = new Li();
|
|
1197
1197
|
return a.rebuild(r), a;
|
|
1198
|
-
}, [r]), mt =
|
|
1199
|
-
const a = new
|
|
1198
|
+
}, [r]), mt = Q(() => {
|
|
1199
|
+
const a = new xi();
|
|
1200
1200
|
return a.buildFromItems(r, (l) => Ie.getEffectiveSpan(l.id).start, (l) => Ie.getEffectiveSpan(l.id).end), a;
|
|
1201
|
-
}, [r, Ie]),
|
|
1202
|
-
const a = new zi(s,
|
|
1203
|
-
return a.computeLayout(r,
|
|
1204
|
-
}, [r, s,
|
|
1201
|
+
}, [r, Ie]), ze = Q(() => {
|
|
1202
|
+
const a = new zi(s, h);
|
|
1203
|
+
return a.computeLayout(r, S, Ie), a;
|
|
1204
|
+
}, [r, s, h, S, Ie]), De = Q(() => n.map((a) => ze.getGroupHeight(a.id)), [n, ze]), nt = Q(() => De.reduce((a, l) => a + l, 0), [De]), Bt = typeof Be == "number" ? Be : Si, ge = Bt ? Math.min(nt, Bt) : nt, L = A(new wt({
|
|
1205
1205
|
visibleTimeStart: e.visibleTimeStart ?? u,
|
|
1206
1206
|
visibleTimeEnd: e.visibleTimeEnd ?? o,
|
|
1207
1207
|
canvasWidth: ke,
|
|
@@ -1212,185 +1212,185 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1212
1212
|
buffer: e.buffer ?? 3,
|
|
1213
1213
|
scrollTop: 0,
|
|
1214
1214
|
groupHeights: De
|
|
1215
|
-
})), gt = A(null),
|
|
1215
|
+
})), gt = A(null), Le = A(void 0), xt = A({ x: 0, y: 0 }), pt = A(!1), de = A(null), Oe = A(!1), zt = 4, [Lt, wi] = Ue(e.visibleTimeStart ?? u), [At, ki] = Ue(e.visibleTimeEnd ?? o), [Nt, rt] = Ue(0), Ae = A(null), $e = te(() => {
|
|
1216
1216
|
const a = L.current;
|
|
1217
|
-
|
|
1217
|
+
wi(a.visibleTimeStart), ki(a.visibleTimeEnd), rt(a.scrollTop), Ae.current = null;
|
|
1218
1218
|
}, []), vt = te(() => {
|
|
1219
1219
|
Ae.current === null && (Ae.current = setTimeout($e, ai));
|
|
1220
1220
|
}, [$e]);
|
|
1221
1221
|
ae(() => () => {
|
|
1222
1222
|
Ae.current !== null && clearTimeout(Ae.current);
|
|
1223
1223
|
}, []);
|
|
1224
|
-
const jt =
|
|
1225
|
-
|
|
1226
|
-
}, [e.summaryRenderer,
|
|
1224
|
+
const jt = Q(() => e.summaryRenderer ? e.summaryRenderer : (a, l, p, v, d) => {
|
|
1225
|
+
Ai(a, l, p, v, d, Te);
|
|
1226
|
+
}, [e.summaryRenderer, Te]), Xe = Q(() => new Ki(), []), Fe = Q(() => new Qi(), []), _e = Q(() => new Ji(), []), ne = Q(() => new rn(y), [y]), ot = Q(() => {
|
|
1227
1227
|
const a = [];
|
|
1228
1228
|
return ce.Children.forEach(we, (l) => {
|
|
1229
1229
|
var v;
|
|
1230
1230
|
if (!ce.isValidElement(l))
|
|
1231
1231
|
return;
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1232
|
+
const p = (v = l.type) == null ? void 0 : v.displayName;
|
|
1233
|
+
p === "TodayMarker" ? a.push(oi(l.props)) : p === "CustomMarker" && a.push(si(l.props));
|
|
1234
1234
|
}), a;
|
|
1235
|
-
}, [we]),
|
|
1236
|
-
Ne.current =
|
|
1237
|
-
const bt =
|
|
1235
|
+
}, [we]), st = Q(() => ot.map((a) => `${a.date}|${a.color}|${a.width}|${a.label ?? ""}`).join(";"), [ot]), Ne = A(ot);
|
|
1236
|
+
Ne.current = ot;
|
|
1237
|
+
const bt = Q(() => {
|
|
1238
1238
|
let a = 0;
|
|
1239
1239
|
return ce.Children.forEach(we, (l) => {
|
|
1240
1240
|
var v;
|
|
1241
1241
|
if (!ce.isValidElement(l))
|
|
1242
1242
|
return;
|
|
1243
|
-
((v = l.type) == null ? void 0 : v.displayName) === "TodayMarker" && (a =
|
|
1243
|
+
((v = l.type) == null ? void 0 : v.displayName) === "TodayMarker" && (a = un(l.props));
|
|
1244
1244
|
}), a;
|
|
1245
1245
|
}, [we]), N = A({
|
|
1246
1246
|
groups: n,
|
|
1247
1247
|
items: r,
|
|
1248
1248
|
intervalTree: mt,
|
|
1249
|
-
layoutEngine:
|
|
1250
|
-
itemRenderer:
|
|
1249
|
+
layoutEngine: ze,
|
|
1250
|
+
itemRenderer: k,
|
|
1251
1251
|
groupRenderer: X,
|
|
1252
|
-
theme:
|
|
1252
|
+
theme: Te,
|
|
1253
1253
|
selected: ht,
|
|
1254
1254
|
dependencies: I,
|
|
1255
1255
|
highlights: x,
|
|
1256
|
-
dayStyle:
|
|
1257
|
-
rowStyle:
|
|
1258
|
-
showCursorLine:
|
|
1256
|
+
dayStyle: $,
|
|
1257
|
+
rowStyle: w,
|
|
1258
|
+
showCursorLine: E,
|
|
1259
1259
|
canvasWidth: ke,
|
|
1260
1260
|
canvasHeight: ge,
|
|
1261
1261
|
lineHeight: s,
|
|
1262
|
-
itemHeightRatio:
|
|
1262
|
+
itemHeightRatio: h,
|
|
1263
1263
|
onTimeChange: Dt,
|
|
1264
|
-
onZoom:
|
|
1265
|
-
onItemHover:
|
|
1266
|
-
onItemClick:
|
|
1264
|
+
onZoom: Ot,
|
|
1265
|
+
onItemHover: ye,
|
|
1266
|
+
onItemClick: _,
|
|
1267
1267
|
onItemDoubleClick: ie,
|
|
1268
1268
|
onItemContextMenu: U,
|
|
1269
|
-
onItemMove:
|
|
1269
|
+
onItemMove: J,
|
|
1270
1270
|
onItemResize: me,
|
|
1271
1271
|
onInteractionUpdate: Ye,
|
|
1272
|
-
onCanvasDoubleClick:
|
|
1272
|
+
onCanvasDoubleClick: et,
|
|
1273
1273
|
onCanvasContextMenu: He,
|
|
1274
|
-
canMove:
|
|
1275
|
-
canResize:
|
|
1274
|
+
canMove: m,
|
|
1275
|
+
canResize: T,
|
|
1276
1276
|
canChangeGroup: f,
|
|
1277
1277
|
dragSnap: y,
|
|
1278
1278
|
sidebarWidth: c,
|
|
1279
|
-
moveResizeValidator:
|
|
1279
|
+
moveResizeValidator: be,
|
|
1280
1280
|
summaryRenderer: jt,
|
|
1281
1281
|
hierarchyEngine: Ie,
|
|
1282
|
-
timezone:
|
|
1282
|
+
timezone: it
|
|
1283
1283
|
});
|
|
1284
1284
|
N.current = {
|
|
1285
1285
|
groups: n,
|
|
1286
1286
|
items: r,
|
|
1287
1287
|
intervalTree: mt,
|
|
1288
|
-
layoutEngine:
|
|
1289
|
-
itemRenderer:
|
|
1288
|
+
layoutEngine: ze,
|
|
1289
|
+
itemRenderer: k,
|
|
1290
1290
|
groupRenderer: X,
|
|
1291
|
-
theme:
|
|
1291
|
+
theme: Te,
|
|
1292
1292
|
selected: ht,
|
|
1293
1293
|
dependencies: I,
|
|
1294
1294
|
highlights: x,
|
|
1295
|
-
dayStyle:
|
|
1296
|
-
rowStyle:
|
|
1297
|
-
showCursorLine:
|
|
1295
|
+
dayStyle: $,
|
|
1296
|
+
rowStyle: w,
|
|
1297
|
+
showCursorLine: E,
|
|
1298
1298
|
canvasWidth: ke,
|
|
1299
1299
|
canvasHeight: ge,
|
|
1300
1300
|
lineHeight: s,
|
|
1301
|
-
itemHeightRatio:
|
|
1301
|
+
itemHeightRatio: h,
|
|
1302
1302
|
onTimeChange: Dt,
|
|
1303
|
-
onZoom:
|
|
1304
|
-
onItemHover:
|
|
1305
|
-
onItemClick:
|
|
1303
|
+
onZoom: Ot,
|
|
1304
|
+
onItemHover: ye,
|
|
1305
|
+
onItemClick: _,
|
|
1306
1306
|
onItemDoubleClick: ie,
|
|
1307
1307
|
onItemContextMenu: U,
|
|
1308
|
-
onItemMove:
|
|
1308
|
+
onItemMove: J,
|
|
1309
1309
|
onItemResize: me,
|
|
1310
1310
|
onInteractionUpdate: Ye,
|
|
1311
|
-
onCanvasDoubleClick:
|
|
1311
|
+
onCanvasDoubleClick: et,
|
|
1312
1312
|
onCanvasContextMenu: He,
|
|
1313
|
-
canMove:
|
|
1314
|
-
canResize:
|
|
1313
|
+
canMove: m,
|
|
1314
|
+
canResize: T,
|
|
1315
1315
|
canChangeGroup: f,
|
|
1316
1316
|
dragSnap: y,
|
|
1317
1317
|
sidebarWidth: c,
|
|
1318
|
-
moveResizeValidator:
|
|
1318
|
+
moveResizeValidator: be,
|
|
1319
1319
|
summaryRenderer: jt,
|
|
1320
1320
|
hierarchyEngine: Ie,
|
|
1321
|
-
timezone:
|
|
1321
|
+
timezone: it
|
|
1322
1322
|
};
|
|
1323
|
-
const
|
|
1323
|
+
const Ci = te(() => {
|
|
1324
1324
|
const a = $t.current;
|
|
1325
1325
|
if (!a)
|
|
1326
1326
|
return;
|
|
1327
|
-
const l = N.current,
|
|
1328
|
-
Et(
|
|
1329
|
-
}, [Xe]),
|
|
1327
|
+
const l = N.current, p = Ct(a, l.canvasWidth, l.canvasHeight);
|
|
1328
|
+
Et(p, a), Xe.draw(p, L.current, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights, l.timezone);
|
|
1329
|
+
}, [Xe]), Ei = te(() => {
|
|
1330
1330
|
const a = Xt.current;
|
|
1331
1331
|
if (!a)
|
|
1332
1332
|
return;
|
|
1333
|
-
const l = N.current,
|
|
1334
|
-
Et(
|
|
1335
|
-
}, [Fe]), Gt = te((a, l,
|
|
1336
|
-
const v = L.current, d = N.current, b = d.canvasWidth / (v.visibleTimeEnd - v.visibleTimeStart), C = l / b, D =
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1339
|
-
for (const ee of
|
|
1340
|
-
const V =
|
|
1333
|
+
const l = N.current, p = Ct(a, l.canvasWidth, l.canvasHeight);
|
|
1334
|
+
Et(p, a), Fe.draw(p, L.current, l.groups, l.items, l.intervalTree, l.layoutEngine, l.itemRenderer, l.groupRenderer, l.theme, l.selected, Le.current, l.dependencies, l.summaryRenderer, l.hierarchyEngine);
|
|
1335
|
+
}, [Fe]), Gt = te((a, l, p) => {
|
|
1336
|
+
const v = L.current, d = N.current, b = d.canvasWidth / (v.visibleTimeEnd - v.visibleTimeStart), C = l / b, D = p === "resize-left" ? "left" : p === "resize-right" ? "right" : void 0, P = qe(d.dragSnap, a, D), F = [];
|
|
1337
|
+
p === "move" ? (F.push(v.timeToX(a.start_time + C)), F.push(v.timeToX(a.end_time + C))) : p === "resize-left" ? F.push(v.timeToX(a.start_time + C)) : F.push(v.timeToX(a.end_time + C));
|
|
1338
|
+
const W = (v.visibleTimeEnd - v.visibleTimeStart) * 0.1, Z = d.intervalTree.query(v.visibleTimeStart - W, v.visibleTimeEnd + W), se = It(Z, a.id, (ee) => v.timeToX(ee));
|
|
1339
|
+
for (const ee of F) {
|
|
1340
|
+
const V = dt(ee, se, 8);
|
|
1341
1341
|
if (V !== null)
|
|
1342
1342
|
return V;
|
|
1343
1343
|
}
|
|
1344
|
-
const q =
|
|
1344
|
+
const q = p === "resize-right" ? a.end_time + C : a.start_time + C, G = Ke(q, P, d.timezone);
|
|
1345
1345
|
return v.timeToX(G);
|
|
1346
|
-
}, []),
|
|
1346
|
+
}, []), Hi = te(() => {
|
|
1347
1347
|
const a = Ft.current;
|
|
1348
1348
|
if (!a)
|
|
1349
1349
|
return;
|
|
1350
|
-
const l = N.current,
|
|
1351
|
-
Et(
|
|
1350
|
+
const l = N.current, p = Ct(a, l.canvasWidth, l.canvasHeight);
|
|
1351
|
+
Et(p, a);
|
|
1352
1352
|
const v = L.current, d = ne.getState();
|
|
1353
1353
|
let b = null;
|
|
1354
1354
|
if (d) {
|
|
1355
1355
|
const C = v.timeToX(d.item.start_time), D = v.timeToX(d.item.end_time) - C;
|
|
1356
|
-
let
|
|
1357
|
-
d.mode === "resize-left" ? (
|
|
1358
|
-
const
|
|
1356
|
+
let P, F;
|
|
1357
|
+
d.mode === "resize-left" ? (P = C + d.deltaX, F = D - d.deltaX) : d.mode === "resize-right" ? (P = C, F = D + d.deltaX) : (P = C + d.deltaX, F = D);
|
|
1358
|
+
const W = Yt(d.currentGroup, l.groups), Z = v.groupIndexToY(W), se = d.currentGroup !== d.originalGroup;
|
|
1359
1359
|
b = {
|
|
1360
1360
|
item: d.item,
|
|
1361
1361
|
mode: d.mode,
|
|
1362
|
-
bounds: { x:
|
|
1362
|
+
bounds: { x: P, y: Z + (l.lineHeight - l.lineHeight * l.itemHeightRatio) / 2, width: F, height: l.lineHeight * l.itemHeightRatio },
|
|
1363
1363
|
renderer: l.itemRenderer,
|
|
1364
1364
|
targetGroupY: Z,
|
|
1365
1365
|
groupChanged: se
|
|
1366
1366
|
};
|
|
1367
1367
|
}
|
|
1368
|
-
_e.draw(
|
|
1368
|
+
_e.draw(p, v, l.theme, {
|
|
1369
1369
|
cursorX: l.showCursorLine ? gt.current : null,
|
|
1370
1370
|
snapX: d ? Gt(d.item, d.deltaX, d.mode) : null,
|
|
1371
1371
|
markers: Ne.current,
|
|
1372
1372
|
interaction: b
|
|
1373
|
-
}), l.onInteractionUpdate && (d ? (l.onInteractionUpdate(
|
|
1373
|
+
}), l.onInteractionUpdate && (d ? (l.onInteractionUpdate(on(d, v, l, xt.current)), pt.current = !0) : pt.current && (pt.current = !1, l.onInteractionUpdate(null)));
|
|
1374
1374
|
}, [_e, ne, Gt, Yt]), yt = A(null);
|
|
1375
|
-
yt.current || (yt.current = new
|
|
1376
|
-
a.grid &&
|
|
1375
|
+
yt.current || (yt.current = new Gi((a) => {
|
|
1376
|
+
a.grid && Ci(), a.items && Ei(), a.overlay && Hi();
|
|
1377
1377
|
}));
|
|
1378
|
-
const
|
|
1379
|
-
ae(() => () =>
|
|
1378
|
+
const O = yt.current;
|
|
1379
|
+
ae(() => () => O.dispose(), [O]), ae(() => {
|
|
1380
1380
|
if (!bt)
|
|
1381
1381
|
return;
|
|
1382
1382
|
const a = setInterval(() => {
|
|
1383
1383
|
const l = [];
|
|
1384
|
-
ce.Children.forEach(we, (
|
|
1384
|
+
ce.Children.forEach(we, (p) => {
|
|
1385
1385
|
var d;
|
|
1386
|
-
if (!ce.isValidElement(
|
|
1386
|
+
if (!ce.isValidElement(p))
|
|
1387
1387
|
return;
|
|
1388
|
-
const v = (d =
|
|
1389
|
-
v === "TodayMarker" ? l.push(oi(
|
|
1390
|
-
}), Ne.current = l,
|
|
1388
|
+
const v = (d = p.type) == null ? void 0 : d.displayName;
|
|
1389
|
+
v === "TodayMarker" ? l.push(oi(p.props)) : v === "CustomMarker" && l.push(si(p.props));
|
|
1390
|
+
}), Ne.current = l, O.markDirty("overlay");
|
|
1391
1391
|
}, bt);
|
|
1392
1392
|
return () => clearInterval(a);
|
|
1393
|
-
}, [bt, we,
|
|
1393
|
+
}, [bt, we, O]), ae(() => {
|
|
1394
1394
|
L.current.update({
|
|
1395
1395
|
canvasWidth: ke,
|
|
1396
1396
|
canvasHeight: ge,
|
|
@@ -1398,85 +1398,85 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1398
1398
|
lineHeight: s,
|
|
1399
1399
|
groupCount: n.length,
|
|
1400
1400
|
groupHeights: De
|
|
1401
|
-
}),
|
|
1402
|
-
}, [ke, ge, c, s, n.length, De,
|
|
1403
|
-
|
|
1404
|
-
}, [r, n, ht,
|
|
1405
|
-
const
|
|
1401
|
+
}), O.markAllDirty();
|
|
1402
|
+
}, [ke, ge, c, s, n.length, De, O]), ae(() => {
|
|
1403
|
+
O.markDirty("grid"), O.markDirty("items");
|
|
1404
|
+
}, [r, n, ht, Te, $, w, mt, ze, O]);
|
|
1405
|
+
const at = Q(() => {
|
|
1406
1406
|
var a;
|
|
1407
1407
|
return ((a = e.highlights) == null ? void 0 : a.map((l) => `${l.start}|${l.end}|${l.color}|${l.label ?? ""}|${l.opacity ?? ""}`).join(";")) ?? "";
|
|
1408
|
-
}, [e.highlights]), Ut = A(
|
|
1408
|
+
}, [e.highlights]), Ut = A(at);
|
|
1409
1409
|
ae(() => {
|
|
1410
|
-
|
|
1411
|
-
}, [
|
|
1412
|
-
const Zt = A(
|
|
1410
|
+
at !== Ut.current && (Ut.current = at, O.markDirty("grid"));
|
|
1411
|
+
}, [at, O]);
|
|
1412
|
+
const Zt = A(st);
|
|
1413
1413
|
ae(() => {
|
|
1414
|
-
|
|
1415
|
-
}, [
|
|
1414
|
+
st !== Zt.current && (Zt.current = st, O.markDirty("overlay"));
|
|
1415
|
+
}, [st, O]);
|
|
1416
1416
|
const Vt = A(e.visibleTimeStart), qt = A(e.visibleTimeEnd);
|
|
1417
|
-
e.visibleTimeStart !== void 0 && e.visibleTimeStart !== Vt.current && (Vt.current = e.visibleTimeStart, L.current.update({ visibleTimeStart: e.visibleTimeStart }),
|
|
1417
|
+
e.visibleTimeStart !== void 0 && e.visibleTimeStart !== Vt.current && (Vt.current = e.visibleTimeStart, L.current.update({ visibleTimeStart: e.visibleTimeStart }), O.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== qt.current && (qt.current = e.visibleTimeEnd, L.current.update({ visibleTimeEnd: e.visibleTimeEnd }), O.markAllDirty());
|
|
1418
1418
|
const je = A(null), Tt = te((a) => {
|
|
1419
1419
|
je.current === null && (je.current = setTimeout(() => {
|
|
1420
1420
|
var v, d;
|
|
1421
1421
|
je.current = null;
|
|
1422
|
-
const l = L.current,
|
|
1423
|
-
a === "zoom" ? (v =
|
|
1422
|
+
const l = L.current, p = N.current;
|
|
1423
|
+
a === "zoom" ? (v = p.onZoom) == null || v.call(p, l.visibleTimeStart, l.visibleTimeEnd) : (d = p.onTimeChange) == null || d.call(p, l.visibleTimeStart, l.visibleTimeEnd);
|
|
1424
1424
|
}, ai));
|
|
1425
1425
|
}, []);
|
|
1426
1426
|
ae(() => () => {
|
|
1427
1427
|
je.current !== null && clearTimeout(je.current);
|
|
1428
1428
|
}, []);
|
|
1429
|
-
const
|
|
1430
|
-
var
|
|
1431
|
-
L.current.update({ visibleTimeStart: a, visibleTimeEnd: l }), (
|
|
1432
|
-
}, u, o,
|
|
1433
|
-
|
|
1434
|
-
const
|
|
1435
|
-
const l = L.current,
|
|
1436
|
-
d !== l.scrollTop && (l.update({ scrollTop: d }),
|
|
1437
|
-
}, [
|
|
1438
|
-
var C, D,
|
|
1439
|
-
const l = L.current,
|
|
1440
|
-
l.update({ visibleTimeStart: d, visibleTimeEnd: b }), (C =
|
|
1441
|
-
}, [
|
|
1429
|
+
const lt = A(null), St = Q(() => new tn((a, l) => {
|
|
1430
|
+
var p;
|
|
1431
|
+
L.current.update({ visibleTimeStart: a, visibleTimeEnd: l }), (p = lt.current) == null || p.updateBounds(a, l), O.markAllDirty(), vt(), Tt("zoom");
|
|
1432
|
+
}, u, o, g, H), []);
|
|
1433
|
+
lt.current = St;
|
|
1434
|
+
const ut = te((a) => {
|
|
1435
|
+
const l = L.current, p = l.getTotalHeight(), v = Math.max(0, p - l.canvasHeight), d = Math.max(0, Math.min(v, l.scrollTop + a));
|
|
1436
|
+
d !== l.scrollTop && (l.update({ scrollTop: d }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), rt(d));
|
|
1437
|
+
}, [O]), Ge = te((a) => {
|
|
1438
|
+
var C, D, P;
|
|
1439
|
+
const l = L.current, p = l.canvasWidth / (l.visibleTimeEnd - l.visibleTimeStart), v = a / p, d = l.visibleTimeStart + v, b = l.visibleTimeEnd + v;
|
|
1440
|
+
l.update({ visibleTimeStart: d, visibleTimeEnd: b }), (C = lt.current) == null || C.updateBounds(d, b), O.markAllDirty(), Bi(() => $e()), (P = (D = N.current).onTimeChange) == null || P.call(D, d, b);
|
|
1441
|
+
}, [O, $e]);
|
|
1442
1442
|
ae(() => {
|
|
1443
|
-
const a =
|
|
1443
|
+
const a = xe.current;
|
|
1444
1444
|
if (!a)
|
|
1445
1445
|
return;
|
|
1446
|
-
const l = (
|
|
1447
|
-
if (
|
|
1448
|
-
|
|
1449
|
-
const v = a.getBoundingClientRect(), d = (
|
|
1450
|
-
St.handleWheelZoom(
|
|
1451
|
-
} else if (
|
|
1452
|
-
|
|
1446
|
+
const l = (p) => {
|
|
1447
|
+
if (p.ctrlKey || p.metaKey || p.altKey) {
|
|
1448
|
+
p.preventDefault();
|
|
1449
|
+
const v = a.getBoundingClientRect(), d = (p.clientX - v.left) / v.width;
|
|
1450
|
+
St.handleWheelZoom(p, d);
|
|
1451
|
+
} else if (p.shiftKey)
|
|
1452
|
+
p.preventDefault(), Ge(p.deltaY || p.deltaX);
|
|
1453
1453
|
else {
|
|
1454
|
-
const v =
|
|
1455
|
-
v !== 0 && Math.abs(v) > Math.abs(
|
|
1454
|
+
const v = p.deltaX;
|
|
1455
|
+
v !== 0 && Math.abs(v) > Math.abs(p.deltaY) ? (p.preventDefault(), Ge(v)) : p.deltaY !== 0 && (nt > ge && p.preventDefault(), ut(p.deltaY));
|
|
1456
1456
|
}
|
|
1457
1457
|
};
|
|
1458
1458
|
return a.addEventListener("wheel", l, { passive: !1 }), () => a.removeEventListener("wheel", l);
|
|
1459
|
-
}, [St,
|
|
1459
|
+
}, [St, ut, Ge, nt, ge]);
|
|
1460
1460
|
const Ce = A({ lastDistance: null, lastCenter: null });
|
|
1461
1461
|
ae(() => {
|
|
1462
|
-
const a =
|
|
1462
|
+
const a = xe.current;
|
|
1463
1463
|
if (!a)
|
|
1464
1464
|
return;
|
|
1465
|
-
const l = (C, D) => Math.abs(C.clientX - D.clientX),
|
|
1465
|
+
const l = (C, D) => Math.abs(C.clientX - D.clientX), p = (C, D, P) => (C.clientX + D.clientX) / 2 - P.left, v = (C) => {
|
|
1466
1466
|
C.touches.length === 2 && (C.preventDefault(), Ce.current.lastDistance = l(C.touches[0], C.touches[1]), Ce.current.lastCenter = null);
|
|
1467
1467
|
}, d = (C) => {
|
|
1468
1468
|
var D;
|
|
1469
1469
|
if (C.touches.length === 2 && Ce.current.lastDistance !== null) {
|
|
1470
1470
|
C.preventDefault();
|
|
1471
|
-
const
|
|
1472
|
-
if (
|
|
1473
|
-
const se = Ce.current.lastDistance /
|
|
1471
|
+
const P = l(C.touches[0], C.touches[1]), F = a.getBoundingClientRect(), Z = p(C.touches[0], C.touches[1], F) / F.width;
|
|
1472
|
+
if (P !== 0 && Ce.current.lastDistance !== 0) {
|
|
1473
|
+
const se = Ce.current.lastDistance / P, q = L.current, G = q.visibleTimeEnd - q.visibleTimeStart;
|
|
1474
1474
|
let ee = G * se;
|
|
1475
|
-
ee = Math.max(
|
|
1476
|
-
const V = q.visibleTimeStart + G * Z,
|
|
1477
|
-
q.update({ visibleTimeStart:
|
|
1475
|
+
ee = Math.max(g, Math.min(H, ee));
|
|
1476
|
+
const V = q.visibleTimeStart + G * Z, R = V - ee * Z, M = V + ee * (1 - Z);
|
|
1477
|
+
q.update({ visibleTimeStart: R, visibleTimeEnd: M }), (D = lt.current) == null || D.updateBounds(R, M), O.markAllDirty(), vt(), Tt("zoom");
|
|
1478
1478
|
}
|
|
1479
|
-
Ce.current.lastDistance =
|
|
1479
|
+
Ce.current.lastDistance = P;
|
|
1480
1480
|
}
|
|
1481
1481
|
}, b = () => {
|
|
1482
1482
|
Ce.current.lastDistance = null, Ce.current.lastCenter = null;
|
|
@@ -1484,99 +1484,99 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1484
1484
|
return a.addEventListener("touchstart", v, { passive: !1 }), a.addEventListener("touchmove", d, { passive: !1 }), a.addEventListener("touchend", b), () => {
|
|
1485
1485
|
a.removeEventListener("touchstart", v), a.removeEventListener("touchmove", d), a.removeEventListener("touchend", b);
|
|
1486
1486
|
};
|
|
1487
|
-
}, [
|
|
1488
|
-
const
|
|
1489
|
-
var
|
|
1490
|
-
const l = a.currentTarget,
|
|
1491
|
-
if (gt.current = v,
|
|
1492
|
-
const
|
|
1493
|
-
if (!
|
|
1487
|
+
}, [O, vt, Tt]);
|
|
1488
|
+
const Ii = te((a) => {
|
|
1489
|
+
var P;
|
|
1490
|
+
const l = a.currentTarget, p = l.getBoundingClientRect(), v = a.clientX - p.left, d = a.clientY - p.top;
|
|
1491
|
+
if (gt.current = v, xt.current = { x: a.clientX, y: a.clientY }, de.current) {
|
|
1492
|
+
const F = a.clientX - de.current.startX, W = a.clientY - de.current.startY;
|
|
1493
|
+
if (!Oe.current && (Math.abs(F) >= zt || Math.abs(W) >= zt) && (Oe.current = !0, l.style.cursor = "grabbing", l.setPointerCapture(a.pointerId)), Oe.current) {
|
|
1494
1494
|
const Z = a.clientX - de.current.lastX, se = a.clientY - de.current.lastY;
|
|
1495
|
-
de.current.lastX = a.clientX, de.current.lastY = a.clientY, Math.abs(Z) > 0 && Ge(-Z), Math.abs(se) > 0 &&
|
|
1495
|
+
de.current.lastX = a.clientX, de.current.lastY = a.clientY, Math.abs(Z) > 0 && Ge(-Z), Math.abs(se) > 0 && ut(-se);
|
|
1496
1496
|
}
|
|
1497
1497
|
return;
|
|
1498
1498
|
}
|
|
1499
1499
|
if (ne.isPending()) {
|
|
1500
1500
|
if (ne.update(v, d), ne.isActive()) {
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1501
|
+
const F = ne.getState();
|
|
1502
|
+
if (F && F.mode === "move" && N.current.canChangeGroup) {
|
|
1503
|
+
const W = kt(d, L.current, N.current.groups);
|
|
1504
|
+
W && ne.setCurrentGroup(W.id);
|
|
1505
1505
|
}
|
|
1506
|
-
|
|
1506
|
+
O.markDirty("overlay");
|
|
1507
1507
|
}
|
|
1508
1508
|
return;
|
|
1509
1509
|
}
|
|
1510
|
-
N.current.showCursorLine &&
|
|
1510
|
+
N.current.showCursorLine && O.markDirty("overlay");
|
|
1511
1511
|
const b = N.current, C = Ze(v, d, L.current, b.intervalTree, b.layoutEngine, b.groups), D = C == null ? void 0 : C.id;
|
|
1512
|
-
if (D !==
|
|
1513
|
-
const
|
|
1514
|
-
l.style.cursor =
|
|
1512
|
+
if (D !== Le.current && (Le.current = D, O.markDirty("items"), (P = b.onItemHover) == null || P.call(b, D ?? null, a.nativeEvent)), C) {
|
|
1513
|
+
const F = Qt(v, C, L.current), W = Jt(C, F, b.canResize, b.canMove);
|
|
1514
|
+
l.style.cursor = W === "resize-left" || W === "resize-right" ? "col-resize" : W === "move" ? "grab" : "default";
|
|
1515
1515
|
} else
|
|
1516
1516
|
l.style.cursor = "default";
|
|
1517
|
-
}, [ne,
|
|
1518
|
-
const l = N.current,
|
|
1517
|
+
}, [ne, O, Ge, ut]), Di = te((a) => {
|
|
1518
|
+
const l = N.current, p = a.currentTarget.getBoundingClientRect(), v = a.clientX - p.left, d = a.clientY - p.top, b = Ze(v, d, L.current, l.intervalTree, l.layoutEngine, l.groups);
|
|
1519
1519
|
if (!b) {
|
|
1520
|
-
de.current = { startX: a.clientX, startY: a.clientY, lastX: a.clientX, lastY: a.clientY },
|
|
1520
|
+
de.current = { startX: a.clientX, startY: a.clientY, lastX: a.clientX, lastY: a.clientY }, Oe.current = !1;
|
|
1521
1521
|
return;
|
|
1522
1522
|
}
|
|
1523
|
-
const C =
|
|
1523
|
+
const C = Qt(v, b, L.current), D = Jt(b, C, l.canResize, l.canMove);
|
|
1524
1524
|
D && ne.startInteraction(b, D, v, d);
|
|
1525
|
-
}, [ne]),
|
|
1526
|
-
var C, D,
|
|
1525
|
+
}, [ne]), Oi = te((a) => {
|
|
1526
|
+
var C, D, P, F;
|
|
1527
1527
|
const l = a.currentTarget;
|
|
1528
1528
|
if (de.current) {
|
|
1529
|
-
const
|
|
1530
|
-
if (de.current = null,
|
|
1529
|
+
const W = Oe.current;
|
|
1530
|
+
if (de.current = null, Oe.current = !1, l.style.cursor = "default", W)
|
|
1531
1531
|
return;
|
|
1532
1532
|
}
|
|
1533
1533
|
if (ne.isActive()) {
|
|
1534
|
-
const
|
|
1535
|
-
if (
|
|
1534
|
+
const W = ne.getState(), Z = L.current, se = Z.canvasWidth / (Z.visibleTimeEnd - Z.visibleTimeStart);
|
|
1535
|
+
if (W) {
|
|
1536
1536
|
const q = N.current.moveResizeValidator, G = N.current;
|
|
1537
|
-
if (
|
|
1538
|
-
const ee = fi(
|
|
1537
|
+
if (W.mode === "move") {
|
|
1538
|
+
const ee = fi(W, Z, G), V = ne.endMove(se);
|
|
1539
1539
|
if (V) {
|
|
1540
|
-
const
|
|
1541
|
-
(C = G.onItemMove) == null || C.call(G,
|
|
1540
|
+
const R = q ? q("move", W.item.id, ee) : ee, M = G.hierarchyEngine.getMoveDelta(W.item.id, R);
|
|
1541
|
+
(C = G.onItemMove) == null || C.call(G, W.item.id, R, V.newGroupId, M.length > 0 ? M : void 0);
|
|
1542
1542
|
}
|
|
1543
1543
|
} else {
|
|
1544
|
-
const { edge: ee, time: V } = hi(
|
|
1544
|
+
const { edge: ee, time: V } = hi(W, Z, G);
|
|
1545
1545
|
if (ne.endResize(se)) {
|
|
1546
|
-
const M = q ? q("resize",
|
|
1547
|
-
(D = G.onItemResize) == null || D.call(G,
|
|
1546
|
+
const M = q ? q("resize", W.item.id, V, ee) : V;
|
|
1547
|
+
(D = G.onItemResize) == null || D.call(G, W.item.id, M, ee);
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
1550
|
}
|
|
1551
|
-
l.style.cursor = "default",
|
|
1551
|
+
l.style.cursor = "default", O.markDirty("overlay");
|
|
1552
1552
|
return;
|
|
1553
1553
|
}
|
|
1554
1554
|
ne.isPending() && ne.cancel();
|
|
1555
|
-
const
|
|
1556
|
-
b && ((
|
|
1557
|
-
}, [ne,
|
|
1555
|
+
const p = l.getBoundingClientRect(), v = a.clientX - p.left, d = a.clientY - p.top, b = Ze(v, d, L.current, N.current.intervalTree, N.current.layoutEngine, N.current.groups);
|
|
1556
|
+
b && ((F = (P = N.current).onItemClick) == null || F.call(P, b.id, a.nativeEvent));
|
|
1557
|
+
}, [ne, O]), Ri = te((a) => {
|
|
1558
1558
|
var C, D;
|
|
1559
|
-
const l = a.currentTarget.getBoundingClientRect(),
|
|
1559
|
+
const l = a.currentTarget.getBoundingClientRect(), p = a.clientX - l.left, v = a.clientY - l.top, d = N.current, b = Ze(p, v, L.current, d.intervalTree, d.layoutEngine, d.groups);
|
|
1560
1560
|
if (b)
|
|
1561
1561
|
(C = d.onItemDoubleClick) == null || C.call(d, b.id, a.nativeEvent);
|
|
1562
1562
|
else {
|
|
1563
|
-
const
|
|
1564
|
-
|
|
1563
|
+
const P = kt(v, L.current, d.groups), F = L.current.xToTime(p);
|
|
1564
|
+
P && ((D = d.onCanvasDoubleClick) == null || D.call(d, P.id, F));
|
|
1565
1565
|
}
|
|
1566
|
-
}, []),
|
|
1566
|
+
}, []), Pi = te((a) => {
|
|
1567
1567
|
var C, D;
|
|
1568
1568
|
a.preventDefault();
|
|
1569
|
-
const l = a.currentTarget.getBoundingClientRect(),
|
|
1569
|
+
const l = a.currentTarget.getBoundingClientRect(), p = a.clientX - l.left, v = a.clientY - l.top, d = N.current, b = Ze(p, v, L.current, d.intervalTree, d.layoutEngine, d.groups);
|
|
1570
1570
|
if (b)
|
|
1571
1571
|
(C = d.onItemContextMenu) == null || C.call(d, b.id, a.nativeEvent);
|
|
1572
1572
|
else {
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1573
|
+
const P = kt(v, L.current, d.groups), F = L.current.xToTime(p);
|
|
1574
|
+
P && ((D = d.onCanvasContextMenu) == null || D.call(d, P.id, F, a.nativeEvent));
|
|
1575
1575
|
}
|
|
1576
|
-
}, []),
|
|
1576
|
+
}, []), Yi = te(() => {
|
|
1577
1577
|
var a, l;
|
|
1578
|
-
de.current = null,
|
|
1579
|
-
}, [
|
|
1578
|
+
de.current = null, Oe.current = !1, gt.current = null, xe.current && (xe.current.style.cursor = "default"), Le.current !== void 0 && (Le.current = void 0, O.markDirty("items"), (l = (a = N.current).onItemHover) == null || l.call(a, null, new PointerEvent("pointerleave"))), N.current.showCursorLine && O.markDirty("overlay");
|
|
1579
|
+
}, [O]), $i = Q(() => {
|
|
1580
1580
|
const a = [];
|
|
1581
1581
|
return ce.Children.forEach(we, (l) => {
|
|
1582
1582
|
var v;
|
|
@@ -1585,59 +1585,59 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1585
1585
|
if (((v = l.type) == null ? void 0 : v.displayName) === "TimelineHeaders") {
|
|
1586
1586
|
const d = l.props;
|
|
1587
1587
|
a.push(ce.cloneElement(l, {
|
|
1588
|
-
visibleTimeStart: d.visibleTimeStart ??
|
|
1588
|
+
visibleTimeStart: d.visibleTimeStart ?? Lt,
|
|
1589
1589
|
visibleTimeEnd: d.visibleTimeEnd ?? At,
|
|
1590
1590
|
canvasWidth: d.canvasWidth ?? ke,
|
|
1591
1591
|
sidebarWidth: d.sidebarWidth ?? c,
|
|
1592
|
-
theme: d.theme ??
|
|
1593
|
-
timezone: d.timezone ??
|
|
1592
|
+
theme: d.theme ?? Te,
|
|
1593
|
+
timezone: d.timezone ?? it,
|
|
1594
1594
|
onZoomToInterval: d.onZoomToInterval ?? ((b, C) => {
|
|
1595
|
-
var D,
|
|
1596
|
-
L.current.update({ visibleTimeStart: b, visibleTimeEnd: C }),
|
|
1595
|
+
var D, P, F, W;
|
|
1596
|
+
L.current.update({ visibleTimeStart: b, visibleTimeEnd: C }), O.markAllDirty(), $e(), (P = (D = N.current).onTimeChange) == null || P.call(D, b, C), (W = (F = N.current).onZoom) == null || W.call(F, b, C);
|
|
1597
1597
|
})
|
|
1598
1598
|
}));
|
|
1599
1599
|
}
|
|
1600
1600
|
}), a;
|
|
1601
|
-
}, [we,
|
|
1601
|
+
}, [we, Lt, At, ke, c, Te, it, O, $e]), Kt = A(!1);
|
|
1602
1602
|
ae(() => {
|
|
1603
|
-
Kt.current || (Kt.current = !0,
|
|
1604
|
-
}, [
|
|
1605
|
-
captureToCanvas({ timeStart: a, timeEnd: l, scale:
|
|
1606
|
-
const d = N.current, b = 28, C = b * 3, D = d.groups.map((j) => d.layoutEngine.getGroupHeight(j.id)),
|
|
1603
|
+
Kt.current || (Kt.current = !0, O.markAllDirty());
|
|
1604
|
+
}, [O]), Wi(i, () => ({
|
|
1605
|
+
captureToCanvas({ timeStart: a, timeEnd: l, scale: p, sidebarWidth: v }) {
|
|
1606
|
+
const d = N.current, b = 28, C = b * 3, D = d.groups.map((j) => d.layoutEngine.getGroupHeight(j.id)), P = [0];
|
|
1607
1607
|
for (let j = 0; j < D.length; j++)
|
|
1608
|
-
|
|
1609
|
-
const
|
|
1608
|
+
P.push(P[j] + D[j]);
|
|
1609
|
+
const F = P[D.length], W = L.current, Z = d.canvasWidth / (W.visibleTimeEnd - W.visibleTimeStart), se = l - a, q = Math.max(d.canvasWidth, Math.round(se * Z)), G = (v + q) * p, ee = (C + F) * p, V = document.createElement("canvas");
|
|
1610
1610
|
V.width = G, V.height = ee;
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1611
|
+
const R = V.getContext("2d");
|
|
1612
|
+
R.scale(p, p);
|
|
1613
1613
|
for (let j = 0; j < d.groups.length; j++) {
|
|
1614
|
-
const
|
|
1614
|
+
const Se = d.groups[j], Me = D[j], z = C + P[j];
|
|
1615
1615
|
if (d.rowStyle) {
|
|
1616
|
-
const ue = d.rowStyle(
|
|
1617
|
-
ue != null && ue.backgroundColor && (
|
|
1616
|
+
const ue = d.rowStyle(Se);
|
|
1617
|
+
ue != null && ue.backgroundColor && (R.fillStyle = ue.backgroundColor, R.fillRect(0, z, v, Me));
|
|
1618
1618
|
}
|
|
1619
|
-
const le =
|
|
1619
|
+
const le = Se.type;
|
|
1620
1620
|
let oe = "400", K = 8;
|
|
1621
|
-
le === "project" ? oe = "700" : le === "CAG" ? oe = "600" : le === "CA" && (oe = "400", K = 24),
|
|
1621
|
+
le === "project" ? oe = "700" : le === "CAG" ? oe = "600" : le === "CA" && (oe = "400", K = 24), R.fillStyle = "#111", R.font = `${oe} 12px sans-serif`, R.textBaseline = "middle", R.fillText(Se.title, K, z + Me / 2, v - K - 4);
|
|
1622
1622
|
}
|
|
1623
|
-
const M = (j,
|
|
1623
|
+
const M = (j, Se, Me) => {
|
|
1624
1624
|
var oe, K;
|
|
1625
|
-
|
|
1626
|
-
let z = he(a, d.timezone).startOf(
|
|
1627
|
-
z.valueOf() < a && (z = z.add(1,
|
|
1625
|
+
R.fillStyle = ((oe = d.theme.header) == null ? void 0 : oe.bg) ?? "#f5f5f5", R.fillRect(v, j, q, b), R.strokeStyle = ((K = d.theme.grid) == null ? void 0 : K.line) ?? "#e0e0e0", R.lineWidth = 1, R.strokeRect(v, j, q, b);
|
|
1626
|
+
let z = he(a, d.timezone).startOf(Me);
|
|
1627
|
+
z.valueOf() < a && (z = z.add(1, Me));
|
|
1628
1628
|
const le = q / (l - a);
|
|
1629
1629
|
for (; z.valueOf() < l; ) {
|
|
1630
|
-
const ue = z.add(1,
|
|
1631
|
-
|
|
1630
|
+
const ue = z.add(1, Me), fe = v + (z.valueOf() - a) * le, pe = v + (Math.min(ue.valueOf(), l) - a) * le - fe;
|
|
1631
|
+
R.beginPath(), R.moveTo(fe, j), R.lineTo(fe, j + b), R.stroke(), R.fillStyle = "#333", R.font = "600 11px sans-serif", R.textBaseline = "middle", R.textAlign = "center", R.fillText(Se(z), fe + pe / 2, j + b / 2, pe - 4), z = ue;
|
|
1632
1632
|
}
|
|
1633
|
-
|
|
1633
|
+
R.textAlign = "start";
|
|
1634
1634
|
};
|
|
1635
1635
|
M(0, (j) => j.format("YYYY"), "year"), M(b, (j) => j.format("MM"), "month"), M(b * 2, (j) => String(j.isoWeek()), "week");
|
|
1636
1636
|
const We = new wt({
|
|
1637
1637
|
visibleTimeStart: a,
|
|
1638
1638
|
visibleTimeEnd: l,
|
|
1639
1639
|
canvasWidth: q,
|
|
1640
|
-
canvasHeight:
|
|
1640
|
+
canvasHeight: F,
|
|
1641
1641
|
sidebarWidth: 0,
|
|
1642
1642
|
lineHeight: d.lineHeight,
|
|
1643
1643
|
groupCount: d.groups.length,
|
|
@@ -1645,35 +1645,35 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1645
1645
|
scrollTop: 0,
|
|
1646
1646
|
groupHeights: D
|
|
1647
1647
|
});
|
|
1648
|
-
return
|
|
1648
|
+
return R.save(), R.translate(v, C), R.beginPath(), R.rect(0, 0, q, F), R.clip(), Xe.draw(R, We, d.groups, d.theme, d.dayStyle, d.rowStyle, d.highlights, d.timezone), Fe.draw(R, We, d.groups, d.items, d.intervalTree, d.layoutEngine, d.itemRenderer, d.groupRenderer, d.theme, d.selected, void 0, d.dependencies, d.summaryRenderer, d.hierarchyEngine), _e.draw(R, We, d.theme, {
|
|
1649
1649
|
cursorX: null,
|
|
1650
1650
|
snapX: null,
|
|
1651
1651
|
markers: Ne.current,
|
|
1652
1652
|
interaction: null
|
|
1653
|
-
}),
|
|
1653
|
+
}), R.restore(), V;
|
|
1654
1654
|
}
|
|
1655
1655
|
}), [Xe, Fe, _e]), ae(() => {
|
|
1656
1656
|
const a = {
|
|
1657
|
-
captureToCanvas({ timeStart: l, timeEnd:
|
|
1658
|
-
var
|
|
1659
|
-
const b = N.current, C = 28, D = C * 3,
|
|
1660
|
-
for (let z = 0; z <
|
|
1661
|
-
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1664
|
-
const M =
|
|
1657
|
+
captureToCanvas({ timeStart: l, timeEnd: p, scale: v, sidebarWidth: d }) {
|
|
1658
|
+
var Me;
|
|
1659
|
+
const b = N.current, C = 28, D = C * 3, P = b.groups.map((z) => b.layoutEngine.getGroupHeight(z.id)), F = [0];
|
|
1660
|
+
for (let z = 0; z < P.length; z++)
|
|
1661
|
+
F.push(F[z] + P[z]);
|
|
1662
|
+
const W = F[P.length], Z = L.current, se = b.canvasWidth / (Z.visibleTimeEnd - Z.visibleTimeStart), q = p - l, G = Math.max(b.canvasWidth, Math.round(q * se)), ee = d + G, V = D + W, R = document.createElement("canvas");
|
|
1663
|
+
R.width = ee * v, R.height = V * v;
|
|
1664
|
+
const M = R.getContext("2d");
|
|
1665
1665
|
M.scale(v, v), M.fillStyle = "#FFFFFF", M.fillRect(0, 0, ee, V), M.save(), M.beginPath(), M.rect(0, 0, d, V), M.clip(), M.fillStyle = "#F9FAFB", M.fillRect(0, 0, d, D), M.strokeStyle = "#E5E7EB", M.lineWidth = 1, M.strokeRect(0, 0, d, D);
|
|
1666
1666
|
for (let z = 0; z < b.groups.length; z++) {
|
|
1667
|
-
const le = b.groups[z], oe =
|
|
1667
|
+
const le = b.groups[z], oe = P[z], K = D + F[z], ue = (Me = b.rowStyle) == null ? void 0 : Me.call(b, le);
|
|
1668
1668
|
M.fillStyle = (ue == null ? void 0 : ue.backgroundColor) ?? (z % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), M.fillRect(0, K, d, oe), M.strokeStyle = "#E5E5E5", M.lineWidth = 0.5, M.beginPath(), M.moveTo(0, K + oe), M.lineTo(d, K + oe), M.stroke();
|
|
1669
1669
|
const fe = le.type ?? "";
|
|
1670
|
-
let
|
|
1671
|
-
fe === "project" ? (pe = "700", Pe = 12) : fe === "control_area_group" ? pe = "600" : fe === "control_area" && (
|
|
1672
|
-
const
|
|
1673
|
-
M.fillText(
|
|
1670
|
+
let Re = 8, pe = "400", Pe = 11;
|
|
1671
|
+
fe === "project" ? (pe = "700", Pe = 12) : fe === "control_area_group" ? pe = "600" : fe === "control_area" && (Re = 24), M.fillStyle = "#374151", M.font = `${pe} ${Pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, M.textBaseline = "middle";
|
|
1672
|
+
const Fi = typeof le.title == "string" ? le.title : String(le.title);
|
|
1673
|
+
M.fillText(Fi, Re, K + oe / 2, d - Re - 8);
|
|
1674
1674
|
}
|
|
1675
1675
|
M.strokeStyle = "#E5E7EB", M.lineWidth = 1, M.beginPath(), M.moveTo(d, 0), M.lineTo(d, V), M.stroke(), M.restore(), M.save(), M.beginPath(), M.rect(d, 0, G, D), M.clip();
|
|
1676
|
-
const We =
|
|
1676
|
+
const We = p - l, j = [
|
|
1677
1677
|
{ unit: "year", row: 0 },
|
|
1678
1678
|
{ unit: "month", row: 1 },
|
|
1679
1679
|
{ unit: "week", row: 2 }
|
|
@@ -1682,40 +1682,40 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1682
1682
|
const oe = le * C;
|
|
1683
1683
|
M.fillStyle = "#F9FAFB", M.fillRect(d, oe, G, C);
|
|
1684
1684
|
let K = he(l, b.timezone).startOf(z);
|
|
1685
|
-
const ue = he(
|
|
1685
|
+
const ue = he(p, b.timezone).add(1, z);
|
|
1686
1686
|
for (; K.isBefore(ue); ) {
|
|
1687
|
-
const fe = K.add(1, z),
|
|
1688
|
-
M.strokeStyle = "#E5E7EB", M.lineWidth = 0.5, M.strokeRect(
|
|
1687
|
+
const fe = K.add(1, z), Re = d + (K.valueOf() - l) / We * G, pe = (fe.valueOf() - K.valueOf()) / We * G;
|
|
1688
|
+
M.strokeStyle = "#E5E7EB", M.lineWidth = 0.5, M.strokeRect(Re, oe, pe, C);
|
|
1689
1689
|
let Pe;
|
|
1690
|
-
z === "year" ? Pe = K.format("YYYY") : z === "month" ? Pe = K.format("MM") : Pe = `${K.week()}`, M.fillStyle = "#6c737f", M.font = z === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', M.textBaseline = "middle", M.textAlign = "center", pe > 20 && M.fillText(Pe,
|
|
1690
|
+
z === "year" ? Pe = K.format("YYYY") : z === "month" ? Pe = K.format("MM") : Pe = `${K.week()}`, M.fillStyle = "#6c737f", M.font = z === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', M.textBaseline = "middle", M.textAlign = "center", pe > 20 && M.fillText(Pe, Re + pe / 2, oe + C / 2), K = fe;
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
|
-
M.textAlign = "start", M.restore(), M.save(), M.beginPath(), M.rect(d, D, G,
|
|
1694
|
-
const
|
|
1693
|
+
M.textAlign = "start", M.restore(), M.save(), M.beginPath(), M.rect(d, D, G, W), M.clip(), M.translate(d, D);
|
|
1694
|
+
const Se = new wt({
|
|
1695
1695
|
visibleTimeStart: l,
|
|
1696
|
-
visibleTimeEnd:
|
|
1696
|
+
visibleTimeEnd: p,
|
|
1697
1697
|
canvasWidth: G,
|
|
1698
|
-
canvasHeight:
|
|
1698
|
+
canvasHeight: W,
|
|
1699
1699
|
sidebarWidth: 0,
|
|
1700
1700
|
lineHeight: b.lineHeight,
|
|
1701
1701
|
groupCount: b.groups.length,
|
|
1702
1702
|
buffer: 1,
|
|
1703
1703
|
scrollTop: 0,
|
|
1704
|
-
groupHeights:
|
|
1704
|
+
groupHeights: P
|
|
1705
1705
|
});
|
|
1706
|
-
return Xe.draw(M,
|
|
1706
|
+
return Xe.draw(M, Se, b.groups, b.theme, b.dayStyle, b.rowStyle, b.highlights, b.timezone), Fe.draw(M, Se, b.groups, b.items, b.intervalTree, b.layoutEngine, b.itemRenderer, b.groupRenderer, b.theme, b.selected, void 0, b.dependencies, b.summaryRenderer, b.hierarchyEngine), _e.draw(M, Se, b.theme, { cursorX: null, markers: Ne.current }), M.restore(), R;
|
|
1707
1707
|
}
|
|
1708
1708
|
};
|
|
1709
|
-
|
|
1710
|
-
}, [
|
|
1711
|
-
const
|
|
1709
|
+
tt == null || tt(a);
|
|
1710
|
+
}, [tt, Xe, Fe, _e]);
|
|
1711
|
+
const Xi = {
|
|
1712
1712
|
position: "relative",
|
|
1713
1713
|
width: ke,
|
|
1714
1714
|
height: ge,
|
|
1715
1715
|
overflow: "hidden",
|
|
1716
1716
|
cursor: "default"
|
|
1717
1717
|
}, Mt = { position: "absolute", top: 0, left: 0 };
|
|
1718
|
-
return Ve("div", { ref: _t, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [
|
|
1718
|
+
return Ve("div", { ref: _t, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [vi ? Ve("div", { style: {
|
|
1719
1719
|
position: "absolute",
|
|
1720
1720
|
top: 0,
|
|
1721
1721
|
left: 0,
|
|
@@ -1729,27 +1729,27 @@ const ai = 32, kn = ce.memo(Fi(function(e, i) {
|
|
|
1729
1729
|
borderBottomRightRadius: 4,
|
|
1730
1730
|
pointerEvents: "none",
|
|
1731
1731
|
userSelect: "none"
|
|
1732
|
-
}, children: ["v", "0.10.
|
|
1733
|
-
L.current.update({ scrollTop: a }),
|
|
1734
|
-
} }), Ve("div", { ref:
|
|
1735
|
-
L.current.update({ scrollTop: a }),
|
|
1732
|
+
}, children: ["v", "0.10.1", " · ", "14:58:01"] }) : null, $i, Ve("div", { ref: Wt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [re(ri, { groups: n, width: c, lineHeight: s, groupHeights: De, scrollTop: Nt, canvasHeight: ge, theme: Te, groupRenderer: B, onScroll: (a) => {
|
|
1733
|
+
L.current.update({ scrollTop: a }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), rt(a);
|
|
1734
|
+
} }), Ve("div", { ref: xe, style: Xi, onPointerMove: Ii, onPointerDown: Di, onPointerUp: Oi, onDoubleClick: Ri, onContextMenu: Pi, onPointerLeave: Yi, children: [re("canvas", { ref: $t, style: { ...Mt, zIndex: 0 } }), re("canvas", { ref: Xt, style: { ...Mt, zIndex: 1 } }), re("canvas", { ref: Ft, style: { ...Mt, zIndex: 2 } })] }), ft && Pt ? re(ri, { groups: n, width: ft, lineHeight: s, groupHeights: De, scrollTop: Nt, canvasHeight: ge, theme: Te, groupRenderer: Pt, onScroll: (a) => {
|
|
1735
|
+
L.current.update({ scrollTop: a }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), rt(a);
|
|
1736
1736
|
} }) : null] })] });
|
|
1737
1737
|
}));
|
|
1738
|
-
function
|
|
1739
|
-
const
|
|
1738
|
+
function fn({ children: t, theme: e, className: i, classNames: n, style: r, visibleTimeStart: u, visibleTimeEnd: o, canvasWidth: c, sidebarWidth: s = 0, onZoomToInterval: h, timezone: S }) {
|
|
1739
|
+
const m = ce.Children.map(t, (f) => {
|
|
1740
1740
|
var y;
|
|
1741
1741
|
if (!ce.isValidElement(f))
|
|
1742
1742
|
return f;
|
|
1743
1743
|
if (((y = f.type) == null ? void 0 : y.displayName) === "DateHeader") {
|
|
1744
|
-
const
|
|
1745
|
-
visibleTimeStart:
|
|
1746
|
-
visibleTimeEnd:
|
|
1747
|
-
canvasWidth:
|
|
1748
|
-
theme:
|
|
1749
|
-
onZoomToInterval:
|
|
1750
|
-
timezone:
|
|
1744
|
+
const g = f.props, H = ce.cloneElement(f, {
|
|
1745
|
+
visibleTimeStart: g.visibleTimeStart ?? u,
|
|
1746
|
+
visibleTimeEnd: g.visibleTimeEnd ?? o,
|
|
1747
|
+
canvasWidth: g.canvasWidth ?? c,
|
|
1748
|
+
theme: g.theme ?? e,
|
|
1749
|
+
onZoomToInterval: g.onIntervalClick ?? g.onZoomToInterval ?? h,
|
|
1750
|
+
timezone: g.timezone ?? S
|
|
1751
1751
|
});
|
|
1752
|
-
return Ve("div", { style: { display: "flex" }, children: [re("div", { style: { width: s, flexShrink: 0 } }), re("div", { style: { flex: 1, overflow: "hidden" }, children:
|
|
1752
|
+
return Ve("div", { style: { display: "flex" }, children: [re("div", { style: { width: s, flexShrink: 0 } }), re("div", { style: { flex: 1, overflow: "hidden" }, children: H })] });
|
|
1753
1753
|
}
|
|
1754
1754
|
return f;
|
|
1755
1755
|
});
|
|
@@ -1763,64 +1763,95 @@ function dn({ children: t, theme: e, className: i, classNames: n, style: r, visi
|
|
|
1763
1763
|
borderTop: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
|
|
1764
1764
|
borderBottom: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
|
|
1765
1765
|
...r
|
|
1766
|
-
}, children:
|
|
1766
|
+
}, children: m });
|
|
1767
1767
|
}
|
|
1768
|
-
|
|
1768
|
+
fn.displayName = "TimelineHeaders";
|
|
1769
1769
|
var gi = { exports: {} };
|
|
1770
1770
|
(function(t, e) {
|
|
1771
1771
|
(function(i, n) {
|
|
1772
1772
|
t.exports = n();
|
|
1773
|
-
})(
|
|
1773
|
+
})(Qe, function() {
|
|
1774
|
+
var i = "month", n = "quarter";
|
|
1775
|
+
return function(r, u) {
|
|
1776
|
+
var o = u.prototype;
|
|
1777
|
+
o.quarter = function(h) {
|
|
1778
|
+
return this.$utils().u(h) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (h - 1));
|
|
1779
|
+
};
|
|
1780
|
+
var c = o.add;
|
|
1781
|
+
o.add = function(h, S) {
|
|
1782
|
+
return h = Number(h), this.$utils().p(S) === n ? this.add(3 * h, i) : c.bind(this)(h, S);
|
|
1783
|
+
};
|
|
1784
|
+
var s = o.startOf;
|
|
1785
|
+
o.startOf = function(h, S) {
|
|
1786
|
+
var m = this.$utils(), f = !!m.u(S) || S;
|
|
1787
|
+
if (m.p(h) === n) {
|
|
1788
|
+
var T = this.quarter() - 1;
|
|
1789
|
+
return f ? this.month(3 * T).startOf(i).startOf("day") : this.month(3 * T + 2).endOf(i).endOf("day");
|
|
1790
|
+
}
|
|
1791
|
+
return s.bind(this)(h, S);
|
|
1792
|
+
};
|
|
1793
|
+
};
|
|
1794
|
+
});
|
|
1795
|
+
})(gi);
|
|
1796
|
+
var hn = gi.exports;
|
|
1797
|
+
const mn = /* @__PURE__ */ Je(hn);
|
|
1798
|
+
var pi = { exports: {} };
|
|
1799
|
+
(function(t, e) {
|
|
1800
|
+
(function(i, n) {
|
|
1801
|
+
t.exports = n();
|
|
1802
|
+
})(Qe, function() {
|
|
1774
1803
|
var i = "week", n = "year";
|
|
1775
1804
|
return function(r, u, o) {
|
|
1776
1805
|
var c = u.prototype;
|
|
1777
1806
|
c.week = function(s) {
|
|
1778
1807
|
if (s === void 0 && (s = null), s !== null) return this.add(7 * (s - this.week()), "day");
|
|
1779
|
-
var
|
|
1808
|
+
var h = this.$locale().yearStart || 1;
|
|
1780
1809
|
if (this.month() === 11 && this.date() > 25) {
|
|
1781
|
-
var
|
|
1782
|
-
if (
|
|
1810
|
+
var S = o(this).startOf(n).add(1, n).date(h), m = o(this).endOf(i);
|
|
1811
|
+
if (S.isBefore(m)) return 1;
|
|
1783
1812
|
}
|
|
1784
|
-
var f = o(this).startOf(n).date(
|
|
1785
|
-
return
|
|
1813
|
+
var f = o(this).startOf(n).date(h).startOf(i).subtract(1, "millisecond"), T = this.diff(f, i, !0);
|
|
1814
|
+
return T < 0 ? o(this).startOf("week").week() : Math.ceil(T);
|
|
1786
1815
|
}, c.weeks = function(s) {
|
|
1787
1816
|
return s === void 0 && (s = null), this.week(s);
|
|
1788
1817
|
};
|
|
1789
1818
|
};
|
|
1790
1819
|
});
|
|
1791
|
-
})(
|
|
1792
|
-
var
|
|
1793
|
-
const
|
|
1794
|
-
|
|
1795
|
-
|
|
1820
|
+
})(pi);
|
|
1821
|
+
var gn = pi.exports;
|
|
1822
|
+
const pn = /* @__PURE__ */ Je(gn);
|
|
1823
|
+
ve.extend(pn);
|
|
1824
|
+
ve.extend(mn);
|
|
1825
|
+
const vn = {
|
|
1796
1826
|
year: 30,
|
|
1827
|
+
quarter: 30,
|
|
1797
1828
|
month: 30,
|
|
1798
1829
|
week: 20,
|
|
1799
1830
|
day: 15,
|
|
1800
1831
|
hour: 30
|
|
1801
1832
|
};
|
|
1802
|
-
function
|
|
1803
|
-
const f =
|
|
1833
|
+
function bn({ unit: t, visibleTimeStart: e = 0, visibleTimeEnd: i = 0, canvasWidth: n = 0, theme: r, height: u = 28, className: o, labelFormat: c, onIntervalClick: s, minCellWidth: h, onZoomToInterval: S, timezone: m }) {
|
|
1834
|
+
const f = Q(() => {
|
|
1804
1835
|
if (!e || !i || !n)
|
|
1805
1836
|
return [];
|
|
1806
|
-
const y = i - e,
|
|
1807
|
-
if (
|
|
1808
|
-
const
|
|
1809
|
-
if ((
|
|
1837
|
+
const y = i - e, g = t, H = h ?? vn[t];
|
|
1838
|
+
if (H > 0) {
|
|
1839
|
+
const E = he(e, m).startOf(t);
|
|
1840
|
+
if ((E.add(1, g).valueOf() - E.valueOf()) / y * n < H)
|
|
1810
1841
|
return [];
|
|
1811
1842
|
}
|
|
1812
|
-
const
|
|
1813
|
-
let
|
|
1814
|
-
const
|
|
1815
|
-
for (;
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1843
|
+
const Y = [];
|
|
1844
|
+
let $ = he(e, m).startOf(t).subtract(1, g);
|
|
1845
|
+
const w = he(i, m).add(2, g).valueOf();
|
|
1846
|
+
for (; $.valueOf() < w; ) {
|
|
1847
|
+
const E = $.add(1, g), k = $.valueOf(), X = E.valueOf(), B = (k - e) / y * n, I = (X - k) / y * n, x = yn($, E, t, c);
|
|
1848
|
+
Y.push({ start: k, end: X, label: x, left: B, width: I }), $ = E;
|
|
1818
1849
|
}
|
|
1819
|
-
return
|
|
1820
|
-
}, [e, i, n, t, c,
|
|
1821
|
-
s ? s(y,
|
|
1822
|
-
}, [s,
|
|
1823
|
-
return f.length === 0 ? null : re("div", { style: { display: "flex", position: "relative", height: u, overflow: "hidden" }, children: f.map((y) => re("div", { className: o, onClick: () =>
|
|
1850
|
+
return Y;
|
|
1851
|
+
}, [e, i, n, t, c, h, m]), T = te((y, g) => {
|
|
1852
|
+
s ? s(y, g) : S && S(y, g);
|
|
1853
|
+
}, [s, S]);
|
|
1854
|
+
return f.length === 0 ? null : re("div", { style: { display: "flex", position: "relative", height: u, overflow: "hidden" }, children: f.map((y) => re("div", { className: o, onClick: () => T(y.start, y.end), style: {
|
|
1824
1855
|
position: "absolute",
|
|
1825
1856
|
left: y.left,
|
|
1826
1857
|
width: y.width,
|
|
@@ -1841,14 +1872,16 @@ function gn({ unit: t, visibleTimeStart: e = 0, visibleTimeEnd: i = 0, canvasWid
|
|
|
1841
1872
|
boxSizing: "border-box"
|
|
1842
1873
|
}, children: re("span", { children: y.label }) }, y.start)) });
|
|
1843
1874
|
}
|
|
1844
|
-
|
|
1845
|
-
function
|
|
1846
|
-
return typeof n == "function" ? n(t.toDate(), e.toDate(), i) : typeof n == "string" ? t.format(n) :
|
|
1875
|
+
bn.displayName = "DateHeader";
|
|
1876
|
+
function yn(t, e, i, n, r) {
|
|
1877
|
+
return typeof n == "function" ? n(t.toDate(), e.toDate(), i) : typeof n == "string" ? t.format(n) : Tn(t, i);
|
|
1847
1878
|
}
|
|
1848
|
-
function
|
|
1879
|
+
function Tn(t, e) {
|
|
1849
1880
|
switch (e) {
|
|
1850
1881
|
case "year":
|
|
1851
1882
|
return t.format("YYYY");
|
|
1883
|
+
case "quarter":
|
|
1884
|
+
return `Q${t.quarter()} ${t.format("YYYY")}`;
|
|
1852
1885
|
case "month":
|
|
1853
1886
|
return t.format("MM");
|
|
1854
1887
|
case "week":
|
|
@@ -1859,24 +1892,24 @@ function vn(t, e) {
|
|
|
1859
1892
|
return t.format("HH:mm");
|
|
1860
1893
|
}
|
|
1861
1894
|
}
|
|
1862
|
-
function
|
|
1895
|
+
function Sn({ width: t, children: e, style: i }) {
|
|
1863
1896
|
const n = () => ({ style: { width: t, ...i } });
|
|
1864
1897
|
return e ? re(li, { children: e({ getRootProps: n }) }) : re("div", { style: { width: t } });
|
|
1865
1898
|
}
|
|
1866
|
-
|
|
1867
|
-
function
|
|
1899
|
+
Sn.displayName = "SidebarHeader";
|
|
1900
|
+
function Mn({ children: t }) {
|
|
1868
1901
|
return re(li, { children: t });
|
|
1869
1902
|
}
|
|
1870
|
-
|
|
1903
|
+
Mn.displayName = "CustomHeader";
|
|
1871
1904
|
export {
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1905
|
+
Hn as CanvasTimeline,
|
|
1906
|
+
Mn as CustomHeader,
|
|
1907
|
+
cn as CustomMarker,
|
|
1875
1908
|
Ee as DEFAULT_THEME,
|
|
1876
|
-
|
|
1909
|
+
bn as DateHeader,
|
|
1877
1910
|
Li as HierarchyEngine,
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1911
|
+
Sn as SidebarHeader,
|
|
1912
|
+
fn as TimelineHeaders,
|
|
1913
|
+
ln as TodayMarker
|
|
1881
1914
|
};
|
|
1882
1915
|
//# sourceMappingURL=canvas-timeline.es.js.map
|