@savvycal/calendar 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -41
- package/dist/components/day-grid-view/DayColumn.d.ts +5 -1
- package/dist/components/day-grid-view/DayColumn.d.ts.map +1 -1
- package/dist/components/day-grid-view/DayColumn.js +6 -48
- package/dist/components/day-grid-view/DayGridView.d.ts +1 -1
- package/dist/components/day-grid-view/DayGridView.d.ts.map +1 -1
- package/dist/components/day-grid-view/DayGridView.js +168 -155
- package/dist/components/day-grid-view/defaults.d.ts.map +1 -1
- package/dist/components/day-grid-view/defaults.js +7 -1
- package/dist/components/resource-grid-view/ResourceColumn.d.ts +5 -1
- package/dist/components/resource-grid-view/ResourceColumn.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceColumn.js +8 -49
- package/dist/components/resource-grid-view/ResourceGridView.d.ts +1 -1
- package/dist/components/resource-grid-view/ResourceGridView.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceGridView.js +182 -169
- package/dist/components/resource-grid-view/defaults.d.ts.map +1 -1
- package/dist/components/resource-grid-view/defaults.js +7 -1
- package/dist/components/shared/EventChip.d.ts.map +1 -1
- package/dist/components/shared/EventChip.js +42 -42
- package/dist/components/shared/OverflowChip.d.ts +13 -0
- package/dist/components/shared/OverflowChip.d.ts.map +1 -0
- package/dist/components/shared/OverflowChip.js +125 -0
- package/dist/components/shared/SlotInteractionLayer.d.ts.map +1 -1
- package/dist/components/shared/SlotInteractionLayer.js +138 -125
- package/dist/components/shared/TimedEventLayer.d.ts +26 -0
- package/dist/components/shared/TimedEventLayer.d.ts.map +1 -0
- package/dist/components/shared/TimedEventLayer.js +83 -0
- package/dist/components/shared/useColumnWidth.d.ts +5 -0
- package/dist/components/shared/useColumnWidth.d.ts.map +1 -0
- package/dist/components/shared/useColumnWidth.js +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/autoScroll.d.ts +44 -0
- package/dist/lib/autoScroll.d.ts.map +1 -0
- package/dist/lib/autoScroll.js +78 -0
- package/dist/lib/overlap.d.ts +13 -0
- package/dist/lib/overlap.d.ts.map +1 -1
- package/dist/lib/overlap.js +216 -118
- package/dist/types/calendar.d.ts +56 -0
- package/dist/types/calendar.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { formatEventStartTime as
|
|
5
|
-
import { getEventLabel as
|
|
6
|
-
const
|
|
7
|
-
positioned:
|
|
8
|
-
fallbackColor:
|
|
1
|
+
import { jsx as o, jsxs as h, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { memo as z } from "react";
|
|
3
|
+
import { cn as B } from "../../lib/utils.js";
|
|
4
|
+
import { formatEventStartTime as K, formatTimeRange as O } from "../../lib/time.js";
|
|
5
|
+
import { getEventLabel as q, getClientNameLabel as A } from "../../lib/accessibility.js";
|
|
6
|
+
const U = z(function({
|
|
7
|
+
positioned: c,
|
|
8
|
+
fallbackColor: S,
|
|
9
9
|
timeZone: x,
|
|
10
10
|
cls: n,
|
|
11
11
|
onClick: g,
|
|
@@ -17,19 +17,19 @@ const R = P(function({
|
|
|
17
17
|
isSelected: T,
|
|
18
18
|
selectedEventRef: C
|
|
19
19
|
}) {
|
|
20
|
-
const { event: e, top: $, height:
|
|
21
|
-
let
|
|
20
|
+
const { event: e, top: $, height: m, subColumn: s, totalSubColumns: a } = c, y = c.colSpan ?? 1, d = e.color ?? S;
|
|
21
|
+
let p, u, l;
|
|
22
22
|
if (w === "stacked") {
|
|
23
23
|
const t = (a - 1) * b;
|
|
24
|
-
|
|
24
|
+
p = s > 0 ? `${s * b}px` : "0", u = t > 0 ? `calc(100% - ${t}px)` : "100%", l = s + 1;
|
|
25
25
|
} else {
|
|
26
|
-
const t = s / a * 100, r =
|
|
27
|
-
|
|
26
|
+
const t = s / a * 100, r = y / a * 100, L = k, I = s * L / a, v = (a - y) * L / a;
|
|
27
|
+
p = v ? `calc(${t}% + ${I}px)` : `${t}%`, u = v ? `calc(${r}% - ${v}px)` : `${r}%`;
|
|
28
28
|
}
|
|
29
|
-
T && (
|
|
30
|
-
const E =
|
|
29
|
+
c.overlay && (l = 8), T && (l = 20);
|
|
30
|
+
const E = m >= 36, j = m >= 52, D = e.status === "canceled";
|
|
31
31
|
if (N) {
|
|
32
|
-
const t = N({ event: e, position:
|
|
32
|
+
const t = N({ event: e, position: c });
|
|
33
33
|
if (t)
|
|
34
34
|
return /* @__PURE__ */ o(
|
|
35
35
|
"div",
|
|
@@ -38,35 +38,35 @@ const R = P(function({
|
|
|
38
38
|
style: {
|
|
39
39
|
position: "absolute",
|
|
40
40
|
top: $,
|
|
41
|
-
height:
|
|
42
|
-
left:
|
|
43
|
-
width:
|
|
44
|
-
zIndex:
|
|
41
|
+
height: m,
|
|
42
|
+
left: p,
|
|
43
|
+
width: u,
|
|
44
|
+
zIndex: l,
|
|
45
45
|
pointerEvents: i ? "auto" : "none"
|
|
46
46
|
},
|
|
47
47
|
children: t
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
-
const
|
|
51
|
+
const f = K(e.startTime, x), F = i ? (() => {
|
|
52
52
|
const t = [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
], r =
|
|
53
|
+
q(e),
|
|
54
|
+
O(e.startTime, e.endTime, x)
|
|
55
|
+
], r = A(e);
|
|
56
56
|
return r && t.push(r), e.status === "canceled" ? t.push("canceled") : e.status === "tentative" && t.push("tentative"), t.join(", ");
|
|
57
57
|
})() : void 0;
|
|
58
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ h(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
ref: C,
|
|
62
|
-
...i ? { role: "button", tabIndex: 0, "aria-label":
|
|
63
|
-
className:
|
|
62
|
+
...i ? { role: "button", tabIndex: 0, "aria-label": F } : {},
|
|
63
|
+
className: B(n("event"), T && n("eventSelected")),
|
|
64
64
|
style: {
|
|
65
65
|
top: $,
|
|
66
|
-
height:
|
|
67
|
-
left:
|
|
68
|
-
width:
|
|
69
|
-
zIndex:
|
|
66
|
+
height: m,
|
|
67
|
+
left: p,
|
|
68
|
+
width: u,
|
|
69
|
+
zIndex: l,
|
|
70
70
|
pointerEvents: i ? "auto" : "none"
|
|
71
71
|
},
|
|
72
72
|
...i ? {
|
|
@@ -76,41 +76,41 @@ const R = P(function({
|
|
|
76
76
|
}
|
|
77
77
|
} : {},
|
|
78
78
|
children: [
|
|
79
|
-
|
|
79
|
+
d && /* @__PURE__ */ o(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
82
82
|
className: n("eventColorBar"),
|
|
83
83
|
style: e.status === "tentative" ? {
|
|
84
84
|
backgroundImage: `repeating-linear-gradient(
|
|
85
85
|
-45deg,
|
|
86
|
-
${
|
|
87
|
-
${
|
|
86
|
+
${d},
|
|
87
|
+
${d} 3px,
|
|
88
88
|
transparent 3px,
|
|
89
89
|
transparent 6px
|
|
90
90
|
)`
|
|
91
|
-
} : { backgroundColor:
|
|
91
|
+
} : { backgroundColor: d }
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
94
|
/* @__PURE__ */ o(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
className: n("eventTitle"),
|
|
98
|
-
style:
|
|
98
|
+
style: D ? { textDecoration: "line-through" } : void 0,
|
|
99
99
|
children: e.title
|
|
100
100
|
}
|
|
101
101
|
),
|
|
102
|
-
E && (
|
|
103
|
-
/* @__PURE__ */ o("div", { className: n("eventTime"), children:
|
|
102
|
+
E && (j ? /* @__PURE__ */ h(P, { children: [
|
|
103
|
+
/* @__PURE__ */ o("div", { className: n("eventTime"), children: f }),
|
|
104
104
|
e.clientName && /* @__PURE__ */ o("div", { className: n("eventClientName"), children: e.clientName })
|
|
105
|
-
] }) : e.clientName ? /* @__PURE__ */
|
|
106
|
-
|
|
105
|
+
] }) : e.clientName ? /* @__PURE__ */ h("div", { className: n("eventTime"), children: [
|
|
106
|
+
f,
|
|
107
107
|
", ",
|
|
108
108
|
e.clientName
|
|
109
|
-
] }) : /* @__PURE__ */ o("div", { className: n("eventTime"), children:
|
|
109
|
+
] }) : /* @__PURE__ */ o("div", { className: n("eventTime"), children: f }))
|
|
110
110
|
]
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
});
|
|
114
114
|
export {
|
|
115
|
-
|
|
115
|
+
U as EventChip
|
|
116
116
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CalendarEvent, GridViewClassNames, OverflowClickInfo, OverflowPopoverRenderProps } from '../../types/calendar';
|
|
2
|
+
import { OverflowGroup } from '../../lib/overlap';
|
|
3
|
+
interface OverflowChipProps {
|
|
4
|
+
group: OverflowGroup;
|
|
5
|
+
timeZone: string;
|
|
6
|
+
cls: (key: keyof GridViewClassNames) => string;
|
|
7
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
8
|
+
onOverflowClick?: (info: OverflowClickInfo) => void;
|
|
9
|
+
renderOverflowPopover?: (props: OverflowPopoverRenderProps) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function OverflowChip({ group, timeZone, cls, onEventClick, onOverflowClick, renderOverflowPopover, }: OverflowChipProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=OverflowChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverflowChip.d.ts","sourceRoot":"","sources":["../../../src/components/shared/OverflowChip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,UAAU,iBAAiB;IACzB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpD,qBAAqB,CAAC,EAAE,CACtB,KAAK,EAAE,0BAA0B,KAC9B,KAAK,CAAC,SAAS,CAAC;CACtB;AAID,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,GAAG,EACH,YAAY,EACZ,eAAe,EACf,qBAAqB,GACtB,EAAE,iBAAiB,2CAqInB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsx as a, jsxs as x, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useRef as L, useLayoutEffect as k, useEffect as O } from "react";
|
|
3
|
+
import { createPortal as z } from "react-dom";
|
|
4
|
+
import { formatTimeRange as H } from "../../lib/time.js";
|
|
5
|
+
import { getEventLabel as I } from "../../lib/accessibility.js";
|
|
6
|
+
const P = 256;
|
|
7
|
+
function F({
|
|
8
|
+
group: o,
|
|
9
|
+
timeZone: v,
|
|
10
|
+
cls: t,
|
|
11
|
+
onEventClick: f,
|
|
12
|
+
onOverflowClick: r,
|
|
13
|
+
renderOverflowPopover: y
|
|
14
|
+
}) {
|
|
15
|
+
const [n, u] = g(!1), l = L(null), w = L(null), [h, C] = g({ top: 0, left: 0 }), c = o.events.length, T = `+${c}`, E = `${c} more event${c === 1 ? "" : "s"}`, p = () => u(!1);
|
|
16
|
+
k(() => {
|
|
17
|
+
if (!n) return;
|
|
18
|
+
const e = () => {
|
|
19
|
+
const i = l.current?.getBoundingClientRect();
|
|
20
|
+
if (!i) return;
|
|
21
|
+
let s = i.right + 8;
|
|
22
|
+
s + P > window.innerWidth - 8 && (s = Math.max(8, i.left - P - 8));
|
|
23
|
+
const d = Math.min(320, 16 + c * 52);
|
|
24
|
+
let m = i.top;
|
|
25
|
+
m + d > window.innerHeight - 8 && (m = Math.max(8, window.innerHeight - d - 8)), C({ top: m, left: s });
|
|
26
|
+
};
|
|
27
|
+
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
28
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
29
|
+
};
|
|
30
|
+
}, [n, c]), O(() => {
|
|
31
|
+
if (!n) return;
|
|
32
|
+
const e = (s) => {
|
|
33
|
+
s.key === "Escape" && p();
|
|
34
|
+
}, i = (s) => {
|
|
35
|
+
const d = s.target;
|
|
36
|
+
l.current?.contains(d) || w.current?.contains(d) || p();
|
|
37
|
+
};
|
|
38
|
+
return document.addEventListener("keydown", e), document.addEventListener("pointerdown", i), () => {
|
|
39
|
+
document.removeEventListener("keydown", e), document.removeEventListener("pointerdown", i);
|
|
40
|
+
};
|
|
41
|
+
}, [n]);
|
|
42
|
+
const N = () => {
|
|
43
|
+
const e = !n;
|
|
44
|
+
u(e), e && l.current && r?.({
|
|
45
|
+
events: o.events,
|
|
46
|
+
anchor: l.current
|
|
47
|
+
});
|
|
48
|
+
}, b = n ? y?.({
|
|
49
|
+
events: o.events,
|
|
50
|
+
onClose: p,
|
|
51
|
+
onEventClick: f
|
|
52
|
+
}) ?? /* @__PURE__ */ a(
|
|
53
|
+
M,
|
|
54
|
+
{
|
|
55
|
+
events: o.events,
|
|
56
|
+
timeZone: v,
|
|
57
|
+
cls: t,
|
|
58
|
+
onEventClick: (e) => {
|
|
59
|
+
f?.(e), p();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
) : null;
|
|
63
|
+
return /* @__PURE__ */ x(R, { children: [
|
|
64
|
+
/* @__PURE__ */ a(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
ref: l,
|
|
68
|
+
type: "button",
|
|
69
|
+
className: t("overflowChip"),
|
|
70
|
+
style: {
|
|
71
|
+
top: o.top,
|
|
72
|
+
zIndex: 25,
|
|
73
|
+
pointerEvents: "auto"
|
|
74
|
+
},
|
|
75
|
+
"aria-label": E,
|
|
76
|
+
"aria-expanded": n,
|
|
77
|
+
"aria-haspopup": "dialog",
|
|
78
|
+
onClick: N,
|
|
79
|
+
children: /* @__PURE__ */ a("span", { className: t("overflowChipLabel"), children: T })
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
n && b && z(
|
|
83
|
+
/* @__PURE__ */ a(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
ref: w,
|
|
87
|
+
role: "dialog",
|
|
88
|
+
"aria-label": E,
|
|
89
|
+
className: t("overflowPopover"),
|
|
90
|
+
style: {
|
|
91
|
+
position: "fixed",
|
|
92
|
+
top: h.top,
|
|
93
|
+
left: h.left,
|
|
94
|
+
zIndex: 50
|
|
95
|
+
},
|
|
96
|
+
children: b
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
document.body
|
|
100
|
+
)
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
function M({
|
|
104
|
+
events: o,
|
|
105
|
+
timeZone: v,
|
|
106
|
+
cls: t,
|
|
107
|
+
onEventClick: f
|
|
108
|
+
}) {
|
|
109
|
+
return /* @__PURE__ */ a("div", { children: o.map((r) => /* @__PURE__ */ x(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
type: "button",
|
|
113
|
+
className: t("overflowPopoverEvent"),
|
|
114
|
+
onClick: () => f?.(r),
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ a("div", { className: t("overflowPopoverTitle"), children: I(r) }),
|
|
117
|
+
/* @__PURE__ */ a("div", { className: t("overflowPopoverTime"), children: H(r.startTime, r.endTime, v) })
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
r.id
|
|
121
|
+
)) });
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
F as OverflowChip
|
|
125
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotInteractionLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SlotInteractionLayer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SlotInteractionLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SlotInteractionLayer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAU1B,UAAU,yBAAyB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;QAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;KACjC,KAAK,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;QAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;KACjC,GAAG,IAAI,KACL,IAAI,CAAC;IACV,qBAAqB,CAAC,EAAE,mBAAmB,CAAC;IAC5C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AAyBD,eAAO,MAAM,oBAAoB,iEA6V/B,CAAC"}
|
|
@@ -1,206 +1,219 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as lt, jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { memo as at, useState as X, useRef as e, useCallback as l, useLayoutEffect as ft, useEffect as dt } from "react";
|
|
3
|
+
import { computeAutoScrollIntensity as mt, findVerticalScrollParent as Mt, createVerticalAutoScroller as ht } from "../../lib/autoScroll.js";
|
|
4
|
+
import { buildSyntheticEvent as gt } from "../../lib/selection.js";
|
|
5
|
+
import { EventChip as vt } from "./EventChip.js";
|
|
6
|
+
function S(w, M, L) {
|
|
7
|
+
const h = Math.floor(M / 60), s = M % 60;
|
|
8
|
+
return h >= 24 ? w.add({ days: Math.floor(h / 24) }).toPlainDateTime({ hour: h % 24, minute: s }).toZonedDateTime(L) : w.toPlainDateTime({ hour: h, minute: s }).toZonedDateTime(L);
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
-
columnId:
|
|
11
|
-
fallbackColor:
|
|
10
|
+
const Ct = at(function({
|
|
11
|
+
columnId: M,
|
|
12
|
+
fallbackColor: L,
|
|
12
13
|
column: h,
|
|
13
|
-
date:
|
|
14
|
+
date: s,
|
|
14
15
|
timeZone: a,
|
|
15
|
-
startHour:
|
|
16
|
-
endHour:
|
|
17
|
-
hourHeight:
|
|
18
|
-
snapDuration:
|
|
19
|
-
placeholderDuration:
|
|
20
|
-
cls:
|
|
16
|
+
startHour: _,
|
|
17
|
+
endHour: $,
|
|
18
|
+
hourHeight: Z,
|
|
19
|
+
snapDuration: y,
|
|
20
|
+
placeholderDuration: i,
|
|
21
|
+
cls: Y,
|
|
21
22
|
onSlotClick: x,
|
|
22
|
-
onSelect:
|
|
23
|
-
dragPreviewAppearance:
|
|
24
|
-
renderEvent:
|
|
23
|
+
onSelect: g,
|
|
24
|
+
dragPreviewAppearance: q = "highlight",
|
|
25
|
+
renderEvent: tt
|
|
25
26
|
}) {
|
|
26
|
-
const [
|
|
27
|
+
const [H, z] = X(null), [u, O] = X(null), C = e(null), v = e(null), F = e(!1), P = e(0), b = e(null), p = e(null), G = e(() => {
|
|
28
|
+
}), J = e(g), K = e(M), N = e(s), j = e(a), R = _ * 60, D = $ * 60, f = Z / 60, d = l(
|
|
27
29
|
(n) => {
|
|
28
|
-
const t = n /
|
|
29
|
-
return
|
|
30
|
+
const t = n / f, r = Math.floor(t / y) * y, o = R + r;
|
|
31
|
+
return o + i > D || o < R ? null : o;
|
|
30
32
|
},
|
|
31
33
|
[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
f,
|
|
35
|
+
y,
|
|
36
|
+
i,
|
|
37
|
+
R,
|
|
38
|
+
D
|
|
37
39
|
]
|
|
38
|
-
),
|
|
39
|
-
const r = Math.min(n, t),
|
|
40
|
-
Math.max(n, t) +
|
|
41
|
-
|
|
40
|
+
), Q = e(d), I = e(D), nt = e(y), U = e(i), W = l((n, t) => {
|
|
41
|
+
const r = Math.min(n, t), o = Math.min(
|
|
42
|
+
Math.max(n, t) + U.current,
|
|
43
|
+
I.current
|
|
42
44
|
);
|
|
43
|
-
return { startMin: r, endMin:
|
|
44
|
-
}, []),
|
|
45
|
+
return { startMin: r, endMin: o };
|
|
46
|
+
}, []), V = l(
|
|
45
47
|
(n) => {
|
|
46
|
-
const t = v.current, r =
|
|
48
|
+
const t = v.current, r = C.current;
|
|
47
49
|
if (!t || !r) return;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
F == null && (F = Y.current - N.current);
|
|
54
|
-
const I = K(t.anchorSlotStart, F);
|
|
55
|
-
t.currentStartMin = I.startMin, t.currentEndMin = I.endMin, t.moved = !0, B(I);
|
|
50
|
+
const o = r.getBoundingClientRect(), c = Math.max(0, Math.min(n - o.top, o.height));
|
|
51
|
+
let m = Q.current(c);
|
|
52
|
+
m == null && (m = I.current - U.current);
|
|
53
|
+
const T = W(t.anchorSlotStart, m), it = t.moved && t.currentStartMin === T.startMin && t.currentEndMin === T.endMin;
|
|
54
|
+
t.currentStartMin = T.startMin, t.currentEndMin = T.endMin, t.moved = !0, it || O(T);
|
|
56
55
|
},
|
|
57
|
-
[
|
|
58
|
-
),
|
|
59
|
-
|
|
56
|
+
[W]
|
|
57
|
+
), E = l(
|
|
58
|
+
(n) => {
|
|
59
|
+
P.current = n.clientY, V(n.clientY);
|
|
60
|
+
const t = b.current;
|
|
61
|
+
if (!t) return;
|
|
62
|
+
const r = t.getBoundingClientRect();
|
|
63
|
+
mt(n.clientY, r.top, r.bottom) !== 0 && p.current?.ensure();
|
|
64
|
+
},
|
|
65
|
+
[V]
|
|
66
|
+
), A = e(() => {
|
|
67
|
+
}), k = l(() => {
|
|
68
|
+
p.current?.stop(), p.current = null, b.current = null;
|
|
60
69
|
const n = v.current;
|
|
61
|
-
n && (n.moved && (
|
|
62
|
-
columnId:
|
|
63
|
-
startTime:
|
|
64
|
-
|
|
70
|
+
n && (n.moved && (F.current = !0), J.current?.({
|
|
71
|
+
columnId: K.current,
|
|
72
|
+
startTime: S(
|
|
73
|
+
N.current,
|
|
65
74
|
n.currentStartMin,
|
|
66
|
-
|
|
75
|
+
j.current
|
|
67
76
|
),
|
|
68
|
-
endTime:
|
|
69
|
-
|
|
77
|
+
endTime: S(
|
|
78
|
+
N.current,
|
|
70
79
|
n.currentEndMin,
|
|
71
|
-
|
|
80
|
+
j.current
|
|
72
81
|
)
|
|
73
|
-
})), v.current = null,
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}),
|
|
78
|
-
document.removeEventListener("mousemove",
|
|
79
|
-
}, [
|
|
80
|
-
const
|
|
82
|
+
})), v.current = null, O(null), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", A.current);
|
|
83
|
+
}, [E]);
|
|
84
|
+
ft(() => {
|
|
85
|
+
J.current = g, K.current = M, N.current = s, j.current = a, Q.current = d, I.current = D, nt.current = y, U.current = i, A.current = k, G.current = V;
|
|
86
|
+
}), dt(() => () => {
|
|
87
|
+
p.current?.stop(), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", A.current);
|
|
88
|
+
}, [E]);
|
|
89
|
+
const et = l(
|
|
81
90
|
(n) => {
|
|
82
|
-
if (!
|
|
83
|
-
const t =
|
|
91
|
+
if (!g) return;
|
|
92
|
+
const t = C.current;
|
|
84
93
|
if (!t) return;
|
|
85
|
-
const r = t.getBoundingClientRect(),
|
|
86
|
-
if (
|
|
87
|
-
n.preventDefault(),
|
|
88
|
-
const
|
|
94
|
+
const r = t.getBoundingClientRect(), o = n.clientY - r.top, c = d(o);
|
|
95
|
+
if (c == null) return;
|
|
96
|
+
n.preventDefault(), g(null);
|
|
97
|
+
const m = c + i;
|
|
89
98
|
v.current = {
|
|
90
|
-
anchorSlotStart:
|
|
91
|
-
currentStartMin:
|
|
92
|
-
currentEndMin:
|
|
99
|
+
anchorSlotStart: c,
|
|
100
|
+
currentStartMin: c,
|
|
101
|
+
currentEndMin: m,
|
|
93
102
|
moved: !1
|
|
94
|
-
},
|
|
103
|
+
}, P.current = n.clientY, b.current = Mt(t), p.current?.stop(), p.current = ht({
|
|
104
|
+
getPointerY: () => P.current,
|
|
105
|
+
getScrollParent: () => b.current,
|
|
106
|
+
onScroll: () => G.current(P.current)
|
|
107
|
+
}), O({ startMin: c, endMin: m }), document.addEventListener("mousemove", E), document.addEventListener("mouseup", k);
|
|
95
108
|
},
|
|
96
109
|
[
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
g,
|
|
111
|
+
d,
|
|
112
|
+
i,
|
|
113
|
+
E,
|
|
114
|
+
k
|
|
102
115
|
]
|
|
103
|
-
),
|
|
116
|
+
), rt = l(
|
|
104
117
|
(n) => {
|
|
105
118
|
if (v.current) return;
|
|
106
|
-
const t =
|
|
119
|
+
const t = C.current;
|
|
107
120
|
if (!t) return;
|
|
108
|
-
const r = t.getBoundingClientRect(),
|
|
109
|
-
|
|
121
|
+
const r = t.getBoundingClientRect(), o = n.clientY - r.top;
|
|
122
|
+
z(d(o));
|
|
110
123
|
},
|
|
111
|
-
[
|
|
112
|
-
),
|
|
113
|
-
v.current ||
|
|
114
|
-
}, []),
|
|
124
|
+
[d]
|
|
125
|
+
), ot = l(() => {
|
|
126
|
+
v.current || z(null);
|
|
127
|
+
}, []), ct = l(
|
|
115
128
|
(n) => {
|
|
116
|
-
if (
|
|
117
|
-
|
|
129
|
+
if (F.current) {
|
|
130
|
+
F.current = !1;
|
|
118
131
|
return;
|
|
119
132
|
}
|
|
120
|
-
const t =
|
|
133
|
+
const t = C.current;
|
|
121
134
|
if (!t) return;
|
|
122
|
-
const r = t.getBoundingClientRect(),
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
135
|
+
const r = t.getBoundingClientRect(), o = n.clientY - r.top, c = d(o);
|
|
136
|
+
if (c == null) return;
|
|
137
|
+
const m = c + i;
|
|
125
138
|
x && x({
|
|
126
|
-
columnId:
|
|
127
|
-
startTime:
|
|
128
|
-
endTime:
|
|
139
|
+
columnId: M,
|
|
140
|
+
startTime: S(s, c, a),
|
|
141
|
+
endTime: S(s, m, a)
|
|
129
142
|
});
|
|
130
143
|
},
|
|
131
|
-
[x,
|
|
132
|
-
),
|
|
133
|
-
return /* @__PURE__ */
|
|
144
|
+
[x, d, i, M, s, a]
|
|
145
|
+
), st = H != null ? (H - R) * f : 0, ut = i * f;
|
|
146
|
+
return /* @__PURE__ */ lt(
|
|
134
147
|
"div",
|
|
135
148
|
{
|
|
136
|
-
ref:
|
|
149
|
+
ref: C,
|
|
137
150
|
style: {
|
|
138
151
|
gridRow: "3 / -1",
|
|
139
152
|
gridColumn: h,
|
|
140
153
|
position: "relative",
|
|
141
154
|
pointerEvents: "auto",
|
|
142
|
-
cursor: x ||
|
|
155
|
+
cursor: x || g ? "pointer" : void 0
|
|
143
156
|
},
|
|
144
|
-
onMouseDown:
|
|
145
|
-
onMouseMove:
|
|
146
|
-
onMouseLeave:
|
|
147
|
-
onClick:
|
|
157
|
+
onMouseDown: et,
|
|
158
|
+
onMouseMove: rt,
|
|
159
|
+
onMouseLeave: ot,
|
|
160
|
+
onClick: ct,
|
|
148
161
|
children: [
|
|
149
|
-
|
|
162
|
+
H != null && !u && /* @__PURE__ */ B(
|
|
150
163
|
"div",
|
|
151
164
|
{
|
|
152
165
|
"aria-hidden": "true",
|
|
153
|
-
className:
|
|
166
|
+
className: Y("slotHighlight"),
|
|
154
167
|
style: {
|
|
155
168
|
position: "absolute",
|
|
156
|
-
top:
|
|
169
|
+
top: st,
|
|
157
170
|
left: 0,
|
|
158
171
|
right: 0,
|
|
159
|
-
height:
|
|
172
|
+
height: ut,
|
|
160
173
|
pointerEvents: "none"
|
|
161
174
|
}
|
|
162
175
|
}
|
|
163
176
|
),
|
|
164
|
-
u && (
|
|
177
|
+
u && (q !== "highlight" ? /* @__PURE__ */ B(
|
|
165
178
|
"div",
|
|
166
179
|
{
|
|
167
180
|
"aria-hidden": "true",
|
|
168
|
-
className:
|
|
181
|
+
className: Y("eventColumn"),
|
|
169
182
|
style: { pointerEvents: "none" },
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
|
|
183
|
+
children: /* @__PURE__ */ B(
|
|
184
|
+
vt,
|
|
172
185
|
{
|
|
173
186
|
interactive: !1,
|
|
174
187
|
positioned: {
|
|
175
|
-
event:
|
|
188
|
+
event: gt(
|
|
176
189
|
"",
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
190
|
+
S(s, u.startMin, a),
|
|
191
|
+
S(s, u.endMin, a),
|
|
192
|
+
q.eventData
|
|
180
193
|
),
|
|
181
|
-
top: (u.startMin -
|
|
182
|
-
height: (u.endMin - u.startMin) *
|
|
194
|
+
top: (u.startMin - R) * f,
|
|
195
|
+
height: (u.endMin - u.startMin) * f,
|
|
183
196
|
subColumn: 0,
|
|
184
197
|
totalSubColumns: 1
|
|
185
198
|
},
|
|
186
|
-
fallbackColor:
|
|
199
|
+
fallbackColor: L,
|
|
187
200
|
timeZone: a,
|
|
188
|
-
cls:
|
|
189
|
-
renderEvent:
|
|
201
|
+
cls: Y,
|
|
202
|
+
renderEvent: tt
|
|
190
203
|
}
|
|
191
204
|
)
|
|
192
205
|
}
|
|
193
|
-
) : /* @__PURE__ */
|
|
206
|
+
) : /* @__PURE__ */ B(
|
|
194
207
|
"div",
|
|
195
208
|
{
|
|
196
209
|
"aria-hidden": "true",
|
|
197
|
-
className:
|
|
210
|
+
className: Y("selectionHighlight"),
|
|
198
211
|
style: {
|
|
199
212
|
position: "absolute",
|
|
200
|
-
top: (u.startMin -
|
|
213
|
+
top: (u.startMin - R) * f,
|
|
201
214
|
left: 0,
|
|
202
215
|
right: 0,
|
|
203
|
-
height: (u.endMin - u.startMin) *
|
|
216
|
+
height: (u.endMin - u.startMin) * f,
|
|
204
217
|
pointerEvents: "none"
|
|
205
218
|
}
|
|
206
219
|
}
|
|
@@ -210,5 +223,5 @@ const ht = st(function({
|
|
|
210
223
|
);
|
|
211
224
|
});
|
|
212
225
|
export {
|
|
213
|
-
|
|
226
|
+
Ct as SlotInteractionLayer
|
|
214
227
|
};
|