calkit 0.1.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 +734 -0
- package/dist/booking.es.js +1845 -0
- package/dist/booking.es.js.map +1 -0
- package/dist/booking.umd.js +888 -0
- package/dist/booking.umd.js.map +1 -0
- package/dist/calkit.es.js +5230 -0
- package/dist/calkit.es.js.map +1 -0
- package/dist/calkit.umd.js +2164 -0
- package/dist/calkit.umd.js.map +1 -0
- package/dist/datepicker.es.js +1619 -0
- package/dist/datepicker.es.js.map +1 -0
- package/dist/datepicker.umd.js +818 -0
- package/dist/datepicker.umd.js.map +1 -0
- package/dist/scheduler.es.js +3235 -0
- package/dist/scheduler.es.js.map +1 -0
- package/dist/scheduler.umd.js +1547 -0
- package/dist/scheduler.umd.js.map +1 -0
- package/dist/timepicker.es.js +962 -0
- package/dist/timepicker.es.js.map +1 -0
- package/dist/timepicker.umd.js +517 -0
- package/dist/timepicker.umd.js.map +1 -0
- package/llms.txt +594 -0
- package/package.json +58 -0
|
@@ -0,0 +1,3235 @@
|
|
|
1
|
+
class Fe extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super(), this.attachShadow({ mode: "open" }), this._initialized = !1;
|
|
4
|
+
}
|
|
5
|
+
/** Override in subclass — return array of CSSStyleSheet or CSS strings. */
|
|
6
|
+
static get styles() {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
this._initialized || (this._adoptStyles(), this._initialized = !0), this.render();
|
|
11
|
+
}
|
|
12
|
+
_adoptStyles() {
|
|
13
|
+
const e = this.constructor.styles;
|
|
14
|
+
if (e.length)
|
|
15
|
+
if ("adoptedStyleSheets" in this.shadowRoot)
|
|
16
|
+
this.shadowRoot.adoptedStyleSheets = e.map((s) => {
|
|
17
|
+
if (s instanceof CSSStyleSheet) return s;
|
|
18
|
+
const a = new CSSStyleSheet();
|
|
19
|
+
return a.replaceSync(s), a;
|
|
20
|
+
});
|
|
21
|
+
else
|
|
22
|
+
for (const s of e) {
|
|
23
|
+
const a = document.createElement("style");
|
|
24
|
+
a.textContent = s instanceof CSSStyleSheet ? "" : s, this.shadowRoot.prepend(a);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Subclasses override to update Shadow DOM. */
|
|
28
|
+
render() {
|
|
29
|
+
}
|
|
30
|
+
/** Dispatch a composed, bubbling custom event. */
|
|
31
|
+
emit(e, s = {}) {
|
|
32
|
+
this.dispatchEvent(
|
|
33
|
+
new CustomEvent(e, { detail: s, bubbles: !0, composed: !0 })
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
/** Show an inline status banner. */
|
|
37
|
+
showStatus(e, s, a = {}) {
|
|
38
|
+
if (!this._store) return;
|
|
39
|
+
const { autoDismiss: n, dismissible: l = !0 } = a;
|
|
40
|
+
clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: s, statusDismissible: l }), this.emit("cal:status", { type: e, message: s }), n && n > 0 && (this._statusTimer = setTimeout(() => this.clearStatus(), n));
|
|
41
|
+
}
|
|
42
|
+
/** Clear the status banner. */
|
|
43
|
+
clearStatus() {
|
|
44
|
+
this._store && (clearTimeout(this._statusTimer), this._store.set({ statusType: null, statusMessage: null, statusDismissible: !0 }), this.emit("cal:status", { type: null, message: null }));
|
|
45
|
+
}
|
|
46
|
+
/** Query within shadow root. */
|
|
47
|
+
$(e) {
|
|
48
|
+
return this.shadowRoot.querySelector(e);
|
|
49
|
+
}
|
|
50
|
+
$$(e) {
|
|
51
|
+
return this.shadowRoot.querySelectorAll(e);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function Ve(t) {
|
|
55
|
+
let e = { ...t };
|
|
56
|
+
const s = /* @__PURE__ */ new Set();
|
|
57
|
+
return {
|
|
58
|
+
get(a) {
|
|
59
|
+
return e[a];
|
|
60
|
+
},
|
|
61
|
+
set(a) {
|
|
62
|
+
const n = e;
|
|
63
|
+
e = { ...e, ...a };
|
|
64
|
+
let l = !1;
|
|
65
|
+
for (const r of Object.keys(a))
|
|
66
|
+
if (n[r] !== e[r]) {
|
|
67
|
+
l = !0;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
if (l)
|
|
71
|
+
for (const r of s) r(e, n);
|
|
72
|
+
},
|
|
73
|
+
getState() {
|
|
74
|
+
return e;
|
|
75
|
+
},
|
|
76
|
+
subscribe(a) {
|
|
77
|
+
return s.add(a), () => s.delete(a);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const oe = [
|
|
82
|
+
"January",
|
|
83
|
+
"February",
|
|
84
|
+
"March",
|
|
85
|
+
"April",
|
|
86
|
+
"May",
|
|
87
|
+
"June",
|
|
88
|
+
"July",
|
|
89
|
+
"August",
|
|
90
|
+
"September",
|
|
91
|
+
"October",
|
|
92
|
+
"November",
|
|
93
|
+
"December"
|
|
94
|
+
], qe = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Oe = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Xe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
95
|
+
function He(t, e = "short") {
|
|
96
|
+
const s = ee(t);
|
|
97
|
+
return s ? e === "long" ? Oe[s.getDay()] : Xe[s.getDay()] : "";
|
|
98
|
+
}
|
|
99
|
+
function We(t = 0) {
|
|
100
|
+
const e = [];
|
|
101
|
+
for (let s = 0; s < 7; s++)
|
|
102
|
+
e.push(qe[(t + s) % 7]);
|
|
103
|
+
return e;
|
|
104
|
+
}
|
|
105
|
+
function $e(t, e) {
|
|
106
|
+
return new Date(t, e + 1, 0).getDate();
|
|
107
|
+
}
|
|
108
|
+
function Ge(t, e) {
|
|
109
|
+
return new Date(t, e, 1).getDay();
|
|
110
|
+
}
|
|
111
|
+
function pe(t) {
|
|
112
|
+
if (typeof t == "string") return t;
|
|
113
|
+
const e = t instanceof Date ? t : new Date(t.year, t.month, t.day), s = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
|
|
114
|
+
return `${s}-${a}-${n}`;
|
|
115
|
+
}
|
|
116
|
+
function ee(t) {
|
|
117
|
+
if (!t) return null;
|
|
118
|
+
if (t instanceof Date) return t;
|
|
119
|
+
if (typeof t == "string") {
|
|
120
|
+
const [e, s, a] = t.split("-").map(Number);
|
|
121
|
+
return !e || !s || !a ? null : new Date(e, s - 1, a);
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
function _e(t, e) {
|
|
126
|
+
if (!t || !e) return !1;
|
|
127
|
+
const s = ee(t), a = ee(e);
|
|
128
|
+
return !s || !a ? !1 : s.getFullYear() === a.getFullYear() && s.getMonth() === a.getMonth() && s.getDate() === a.getDate();
|
|
129
|
+
}
|
|
130
|
+
function me() {
|
|
131
|
+
return pe(/* @__PURE__ */ new Date());
|
|
132
|
+
}
|
|
133
|
+
function xe(t, e, s) {
|
|
134
|
+
const a = new Date(t, e + s, 1);
|
|
135
|
+
return { year: a.getFullYear(), month: a.getMonth() };
|
|
136
|
+
}
|
|
137
|
+
function fe(t, e) {
|
|
138
|
+
const s = ee(t);
|
|
139
|
+
return s ? (s.setDate(s.getDate() + e), pe(s)) : t;
|
|
140
|
+
}
|
|
141
|
+
function Ue(t, e, s = 0) {
|
|
142
|
+
const a = $e(t, e), l = (Ge(t, e) - s + 7) % 7, r = [], i = me(), d = xe(t, e, -1), g = $e(d.year, d.month);
|
|
143
|
+
for (let k = l - 1; k >= 0; k--) {
|
|
144
|
+
const u = g - k, p = pe({ year: d.year, month: d.month, day: u });
|
|
145
|
+
r.push({ year: d.year, month: d.month, day: u, dateString: p, isCurrentMonth: !1, isToday: p === i });
|
|
146
|
+
}
|
|
147
|
+
for (let k = 1; k <= a; k++) {
|
|
148
|
+
const u = pe({ year: t, month: e, day: k });
|
|
149
|
+
r.push({ year: t, month: e, day: k, dateString: u, isCurrentMonth: !0, isToday: u === i });
|
|
150
|
+
}
|
|
151
|
+
const c = xe(t, e, 1);
|
|
152
|
+
let o = 1;
|
|
153
|
+
for (; r.length < 42; ) {
|
|
154
|
+
const k = pe({ year: c.year, month: c.month, day: o });
|
|
155
|
+
r.push({ year: c.year, month: c.month, day: o, dateString: k, isCurrentMonth: !1, isToday: k === i }), o++;
|
|
156
|
+
}
|
|
157
|
+
return r;
|
|
158
|
+
}
|
|
159
|
+
function he(t) {
|
|
160
|
+
if (!t || typeof t != "string") return null;
|
|
161
|
+
const e = t.trim().toUpperCase(), s = e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);
|
|
162
|
+
if (s) {
|
|
163
|
+
let n = parseInt(s[1], 10);
|
|
164
|
+
const l = parseInt(s[2], 10), r = s[3];
|
|
165
|
+
return r === "AM" && n === 12 && (n = 0), r === "PM" && n !== 12 && (n += 12), { hours: n, minutes: l };
|
|
166
|
+
}
|
|
167
|
+
const a = e.match(/^(\d{1,2}):(\d{2})$/);
|
|
168
|
+
return a ? { hours: parseInt(a[1], 10), minutes: parseInt(a[2], 10) } : null;
|
|
169
|
+
}
|
|
170
|
+
function ge(t, e, s = "24h") {
|
|
171
|
+
const a = String(e).padStart(2, "0");
|
|
172
|
+
if (s === "12h") {
|
|
173
|
+
const n = t >= 12 ? "PM" : "AM";
|
|
174
|
+
return `${t % 12 || 12}:${a} ${n}`;
|
|
175
|
+
}
|
|
176
|
+
return `${String(t).padStart(2, "0")}:${a}`;
|
|
177
|
+
}
|
|
178
|
+
function y(t) {
|
|
179
|
+
const e = he(t);
|
|
180
|
+
return e ? e.hours * 60 + e.minutes : 0;
|
|
181
|
+
}
|
|
182
|
+
function ce(t) {
|
|
183
|
+
const e = Math.floor(t / 60) % 24, s = t % 60;
|
|
184
|
+
return `${String(e).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
185
|
+
}
|
|
186
|
+
function Me(t, e, s) {
|
|
187
|
+
const a = [], n = y(t), l = y(e);
|
|
188
|
+
for (let r = n; r <= l; r += s)
|
|
189
|
+
a.push(ce(r));
|
|
190
|
+
return a;
|
|
191
|
+
}
|
|
192
|
+
function Ye() {
|
|
193
|
+
const t = /* @__PURE__ */ new Date();
|
|
194
|
+
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
195
|
+
}
|
|
196
|
+
function Ze(t, e = 0) {
|
|
197
|
+
const s = ee(t);
|
|
198
|
+
if (!s) return t;
|
|
199
|
+
const n = (s.getDay() - e + 7) % 7;
|
|
200
|
+
return s.setDate(s.getDate() - n), pe(s);
|
|
201
|
+
}
|
|
202
|
+
function Te(t, e = 0) {
|
|
203
|
+
const s = Ze(t, e), a = [];
|
|
204
|
+
for (let n = 0; n < 7; n++)
|
|
205
|
+
a.push(fe(s, n));
|
|
206
|
+
return a;
|
|
207
|
+
}
|
|
208
|
+
function Je(t, e, s) {
|
|
209
|
+
const a = ee(e);
|
|
210
|
+
if (!a) return "";
|
|
211
|
+
if (t === "day")
|
|
212
|
+
return `${oe[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
|
|
213
|
+
if (t === "week" && s && s.length === 7) {
|
|
214
|
+
const n = ee(s[0]), l = ee(s[6]);
|
|
215
|
+
return !n || !l ? "" : n.getMonth() === l.getMonth() ? `${oe[n.getMonth()]} ${n.getDate()}–${l.getDate()}, ${n.getFullYear()}` : n.getFullYear() === l.getFullYear() ? `${oe[n.getMonth()].slice(0, 3)} ${n.getDate()} – ${oe[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${n.getFullYear()}` : `${oe[n.getMonth()].slice(0, 3)} ${n.getDate()}, ${n.getFullYear()} – ${oe[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${l.getFullYear()}`;
|
|
216
|
+
}
|
|
217
|
+
return t === "month" ? `${oe[a.getMonth()]} ${a.getFullYear()}` : "";
|
|
218
|
+
}
|
|
219
|
+
function ve(t, e) {
|
|
220
|
+
return t.filter((s) => s.start ? s.end && s.end !== s.start ? e >= s.start && e <= s.end : s.start === e : !1);
|
|
221
|
+
}
|
|
222
|
+
function ye(t) {
|
|
223
|
+
if (!t.length) return t;
|
|
224
|
+
const e = [...t].sort((a, n) => {
|
|
225
|
+
const l = y(a.startTime || "00:00"), r = y(n.startTime || "00:00");
|
|
226
|
+
if (l !== r) return l - r;
|
|
227
|
+
const i = y(a.endTime || "23:59");
|
|
228
|
+
return y(n.endTime || "23:59") - r - (i - l);
|
|
229
|
+
}), s = [];
|
|
230
|
+
for (const a of e) {
|
|
231
|
+
const n = y(a.startTime || "00:00"), l = y(a.endTime || "23:59");
|
|
232
|
+
let r = !1;
|
|
233
|
+
for (let i = 0; i < s.length; i++)
|
|
234
|
+
if (n >= s[i]) {
|
|
235
|
+
a._col = i, s[i] = l, r = !0;
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
r || (a._col = s.length, s.push(l));
|
|
239
|
+
}
|
|
240
|
+
for (const a of e) {
|
|
241
|
+
const n = y(a.startTime || "00:00"), l = y(a.endTime || "23:59");
|
|
242
|
+
let r = a._col;
|
|
243
|
+
for (const i of e) {
|
|
244
|
+
const d = y(i.startTime || "00:00"), g = y(i.endTime || "23:59");
|
|
245
|
+
d < l && g > n && (r = Math.max(r, i._col));
|
|
246
|
+
}
|
|
247
|
+
a._totalCols = r + 1;
|
|
248
|
+
}
|
|
249
|
+
return e;
|
|
250
|
+
}
|
|
251
|
+
function ie(t, e, s, a) {
|
|
252
|
+
return (y(t) - y(e)) / a * s;
|
|
253
|
+
}
|
|
254
|
+
function Ie(t, e, s, a) {
|
|
255
|
+
const n = t / s * a, l = y(e) + n;
|
|
256
|
+
return ce(Math.round(l));
|
|
257
|
+
}
|
|
258
|
+
function ze(t, e) {
|
|
259
|
+
const s = y(t), a = Math.round(s / e) * e;
|
|
260
|
+
return ce(a);
|
|
261
|
+
}
|
|
262
|
+
function Ke(t, e, s) {
|
|
263
|
+
return ve(t, s).filter(
|
|
264
|
+
(a) => a.resourceId === e
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
function Be(t, e, s, a, n) {
|
|
268
|
+
const l = Ke(t, e, s), r = y(a), i = y(n);
|
|
269
|
+
for (const d of l) {
|
|
270
|
+
if (!d.startTime || !d.endTime) continue;
|
|
271
|
+
const g = y(d.startTime), c = y(d.endTime);
|
|
272
|
+
if (r < c && i > g)
|
|
273
|
+
return !1;
|
|
274
|
+
}
|
|
275
|
+
return !0;
|
|
276
|
+
}
|
|
277
|
+
function Qe(t, e, s, a, n = "08:00", l = "18:00") {
|
|
278
|
+
const { duration: r, resourceId: i, minCapacity: d } = t, g = t.date || me(), c = 14;
|
|
279
|
+
let o = e;
|
|
280
|
+
i && (o = e.filter((p) => p.id === i)), d && (o = o.filter(
|
|
281
|
+
(p) => p.capacity && p.capacity >= d
|
|
282
|
+
));
|
|
283
|
+
const k = y(n), u = y(l);
|
|
284
|
+
for (let p = 0; p < c; p++) {
|
|
285
|
+
const v = fe(g, p);
|
|
286
|
+
for (const h of o)
|
|
287
|
+
for (let m = k; m + r <= u; m += a) {
|
|
288
|
+
const w = ce(m), T = ce(m + r);
|
|
289
|
+
if (Be(s, h.id, v, w, T))
|
|
290
|
+
return {
|
|
291
|
+
resourceId: h.id,
|
|
292
|
+
date: v,
|
|
293
|
+
startTime: w,
|
|
294
|
+
endTime: T
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
const et = `
|
|
301
|
+
:host {
|
|
302
|
+
/* Light theme (default) */
|
|
303
|
+
--cal-bg: 0 0% 100%;
|
|
304
|
+
--cal-bg-muted: 240 5% 96%;
|
|
305
|
+
--cal-fg: 240 6% 10%;
|
|
306
|
+
--cal-fg-muted: 240 4% 46%;
|
|
307
|
+
--cal-border: 240 6% 90%;
|
|
308
|
+
--cal-accent: 240 6% 10%;
|
|
309
|
+
--cal-accent-fg: 0 0% 100%;
|
|
310
|
+
--cal-accent-subtle: 240 5% 96%;
|
|
311
|
+
--cal-hover: 240 5% 93%;
|
|
312
|
+
--cal-ring: 240 6% 10%;
|
|
313
|
+
--cal-radius: 8px;
|
|
314
|
+
--cal-radius-sm: 6px;
|
|
315
|
+
--cal-cell-size: 36px;
|
|
316
|
+
--cal-transition: 150ms ease;
|
|
317
|
+
|
|
318
|
+
/* Booking color palette (softer / less saturated) */
|
|
319
|
+
--cal-booking-blue-bg: 217 55% 94%;
|
|
320
|
+
--cal-booking-blue-fg: 217 60% 35%;
|
|
321
|
+
--cal-booking-green-bg: 152 45% 93%;
|
|
322
|
+
--cal-booking-green-fg: 152 55% 28%;
|
|
323
|
+
--cal-booking-red-bg: 4 50% 94%;
|
|
324
|
+
--cal-booking-red-fg: 4 55% 40%;
|
|
325
|
+
--cal-booking-orange-bg: 30 55% 93%;
|
|
326
|
+
--cal-booking-orange-fg: 30 60% 35%;
|
|
327
|
+
--cal-booking-gray-bg: 240 8% 94%;
|
|
328
|
+
--cal-booking-gray-fg: 240 8% 38%;
|
|
329
|
+
|
|
330
|
+
/* Booking hover tokens */
|
|
331
|
+
--cal-booking-blue-hover: 217 55% 88%;
|
|
332
|
+
--cal-booking-green-hover: 152 45% 87%;
|
|
333
|
+
--cal-booking-red-hover: 4 50% 88%;
|
|
334
|
+
--cal-booking-orange-hover: 30 55% 87%;
|
|
335
|
+
--cal-booking-gray-hover: 240 8% 88%;
|
|
336
|
+
|
|
337
|
+
/* Scheduler tokens */
|
|
338
|
+
--cal-sched-grid-line: 240 6% 94%;
|
|
339
|
+
--cal-sched-now-line: 4 70% 55%;
|
|
340
|
+
--cal-sched-slot-hover: 240 5% 97%;
|
|
341
|
+
--cal-sched-header-bg: 240 5% 98%;
|
|
342
|
+
|
|
343
|
+
/* Status tokens */
|
|
344
|
+
--cal-status-error-bg: 4 50% 95%;
|
|
345
|
+
--cal-status-error-fg: 4 55% 40%;
|
|
346
|
+
--cal-status-error-border: 4 50% 85%;
|
|
347
|
+
--cal-status-warning-bg: 40 55% 95%;
|
|
348
|
+
--cal-status-warning-fg: 40 60% 35%;
|
|
349
|
+
--cal-status-warning-border: 40 50% 85%;
|
|
350
|
+
--cal-status-info-bg: 217 55% 95%;
|
|
351
|
+
--cal-status-info-fg: 217 60% 35%;
|
|
352
|
+
--cal-status-info-border: 217 50% 85%;
|
|
353
|
+
--cal-status-success-bg: 152 45% 95%;
|
|
354
|
+
--cal-status-success-fg: 152 55% 28%;
|
|
355
|
+
--cal-status-success-border: 152 45% 85%;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
:host([theme="dark"]) {
|
|
359
|
+
--cal-bg: 240 6% 10%;
|
|
360
|
+
--cal-bg-muted: 240 4% 16%;
|
|
361
|
+
--cal-fg: 0 0% 98%;
|
|
362
|
+
--cal-fg-muted: 240 4% 54%;
|
|
363
|
+
--cal-border: 240 4% 20%;
|
|
364
|
+
--cal-accent: 0 0% 98%;
|
|
365
|
+
--cal-accent-fg: 240 6% 10%;
|
|
366
|
+
--cal-accent-subtle: 240 4% 16%;
|
|
367
|
+
--cal-hover: 240 4% 20%;
|
|
368
|
+
--cal-ring: 0 0% 98%;
|
|
369
|
+
|
|
370
|
+
--cal-booking-blue-bg: 217 50% 25%;
|
|
371
|
+
--cal-booking-blue-fg: 217 80% 75%;
|
|
372
|
+
--cal-booking-green-bg: 142 40% 22%;
|
|
373
|
+
--cal-booking-green-fg: 142 70% 70%;
|
|
374
|
+
--cal-booking-red-bg: 4 45% 25%;
|
|
375
|
+
--cal-booking-red-fg: 4 70% 75%;
|
|
376
|
+
--cal-booking-orange-bg: 30 45% 25%;
|
|
377
|
+
--cal-booking-orange-fg: 30 80% 75%;
|
|
378
|
+
--cal-booking-gray-bg: 240 5% 22%;
|
|
379
|
+
--cal-booking-gray-fg: 240 5% 65%;
|
|
380
|
+
|
|
381
|
+
--cal-booking-blue-hover: 217 50% 30%;
|
|
382
|
+
--cal-booking-green-hover: 142 40% 27%;
|
|
383
|
+
--cal-booking-red-hover: 4 45% 30%;
|
|
384
|
+
--cal-booking-orange-hover: 30 45% 30%;
|
|
385
|
+
--cal-booking-gray-hover: 240 5% 27%;
|
|
386
|
+
|
|
387
|
+
--cal-sched-grid-line: 240 4% 18%;
|
|
388
|
+
--cal-sched-now-line: 4 55% 55%;
|
|
389
|
+
--cal-sched-slot-hover: 240 4% 14%;
|
|
390
|
+
--cal-sched-header-bg: 240 5% 12%;
|
|
391
|
+
|
|
392
|
+
--cal-status-error-bg: 4 45% 20%;
|
|
393
|
+
--cal-status-error-fg: 4 70% 75%;
|
|
394
|
+
--cal-status-error-border: 4 45% 30%;
|
|
395
|
+
--cal-status-warning-bg: 40 45% 20%;
|
|
396
|
+
--cal-status-warning-fg: 40 80% 75%;
|
|
397
|
+
--cal-status-warning-border: 40 45% 30%;
|
|
398
|
+
--cal-status-info-bg: 217 50% 20%;
|
|
399
|
+
--cal-status-info-fg: 217 80% 75%;
|
|
400
|
+
--cal-status-info-border: 217 50% 30%;
|
|
401
|
+
--cal-status-success-bg: 152 40% 18%;
|
|
402
|
+
--cal-status-success-fg: 152 70% 70%;
|
|
403
|
+
--cal-status-success-border: 152 40% 28%;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
:host([theme="auto"]) {
|
|
407
|
+
--cal-bg: 0 0% 100%;
|
|
408
|
+
--cal-bg-muted: 240 5% 96%;
|
|
409
|
+
--cal-fg: 240 6% 10%;
|
|
410
|
+
--cal-fg-muted: 240 4% 46%;
|
|
411
|
+
--cal-border: 240 6% 90%;
|
|
412
|
+
--cal-accent: 240 6% 10%;
|
|
413
|
+
--cal-accent-fg: 0 0% 100%;
|
|
414
|
+
--cal-accent-subtle: 240 5% 96%;
|
|
415
|
+
--cal-hover: 240 5% 93%;
|
|
416
|
+
--cal-ring: 240 6% 10%;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
@media (prefers-color-scheme: dark) {
|
|
420
|
+
:host([theme="auto"]) {
|
|
421
|
+
--cal-bg: 240 6% 10%;
|
|
422
|
+
--cal-bg-muted: 240 4% 16%;
|
|
423
|
+
--cal-fg: 0 0% 98%;
|
|
424
|
+
--cal-fg-muted: 240 4% 54%;
|
|
425
|
+
--cal-border: 240 4% 20%;
|
|
426
|
+
--cal-accent: 0 0% 98%;
|
|
427
|
+
--cal-accent-fg: 240 6% 10%;
|
|
428
|
+
--cal-accent-subtle: 240 4% 16%;
|
|
429
|
+
--cal-hover: 240 4% 20%;
|
|
430
|
+
--cal-ring: 0 0% 98%;
|
|
431
|
+
|
|
432
|
+
--cal-booking-blue-bg: 217 50% 25%;
|
|
433
|
+
--cal-booking-blue-fg: 217 80% 75%;
|
|
434
|
+
--cal-booking-green-bg: 142 40% 22%;
|
|
435
|
+
--cal-booking-green-fg: 142 70% 70%;
|
|
436
|
+
--cal-booking-red-bg: 4 45% 25%;
|
|
437
|
+
--cal-booking-red-fg: 4 70% 75%;
|
|
438
|
+
--cal-booking-orange-bg: 30 45% 25%;
|
|
439
|
+
--cal-booking-orange-fg: 30 80% 75%;
|
|
440
|
+
--cal-booking-gray-bg: 240 5% 22%;
|
|
441
|
+
--cal-booking-gray-fg: 240 5% 65%;
|
|
442
|
+
|
|
443
|
+
--cal-booking-blue-hover: 217 50% 30%;
|
|
444
|
+
--cal-booking-green-hover: 142 40% 27%;
|
|
445
|
+
--cal-booking-red-hover: 4 45% 30%;
|
|
446
|
+
--cal-booking-orange-hover: 30 45% 30%;
|
|
447
|
+
--cal-booking-gray-hover: 240 5% 27%;
|
|
448
|
+
|
|
449
|
+
--cal-sched-grid-line: 240 4% 18%;
|
|
450
|
+
--cal-sched-now-line: 4 55% 55%;
|
|
451
|
+
--cal-sched-slot-hover: 240 4% 14%;
|
|
452
|
+
--cal-sched-header-bg: 240 5% 12%;
|
|
453
|
+
|
|
454
|
+
--cal-status-error-bg: 4 45% 20%;
|
|
455
|
+
--cal-status-error-fg: 4 70% 75%;
|
|
456
|
+
--cal-status-error-border: 4 45% 30%;
|
|
457
|
+
--cal-status-warning-bg: 40 45% 20%;
|
|
458
|
+
--cal-status-warning-fg: 40 80% 75%;
|
|
459
|
+
--cal-status-warning-border: 40 45% 30%;
|
|
460
|
+
--cal-status-info-bg: 217 50% 20%;
|
|
461
|
+
--cal-status-info-fg: 217 80% 75%;
|
|
462
|
+
--cal-status-info-border: 217 50% 30%;
|
|
463
|
+
--cal-status-success-bg: 152 40% 18%;
|
|
464
|
+
--cal-status-success-fg: 152 70% 70%;
|
|
465
|
+
--cal-status-success-border: 152 40% 28%;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
`, tt = `
|
|
469
|
+
:host {
|
|
470
|
+
display: inline-block;
|
|
471
|
+
font-family: inherit;
|
|
472
|
+
font-size: 14px;
|
|
473
|
+
line-height: 1.5;
|
|
474
|
+
color: hsl(var(--cal-fg));
|
|
475
|
+
-webkit-font-smoothing: antialiased;
|
|
476
|
+
-moz-osx-font-smoothing: grayscale;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
:host([display="inline"]) {
|
|
480
|
+
display: inline-block;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
*,
|
|
484
|
+
*::before,
|
|
485
|
+
*::after {
|
|
486
|
+
box-sizing: border-box;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
button {
|
|
490
|
+
font: inherit;
|
|
491
|
+
color: inherit;
|
|
492
|
+
background: none;
|
|
493
|
+
border: none;
|
|
494
|
+
padding: 0;
|
|
495
|
+
margin: 0;
|
|
496
|
+
cursor: pointer;
|
|
497
|
+
-webkit-tap-highlight-color: transparent;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
button:focus-visible {
|
|
501
|
+
outline: 2px solid hsl(var(--cal-ring));
|
|
502
|
+
outline-offset: 2px;
|
|
503
|
+
border-radius: var(--cal-radius-sm);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
[hidden] {
|
|
507
|
+
display: none !important;
|
|
508
|
+
}
|
|
509
|
+
`, at = `
|
|
510
|
+
@keyframes cal-fade-in {
|
|
511
|
+
from { opacity: 0; }
|
|
512
|
+
to { opacity: 1; }
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
@keyframes cal-slide-up {
|
|
516
|
+
from {
|
|
517
|
+
opacity: 0;
|
|
518
|
+
transform: translateY(4px);
|
|
519
|
+
}
|
|
520
|
+
to {
|
|
521
|
+
opacity: 1;
|
|
522
|
+
transform: translateY(0);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
@keyframes cal-slide-left {
|
|
527
|
+
from {
|
|
528
|
+
opacity: 0;
|
|
529
|
+
transform: translateX(16px);
|
|
530
|
+
}
|
|
531
|
+
to {
|
|
532
|
+
opacity: 1;
|
|
533
|
+
transform: translateX(0);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
@keyframes cal-slide-right {
|
|
538
|
+
from {
|
|
539
|
+
opacity: 0;
|
|
540
|
+
transform: translateX(-16px);
|
|
541
|
+
}
|
|
542
|
+
to {
|
|
543
|
+
opacity: 1;
|
|
544
|
+
transform: translateX(0);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.cal-animate-fade { animation: cal-fade-in 150ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
549
|
+
.cal-animate-slide-up { animation: cal-slide-up 200ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
550
|
+
.cal-animate-slide-left { animation: cal-slide-left 200ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
551
|
+
.cal-animate-slide-right { animation: cal-slide-right 200ms cubic-bezier(0.16, 1, 0.3, 1); }
|
|
552
|
+
|
|
553
|
+
@keyframes cal-shimmer {
|
|
554
|
+
0% { background-position: -200% 0; }
|
|
555
|
+
100% { background-position: 200% 0; }
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.cal-skeleton {
|
|
559
|
+
background: linear-gradient(
|
|
560
|
+
90deg,
|
|
561
|
+
hsl(var(--cal-bg-muted)) 25%,
|
|
562
|
+
hsl(var(--cal-hover)) 50%,
|
|
563
|
+
hsl(var(--cal-bg-muted)) 75%
|
|
564
|
+
);
|
|
565
|
+
background-size: 200% 100%;
|
|
566
|
+
animation: cal-shimmer 1.5s infinite ease-in-out;
|
|
567
|
+
border-radius: 999px;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.cal-skeleton--rect {
|
|
571
|
+
border-radius: var(--cal-radius-sm);
|
|
572
|
+
}
|
|
573
|
+
`, st = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>', nt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';
|
|
574
|
+
function lt({ title: t, view: e, onPrev: s, onNext: a, onToday: n, onViewChange: l }) {
|
|
575
|
+
const r = document.createElement("div");
|
|
576
|
+
r.classList.add("cal-sched-nav");
|
|
577
|
+
const i = document.createElement("div");
|
|
578
|
+
i.classList.add("cal-sched-nav__left");
|
|
579
|
+
const d = document.createElement("button");
|
|
580
|
+
d.classList.add("cal-sched-nav__btn"), d.innerHTML = st, d.setAttribute("aria-label", "Previous"), d.addEventListener("click", s);
|
|
581
|
+
const g = document.createElement("button");
|
|
582
|
+
g.classList.add("cal-sched-nav__btn"), g.innerHTML = nt, g.setAttribute("aria-label", "Next"), g.addEventListener("click", a);
|
|
583
|
+
const c = document.createElement("button");
|
|
584
|
+
c.classList.add("cal-sched-nav__today"), c.textContent = "Today", c.addEventListener("click", n);
|
|
585
|
+
const o = document.createElement("span");
|
|
586
|
+
o.classList.add("cal-sched-nav__title"), o.setAttribute("aria-live", "polite"), o.textContent = t, i.appendChild(d), i.appendChild(g), i.appendChild(c), i.appendChild(o);
|
|
587
|
+
const k = document.createElement("div");
|
|
588
|
+
k.classList.add("cal-sched-nav__tabs");
|
|
589
|
+
for (const u of ["day", "week", "month"]) {
|
|
590
|
+
const p = document.createElement("button");
|
|
591
|
+
p.classList.add("cal-sched-nav__tab"), u === e && p.classList.add("cal-sched-nav__tab--active"), p.textContent = u.charAt(0).toUpperCase() + u.slice(1), p.addEventListener("click", () => l(u)), k.appendChild(p);
|
|
592
|
+
}
|
|
593
|
+
return r.appendChild(i), r.appendChild(k), r;
|
|
594
|
+
}
|
|
595
|
+
const rt = `
|
|
596
|
+
.cal-sched-nav {
|
|
597
|
+
display: flex;
|
|
598
|
+
align-items: center;
|
|
599
|
+
justify-content: space-between;
|
|
600
|
+
padding: 8px 0;
|
|
601
|
+
gap: 8px;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.cal-sched-nav__left {
|
|
605
|
+
display: flex;
|
|
606
|
+
align-items: center;
|
|
607
|
+
gap: 4px;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.cal-sched-nav__btn {
|
|
611
|
+
display: flex;
|
|
612
|
+
align-items: center;
|
|
613
|
+
justify-content: center;
|
|
614
|
+
width: 28px;
|
|
615
|
+
height: 28px;
|
|
616
|
+
border-radius: var(--cal-radius-sm);
|
|
617
|
+
color: hsl(var(--cal-fg));
|
|
618
|
+
transition: background var(--cal-transition);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.cal-sched-nav__btn:hover {
|
|
622
|
+
background: hsl(var(--cal-hover));
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.cal-sched-nav__today {
|
|
626
|
+
font-size: 13px;
|
|
627
|
+
font-weight: 500;
|
|
628
|
+
color: hsl(var(--cal-fg));
|
|
629
|
+
padding: 4px 12px;
|
|
630
|
+
border-radius: var(--cal-radius-sm);
|
|
631
|
+
border: 1px solid hsl(var(--cal-border));
|
|
632
|
+
margin-left: 4px;
|
|
633
|
+
margin-right: 8px;
|
|
634
|
+
transition: background var(--cal-transition);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.cal-sched-nav__today:hover {
|
|
638
|
+
background: hsl(var(--cal-hover));
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.cal-sched-nav__title {
|
|
642
|
+
font-size: 14px;
|
|
643
|
+
font-weight: 600;
|
|
644
|
+
color: hsl(var(--cal-fg));
|
|
645
|
+
user-select: none;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
.cal-sched-nav__tabs {
|
|
649
|
+
display: flex;
|
|
650
|
+
gap: 0;
|
|
651
|
+
border: 1px solid hsl(var(--cal-border));
|
|
652
|
+
border-radius: var(--cal-radius-sm);
|
|
653
|
+
overflow: hidden;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.cal-sched-nav__tab {
|
|
657
|
+
font-size: 13px;
|
|
658
|
+
font-weight: 500;
|
|
659
|
+
color: hsl(var(--cal-fg-muted));
|
|
660
|
+
padding: 4px 12px;
|
|
661
|
+
transition: all var(--cal-transition);
|
|
662
|
+
border-right: 1px solid hsl(var(--cal-border));
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.cal-sched-nav__tab:last-child {
|
|
666
|
+
border-right: none;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
.cal-sched-nav__tab:hover {
|
|
670
|
+
background: hsl(var(--cal-hover));
|
|
671
|
+
color: hsl(var(--cal-fg));
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
.cal-sched-nav__tab--active {
|
|
675
|
+
background: hsl(var(--cal-accent));
|
|
676
|
+
color: hsl(var(--cal-accent-fg));
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.cal-sched-nav__tab--active:hover {
|
|
680
|
+
background: hsl(var(--cal-accent));
|
|
681
|
+
color: hsl(var(--cal-accent-fg));
|
|
682
|
+
}
|
|
683
|
+
`;
|
|
684
|
+
function Ne({ startTime: t, endTime: e, interval: s, slotHeight: a, format: n }) {
|
|
685
|
+
const l = document.createElement("div");
|
|
686
|
+
l.classList.add("cal-sched-time-axis");
|
|
687
|
+
const r = Me(t, e, s);
|
|
688
|
+
for (let i = 0; i < r.length; i++) {
|
|
689
|
+
const d = r[i], g = he(d);
|
|
690
|
+
if (!g) continue;
|
|
691
|
+
const c = document.createElement("div");
|
|
692
|
+
if (c.classList.add("cal-sched-time-axis__slot"), c.style.height = `${a}px`, g.minutes === 0) {
|
|
693
|
+
const o = document.createElement("span");
|
|
694
|
+
o.classList.add("cal-sched-time-axis__label"), o.textContent = ge(g.hours, g.minutes, n), c.appendChild(o);
|
|
695
|
+
}
|
|
696
|
+
l.appendChild(c);
|
|
697
|
+
}
|
|
698
|
+
return l;
|
|
699
|
+
}
|
|
700
|
+
const it = `
|
|
701
|
+
.cal-sched-time-axis {
|
|
702
|
+
display: flex;
|
|
703
|
+
flex-direction: column;
|
|
704
|
+
flex-shrink: 0;
|
|
705
|
+
width: 56px;
|
|
706
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.cal-sched-time-axis__slot {
|
|
710
|
+
position: relative;
|
|
711
|
+
display: flex;
|
|
712
|
+
align-items: flex-start;
|
|
713
|
+
justify-content: flex-end;
|
|
714
|
+
padding-right: 8px;
|
|
715
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.cal-sched-time-axis__label {
|
|
719
|
+
font-size: 11px;
|
|
720
|
+
color: hsl(var(--cal-fg-muted));
|
|
721
|
+
transform: translateY(-7px);
|
|
722
|
+
white-space: nowrap;
|
|
723
|
+
user-select: none;
|
|
724
|
+
}
|
|
725
|
+
`;
|
|
726
|
+
function ct({ resource: t, width: e }) {
|
|
727
|
+
const s = document.createElement("div");
|
|
728
|
+
s.classList.add("cal-sched-resource-header"), e && (s.style.width = `${e}px`), s.style.flex = e ? `0 0 ${e}px` : "1 1 0";
|
|
729
|
+
const a = document.createElement("span");
|
|
730
|
+
a.classList.add("cal-sched-resource-header__dot");
|
|
731
|
+
const n = t.color || "blue";
|
|
732
|
+
a.style.background = `hsl(var(--cal-booking-${n}-fg))`, s.appendChild(a);
|
|
733
|
+
const l = document.createElement("span");
|
|
734
|
+
if (l.classList.add("cal-sched-resource-header__name"), l.textContent = t.name, s.appendChild(l), t.capacity) {
|
|
735
|
+
const r = document.createElement("span");
|
|
736
|
+
r.classList.add("cal-sched-resource-header__capacity"), r.textContent = t.capacity, r.setAttribute("title", `Capacity: ${t.capacity}`), s.appendChild(r);
|
|
737
|
+
}
|
|
738
|
+
return s;
|
|
739
|
+
}
|
|
740
|
+
function dt({ resources: t }) {
|
|
741
|
+
const e = document.createElement("div");
|
|
742
|
+
e.classList.add("cal-sched-resource-header-row");
|
|
743
|
+
for (const s of t)
|
|
744
|
+
e.appendChild(ct({ resource: s }));
|
|
745
|
+
return e;
|
|
746
|
+
}
|
|
747
|
+
const ot = `
|
|
748
|
+
.cal-sched-resource-header-row {
|
|
749
|
+
display: flex;
|
|
750
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
751
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
.cal-sched-resource-header {
|
|
755
|
+
display: flex;
|
|
756
|
+
align-items: center;
|
|
757
|
+
gap: 6px;
|
|
758
|
+
padding: 8px 12px;
|
|
759
|
+
min-width: 0;
|
|
760
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.cal-sched-resource-header:last-child {
|
|
764
|
+
border-right: none;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
.cal-sched-resource-header__dot {
|
|
768
|
+
width: 8px;
|
|
769
|
+
height: 8px;
|
|
770
|
+
border-radius: 50%;
|
|
771
|
+
flex-shrink: 0;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.cal-sched-resource-header__name {
|
|
775
|
+
font-size: 13px;
|
|
776
|
+
font-weight: 500;
|
|
777
|
+
color: hsl(var(--cal-fg));
|
|
778
|
+
white-space: nowrap;
|
|
779
|
+
overflow: hidden;
|
|
780
|
+
text-overflow: ellipsis;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
.cal-sched-resource-header__capacity {
|
|
784
|
+
font-size: 11px;
|
|
785
|
+
color: hsl(var(--cal-fg-muted));
|
|
786
|
+
background: hsl(var(--cal-bg-muted));
|
|
787
|
+
padding: 1px 6px;
|
|
788
|
+
border-radius: 999px;
|
|
789
|
+
flex-shrink: 0;
|
|
790
|
+
}
|
|
791
|
+
`;
|
|
792
|
+
function we({ event: t, gridStartTime: e, slotHeight: s, interval: a, format: n, onClick: l, eventContent: r, showTime: i = !0, resource: d, draggable: g }) {
|
|
793
|
+
const c = document.createElement("div");
|
|
794
|
+
c.classList.add("cal-sched-event"), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.dataset.eventId = t.id;
|
|
795
|
+
const o = !!t.locked;
|
|
796
|
+
g && !o && (c.dataset.draggable = "true"), o && c.classList.add("cal-sched-event--locked");
|
|
797
|
+
const k = t.color || "blue";
|
|
798
|
+
if (c.style.setProperty("--ev-bg", `var(--cal-booking-${k}-bg)`), c.style.setProperty("--ev-fg", `var(--cal-booking-${k}-fg)`), t.startTime && t.endTime) {
|
|
799
|
+
const u = ie(t.startTime, e, s, a), p = ie(t.endTime, e, s, a), v = Math.max(p - u, s * 0.5);
|
|
800
|
+
if (c.style.top = `${u}px`, c.style.height = `${v}px`, t._totalCols > 1) {
|
|
801
|
+
const h = 100 / t._totalCols;
|
|
802
|
+
c.style.left = `${t._col * h}%`, c.style.width = `${h}%`;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (typeof r == "function") {
|
|
806
|
+
const u = r(t, d), p = document.createElement("div");
|
|
807
|
+
p.classList.add("cal-sched-event__custom"), u instanceof HTMLElement ? p.appendChild(u) : u != null && (p.textContent = String(u)), c.appendChild(p);
|
|
808
|
+
} else {
|
|
809
|
+
const u = document.createElement("div");
|
|
810
|
+
if (u.classList.add("cal-sched-event__title"), u.textContent = t.title || "", c.appendChild(u), i && t.startTime && t.endTime) {
|
|
811
|
+
const p = document.createElement("div");
|
|
812
|
+
p.classList.add("cal-sched-event__time");
|
|
813
|
+
const v = he(t.startTime), h = he(t.endTime);
|
|
814
|
+
v && h && (p.textContent = `${ge(v.hours, v.minutes, n)}–${ge(h.hours, h.minutes, n)}`), c.appendChild(p);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
if (g && !o) {
|
|
818
|
+
const u = document.createElement("div");
|
|
819
|
+
u.classList.add("cal-sched-event__resize-handle"), c.appendChild(u);
|
|
820
|
+
}
|
|
821
|
+
return l && (c.addEventListener("click", (u) => {
|
|
822
|
+
if (c.dataset.wasDragged) {
|
|
823
|
+
delete c.dataset.wasDragged;
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
u.stopPropagation(), l(t);
|
|
827
|
+
}), c.addEventListener("keydown", (u) => {
|
|
828
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), l(t));
|
|
829
|
+
})), c;
|
|
830
|
+
}
|
|
831
|
+
function je({ event: t, onClick: e, eventContent: s, resource: a }) {
|
|
832
|
+
const n = document.createElement("div");
|
|
833
|
+
n.classList.add("cal-sched-allday-chip"), n.dataset.eventId = t.id;
|
|
834
|
+
const l = t.color || "blue";
|
|
835
|
+
if (n.style.setProperty("--ev-bg", `var(--cal-booking-${l}-bg)`), n.style.setProperty("--ev-fg", `var(--cal-booking-${l}-fg)`), typeof s == "function") {
|
|
836
|
+
const r = s(t, a);
|
|
837
|
+
r instanceof HTMLElement ? n.appendChild(r) : r != null && (n.textContent = String(r));
|
|
838
|
+
} else
|
|
839
|
+
n.textContent = t.title || "";
|
|
840
|
+
return e && n.addEventListener("click", (r) => {
|
|
841
|
+
r.stopPropagation(), e(t);
|
|
842
|
+
}), n;
|
|
843
|
+
}
|
|
844
|
+
function ht({ event: t, format: e, onClick: s, eventContent: a, resource: n }) {
|
|
845
|
+
const l = document.createElement("div");
|
|
846
|
+
l.classList.add("cal-sched-month-chip"), l.dataset.eventId = t.id;
|
|
847
|
+
const r = t.color || "blue";
|
|
848
|
+
if (l.style.setProperty("--ev-bg", `var(--cal-booking-${r}-bg)`), l.style.setProperty("--ev-fg", `var(--cal-booking-${r}-fg)`), typeof a == "function") {
|
|
849
|
+
const i = a(t, n);
|
|
850
|
+
i instanceof HTMLElement ? l.appendChild(i) : i != null && (l.textContent = String(i));
|
|
851
|
+
} else {
|
|
852
|
+
const i = document.createElement("span");
|
|
853
|
+
i.classList.add("cal-sched-month-chip__dot"), i.style.background = `hsl(var(--cal-booking-${r}-fg))`, l.appendChild(i);
|
|
854
|
+
const d = document.createElement("span");
|
|
855
|
+
if (d.classList.add("cal-sched-month-chip__text"), t.startTime) {
|
|
856
|
+
const g = he(t.startTime), c = g ? ge(g.hours, g.minutes, e) : t.startTime;
|
|
857
|
+
d.textContent = `${c} ${t.title || ""}`;
|
|
858
|
+
} else
|
|
859
|
+
d.textContent = t.title || "";
|
|
860
|
+
l.appendChild(d);
|
|
861
|
+
}
|
|
862
|
+
return s && l.addEventListener("click", (i) => {
|
|
863
|
+
i.stopPropagation(), s(t);
|
|
864
|
+
}), l;
|
|
865
|
+
}
|
|
866
|
+
const ut = `
|
|
867
|
+
.cal-sched-event {
|
|
868
|
+
position: absolute;
|
|
869
|
+
left: 2px;
|
|
870
|
+
right: 2px;
|
|
871
|
+
background: hsl(var(--ev-bg));
|
|
872
|
+
color: hsl(var(--ev-fg));
|
|
873
|
+
border-left: 3px solid hsl(var(--ev-fg));
|
|
874
|
+
border-radius: var(--cal-radius-sm);
|
|
875
|
+
padding: 2px 6px;
|
|
876
|
+
font-size: 12px;
|
|
877
|
+
line-height: 1.3;
|
|
878
|
+
overflow: hidden;
|
|
879
|
+
cursor: pointer;
|
|
880
|
+
transition: box-shadow var(--cal-transition);
|
|
881
|
+
z-index: 1;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.cal-sched-event:hover {
|
|
885
|
+
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
|
|
886
|
+
z-index: 2;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
.cal-sched-event:focus-visible {
|
|
890
|
+
outline: 2px solid hsl(var(--cal-ring));
|
|
891
|
+
outline-offset: 1px;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
.cal-sched-event__title {
|
|
895
|
+
font-weight: 500;
|
|
896
|
+
white-space: nowrap;
|
|
897
|
+
overflow: hidden;
|
|
898
|
+
text-overflow: ellipsis;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
.cal-sched-event__time {
|
|
902
|
+
font-size: 11px;
|
|
903
|
+
opacity: 0.8;
|
|
904
|
+
white-space: nowrap;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.cal-sched-event__custom {
|
|
908
|
+
overflow: hidden;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.cal-sched-event--locked {
|
|
912
|
+
cursor: default;
|
|
913
|
+
opacity: 0.85;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
.cal-sched-event--locked::after {
|
|
917
|
+
content: '';
|
|
918
|
+
position: absolute;
|
|
919
|
+
top: 3px;
|
|
920
|
+
right: 4px;
|
|
921
|
+
width: 10px;
|
|
922
|
+
height: 10px;
|
|
923
|
+
background: currentColor;
|
|
924
|
+
opacity: 0.25;
|
|
925
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M11 5V4a3 3 0 0 0-6 0v1H4v7h8V5h-1ZM6 4a2 2 0 1 1 4 0v1H6V4Z'/%3E%3C/svg%3E");
|
|
926
|
+
mask-size: contain;
|
|
927
|
+
mask-repeat: no-repeat;
|
|
928
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M11 5V4a3 3 0 0 0-6 0v1H4v7h8V5h-1ZM6 4a2 2 0 1 1 4 0v1H6V4Z'/%3E%3C/svg%3E");
|
|
929
|
+
-webkit-mask-size: contain;
|
|
930
|
+
-webkit-mask-repeat: no-repeat;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
.cal-sched-allday-chip {
|
|
934
|
+
background: hsl(var(--ev-bg));
|
|
935
|
+
color: hsl(var(--ev-fg));
|
|
936
|
+
border-left: 3px solid hsl(var(--ev-fg));
|
|
937
|
+
border-radius: var(--cal-radius-sm);
|
|
938
|
+
padding: 2px 8px;
|
|
939
|
+
font-size: 12px;
|
|
940
|
+
font-weight: 500;
|
|
941
|
+
white-space: nowrap;
|
|
942
|
+
overflow: hidden;
|
|
943
|
+
text-overflow: ellipsis;
|
|
944
|
+
cursor: pointer;
|
|
945
|
+
transition: box-shadow var(--cal-transition);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
.cal-sched-allday-chip:hover {
|
|
949
|
+
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
.cal-sched-month-chip {
|
|
953
|
+
display: flex;
|
|
954
|
+
align-items: center;
|
|
955
|
+
gap: 4px;
|
|
956
|
+
background: hsl(var(--ev-bg));
|
|
957
|
+
color: hsl(var(--ev-fg));
|
|
958
|
+
border-radius: var(--cal-radius-sm);
|
|
959
|
+
padding: 1px 6px;
|
|
960
|
+
font-size: 11px;
|
|
961
|
+
cursor: pointer;
|
|
962
|
+
overflow: hidden;
|
|
963
|
+
transition: box-shadow var(--cal-transition);
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
.cal-sched-month-chip:hover {
|
|
967
|
+
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.cal-sched-month-chip__dot {
|
|
971
|
+
width: 6px;
|
|
972
|
+
height: 6px;
|
|
973
|
+
border-radius: 50%;
|
|
974
|
+
flex-shrink: 0;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
.cal-sched-month-chip__text {
|
|
978
|
+
white-space: nowrap;
|
|
979
|
+
overflow: hidden;
|
|
980
|
+
text-overflow: ellipsis;
|
|
981
|
+
}
|
|
982
|
+
`;
|
|
983
|
+
function be({ date: t, startTime: e, endTime: s, resourceName: a, format: n, onCreate: l }) {
|
|
984
|
+
const r = document.createElement("div");
|
|
985
|
+
r.classList.add("cal-sched-slot-prompt", "cal-animate-fade");
|
|
986
|
+
const i = document.createElement("div");
|
|
987
|
+
if (i.classList.add("cal-sched-slot-prompt__info"), e && s) {
|
|
988
|
+
const g = he(e), c = he(s), o = document.createElement("div");
|
|
989
|
+
o.classList.add("cal-sched-slot-prompt__time"), g && c && (o.textContent = `${ge(g.hours, g.minutes, n)}–${ge(c.hours, c.minutes, n)}`), i.appendChild(o);
|
|
990
|
+
} else {
|
|
991
|
+
const g = document.createElement("div");
|
|
992
|
+
g.classList.add("cal-sched-slot-prompt__time"), g.textContent = t, i.appendChild(g);
|
|
993
|
+
}
|
|
994
|
+
if (a) {
|
|
995
|
+
const g = document.createElement("div");
|
|
996
|
+
g.classList.add("cal-sched-slot-prompt__resource"), g.textContent = a, i.appendChild(g);
|
|
997
|
+
}
|
|
998
|
+
r.appendChild(i);
|
|
999
|
+
const d = document.createElement("button");
|
|
1000
|
+
return d.classList.add("cal-sched-slot-prompt__btn"), d.setAttribute("aria-label", "Create event"), d.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M7 3v8M3 7h8"/></svg>', d.addEventListener("click", (g) => {
|
|
1001
|
+
g.stopPropagation(), l == null || l();
|
|
1002
|
+
}), r.appendChild(d), r.addEventListener("click", (g) => g.stopPropagation()), r;
|
|
1003
|
+
}
|
|
1004
|
+
const pt = `
|
|
1005
|
+
.cal-sched-slot-prompt {
|
|
1006
|
+
position: absolute;
|
|
1007
|
+
z-index: 10;
|
|
1008
|
+
display: flex;
|
|
1009
|
+
align-items: center;
|
|
1010
|
+
gap: 8px;
|
|
1011
|
+
background: hsl(var(--cal-bg));
|
|
1012
|
+
border: 1px solid hsl(var(--cal-border));
|
|
1013
|
+
border-radius: var(--cal-radius);
|
|
1014
|
+
box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.1), 0 1px 4px -1px rgba(0, 0, 0, 0.06);
|
|
1015
|
+
padding: 6px 8px 6px 12px;
|
|
1016
|
+
font-size: 12px;
|
|
1017
|
+
color: hsl(var(--cal-fg));
|
|
1018
|
+
white-space: nowrap;
|
|
1019
|
+
pointer-events: auto;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
.cal-sched-slot-prompt__info {
|
|
1023
|
+
display: flex;
|
|
1024
|
+
flex-direction: column;
|
|
1025
|
+
gap: 1px;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
.cal-sched-slot-prompt__time {
|
|
1029
|
+
font-weight: 600;
|
|
1030
|
+
font-size: 12px;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.cal-sched-slot-prompt__resource {
|
|
1034
|
+
font-size: 11px;
|
|
1035
|
+
color: hsl(var(--cal-fg-muted));
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
.cal-sched-slot-prompt__btn {
|
|
1039
|
+
display: flex;
|
|
1040
|
+
align-items: center;
|
|
1041
|
+
justify-content: center;
|
|
1042
|
+
width: 26px;
|
|
1043
|
+
height: 26px;
|
|
1044
|
+
border-radius: var(--cal-radius-sm);
|
|
1045
|
+
background: hsl(var(--cal-accent));
|
|
1046
|
+
color: hsl(var(--cal-accent-fg));
|
|
1047
|
+
flex-shrink: 0;
|
|
1048
|
+
transition: opacity var(--cal-transition);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.cal-sched-slot-prompt__btn:hover {
|
|
1052
|
+
opacity: 0.85;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/* Selected slot highlight */
|
|
1056
|
+
.cal-sched-week__slot--selected,
|
|
1057
|
+
.cal-sched-day__slot--selected {
|
|
1058
|
+
background: hsl(var(--cal-accent-subtle));
|
|
1059
|
+
box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
|
|
1060
|
+
z-index: 1;
|
|
1061
|
+
position: relative;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
.cal-sched-month__cell--selected {
|
|
1065
|
+
background: hsl(var(--cal-accent-subtle));
|
|
1066
|
+
box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
|
|
1067
|
+
}
|
|
1068
|
+
`;
|
|
1069
|
+
function gt({
|
|
1070
|
+
date: t,
|
|
1071
|
+
resources: e,
|
|
1072
|
+
events: s,
|
|
1073
|
+
startTime: a,
|
|
1074
|
+
endTime: n,
|
|
1075
|
+
interval: l,
|
|
1076
|
+
slotHeight: r,
|
|
1077
|
+
format: i,
|
|
1078
|
+
layout: d,
|
|
1079
|
+
resourceMode: g,
|
|
1080
|
+
selectedSlot: c,
|
|
1081
|
+
eventContent: o,
|
|
1082
|
+
showTime: k = !0,
|
|
1083
|
+
draggable: u,
|
|
1084
|
+
onSlotClick: p,
|
|
1085
|
+
onEventClick: v,
|
|
1086
|
+
onSlotCreate: h
|
|
1087
|
+
}) {
|
|
1088
|
+
const m = document.createElement("div");
|
|
1089
|
+
m.classList.add("cal-sched-day"), d === "horizontal" && m.classList.add("cal-sched-day--horizontal");
|
|
1090
|
+
const w = g === "tabs", T = e.length > 1 && !w, D = ve(s, t), F = D.filter((_) => !_.startTime || !_.endTime), X = D.filter((_) => _.startTime && _.endTime), Y = Me(a, n, l);
|
|
1091
|
+
if (F.length > 0) {
|
|
1092
|
+
const _ = document.createElement("div");
|
|
1093
|
+
_.classList.add("cal-sched-day__allday");
|
|
1094
|
+
const E = document.createElement("div");
|
|
1095
|
+
E.classList.add("cal-sched-day__allday-label"), E.textContent = "All day", _.appendChild(E);
|
|
1096
|
+
const Z = document.createElement("div");
|
|
1097
|
+
Z.classList.add("cal-sched-day__allday-chips");
|
|
1098
|
+
for (const j of F) {
|
|
1099
|
+
const M = e.find((f) => f.id === j.resourceId);
|
|
1100
|
+
Z.appendChild(je({
|
|
1101
|
+
event: j,
|
|
1102
|
+
onClick: (f) => v == null ? void 0 : v(f, j.resourceId, M),
|
|
1103
|
+
eventContent: o,
|
|
1104
|
+
resource: M
|
|
1105
|
+
}));
|
|
1106
|
+
}
|
|
1107
|
+
_.appendChild(Z), m.appendChild(_);
|
|
1108
|
+
}
|
|
1109
|
+
if (T) {
|
|
1110
|
+
const _ = document.createElement("div");
|
|
1111
|
+
_.classList.add("cal-sched-day__header");
|
|
1112
|
+
const E = document.createElement("div");
|
|
1113
|
+
E.classList.add("cal-sched-day__header-spacer"), _.appendChild(E), _.appendChild(dt({ resources: e })), m.appendChild(_);
|
|
1114
|
+
}
|
|
1115
|
+
const N = document.createElement("div");
|
|
1116
|
+
N.classList.add("cal-sched-day__grid-area"), N.appendChild(Ne({ startTime: a, endTime: n, interval: l, slotHeight: r, format: i }));
|
|
1117
|
+
const P = document.createElement("div");
|
|
1118
|
+
if (P.classList.add("cal-sched-day__lanes"), T)
|
|
1119
|
+
for (const _ of e) {
|
|
1120
|
+
const E = document.createElement("div");
|
|
1121
|
+
E.classList.add("cal-sched-day__lane"), E.style.flex = "1 1 0", E.dataset.resourceId = _.id, E.dataset.date = t;
|
|
1122
|
+
for (let M = 0; M < Y.length; M++) {
|
|
1123
|
+
const f = document.createElement("div");
|
|
1124
|
+
f.classList.add("cal-sched-day__slot"), f.style.height = `${r}px`, f.dataset.time = Y[M], f.dataset.resourceId = _.id;
|
|
1125
|
+
const z = M < Y.length - 1 ? Y[M + 1] : n;
|
|
1126
|
+
c && c.date === t && c.startTime === Y[M] && c.resourceId === _.id && (f.classList.add("cal-sched-day__slot--selected"), f.appendChild(be({
|
|
1127
|
+
date: t,
|
|
1128
|
+
startTime: Y[M],
|
|
1129
|
+
endTime: z,
|
|
1130
|
+
resourceName: _.name,
|
|
1131
|
+
format: i,
|
|
1132
|
+
onCreate: () => h == null ? void 0 : h(t, Y[M], z, _.id, _)
|
|
1133
|
+
}))), f.addEventListener("click", () => {
|
|
1134
|
+
p == null || p(t, Y[M], z, _.id, _);
|
|
1135
|
+
}), E.appendChild(f);
|
|
1136
|
+
}
|
|
1137
|
+
const Z = X.filter((M) => M.resourceId === _.id), j = ye(Z);
|
|
1138
|
+
for (const M of j)
|
|
1139
|
+
E.appendChild(we({
|
|
1140
|
+
event: M,
|
|
1141
|
+
gridStartTime: a,
|
|
1142
|
+
slotHeight: r,
|
|
1143
|
+
interval: l,
|
|
1144
|
+
format: i,
|
|
1145
|
+
onClick: (f) => v == null ? void 0 : v(f, _.id, _),
|
|
1146
|
+
eventContent: o,
|
|
1147
|
+
showTime: k,
|
|
1148
|
+
resource: _,
|
|
1149
|
+
draggable: u
|
|
1150
|
+
}));
|
|
1151
|
+
P.appendChild(E);
|
|
1152
|
+
}
|
|
1153
|
+
else {
|
|
1154
|
+
const _ = document.createElement("div");
|
|
1155
|
+
_.classList.add("cal-sched-day__lane"), _.style.flex = "1 1 0", _.dataset.date = t;
|
|
1156
|
+
const E = e.length === 1 ? e[0] : null;
|
|
1157
|
+
E && (_.dataset.resourceId = E.id);
|
|
1158
|
+
for (let j = 0; j < Y.length; j++) {
|
|
1159
|
+
const M = document.createElement("div");
|
|
1160
|
+
M.classList.add("cal-sched-day__slot"), M.style.height = `${r}px`, M.dataset.time = Y[j];
|
|
1161
|
+
const f = j < Y.length - 1 ? Y[j + 1] : n, z = (E == null ? void 0 : E.id) || null;
|
|
1162
|
+
c && c.date === t && c.startTime === Y[j] && (c.resourceId === z || !c.resourceId && !z) && (M.classList.add("cal-sched-day__slot--selected"), M.appendChild(be({
|
|
1163
|
+
date: t,
|
|
1164
|
+
startTime: Y[j],
|
|
1165
|
+
endTime: f,
|
|
1166
|
+
resourceName: (E == null ? void 0 : E.name) || null,
|
|
1167
|
+
format: i,
|
|
1168
|
+
onCreate: () => h == null ? void 0 : h(t, Y[j], f, z, E)
|
|
1169
|
+
}))), M.addEventListener("click", () => {
|
|
1170
|
+
p == null || p(t, Y[j], f, z, E);
|
|
1171
|
+
}), _.appendChild(M);
|
|
1172
|
+
}
|
|
1173
|
+
const Z = ye(X);
|
|
1174
|
+
for (const j of Z) {
|
|
1175
|
+
const M = e.find((f) => f.id === j.resourceId) || e[0];
|
|
1176
|
+
_.appendChild(we({
|
|
1177
|
+
event: j,
|
|
1178
|
+
gridStartTime: a,
|
|
1179
|
+
slotHeight: r,
|
|
1180
|
+
interval: l,
|
|
1181
|
+
format: i,
|
|
1182
|
+
onClick: (f) => v == null ? void 0 : v(f, j.resourceId, M),
|
|
1183
|
+
eventContent: o,
|
|
1184
|
+
showTime: k,
|
|
1185
|
+
resource: M,
|
|
1186
|
+
draggable: u
|
|
1187
|
+
}));
|
|
1188
|
+
}
|
|
1189
|
+
P.appendChild(_);
|
|
1190
|
+
}
|
|
1191
|
+
N.appendChild(P);
|
|
1192
|
+
const H = me();
|
|
1193
|
+
if (_e(t, H)) {
|
|
1194
|
+
const _ = Ye(), E = y(_), Z = y(a), j = y(n);
|
|
1195
|
+
if (E >= Z && E <= j) {
|
|
1196
|
+
const M = ie(_, a, r, l), f = document.createElement("div");
|
|
1197
|
+
f.classList.add("cal-sched-now-line"), f.style.top = `${M}px`;
|
|
1198
|
+
const z = document.createElement("div");
|
|
1199
|
+
z.classList.add("cal-sched-now-line__dot"), f.appendChild(z), P.appendChild(f);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return m.appendChild(N), m;
|
|
1203
|
+
}
|
|
1204
|
+
const mt = `
|
|
1205
|
+
.cal-sched-day {
|
|
1206
|
+
display: flex;
|
|
1207
|
+
flex-direction: column;
|
|
1208
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1209
|
+
border-radius: var(--cal-radius);
|
|
1210
|
+
overflow: hidden;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
.cal-sched-day__allday {
|
|
1214
|
+
display: flex;
|
|
1215
|
+
align-items: center;
|
|
1216
|
+
gap: 8px;
|
|
1217
|
+
padding: 6px 12px;
|
|
1218
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1219
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1220
|
+
flex-wrap: wrap;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
.cal-sched-day__allday-label {
|
|
1224
|
+
font-size: 11px;
|
|
1225
|
+
color: hsl(var(--cal-fg-muted));
|
|
1226
|
+
flex-shrink: 0;
|
|
1227
|
+
width: 48px;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.cal-sched-day__allday-chips {
|
|
1231
|
+
display: flex;
|
|
1232
|
+
gap: 4px;
|
|
1233
|
+
flex-wrap: wrap;
|
|
1234
|
+
flex: 1;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.cal-sched-day__header {
|
|
1238
|
+
display: flex;
|
|
1239
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1240
|
+
position: sticky;
|
|
1241
|
+
top: 0;
|
|
1242
|
+
z-index: 3;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
.cal-sched-day__header-spacer {
|
|
1246
|
+
width: 56px;
|
|
1247
|
+
flex-shrink: 0;
|
|
1248
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
.cal-sched-day__grid-area {
|
|
1252
|
+
display: flex;
|
|
1253
|
+
overflow-y: auto;
|
|
1254
|
+
position: relative;
|
|
1255
|
+
padding-top: 8px;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
.cal-sched-day__lanes {
|
|
1259
|
+
display: flex;
|
|
1260
|
+
flex: 1;
|
|
1261
|
+
position: relative;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.cal-sched-day__lane {
|
|
1265
|
+
position: relative;
|
|
1266
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.cal-sched-day__lane:last-child {
|
|
1270
|
+
border-right: none;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
.cal-sched-day__slot {
|
|
1274
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1275
|
+
cursor: pointer;
|
|
1276
|
+
transition: background var(--cal-transition);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
.cal-sched-day__slot:hover {
|
|
1280
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/* Now line */
|
|
1284
|
+
.cal-sched-now-line {
|
|
1285
|
+
position: absolute;
|
|
1286
|
+
left: 0;
|
|
1287
|
+
right: 0;
|
|
1288
|
+
height: 2px;
|
|
1289
|
+
background: hsl(var(--cal-sched-now-line));
|
|
1290
|
+
z-index: 5;
|
|
1291
|
+
pointer-events: none;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
.cal-sched-now-line__dot {
|
|
1295
|
+
position: absolute;
|
|
1296
|
+
left: -4px;
|
|
1297
|
+
top: -3px;
|
|
1298
|
+
width: 8px;
|
|
1299
|
+
height: 8px;
|
|
1300
|
+
border-radius: 50%;
|
|
1301
|
+
background: hsl(var(--cal-sched-now-line));
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
/* Horizontal layout */
|
|
1305
|
+
.cal-sched-day--horizontal .cal-sched-day__grid-area {
|
|
1306
|
+
flex-direction: column;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
.cal-sched-day--horizontal .cal-sched-day__lanes {
|
|
1310
|
+
flex-direction: column;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
.cal-sched-day--horizontal .cal-sched-day__lane {
|
|
1314
|
+
display: flex;
|
|
1315
|
+
border-right: none;
|
|
1316
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
.cal-sched-day--horizontal .cal-sched-day__lane:last-child {
|
|
1320
|
+
border-bottom: none;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
.cal-sched-day--horizontal .cal-sched-day__slot {
|
|
1324
|
+
border-bottom: none;
|
|
1325
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1326
|
+
flex: 0 0 auto;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.cal-sched-day--horizontal .cal-sched-time-axis {
|
|
1330
|
+
flex-direction: row;
|
|
1331
|
+
width: auto;
|
|
1332
|
+
border-right: none;
|
|
1333
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
.cal-sched-day--horizontal .cal-sched-time-axis__slot {
|
|
1337
|
+
border-bottom: none;
|
|
1338
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1339
|
+
align-items: center;
|
|
1340
|
+
justify-content: center;
|
|
1341
|
+
padding: 4px 0;
|
|
1342
|
+
}
|
|
1343
|
+
`, Le = 3, Ce = 5;
|
|
1344
|
+
function ft({
|
|
1345
|
+
date: t,
|
|
1346
|
+
firstDay: e,
|
|
1347
|
+
resources: s,
|
|
1348
|
+
events: a,
|
|
1349
|
+
startTime: n,
|
|
1350
|
+
endTime: l,
|
|
1351
|
+
interval: r,
|
|
1352
|
+
slotHeight: i,
|
|
1353
|
+
format: d,
|
|
1354
|
+
layout: g,
|
|
1355
|
+
resourceMode: c,
|
|
1356
|
+
selectedSlot: o,
|
|
1357
|
+
eventContent: k,
|
|
1358
|
+
showTime: u = !0,
|
|
1359
|
+
draggable: p,
|
|
1360
|
+
allDayCollapsed: v,
|
|
1361
|
+
onToggleAllDay: h,
|
|
1362
|
+
onSlotClick: m,
|
|
1363
|
+
onEventClick: w,
|
|
1364
|
+
onSlotCreate: T
|
|
1365
|
+
}) {
|
|
1366
|
+
const D = document.createElement("div");
|
|
1367
|
+
D.classList.add("cal-sched-week"), g === "horizontal" && D.classList.add("cal-sched-week--horizontal");
|
|
1368
|
+
const F = Te(t, e), X = c === "tabs", Y = s.length > 1 && !X, N = Me(n, l, r), P = me(), H = {};
|
|
1369
|
+
for (const f of F) {
|
|
1370
|
+
const z = ve(a, f).filter((W) => !W.startTime || !W.endTime);
|
|
1371
|
+
z.length && (H[f] = z);
|
|
1372
|
+
}
|
|
1373
|
+
if (Object.keys(H).length > 0) {
|
|
1374
|
+
const f = document.createElement("div");
|
|
1375
|
+
f.classList.add("cal-sched-week__allday"), v && f.classList.add("cal-sched-week__allday--collapsed");
|
|
1376
|
+
const z = document.createElement("div");
|
|
1377
|
+
z.classList.add("cal-sched-week__allday-spacer");
|
|
1378
|
+
const W = document.createElement("span");
|
|
1379
|
+
W.textContent = "All day", z.appendChild(W);
|
|
1380
|
+
const $ = document.createElement("button");
|
|
1381
|
+
$.classList.add("cal-sched-week__allday-toggle"), $.setAttribute("aria-label", v ? "Expand all-day events" : "Collapse all-day events"), $.innerHTML = v ? '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>' : '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>', $.addEventListener("click", (R) => {
|
|
1382
|
+
R.stopPropagation(), h == null || h();
|
|
1383
|
+
}), z.appendChild($), f.appendChild(z);
|
|
1384
|
+
for (const R of F) {
|
|
1385
|
+
const U = document.createElement("div");
|
|
1386
|
+
U.classList.add("cal-sched-week__allday-cell");
|
|
1387
|
+
const I = H[R] || [];
|
|
1388
|
+
if (v) {
|
|
1389
|
+
if (I.length > 0) {
|
|
1390
|
+
const C = document.createElement("div");
|
|
1391
|
+
C.classList.add("cal-sched-week__allday-dots");
|
|
1392
|
+
const A = I.slice(0, Ce);
|
|
1393
|
+
for (const G of A) {
|
|
1394
|
+
const le = document.createElement("span");
|
|
1395
|
+
le.classList.add("cal-sched-week__allday-dot");
|
|
1396
|
+
const ke = G.color || "blue";
|
|
1397
|
+
le.style.background = `hsl(var(--cal-booking-${ke}-fg))`, C.appendChild(le);
|
|
1398
|
+
}
|
|
1399
|
+
if (I.length > Ce) {
|
|
1400
|
+
const G = document.createElement("span");
|
|
1401
|
+
G.classList.add("cal-sched-week__allday-overflow"), G.textContent = `+${I.length - Ce}`, C.appendChild(G);
|
|
1402
|
+
}
|
|
1403
|
+
U.appendChild(C);
|
|
1404
|
+
}
|
|
1405
|
+
} else {
|
|
1406
|
+
const C = I.slice(0, Le);
|
|
1407
|
+
for (const A of C) {
|
|
1408
|
+
const G = s.find((le) => le.id === A.resourceId);
|
|
1409
|
+
U.appendChild(je({
|
|
1410
|
+
event: A,
|
|
1411
|
+
onClick: (le) => w == null ? void 0 : w(le, A.resourceId, G),
|
|
1412
|
+
eventContent: k,
|
|
1413
|
+
resource: G
|
|
1414
|
+
}));
|
|
1415
|
+
}
|
|
1416
|
+
if (I.length > Le) {
|
|
1417
|
+
const A = document.createElement("span");
|
|
1418
|
+
A.classList.add("cal-sched-week__allday-overflow"), A.textContent = `+${I.length - Le}`, U.appendChild(A);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
f.appendChild(U);
|
|
1422
|
+
}
|
|
1423
|
+
D.appendChild(f);
|
|
1424
|
+
}
|
|
1425
|
+
const E = document.createElement("div");
|
|
1426
|
+
E.classList.add("cal-sched-week__header");
|
|
1427
|
+
const Z = document.createElement("div");
|
|
1428
|
+
Z.classList.add("cal-sched-week__header-spacer"), E.appendChild(Z);
|
|
1429
|
+
for (const f of F) {
|
|
1430
|
+
const z = ee(f), W = document.createElement("div");
|
|
1431
|
+
W.classList.add("cal-sched-week__day-header"), _e(f, P) && W.classList.add("cal-sched-week__day-header--today");
|
|
1432
|
+
const $ = document.createElement("span");
|
|
1433
|
+
$.classList.add("cal-sched-week__day-name"), $.textContent = He(f);
|
|
1434
|
+
const R = document.createElement("span");
|
|
1435
|
+
if (R.classList.add("cal-sched-week__day-num"), _e(f, P) && R.classList.add("cal-sched-week__day-num--today"), R.textContent = z ? z.getDate() : "", W.appendChild($), W.appendChild(R), Y) {
|
|
1436
|
+
const U = document.createElement("div");
|
|
1437
|
+
U.classList.add("cal-sched-week__res-row");
|
|
1438
|
+
for (const I of s) {
|
|
1439
|
+
const C = document.createElement("span");
|
|
1440
|
+
C.classList.add("cal-sched-week__res-label");
|
|
1441
|
+
const A = document.createElement("span");
|
|
1442
|
+
A.classList.add("cal-sched-week__res-dot"), A.style.background = `hsl(var(--cal-booking-${I.color || "blue"}-fg))`, C.appendChild(A), C.appendChild(document.createTextNode(I.name)), U.appendChild(C);
|
|
1443
|
+
}
|
|
1444
|
+
W.appendChild(U);
|
|
1445
|
+
}
|
|
1446
|
+
E.appendChild(W);
|
|
1447
|
+
}
|
|
1448
|
+
D.appendChild(E);
|
|
1449
|
+
const j = document.createElement("div");
|
|
1450
|
+
j.classList.add("cal-sched-week__grid-area"), j.appendChild(Ne({ startTime: n, endTime: l, interval: r, slotHeight: i, format: d }));
|
|
1451
|
+
const M = document.createElement("div");
|
|
1452
|
+
M.classList.add("cal-sched-week__cols");
|
|
1453
|
+
for (const f of F) {
|
|
1454
|
+
const z = document.createElement("div");
|
|
1455
|
+
z.classList.add("cal-sched-week__day-col"), z.dataset.date = f, _e(f, P) && z.classList.add("cal-sched-week__day-col--today");
|
|
1456
|
+
const W = ve(a, f).filter(($) => $.startTime && $.endTime);
|
|
1457
|
+
if (Y)
|
|
1458
|
+
for (const $ of s) {
|
|
1459
|
+
const R = document.createElement("div");
|
|
1460
|
+
R.classList.add("cal-sched-week__lane"), R.dataset.resourceId = $.id;
|
|
1461
|
+
for (let C = 0; C < N.length; C++) {
|
|
1462
|
+
const A = document.createElement("div");
|
|
1463
|
+
A.classList.add("cal-sched-week__slot"), A.style.height = `${i}px`, A.dataset.time = N[C];
|
|
1464
|
+
const G = C < N.length - 1 ? N[C + 1] : l;
|
|
1465
|
+
o && o.date === f && o.startTime === N[C] && o.resourceId === $.id && (A.classList.add("cal-sched-week__slot--selected"), A.appendChild(be({
|
|
1466
|
+
date: f,
|
|
1467
|
+
startTime: N[C],
|
|
1468
|
+
endTime: G,
|
|
1469
|
+
resourceName: $.name,
|
|
1470
|
+
format: d,
|
|
1471
|
+
onCreate: () => T == null ? void 0 : T(f, N[C], G, $.id, $)
|
|
1472
|
+
}))), A.addEventListener("click", () => {
|
|
1473
|
+
m == null || m(f, N[C], G, $.id, $);
|
|
1474
|
+
}), R.appendChild(A);
|
|
1475
|
+
}
|
|
1476
|
+
const U = W.filter((C) => C.resourceId === $.id), I = ye(U);
|
|
1477
|
+
for (const C of I)
|
|
1478
|
+
R.appendChild(we({
|
|
1479
|
+
event: C,
|
|
1480
|
+
gridStartTime: n,
|
|
1481
|
+
slotHeight: i,
|
|
1482
|
+
interval: r,
|
|
1483
|
+
format: d,
|
|
1484
|
+
onClick: (A) => w == null ? void 0 : w(A, $.id, $),
|
|
1485
|
+
eventContent: k,
|
|
1486
|
+
showTime: u,
|
|
1487
|
+
resource: $,
|
|
1488
|
+
draggable: p
|
|
1489
|
+
}));
|
|
1490
|
+
z.appendChild(R);
|
|
1491
|
+
}
|
|
1492
|
+
else {
|
|
1493
|
+
const $ = document.createElement("div");
|
|
1494
|
+
$.classList.add("cal-sched-week__lane", "cal-sched-week__lane--full");
|
|
1495
|
+
const R = s.length === 1 ? s[0] : null;
|
|
1496
|
+
R && ($.dataset.resourceId = R.id);
|
|
1497
|
+
for (let I = 0; I < N.length; I++) {
|
|
1498
|
+
const C = document.createElement("div");
|
|
1499
|
+
C.classList.add("cal-sched-week__slot"), C.style.height = `${i}px`, C.dataset.time = N[I];
|
|
1500
|
+
const A = I < N.length - 1 ? N[I + 1] : l, G = (R == null ? void 0 : R.id) || null;
|
|
1501
|
+
o && o.date === f && o.startTime === N[I] && (o.resourceId === G || !o.resourceId && !G) && (C.classList.add("cal-sched-week__slot--selected"), C.appendChild(be({
|
|
1502
|
+
date: f,
|
|
1503
|
+
startTime: N[I],
|
|
1504
|
+
endTime: A,
|
|
1505
|
+
resourceName: (R == null ? void 0 : R.name) || null,
|
|
1506
|
+
format: d,
|
|
1507
|
+
onCreate: () => T == null ? void 0 : T(f, N[I], A, G, R)
|
|
1508
|
+
}))), C.addEventListener("click", () => {
|
|
1509
|
+
m == null || m(f, N[I], A, G, R);
|
|
1510
|
+
}), $.appendChild(C);
|
|
1511
|
+
}
|
|
1512
|
+
const U = ye(W);
|
|
1513
|
+
for (const I of U) {
|
|
1514
|
+
const C = s.find((A) => A.id === I.resourceId) || s[0];
|
|
1515
|
+
$.appendChild(we({
|
|
1516
|
+
event: I,
|
|
1517
|
+
gridStartTime: n,
|
|
1518
|
+
slotHeight: i,
|
|
1519
|
+
interval: r,
|
|
1520
|
+
format: d,
|
|
1521
|
+
onClick: (A) => w == null ? void 0 : w(A, I.resourceId, C),
|
|
1522
|
+
eventContent: k,
|
|
1523
|
+
showTime: u,
|
|
1524
|
+
resource: C,
|
|
1525
|
+
draggable: p
|
|
1526
|
+
}));
|
|
1527
|
+
}
|
|
1528
|
+
z.appendChild($);
|
|
1529
|
+
}
|
|
1530
|
+
M.appendChild(z);
|
|
1531
|
+
}
|
|
1532
|
+
if (F.includes(P)) {
|
|
1533
|
+
const f = Ye(), z = y(f), W = y(n), $ = y(l);
|
|
1534
|
+
if (z >= W && z <= $) {
|
|
1535
|
+
const R = F.indexOf(P), U = ie(f, n, i, r), I = document.createElement("div");
|
|
1536
|
+
I.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), I.style.top = `${U}px`;
|
|
1537
|
+
const C = 100 / 7;
|
|
1538
|
+
I.style.left = `${R * C}%`, I.style.width = `${C}%`;
|
|
1539
|
+
const A = document.createElement("div");
|
|
1540
|
+
A.classList.add("cal-sched-now-line__dot"), I.appendChild(A), M.appendChild(I);
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return j.appendChild(M), D.appendChild(j), D;
|
|
1544
|
+
}
|
|
1545
|
+
const vt = `
|
|
1546
|
+
.cal-sched-week {
|
|
1547
|
+
display: flex;
|
|
1548
|
+
flex-direction: column;
|
|
1549
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1550
|
+
border-radius: var(--cal-radius);
|
|
1551
|
+
overflow: hidden;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
.cal-sched-week__allday {
|
|
1555
|
+
display: flex;
|
|
1556
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1557
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.cal-sched-week__allday-spacer {
|
|
1561
|
+
width: 56px;
|
|
1562
|
+
flex-shrink: 0;
|
|
1563
|
+
font-size: 11px;
|
|
1564
|
+
color: hsl(var(--cal-fg-muted));
|
|
1565
|
+
display: flex;
|
|
1566
|
+
flex-direction: column;
|
|
1567
|
+
align-items: flex-end;
|
|
1568
|
+
justify-content: center;
|
|
1569
|
+
gap: 4px;
|
|
1570
|
+
padding-right: 8px;
|
|
1571
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
.cal-sched-week__allday-toggle {
|
|
1575
|
+
display: flex;
|
|
1576
|
+
align-items: center;
|
|
1577
|
+
justify-content: center;
|
|
1578
|
+
width: 18px;
|
|
1579
|
+
height: 18px;
|
|
1580
|
+
border-radius: var(--cal-radius-sm);
|
|
1581
|
+
background: transparent;
|
|
1582
|
+
color: hsl(var(--cal-fg-muted));
|
|
1583
|
+
cursor: pointer;
|
|
1584
|
+
transition: background var(--cal-transition), color var(--cal-transition);
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
.cal-sched-week__allday-toggle:hover {
|
|
1588
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
1589
|
+
color: hsl(var(--cal-fg));
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
.cal-sched-week__allday-cell {
|
|
1593
|
+
flex: 1;
|
|
1594
|
+
display: flex;
|
|
1595
|
+
gap: 2px;
|
|
1596
|
+
padding: 4px;
|
|
1597
|
+
flex-wrap: wrap;
|
|
1598
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1599
|
+
max-height: 80px;
|
|
1600
|
+
overflow: hidden;
|
|
1601
|
+
align-items: flex-start;
|
|
1602
|
+
align-content: flex-start;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
.cal-sched-week__allday--collapsed .cal-sched-week__allday-cell {
|
|
1606
|
+
max-height: 28px;
|
|
1607
|
+
align-items: center;
|
|
1608
|
+
align-content: center;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
.cal-sched-week__allday-cell:last-child {
|
|
1612
|
+
border-right: none;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.cal-sched-week__allday-overflow {
|
|
1616
|
+
font-size: 10px;
|
|
1617
|
+
color: hsl(var(--cal-fg-muted));
|
|
1618
|
+
padding: 1px 4px;
|
|
1619
|
+
white-space: nowrap;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
.cal-sched-week__allday-dots {
|
|
1623
|
+
display: flex;
|
|
1624
|
+
align-items: center;
|
|
1625
|
+
gap: 3px;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
.cal-sched-week__allday-dot {
|
|
1629
|
+
width: 7px;
|
|
1630
|
+
height: 7px;
|
|
1631
|
+
border-radius: 50%;
|
|
1632
|
+
flex-shrink: 0;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
.cal-sched-week__header {
|
|
1636
|
+
display: flex;
|
|
1637
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1638
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1639
|
+
position: sticky;
|
|
1640
|
+
top: 0;
|
|
1641
|
+
z-index: 3;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
.cal-sched-week__header-spacer {
|
|
1645
|
+
width: 56px;
|
|
1646
|
+
flex-shrink: 0;
|
|
1647
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
.cal-sched-week__day-header {
|
|
1651
|
+
flex: 1;
|
|
1652
|
+
text-align: center;
|
|
1653
|
+
padding: 8px 4px;
|
|
1654
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
.cal-sched-week__day-header:last-child {
|
|
1658
|
+
border-right: none;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.cal-sched-week__day-name {
|
|
1662
|
+
display: block;
|
|
1663
|
+
font-size: 11px;
|
|
1664
|
+
color: hsl(var(--cal-fg-muted));
|
|
1665
|
+
font-weight: 500;
|
|
1666
|
+
text-transform: uppercase;
|
|
1667
|
+
letter-spacing: 0.5px;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
.cal-sched-week__day-num {
|
|
1671
|
+
display: inline-flex;
|
|
1672
|
+
align-items: center;
|
|
1673
|
+
justify-content: center;
|
|
1674
|
+
width: 28px;
|
|
1675
|
+
height: 28px;
|
|
1676
|
+
font-size: 14px;
|
|
1677
|
+
font-weight: 600;
|
|
1678
|
+
color: hsl(var(--cal-fg));
|
|
1679
|
+
border-radius: 50%;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
.cal-sched-week__day-num--today {
|
|
1683
|
+
background: hsl(var(--cal-accent));
|
|
1684
|
+
color: hsl(var(--cal-accent-fg));
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
.cal-sched-week__res-row {
|
|
1688
|
+
display: flex;
|
|
1689
|
+
justify-content: center;
|
|
1690
|
+
gap: 8px;
|
|
1691
|
+
margin-top: 4px;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
.cal-sched-week__res-label {
|
|
1695
|
+
display: flex;
|
|
1696
|
+
align-items: center;
|
|
1697
|
+
gap: 3px;
|
|
1698
|
+
font-size: 10px;
|
|
1699
|
+
color: hsl(var(--cal-fg-muted));
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
.cal-sched-week__res-dot {
|
|
1703
|
+
width: 6px;
|
|
1704
|
+
height: 6px;
|
|
1705
|
+
border-radius: 50%;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
.cal-sched-week__grid-area {
|
|
1709
|
+
display: flex;
|
|
1710
|
+
overflow-y: auto;
|
|
1711
|
+
position: relative;
|
|
1712
|
+
padding-top: 8px;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
.cal-sched-week__cols {
|
|
1716
|
+
display: flex;
|
|
1717
|
+
flex: 1;
|
|
1718
|
+
position: relative;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
.cal-sched-week__day-col {
|
|
1722
|
+
flex: 1;
|
|
1723
|
+
display: flex;
|
|
1724
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1725
|
+
position: relative;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
.cal-sched-week__day-col:last-child {
|
|
1729
|
+
border-right: none;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
.cal-sched-week__lane {
|
|
1733
|
+
flex: 1;
|
|
1734
|
+
position: relative;
|
|
1735
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line) / 0.5);
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
.cal-sched-week__lane:last-child {
|
|
1739
|
+
border-right: none;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
.cal-sched-week__lane--full {
|
|
1743
|
+
border-right: none;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
.cal-sched-week__slot {
|
|
1747
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1748
|
+
cursor: pointer;
|
|
1749
|
+
transition: background var(--cal-transition);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
.cal-sched-week__slot:hover {
|
|
1753
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
.cal-sched-now-line--week {
|
|
1757
|
+
position: absolute;
|
|
1758
|
+
height: 2px;
|
|
1759
|
+
background: hsl(var(--cal-sched-now-line));
|
|
1760
|
+
z-index: 5;
|
|
1761
|
+
pointer-events: none;
|
|
1762
|
+
}
|
|
1763
|
+
`, Ae = 3;
|
|
1764
|
+
function bt({
|
|
1765
|
+
date: t,
|
|
1766
|
+
firstDay: e,
|
|
1767
|
+
resources: s,
|
|
1768
|
+
events: a,
|
|
1769
|
+
format: n,
|
|
1770
|
+
selectedResourceId: l,
|
|
1771
|
+
selectedDate: r,
|
|
1772
|
+
eventContent: i,
|
|
1773
|
+
onSlotClick: d,
|
|
1774
|
+
onEventClick: g,
|
|
1775
|
+
onSlotCreate: c
|
|
1776
|
+
}) {
|
|
1777
|
+
const o = document.createElement("div");
|
|
1778
|
+
o.classList.add("cal-sched-month");
|
|
1779
|
+
const k = ee(t);
|
|
1780
|
+
if (!k) return o;
|
|
1781
|
+
const u = k.getFullYear(), p = k.getMonth();
|
|
1782
|
+
me();
|
|
1783
|
+
const v = document.createElement("div");
|
|
1784
|
+
v.classList.add("cal-sched-month__weekdays");
|
|
1785
|
+
const h = We(e);
|
|
1786
|
+
for (const T of h) {
|
|
1787
|
+
const D = document.createElement("div");
|
|
1788
|
+
D.classList.add("cal-sched-month__weekday"), D.textContent = T, v.appendChild(D);
|
|
1789
|
+
}
|
|
1790
|
+
o.appendChild(v);
|
|
1791
|
+
const m = document.createElement("div");
|
|
1792
|
+
m.classList.add("cal-sched-month__grid");
|
|
1793
|
+
const w = Ue(u, p, e);
|
|
1794
|
+
for (const T of w) {
|
|
1795
|
+
const D = document.createElement("div");
|
|
1796
|
+
D.classList.add("cal-sched-month__cell"), T.isCurrentMonth || D.classList.add("cal-sched-month__cell--outside"), T.isToday && D.classList.add("cal-sched-month__cell--today"), r && T.dateString === r && D.classList.add("cal-sched-month__cell--selected"), D.addEventListener("click", (H) => {
|
|
1797
|
+
H.target.closest(".cal-sched-month-chip") || d == null || d(T.dateString);
|
|
1798
|
+
});
|
|
1799
|
+
const F = document.createElement("div");
|
|
1800
|
+
F.classList.add("cal-sched-month__day-num"), T.isToday && F.classList.add("cal-sched-month__day-num--today"), F.textContent = T.day, D.appendChild(F);
|
|
1801
|
+
let X = ve(a, T.dateString);
|
|
1802
|
+
l && (X = X.filter((H) => H.resourceId === l)), X.sort((H, _) => H.startTime && !_.startTime ? -1 : !H.startTime && _.startTime ? 1 : H.startTime && _.startTime ? H.startTime.localeCompare(_.startTime) : 0);
|
|
1803
|
+
const Y = document.createElement("div");
|
|
1804
|
+
Y.classList.add("cal-sched-month__events");
|
|
1805
|
+
const N = X.slice(0, Ae), P = X.length - Ae;
|
|
1806
|
+
for (const H of N) {
|
|
1807
|
+
const _ = s.find((E) => E.id === H.resourceId);
|
|
1808
|
+
Y.appendChild(ht({
|
|
1809
|
+
event: H,
|
|
1810
|
+
format: n,
|
|
1811
|
+
onClick: (E) => g == null ? void 0 : g(E, H.resourceId, _),
|
|
1812
|
+
eventContent: i,
|
|
1813
|
+
resource: _
|
|
1814
|
+
}));
|
|
1815
|
+
}
|
|
1816
|
+
if (P > 0) {
|
|
1817
|
+
const H = document.createElement("div");
|
|
1818
|
+
H.classList.add("cal-sched-month__more"), H.textContent = `+${P} more`, Y.appendChild(H);
|
|
1819
|
+
}
|
|
1820
|
+
D.appendChild(Y), r && T.dateString === r && (D.style.position = "relative", D.appendChild(be({
|
|
1821
|
+
date: T.dateString,
|
|
1822
|
+
startTime: null,
|
|
1823
|
+
endTime: null,
|
|
1824
|
+
resourceName: null,
|
|
1825
|
+
format: n,
|
|
1826
|
+
onCreate: () => c == null ? void 0 : c(T.dateString)
|
|
1827
|
+
}))), m.appendChild(D);
|
|
1828
|
+
}
|
|
1829
|
+
return o.appendChild(m), o;
|
|
1830
|
+
}
|
|
1831
|
+
const _t = `
|
|
1832
|
+
.cal-sched-month {
|
|
1833
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1834
|
+
border-radius: var(--cal-radius);
|
|
1835
|
+
overflow: hidden;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
.cal-sched-month__weekdays {
|
|
1839
|
+
display: grid;
|
|
1840
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
1841
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1842
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
.cal-sched-month__weekday {
|
|
1846
|
+
font-size: 11px;
|
|
1847
|
+
font-weight: 500;
|
|
1848
|
+
color: hsl(var(--cal-fg-muted));
|
|
1849
|
+
text-align: center;
|
|
1850
|
+
padding: 8px 4px;
|
|
1851
|
+
text-transform: uppercase;
|
|
1852
|
+
letter-spacing: 0.5px;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
.cal-sched-month__grid {
|
|
1856
|
+
display: grid;
|
|
1857
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
.cal-sched-month__cell {
|
|
1861
|
+
min-height: 100px;
|
|
1862
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1863
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1864
|
+
padding: 4px;
|
|
1865
|
+
cursor: pointer;
|
|
1866
|
+
transition: background var(--cal-transition);
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
.cal-sched-month__cell:nth-child(7n) {
|
|
1870
|
+
border-right: none;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
.cal-sched-month__cell:hover {
|
|
1874
|
+
background: hsl(var(--cal-sched-slot-hover));
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
.cal-sched-month__cell--outside {
|
|
1878
|
+
opacity: 0.4;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
.cal-sched-month__day-num {
|
|
1882
|
+
font-size: 13px;
|
|
1883
|
+
font-weight: 500;
|
|
1884
|
+
color: hsl(var(--cal-fg));
|
|
1885
|
+
margin-bottom: 4px;
|
|
1886
|
+
width: 24px;
|
|
1887
|
+
height: 24px;
|
|
1888
|
+
display: flex;
|
|
1889
|
+
align-items: center;
|
|
1890
|
+
justify-content: center;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
.cal-sched-month__day-num--today {
|
|
1894
|
+
background: hsl(var(--cal-accent));
|
|
1895
|
+
color: hsl(var(--cal-accent-fg));
|
|
1896
|
+
border-radius: 50%;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
.cal-sched-month__events {
|
|
1900
|
+
display: flex;
|
|
1901
|
+
flex-direction: column;
|
|
1902
|
+
gap: 2px;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
.cal-sched-month__more {
|
|
1906
|
+
font-size: 11px;
|
|
1907
|
+
color: hsl(var(--cal-fg-muted));
|
|
1908
|
+
padding: 1px 6px;
|
|
1909
|
+
cursor: pointer;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
.cal-sched-month__more:hover {
|
|
1913
|
+
color: hsl(var(--cal-fg));
|
|
1914
|
+
}
|
|
1915
|
+
`;
|
|
1916
|
+
function xt({ columns: t = 3, rows: e = 10, slotHeight: s = 48 } = {}) {
|
|
1917
|
+
const a = document.createElement("div");
|
|
1918
|
+
a.setAttribute("role", "status"), a.setAttribute("aria-label", "Loading..."), a.classList.add("cal-sched-skeleton-grid");
|
|
1919
|
+
const n = document.createElement("div");
|
|
1920
|
+
n.classList.add("cal-sched-skeleton-grid__header");
|
|
1921
|
+
const l = document.createElement("div");
|
|
1922
|
+
l.classList.add("cal-sched-skeleton-grid__spacer"), n.appendChild(l);
|
|
1923
|
+
for (let i = 0; i < t; i++) {
|
|
1924
|
+
const d = document.createElement("div");
|
|
1925
|
+
d.classList.add("cal-skeleton", "cal-sched-skeleton-grid__col-header"), n.appendChild(d);
|
|
1926
|
+
}
|
|
1927
|
+
a.appendChild(n);
|
|
1928
|
+
const r = document.createElement("div");
|
|
1929
|
+
r.classList.add("cal-sched-skeleton-grid__body");
|
|
1930
|
+
for (let i = 0; i < e; i++) {
|
|
1931
|
+
const d = document.createElement("div");
|
|
1932
|
+
d.classList.add("cal-sched-skeleton-grid__row"), d.style.height = `${s}px`;
|
|
1933
|
+
const g = document.createElement("div");
|
|
1934
|
+
g.classList.add("cal-skeleton", "cal-sched-skeleton-grid__time"), d.appendChild(g);
|
|
1935
|
+
for (let c = 0; c < t; c++) {
|
|
1936
|
+
const o = document.createElement("div");
|
|
1937
|
+
if (o.classList.add("cal-sched-skeleton-grid__cell"), Math.random() < 0.15) {
|
|
1938
|
+
const k = document.createElement("div");
|
|
1939
|
+
k.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), k.style.height = `${s * (1 + Math.floor(Math.random() * 2))}px`, o.appendChild(k);
|
|
1940
|
+
}
|
|
1941
|
+
d.appendChild(o);
|
|
1942
|
+
}
|
|
1943
|
+
r.appendChild(d);
|
|
1944
|
+
}
|
|
1945
|
+
return a.appendChild(r), a;
|
|
1946
|
+
}
|
|
1947
|
+
function yt() {
|
|
1948
|
+
const t = document.createElement("div");
|
|
1949
|
+
t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-sched-skeleton-month");
|
|
1950
|
+
const e = document.createElement("div");
|
|
1951
|
+
e.classList.add("cal-sched-skeleton-month__weekdays");
|
|
1952
|
+
for (let a = 0; a < 7; a++) {
|
|
1953
|
+
const n = document.createElement("div");
|
|
1954
|
+
n.classList.add("cal-skeleton", "cal-sched-skeleton-month__weekday"), e.appendChild(n);
|
|
1955
|
+
}
|
|
1956
|
+
t.appendChild(e);
|
|
1957
|
+
const s = document.createElement("div");
|
|
1958
|
+
s.classList.add("cal-sched-skeleton-month__grid");
|
|
1959
|
+
for (let a = 0; a < 35; a++) {
|
|
1960
|
+
const n = document.createElement("div");
|
|
1961
|
+
n.classList.add("cal-sched-skeleton-month__cell");
|
|
1962
|
+
const l = document.createElement("div");
|
|
1963
|
+
l.classList.add("cal-skeleton", "cal-sched-skeleton-month__num"), n.appendChild(l);
|
|
1964
|
+
const r = Math.floor(Math.random() * 3);
|
|
1965
|
+
for (let i = 0; i < r; i++) {
|
|
1966
|
+
const d = document.createElement("div");
|
|
1967
|
+
d.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-month__chip"), n.appendChild(d);
|
|
1968
|
+
}
|
|
1969
|
+
s.appendChild(n);
|
|
1970
|
+
}
|
|
1971
|
+
return t.appendChild(s), t;
|
|
1972
|
+
}
|
|
1973
|
+
const wt = `
|
|
1974
|
+
.cal-sched-skeleton-grid {
|
|
1975
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1976
|
+
border-radius: var(--cal-radius);
|
|
1977
|
+
overflow: hidden;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
.cal-sched-skeleton-grid__header {
|
|
1981
|
+
display: flex;
|
|
1982
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
1983
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1984
|
+
padding: 12px 0;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
.cal-sched-skeleton-grid__spacer {
|
|
1988
|
+
width: 56px;
|
|
1989
|
+
flex-shrink: 0;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
.cal-sched-skeleton-grid__col-header {
|
|
1993
|
+
flex: 1;
|
|
1994
|
+
height: 20px;
|
|
1995
|
+
margin: 0 12px;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
.cal-sched-skeleton-grid__body {
|
|
1999
|
+
display: flex;
|
|
2000
|
+
flex-direction: column;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
.cal-sched-skeleton-grid__row {
|
|
2004
|
+
display: flex;
|
|
2005
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
.cal-sched-skeleton-grid__time {
|
|
2009
|
+
width: 36px;
|
|
2010
|
+
height: 12px;
|
|
2011
|
+
margin: 4px 10px;
|
|
2012
|
+
flex-shrink: 0;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
.cal-sched-skeleton-grid__cell {
|
|
2016
|
+
flex: 1;
|
|
2017
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2018
|
+
position: relative;
|
|
2019
|
+
padding: 2px;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.cal-sched-skeleton-grid__cell:last-child {
|
|
2023
|
+
border-right: none;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
.cal-sched-skeleton-grid__event {
|
|
2027
|
+
width: 80%;
|
|
2028
|
+
min-height: 24px;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
.cal-sched-skeleton-month {
|
|
2032
|
+
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2033
|
+
border-radius: var(--cal-radius);
|
|
2034
|
+
overflow: hidden;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
.cal-sched-skeleton-month__weekdays {
|
|
2038
|
+
display: grid;
|
|
2039
|
+
grid-template-columns: repeat(7, 1fr);
|
|
2040
|
+
gap: 8px;
|
|
2041
|
+
padding: 12px;
|
|
2042
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
2043
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
.cal-sched-skeleton-month__weekday {
|
|
2047
|
+
height: 14px;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
.cal-sched-skeleton-month__grid {
|
|
2051
|
+
display: grid;
|
|
2052
|
+
grid-template-columns: repeat(7, 1fr);
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
.cal-sched-skeleton-month__cell {
|
|
2056
|
+
min-height: 80px;
|
|
2057
|
+
border-right: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2058
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2059
|
+
padding: 6px;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
.cal-sched-skeleton-month__cell:nth-child(7n) {
|
|
2063
|
+
border-right: none;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
.cal-sched-skeleton-month__num {
|
|
2067
|
+
width: 20px;
|
|
2068
|
+
height: 14px;
|
|
2069
|
+
margin-bottom: 6px;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
.cal-sched-skeleton-month__chip {
|
|
2073
|
+
height: 16px;
|
|
2074
|
+
margin-bottom: 2px;
|
|
2075
|
+
width: 85%;
|
|
2076
|
+
}
|
|
2077
|
+
`, Pe = {
|
|
2078
|
+
error: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',
|
|
2079
|
+
warning: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',
|
|
2080
|
+
info: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',
|
|
2081
|
+
success: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'
|
|
2082
|
+
};
|
|
2083
|
+
function kt({ type: t = "info", message: e, dismissible: s = !0, onDismiss: a }) {
|
|
2084
|
+
const n = document.createElement("div");
|
|
2085
|
+
n.classList.add("cal-status", `cal-status--${t}`, "cal-animate-slide-up"), n.setAttribute("role", t === "error" ? "alert" : "status"), n.setAttribute("aria-live", t === "error" ? "assertive" : "polite");
|
|
2086
|
+
const l = document.createElement("span");
|
|
2087
|
+
l.classList.add("cal-status__icon"), l.innerHTML = Pe[t] || Pe.info, n.appendChild(l);
|
|
2088
|
+
const r = document.createElement("span");
|
|
2089
|
+
if (r.classList.add("cal-status__text"), r.textContent = e, n.appendChild(r), s) {
|
|
2090
|
+
const i = document.createElement("button");
|
|
2091
|
+
i.classList.add("cal-status__close"), i.setAttribute("aria-label", "Dismiss"), i.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 3l6 6M9 3l-6 6"/></svg>', i.addEventListener("click", () => a == null ? void 0 : a()), n.appendChild(i);
|
|
2092
|
+
}
|
|
2093
|
+
return n;
|
|
2094
|
+
}
|
|
2095
|
+
const Et = `
|
|
2096
|
+
.cal-status {
|
|
2097
|
+
display: flex;
|
|
2098
|
+
align-items: center;
|
|
2099
|
+
gap: 8px;
|
|
2100
|
+
padding: 8px 12px;
|
|
2101
|
+
border-radius: var(--cal-radius-sm);
|
|
2102
|
+
font-size: 12px;
|
|
2103
|
+
line-height: 1.4;
|
|
2104
|
+
margin-bottom: 8px;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
.cal-status__icon {
|
|
2108
|
+
flex-shrink: 0;
|
|
2109
|
+
display: flex;
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
.cal-status__text {
|
|
2113
|
+
flex: 1;
|
|
2114
|
+
min-width: 0;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
.cal-status__close {
|
|
2118
|
+
flex-shrink: 0;
|
|
2119
|
+
display: flex;
|
|
2120
|
+
align-items: center;
|
|
2121
|
+
justify-content: center;
|
|
2122
|
+
width: 20px;
|
|
2123
|
+
height: 20px;
|
|
2124
|
+
border-radius: 4px;
|
|
2125
|
+
cursor: pointer;
|
|
2126
|
+
opacity: 0.7;
|
|
2127
|
+
transition: opacity var(--cal-transition);
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
.cal-status__close:hover {
|
|
2131
|
+
opacity: 1;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
.cal-status--error {
|
|
2135
|
+
background: hsl(var(--cal-status-error-bg));
|
|
2136
|
+
color: hsl(var(--cal-status-error-fg));
|
|
2137
|
+
border: 1px solid hsl(var(--cal-status-error-border));
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
.cal-status--warning {
|
|
2141
|
+
background: hsl(var(--cal-status-warning-bg));
|
|
2142
|
+
color: hsl(var(--cal-status-warning-fg));
|
|
2143
|
+
border: 1px solid hsl(var(--cal-status-warning-border));
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
.cal-status--info {
|
|
2147
|
+
background: hsl(var(--cal-status-info-bg));
|
|
2148
|
+
color: hsl(var(--cal-status-info-fg));
|
|
2149
|
+
border: 1px solid hsl(var(--cal-status-info-border));
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
.cal-status--success {
|
|
2153
|
+
background: hsl(var(--cal-status-success-bg));
|
|
2154
|
+
color: hsl(var(--cal-status-success-fg));
|
|
2155
|
+
border: 1px solid hsl(var(--cal-status-success-border));
|
|
2156
|
+
}
|
|
2157
|
+
`;
|
|
2158
|
+
function Lt({ event: t, resource: e, format: s, onClose: a, actions: n, onAction: l }) {
|
|
2159
|
+
const r = document.createElement("div");
|
|
2160
|
+
r.classList.add("cal-sched-detail-backdrop"), r.addEventListener("click", a);
|
|
2161
|
+
const i = document.createElement("div");
|
|
2162
|
+
i.classList.add("cal-sched-detail", "cal-animate-fade"), i.addEventListener("click", (u) => u.stopPropagation());
|
|
2163
|
+
const d = document.createElement("button");
|
|
2164
|
+
d.classList.add("cal-sched-detail__close"), d.setAttribute("aria-label", "Close"), d.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 4l6 6M10 4l-6 6"/></svg>', d.addEventListener("click", a), i.appendChild(d);
|
|
2165
|
+
const g = t.color || "blue", c = document.createElement("div");
|
|
2166
|
+
c.classList.add("cal-sched-detail__accent"), c.style.background = `hsl(var(--cal-booking-${g}-fg))`, i.appendChild(c);
|
|
2167
|
+
const o = document.createElement("div");
|
|
2168
|
+
if (o.classList.add("cal-sched-detail__title"), o.textContent = t.title || "Untitled", i.appendChild(o), t.startTime && t.endTime) {
|
|
2169
|
+
const u = document.createElement("div");
|
|
2170
|
+
u.classList.add("cal-sched-detail__row");
|
|
2171
|
+
const p = document.createElement("span");
|
|
2172
|
+
p.classList.add("cal-sched-detail__icon"), p.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>', u.appendChild(p);
|
|
2173
|
+
const v = he(t.startTime), h = he(t.endTime), m = document.createElement("span");
|
|
2174
|
+
v && h && (m.textContent = `${ge(v.hours, v.minutes, s)}–${ge(h.hours, h.minutes, s)}`), u.appendChild(m), i.appendChild(u);
|
|
2175
|
+
}
|
|
2176
|
+
if (t.start) {
|
|
2177
|
+
const u = document.createElement("div");
|
|
2178
|
+
u.classList.add("cal-sched-detail__row");
|
|
2179
|
+
const p = document.createElement("span");
|
|
2180
|
+
p.classList.add("cal-sched-detail__icon"), p.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>', u.appendChild(p);
|
|
2181
|
+
const v = ee(t.start), h = document.createElement("span");
|
|
2182
|
+
if (v) {
|
|
2183
|
+
let m = `${He(t.start, "long")}, ${oe[v.getMonth()]} ${v.getDate()}`;
|
|
2184
|
+
if (t.end && t.end !== t.start) {
|
|
2185
|
+
const w = ee(t.end);
|
|
2186
|
+
w && (m += ` – ${oe[w.getMonth()]} ${w.getDate()}`);
|
|
2187
|
+
}
|
|
2188
|
+
h.textContent = m;
|
|
2189
|
+
}
|
|
2190
|
+
u.appendChild(h), i.appendChild(u);
|
|
2191
|
+
}
|
|
2192
|
+
if (e && e.name) {
|
|
2193
|
+
const u = document.createElement("div");
|
|
2194
|
+
u.classList.add("cal-sched-detail__row");
|
|
2195
|
+
const p = document.createElement("span");
|
|
2196
|
+
p.classList.add("cal-sched-detail__res-dot"), p.style.background = `hsl(var(--cal-booking-${e.color || "blue"}-fg))`, u.appendChild(p);
|
|
2197
|
+
const v = document.createElement("span");
|
|
2198
|
+
v.textContent = e.name, e.capacity && (v.textContent += ` (capacity: ${e.capacity})`), u.appendChild(v), i.appendChild(u);
|
|
2199
|
+
}
|
|
2200
|
+
if (t.metadata && typeof t.metadata == "object") {
|
|
2201
|
+
const u = Object.entries(t.metadata);
|
|
2202
|
+
if (u.length > 0) {
|
|
2203
|
+
const p = document.createElement("div");
|
|
2204
|
+
p.classList.add("cal-sched-detail__meta");
|
|
2205
|
+
for (const [v, h] of u) {
|
|
2206
|
+
const m = document.createElement("div");
|
|
2207
|
+
m.classList.add("cal-sched-detail__meta-row");
|
|
2208
|
+
const w = document.createElement("span");
|
|
2209
|
+
w.classList.add("cal-sched-detail__meta-label"), w.textContent = v;
|
|
2210
|
+
const T = document.createElement("span");
|
|
2211
|
+
T.textContent = String(h), m.appendChild(w), m.appendChild(T), p.appendChild(m);
|
|
2212
|
+
}
|
|
2213
|
+
i.appendChild(p);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
if (n && n.length > 0) {
|
|
2217
|
+
const u = document.createElement("div");
|
|
2218
|
+
u.classList.add("cal-sched-detail__actions");
|
|
2219
|
+
for (const p of n) {
|
|
2220
|
+
const v = document.createElement("button");
|
|
2221
|
+
v.classList.add("cal-sched-detail__action"), p.type === "danger" && v.classList.add("cal-sched-detail__action--danger"), v.textContent = p.label, v.addEventListener("click", () => {
|
|
2222
|
+
l == null || l(p.label);
|
|
2223
|
+
}), u.appendChild(v);
|
|
2224
|
+
}
|
|
2225
|
+
i.appendChild(u);
|
|
2226
|
+
}
|
|
2227
|
+
r.appendChild(i);
|
|
2228
|
+
const k = (u) => {
|
|
2229
|
+
u.key === "Escape" && a();
|
|
2230
|
+
};
|
|
2231
|
+
return r.addEventListener("keydown", k), requestAnimationFrame(() => d.focus()), r;
|
|
2232
|
+
}
|
|
2233
|
+
const Ct = `
|
|
2234
|
+
.cal-sched-detail-backdrop {
|
|
2235
|
+
position: absolute;
|
|
2236
|
+
inset: 0;
|
|
2237
|
+
z-index: 20;
|
|
2238
|
+
display: flex;
|
|
2239
|
+
align-items: flex-start;
|
|
2240
|
+
justify-content: center;
|
|
2241
|
+
padding-top: 80px;
|
|
2242
|
+
background: rgba(0, 0, 0, 0.06);
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
.cal-sched-detail {
|
|
2246
|
+
position: relative;
|
|
2247
|
+
background: hsl(var(--cal-bg));
|
|
2248
|
+
border: 1px solid hsl(var(--cal-border));
|
|
2249
|
+
border-radius: var(--cal-radius);
|
|
2250
|
+
box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.12), 0 2px 8px -2px rgba(0, 0, 0, 0.06);
|
|
2251
|
+
padding: 16px 20px;
|
|
2252
|
+
min-width: 260px;
|
|
2253
|
+
max-width: 340px;
|
|
2254
|
+
font-size: 13px;
|
|
2255
|
+
color: hsl(var(--cal-fg));
|
|
2256
|
+
user-select: text;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
.cal-sched-detail__close {
|
|
2260
|
+
position: absolute;
|
|
2261
|
+
top: 10px;
|
|
2262
|
+
right: 10px;
|
|
2263
|
+
display: flex;
|
|
2264
|
+
align-items: center;
|
|
2265
|
+
justify-content: center;
|
|
2266
|
+
width: 24px;
|
|
2267
|
+
height: 24px;
|
|
2268
|
+
border-radius: var(--cal-radius-sm);
|
|
2269
|
+
color: hsl(var(--cal-fg-muted));
|
|
2270
|
+
transition: background var(--cal-transition), color var(--cal-transition);
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
.cal-sched-detail__close:hover {
|
|
2274
|
+
background: hsl(var(--cal-hover));
|
|
2275
|
+
color: hsl(var(--cal-fg));
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
.cal-sched-detail__accent {
|
|
2279
|
+
width: 32px;
|
|
2280
|
+
height: 4px;
|
|
2281
|
+
border-radius: 2px;
|
|
2282
|
+
margin-bottom: 10px;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
.cal-sched-detail__title {
|
|
2286
|
+
font-size: 15px;
|
|
2287
|
+
font-weight: 600;
|
|
2288
|
+
margin-bottom: 12px;
|
|
2289
|
+
padding-right: 24px;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
.cal-sched-detail__row {
|
|
2293
|
+
display: flex;
|
|
2294
|
+
align-items: center;
|
|
2295
|
+
gap: 8px;
|
|
2296
|
+
padding: 4px 0;
|
|
2297
|
+
color: hsl(var(--cal-fg-muted));
|
|
2298
|
+
font-size: 13px;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
.cal-sched-detail__icon {
|
|
2302
|
+
display: flex;
|
|
2303
|
+
flex-shrink: 0;
|
|
2304
|
+
color: hsl(var(--cal-fg-muted));
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
.cal-sched-detail__res-dot {
|
|
2308
|
+
width: 8px;
|
|
2309
|
+
height: 8px;
|
|
2310
|
+
border-radius: 50%;
|
|
2311
|
+
flex-shrink: 0;
|
|
2312
|
+
margin-left: 3px;
|
|
2313
|
+
margin-right: 3px;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
.cal-sched-detail__meta {
|
|
2317
|
+
margin-top: 10px;
|
|
2318
|
+
padding-top: 10px;
|
|
2319
|
+
border-top: 1px solid hsl(var(--cal-border));
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
.cal-sched-detail__meta-row {
|
|
2323
|
+
display: flex;
|
|
2324
|
+
justify-content: space-between;
|
|
2325
|
+
padding: 2px 0;
|
|
2326
|
+
font-size: 12px;
|
|
2327
|
+
color: hsl(var(--cal-fg-muted));
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
.cal-sched-detail__meta-label {
|
|
2331
|
+
font-weight: 500;
|
|
2332
|
+
text-transform: capitalize;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
.cal-sched-detail__actions {
|
|
2336
|
+
display: flex;
|
|
2337
|
+
gap: 6px;
|
|
2338
|
+
margin-top: 14px;
|
|
2339
|
+
padding-top: 12px;
|
|
2340
|
+
border-top: 1px solid hsl(var(--cal-border));
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
.cal-sched-detail__action {
|
|
2344
|
+
flex: 1;
|
|
2345
|
+
display: flex;
|
|
2346
|
+
align-items: center;
|
|
2347
|
+
justify-content: center;
|
|
2348
|
+
padding: 6px 12px;
|
|
2349
|
+
font-size: 12px;
|
|
2350
|
+
font-weight: 500;
|
|
2351
|
+
border-radius: var(--cal-radius-sm);
|
|
2352
|
+
border: 1px solid hsl(var(--cal-border));
|
|
2353
|
+
color: hsl(var(--cal-fg));
|
|
2354
|
+
background: hsl(var(--cal-bg));
|
|
2355
|
+
transition: background var(--cal-transition);
|
|
2356
|
+
cursor: pointer;
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
.cal-sched-detail__action:hover {
|
|
2360
|
+
background: hsl(var(--cal-hover));
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
.cal-sched-detail__action--danger {
|
|
2364
|
+
color: hsl(var(--cal-status-error-fg));
|
|
2365
|
+
border-color: hsl(var(--cal-status-error-border));
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
.cal-sched-detail__action--danger:hover {
|
|
2369
|
+
background: hsl(var(--cal-status-error-bg));
|
|
2370
|
+
}
|
|
2371
|
+
`;
|
|
2372
|
+
function Tt({ resources: t, selectedResourceId: e, onResourceFilter: s }) {
|
|
2373
|
+
const a = document.createElement("div");
|
|
2374
|
+
a.classList.add("cal-sched-res-tabs");
|
|
2375
|
+
const n = document.createElement("button");
|
|
2376
|
+
n.classList.add("cal-sched-res-tabs__tab"), e || n.classList.add("cal-sched-res-tabs__tab--active"), n.textContent = "All", n.addEventListener("click", () => s == null ? void 0 : s(null)), a.appendChild(n);
|
|
2377
|
+
for (const l of t) {
|
|
2378
|
+
const r = document.createElement("button");
|
|
2379
|
+
r.classList.add("cal-sched-res-tabs__tab"), e === l.id && r.classList.add("cal-sched-res-tabs__tab--active");
|
|
2380
|
+
const i = document.createElement("span");
|
|
2381
|
+
i.classList.add("cal-sched-res-tabs__dot"), i.style.background = `hsl(var(--cal-booking-${l.color || "blue"}-fg))`, r.appendChild(i), r.appendChild(document.createTextNode(l.name)), r.addEventListener("click", () => s == null ? void 0 : s(l.id)), a.appendChild(r);
|
|
2382
|
+
}
|
|
2383
|
+
return a;
|
|
2384
|
+
}
|
|
2385
|
+
const Mt = `
|
|
2386
|
+
.cal-sched-res-tabs {
|
|
2387
|
+
display: flex;
|
|
2388
|
+
gap: 4px;
|
|
2389
|
+
padding: 8px 12px;
|
|
2390
|
+
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
2391
|
+
background: hsl(var(--cal-sched-header-bg));
|
|
2392
|
+
flex-wrap: wrap;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
.cal-sched-res-tabs__tab {
|
|
2396
|
+
display: flex;
|
|
2397
|
+
align-items: center;
|
|
2398
|
+
gap: 4px;
|
|
2399
|
+
font-size: 12px;
|
|
2400
|
+
font-weight: 500;
|
|
2401
|
+
color: hsl(var(--cal-fg-muted));
|
|
2402
|
+
padding: 4px 10px;
|
|
2403
|
+
border-radius: var(--cal-radius-sm);
|
|
2404
|
+
border: 1px solid hsl(var(--cal-border));
|
|
2405
|
+
transition: all var(--cal-transition);
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
.cal-sched-res-tabs__tab:hover {
|
|
2409
|
+
background: hsl(var(--cal-hover));
|
|
2410
|
+
color: hsl(var(--cal-fg));
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
.cal-sched-res-tabs__tab--active {
|
|
2414
|
+
background: hsl(var(--cal-accent));
|
|
2415
|
+
color: hsl(var(--cal-accent-fg));
|
|
2416
|
+
border-color: hsl(var(--cal-accent));
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
.cal-sched-res-tabs__tab--active:hover {
|
|
2420
|
+
background: hsl(var(--cal-accent));
|
|
2421
|
+
color: hsl(var(--cal-accent-fg));
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
.cal-sched-res-tabs__dot {
|
|
2425
|
+
width: 6px;
|
|
2426
|
+
height: 6px;
|
|
2427
|
+
border-radius: 50%;
|
|
2428
|
+
}
|
|
2429
|
+
`;
|
|
2430
|
+
function St({ onClick: t }) {
|
|
2431
|
+
const e = document.createElement("button");
|
|
2432
|
+
return e.classList.add("cal-sched-fab"), e.setAttribute("aria-label", "Create event"), e.innerHTML = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10 4v12M4 10h12"/></svg>', e.addEventListener("click", (s) => {
|
|
2433
|
+
s.stopPropagation(), t == null || t();
|
|
2434
|
+
}), e;
|
|
2435
|
+
}
|
|
2436
|
+
const Dt = `
|
|
2437
|
+
.cal-sched-fab {
|
|
2438
|
+
position: absolute;
|
|
2439
|
+
bottom: 16px;
|
|
2440
|
+
right: 16px;
|
|
2441
|
+
width: 48px;
|
|
2442
|
+
height: 48px;
|
|
2443
|
+
border-radius: 50%;
|
|
2444
|
+
background: hsl(var(--cal-accent));
|
|
2445
|
+
color: hsl(var(--cal-accent-fg));
|
|
2446
|
+
display: flex;
|
|
2447
|
+
align-items: center;
|
|
2448
|
+
justify-content: center;
|
|
2449
|
+
box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
|
|
2450
|
+
cursor: pointer;
|
|
2451
|
+
z-index: 8;
|
|
2452
|
+
transition: transform var(--cal-transition), box-shadow var(--cal-transition);
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
.cal-sched-fab:hover {
|
|
2456
|
+
transform: scale(1.08);
|
|
2457
|
+
box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.25), 0 3px 6px -1px rgba(0, 0, 0, 0.12);
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
.cal-sched-fab:active {
|
|
2461
|
+
transform: scale(0.96);
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
.cal-sched-fab:focus-visible {
|
|
2465
|
+
outline: 2px solid hsl(var(--cal-ring));
|
|
2466
|
+
outline-offset: 2px;
|
|
2467
|
+
}
|
|
2468
|
+
`, $t = 4;
|
|
2469
|
+
function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove: n, onResize: l, onCreate: r }) {
|
|
2470
|
+
let i = !1, d = null, g = null, c = null, o = null, k = 0, u = 0, p = 0, v = 0, h = !1, m = null, w = null, T = null, D = null, F = null, X = null, Y = null, N = null, P = null, H = null, _ = null, E = null, Z = 0;
|
|
2471
|
+
function j(b) {
|
|
2472
|
+
if (!i || b.button !== 0) return;
|
|
2473
|
+
const L = b.target.closest(".cal-sched-event__resize-handle"), S = b.target.closest('.cal-sched-event[data-draggable="true"]');
|
|
2474
|
+
if (S) {
|
|
2475
|
+
const q = S.dataset.eventId;
|
|
2476
|
+
if (g = a().find((B) => B.id === q), !g) return;
|
|
2477
|
+
b.preventDefault(), b.stopPropagation(), N = S, Y = b.pointerId, S.setPointerCapture(b.pointerId), p = b.clientX, v = b.clientY, h = !1, w = g.startTime, m = g.endTime, T = g.start, D = g.resourceId, L ? (d = "resize", o = S, o.classList.add("cal-sched-event--resizing")) : (d = "move", o = S);
|
|
2478
|
+
} else {
|
|
2479
|
+
const q = b.target.closest("[data-time]");
|
|
2480
|
+
if (!q || b.target.closest(".cal-sched-slot-prompt")) return;
|
|
2481
|
+
const x = z(b.clientX, b.clientY);
|
|
2482
|
+
if (!x) return;
|
|
2483
|
+
b.preventDefault(), d = "create", p = b.clientX, v = b.clientY, h = !1, H = x.date, _ = x.resourceId, E = x.time;
|
|
2484
|
+
const B = t.querySelectorAll("[data-time]");
|
|
2485
|
+
B.length > 0 && (Z = B[0].getBoundingClientRect().top), N = q, Y = b.pointerId, q.setPointerCapture(b.pointerId);
|
|
2486
|
+
}
|
|
2487
|
+
t.addEventListener("pointermove", M), t.addEventListener("pointerup", f);
|
|
2488
|
+
}
|
|
2489
|
+
function M(b) {
|
|
2490
|
+
if (!d) return;
|
|
2491
|
+
const L = b.clientX - p, S = b.clientY - v, q = Math.sqrt(L * L + S * S);
|
|
2492
|
+
if (!(!h && q < $t)) {
|
|
2493
|
+
if (h = !0, d === "move") {
|
|
2494
|
+
if (!c && o) {
|
|
2495
|
+
const B = o.getBoundingClientRect();
|
|
2496
|
+
k = p - B.left, u = v - B.top, c = o.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
|
|
2497
|
+
position: fixed;
|
|
2498
|
+
width: ${B.width}px;
|
|
2499
|
+
height: ${B.height}px;
|
|
2500
|
+
left: ${B.left}px;
|
|
2501
|
+
top: ${B.top}px;
|
|
2502
|
+
z-index: 1000;
|
|
2503
|
+
pointer-events: none;
|
|
2504
|
+
opacity: 0.85;
|
|
2505
|
+
box-shadow: 0 8px 24px -4px rgba(0,0,0,0.2);
|
|
2506
|
+
background: hsl(var(--ev-bg));
|
|
2507
|
+
color: hsl(var(--ev-fg));
|
|
2508
|
+
border-left: 3px solid hsl(var(--ev-fg));
|
|
2509
|
+
border-radius: var(--cal-radius-sm);
|
|
2510
|
+
padding: 2px 6px;
|
|
2511
|
+
font-size: 12px;
|
|
2512
|
+
line-height: 1.3;
|
|
2513
|
+
overflow: hidden;
|
|
2514
|
+
`, c.style.setProperty("--ev-bg", o.style.getPropertyValue("--ev-bg")), c.style.setProperty("--ev-fg", o.style.getPropertyValue("--ev-fg")), t.appendChild(c), o.classList.add("cal-sched-event--dragging");
|
|
2515
|
+
}
|
|
2516
|
+
c && (c.style.left = `${b.clientX - k}px`, c.style.top = `${b.clientY - u}px`);
|
|
2517
|
+
const x = z(b.clientX, b.clientY);
|
|
2518
|
+
x ? W(x) : $();
|
|
2519
|
+
} else if (d === "resize") {
|
|
2520
|
+
const x = e(), B = x.snapInterval || x.interval, Q = x.slotHeight * (B / x.interval), ae = b.clientY - v, O = Math.round(ae / Q) * B, ue = y(m), re = y(w);
|
|
2521
|
+
let K = ue + O;
|
|
2522
|
+
const te = x.minDuration || B, se = re + te;
|
|
2523
|
+
if (K < se && (K = se), x.maxDuration) {
|
|
2524
|
+
const de = re + x.maxDuration;
|
|
2525
|
+
K > de && (K = de);
|
|
2526
|
+
}
|
|
2527
|
+
const V = y(x.endTime);
|
|
2528
|
+
K > V && (K = V);
|
|
2529
|
+
const ne = ce(K);
|
|
2530
|
+
if (o) {
|
|
2531
|
+
const de = ie(w, x.startTime, x.slotHeight, x.interval), Ee = ie(ne, x.startTime, x.slotHeight, x.interval);
|
|
2532
|
+
o.style.height = `${Math.max(Ee - de, x.slotHeight * 0.5)}px`;
|
|
2533
|
+
}
|
|
2534
|
+
U(b.clientX, b.clientY, ne, x.format);
|
|
2535
|
+
} else if (d === "create") {
|
|
2536
|
+
const x = e(), B = x.snapInterval || x.interval, Q = b.clientY - Z, ae = Ie(Math.max(0, Q), x.startTime, x.slotHeight, x.interval), J = ze(ae, B), O = y(J), ue = y(E), re = y(x.endTime), K = x.minDuration || B;
|
|
2537
|
+
let te = Math.max(O, ue + K);
|
|
2538
|
+
if (x.maxDuration) {
|
|
2539
|
+
const V = ue + x.maxDuration;
|
|
2540
|
+
te > V && (te = V);
|
|
2541
|
+
}
|
|
2542
|
+
te > re && (te = re);
|
|
2543
|
+
const se = ce(te);
|
|
2544
|
+
if (!P) {
|
|
2545
|
+
P = document.createElement("div"), P.classList.add("cal-sched-create-preview");
|
|
2546
|
+
let V = null;
|
|
2547
|
+
_ && (V = t.querySelector(`[data-resource-id="${_}"][data-date="${H}"]`), V || (V = t.querySelector(`[data-date="${H}"] [data-resource-id="${_}"]`))), V || (V = t.querySelector(`[data-date="${H}"] .cal-sched-week__lane`) || t.querySelector(`[data-date="${H}"] .cal-sched-day__lane`) || t.querySelector(`[data-date="${H}"]`)), V && V.appendChild(P);
|
|
2548
|
+
}
|
|
2549
|
+
if (P) {
|
|
2550
|
+
const V = e(), ne = ie(E, V.startTime, V.slotHeight, V.interval), de = ie(se, V.startTime, V.slotHeight, V.interval);
|
|
2551
|
+
P.style.top = `${ne}px`, P.style.height = `${Math.max(de - ne, V.slotHeight * 0.5)}px`, P.dataset.endTime = se;
|
|
2552
|
+
}
|
|
2553
|
+
U(b.clientX, b.clientY, se, x.format);
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
function f(b) {
|
|
2558
|
+
if (d) {
|
|
2559
|
+
if (t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", f), N && Y != null) {
|
|
2560
|
+
try {
|
|
2561
|
+
N.releasePointerCapture(Y);
|
|
2562
|
+
} catch {
|
|
2563
|
+
}
|
|
2564
|
+
N = null, Y = null;
|
|
2565
|
+
}
|
|
2566
|
+
if (d === "move") {
|
|
2567
|
+
if ($(), c && (c.remove(), c = null), o && o.classList.remove("cal-sched-event--dragging"), h) {
|
|
2568
|
+
o && (o.dataset.wasDragged = "true");
|
|
2569
|
+
const L = z(b.clientX, b.clientY);
|
|
2570
|
+
if (L && g) {
|
|
2571
|
+
const S = e(), q = y(m) - y(w), x = L.time, B = y(x), Q = Math.min(B + q, y(S.endTime)), ae = ce(Q), J = {
|
|
2572
|
+
date: T,
|
|
2573
|
+
startTime: w,
|
|
2574
|
+
endTime: m,
|
|
2575
|
+
resourceId: D
|
|
2576
|
+
}, O = {
|
|
2577
|
+
date: L.date,
|
|
2578
|
+
startTime: x,
|
|
2579
|
+
endTime: ae,
|
|
2580
|
+
resourceId: L.resourceId || D
|
|
2581
|
+
};
|
|
2582
|
+
(J.date !== O.date || J.startTime !== O.startTime || J.resourceId !== O.resourceId) && (n == null || n({ event: g, from: J, to: O }));
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
} else if (d === "resize") {
|
|
2586
|
+
if (h) {
|
|
2587
|
+
const L = e(), S = L.snapInterval || L.interval, q = L.slotHeight * (S / L.interval), x = b.clientY - v, Q = Math.round(x / q) * S, ae = y(m), J = y(w);
|
|
2588
|
+
let O = ae + Q;
|
|
2589
|
+
const ue = L.minDuration || S, re = J + ue;
|
|
2590
|
+
if (O < re && (O = re), L.maxDuration) {
|
|
2591
|
+
const se = J + L.maxDuration;
|
|
2592
|
+
O > se && (O = se);
|
|
2593
|
+
}
|
|
2594
|
+
const K = y(L.endTime);
|
|
2595
|
+
O > K && (O = K);
|
|
2596
|
+
const te = ce(O);
|
|
2597
|
+
o && (o.dataset.wasDragged = "true"), te !== m && g && (l == null || l({
|
|
2598
|
+
event: g,
|
|
2599
|
+
from: { endTime: m },
|
|
2600
|
+
to: { endTime: te }
|
|
2601
|
+
}));
|
|
2602
|
+
}
|
|
2603
|
+
o && o.classList.remove("cal-sched-event--resizing"), I();
|
|
2604
|
+
} else if (d === "create") {
|
|
2605
|
+
I();
|
|
2606
|
+
const L = (P == null ? void 0 : P.dataset.endTime) || null;
|
|
2607
|
+
P && (P.remove(), P = null), h && H && E && L && (r == null || r({
|
|
2608
|
+
date: H,
|
|
2609
|
+
startTime: E,
|
|
2610
|
+
endTime: L,
|
|
2611
|
+
resourceId: _
|
|
2612
|
+
})), H = null, _ = null, E = null, Z = 0;
|
|
2613
|
+
}
|
|
2614
|
+
d = null, g = null, o = null, k = 0, u = 0, p = 0, v = 0, h = !1, m = null, w = null, T = null, D = null;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
function z(b, L) {
|
|
2618
|
+
const S = e(), q = t.querySelectorAll("[data-date]");
|
|
2619
|
+
let x = null, B = null;
|
|
2620
|
+
for (const ne of q) {
|
|
2621
|
+
const de = ne.getBoundingClientRect();
|
|
2622
|
+
if (b >= de.left && b <= de.right) {
|
|
2623
|
+
if (x = ne.dataset.date, ne.dataset.resourceId)
|
|
2624
|
+
B = ne.dataset.resourceId;
|
|
2625
|
+
else {
|
|
2626
|
+
const Ee = ne.querySelectorAll("[data-resource-id]");
|
|
2627
|
+
for (const Se of Ee) {
|
|
2628
|
+
const De = Se.getBoundingClientRect();
|
|
2629
|
+
if (b >= De.left && b <= De.right) {
|
|
2630
|
+
B = Se.dataset.resourceId;
|
|
2631
|
+
break;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
break;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
if (!x) return null;
|
|
2639
|
+
const Q = t.querySelectorAll("[data-time]");
|
|
2640
|
+
if (Q.length === 0) return null;
|
|
2641
|
+
const J = Q[0].getBoundingClientRect().top, O = L - J;
|
|
2642
|
+
if (O < 0) return null;
|
|
2643
|
+
const ue = S.snapInterval || S.interval, re = Ie(O, S.startTime, S.slotHeight, S.interval), K = ze(re, ue), te = y(K), se = y(S.startTime), V = y(S.endTime);
|
|
2644
|
+
return te < se || te >= V ? null : {
|
|
2645
|
+
date: x,
|
|
2646
|
+
time: K,
|
|
2647
|
+
resourceId: B
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
function W(b) {
|
|
2651
|
+
$();
|
|
2652
|
+
const L = e();
|
|
2653
|
+
let S = L.interval;
|
|
2654
|
+
g && w && m && (S = y(m) - y(w));
|
|
2655
|
+
let x = y(b.time) + S;
|
|
2656
|
+
const B = y(L.endTime);
|
|
2657
|
+
x > B && (x = B);
|
|
2658
|
+
const Q = ce(x);
|
|
2659
|
+
let ae = R(b.date, b.resourceId);
|
|
2660
|
+
if (!ae) return;
|
|
2661
|
+
X = document.createElement("div"), X.classList.add("cal-sched-drop-preview");
|
|
2662
|
+
const J = ie(b.time, L.startTime, L.slotHeight, L.interval), O = ie(Q, L.startTime, L.slotHeight, L.interval);
|
|
2663
|
+
X.style.top = `${J}px`, X.style.height = `${Math.max(O - J, L.slotHeight * 0.5)}px`, ae.appendChild(X);
|
|
2664
|
+
}
|
|
2665
|
+
function $() {
|
|
2666
|
+
X && (X.remove(), X = null);
|
|
2667
|
+
}
|
|
2668
|
+
function R(b, L) {
|
|
2669
|
+
if (L) {
|
|
2670
|
+
let q = t.querySelector(
|
|
2671
|
+
`[data-resource-id="${L}"][data-date="${b}"]`
|
|
2672
|
+
);
|
|
2673
|
+
if (q || (q = t.querySelector(
|
|
2674
|
+
`[data-date="${b}"] [data-resource-id="${L}"]`
|
|
2675
|
+
)), q) return q;
|
|
2676
|
+
}
|
|
2677
|
+
const S = t.querySelector(`[data-date="${b}"]`);
|
|
2678
|
+
return S ? S.querySelector(".cal-sched-week__lane") || S.querySelector(".cal-sched-day__lane") || S : null;
|
|
2679
|
+
}
|
|
2680
|
+
function U(b, L, S, q) {
|
|
2681
|
+
F || (F = document.createElement("div"), F.classList.add("cal-sched-drag-time-label"), t.appendChild(F));
|
|
2682
|
+
const { hours: x, minutes: B } = C(S), Q = q === "12h" ? A(x, B) : S;
|
|
2683
|
+
F.textContent = Q, F.style.left = `${b + 12}px`, F.style.top = `${L - 8}px`;
|
|
2684
|
+
}
|
|
2685
|
+
function I() {
|
|
2686
|
+
F && (F.remove(), F = null);
|
|
2687
|
+
}
|
|
2688
|
+
function C(b) {
|
|
2689
|
+
const [L, S] = b.split(":").map(Number);
|
|
2690
|
+
return { hours: L, minutes: S };
|
|
2691
|
+
}
|
|
2692
|
+
function A(b, L) {
|
|
2693
|
+
const S = b >= 12 ? "PM" : "AM";
|
|
2694
|
+
return `${b % 12 || 12}:${String(L).padStart(2, "0")} ${S}`;
|
|
2695
|
+
}
|
|
2696
|
+
function G() {
|
|
2697
|
+
i || (i = !0, t.addEventListener("pointerdown", j));
|
|
2698
|
+
}
|
|
2699
|
+
function le() {
|
|
2700
|
+
i = !1, t.removeEventListener("pointerdown", j), t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", f), ke();
|
|
2701
|
+
}
|
|
2702
|
+
function ke() {
|
|
2703
|
+
c && (c.remove(), c = null), P && (P.remove(), P = null), o && (o.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), o = null), $(), I(), d = null, g = null, h = !1;
|
|
2704
|
+
}
|
|
2705
|
+
function Re() {
|
|
2706
|
+
le();
|
|
2707
|
+
}
|
|
2708
|
+
return { enable: G, disable: le, destroy: Re };
|
|
2709
|
+
}
|
|
2710
|
+
const zt = `
|
|
2711
|
+
[data-draggable="true"] {
|
|
2712
|
+
cursor: grab;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
[data-draggable="true"]:active {
|
|
2716
|
+
cursor: grabbing;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
.cal-sched-event--dragging {
|
|
2720
|
+
opacity: 0.3;
|
|
2721
|
+
pointer-events: none;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
.cal-sched-event--ghost {
|
|
2725
|
+
pointer-events: none;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
.cal-sched-event--resizing {
|
|
2729
|
+
z-index: 10;
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
.cal-sched-event__resize-handle {
|
|
2733
|
+
position: absolute;
|
|
2734
|
+
bottom: 0;
|
|
2735
|
+
left: 0;
|
|
2736
|
+
right: 0;
|
|
2737
|
+
height: 6px;
|
|
2738
|
+
cursor: ns-resize;
|
|
2739
|
+
border-radius: 0 0 var(--cal-radius-sm) var(--cal-radius-sm);
|
|
2740
|
+
display: flex;
|
|
2741
|
+
align-items: center;
|
|
2742
|
+
justify-content: center;
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
.cal-sched-event__resize-handle::after {
|
|
2746
|
+
content: '';
|
|
2747
|
+
width: 20px;
|
|
2748
|
+
height: 2px;
|
|
2749
|
+
border-radius: 1px;
|
|
2750
|
+
background: currentColor;
|
|
2751
|
+
opacity: 0.3;
|
|
2752
|
+
transition: opacity var(--cal-transition);
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
.cal-sched-event__resize-handle:hover::after {
|
|
2756
|
+
opacity: 0.6;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
.cal-sched-drop-preview {
|
|
2760
|
+
position: absolute;
|
|
2761
|
+
left: 2px;
|
|
2762
|
+
right: 2px;
|
|
2763
|
+
background: hsl(var(--cal-accent) / 0.12);
|
|
2764
|
+
border: 1.5px solid hsl(var(--cal-accent) / 0.5);
|
|
2765
|
+
border-radius: var(--cal-radius-sm);
|
|
2766
|
+
z-index: 3;
|
|
2767
|
+
pointer-events: none;
|
|
2768
|
+
transition: top 0.05s ease, height 0.05s ease;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
.cal-sched-create-preview {
|
|
2772
|
+
position: absolute;
|
|
2773
|
+
left: 2px;
|
|
2774
|
+
right: 2px;
|
|
2775
|
+
background: hsl(var(--cal-accent) / 0.15);
|
|
2776
|
+
border: 1.5px dashed hsl(var(--cal-accent));
|
|
2777
|
+
border-radius: var(--cal-radius-sm);
|
|
2778
|
+
z-index: 4;
|
|
2779
|
+
pointer-events: none;
|
|
2780
|
+
transition: height 0.05s ease;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
.cal-sched-drag-time-label {
|
|
2784
|
+
position: fixed;
|
|
2785
|
+
background: hsl(var(--cal-fg));
|
|
2786
|
+
color: hsl(var(--cal-bg));
|
|
2787
|
+
font-size: 11px;
|
|
2788
|
+
font-weight: 500;
|
|
2789
|
+
padding: 2px 6px;
|
|
2790
|
+
border-radius: var(--cal-radius-sm);
|
|
2791
|
+
pointer-events: none;
|
|
2792
|
+
z-index: 1001;
|
|
2793
|
+
white-space: nowrap;
|
|
2794
|
+
}
|
|
2795
|
+
`, At = `
|
|
2796
|
+
.cal-sched {
|
|
2797
|
+
background: hsl(var(--cal-bg));
|
|
2798
|
+
border-radius: var(--cal-radius);
|
|
2799
|
+
user-select: none;
|
|
2800
|
+
font-size: 14px;
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
.cal-sched__body {
|
|
2804
|
+
position: relative;
|
|
2805
|
+
}
|
|
2806
|
+
`;
|
|
2807
|
+
class Pt extends Fe {
|
|
2808
|
+
static get styles() {
|
|
2809
|
+
return [
|
|
2810
|
+
et,
|
|
2811
|
+
tt,
|
|
2812
|
+
at,
|
|
2813
|
+
rt,
|
|
2814
|
+
it,
|
|
2815
|
+
ot,
|
|
2816
|
+
ut,
|
|
2817
|
+
mt,
|
|
2818
|
+
vt,
|
|
2819
|
+
_t,
|
|
2820
|
+
wt,
|
|
2821
|
+
Et,
|
|
2822
|
+
Ct,
|
|
2823
|
+
Mt,
|
|
2824
|
+
pt,
|
|
2825
|
+
Dt,
|
|
2826
|
+
zt,
|
|
2827
|
+
At
|
|
2828
|
+
];
|
|
2829
|
+
}
|
|
2830
|
+
static get observedAttributes() {
|
|
2831
|
+
return [
|
|
2832
|
+
"theme",
|
|
2833
|
+
"view",
|
|
2834
|
+
"layout",
|
|
2835
|
+
"date",
|
|
2836
|
+
"start-time",
|
|
2837
|
+
"end-time",
|
|
2838
|
+
"interval",
|
|
2839
|
+
"format",
|
|
2840
|
+
"first-day",
|
|
2841
|
+
"loading",
|
|
2842
|
+
"slot-height",
|
|
2843
|
+
"resource-mode",
|
|
2844
|
+
"show-event-time",
|
|
2845
|
+
"show-fab",
|
|
2846
|
+
"draggable-events",
|
|
2847
|
+
"snap-interval",
|
|
2848
|
+
"min-duration",
|
|
2849
|
+
"max-duration"
|
|
2850
|
+
];
|
|
2851
|
+
}
|
|
2852
|
+
constructor() {
|
|
2853
|
+
super(), this._store = Ve({
|
|
2854
|
+
view: "week",
|
|
2855
|
+
anchorDate: me(),
|
|
2856
|
+
layout: "vertical",
|
|
2857
|
+
selectedResourceId: null,
|
|
2858
|
+
// Slot selection
|
|
2859
|
+
selectedSlot: null,
|
|
2860
|
+
// Event detail
|
|
2861
|
+
detailEvent: null,
|
|
2862
|
+
detailResource: null,
|
|
2863
|
+
// Status
|
|
2864
|
+
statusType: null,
|
|
2865
|
+
statusMessage: null,
|
|
2866
|
+
statusDismissible: !0,
|
|
2867
|
+
// All-day collapse
|
|
2868
|
+
allDayCollapsed: !1
|
|
2869
|
+
}), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
|
|
2870
|
+
}
|
|
2871
|
+
// -- Attribute getters --
|
|
2872
|
+
get view() {
|
|
2873
|
+
return this.getAttribute("view") || this._store.get("view");
|
|
2874
|
+
}
|
|
2875
|
+
get layout() {
|
|
2876
|
+
return this.getAttribute("layout") || this._store.get("layout");
|
|
2877
|
+
}
|
|
2878
|
+
get startTime() {
|
|
2879
|
+
return this.getAttribute("start-time") || "08:00";
|
|
2880
|
+
}
|
|
2881
|
+
get endTime() {
|
|
2882
|
+
return this.getAttribute("end-time") || "18:00";
|
|
2883
|
+
}
|
|
2884
|
+
get interval() {
|
|
2885
|
+
return parseInt(this.getAttribute("interval") || "30", 10);
|
|
2886
|
+
}
|
|
2887
|
+
get format() {
|
|
2888
|
+
return this.getAttribute("format") || "24h";
|
|
2889
|
+
}
|
|
2890
|
+
get firstDay() {
|
|
2891
|
+
return parseInt(this.getAttribute("first-day") || "0", 10);
|
|
2892
|
+
}
|
|
2893
|
+
get slotHeight() {
|
|
2894
|
+
return parseInt(this.getAttribute("slot-height") || "48", 10);
|
|
2895
|
+
}
|
|
2896
|
+
get resourceMode() {
|
|
2897
|
+
return this.getAttribute("resource-mode") || "tabs";
|
|
2898
|
+
}
|
|
2899
|
+
get loading() {
|
|
2900
|
+
return this.hasAttribute("loading");
|
|
2901
|
+
}
|
|
2902
|
+
set loading(e) {
|
|
2903
|
+
e ? this.setAttribute("loading", "") : this.removeAttribute("loading");
|
|
2904
|
+
}
|
|
2905
|
+
get showEventTime() {
|
|
2906
|
+
return this.getAttribute("show-event-time") !== "false";
|
|
2907
|
+
}
|
|
2908
|
+
get showFab() {
|
|
2909
|
+
return this.hasAttribute("show-fab");
|
|
2910
|
+
}
|
|
2911
|
+
get draggableEvents() {
|
|
2912
|
+
return this.hasAttribute("draggable-events");
|
|
2913
|
+
}
|
|
2914
|
+
get snapInterval() {
|
|
2915
|
+
const e = this.getAttribute("snap-interval");
|
|
2916
|
+
return e ? parseInt(e, 10) : null;
|
|
2917
|
+
}
|
|
2918
|
+
get minDuration() {
|
|
2919
|
+
const e = this.getAttribute("min-duration");
|
|
2920
|
+
return e ? parseInt(e, 10) : null;
|
|
2921
|
+
}
|
|
2922
|
+
get maxDuration() {
|
|
2923
|
+
const e = this.getAttribute("max-duration");
|
|
2924
|
+
return e ? parseInt(e, 10) : null;
|
|
2925
|
+
}
|
|
2926
|
+
// -- Properties --
|
|
2927
|
+
get resources() {
|
|
2928
|
+
return this._resources;
|
|
2929
|
+
}
|
|
2930
|
+
set resources(e) {
|
|
2931
|
+
this._resources = Array.isArray(e) ? e : [], this._initialized && this.render();
|
|
2932
|
+
}
|
|
2933
|
+
get events() {
|
|
2934
|
+
return this._events;
|
|
2935
|
+
}
|
|
2936
|
+
set events(e) {
|
|
2937
|
+
this._events = Array.isArray(e) ? e : [], this._initialized && this.render();
|
|
2938
|
+
}
|
|
2939
|
+
get eventActions() {
|
|
2940
|
+
return this._eventActions;
|
|
2941
|
+
}
|
|
2942
|
+
set eventActions(e) {
|
|
2943
|
+
this._eventActions = Array.isArray(e) ? e : [], this._initialized && this.render();
|
|
2944
|
+
}
|
|
2945
|
+
get eventContent() {
|
|
2946
|
+
return this._eventContent;
|
|
2947
|
+
}
|
|
2948
|
+
set eventContent(e) {
|
|
2949
|
+
this._eventContent = typeof e == "function" ? e : null, this._initialized && this.render();
|
|
2950
|
+
}
|
|
2951
|
+
get value() {
|
|
2952
|
+
return this._lastSlotValue || null;
|
|
2953
|
+
}
|
|
2954
|
+
// -- Lifecycle --
|
|
2955
|
+
connectedCallback() {
|
|
2956
|
+
const e = this.getAttribute("date");
|
|
2957
|
+
e && this._store.set({ anchorDate: e });
|
|
2958
|
+
const s = this.getAttribute("view");
|
|
2959
|
+
s && this._store.set({ view: s });
|
|
2960
|
+
const a = this.getAttribute("layout");
|
|
2961
|
+
a && this._store.set({ layout: a }), super.connectedCallback(), this._unsubscribe = this._store.subscribe(() => {
|
|
2962
|
+
this._rendering || this.render();
|
|
2963
|
+
}), this._nowTimer = setInterval(() => {
|
|
2964
|
+
const n = this._store.get("view");
|
|
2965
|
+
(n === "day" || n === "week") && this.render();
|
|
2966
|
+
}, 6e4), this.draggableEvents && this._initDrag();
|
|
2967
|
+
}
|
|
2968
|
+
disconnectedCallback() {
|
|
2969
|
+
var e;
|
|
2970
|
+
(e = this._unsubscribe) == null || e.call(this), clearInterval(this._nowTimer), clearTimeout(this._statusTimer), this._destroyDrag(), this._escHandler && (document.removeEventListener("keydown", this._escHandler), this._escHandler = null);
|
|
2971
|
+
}
|
|
2972
|
+
attributeChangedCallback(e, s, a) {
|
|
2973
|
+
if (s !== a) {
|
|
2974
|
+
if (e === "date" && a) {
|
|
2975
|
+
this._store.set({ anchorDate: a });
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2978
|
+
if (e === "view" && a) {
|
|
2979
|
+
this._store.set({ view: a });
|
|
2980
|
+
return;
|
|
2981
|
+
}
|
|
2982
|
+
if (e === "layout" && a) {
|
|
2983
|
+
this._store.set({ layout: a });
|
|
2984
|
+
return;
|
|
2985
|
+
}
|
|
2986
|
+
e === "draggable-events" && (a !== null ? this._initDrag() : this._destroyDrag()), this._initialized && this.render();
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
// -- Public methods --
|
|
2990
|
+
goToDate(e) {
|
|
2991
|
+
this._store.set({ anchorDate: e }), this.emit("cal:date-change", { date: e, view: this._store.get("view") });
|
|
2992
|
+
}
|
|
2993
|
+
setView(e) {
|
|
2994
|
+
["day", "week", "month"].includes(e) && (this._store.set({ view: e }), this.emit("cal:view-change", { view: e, date: this._store.get("anchorDate") }));
|
|
2995
|
+
}
|
|
2996
|
+
today() {
|
|
2997
|
+
this.goToDate(me());
|
|
2998
|
+
}
|
|
2999
|
+
next() {
|
|
3000
|
+
const e = this._store.getState(), s = ee(e.anchorDate);
|
|
3001
|
+
if (!s) return;
|
|
3002
|
+
let a;
|
|
3003
|
+
if (e.view === "day")
|
|
3004
|
+
a = fe(e.anchorDate, 1);
|
|
3005
|
+
else if (e.view === "week")
|
|
3006
|
+
a = fe(e.anchorDate, 7);
|
|
3007
|
+
else {
|
|
3008
|
+
const { year: n, month: l } = xe(s.getFullYear(), s.getMonth(), 1);
|
|
3009
|
+
a = pe(new Date(n, l, 1));
|
|
3010
|
+
}
|
|
3011
|
+
this._store.set({ anchorDate: a }), this.emit("cal:date-change", { date: a, view: e.view });
|
|
3012
|
+
}
|
|
3013
|
+
prev() {
|
|
3014
|
+
const e = this._store.getState(), s = ee(e.anchorDate);
|
|
3015
|
+
if (!s) return;
|
|
3016
|
+
let a;
|
|
3017
|
+
if (e.view === "day")
|
|
3018
|
+
a = fe(e.anchorDate, -1);
|
|
3019
|
+
else if (e.view === "week")
|
|
3020
|
+
a = fe(e.anchorDate, -7);
|
|
3021
|
+
else {
|
|
3022
|
+
const { year: n, month: l } = xe(s.getFullYear(), s.getMonth(), -1);
|
|
3023
|
+
a = pe(new Date(n, l, 1));
|
|
3024
|
+
}
|
|
3025
|
+
this._store.set({ anchorDate: a }), this.emit("cal:date-change", { date: a, view: e.view });
|
|
3026
|
+
}
|
|
3027
|
+
findAvailableSlot(e) {
|
|
3028
|
+
return Qe(
|
|
3029
|
+
e,
|
|
3030
|
+
this._resources,
|
|
3031
|
+
this._events,
|
|
3032
|
+
this.interval,
|
|
3033
|
+
this.startTime,
|
|
3034
|
+
this.endTime
|
|
3035
|
+
);
|
|
3036
|
+
}
|
|
3037
|
+
isSlotAvailable(e, s, a, n) {
|
|
3038
|
+
return Be(this._events, n, e, s, a);
|
|
3039
|
+
}
|
|
3040
|
+
// -- Event handlers --
|
|
3041
|
+
_handleSlotClick(e, s, a, n, l) {
|
|
3042
|
+
this._lastSlotValue = { date: e, startTime: s, endTime: a, resourceId: n, resource: l }, this._store.set({ selectedSlot: { date: e, startTime: s, endTime: a, resourceId: n, resource: l } }), this.emit("cal:slot-select", { date: e, startTime: s, endTime: a, resourceId: n, resource: l });
|
|
3043
|
+
}
|
|
3044
|
+
_handleSlotCreate(e, s, a, n, l) {
|
|
3045
|
+
this.emit("cal:slot-create", { date: e, startTime: s, endTime: a, resourceId: n, resource: l });
|
|
3046
|
+
}
|
|
3047
|
+
_dismissSlot() {
|
|
3048
|
+
this._store.set({ selectedSlot: null });
|
|
3049
|
+
}
|
|
3050
|
+
_handleEventClick(e, s, a) {
|
|
3051
|
+
this._dismissSlot(), this._store.set({ detailEvent: e, detailResource: a || null }), this.emit("cal:event-click", { event: e, resourceId: s, resource: a });
|
|
3052
|
+
}
|
|
3053
|
+
_closeDetail() {
|
|
3054
|
+
this._store.set({ detailEvent: null, detailResource: null });
|
|
3055
|
+
}
|
|
3056
|
+
_handleViewChange(e) {
|
|
3057
|
+
this._dismissSlot(), this.setView(e);
|
|
3058
|
+
}
|
|
3059
|
+
_handleResourceFilter(e) {
|
|
3060
|
+
this._dismissSlot(), this._store.set({ selectedResourceId: e });
|
|
3061
|
+
}
|
|
3062
|
+
_handleEventAction(e) {
|
|
3063
|
+
const s = this._store.getState(), a = s.detailEvent, n = s.detailResource;
|
|
3064
|
+
this.emit("cal:event-action", {
|
|
3065
|
+
action: e,
|
|
3066
|
+
event: a,
|
|
3067
|
+
resourceId: a == null ? void 0 : a.resourceId,
|
|
3068
|
+
resource: n
|
|
3069
|
+
});
|
|
3070
|
+
}
|
|
3071
|
+
_initDrag() {
|
|
3072
|
+
this._dragManager || (this._dragManager = It({
|
|
3073
|
+
shadowRoot: this.shadowRoot,
|
|
3074
|
+
getConfig: () => ({
|
|
3075
|
+
slotHeight: this.slotHeight,
|
|
3076
|
+
interval: this.interval,
|
|
3077
|
+
startTime: this.startTime,
|
|
3078
|
+
endTime: this.endTime,
|
|
3079
|
+
format: this.format,
|
|
3080
|
+
snapInterval: this.snapInterval,
|
|
3081
|
+
minDuration: this.minDuration,
|
|
3082
|
+
maxDuration: this.maxDuration
|
|
3083
|
+
}),
|
|
3084
|
+
getViewInfo: () => {
|
|
3085
|
+
const e = this._store.getState();
|
|
3086
|
+
return {
|
|
3087
|
+
view: e.view,
|
|
3088
|
+
anchorDate: e.anchorDate,
|
|
3089
|
+
weekDates: Te(e.anchorDate, this.firstDay),
|
|
3090
|
+
resources: this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }],
|
|
3091
|
+
resourceMode: this.resourceMode,
|
|
3092
|
+
selectedResourceId: e.selectedResourceId
|
|
3093
|
+
};
|
|
3094
|
+
},
|
|
3095
|
+
getEvents: () => this._events,
|
|
3096
|
+
onMove: (e) => {
|
|
3097
|
+
this.emit("cal:event-move", e);
|
|
3098
|
+
},
|
|
3099
|
+
onResize: (e) => {
|
|
3100
|
+
this.emit("cal:event-resize", e);
|
|
3101
|
+
},
|
|
3102
|
+
onCreate: (e) => {
|
|
3103
|
+
const s = this._resources.find((a) => a.id === e.resourceId) || null;
|
|
3104
|
+
this.emit("cal:slot-create", { ...e, resource: s });
|
|
3105
|
+
}
|
|
3106
|
+
}), this._dragManager.enable());
|
|
3107
|
+
}
|
|
3108
|
+
_destroyDrag() {
|
|
3109
|
+
this._dragManager && (this._dragManager.destroy(), this._dragManager = null);
|
|
3110
|
+
}
|
|
3111
|
+
_handleFabClick() {
|
|
3112
|
+
const e = this._store.getState();
|
|
3113
|
+
this.emit("cal:fab-create", { date: e.anchorDate, view: e.view });
|
|
3114
|
+
}
|
|
3115
|
+
// -- Render --
|
|
3116
|
+
render() {
|
|
3117
|
+
var v;
|
|
3118
|
+
if (this._rendering) return;
|
|
3119
|
+
this._rendering = !0;
|
|
3120
|
+
const e = this.shadowRoot, s = [...e.childNodes];
|
|
3121
|
+
for (const h of s)
|
|
3122
|
+
h.nodeName !== "STYLE" && !(h instanceof CSSStyleSheet) && e.removeChild(h);
|
|
3123
|
+
const a = this._store.getState(), n = document.createElement("div");
|
|
3124
|
+
n.classList.add("cal-sched"), a.statusType && a.statusMessage && n.appendChild(kt({
|
|
3125
|
+
type: a.statusType,
|
|
3126
|
+
message: a.statusMessage,
|
|
3127
|
+
dismissible: a.statusDismissible,
|
|
3128
|
+
onDismiss: () => this.clearStatus()
|
|
3129
|
+
}));
|
|
3130
|
+
const l = a.view, r = a.anchorDate, i = Te(r, this.firstDay), d = Je(l, r, i), g = this.resourceMode;
|
|
3131
|
+
n.appendChild(lt({
|
|
3132
|
+
title: d,
|
|
3133
|
+
view: l,
|
|
3134
|
+
onPrev: () => this.prev(),
|
|
3135
|
+
onNext: () => this.next(),
|
|
3136
|
+
onToday: () => this.today(),
|
|
3137
|
+
onViewChange: (h) => this._handleViewChange(h)
|
|
3138
|
+
}));
|
|
3139
|
+
const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }], o = g === "tabs" && c.length > 1 && c[0].id !== "__default";
|
|
3140
|
+
o && !this.loading && n.appendChild(Tt({
|
|
3141
|
+
resources: c,
|
|
3142
|
+
selectedResourceId: a.selectedResourceId,
|
|
3143
|
+
onResourceFilter: (h) => this._handleResourceFilter(h)
|
|
3144
|
+
}));
|
|
3145
|
+
let k = this._events;
|
|
3146
|
+
o && a.selectedResourceId && (k = this._events.filter((h) => h.resourceId === a.selectedResourceId));
|
|
3147
|
+
let u = c;
|
|
3148
|
+
if (o && a.selectedResourceId) {
|
|
3149
|
+
const h = c.find((m) => m.id === a.selectedResourceId);
|
|
3150
|
+
h && (u = [h]);
|
|
3151
|
+
}
|
|
3152
|
+
const p = document.createElement("div");
|
|
3153
|
+
if (p.classList.add("cal-sched__body"), this.loading)
|
|
3154
|
+
if (l === "month")
|
|
3155
|
+
p.appendChild(yt());
|
|
3156
|
+
else {
|
|
3157
|
+
const h = l === "week" ? 7 : Math.max(this._resources.length, 1);
|
|
3158
|
+
p.appendChild(xt({
|
|
3159
|
+
columns: h,
|
|
3160
|
+
rows: Math.ceil((y(this.endTime) - y(this.startTime)) / this.interval),
|
|
3161
|
+
slotHeight: this.slotHeight
|
|
3162
|
+
}));
|
|
3163
|
+
}
|
|
3164
|
+
else
|
|
3165
|
+
l === "day" ? p.appendChild(gt({
|
|
3166
|
+
date: r,
|
|
3167
|
+
resources: u,
|
|
3168
|
+
events: k,
|
|
3169
|
+
startTime: this.startTime,
|
|
3170
|
+
endTime: this.endTime,
|
|
3171
|
+
interval: this.interval,
|
|
3172
|
+
slotHeight: this.slotHeight,
|
|
3173
|
+
format: this.format,
|
|
3174
|
+
layout: a.layout,
|
|
3175
|
+
resourceMode: g,
|
|
3176
|
+
selectedSlot: a.selectedSlot,
|
|
3177
|
+
eventContent: this._eventContent,
|
|
3178
|
+
showTime: this.showEventTime,
|
|
3179
|
+
draggable: this.draggableEvents,
|
|
3180
|
+
onSlotClick: (h, m, w, T, D) => this._handleSlotClick(h, m, w, T, D),
|
|
3181
|
+
onEventClick: (h, m, w) => this._handleEventClick(h, m, w),
|
|
3182
|
+
onSlotCreate: (h, m, w, T, D) => this._handleSlotCreate(h, m, w, T, D)
|
|
3183
|
+
})) : l === "week" ? p.appendChild(ft({
|
|
3184
|
+
date: r,
|
|
3185
|
+
firstDay: this.firstDay,
|
|
3186
|
+
resources: u,
|
|
3187
|
+
events: k,
|
|
3188
|
+
startTime: this.startTime,
|
|
3189
|
+
endTime: this.endTime,
|
|
3190
|
+
interval: this.interval,
|
|
3191
|
+
slotHeight: this.slotHeight,
|
|
3192
|
+
format: this.format,
|
|
3193
|
+
layout: a.layout,
|
|
3194
|
+
resourceMode: g,
|
|
3195
|
+
selectedSlot: a.selectedSlot,
|
|
3196
|
+
eventContent: this._eventContent,
|
|
3197
|
+
showTime: this.showEventTime,
|
|
3198
|
+
draggable: this.draggableEvents,
|
|
3199
|
+
allDayCollapsed: a.allDayCollapsed,
|
|
3200
|
+
onToggleAllDay: () => this._store.set({ allDayCollapsed: !a.allDayCollapsed }),
|
|
3201
|
+
onSlotClick: (h, m, w, T, D) => this._handleSlotClick(h, m, w, T, D),
|
|
3202
|
+
onEventClick: (h, m, w) => this._handleEventClick(h, m, w),
|
|
3203
|
+
onSlotCreate: (h, m, w, T, D) => this._handleSlotCreate(h, m, w, T, D)
|
|
3204
|
+
})) : l === "month" && p.appendChild(bt({
|
|
3205
|
+
date: r,
|
|
3206
|
+
firstDay: this.firstDay,
|
|
3207
|
+
resources: u,
|
|
3208
|
+
events: k,
|
|
3209
|
+
format: this.format,
|
|
3210
|
+
selectedResourceId: a.selectedResourceId,
|
|
3211
|
+
selectedDate: ((v = a.selectedSlot) == null ? void 0 : v.date) || null,
|
|
3212
|
+
eventContent: this._eventContent,
|
|
3213
|
+
onSlotClick: (h) => this._handleSlotClick(h, null, null, null, null),
|
|
3214
|
+
onEventClick: (h, m, w) => this._handleEventClick(h, m, w),
|
|
3215
|
+
onSlotCreate: (h) => this._handleSlotCreate(h, null, null, null, null)
|
|
3216
|
+
}));
|
|
3217
|
+
n.appendChild(p), a.detailEvent && p.appendChild(Lt({
|
|
3218
|
+
event: a.detailEvent,
|
|
3219
|
+
resource: a.detailResource,
|
|
3220
|
+
format: this.format,
|
|
3221
|
+
onClose: () => this._closeDetail(),
|
|
3222
|
+
actions: this._eventActions,
|
|
3223
|
+
onAction: (h) => this._handleEventAction(h)
|
|
3224
|
+
})), this.showFab && !this.loading && p.appendChild(St({
|
|
3225
|
+
onClick: () => this._handleFabClick()
|
|
3226
|
+
})), e.appendChild(n), this._escHandler || (this._escHandler = (h) => {
|
|
3227
|
+
h.key === "Escape" && this._store.get("selectedSlot") && this._dismissSlot();
|
|
3228
|
+
}, this.shadowRoot.addEventListener("keydown", this._escHandler), document.addEventListener("keydown", this._escHandler)), this._rendering = !1;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
customElements.get("cal-scheduler") || customElements.define("cal-scheduler", Pt);
|
|
3232
|
+
export {
|
|
3233
|
+
Pt as CalScheduler
|
|
3234
|
+
};
|
|
3235
|
+
//# sourceMappingURL=scheduler.es.js.map
|