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