@taskctrl/canvas-timeline 0.7.0 → 0.8.0
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,6 +1,6 @@
|
|
|
1
|
-
import { jsx as le, jsxs as Ve, Fragment as
|
|
2
|
-
import me, { useRef as U, useMemo as ee, useCallback as oe, useEffect as ce, forwardRef as
|
|
3
|
-
import { flushSync as
|
|
1
|
+
import { jsx as le, jsxs as Ve, Fragment as ti } from "react/jsx-runtime";
|
|
2
|
+
import me, { useRef as U, useMemo as ee, useCallback as oe, useEffect as ce, forwardRef as Hi, useState as Ze, useImperativeHandle as Di } from "react";
|
|
3
|
+
import { flushSync as Ii } from "react-dom";
|
|
4
4
|
import We from "dayjs";
|
|
5
5
|
const He = {
|
|
6
6
|
primary: "#269bf7",
|
|
@@ -143,7 +143,7 @@ class yt {
|
|
|
143
143
|
return this.groupYOffsets[this.groupCount] ?? 0;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
class
|
|
146
|
+
class Ri {
|
|
147
147
|
constructor() {
|
|
148
148
|
Object.defineProperty(this, "root", {
|
|
149
149
|
enumerable: !0,
|
|
@@ -188,7 +188,7 @@ class Ii {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
class
|
|
191
|
+
class Oi {
|
|
192
192
|
constructor(e, t) {
|
|
193
193
|
Object.defineProperty(this, "lineHeight", {
|
|
194
194
|
enumerable: !0,
|
|
@@ -254,16 +254,16 @@ class Ri {
|
|
|
254
254
|
for (const p of e)
|
|
255
255
|
t.isParent(p.id) ? c.push(p) : s.push(p);
|
|
256
256
|
s.sort((p, f) => {
|
|
257
|
-
const
|
|
258
|
-
return
|
|
257
|
+
const w = p.start_time - f.start_time;
|
|
258
|
+
return w !== 0 ? w : f.end_time - f.start_time - (p.end_time - p.start_time);
|
|
259
259
|
});
|
|
260
260
|
const a = [];
|
|
261
261
|
let b = 0;
|
|
262
262
|
for (const p of s) {
|
|
263
263
|
let f = -1;
|
|
264
|
-
for (let
|
|
265
|
-
if (a[
|
|
266
|
-
f =
|
|
264
|
+
for (let w = 0; w < a.length; w++)
|
|
265
|
+
if (a[w] <= p.start_time) {
|
|
266
|
+
f = w;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
269
|
f === -1 ? (f = a.length, a.push(p.end_time)) : a[f] = p.end_time, f > b && (b = f), this.layoutCache.set(p.id, { stackLevel: f, itemHeight: n });
|
|
@@ -281,7 +281,7 @@ class Ri {
|
|
|
281
281
|
return ((this.groupMaxStack.get(e) ?? 0) + 1) * this.lineHeight;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class Pi {
|
|
285
285
|
constructor() {
|
|
286
286
|
Object.defineProperty(this, "parentToChildren", {
|
|
287
287
|
enumerable: !0,
|
|
@@ -405,17 +405,17 @@ class Oi {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Xi(i, e, t, n, o, d) {
|
|
409
409
|
const { x: s, y: c, width: a, height: b } = t, H = d.primary;
|
|
410
410
|
i.globalAlpha = 0.15, i.fillStyle = H, i.fillRect(s, c, a, b), i.globalAlpha = 1, i.strokeStyle = H, i.lineWidth = 1.5, i.strokeRect(s, c, a, b);
|
|
411
411
|
const p = Math.min(b * 0.5, 6), f = c + b / 2;
|
|
412
412
|
i.fillStyle = H, i.beginPath(), i.moveTo(s, f), i.lineTo(s + p, f - p), i.lineTo(s + p * 2, f), i.lineTo(s + p, f + p), i.closePath(), i.fill(), i.beginPath(), i.moveTo(s + a, f), i.lineTo(s + a - p, f - p), i.lineTo(s + a - p * 2, f), i.lineTo(s + a - p, f + p), i.closePath(), i.fill();
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
413
|
+
const w = e.title;
|
|
414
|
+
if (w && a > 30) {
|
|
415
415
|
i.fillStyle = d.item.text, i.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', i.textBaseline = "middle";
|
|
416
|
-
const T = i.measureText(
|
|
416
|
+
const T = i.measureText(w).width, h = a - p * 4 - 4;
|
|
417
417
|
if (h > 20) {
|
|
418
|
-
const E = T > h ?
|
|
418
|
+
const E = T > h ? w.slice(0, Math.floor(w.length * h / T)) + "..." : w;
|
|
419
419
|
i.fillText(E, s + a / 2 - Math.min(T, h) / 2, f);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
@@ -431,13 +431,13 @@ function Ue(i, e, t, n, o, d) {
|
|
|
431
431
|
const f = c.get(p.group);
|
|
432
432
|
if (f === void 0)
|
|
433
433
|
continue;
|
|
434
|
-
const
|
|
435
|
-
if (!
|
|
434
|
+
const w = o.getLayout(p.id);
|
|
435
|
+
if (!w)
|
|
436
436
|
continue;
|
|
437
437
|
const T = t.timeToX(p.start_time), h = t.timeToX(p.end_time) - T;
|
|
438
438
|
if (i < T || i > T + h)
|
|
439
439
|
continue;
|
|
440
|
-
const P = t.groupIndexToY(f) +
|
|
440
|
+
const P = t.groupIndexToY(f) + w.stackLevel * t.lineHeight + (t.lineHeight - w.itemHeight) / 2, W = w.itemHeight;
|
|
441
441
|
e < P || e > P + W || P > H && (H = P, b = p);
|
|
442
442
|
}
|
|
443
443
|
return b;
|
|
@@ -453,6 +453,9 @@ function Gt(i, e, t, n = 6) {
|
|
|
453
453
|
function Nt(i, e) {
|
|
454
454
|
return i.canResize ?? e;
|
|
455
455
|
}
|
|
456
|
+
function Zt(i, e) {
|
|
457
|
+
return i.canMove ?? e;
|
|
458
|
+
}
|
|
456
459
|
function St(i, e, t) {
|
|
457
460
|
const n = window.devicePixelRatio || 1, o = Math.round(e * n), d = Math.round(t * n);
|
|
458
461
|
(i.width !== o || i.height !== d) && (i.width = o, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
|
|
@@ -463,7 +466,7 @@ function Mt(i, e) {
|
|
|
463
466
|
const t = window.devicePixelRatio || 1;
|
|
464
467
|
i.clearRect(0, 0, e.width / t, e.height / t);
|
|
465
468
|
}
|
|
466
|
-
class
|
|
469
|
+
class $i {
|
|
467
470
|
constructor(e) {
|
|
468
471
|
Object.defineProperty(this, "dirty", {
|
|
469
472
|
enumerable: !0,
|
|
@@ -503,7 +506,7 @@ var lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
503
506
|
function at(i) {
|
|
504
507
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
505
508
|
}
|
|
506
|
-
var
|
|
509
|
+
var ii = { exports: {} };
|
|
507
510
|
(function(i, e) {
|
|
508
511
|
(function(t, n) {
|
|
509
512
|
i.exports = n();
|
|
@@ -535,9 +538,9 @@ var ti = { exports: {} };
|
|
|
535
538
|
a.utcOffset = function(h, E) {
|
|
536
539
|
var P = this.$utils().u;
|
|
537
540
|
if (P(h)) return this.$u ? 0 : P(this.$offset) ? p.call(this) : this.$offset;
|
|
538
|
-
if (typeof h == "string" && (h = function(
|
|
539
|
-
|
|
540
|
-
var $ =
|
|
541
|
+
if (typeof h == "string" && (h = function(k) {
|
|
542
|
+
k === void 0 && (k = "");
|
|
543
|
+
var $ = k.match(n);
|
|
541
544
|
if (!$) return null;
|
|
542
545
|
var B = ("" + $[0]).match(o) || ["-", 0, 0], I = B[0], A = 60 * +B[1] + +B[2];
|
|
543
546
|
return A === 0 ? 0 : I === "+" ? A : -A;
|
|
@@ -563,9 +566,9 @@ var ti = { exports: {} };
|
|
|
563
566
|
}, a.toString = function() {
|
|
564
567
|
return this.toDate().toUTCString();
|
|
565
568
|
};
|
|
566
|
-
var
|
|
569
|
+
var w = a.toDate;
|
|
567
570
|
a.toDate = function(h) {
|
|
568
|
-
return h === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() :
|
|
571
|
+
return h === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : w.call(this);
|
|
569
572
|
};
|
|
570
573
|
var T = a.diff;
|
|
571
574
|
a.diff = function(h, E, P) {
|
|
@@ -575,62 +578,62 @@ var ti = { exports: {} };
|
|
|
575
578
|
};
|
|
576
579
|
};
|
|
577
580
|
});
|
|
578
|
-
})(
|
|
579
|
-
var
|
|
580
|
-
const
|
|
581
|
-
var
|
|
581
|
+
})(ii);
|
|
582
|
+
var Fi = ii.exports;
|
|
583
|
+
const Yi = /* @__PURE__ */ at(Fi);
|
|
584
|
+
var ni = { exports: {} };
|
|
582
585
|
(function(i, e) {
|
|
583
586
|
(function(t, n) {
|
|
584
587
|
i.exports = n();
|
|
585
588
|
})(lt, function() {
|
|
586
589
|
var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
|
|
587
590
|
return function(o, d, s) {
|
|
588
|
-
var c, a = function(f,
|
|
591
|
+
var c, a = function(f, w, T) {
|
|
589
592
|
T === void 0 && (T = {});
|
|
590
593
|
var h = new Date(f), E = function(P, W) {
|
|
591
594
|
W === void 0 && (W = {});
|
|
592
|
-
var y = W.timeZoneName || "short", D = P + "|" + y,
|
|
593
|
-
return
|
|
594
|
-
}(
|
|
595
|
+
var y = W.timeZoneName || "short", D = P + "|" + y, k = n[D];
|
|
596
|
+
return k || (k = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: P, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: y }), n[D] = k), k;
|
|
597
|
+
}(w, T);
|
|
595
598
|
return E.formatToParts(h);
|
|
596
|
-
}, b = function(f,
|
|
597
|
-
for (var T = a(f,
|
|
599
|
+
}, b = function(f, w) {
|
|
600
|
+
for (var T = a(f, w), h = [], E = 0; E < T.length; E += 1) {
|
|
598
601
|
var P = T[E], W = P.type, y = P.value, D = t[W];
|
|
599
602
|
D >= 0 && (h[D] = parseInt(y, 10));
|
|
600
603
|
}
|
|
601
|
-
var
|
|
604
|
+
var k = h[3], $ = k === 24 ? 0 : k, B = h[0] + "-" + h[1] + "-" + h[2] + " " + $ + ":" + h[4] + ":" + h[5] + ":000", I = +f;
|
|
602
605
|
return (s.utc(B).valueOf() - (I -= I % 1e3)) / 6e4;
|
|
603
606
|
}, H = d.prototype;
|
|
604
|
-
H.tz = function(f,
|
|
607
|
+
H.tz = function(f, w) {
|
|
605
608
|
f === void 0 && (f = c);
|
|
606
609
|
var T, h = this.utcOffset(), E = this.toDate(), P = E.toLocaleString("en-US", { timeZone: f }), W = Math.round((E - new Date(P)) / 1e3 / 60), y = 15 * -Math.round(E.getTimezoneOffset() / 15) - W;
|
|
607
|
-
if (!Number(y)) T = this.utcOffset(0,
|
|
608
|
-
else if (T = s(P, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(y, !0),
|
|
610
|
+
if (!Number(y)) T = this.utcOffset(0, w);
|
|
611
|
+
else if (T = s(P, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(y, !0), w) {
|
|
609
612
|
var D = T.utcOffset();
|
|
610
613
|
T = T.add(h - D, "minute");
|
|
611
614
|
}
|
|
612
615
|
return T.$x.$timezone = f, T;
|
|
613
616
|
}, H.offsetName = function(f) {
|
|
614
|
-
var
|
|
617
|
+
var w = this.$x.$timezone || s.tz.guess(), T = a(this.valueOf(), w, { timeZoneName: f }).find(function(h) {
|
|
615
618
|
return h.type.toLowerCase() === "timezonename";
|
|
616
619
|
});
|
|
617
620
|
return T && T.value;
|
|
618
621
|
};
|
|
619
622
|
var p = H.startOf;
|
|
620
|
-
H.startOf = function(f,
|
|
621
|
-
if (!this.$x || !this.$x.$timezone) return p.call(this, f,
|
|
623
|
+
H.startOf = function(f, w) {
|
|
624
|
+
if (!this.$x || !this.$x.$timezone) return p.call(this, f, w);
|
|
622
625
|
var T = s(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
623
|
-
return p.call(T, f,
|
|
624
|
-
}, s.tz = function(f,
|
|
625
|
-
var h = T &&
|
|
626
|
+
return p.call(T, f, w).tz(this.$x.$timezone, !0);
|
|
627
|
+
}, s.tz = function(f, w, T) {
|
|
628
|
+
var h = T && w, E = T || w || c, P = b(+s(), E);
|
|
626
629
|
if (typeof f != "string") return s(f).tz(E);
|
|
627
630
|
var W = function($, B, I) {
|
|
628
631
|
var A = $ - 60 * B * 1e3, F = b(A, I);
|
|
629
632
|
if (B === F) return [A, B];
|
|
630
633
|
var se = b(A -= 60 * (F - B) * 1e3, I);
|
|
631
634
|
return F === se ? [A, F] : [$ - 60 * Math.min(F, se) * 1e3, Math.max(F, se)];
|
|
632
|
-
}(s.utc(f, h).valueOf(), P, E), y = W[0], D = W[1],
|
|
633
|
-
return
|
|
635
|
+
}(s.utc(f, h).valueOf(), P, E), y = W[0], D = W[1], k = s(y).utcOffset(D);
|
|
636
|
+
return k.$x.$timezone = E, k;
|
|
634
637
|
}, s.tz.guess = function() {
|
|
635
638
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
636
639
|
}, s.tz.setDefault = function(f) {
|
|
@@ -638,31 +641,31 @@ var ii = { exports: {} };
|
|
|
638
641
|
};
|
|
639
642
|
};
|
|
640
643
|
});
|
|
641
|
-
})(
|
|
642
|
-
var
|
|
643
|
-
const
|
|
644
|
-
We.extend(
|
|
645
|
-
We.extend(
|
|
644
|
+
})(ni);
|
|
645
|
+
var _i = ni.exports;
|
|
646
|
+
const Wi = /* @__PURE__ */ at(_i);
|
|
647
|
+
We.extend(Yi);
|
|
648
|
+
We.extend(Wi);
|
|
646
649
|
function Te(i, e) {
|
|
647
650
|
return e ? We(i).tz(e) : We(i);
|
|
648
651
|
}
|
|
649
|
-
class
|
|
652
|
+
class Bi {
|
|
650
653
|
draw(e, t, n, o, d, s, c, a) {
|
|
651
654
|
const { firstVisible: b, lastVisible: H } = t.getVisibleGroupRange();
|
|
652
655
|
for (let y = b; y <= H; y++) {
|
|
653
|
-
const D = t.groupIndexToY(y),
|
|
656
|
+
const D = t.groupIndexToY(y), k = t.groupIndexToHeight(y), $ = n[y];
|
|
654
657
|
if (!$)
|
|
655
658
|
continue;
|
|
656
659
|
let B;
|
|
657
660
|
const I = s == null ? void 0 : s($);
|
|
658
|
-
I != null && I.backgroundColor ? B = I.backgroundColor : B = y % 2 === 0 ? "#FFFFFF" : o.grid.rowAlt, e.fillStyle = B, e.fillRect(0, D, t.canvasWidth,
|
|
661
|
+
I != null && I.backgroundColor ? B = I.backgroundColor : B = y % 2 === 0 ? "#FFFFFF" : o.grid.rowAlt, e.fillStyle = B, e.fillRect(0, D, t.canvasWidth, k), e.strokeStyle = (I == null ? void 0 : I.borderBottomColor) ?? o.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, D + k), e.lineTo(t.canvasWidth, D + k), e.stroke();
|
|
659
662
|
}
|
|
660
663
|
if (c && c.length > 0)
|
|
661
664
|
for (const y of c) {
|
|
662
|
-
const D = t.timeToX(y.start),
|
|
663
|
-
if (
|
|
665
|
+
const D = t.timeToX(y.start), k = t.timeToX(y.end);
|
|
666
|
+
if (k < 0 || D > t.canvasWidth)
|
|
664
667
|
continue;
|
|
665
|
-
const $ = Math.max(0, D), B = Math.min(t.canvasWidth,
|
|
668
|
+
const $ = Math.max(0, D), B = Math.min(t.canvasWidth, k) - $, I = y.opacity ?? 0.12, A = parseInt(y.color.slice(1, 3), 16), F = parseInt(y.color.slice(3, 5), 16), se = parseInt(y.color.slice(5, 7), 16);
|
|
666
669
|
e.fillStyle = `rgb(${Math.round(A * I + 255 * (1 - I))},${Math.round(F * I + 255 * (1 - I))},${Math.round(se * I + 255 * (1 - I))})`, e.fillRect($, 0, B, t.canvasHeight);
|
|
667
670
|
}
|
|
668
671
|
const p = t.visibleTimeStart, f = t.visibleTimeEnd, h = 864e5 / (f - p) * t.canvasWidth;
|
|
@@ -671,9 +674,9 @@ class Wi {
|
|
|
671
674
|
{
|
|
672
675
|
let y = Te(p, a).startOf("day");
|
|
673
676
|
const D = Te(f, a).endOf("day");
|
|
674
|
-
let
|
|
677
|
+
let k = null, $ = 1, B = 0;
|
|
675
678
|
const I = [], A = (F) => {
|
|
676
|
-
|
|
679
|
+
k !== null && (e.fillStyle = k, $ !== 1 && (e.globalAlpha = $), e.fillRect(B, 0, F - B, t.canvasHeight), $ !== 1 && (e.globalAlpha = 1), k = null, $ = 1);
|
|
677
680
|
};
|
|
678
681
|
for (; y.isBefore(D); ) {
|
|
679
682
|
const F = t.timeToX(y.valueOf()), se = y.toDate(), K = d == null ? void 0 : d(se);
|
|
@@ -684,9 +687,9 @@ class Wi {
|
|
|
684
687
|
const Se = y.day();
|
|
685
688
|
(Se === 0 || Se === 6) && (te = o.grid.weekend);
|
|
686
689
|
}
|
|
687
|
-
K != null && K.borderColor && I.push({ x: F, color: K.borderColor }), te ===
|
|
690
|
+
K != null && K.borderColor && I.push({ x: F, color: K.borderColor }), te === k && be === $ || (A(F), te !== null && (k = te, $ = be, B = F)), y = y.add(1, "day");
|
|
688
691
|
}
|
|
689
|
-
|
|
692
|
+
k !== null && A(t.timeToX(y.valueOf()));
|
|
690
693
|
for (const F of I)
|
|
691
694
|
e.strokeStyle = F.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(F.x, 0), e.lineTo(F.x, t.canvasHeight), e.stroke();
|
|
692
695
|
}
|
|
@@ -698,9 +701,9 @@ class Wi {
|
|
|
698
701
|
}
|
|
699
702
|
if (e.stroke(), c && c.length > 0)
|
|
700
703
|
for (const y of c) {
|
|
701
|
-
const D = t.timeToX(y.start),
|
|
702
|
-
if (!(
|
|
703
|
-
const $ = Math.max(0, D), B = Math.min(t.canvasWidth,
|
|
704
|
+
const D = t.timeToX(y.start), k = t.timeToX(y.end);
|
|
705
|
+
if (!(k < 0 || D > t.canvasWidth) && (e.strokeStyle = y.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), D >= 0 && D <= t.canvasWidth && (e.moveTo(D, 0), e.lineTo(D, t.canvasHeight)), k >= 0 && k <= t.canvasWidth && (e.moveTo(k, 0), e.lineTo(k, t.canvasHeight)), e.stroke(), e.globalAlpha = 1, y.label)) {
|
|
706
|
+
const $ = Math.max(0, D), B = Math.min(t.canvasWidth, k) - $;
|
|
704
707
|
e.save(), e.font = '600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
705
708
|
const I = e.measureText(y.label).width, A = 6, F = I + A * 2, se = 18, K = $ + (B - F) / 2, te = 4;
|
|
706
709
|
e.fillStyle = y.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(K, te, F, se, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(y.label, K + A, te + se / 2), e.restore();
|
|
@@ -708,8 +711,8 @@ class Wi {
|
|
|
708
711
|
}
|
|
709
712
|
}
|
|
710
713
|
}
|
|
711
|
-
const
|
|
712
|
-
function
|
|
714
|
+
const Ut = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
715
|
+
function ri(i, e) {
|
|
713
716
|
return {
|
|
714
717
|
/**
|
|
715
718
|
* Draws a filled rounded rectangle.
|
|
@@ -724,7 +727,7 @@ function ni(i, e) {
|
|
|
724
727
|
* and appends '...' so it fits within maxWidth.
|
|
725
728
|
*/
|
|
726
729
|
fillText(t, n, o, d) {
|
|
727
|
-
if (i.font =
|
|
730
|
+
if (i.font = Ut, d !== void 0 && i.measureText(t).width > d) {
|
|
728
731
|
let s = 0, c = t.length;
|
|
729
732
|
for (; s < c; ) {
|
|
730
733
|
const a = Math.ceil((s + c) / 2), b = t.slice(0, a) + "...";
|
|
@@ -773,18 +776,18 @@ function ni(i, e) {
|
|
|
773
776
|
* Draws a pill-shaped badge with centered white text on a colored background.
|
|
774
777
|
*/
|
|
775
778
|
badge(t, n, o, d) {
|
|
776
|
-
i.save(), i.font =
|
|
779
|
+
i.save(), i.font = Ut;
|
|
777
780
|
const c = i.measureText(t).width, a = 8, H = 12 + 3 * 2, p = c + a * 2, f = H / 2;
|
|
778
781
|
i.fillStyle = d, i.beginPath(), i.roundRect(n, o, p, H, f), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + p / 2, o + H / 2), i.restore();
|
|
779
782
|
}
|
|
780
783
|
};
|
|
781
784
|
}
|
|
782
|
-
class
|
|
783
|
-
draw(e, t, n, o, d, s, c, a, b, H, p, f,
|
|
785
|
+
class Li {
|
|
786
|
+
draw(e, t, n, o, d, s, c, a, b, H, p, f, w, T) {
|
|
784
787
|
const h = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, E = t.visibleTimeStart - h, P = t.visibleTimeEnd + h, W = d.query(E, P), y = /* @__PURE__ */ new Map();
|
|
785
788
|
for (let I = 0; I < n.length; I++)
|
|
786
789
|
y.set(n[I].id, I);
|
|
787
|
-
const D = new Set(H),
|
|
790
|
+
const D = new Set(H), k = /* @__PURE__ */ new Map(), $ = -t.lineHeight, B = t.canvasHeight + t.lineHeight;
|
|
788
791
|
for (const I of W) {
|
|
789
792
|
const A = y.get(I.group);
|
|
790
793
|
if (A === void 0)
|
|
@@ -796,7 +799,7 @@ class Bi {
|
|
|
796
799
|
if (K + te < $ || K > B)
|
|
797
800
|
continue;
|
|
798
801
|
const be = t.timeToX(I.start_time), Se = t.timeToX(I.end_time) - be, Me = { x: be, y: K, width: Se, height: te };
|
|
799
|
-
|
|
802
|
+
k.set(I.id, Me);
|
|
800
803
|
const Xe = {
|
|
801
804
|
selected: D.has(I.id),
|
|
802
805
|
hovered: p === I.id,
|
|
@@ -804,14 +807,14 @@ class Bi {
|
|
|
804
807
|
filtered: I.filtered !== !1
|
|
805
808
|
};
|
|
806
809
|
e.save();
|
|
807
|
-
const qe =
|
|
810
|
+
const qe = ri(e, Me);
|
|
808
811
|
let De;
|
|
809
|
-
|
|
812
|
+
w && (T != null && T.isParent(I.id)) ? De = w : a && (I.type === "control_area_group" || I.type === "construction_train") ? De = a : De = c, De(e, I, Me, Xe, qe), e.restore();
|
|
810
813
|
}
|
|
811
814
|
if (f && f.length > 0) {
|
|
812
815
|
const I = /* @__PURE__ */ new Set();
|
|
813
816
|
for (const A of f)
|
|
814
|
-
|
|
817
|
+
k.has(A.fromItemId) || I.add(A.fromItemId), k.has(A.toItemId) || I.add(A.toItemId);
|
|
815
818
|
if (I.size > 0) {
|
|
816
819
|
const A = /* @__PURE__ */ new Map();
|
|
817
820
|
for (const F of o)
|
|
@@ -824,10 +827,10 @@ class Bi {
|
|
|
824
827
|
if (!te)
|
|
825
828
|
continue;
|
|
826
829
|
const Se = t.groupIndexToY(K) + te.stackLevel * t.lineHeight + (t.lineHeight - te.itemHeight) / 2, Me = t.timeToX(se.start_time), Xe = t.timeToX(se.end_time) - Me;
|
|
827
|
-
|
|
830
|
+
k.set(F, { x: Me, y: Se, width: Xe, height: te.itemHeight });
|
|
828
831
|
}
|
|
829
832
|
}
|
|
830
|
-
this.drawDependencies(e, f,
|
|
833
|
+
this.drawDependencies(e, f, k, p, b);
|
|
831
834
|
}
|
|
832
835
|
}
|
|
833
836
|
drawDependencies(e, t, n, o, d) {
|
|
@@ -837,14 +840,14 @@ class Bi {
|
|
|
837
840
|
continue;
|
|
838
841
|
const b = o === s.fromItemId || o === s.toItemId;
|
|
839
842
|
e.strokeStyle = b ? d.primary : s.color ?? "#94A3B8", e.lineWidth = b ? 2 : 1.5, e.setLineDash([]);
|
|
840
|
-
const H = c.x + c.width, p = c.y + c.height / 2, f = a.x,
|
|
841
|
-
e.beginPath(), e.moveTo(H, p), e.bezierCurveTo(H + h, p, f - h,
|
|
843
|
+
const H = c.x + c.width, p = c.y + c.height / 2, f = a.x, w = a.y + a.height / 2, T = Math.abs(f - H), h = Math.max(T * 0.4, 30);
|
|
844
|
+
e.beginPath(), e.moveTo(H, p), e.bezierCurveTo(H + h, p, f - h, w, f, w), e.stroke();
|
|
842
845
|
const E = 6;
|
|
843
|
-
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f,
|
|
846
|
+
e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f, w), e.lineTo(f - E, w - E / 2), e.lineTo(f - E, w + E / 2), e.closePath(), e.fill();
|
|
844
847
|
}
|
|
845
848
|
}
|
|
846
849
|
}
|
|
847
|
-
class
|
|
850
|
+
class zi {
|
|
848
851
|
draw(e, t, n, o) {
|
|
849
852
|
const { cursorX: d, snapX: s, markers: c, interaction: a } = o;
|
|
850
853
|
if (c)
|
|
@@ -852,25 +855,25 @@ class Li {
|
|
|
852
855
|
const H = t.timeToX(b.date);
|
|
853
856
|
if (e.fillStyle = b.color, e.fillRect(H - b.width / 2, 0, b.width, t.canvasHeight), b.label) {
|
|
854
857
|
e.save(), e.font = '500 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
855
|
-
const p = e.measureText(b.label).width, f = 8,
|
|
858
|
+
const p = e.measureText(b.label).width, f = 8, w = 200, T = Math.min(p + f * 2, w), h = 20, E = H - T / 2, P = 4;
|
|
856
859
|
e.fillStyle = b.color, e.beginPath(), e.roundRect(E, P, T, h, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
|
|
857
|
-
const W =
|
|
860
|
+
const W = w - f * 2, y = p > W ? b.label.slice(0, Math.floor(b.label.length * W / p)) + "…" : b.label;
|
|
858
861
|
e.fillText(y, E + f, P + h / 2), e.restore();
|
|
859
862
|
}
|
|
860
863
|
}
|
|
861
864
|
if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), s != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(s, 0), e.lineTo(s, t.canvasHeight), e.stroke(), e.setLineDash([])), a) {
|
|
862
865
|
a.groupChanged && a.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, a.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
|
|
863
|
-
const b =
|
|
866
|
+
const b = ri(e, a.bounds);
|
|
864
867
|
a.renderer(e, a.item, a.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, b), e.restore();
|
|
865
868
|
}
|
|
866
869
|
}
|
|
867
870
|
}
|
|
868
|
-
const
|
|
869
|
-
function
|
|
871
|
+
const Vt = 120;
|
|
872
|
+
function xi(i) {
|
|
870
873
|
let e = i.deltaY || i.deltaX;
|
|
871
|
-
return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-
|
|
874
|
+
return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Vt, Math.min(Vt, e));
|
|
872
875
|
}
|
|
873
|
-
class
|
|
876
|
+
class Ai {
|
|
874
877
|
constructor(e, t, n, o, d) {
|
|
875
878
|
Object.defineProperty(this, "onZoom", {
|
|
876
879
|
enumerable: !0,
|
|
@@ -903,15 +906,15 @@ class xi {
|
|
|
903
906
|
this.visibleTimeStart = e, this.visibleTimeEnd = t;
|
|
904
907
|
}
|
|
905
908
|
handleWheelZoom(e, t) {
|
|
906
|
-
const n =
|
|
909
|
+
const n = xi(e), o = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + o * n / 500 : 1 / (1 + o * -n / 500), s = this.visibleTimeEnd - this.visibleTimeStart;
|
|
907
910
|
let c = Math.round(s * d);
|
|
908
911
|
c = Math.max(this.minZoom, Math.min(this.maxZoom, c));
|
|
909
912
|
const a = Math.round(this.visibleTimeStart + (s - c) * t), b = a + c;
|
|
910
913
|
this.onZoom(a, b);
|
|
911
914
|
}
|
|
912
915
|
}
|
|
913
|
-
const
|
|
914
|
-
class
|
|
916
|
+
const ji = 4;
|
|
917
|
+
class Gi {
|
|
915
918
|
constructor(e) {
|
|
916
919
|
Object.defineProperty(this, "state", {
|
|
917
920
|
enumerable: !0,
|
|
@@ -944,7 +947,7 @@ class ji {
|
|
|
944
947
|
}, this.activated = !1;
|
|
945
948
|
}
|
|
946
949
|
update(e, t) {
|
|
947
|
-
this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >=
|
|
950
|
+
this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= ji && (this.activated = !0));
|
|
948
951
|
}
|
|
949
952
|
setCurrentGroup(e) {
|
|
950
953
|
this.state && (this.state.currentGroup = e);
|
|
@@ -994,7 +997,7 @@ function st(i, e, t, n, o) {
|
|
|
994
997
|
}
|
|
995
998
|
return s <= t ? d : null;
|
|
996
999
|
}
|
|
997
|
-
var
|
|
1000
|
+
var oi = { exports: {} };
|
|
998
1001
|
(function(i, e) {
|
|
999
1002
|
(function(t, n) {
|
|
1000
1003
|
i.exports = n();
|
|
@@ -1008,7 +1011,7 @@ var ri = { exports: {} };
|
|
|
1008
1011
|
return s(this).year();
|
|
1009
1012
|
}, c.isoWeek = function(b) {
|
|
1010
1013
|
if (!this.$utils().u(b)) return this.add(7 * (b - this.isoWeek()), t);
|
|
1011
|
-
var H, p, f,
|
|
1014
|
+
var H, p, f, w, T = s(this), h = (H = this.isoWeekYear(), p = this.$u, f = (p ? d.utc : d)().year(H).startOf("year"), w = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (w += 7), f.add(w, t));
|
|
1012
1015
|
return T.diff(h, "week") + 1;
|
|
1013
1016
|
}, c.isoWeekday = function(b) {
|
|
1014
1017
|
return this.$utils().u(b) ? this.day() || 7 : this.day(this.day() % 7 ? b : b - 7);
|
|
@@ -1020,29 +1023,29 @@ var ri = { exports: {} };
|
|
|
1020
1023
|
};
|
|
1021
1024
|
};
|
|
1022
1025
|
});
|
|
1023
|
-
})(
|
|
1024
|
-
var
|
|
1025
|
-
const
|
|
1026
|
-
function
|
|
1026
|
+
})(oi);
|
|
1027
|
+
var Ni = oi.exports;
|
|
1028
|
+
const Zi = /* @__PURE__ */ at(Ni), qt = 200;
|
|
1029
|
+
function Kt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o, canvasHeight: d, theme: s, groupRenderer: c, onScroll: a }) {
|
|
1027
1030
|
var y;
|
|
1028
1031
|
const b = U(null), H = U(!1), p = ee(() => {
|
|
1029
1032
|
const D = new Array(i.length + 1);
|
|
1030
1033
|
D[0] = 0;
|
|
1031
|
-
for (let
|
|
1032
|
-
D[
|
|
1034
|
+
for (let k = 0; k < i.length; k++)
|
|
1035
|
+
D[k + 1] = D[k] + ((n == null ? void 0 : n[k]) ?? t);
|
|
1033
1036
|
return D;
|
|
1034
|
-
}, [i.length, n, t]), f = p[i.length] ?? 0,
|
|
1037
|
+
}, [i.length, n, t]), f = p[i.length] ?? 0, w = d, T = oe((D) => {
|
|
1035
1038
|
if (i.length === 0 || D <= 0)
|
|
1036
1039
|
return 0;
|
|
1037
1040
|
if (D >= f)
|
|
1038
1041
|
return i.length - 1;
|
|
1039
|
-
let
|
|
1040
|
-
for (;
|
|
1041
|
-
const B =
|
|
1042
|
-
p[B + 1] > D ? $ = B :
|
|
1042
|
+
let k = 0, $ = i.length - 1;
|
|
1043
|
+
for (; k < $; ) {
|
|
1044
|
+
const B = k + $ >>> 1;
|
|
1045
|
+
p[B + 1] > D ? $ = B : k = B + 1;
|
|
1043
1046
|
}
|
|
1044
|
-
return
|
|
1045
|
-
}, [i.length, p, f]), h = T(o -
|
|
1047
|
+
return k;
|
|
1048
|
+
}, [i.length, p, f]), h = T(o - qt), E = T(o + d + qt), P = oe((D) => {
|
|
1046
1049
|
H.current || a(D.currentTarget.scrollTop);
|
|
1047
1050
|
}, [a]);
|
|
1048
1051
|
ce(() => {
|
|
@@ -1052,8 +1055,8 @@ function qt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o,
|
|
|
1052
1055
|
}, [o]);
|
|
1053
1056
|
const W = [];
|
|
1054
1057
|
for (let D = h; D <= E; D++) {
|
|
1055
|
-
const
|
|
1056
|
-
if (!
|
|
1058
|
+
const k = i[D];
|
|
1059
|
+
if (!k)
|
|
1057
1060
|
continue;
|
|
1058
1061
|
const $ = p[D], B = p[D + 1] - $;
|
|
1059
1062
|
W.push(le("div", { style: {
|
|
@@ -1066,11 +1069,11 @@ function qt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o,
|
|
|
1066
1069
|
alignItems: "stretch",
|
|
1067
1070
|
borderBottom: `1px solid ${((y = s.grid) == null ? void 0 : y.line) ?? "#E5E5E5"}`,
|
|
1068
1071
|
boxSizing: "border-box"
|
|
1069
|
-
}, children: c(
|
|
1072
|
+
}, children: c(k) }, k.id));
|
|
1070
1073
|
}
|
|
1071
1074
|
return le("div", { ref: b, onScroll: P, style: {
|
|
1072
1075
|
width: e,
|
|
1073
|
-
height:
|
|
1076
|
+
height: w,
|
|
1074
1077
|
overflowY: f > d ? "auto" : "hidden",
|
|
1075
1078
|
overflowX: "hidden",
|
|
1076
1079
|
position: "relative",
|
|
@@ -1078,21 +1081,21 @@ function qt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o,
|
|
|
1078
1081
|
backgroundColor: s.sidebar.bg
|
|
1079
1082
|
}, children: le("div", { style: { height: f, position: "relative" }, children: W }) });
|
|
1080
1083
|
}
|
|
1081
|
-
function
|
|
1084
|
+
function Ui(i) {
|
|
1082
1085
|
return null;
|
|
1083
1086
|
}
|
|
1084
|
-
|
|
1085
|
-
function
|
|
1087
|
+
Ui.displayName = "TodayMarker";
|
|
1088
|
+
function Jt(i) {
|
|
1086
1089
|
return { date: Math.floor(Date.now() / 6e4) * 6e4, color: i.color ?? "#FD7171", width: i.width ?? 6, label: i.label };
|
|
1087
1090
|
}
|
|
1088
|
-
function
|
|
1091
|
+
function Vi(i) {
|
|
1089
1092
|
return i.interval ?? 1e4;
|
|
1090
1093
|
}
|
|
1091
|
-
function
|
|
1094
|
+
function qi(i) {
|
|
1092
1095
|
return null;
|
|
1093
1096
|
}
|
|
1094
|
-
|
|
1095
|
-
function
|
|
1097
|
+
qi.displayName = "CustomMarker";
|
|
1098
|
+
function Qt(i) {
|
|
1096
1099
|
return {
|
|
1097
1100
|
date: i.date,
|
|
1098
1101
|
color: i.color ?? "#3B82F6",
|
|
@@ -1100,8 +1103,8 @@ function Jt(i) {
|
|
|
1100
1103
|
label: i.label
|
|
1101
1104
|
};
|
|
1102
1105
|
}
|
|
1103
|
-
We.extend(
|
|
1104
|
-
function
|
|
1106
|
+
We.extend(Zi);
|
|
1107
|
+
function Ki(i) {
|
|
1105
1108
|
return i ? {
|
|
1106
1109
|
...He,
|
|
1107
1110
|
...i,
|
|
@@ -1113,20 +1116,20 @@ function qi(i) {
|
|
|
1113
1116
|
header: { ...He.header, ...i.header }
|
|
1114
1117
|
} : He;
|
|
1115
1118
|
}
|
|
1116
|
-
const
|
|
1117
|
-
const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: s, sidebarWidth: c, lineHeight: a, itemHeightRatio: b, stackItems: H, canMove: p, canChangeGroup: f, canResize:
|
|
1119
|
+
const ei = 32, fn = me.memo(Hi(function(e, t) {
|
|
1120
|
+
const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: s, sidebarWidth: c, lineHeight: a, itemHeightRatio: b, stackItems: H, canMove: p, canChangeGroup: f, canResize: w, dragSnap: T, minZoom: h, maxZoom: E, theme: P, dayStyle: W, rowStyle: y, showCursorLine: D, itemRenderer: k, groupRenderer: $, sidebarGroupRenderer: B, dependencies: I, highlights: A, onItemClick: F, onItemDoubleClick: se, onItemContextMenu: K, onItemMove: te, onItemResize: be, moveResizeValidator: Se, onItemHover: Me, onCanvasDoubleClick: Xe, onCanvasContextMenu: qe, onTimeChange: De, onZoom: kt, selected: Ct = [], rightSidebarWidth: ut, rightSidebarGroupRenderer: Et, onReady: Ke, maxHeight: Be, timezone: Je, devBadge: li, children: ke } = e, we = ee(() => Ki(P), [P]), Ht = oe((r, l) => {
|
|
1118
1121
|
for (let m = 0; m < l.length; m++)
|
|
1119
1122
|
if (l[m].id === r)
|
|
1120
1123
|
return m;
|
|
1121
1124
|
return 0;
|
|
1122
|
-
}, []),
|
|
1125
|
+
}, []), ai = Ct.join(","), ct = ee(() => Ct, [ai]), Dt = U(null), It = U(null), Rt = U(null), Le = U(null), Ot = U(null), Pt = U(null), [ui, ci] = Ze(800), [di, fi] = Ze(null);
|
|
1123
1126
|
ce(() => {
|
|
1124
1127
|
const r = Ot.current;
|
|
1125
1128
|
if (!r)
|
|
1126
1129
|
return;
|
|
1127
1130
|
const l = new ResizeObserver((m) => {
|
|
1128
1131
|
const g = m[0];
|
|
1129
|
-
g &&
|
|
1132
|
+
g && ci(g.contentRect.width);
|
|
1130
1133
|
});
|
|
1131
1134
|
return l.observe(r), () => l.disconnect();
|
|
1132
1135
|
}, []), ce(() => {
|
|
@@ -1135,20 +1138,20 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1135
1138
|
return;
|
|
1136
1139
|
const l = new ResizeObserver((m) => {
|
|
1137
1140
|
const g = m[0];
|
|
1138
|
-
g &&
|
|
1141
|
+
g && fi(g.contentRect.height);
|
|
1139
1142
|
});
|
|
1140
1143
|
return l.observe(r), () => l.disconnect();
|
|
1141
1144
|
}, [Be]);
|
|
1142
|
-
const Ce = Math.max(0,
|
|
1143
|
-
const r = new
|
|
1145
|
+
const Ce = Math.max(0, ui - c - (ut ?? 0)), Ie = ee(() => {
|
|
1146
|
+
const r = new Pi();
|
|
1144
1147
|
return r.rebuild(o), r;
|
|
1145
1148
|
}, [o]), dt = ee(() => {
|
|
1146
|
-
const r = new
|
|
1149
|
+
const r = new Ri();
|
|
1147
1150
|
return r.buildFromItems(o, (l) => Ie.getEffectiveSpan(l.id).start, (l) => Ie.getEffectiveSpan(l.id).end), r;
|
|
1148
1151
|
}, [o, Ie]), ze = ee(() => {
|
|
1149
|
-
const r = new
|
|
1152
|
+
const r = new Oi(a, b);
|
|
1150
1153
|
return r.computeLayout(o, H, Ie), r;
|
|
1151
|
-
}, [o, a, b, H, Ie]), Re = ee(() => n.map((r) => ze.getGroupHeight(r.id)), [n, ze]), Qe = ee(() => Re.reduce((r, l) => r + l, 0), [Re]), Xt = typeof Be == "number" ? Be :
|
|
1154
|
+
}, [o, a, b, H, Ie]), Re = ee(() => n.map((r) => ze.getGroupHeight(r.id)), [n, ze]), Qe = ee(() => Re.reduce((r, l) => r + l, 0), [Re]), Xt = typeof Be == "number" ? Be : di, ye = Xt ? Math.min(Qe, Xt) : Qe, L = U(new yt({
|
|
1152
1155
|
visibleTimeStart: e.visibleTimeStart ?? d,
|
|
1153
1156
|
visibleTimeEnd: e.visibleTimeEnd ?? s,
|
|
1154
1157
|
canvasWidth: Ce,
|
|
@@ -1159,25 +1162,25 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1159
1162
|
buffer: e.buffer ?? 3,
|
|
1160
1163
|
scrollTop: 0,
|
|
1161
1164
|
groupHeights: Re
|
|
1162
|
-
})), ft = U(null), xe = U(void 0), ve = U(null), Oe = U(!1), $t = 4, [Ft,
|
|
1165
|
+
})), ft = U(null), xe = U(void 0), ve = U(null), Oe = U(!1), $t = 4, [Ft, hi] = Ze(e.visibleTimeStart ?? d), [Yt, mi] = Ze(e.visibleTimeEnd ?? s), [_t, et] = Ze(0), Ae = U(null), $e = oe(() => {
|
|
1163
1166
|
const r = L.current;
|
|
1164
|
-
|
|
1167
|
+
hi(r.visibleTimeStart), mi(r.visibleTimeEnd), et(r.scrollTop), Ae.current = null;
|
|
1165
1168
|
}, []), ht = oe(() => {
|
|
1166
|
-
Ae.current === null && (Ae.current = setTimeout($e,
|
|
1169
|
+
Ae.current === null && (Ae.current = setTimeout($e, ei));
|
|
1167
1170
|
}, [$e]);
|
|
1168
1171
|
ce(() => () => {
|
|
1169
1172
|
Ae.current !== null && clearTimeout(Ae.current);
|
|
1170
1173
|
}, []);
|
|
1171
1174
|
const Wt = ee(() => e.summaryRenderer ? e.summaryRenderer : (r, l, m, g, u) => {
|
|
1172
|
-
|
|
1173
|
-
}, [e.summaryRenderer, we]), Fe = ee(() => new
|
|
1175
|
+
Xi(r, l, m, g, u, we);
|
|
1176
|
+
}, [e.summaryRenderer, we]), Fe = ee(() => new Bi(), []), Ye = ee(() => new Li(), []), _e = ee(() => new zi(), []), ie = ee(() => new Gi(T), [T]), tt = ee(() => {
|
|
1174
1177
|
const r = [];
|
|
1175
1178
|
return me.Children.forEach(ke, (l) => {
|
|
1176
1179
|
var g;
|
|
1177
1180
|
if (!me.isValidElement(l))
|
|
1178
1181
|
return;
|
|
1179
1182
|
const m = (g = l.type) == null ? void 0 : g.displayName;
|
|
1180
|
-
m === "TodayMarker" ? r.push(
|
|
1183
|
+
m === "TodayMarker" ? r.push(Jt(l.props)) : m === "CustomMarker" && r.push(Qt(l.props));
|
|
1181
1184
|
}), r;
|
|
1182
1185
|
}, [ke]), it = ee(() => tt.map((r) => `${r.date}|${r.color}|${r.width}|${r.label ?? ""}`).join(";"), [tt]), je = U(tt);
|
|
1183
1186
|
je.current = tt;
|
|
@@ -1187,14 +1190,14 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1187
1190
|
var g;
|
|
1188
1191
|
if (!me.isValidElement(l))
|
|
1189
1192
|
return;
|
|
1190
|
-
((g = l.type) == null ? void 0 : g.displayName) === "TodayMarker" && (r =
|
|
1193
|
+
((g = l.type) == null ? void 0 : g.displayName) === "TodayMarker" && (r = Vi(l.props));
|
|
1191
1194
|
}), r;
|
|
1192
1195
|
}, [ke]), x = U({
|
|
1193
1196
|
groups: n,
|
|
1194
1197
|
items: o,
|
|
1195
1198
|
intervalTree: dt,
|
|
1196
1199
|
layoutEngine: ze,
|
|
1197
|
-
itemRenderer:
|
|
1200
|
+
itemRenderer: k,
|
|
1198
1201
|
groupRenderer: $,
|
|
1199
1202
|
theme: we,
|
|
1200
1203
|
selected: ct,
|
|
@@ -1218,7 +1221,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1218
1221
|
onCanvasDoubleClick: Xe,
|
|
1219
1222
|
onCanvasContextMenu: qe,
|
|
1220
1223
|
canMove: p,
|
|
1221
|
-
canResize:
|
|
1224
|
+
canResize: w,
|
|
1222
1225
|
canChangeGroup: f,
|
|
1223
1226
|
dragSnap: T,
|
|
1224
1227
|
sidebarWidth: c,
|
|
@@ -1232,7 +1235,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1232
1235
|
items: o,
|
|
1233
1236
|
intervalTree: dt,
|
|
1234
1237
|
layoutEngine: ze,
|
|
1235
|
-
itemRenderer:
|
|
1238
|
+
itemRenderer: k,
|
|
1236
1239
|
groupRenderer: $,
|
|
1237
1240
|
theme: we,
|
|
1238
1241
|
selected: ct,
|
|
@@ -1256,7 +1259,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1256
1259
|
onCanvasDoubleClick: Xe,
|
|
1257
1260
|
onCanvasContextMenu: qe,
|
|
1258
1261
|
canMove: p,
|
|
1259
|
-
canResize:
|
|
1262
|
+
canResize: w,
|
|
1260
1263
|
canChangeGroup: f,
|
|
1261
1264
|
dragSnap: T,
|
|
1262
1265
|
sidebarWidth: c,
|
|
@@ -1265,30 +1268,30 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1265
1268
|
hierarchyEngine: Ie,
|
|
1266
1269
|
timezone: Je
|
|
1267
1270
|
};
|
|
1268
|
-
const
|
|
1271
|
+
const gi = oe(() => {
|
|
1269
1272
|
const r = Dt.current;
|
|
1270
1273
|
if (!r)
|
|
1271
1274
|
return;
|
|
1272
1275
|
const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
|
|
1273
1276
|
Mt(m, r), Fe.draw(m, L.current, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights, l.timezone);
|
|
1274
|
-
}, [Fe]),
|
|
1277
|
+
}, [Fe]), pi = oe(() => {
|
|
1275
1278
|
const r = It.current;
|
|
1276
1279
|
if (!r)
|
|
1277
1280
|
return;
|
|
1278
1281
|
const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
|
|
1279
1282
|
Mt(m, r), Ye.draw(m, L.current, l.groups, l.items, l.intervalTree, l.layoutEngine, l.itemRenderer, l.groupRenderer, l.theme, l.selected, xe.current, l.dependencies, l.summaryRenderer, l.hierarchyEngine);
|
|
1280
1283
|
}, [Ye]), Bt = oe((r, l, m) => {
|
|
1281
|
-
const g = L.current, u = x.current, v = u.canvasWidth / (g.visibleTimeEnd - g.visibleTimeStart),
|
|
1282
|
-
m === "move" ? (R.push(g.timeToX(r.start_time +
|
|
1284
|
+
const g = L.current, u = x.current, v = u.canvasWidth / (g.visibleTimeEnd - g.visibleTimeStart), M = l / v, R = [];
|
|
1285
|
+
m === "move" ? (R.push(g.timeToX(r.start_time + M)), R.push(g.timeToX(r.end_time + M))) : m === "resize-left" ? R.push(g.timeToX(r.start_time + M)) : R.push(g.timeToX(r.end_time + M));
|
|
1283
1286
|
const X = (g.visibleTimeEnd - g.visibleTimeStart) * 0.1, Y = u.intervalTree.query(g.visibleTimeStart - X, g.visibleTimeEnd + X), N = wt(Y, r.id, (J) => g.timeToX(J));
|
|
1284
1287
|
for (const J of R) {
|
|
1285
1288
|
const q = st(J, N, 8, v, u.dragSnap);
|
|
1286
1289
|
if (q !== null)
|
|
1287
1290
|
return q;
|
|
1288
1291
|
}
|
|
1289
|
-
const ne = m === "resize-right" ? r.end_time +
|
|
1292
|
+
const ne = m === "resize-right" ? r.end_time + M : r.start_time + M, z = Math.round(ne / u.dragSnap) * u.dragSnap;
|
|
1290
1293
|
return g.timeToX(z);
|
|
1291
|
-
}, []),
|
|
1294
|
+
}, []), vi = oe(() => {
|
|
1292
1295
|
const r = Rt.current;
|
|
1293
1296
|
if (!r)
|
|
1294
1297
|
return;
|
|
@@ -1297,9 +1300,9 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1297
1300
|
const g = L.current, u = ie.getState();
|
|
1298
1301
|
let v = null;
|
|
1299
1302
|
if (u) {
|
|
1300
|
-
const
|
|
1303
|
+
const M = g.timeToX(u.item.start_time), R = g.timeToX(u.item.end_time) - M;
|
|
1301
1304
|
let X, Y;
|
|
1302
|
-
u.mode === "resize-left" ? (X =
|
|
1305
|
+
u.mode === "resize-left" ? (X = M + u.deltaX, Y = R - u.deltaX) : u.mode === "resize-right" ? (X = M, Y = R + u.deltaX) : (X = M + u.deltaX, Y = R);
|
|
1303
1306
|
const N = Ht(u.currentGroup, l.groups), ne = g.groupIndexToY(N), z = u.currentGroup !== u.originalGroup;
|
|
1304
1307
|
v = {
|
|
1305
1308
|
item: u.item,
|
|
@@ -1317,8 +1320,8 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1317
1320
|
interaction: v
|
|
1318
1321
|
});
|
|
1319
1322
|
}, [_e, ie, Bt, Ht]), gt = U(null);
|
|
1320
|
-
gt.current || (gt.current = new
|
|
1321
|
-
r.grid &&
|
|
1323
|
+
gt.current || (gt.current = new $i((r) => {
|
|
1324
|
+
r.grid && gi(), r.items && pi(), r.overlay && vi();
|
|
1322
1325
|
}));
|
|
1323
1326
|
const O = gt.current;
|
|
1324
1327
|
ce(() => () => O.dispose(), [O]), ce(() => {
|
|
@@ -1331,7 +1334,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1331
1334
|
if (!me.isValidElement(m))
|
|
1332
1335
|
return;
|
|
1333
1336
|
const g = (u = m.type) == null ? void 0 : u.displayName;
|
|
1334
|
-
g === "TodayMarker" ? l.push(
|
|
1337
|
+
g === "TodayMarker" ? l.push(Jt(m.props)) : g === "CustomMarker" && l.push(Qt(m.props));
|
|
1335
1338
|
}), je.current = l, O.markDirty("overlay");
|
|
1336
1339
|
}, mt);
|
|
1337
1340
|
return () => clearInterval(r);
|
|
@@ -1366,12 +1369,12 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1366
1369
|
Ge.current = null;
|
|
1367
1370
|
const l = L.current, m = x.current;
|
|
1368
1371
|
r === "zoom" ? (g = m.onZoom) == null || g.call(m, l.visibleTimeStart, l.visibleTimeEnd) : (u = m.onTimeChange) == null || u.call(m, l.visibleTimeStart, l.visibleTimeEnd);
|
|
1369
|
-
},
|
|
1372
|
+
}, ei));
|
|
1370
1373
|
}, []);
|
|
1371
1374
|
ce(() => () => {
|
|
1372
1375
|
Ge.current !== null && clearTimeout(Ge.current);
|
|
1373
1376
|
}, []);
|
|
1374
|
-
const rt = U(null), vt = ee(() => new
|
|
1377
|
+
const rt = U(null), vt = ee(() => new Ai((r, l) => {
|
|
1375
1378
|
var m;
|
|
1376
1379
|
L.current.update({ visibleTimeStart: r, visibleTimeEnd: l }), (m = rt.current) == null || m.updateBounds(r, l), O.markAllDirty(), ht(), pt("zoom");
|
|
1377
1380
|
}, d, s, h, E), []);
|
|
@@ -1380,9 +1383,9 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1380
1383
|
const l = L.current, m = l.getTotalHeight(), g = Math.max(0, m - l.canvasHeight), u = Math.max(0, Math.min(g, l.scrollTop + r));
|
|
1381
1384
|
u !== l.scrollTop && (l.update({ scrollTop: u }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(u));
|
|
1382
1385
|
}, [O]), Ne = oe((r) => {
|
|
1383
|
-
var
|
|
1386
|
+
var M, R, X;
|
|
1384
1387
|
const l = L.current, m = l.canvasWidth / (l.visibleTimeEnd - l.visibleTimeStart), g = r / m, u = l.visibleTimeStart + g, v = l.visibleTimeEnd + g;
|
|
1385
|
-
l.update({ visibleTimeStart: u, visibleTimeEnd: v }), (
|
|
1388
|
+
l.update({ visibleTimeStart: u, visibleTimeEnd: v }), (M = rt.current) == null || M.updateBounds(u, v), O.markAllDirty(), Ii(() => $e()), (X = (R = x.current).onTimeChange) == null || X.call(R, u, v);
|
|
1386
1389
|
}, [O, $e]);
|
|
1387
1390
|
ce(() => {
|
|
1388
1391
|
const r = Le.current;
|
|
@@ -1407,13 +1410,13 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1407
1410
|
const r = Le.current;
|
|
1408
1411
|
if (!r)
|
|
1409
1412
|
return;
|
|
1410
|
-
const l = (
|
|
1411
|
-
|
|
1412
|
-
}, u = (
|
|
1413
|
+
const l = (M, R) => Math.abs(M.clientX - R.clientX), m = (M, R, X) => (M.clientX + R.clientX) / 2 - X.left, g = (M) => {
|
|
1414
|
+
M.touches.length === 2 && (M.preventDefault(), Ee.current.lastDistance = l(M.touches[0], M.touches[1]), Ee.current.lastCenter = null);
|
|
1415
|
+
}, u = (M) => {
|
|
1413
1416
|
var R;
|
|
1414
|
-
if (
|
|
1415
|
-
|
|
1416
|
-
const X = l(
|
|
1417
|
+
if (M.touches.length === 2 && Ee.current.lastDistance !== null) {
|
|
1418
|
+
M.preventDefault();
|
|
1419
|
+
const X = l(M.touches[0], M.touches[1]), Y = r.getBoundingClientRect(), ne = m(M.touches[0], M.touches[1], Y) / Y.width;
|
|
1417
1420
|
if (X !== 0 && Ee.current.lastDistance !== 0) {
|
|
1418
1421
|
const z = Ee.current.lastDistance / X, J = L.current, q = J.visibleTimeEnd - J.visibleTimeStart;
|
|
1419
1422
|
let de = q * z;
|
|
@@ -1430,7 +1433,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1430
1433
|
r.removeEventListener("touchstart", g), r.removeEventListener("touchmove", u), r.removeEventListener("touchend", v);
|
|
1431
1434
|
};
|
|
1432
1435
|
}, [O, ht, pt]);
|
|
1433
|
-
const
|
|
1436
|
+
const bi = oe((r) => {
|
|
1434
1437
|
var X;
|
|
1435
1438
|
const l = r.currentTarget, m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top;
|
|
1436
1439
|
if (ft.current = g, ve.current) {
|
|
@@ -1453,22 +1456,22 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1453
1456
|
return;
|
|
1454
1457
|
}
|
|
1455
1458
|
x.current.showCursorLine && O.markDirty("overlay");
|
|
1456
|
-
const v = x.current,
|
|
1457
|
-
if (R !== xe.current && (xe.current = R, O.markDirty("items"), (X = v.onItemHover) == null || X.call(v, R ?? null, r.nativeEvent)),
|
|
1458
|
-
const Y = Gt(g,
|
|
1459
|
-
Y === "left" && (N === "left" || N === "both") || Y === "right" && (N === "right" || N === "both") ? l.style.cursor = "col-resize" : v.canMove ? l.style.cursor = "grab" : l.style.cursor = "default";
|
|
1459
|
+
const v = x.current, M = Ue(g, u, L.current, v.intervalTree, v.layoutEngine, v.groups), R = M == null ? void 0 : M.id;
|
|
1460
|
+
if (R !== xe.current && (xe.current = R, O.markDirty("items"), (X = v.onItemHover) == null || X.call(v, R ?? null, r.nativeEvent)), M) {
|
|
1461
|
+
const Y = Gt(g, M, L.current), N = Nt(M, v.canResize);
|
|
1462
|
+
Y === "left" && (N === "left" || N === "both") || Y === "right" && (N === "right" || N === "both") ? l.style.cursor = "col-resize" : Zt(M, v.canMove) ? l.style.cursor = "grab" : l.style.cursor = "default";
|
|
1460
1463
|
} else
|
|
1461
1464
|
l.style.cursor = "default";
|
|
1462
|
-
}, [ie, O, Ne, ot]),
|
|
1465
|
+
}, [ie, O, Ne, ot]), yi = oe((r) => {
|
|
1463
1466
|
const l = x.current, m = r.currentTarget.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, l.intervalTree, l.layoutEngine, l.groups);
|
|
1464
1467
|
if (!v) {
|
|
1465
1468
|
ve.current = { startX: r.clientX, startY: r.clientY, lastX: r.clientX, lastY: r.clientY }, Oe.current = !1;
|
|
1466
1469
|
return;
|
|
1467
1470
|
}
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
}, [ie]),
|
|
1471
|
-
var
|
|
1471
|
+
const M = Gt(g, v, L.current), R = Nt(v, l.canResize);
|
|
1472
|
+
M === "left" && (R === "left" || R === "both") ? ie.startInteraction(v, "resize-left", g, u) : M === "right" && (R === "right" || R === "both") ? ie.startInteraction(v, "resize-right", g, u) : Zt(v, l.canMove) && ie.startInteraction(v, "move", g, u);
|
|
1473
|
+
}, [ie]), Ti = oe((r) => {
|
|
1474
|
+
var M, R, X, Y, N, ne;
|
|
1472
1475
|
const l = r.currentTarget;
|
|
1473
1476
|
if (ve.current) {
|
|
1474
1477
|
const z = Oe.current;
|
|
@@ -1495,7 +1498,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1495
1498
|
}
|
|
1496
1499
|
}
|
|
1497
1500
|
const Q = de ? de("move", z.item.id, V) : V, ae = x.current.hierarchyEngine.getMoveDelta(z.item.id, Q);
|
|
1498
|
-
(R = (
|
|
1501
|
+
(R = (M = x.current).onItemMove) == null || R.call(M, z.item.id, Q, Z.newGroupId, ae.length > 0 ? ae : void 0);
|
|
1499
1502
|
}
|
|
1500
1503
|
} else {
|
|
1501
1504
|
const Z = ie.endResize(q);
|
|
@@ -1515,29 +1518,29 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1515
1518
|
ie.isPending() && ie.cancel();
|
|
1516
1519
|
const m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, x.current.intervalTree, x.current.layoutEngine, x.current.groups);
|
|
1517
1520
|
v && ((ne = (N = x.current).onItemClick) == null || ne.call(N, v.id, r.nativeEvent));
|
|
1518
|
-
}, [ie, O]),
|
|
1519
|
-
var
|
|
1521
|
+
}, [ie, O]), Si = oe((r) => {
|
|
1522
|
+
var M, R;
|
|
1520
1523
|
const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
|
|
1521
1524
|
if (v)
|
|
1522
|
-
(
|
|
1525
|
+
(M = u.onItemDoubleClick) == null || M.call(u, v.id, r.nativeEvent);
|
|
1523
1526
|
else {
|
|
1524
1527
|
const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
|
|
1525
1528
|
X && ((R = u.onCanvasDoubleClick) == null || R.call(u, X.id, Y));
|
|
1526
1529
|
}
|
|
1527
|
-
}, []),
|
|
1528
|
-
var
|
|
1530
|
+
}, []), Mi = oe((r) => {
|
|
1531
|
+
var M, R;
|
|
1529
1532
|
r.preventDefault();
|
|
1530
1533
|
const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
|
|
1531
1534
|
if (v)
|
|
1532
|
-
(
|
|
1535
|
+
(M = u.onItemContextMenu) == null || M.call(u, v.id, r.nativeEvent);
|
|
1533
1536
|
else {
|
|
1534
1537
|
const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
|
|
1535
1538
|
X && ((R = u.onCanvasContextMenu) == null || R.call(u, X.id, Y, r.nativeEvent));
|
|
1536
1539
|
}
|
|
1537
|
-
}, []),
|
|
1540
|
+
}, []), wi = oe(() => {
|
|
1538
1541
|
var r, l;
|
|
1539
1542
|
ve.current = null, Oe.current = !1, ft.current = null, Le.current && (Le.current.style.cursor = "default"), xe.current !== void 0 && (xe.current = void 0, O.markDirty("items"), (l = (r = x.current).onItemHover) == null || l.call(r, null, new PointerEvent("pointerleave"))), x.current.showCursorLine && O.markDirty("overlay");
|
|
1540
|
-
}, [O]),
|
|
1543
|
+
}, [O]), ki = ee(() => {
|
|
1541
1544
|
const r = [];
|
|
1542
1545
|
return me.Children.forEach(ke, (l) => {
|
|
1543
1546
|
var g;
|
|
@@ -1552,9 +1555,9 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1552
1555
|
sidebarWidth: u.sidebarWidth ?? c,
|
|
1553
1556
|
theme: u.theme ?? we,
|
|
1554
1557
|
timezone: u.timezone ?? Je,
|
|
1555
|
-
onZoomToInterval: u.onZoomToInterval ?? ((v,
|
|
1558
|
+
onZoomToInterval: u.onZoomToInterval ?? ((v, M) => {
|
|
1556
1559
|
var R, X, Y, N;
|
|
1557
|
-
L.current.update({ visibleTimeStart: v, visibleTimeEnd:
|
|
1560
|
+
L.current.update({ visibleTimeStart: v, visibleTimeEnd: M }), O.markAllDirty(), $e(), (X = (R = x.current).onTimeChange) == null || X.call(R, v, M), (N = (Y = x.current).onZoom) == null || N.call(Y, v, M);
|
|
1558
1561
|
})
|
|
1559
1562
|
}));
|
|
1560
1563
|
}
|
|
@@ -1562,17 +1565,17 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1562
1565
|
}, [ke, Ft, Yt, Ce, c, we, Je, O, $e]), jt = U(!1);
|
|
1563
1566
|
ce(() => {
|
|
1564
1567
|
jt.current || (jt.current = !0, O.markAllDirty());
|
|
1565
|
-
}, [O]),
|
|
1568
|
+
}, [O]), Di(t, () => ({
|
|
1566
1569
|
captureToCanvas({ timeStart: r, timeEnd: l, scale: m, sidebarWidth: g }) {
|
|
1567
|
-
const u = x.current, v = 28,
|
|
1570
|
+
const u = x.current, v = 28, M = v * 3, R = u.groups.map((j) => u.layoutEngine.getGroupHeight(j.id)), X = [0];
|
|
1568
1571
|
for (let j = 0; j < R.length; j++)
|
|
1569
1572
|
X.push(X[j] + R[j]);
|
|
1570
|
-
const Y = X[R.length], N = L.current, ne = u.canvasWidth / (N.visibleTimeEnd - N.visibleTimeStart), z = l - r, J = Math.max(u.canvasWidth, Math.round(z * ne)), q = (g + J) * m, de = (
|
|
1573
|
+
const Y = X[R.length], N = L.current, ne = u.canvasWidth / (N.visibleTimeEnd - N.visibleTimeStart), z = l - r, J = Math.max(u.canvasWidth, Math.round(z * ne)), q = (g + J) * m, de = (M + Y) * m, Z = document.createElement("canvas");
|
|
1571
1574
|
Z.width = q, Z.height = de;
|
|
1572
1575
|
const C = Z.getContext("2d");
|
|
1573
1576
|
C.scale(m, m);
|
|
1574
1577
|
for (let j = 0; j < u.groups.length; j++) {
|
|
1575
|
-
const he = u.groups[j], ue = R[j], _ =
|
|
1578
|
+
const he = u.groups[j], ue = R[j], _ = M + X[j];
|
|
1576
1579
|
if (u.rowStyle) {
|
|
1577
1580
|
const Q = u.rowStyle(he);
|
|
1578
1581
|
Q != null && Q.backgroundColor && (C.fillStyle = Q.backgroundColor, C.fillRect(0, _, g, ue));
|
|
@@ -1606,7 +1609,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1606
1609
|
scrollTop: 0,
|
|
1607
1610
|
groupHeights: R
|
|
1608
1611
|
});
|
|
1609
|
-
return C.save(), C.translate(g,
|
|
1612
|
+
return C.save(), C.translate(g, M), C.beginPath(), C.rect(0, 0, J, Y), C.clip(), Fe.draw(C, ge, u.groups, u.theme, u.dayStyle, u.rowStyle, u.highlights, u.timezone), Ye.draw(C, ge, u.groups, u.items, u.intervalTree, u.layoutEngine, u.itemRenderer, u.groupRenderer, u.theme, u.selected, void 0, u.dependencies, u.summaryRenderer, u.hierarchyEngine), _e.draw(C, ge, u.theme, {
|
|
1610
1613
|
cursorX: null,
|
|
1611
1614
|
snapX: null,
|
|
1612
1615
|
markers: je.current,
|
|
@@ -1617,7 +1620,7 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1617
1620
|
const r = {
|
|
1618
1621
|
captureToCanvas({ timeStart: l, timeEnd: m, scale: g, sidebarWidth: u }) {
|
|
1619
1622
|
var ue;
|
|
1620
|
-
const v = x.current,
|
|
1623
|
+
const v = x.current, M = 28, R = M * 3, X = v.groups.map((_) => v.layoutEngine.getGroupHeight(_.id)), Y = [0];
|
|
1621
1624
|
for (let _ = 0; _ < X.length; _++)
|
|
1622
1625
|
Y.push(Y[_] + X[_]);
|
|
1623
1626
|
const N = Y[X.length], ne = L.current, z = v.canvasWidth / (ne.visibleTimeEnd - ne.visibleTimeStart), J = m - l, q = Math.max(v.canvasWidth, Math.round(J * z)), de = u + q, Z = R + N, C = document.createElement("canvas");
|
|
@@ -1630,8 +1633,8 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1630
1633
|
const ae = re.type ?? "";
|
|
1631
1634
|
let fe = 8, pe = "400", Pe = 11;
|
|
1632
1635
|
ae === "project" ? (pe = "700", Pe = 12) : ae === "control_area_group" ? pe = "600" : ae === "control_area" && (fe = 24), S.fillStyle = "#374151", S.font = `${pe} ${Pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, S.textBaseline = "middle";
|
|
1633
|
-
const
|
|
1634
|
-
S.fillText(
|
|
1636
|
+
const Ei = typeof re.title == "string" ? re.title : String(re.title);
|
|
1637
|
+
S.fillText(Ei, fe, G + V / 2, u - fe - 8);
|
|
1635
1638
|
}
|
|
1636
1639
|
S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.beginPath(), S.moveTo(u, 0), S.lineTo(u, Z), S.stroke(), S.restore(), S.save(), S.beginPath(), S.rect(u, 0, q, R), S.clip();
|
|
1637
1640
|
const ge = m - l, j = [
|
|
@@ -1640,15 +1643,15 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1640
1643
|
{ unit: "week", row: 2 }
|
|
1641
1644
|
];
|
|
1642
1645
|
for (const { unit: _, row: re } of j) {
|
|
1643
|
-
const V = re *
|
|
1644
|
-
S.fillStyle = "#F9FAFB", S.fillRect(u, V, q,
|
|
1646
|
+
const V = re * M;
|
|
1647
|
+
S.fillStyle = "#F9FAFB", S.fillRect(u, V, q, M);
|
|
1645
1648
|
let G = Te(l, v.timezone).startOf(_);
|
|
1646
1649
|
const Q = Te(m, v.timezone).add(1, _);
|
|
1647
1650
|
for (; G.isBefore(Q); ) {
|
|
1648
1651
|
const ae = G.add(1, _), fe = u + (G.valueOf() - l) / ge * q, pe = (ae.valueOf() - G.valueOf()) / ge * q;
|
|
1649
|
-
S.strokeStyle = "#E5E7EB", S.lineWidth = 0.5, S.strokeRect(fe, V, pe,
|
|
1652
|
+
S.strokeStyle = "#E5E7EB", S.lineWidth = 0.5, S.strokeRect(fe, V, pe, M);
|
|
1650
1653
|
let Pe;
|
|
1651
|
-
_ === "year" ? Pe = G.format("YYYY") : _ === "month" ? Pe = G.format("MM") : Pe = `${G.week()}`, S.fillStyle = "#6c737f", S.font = _ === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', S.textBaseline = "middle", S.textAlign = "center", pe > 20 && S.fillText(Pe, fe + pe / 2, V +
|
|
1654
|
+
_ === "year" ? Pe = G.format("YYYY") : _ === "month" ? Pe = G.format("MM") : Pe = `${G.week()}`, S.fillStyle = "#6c737f", S.font = _ === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', S.textBaseline = "middle", S.textAlign = "center", pe > 20 && S.fillText(Pe, fe + pe / 2, V + M / 2), G = ae;
|
|
1652
1655
|
}
|
|
1653
1656
|
}
|
|
1654
1657
|
S.textAlign = "start", S.restore(), S.save(), S.beginPath(), S.rect(u, R, q, N), S.clip(), S.translate(u, R);
|
|
@@ -1669,14 +1672,14 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1669
1672
|
};
|
|
1670
1673
|
Ke == null || Ke(r);
|
|
1671
1674
|
}, [Ke, Fe, Ye, _e]);
|
|
1672
|
-
const
|
|
1675
|
+
const Ci = {
|
|
1673
1676
|
position: "relative",
|
|
1674
1677
|
width: Ce,
|
|
1675
1678
|
height: ye,
|
|
1676
1679
|
overflow: "hidden",
|
|
1677
1680
|
cursor: "default"
|
|
1678
1681
|
}, bt = { position: "absolute", top: 0, left: 0 };
|
|
1679
|
-
return Ve("div", { ref: Ot, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [
|
|
1682
|
+
return Ve("div", { ref: Ot, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [li ? Ve("div", { style: {
|
|
1680
1683
|
position: "absolute",
|
|
1681
1684
|
top: 0,
|
|
1682
1685
|
left: 0,
|
|
@@ -1690,13 +1693,13 @@ const Qt = 32, dn = me.memo(Ei(function(e, t) {
|
|
|
1690
1693
|
borderBottomRightRadius: 4,
|
|
1691
1694
|
pointerEvents: "none",
|
|
1692
1695
|
userSelect: "none"
|
|
1693
|
-
}, children: ["v", "0.
|
|
1696
|
+
}, children: ["v", "0.8.0", " · ", "08:36:05"] }) : null, ki, Ve("div", { ref: Pt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [le(Kt, { groups: n, width: c, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: B, onScroll: (r) => {
|
|
1694
1697
|
L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
|
|
1695
|
-
} }), Ve("div", { ref: Le, style:
|
|
1698
|
+
} }), Ve("div", { ref: Le, style: Ci, onPointerMove: bi, onPointerDown: yi, onPointerUp: Ti, onDoubleClick: Si, onContextMenu: Mi, onPointerLeave: wi, children: [le("canvas", { ref: Dt, style: { ...bt, zIndex: 0 } }), le("canvas", { ref: It, style: { ...bt, zIndex: 1 } }), le("canvas", { ref: Rt, style: { ...bt, zIndex: 2 } })] }), ut && Et ? le(Kt, { groups: n, width: ut, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: Et, onScroll: (r) => {
|
|
1696
1699
|
L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
|
|
1697
1700
|
} }) : null] })] });
|
|
1698
1701
|
}));
|
|
1699
|
-
function
|
|
1702
|
+
function Ji({ children: i, theme: e, className: t, classNames: n, style: o, visibleTimeStart: d, visibleTimeEnd: s, canvasWidth: c, sidebarWidth: a = 0, onZoomToInterval: b, timezone: H }) {
|
|
1700
1703
|
const p = me.Children.map(i, (f) => {
|
|
1701
1704
|
var T;
|
|
1702
1705
|
if (!me.isValidElement(f))
|
|
@@ -1726,8 +1729,8 @@ function Ki({ children: i, theme: e, className: t, classNames: n, style: o, visi
|
|
|
1726
1729
|
...o
|
|
1727
1730
|
}, children: p });
|
|
1728
1731
|
}
|
|
1729
|
-
|
|
1730
|
-
var
|
|
1732
|
+
Ji.displayName = "TimelineHeaders";
|
|
1733
|
+
var si = { exports: {} };
|
|
1731
1734
|
(function(i, e) {
|
|
1732
1735
|
(function(t, n) {
|
|
1733
1736
|
i.exports = n();
|
|
@@ -1742,29 +1745,29 @@ var oi = { exports: {} };
|
|
|
1742
1745
|
var H = s(this).startOf(n).add(1, n).date(b), p = s(this).endOf(t);
|
|
1743
1746
|
if (H.isBefore(p)) return 1;
|
|
1744
1747
|
}
|
|
1745
|
-
var f = s(this).startOf(n).date(b).startOf(t).subtract(1, "millisecond"),
|
|
1746
|
-
return
|
|
1748
|
+
var f = s(this).startOf(n).date(b).startOf(t).subtract(1, "millisecond"), w = this.diff(f, t, !0);
|
|
1749
|
+
return w < 0 ? s(this).startOf("week").week() : Math.ceil(w);
|
|
1747
1750
|
}, c.weeks = function(a) {
|
|
1748
1751
|
return a === void 0 && (a = null), this.week(a);
|
|
1749
1752
|
};
|
|
1750
1753
|
};
|
|
1751
1754
|
});
|
|
1752
|
-
})(
|
|
1753
|
-
var
|
|
1754
|
-
const
|
|
1755
|
-
We.extend(
|
|
1756
|
-
const
|
|
1755
|
+
})(si);
|
|
1756
|
+
var Qi = si.exports;
|
|
1757
|
+
const en = /* @__PURE__ */ at(Qi);
|
|
1758
|
+
We.extend(en);
|
|
1759
|
+
const tn = {
|
|
1757
1760
|
year: 30,
|
|
1758
1761
|
month: 30,
|
|
1759
1762
|
week: 20,
|
|
1760
1763
|
day: 15,
|
|
1761
1764
|
hour: 30
|
|
1762
1765
|
};
|
|
1763
|
-
function
|
|
1766
|
+
function nn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: o, height: d = 28, className: s, labelFormat: c, onIntervalClick: a, minCellWidth: b, onZoomToInterval: H, timezone: p }) {
|
|
1764
1767
|
const f = ee(() => {
|
|
1765
1768
|
if (!e || !t || !n)
|
|
1766
1769
|
return [];
|
|
1767
|
-
const T = t - e, h = b ??
|
|
1770
|
+
const T = t - e, h = b ?? tn[i];
|
|
1768
1771
|
if (h > 0) {
|
|
1769
1772
|
const y = Te(e, p).startOf(i);
|
|
1770
1773
|
if ((y.add(1, i).valueOf() - y.valueOf()) / T * n < h)
|
|
@@ -1774,14 +1777,14 @@ function tn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
|
|
|
1774
1777
|
let P = Te(e, p).startOf(i).subtract(1, i);
|
|
1775
1778
|
const W = Te(t, p).add(2, i).valueOf();
|
|
1776
1779
|
for (; P.valueOf() < W; ) {
|
|
1777
|
-
const y = P.add(1, i), D = P.valueOf(),
|
|
1778
|
-
E.push({ start: D, end:
|
|
1780
|
+
const y = P.add(1, i), D = P.valueOf(), k = y.valueOf(), $ = (D - e) / T * n, B = (k - D) / T * n, I = rn(P, y, i, c);
|
|
1781
|
+
E.push({ start: D, end: k, label: I, left: $, width: B }), P = y;
|
|
1779
1782
|
}
|
|
1780
1783
|
return E;
|
|
1781
|
-
}, [e, t, n, i, c, b, p]),
|
|
1784
|
+
}, [e, t, n, i, c, b, p]), w = oe((T, h) => {
|
|
1782
1785
|
a ? a(T, h) : H && H(T, h);
|
|
1783
1786
|
}, [a, H]);
|
|
1784
|
-
return f.length === 0 ? null : le("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: f.map((T) => le("div", { className: s, onClick: () =>
|
|
1787
|
+
return f.length === 0 ? null : le("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: f.map((T) => le("div", { className: s, onClick: () => w(T.start, T.end), style: {
|
|
1785
1788
|
position: "absolute",
|
|
1786
1789
|
left: T.left,
|
|
1787
1790
|
width: T.width,
|
|
@@ -1802,11 +1805,11 @@ function tn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
|
|
|
1802
1805
|
boxSizing: "border-box"
|
|
1803
1806
|
}, children: le("span", { children: T.label }) }, T.start)) });
|
|
1804
1807
|
}
|
|
1805
|
-
|
|
1806
|
-
function
|
|
1807
|
-
return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) :
|
|
1808
|
+
nn.displayName = "DateHeader";
|
|
1809
|
+
function rn(i, e, t, n, o) {
|
|
1810
|
+
return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : on(i, t);
|
|
1808
1811
|
}
|
|
1809
|
-
function
|
|
1812
|
+
function on(i, e) {
|
|
1810
1813
|
switch (e) {
|
|
1811
1814
|
case "year":
|
|
1812
1815
|
return i.format("YYYY");
|
|
@@ -1820,24 +1823,24 @@ function rn(i, e) {
|
|
|
1820
1823
|
return i.format("HH:mm");
|
|
1821
1824
|
}
|
|
1822
1825
|
}
|
|
1823
|
-
function
|
|
1826
|
+
function sn({ width: i, children: e, style: t }) {
|
|
1824
1827
|
const n = () => ({ style: { width: i, ...t } });
|
|
1825
|
-
return e ? le(
|
|
1828
|
+
return e ? le(ti, { children: e({ getRootProps: n }) }) : le("div", { style: { width: i } });
|
|
1826
1829
|
}
|
|
1827
|
-
|
|
1828
|
-
function
|
|
1829
|
-
return le(
|
|
1830
|
+
sn.displayName = "SidebarHeader";
|
|
1831
|
+
function ln({ children: i }) {
|
|
1832
|
+
return le(ti, { children: i });
|
|
1830
1833
|
}
|
|
1831
|
-
|
|
1834
|
+
ln.displayName = "CustomHeader";
|
|
1832
1835
|
export {
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
+
fn as CanvasTimeline,
|
|
1837
|
+
ln as CustomHeader,
|
|
1838
|
+
qi as CustomMarker,
|
|
1836
1839
|
He as DEFAULT_THEME,
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1840
|
+
nn as DateHeader,
|
|
1841
|
+
Pi as HierarchyEngine,
|
|
1842
|
+
sn as SidebarHeader,
|
|
1843
|
+
Ji as TimelineHeaders,
|
|
1844
|
+
Ui as TodayMarker
|
|
1842
1845
|
};
|
|
1843
1846
|
//# sourceMappingURL=canvas-timeline.es.js.map
|