@canplot/react 0.5.13 → 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canplot.cjs +1 -1
- package/dist/canplot.cjs.map +1 -1
- package/dist/canplot.mjs +91 -79
- package/dist/canplot.mjs.map +1 -1
- package/dist/plot/LinePlot.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/canplot.mjs
CHANGED
|
@@ -381,7 +381,15 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
381
381
|
const t = new Le();
|
|
382
382
|
return t._updateFrame(e), t;
|
|
383
383
|
}, [e]);
|
|
384
|
-
}, st = ({
|
|
384
|
+
}, st = ({
|
|
385
|
+
layer: e = "MIDDLE",
|
|
386
|
+
data: t,
|
|
387
|
+
xScaleId: n,
|
|
388
|
+
yScaleId: s,
|
|
389
|
+
style: o,
|
|
390
|
+
globalAlpha: i,
|
|
391
|
+
xGapWidth: c
|
|
392
|
+
}) => (j(
|
|
385
393
|
e,
|
|
386
394
|
({ ctx: r, clampXPosToChartArea: u, clampYPosToChartArea: l, valToPos: y }) => {
|
|
387
395
|
r.save(), r.beginPath(), _(r, o);
|
|
@@ -389,8 +397,12 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
389
397
|
o?.lineDash && r.setLineDash(o.lineDash), i !== void 0 && (r.globalAlpha = i);
|
|
390
398
|
let a = null;
|
|
391
399
|
for (const g of t) {
|
|
392
|
-
const h = u(
|
|
393
|
-
|
|
400
|
+
const h = u(
|
|
401
|
+
y(g.x, n, "canvas")
|
|
402
|
+
), p = l(
|
|
403
|
+
y(g.y, s, "canvas")
|
|
404
|
+
);
|
|
405
|
+
h === null || p === null || (a !== null && c !== void 0 && g.x - a > c ? r.moveTo(h, p) : r.lineTo(h, p), a = g.x);
|
|
394
406
|
}
|
|
395
407
|
r.stroke(), d && r.setLineDash(d), r.restore();
|
|
396
408
|
},
|
|
@@ -425,13 +437,13 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
425
437
|
f = v;
|
|
426
438
|
} else
|
|
427
439
|
f = a(v, "canvas");
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
440
|
+
const x = y(p.y, s);
|
|
441
|
+
if (x !== null) {
|
|
430
442
|
if (i === "clip") {
|
|
431
443
|
if (!d(p.y, s)) continue;
|
|
432
|
-
m =
|
|
444
|
+
m = x;
|
|
433
445
|
} else
|
|
434
|
-
m = g(
|
|
446
|
+
m = g(x, "canvas");
|
|
435
447
|
f === null || m === null || h.push({ x: f, y: m });
|
|
436
448
|
}
|
|
437
449
|
}
|
|
@@ -478,15 +490,15 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
478
490
|
const v = d(m.x, t, "canvas");
|
|
479
491
|
if (v === null)
|
|
480
492
|
continue;
|
|
481
|
-
const
|
|
493
|
+
const x = v - p / 2 + i * p, T = g(
|
|
482
494
|
d(m.y, n, "canvas"),
|
|
483
495
|
"canvas"
|
|
484
496
|
);
|
|
485
497
|
if (T === null)
|
|
486
498
|
continue;
|
|
487
|
-
const w = h - T,
|
|
499
|
+
const w = h - T, b = a(x, "canvas"), S = a(x + p, "canvas") - b;
|
|
488
500
|
f.push({
|
|
489
|
-
x,
|
|
501
|
+
x: b,
|
|
490
502
|
y: T,
|
|
491
503
|
width: S,
|
|
492
504
|
height: w
|
|
@@ -570,8 +582,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
570
582
|
r.save(), r.fontKerning = "auto", _(r, {
|
|
571
583
|
...n
|
|
572
584
|
}), r.beginPath();
|
|
573
|
-
const
|
|
574
|
-
for (const { value: T } of
|
|
585
|
+
const x = Array.isArray(c) ? c : c({ ...d, axis: a }, y);
|
|
586
|
+
for (const { value: T } of x) {
|
|
575
587
|
const w = u(T, t, "canvas");
|
|
576
588
|
w !== null && (r.moveTo(w, p), r.lineTo(w, m));
|
|
577
589
|
}
|
|
@@ -583,14 +595,14 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
583
595
|
// alter font size for DPR
|
|
584
596
|
font: _e(s?.font ?? n?.font)
|
|
585
597
|
});
|
|
586
|
-
for (const { value: T, label: w } of
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
598
|
+
for (const { value: T, label: w } of x) {
|
|
599
|
+
const b = u(T, t, "canvas");
|
|
600
|
+
if (b === null)
|
|
589
601
|
continue;
|
|
590
602
|
const S = w.split(`
|
|
591
603
|
`);
|
|
592
604
|
for (let E = 0; E < S.length; E++)
|
|
593
|
-
r.fillText(S[E],
|
|
605
|
+
r.fillText(S[E], b, m + h * 2 + E * v);
|
|
594
606
|
}
|
|
595
607
|
r.restore();
|
|
596
608
|
},
|
|
@@ -610,8 +622,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
610
622
|
if (!d || !d.axis || d.origin !== "y") return;
|
|
611
623
|
const a = d.axis, g = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, h = g, p = i ?? 6, f = a.position === "left" ? g - p : g + p, m = o ?? 12, v = Array.isArray(c) ? c : c({ ...d, axis: a }, y);
|
|
612
624
|
r.save(), r.fontKerning = "auto", _(r, { ...n }), r.beginPath();
|
|
613
|
-
for (const { value:
|
|
614
|
-
const T = u(
|
|
625
|
+
for (const { value: x } of v) {
|
|
626
|
+
const T = u(x, t, "canvas");
|
|
615
627
|
T !== null && (r.moveTo(h, T), r.lineTo(f, T));
|
|
616
628
|
}
|
|
617
629
|
r.stroke(), r.restore(), r.save(), _(r, {
|
|
@@ -622,14 +634,14 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
622
634
|
// alter font size for DPR
|
|
623
635
|
font: _e(s?.font ?? n?.font)
|
|
624
636
|
});
|
|
625
|
-
for (const { value:
|
|
626
|
-
const w = u(
|
|
637
|
+
for (const { value: x, label: T } of v) {
|
|
638
|
+
const w = u(x, t, "canvas");
|
|
627
639
|
if (w === null)
|
|
628
640
|
continue;
|
|
629
|
-
const
|
|
641
|
+
const b = T.split(`
|
|
630
642
|
`);
|
|
631
|
-
for (let S = 0; S <
|
|
632
|
-
r.fillText(` ${
|
|
643
|
+
for (let S = 0; S < b.length; S++)
|
|
644
|
+
r.fillText(` ${b[S]} `, f, w + S * m);
|
|
633
645
|
}
|
|
634
646
|
r.restore();
|
|
635
647
|
},
|
|
@@ -675,7 +687,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
675
687
|
s.current(c, i);
|
|
676
688
|
}
|
|
677
689
|
), [t, e, s]);
|
|
678
|
-
}, we = R.createContext(""),
|
|
690
|
+
}, we = R.createContext(""), xe = (e, t) => {
|
|
679
691
|
const n = R.useContext(we);
|
|
680
692
|
return L(e, n, t);
|
|
681
693
|
}, ut = (e, t, n, s, o) => {
|
|
@@ -812,9 +824,9 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
812
824
|
}, p = k(h);
|
|
813
825
|
return p.current = h, ke(() => {
|
|
814
826
|
const f = (w) => {
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
...
|
|
827
|
+
const b = d.current;
|
|
828
|
+
b && M.spanselect.dispatchEvent(u, {
|
|
829
|
+
...b,
|
|
818
830
|
completed: !0
|
|
819
831
|
}), M.documentmouseup.dispatchEvent(u, {
|
|
820
832
|
frame: r.current,
|
|
@@ -826,35 +838,35 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
826
838
|
}
|
|
827
839
|
});
|
|
828
840
|
}, m = (w) => {
|
|
829
|
-
const
|
|
841
|
+
const b = {
|
|
830
842
|
ctrlKey: w.ctrlKey,
|
|
831
843
|
altKey: w.altKey,
|
|
832
844
|
shiftKey: w.shiftKey,
|
|
833
845
|
metaKey: w.metaKey
|
|
834
846
|
}, S = a.current;
|
|
835
|
-
if (S && Object.entries(
|
|
847
|
+
if (S && Object.entries(b).some(
|
|
836
848
|
([C, P]) => S.keys[C] !== P
|
|
837
849
|
)) {
|
|
838
|
-
const C = { ...S, keys:
|
|
850
|
+
const C = { ...S, keys: b };
|
|
839
851
|
a.current = C, M.sync_move.dispatchEvent(l, C);
|
|
840
852
|
}
|
|
841
853
|
const E = d.current;
|
|
842
|
-
if (E && Object.entries(
|
|
854
|
+
if (E && Object.entries(b).some(
|
|
843
855
|
([C, P]) => E.keys[C] !== P
|
|
844
856
|
)) {
|
|
845
857
|
w.stopPropagation(), w.preventDefault();
|
|
846
|
-
const C = { ...E, keys:
|
|
858
|
+
const C = { ...E, keys: b };
|
|
847
859
|
d.current = C, M.spanselect.dispatchEvent(u, C);
|
|
848
860
|
}
|
|
849
861
|
}, v = (w) => {
|
|
850
862
|
p.current(
|
|
851
863
|
w,
|
|
852
|
-
(
|
|
864
|
+
(b, { cssX: S, cssY: E }, C) => {
|
|
853
865
|
const P = y.current;
|
|
854
|
-
if (!P || !
|
|
855
|
-
const D = r.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, ee = F(D,
|
|
866
|
+
if (!P || !b.x || !b.y) return;
|
|
867
|
+
const D = r.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, ee = F(D, b.x.scaleId);
|
|
856
868
|
if (!ee) return;
|
|
857
|
-
const te = F(D,
|
|
869
|
+
const te = F(D, b.y.scaleId);
|
|
858
870
|
if (!te) return;
|
|
859
871
|
y.current = {
|
|
860
872
|
xRangeCss: { start: z, end: ae },
|
|
@@ -925,10 +937,10 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
925
937
|
);
|
|
926
938
|
}
|
|
927
939
|
);
|
|
928
|
-
},
|
|
929
|
-
p.current(w, (
|
|
940
|
+
}, x = (w) => {
|
|
941
|
+
p.current(w, (b, S, E) => {
|
|
930
942
|
const C = N(
|
|
931
|
-
|
|
943
|
+
b,
|
|
932
944
|
r.current
|
|
933
945
|
);
|
|
934
946
|
if (!C) return;
|
|
@@ -948,10 +960,10 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
948
960
|
};
|
|
949
961
|
document.addEventListener("mouseup", f), document.addEventListener("keydown", m), document.addEventListener("keyup", m), document.addEventListener("mousemove", v);
|
|
950
962
|
const T = i.current;
|
|
951
|
-
return T?.addEventListener("wheel",
|
|
963
|
+
return T?.addEventListener("wheel", x, {
|
|
952
964
|
passive: !1
|
|
953
965
|
}), () => {
|
|
954
|
-
document.removeEventListener("mouseup", f), document.removeEventListener("keydown", m), document.removeEventListener("keyup", m), document.removeEventListener("mousemove", v), T?.removeEventListener("wheel",
|
|
966
|
+
document.removeEventListener("mouseup", f), document.removeEventListener("keydown", m), document.removeEventListener("keyup", m), document.removeEventListener("mousemove", v), T?.removeEventListener("wheel", x);
|
|
955
967
|
};
|
|
956
968
|
}, [r, u, l, p]), L("sync_move", l, (f) => {
|
|
957
969
|
const m = f.positions ? N(
|
|
@@ -983,7 +995,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
983
995
|
f.preventDefault();
|
|
984
996
|
},
|
|
985
997
|
onClick: (f) => {
|
|
986
|
-
h(f, (m, v,
|
|
998
|
+
h(f, (m, v, x) => {
|
|
987
999
|
const T = N(
|
|
988
1000
|
m,
|
|
989
1001
|
r.current
|
|
@@ -991,30 +1003,30 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
991
1003
|
T && M.click.dispatchEvent(u, {
|
|
992
1004
|
pointer: T,
|
|
993
1005
|
frame: r.current,
|
|
994
|
-
keys:
|
|
1006
|
+
keys: x
|
|
995
1007
|
});
|
|
996
1008
|
});
|
|
997
1009
|
},
|
|
998
1010
|
onMouseLeave: (f) => {
|
|
999
|
-
h(f, (m, v,
|
|
1011
|
+
h(f, (m, v, x) => {
|
|
1000
1012
|
M.sync_move.dispatchEvent(l, {
|
|
1001
1013
|
positions: null,
|
|
1002
|
-
keys:
|
|
1014
|
+
keys: x,
|
|
1003
1015
|
originInteractionsId: u
|
|
1004
1016
|
});
|
|
1005
1017
|
});
|
|
1006
1018
|
},
|
|
1007
1019
|
onMouseMove: (f) => {
|
|
1008
|
-
h(f, (m, v,
|
|
1020
|
+
h(f, (m, v, x) => {
|
|
1009
1021
|
M.sync_move.dispatchEvent(l, {
|
|
1010
1022
|
positions: m,
|
|
1011
|
-
keys:
|
|
1023
|
+
keys: x,
|
|
1012
1024
|
originInteractionsId: u
|
|
1013
1025
|
});
|
|
1014
1026
|
});
|
|
1015
1027
|
},
|
|
1016
1028
|
onMouseDown: (f) => {
|
|
1017
|
-
h(f, (m, { cssX: v, cssY:
|
|
1029
|
+
h(f, (m, { cssX: v, cssY: x }, T) => {
|
|
1018
1030
|
const w = N(
|
|
1019
1031
|
m,
|
|
1020
1032
|
r.current
|
|
@@ -1025,12 +1037,12 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1025
1037
|
keys: T
|
|
1026
1038
|
}), y.current = {
|
|
1027
1039
|
xRangeCss: { start: v, end: v },
|
|
1028
|
-
yRangeCss: { start:
|
|
1040
|
+
yRangeCss: { start: x, end: x }
|
|
1029
1041
|
});
|
|
1030
1042
|
});
|
|
1031
1043
|
},
|
|
1032
1044
|
onMouseUp: (f) => {
|
|
1033
|
-
h(f, (m, v,
|
|
1045
|
+
h(f, (m, v, x) => {
|
|
1034
1046
|
const T = N(
|
|
1035
1047
|
m,
|
|
1036
1048
|
r.current
|
|
@@ -1039,15 +1051,15 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1039
1051
|
M.mouseup.dispatchEvent(u, {
|
|
1040
1052
|
frame: r.current,
|
|
1041
1053
|
pointer: T,
|
|
1042
|
-
keys:
|
|
1054
|
+
keys: x
|
|
1043
1055
|
});
|
|
1044
1056
|
const w = d.current;
|
|
1045
1057
|
d.current = null;
|
|
1046
|
-
const
|
|
1047
|
-
if (y.current = null,
|
|
1058
|
+
const b = y.current;
|
|
1059
|
+
if (y.current = null, b && w) {
|
|
1048
1060
|
const S = {
|
|
1049
1061
|
...w,
|
|
1050
|
-
keys:
|
|
1062
|
+
keys: x,
|
|
1051
1063
|
completed: !0
|
|
1052
1064
|
};
|
|
1053
1065
|
d.current = null, M.spanselect.dispatchEvent(
|
|
@@ -1058,7 +1070,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1058
1070
|
});
|
|
1059
1071
|
},
|
|
1060
1072
|
onContextMenu: (f) => {
|
|
1061
|
-
f.preventDefault(), h(f, (m, v,
|
|
1073
|
+
f.preventDefault(), h(f, (m, v, x) => {
|
|
1062
1074
|
const T = N(
|
|
1063
1075
|
m,
|
|
1064
1076
|
r.current
|
|
@@ -1066,12 +1078,12 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1066
1078
|
T && M.contextmenu.dispatchEvent(u, {
|
|
1067
1079
|
frame: r.current,
|
|
1068
1080
|
pointer: T,
|
|
1069
|
-
keys:
|
|
1081
|
+
keys: x
|
|
1070
1082
|
});
|
|
1071
1083
|
});
|
|
1072
1084
|
},
|
|
1073
1085
|
onDoubleClick: (f) => {
|
|
1074
|
-
h(f, (m, v,
|
|
1086
|
+
h(f, (m, v, x) => {
|
|
1075
1087
|
const T = N(
|
|
1076
1088
|
m,
|
|
1077
1089
|
r.current
|
|
@@ -1079,7 +1091,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1079
1091
|
T && M.dblclick.dispatchEvent(u, {
|
|
1080
1092
|
frame: r.current,
|
|
1081
1093
|
pointer: T,
|
|
1082
|
-
keys:
|
|
1094
|
+
keys: x
|
|
1083
1095
|
});
|
|
1084
1096
|
});
|
|
1085
1097
|
},
|
|
@@ -1088,7 +1100,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1088
1100
|
);
|
|
1089
1101
|
}, Yt = ({ data: e, renderTooltip: t, xScaleId: n }) => {
|
|
1090
1102
|
const [s, o] = B(null);
|
|
1091
|
-
|
|
1103
|
+
xe("move", (c) => {
|
|
1092
1104
|
o(c);
|
|
1093
1105
|
});
|
|
1094
1106
|
const i = Q(() => {
|
|
@@ -1104,8 +1116,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1104
1116
|
for (const [m, v] of a.points.entries()) {
|
|
1105
1117
|
if (!de(c, v.x, n) || !de(c, v.y, a.yScaleId))
|
|
1106
1118
|
continue;
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1119
|
+
const x = Math.abs(v.x - u);
|
|
1120
|
+
x < h && (h = x, g = m);
|
|
1109
1121
|
}
|
|
1110
1122
|
const p = a.points[g ?? -1], f = ge(c, h, n, "css");
|
|
1111
1123
|
if (!p || f === null || f > 30) {
|
|
@@ -1126,7 +1138,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1126
1138
|
return t(i);
|
|
1127
1139
|
}, Bt = ({ makeXStyle: e, makeXClassName: t, makeYStyle: n, makeYClassName: s }) => {
|
|
1128
1140
|
const [o, i] = B(null);
|
|
1129
|
-
if (
|
|
1141
|
+
if (xe("move", (a) => {
|
|
1130
1142
|
i(a);
|
|
1131
1143
|
}), !o)
|
|
1132
1144
|
return null;
|
|
@@ -1176,7 +1188,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1176
1188
|
] });
|
|
1177
1189
|
}, zt = ({ makeClassName: e, makeStyle: t }) => {
|
|
1178
1190
|
const [n, s] = B(null);
|
|
1179
|
-
|
|
1191
|
+
xe("spanselect", (i) => {
|
|
1180
1192
|
s(
|
|
1181
1193
|
i.mode === "below_threshold" || i.completed ? null : i
|
|
1182
1194
|
);
|
|
@@ -1249,7 +1261,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1249
1261
|
}, oe = [];
|
|
1250
1262
|
for (let e = -12; e <= 12; e++)
|
|
1251
1263
|
oe.push(1 * 10 ** e), oe.push(2 * 10 ** e), oe.push(5 * 10 ** e);
|
|
1252
|
-
const pt = 1, Oe = 1e3 * pt,
|
|
1264
|
+
const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, J = 60 * be, ce = 24 * J, yt = 30 * ce, gt = 365 * ce, vt = [
|
|
1253
1265
|
// second divisors
|
|
1254
1266
|
[1, "milliseconds"],
|
|
1255
1267
|
[2, "milliseconds"],
|
|
@@ -1309,7 +1321,7 @@ const pt = 1, Oe = 1e3 * pt, xe = 60 * Oe, J = 60 * xe, ce = 24 * J, yt = 30 * c
|
|
|
1309
1321
|
case "seconds":
|
|
1310
1322
|
return t * Oe;
|
|
1311
1323
|
case "minutes":
|
|
1312
|
-
return t *
|
|
1324
|
+
return t * be;
|
|
1313
1325
|
case "hours":
|
|
1314
1326
|
return t * J;
|
|
1315
1327
|
case "days":
|
|
@@ -1322,10 +1334,10 @@ const pt = 1, Oe = 1e3 * pt, xe = 60 * Oe, J = 60 * xe, ce = 24 * J, yt = 30 * c
|
|
|
1322
1334
|
}, wt = (e, t) => {
|
|
1323
1335
|
const n = new Date(e);
|
|
1324
1336
|
return n.setUTCMilliseconds(n.getUTCMilliseconds() + t), n.getTime();
|
|
1325
|
-
},
|
|
1337
|
+
}, xt = (e, t) => {
|
|
1326
1338
|
const n = new Date(e);
|
|
1327
1339
|
return n.setUTCSeconds(n.getUTCSeconds() + t), n.getTime();
|
|
1328
|
-
},
|
|
1340
|
+
}, bt = (e, t) => {
|
|
1329
1341
|
const n = new Date(e);
|
|
1330
1342
|
return n.setUTCMinutes(n.getUTCMinutes() + t), n.getTime();
|
|
1331
1343
|
}, Tt = (e, t) => {
|
|
@@ -1343,9 +1355,9 @@ const pt = 1, Oe = 1e3 * pt, xe = 60 * Oe, J = 60 * xe, ce = 24 * J, yt = 30 * c
|
|
|
1343
1355
|
case "milliseconds":
|
|
1344
1356
|
return wt(e, n);
|
|
1345
1357
|
case "seconds":
|
|
1346
|
-
return bt(e, n);
|
|
1347
|
-
case "minutes":
|
|
1348
1358
|
return xt(e, n);
|
|
1359
|
+
case "minutes":
|
|
1360
|
+
return bt(e, n);
|
|
1349
1361
|
case "hours":
|
|
1350
1362
|
return Tt(e, n);
|
|
1351
1363
|
case "days":
|
|
@@ -1380,7 +1392,7 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1380
1392
|
break;
|
|
1381
1393
|
case "minutes":
|
|
1382
1394
|
i.setUTCMinutes(
|
|
1383
|
-
Math.ceil(i.getTime() % J /
|
|
1395
|
+
Math.ceil(i.getTime() % J / be / s) * s,
|
|
1384
1396
|
0,
|
|
1385
1397
|
0
|
|
1386
1398
|
);
|
|
@@ -1501,9 +1513,9 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1501
1513
|
return (o) => {
|
|
1502
1514
|
const i = o[1] - o[0], c = i < ie([1, "days"]), r = i < ie([1, "minutes"]), u = i < ie([1, "seconds"]);
|
|
1503
1515
|
return o.map((l) => ({ value: l, label: s.formatToParts(new Date(l)) })).map((l, y, d) => {
|
|
1504
|
-
const a = d[y - 1], g = y === 0 || Y(l.label, a.label, "year"), h = y === 0 || Y(l.label, a.label, "day"), p = y === 0 || Y(l.label, a.label, "month"), f = y === 0 || Y(l.label, a.label, "hour"), m = y === 0 || Y(l.label, a.label, "timeZoneName"), v = y === 0 || Y(l.label, a.label, "minute"),
|
|
1505
|
-
if (c && (f || v || m ||
|
|
1506
|
-
const
|
|
1516
|
+
const a = d[y - 1], g = y === 0 || Y(l.label, a.label, "year"), h = y === 0 || Y(l.label, a.label, "day"), p = y === 0 || Y(l.label, a.label, "month"), f = y === 0 || Y(l.label, a.label, "hour"), m = y === 0 || Y(l.label, a.label, "timeZoneName"), v = y === 0 || Y(l.label, a.label, "minute"), x = y === 0 || Y(l.label, a.label, "second"), T = y === 0 || Y(l.label, a.label, "fractionalSecond"), w = [];
|
|
1517
|
+
if (c && (f || v || m || x || T)) {
|
|
1518
|
+
const b = l.label.find((P) => P.type === "hour")?.value, S = l.label.find((P) => P.type === "minute")?.value, E = l.label.find((P) => P.type === "timeZoneName")?.value;
|
|
1507
1519
|
let C = "";
|
|
1508
1520
|
if (r) {
|
|
1509
1521
|
const P = l.label.find((z) => z.type === "second")?.value, D = l.label.find(
|
|
@@ -1512,17 +1524,17 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1512
1524
|
C = `:${P}` + (u ? `.${D}` : "");
|
|
1513
1525
|
}
|
|
1514
1526
|
w.push(
|
|
1515
|
-
`${
|
|
1527
|
+
`${b}:${S}${C}` + (n && m ? ` ${E}` : "")
|
|
1516
1528
|
);
|
|
1517
1529
|
}
|
|
1518
1530
|
return (h || p) && w.push(
|
|
1519
1531
|
[
|
|
1520
|
-
l.label.find((
|
|
1521
|
-
h && l.label.find((
|
|
1532
|
+
l.label.find((b) => b.type === "month")?.value,
|
|
1533
|
+
h && l.label.find((b) => b.type === "day")?.value
|
|
1522
1534
|
].filter(Boolean).join(" ")
|
|
1523
|
-
), g && w.push(l.label.find((
|
|
1535
|
+
), g && w.push(l.label.find((b) => b.type === "year")?.value), {
|
|
1524
1536
|
value: l.value,
|
|
1525
|
-
label: w.filter((
|
|
1537
|
+
label: w.filter((b) => b).join(`
|
|
1526
1538
|
`)
|
|
1527
1539
|
};
|
|
1528
1540
|
});
|
|
@@ -1560,7 +1572,7 @@ export {
|
|
|
1560
1572
|
kt as sum,
|
|
1561
1573
|
j as useDrawEffect,
|
|
1562
1574
|
Ue as useFrameState,
|
|
1563
|
-
|
|
1575
|
+
xe as useInteractionsEvent,
|
|
1564
1576
|
de as valFits,
|
|
1565
1577
|
Z as valToPos,
|
|
1566
1578
|
ge as valToPxDistance
|