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/calkit.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Me extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.attachShadow({ mode: "open" }), this._initialized = !1;
|
|
4
4
|
}
|
|
@@ -27,6 +27,9 @@ class Se 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, a = {}) {
|
|
32
35
|
this.dispatchEvent(
|
|
@@ -51,7 +54,7 @@ class Se extends HTMLElement {
|
|
|
51
54
|
return this.shadowRoot.querySelectorAll(e);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function Ae(n) {
|
|
55
58
|
let e = { ...n };
|
|
56
59
|
const a = /* @__PURE__ */ new Set();
|
|
57
60
|
return {
|
|
@@ -78,7 +81,7 @@ function Te(n) {
|
|
|
78
81
|
}
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
|
-
const
|
|
84
|
+
const Ce = [
|
|
82
85
|
"January",
|
|
83
86
|
"February",
|
|
84
87
|
"March",
|
|
@@ -91,21 +94,82 @@ const ne = [
|
|
|
91
94
|
"October",
|
|
92
95
|
"November",
|
|
93
96
|
"December"
|
|
94
|
-
],
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
], wt = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Et = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Lt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
98
|
+
function st(n) {
|
|
99
|
+
if (!n) return Ce;
|
|
100
|
+
try {
|
|
101
|
+
const e = new Intl.DateTimeFormat(n, { month: "long" });
|
|
102
|
+
return Array.from({ length: 12 }, (a, t) => {
|
|
103
|
+
const s = e.format(new Date(2024, t, 1));
|
|
104
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
105
|
+
});
|
|
106
|
+
} catch {
|
|
107
|
+
return Ce;
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
function Re(n) {
|
|
111
|
+
if (!n)
|
|
112
|
+
return [
|
|
113
|
+
"Jan",
|
|
114
|
+
"Feb",
|
|
115
|
+
"Mar",
|
|
116
|
+
"Apr",
|
|
117
|
+
"May",
|
|
118
|
+
"Jun",
|
|
119
|
+
"Jul",
|
|
120
|
+
"Aug",
|
|
121
|
+
"Sep",
|
|
122
|
+
"Oct",
|
|
123
|
+
"Nov",
|
|
124
|
+
"Dec"
|
|
125
|
+
];
|
|
126
|
+
try {
|
|
127
|
+
const e = new Intl.DateTimeFormat(n, { month: "short" });
|
|
128
|
+
return Array.from({ length: 12 }, (a, t) => {
|
|
129
|
+
const s = e.format(new Date(2024, t, 1));
|
|
130
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
131
|
+
});
|
|
132
|
+
} catch {
|
|
133
|
+
return [
|
|
134
|
+
"Jan",
|
|
135
|
+
"Feb",
|
|
136
|
+
"Mar",
|
|
137
|
+
"Apr",
|
|
138
|
+
"May",
|
|
139
|
+
"Jun",
|
|
140
|
+
"Jul",
|
|
141
|
+
"Aug",
|
|
142
|
+
"Sep",
|
|
143
|
+
"Oct",
|
|
144
|
+
"Nov",
|
|
145
|
+
"Dec"
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function nt(n, e = "short", a) {
|
|
150
|
+
const t = U(n);
|
|
151
|
+
return t ? e === "long" ? Et[t.getDay()] : Lt[t.getDay()] : "";
|
|
152
|
+
}
|
|
153
|
+
function it(n = 0, e) {
|
|
154
|
+
if (e)
|
|
155
|
+
try {
|
|
156
|
+
const t = new Intl.DateTimeFormat(e, { weekday: "short" }), s = [];
|
|
157
|
+
for (let i = 0; i < 7; i++) {
|
|
158
|
+
const l = new Date(2024, 0, 7 + (n + i) % 7), r = t.format(l);
|
|
159
|
+
s.push(r.charAt(0).toUpperCase() + r.slice(1));
|
|
160
|
+
}
|
|
161
|
+
return s;
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
const a = [];
|
|
165
|
+
for (let t = 0; t < 7; t++)
|
|
166
|
+
a.push(wt[(n + t) % 7]);
|
|
167
|
+
return a;
|
|
104
168
|
}
|
|
105
|
-
function
|
|
169
|
+
function Ue(n, e) {
|
|
106
170
|
return new Date(n, e + 1, 0).getDate();
|
|
107
171
|
}
|
|
108
|
-
function
|
|
172
|
+
function Ct(n, e) {
|
|
109
173
|
return new Date(n, e, 1).getDay();
|
|
110
174
|
}
|
|
111
175
|
function Z(n) {
|
|
@@ -113,7 +177,7 @@ function Z(n) {
|
|
|
113
177
|
const e = n instanceof Date ? n : new Date(n.year, n.month, n.day), a = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0");
|
|
114
178
|
return `${a}-${t}-${s}`;
|
|
115
179
|
}
|
|
116
|
-
function
|
|
180
|
+
function U(n) {
|
|
117
181
|
if (!n) return null;
|
|
118
182
|
if (n instanceof Date) return n;
|
|
119
183
|
if (typeof n == "string") {
|
|
@@ -124,12 +188,12 @@ function G(n) {
|
|
|
124
188
|
}
|
|
125
189
|
function de(n, e) {
|
|
126
190
|
if (!n || !e) return !1;
|
|
127
|
-
const a =
|
|
191
|
+
const a = U(n), t = U(e);
|
|
128
192
|
return !a || !t ? !1 : a.getFullYear() === t.getFullYear() && a.getMonth() === t.getMonth() && a.getDate() === t.getDate();
|
|
129
193
|
}
|
|
130
|
-
function
|
|
194
|
+
function Dt(n, e, a) {
|
|
131
195
|
if (!n || !e || !a) return !1;
|
|
132
|
-
const t =
|
|
196
|
+
const t = U(n), s = U(e), i = U(a);
|
|
133
197
|
if (!t || !s || !i) return !1;
|
|
134
198
|
const l = t.getTime(), r = Math.min(s.getTime(), i.getTime()), o = Math.max(s.getTime(), i.getTime());
|
|
135
199
|
return l >= r && l <= o;
|
|
@@ -142,28 +206,28 @@ function ge(n, e, a) {
|
|
|
142
206
|
return { year: t.getFullYear(), month: t.getMonth() };
|
|
143
207
|
}
|
|
144
208
|
function ye(n, e) {
|
|
145
|
-
const a =
|
|
209
|
+
const a = U(n);
|
|
146
210
|
return a ? (a.setDate(a.getDate() + e), Z(a)) : n;
|
|
147
211
|
}
|
|
148
|
-
function
|
|
149
|
-
const t =
|
|
150
|
-
for (let
|
|
151
|
-
const u = h -
|
|
152
|
-
l.push({ year: o.year, month: o.month, day: u, dateString:
|
|
212
|
+
function lt(n, e, a = 0) {
|
|
213
|
+
const t = Ue(n, e), i = (Ct(n, e) - a + 7) % 7, l = [], r = me(), o = ge(n, e, -1), h = Ue(o.year, o.month);
|
|
214
|
+
for (let p = i - 1; p >= 0; p--) {
|
|
215
|
+
const u = h - p, g = Z({ year: o.year, month: o.month, day: u });
|
|
216
|
+
l.push({ year: o.year, month: o.month, day: u, dateString: g, isCurrentMonth: !1, isToday: g === r });
|
|
153
217
|
}
|
|
154
|
-
for (let
|
|
155
|
-
const u = Z({ year: n, month: e, day:
|
|
156
|
-
l.push({ year: n, month: e, day:
|
|
218
|
+
for (let p = 1; p <= t; p++) {
|
|
219
|
+
const u = Z({ year: n, month: e, day: p });
|
|
220
|
+
l.push({ year: n, month: e, day: p, dateString: u, isCurrentMonth: !0, isToday: u === r });
|
|
157
221
|
}
|
|
158
222
|
const c = ge(n, e, 1);
|
|
159
223
|
let d = 1;
|
|
160
224
|
for (; l.length < 42; ) {
|
|
161
|
-
const
|
|
162
|
-
l.push({ year: c.year, month: c.month, day: d, dateString:
|
|
225
|
+
const p = Z({ year: c.year, month: c.month, day: d });
|
|
226
|
+
l.push({ year: c.year, month: c.month, day: d, dateString: p, isCurrentMonth: !1, isToday: p === r }), d++;
|
|
163
227
|
}
|
|
164
228
|
return l;
|
|
165
229
|
}
|
|
166
|
-
const
|
|
230
|
+
const $e = `
|
|
167
231
|
:host {
|
|
168
232
|
/* Light theme (default) */
|
|
169
233
|
--cal-bg: 0 0% 100%;
|
|
@@ -331,7 +395,7 @@ const Me = `
|
|
|
331
395
|
--cal-status-success-border: 152 40% 28%;
|
|
332
396
|
}
|
|
333
397
|
}
|
|
334
|
-
`,
|
|
398
|
+
`, ze = `
|
|
335
399
|
:host {
|
|
336
400
|
display: inline-block;
|
|
337
401
|
font-family: inherit;
|
|
@@ -372,7 +436,7 @@ const Me = `
|
|
|
372
436
|
[hidden] {
|
|
373
437
|
display: none !important;
|
|
374
438
|
}
|
|
375
|
-
`,
|
|
439
|
+
`, Ie = `
|
|
376
440
|
@keyframes cal-fade-in {
|
|
377
441
|
from { opacity: 0; }
|
|
378
442
|
to { opacity: 1; }
|
|
@@ -436,30 +500,41 @@ const Me = `
|
|
|
436
500
|
.cal-skeleton--rect {
|
|
437
501
|
border-radius: var(--cal-radius-sm);
|
|
438
502
|
}
|
|
439
|
-
`,
|
|
503
|
+
`, Je = {
|
|
440
504
|
blue: { bg: "var(--cal-booking-blue-bg)", fg: "var(--cal-booking-blue-fg)", hover: "var(--cal-booking-blue-hover)" },
|
|
441
505
|
green: { bg: "var(--cal-booking-green-bg)", fg: "var(--cal-booking-green-fg)", hover: "var(--cal-booking-green-hover)" },
|
|
442
506
|
red: { bg: "var(--cal-booking-red-bg)", fg: "var(--cal-booking-red-fg)", hover: "var(--cal-booking-red-hover)" },
|
|
443
507
|
orange: { bg: "var(--cal-booking-orange-bg)", fg: "var(--cal-booking-orange-fg)", hover: "var(--cal-booking-orange-hover)" },
|
|
444
508
|
gray: { bg: "var(--cal-booking-gray-bg)", fg: "var(--cal-booking-gray-fg)", hover: "var(--cal-booking-gray-hover)" }
|
|
445
509
|
}, _e = "blue";
|
|
446
|
-
function xe(n) {
|
|
447
|
-
return
|
|
510
|
+
function xe(n, e) {
|
|
511
|
+
return e && e[n] ? e[n] : Je[n] || Je[_e];
|
|
512
|
+
}
|
|
513
|
+
function rt(n) {
|
|
514
|
+
if (!Array.isArray(n) || !n.length) return null;
|
|
515
|
+
const e = {};
|
|
516
|
+
for (const a of n)
|
|
517
|
+
!a.name || !a.bg || !a.fg || (e[a.name] = {
|
|
518
|
+
bg: a.bg,
|
|
519
|
+
fg: a.fg,
|
|
520
|
+
hover: a.hover || a.bg
|
|
521
|
+
});
|
|
522
|
+
return Object.keys(e).length ? e : null;
|
|
448
523
|
}
|
|
449
|
-
function
|
|
450
|
-
const
|
|
451
|
-
(
|
|
524
|
+
function Tt(n, e = [], a = {}, t = null, s = null) {
|
|
525
|
+
const i = e.find((f) => f.end === n), l = e.find((f) => f.start === n), r = e.find(
|
|
526
|
+
(f) => f.start < n && f.end > n
|
|
452
527
|
);
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
return { status:
|
|
528
|
+
let o = "available", h = null, c = !1, d = null, p = null, u = null;
|
|
529
|
+
i && l ? (o = "half-day", c = !0, d = xe(i.color || _e, s), p = xe(l.color || _e, s)) : r ? (o = "booked", u = xe(r.color || _e, s)) : l && !i ? (o = "checkin-only", p = xe(l.color || _e, s)) : i && !l && (o = "checkout-only", d = xe(i.color || _e, s));
|
|
530
|
+
const g = a[n];
|
|
531
|
+
if (g && (g.status && (o = g.status), g.label !== void 0 && (h = g.label)), t) {
|
|
532
|
+
const f = t(n);
|
|
533
|
+
f && (f.status && (o = f.status), f.label !== void 0 && (h = f.label));
|
|
534
|
+
}
|
|
535
|
+
return { status: o, label: h, checkoutBooking: i, checkinBooking: l, halfDay: c, colorOut: d, colorIn: p, colorFull: u };
|
|
461
536
|
}
|
|
462
|
-
function
|
|
537
|
+
function ot(n, e, a = []) {
|
|
463
538
|
if (!n || !e) return !0;
|
|
464
539
|
const t = n < e ? n : e, s = n < e ? e : n;
|
|
465
540
|
for (const i of a)
|
|
@@ -467,10 +542,10 @@ function at(n, e, a = []) {
|
|
|
467
542
|
return !1;
|
|
468
543
|
return !0;
|
|
469
544
|
}
|
|
470
|
-
function
|
|
471
|
-
return !n || !e ? !1 : !
|
|
545
|
+
function St(n, e, a = []) {
|
|
546
|
+
return !n || !e ? !1 : !ot(n, e, a);
|
|
472
547
|
}
|
|
473
|
-
function
|
|
548
|
+
function ct(n) {
|
|
474
549
|
const {
|
|
475
550
|
year: e,
|
|
476
551
|
month: a,
|
|
@@ -483,77 +558,79 @@ function st(n) {
|
|
|
483
558
|
maxDate: h,
|
|
484
559
|
disabledDates: c = [],
|
|
485
560
|
mode: d = "single",
|
|
486
|
-
focusedDate:
|
|
561
|
+
focusedDate: p,
|
|
487
562
|
onSelect: u,
|
|
488
|
-
onHover:
|
|
563
|
+
onHover: g,
|
|
489
564
|
// Booking-specific params
|
|
490
|
-
bookings:
|
|
565
|
+
bookings: f = null,
|
|
491
566
|
dayData: m = null,
|
|
492
|
-
labelFormula:
|
|
493
|
-
showLabelsOnHover:
|
|
494
|
-
|
|
495
|
-
|
|
567
|
+
labelFormula: b = null,
|
|
568
|
+
showLabelsOnHover: y = !1,
|
|
569
|
+
locale: w,
|
|
570
|
+
customColors: A = null
|
|
571
|
+
} = n, I = f !== null, q = document.createElement("div");
|
|
572
|
+
q.setAttribute("role", "grid"), q.classList.add("cal-grid");
|
|
496
573
|
const B = document.createElement("div");
|
|
497
574
|
B.setAttribute("role", "row"), B.classList.add("cal-weekdays");
|
|
498
|
-
for (const
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
return
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
|
|
575
|
+
for (const L of it(t, w)) {
|
|
576
|
+
const W = document.createElement("div");
|
|
577
|
+
W.setAttribute("role", "columnheader"), W.setAttribute("aria-label", L), W.classList.add("cal-weekday"), W.textContent = L, B.appendChild(W);
|
|
578
|
+
}
|
|
579
|
+
q.appendChild(B);
|
|
580
|
+
const j = lt(e, a, t), H = d === "range" && i && !l && r || I && i && !l && r ? r : l, F = I ? St(i, r, f) : !1;
|
|
581
|
+
let k;
|
|
582
|
+
return j.forEach((L, W) => {
|
|
583
|
+
W % 7 === 0 && (k = document.createElement("div"), k.setAttribute("role", "row"), k.classList.add("cal-row"), q.appendChild(k));
|
|
584
|
+
const v = document.createElement("button");
|
|
585
|
+
v.setAttribute("role", "gridcell"), v.setAttribute("part", "day"), v.classList.add("cal-day");
|
|
586
|
+
const C = L.dateString;
|
|
587
|
+
v.dataset.date = C;
|
|
588
|
+
const x = new Date(L.year, L.month, L.day);
|
|
589
|
+
v.setAttribute("aria-label", x.toLocaleDateString("en-US", {
|
|
513
590
|
weekday: "long",
|
|
514
591
|
year: "numeric",
|
|
515
592
|
month: "long",
|
|
516
593
|
day: "numeric"
|
|
517
|
-
})),
|
|
518
|
-
let
|
|
519
|
-
if (
|
|
520
|
-
|
|
521
|
-
const { status:
|
|
522
|
-
if (
|
|
523
|
-
let
|
|
524
|
-
if (
|
|
525
|
-
|
|
526
|
-
else if (
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
} else
|
|
530
|
-
|
|
594
|
+
})), L.isCurrentMonth || v.classList.add("cal-day--outside"), L.isToday && v.classList.add("cal-day--today");
|
|
595
|
+
let T = null, X = !1;
|
|
596
|
+
if (I) {
|
|
597
|
+
T = Tt(C, f, m || {}, b, A);
|
|
598
|
+
const { status: O, label: S, halfDay: M, colorOut: z, colorIn: G, colorFull: Q } = T;
|
|
599
|
+
if (O === "booked" && (v.classList.add("cal-day--booked"), Q && (v.style.setProperty("--booking-bg", `hsl(${Q.bg})`), v.style.setProperty("--booking-fg", `hsl(${Q.fg})`), v.style.setProperty("--booking-hover", `hsl(${Q.hover})`)), X = !0), O === "blocked" && (v.classList.add("cal-day--blocked"), X = !0), M && (v.classList.add("cal-day--half-day"), z && v.style.setProperty("--half-day-color-out", `hsl(${z.bg})`), G && v.style.setProperty("--half-day-color-in", `hsl(${G.bg})`), X = !0), O === "checkout-only" && (v.classList.add("cal-day--checkout-only"), z && v.style.setProperty("--half-day-color-out", `hsl(${z.bg})`)), O === "checkin-only" && (v.classList.add("cal-day--checkin-only"), G && v.style.setProperty("--half-day-color-in", `hsl(${G.bg})`)), y) {
|
|
600
|
+
let ne = null;
|
|
601
|
+
if (M && T.checkoutBooking && T.checkinBooking)
|
|
602
|
+
ne = `${T.checkoutBooking.label || ""} / ${T.checkinBooking.label || ""}`;
|
|
603
|
+
else if (O === "booked") {
|
|
604
|
+
const ve = f.find((E) => E.start <= C && E.end > C);
|
|
605
|
+
ve && (ne = ve.label);
|
|
606
|
+
} else O === "checkout-only" && T.checkoutBooking ? ne = T.checkoutBooking.label : O === "checkin-only" && T.checkinBooking && (ne = T.checkinBooking.label);
|
|
607
|
+
ne && v.setAttribute("data-booking-label", ne);
|
|
531
608
|
}
|
|
532
|
-
if (
|
|
533
|
-
const
|
|
534
|
-
|
|
609
|
+
if (F && i && !l && r) {
|
|
610
|
+
const ne = i < r ? i : r, ve = i < r ? r : i;
|
|
611
|
+
C >= ne && C <= ve && v.classList.add("cal-day--invalid-range");
|
|
535
612
|
}
|
|
536
613
|
}
|
|
537
|
-
if (
|
|
538
|
-
const
|
|
539
|
-
|
|
614
|
+
if (I ? i && l && (de(C, i) || de(C, l)) ? (v.classList.add("cal-day--selected"), v.setAttribute("aria-selected", "true")) : v.setAttribute("aria-selected", "false") : s.some((S) => de(S, C)) ? (v.classList.add("cal-day--selected"), v.setAttribute("aria-selected", "true")) : v.setAttribute("aria-selected", "false"), (d === "range" || I) && i && H) {
|
|
615
|
+
const O = de(C, i), S = de(C, H), M = Dt(C, i, H);
|
|
616
|
+
O && v.classList.add("cal-day--range-start"), S && v.classList.add("cal-day--range-end"), M && !O && !S && v.classList.add("cal-day--in-range");
|
|
540
617
|
}
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
|
|
618
|
+
const R = Mt(C, o, h, c) || X;
|
|
619
|
+
if (R && (v.classList.add("cal-day--disabled"), v.disabled = !0, v.setAttribute("aria-disabled", "true")), p && de(C, p) ? v.setAttribute("tabindex", "0") : v.setAttribute("tabindex", "-1"), I && T && T.label != null) {
|
|
620
|
+
v.classList.add("cal-day--with-label");
|
|
621
|
+
const O = document.createElement("span");
|
|
622
|
+
O.classList.add("cal-day__number"), O.textContent = L.day, v.appendChild(O);
|
|
623
|
+
const S = document.createElement("span");
|
|
624
|
+
S.classList.add("cal-day__label"), S.textContent = T.label, v.appendChild(S);
|
|
548
625
|
} else
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}),
|
|
626
|
+
v.textContent = L.day;
|
|
627
|
+
R ? I && v.addEventListener("mouseenter", () => g == null ? void 0 : g(C)) : (v.addEventListener("click", () => u == null ? void 0 : u(C)), v.addEventListener("mouseenter", () => g == null ? void 0 : g(C))), k.appendChild(v);
|
|
628
|
+
}), q.addEventListener("mouseleave", () => g == null ? void 0 : g(null)), q;
|
|
552
629
|
}
|
|
553
|
-
function
|
|
630
|
+
function Mt(n, e, a, t) {
|
|
554
631
|
return !!(t.includes(n) || e && n < e || a && n > a);
|
|
555
632
|
}
|
|
556
|
-
const
|
|
633
|
+
const dt = `
|
|
557
634
|
.cal-grid {
|
|
558
635
|
display: flex;
|
|
559
636
|
flex-direction: column;
|
|
@@ -811,18 +888,18 @@ const nt = `
|
|
|
811
888
|
pointer-events: none;
|
|
812
889
|
z-index: 10;
|
|
813
890
|
}
|
|
814
|
-
`,
|
|
815
|
-
function
|
|
816
|
-
const
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
return
|
|
891
|
+
`, je = '<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>', Ne = '<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>';
|
|
892
|
+
function De({ year: n, month: e, onPrev: a, onNext: t, onTitleClick: s, locale: i }) {
|
|
893
|
+
const l = document.createElement("div");
|
|
894
|
+
l.classList.add("cal-nav");
|
|
895
|
+
const r = document.createElement("button");
|
|
896
|
+
r.classList.add("cal-nav__btn", "cal-nav__btn--prev"), r.innerHTML = je, r.setAttribute("aria-label", "Previous month"), r.addEventListener("click", a);
|
|
897
|
+
const o = st(i), h = s ? "button" : "div", c = document.createElement(h);
|
|
898
|
+
c.classList.add("cal-nav__title"), s && (c.classList.add("cal-nav__title--interactive"), c.setAttribute("aria-label", `Select month and year, currently ${o[e]} ${n}`), c.addEventListener("click", s)), c.setAttribute("aria-live", "polite"), c.textContent = `${o[e]} ${n}`;
|
|
899
|
+
const d = document.createElement("button");
|
|
900
|
+
return d.classList.add("cal-nav__btn", "cal-nav__btn--next"), d.innerHTML = Ne, d.setAttribute("aria-label", "Next month"), d.addEventListener("click", t), l.appendChild(r), l.appendChild(c), l.appendChild(d), l;
|
|
824
901
|
}
|
|
825
|
-
const
|
|
902
|
+
const ht = `
|
|
826
903
|
.cal-nav {
|
|
827
904
|
display: flex;
|
|
828
905
|
align-items: center;
|
|
@@ -863,51 +940,39 @@ const it = `
|
|
|
863
940
|
.cal-nav__title--interactive:hover {
|
|
864
941
|
background: hsl(var(--cal-hover));
|
|
865
942
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
"Feb",
|
|
869
|
-
"Mar",
|
|
870
|
-
"Apr",
|
|
871
|
-
"May",
|
|
872
|
-
"Jun",
|
|
873
|
-
"Jul",
|
|
874
|
-
"Aug",
|
|
875
|
-
"Sep",
|
|
876
|
-
"Oct",
|
|
877
|
-
"Nov",
|
|
878
|
-
"Dec"
|
|
879
|
-
];
|
|
880
|
-
function lt({
|
|
943
|
+
`;
|
|
944
|
+
function ut({
|
|
881
945
|
pickerYear: n,
|
|
882
946
|
viewMonth: e,
|
|
883
947
|
viewYear: a,
|
|
884
948
|
onMonthSelect: t,
|
|
885
949
|
onYearPrev: s,
|
|
886
950
|
onYearNext: i,
|
|
887
|
-
onClose: l
|
|
951
|
+
onClose: l,
|
|
952
|
+
locale: r
|
|
888
953
|
}) {
|
|
889
|
-
const r = document.createElement("div");
|
|
890
|
-
r.classList.add("cal-myp", "cal-animate-fade");
|
|
891
954
|
const o = document.createElement("div");
|
|
892
|
-
o.classList.add("cal-
|
|
893
|
-
const h = document.createElement("
|
|
894
|
-
h.classList.add("cal-
|
|
895
|
-
const c = document.createElement("
|
|
896
|
-
c.classList.add("cal-
|
|
897
|
-
const d = document.createElement("
|
|
898
|
-
d.classList.add("cal-
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
const u =
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
955
|
+
o.classList.add("cal-myp", "cal-animate-fade");
|
|
956
|
+
const h = document.createElement("div");
|
|
957
|
+
h.classList.add("cal-myp__year-nav");
|
|
958
|
+
const c = document.createElement("button");
|
|
959
|
+
c.classList.add("cal-nav__btn"), c.innerHTML = je, c.setAttribute("aria-label", "Previous year"), c.addEventListener("click", s);
|
|
960
|
+
const d = document.createElement("div");
|
|
961
|
+
d.classList.add("cal-myp__year-label"), d.textContent = n;
|
|
962
|
+
const p = document.createElement("button");
|
|
963
|
+
p.classList.add("cal-nav__btn"), p.innerHTML = Ne, p.setAttribute("aria-label", "Next year"), p.addEventListener("click", i), h.appendChild(c), h.appendChild(d), h.appendChild(p), o.appendChild(h);
|
|
964
|
+
const u = document.createElement("div");
|
|
965
|
+
u.classList.add("cal-myp__grid");
|
|
966
|
+
const g = Re(r), f = /* @__PURE__ */ new Date(), m = f.getMonth(), b = f.getFullYear();
|
|
967
|
+
for (let y = 0; y < 12; y++) {
|
|
968
|
+
const w = document.createElement("button");
|
|
969
|
+
w.classList.add("cal-myp__cell"), w.textContent = g[y], y === e && n === a && w.classList.add("cal-myp__cell--active"), y === m && n === b && w.classList.add("cal-myp__cell--today"), w.addEventListener("click", () => t(y, n)), u.appendChild(w);
|
|
970
|
+
}
|
|
971
|
+
return o.appendChild(u), o.addEventListener("keydown", (y) => {
|
|
972
|
+
y.key === "Escape" && (y.stopPropagation(), l());
|
|
973
|
+
}), o;
|
|
909
974
|
}
|
|
910
|
-
const
|
|
975
|
+
const pt = `
|
|
911
976
|
.cal-myp {
|
|
912
977
|
width: calc(7 * var(--cal-cell-size));
|
|
913
978
|
}
|
|
@@ -965,58 +1030,74 @@ const rt = `
|
|
|
965
1030
|
border: 1px solid hsl(var(--cal-border));
|
|
966
1031
|
font-weight: 600;
|
|
967
1032
|
}
|
|
968
|
-
|
|
969
|
-
|
|
1033
|
+
`, Ve = {
|
|
1034
|
+
today: "Today",
|
|
1035
|
+
"this-week": "This Week",
|
|
1036
|
+
"next-7": "Next 7 Days",
|
|
1037
|
+
"next-30": "Next 30 Days"
|
|
1038
|
+
};
|
|
1039
|
+
function Le(n, e) {
|
|
1040
|
+
if (!e) return Ve[n] || n;
|
|
1041
|
+
try {
|
|
1042
|
+
if (n === "today") {
|
|
1043
|
+
const s = new Intl.RelativeTimeFormat(e, { numeric: "auto" }).formatToParts(0, "day").map((i) => i.value).join("");
|
|
1044
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
1045
|
+
}
|
|
1046
|
+
} catch {
|
|
1047
|
+
}
|
|
1048
|
+
return Ve[n] || n;
|
|
1049
|
+
}
|
|
1050
|
+
function At(n) {
|
|
970
1051
|
return [
|
|
971
1052
|
{
|
|
972
1053
|
key: "today",
|
|
973
|
-
label: "
|
|
1054
|
+
label: Le("today", n),
|
|
974
1055
|
resolve() {
|
|
975
|
-
const
|
|
976
|
-
return { start:
|
|
1056
|
+
const e = me();
|
|
1057
|
+
return { start: e, end: e };
|
|
977
1058
|
}
|
|
978
1059
|
},
|
|
979
1060
|
{
|
|
980
1061
|
key: "this-week",
|
|
981
|
-
label: "
|
|
1062
|
+
label: Le("this-week", n),
|
|
982
1063
|
resolve() {
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
const
|
|
986
|
-
return
|
|
1064
|
+
const e = /* @__PURE__ */ new Date(), a = e.getDay(), t = new Date(e);
|
|
1065
|
+
t.setDate(e.getDate() - a);
|
|
1066
|
+
const s = new Date(t);
|
|
1067
|
+
return s.setDate(t.getDate() + 6), { start: Z(t), end: Z(s) };
|
|
987
1068
|
}
|
|
988
1069
|
},
|
|
989
1070
|
{
|
|
990
1071
|
key: "next-7",
|
|
991
|
-
label: "
|
|
1072
|
+
label: Le("next-7", n),
|
|
992
1073
|
resolve() {
|
|
993
|
-
const
|
|
994
|
-
return
|
|
1074
|
+
const e = /* @__PURE__ */ new Date(), a = /* @__PURE__ */ new Date();
|
|
1075
|
+
return a.setDate(e.getDate() + 6), { start: Z(e), end: Z(a) };
|
|
995
1076
|
}
|
|
996
1077
|
},
|
|
997
1078
|
{
|
|
998
1079
|
key: "next-30",
|
|
999
|
-
label: "
|
|
1080
|
+
label: Le("next-30", n),
|
|
1000
1081
|
resolve() {
|
|
1001
|
-
const
|
|
1002
|
-
return
|
|
1082
|
+
const e = /* @__PURE__ */ new Date(), a = /* @__PURE__ */ new Date();
|
|
1083
|
+
return a.setDate(e.getDate() + 29), { start: Z(e), end: Z(a) };
|
|
1003
1084
|
}
|
|
1004
1085
|
}
|
|
1005
1086
|
];
|
|
1006
1087
|
}
|
|
1007
|
-
function
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
for (const
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1014
|
-
e == null || e(
|
|
1015
|
-
}),
|
|
1088
|
+
function $t({ presetKeys: n, onSelect: e, locale: a }) {
|
|
1089
|
+
const t = document.createElement("div");
|
|
1090
|
+
t.classList.add("cal-presets");
|
|
1091
|
+
const s = At(a), i = n.map((l) => s.find((r) => r.key === l)).filter(Boolean);
|
|
1092
|
+
for (const l of i) {
|
|
1093
|
+
const r = document.createElement("button");
|
|
1094
|
+
r.classList.add("cal-preset"), r.textContent = l.label, r.addEventListener("click", () => {
|
|
1095
|
+
e == null || e(l.resolve());
|
|
1096
|
+
}), t.appendChild(r);
|
|
1016
1097
|
}
|
|
1017
|
-
return
|
|
1098
|
+
return t;
|
|
1018
1099
|
}
|
|
1019
|
-
const
|
|
1100
|
+
const zt = `
|
|
1020
1101
|
.cal-presets {
|
|
1021
1102
|
display: flex;
|
|
1022
1103
|
flex-wrap: wrap;
|
|
@@ -1043,14 +1124,14 @@ const Tt = `
|
|
|
1043
1124
|
background: hsl(var(--cal-hover));
|
|
1044
1125
|
}
|
|
1045
1126
|
`;
|
|
1046
|
-
function
|
|
1127
|
+
function qe({ trigger: n, content: e, onClose: a }) {
|
|
1047
1128
|
const t = document.createElement("div");
|
|
1048
1129
|
t.classList.add("cal-popover"), t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "false"), t.style.display = "none", t.appendChild(e);
|
|
1049
1130
|
let s = !1;
|
|
1050
1131
|
function i() {
|
|
1051
1132
|
t.classList.remove("cal-popover--above");
|
|
1052
|
-
const d = n.getBoundingClientRect(),
|
|
1053
|
-
u <
|
|
1133
|
+
const d = n.getBoundingClientRect(), p = t.offsetHeight, u = window.innerHeight - d.bottom, g = d.top;
|
|
1134
|
+
u < p + 8 && g > u ? (t.classList.add("cal-popover--above"), t.style.top = "auto", t.style.bottom = "100%", t.style.marginBottom = "4px", t.style.marginTop = "0") : (t.style.top = "100%", t.style.bottom = "auto", t.style.marginTop = "4px", t.style.marginBottom = "0");
|
|
1054
1135
|
}
|
|
1055
1136
|
function l() {
|
|
1056
1137
|
s || (s = !0, t.style.display = "", t.classList.add("cal-animate-slide-up"), requestAnimationFrame(() => i()), document.addEventListener("click", o, !0), document.addEventListener("keydown", h, !0));
|
|
@@ -1060,8 +1141,8 @@ function Ne({ trigger: n, content: e, onClose: a }) {
|
|
|
1060
1141
|
}
|
|
1061
1142
|
function o(d) {
|
|
1062
1143
|
var u;
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1144
|
+
const p = (u = n.getRootNode()) == null ? void 0 : u.host;
|
|
1145
|
+
p && !p.contains(d.target) && d.target !== p && r();
|
|
1065
1146
|
}
|
|
1066
1147
|
function h(d) {
|
|
1067
1148
|
d.key === "Escape" && (d.stopPropagation(), r());
|
|
@@ -1073,7 +1154,7 @@ function Ne({ trigger: n, content: e, onClose: a }) {
|
|
|
1073
1154
|
return s;
|
|
1074
1155
|
} };
|
|
1075
1156
|
}
|
|
1076
|
-
const
|
|
1157
|
+
const We = `
|
|
1077
1158
|
.cal-popover-wrapper {
|
|
1078
1159
|
position: relative;
|
|
1079
1160
|
display: inline-block;
|
|
@@ -1119,7 +1200,7 @@ const Re = `
|
|
|
1119
1200
|
color: hsl(var(--cal-fg-muted));
|
|
1120
1201
|
}
|
|
1121
1202
|
`;
|
|
1122
|
-
function
|
|
1203
|
+
function gt({ columns: n = 3, rows: e = 4, durationLabels: a = !1 } = {}) {
|
|
1123
1204
|
const t = document.createElement("div");
|
|
1124
1205
|
t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-skeleton-time-grid"), a && t.classList.add("cal-skeleton-time-grid--duration");
|
|
1125
1206
|
const s = n * e;
|
|
@@ -1129,7 +1210,7 @@ function ot({ columns: n = 3, rows: e = 4, durationLabels: a = !1 } = {}) {
|
|
|
1129
1210
|
}
|
|
1130
1211
|
return t;
|
|
1131
1212
|
}
|
|
1132
|
-
function
|
|
1213
|
+
function mt({ rows: n = 5 } = {}) {
|
|
1133
1214
|
const e = document.createElement("div");
|
|
1134
1215
|
e.setAttribute("role", "status"), e.setAttribute("aria-label", "Loading..."), e.classList.add("cal-skeleton-calendar-grid");
|
|
1135
1216
|
for (let t = 0; t < 7; t++) {
|
|
@@ -1143,7 +1224,7 @@ function ct({ rows: n = 5 } = {}) {
|
|
|
1143
1224
|
}
|
|
1144
1225
|
return e;
|
|
1145
1226
|
}
|
|
1146
|
-
const
|
|
1227
|
+
const Xe = `
|
|
1147
1228
|
.cal-skeleton-time-grid {
|
|
1148
1229
|
display: grid;
|
|
1149
1230
|
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
|
@@ -1176,17 +1257,17 @@ const je = `
|
|
|
1176
1257
|
aspect-ratio: 1;
|
|
1177
1258
|
border-radius: var(--cal-radius-sm) !important;
|
|
1178
1259
|
}
|
|
1179
|
-
`,
|
|
1260
|
+
`, Ze = {
|
|
1180
1261
|
error: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',
|
|
1181
1262
|
warning: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',
|
|
1182
1263
|
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>',
|
|
1183
1264
|
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>'
|
|
1184
1265
|
};
|
|
1185
|
-
function
|
|
1266
|
+
function Ye({ type: n = "info", message: e, dismissible: a = !0, onDismiss: t }) {
|
|
1186
1267
|
const s = document.createElement("div");
|
|
1187
1268
|
s.classList.add("cal-status", `cal-status--${n}`, "cal-animate-slide-up"), s.setAttribute("role", n === "error" ? "alert" : "status"), s.setAttribute("aria-live", n === "error" ? "assertive" : "polite");
|
|
1188
1269
|
const i = document.createElement("span");
|
|
1189
|
-
i.classList.add("cal-status__icon"), i.innerHTML =
|
|
1270
|
+
i.classList.add("cal-status__icon"), i.innerHTML = Ze[n] || Ze.info, s.appendChild(i);
|
|
1190
1271
|
const l = document.createElement("span");
|
|
1191
1272
|
if (l.classList.add("cal-status__text"), l.textContent = e, s.appendChild(l), a) {
|
|
1192
1273
|
const r = document.createElement("button");
|
|
@@ -1194,7 +1275,7 @@ function ze({ type: n = "info", message: e, dismissible: a = !0, onDismiss: t })
|
|
|
1194
1275
|
}
|
|
1195
1276
|
return s;
|
|
1196
1277
|
}
|
|
1197
|
-
const
|
|
1278
|
+
const Pe = `
|
|
1198
1279
|
.cal-status {
|
|
1199
1280
|
display: flex;
|
|
1200
1281
|
align-items: center;
|
|
@@ -1256,7 +1337,7 @@ const Ye = `
|
|
|
1256
1337
|
color: hsl(var(--cal-status-success-fg));
|
|
1257
1338
|
border: 1px solid hsl(var(--cal-status-success-border));
|
|
1258
1339
|
}
|
|
1259
|
-
`,
|
|
1340
|
+
`, It = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', Yt = `
|
|
1260
1341
|
.cal-picker {
|
|
1261
1342
|
background: hsl(var(--cal-bg));
|
|
1262
1343
|
border-radius: var(--cal-radius);
|
|
@@ -1277,9 +1358,9 @@ const Ye = `
|
|
|
1277
1358
|
flex: 0 0 auto;
|
|
1278
1359
|
}
|
|
1279
1360
|
`;
|
|
1280
|
-
class
|
|
1361
|
+
class Pt extends Me {
|
|
1281
1362
|
static get styles() {
|
|
1282
|
-
return [
|
|
1363
|
+
return [$e, ze, Ie, dt, ht, pt, zt, We, Xe, Pe, Yt];
|
|
1283
1364
|
}
|
|
1284
1365
|
static get observedAttributes() {
|
|
1285
1366
|
return ["mode", "display", "theme", "value", "min-date", "max-date", "disabled-dates", "first-day", "locale", "presets", "placeholder", "loading"];
|
|
@@ -1287,7 +1368,7 @@ class $t extends Se {
|
|
|
1287
1368
|
constructor() {
|
|
1288
1369
|
super();
|
|
1289
1370
|
const e = /* @__PURE__ */ new Date();
|
|
1290
|
-
this._store =
|
|
1371
|
+
this._store = Ae({
|
|
1291
1372
|
viewYear: e.getFullYear(),
|
|
1292
1373
|
viewMonth: e.getMonth(),
|
|
1293
1374
|
selectedDates: [],
|
|
@@ -1323,6 +1404,9 @@ class $t extends Se {
|
|
|
1323
1404
|
get maxDate() {
|
|
1324
1405
|
return this.getAttribute("max-date") || null;
|
|
1325
1406
|
}
|
|
1407
|
+
get locale() {
|
|
1408
|
+
return this.getAttribute("locale") || void 0;
|
|
1409
|
+
}
|
|
1326
1410
|
get loading() {
|
|
1327
1411
|
return this.hasAttribute("loading");
|
|
1328
1412
|
}
|
|
@@ -1353,7 +1437,7 @@ class $t extends Se {
|
|
|
1353
1437
|
} else this.mode === "multi" && Array.isArray(e) ? (this._store.set({ selectedDates: e }), e.length && this._navigateToDate(e[0])) : typeof e == "string" ? (this._store.set({ selectedDates: [e], rangeStart: null, rangeEnd: null }), this._navigateToDate(e)) : this._store.set({ selectedDates: [], rangeStart: null, rangeEnd: null });
|
|
1354
1438
|
}
|
|
1355
1439
|
_navigateToDate(e) {
|
|
1356
|
-
const a =
|
|
1440
|
+
const a = U(e);
|
|
1357
1441
|
a && this._store.set({ viewYear: a.getFullYear(), viewMonth: a.getMonth() });
|
|
1358
1442
|
}
|
|
1359
1443
|
connectedCallback() {
|
|
@@ -1454,7 +1538,7 @@ class $t extends Se {
|
|
|
1454
1538
|
e.stopPropagation(), this._store.set({ pickingMonth: !1 });
|
|
1455
1539
|
return;
|
|
1456
1540
|
}
|
|
1457
|
-
const a = this._store.getState(), t =
|
|
1541
|
+
const a = this._store.getState(), t = U(a.focusedDate);
|
|
1458
1542
|
if (!t) return;
|
|
1459
1543
|
let s = null;
|
|
1460
1544
|
switch (e.key) {
|
|
@@ -1503,8 +1587,8 @@ class $t extends Se {
|
|
|
1503
1587
|
const o = r === t, h = r === i;
|
|
1504
1588
|
let c = !1;
|
|
1505
1589
|
if (t && i) {
|
|
1506
|
-
const d = t < i ? t : i,
|
|
1507
|
-
c = r >= d && r <=
|
|
1590
|
+
const d = t < i ? t : i, p = t < i ? i : t;
|
|
1591
|
+
c = r >= d && r <= p && !o && !h;
|
|
1508
1592
|
}
|
|
1509
1593
|
l.classList.toggle("cal-day--range-start", o && !!i), l.classList.toggle("cal-day--range-end", h && !!i), l.classList.toggle("cal-day--in-range", c);
|
|
1510
1594
|
}
|
|
@@ -1519,10 +1603,18 @@ class $t extends Se {
|
|
|
1519
1603
|
goToMonth(e, a) {
|
|
1520
1604
|
this._store.set({ viewYear: a, viewMonth: e });
|
|
1521
1605
|
}
|
|
1606
|
+
clear() {
|
|
1607
|
+
this._store.set({
|
|
1608
|
+
selectedDates: [],
|
|
1609
|
+
rangeStart: null,
|
|
1610
|
+
rangeEnd: null,
|
|
1611
|
+
hoverDate: null
|
|
1612
|
+
}), this.emit("cal:change", { value: null });
|
|
1613
|
+
}
|
|
1522
1614
|
// -- Render --
|
|
1523
1615
|
_renderCalendarContent() {
|
|
1524
1616
|
const e = this._store.getState(), a = document.createElement("div");
|
|
1525
|
-
if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(
|
|
1617
|
+
if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(Ye({
|
|
1526
1618
|
type: e.statusType,
|
|
1527
1619
|
message: e.statusMessage,
|
|
1528
1620
|
dismissible: e.statusDismissible,
|
|
@@ -1531,14 +1623,14 @@ class $t extends Se {
|
|
|
1531
1623
|
const l = document.createElement("div");
|
|
1532
1624
|
l.classList.add("cal-months");
|
|
1533
1625
|
const r = document.createElement("div");
|
|
1534
|
-
return r.classList.add("cal-month"), r.appendChild(
|
|
1626
|
+
return r.classList.add("cal-month"), r.appendChild(mt()), l.appendChild(r), a.appendChild(l), a.addEventListener("keydown", (o) => this._handleKeydown(o)), a;
|
|
1535
1627
|
}
|
|
1536
1628
|
const t = document.createElement("div");
|
|
1537
1629
|
t.classList.add("cal-months");
|
|
1538
1630
|
const s = this.mode === "range" && this.hasAttribute("dual"), i = s ? 2 : 1;
|
|
1539
1631
|
for (let l = 0; l < i; l++) {
|
|
1540
1632
|
const { year: r, month: o } = l === 0 ? { year: e.viewYear, month: e.viewMonth } : ge(e.viewYear, e.viewMonth, 1), h = document.createElement("div");
|
|
1541
|
-
if (h.classList.add("cal-month"), l === 0 && h.appendChild(
|
|
1633
|
+
if (h.classList.add("cal-month"), l === 0 && h.appendChild(De({
|
|
1542
1634
|
year: r,
|
|
1543
1635
|
month: o,
|
|
1544
1636
|
onPrev: e.pickingMonth ? () => {
|
|
@@ -1547,26 +1639,29 @@ class $t extends Se {
|
|
|
1547
1639
|
} : () => {
|
|
1548
1640
|
s || this._nextMonth();
|
|
1549
1641
|
},
|
|
1550
|
-
onTitleClick: () => this._toggleMonthPicker()
|
|
1551
|
-
|
|
1642
|
+
onTitleClick: () => this._toggleMonthPicker(),
|
|
1643
|
+
locale: this.locale
|
|
1644
|
+
})), l === 1 && h.appendChild(De({
|
|
1552
1645
|
year: r,
|
|
1553
1646
|
month: o,
|
|
1554
1647
|
onPrev: () => {
|
|
1555
1648
|
},
|
|
1556
|
-
onNext: () => this._nextMonth()
|
|
1649
|
+
onNext: () => this._nextMonth(),
|
|
1650
|
+
locale: this.locale
|
|
1557
1651
|
})), e.pickingMonth && l === 0) {
|
|
1558
|
-
const c =
|
|
1652
|
+
const c = ut({
|
|
1559
1653
|
pickerYear: e.pickerYear,
|
|
1560
1654
|
viewMonth: e.viewMonth,
|
|
1561
1655
|
viewYear: e.viewYear,
|
|
1562
|
-
onMonthSelect: (d,
|
|
1656
|
+
onMonthSelect: (d, p) => this._selectMonthFromPicker(d, p),
|
|
1563
1657
|
onYearPrev: () => this._store.set({ pickerYear: e.pickerYear - 1 }),
|
|
1564
1658
|
onYearNext: () => this._store.set({ pickerYear: e.pickerYear + 1 }),
|
|
1565
|
-
onClose: () => this._store.set({ pickingMonth: !1 })
|
|
1659
|
+
onClose: () => this._store.set({ pickingMonth: !1 }),
|
|
1660
|
+
locale: this.locale
|
|
1566
1661
|
});
|
|
1567
1662
|
h.appendChild(c);
|
|
1568
1663
|
} else {
|
|
1569
|
-
const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d =
|
|
1664
|
+
const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = ct({
|
|
1570
1665
|
year: r,
|
|
1571
1666
|
month: o,
|
|
1572
1667
|
firstDay: this.firstDay,
|
|
@@ -1579,16 +1674,18 @@ class $t extends Se {
|
|
|
1579
1674
|
disabledDates: this.disabledDates,
|
|
1580
1675
|
mode: this.mode,
|
|
1581
1676
|
focusedDate: e.focusedDate,
|
|
1582
|
-
onSelect: (
|
|
1583
|
-
onHover: (
|
|
1677
|
+
onSelect: (p) => this._handleSelect(p),
|
|
1678
|
+
onHover: (p) => this._handleHover(p),
|
|
1679
|
+
locale: this.locale
|
|
1584
1680
|
});
|
|
1585
1681
|
c && d.classList.add(c), h.appendChild(d);
|
|
1586
1682
|
}
|
|
1587
1683
|
t.appendChild(h);
|
|
1588
1684
|
}
|
|
1589
|
-
return a.appendChild(t), this.mode === "range" && this.presetKeys.length && a.appendChild(
|
|
1685
|
+
return a.appendChild(t), this.mode === "range" && this.presetKeys.length && a.appendChild($t({
|
|
1590
1686
|
presetKeys: this.presetKeys,
|
|
1591
|
-
onSelect: (l) => this._handlePresetSelect(l)
|
|
1687
|
+
onSelect: (l) => this._handlePresetSelect(l),
|
|
1688
|
+
locale: this.locale
|
|
1592
1689
|
})), a.addEventListener("keydown", (l) => this._handleKeydown(l)), a;
|
|
1593
1690
|
}
|
|
1594
1691
|
_formatTriggerText() {
|
|
@@ -1596,8 +1693,14 @@ class $t extends Se {
|
|
|
1596
1693
|
return this.mode === "range" && e.rangeStart && e.rangeEnd ? `${this._formatShortDate(e.rangeStart)} – ${this._formatShortDate(e.rangeEnd)}` : e.selectedDates.length ? this.mode === "multi" ? `${e.selectedDates.length} dates selected` : this._formatShortDate(e.selectedDates[0]) : null;
|
|
1597
1694
|
}
|
|
1598
1695
|
_formatShortDate(e) {
|
|
1599
|
-
const a =
|
|
1600
|
-
|
|
1696
|
+
const a = U(e);
|
|
1697
|
+
if (!a) return e;
|
|
1698
|
+
if (this.locale)
|
|
1699
|
+
try {
|
|
1700
|
+
return new Intl.DateTimeFormat(this.locale, { month: "short", day: "numeric", year: "numeric" }).format(a);
|
|
1701
|
+
} catch {
|
|
1702
|
+
}
|
|
1703
|
+
return `${Re(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
|
|
1601
1704
|
}
|
|
1602
1705
|
render() {
|
|
1603
1706
|
var t;
|
|
@@ -1612,10 +1715,10 @@ class $t extends Se {
|
|
|
1612
1715
|
const i = document.createElement("button");
|
|
1613
1716
|
i.classList.add("cal-trigger");
|
|
1614
1717
|
const l = document.createElement("span");
|
|
1615
|
-
l.classList.add("cal-trigger__icon"), l.innerHTML =
|
|
1718
|
+
l.classList.add("cal-trigger__icon"), l.innerHTML = It, i.appendChild(l);
|
|
1616
1719
|
const r = this._formatTriggerText(), o = document.createElement("span");
|
|
1617
1720
|
r ? o.textContent = r : (o.textContent = this.placeholder, o.classList.add("cal-trigger--placeholder")), i.appendChild(o), s.appendChild(i);
|
|
1618
|
-
const h = this._renderCalendarContent(), c =
|
|
1721
|
+
const h = this._renderCalendarContent(), c = qe({
|
|
1619
1722
|
trigger: i,
|
|
1620
1723
|
content: h,
|
|
1621
1724
|
onClose: () => {
|
|
@@ -1649,7 +1752,7 @@ function he(n, e, a = "24h") {
|
|
|
1649
1752
|
}
|
|
1650
1753
|
return `${String(n).padStart(2, "0")}:${t}`;
|
|
1651
1754
|
}
|
|
1652
|
-
function
|
|
1755
|
+
function _(n) {
|
|
1653
1756
|
const e = le(n);
|
|
1654
1757
|
return e ? e.hours * 60 + e.minutes : 0;
|
|
1655
1758
|
}
|
|
@@ -1658,28 +1761,32 @@ function ie(n) {
|
|
|
1658
1761
|
return `${String(e).padStart(2, "0")}:${String(a).padStart(2, "0")}`;
|
|
1659
1762
|
}
|
|
1660
1763
|
function Ee(n, e, a) {
|
|
1661
|
-
const t = [], s =
|
|
1764
|
+
const t = [], s = _(n);
|
|
1765
|
+
let i = _(e);
|
|
1766
|
+
i <= s && (i += 1440);
|
|
1662
1767
|
for (let l = s; l <= i; l += a)
|
|
1663
|
-
t.push(ie(l));
|
|
1768
|
+
t.push(ie(l % 1440));
|
|
1664
1769
|
return t;
|
|
1665
1770
|
}
|
|
1666
|
-
function
|
|
1667
|
-
const s = [], i =
|
|
1771
|
+
function ft(n, e, a, t = "24h") {
|
|
1772
|
+
const s = [], i = _(n);
|
|
1773
|
+
let l = _(e);
|
|
1774
|
+
l <= i && (l += 1440);
|
|
1668
1775
|
for (let r = i; r <= l; r += a) {
|
|
1669
|
-
const o = ie(r), h = r + a, c = ie(Math.min(h, l + a)), d = le(o),
|
|
1670
|
-
s.push({ time: o, displayText: `${u}–${
|
|
1776
|
+
const o = ie(r % 1440), h = r + a, c = ie(Math.min(h, l + a) % 1440), d = le(o), p = le(c), u = d ? he(d.hours, d.minutes, t) : o, g = p ? he(p.hours, p.minutes, t) : c;
|
|
1777
|
+
s.push({ time: o, displayText: `${u}–${g}` });
|
|
1671
1778
|
}
|
|
1672
1779
|
return s;
|
|
1673
1780
|
}
|
|
1674
|
-
function
|
|
1781
|
+
function bt() {
|
|
1675
1782
|
const n = /* @__PURE__ */ new Date();
|
|
1676
1783
|
return `${String(n.getHours()).padStart(2, "0")}:${String(n.getMinutes()).padStart(2, "0")}`;
|
|
1677
1784
|
}
|
|
1678
|
-
function
|
|
1679
|
-
const t =
|
|
1680
|
-
return t >=
|
|
1785
|
+
function Qe(n, e, a) {
|
|
1786
|
+
const t = _(n), s = _(e), i = _(a);
|
|
1787
|
+
return i >= s ? t >= s && t <= i : t >= s || t <= i;
|
|
1681
1788
|
}
|
|
1682
|
-
function
|
|
1789
|
+
function vt(n) {
|
|
1683
1790
|
const {
|
|
1684
1791
|
slots: e = [],
|
|
1685
1792
|
mode: a = "single",
|
|
@@ -1693,33 +1800,33 @@ function ut(n) {
|
|
|
1693
1800
|
durationLabels: c = !1
|
|
1694
1801
|
} = n, d = document.createElement("div");
|
|
1695
1802
|
d.classList.add("cal-time-grid"), c && d.classList.add("cal-time-grid--duration"), d.setAttribute("role", "listbox"), a === "multi" && d.setAttribute("aria-multiselectable", "true");
|
|
1696
|
-
for (const
|
|
1803
|
+
for (const p of e) {
|
|
1697
1804
|
const u = document.createElement("button");
|
|
1698
|
-
u.classList.add("cal-time-slot"), u.setAttribute("role", "option"), u.dataset.time =
|
|
1699
|
-
const
|
|
1700
|
-
if (m.classList.add("cal-time-slot__time"), m.textContent =
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1805
|
+
u.classList.add("cal-time-slot"), u.setAttribute("role", "option"), u.dataset.time = p.time;
|
|
1806
|
+
const g = le(p.time), f = p.displayText ? p.displayText : g ? he(g.hours, g.minutes, t) : p.time, m = document.createElement("span");
|
|
1807
|
+
if (m.classList.add("cal-time-slot__time"), m.textContent = f, u.appendChild(m), p.label) {
|
|
1808
|
+
const w = document.createElement("span");
|
|
1809
|
+
w.classList.add("cal-time-slot__label"), w.textContent = p.label, u.appendChild(w);
|
|
1703
1810
|
}
|
|
1704
|
-
const
|
|
1705
|
-
if (
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1811
|
+
const b = p.available === !1 || r.includes(p.time);
|
|
1812
|
+
if (b && (u.classList.add("cal-time-slot--unavailable"), u.disabled = !0, u.setAttribute("aria-disabled", "true")), Ht(p.time, s, a) ? (u.classList.add("cal-time-slot--selected"), u.setAttribute("aria-selected", "true")) : u.setAttribute("aria-selected", "false"), a === "range" && l && !Bt(s) && i) {
|
|
1813
|
+
const w = Qe(p.time, l, i), A = p.time === l, I = p.time === i;
|
|
1814
|
+
w && !A && !I && u.classList.add("cal-time-slot--in-range"), A && u.classList.add("cal-time-slot--range-start"), I && u.classList.add("cal-time-slot--range-end");
|
|
1708
1815
|
} else if (a === "range" && s && typeof s == "object" && s.start && s.end) {
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1816
|
+
const w = Qe(p.time, s.start, s.end), A = p.time === s.start, I = p.time === s.end;
|
|
1817
|
+
A && u.classList.add("cal-time-slot--range-start", "cal-time-slot--selected"), I && u.classList.add("cal-time-slot--range-end", "cal-time-slot--selected"), w && !A && !I && u.classList.add("cal-time-slot--in-range");
|
|
1711
1818
|
}
|
|
1712
|
-
|
|
1819
|
+
b || (u.addEventListener("click", () => o == null ? void 0 : o(p.time)), u.addEventListener("mouseenter", () => h == null ? void 0 : h(p.time))), d.appendChild(u);
|
|
1713
1820
|
}
|
|
1714
1821
|
return d.addEventListener("mouseleave", () => h == null ? void 0 : h(null)), d;
|
|
1715
1822
|
}
|
|
1716
|
-
function
|
|
1823
|
+
function Ht(n, e, a) {
|
|
1717
1824
|
return e ? a === "single" ? e === n : a === "multi" ? Array.isArray(e) && e.includes(n) : a === "range" && typeof e == "object" && e.start && e.end ? e.start === n || e.end === n : !1 : !1;
|
|
1718
1825
|
}
|
|
1719
|
-
function
|
|
1826
|
+
function Bt(n) {
|
|
1720
1827
|
return n && typeof n == "object" && n.start && n.end;
|
|
1721
1828
|
}
|
|
1722
|
-
const
|
|
1829
|
+
const _t = `
|
|
1723
1830
|
.cal-time-grid {
|
|
1724
1831
|
display: grid;
|
|
1725
1832
|
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
|
@@ -1801,7 +1908,7 @@ const pt = `
|
|
|
1801
1908
|
.cal-time-grid--duration .cal-time-slot {
|
|
1802
1909
|
font-size: 12px;
|
|
1803
1910
|
}
|
|
1804
|
-
`,
|
|
1911
|
+
`, Ot = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', Ft = `
|
|
1805
1912
|
.cal-picker {
|
|
1806
1913
|
background: hsl(var(--cal-bg));
|
|
1807
1914
|
border-radius: var(--cal-radius);
|
|
@@ -1836,9 +1943,9 @@ const pt = `
|
|
|
1836
1943
|
margin-bottom: 8px;
|
|
1837
1944
|
}
|
|
1838
1945
|
`;
|
|
1839
|
-
class
|
|
1946
|
+
class Rt extends Me {
|
|
1840
1947
|
static get styles() {
|
|
1841
|
-
return [
|
|
1948
|
+
return [$e, ze, Ie, dt, _t, ht, pt, We, Xe, Pe, Ft];
|
|
1842
1949
|
}
|
|
1843
1950
|
static get observedAttributes() {
|
|
1844
1951
|
return [
|
|
@@ -1847,6 +1954,7 @@ class Ht extends Se {
|
|
|
1847
1954
|
"min-date",
|
|
1848
1955
|
"max-date",
|
|
1849
1956
|
"first-day",
|
|
1957
|
+
"locale",
|
|
1850
1958
|
"placeholder",
|
|
1851
1959
|
"dual",
|
|
1852
1960
|
"show-labels-on-hover",
|
|
@@ -1862,7 +1970,7 @@ class Ht extends Se {
|
|
|
1862
1970
|
constructor() {
|
|
1863
1971
|
super();
|
|
1864
1972
|
const e = /* @__PURE__ */ new Date();
|
|
1865
|
-
this._store =
|
|
1973
|
+
this._store = Ae({
|
|
1866
1974
|
viewYear: e.getFullYear(),
|
|
1867
1975
|
viewMonth: e.getMonth(),
|
|
1868
1976
|
rangeStart: null,
|
|
@@ -1882,7 +1990,7 @@ class Ht extends Se {
|
|
|
1882
1990
|
statusType: null,
|
|
1883
1991
|
statusMessage: null,
|
|
1884
1992
|
statusDismissible: !0
|
|
1885
|
-
}), this._bookings = [], this._dayData = {}, this._labelFormula = null, this._timeSlots = null, this._popover = null, this._unsubscribe = null, this._rendering = !1;
|
|
1993
|
+
}), this._bookings = [], this._dayData = {}, this._labelFormula = null, this._colors = null, this._customColorMap = null, this._timeSlots = null, this._popover = null, this._unsubscribe = null, this._rendering = !1;
|
|
1886
1994
|
}
|
|
1887
1995
|
// -- Attribute getters --
|
|
1888
1996
|
get display() {
|
|
@@ -1900,6 +2008,9 @@ class Ht extends Se {
|
|
|
1900
2008
|
get maxDate() {
|
|
1901
2009
|
return this.getAttribute("max-date") || null;
|
|
1902
2010
|
}
|
|
2011
|
+
get locale() {
|
|
2012
|
+
return this.getAttribute("locale") || void 0;
|
|
2013
|
+
}
|
|
1903
2014
|
get showLabelsOnHover() {
|
|
1904
2015
|
return this.hasAttribute("show-labels-on-hover");
|
|
1905
2016
|
}
|
|
@@ -1952,6 +2063,15 @@ class Ht extends Se {
|
|
|
1952
2063
|
set timeSlots(e) {
|
|
1953
2064
|
this._timeSlots = Array.isArray(e) ? e : null, this._initialized && this.render();
|
|
1954
2065
|
}
|
|
2066
|
+
get colors() {
|
|
2067
|
+
return this._colors;
|
|
2068
|
+
}
|
|
2069
|
+
set colors(e) {
|
|
2070
|
+
if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = rt(this._colors), this._customColorMap)
|
|
2071
|
+
for (const [a, t] of Object.entries(this._customColorMap))
|
|
2072
|
+
this.style.setProperty(`--cal-booking-${a}-bg`, t.bg), this.style.setProperty(`--cal-booking-${a}-fg`, t.fg), this.style.setProperty(`--cal-booking-${a}-hover`, t.hover);
|
|
2073
|
+
this._initialized && this.render();
|
|
2074
|
+
}
|
|
1955
2075
|
get value() {
|
|
1956
2076
|
const e = this._store.getState();
|
|
1957
2077
|
if (!e.rangeStart || !e.rangeEnd) return null;
|
|
@@ -1972,7 +2092,7 @@ class Ht extends Se {
|
|
|
1972
2092
|
});
|
|
1973
2093
|
}
|
|
1974
2094
|
_navigateToDate(e) {
|
|
1975
|
-
const a =
|
|
2095
|
+
const a = U(e);
|
|
1976
2096
|
a && this._store.set({ viewYear: a.getFullYear(), viewMonth: a.getMonth() });
|
|
1977
2097
|
}
|
|
1978
2098
|
connectedCallback() {
|
|
@@ -2009,7 +2129,7 @@ class Ht extends Se {
|
|
|
2009
2129
|
});
|
|
2010
2130
|
else {
|
|
2011
2131
|
let t = a.rangeStart, s = e;
|
|
2012
|
-
if (t > s && ([t, s] = [s, t]), !
|
|
2132
|
+
if (t > s && ([t, s] = [s, t]), !ot(t, s, this._bookings)) {
|
|
2013
2133
|
this.emit("cal:selection-invalid", { start: t, end: s }), this._store.set({
|
|
2014
2134
|
rangeStart: null,
|
|
2015
2135
|
rangeEnd: null,
|
|
@@ -2070,14 +2190,14 @@ class Ht extends Se {
|
|
|
2070
2190
|
const h = o === t && !!i, c = o === i && !!i;
|
|
2071
2191
|
let d = !1;
|
|
2072
2192
|
if (t && i) {
|
|
2073
|
-
const u = t < i ? t : i,
|
|
2074
|
-
d = o >= u && o <=
|
|
2193
|
+
const u = t < i ? t : i, g = t < i ? i : t;
|
|
2194
|
+
d = o >= u && o <= g && !h && !c;
|
|
2075
2195
|
}
|
|
2076
|
-
const
|
|
2077
|
-
const u = t < s ? t : s,
|
|
2078
|
-
return o >= u && o <=
|
|
2196
|
+
const p = l && t && !e.rangeEnd && s && (() => {
|
|
2197
|
+
const u = t < s ? t : s, g = t < s ? s : t;
|
|
2198
|
+
return o >= u && o <= g;
|
|
2079
2199
|
})();
|
|
2080
|
-
r.classList.toggle("cal-day--range-start", h), r.classList.toggle("cal-day--range-end", c), r.classList.toggle("cal-day--in-range", d), r.classList.toggle("cal-day--invalid-range", !!
|
|
2200
|
+
r.classList.toggle("cal-day--range-start", h), r.classList.toggle("cal-day--range-end", c), r.classList.toggle("cal-day--in-range", d), r.classList.toggle("cal-day--invalid-range", !!p);
|
|
2081
2201
|
}
|
|
2082
2202
|
}
|
|
2083
2203
|
// -- Navigation --
|
|
@@ -2110,7 +2230,7 @@ class Ht extends Se {
|
|
|
2110
2230
|
e.stopPropagation(), this._store.set({ pickingMonth: !1 });
|
|
2111
2231
|
return;
|
|
2112
2232
|
}
|
|
2113
|
-
const a = this._store.getState(), t =
|
|
2233
|
+
const a = this._store.getState(), t = U(a.focusedDate);
|
|
2114
2234
|
if (!t) return;
|
|
2115
2235
|
let s = null;
|
|
2116
2236
|
switch (e.key) {
|
|
@@ -2160,14 +2280,24 @@ class Ht extends Se {
|
|
|
2160
2280
|
goToMonth(e, a) {
|
|
2161
2281
|
this._store.set({ viewYear: a, viewMonth: e });
|
|
2162
2282
|
}
|
|
2283
|
+
clear() {
|
|
2284
|
+
this._store.set({
|
|
2285
|
+
rangeStart: null,
|
|
2286
|
+
rangeEnd: null,
|
|
2287
|
+
hoverDate: null,
|
|
2288
|
+
startTime: null,
|
|
2289
|
+
endTime: null,
|
|
2290
|
+
timeSelectPhase: null
|
|
2291
|
+
}), this.emit("cal:change", { value: null });
|
|
2292
|
+
}
|
|
2163
2293
|
// -- Time slots generation --
|
|
2164
2294
|
_getTimeSlotArray() {
|
|
2165
|
-
return this._timeSlots ? this._timeSlots : this.durationLabels ?
|
|
2295
|
+
return this._timeSlots ? this._timeSlots : this.durationLabels ? ft(this.timeStartTime, this.timeEndTime, this.timeInterval, this.timeFormat).map((a) => ({ ...a, available: !0 })) : Ee(this.timeStartTime, this.timeEndTime, this.timeInterval).map((a) => ({ time: a, available: !0 }));
|
|
2166
2296
|
}
|
|
2167
2297
|
// -- Render --
|
|
2168
2298
|
_renderCalendarContent() {
|
|
2169
2299
|
const e = this._store.getState(), a = document.createElement("div");
|
|
2170
|
-
if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(
|
|
2300
|
+
if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(Ye({
|
|
2171
2301
|
type: e.statusType,
|
|
2172
2302
|
message: e.statusMessage,
|
|
2173
2303
|
dismissible: e.statusDismissible,
|
|
@@ -2176,9 +2306,9 @@ class Ht extends Se {
|
|
|
2176
2306
|
const l = document.createElement("div");
|
|
2177
2307
|
l.classList.add("cal-months");
|
|
2178
2308
|
const r = document.createElement("div");
|
|
2179
|
-
if (r.classList.add("cal-month"), r.appendChild(
|
|
2309
|
+
if (r.classList.add("cal-month"), r.appendChild(mt()), l.appendChild(r), a.appendChild(l), this.timeSlotsEnabled) {
|
|
2180
2310
|
const o = document.createElement("div");
|
|
2181
|
-
o.classList.add("cal-booking-time-section"), o.appendChild(
|
|
2311
|
+
o.classList.add("cal-booking-time-section"), o.appendChild(gt({ durationLabels: this.durationLabels })), a.appendChild(o);
|
|
2182
2312
|
}
|
|
2183
2313
|
return a.addEventListener("keydown", (o) => this._handleKeydown(o)), a;
|
|
2184
2314
|
}
|
|
@@ -2187,7 +2317,7 @@ class Ht extends Se {
|
|
|
2187
2317
|
const s = this.hasAttribute("dual"), i = s ? 2 : 1;
|
|
2188
2318
|
for (let l = 0; l < i; l++) {
|
|
2189
2319
|
const { year: r, month: o } = l === 0 ? { year: e.viewYear, month: e.viewMonth } : ge(e.viewYear, e.viewMonth, 1), h = document.createElement("div");
|
|
2190
|
-
if (h.classList.add("cal-month"), l === 0 && h.appendChild(
|
|
2320
|
+
if (h.classList.add("cal-month"), l === 0 && h.appendChild(De({
|
|
2191
2321
|
year: r,
|
|
2192
2322
|
month: o,
|
|
2193
2323
|
onPrev: e.pickingMonth ? () => {
|
|
@@ -2196,26 +2326,29 @@ class Ht extends Se {
|
|
|
2196
2326
|
} : () => {
|
|
2197
2327
|
s || this._nextMonth();
|
|
2198
2328
|
},
|
|
2199
|
-
onTitleClick: () => this._toggleMonthPicker()
|
|
2200
|
-
|
|
2329
|
+
onTitleClick: () => this._toggleMonthPicker(),
|
|
2330
|
+
locale: this.locale
|
|
2331
|
+
})), l === 1 && h.appendChild(De({
|
|
2201
2332
|
year: r,
|
|
2202
2333
|
month: o,
|
|
2203
2334
|
onPrev: () => {
|
|
2204
2335
|
},
|
|
2205
|
-
onNext: () => this._nextMonth()
|
|
2336
|
+
onNext: () => this._nextMonth(),
|
|
2337
|
+
locale: this.locale
|
|
2206
2338
|
})), e.pickingMonth && l === 0) {
|
|
2207
|
-
const c =
|
|
2339
|
+
const c = ut({
|
|
2208
2340
|
pickerYear: e.pickerYear,
|
|
2209
2341
|
viewMonth: e.viewMonth,
|
|
2210
2342
|
viewYear: e.viewYear,
|
|
2211
|
-
onMonthSelect: (d,
|
|
2343
|
+
onMonthSelect: (d, p) => this._selectMonthFromPicker(d, p),
|
|
2212
2344
|
onYearPrev: () => this._store.set({ pickerYear: e.pickerYear - 1 }),
|
|
2213
2345
|
onYearNext: () => this._store.set({ pickerYear: e.pickerYear + 1 }),
|
|
2214
|
-
onClose: () => this._store.set({ pickingMonth: !1 })
|
|
2346
|
+
onClose: () => this._store.set({ pickingMonth: !1 }),
|
|
2347
|
+
locale: this.locale
|
|
2215
2348
|
});
|
|
2216
2349
|
h.appendChild(c);
|
|
2217
2350
|
} else {
|
|
2218
|
-
const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d =
|
|
2351
|
+
const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = ct({
|
|
2219
2352
|
year: r,
|
|
2220
2353
|
month: o,
|
|
2221
2354
|
firstDay: this.firstDay,
|
|
@@ -2226,13 +2359,15 @@ class Ht extends Se {
|
|
|
2226
2359
|
maxDate: this.maxDate,
|
|
2227
2360
|
focusedDate: e.focusedDate,
|
|
2228
2361
|
mode: "range",
|
|
2229
|
-
onSelect: (
|
|
2230
|
-
onHover: (
|
|
2362
|
+
onSelect: (p) => this._handleSelect(p),
|
|
2363
|
+
onHover: (p) => this._handleHover(p),
|
|
2231
2364
|
// Booking-specific params
|
|
2232
2365
|
bookings: this._bookings,
|
|
2233
2366
|
dayData: this._dayData,
|
|
2234
2367
|
labelFormula: this._labelFormula,
|
|
2235
|
-
showLabelsOnHover: this.showLabelsOnHover
|
|
2368
|
+
showLabelsOnHover: this.showLabelsOnHover,
|
|
2369
|
+
locale: this.locale,
|
|
2370
|
+
customColors: this._customColorMap
|
|
2236
2371
|
});
|
|
2237
2372
|
c && d.classList.add(c), h.appendChild(d);
|
|
2238
2373
|
}
|
|
@@ -2243,7 +2378,7 @@ class Ht extends Se {
|
|
|
2243
2378
|
l.classList.add("cal-booking-time-section");
|
|
2244
2379
|
const r = document.createElement("div");
|
|
2245
2380
|
r.classList.add("cal-booking-time-header"), r.textContent = e.timeSelectPhase === "start" ? "Select check-in time" : "Select check-out time", l.appendChild(r);
|
|
2246
|
-
const o = this._getTimeSlotArray(), h =
|
|
2381
|
+
const o = this._getTimeSlotArray(), h = vt({
|
|
2247
2382
|
slots: o,
|
|
2248
2383
|
mode: "single",
|
|
2249
2384
|
format: this.timeFormat,
|
|
@@ -2266,8 +2401,14 @@ class Ht extends Se {
|
|
|
2266
2401
|
return null;
|
|
2267
2402
|
}
|
|
2268
2403
|
_formatShortDate(e) {
|
|
2269
|
-
const a =
|
|
2270
|
-
|
|
2404
|
+
const a = U(e);
|
|
2405
|
+
if (!a) return e;
|
|
2406
|
+
if (this.locale)
|
|
2407
|
+
try {
|
|
2408
|
+
return new Intl.DateTimeFormat(this.locale, { month: "short", day: "numeric", year: "numeric" }).format(a);
|
|
2409
|
+
} catch {
|
|
2410
|
+
}
|
|
2411
|
+
return `${Re(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
|
|
2271
2412
|
}
|
|
2272
2413
|
render() {
|
|
2273
2414
|
var t;
|
|
@@ -2282,10 +2423,10 @@ class Ht extends Se {
|
|
|
2282
2423
|
const i = document.createElement("button");
|
|
2283
2424
|
i.classList.add("cal-trigger");
|
|
2284
2425
|
const l = document.createElement("span");
|
|
2285
|
-
l.classList.add("cal-trigger__icon"), l.innerHTML =
|
|
2426
|
+
l.classList.add("cal-trigger__icon"), l.innerHTML = Ot, i.appendChild(l);
|
|
2286
2427
|
const r = this._formatTriggerText(), o = document.createElement("span");
|
|
2287
2428
|
r ? o.textContent = r : (o.textContent = this.placeholder, o.classList.add("cal-trigger--placeholder")), i.appendChild(o), s.appendChild(i);
|
|
2288
|
-
const h = this._renderCalendarContent(), c =
|
|
2429
|
+
const h = this._renderCalendarContent(), c = qe({
|
|
2289
2430
|
trigger: i,
|
|
2290
2431
|
content: h,
|
|
2291
2432
|
onClose: () => {
|
|
@@ -2300,7 +2441,7 @@ class Ht extends Se {
|
|
|
2300
2441
|
this._store.set({ navDirection: null }), this._rendering = !1;
|
|
2301
2442
|
}
|
|
2302
2443
|
}
|
|
2303
|
-
const
|
|
2444
|
+
const jt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5V8l2.5 1.5"/></svg>', Nt = `
|
|
2304
2445
|
.cal-timepicker {
|
|
2305
2446
|
background: hsl(var(--cal-bg));
|
|
2306
2447
|
border-radius: var(--cal-radius);
|
|
@@ -2321,15 +2462,15 @@ const Bt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="
|
|
|
2321
2462
|
padding: 0 4px;
|
|
2322
2463
|
}
|
|
2323
2464
|
`;
|
|
2324
|
-
class
|
|
2465
|
+
class qt extends Me {
|
|
2325
2466
|
static get styles() {
|
|
2326
|
-
return [
|
|
2467
|
+
return [$e, ze, Ie, _t, We, Xe, Pe, Nt];
|
|
2327
2468
|
}
|
|
2328
2469
|
static get observedAttributes() {
|
|
2329
|
-
return ["mode", "display", "theme", "start-time", "end-time", "interval", "format", "placeholder", "value", "duration-labels", "loading"];
|
|
2470
|
+
return ["mode", "display", "theme", "start-time", "end-time", "interval", "format", "placeholder", "value", "duration-labels", "loading", "locale", "min-time"];
|
|
2330
2471
|
}
|
|
2331
2472
|
constructor() {
|
|
2332
|
-
super(), this._store =
|
|
2473
|
+
super(), this._store = Ae({
|
|
2333
2474
|
selected: null,
|
|
2334
2475
|
// string | string[] | {start, end}
|
|
2335
2476
|
rangeStart: null,
|
|
@@ -2372,6 +2513,12 @@ class Ft extends Se {
|
|
|
2372
2513
|
set loading(e) {
|
|
2373
2514
|
e ? this.setAttribute("loading", "") : this.removeAttribute("loading");
|
|
2374
2515
|
}
|
|
2516
|
+
get locale() {
|
|
2517
|
+
return this.getAttribute("locale") || void 0;
|
|
2518
|
+
}
|
|
2519
|
+
get minTime() {
|
|
2520
|
+
return this.getAttribute("min-time") || null;
|
|
2521
|
+
}
|
|
2375
2522
|
// -- Properties --
|
|
2376
2523
|
get slots() {
|
|
2377
2524
|
return this._slots;
|
|
@@ -2389,16 +2536,26 @@ class Ft extends Se {
|
|
|
2389
2536
|
return this._store.getState().selected;
|
|
2390
2537
|
}
|
|
2391
2538
|
set value(e) {
|
|
2392
|
-
this.mode === "single" && typeof e == "string" ? this._store.set({ selected: e, rangeStart: null }) : this.mode === "multi" && Array.isArray(e) ? this._store.set({ selected: [...e].sort((a, t) =>
|
|
2539
|
+
this.mode === "single" && typeof e == "string" ? this._store.set({ selected: e, rangeStart: null }) : this.mode === "multi" && Array.isArray(e) ? this._store.set({ selected: [...e].sort((a, t) => _(a) - _(t)), rangeStart: null }) : this.mode === "range" && e && typeof e == "object" ? this._store.set({ selected: { start: e.start, end: e.end }, rangeStart: null }) : this._store.set({ selected: null, rangeStart: null });
|
|
2393
2540
|
}
|
|
2394
2541
|
_getEffectiveSlots() {
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2542
|
+
let e;
|
|
2543
|
+
this._slots ? e = this._slots : this.durationLabels ? e = ft(this.startTime, this.endTime, this.interval, this.format).map((s) => ({
|
|
2544
|
+
...s,
|
|
2545
|
+
available: !this._unavailableTimes.includes(s.time)
|
|
2546
|
+
})) : e = Ee(this.startTime, this.endTime, this.interval).map((s) => ({
|
|
2547
|
+
time: s,
|
|
2548
|
+
available: !this._unavailableTimes.includes(s)
|
|
2401
2549
|
}));
|
|
2550
|
+
const a = this.minTime;
|
|
2551
|
+
if (a) {
|
|
2552
|
+
const t = _(a);
|
|
2553
|
+
e = e.map((s) => {
|
|
2554
|
+
const i = typeof s == "string" ? s : s.time;
|
|
2555
|
+
return _(i) < t ? typeof s == "string" ? { time: s, available: !1 } : { ...s, available: !1 } : s;
|
|
2556
|
+
});
|
|
2557
|
+
}
|
|
2558
|
+
return e;
|
|
2402
2559
|
}
|
|
2403
2560
|
connectedCallback() {
|
|
2404
2561
|
super.connectedCallback(), this._unsubscribe = this._store.subscribe((a, t) => {
|
|
@@ -2439,13 +2596,13 @@ class Ft extends Se {
|
|
|
2439
2596
|
this._store.set({ selected: e }), this.emit("cal:time-change", { value: e }), this.display === "popover" && this.close();
|
|
2440
2597
|
else if (this.mode === "multi") {
|
|
2441
2598
|
const t = Array.isArray(a.selected) ? [...a.selected] : [], s = t.indexOf(e);
|
|
2442
|
-
s >= 0 ? t.splice(s, 1) : t.push(e), t.sort((i, l) =>
|
|
2599
|
+
s >= 0 ? t.splice(s, 1) : t.push(e), t.sort((i, l) => _(i) - _(l)), this._store.set({ selected: t }), this.emit("cal:time-change", { value: t });
|
|
2443
2600
|
} else if (this.mode === "range")
|
|
2444
2601
|
if (!a.rangeStart || a.selected && typeof a.selected == "object" && a.selected.start && a.selected.end)
|
|
2445
2602
|
this._store.set({ rangeStart: e, selected: null, hoverTime: null });
|
|
2446
2603
|
else {
|
|
2447
2604
|
let t = a.rangeStart, s = e;
|
|
2448
|
-
|
|
2605
|
+
_(t) > _(s) && ([t, s] = [s, t]);
|
|
2449
2606
|
const i = { start: t, end: s };
|
|
2450
2607
|
this._store.set({ selected: i, rangeStart: null, hoverTime: null }), this.emit("cal:time-change", { value: i }), this.display === "popover" && this.close();
|
|
2451
2608
|
}
|
|
@@ -2460,8 +2617,8 @@ class Ft extends Se {
|
|
|
2460
2617
|
const o = r.dataset.time;
|
|
2461
2618
|
if (!(!o || r.disabled))
|
|
2462
2619
|
if (t && !l && s) {
|
|
2463
|
-
const h =
|
|
2464
|
-
r.classList.toggle("cal-time-slot--range-start", u), r.classList.toggle("cal-time-slot--range-end",
|
|
2620
|
+
const h = _(t) < _(s) ? t : s, c = _(t) < _(s) ? s : t, d = _(o), p = d > _(h) && d < _(c), u = o === t, g = o === s;
|
|
2621
|
+
r.classList.toggle("cal-time-slot--range-start", u), r.classList.toggle("cal-time-slot--range-end", g), r.classList.toggle("cal-time-slot--in-range", p);
|
|
2465
2622
|
} else t || r.classList.remove("cal-time-slot--range-start", "cal-time-slot--range-end", "cal-time-slot--in-range");
|
|
2466
2623
|
}
|
|
2467
2624
|
}
|
|
@@ -2472,10 +2629,17 @@ class Ft extends Se {
|
|
|
2472
2629
|
close() {
|
|
2473
2630
|
this._popover && (this._popover.close(), this._store.set({ isOpen: !1 }), this.emit("cal:close"));
|
|
2474
2631
|
}
|
|
2632
|
+
clear() {
|
|
2633
|
+
this._store.set({
|
|
2634
|
+
selected: null,
|
|
2635
|
+
rangeStart: null,
|
|
2636
|
+
hoverTime: null
|
|
2637
|
+
}), this.emit("cal:time-change", { value: null });
|
|
2638
|
+
}
|
|
2475
2639
|
// -- Render --
|
|
2476
2640
|
_renderTimepickerContent() {
|
|
2477
2641
|
const e = this._store.getState(), a = document.createElement("div");
|
|
2478
|
-
a.classList.add("cal-timepicker"), e.statusType && e.statusMessage && a.appendChild(
|
|
2642
|
+
a.classList.add("cal-timepicker"), e.statusType && e.statusMessage && a.appendChild(Ye({
|
|
2479
2643
|
type: e.statusType,
|
|
2480
2644
|
message: e.statusMessage,
|
|
2481
2645
|
dismissible: e.statusDismissible,
|
|
@@ -2483,9 +2647,9 @@ class Ft extends Se {
|
|
|
2483
2647
|
}));
|
|
2484
2648
|
const t = document.createElement("div");
|
|
2485
2649
|
if (t.classList.add("cal-timepicker__header"), t.textContent = "Select Time", a.appendChild(t), this.loading)
|
|
2486
|
-
a.appendChild(
|
|
2650
|
+
a.appendChild(gt({ durationLabels: this.durationLabels }));
|
|
2487
2651
|
else {
|
|
2488
|
-
const s = this._getEffectiveSlots(), i =
|
|
2652
|
+
const s = this._getEffectiveSlots(), i = vt({
|
|
2489
2653
|
slots: s,
|
|
2490
2654
|
mode: this.mode,
|
|
2491
2655
|
format: this.format,
|
|
@@ -2518,10 +2682,10 @@ class Ft extends Se {
|
|
|
2518
2682
|
const i = document.createElement("button");
|
|
2519
2683
|
i.classList.add("cal-trigger");
|
|
2520
2684
|
const l = document.createElement("span");
|
|
2521
|
-
l.classList.add("cal-trigger__icon"), l.innerHTML =
|
|
2685
|
+
l.classList.add("cal-trigger__icon"), l.innerHTML = jt, i.appendChild(l);
|
|
2522
2686
|
const r = this._formatTriggerText(), o = document.createElement("span");
|
|
2523
2687
|
r ? o.textContent = r : (o.textContent = this.placeholder, o.classList.add("cal-trigger--placeholder")), i.appendChild(o), s.appendChild(i);
|
|
2524
|
-
const h = this._renderTimepickerContent(), c =
|
|
2688
|
+
const h = this._renderTimepickerContent(), c = qe({
|
|
2525
2689
|
trigger: i,
|
|
2526
2690
|
content: h,
|
|
2527
2691
|
onClose: () => {
|
|
@@ -2536,42 +2700,43 @@ class Ft extends Se {
|
|
|
2536
2700
|
this._rendering = !1;
|
|
2537
2701
|
}
|
|
2538
2702
|
}
|
|
2539
|
-
function
|
|
2540
|
-
const a =
|
|
2703
|
+
function Wt(n, e = 0) {
|
|
2704
|
+
const a = U(n);
|
|
2541
2705
|
if (!a) return n;
|
|
2542
2706
|
const s = (a.getDay() - e + 7) % 7;
|
|
2543
2707
|
return a.setDate(a.getDate() - s), Z(a);
|
|
2544
2708
|
}
|
|
2545
|
-
function
|
|
2546
|
-
const a =
|
|
2709
|
+
function Fe(n, e = 0) {
|
|
2710
|
+
const a = Wt(n, e), t = [];
|
|
2547
2711
|
for (let s = 0; s < 7; s++)
|
|
2548
2712
|
t.push(ye(a, s));
|
|
2549
2713
|
return t;
|
|
2550
2714
|
}
|
|
2551
|
-
function
|
|
2552
|
-
const
|
|
2553
|
-
if (!
|
|
2715
|
+
function Xt(n, e, a, t) {
|
|
2716
|
+
const s = U(e);
|
|
2717
|
+
if (!s) return "";
|
|
2718
|
+
const i = st(t);
|
|
2554
2719
|
if (n === "day")
|
|
2555
|
-
return `${
|
|
2720
|
+
return `${i[s.getMonth()]} ${s.getDate()}, ${s.getFullYear()}`;
|
|
2556
2721
|
if (n === "week" && a && a.length === 7) {
|
|
2557
|
-
const
|
|
2558
|
-
return !
|
|
2722
|
+
const l = U(a[0]), r = U(a[6]);
|
|
2723
|
+
return !l || !r ? "" : l.getMonth() === r.getMonth() ? `${i[l.getMonth()]} ${l.getDate()}–${r.getDate()}, ${l.getFullYear()}` : l.getFullYear() === r.getFullYear() ? `${i[l.getMonth()].slice(0, 3)} ${l.getDate()} – ${i[r.getMonth()].slice(0, 3)} ${r.getDate()}, ${l.getFullYear()}` : `${i[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${l.getFullYear()} – ${i[r.getMonth()].slice(0, 3)} ${r.getDate()}, ${r.getFullYear()}`;
|
|
2559
2724
|
}
|
|
2560
|
-
return n === "month" ? `${
|
|
2725
|
+
return n === "month" ? `${i[s.getMonth()]} ${s.getFullYear()}` : "";
|
|
2561
2726
|
}
|
|
2562
2727
|
function ke(n, e) {
|
|
2563
2728
|
return n.filter((a) => a.start ? a.end && a.end !== a.start ? e >= a.start && e <= a.end : a.start === e : !1);
|
|
2564
2729
|
}
|
|
2565
|
-
function
|
|
2730
|
+
function Te(n) {
|
|
2566
2731
|
if (!n.length) return n;
|
|
2567
2732
|
const e = [...n].sort((t, s) => {
|
|
2568
|
-
const i =
|
|
2733
|
+
const i = _(t.startTime || "00:00"), l = _(s.startTime || "00:00");
|
|
2569
2734
|
if (i !== l) return i - l;
|
|
2570
|
-
const r =
|
|
2571
|
-
return
|
|
2735
|
+
const r = _(t.endTime || "23:59");
|
|
2736
|
+
return _(s.endTime || "23:59") - l - (r - i);
|
|
2572
2737
|
}), a = [];
|
|
2573
2738
|
for (const t of e) {
|
|
2574
|
-
const s =
|
|
2739
|
+
const s = _(t.startTime || "00:00"), i = _(t.endTime || "23:59");
|
|
2575
2740
|
let l = !1;
|
|
2576
2741
|
for (let r = 0; r < a.length; r++)
|
|
2577
2742
|
if (s >= a[r]) {
|
|
@@ -2581,10 +2746,10 @@ function Ce(n) {
|
|
|
2581
2746
|
l || (t._col = a.length, a.push(i));
|
|
2582
2747
|
}
|
|
2583
2748
|
for (const t of e) {
|
|
2584
|
-
const s =
|
|
2749
|
+
const s = _(t.startTime || "00:00"), i = _(t.endTime || "23:59");
|
|
2585
2750
|
let l = t._col;
|
|
2586
2751
|
for (const r of e) {
|
|
2587
|
-
const o =
|
|
2752
|
+
const o = _(r.startTime || "00:00"), h = _(r.endTime || "23:59");
|
|
2588
2753
|
o < i && h > s && (l = Math.max(l, r._col));
|
|
2589
2754
|
}
|
|
2590
2755
|
t._totalCols = l + 1;
|
|
@@ -2592,76 +2757,93 @@ function Ce(n) {
|
|
|
2592
2757
|
return e;
|
|
2593
2758
|
}
|
|
2594
2759
|
function pe(n, e, a, t) {
|
|
2595
|
-
return (
|
|
2760
|
+
return (_(n) - _(e)) / t * a;
|
|
2596
2761
|
}
|
|
2597
|
-
function
|
|
2598
|
-
const s = n / a * t, i =
|
|
2762
|
+
function et(n, e, a, t) {
|
|
2763
|
+
const s = n / a * t, i = _(e) + s;
|
|
2599
2764
|
return ie(Math.round(i));
|
|
2600
2765
|
}
|
|
2601
|
-
function
|
|
2602
|
-
const a =
|
|
2766
|
+
function tt(n, e) {
|
|
2767
|
+
const a = _(n), t = Math.round(a / e) * e;
|
|
2603
2768
|
return ie(t);
|
|
2604
2769
|
}
|
|
2605
|
-
function
|
|
2770
|
+
function Gt(n, e, a) {
|
|
2606
2771
|
return ke(n, a).filter(
|
|
2607
2772
|
(t) => t.resourceId === e
|
|
2608
2773
|
);
|
|
2609
2774
|
}
|
|
2610
|
-
function
|
|
2611
|
-
const i =
|
|
2775
|
+
function yt(n, e, a, t, s) {
|
|
2776
|
+
const i = Gt(n, e, a), l = _(t), r = _(s);
|
|
2612
2777
|
for (const o of i) {
|
|
2613
2778
|
if (!o.startTime || !o.endTime) continue;
|
|
2614
|
-
const h =
|
|
2779
|
+
const h = _(o.startTime), c = _(o.endTime);
|
|
2615
2780
|
if (l < c && r > h)
|
|
2616
2781
|
return !1;
|
|
2617
2782
|
}
|
|
2618
2783
|
return !0;
|
|
2619
2784
|
}
|
|
2620
|
-
function
|
|
2785
|
+
function Kt(n, e, a, t, s = "08:00", i = "18:00") {
|
|
2621
2786
|
const { duration: l, resourceId: r, minCapacity: o } = n, h = n.date || me(), c = 14;
|
|
2622
2787
|
let d = e;
|
|
2623
|
-
r && (d = e.filter((
|
|
2624
|
-
(
|
|
2788
|
+
r && (d = e.filter((g) => g.id === r)), o && (d = d.filter(
|
|
2789
|
+
(g) => g.capacity && g.capacity >= o
|
|
2625
2790
|
));
|
|
2626
|
-
const
|
|
2627
|
-
for (let
|
|
2628
|
-
const
|
|
2791
|
+
const p = _(s), u = _(i);
|
|
2792
|
+
for (let g = 0; g < c; g++) {
|
|
2793
|
+
const f = ye(h, g);
|
|
2629
2794
|
for (const m of d)
|
|
2630
|
-
for (let
|
|
2631
|
-
const
|
|
2632
|
-
if (
|
|
2795
|
+
for (let b = p; b + l <= u; b += t) {
|
|
2796
|
+
const y = ie(b), w = ie(b + l);
|
|
2797
|
+
if (yt(a, m.id, f, y, w))
|
|
2633
2798
|
return {
|
|
2634
2799
|
resourceId: m.id,
|
|
2635
|
-
date:
|
|
2636
|
-
startTime:
|
|
2637
|
-
endTime:
|
|
2800
|
+
date: f,
|
|
2801
|
+
startTime: y,
|
|
2802
|
+
endTime: w
|
|
2638
2803
|
};
|
|
2639
2804
|
}
|
|
2640
2805
|
}
|
|
2641
2806
|
return null;
|
|
2642
2807
|
}
|
|
2643
|
-
function
|
|
2644
|
-
const l = document.createElement("div");
|
|
2645
|
-
l.classList.add("cal-sched-nav");
|
|
2808
|
+
function Ut({ title: n, view: e, onPrev: a, onNext: t, onToday: s, onViewChange: i, locale: l }) {
|
|
2646
2809
|
const r = document.createElement("div");
|
|
2647
|
-
r.classList.add("cal-sched-
|
|
2648
|
-
const o = document.createElement("
|
|
2649
|
-
o.classList.add("cal-sched-
|
|
2810
|
+
r.classList.add("cal-sched-nav");
|
|
2811
|
+
const o = document.createElement("div");
|
|
2812
|
+
o.classList.add("cal-sched-nav__left");
|
|
2650
2813
|
const h = document.createElement("button");
|
|
2651
|
-
h.classList.add("cal-sched-nav__btn"), h.innerHTML =
|
|
2814
|
+
h.classList.add("cal-sched-nav__btn"), h.innerHTML = je, h.setAttribute("aria-label", "Previous"), h.addEventListener("click", a);
|
|
2652
2815
|
const c = document.createElement("button");
|
|
2653
|
-
c.classList.add("cal-sched-
|
|
2654
|
-
|
|
2655
|
-
|
|
2816
|
+
c.classList.add("cal-sched-nav__btn"), c.innerHTML = Ne, c.setAttribute("aria-label", "Next"), c.addEventListener("click", t);
|
|
2817
|
+
let d = "Today";
|
|
2818
|
+
if (l)
|
|
2819
|
+
try {
|
|
2820
|
+
const y = new Intl.RelativeTimeFormat(l, { numeric: "auto" }).formatToParts(0, "day").map((w) => w.value).join("");
|
|
2821
|
+
d = y.charAt(0).toUpperCase() + y.slice(1);
|
|
2822
|
+
} catch {
|
|
2823
|
+
}
|
|
2824
|
+
const p = document.createElement("button");
|
|
2825
|
+
p.classList.add("cal-sched-nav__today"), p.textContent = d, p.addEventListener("click", s);
|
|
2826
|
+
const u = document.createElement("span");
|
|
2827
|
+
u.classList.add("cal-sched-nav__title"), u.setAttribute("aria-live", "polite"), u.textContent = n, o.appendChild(h), o.appendChild(c), o.appendChild(p), o.appendChild(u);
|
|
2656
2828
|
const g = document.createElement("div");
|
|
2657
2829
|
g.classList.add("cal-sched-nav__tabs");
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2830
|
+
const f = { day: "Day", week: "Week", month: "Month" };
|
|
2831
|
+
if (l)
|
|
2832
|
+
try {
|
|
2833
|
+
const m = new Intl.DisplayNames(l, { type: "dateTimeField" });
|
|
2834
|
+
for (const b of ["day", "week", "month"]) {
|
|
2835
|
+
const y = m.of(b);
|
|
2836
|
+
y && (f[b] = y.charAt(0).toUpperCase() + y.slice(1));
|
|
2837
|
+
}
|
|
2838
|
+
} catch {
|
|
2839
|
+
}
|
|
2840
|
+
for (const m of ["day", "week", "month"]) {
|
|
2841
|
+
const b = document.createElement("button");
|
|
2842
|
+
b.classList.add("cal-sched-nav__tab"), m === e && b.classList.add("cal-sched-nav__tab--active"), b.textContent = f[m], b.addEventListener("click", () => i(m)), g.appendChild(b);
|
|
2661
2843
|
}
|
|
2662
|
-
return
|
|
2844
|
+
return r.appendChild(o), r.appendChild(g), r;
|
|
2663
2845
|
}
|
|
2664
|
-
const
|
|
2846
|
+
const Jt = `
|
|
2665
2847
|
.cal-sched-nav {
|
|
2666
2848
|
display: flex;
|
|
2667
2849
|
align-items: center;
|
|
@@ -2750,7 +2932,7 @@ const Xt = `
|
|
|
2750
2932
|
color: hsl(var(--cal-accent-fg));
|
|
2751
2933
|
}
|
|
2752
2934
|
`;
|
|
2753
|
-
function
|
|
2935
|
+
function xt({ startTime: n, endTime: e, interval: a, slotHeight: t, format: s }) {
|
|
2754
2936
|
const i = document.createElement("div");
|
|
2755
2937
|
i.classList.add("cal-sched-time-axis");
|
|
2756
2938
|
const l = Ee(n, e, a);
|
|
@@ -2766,7 +2948,7 @@ function mt({ startTime: n, endTime: e, interval: a, slotHeight: t, format: s })
|
|
|
2766
2948
|
}
|
|
2767
2949
|
return i;
|
|
2768
2950
|
}
|
|
2769
|
-
const
|
|
2951
|
+
const Vt = `
|
|
2770
2952
|
.cal-sched-time-axis {
|
|
2771
2953
|
display: flex;
|
|
2772
2954
|
flex-direction: column;
|
|
@@ -2792,7 +2974,7 @@ const Gt = `
|
|
|
2792
2974
|
user-select: none;
|
|
2793
2975
|
}
|
|
2794
2976
|
`;
|
|
2795
|
-
function
|
|
2977
|
+
function Zt({ resource: n, width: e }) {
|
|
2796
2978
|
const a = document.createElement("div");
|
|
2797
2979
|
a.classList.add("cal-sched-resource-header"), e && (a.style.width = `${e}px`), a.style.flex = e ? `0 0 ${e}px` : "1 1 0";
|
|
2798
2980
|
const t = document.createElement("span");
|
|
@@ -2806,14 +2988,14 @@ function Kt({ resource: n, width: e }) {
|
|
|
2806
2988
|
}
|
|
2807
2989
|
return a;
|
|
2808
2990
|
}
|
|
2809
|
-
function
|
|
2991
|
+
function Qt({ resources: n }) {
|
|
2810
2992
|
const e = document.createElement("div");
|
|
2811
2993
|
e.classList.add("cal-sched-resource-header-row");
|
|
2812
2994
|
for (const a of n)
|
|
2813
|
-
e.appendChild(
|
|
2995
|
+
e.appendChild(Zt({ resource: a }));
|
|
2814
2996
|
return e;
|
|
2815
2997
|
}
|
|
2816
|
-
const
|
|
2998
|
+
const ea = `
|
|
2817
2999
|
.cal-sched-resource-header-row {
|
|
2818
3000
|
display: flex;
|
|
2819
3001
|
border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
|
|
@@ -2858,29 +3040,29 @@ const Vt = `
|
|
|
2858
3040
|
flex-shrink: 0;
|
|
2859
3041
|
}
|
|
2860
3042
|
`;
|
|
2861
|
-
function
|
|
3043
|
+
function Se({ event: n, gridStartTime: e, slotHeight: a, interval: t, format: s, onClick: i, eventContent: l, showTime: r = !0, resource: o, draggable: h }) {
|
|
2862
3044
|
const c = document.createElement("div");
|
|
2863
3045
|
c.classList.add("cal-sched-event"), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.dataset.eventId = n.id;
|
|
2864
3046
|
const d = !!n.locked;
|
|
2865
3047
|
h && !d && (c.dataset.draggable = "true"), d && c.classList.add("cal-sched-event--locked");
|
|
2866
|
-
const
|
|
2867
|
-
if (c.style.setProperty("--ev-bg", `var(--cal-booking-${
|
|
2868
|
-
const u = pe(n.startTime, e, a, t),
|
|
2869
|
-
if (c.style.top = `${u}px`, c.style.height = `${
|
|
3048
|
+
const p = n.color || "blue";
|
|
3049
|
+
if (c.style.setProperty("--ev-bg", `var(--cal-booking-${p}-bg)`), c.style.setProperty("--ev-fg", `var(--cal-booking-${p}-fg)`), n.startTime && n.endTime) {
|
|
3050
|
+
const u = pe(n.startTime, e, a, t), g = pe(n.endTime, e, a, t), f = Math.max(g - u, a * 0.5);
|
|
3051
|
+
if (c.style.top = `${u}px`, c.style.height = `${f}px`, n._totalCols > 1) {
|
|
2870
3052
|
const m = 100 / n._totalCols;
|
|
2871
3053
|
c.style.left = `${n._col * m}%`, c.style.width = `${m}%`;
|
|
2872
3054
|
}
|
|
2873
3055
|
}
|
|
2874
3056
|
if (typeof l == "function") {
|
|
2875
|
-
const u = l(n, o),
|
|
2876
|
-
|
|
3057
|
+
const u = l(n, o), g = document.createElement("div");
|
|
3058
|
+
g.classList.add("cal-sched-event__custom"), u instanceof HTMLElement ? g.appendChild(u) : u != null && (g.textContent = String(u)), c.appendChild(g);
|
|
2877
3059
|
} else {
|
|
2878
3060
|
const u = document.createElement("div");
|
|
2879
3061
|
if (u.classList.add("cal-sched-event__title"), u.textContent = n.title || "", c.appendChild(u), r && n.startTime && n.endTime) {
|
|
2880
|
-
const
|
|
2881
|
-
|
|
2882
|
-
const
|
|
2883
|
-
|
|
3062
|
+
const g = document.createElement("div");
|
|
3063
|
+
g.classList.add("cal-sched-event__time");
|
|
3064
|
+
const f = le(n.startTime), m = le(n.endTime);
|
|
3065
|
+
f && m && (g.textContent = `${he(f.hours, f.minutes, s)}–${he(m.hours, m.minutes, s)}`), c.appendChild(g);
|
|
2884
3066
|
}
|
|
2885
3067
|
}
|
|
2886
3068
|
if (h && !d) {
|
|
@@ -2897,7 +3079,7 @@ function De({ event: n, gridStartTime: e, slotHeight: a, interval: t, format: s,
|
|
|
2897
3079
|
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), i(n));
|
|
2898
3080
|
})), c;
|
|
2899
3081
|
}
|
|
2900
|
-
function
|
|
3082
|
+
function kt({ event: n, onClick: e, eventContent: a, resource: t }) {
|
|
2901
3083
|
const s = document.createElement("div");
|
|
2902
3084
|
s.classList.add("cal-sched-allday-chip"), s.dataset.eventId = n.id;
|
|
2903
3085
|
const i = n.color || "blue";
|
|
@@ -2910,7 +3092,7 @@ function ft({ event: n, onClick: e, eventContent: a, resource: t }) {
|
|
|
2910
3092
|
l.stopPropagation(), e(n);
|
|
2911
3093
|
}), s;
|
|
2912
3094
|
}
|
|
2913
|
-
function
|
|
3095
|
+
function ta({ event: n, format: e, onClick: a, eventContent: t, resource: s }) {
|
|
2914
3096
|
const i = document.createElement("div");
|
|
2915
3097
|
i.classList.add("cal-sched-month-chip"), i.dataset.eventId = n.id;
|
|
2916
3098
|
const l = n.color || "blue";
|
|
@@ -2932,7 +3114,7 @@ function Jt({ event: n, format: e, onClick: a, eventContent: t, resource: s }) {
|
|
|
2932
3114
|
r.stopPropagation(), a(n);
|
|
2933
3115
|
}), i;
|
|
2934
3116
|
}
|
|
2935
|
-
const
|
|
3117
|
+
const aa = `
|
|
2936
3118
|
.cal-sched-event {
|
|
2937
3119
|
position: absolute;
|
|
2938
3120
|
left: 2px;
|
|
@@ -3070,7 +3252,7 @@ function we({ date: n, startTime: e, endTime: a, resourceName: t, format: s, onC
|
|
|
3070
3252
|
h.stopPropagation(), i == null || i();
|
|
3071
3253
|
}), l.appendChild(o), l.addEventListener("click", (h) => h.stopPropagation()), l;
|
|
3072
3254
|
}
|
|
3073
|
-
const
|
|
3255
|
+
const sa = `
|
|
3074
3256
|
.cal-sched-slot-prompt {
|
|
3075
3257
|
position: absolute;
|
|
3076
3258
|
z-index: 10;
|
|
@@ -3135,7 +3317,7 @@ const Qt = `
|
|
|
3135
3317
|
box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
|
|
3136
3318
|
}
|
|
3137
3319
|
`;
|
|
3138
|
-
function
|
|
3320
|
+
function na({
|
|
3139
3321
|
date: n,
|
|
3140
3322
|
resources: e,
|
|
3141
3323
|
events: a,
|
|
@@ -3148,129 +3330,129 @@ function ea({
|
|
|
3148
3330
|
resourceMode: h,
|
|
3149
3331
|
selectedSlot: c,
|
|
3150
3332
|
eventContent: d,
|
|
3151
|
-
showTime:
|
|
3333
|
+
showTime: p = !0,
|
|
3152
3334
|
draggable: u,
|
|
3153
|
-
onSlotClick:
|
|
3154
|
-
onEventClick:
|
|
3335
|
+
onSlotClick: g,
|
|
3336
|
+
onEventClick: f,
|
|
3155
3337
|
onSlotCreate: m
|
|
3156
3338
|
}) {
|
|
3157
|
-
const
|
|
3158
|
-
|
|
3159
|
-
const
|
|
3160
|
-
if (
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3163
|
-
const
|
|
3164
|
-
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3167
|
-
for (const
|
|
3168
|
-
const
|
|
3169
|
-
|
|
3170
|
-
event:
|
|
3171
|
-
onClick: (
|
|
3339
|
+
const b = document.createElement("div");
|
|
3340
|
+
b.classList.add("cal-sched-day"), o === "horizontal" && b.classList.add("cal-sched-day--horizontal");
|
|
3341
|
+
const y = h === "tabs", w = e.length > 1 && !y, A = ke(a, n), I = A.filter((k) => !k.startTime || !k.endTime), q = A.filter((k) => k.startTime && k.endTime), B = Ee(t, s, i);
|
|
3342
|
+
if (I.length > 0) {
|
|
3343
|
+
const k = document.createElement("div");
|
|
3344
|
+
k.classList.add("cal-sched-day__allday");
|
|
3345
|
+
const L = document.createElement("div");
|
|
3346
|
+
L.classList.add("cal-sched-day__allday-label"), L.textContent = "All day", k.appendChild(L);
|
|
3347
|
+
const W = document.createElement("div");
|
|
3348
|
+
W.classList.add("cal-sched-day__allday-chips");
|
|
3349
|
+
for (const v of I) {
|
|
3350
|
+
const C = e.find((x) => x.id === v.resourceId);
|
|
3351
|
+
W.appendChild(kt({
|
|
3352
|
+
event: v,
|
|
3353
|
+
onClick: (x) => f == null ? void 0 : f(x, v.resourceId, C),
|
|
3172
3354
|
eventContent: d,
|
|
3173
|
-
resource:
|
|
3355
|
+
resource: C
|
|
3174
3356
|
}));
|
|
3175
3357
|
}
|
|
3176
|
-
|
|
3177
|
-
}
|
|
3178
|
-
if (
|
|
3179
|
-
const
|
|
3180
|
-
|
|
3181
|
-
const
|
|
3182
|
-
|
|
3183
|
-
}
|
|
3184
|
-
const
|
|
3185
|
-
|
|
3186
|
-
const
|
|
3187
|
-
if (
|
|
3188
|
-
for (const
|
|
3189
|
-
const
|
|
3190
|
-
|
|
3191
|
-
for (let
|
|
3192
|
-
const
|
|
3193
|
-
|
|
3194
|
-
const
|
|
3195
|
-
c && c.date === n && c.startTime ===
|
|
3358
|
+
k.appendChild(W), b.appendChild(k);
|
|
3359
|
+
}
|
|
3360
|
+
if (w) {
|
|
3361
|
+
const k = document.createElement("div");
|
|
3362
|
+
k.classList.add("cal-sched-day__header");
|
|
3363
|
+
const L = document.createElement("div");
|
|
3364
|
+
L.classList.add("cal-sched-day__header-spacer"), k.appendChild(L), k.appendChild(Qt({ resources: e })), b.appendChild(k);
|
|
3365
|
+
}
|
|
3366
|
+
const j = document.createElement("div");
|
|
3367
|
+
j.classList.add("cal-sched-day__grid-area"), j.appendChild(xt({ startTime: t, endTime: s, interval: i, slotHeight: l, format: r }));
|
|
3368
|
+
const H = document.createElement("div");
|
|
3369
|
+
if (H.classList.add("cal-sched-day__lanes"), w)
|
|
3370
|
+
for (const k of e) {
|
|
3371
|
+
const L = document.createElement("div");
|
|
3372
|
+
L.classList.add("cal-sched-day__lane"), L.style.flex = "1 1 0", L.dataset.resourceId = k.id, L.dataset.date = n;
|
|
3373
|
+
for (let C = 0; C < B.length; C++) {
|
|
3374
|
+
const x = document.createElement("div");
|
|
3375
|
+
x.classList.add("cal-sched-day__slot"), x.style.height = `${l}px`, x.dataset.time = B[C], x.dataset.resourceId = k.id;
|
|
3376
|
+
const T = C < B.length - 1 ? B[C + 1] : s;
|
|
3377
|
+
c && c.date === n && c.startTime === B[C] && c.resourceId === k.id && (x.classList.add("cal-sched-day__slot--selected"), x.appendChild(we({
|
|
3196
3378
|
date: n,
|
|
3197
|
-
startTime:
|
|
3198
|
-
endTime:
|
|
3199
|
-
resourceName:
|
|
3379
|
+
startTime: B[C],
|
|
3380
|
+
endTime: T,
|
|
3381
|
+
resourceName: k.name,
|
|
3200
3382
|
format: r,
|
|
3201
|
-
onCreate: () => m == null ? void 0 : m(n,
|
|
3202
|
-
}))),
|
|
3203
|
-
|
|
3204
|
-
}),
|
|
3383
|
+
onCreate: () => m == null ? void 0 : m(n, B[C], T, k.id, k)
|
|
3384
|
+
}))), x.addEventListener("click", () => {
|
|
3385
|
+
g == null || g(n, B[C], T, k.id, k);
|
|
3386
|
+
}), L.appendChild(x);
|
|
3205
3387
|
}
|
|
3206
|
-
const
|
|
3207
|
-
for (const
|
|
3208
|
-
|
|
3209
|
-
event:
|
|
3388
|
+
const W = q.filter((C) => C.resourceId === k.id), v = Te(W);
|
|
3389
|
+
for (const C of v)
|
|
3390
|
+
L.appendChild(Se({
|
|
3391
|
+
event: C,
|
|
3210
3392
|
gridStartTime: t,
|
|
3211
3393
|
slotHeight: l,
|
|
3212
3394
|
interval: i,
|
|
3213
3395
|
format: r,
|
|
3214
|
-
onClick: (
|
|
3396
|
+
onClick: (x) => f == null ? void 0 : f(x, k.id, k),
|
|
3215
3397
|
eventContent: d,
|
|
3216
|
-
showTime:
|
|
3217
|
-
resource:
|
|
3398
|
+
showTime: p,
|
|
3399
|
+
resource: k,
|
|
3218
3400
|
draggable: u
|
|
3219
3401
|
}));
|
|
3220
|
-
|
|
3402
|
+
H.appendChild(L);
|
|
3221
3403
|
}
|
|
3222
3404
|
else {
|
|
3223
|
-
const
|
|
3224
|
-
|
|
3225
|
-
const
|
|
3226
|
-
|
|
3227
|
-
for (let
|
|
3228
|
-
const
|
|
3229
|
-
|
|
3230
|
-
const
|
|
3231
|
-
c && c.date === n && c.startTime ===
|
|
3405
|
+
const k = document.createElement("div");
|
|
3406
|
+
k.classList.add("cal-sched-day__lane"), k.style.flex = "1 1 0", k.dataset.date = n;
|
|
3407
|
+
const L = e.length === 1 ? e[0] : null;
|
|
3408
|
+
L && (k.dataset.resourceId = L.id);
|
|
3409
|
+
for (let v = 0; v < B.length; v++) {
|
|
3410
|
+
const C = document.createElement("div");
|
|
3411
|
+
C.classList.add("cal-sched-day__slot"), C.style.height = `${l}px`, C.dataset.time = B[v];
|
|
3412
|
+
const x = v < B.length - 1 ? B[v + 1] : s, T = (L == null ? void 0 : L.id) || null;
|
|
3413
|
+
c && c.date === n && c.startTime === B[v] && (c.resourceId === T || !c.resourceId && !T) && (C.classList.add("cal-sched-day__slot--selected"), C.appendChild(we({
|
|
3232
3414
|
date: n,
|
|
3233
|
-
startTime:
|
|
3234
|
-
endTime:
|
|
3235
|
-
resourceName: (
|
|
3415
|
+
startTime: B[v],
|
|
3416
|
+
endTime: x,
|
|
3417
|
+
resourceName: (L == null ? void 0 : L.name) || null,
|
|
3236
3418
|
format: r,
|
|
3237
|
-
onCreate: () => m == null ? void 0 : m(n,
|
|
3238
|
-
}))),
|
|
3239
|
-
|
|
3240
|
-
}),
|
|
3419
|
+
onCreate: () => m == null ? void 0 : m(n, B[v], x, T, L)
|
|
3420
|
+
}))), C.addEventListener("click", () => {
|
|
3421
|
+
g == null || g(n, B[v], x, T, L);
|
|
3422
|
+
}), k.appendChild(C);
|
|
3241
3423
|
}
|
|
3242
|
-
const
|
|
3243
|
-
for (const
|
|
3244
|
-
const
|
|
3245
|
-
|
|
3246
|
-
event:
|
|
3424
|
+
const W = Te(q);
|
|
3425
|
+
for (const v of W) {
|
|
3426
|
+
const C = e.find((x) => x.id === v.resourceId) || e[0];
|
|
3427
|
+
k.appendChild(Se({
|
|
3428
|
+
event: v,
|
|
3247
3429
|
gridStartTime: t,
|
|
3248
3430
|
slotHeight: l,
|
|
3249
3431
|
interval: i,
|
|
3250
3432
|
format: r,
|
|
3251
|
-
onClick: (
|
|
3433
|
+
onClick: (x) => f == null ? void 0 : f(x, v.resourceId, C),
|
|
3252
3434
|
eventContent: d,
|
|
3253
|
-
showTime:
|
|
3254
|
-
resource:
|
|
3435
|
+
showTime: p,
|
|
3436
|
+
resource: C,
|
|
3255
3437
|
draggable: u
|
|
3256
3438
|
}));
|
|
3257
3439
|
}
|
|
3258
|
-
|
|
3259
|
-
}
|
|
3260
|
-
|
|
3261
|
-
const
|
|
3262
|
-
if (de(n,
|
|
3263
|
-
const
|
|
3264
|
-
if (
|
|
3265
|
-
const
|
|
3266
|
-
|
|
3267
|
-
const
|
|
3268
|
-
|
|
3440
|
+
H.appendChild(k);
|
|
3441
|
+
}
|
|
3442
|
+
j.appendChild(H);
|
|
3443
|
+
const F = me();
|
|
3444
|
+
if (de(n, F)) {
|
|
3445
|
+
const k = bt(), L = _(k), W = _(t), v = _(s);
|
|
3446
|
+
if (L >= W && L <= v) {
|
|
3447
|
+
const C = pe(k, t, l, i), x = document.createElement("div");
|
|
3448
|
+
x.classList.add("cal-sched-now-line"), x.style.top = `${C}px`;
|
|
3449
|
+
const T = document.createElement("div");
|
|
3450
|
+
T.classList.add("cal-sched-now-line__dot"), x.appendChild(T), H.appendChild(x);
|
|
3269
3451
|
}
|
|
3270
3452
|
}
|
|
3271
|
-
return
|
|
3453
|
+
return b.appendChild(j), b;
|
|
3272
3454
|
}
|
|
3273
|
-
const
|
|
3455
|
+
const ia = `
|
|
3274
3456
|
.cal-sched-day {
|
|
3275
3457
|
display: flex;
|
|
3276
3458
|
flex-direction: column;
|
|
@@ -3409,8 +3591,8 @@ const ta = `
|
|
|
3409
3591
|
justify-content: center;
|
|
3410
3592
|
padding: 4px 0;
|
|
3411
3593
|
}
|
|
3412
|
-
`,
|
|
3413
|
-
function
|
|
3594
|
+
`, Be = 3, Oe = 5;
|
|
3595
|
+
function la({
|
|
3414
3596
|
date: n,
|
|
3415
3597
|
firstDay: e,
|
|
3416
3598
|
resources: a,
|
|
@@ -3423,195 +3605,195 @@ function aa({
|
|
|
3423
3605
|
layout: h,
|
|
3424
3606
|
resourceMode: c,
|
|
3425
3607
|
selectedSlot: d,
|
|
3426
|
-
eventContent:
|
|
3608
|
+
eventContent: p,
|
|
3427
3609
|
showTime: u = !0,
|
|
3428
|
-
draggable:
|
|
3429
|
-
allDayCollapsed:
|
|
3610
|
+
draggable: g,
|
|
3611
|
+
allDayCollapsed: f,
|
|
3430
3612
|
onToggleAllDay: m,
|
|
3431
|
-
onSlotClick:
|
|
3432
|
-
onEventClick:
|
|
3433
|
-
onSlotCreate:
|
|
3613
|
+
onSlotClick: b,
|
|
3614
|
+
onEventClick: y,
|
|
3615
|
+
onSlotCreate: w
|
|
3434
3616
|
}) {
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3437
|
-
const
|
|
3438
|
-
for (const
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3441
|
-
}
|
|
3442
|
-
if (Object.keys(
|
|
3443
|
-
const
|
|
3444
|
-
|
|
3445
|
-
const
|
|
3446
|
-
|
|
3447
|
-
const
|
|
3448
|
-
|
|
3449
|
-
const
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
}),
|
|
3453
|
-
for (const
|
|
3454
|
-
const
|
|
3455
|
-
|
|
3456
|
-
const
|
|
3457
|
-
if (
|
|
3458
|
-
if (
|
|
3459
|
-
const
|
|
3460
|
-
|
|
3461
|
-
const z =
|
|
3462
|
-
for (const
|
|
3617
|
+
const A = document.createElement("div");
|
|
3618
|
+
A.classList.add("cal-sched-week"), h === "horizontal" && A.classList.add("cal-sched-week--horizontal");
|
|
3619
|
+
const I = Fe(n, e), q = c === "tabs", B = a.length > 1 && !q, j = Ee(s, i, l), H = me(), F = {};
|
|
3620
|
+
for (const x of I) {
|
|
3621
|
+
const T = ke(t, x).filter((X) => !X.startTime || !X.endTime);
|
|
3622
|
+
T.length && (F[x] = T);
|
|
3623
|
+
}
|
|
3624
|
+
if (Object.keys(F).length > 0) {
|
|
3625
|
+
const x = document.createElement("div");
|
|
3626
|
+
x.classList.add("cal-sched-week__allday"), f && x.classList.add("cal-sched-week__allday--collapsed");
|
|
3627
|
+
const T = document.createElement("div");
|
|
3628
|
+
T.classList.add("cal-sched-week__allday-spacer");
|
|
3629
|
+
const X = document.createElement("span");
|
|
3630
|
+
X.textContent = "All day", T.appendChild(X);
|
|
3631
|
+
const Y = document.createElement("button");
|
|
3632
|
+
Y.classList.add("cal-sched-week__allday-toggle"), Y.setAttribute("aria-label", f ? "Expand all-day events" : "Collapse all-day events"), Y.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>', Y.addEventListener("click", (R) => {
|
|
3633
|
+
R.stopPropagation(), m == null || m();
|
|
3634
|
+
}), T.appendChild(Y), x.appendChild(T);
|
|
3635
|
+
for (const R of I) {
|
|
3636
|
+
const O = document.createElement("div");
|
|
3637
|
+
O.classList.add("cal-sched-week__allday-cell");
|
|
3638
|
+
const S = F[R] || [];
|
|
3639
|
+
if (f) {
|
|
3640
|
+
if (S.length > 0) {
|
|
3641
|
+
const M = document.createElement("div");
|
|
3642
|
+
M.classList.add("cal-sched-week__allday-dots");
|
|
3643
|
+
const z = S.slice(0, Oe);
|
|
3644
|
+
for (const G of z) {
|
|
3463
3645
|
const Q = document.createElement("span");
|
|
3464
3646
|
Q.classList.add("cal-sched-week__allday-dot");
|
|
3465
|
-
const
|
|
3466
|
-
Q.style.background = `hsl(var(--cal-booking-${
|
|
3647
|
+
const ne = G.color || "blue";
|
|
3648
|
+
Q.style.background = `hsl(var(--cal-booking-${ne}-fg))`, M.appendChild(Q);
|
|
3467
3649
|
}
|
|
3468
|
-
if (
|
|
3469
|
-
const
|
|
3470
|
-
|
|
3650
|
+
if (S.length > Oe) {
|
|
3651
|
+
const G = document.createElement("span");
|
|
3652
|
+
G.classList.add("cal-sched-week__allday-overflow"), G.textContent = `+${S.length - Oe}`, M.appendChild(G);
|
|
3471
3653
|
}
|
|
3472
|
-
|
|
3654
|
+
O.appendChild(M);
|
|
3473
3655
|
}
|
|
3474
3656
|
} else {
|
|
3475
|
-
const
|
|
3476
|
-
for (const z of
|
|
3477
|
-
const
|
|
3478
|
-
|
|
3657
|
+
const M = S.slice(0, Be);
|
|
3658
|
+
for (const z of M) {
|
|
3659
|
+
const G = a.find((Q) => Q.id === z.resourceId);
|
|
3660
|
+
O.appendChild(kt({
|
|
3479
3661
|
event: z,
|
|
3480
|
-
onClick: (Q) =>
|
|
3481
|
-
eventContent:
|
|
3482
|
-
resource:
|
|
3662
|
+
onClick: (Q) => y == null ? void 0 : y(Q, z.resourceId, G),
|
|
3663
|
+
eventContent: p,
|
|
3664
|
+
resource: G
|
|
3483
3665
|
}));
|
|
3484
3666
|
}
|
|
3485
|
-
if (
|
|
3667
|
+
if (S.length > Be) {
|
|
3486
3668
|
const z = document.createElement("span");
|
|
3487
|
-
z.classList.add("cal-sched-week__allday-overflow"), z.textContent = `+${
|
|
3669
|
+
z.classList.add("cal-sched-week__allday-overflow"), z.textContent = `+${S.length - Be}`, O.appendChild(z);
|
|
3488
3670
|
}
|
|
3489
3671
|
}
|
|
3490
|
-
|
|
3672
|
+
x.appendChild(O);
|
|
3491
3673
|
}
|
|
3492
|
-
|
|
3674
|
+
A.appendChild(x);
|
|
3493
3675
|
}
|
|
3494
|
-
const
|
|
3495
|
-
|
|
3496
|
-
const
|
|
3497
|
-
|
|
3498
|
-
for (const
|
|
3499
|
-
const
|
|
3500
|
-
|
|
3501
|
-
const E = document.createElement("span");
|
|
3502
|
-
E.classList.add("cal-sched-week__day-name"), E.textContent = Qe(y);
|
|
3676
|
+
const L = document.createElement("div");
|
|
3677
|
+
L.classList.add("cal-sched-week__header");
|
|
3678
|
+
const W = document.createElement("div");
|
|
3679
|
+
W.classList.add("cal-sched-week__header-spacer"), L.appendChild(W);
|
|
3680
|
+
for (const x of I) {
|
|
3681
|
+
const T = U(x), X = document.createElement("div");
|
|
3682
|
+
X.classList.add("cal-sched-week__day-header"), de(x, H) && X.classList.add("cal-sched-week__day-header--today");
|
|
3503
3683
|
const Y = document.createElement("span");
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3684
|
+
Y.classList.add("cal-sched-week__day-name"), Y.textContent = nt(x);
|
|
3685
|
+
const R = document.createElement("span");
|
|
3686
|
+
if (R.classList.add("cal-sched-week__day-num"), de(x, H) && R.classList.add("cal-sched-week__day-num--today"), R.textContent = T ? T.getDate() : "", X.appendChild(Y), X.appendChild(R), B) {
|
|
3687
|
+
const O = document.createElement("div");
|
|
3688
|
+
O.classList.add("cal-sched-week__res-row");
|
|
3689
|
+
for (const S of a) {
|
|
3690
|
+
const M = document.createElement("span");
|
|
3691
|
+
M.classList.add("cal-sched-week__res-label");
|
|
3510
3692
|
const z = document.createElement("span");
|
|
3511
|
-
z.classList.add("cal-sched-week__res-dot"), z.style.background = `hsl(var(--cal-booking-${
|
|
3693
|
+
z.classList.add("cal-sched-week__res-dot"), z.style.background = `hsl(var(--cal-booking-${S.color || "blue"}-fg))`, M.appendChild(z), M.appendChild(document.createTextNode(S.name)), O.appendChild(M);
|
|
3512
3694
|
}
|
|
3513
|
-
|
|
3695
|
+
X.appendChild(O);
|
|
3514
3696
|
}
|
|
3515
|
-
|
|
3697
|
+
L.appendChild(X);
|
|
3516
3698
|
}
|
|
3517
|
-
|
|
3518
|
-
const
|
|
3519
|
-
|
|
3520
|
-
const
|
|
3521
|
-
|
|
3522
|
-
for (const
|
|
3523
|
-
const
|
|
3524
|
-
|
|
3525
|
-
const
|
|
3526
|
-
if (
|
|
3527
|
-
for (const
|
|
3528
|
-
const
|
|
3529
|
-
|
|
3530
|
-
for (let
|
|
3699
|
+
A.appendChild(L);
|
|
3700
|
+
const v = document.createElement("div");
|
|
3701
|
+
v.classList.add("cal-sched-week__grid-area"), v.appendChild(xt({ startTime: s, endTime: i, interval: l, slotHeight: r, format: o }));
|
|
3702
|
+
const C = document.createElement("div");
|
|
3703
|
+
C.classList.add("cal-sched-week__cols");
|
|
3704
|
+
for (const x of I) {
|
|
3705
|
+
const T = document.createElement("div");
|
|
3706
|
+
T.classList.add("cal-sched-week__day-col"), T.dataset.date = x, de(x, H) && T.classList.add("cal-sched-week__day-col--today");
|
|
3707
|
+
const X = ke(t, x).filter((Y) => Y.startTime && Y.endTime);
|
|
3708
|
+
if (B)
|
|
3709
|
+
for (const Y of a) {
|
|
3710
|
+
const R = document.createElement("div");
|
|
3711
|
+
R.classList.add("cal-sched-week__lane"), R.dataset.resourceId = Y.id;
|
|
3712
|
+
for (let M = 0; M < j.length; M++) {
|
|
3531
3713
|
const z = document.createElement("div");
|
|
3532
|
-
z.classList.add("cal-sched-week__slot"), z.style.height = `${r}px`, z.dataset.time =
|
|
3533
|
-
const
|
|
3534
|
-
d && d.date ===
|
|
3535
|
-
date:
|
|
3536
|
-
startTime:
|
|
3537
|
-
endTime:
|
|
3538
|
-
resourceName:
|
|
3714
|
+
z.classList.add("cal-sched-week__slot"), z.style.height = `${r}px`, z.dataset.time = j[M];
|
|
3715
|
+
const G = M < j.length - 1 ? j[M + 1] : i;
|
|
3716
|
+
d && d.date === x && d.startTime === j[M] && d.resourceId === Y.id && (z.classList.add("cal-sched-week__slot--selected"), z.appendChild(we({
|
|
3717
|
+
date: x,
|
|
3718
|
+
startTime: j[M],
|
|
3719
|
+
endTime: G,
|
|
3720
|
+
resourceName: Y.name,
|
|
3539
3721
|
format: o,
|
|
3540
|
-
onCreate: () =>
|
|
3722
|
+
onCreate: () => w == null ? void 0 : w(x, j[M], G, Y.id, Y)
|
|
3541
3723
|
}))), z.addEventListener("click", () => {
|
|
3542
|
-
|
|
3543
|
-
}),
|
|
3724
|
+
b == null || b(x, j[M], G, Y.id, Y);
|
|
3725
|
+
}), R.appendChild(z);
|
|
3544
3726
|
}
|
|
3545
|
-
const
|
|
3546
|
-
for (const
|
|
3547
|
-
|
|
3548
|
-
event:
|
|
3727
|
+
const O = X.filter((M) => M.resourceId === Y.id), S = Te(O);
|
|
3728
|
+
for (const M of S)
|
|
3729
|
+
R.appendChild(Se({
|
|
3730
|
+
event: M,
|
|
3549
3731
|
gridStartTime: s,
|
|
3550
3732
|
slotHeight: r,
|
|
3551
3733
|
interval: l,
|
|
3552
3734
|
format: o,
|
|
3553
|
-
onClick: (z) =>
|
|
3554
|
-
eventContent:
|
|
3735
|
+
onClick: (z) => y == null ? void 0 : y(z, Y.id, Y),
|
|
3736
|
+
eventContent: p,
|
|
3555
3737
|
showTime: u,
|
|
3556
|
-
resource:
|
|
3557
|
-
draggable:
|
|
3738
|
+
resource: Y,
|
|
3739
|
+
draggable: g
|
|
3558
3740
|
}));
|
|
3559
|
-
|
|
3741
|
+
T.appendChild(R);
|
|
3560
3742
|
}
|
|
3561
3743
|
else {
|
|
3562
|
-
const
|
|
3563
|
-
|
|
3564
|
-
const
|
|
3565
|
-
|
|
3566
|
-
for (let
|
|
3567
|
-
const
|
|
3568
|
-
|
|
3569
|
-
const z =
|
|
3570
|
-
d && d.date ===
|
|
3571
|
-
date:
|
|
3572
|
-
startTime:
|
|
3744
|
+
const Y = document.createElement("div");
|
|
3745
|
+
Y.classList.add("cal-sched-week__lane", "cal-sched-week__lane--full");
|
|
3746
|
+
const R = a.length === 1 ? a[0] : null;
|
|
3747
|
+
R && (Y.dataset.resourceId = R.id);
|
|
3748
|
+
for (let S = 0; S < j.length; S++) {
|
|
3749
|
+
const M = document.createElement("div");
|
|
3750
|
+
M.classList.add("cal-sched-week__slot"), M.style.height = `${r}px`, M.dataset.time = j[S];
|
|
3751
|
+
const z = S < j.length - 1 ? j[S + 1] : i, G = (R == null ? void 0 : R.id) || null;
|
|
3752
|
+
d && d.date === x && d.startTime === j[S] && (d.resourceId === G || !d.resourceId && !G) && (M.classList.add("cal-sched-week__slot--selected"), M.appendChild(we({
|
|
3753
|
+
date: x,
|
|
3754
|
+
startTime: j[S],
|
|
3573
3755
|
endTime: z,
|
|
3574
|
-
resourceName: (
|
|
3756
|
+
resourceName: (R == null ? void 0 : R.name) || null,
|
|
3575
3757
|
format: o,
|
|
3576
|
-
onCreate: () =>
|
|
3577
|
-
}))),
|
|
3578
|
-
|
|
3579
|
-
}),
|
|
3758
|
+
onCreate: () => w == null ? void 0 : w(x, j[S], z, G, R)
|
|
3759
|
+
}))), M.addEventListener("click", () => {
|
|
3760
|
+
b == null || b(x, j[S], z, G, R);
|
|
3761
|
+
}), Y.appendChild(M);
|
|
3580
3762
|
}
|
|
3581
|
-
const
|
|
3582
|
-
for (const
|
|
3583
|
-
const
|
|
3584
|
-
|
|
3585
|
-
event:
|
|
3763
|
+
const O = Te(X);
|
|
3764
|
+
for (const S of O) {
|
|
3765
|
+
const M = a.find((z) => z.id === S.resourceId) || a[0];
|
|
3766
|
+
Y.appendChild(Se({
|
|
3767
|
+
event: S,
|
|
3586
3768
|
gridStartTime: s,
|
|
3587
3769
|
slotHeight: r,
|
|
3588
3770
|
interval: l,
|
|
3589
3771
|
format: o,
|
|
3590
|
-
onClick: (z) =>
|
|
3591
|
-
eventContent:
|
|
3772
|
+
onClick: (z) => y == null ? void 0 : y(z, S.resourceId, M),
|
|
3773
|
+
eventContent: p,
|
|
3592
3774
|
showTime: u,
|
|
3593
|
-
resource:
|
|
3594
|
-
draggable:
|
|
3775
|
+
resource: M,
|
|
3776
|
+
draggable: g
|
|
3595
3777
|
}));
|
|
3596
3778
|
}
|
|
3597
|
-
|
|
3779
|
+
T.appendChild(Y);
|
|
3598
3780
|
}
|
|
3599
|
-
|
|
3600
|
-
}
|
|
3601
|
-
if (
|
|
3602
|
-
const
|
|
3603
|
-
if (
|
|
3604
|
-
const
|
|
3605
|
-
|
|
3606
|
-
const
|
|
3607
|
-
|
|
3781
|
+
C.appendChild(T);
|
|
3782
|
+
}
|
|
3783
|
+
if (I.includes(H)) {
|
|
3784
|
+
const x = bt(), T = _(x), X = _(s), Y = _(i);
|
|
3785
|
+
if (T >= X && T <= Y) {
|
|
3786
|
+
const R = I.indexOf(H), O = pe(x, s, r, l), S = document.createElement("div");
|
|
3787
|
+
S.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), S.style.top = `${O}px`;
|
|
3788
|
+
const M = 100 / 7;
|
|
3789
|
+
S.style.left = `${R * M}%`, S.style.width = `${M}%`;
|
|
3608
3790
|
const z = document.createElement("div");
|
|
3609
|
-
z.classList.add("cal-sched-now-line__dot"),
|
|
3791
|
+
z.classList.add("cal-sched-now-line__dot"), S.appendChild(z), C.appendChild(S);
|
|
3610
3792
|
}
|
|
3611
3793
|
}
|
|
3612
|
-
return
|
|
3794
|
+
return v.appendChild(C), A.appendChild(v), A;
|
|
3613
3795
|
}
|
|
3614
|
-
const
|
|
3796
|
+
const ra = `
|
|
3615
3797
|
.cal-sched-week {
|
|
3616
3798
|
display: flex;
|
|
3617
3799
|
flex-direction: column;
|
|
@@ -3829,8 +4011,8 @@ const sa = `
|
|
|
3829
4011
|
z-index: 5;
|
|
3830
4012
|
pointer-events: none;
|
|
3831
4013
|
}
|
|
3832
|
-
`,
|
|
3833
|
-
function
|
|
4014
|
+
`, at = 3;
|
|
4015
|
+
function oa({
|
|
3834
4016
|
date: n,
|
|
3835
4017
|
firstDay: e,
|
|
3836
4018
|
resources: a,
|
|
@@ -3845,59 +4027,59 @@ function na({
|
|
|
3845
4027
|
}) {
|
|
3846
4028
|
const d = document.createElement("div");
|
|
3847
4029
|
d.classList.add("cal-sched-month");
|
|
3848
|
-
const
|
|
3849
|
-
if (!
|
|
3850
|
-
const u =
|
|
4030
|
+
const p = U(n);
|
|
4031
|
+
if (!p) return d;
|
|
4032
|
+
const u = p.getFullYear(), g = p.getMonth();
|
|
3851
4033
|
me();
|
|
3852
|
-
const
|
|
3853
|
-
|
|
3854
|
-
const m =
|
|
3855
|
-
for (const
|
|
3856
|
-
const
|
|
3857
|
-
|
|
3858
|
-
}
|
|
3859
|
-
d.appendChild(
|
|
3860
|
-
const
|
|
3861
|
-
|
|
3862
|
-
const
|
|
3863
|
-
for (const
|
|
3864
|
-
const
|
|
3865
|
-
|
|
3866
|
-
|
|
4034
|
+
const f = document.createElement("div");
|
|
4035
|
+
f.classList.add("cal-sched-month__weekdays");
|
|
4036
|
+
const m = it(e);
|
|
4037
|
+
for (const w of m) {
|
|
4038
|
+
const A = document.createElement("div");
|
|
4039
|
+
A.classList.add("cal-sched-month__weekday"), A.textContent = w, f.appendChild(A);
|
|
4040
|
+
}
|
|
4041
|
+
d.appendChild(f);
|
|
4042
|
+
const b = document.createElement("div");
|
|
4043
|
+
b.classList.add("cal-sched-month__grid");
|
|
4044
|
+
const y = lt(u, g, e);
|
|
4045
|
+
for (const w of y) {
|
|
4046
|
+
const A = document.createElement("div");
|
|
4047
|
+
A.classList.add("cal-sched-month__cell"), w.isCurrentMonth || A.classList.add("cal-sched-month__cell--outside"), w.isToday && A.classList.add("cal-sched-month__cell--today"), l && w.dateString === l && A.classList.add("cal-sched-month__cell--selected"), A.addEventListener("click", (F) => {
|
|
4048
|
+
F.target.closest(".cal-sched-month-chip") || o == null || o(w.dateString);
|
|
3867
4049
|
});
|
|
4050
|
+
const I = document.createElement("div");
|
|
4051
|
+
I.classList.add("cal-sched-month__day-num"), w.isToday && I.classList.add("cal-sched-month__day-num--today"), I.textContent = w.day, A.appendChild(I);
|
|
4052
|
+
let q = ke(t, w.dateString);
|
|
4053
|
+
i && (q = q.filter((F) => F.resourceId === i)), q.sort((F, k) => F.startTime && !k.startTime ? -1 : !F.startTime && k.startTime ? 1 : F.startTime && k.startTime ? F.startTime.localeCompare(k.startTime) : 0);
|
|
3868
4054
|
const B = document.createElement("div");
|
|
3869
|
-
B.classList.add("cal-sched-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
for (const M of N) {
|
|
3876
|
-
const x = a.find((f) => f.id === M.resourceId);
|
|
3877
|
-
O.appendChild(Jt({
|
|
3878
|
-
event: M,
|
|
4055
|
+
B.classList.add("cal-sched-month__events");
|
|
4056
|
+
const j = q.slice(0, at), H = q.length - at;
|
|
4057
|
+
for (const F of j) {
|
|
4058
|
+
const k = a.find((L) => L.id === F.resourceId);
|
|
4059
|
+
B.appendChild(ta({
|
|
4060
|
+
event: F,
|
|
3879
4061
|
format: s,
|
|
3880
|
-
onClick: (
|
|
4062
|
+
onClick: (L) => h == null ? void 0 : h(L, F.resourceId, k),
|
|
3881
4063
|
eventContent: r,
|
|
3882
|
-
resource:
|
|
4064
|
+
resource: k
|
|
3883
4065
|
}));
|
|
3884
4066
|
}
|
|
3885
|
-
if (
|
|
3886
|
-
const
|
|
3887
|
-
|
|
4067
|
+
if (H > 0) {
|
|
4068
|
+
const F = document.createElement("div");
|
|
4069
|
+
F.classList.add("cal-sched-month__more"), F.textContent = `+${H} more`, B.appendChild(F);
|
|
3888
4070
|
}
|
|
3889
|
-
|
|
3890
|
-
date:
|
|
4071
|
+
A.appendChild(B), l && w.dateString === l && (A.style.position = "relative", A.appendChild(we({
|
|
4072
|
+
date: w.dateString,
|
|
3891
4073
|
startTime: null,
|
|
3892
4074
|
endTime: null,
|
|
3893
4075
|
resourceName: null,
|
|
3894
4076
|
format: s,
|
|
3895
|
-
onCreate: () => c == null ? void 0 : c(
|
|
3896
|
-
}))),
|
|
4077
|
+
onCreate: () => c == null ? void 0 : c(w.dateString)
|
|
4078
|
+
}))), b.appendChild(A);
|
|
3897
4079
|
}
|
|
3898
|
-
return d.appendChild(
|
|
4080
|
+
return d.appendChild(b), d;
|
|
3899
4081
|
}
|
|
3900
|
-
const
|
|
4082
|
+
const ca = `
|
|
3901
4083
|
.cal-sched-month {
|
|
3902
4084
|
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
3903
4085
|
border-radius: var(--cal-radius);
|
|
@@ -3982,7 +4164,7 @@ const ia = `
|
|
|
3982
4164
|
color: hsl(var(--cal-fg));
|
|
3983
4165
|
}
|
|
3984
4166
|
`;
|
|
3985
|
-
function
|
|
4167
|
+
function da({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
|
|
3986
4168
|
const t = document.createElement("div");
|
|
3987
4169
|
t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-sched-skeleton-grid");
|
|
3988
4170
|
const s = document.createElement("div");
|
|
@@ -4004,8 +4186,8 @@ function la({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
|
|
|
4004
4186
|
for (let c = 0; c < n; c++) {
|
|
4005
4187
|
const d = document.createElement("div");
|
|
4006
4188
|
if (d.classList.add("cal-sched-skeleton-grid__cell"), Math.random() < 0.15) {
|
|
4007
|
-
const
|
|
4008
|
-
|
|
4189
|
+
const p = document.createElement("div");
|
|
4190
|
+
p.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), p.style.height = `${a * (1 + Math.floor(Math.random() * 2))}px`, d.appendChild(p);
|
|
4009
4191
|
}
|
|
4010
4192
|
o.appendChild(d);
|
|
4011
4193
|
}
|
|
@@ -4013,7 +4195,7 @@ function la({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
|
|
|
4013
4195
|
}
|
|
4014
4196
|
return t.appendChild(l), t;
|
|
4015
4197
|
}
|
|
4016
|
-
function
|
|
4198
|
+
function ha() {
|
|
4017
4199
|
const n = document.createElement("div");
|
|
4018
4200
|
n.setAttribute("role", "status"), n.setAttribute("aria-label", "Loading..."), n.classList.add("cal-sched-skeleton-month");
|
|
4019
4201
|
const e = document.createElement("div");
|
|
@@ -4039,7 +4221,7 @@ function ra() {
|
|
|
4039
4221
|
}
|
|
4040
4222
|
return n.appendChild(a), n;
|
|
4041
4223
|
}
|
|
4042
|
-
const
|
|
4224
|
+
const ua = `
|
|
4043
4225
|
.cal-sched-skeleton-grid {
|
|
4044
4226
|
border: 1px solid hsl(var(--cal-sched-grid-line));
|
|
4045
4227
|
border-radius: var(--cal-radius);
|
|
@@ -4144,7 +4326,7 @@ const oa = `
|
|
|
4144
4326
|
width: 85%;
|
|
4145
4327
|
}
|
|
4146
4328
|
`;
|
|
4147
|
-
function
|
|
4329
|
+
function pa({ event: n, resource: e, format: a, onClose: t, actions: s, onAction: i }) {
|
|
4148
4330
|
const l = document.createElement("div");
|
|
4149
4331
|
l.classList.add("cal-sched-detail-backdrop"), l.addEventListener("click", t);
|
|
4150
4332
|
const r = document.createElement("div");
|
|
@@ -4157,69 +4339,69 @@ function ca({ event: n, resource: e, format: a, onClose: t, actions: s, onAction
|
|
|
4157
4339
|
if (d.classList.add("cal-sched-detail__title"), d.textContent = n.title || "Untitled", r.appendChild(d), n.startTime && n.endTime) {
|
|
4158
4340
|
const u = document.createElement("div");
|
|
4159
4341
|
u.classList.add("cal-sched-detail__row");
|
|
4160
|
-
const
|
|
4161
|
-
|
|
4162
|
-
const
|
|
4163
|
-
|
|
4342
|
+
const g = document.createElement("span");
|
|
4343
|
+
g.classList.add("cal-sched-detail__icon"), g.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(g);
|
|
4344
|
+
const f = le(n.startTime), m = le(n.endTime), b = document.createElement("span");
|
|
4345
|
+
f && m && (b.textContent = `${he(f.hours, f.minutes, a)}–${he(m.hours, m.minutes, a)}`), u.appendChild(b), r.appendChild(u);
|
|
4164
4346
|
}
|
|
4165
4347
|
if (n.start) {
|
|
4166
4348
|
const u = document.createElement("div");
|
|
4167
4349
|
u.classList.add("cal-sched-detail__row");
|
|
4168
|
-
const
|
|
4169
|
-
|
|
4170
|
-
const
|
|
4171
|
-
if (
|
|
4172
|
-
let
|
|
4350
|
+
const g = document.createElement("span");
|
|
4351
|
+
g.classList.add("cal-sched-detail__icon"), g.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(g);
|
|
4352
|
+
const f = U(n.start), m = document.createElement("span");
|
|
4353
|
+
if (f) {
|
|
4354
|
+
let b = `${nt(n.start, "long")}, ${Ce[f.getMonth()]} ${f.getDate()}`;
|
|
4173
4355
|
if (n.end && n.end !== n.start) {
|
|
4174
|
-
const
|
|
4175
|
-
|
|
4356
|
+
const y = U(n.end);
|
|
4357
|
+
y && (b += ` – ${Ce[y.getMonth()]} ${y.getDate()}`);
|
|
4176
4358
|
}
|
|
4177
|
-
m.textContent =
|
|
4359
|
+
m.textContent = b;
|
|
4178
4360
|
}
|
|
4179
4361
|
u.appendChild(m), r.appendChild(u);
|
|
4180
4362
|
}
|
|
4181
4363
|
if (e && e.name) {
|
|
4182
4364
|
const u = document.createElement("div");
|
|
4183
4365
|
u.classList.add("cal-sched-detail__row");
|
|
4184
|
-
const
|
|
4185
|
-
|
|
4186
|
-
const
|
|
4187
|
-
|
|
4366
|
+
const g = document.createElement("span");
|
|
4367
|
+
g.classList.add("cal-sched-detail__res-dot"), g.style.background = `hsl(var(--cal-booking-${e.color || "blue"}-fg))`, u.appendChild(g);
|
|
4368
|
+
const f = document.createElement("span");
|
|
4369
|
+
f.textContent = e.name, e.capacity && (f.textContent += ` (capacity: ${e.capacity})`), u.appendChild(f), r.appendChild(u);
|
|
4188
4370
|
}
|
|
4189
4371
|
if (n.metadata && typeof n.metadata == "object") {
|
|
4190
4372
|
const u = Object.entries(n.metadata);
|
|
4191
4373
|
if (u.length > 0) {
|
|
4192
|
-
const
|
|
4193
|
-
|
|
4194
|
-
for (const [
|
|
4195
|
-
const
|
|
4196
|
-
|
|
4197
|
-
const
|
|
4198
|
-
|
|
4199
|
-
const
|
|
4200
|
-
|
|
4374
|
+
const g = document.createElement("div");
|
|
4375
|
+
g.classList.add("cal-sched-detail__meta");
|
|
4376
|
+
for (const [f, m] of u) {
|
|
4377
|
+
const b = document.createElement("div");
|
|
4378
|
+
b.classList.add("cal-sched-detail__meta-row");
|
|
4379
|
+
const y = document.createElement("span");
|
|
4380
|
+
y.classList.add("cal-sched-detail__meta-label"), y.textContent = f;
|
|
4381
|
+
const w = document.createElement("span");
|
|
4382
|
+
w.textContent = String(m), b.appendChild(y), b.appendChild(w), g.appendChild(b);
|
|
4201
4383
|
}
|
|
4202
|
-
r.appendChild(
|
|
4384
|
+
r.appendChild(g);
|
|
4203
4385
|
}
|
|
4204
4386
|
}
|
|
4205
4387
|
if (s && s.length > 0) {
|
|
4206
4388
|
const u = document.createElement("div");
|
|
4207
4389
|
u.classList.add("cal-sched-detail__actions");
|
|
4208
|
-
for (const
|
|
4209
|
-
const
|
|
4210
|
-
|
|
4211
|
-
i == null || i(
|
|
4212
|
-
}), u.appendChild(
|
|
4390
|
+
for (const g of s) {
|
|
4391
|
+
const f = document.createElement("button");
|
|
4392
|
+
f.classList.add("cal-sched-detail__action"), g.type === "danger" && f.classList.add("cal-sched-detail__action--danger"), f.textContent = g.label, f.addEventListener("click", () => {
|
|
4393
|
+
i == null || i(g.label);
|
|
4394
|
+
}), u.appendChild(f);
|
|
4213
4395
|
}
|
|
4214
4396
|
r.appendChild(u);
|
|
4215
4397
|
}
|
|
4216
4398
|
l.appendChild(r);
|
|
4217
|
-
const
|
|
4399
|
+
const p = (u) => {
|
|
4218
4400
|
u.key === "Escape" && t();
|
|
4219
4401
|
};
|
|
4220
|
-
return l.addEventListener("keydown",
|
|
4402
|
+
return l.addEventListener("keydown", p), requestAnimationFrame(() => o.focus()), l;
|
|
4221
4403
|
}
|
|
4222
|
-
const
|
|
4404
|
+
const ga = `
|
|
4223
4405
|
.cal-sched-detail-backdrop {
|
|
4224
4406
|
position: absolute;
|
|
4225
4407
|
inset: 0;
|
|
@@ -4358,7 +4540,7 @@ const da = `
|
|
|
4358
4540
|
background: hsl(var(--cal-status-error-bg));
|
|
4359
4541
|
}
|
|
4360
4542
|
`;
|
|
4361
|
-
function
|
|
4543
|
+
function ma({ resources: n, selectedResourceId: e, onResourceFilter: a }) {
|
|
4362
4544
|
const t = document.createElement("div");
|
|
4363
4545
|
t.classList.add("cal-sched-res-tabs");
|
|
4364
4546
|
const s = document.createElement("button");
|
|
@@ -4371,7 +4553,7 @@ function ha({ resources: n, selectedResourceId: e, onResourceFilter: a }) {
|
|
|
4371
4553
|
}
|
|
4372
4554
|
return t;
|
|
4373
4555
|
}
|
|
4374
|
-
const
|
|
4556
|
+
const fa = `
|
|
4375
4557
|
.cal-sched-res-tabs {
|
|
4376
4558
|
display: flex;
|
|
4377
4559
|
gap: 4px;
|
|
@@ -4416,13 +4598,13 @@ const ua = `
|
|
|
4416
4598
|
border-radius: 50%;
|
|
4417
4599
|
}
|
|
4418
4600
|
`;
|
|
4419
|
-
function
|
|
4601
|
+
function ba({ onClick: n }) {
|
|
4420
4602
|
const e = document.createElement("button");
|
|
4421
4603
|
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", (a) => {
|
|
4422
4604
|
a.stopPropagation(), n == null || n();
|
|
4423
4605
|
}), e;
|
|
4424
4606
|
}
|
|
4425
|
-
const
|
|
4607
|
+
const va = `
|
|
4426
4608
|
.cal-sched-fab {
|
|
4427
4609
|
position: absolute;
|
|
4428
4610
|
bottom: 16px;
|
|
@@ -4454,40 +4636,40 @@ const ga = `
|
|
|
4454
4636
|
outline: 2px solid hsl(var(--cal-ring));
|
|
4455
4637
|
outline-offset: 2px;
|
|
4456
4638
|
}
|
|
4457
|
-
`,
|
|
4458
|
-
function
|
|
4459
|
-
let r = !1, o = null, h = null, c = null, d = null,
|
|
4460
|
-
function
|
|
4461
|
-
if (!r ||
|
|
4462
|
-
const
|
|
4639
|
+
`, _a = 4;
|
|
4640
|
+
function ya({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove: s, onResize: i, onCreate: l }) {
|
|
4641
|
+
let r = !1, o = null, h = null, c = null, d = null, p = 0, u = 0, g = 0, f = 0, m = !1, b = null, y = null, w = null, A = null, I = null, q = null, B = null, j = null, H = null, F = null, k = null, L = null, W = 0;
|
|
4642
|
+
function v(E) {
|
|
4643
|
+
if (!r || E.button !== 0) return;
|
|
4644
|
+
const $ = E.target.closest(".cal-sched-event__resize-handle"), P = E.target.closest('.cal-sched-event[data-draggable="true"]');
|
|
4463
4645
|
if (P) {
|
|
4464
|
-
const
|
|
4465
|
-
if (h = t().find((
|
|
4466
|
-
|
|
4646
|
+
const J = P.dataset.eventId;
|
|
4647
|
+
if (h = t().find((N) => N.id === J), !h) return;
|
|
4648
|
+
E.preventDefault(), E.stopPropagation(), j = P, B = E.pointerId, P.setPointerCapture(E.pointerId), g = E.clientX, f = E.clientY, m = !1, y = h.startTime, b = h.endTime, w = h.start, A = h.resourceId, $ ? (o = "resize", d = P, d.classList.add("cal-sched-event--resizing")) : (o = "move", d = P);
|
|
4467
4649
|
} else {
|
|
4468
|
-
const
|
|
4469
|
-
if (!
|
|
4470
|
-
const D =
|
|
4650
|
+
const J = E.target.closest("[data-time]");
|
|
4651
|
+
if (!J || E.target.closest(".cal-sched-slot-prompt")) return;
|
|
4652
|
+
const D = T(E.clientX, E.clientY);
|
|
4471
4653
|
if (!D) return;
|
|
4472
|
-
|
|
4473
|
-
const
|
|
4474
|
-
|
|
4654
|
+
E.preventDefault(), o = "create", g = E.clientX, f = E.clientY, m = !1, F = D.date, k = D.resourceId, L = D.time;
|
|
4655
|
+
const N = n.querySelectorAll("[data-time]");
|
|
4656
|
+
N.length > 0 && (W = N[0].getBoundingClientRect().top), j = J, B = E.pointerId, J.setPointerCapture(E.pointerId);
|
|
4475
4657
|
}
|
|
4476
|
-
n.addEventListener("pointermove",
|
|
4658
|
+
n.addEventListener("pointermove", C), n.addEventListener("pointerup", x);
|
|
4477
4659
|
}
|
|
4478
|
-
function
|
|
4660
|
+
function C(E) {
|
|
4479
4661
|
if (!o) return;
|
|
4480
|
-
const
|
|
4481
|
-
if (!(!m &&
|
|
4662
|
+
const $ = E.clientX - g, P = E.clientY - f, J = Math.sqrt($ * $ + P * P);
|
|
4663
|
+
if (!(!m && J < _a)) {
|
|
4482
4664
|
if (m = !0, o === "move") {
|
|
4483
4665
|
if (!c && d) {
|
|
4484
|
-
const
|
|
4485
|
-
|
|
4666
|
+
const N = d.getBoundingClientRect();
|
|
4667
|
+
p = g - N.left, u = f - N.top, c = d.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
|
|
4486
4668
|
position: fixed;
|
|
4487
|
-
width: ${
|
|
4488
|
-
height: ${
|
|
4489
|
-
left: ${
|
|
4490
|
-
top: ${
|
|
4669
|
+
width: ${N.width}px;
|
|
4670
|
+
height: ${N.height}px;
|
|
4671
|
+
left: ${N.left}px;
|
|
4672
|
+
top: ${N.top}px;
|
|
4491
4673
|
z-index: 1000;
|
|
4492
4674
|
pointer-events: none;
|
|
4493
4675
|
opacity: 0.85;
|
|
@@ -4502,121 +4684,121 @@ function fa({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove:
|
|
|
4502
4684
|
overflow: hidden;
|
|
4503
4685
|
`, c.style.setProperty("--ev-bg", d.style.getPropertyValue("--ev-bg")), c.style.setProperty("--ev-fg", d.style.getPropertyValue("--ev-fg")), n.appendChild(c), d.classList.add("cal-sched-event--dragging");
|
|
4504
4686
|
}
|
|
4505
|
-
c && (c.style.left = `${
|
|
4506
|
-
const D =
|
|
4507
|
-
D ?
|
|
4687
|
+
c && (c.style.left = `${E.clientX - p}px`, c.style.top = `${E.clientY - u}px`);
|
|
4688
|
+
const D = T(E.clientX, E.clientY);
|
|
4689
|
+
D ? X(D) : Y();
|
|
4508
4690
|
} else if (o === "resize") {
|
|
4509
|
-
const D = e(),
|
|
4510
|
-
let te =
|
|
4511
|
-
const se = D.minDuration ||
|
|
4691
|
+
const D = e(), N = D.snapInterval || D.interval, ae = D.slotHeight * (N / D.interval), re = E.clientY - f, V = Math.round(re / ae) * N, be = _(b), ue = _(y);
|
|
4692
|
+
let te = be + V;
|
|
4693
|
+
const se = D.minDuration || N, oe = ue + se;
|
|
4512
4694
|
if (te < oe && (te = oe), D.maxDuration) {
|
|
4513
4695
|
const fe = ue + D.maxDuration;
|
|
4514
4696
|
te > fe && (te = fe);
|
|
4515
4697
|
}
|
|
4516
|
-
const
|
|
4517
|
-
te >
|
|
4698
|
+
const K = _(D.endTime);
|
|
4699
|
+
te > K && (te = K);
|
|
4518
4700
|
const ce = ie(te);
|
|
4519
4701
|
if (d) {
|
|
4520
|
-
const fe = pe(
|
|
4521
|
-
d.style.height = `${Math.max(
|
|
4702
|
+
const fe = pe(y, D.startTime, D.slotHeight, D.interval), He = pe(ce, D.startTime, D.slotHeight, D.interval);
|
|
4703
|
+
d.style.height = `${Math.max(He - fe, D.slotHeight * 0.5)}px`;
|
|
4522
4704
|
}
|
|
4523
|
-
|
|
4705
|
+
O(E.clientX, E.clientY, ce, D.format);
|
|
4524
4706
|
} else if (o === "create") {
|
|
4525
|
-
const D = e(),
|
|
4526
|
-
let se = Math.max(
|
|
4707
|
+
const D = e(), N = D.snapInterval || D.interval, ae = E.clientY - W, re = et(Math.max(0, ae), D.startTime, D.slotHeight, D.interval), ee = tt(re, N), V = _(ee), be = _(L), ue = _(D.endTime), te = D.minDuration || N;
|
|
4708
|
+
let se = Math.max(V, be + te);
|
|
4527
4709
|
if (D.maxDuration) {
|
|
4528
|
-
const
|
|
4529
|
-
se >
|
|
4710
|
+
const K = be + D.maxDuration;
|
|
4711
|
+
se > K && (se = K);
|
|
4530
4712
|
}
|
|
4531
4713
|
se > ue && (se = ue);
|
|
4532
4714
|
const oe = ie(se);
|
|
4533
|
-
if (!
|
|
4534
|
-
|
|
4535
|
-
let
|
|
4536
|
-
|
|
4715
|
+
if (!H) {
|
|
4716
|
+
H = document.createElement("div"), H.classList.add("cal-sched-create-preview");
|
|
4717
|
+
let K = null;
|
|
4718
|
+
k && (K = n.querySelector(`[data-resource-id="${k}"][data-date="${F}"]`), K || (K = n.querySelector(`[data-date="${F}"] [data-resource-id="${k}"]`))), K || (K = n.querySelector(`[data-date="${F}"] .cal-sched-week__lane`) || n.querySelector(`[data-date="${F}"] .cal-sched-day__lane`) || n.querySelector(`[data-date="${F}"]`)), K && K.appendChild(H);
|
|
4537
4719
|
}
|
|
4538
|
-
if (
|
|
4539
|
-
const
|
|
4540
|
-
|
|
4720
|
+
if (H) {
|
|
4721
|
+
const K = e(), ce = pe(L, K.startTime, K.slotHeight, K.interval), fe = pe(oe, K.startTime, K.slotHeight, K.interval);
|
|
4722
|
+
H.style.top = `${ce}px`, H.style.height = `${Math.max(fe - ce, K.slotHeight * 0.5)}px`, H.dataset.endTime = oe;
|
|
4541
4723
|
}
|
|
4542
|
-
|
|
4724
|
+
O(E.clientX, E.clientY, oe, D.format);
|
|
4543
4725
|
}
|
|
4544
4726
|
}
|
|
4545
4727
|
}
|
|
4546
|
-
function
|
|
4728
|
+
function x(E) {
|
|
4547
4729
|
if (o) {
|
|
4548
|
-
if (n.removeEventListener("pointermove",
|
|
4730
|
+
if (n.removeEventListener("pointermove", C), n.removeEventListener("pointerup", x), j && B != null) {
|
|
4549
4731
|
try {
|
|
4550
|
-
|
|
4732
|
+
j.releasePointerCapture(B);
|
|
4551
4733
|
} catch {
|
|
4552
4734
|
}
|
|
4553
|
-
|
|
4735
|
+
j = null, B = null;
|
|
4554
4736
|
}
|
|
4555
4737
|
if (o === "move") {
|
|
4556
|
-
if (
|
|
4738
|
+
if (Y(), c && (c.remove(), c = null), d && d.classList.remove("cal-sched-event--dragging"), m) {
|
|
4557
4739
|
d && (d.dataset.wasDragged = "true");
|
|
4558
|
-
const
|
|
4559
|
-
if (
|
|
4560
|
-
const P = e(),
|
|
4561
|
-
date:
|
|
4562
|
-
startTime:
|
|
4563
|
-
endTime:
|
|
4564
|
-
resourceId:
|
|
4565
|
-
},
|
|
4566
|
-
date:
|
|
4740
|
+
const $ = T(E.clientX, E.clientY);
|
|
4741
|
+
if ($ && h) {
|
|
4742
|
+
const P = e(), J = _(b) - _(y), D = $.time, N = _(D), ae = Math.min(N + J, _(P.endTime)), re = ie(ae), ee = {
|
|
4743
|
+
date: w,
|
|
4744
|
+
startTime: y,
|
|
4745
|
+
endTime: b,
|
|
4746
|
+
resourceId: A
|
|
4747
|
+
}, V = {
|
|
4748
|
+
date: $.date,
|
|
4567
4749
|
startTime: D,
|
|
4568
4750
|
endTime: re,
|
|
4569
|
-
resourceId:
|
|
4751
|
+
resourceId: $.resourceId || A
|
|
4570
4752
|
};
|
|
4571
|
-
(ee.date !==
|
|
4753
|
+
(ee.date !== V.date || ee.startTime !== V.startTime || ee.resourceId !== V.resourceId) && (s == null || s({ event: h, from: ee, to: V }));
|
|
4572
4754
|
}
|
|
4573
4755
|
}
|
|
4574
4756
|
} else if (o === "resize") {
|
|
4575
4757
|
if (m) {
|
|
4576
|
-
const
|
|
4577
|
-
let
|
|
4578
|
-
const
|
|
4579
|
-
if (
|
|
4580
|
-
const oe = ee +
|
|
4581
|
-
|
|
4758
|
+
const $ = e(), P = $.snapInterval || $.interval, J = $.slotHeight * (P / $.interval), D = E.clientY - f, ae = Math.round(D / J) * P, re = _(b), ee = _(y);
|
|
4759
|
+
let V = re + ae;
|
|
4760
|
+
const be = $.minDuration || P, ue = ee + be;
|
|
4761
|
+
if (V < ue && (V = ue), $.maxDuration) {
|
|
4762
|
+
const oe = ee + $.maxDuration;
|
|
4763
|
+
V > oe && (V = oe);
|
|
4582
4764
|
}
|
|
4583
|
-
const te =
|
|
4584
|
-
|
|
4585
|
-
const se = ie(
|
|
4586
|
-
d && (d.dataset.wasDragged = "true"), se !==
|
|
4765
|
+
const te = _($.endTime);
|
|
4766
|
+
V > te && (V = te);
|
|
4767
|
+
const se = ie(V);
|
|
4768
|
+
d && (d.dataset.wasDragged = "true"), se !== b && h && (i == null || i({
|
|
4587
4769
|
event: h,
|
|
4588
|
-
from: { endTime:
|
|
4770
|
+
from: { endTime: b },
|
|
4589
4771
|
to: { endTime: se }
|
|
4590
4772
|
}));
|
|
4591
4773
|
}
|
|
4592
|
-
d && d.classList.remove("cal-sched-event--resizing"),
|
|
4774
|
+
d && d.classList.remove("cal-sched-event--resizing"), S();
|
|
4593
4775
|
} else if (o === "create") {
|
|
4594
|
-
|
|
4595
|
-
const
|
|
4596
|
-
|
|
4597
|
-
date:
|
|
4598
|
-
startTime:
|
|
4599
|
-
endTime:
|
|
4600
|
-
resourceId:
|
|
4601
|
-
})),
|
|
4776
|
+
S();
|
|
4777
|
+
const $ = (H == null ? void 0 : H.dataset.endTime) || null;
|
|
4778
|
+
H && (H.remove(), H = null), m && F && L && $ && (l == null || l({
|
|
4779
|
+
date: F,
|
|
4780
|
+
startTime: L,
|
|
4781
|
+
endTime: $,
|
|
4782
|
+
resourceId: k
|
|
4783
|
+
})), F = null, k = null, L = null, W = 0;
|
|
4602
4784
|
}
|
|
4603
|
-
o = null, h = null, d = null,
|
|
4785
|
+
o = null, h = null, d = null, p = 0, u = 0, g = 0, f = 0, m = !1, b = null, y = null, w = null, A = null;
|
|
4604
4786
|
}
|
|
4605
4787
|
}
|
|
4606
|
-
function
|
|
4607
|
-
const P = e(),
|
|
4608
|
-
let D = null,
|
|
4609
|
-
for (const ce of
|
|
4788
|
+
function T(E, $) {
|
|
4789
|
+
const P = e(), J = n.querySelectorAll("[data-date]");
|
|
4790
|
+
let D = null, N = null;
|
|
4791
|
+
for (const ce of J) {
|
|
4610
4792
|
const fe = ce.getBoundingClientRect();
|
|
4611
|
-
if (
|
|
4793
|
+
if (E >= fe.left && E <= fe.right) {
|
|
4612
4794
|
if (D = ce.dataset.date, ce.dataset.resourceId)
|
|
4613
|
-
|
|
4795
|
+
N = ce.dataset.resourceId;
|
|
4614
4796
|
else {
|
|
4615
|
-
const
|
|
4616
|
-
for (const
|
|
4617
|
-
const
|
|
4618
|
-
if (
|
|
4619
|
-
|
|
4797
|
+
const He = ce.querySelectorAll("[data-resource-id]");
|
|
4798
|
+
for (const Ge of He) {
|
|
4799
|
+
const Ke = Ge.getBoundingClientRect();
|
|
4800
|
+
if (E >= Ke.left && E <= Ke.right) {
|
|
4801
|
+
N = Ge.dataset.resourceId;
|
|
4620
4802
|
break;
|
|
4621
4803
|
}
|
|
4622
4804
|
}
|
|
@@ -4627,76 +4809,76 @@ function fa({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove:
|
|
|
4627
4809
|
if (!D) return null;
|
|
4628
4810
|
const ae = n.querySelectorAll("[data-time]");
|
|
4629
4811
|
if (ae.length === 0) return null;
|
|
4630
|
-
const ee = ae[0].getBoundingClientRect().top,
|
|
4631
|
-
if (
|
|
4632
|
-
const
|
|
4633
|
-
return se < oe || se >=
|
|
4812
|
+
const ee = ae[0].getBoundingClientRect().top, V = $ - ee;
|
|
4813
|
+
if (V < 0) return null;
|
|
4814
|
+
const be = P.snapInterval || P.interval, ue = et(V, P.startTime, P.slotHeight, P.interval), te = tt(ue, be), se = _(te), oe = _(P.startTime), K = _(P.endTime);
|
|
4815
|
+
return se < oe || se >= K ? null : {
|
|
4634
4816
|
date: D,
|
|
4635
4817
|
time: te,
|
|
4636
|
-
resourceId:
|
|
4818
|
+
resourceId: N
|
|
4637
4819
|
};
|
|
4638
4820
|
}
|
|
4639
|
-
function
|
|
4640
|
-
|
|
4641
|
-
const
|
|
4642
|
-
let P =
|
|
4643
|
-
h &&
|
|
4644
|
-
let D =
|
|
4645
|
-
const
|
|
4646
|
-
D >
|
|
4821
|
+
function X(E) {
|
|
4822
|
+
Y();
|
|
4823
|
+
const $ = e();
|
|
4824
|
+
let P = $.interval;
|
|
4825
|
+
h && y && b && (P = _(b) - _(y));
|
|
4826
|
+
let D = _(E.time) + P;
|
|
4827
|
+
const N = _($.endTime);
|
|
4828
|
+
D > N && (D = N);
|
|
4647
4829
|
const ae = ie(D);
|
|
4648
|
-
let re =
|
|
4830
|
+
let re = R(E.date, E.resourceId);
|
|
4649
4831
|
if (!re) return;
|
|
4650
|
-
|
|
4651
|
-
const ee = pe(
|
|
4652
|
-
|
|
4832
|
+
q = document.createElement("div"), q.classList.add("cal-sched-drop-preview");
|
|
4833
|
+
const ee = pe(E.time, $.startTime, $.slotHeight, $.interval), V = pe(ae, $.startTime, $.slotHeight, $.interval);
|
|
4834
|
+
q.style.top = `${ee}px`, q.style.height = `${Math.max(V - ee, $.slotHeight * 0.5)}px`, re.appendChild(q);
|
|
4653
4835
|
}
|
|
4654
|
-
function
|
|
4655
|
-
|
|
4836
|
+
function Y() {
|
|
4837
|
+
q && (q.remove(), q = null);
|
|
4656
4838
|
}
|
|
4657
|
-
function
|
|
4658
|
-
if (
|
|
4659
|
-
let
|
|
4660
|
-
`[data-resource-id="${
|
|
4839
|
+
function R(E, $) {
|
|
4840
|
+
if ($) {
|
|
4841
|
+
let J = n.querySelector(
|
|
4842
|
+
`[data-resource-id="${$}"][data-date="${E}"]`
|
|
4661
4843
|
);
|
|
4662
|
-
if (
|
|
4663
|
-
`[data-date="${
|
|
4664
|
-
)),
|
|
4844
|
+
if (J || (J = n.querySelector(
|
|
4845
|
+
`[data-date="${E}"] [data-resource-id="${$}"]`
|
|
4846
|
+
)), J) return J;
|
|
4665
4847
|
}
|
|
4666
|
-
const P = n.querySelector(`[data-date="${
|
|
4848
|
+
const P = n.querySelector(`[data-date="${E}"]`);
|
|
4667
4849
|
return P ? P.querySelector(".cal-sched-week__lane") || P.querySelector(".cal-sched-day__lane") || P : null;
|
|
4668
4850
|
}
|
|
4669
|
-
function
|
|
4670
|
-
|
|
4671
|
-
const { hours: D, minutes:
|
|
4672
|
-
|
|
4851
|
+
function O(E, $, P, J) {
|
|
4852
|
+
I || (I = document.createElement("div"), I.classList.add("cal-sched-drag-time-label"), n.appendChild(I));
|
|
4853
|
+
const { hours: D, minutes: N } = M(P), ae = J === "12h" ? z(D, N) : P;
|
|
4854
|
+
I.textContent = ae, I.style.left = `${E + 12}px`, I.style.top = `${$ - 8}px`;
|
|
4673
4855
|
}
|
|
4674
|
-
function
|
|
4675
|
-
|
|
4856
|
+
function S() {
|
|
4857
|
+
I && (I.remove(), I = null);
|
|
4676
4858
|
}
|
|
4677
|
-
function
|
|
4678
|
-
const [
|
|
4679
|
-
return { hours:
|
|
4859
|
+
function M(E) {
|
|
4860
|
+
const [$, P] = E.split(":").map(Number);
|
|
4861
|
+
return { hours: $, minutes: P };
|
|
4680
4862
|
}
|
|
4681
|
-
function z(
|
|
4682
|
-
const P =
|
|
4683
|
-
return `${
|
|
4863
|
+
function z(E, $) {
|
|
4864
|
+
const P = E >= 12 ? "PM" : "AM";
|
|
4865
|
+
return `${E % 12 || 12}:${String($).padStart(2, "0")} ${P}`;
|
|
4684
4866
|
}
|
|
4685
|
-
function
|
|
4686
|
-
r || (r = !0, n.addEventListener("pointerdown",
|
|
4867
|
+
function G() {
|
|
4868
|
+
r || (r = !0, n.addEventListener("pointerdown", v));
|
|
4687
4869
|
}
|
|
4688
4870
|
function Q() {
|
|
4689
|
-
r = !1, n.removeEventListener("pointerdown",
|
|
4871
|
+
r = !1, n.removeEventListener("pointerdown", v), n.removeEventListener("pointermove", C), n.removeEventListener("pointerup", x), ne();
|
|
4690
4872
|
}
|
|
4691
|
-
function
|
|
4692
|
-
c && (c.remove(), c = null),
|
|
4873
|
+
function ne() {
|
|
4874
|
+
c && (c.remove(), c = null), H && (H.remove(), H = null), d && (d.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), d = null), Y(), S(), o = null, h = null, m = !1;
|
|
4693
4875
|
}
|
|
4694
|
-
function
|
|
4876
|
+
function ve() {
|
|
4695
4877
|
Q();
|
|
4696
4878
|
}
|
|
4697
|
-
return { enable:
|
|
4879
|
+
return { enable: G, disable: Q, destroy: ve };
|
|
4698
4880
|
}
|
|
4699
|
-
const
|
|
4881
|
+
const xa = `
|
|
4700
4882
|
[data-draggable="true"] {
|
|
4701
4883
|
cursor: grab;
|
|
4702
4884
|
}
|
|
@@ -4781,7 +4963,7 @@ const va = `
|
|
|
4781
4963
|
z-index: 1001;
|
|
4782
4964
|
white-space: nowrap;
|
|
4783
4965
|
}
|
|
4784
|
-
`,
|
|
4966
|
+
`, ka = `
|
|
4785
4967
|
.cal-sched {
|
|
4786
4968
|
background: hsl(var(--cal-bg));
|
|
4787
4969
|
border-radius: var(--cal-radius);
|
|
@@ -4793,27 +4975,27 @@ const va = `
|
|
|
4793
4975
|
position: relative;
|
|
4794
4976
|
}
|
|
4795
4977
|
`;
|
|
4796
|
-
class
|
|
4978
|
+
class wa extends Me {
|
|
4797
4979
|
static get styles() {
|
|
4798
4980
|
return [
|
|
4799
|
-
Me,
|
|
4800
|
-
Ae,
|
|
4801
4981
|
$e,
|
|
4802
|
-
|
|
4803
|
-
|
|
4982
|
+
ze,
|
|
4983
|
+
Ie,
|
|
4984
|
+
Jt,
|
|
4804
4985
|
Vt,
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
sa,
|
|
4986
|
+
ea,
|
|
4987
|
+
aa,
|
|
4808
4988
|
ia,
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
da,
|
|
4989
|
+
ra,
|
|
4990
|
+
ca,
|
|
4812
4991
|
ua,
|
|
4813
|
-
|
|
4992
|
+
Pe,
|
|
4814
4993
|
ga,
|
|
4994
|
+
fa,
|
|
4995
|
+
sa,
|
|
4815
4996
|
va,
|
|
4816
|
-
|
|
4997
|
+
xa,
|
|
4998
|
+
ka
|
|
4817
4999
|
];
|
|
4818
5000
|
}
|
|
4819
5001
|
static get observedAttributes() {
|
|
@@ -4835,11 +5017,12 @@ class _a extends Se {
|
|
|
4835
5017
|
"draggable-events",
|
|
4836
5018
|
"snap-interval",
|
|
4837
5019
|
"min-duration",
|
|
4838
|
-
"max-duration"
|
|
5020
|
+
"max-duration",
|
|
5021
|
+
"locale"
|
|
4839
5022
|
];
|
|
4840
5023
|
}
|
|
4841
5024
|
constructor() {
|
|
4842
|
-
super(), this._store =
|
|
5025
|
+
super(), this._store = Ae({
|
|
4843
5026
|
view: "week",
|
|
4844
5027
|
anchorDate: me(),
|
|
4845
5028
|
layout: "vertical",
|
|
@@ -4855,7 +5038,7 @@ class _a extends Se {
|
|
|
4855
5038
|
statusDismissible: !0,
|
|
4856
5039
|
// All-day collapse
|
|
4857
5040
|
allDayCollapsed: !1
|
|
4858
|
-
}), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
|
|
5041
|
+
}), 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;
|
|
4859
5042
|
}
|
|
4860
5043
|
// -- Attribute getters --
|
|
4861
5044
|
get view() {
|
|
@@ -4912,6 +5095,9 @@ class _a extends Se {
|
|
|
4912
5095
|
const e = this.getAttribute("max-duration");
|
|
4913
5096
|
return e ? parseInt(e, 10) : null;
|
|
4914
5097
|
}
|
|
5098
|
+
get locale() {
|
|
5099
|
+
return this.getAttribute("locale") || void 0;
|
|
5100
|
+
}
|
|
4915
5101
|
// -- Properties --
|
|
4916
5102
|
get resources() {
|
|
4917
5103
|
return this._resources;
|
|
@@ -4937,6 +5123,15 @@ class _a extends Se {
|
|
|
4937
5123
|
set eventContent(e) {
|
|
4938
5124
|
this._eventContent = typeof e == "function" ? e : null, this._initialized && this.render();
|
|
4939
5125
|
}
|
|
5126
|
+
get colors() {
|
|
5127
|
+
return this._colors;
|
|
5128
|
+
}
|
|
5129
|
+
set colors(e) {
|
|
5130
|
+
if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = rt(this._colors), this._customColorMap)
|
|
5131
|
+
for (const [a, t] of Object.entries(this._customColorMap))
|
|
5132
|
+
this.style.setProperty(`--cal-booking-${a}-bg`, t.bg), this.style.setProperty(`--cal-booking-${a}-fg`, t.fg), this.style.setProperty(`--cal-booking-${a}-hover`, t.hover);
|
|
5133
|
+
this._initialized && this.render();
|
|
5134
|
+
}
|
|
4940
5135
|
get value() {
|
|
4941
5136
|
return this._lastSlotValue || null;
|
|
4942
5137
|
}
|
|
@@ -4986,7 +5181,7 @@ class _a extends Se {
|
|
|
4986
5181
|
this.goToDate(me());
|
|
4987
5182
|
}
|
|
4988
5183
|
next() {
|
|
4989
|
-
const e = this._store.getState(), a =
|
|
5184
|
+
const e = this._store.getState(), a = U(e.anchorDate);
|
|
4990
5185
|
if (!a) return;
|
|
4991
5186
|
let t;
|
|
4992
5187
|
if (e.view === "day")
|
|
@@ -5000,7 +5195,7 @@ class _a extends Se {
|
|
|
5000
5195
|
this._store.set({ anchorDate: t }), this.emit("cal:date-change", { date: t, view: e.view });
|
|
5001
5196
|
}
|
|
5002
5197
|
prev() {
|
|
5003
|
-
const e = this._store.getState(), a =
|
|
5198
|
+
const e = this._store.getState(), a = U(e.anchorDate);
|
|
5004
5199
|
if (!a) return;
|
|
5005
5200
|
let t;
|
|
5006
5201
|
if (e.view === "day")
|
|
@@ -5014,7 +5209,7 @@ class _a extends Se {
|
|
|
5014
5209
|
this._store.set({ anchorDate: t }), this.emit("cal:date-change", { date: t, view: e.view });
|
|
5015
5210
|
}
|
|
5016
5211
|
findAvailableSlot(e) {
|
|
5017
|
-
return
|
|
5212
|
+
return Kt(
|
|
5018
5213
|
e,
|
|
5019
5214
|
this._resources,
|
|
5020
5215
|
this._events,
|
|
@@ -5024,7 +5219,14 @@ class _a extends Se {
|
|
|
5024
5219
|
);
|
|
5025
5220
|
}
|
|
5026
5221
|
isSlotAvailable(e, a, t, s) {
|
|
5027
|
-
return
|
|
5222
|
+
return yt(this._events, s, e, a, t);
|
|
5223
|
+
}
|
|
5224
|
+
clear() {
|
|
5225
|
+
this._store.set({
|
|
5226
|
+
selectedSlot: null,
|
|
5227
|
+
detailEvent: null,
|
|
5228
|
+
detailResource: null
|
|
5229
|
+
}), this._lastSlotValue = null;
|
|
5028
5230
|
}
|
|
5029
5231
|
// -- Event handlers --
|
|
5030
5232
|
_handleSlotClick(e, a, t, s, i) {
|
|
@@ -5058,7 +5260,7 @@ class _a extends Se {
|
|
|
5058
5260
|
});
|
|
5059
5261
|
}
|
|
5060
5262
|
_initDrag() {
|
|
5061
|
-
this._dragManager || (this._dragManager =
|
|
5263
|
+
this._dragManager || (this._dragManager = ya({
|
|
5062
5264
|
shadowRoot: this.shadowRoot,
|
|
5063
5265
|
getConfig: () => ({
|
|
5064
5266
|
slotHeight: this.slotHeight,
|
|
@@ -5075,7 +5277,7 @@ class _a extends Se {
|
|
|
5075
5277
|
return {
|
|
5076
5278
|
view: e.view,
|
|
5077
5279
|
anchorDate: e.anchorDate,
|
|
5078
|
-
weekDates:
|
|
5280
|
+
weekDates: Fe(e.anchorDate, this.firstDay),
|
|
5079
5281
|
resources: this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }],
|
|
5080
5282
|
resourceMode: this.resourceMode,
|
|
5081
5283
|
selectedResourceId: e.selectedResourceId
|
|
@@ -5103,58 +5305,59 @@ class _a extends Se {
|
|
|
5103
5305
|
}
|
|
5104
5306
|
// -- Render --
|
|
5105
5307
|
render() {
|
|
5106
|
-
var
|
|
5308
|
+
var f;
|
|
5107
5309
|
if (this._rendering) return;
|
|
5108
5310
|
this._rendering = !0;
|
|
5109
5311
|
const e = this.shadowRoot, a = [...e.childNodes];
|
|
5110
5312
|
for (const m of a)
|
|
5111
5313
|
m.nodeName !== "STYLE" && !(m instanceof CSSStyleSheet) && e.removeChild(m);
|
|
5112
5314
|
const t = this._store.getState(), s = document.createElement("div");
|
|
5113
|
-
s.classList.add("cal-sched"), t.statusType && t.statusMessage && s.appendChild(
|
|
5315
|
+
s.classList.add("cal-sched"), t.statusType && t.statusMessage && s.appendChild(Ye({
|
|
5114
5316
|
type: t.statusType,
|
|
5115
5317
|
message: t.statusMessage,
|
|
5116
5318
|
dismissible: t.statusDismissible,
|
|
5117
5319
|
onDismiss: () => this.clearStatus()
|
|
5118
5320
|
}));
|
|
5119
|
-
const i = t.view, l = t.anchorDate, r =
|
|
5120
|
-
s.appendChild(
|
|
5321
|
+
const i = t.view, l = t.anchorDate, r = Fe(l, this.firstDay), o = Xt(i, l, r, this.locale), h = this.resourceMode;
|
|
5322
|
+
s.appendChild(Ut({
|
|
5121
5323
|
title: o,
|
|
5122
5324
|
view: i,
|
|
5123
5325
|
onPrev: () => this.prev(),
|
|
5124
5326
|
onNext: () => this.next(),
|
|
5125
5327
|
onToday: () => this.today(),
|
|
5126
|
-
onViewChange: (m) => this._handleViewChange(m)
|
|
5328
|
+
onViewChange: (m) => this._handleViewChange(m),
|
|
5329
|
+
locale: this.locale
|
|
5127
5330
|
}));
|
|
5128
5331
|
const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }], d = h === "tabs" && c.length > 1 && c[0].id !== "__default";
|
|
5129
|
-
d && !this.loading && s.appendChild(
|
|
5332
|
+
d && !this.loading && s.appendChild(ma({
|
|
5130
5333
|
resources: c,
|
|
5131
5334
|
selectedResourceId: t.selectedResourceId,
|
|
5132
5335
|
onResourceFilter: (m) => this._handleResourceFilter(m)
|
|
5133
5336
|
}));
|
|
5134
|
-
let
|
|
5135
|
-
d && t.selectedResourceId && (
|
|
5337
|
+
let p = this._events;
|
|
5338
|
+
d && t.selectedResourceId && (p = this._events.filter((m) => m.resourceId === t.selectedResourceId));
|
|
5136
5339
|
let u = c;
|
|
5137
5340
|
if (d && t.selectedResourceId) {
|
|
5138
|
-
const m = c.find((
|
|
5341
|
+
const m = c.find((b) => b.id === t.selectedResourceId);
|
|
5139
5342
|
m && (u = [m]);
|
|
5140
5343
|
}
|
|
5141
|
-
const
|
|
5142
|
-
if (
|
|
5344
|
+
const g = document.createElement("div");
|
|
5345
|
+
if (g.classList.add("cal-sched__body"), this.loading)
|
|
5143
5346
|
if (i === "month")
|
|
5144
|
-
|
|
5347
|
+
g.appendChild(ha());
|
|
5145
5348
|
else {
|
|
5146
5349
|
const m = i === "week" ? 7 : Math.max(this._resources.length, 1);
|
|
5147
|
-
|
|
5350
|
+
g.appendChild(da({
|
|
5148
5351
|
columns: m,
|
|
5149
|
-
rows: Math.ceil((
|
|
5352
|
+
rows: Math.ceil((_(this.endTime) - _(this.startTime)) / this.interval),
|
|
5150
5353
|
slotHeight: this.slotHeight
|
|
5151
5354
|
}));
|
|
5152
5355
|
}
|
|
5153
5356
|
else
|
|
5154
|
-
i === "day" ?
|
|
5357
|
+
i === "day" ? g.appendChild(na({
|
|
5155
5358
|
date: l,
|
|
5156
5359
|
resources: u,
|
|
5157
|
-
events:
|
|
5360
|
+
events: p,
|
|
5158
5361
|
startTime: this.startTime,
|
|
5159
5362
|
endTime: this.endTime,
|
|
5160
5363
|
interval: this.interval,
|
|
@@ -5166,14 +5369,14 @@ class _a extends Se {
|
|
|
5166
5369
|
eventContent: this._eventContent,
|
|
5167
5370
|
showTime: this.showEventTime,
|
|
5168
5371
|
draggable: this.draggableEvents,
|
|
5169
|
-
onSlotClick: (m,
|
|
5170
|
-
onEventClick: (m,
|
|
5171
|
-
onSlotCreate: (m,
|
|
5172
|
-
})) : i === "week" ?
|
|
5372
|
+
onSlotClick: (m, b, y, w, A) => this._handleSlotClick(m, b, y, w, A),
|
|
5373
|
+
onEventClick: (m, b, y) => this._handleEventClick(m, b, y),
|
|
5374
|
+
onSlotCreate: (m, b, y, w, A) => this._handleSlotCreate(m, b, y, w, A)
|
|
5375
|
+
})) : i === "week" ? g.appendChild(la({
|
|
5173
5376
|
date: l,
|
|
5174
5377
|
firstDay: this.firstDay,
|
|
5175
5378
|
resources: u,
|
|
5176
|
-
events:
|
|
5379
|
+
events: p,
|
|
5177
5380
|
startTime: this.startTime,
|
|
5178
5381
|
endTime: this.endTime,
|
|
5179
5382
|
interval: this.interval,
|
|
@@ -5187,44 +5390,44 @@ class _a extends Se {
|
|
|
5187
5390
|
draggable: this.draggableEvents,
|
|
5188
5391
|
allDayCollapsed: t.allDayCollapsed,
|
|
5189
5392
|
onToggleAllDay: () => this._store.set({ allDayCollapsed: !t.allDayCollapsed }),
|
|
5190
|
-
onSlotClick: (m,
|
|
5191
|
-
onEventClick: (m,
|
|
5192
|
-
onSlotCreate: (m,
|
|
5193
|
-
})) : i === "month" &&
|
|
5393
|
+
onSlotClick: (m, b, y, w, A) => this._handleSlotClick(m, b, y, w, A),
|
|
5394
|
+
onEventClick: (m, b, y) => this._handleEventClick(m, b, y),
|
|
5395
|
+
onSlotCreate: (m, b, y, w, A) => this._handleSlotCreate(m, b, y, w, A)
|
|
5396
|
+
})) : i === "month" && g.appendChild(oa({
|
|
5194
5397
|
date: l,
|
|
5195
5398
|
firstDay: this.firstDay,
|
|
5196
5399
|
resources: u,
|
|
5197
|
-
events:
|
|
5400
|
+
events: p,
|
|
5198
5401
|
format: this.format,
|
|
5199
5402
|
selectedResourceId: t.selectedResourceId,
|
|
5200
|
-
selectedDate: ((
|
|
5403
|
+
selectedDate: ((f = t.selectedSlot) == null ? void 0 : f.date) || null,
|
|
5201
5404
|
eventContent: this._eventContent,
|
|
5202
5405
|
onSlotClick: (m) => this._handleSlotClick(m, null, null, null, null),
|
|
5203
|
-
onEventClick: (m,
|
|
5406
|
+
onEventClick: (m, b, y) => this._handleEventClick(m, b, y),
|
|
5204
5407
|
onSlotCreate: (m) => this._handleSlotCreate(m, null, null, null, null)
|
|
5205
5408
|
}));
|
|
5206
|
-
s.appendChild(
|
|
5409
|
+
s.appendChild(g), t.detailEvent && g.appendChild(pa({
|
|
5207
5410
|
event: t.detailEvent,
|
|
5208
5411
|
resource: t.detailResource,
|
|
5209
5412
|
format: this.format,
|
|
5210
5413
|
onClose: () => this._closeDetail(),
|
|
5211
5414
|
actions: this._eventActions,
|
|
5212
5415
|
onAction: (m) => this._handleEventAction(m)
|
|
5213
|
-
})), this.showFab && !this.loading &&
|
|
5416
|
+
})), this.showFab && !this.loading && g.appendChild(ba({
|
|
5214
5417
|
onClick: () => this._handleFabClick()
|
|
5215
5418
|
})), e.appendChild(s), this._escHandler || (this._escHandler = (m) => {
|
|
5216
5419
|
m.key === "Escape" && this._store.get("selectedSlot") && this._dismissSlot();
|
|
5217
5420
|
}, this.shadowRoot.addEventListener("keydown", this._escHandler), document.addEventListener("keydown", this._escHandler)), this._rendering = !1;
|
|
5218
5421
|
}
|
|
5219
5422
|
}
|
|
5220
|
-
customElements.get("cal-datepicker") || customElements.define("cal-datepicker",
|
|
5221
|
-
customElements.get("cal-booking") || customElements.define("cal-booking",
|
|
5222
|
-
customElements.get("cal-timepicker") || customElements.define("cal-timepicker",
|
|
5223
|
-
customElements.get("cal-scheduler") || customElements.define("cal-scheduler",
|
|
5423
|
+
customElements.get("cal-datepicker") || customElements.define("cal-datepicker", Pt);
|
|
5424
|
+
customElements.get("cal-booking") || customElements.define("cal-booking", Rt);
|
|
5425
|
+
customElements.get("cal-timepicker") || customElements.define("cal-timepicker", qt);
|
|
5426
|
+
customElements.get("cal-scheduler") || customElements.define("cal-scheduler", wa);
|
|
5224
5427
|
export {
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5428
|
+
Rt as CalBooking,
|
|
5429
|
+
Pt as CalDatepicker,
|
|
5430
|
+
wa as CalScheduler,
|
|
5431
|
+
qt as CalTimepicker
|
|
5229
5432
|
};
|
|
5230
5433
|
//# sourceMappingURL=calkit.es.js.map
|