@savvycal/calendar 0.13.0 → 0.14.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.
- package/README.md +108 -40
- package/dist/components/day-grid-view/AllDaySection.d.ts +2 -0
- package/dist/components/day-grid-view/AllDaySection.d.ts.map +1 -1
- package/dist/components/day-grid-view/AllDaySection.js +111 -75
- package/dist/components/day-grid-view/DayColumn.d.ts +2 -24
- package/dist/components/day-grid-view/DayColumn.d.ts.map +1 -1
- 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 +330 -275
- package/dist/components/day-grid-view/defaults.d.ts.map +1 -1
- package/dist/components/day-grid-view/defaults.js +1 -0
- package/dist/components/month-view/MonthView.d.ts.map +1 -1
- package/dist/components/month-view/MonthView.js +184 -165
- package/dist/components/month-view/MonthWeekRow.d.ts +1 -0
- package/dist/components/month-view/MonthWeekRow.d.ts.map +1 -1
- package/dist/components/month-view/MonthWeekRow.js +95 -89
- package/dist/components/resource-grid-view/ResourceColumn.d.ts +3 -21
- package/dist/components/resource-grid-view/ResourceColumn.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceColumn.js +13 -6
- 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 +348 -300
- package/dist/components/resource-grid-view/defaults.d.ts.map +1 -1
- package/dist/components/resource-grid-view/defaults.js +1 -0
- package/dist/components/shared/AllDayRow.d.ts.map +1 -1
- package/dist/components/shared/AllDayRow.js +21 -22
- package/dist/components/shared/EventChip.d.ts +4 -0
- package/dist/components/shared/EventChip.d.ts.map +1 -1
- package/dist/components/shared/EventChip.js +77 -69
- package/dist/components/shared/SelectionOverlay.d.ts +4 -0
- package/dist/components/shared/SelectionOverlay.d.ts.map +1 -1
- package/dist/components/shared/SelectionOverlay.js +38 -33
- package/dist/components/shared/SlotInteractionLayer.d.ts +5 -0
- package/dist/components/shared/SlotInteractionLayer.d.ts.map +1 -1
- package/dist/components/shared/SlotInteractionLayer.js +201 -176
- package/dist/components/shared/TimedEventLayer.d.ts +5 -2
- package/dist/components/shared/TimedEventLayer.d.ts.map +1 -1
- package/dist/components/shared/TimedEventLayer.js +57 -51
- package/dist/components/shared/useEventDrag.d.ts +36 -0
- package/dist/components/shared/useEventDrag.d.ts.map +1 -0
- package/dist/components/shared/useEventDrag.js +156 -0
- package/dist/components/shared/useLingeringValue.d.ts +7 -0
- package/dist/components/shared/useLingeringValue.d.ts.map +1 -0
- package/dist/components/shared/useLingeringValue.js +17 -0
- package/dist/components/shared/useTouchDrag.d.ts +38 -0
- package/dist/components/shared/useTouchDrag.d.ts.map +1 -0
- package/dist/components/shared/useTouchDrag.js +51 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/autoScroll.d.ts +30 -9
- package/dist/lib/autoScroll.d.ts.map +1 -1
- package/dist/lib/autoScroll.js +57 -51
- package/dist/types/calendar.d.ts +50 -0
- package/dist/types/calendar.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,246 +1,271 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import {
|
|
4
|
-
import { buildSyntheticEvent as
|
|
5
|
-
import { minutesToZonedDateTime as
|
|
6
|
-
import { EventChip as
|
|
7
|
-
import { DISMISS_ONLY_ATTR as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs as bt, jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { memo as xt, useState as lt, useRef as e, useCallback as u, useLayoutEffect as wt, useEffect as It } from "react";
|
|
3
|
+
import { findVerticalScrollParent as Yt, createAutoScroller as Ht } from "../../lib/autoScroll.js";
|
|
4
|
+
import { buildSyntheticEvent as Ot } from "../../lib/selection.js";
|
|
5
|
+
import { minutesToZonedDateTime as g } from "../../lib/time.js";
|
|
6
|
+
import { EventChip as Bt } from "./EventChip.js";
|
|
7
|
+
import { DISMISS_ONLY_ATTR as Nt } from "./AnchoredPopover.js";
|
|
8
|
+
import { useTouchDrag as _t, TOUCH_DRAG_STYLE as Ft } from "./useTouchDrag.js";
|
|
9
|
+
const Jt = xt(function({
|
|
10
|
+
columnId: s,
|
|
11
|
+
fallbackColor: at,
|
|
12
|
+
column: ft,
|
|
12
13
|
date: a,
|
|
13
|
-
timeZone:
|
|
14
|
-
startHour:
|
|
15
|
-
endHour:
|
|
16
|
-
hourHeight:
|
|
17
|
-
snapDuration:
|
|
18
|
-
placeholderDuration:
|
|
19
|
-
cls:
|
|
20
|
-
onSlotClick:
|
|
21
|
-
onSelect:
|
|
22
|
-
onSlotHover:
|
|
23
|
-
resolveColumnId:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
timeZone: i,
|
|
15
|
+
startHour: dt,
|
|
16
|
+
endHour: mt,
|
|
17
|
+
hourHeight: Mt,
|
|
18
|
+
snapDuration: L,
|
|
19
|
+
placeholderDuration: l,
|
|
20
|
+
cls: D,
|
|
21
|
+
onSlotClick: b,
|
|
22
|
+
onSelect: f,
|
|
23
|
+
onSlotHover: W,
|
|
24
|
+
resolveColumnId: $,
|
|
25
|
+
getScrollViewportLeft: Z,
|
|
26
|
+
onDragPreviewChange: N,
|
|
27
|
+
previewRange: gt,
|
|
28
|
+
dragPreviewAppearance: tt = "highlight",
|
|
29
|
+
renderEvent: ht
|
|
28
30
|
}) {
|
|
29
|
-
const [
|
|
30
|
-
}),
|
|
31
|
+
const [_, F] = lt(null), [vt, pt] = lt(null), d = N ? gt : vt, h = e(null), v = e(null), U = e(!1), x = e(0), w = e(0), nt = e(null), X = e(null), p = e(null), rt = e(() => {
|
|
32
|
+
}), et = e(f), I = e($), ot = e(Z), ut = e(N), j = e(s), A = e(a), V = e(i), R = dt * 60, Y = mt * 60, m = Mt / 60, M = u(
|
|
31
33
|
(t) => {
|
|
32
|
-
const
|
|
33
|
-
return c +
|
|
34
|
+
const n = t / m, r = Math.floor(n / L) * L, c = R + r;
|
|
35
|
+
return c + l > Y || c < R ? null : c;
|
|
34
36
|
},
|
|
35
37
|
[
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
m,
|
|
39
|
+
L,
|
|
40
|
+
l,
|
|
41
|
+
R,
|
|
42
|
+
Y
|
|
41
43
|
]
|
|
42
|
-
),
|
|
43
|
-
const
|
|
44
|
-
Math.max(t,
|
|
45
|
-
|
|
44
|
+
), ct = e(M), z = e(Y), Rt = e(L), G = e(l), st = u((t, n) => {
|
|
45
|
+
const r = Math.min(t, n), c = Math.min(
|
|
46
|
+
Math.max(t, n) + G.current,
|
|
47
|
+
z.current
|
|
46
48
|
);
|
|
47
|
-
return { startMin:
|
|
48
|
-
}, []),
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
return { startMin: r, endMin: c };
|
|
50
|
+
}, []), E = u((t) => {
|
|
51
|
+
const n = ut.current;
|
|
52
|
+
n ? n(t) : pt(
|
|
51
53
|
t && { startMin: t.startMin, endMin: t.endMin }
|
|
52
54
|
);
|
|
53
|
-
}, []),
|
|
54
|
-
(t,
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
const o = c.getBoundingClientRect(),
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
55
|
+
}, []), k = u(
|
|
56
|
+
(t, n) => {
|
|
57
|
+
const r = v.current, c = h.current;
|
|
58
|
+
if (!r || !c) return;
|
|
59
|
+
const o = c.getBoundingClientRect(), T = Math.max(0, Math.min(n - o.top, o.height));
|
|
60
|
+
let K = ct.current(T);
|
|
61
|
+
K == null && (K = z.current - G.current);
|
|
62
|
+
const P = st(r.anchorSlotStart, K), Q = I.current?.(t) ?? r.currentColumnId, Dt = r.moved && r.currentStartMin === P.startMin && r.currentEndMin === P.endMin && r.currentColumnId === Q;
|
|
63
|
+
r.currentStartMin = P.startMin, r.currentEndMin = P.endMin, r.currentColumnId = Q, r.moved = !0, Dt || E({
|
|
62
64
|
columnId: j.current,
|
|
63
|
-
endColumnId:
|
|
64
|
-
...
|
|
65
|
+
endColumnId: Q,
|
|
66
|
+
...P
|
|
65
67
|
});
|
|
66
68
|
},
|
|
67
|
-
[
|
|
68
|
-
),
|
|
69
|
+
[st, E]
|
|
70
|
+
), H = u(
|
|
71
|
+
(t, n) => {
|
|
72
|
+
x.current = n, w.current = t, k(t, n), p.current?.ensure();
|
|
73
|
+
},
|
|
74
|
+
[k]
|
|
75
|
+
), C = u(
|
|
76
|
+
(t) => H(t.clientX, t.clientY),
|
|
77
|
+
[H]
|
|
78
|
+
), q = e(() => {
|
|
79
|
+
}), y = u(
|
|
69
80
|
(t) => {
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
p.current?.stop(), p.current = null, X.current = null;
|
|
82
|
+
const n = v.current;
|
|
83
|
+
n && t && (n.moved && (U.current = !0), et.current?.({
|
|
84
|
+
columnId: j.current,
|
|
85
|
+
...I.current ? { endColumnId: n.currentColumnId } : {},
|
|
86
|
+
startTime: g(
|
|
87
|
+
A.current,
|
|
88
|
+
n.currentStartMin,
|
|
89
|
+
V.current
|
|
90
|
+
),
|
|
91
|
+
endTime: g(
|
|
92
|
+
A.current,
|
|
93
|
+
n.currentEndMin,
|
|
94
|
+
V.current
|
|
95
|
+
)
|
|
96
|
+
})), v.current = null, E(null), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", q.current);
|
|
75
97
|
},
|
|
76
|
-
[
|
|
77
|
-
),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
startTime: M(
|
|
85
|
-
A.current,
|
|
86
|
-
t.currentStartMin,
|
|
87
|
-
D.current
|
|
88
|
-
),
|
|
89
|
-
endTime: M(
|
|
90
|
-
A.current,
|
|
91
|
-
t.currentEndMin,
|
|
92
|
-
D.current
|
|
93
|
-
)
|
|
94
|
-
})), h.current = null, R(null), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", k.current);
|
|
95
|
-
}, [E, R]);
|
|
96
|
-
yt(() => {
|
|
97
|
-
Z.current = g, F.current = K, tt.current = O, j.current = u, A.current = a, D.current = s, nt.current = m, U.current = I, mt.current = y, V.current = i, k.current = q, $.current = _;
|
|
98
|
-
}), Tt(() => () => {
|
|
99
|
-
v.current?.stop(), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", k.current);
|
|
100
|
-
}, [E]);
|
|
101
|
-
const S = l(
|
|
98
|
+
[C, E]
|
|
99
|
+
), J = u(() => y(!0), [y]);
|
|
100
|
+
wt(() => {
|
|
101
|
+
et.current = f, I.current = $, ot.current = Z, ut.current = N, j.current = s, A.current = a, V.current = i, ct.current = M, z.current = Y, Rt.current = L, G.current = l, q.current = J, rt.current = k;
|
|
102
|
+
}), It(() => () => {
|
|
103
|
+
p.current?.stop(), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", q.current);
|
|
104
|
+
}, [C]);
|
|
105
|
+
const S = u(
|
|
102
106
|
(t) => {
|
|
103
|
-
|
|
107
|
+
nt.current !== t && (nt.current = t, W?.(
|
|
104
108
|
t == null ? null : {
|
|
105
|
-
columnId:
|
|
106
|
-
startTime:
|
|
107
|
-
endTime:
|
|
109
|
+
columnId: s,
|
|
110
|
+
startTime: g(a, t, i),
|
|
111
|
+
endTime: g(
|
|
108
112
|
a,
|
|
109
|
-
t +
|
|
110
|
-
|
|
113
|
+
t + l,
|
|
114
|
+
i
|
|
111
115
|
)
|
|
112
116
|
}
|
|
113
117
|
));
|
|
114
118
|
},
|
|
115
|
-
[
|
|
116
|
-
),
|
|
117
|
-
(t) => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
h.current = {
|
|
119
|
+
[W, s, a, i, l]
|
|
120
|
+
), O = u(
|
|
121
|
+
(t, n) => {
|
|
122
|
+
const r = h.current;
|
|
123
|
+
if (!f || !r) return !1;
|
|
124
|
+
const c = r.getBoundingClientRect(), o = M(n - c.top);
|
|
125
|
+
if (o == null) return !1;
|
|
126
|
+
f(null), F(null), S(null);
|
|
127
|
+
const T = o + l;
|
|
128
|
+
return v.current = {
|
|
126
129
|
anchorSlotStart: o,
|
|
127
|
-
currentColumnId:
|
|
130
|
+
currentColumnId: s,
|
|
128
131
|
currentStartMin: o,
|
|
129
|
-
currentEndMin:
|
|
132
|
+
currentEndMin: T,
|
|
130
133
|
moved: !1
|
|
131
|
-
},
|
|
132
|
-
getPointerY: () =>
|
|
133
|
-
getScrollParent: () =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
}, x.current = n, w.current = t, X.current = Yt(r), p.current?.stop(), p.current = Ht({
|
|
135
|
+
getPointerY: () => x.current,
|
|
136
|
+
getScrollParent: () => X.current,
|
|
137
|
+
// Only a drag that can span columns has a reason to scroll sideways
|
|
138
|
+
horizontal: I.current && {
|
|
139
|
+
getPointerX: () => w.current,
|
|
140
|
+
getViewportLeft: () => ot.current?.()
|
|
141
|
+
},
|
|
142
|
+
onScroll: () => rt.current(
|
|
143
|
+
w.current,
|
|
144
|
+
x.current
|
|
137
145
|
)
|
|
138
|
-
}),
|
|
139
|
-
columnId:
|
|
140
|
-
endColumnId:
|
|
146
|
+
}), E({
|
|
147
|
+
columnId: s,
|
|
148
|
+
endColumnId: s,
|
|
141
149
|
startMin: o,
|
|
142
|
-
endMin:
|
|
143
|
-
}),
|
|
150
|
+
endMin: T
|
|
151
|
+
}), !0;
|
|
144
152
|
},
|
|
145
153
|
[
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
f,
|
|
155
|
+
M,
|
|
156
|
+
l,
|
|
157
|
+
s,
|
|
149
158
|
E,
|
|
150
|
-
q,
|
|
151
|
-
u,
|
|
152
|
-
R,
|
|
153
159
|
S
|
|
154
160
|
]
|
|
155
|
-
),
|
|
161
|
+
), Et = u(
|
|
162
|
+
(t) => {
|
|
163
|
+
O(t.clientX, t.clientY) && (t.preventDefault(), document.addEventListener("mousemove", C), document.addEventListener("mouseup", J));
|
|
164
|
+
},
|
|
165
|
+
[O, C, J]
|
|
166
|
+
), it = _t(h, f != null), Ct = u(
|
|
167
|
+
(t) => {
|
|
168
|
+
f && it(t, {
|
|
169
|
+
start: O,
|
|
170
|
+
move: H,
|
|
171
|
+
end: () => y(!0),
|
|
172
|
+
cancel: () => y(!1)
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
[f, it, O, H, y]
|
|
176
|
+
), St = u(
|
|
156
177
|
(t) => {
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
if (!
|
|
160
|
-
const
|
|
161
|
-
|
|
178
|
+
if (v.current || t.buttons !== 0) return;
|
|
179
|
+
const n = h.current;
|
|
180
|
+
if (!n) return;
|
|
181
|
+
const r = n.getBoundingClientRect(), c = t.clientY - r.top, o = M(c);
|
|
182
|
+
F(o), S(o);
|
|
162
183
|
},
|
|
163
|
-
[
|
|
164
|
-
),
|
|
165
|
-
|
|
166
|
-
}, [S]),
|
|
184
|
+
[M, S]
|
|
185
|
+
), Tt = u(() => {
|
|
186
|
+
v.current || (F(null), S(null));
|
|
187
|
+
}, [S]), Lt = u(
|
|
167
188
|
(t) => {
|
|
168
|
-
if (
|
|
169
|
-
|
|
189
|
+
if (U.current) {
|
|
190
|
+
U.current = !1;
|
|
170
191
|
return;
|
|
171
192
|
}
|
|
172
|
-
const
|
|
173
|
-
if (!
|
|
174
|
-
const
|
|
193
|
+
const n = h.current;
|
|
194
|
+
if (!n) return;
|
|
195
|
+
const r = n.getBoundingClientRect(), c = t.clientY - r.top, o = M(c);
|
|
175
196
|
if (o == null) return;
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
columnId:
|
|
179
|
-
startTime:
|
|
180
|
-
endTime:
|
|
197
|
+
const T = o + l;
|
|
198
|
+
b && b({
|
|
199
|
+
columnId: s,
|
|
200
|
+
startTime: g(a, o, i),
|
|
201
|
+
endTime: g(a, T, i)
|
|
181
202
|
});
|
|
182
203
|
},
|
|
183
|
-
[
|
|
184
|
-
),
|
|
185
|
-
return /* @__PURE__ */
|
|
204
|
+
[b, M, l, s, a, i]
|
|
205
|
+
), yt = _ != null ? (_ - R) * m : 0, Pt = l * m;
|
|
206
|
+
return /* @__PURE__ */ bt(
|
|
186
207
|
"div",
|
|
187
208
|
{
|
|
188
|
-
ref:
|
|
189
|
-
[
|
|
190
|
-
"data-slot-column":
|
|
209
|
+
ref: h,
|
|
210
|
+
[Nt]: "",
|
|
211
|
+
"data-slot-column": s,
|
|
191
212
|
style: {
|
|
192
213
|
gridRow: "3 / -1",
|
|
193
|
-
gridColumn:
|
|
214
|
+
gridColumn: ft,
|
|
194
215
|
position: "relative",
|
|
195
216
|
pointerEvents: "auto",
|
|
196
|
-
cursor:
|
|
217
|
+
cursor: b || f ? "pointer" : void 0,
|
|
218
|
+
// A long press starts a touch drag: keep it from selecting text or
|
|
219
|
+
// opening the iOS callout
|
|
220
|
+
...f && Ft
|
|
197
221
|
},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
222
|
+
onPointerDown: Ct,
|
|
223
|
+
onMouseDown: Et,
|
|
224
|
+
onMouseMove: St,
|
|
225
|
+
onMouseLeave: Tt,
|
|
226
|
+
onClick: Lt,
|
|
202
227
|
children: [
|
|
203
|
-
|
|
228
|
+
_ != null && !d && /* @__PURE__ */ B(
|
|
204
229
|
"div",
|
|
205
230
|
{
|
|
206
231
|
"aria-hidden": "true",
|
|
207
|
-
className:
|
|
232
|
+
className: D("slotHighlight"),
|
|
208
233
|
style: {
|
|
209
234
|
position: "absolute",
|
|
210
|
-
top:
|
|
235
|
+
top: yt,
|
|
211
236
|
left: 0,
|
|
212
237
|
right: 0,
|
|
213
|
-
height:
|
|
238
|
+
height: Pt,
|
|
214
239
|
pointerEvents: "none"
|
|
215
240
|
}
|
|
216
241
|
}
|
|
217
242
|
),
|
|
218
|
-
|
|
243
|
+
d && (tt !== "highlight" ? /* @__PURE__ */ B(
|
|
219
244
|
"div",
|
|
220
245
|
{
|
|
221
246
|
"aria-hidden": "true",
|
|
222
|
-
className:
|
|
247
|
+
className: D("eventColumn"),
|
|
223
248
|
style: { pointerEvents: "none" },
|
|
224
249
|
children: /* @__PURE__ */ B(
|
|
225
|
-
|
|
250
|
+
Bt,
|
|
226
251
|
{
|
|
227
252
|
interactive: !1,
|
|
228
253
|
positioned: {
|
|
229
|
-
event:
|
|
254
|
+
event: Ot(
|
|
230
255
|
"",
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
256
|
+
g(a, d.startMin, i),
|
|
257
|
+
g(a, d.endMin, i),
|
|
258
|
+
tt.eventData
|
|
234
259
|
),
|
|
235
|
-
top: (
|
|
236
|
-
height: (
|
|
260
|
+
top: (d.startMin - R) * m,
|
|
261
|
+
height: (d.endMin - d.startMin) * m,
|
|
237
262
|
subColumn: 0,
|
|
238
263
|
totalSubColumns: 1
|
|
239
264
|
},
|
|
240
|
-
fallbackColor:
|
|
241
|
-
timeZone:
|
|
242
|
-
cls:
|
|
243
|
-
renderEvent:
|
|
265
|
+
fallbackColor: at,
|
|
266
|
+
timeZone: i,
|
|
267
|
+
cls: D,
|
|
268
|
+
renderEvent: ht
|
|
244
269
|
}
|
|
245
270
|
)
|
|
246
271
|
}
|
|
@@ -248,13 +273,13 @@ const At = Ct(function({
|
|
|
248
273
|
"div",
|
|
249
274
|
{
|
|
250
275
|
"aria-hidden": "true",
|
|
251
|
-
className:
|
|
276
|
+
className: D("selectionHighlight"),
|
|
252
277
|
style: {
|
|
253
278
|
position: "absolute",
|
|
254
|
-
top: (
|
|
279
|
+
top: (d.startMin - R) * m,
|
|
255
280
|
left: 0,
|
|
256
281
|
right: 0,
|
|
257
|
-
height: (
|
|
282
|
+
height: (d.endMin - d.startMin) * m,
|
|
258
283
|
pointerEvents: "none"
|
|
259
284
|
}
|
|
260
285
|
}
|
|
@@ -264,5 +289,5 @@ const At = Ct(function({
|
|
|
264
289
|
);
|
|
265
290
|
});
|
|
266
291
|
export {
|
|
267
|
-
|
|
292
|
+
Jt as SlotInteractionLayer
|
|
268
293
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { CalendarEvent, EventLayout, GridViewClassNames, OverflowClickInfo, OverflowPopoverRenderProps, PositionedEvent, TimedCalendarEvent } from '../../types/calendar';
|
|
3
|
-
interface TimedEventLayerProps {
|
|
3
|
+
export interface TimedEventLayerProps {
|
|
4
|
+
/** Identifies the column to event drags (`data-event-column`). */
|
|
5
|
+
columnId: string;
|
|
4
6
|
positionedEvents: PositionedEvent[];
|
|
5
7
|
column: number;
|
|
6
8
|
timeZone: string;
|
|
@@ -20,7 +22,8 @@ interface TimedEventLayerProps {
|
|
|
20
22
|
eventMaxStack?: number;
|
|
21
23
|
onOverflowClick?: (info: OverflowClickInfo) => void;
|
|
22
24
|
renderOverflowPopover?: (props: OverflowPopoverRenderProps) => React.ReactNode;
|
|
25
|
+
dragSourceId?: string | null;
|
|
26
|
+
onEventDragStart?: (event: TimedCalendarEvent, e: React.PointerEvent<HTMLElement>) => void;
|
|
23
27
|
}
|
|
24
28
|
export declare const TimedEventLayer: import('react').NamedExoticComponent<TimedEventLayerProps>;
|
|
25
|
-
export {};
|
|
26
29
|
//# sourceMappingURL=TimedEventLayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimedEventLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/TimedEventLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAU1B,
|
|
1
|
+
{"version":3,"file":"TimedEventLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/TimedEventLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAU1B,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpD,qBAAqB,CAAC,EAAE,CACtB,KAAK,EAAE,0BAA0B,KAC9B,KAAK,CAAC,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,kBAAkB,EACzB,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,KAC/B,IAAI,CAAC;CACX;AAED,eAAO,MAAM,eAAe,4DA8E1B,CAAC"}
|
|
@@ -1,76 +1,82 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { applyEventOverflow as
|
|
4
|
-
import { EventChip as
|
|
5
|
-
import { OverflowChip as
|
|
6
|
-
import { useColumnWidth as
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsxs as L, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { memo as N, useMemo as V } from "react";
|
|
3
|
+
import { applyEventOverflow as _, DEFAULT_EVENT_MIN_WIDTH as j, computeMaxVisibleColumns as I } from "../../lib/overlap.js";
|
|
4
|
+
import { EventChip as O } from "./EventChip.js";
|
|
5
|
+
import { OverflowChip as R } from "./OverflowChip.js";
|
|
6
|
+
import { useColumnWidth as S } from "./useColumnWidth.js";
|
|
7
|
+
const z = N(function({
|
|
8
|
+
columnId: v,
|
|
9
|
+
positionedEvents: o,
|
|
10
|
+
column: f,
|
|
11
|
+
timeZone: t,
|
|
12
|
+
cls: r,
|
|
13
|
+
fallbackColor: u,
|
|
14
|
+
onEventClick: m,
|
|
14
15
|
renderEvent: d,
|
|
15
|
-
eventGap:
|
|
16
|
-
eventLayout:
|
|
17
|
-
stackOffset:
|
|
18
|
-
selectedEventId:
|
|
19
|
-
selectedEventRef:
|
|
20
|
-
eventMinWidth: i =
|
|
16
|
+
eventGap: c,
|
|
17
|
+
eventLayout: p,
|
|
18
|
+
stackOffset: E,
|
|
19
|
+
selectedEventId: C,
|
|
20
|
+
selectedEventRef: w,
|
|
21
|
+
eventMinWidth: i = j,
|
|
21
22
|
eventMaxStack: n,
|
|
22
|
-
onOverflowClick:
|
|
23
|
-
renderOverflowPopover:
|
|
23
|
+
onOverflowClick: T,
|
|
24
|
+
renderOverflowPopover: h,
|
|
25
|
+
dragSourceId: x,
|
|
26
|
+
onEventDragStart: y
|
|
24
27
|
}) {
|
|
25
|
-
const { ref:
|
|
26
|
-
const e =
|
|
27
|
-
|
|
28
|
+
const { ref: D, width: l } = S(), { visible: b, overflows: g } = V(() => {
|
|
29
|
+
const e = I(
|
|
30
|
+
l,
|
|
28
31
|
i,
|
|
29
32
|
n
|
|
30
33
|
);
|
|
31
|
-
return
|
|
32
|
-
}, [
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
+
return _(o, e);
|
|
35
|
+
}, [o, l, i, n]);
|
|
36
|
+
return /* @__PURE__ */ L(
|
|
34
37
|
"div",
|
|
35
38
|
{
|
|
36
|
-
ref:
|
|
37
|
-
|
|
39
|
+
ref: D,
|
|
40
|
+
"data-event-column": v,
|
|
41
|
+
className: r("eventColumn"),
|
|
38
42
|
style: {
|
|
39
43
|
gridRow: "3 / -1",
|
|
40
|
-
gridColumn:
|
|
44
|
+
gridColumn: f,
|
|
41
45
|
pointerEvents: "none",
|
|
42
46
|
isolation: "isolate"
|
|
43
47
|
},
|
|
44
48
|
children: [
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
+
b.map((e) => {
|
|
50
|
+
const s = e.event.id === C;
|
|
51
|
+
return /* @__PURE__ */ a(
|
|
52
|
+
O,
|
|
49
53
|
{
|
|
50
54
|
positioned: e,
|
|
51
|
-
fallbackColor:
|
|
52
|
-
timeZone:
|
|
53
|
-
cls:
|
|
54
|
-
onClick:
|
|
55
|
+
fallbackColor: u,
|
|
56
|
+
timeZone: t,
|
|
57
|
+
cls: r,
|
|
58
|
+
onClick: m,
|
|
55
59
|
renderEvent: d,
|
|
56
|
-
eventGap:
|
|
57
|
-
eventLayout:
|
|
58
|
-
stackOffset:
|
|
59
|
-
isSelected:
|
|
60
|
-
selectedEventRef:
|
|
60
|
+
eventGap: c,
|
|
61
|
+
eventLayout: p,
|
|
62
|
+
stackOffset: E,
|
|
63
|
+
isSelected: s,
|
|
64
|
+
selectedEventRef: s ? w : void 0,
|
|
65
|
+
isDragSource: e.event.id === x,
|
|
66
|
+
onDragStart: y
|
|
61
67
|
},
|
|
62
68
|
e.event.id
|
|
63
69
|
);
|
|
64
70
|
}),
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
g.map((e) => /* @__PURE__ */ a(
|
|
72
|
+
R,
|
|
67
73
|
{
|
|
68
74
|
group: e,
|
|
69
|
-
timeZone:
|
|
70
|
-
cls:
|
|
71
|
-
onEventClick:
|
|
72
|
-
onOverflowClick:
|
|
73
|
-
renderOverflowPopover:
|
|
75
|
+
timeZone: t,
|
|
76
|
+
cls: r,
|
|
77
|
+
onEventClick: m,
|
|
78
|
+
onOverflowClick: T,
|
|
79
|
+
renderOverflowPopover: h
|
|
74
80
|
},
|
|
75
81
|
e.id
|
|
76
82
|
))
|
|
@@ -79,5 +85,5 @@ const W = L(function({
|
|
|
79
85
|
);
|
|
80
86
|
});
|
|
81
87
|
export {
|
|
82
|
-
|
|
88
|
+
z as TimedEventLayer
|
|
83
89
|
};
|