calkit 0.1.0 → 0.2.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 +1 -1
- package/dist/booking.es.js +421 -318
- package/dist/booking.es.js.map +1 -1
- package/dist/booking.umd.js +12 -12
- package/dist/booking.umd.js.map +1 -1
- package/dist/calkit.d.ts +453 -0
- package/dist/calkit.es.js +1101 -898
- package/dist/calkit.es.js.map +1 -1
- package/dist/calkit.umd.js +34 -34
- package/dist/calkit.umd.js.map +1 -1
- package/dist/datepicker.es.js +333 -241
- package/dist/datepicker.es.js.map +1 -1
- package/dist/datepicker.umd.js +12 -12
- package/dist/datepicker.umd.js.map +1 -1
- package/dist/scheduler.es.js +705 -638
- package/dist/scheduler.es.js.map +1 -1
- package/dist/scheduler.umd.js +20 -20
- package/dist/scheduler.umd.js.map +1 -1
- package/dist/timepicker.es.js +146 -116
- package/dist/timepicker.es.js.map +1 -1
- package/dist/timepicker.umd.js +6 -6
- package/dist/timepicker.umd.js.map +1 -1
- package/llms.txt +1 -1
- package/package.json +4 -2
package/dist/scheduler.es.js
CHANGED
|
@@ -27,6 +27,9 @@ class Fe extends HTMLElement {
|
|
|
27
27
|
/** Subclasses override to update Shadow DOM. */
|
|
28
28
|
render() {
|
|
29
29
|
}
|
|
30
|
+
/** Reset selection state. Subclasses should override with specific logic. */
|
|
31
|
+
clear() {
|
|
32
|
+
}
|
|
30
33
|
/** Dispatch a composed, bubbling custom event. */
|
|
31
34
|
emit(e, s = {}) {
|
|
32
35
|
this.dispatchEvent(
|
|
@@ -36,8 +39,8 @@ class Fe extends HTMLElement {
|
|
|
36
39
|
/** Show an inline status banner. */
|
|
37
40
|
showStatus(e, s, a = {}) {
|
|
38
41
|
if (!this._store) return;
|
|
39
|
-
const { autoDismiss: n, dismissible:
|
|
40
|
-
clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: s, statusDismissible:
|
|
42
|
+
const { autoDismiss: n, dismissible: r = !0 } = a;
|
|
43
|
+
clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: s, statusDismissible: r }), this.emit("cal:status", { type: e, message: s }), n && n > 0 && (this._statusTimer = setTimeout(() => this.clearStatus(), n));
|
|
41
44
|
}
|
|
42
45
|
/** Clear the status banner. */
|
|
43
46
|
clearStatus() {
|
|
@@ -61,14 +64,14 @@ function Ve(t) {
|
|
|
61
64
|
set(a) {
|
|
62
65
|
const n = e;
|
|
63
66
|
e = { ...e, ...a };
|
|
64
|
-
let
|
|
65
|
-
for (const
|
|
66
|
-
if (n[
|
|
67
|
-
|
|
67
|
+
let r = !1;
|
|
68
|
+
for (const l of Object.keys(a))
|
|
69
|
+
if (n[l] !== e[l]) {
|
|
70
|
+
r = !0;
|
|
68
71
|
break;
|
|
69
72
|
}
|
|
70
|
-
if (
|
|
71
|
-
for (const
|
|
73
|
+
if (r)
|
|
74
|
+
for (const l of s) l(e, n);
|
|
72
75
|
},
|
|
73
76
|
getState() {
|
|
74
77
|
return e;
|
|
@@ -78,7 +81,7 @@ function Ve(t) {
|
|
|
78
81
|
}
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
|
-
const
|
|
84
|
+
const _e = [
|
|
82
85
|
"January",
|
|
83
86
|
"February",
|
|
84
87
|
"March",
|
|
@@ -91,16 +94,28 @@ const oe = [
|
|
|
91
94
|
"October",
|
|
92
95
|
"November",
|
|
93
96
|
"December"
|
|
94
|
-
],
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
], Oe = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], qe = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Xe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
98
|
+
function We(t) {
|
|
99
|
+
if (!t) return _e;
|
|
100
|
+
try {
|
|
101
|
+
const e = new Intl.DateTimeFormat(t, { month: "long" });
|
|
102
|
+
return Array.from({ length: 12 }, (s, a) => {
|
|
103
|
+
const n = e.format(new Date(2024, a, 1));
|
|
104
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
105
|
+
});
|
|
106
|
+
} catch {
|
|
107
|
+
return _e;
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
function He(t, e = "short", s) {
|
|
111
|
+
const a = ee(t);
|
|
112
|
+
return a ? e === "long" ? qe[a.getDay()] : Xe[a.getDay()] : "";
|
|
113
|
+
}
|
|
114
|
+
function Ue(t = 0, e) {
|
|
115
|
+
const s = [];
|
|
116
|
+
for (let a = 0; a < 7; a++)
|
|
117
|
+
s.push(Oe[(t + a) % 7]);
|
|
118
|
+
return s;
|
|
104
119
|
}
|
|
105
120
|
function $e(t, e) {
|
|
106
121
|
return new Date(t, e + 1, 0).getDate();
|
|
@@ -108,7 +123,7 @@ function $e(t, e) {
|
|
|
108
123
|
function Ge(t, e) {
|
|
109
124
|
return new Date(t, e, 1).getDay();
|
|
110
125
|
}
|
|
111
|
-
function
|
|
126
|
+
function ue(t) {
|
|
112
127
|
if (typeof t == "string") return t;
|
|
113
128
|
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
129
|
return `${s}-${a}-${n}`;
|
|
@@ -122,52 +137,52 @@ function ee(t) {
|
|
|
122
137
|
}
|
|
123
138
|
return null;
|
|
124
139
|
}
|
|
125
|
-
function
|
|
140
|
+
function be(t, e) {
|
|
126
141
|
if (!t || !e) return !1;
|
|
127
142
|
const s = ee(t), a = ee(e);
|
|
128
143
|
return !s || !a ? !1 : s.getFullYear() === a.getFullYear() && s.getMonth() === a.getMonth() && s.getDate() === a.getDate();
|
|
129
144
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
145
|
+
function ge() {
|
|
146
|
+
return ue(/* @__PURE__ */ new Date());
|
|
132
147
|
}
|
|
133
148
|
function xe(t, e, s) {
|
|
134
149
|
const a = new Date(t, e + s, 1);
|
|
135
150
|
return { year: a.getFullYear(), month: a.getMonth() };
|
|
136
151
|
}
|
|
137
|
-
function
|
|
152
|
+
function me(t, e) {
|
|
138
153
|
const s = ee(t);
|
|
139
|
-
return s ? (s.setDate(s.getDate() + e),
|
|
154
|
+
return s ? (s.setDate(s.getDate() + e), ue(s)) : t;
|
|
140
155
|
}
|
|
141
|
-
function
|
|
142
|
-
const a = $e(t, e),
|
|
143
|
-
for (let k =
|
|
144
|
-
const u = g - k, p =
|
|
145
|
-
|
|
156
|
+
function Ze(t, e, s = 0) {
|
|
157
|
+
const a = $e(t, e), r = (Ge(t, e) - s + 7) % 7, l = [], i = ge(), d = xe(t, e, -1), g = $e(d.year, d.month);
|
|
158
|
+
for (let k = r - 1; k >= 0; k--) {
|
|
159
|
+
const u = g - k, p = ue({ year: d.year, month: d.month, day: u });
|
|
160
|
+
l.push({ year: d.year, month: d.month, day: u, dateString: p, isCurrentMonth: !1, isToday: p === i });
|
|
146
161
|
}
|
|
147
162
|
for (let k = 1; k <= a; k++) {
|
|
148
|
-
const u =
|
|
149
|
-
|
|
163
|
+
const u = ue({ year: t, month: e, day: k });
|
|
164
|
+
l.push({ year: t, month: e, day: k, dateString: u, isCurrentMonth: !0, isToday: u === i });
|
|
150
165
|
}
|
|
151
166
|
const c = xe(t, e, 1);
|
|
152
|
-
let
|
|
153
|
-
for (;
|
|
154
|
-
const k =
|
|
155
|
-
|
|
167
|
+
let h = 1;
|
|
168
|
+
for (; l.length < 42; ) {
|
|
169
|
+
const k = ue({ year: c.year, month: c.month, day: h });
|
|
170
|
+
l.push({ year: c.year, month: c.month, day: h, dateString: k, isCurrentMonth: !1, isToday: k === i }), h++;
|
|
156
171
|
}
|
|
157
|
-
return
|
|
172
|
+
return l;
|
|
158
173
|
}
|
|
159
|
-
function
|
|
174
|
+
function de(t) {
|
|
160
175
|
if (!t || typeof t != "string") return null;
|
|
161
176
|
const e = t.trim().toUpperCase(), s = e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);
|
|
162
177
|
if (s) {
|
|
163
178
|
let n = parseInt(s[1], 10);
|
|
164
|
-
const
|
|
165
|
-
return
|
|
179
|
+
const r = parseInt(s[2], 10), l = s[3];
|
|
180
|
+
return l === "AM" && n === 12 && (n = 0), l === "PM" && n !== 12 && (n += 12), { hours: n, minutes: r };
|
|
166
181
|
}
|
|
167
182
|
const a = e.match(/^(\d{1,2}):(\d{2})$/);
|
|
168
183
|
return a ? { hours: parseInt(a[1], 10), minutes: parseInt(a[2], 10) } : null;
|
|
169
184
|
}
|
|
170
|
-
function
|
|
185
|
+
function pe(t, e, s = "24h") {
|
|
171
186
|
const a = String(e).padStart(2, "0");
|
|
172
187
|
if (s === "12h") {
|
|
173
188
|
const n = t >= 12 ? "PM" : "AM";
|
|
@@ -175,8 +190,8 @@ function ge(t, e, s = "24h") {
|
|
|
175
190
|
}
|
|
176
191
|
return `${String(t).padStart(2, "0")}:${a}`;
|
|
177
192
|
}
|
|
178
|
-
function
|
|
179
|
-
const e =
|
|
193
|
+
function w(t) {
|
|
194
|
+
const e = de(t);
|
|
180
195
|
return e ? e.hours * 60 + e.minutes : 0;
|
|
181
196
|
}
|
|
182
197
|
function ce(t) {
|
|
@@ -184,120 +199,134 @@ function ce(t) {
|
|
|
184
199
|
return `${String(e).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
185
200
|
}
|
|
186
201
|
function Me(t, e, s) {
|
|
187
|
-
const a = [], n =
|
|
188
|
-
|
|
189
|
-
|
|
202
|
+
const a = [], n = w(t);
|
|
203
|
+
let r = w(e);
|
|
204
|
+
r <= n && (r += 1440);
|
|
205
|
+
for (let l = n; l <= r; l += s)
|
|
206
|
+
a.push(ce(l % 1440));
|
|
190
207
|
return a;
|
|
191
208
|
}
|
|
192
209
|
function Ye() {
|
|
193
210
|
const t = /* @__PURE__ */ new Date();
|
|
194
211
|
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
195
212
|
}
|
|
196
|
-
function
|
|
213
|
+
function Je(t, e = 0) {
|
|
197
214
|
const s = ee(t);
|
|
198
215
|
if (!s) return t;
|
|
199
216
|
const n = (s.getDay() - e + 7) % 7;
|
|
200
|
-
return s.setDate(s.getDate() - n),
|
|
217
|
+
return s.setDate(s.getDate() - n), ue(s);
|
|
201
218
|
}
|
|
202
219
|
function Te(t, e = 0) {
|
|
203
|
-
const s =
|
|
220
|
+
const s = Je(t, e), a = [];
|
|
204
221
|
for (let n = 0; n < 7; n++)
|
|
205
|
-
a.push(
|
|
222
|
+
a.push(me(s, n));
|
|
206
223
|
return a;
|
|
207
224
|
}
|
|
208
|
-
function
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
225
|
+
function Ke(t, e, s, a) {
|
|
226
|
+
const n = ee(e);
|
|
227
|
+
if (!n) return "";
|
|
228
|
+
const r = We(a);
|
|
211
229
|
if (t === "day")
|
|
212
|
-
return `${
|
|
230
|
+
return `${r[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`;
|
|
213
231
|
if (t === "week" && s && s.length === 7) {
|
|
214
|
-
const
|
|
215
|
-
return !
|
|
232
|
+
const l = ee(s[0]), i = ee(s[6]);
|
|
233
|
+
return !l || !i ? "" : l.getMonth() === i.getMonth() ? `${r[l.getMonth()]} ${l.getDate()}–${i.getDate()}, ${l.getFullYear()}` : l.getFullYear() === i.getFullYear() ? `${r[l.getMonth()].slice(0, 3)} ${l.getDate()} – ${r[i.getMonth()].slice(0, 3)} ${i.getDate()}, ${l.getFullYear()}` : `${r[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${l.getFullYear()} – ${r[i.getMonth()].slice(0, 3)} ${i.getDate()}, ${i.getFullYear()}`;
|
|
216
234
|
}
|
|
217
|
-
return t === "month" ? `${
|
|
235
|
+
return t === "month" ? `${r[n.getMonth()]} ${n.getFullYear()}` : "";
|
|
218
236
|
}
|
|
219
|
-
function
|
|
237
|
+
function fe(t, e) {
|
|
220
238
|
return t.filter((s) => s.start ? s.end && s.end !== s.start ? e >= s.start && e <= s.end : s.start === e : !1);
|
|
221
239
|
}
|
|
222
240
|
function ye(t) {
|
|
223
241
|
if (!t.length) return t;
|
|
224
242
|
const e = [...t].sort((a, n) => {
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
const i =
|
|
228
|
-
return
|
|
243
|
+
const r = w(a.startTime || "00:00"), l = w(n.startTime || "00:00");
|
|
244
|
+
if (r !== l) return r - l;
|
|
245
|
+
const i = w(a.endTime || "23:59");
|
|
246
|
+
return w(n.endTime || "23:59") - l - (i - r);
|
|
229
247
|
}), s = [];
|
|
230
248
|
for (const a of e) {
|
|
231
|
-
const n =
|
|
232
|
-
let
|
|
249
|
+
const n = w(a.startTime || "00:00"), r = w(a.endTime || "23:59");
|
|
250
|
+
let l = !1;
|
|
233
251
|
for (let i = 0; i < s.length; i++)
|
|
234
252
|
if (n >= s[i]) {
|
|
235
|
-
a._col = i, s[i] =
|
|
253
|
+
a._col = i, s[i] = r, l = !0;
|
|
236
254
|
break;
|
|
237
255
|
}
|
|
238
|
-
|
|
256
|
+
l || (a._col = s.length, s.push(r));
|
|
239
257
|
}
|
|
240
258
|
for (const a of e) {
|
|
241
|
-
const n =
|
|
242
|
-
let
|
|
259
|
+
const n = w(a.startTime || "00:00"), r = w(a.endTime || "23:59");
|
|
260
|
+
let l = a._col;
|
|
243
261
|
for (const i of e) {
|
|
244
|
-
const d =
|
|
245
|
-
d <
|
|
262
|
+
const d = w(i.startTime || "00:00"), g = w(i.endTime || "23:59");
|
|
263
|
+
d < r && g > n && (l = Math.max(l, i._col));
|
|
246
264
|
}
|
|
247
|
-
a._totalCols =
|
|
265
|
+
a._totalCols = l + 1;
|
|
248
266
|
}
|
|
249
267
|
return e;
|
|
250
268
|
}
|
|
251
269
|
function ie(t, e, s, a) {
|
|
252
|
-
return (
|
|
270
|
+
return (w(t) - w(e)) / a * s;
|
|
253
271
|
}
|
|
254
|
-
function
|
|
255
|
-
const n = t / s * a,
|
|
256
|
-
return ce(Math.round(
|
|
272
|
+
function Ae(t, e, s, a) {
|
|
273
|
+
const n = t / s * a, r = w(e) + n;
|
|
274
|
+
return ce(Math.round(r));
|
|
257
275
|
}
|
|
258
|
-
function
|
|
259
|
-
const s =
|
|
276
|
+
function Ie(t, e) {
|
|
277
|
+
const s = w(t), a = Math.round(s / e) * e;
|
|
260
278
|
return ce(a);
|
|
261
279
|
}
|
|
262
|
-
function
|
|
263
|
-
return
|
|
280
|
+
function Qe(t, e, s) {
|
|
281
|
+
return fe(t, s).filter(
|
|
264
282
|
(a) => a.resourceId === e
|
|
265
283
|
);
|
|
266
284
|
}
|
|
267
285
|
function Be(t, e, s, a, n) {
|
|
268
|
-
const
|
|
269
|
-
for (const d of
|
|
286
|
+
const r = Qe(t, e, s), l = w(a), i = w(n);
|
|
287
|
+
for (const d of r) {
|
|
270
288
|
if (!d.startTime || !d.endTime) continue;
|
|
271
|
-
const g =
|
|
272
|
-
if (
|
|
289
|
+
const g = w(d.startTime), c = w(d.endTime);
|
|
290
|
+
if (l < c && i > g)
|
|
273
291
|
return !1;
|
|
274
292
|
}
|
|
275
293
|
return !0;
|
|
276
294
|
}
|
|
277
|
-
function
|
|
278
|
-
const { duration:
|
|
279
|
-
let
|
|
280
|
-
i && (
|
|
295
|
+
function et(t, e, s, a, n = "08:00", r = "18:00") {
|
|
296
|
+
const { duration: l, resourceId: i, minCapacity: d } = t, g = t.date || ge(), c = 14;
|
|
297
|
+
let h = e;
|
|
298
|
+
i && (h = e.filter((p) => p.id === i)), d && (h = h.filter(
|
|
281
299
|
(p) => p.capacity && p.capacity >= d
|
|
282
300
|
));
|
|
283
|
-
const k =
|
|
301
|
+
const k = w(n), u = w(r);
|
|
284
302
|
for (let p = 0; p < c; p++) {
|
|
285
|
-
const
|
|
286
|
-
for (const
|
|
287
|
-
for (let m = k; m +
|
|
288
|
-
const
|
|
289
|
-
if (Be(s,
|
|
303
|
+
const f = me(g, p);
|
|
304
|
+
for (const o of h)
|
|
305
|
+
for (let m = k; m + l <= u; m += a) {
|
|
306
|
+
const _ = ce(m), C = ce(m + l);
|
|
307
|
+
if (Be(s, o.id, f, _, C))
|
|
290
308
|
return {
|
|
291
|
-
resourceId:
|
|
292
|
-
date:
|
|
293
|
-
startTime:
|
|
294
|
-
endTime:
|
|
309
|
+
resourceId: o.id,
|
|
310
|
+
date: f,
|
|
311
|
+
startTime: _,
|
|
312
|
+
endTime: C
|
|
295
313
|
};
|
|
296
314
|
}
|
|
297
315
|
}
|
|
298
316
|
return null;
|
|
299
317
|
}
|
|
300
|
-
|
|
318
|
+
function tt(t) {
|
|
319
|
+
if (!Array.isArray(t) || !t.length) return null;
|
|
320
|
+
const e = {};
|
|
321
|
+
for (const s of t)
|
|
322
|
+
!s.name || !s.bg || !s.fg || (e[s.name] = {
|
|
323
|
+
bg: s.bg,
|
|
324
|
+
fg: s.fg,
|
|
325
|
+
hover: s.hover || s.bg
|
|
326
|
+
});
|
|
327
|
+
return Object.keys(e).length ? e : null;
|
|
328
|
+
}
|
|
329
|
+
const at = `
|
|
301
330
|
:host {
|
|
302
331
|
/* Light theme (default) */
|
|
303
332
|
--cal-bg: 0 0% 100%;
|
|
@@ -465,7 +494,7 @@ const et = `
|
|
|
465
494
|
--cal-status-success-border: 152 40% 28%;
|
|
466
495
|
}
|
|
467
496
|
}
|
|
468
|
-
`,
|
|
497
|
+
`, st = `
|
|
469
498
|
:host {
|
|
470
499
|
display: inline-block;
|
|
471
500
|
font-family: inherit;
|
|
@@ -506,7 +535,7 @@ const et = `
|
|
|
506
535
|
[hidden] {
|
|
507
536
|
display: none !important;
|
|
508
537
|
}
|
|
509
|
-
`,
|
|
538
|
+
`, nt = `
|
|
510
539
|
@keyframes cal-fade-in {
|
|
511
540
|
from { opacity: 0; }
|
|
512
541
|
to { opacity: 1; }
|
|
@@ -570,29 +599,46 @@ const et = `
|
|
|
570
599
|
.cal-skeleton--rect {
|
|
571
600
|
border-radius: var(--cal-radius-sm);
|
|
572
601
|
}
|
|
573
|
-
`,
|
|
574
|
-
function
|
|
575
|
-
const r = document.createElement("div");
|
|
576
|
-
r.classList.add("cal-sched-nav");
|
|
602
|
+
`, lt = '<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>', rt = '<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>';
|
|
603
|
+
function it({ title: t, view: e, onPrev: s, onNext: a, onToday: n, onViewChange: r, locale: l }) {
|
|
577
604
|
const i = document.createElement("div");
|
|
578
|
-
i.classList.add("cal-sched-
|
|
579
|
-
const d = document.createElement("
|
|
580
|
-
d.classList.add("cal-sched-
|
|
605
|
+
i.classList.add("cal-sched-nav");
|
|
606
|
+
const d = document.createElement("div");
|
|
607
|
+
d.classList.add("cal-sched-nav__left");
|
|
581
608
|
const g = document.createElement("button");
|
|
582
|
-
g.classList.add("cal-sched-nav__btn"), g.innerHTML =
|
|
609
|
+
g.classList.add("cal-sched-nav__btn"), g.innerHTML = lt, g.setAttribute("aria-label", "Previous"), g.addEventListener("click", s);
|
|
583
610
|
const c = document.createElement("button");
|
|
584
|
-
c.classList.add("cal-sched-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
611
|
+
c.classList.add("cal-sched-nav__btn"), c.innerHTML = rt, c.setAttribute("aria-label", "Next"), c.addEventListener("click", a);
|
|
612
|
+
let h = "Today";
|
|
613
|
+
if (l)
|
|
614
|
+
try {
|
|
615
|
+
const _ = new Intl.RelativeTimeFormat(l, { numeric: "auto" }).formatToParts(0, "day").map((C) => C.value).join("");
|
|
616
|
+
h = _.charAt(0).toUpperCase() + _.slice(1);
|
|
617
|
+
} catch {
|
|
618
|
+
}
|
|
619
|
+
const k = document.createElement("button");
|
|
620
|
+
k.classList.add("cal-sched-nav__today"), k.textContent = h, k.addEventListener("click", n);
|
|
621
|
+
const u = document.createElement("span");
|
|
622
|
+
u.classList.add("cal-sched-nav__title"), u.setAttribute("aria-live", "polite"), u.textContent = t, d.appendChild(g), d.appendChild(c), d.appendChild(k), d.appendChild(u);
|
|
623
|
+
const p = document.createElement("div");
|
|
624
|
+
p.classList.add("cal-sched-nav__tabs");
|
|
625
|
+
const f = { day: "Day", week: "Week", month: "Month" };
|
|
626
|
+
if (l)
|
|
627
|
+
try {
|
|
628
|
+
const o = new Intl.DisplayNames(l, { type: "dateTimeField" });
|
|
629
|
+
for (const m of ["day", "week", "month"]) {
|
|
630
|
+
const _ = o.of(m);
|
|
631
|
+
_ && (f[m] = _.charAt(0).toUpperCase() + _.slice(1));
|
|
632
|
+
}
|
|
633
|
+
} catch {
|
|
634
|
+
}
|
|
635
|
+
for (const o of ["day", "week", "month"]) {
|
|
636
|
+
const m = document.createElement("button");
|
|
637
|
+
m.classList.add("cal-sched-nav__tab"), o === e && m.classList.add("cal-sched-nav__tab--active"), m.textContent = f[o], m.addEventListener("click", () => r(o)), p.appendChild(m);
|
|
638
|
+
}
|
|
639
|
+
return i.appendChild(d), i.appendChild(p), i;
|
|
594
640
|
}
|
|
595
|
-
const
|
|
641
|
+
const ct = `
|
|
596
642
|
.cal-sched-nav {
|
|
597
643
|
display: flex;
|
|
598
644
|
align-items: center;
|
|
@@ -681,23 +727,23 @@ const rt = `
|
|
|
681
727
|
color: hsl(var(--cal-accent-fg));
|
|
682
728
|
}
|
|
683
729
|
`;
|
|
684
|
-
function
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
for (let i = 0; i <
|
|
689
|
-
const d =
|
|
730
|
+
function je({ startTime: t, endTime: e, interval: s, slotHeight: a, format: n }) {
|
|
731
|
+
const r = document.createElement("div");
|
|
732
|
+
r.classList.add("cal-sched-time-axis");
|
|
733
|
+
const l = Me(t, e, s);
|
|
734
|
+
for (let i = 0; i < l.length; i++) {
|
|
735
|
+
const d = l[i], g = de(d);
|
|
690
736
|
if (!g) continue;
|
|
691
737
|
const c = document.createElement("div");
|
|
692
738
|
if (c.classList.add("cal-sched-time-axis__slot"), c.style.height = `${a}px`, g.minutes === 0) {
|
|
693
|
-
const
|
|
694
|
-
|
|
739
|
+
const h = document.createElement("span");
|
|
740
|
+
h.classList.add("cal-sched-time-axis__label"), h.textContent = pe(g.hours, g.minutes, n), c.appendChild(h);
|
|
695
741
|
}
|
|
696
|
-
|
|
742
|
+
r.appendChild(c);
|
|
697
743
|
}
|
|
698
|
-
return
|
|
744
|
+
return r;
|
|
699
745
|
}
|
|
700
|
-
const
|
|
746
|
+
const ot = `
|
|
701
747
|
.cal-sched-time-axis {
|
|
702
748
|
display: flex;
|
|
703
749
|
flex-direction: column;
|
|
@@ -723,28 +769,28 @@ const it = `
|
|
|
723
769
|
user-select: none;
|
|
724
770
|
}
|
|
725
771
|
`;
|
|
726
|
-
function
|
|
772
|
+
function dt({ resource: t, width: e }) {
|
|
727
773
|
const s = document.createElement("div");
|
|
728
774
|
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
775
|
const a = document.createElement("span");
|
|
730
776
|
a.classList.add("cal-sched-resource-header__dot");
|
|
731
777
|
const n = t.color || "blue";
|
|
732
778
|
a.style.background = `hsl(var(--cal-booking-${n}-fg))`, s.appendChild(a);
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
const
|
|
736
|
-
|
|
779
|
+
const r = document.createElement("span");
|
|
780
|
+
if (r.classList.add("cal-sched-resource-header__name"), r.textContent = t.name, s.appendChild(r), t.capacity) {
|
|
781
|
+
const l = document.createElement("span");
|
|
782
|
+
l.classList.add("cal-sched-resource-header__capacity"), l.textContent = t.capacity, l.setAttribute("title", `Capacity: ${t.capacity}`), s.appendChild(l);
|
|
737
783
|
}
|
|
738
784
|
return s;
|
|
739
785
|
}
|
|
740
|
-
function
|
|
786
|
+
function ht({ resources: t }) {
|
|
741
787
|
const e = document.createElement("div");
|
|
742
788
|
e.classList.add("cal-sched-resource-header-row");
|
|
743
789
|
for (const s of t)
|
|
744
|
-
e.appendChild(
|
|
790
|
+
e.appendChild(dt({ resource: s }));
|
|
745
791
|
return e;
|
|
746
792
|
}
|
|
747
|
-
const
|
|
793
|
+
const ut = `
|
|
748
794
|
.cal-sched-resource-header-row {
|
|
749
795
|
display: flex;
|
|
750
796
|
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
@@ -789,81 +835,81 @@ const ot = `
|
|
|
789
835
|
flex-shrink: 0;
|
|
790
836
|
}
|
|
791
837
|
`;
|
|
792
|
-
function we({ event: t, gridStartTime: e, slotHeight: s, interval: a, format: n, onClick:
|
|
838
|
+
function we({ event: t, gridStartTime: e, slotHeight: s, interval: a, format: n, onClick: r, eventContent: l, showTime: i = !0, resource: d, draggable: g }) {
|
|
793
839
|
const c = document.createElement("div");
|
|
794
840
|
c.classList.add("cal-sched-event"), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.dataset.eventId = t.id;
|
|
795
|
-
const
|
|
796
|
-
g && !
|
|
841
|
+
const h = !!t.locked;
|
|
842
|
+
g && !h && (c.dataset.draggable = "true"), h && c.classList.add("cal-sched-event--locked");
|
|
797
843
|
const k = t.color || "blue";
|
|
798
844
|
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),
|
|
800
|
-
if (c.style.top = `${u}px`, c.style.height = `${
|
|
801
|
-
const
|
|
802
|
-
c.style.left = `${t._col *
|
|
845
|
+
const u = ie(t.startTime, e, s, a), p = ie(t.endTime, e, s, a), f = Math.max(p - u, s * 0.5);
|
|
846
|
+
if (c.style.top = `${u}px`, c.style.height = `${f}px`, t._totalCols > 1) {
|
|
847
|
+
const o = 100 / t._totalCols;
|
|
848
|
+
c.style.left = `${t._col * o}%`, c.style.width = `${o}%`;
|
|
803
849
|
}
|
|
804
850
|
}
|
|
805
|
-
if (typeof
|
|
806
|
-
const u =
|
|
851
|
+
if (typeof l == "function") {
|
|
852
|
+
const u = l(t, d), p = document.createElement("div");
|
|
807
853
|
p.classList.add("cal-sched-event__custom"), u instanceof HTMLElement ? p.appendChild(u) : u != null && (p.textContent = String(u)), c.appendChild(p);
|
|
808
854
|
} else {
|
|
809
855
|
const u = document.createElement("div");
|
|
810
856
|
if (u.classList.add("cal-sched-event__title"), u.textContent = t.title || "", c.appendChild(u), i && t.startTime && t.endTime) {
|
|
811
857
|
const p = document.createElement("div");
|
|
812
858
|
p.classList.add("cal-sched-event__time");
|
|
813
|
-
const
|
|
814
|
-
|
|
859
|
+
const f = de(t.startTime), o = de(t.endTime);
|
|
860
|
+
f && o && (p.textContent = `${pe(f.hours, f.minutes, n)}–${pe(o.hours, o.minutes, n)}`), c.appendChild(p);
|
|
815
861
|
}
|
|
816
862
|
}
|
|
817
|
-
if (g && !
|
|
863
|
+
if (g && !h) {
|
|
818
864
|
const u = document.createElement("div");
|
|
819
865
|
u.classList.add("cal-sched-event__resize-handle"), c.appendChild(u);
|
|
820
866
|
}
|
|
821
|
-
return
|
|
867
|
+
return r && (c.addEventListener("click", (u) => {
|
|
822
868
|
if (c.dataset.wasDragged) {
|
|
823
869
|
delete c.dataset.wasDragged;
|
|
824
870
|
return;
|
|
825
871
|
}
|
|
826
|
-
u.stopPropagation(),
|
|
872
|
+
u.stopPropagation(), r(t);
|
|
827
873
|
}), c.addEventListener("keydown", (u) => {
|
|
828
|
-
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(),
|
|
874
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), r(t));
|
|
829
875
|
})), c;
|
|
830
876
|
}
|
|
831
|
-
function
|
|
877
|
+
function Ne({ event: t, onClick: e, eventContent: s, resource: a }) {
|
|
832
878
|
const n = document.createElement("div");
|
|
833
879
|
n.classList.add("cal-sched-allday-chip"), n.dataset.eventId = t.id;
|
|
834
|
-
const
|
|
835
|
-
if (n.style.setProperty("--ev-bg", `var(--cal-booking-${
|
|
836
|
-
const
|
|
837
|
-
|
|
880
|
+
const r = t.color || "blue";
|
|
881
|
+
if (n.style.setProperty("--ev-bg", `var(--cal-booking-${r}-bg)`), n.style.setProperty("--ev-fg", `var(--cal-booking-${r}-fg)`), typeof s == "function") {
|
|
882
|
+
const l = s(t, a);
|
|
883
|
+
l instanceof HTMLElement ? n.appendChild(l) : l != null && (n.textContent = String(l));
|
|
838
884
|
} else
|
|
839
885
|
n.textContent = t.title || "";
|
|
840
|
-
return e && n.addEventListener("click", (
|
|
841
|
-
|
|
886
|
+
return e && n.addEventListener("click", (l) => {
|
|
887
|
+
l.stopPropagation(), e(t);
|
|
842
888
|
}), n;
|
|
843
889
|
}
|
|
844
|
-
function
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
if (
|
|
890
|
+
function pt({ event: t, format: e, onClick: s, eventContent: a, resource: n }) {
|
|
891
|
+
const r = document.createElement("div");
|
|
892
|
+
r.classList.add("cal-sched-month-chip"), r.dataset.eventId = t.id;
|
|
893
|
+
const l = t.color || "blue";
|
|
894
|
+
if (r.style.setProperty("--ev-bg", `var(--cal-booking-${l}-bg)`), r.style.setProperty("--ev-fg", `var(--cal-booking-${l}-fg)`), typeof a == "function") {
|
|
849
895
|
const i = a(t, n);
|
|
850
|
-
i instanceof HTMLElement ?
|
|
896
|
+
i instanceof HTMLElement ? r.appendChild(i) : i != null && (r.textContent = String(i));
|
|
851
897
|
} else {
|
|
852
898
|
const i = document.createElement("span");
|
|
853
|
-
i.classList.add("cal-sched-month-chip__dot"), i.style.background = `hsl(var(--cal-booking-${
|
|
899
|
+
i.classList.add("cal-sched-month-chip__dot"), i.style.background = `hsl(var(--cal-booking-${l}-fg))`, r.appendChild(i);
|
|
854
900
|
const d = document.createElement("span");
|
|
855
901
|
if (d.classList.add("cal-sched-month-chip__text"), t.startTime) {
|
|
856
|
-
const g =
|
|
902
|
+
const g = de(t.startTime), c = g ? pe(g.hours, g.minutes, e) : t.startTime;
|
|
857
903
|
d.textContent = `${c} ${t.title || ""}`;
|
|
858
904
|
} else
|
|
859
905
|
d.textContent = t.title || "";
|
|
860
|
-
|
|
906
|
+
r.appendChild(d);
|
|
861
907
|
}
|
|
862
|
-
return s &&
|
|
908
|
+
return s && r.addEventListener("click", (i) => {
|
|
863
909
|
i.stopPropagation(), s(t);
|
|
864
|
-
}),
|
|
910
|
+
}), r;
|
|
865
911
|
}
|
|
866
|
-
const
|
|
912
|
+
const gt = `
|
|
867
913
|
.cal-sched-event {
|
|
868
914
|
position: absolute;
|
|
869
915
|
left: 2px;
|
|
@@ -980,13 +1026,13 @@ const ut = `
|
|
|
980
1026
|
text-overflow: ellipsis;
|
|
981
1027
|
}
|
|
982
1028
|
`;
|
|
983
|
-
function
|
|
984
|
-
const
|
|
985
|
-
|
|
1029
|
+
function ve({ date: t, startTime: e, endTime: s, resourceName: a, format: n, onCreate: r }) {
|
|
1030
|
+
const l = document.createElement("div");
|
|
1031
|
+
l.classList.add("cal-sched-slot-prompt", "cal-animate-fade");
|
|
986
1032
|
const i = document.createElement("div");
|
|
987
1033
|
if (i.classList.add("cal-sched-slot-prompt__info"), e && s) {
|
|
988
|
-
const g =
|
|
989
|
-
|
|
1034
|
+
const g = de(e), c = de(s), h = document.createElement("div");
|
|
1035
|
+
h.classList.add("cal-sched-slot-prompt__time"), g && c && (h.textContent = `${pe(g.hours, g.minutes, n)}–${pe(c.hours, c.minutes, n)}`), i.appendChild(h);
|
|
990
1036
|
} else {
|
|
991
1037
|
const g = document.createElement("div");
|
|
992
1038
|
g.classList.add("cal-sched-slot-prompt__time"), g.textContent = t, i.appendChild(g);
|
|
@@ -995,13 +1041,13 @@ function be({ date: t, startTime: e, endTime: s, resourceName: a, format: n, onC
|
|
|
995
1041
|
const g = document.createElement("div");
|
|
996
1042
|
g.classList.add("cal-sched-slot-prompt__resource"), g.textContent = a, i.appendChild(g);
|
|
997
1043
|
}
|
|
998
|
-
|
|
1044
|
+
l.appendChild(i);
|
|
999
1045
|
const d = document.createElement("button");
|
|
1000
1046
|
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(),
|
|
1002
|
-
}),
|
|
1047
|
+
g.stopPropagation(), r == null || r();
|
|
1048
|
+
}), l.appendChild(d), l.addEventListener("click", (g) => g.stopPropagation()), l;
|
|
1003
1049
|
}
|
|
1004
|
-
const
|
|
1050
|
+
const mt = `
|
|
1005
1051
|
.cal-sched-slot-prompt {
|
|
1006
1052
|
position: absolute;
|
|
1007
1053
|
z-index: 10;
|
|
@@ -1066,142 +1112,142 @@ const pt = `
|
|
|
1066
1112
|
box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
|
|
1067
1113
|
}
|
|
1068
1114
|
`;
|
|
1069
|
-
function
|
|
1115
|
+
function ft({
|
|
1070
1116
|
date: t,
|
|
1071
1117
|
resources: e,
|
|
1072
1118
|
events: s,
|
|
1073
1119
|
startTime: a,
|
|
1074
1120
|
endTime: n,
|
|
1075
|
-
interval:
|
|
1076
|
-
slotHeight:
|
|
1121
|
+
interval: r,
|
|
1122
|
+
slotHeight: l,
|
|
1077
1123
|
format: i,
|
|
1078
1124
|
layout: d,
|
|
1079
1125
|
resourceMode: g,
|
|
1080
1126
|
selectedSlot: c,
|
|
1081
|
-
eventContent:
|
|
1127
|
+
eventContent: h,
|
|
1082
1128
|
showTime: k = !0,
|
|
1083
1129
|
draggable: u,
|
|
1084
1130
|
onSlotClick: p,
|
|
1085
|
-
onEventClick:
|
|
1086
|
-
onSlotCreate:
|
|
1131
|
+
onEventClick: f,
|
|
1132
|
+
onSlotCreate: o
|
|
1087
1133
|
}) {
|
|
1088
1134
|
const m = document.createElement("div");
|
|
1089
1135
|
m.classList.add("cal-sched-day"), d === "horizontal" && m.classList.add("cal-sched-day--horizontal");
|
|
1090
|
-
const
|
|
1136
|
+
const _ = g === "tabs", C = e.length > 1 && !_, D = fe(s, t), F = D.filter((x) => !x.startTime || !x.endTime), X = D.filter((x) => x.startTime && x.endTime), Y = Me(a, n, r);
|
|
1091
1137
|
if (F.length > 0) {
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1138
|
+
const x = document.createElement("div");
|
|
1139
|
+
x.classList.add("cal-sched-day__allday");
|
|
1094
1140
|
const E = document.createElement("div");
|
|
1095
|
-
E.classList.add("cal-sched-day__allday-label"), E.textContent = "All day",
|
|
1141
|
+
E.classList.add("cal-sched-day__allday-label"), E.textContent = "All day", x.appendChild(E);
|
|
1096
1142
|
const Z = document.createElement("div");
|
|
1097
1143
|
Z.classList.add("cal-sched-day__allday-chips");
|
|
1098
|
-
for (const
|
|
1099
|
-
const M = e.find((
|
|
1100
|
-
Z.appendChild(
|
|
1101
|
-
event:
|
|
1102
|
-
onClick: (
|
|
1103
|
-
eventContent:
|
|
1144
|
+
for (const N of F) {
|
|
1145
|
+
const M = e.find((v) => v.id === N.resourceId);
|
|
1146
|
+
Z.appendChild(Ne({
|
|
1147
|
+
event: N,
|
|
1148
|
+
onClick: (v) => f == null ? void 0 : f(v, N.resourceId, M),
|
|
1149
|
+
eventContent: h,
|
|
1104
1150
|
resource: M
|
|
1105
1151
|
}));
|
|
1106
1152
|
}
|
|
1107
|
-
|
|
1153
|
+
x.appendChild(Z), m.appendChild(x);
|
|
1108
1154
|
}
|
|
1109
|
-
if (
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1155
|
+
if (C) {
|
|
1156
|
+
const x = document.createElement("div");
|
|
1157
|
+
x.classList.add("cal-sched-day__header");
|
|
1112
1158
|
const E = document.createElement("div");
|
|
1113
|
-
E.classList.add("cal-sched-day__header-spacer"),
|
|
1159
|
+
E.classList.add("cal-sched-day__header-spacer"), x.appendChild(E), x.appendChild(ht({ resources: e })), m.appendChild(x);
|
|
1114
1160
|
}
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1161
|
+
const j = document.createElement("div");
|
|
1162
|
+
j.classList.add("cal-sched-day__grid-area"), j.appendChild(je({ startTime: a, endTime: n, interval: r, slotHeight: l, format: i }));
|
|
1117
1163
|
const P = document.createElement("div");
|
|
1118
|
-
if (P.classList.add("cal-sched-day__lanes"),
|
|
1119
|
-
for (const
|
|
1164
|
+
if (P.classList.add("cal-sched-day__lanes"), C)
|
|
1165
|
+
for (const x of e) {
|
|
1120
1166
|
const E = document.createElement("div");
|
|
1121
|
-
E.classList.add("cal-sched-day__lane"), E.style.flex = "1 1 0", E.dataset.resourceId =
|
|
1167
|
+
E.classList.add("cal-sched-day__lane"), E.style.flex = "1 1 0", E.dataset.resourceId = x.id, E.dataset.date = t;
|
|
1122
1168
|
for (let M = 0; M < Y.length; M++) {
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1126
|
-
c && c.date === t && c.startTime === Y[M] && c.resourceId ===
|
|
1169
|
+
const v = document.createElement("div");
|
|
1170
|
+
v.classList.add("cal-sched-day__slot"), v.style.height = `${l}px`, v.dataset.time = Y[M], v.dataset.resourceId = x.id;
|
|
1171
|
+
const I = M < Y.length - 1 ? Y[M + 1] : n;
|
|
1172
|
+
c && c.date === t && c.startTime === Y[M] && c.resourceId === x.id && (v.classList.add("cal-sched-day__slot--selected"), v.appendChild(ve({
|
|
1127
1173
|
date: t,
|
|
1128
1174
|
startTime: Y[M],
|
|
1129
|
-
endTime:
|
|
1130
|
-
resourceName:
|
|
1175
|
+
endTime: I,
|
|
1176
|
+
resourceName: x.name,
|
|
1131
1177
|
format: i,
|
|
1132
|
-
onCreate: () =>
|
|
1133
|
-
}))),
|
|
1134
|
-
p == null || p(t, Y[M],
|
|
1135
|
-
}), E.appendChild(
|
|
1178
|
+
onCreate: () => o == null ? void 0 : o(t, Y[M], I, x.id, x)
|
|
1179
|
+
}))), v.addEventListener("click", () => {
|
|
1180
|
+
p == null || p(t, Y[M], I, x.id, x);
|
|
1181
|
+
}), E.appendChild(v);
|
|
1136
1182
|
}
|
|
1137
|
-
const Z = X.filter((M) => M.resourceId ===
|
|
1138
|
-
for (const M of
|
|
1183
|
+
const Z = X.filter((M) => M.resourceId === x.id), N = ye(Z);
|
|
1184
|
+
for (const M of N)
|
|
1139
1185
|
E.appendChild(we({
|
|
1140
1186
|
event: M,
|
|
1141
1187
|
gridStartTime: a,
|
|
1142
|
-
slotHeight:
|
|
1143
|
-
interval:
|
|
1188
|
+
slotHeight: l,
|
|
1189
|
+
interval: r,
|
|
1144
1190
|
format: i,
|
|
1145
|
-
onClick: (
|
|
1146
|
-
eventContent:
|
|
1191
|
+
onClick: (v) => f == null ? void 0 : f(v, x.id, x),
|
|
1192
|
+
eventContent: h,
|
|
1147
1193
|
showTime: k,
|
|
1148
|
-
resource:
|
|
1194
|
+
resource: x,
|
|
1149
1195
|
draggable: u
|
|
1150
1196
|
}));
|
|
1151
1197
|
P.appendChild(E);
|
|
1152
1198
|
}
|
|
1153
1199
|
else {
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1200
|
+
const x = document.createElement("div");
|
|
1201
|
+
x.classList.add("cal-sched-day__lane"), x.style.flex = "1 1 0", x.dataset.date = t;
|
|
1156
1202
|
const E = e.length === 1 ? e[0] : null;
|
|
1157
|
-
E && (
|
|
1158
|
-
for (let
|
|
1203
|
+
E && (x.dataset.resourceId = E.id);
|
|
1204
|
+
for (let N = 0; N < Y.length; N++) {
|
|
1159
1205
|
const M = document.createElement("div");
|
|
1160
|
-
M.classList.add("cal-sched-day__slot"), M.style.height = `${
|
|
1161
|
-
const
|
|
1162
|
-
c && c.date === t && c.startTime === Y[
|
|
1206
|
+
M.classList.add("cal-sched-day__slot"), M.style.height = `${l}px`, M.dataset.time = Y[N];
|
|
1207
|
+
const v = N < Y.length - 1 ? Y[N + 1] : n, I = (E == null ? void 0 : E.id) || null;
|
|
1208
|
+
c && c.date === t && c.startTime === Y[N] && (c.resourceId === I || !c.resourceId && !I) && (M.classList.add("cal-sched-day__slot--selected"), M.appendChild(ve({
|
|
1163
1209
|
date: t,
|
|
1164
|
-
startTime: Y[
|
|
1165
|
-
endTime:
|
|
1210
|
+
startTime: Y[N],
|
|
1211
|
+
endTime: v,
|
|
1166
1212
|
resourceName: (E == null ? void 0 : E.name) || null,
|
|
1167
1213
|
format: i,
|
|
1168
|
-
onCreate: () =>
|
|
1214
|
+
onCreate: () => o == null ? void 0 : o(t, Y[N], v, I, E)
|
|
1169
1215
|
}))), M.addEventListener("click", () => {
|
|
1170
|
-
p == null || p(t, Y[
|
|
1171
|
-
}),
|
|
1216
|
+
p == null || p(t, Y[N], v, I, E);
|
|
1217
|
+
}), x.appendChild(M);
|
|
1172
1218
|
}
|
|
1173
1219
|
const Z = ye(X);
|
|
1174
|
-
for (const
|
|
1175
|
-
const M = e.find((
|
|
1176
|
-
|
|
1177
|
-
event:
|
|
1220
|
+
for (const N of Z) {
|
|
1221
|
+
const M = e.find((v) => v.id === N.resourceId) || e[0];
|
|
1222
|
+
x.appendChild(we({
|
|
1223
|
+
event: N,
|
|
1178
1224
|
gridStartTime: a,
|
|
1179
|
-
slotHeight:
|
|
1180
|
-
interval:
|
|
1225
|
+
slotHeight: l,
|
|
1226
|
+
interval: r,
|
|
1181
1227
|
format: i,
|
|
1182
|
-
onClick: (
|
|
1183
|
-
eventContent:
|
|
1228
|
+
onClick: (v) => f == null ? void 0 : f(v, N.resourceId, M),
|
|
1229
|
+
eventContent: h,
|
|
1184
1230
|
showTime: k,
|
|
1185
1231
|
resource: M,
|
|
1186
1232
|
draggable: u
|
|
1187
1233
|
}));
|
|
1188
1234
|
}
|
|
1189
|
-
P.appendChild(
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
const H =
|
|
1193
|
-
if (
|
|
1194
|
-
const
|
|
1195
|
-
if (E >= Z && E <=
|
|
1196
|
-
const M = ie(
|
|
1197
|
-
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1235
|
+
P.appendChild(x);
|
|
1236
|
+
}
|
|
1237
|
+
j.appendChild(P);
|
|
1238
|
+
const H = ge();
|
|
1239
|
+
if (be(t, H)) {
|
|
1240
|
+
const x = Ye(), E = w(x), Z = w(a), N = w(n);
|
|
1241
|
+
if (E >= Z && E <= N) {
|
|
1242
|
+
const M = ie(x, a, l, r), v = document.createElement("div");
|
|
1243
|
+
v.classList.add("cal-sched-now-line"), v.style.top = `${M}px`;
|
|
1244
|
+
const I = document.createElement("div");
|
|
1245
|
+
I.classList.add("cal-sched-now-line__dot"), v.appendChild(I), P.appendChild(v);
|
|
1200
1246
|
}
|
|
1201
1247
|
}
|
|
1202
|
-
return m.appendChild(
|
|
1248
|
+
return m.appendChild(j), m;
|
|
1203
1249
|
}
|
|
1204
|
-
const
|
|
1250
|
+
const vt = `
|
|
1205
1251
|
.cal-sched-day {
|
|
1206
1252
|
display: flex;
|
|
1207
1253
|
flex-direction: column;
|
|
@@ -1341,208 +1387,208 @@ const mt = `
|
|
|
1341
1387
|
padding: 4px 0;
|
|
1342
1388
|
}
|
|
1343
1389
|
`, Le = 3, Ce = 5;
|
|
1344
|
-
function
|
|
1390
|
+
function bt({
|
|
1345
1391
|
date: t,
|
|
1346
1392
|
firstDay: e,
|
|
1347
1393
|
resources: s,
|
|
1348
1394
|
events: a,
|
|
1349
1395
|
startTime: n,
|
|
1350
|
-
endTime:
|
|
1351
|
-
interval:
|
|
1396
|
+
endTime: r,
|
|
1397
|
+
interval: l,
|
|
1352
1398
|
slotHeight: i,
|
|
1353
1399
|
format: d,
|
|
1354
1400
|
layout: g,
|
|
1355
1401
|
resourceMode: c,
|
|
1356
|
-
selectedSlot:
|
|
1402
|
+
selectedSlot: h,
|
|
1357
1403
|
eventContent: k,
|
|
1358
1404
|
showTime: u = !0,
|
|
1359
1405
|
draggable: p,
|
|
1360
|
-
allDayCollapsed:
|
|
1361
|
-
onToggleAllDay:
|
|
1406
|
+
allDayCollapsed: f,
|
|
1407
|
+
onToggleAllDay: o,
|
|
1362
1408
|
onSlotClick: m,
|
|
1363
|
-
onEventClick:
|
|
1364
|
-
onSlotCreate:
|
|
1409
|
+
onEventClick: _,
|
|
1410
|
+
onSlotCreate: C
|
|
1365
1411
|
}) {
|
|
1366
1412
|
const D = document.createElement("div");
|
|
1367
1413
|
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,
|
|
1369
|
-
for (const
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1414
|
+
const F = Te(t, e), X = c === "tabs", Y = s.length > 1 && !X, j = Me(n, r, l), P = ge(), H = {};
|
|
1415
|
+
for (const v of F) {
|
|
1416
|
+
const I = fe(a, v).filter((W) => !W.startTime || !W.endTime);
|
|
1417
|
+
I.length && (H[v] = I);
|
|
1372
1418
|
}
|
|
1373
1419
|
if (Object.keys(H).length > 0) {
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1420
|
+
const v = document.createElement("div");
|
|
1421
|
+
v.classList.add("cal-sched-week__allday"), f && v.classList.add("cal-sched-week__allday--collapsed");
|
|
1422
|
+
const I = document.createElement("div");
|
|
1423
|
+
I.classList.add("cal-sched-week__allday-spacer");
|
|
1378
1424
|
const W = document.createElement("span");
|
|
1379
|
-
W.textContent = "All day",
|
|
1425
|
+
W.textContent = "All day", I.appendChild(W);
|
|
1380
1426
|
const $ = document.createElement("button");
|
|
1381
|
-
$.classList.add("cal-sched-week__allday-toggle"), $.setAttribute("aria-label",
|
|
1382
|
-
R.stopPropagation(),
|
|
1383
|
-
}),
|
|
1427
|
+
$.classList.add("cal-sched-week__allday-toggle"), $.setAttribute("aria-label", f ? "Expand all-day events" : "Collapse all-day events"), $.innerHTML = f ? '<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) => {
|
|
1428
|
+
R.stopPropagation(), o == null || o();
|
|
1429
|
+
}), I.appendChild($), v.appendChild(I);
|
|
1384
1430
|
for (const R of F) {
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
const
|
|
1388
|
-
if (
|
|
1389
|
-
if (
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
const
|
|
1393
|
-
for (const
|
|
1431
|
+
const G = document.createElement("div");
|
|
1432
|
+
G.classList.add("cal-sched-week__allday-cell");
|
|
1433
|
+
const A = H[R] || [];
|
|
1434
|
+
if (f) {
|
|
1435
|
+
if (A.length > 0) {
|
|
1436
|
+
const T = document.createElement("div");
|
|
1437
|
+
T.classList.add("cal-sched-week__allday-dots");
|
|
1438
|
+
const z = A.slice(0, Ce);
|
|
1439
|
+
for (const U of z) {
|
|
1394
1440
|
const le = document.createElement("span");
|
|
1395
1441
|
le.classList.add("cal-sched-week__allday-dot");
|
|
1396
|
-
const ke =
|
|
1397
|
-
le.style.background = `hsl(var(--cal-booking-${ke}-fg))`,
|
|
1442
|
+
const ke = U.color || "blue";
|
|
1443
|
+
le.style.background = `hsl(var(--cal-booking-${ke}-fg))`, T.appendChild(le);
|
|
1398
1444
|
}
|
|
1399
|
-
if (
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1445
|
+
if (A.length > Ce) {
|
|
1446
|
+
const U = document.createElement("span");
|
|
1447
|
+
U.classList.add("cal-sched-week__allday-overflow"), U.textContent = `+${A.length - Ce}`, T.appendChild(U);
|
|
1402
1448
|
}
|
|
1403
|
-
|
|
1449
|
+
G.appendChild(T);
|
|
1404
1450
|
}
|
|
1405
1451
|
} else {
|
|
1406
|
-
const
|
|
1407
|
-
for (const
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
event:
|
|
1411
|
-
onClick: (le) =>
|
|
1452
|
+
const T = A.slice(0, Le);
|
|
1453
|
+
for (const z of T) {
|
|
1454
|
+
const U = s.find((le) => le.id === z.resourceId);
|
|
1455
|
+
G.appendChild(Ne({
|
|
1456
|
+
event: z,
|
|
1457
|
+
onClick: (le) => _ == null ? void 0 : _(le, z.resourceId, U),
|
|
1412
1458
|
eventContent: k,
|
|
1413
|
-
resource:
|
|
1459
|
+
resource: U
|
|
1414
1460
|
}));
|
|
1415
1461
|
}
|
|
1416
|
-
if (
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1462
|
+
if (A.length > Le) {
|
|
1463
|
+
const z = document.createElement("span");
|
|
1464
|
+
z.classList.add("cal-sched-week__allday-overflow"), z.textContent = `+${A.length - Le}`, G.appendChild(z);
|
|
1419
1465
|
}
|
|
1420
1466
|
}
|
|
1421
|
-
|
|
1467
|
+
v.appendChild(G);
|
|
1422
1468
|
}
|
|
1423
|
-
D.appendChild(
|
|
1469
|
+
D.appendChild(v);
|
|
1424
1470
|
}
|
|
1425
1471
|
const E = document.createElement("div");
|
|
1426
1472
|
E.classList.add("cal-sched-week__header");
|
|
1427
1473
|
const Z = document.createElement("div");
|
|
1428
1474
|
Z.classList.add("cal-sched-week__header-spacer"), E.appendChild(Z);
|
|
1429
|
-
for (const
|
|
1430
|
-
const
|
|
1431
|
-
W.classList.add("cal-sched-week__day-header"),
|
|
1475
|
+
for (const v of F) {
|
|
1476
|
+
const I = ee(v), W = document.createElement("div");
|
|
1477
|
+
W.classList.add("cal-sched-week__day-header"), be(v, P) && W.classList.add("cal-sched-week__day-header--today");
|
|
1432
1478
|
const $ = document.createElement("span");
|
|
1433
|
-
$.classList.add("cal-sched-week__day-name"), $.textContent = He(
|
|
1479
|
+
$.classList.add("cal-sched-week__day-name"), $.textContent = He(v);
|
|
1434
1480
|
const R = document.createElement("span");
|
|
1435
|
-
if (R.classList.add("cal-sched-week__day-num"),
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
for (const
|
|
1439
|
-
const
|
|
1440
|
-
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1481
|
+
if (R.classList.add("cal-sched-week__day-num"), be(v, P) && R.classList.add("cal-sched-week__day-num--today"), R.textContent = I ? I.getDate() : "", W.appendChild($), W.appendChild(R), Y) {
|
|
1482
|
+
const G = document.createElement("div");
|
|
1483
|
+
G.classList.add("cal-sched-week__res-row");
|
|
1484
|
+
for (const A of s) {
|
|
1485
|
+
const T = document.createElement("span");
|
|
1486
|
+
T.classList.add("cal-sched-week__res-label");
|
|
1487
|
+
const z = document.createElement("span");
|
|
1488
|
+
z.classList.add("cal-sched-week__res-dot"), z.style.background = `hsl(var(--cal-booking-${A.color || "blue"}-fg))`, T.appendChild(z), T.appendChild(document.createTextNode(A.name)), G.appendChild(T);
|
|
1443
1489
|
}
|
|
1444
|
-
W.appendChild(
|
|
1490
|
+
W.appendChild(G);
|
|
1445
1491
|
}
|
|
1446
1492
|
E.appendChild(W);
|
|
1447
1493
|
}
|
|
1448
1494
|
D.appendChild(E);
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1495
|
+
const N = document.createElement("div");
|
|
1496
|
+
N.classList.add("cal-sched-week__grid-area"), N.appendChild(je({ startTime: n, endTime: r, interval: l, slotHeight: i, format: d }));
|
|
1451
1497
|
const M = document.createElement("div");
|
|
1452
1498
|
M.classList.add("cal-sched-week__cols");
|
|
1453
|
-
for (const
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1456
|
-
const W =
|
|
1499
|
+
for (const v of F) {
|
|
1500
|
+
const I = document.createElement("div");
|
|
1501
|
+
I.classList.add("cal-sched-week__day-col"), I.dataset.date = v, be(v, P) && I.classList.add("cal-sched-week__day-col--today");
|
|
1502
|
+
const W = fe(a, v).filter(($) => $.startTime && $.endTime);
|
|
1457
1503
|
if (Y)
|
|
1458
1504
|
for (const $ of s) {
|
|
1459
1505
|
const R = document.createElement("div");
|
|
1460
1506
|
R.classList.add("cal-sched-week__lane"), R.dataset.resourceId = $.id;
|
|
1461
|
-
for (let
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
date:
|
|
1467
|
-
startTime:
|
|
1468
|
-
endTime:
|
|
1507
|
+
for (let T = 0; T < j.length; T++) {
|
|
1508
|
+
const z = document.createElement("div");
|
|
1509
|
+
z.classList.add("cal-sched-week__slot"), z.style.height = `${i}px`, z.dataset.time = j[T];
|
|
1510
|
+
const U = T < j.length - 1 ? j[T + 1] : r;
|
|
1511
|
+
h && h.date === v && h.startTime === j[T] && h.resourceId === $.id && (z.classList.add("cal-sched-week__slot--selected"), z.appendChild(ve({
|
|
1512
|
+
date: v,
|
|
1513
|
+
startTime: j[T],
|
|
1514
|
+
endTime: U,
|
|
1469
1515
|
resourceName: $.name,
|
|
1470
1516
|
format: d,
|
|
1471
|
-
onCreate: () =>
|
|
1472
|
-
}))),
|
|
1473
|
-
m == null || m(
|
|
1474
|
-
}), R.appendChild(
|
|
1517
|
+
onCreate: () => C == null ? void 0 : C(v, j[T], U, $.id, $)
|
|
1518
|
+
}))), z.addEventListener("click", () => {
|
|
1519
|
+
m == null || m(v, j[T], U, $.id, $);
|
|
1520
|
+
}), R.appendChild(z);
|
|
1475
1521
|
}
|
|
1476
|
-
const
|
|
1477
|
-
for (const
|
|
1522
|
+
const G = W.filter((T) => T.resourceId === $.id), A = ye(G);
|
|
1523
|
+
for (const T of A)
|
|
1478
1524
|
R.appendChild(we({
|
|
1479
|
-
event:
|
|
1525
|
+
event: T,
|
|
1480
1526
|
gridStartTime: n,
|
|
1481
1527
|
slotHeight: i,
|
|
1482
|
-
interval:
|
|
1528
|
+
interval: l,
|
|
1483
1529
|
format: d,
|
|
1484
|
-
onClick: (
|
|
1530
|
+
onClick: (z) => _ == null ? void 0 : _(z, $.id, $),
|
|
1485
1531
|
eventContent: k,
|
|
1486
1532
|
showTime: u,
|
|
1487
1533
|
resource: $,
|
|
1488
1534
|
draggable: p
|
|
1489
1535
|
}));
|
|
1490
|
-
|
|
1536
|
+
I.appendChild(R);
|
|
1491
1537
|
}
|
|
1492
1538
|
else {
|
|
1493
1539
|
const $ = document.createElement("div");
|
|
1494
1540
|
$.classList.add("cal-sched-week__lane", "cal-sched-week__lane--full");
|
|
1495
1541
|
const R = s.length === 1 ? s[0] : null;
|
|
1496
1542
|
R && ($.dataset.resourceId = R.id);
|
|
1497
|
-
for (let
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
date:
|
|
1503
|
-
startTime:
|
|
1504
|
-
endTime:
|
|
1543
|
+
for (let A = 0; A < j.length; A++) {
|
|
1544
|
+
const T = document.createElement("div");
|
|
1545
|
+
T.classList.add("cal-sched-week__slot"), T.style.height = `${i}px`, T.dataset.time = j[A];
|
|
1546
|
+
const z = A < j.length - 1 ? j[A + 1] : r, U = (R == null ? void 0 : R.id) || null;
|
|
1547
|
+
h && h.date === v && h.startTime === j[A] && (h.resourceId === U || !h.resourceId && !U) && (T.classList.add("cal-sched-week__slot--selected"), T.appendChild(ve({
|
|
1548
|
+
date: v,
|
|
1549
|
+
startTime: j[A],
|
|
1550
|
+
endTime: z,
|
|
1505
1551
|
resourceName: (R == null ? void 0 : R.name) || null,
|
|
1506
1552
|
format: d,
|
|
1507
|
-
onCreate: () =>
|
|
1508
|
-
}))),
|
|
1509
|
-
m == null || m(
|
|
1510
|
-
}), $.appendChild(
|
|
1553
|
+
onCreate: () => C == null ? void 0 : C(v, j[A], z, U, R)
|
|
1554
|
+
}))), T.addEventListener("click", () => {
|
|
1555
|
+
m == null || m(v, j[A], z, U, R);
|
|
1556
|
+
}), $.appendChild(T);
|
|
1511
1557
|
}
|
|
1512
|
-
const
|
|
1513
|
-
for (const
|
|
1514
|
-
const
|
|
1558
|
+
const G = ye(W);
|
|
1559
|
+
for (const A of G) {
|
|
1560
|
+
const T = s.find((z) => z.id === A.resourceId) || s[0];
|
|
1515
1561
|
$.appendChild(we({
|
|
1516
|
-
event:
|
|
1562
|
+
event: A,
|
|
1517
1563
|
gridStartTime: n,
|
|
1518
1564
|
slotHeight: i,
|
|
1519
|
-
interval:
|
|
1565
|
+
interval: l,
|
|
1520
1566
|
format: d,
|
|
1521
|
-
onClick: (
|
|
1567
|
+
onClick: (z) => _ == null ? void 0 : _(z, A.resourceId, T),
|
|
1522
1568
|
eventContent: k,
|
|
1523
1569
|
showTime: u,
|
|
1524
|
-
resource:
|
|
1570
|
+
resource: T,
|
|
1525
1571
|
draggable: p
|
|
1526
1572
|
}));
|
|
1527
1573
|
}
|
|
1528
|
-
|
|
1574
|
+
I.appendChild($);
|
|
1529
1575
|
}
|
|
1530
|
-
M.appendChild(
|
|
1576
|
+
M.appendChild(I);
|
|
1531
1577
|
}
|
|
1532
1578
|
if (F.includes(P)) {
|
|
1533
|
-
const
|
|
1534
|
-
if (
|
|
1535
|
-
const R = F.indexOf(P),
|
|
1536
|
-
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1579
|
+
const v = Ye(), I = w(v), W = w(n), $ = w(r);
|
|
1580
|
+
if (I >= W && I <= $) {
|
|
1581
|
+
const R = F.indexOf(P), G = ie(v, n, i, l), A = document.createElement("div");
|
|
1582
|
+
A.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), A.style.top = `${G}px`;
|
|
1583
|
+
const T = 100 / 7;
|
|
1584
|
+
A.style.left = `${R * T}%`, A.style.width = `${T}%`;
|
|
1585
|
+
const z = document.createElement("div");
|
|
1586
|
+
z.classList.add("cal-sched-now-line__dot"), A.appendChild(z), M.appendChild(A);
|
|
1541
1587
|
}
|
|
1542
1588
|
}
|
|
1543
|
-
return
|
|
1589
|
+
return N.appendChild(M), D.appendChild(N), D;
|
|
1544
1590
|
}
|
|
1545
|
-
const
|
|
1591
|
+
const _t = `
|
|
1546
1592
|
.cal-sched-week {
|
|
1547
1593
|
display: flex;
|
|
1548
1594
|
flex-direction: column;
|
|
@@ -1760,75 +1806,75 @@ const vt = `
|
|
|
1760
1806
|
z-index: 5;
|
|
1761
1807
|
pointer-events: none;
|
|
1762
1808
|
}
|
|
1763
|
-
`,
|
|
1764
|
-
function
|
|
1809
|
+
`, ze = 3;
|
|
1810
|
+
function xt({
|
|
1765
1811
|
date: t,
|
|
1766
1812
|
firstDay: e,
|
|
1767
1813
|
resources: s,
|
|
1768
1814
|
events: a,
|
|
1769
1815
|
format: n,
|
|
1770
|
-
selectedResourceId:
|
|
1771
|
-
selectedDate:
|
|
1816
|
+
selectedResourceId: r,
|
|
1817
|
+
selectedDate: l,
|
|
1772
1818
|
eventContent: i,
|
|
1773
1819
|
onSlotClick: d,
|
|
1774
1820
|
onEventClick: g,
|
|
1775
1821
|
onSlotCreate: c
|
|
1776
1822
|
}) {
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1823
|
+
const h = document.createElement("div");
|
|
1824
|
+
h.classList.add("cal-sched-month");
|
|
1779
1825
|
const k = ee(t);
|
|
1780
|
-
if (!k) return
|
|
1826
|
+
if (!k) return h;
|
|
1781
1827
|
const u = k.getFullYear(), p = k.getMonth();
|
|
1782
|
-
|
|
1783
|
-
const
|
|
1784
|
-
|
|
1785
|
-
const
|
|
1786
|
-
for (const
|
|
1828
|
+
ge();
|
|
1829
|
+
const f = document.createElement("div");
|
|
1830
|
+
f.classList.add("cal-sched-month__weekdays");
|
|
1831
|
+
const o = Ue(e);
|
|
1832
|
+
for (const C of o) {
|
|
1787
1833
|
const D = document.createElement("div");
|
|
1788
|
-
D.classList.add("cal-sched-month__weekday"), D.textContent =
|
|
1834
|
+
D.classList.add("cal-sched-month__weekday"), D.textContent = C, f.appendChild(D);
|
|
1789
1835
|
}
|
|
1790
|
-
|
|
1836
|
+
h.appendChild(f);
|
|
1791
1837
|
const m = document.createElement("div");
|
|
1792
1838
|
m.classList.add("cal-sched-month__grid");
|
|
1793
|
-
const
|
|
1794
|
-
for (const
|
|
1839
|
+
const _ = Ze(u, p, e);
|
|
1840
|
+
for (const C of _) {
|
|
1795
1841
|
const D = document.createElement("div");
|
|
1796
|
-
D.classList.add("cal-sched-month__cell"),
|
|
1797
|
-
H.target.closest(".cal-sched-month-chip") || d == null || d(
|
|
1842
|
+
D.classList.add("cal-sched-month__cell"), C.isCurrentMonth || D.classList.add("cal-sched-month__cell--outside"), C.isToday && D.classList.add("cal-sched-month__cell--today"), l && C.dateString === l && D.classList.add("cal-sched-month__cell--selected"), D.addEventListener("click", (H) => {
|
|
1843
|
+
H.target.closest(".cal-sched-month-chip") || d == null || d(C.dateString);
|
|
1798
1844
|
});
|
|
1799
1845
|
const F = document.createElement("div");
|
|
1800
|
-
F.classList.add("cal-sched-month__day-num"),
|
|
1801
|
-
let X =
|
|
1802
|
-
|
|
1846
|
+
F.classList.add("cal-sched-month__day-num"), C.isToday && F.classList.add("cal-sched-month__day-num--today"), F.textContent = C.day, D.appendChild(F);
|
|
1847
|
+
let X = fe(a, C.dateString);
|
|
1848
|
+
r && (X = X.filter((H) => H.resourceId === r)), X.sort((H, x) => H.startTime && !x.startTime ? -1 : !H.startTime && x.startTime ? 1 : H.startTime && x.startTime ? H.startTime.localeCompare(x.startTime) : 0);
|
|
1803
1849
|
const Y = document.createElement("div");
|
|
1804
1850
|
Y.classList.add("cal-sched-month__events");
|
|
1805
|
-
const
|
|
1806
|
-
for (const H of
|
|
1807
|
-
const
|
|
1808
|
-
Y.appendChild(
|
|
1851
|
+
const j = X.slice(0, ze), P = X.length - ze;
|
|
1852
|
+
for (const H of j) {
|
|
1853
|
+
const x = s.find((E) => E.id === H.resourceId);
|
|
1854
|
+
Y.appendChild(pt({
|
|
1809
1855
|
event: H,
|
|
1810
1856
|
format: n,
|
|
1811
|
-
onClick: (E) => g == null ? void 0 : g(E, H.resourceId,
|
|
1857
|
+
onClick: (E) => g == null ? void 0 : g(E, H.resourceId, x),
|
|
1812
1858
|
eventContent: i,
|
|
1813
|
-
resource:
|
|
1859
|
+
resource: x
|
|
1814
1860
|
}));
|
|
1815
1861
|
}
|
|
1816
1862
|
if (P > 0) {
|
|
1817
1863
|
const H = document.createElement("div");
|
|
1818
1864
|
H.classList.add("cal-sched-month__more"), H.textContent = `+${P} more`, Y.appendChild(H);
|
|
1819
1865
|
}
|
|
1820
|
-
D.appendChild(Y),
|
|
1821
|
-
date:
|
|
1866
|
+
D.appendChild(Y), l && C.dateString === l && (D.style.position = "relative", D.appendChild(ve({
|
|
1867
|
+
date: C.dateString,
|
|
1822
1868
|
startTime: null,
|
|
1823
1869
|
endTime: null,
|
|
1824
1870
|
resourceName: null,
|
|
1825
1871
|
format: n,
|
|
1826
|
-
onCreate: () => c == null ? void 0 : c(
|
|
1872
|
+
onCreate: () => c == null ? void 0 : c(C.dateString)
|
|
1827
1873
|
}))), m.appendChild(D);
|
|
1828
1874
|
}
|
|
1829
|
-
return
|
|
1875
|
+
return h.appendChild(m), h;
|
|
1830
1876
|
}
|
|
1831
|
-
const
|
|
1877
|
+
const yt = `
|
|
1832
1878
|
.cal-sched-month {
|
|
1833
1879
|
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1834
1880
|
border-radius: var(--cal-radius);
|
|
@@ -1913,38 +1959,38 @@ const _t = `
|
|
|
1913
1959
|
color: hsl(var(--cal-fg));
|
|
1914
1960
|
}
|
|
1915
1961
|
`;
|
|
1916
|
-
function
|
|
1962
|
+
function wt({ columns: t = 3, rows: e = 10, slotHeight: s = 48 } = {}) {
|
|
1917
1963
|
const a = document.createElement("div");
|
|
1918
1964
|
a.setAttribute("role", "status"), a.setAttribute("aria-label", "Loading..."), a.classList.add("cal-sched-skeleton-grid");
|
|
1919
1965
|
const n = document.createElement("div");
|
|
1920
1966
|
n.classList.add("cal-sched-skeleton-grid__header");
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1967
|
+
const r = document.createElement("div");
|
|
1968
|
+
r.classList.add("cal-sched-skeleton-grid__spacer"), n.appendChild(r);
|
|
1923
1969
|
for (let i = 0; i < t; i++) {
|
|
1924
1970
|
const d = document.createElement("div");
|
|
1925
1971
|
d.classList.add("cal-skeleton", "cal-sched-skeleton-grid__col-header"), n.appendChild(d);
|
|
1926
1972
|
}
|
|
1927
1973
|
a.appendChild(n);
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1974
|
+
const l = document.createElement("div");
|
|
1975
|
+
l.classList.add("cal-sched-skeleton-grid__body");
|
|
1930
1976
|
for (let i = 0; i < e; i++) {
|
|
1931
1977
|
const d = document.createElement("div");
|
|
1932
1978
|
d.classList.add("cal-sched-skeleton-grid__row"), d.style.height = `${s}px`;
|
|
1933
1979
|
const g = document.createElement("div");
|
|
1934
1980
|
g.classList.add("cal-skeleton", "cal-sched-skeleton-grid__time"), d.appendChild(g);
|
|
1935
1981
|
for (let c = 0; c < t; c++) {
|
|
1936
|
-
const
|
|
1937
|
-
if (
|
|
1982
|
+
const h = document.createElement("div");
|
|
1983
|
+
if (h.classList.add("cal-sched-skeleton-grid__cell"), Math.random() < 0.15) {
|
|
1938
1984
|
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`,
|
|
1985
|
+
k.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), k.style.height = `${s * (1 + Math.floor(Math.random() * 2))}px`, h.appendChild(k);
|
|
1940
1986
|
}
|
|
1941
|
-
d.appendChild(
|
|
1987
|
+
d.appendChild(h);
|
|
1942
1988
|
}
|
|
1943
|
-
|
|
1989
|
+
l.appendChild(d);
|
|
1944
1990
|
}
|
|
1945
|
-
return a.appendChild(
|
|
1991
|
+
return a.appendChild(l), a;
|
|
1946
1992
|
}
|
|
1947
|
-
function
|
|
1993
|
+
function kt() {
|
|
1948
1994
|
const t = document.createElement("div");
|
|
1949
1995
|
t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-sched-skeleton-month");
|
|
1950
1996
|
const e = document.createElement("div");
|
|
@@ -1959,10 +2005,10 @@ function yt() {
|
|
|
1959
2005
|
for (let a = 0; a < 35; a++) {
|
|
1960
2006
|
const n = document.createElement("div");
|
|
1961
2007
|
n.classList.add("cal-sched-skeleton-month__cell");
|
|
1962
|
-
const
|
|
1963
|
-
|
|
1964
|
-
const
|
|
1965
|
-
for (let i = 0; i <
|
|
2008
|
+
const r = document.createElement("div");
|
|
2009
|
+
r.classList.add("cal-skeleton", "cal-sched-skeleton-month__num"), n.appendChild(r);
|
|
2010
|
+
const l = Math.floor(Math.random() * 3);
|
|
2011
|
+
for (let i = 0; i < l; i++) {
|
|
1966
2012
|
const d = document.createElement("div");
|
|
1967
2013
|
d.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-month__chip"), n.appendChild(d);
|
|
1968
2014
|
}
|
|
@@ -1970,7 +2016,7 @@ function yt() {
|
|
|
1970
2016
|
}
|
|
1971
2017
|
return t.appendChild(s), t;
|
|
1972
2018
|
}
|
|
1973
|
-
const
|
|
2019
|
+
const Et = `
|
|
1974
2020
|
.cal-sched-skeleton-grid {
|
|
1975
2021
|
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
1976
2022
|
border-radius: var(--cal-radius);
|
|
@@ -2080,19 +2126,19 @@ const wt = `
|
|
|
2080
2126
|
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
2127
|
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
2128
|
};
|
|
2083
|
-
function
|
|
2129
|
+
function Lt({ type: t = "info", message: e, dismissible: s = !0, onDismiss: a }) {
|
|
2084
2130
|
const n = document.createElement("div");
|
|
2085
2131
|
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
2132
|
const r = document.createElement("span");
|
|
2089
|
-
|
|
2133
|
+
r.classList.add("cal-status__icon"), r.innerHTML = Pe[t] || Pe.info, n.appendChild(r);
|
|
2134
|
+
const l = document.createElement("span");
|
|
2135
|
+
if (l.classList.add("cal-status__text"), l.textContent = e, n.appendChild(l), s) {
|
|
2090
2136
|
const i = document.createElement("button");
|
|
2091
2137
|
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
2138
|
}
|
|
2093
2139
|
return n;
|
|
2094
2140
|
}
|
|
2095
|
-
const
|
|
2141
|
+
const Ct = `
|
|
2096
2142
|
.cal-status {
|
|
2097
2143
|
display: flex;
|
|
2098
2144
|
align-items: center;
|
|
@@ -2155,60 +2201,60 @@ const Et = `
|
|
|
2155
2201
|
border: 1px solid hsl(var(--cal-status-success-border));
|
|
2156
2202
|
}
|
|
2157
2203
|
`;
|
|
2158
|
-
function
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2204
|
+
function Tt({ event: t, resource: e, format: s, onClose: a, actions: n, onAction: r }) {
|
|
2205
|
+
const l = document.createElement("div");
|
|
2206
|
+
l.classList.add("cal-sched-detail-backdrop"), l.addEventListener("click", a);
|
|
2161
2207
|
const i = document.createElement("div");
|
|
2162
2208
|
i.classList.add("cal-sched-detail", "cal-animate-fade"), i.addEventListener("click", (u) => u.stopPropagation());
|
|
2163
2209
|
const d = document.createElement("button");
|
|
2164
2210
|
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
2211
|
const g = t.color || "blue", c = document.createElement("div");
|
|
2166
2212
|
c.classList.add("cal-sched-detail__accent"), c.style.background = `hsl(var(--cal-booking-${g}-fg))`, i.appendChild(c);
|
|
2167
|
-
const
|
|
2168
|
-
if (
|
|
2213
|
+
const h = document.createElement("div");
|
|
2214
|
+
if (h.classList.add("cal-sched-detail__title"), h.textContent = t.title || "Untitled", i.appendChild(h), t.startTime && t.endTime) {
|
|
2169
2215
|
const u = document.createElement("div");
|
|
2170
2216
|
u.classList.add("cal-sched-detail__row");
|
|
2171
2217
|
const p = document.createElement("span");
|
|
2172
2218
|
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
|
|
2174
|
-
|
|
2219
|
+
const f = de(t.startTime), o = de(t.endTime), m = document.createElement("span");
|
|
2220
|
+
f && o && (m.textContent = `${pe(f.hours, f.minutes, s)}–${pe(o.hours, o.minutes, s)}`), u.appendChild(m), i.appendChild(u);
|
|
2175
2221
|
}
|
|
2176
2222
|
if (t.start) {
|
|
2177
2223
|
const u = document.createElement("div");
|
|
2178
2224
|
u.classList.add("cal-sched-detail__row");
|
|
2179
2225
|
const p = document.createElement("span");
|
|
2180
2226
|
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
|
|
2182
|
-
if (
|
|
2183
|
-
let m = `${He(t.start, "long")}, ${
|
|
2227
|
+
const f = ee(t.start), o = document.createElement("span");
|
|
2228
|
+
if (f) {
|
|
2229
|
+
let m = `${He(t.start, "long")}, ${_e[f.getMonth()]} ${f.getDate()}`;
|
|
2184
2230
|
if (t.end && t.end !== t.start) {
|
|
2185
|
-
const
|
|
2186
|
-
|
|
2231
|
+
const _ = ee(t.end);
|
|
2232
|
+
_ && (m += ` – ${_e[_.getMonth()]} ${_.getDate()}`);
|
|
2187
2233
|
}
|
|
2188
|
-
|
|
2234
|
+
o.textContent = m;
|
|
2189
2235
|
}
|
|
2190
|
-
u.appendChild(
|
|
2236
|
+
u.appendChild(o), i.appendChild(u);
|
|
2191
2237
|
}
|
|
2192
2238
|
if (e && e.name) {
|
|
2193
2239
|
const u = document.createElement("div");
|
|
2194
2240
|
u.classList.add("cal-sched-detail__row");
|
|
2195
2241
|
const p = document.createElement("span");
|
|
2196
2242
|
p.classList.add("cal-sched-detail__res-dot"), p.style.background = `hsl(var(--cal-booking-${e.color || "blue"}-fg))`, u.appendChild(p);
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2243
|
+
const f = document.createElement("span");
|
|
2244
|
+
f.textContent = e.name, e.capacity && (f.textContent += ` (capacity: ${e.capacity})`), u.appendChild(f), i.appendChild(u);
|
|
2199
2245
|
}
|
|
2200
2246
|
if (t.metadata && typeof t.metadata == "object") {
|
|
2201
2247
|
const u = Object.entries(t.metadata);
|
|
2202
2248
|
if (u.length > 0) {
|
|
2203
2249
|
const p = document.createElement("div");
|
|
2204
2250
|
p.classList.add("cal-sched-detail__meta");
|
|
2205
|
-
for (const [
|
|
2251
|
+
for (const [f, o] of u) {
|
|
2206
2252
|
const m = document.createElement("div");
|
|
2207
2253
|
m.classList.add("cal-sched-detail__meta-row");
|
|
2208
|
-
const
|
|
2209
|
-
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2254
|
+
const _ = document.createElement("span");
|
|
2255
|
+
_.classList.add("cal-sched-detail__meta-label"), _.textContent = f;
|
|
2256
|
+
const C = document.createElement("span");
|
|
2257
|
+
C.textContent = String(o), m.appendChild(_), m.appendChild(C), p.appendChild(m);
|
|
2212
2258
|
}
|
|
2213
2259
|
i.appendChild(p);
|
|
2214
2260
|
}
|
|
@@ -2217,20 +2263,20 @@ function Lt({ event: t, resource: e, format: s, onClose: a, actions: n, onAction
|
|
|
2217
2263
|
const u = document.createElement("div");
|
|
2218
2264
|
u.classList.add("cal-sched-detail__actions");
|
|
2219
2265
|
for (const p of n) {
|
|
2220
|
-
const
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
}), u.appendChild(
|
|
2266
|
+
const f = document.createElement("button");
|
|
2267
|
+
f.classList.add("cal-sched-detail__action"), p.type === "danger" && f.classList.add("cal-sched-detail__action--danger"), f.textContent = p.label, f.addEventListener("click", () => {
|
|
2268
|
+
r == null || r(p.label);
|
|
2269
|
+
}), u.appendChild(f);
|
|
2224
2270
|
}
|
|
2225
2271
|
i.appendChild(u);
|
|
2226
2272
|
}
|
|
2227
|
-
|
|
2273
|
+
l.appendChild(i);
|
|
2228
2274
|
const k = (u) => {
|
|
2229
2275
|
u.key === "Escape" && a();
|
|
2230
2276
|
};
|
|
2231
|
-
return
|
|
2277
|
+
return l.addEventListener("keydown", k), requestAnimationFrame(() => d.focus()), l;
|
|
2232
2278
|
}
|
|
2233
|
-
const
|
|
2279
|
+
const Mt = `
|
|
2234
2280
|
.cal-sched-detail-backdrop {
|
|
2235
2281
|
position: absolute;
|
|
2236
2282
|
inset: 0;
|
|
@@ -2369,20 +2415,20 @@ const Ct = `
|
|
|
2369
2415
|
background: hsl(var(--cal-status-error-bg));
|
|
2370
2416
|
}
|
|
2371
2417
|
`;
|
|
2372
|
-
function
|
|
2418
|
+
function St({ resources: t, selectedResourceId: e, onResourceFilter: s }) {
|
|
2373
2419
|
const a = document.createElement("div");
|
|
2374
2420
|
a.classList.add("cal-sched-res-tabs");
|
|
2375
2421
|
const n = document.createElement("button");
|
|
2376
2422
|
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
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2423
|
+
for (const r of t) {
|
|
2424
|
+
const l = document.createElement("button");
|
|
2425
|
+
l.classList.add("cal-sched-res-tabs__tab"), e === r.id && l.classList.add("cal-sched-res-tabs__tab--active");
|
|
2380
2426
|
const i = document.createElement("span");
|
|
2381
|
-
i.classList.add("cal-sched-res-tabs__dot"), i.style.background = `hsl(var(--cal-booking-${
|
|
2427
|
+
i.classList.add("cal-sched-res-tabs__dot"), i.style.background = `hsl(var(--cal-booking-${r.color || "blue"}-fg))`, l.appendChild(i), l.appendChild(document.createTextNode(r.name)), l.addEventListener("click", () => s == null ? void 0 : s(r.id)), a.appendChild(l);
|
|
2382
2428
|
}
|
|
2383
2429
|
return a;
|
|
2384
2430
|
}
|
|
2385
|
-
const
|
|
2431
|
+
const Dt = `
|
|
2386
2432
|
.cal-sched-res-tabs {
|
|
2387
2433
|
display: flex;
|
|
2388
2434
|
gap: 4px;
|
|
@@ -2427,13 +2473,13 @@ const Mt = `
|
|
|
2427
2473
|
border-radius: 50%;
|
|
2428
2474
|
}
|
|
2429
2475
|
`;
|
|
2430
|
-
function
|
|
2476
|
+
function $t({ onClick: t }) {
|
|
2431
2477
|
const e = document.createElement("button");
|
|
2432
2478
|
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
2479
|
s.stopPropagation(), t == null || t();
|
|
2434
2480
|
}), e;
|
|
2435
2481
|
}
|
|
2436
|
-
const
|
|
2482
|
+
const At = `
|
|
2437
2483
|
.cal-sched-fab {
|
|
2438
2484
|
position: absolute;
|
|
2439
2485
|
bottom: 16px;
|
|
@@ -2465,35 +2511,35 @@ const Dt = `
|
|
|
2465
2511
|
outline: 2px solid hsl(var(--cal-ring));
|
|
2466
2512
|
outline-offset: 2px;
|
|
2467
2513
|
}
|
|
2468
|
-
`,
|
|
2469
|
-
function
|
|
2470
|
-
let i = !1, d = null, g = null, c = null,
|
|
2471
|
-
function
|
|
2514
|
+
`, It = 4;
|
|
2515
|
+
function zt({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove: n, onResize: r, onCreate: l }) {
|
|
2516
|
+
let i = !1, d = null, g = null, c = null, h = null, k = 0, u = 0, p = 0, f = 0, o = !1, m = null, _ = null, C = null, D = null, F = null, X = null, Y = null, j = null, P = null, H = null, x = null, E = null, Z = 0;
|
|
2517
|
+
function N(b) {
|
|
2472
2518
|
if (!i || b.button !== 0) return;
|
|
2473
2519
|
const L = b.target.closest(".cal-sched-event__resize-handle"), S = b.target.closest('.cal-sched-event[data-draggable="true"]');
|
|
2474
2520
|
if (S) {
|
|
2475
|
-
const
|
|
2476
|
-
if (g = a().find((B) => B.id ===
|
|
2477
|
-
b.preventDefault(), b.stopPropagation(),
|
|
2521
|
+
const O = S.dataset.eventId;
|
|
2522
|
+
if (g = a().find((B) => B.id === O), !g) return;
|
|
2523
|
+
b.preventDefault(), b.stopPropagation(), j = S, Y = b.pointerId, S.setPointerCapture(b.pointerId), p = b.clientX, f = b.clientY, o = !1, _ = g.startTime, m = g.endTime, C = g.start, D = g.resourceId, L ? (d = "resize", h = S, h.classList.add("cal-sched-event--resizing")) : (d = "move", h = S);
|
|
2478
2524
|
} else {
|
|
2479
|
-
const
|
|
2480
|
-
if (!
|
|
2481
|
-
const
|
|
2482
|
-
if (!
|
|
2483
|
-
b.preventDefault(), d = "create", p = b.clientX,
|
|
2525
|
+
const O = b.target.closest("[data-time]");
|
|
2526
|
+
if (!O || b.target.closest(".cal-sched-slot-prompt")) return;
|
|
2527
|
+
const y = I(b.clientX, b.clientY);
|
|
2528
|
+
if (!y) return;
|
|
2529
|
+
b.preventDefault(), d = "create", p = b.clientX, f = b.clientY, o = !1, H = y.date, x = y.resourceId, E = y.time;
|
|
2484
2530
|
const B = t.querySelectorAll("[data-time]");
|
|
2485
|
-
B.length > 0 && (Z = B[0].getBoundingClientRect().top),
|
|
2531
|
+
B.length > 0 && (Z = B[0].getBoundingClientRect().top), j = O, Y = b.pointerId, O.setPointerCapture(b.pointerId);
|
|
2486
2532
|
}
|
|
2487
|
-
t.addEventListener("pointermove", M), t.addEventListener("pointerup",
|
|
2533
|
+
t.addEventListener("pointermove", M), t.addEventListener("pointerup", v);
|
|
2488
2534
|
}
|
|
2489
2535
|
function M(b) {
|
|
2490
2536
|
if (!d) return;
|
|
2491
|
-
const L = b.clientX - p, S = b.clientY -
|
|
2492
|
-
if (!(!
|
|
2493
|
-
if (
|
|
2494
|
-
if (!c &&
|
|
2495
|
-
const B =
|
|
2496
|
-
k = p - B.left, u =
|
|
2537
|
+
const L = b.clientX - p, S = b.clientY - f, O = Math.sqrt(L * L + S * S);
|
|
2538
|
+
if (!(!o && O < It)) {
|
|
2539
|
+
if (o = !0, d === "move") {
|
|
2540
|
+
if (!c && h) {
|
|
2541
|
+
const B = h.getBoundingClientRect();
|
|
2542
|
+
k = p - B.left, u = f - B.top, c = h.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
|
|
2497
2543
|
position: fixed;
|
|
2498
2544
|
width: ${B.width}px;
|
|
2499
2545
|
height: ${B.height}px;
|
|
@@ -2511,32 +2557,32 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
|
|
|
2511
2557
|
font-size: 12px;
|
|
2512
2558
|
line-height: 1.3;
|
|
2513
2559
|
overflow: hidden;
|
|
2514
|
-
`, c.style.setProperty("--ev-bg",
|
|
2560
|
+
`, c.style.setProperty("--ev-bg", h.style.getPropertyValue("--ev-bg")), c.style.setProperty("--ev-fg", h.style.getPropertyValue("--ev-fg")), t.appendChild(c), h.classList.add("cal-sched-event--dragging");
|
|
2515
2561
|
}
|
|
2516
2562
|
c && (c.style.left = `${b.clientX - k}px`, c.style.top = `${b.clientY - u}px`);
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2563
|
+
const y = I(b.clientX, b.clientY);
|
|
2564
|
+
y ? W(y) : $();
|
|
2519
2565
|
} else if (d === "resize") {
|
|
2520
|
-
const
|
|
2521
|
-
let K =
|
|
2522
|
-
const te =
|
|
2523
|
-
if (K < se && (K = se),
|
|
2524
|
-
const
|
|
2525
|
-
K >
|
|
2566
|
+
const y = e(), B = y.snapInterval || y.interval, Q = y.slotHeight * (B / y.interval), ae = b.clientY - f, q = Math.round(ae / Q) * B, he = w(m), re = w(_);
|
|
2567
|
+
let K = he + q;
|
|
2568
|
+
const te = y.minDuration || B, se = re + te;
|
|
2569
|
+
if (K < se && (K = se), y.maxDuration) {
|
|
2570
|
+
const oe = re + y.maxDuration;
|
|
2571
|
+
K > oe && (K = oe);
|
|
2526
2572
|
}
|
|
2527
|
-
const V = y
|
|
2573
|
+
const V = w(y.endTime);
|
|
2528
2574
|
K > V && (K = V);
|
|
2529
2575
|
const ne = ce(K);
|
|
2530
|
-
if (
|
|
2531
|
-
const
|
|
2532
|
-
|
|
2576
|
+
if (h) {
|
|
2577
|
+
const oe = ie(_, y.startTime, y.slotHeight, y.interval), Ee = ie(ne, y.startTime, y.slotHeight, y.interval);
|
|
2578
|
+
h.style.height = `${Math.max(Ee - oe, y.slotHeight * 0.5)}px`;
|
|
2533
2579
|
}
|
|
2534
|
-
|
|
2580
|
+
G(b.clientX, b.clientY, ne, y.format);
|
|
2535
2581
|
} else if (d === "create") {
|
|
2536
|
-
const
|
|
2537
|
-
let te = Math.max(
|
|
2538
|
-
if (
|
|
2539
|
-
const V =
|
|
2582
|
+
const y = e(), B = y.snapInterval || y.interval, Q = b.clientY - Z, ae = Ae(Math.max(0, Q), y.startTime, y.slotHeight, y.interval), J = Ie(ae, B), q = w(J), he = w(E), re = w(y.endTime), K = y.minDuration || B;
|
|
2583
|
+
let te = Math.max(q, he + K);
|
|
2584
|
+
if (y.maxDuration) {
|
|
2585
|
+
const V = he + y.maxDuration;
|
|
2540
2586
|
te > V && (te = V);
|
|
2541
2587
|
}
|
|
2542
2588
|
te > re && (te = re);
|
|
@@ -2544,83 +2590,83 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
|
|
|
2544
2590
|
if (!P) {
|
|
2545
2591
|
P = document.createElement("div"), P.classList.add("cal-sched-create-preview");
|
|
2546
2592
|
let V = null;
|
|
2547
|
-
|
|
2593
|
+
x && (V = t.querySelector(`[data-resource-id="${x}"][data-date="${H}"]`), V || (V = t.querySelector(`[data-date="${H}"] [data-resource-id="${x}"]`))), 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
2594
|
}
|
|
2549
2595
|
if (P) {
|
|
2550
|
-
const V = e(), ne = ie(E, V.startTime, V.slotHeight, V.interval),
|
|
2551
|
-
P.style.top = `${ne}px`, P.style.height = `${Math.max(
|
|
2596
|
+
const V = e(), ne = ie(E, V.startTime, V.slotHeight, V.interval), oe = ie(se, V.startTime, V.slotHeight, V.interval);
|
|
2597
|
+
P.style.top = `${ne}px`, P.style.height = `${Math.max(oe - ne, V.slotHeight * 0.5)}px`, P.dataset.endTime = se;
|
|
2552
2598
|
}
|
|
2553
|
-
|
|
2599
|
+
G(b.clientX, b.clientY, se, y.format);
|
|
2554
2600
|
}
|
|
2555
2601
|
}
|
|
2556
2602
|
}
|
|
2557
|
-
function
|
|
2603
|
+
function v(b) {
|
|
2558
2604
|
if (d) {
|
|
2559
|
-
if (t.removeEventListener("pointermove", M), t.removeEventListener("pointerup",
|
|
2605
|
+
if (t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", v), j && Y != null) {
|
|
2560
2606
|
try {
|
|
2561
|
-
|
|
2607
|
+
j.releasePointerCapture(Y);
|
|
2562
2608
|
} catch {
|
|
2563
2609
|
}
|
|
2564
|
-
|
|
2610
|
+
j = null, Y = null;
|
|
2565
2611
|
}
|
|
2566
2612
|
if (d === "move") {
|
|
2567
|
-
if ($(), c && (c.remove(), c = null),
|
|
2568
|
-
|
|
2569
|
-
const L =
|
|
2613
|
+
if ($(), c && (c.remove(), c = null), h && h.classList.remove("cal-sched-event--dragging"), o) {
|
|
2614
|
+
h && (h.dataset.wasDragged = "true");
|
|
2615
|
+
const L = I(b.clientX, b.clientY);
|
|
2570
2616
|
if (L && g) {
|
|
2571
|
-
const S = e(),
|
|
2572
|
-
date:
|
|
2573
|
-
startTime:
|
|
2617
|
+
const S = e(), O = w(m) - w(_), y = L.time, B = w(y), Q = Math.min(B + O, w(S.endTime)), ae = ce(Q), J = {
|
|
2618
|
+
date: C,
|
|
2619
|
+
startTime: _,
|
|
2574
2620
|
endTime: m,
|
|
2575
2621
|
resourceId: D
|
|
2576
|
-
},
|
|
2622
|
+
}, q = {
|
|
2577
2623
|
date: L.date,
|
|
2578
|
-
startTime:
|
|
2624
|
+
startTime: y,
|
|
2579
2625
|
endTime: ae,
|
|
2580
2626
|
resourceId: L.resourceId || D
|
|
2581
2627
|
};
|
|
2582
|
-
(J.date !==
|
|
2628
|
+
(J.date !== q.date || J.startTime !== q.startTime || J.resourceId !== q.resourceId) && (n == null || n({ event: g, from: J, to: q }));
|
|
2583
2629
|
}
|
|
2584
2630
|
}
|
|
2585
2631
|
} else if (d === "resize") {
|
|
2586
|
-
if (
|
|
2587
|
-
const L = e(), S = L.snapInterval || L.interval,
|
|
2588
|
-
let
|
|
2589
|
-
const
|
|
2590
|
-
if (
|
|
2632
|
+
if (o) {
|
|
2633
|
+
const L = e(), S = L.snapInterval || L.interval, O = L.slotHeight * (S / L.interval), y = b.clientY - f, Q = Math.round(y / O) * S, ae = w(m), J = w(_);
|
|
2634
|
+
let q = ae + Q;
|
|
2635
|
+
const he = L.minDuration || S, re = J + he;
|
|
2636
|
+
if (q < re && (q = re), L.maxDuration) {
|
|
2591
2637
|
const se = J + L.maxDuration;
|
|
2592
|
-
|
|
2638
|
+
q > se && (q = se);
|
|
2593
2639
|
}
|
|
2594
|
-
const K =
|
|
2595
|
-
|
|
2596
|
-
const te = ce(
|
|
2597
|
-
|
|
2640
|
+
const K = w(L.endTime);
|
|
2641
|
+
q > K && (q = K);
|
|
2642
|
+
const te = ce(q);
|
|
2643
|
+
h && (h.dataset.wasDragged = "true"), te !== m && g && (r == null || r({
|
|
2598
2644
|
event: g,
|
|
2599
2645
|
from: { endTime: m },
|
|
2600
2646
|
to: { endTime: te }
|
|
2601
2647
|
}));
|
|
2602
2648
|
}
|
|
2603
|
-
|
|
2649
|
+
h && h.classList.remove("cal-sched-event--resizing"), A();
|
|
2604
2650
|
} else if (d === "create") {
|
|
2605
|
-
|
|
2651
|
+
A();
|
|
2606
2652
|
const L = (P == null ? void 0 : P.dataset.endTime) || null;
|
|
2607
|
-
P && (P.remove(), P = null),
|
|
2653
|
+
P && (P.remove(), P = null), o && H && E && L && (l == null || l({
|
|
2608
2654
|
date: H,
|
|
2609
2655
|
startTime: E,
|
|
2610
2656
|
endTime: L,
|
|
2611
|
-
resourceId:
|
|
2612
|
-
})), H = null,
|
|
2657
|
+
resourceId: x
|
|
2658
|
+
})), H = null, x = null, E = null, Z = 0;
|
|
2613
2659
|
}
|
|
2614
|
-
d = null, g = null,
|
|
2660
|
+
d = null, g = null, h = null, k = 0, u = 0, p = 0, f = 0, o = !1, m = null, _ = null, C = null, D = null;
|
|
2615
2661
|
}
|
|
2616
2662
|
}
|
|
2617
|
-
function
|
|
2618
|
-
const S = e(),
|
|
2619
|
-
let
|
|
2620
|
-
for (const ne of
|
|
2621
|
-
const
|
|
2622
|
-
if (b >=
|
|
2623
|
-
if (
|
|
2663
|
+
function I(b, L) {
|
|
2664
|
+
const S = e(), O = t.querySelectorAll("[data-date]");
|
|
2665
|
+
let y = null, B = null;
|
|
2666
|
+
for (const ne of O) {
|
|
2667
|
+
const oe = ne.getBoundingClientRect();
|
|
2668
|
+
if (b >= oe.left && b <= oe.right) {
|
|
2669
|
+
if (y = ne.dataset.date, ne.dataset.resourceId)
|
|
2624
2670
|
B = ne.dataset.resourceId;
|
|
2625
2671
|
else {
|
|
2626
2672
|
const Ee = ne.querySelectorAll("[data-resource-id]");
|
|
@@ -2635,14 +2681,14 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
|
|
|
2635
2681
|
break;
|
|
2636
2682
|
}
|
|
2637
2683
|
}
|
|
2638
|
-
if (!
|
|
2684
|
+
if (!y) return null;
|
|
2639
2685
|
const Q = t.querySelectorAll("[data-time]");
|
|
2640
2686
|
if (Q.length === 0) return null;
|
|
2641
|
-
const J = Q[0].getBoundingClientRect().top,
|
|
2642
|
-
if (
|
|
2643
|
-
const
|
|
2687
|
+
const J = Q[0].getBoundingClientRect().top, q = L - J;
|
|
2688
|
+
if (q < 0) return null;
|
|
2689
|
+
const he = S.snapInterval || S.interval, re = Ae(q, S.startTime, S.slotHeight, S.interval), K = Ie(re, he), te = w(K), se = w(S.startTime), V = w(S.endTime);
|
|
2644
2690
|
return te < se || te >= V ? null : {
|
|
2645
|
-
date:
|
|
2691
|
+
date: y,
|
|
2646
2692
|
time: K,
|
|
2647
2693
|
resourceId: B
|
|
2648
2694
|
};
|
|
@@ -2651,63 +2697,63 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
|
|
|
2651
2697
|
$();
|
|
2652
2698
|
const L = e();
|
|
2653
2699
|
let S = L.interval;
|
|
2654
|
-
g &&
|
|
2655
|
-
let
|
|
2656
|
-
const B =
|
|
2657
|
-
|
|
2658
|
-
const Q = ce(
|
|
2700
|
+
g && _ && m && (S = w(m) - w(_));
|
|
2701
|
+
let y = w(b.time) + S;
|
|
2702
|
+
const B = w(L.endTime);
|
|
2703
|
+
y > B && (y = B);
|
|
2704
|
+
const Q = ce(y);
|
|
2659
2705
|
let ae = R(b.date, b.resourceId);
|
|
2660
2706
|
if (!ae) return;
|
|
2661
2707
|
X = document.createElement("div"), X.classList.add("cal-sched-drop-preview");
|
|
2662
|
-
const J = ie(b.time, L.startTime, L.slotHeight, L.interval),
|
|
2663
|
-
X.style.top = `${J}px`, X.style.height = `${Math.max(
|
|
2708
|
+
const J = ie(b.time, L.startTime, L.slotHeight, L.interval), q = ie(Q, L.startTime, L.slotHeight, L.interval);
|
|
2709
|
+
X.style.top = `${J}px`, X.style.height = `${Math.max(q - J, L.slotHeight * 0.5)}px`, ae.appendChild(X);
|
|
2664
2710
|
}
|
|
2665
2711
|
function $() {
|
|
2666
2712
|
X && (X.remove(), X = null);
|
|
2667
2713
|
}
|
|
2668
2714
|
function R(b, L) {
|
|
2669
2715
|
if (L) {
|
|
2670
|
-
let
|
|
2716
|
+
let O = t.querySelector(
|
|
2671
2717
|
`[data-resource-id="${L}"][data-date="${b}"]`
|
|
2672
2718
|
);
|
|
2673
|
-
if (
|
|
2719
|
+
if (O || (O = t.querySelector(
|
|
2674
2720
|
`[data-date="${b}"] [data-resource-id="${L}"]`
|
|
2675
|
-
)),
|
|
2721
|
+
)), O) return O;
|
|
2676
2722
|
}
|
|
2677
2723
|
const S = t.querySelector(`[data-date="${b}"]`);
|
|
2678
2724
|
return S ? S.querySelector(".cal-sched-week__lane") || S.querySelector(".cal-sched-day__lane") || S : null;
|
|
2679
2725
|
}
|
|
2680
|
-
function
|
|
2726
|
+
function G(b, L, S, O) {
|
|
2681
2727
|
F || (F = document.createElement("div"), F.classList.add("cal-sched-drag-time-label"), t.appendChild(F));
|
|
2682
|
-
const { hours:
|
|
2728
|
+
const { hours: y, minutes: B } = T(S), Q = O === "12h" ? z(y, B) : S;
|
|
2683
2729
|
F.textContent = Q, F.style.left = `${b + 12}px`, F.style.top = `${L - 8}px`;
|
|
2684
2730
|
}
|
|
2685
|
-
function
|
|
2731
|
+
function A() {
|
|
2686
2732
|
F && (F.remove(), F = null);
|
|
2687
2733
|
}
|
|
2688
|
-
function
|
|
2734
|
+
function T(b) {
|
|
2689
2735
|
const [L, S] = b.split(":").map(Number);
|
|
2690
2736
|
return { hours: L, minutes: S };
|
|
2691
2737
|
}
|
|
2692
|
-
function
|
|
2738
|
+
function z(b, L) {
|
|
2693
2739
|
const S = b >= 12 ? "PM" : "AM";
|
|
2694
2740
|
return `${b % 12 || 12}:${String(L).padStart(2, "0")} ${S}`;
|
|
2695
2741
|
}
|
|
2696
|
-
function
|
|
2697
|
-
i || (i = !0, t.addEventListener("pointerdown",
|
|
2742
|
+
function U() {
|
|
2743
|
+
i || (i = !0, t.addEventListener("pointerdown", N));
|
|
2698
2744
|
}
|
|
2699
2745
|
function le() {
|
|
2700
|
-
i = !1, t.removeEventListener("pointerdown",
|
|
2746
|
+
i = !1, t.removeEventListener("pointerdown", N), t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", v), ke();
|
|
2701
2747
|
}
|
|
2702
2748
|
function ke() {
|
|
2703
|
-
c && (c.remove(), c = null), P && (P.remove(), P = null),
|
|
2749
|
+
c && (c.remove(), c = null), P && (P.remove(), P = null), h && (h.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), h = null), $(), A(), d = null, g = null, o = !1;
|
|
2704
2750
|
}
|
|
2705
2751
|
function Re() {
|
|
2706
2752
|
le();
|
|
2707
2753
|
}
|
|
2708
|
-
return { enable:
|
|
2754
|
+
return { enable: U, disable: le, destroy: Re };
|
|
2709
2755
|
}
|
|
2710
|
-
const
|
|
2756
|
+
const Pt = `
|
|
2711
2757
|
[data-draggable="true"] {
|
|
2712
2758
|
cursor: grab;
|
|
2713
2759
|
}
|
|
@@ -2792,7 +2838,7 @@ const zt = `
|
|
|
2792
2838
|
z-index: 1001;
|
|
2793
2839
|
white-space: nowrap;
|
|
2794
2840
|
}
|
|
2795
|
-
`,
|
|
2841
|
+
`, Ht = `
|
|
2796
2842
|
.cal-sched {
|
|
2797
2843
|
background: hsl(var(--cal-bg));
|
|
2798
2844
|
border-radius: var(--cal-radius);
|
|
@@ -2804,27 +2850,27 @@ const zt = `
|
|
|
2804
2850
|
position: relative;
|
|
2805
2851
|
}
|
|
2806
2852
|
`;
|
|
2807
|
-
class
|
|
2853
|
+
class Yt extends Fe {
|
|
2808
2854
|
static get styles() {
|
|
2809
2855
|
return [
|
|
2810
|
-
et,
|
|
2811
|
-
tt,
|
|
2812
2856
|
at,
|
|
2813
|
-
|
|
2814
|
-
|
|
2857
|
+
st,
|
|
2858
|
+
nt,
|
|
2859
|
+
ct,
|
|
2815
2860
|
ot,
|
|
2816
2861
|
ut,
|
|
2817
|
-
|
|
2862
|
+
gt,
|
|
2818
2863
|
vt,
|
|
2819
2864
|
_t,
|
|
2820
|
-
|
|
2865
|
+
yt,
|
|
2821
2866
|
Et,
|
|
2822
2867
|
Ct,
|
|
2823
2868
|
Mt,
|
|
2824
|
-
pt,
|
|
2825
2869
|
Dt,
|
|
2826
|
-
|
|
2827
|
-
At
|
|
2870
|
+
mt,
|
|
2871
|
+
At,
|
|
2872
|
+
Pt,
|
|
2873
|
+
Ht
|
|
2828
2874
|
];
|
|
2829
2875
|
}
|
|
2830
2876
|
static get observedAttributes() {
|
|
@@ -2846,13 +2892,14 @@ class Pt extends Fe {
|
|
|
2846
2892
|
"draggable-events",
|
|
2847
2893
|
"snap-interval",
|
|
2848
2894
|
"min-duration",
|
|
2849
|
-
"max-duration"
|
|
2895
|
+
"max-duration",
|
|
2896
|
+
"locale"
|
|
2850
2897
|
];
|
|
2851
2898
|
}
|
|
2852
2899
|
constructor() {
|
|
2853
2900
|
super(), this._store = Ve({
|
|
2854
2901
|
view: "week",
|
|
2855
|
-
anchorDate:
|
|
2902
|
+
anchorDate: ge(),
|
|
2856
2903
|
layout: "vertical",
|
|
2857
2904
|
selectedResourceId: null,
|
|
2858
2905
|
// Slot selection
|
|
@@ -2866,7 +2913,7 @@ class Pt extends Fe {
|
|
|
2866
2913
|
statusDismissible: !0,
|
|
2867
2914
|
// All-day collapse
|
|
2868
2915
|
allDayCollapsed: !1
|
|
2869
|
-
}), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
|
|
2916
|
+
}), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._colors = null, this._customColorMap = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
|
|
2870
2917
|
}
|
|
2871
2918
|
// -- Attribute getters --
|
|
2872
2919
|
get view() {
|
|
@@ -2923,6 +2970,9 @@ class Pt extends Fe {
|
|
|
2923
2970
|
const e = this.getAttribute("max-duration");
|
|
2924
2971
|
return e ? parseInt(e, 10) : null;
|
|
2925
2972
|
}
|
|
2973
|
+
get locale() {
|
|
2974
|
+
return this.getAttribute("locale") || void 0;
|
|
2975
|
+
}
|
|
2926
2976
|
// -- Properties --
|
|
2927
2977
|
get resources() {
|
|
2928
2978
|
return this._resources;
|
|
@@ -2948,6 +2998,15 @@ class Pt extends Fe {
|
|
|
2948
2998
|
set eventContent(e) {
|
|
2949
2999
|
this._eventContent = typeof e == "function" ? e : null, this._initialized && this.render();
|
|
2950
3000
|
}
|
|
3001
|
+
get colors() {
|
|
3002
|
+
return this._colors;
|
|
3003
|
+
}
|
|
3004
|
+
set colors(e) {
|
|
3005
|
+
if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = tt(this._colors), this._customColorMap)
|
|
3006
|
+
for (const [s, a] of Object.entries(this._customColorMap))
|
|
3007
|
+
this.style.setProperty(`--cal-booking-${s}-bg`, a.bg), this.style.setProperty(`--cal-booking-${s}-fg`, a.fg), this.style.setProperty(`--cal-booking-${s}-hover`, a.hover);
|
|
3008
|
+
this._initialized && this.render();
|
|
3009
|
+
}
|
|
2951
3010
|
get value() {
|
|
2952
3011
|
return this._lastSlotValue || null;
|
|
2953
3012
|
}
|
|
@@ -2994,19 +3053,19 @@ class Pt extends Fe {
|
|
|
2994
3053
|
["day", "week", "month"].includes(e) && (this._store.set({ view: e }), this.emit("cal:view-change", { view: e, date: this._store.get("anchorDate") }));
|
|
2995
3054
|
}
|
|
2996
3055
|
today() {
|
|
2997
|
-
this.goToDate(
|
|
3056
|
+
this.goToDate(ge());
|
|
2998
3057
|
}
|
|
2999
3058
|
next() {
|
|
3000
3059
|
const e = this._store.getState(), s = ee(e.anchorDate);
|
|
3001
3060
|
if (!s) return;
|
|
3002
3061
|
let a;
|
|
3003
3062
|
if (e.view === "day")
|
|
3004
|
-
a =
|
|
3063
|
+
a = me(e.anchorDate, 1);
|
|
3005
3064
|
else if (e.view === "week")
|
|
3006
|
-
a =
|
|
3065
|
+
a = me(e.anchorDate, 7);
|
|
3007
3066
|
else {
|
|
3008
|
-
const { year: n, month:
|
|
3009
|
-
a =
|
|
3067
|
+
const { year: n, month: r } = xe(s.getFullYear(), s.getMonth(), 1);
|
|
3068
|
+
a = ue(new Date(n, r, 1));
|
|
3010
3069
|
}
|
|
3011
3070
|
this._store.set({ anchorDate: a }), this.emit("cal:date-change", { date: a, view: e.view });
|
|
3012
3071
|
}
|
|
@@ -3015,17 +3074,17 @@ class Pt extends Fe {
|
|
|
3015
3074
|
if (!s) return;
|
|
3016
3075
|
let a;
|
|
3017
3076
|
if (e.view === "day")
|
|
3018
|
-
a =
|
|
3077
|
+
a = me(e.anchorDate, -1);
|
|
3019
3078
|
else if (e.view === "week")
|
|
3020
|
-
a =
|
|
3079
|
+
a = me(e.anchorDate, -7);
|
|
3021
3080
|
else {
|
|
3022
|
-
const { year: n, month:
|
|
3023
|
-
a =
|
|
3081
|
+
const { year: n, month: r } = xe(s.getFullYear(), s.getMonth(), -1);
|
|
3082
|
+
a = ue(new Date(n, r, 1));
|
|
3024
3083
|
}
|
|
3025
3084
|
this._store.set({ anchorDate: a }), this.emit("cal:date-change", { date: a, view: e.view });
|
|
3026
3085
|
}
|
|
3027
3086
|
findAvailableSlot(e) {
|
|
3028
|
-
return
|
|
3087
|
+
return et(
|
|
3029
3088
|
e,
|
|
3030
3089
|
this._resources,
|
|
3031
3090
|
this._events,
|
|
@@ -3037,12 +3096,19 @@ class Pt extends Fe {
|
|
|
3037
3096
|
isSlotAvailable(e, s, a, n) {
|
|
3038
3097
|
return Be(this._events, n, e, s, a);
|
|
3039
3098
|
}
|
|
3099
|
+
clear() {
|
|
3100
|
+
this._store.set({
|
|
3101
|
+
selectedSlot: null,
|
|
3102
|
+
detailEvent: null,
|
|
3103
|
+
detailResource: null
|
|
3104
|
+
}), this._lastSlotValue = null;
|
|
3105
|
+
}
|
|
3040
3106
|
// -- Event handlers --
|
|
3041
|
-
_handleSlotClick(e, s, a, n,
|
|
3042
|
-
this._lastSlotValue = { date: e, startTime: s, endTime: a, resourceId: n, resource:
|
|
3107
|
+
_handleSlotClick(e, s, a, n, r) {
|
|
3108
|
+
this._lastSlotValue = { date: e, startTime: s, endTime: a, resourceId: n, resource: r }, this._store.set({ selectedSlot: { date: e, startTime: s, endTime: a, resourceId: n, resource: r } }), this.emit("cal:slot-select", { date: e, startTime: s, endTime: a, resourceId: n, resource: r });
|
|
3043
3109
|
}
|
|
3044
|
-
_handleSlotCreate(e, s, a, n,
|
|
3045
|
-
this.emit("cal:slot-create", { date: e, startTime: s, endTime: a, resourceId: n, resource:
|
|
3110
|
+
_handleSlotCreate(e, s, a, n, r) {
|
|
3111
|
+
this.emit("cal:slot-create", { date: e, startTime: s, endTime: a, resourceId: n, resource: r });
|
|
3046
3112
|
}
|
|
3047
3113
|
_dismissSlot() {
|
|
3048
3114
|
this._store.set({ selectedSlot: null });
|
|
@@ -3069,7 +3135,7 @@ class Pt extends Fe {
|
|
|
3069
3135
|
});
|
|
3070
3136
|
}
|
|
3071
3137
|
_initDrag() {
|
|
3072
|
-
this._dragManager || (this._dragManager =
|
|
3138
|
+
this._dragManager || (this._dragManager = zt({
|
|
3073
3139
|
shadowRoot: this.shadowRoot,
|
|
3074
3140
|
getConfig: () => ({
|
|
3075
3141
|
slotHeight: this.slotHeight,
|
|
@@ -3114,56 +3180,57 @@ class Pt extends Fe {
|
|
|
3114
3180
|
}
|
|
3115
3181
|
// -- Render --
|
|
3116
3182
|
render() {
|
|
3117
|
-
var
|
|
3183
|
+
var f;
|
|
3118
3184
|
if (this._rendering) return;
|
|
3119
3185
|
this._rendering = !0;
|
|
3120
3186
|
const e = this.shadowRoot, s = [...e.childNodes];
|
|
3121
|
-
for (const
|
|
3122
|
-
|
|
3187
|
+
for (const o of s)
|
|
3188
|
+
o.nodeName !== "STYLE" && !(o instanceof CSSStyleSheet) && e.removeChild(o);
|
|
3123
3189
|
const a = this._store.getState(), n = document.createElement("div");
|
|
3124
|
-
n.classList.add("cal-sched"), a.statusType && a.statusMessage && n.appendChild(
|
|
3190
|
+
n.classList.add("cal-sched"), a.statusType && a.statusMessage && n.appendChild(Lt({
|
|
3125
3191
|
type: a.statusType,
|
|
3126
3192
|
message: a.statusMessage,
|
|
3127
3193
|
dismissible: a.statusDismissible,
|
|
3128
3194
|
onDismiss: () => this.clearStatus()
|
|
3129
3195
|
}));
|
|
3130
|
-
const
|
|
3131
|
-
n.appendChild(
|
|
3196
|
+
const r = a.view, l = a.anchorDate, i = Te(l, this.firstDay), d = Ke(r, l, i, this.locale), g = this.resourceMode;
|
|
3197
|
+
n.appendChild(it({
|
|
3132
3198
|
title: d,
|
|
3133
|
-
view:
|
|
3199
|
+
view: r,
|
|
3134
3200
|
onPrev: () => this.prev(),
|
|
3135
3201
|
onNext: () => this.next(),
|
|
3136
3202
|
onToday: () => this.today(),
|
|
3137
|
-
onViewChange: (
|
|
3203
|
+
onViewChange: (o) => this._handleViewChange(o),
|
|
3204
|
+
locale: this.locale
|
|
3138
3205
|
}));
|
|
3139
|
-
const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }],
|
|
3140
|
-
|
|
3206
|
+
const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }], h = g === "tabs" && c.length > 1 && c[0].id !== "__default";
|
|
3207
|
+
h && !this.loading && n.appendChild(St({
|
|
3141
3208
|
resources: c,
|
|
3142
3209
|
selectedResourceId: a.selectedResourceId,
|
|
3143
|
-
onResourceFilter: (
|
|
3210
|
+
onResourceFilter: (o) => this._handleResourceFilter(o)
|
|
3144
3211
|
}));
|
|
3145
3212
|
let k = this._events;
|
|
3146
|
-
|
|
3213
|
+
h && a.selectedResourceId && (k = this._events.filter((o) => o.resourceId === a.selectedResourceId));
|
|
3147
3214
|
let u = c;
|
|
3148
|
-
if (
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3215
|
+
if (h && a.selectedResourceId) {
|
|
3216
|
+
const o = c.find((m) => m.id === a.selectedResourceId);
|
|
3217
|
+
o && (u = [o]);
|
|
3151
3218
|
}
|
|
3152
3219
|
const p = document.createElement("div");
|
|
3153
3220
|
if (p.classList.add("cal-sched__body"), this.loading)
|
|
3154
|
-
if (
|
|
3155
|
-
p.appendChild(
|
|
3221
|
+
if (r === "month")
|
|
3222
|
+
p.appendChild(kt());
|
|
3156
3223
|
else {
|
|
3157
|
-
const
|
|
3158
|
-
p.appendChild(
|
|
3159
|
-
columns:
|
|
3160
|
-
rows: Math.ceil((
|
|
3224
|
+
const o = r === "week" ? 7 : Math.max(this._resources.length, 1);
|
|
3225
|
+
p.appendChild(wt({
|
|
3226
|
+
columns: o,
|
|
3227
|
+
rows: Math.ceil((w(this.endTime) - w(this.startTime)) / this.interval),
|
|
3161
3228
|
slotHeight: this.slotHeight
|
|
3162
3229
|
}));
|
|
3163
3230
|
}
|
|
3164
3231
|
else
|
|
3165
|
-
|
|
3166
|
-
date:
|
|
3232
|
+
r === "day" ? p.appendChild(ft({
|
|
3233
|
+
date: l,
|
|
3167
3234
|
resources: u,
|
|
3168
3235
|
events: k,
|
|
3169
3236
|
startTime: this.startTime,
|
|
@@ -3177,11 +3244,11 @@ class Pt extends Fe {
|
|
|
3177
3244
|
eventContent: this._eventContent,
|
|
3178
3245
|
showTime: this.showEventTime,
|
|
3179
3246
|
draggable: this.draggableEvents,
|
|
3180
|
-
onSlotClick: (
|
|
3181
|
-
onEventClick: (
|
|
3182
|
-
onSlotCreate: (
|
|
3183
|
-
})) :
|
|
3184
|
-
date:
|
|
3247
|
+
onSlotClick: (o, m, _, C, D) => this._handleSlotClick(o, m, _, C, D),
|
|
3248
|
+
onEventClick: (o, m, _) => this._handleEventClick(o, m, _),
|
|
3249
|
+
onSlotCreate: (o, m, _, C, D) => this._handleSlotCreate(o, m, _, C, D)
|
|
3250
|
+
})) : r === "week" ? p.appendChild(bt({
|
|
3251
|
+
date: l,
|
|
3185
3252
|
firstDay: this.firstDay,
|
|
3186
3253
|
resources: u,
|
|
3187
3254
|
events: k,
|
|
@@ -3198,38 +3265,38 @@ class Pt extends Fe {
|
|
|
3198
3265
|
draggable: this.draggableEvents,
|
|
3199
3266
|
allDayCollapsed: a.allDayCollapsed,
|
|
3200
3267
|
onToggleAllDay: () => this._store.set({ allDayCollapsed: !a.allDayCollapsed }),
|
|
3201
|
-
onSlotClick: (
|
|
3202
|
-
onEventClick: (
|
|
3203
|
-
onSlotCreate: (
|
|
3204
|
-
})) :
|
|
3205
|
-
date:
|
|
3268
|
+
onSlotClick: (o, m, _, C, D) => this._handleSlotClick(o, m, _, C, D),
|
|
3269
|
+
onEventClick: (o, m, _) => this._handleEventClick(o, m, _),
|
|
3270
|
+
onSlotCreate: (o, m, _, C, D) => this._handleSlotCreate(o, m, _, C, D)
|
|
3271
|
+
})) : r === "month" && p.appendChild(xt({
|
|
3272
|
+
date: l,
|
|
3206
3273
|
firstDay: this.firstDay,
|
|
3207
3274
|
resources: u,
|
|
3208
3275
|
events: k,
|
|
3209
3276
|
format: this.format,
|
|
3210
3277
|
selectedResourceId: a.selectedResourceId,
|
|
3211
|
-
selectedDate: ((
|
|
3278
|
+
selectedDate: ((f = a.selectedSlot) == null ? void 0 : f.date) || null,
|
|
3212
3279
|
eventContent: this._eventContent,
|
|
3213
|
-
onSlotClick: (
|
|
3214
|
-
onEventClick: (
|
|
3215
|
-
onSlotCreate: (
|
|
3280
|
+
onSlotClick: (o) => this._handleSlotClick(o, null, null, null, null),
|
|
3281
|
+
onEventClick: (o, m, _) => this._handleEventClick(o, m, _),
|
|
3282
|
+
onSlotCreate: (o) => this._handleSlotCreate(o, null, null, null, null)
|
|
3216
3283
|
}));
|
|
3217
|
-
n.appendChild(p), a.detailEvent && p.appendChild(
|
|
3284
|
+
n.appendChild(p), a.detailEvent && p.appendChild(Tt({
|
|
3218
3285
|
event: a.detailEvent,
|
|
3219
3286
|
resource: a.detailResource,
|
|
3220
3287
|
format: this.format,
|
|
3221
3288
|
onClose: () => this._closeDetail(),
|
|
3222
3289
|
actions: this._eventActions,
|
|
3223
|
-
onAction: (
|
|
3224
|
-
})), this.showFab && !this.loading && p.appendChild(
|
|
3290
|
+
onAction: (o) => this._handleEventAction(o)
|
|
3291
|
+
})), this.showFab && !this.loading && p.appendChild($t({
|
|
3225
3292
|
onClick: () => this._handleFabClick()
|
|
3226
|
-
})), e.appendChild(n), this._escHandler || (this._escHandler = (
|
|
3227
|
-
|
|
3293
|
+
})), e.appendChild(n), this._escHandler || (this._escHandler = (o) => {
|
|
3294
|
+
o.key === "Escape" && this._store.get("selectedSlot") && this._dismissSlot();
|
|
3228
3295
|
}, this.shadowRoot.addEventListener("keydown", this._escHandler), document.addEventListener("keydown", this._escHandler)), this._rendering = !1;
|
|
3229
3296
|
}
|
|
3230
3297
|
}
|
|
3231
|
-
customElements.get("cal-scheduler") || customElements.define("cal-scheduler",
|
|
3298
|
+
customElements.get("cal-scheduler") || customElements.define("cal-scheduler", Yt);
|
|
3232
3299
|
export {
|
|
3233
|
-
|
|
3300
|
+
Yt as CalScheduler
|
|
3234
3301
|
};
|
|
3235
3302
|
//# sourceMappingURL=scheduler.es.js.map
|