@featherk/composables 0.6.7 → 0.6.8
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.
|
@@ -4,15 +4,15 @@ const _e = (e, t) => {
|
|
|
4
4
|
const u = _(null);
|
|
5
5
|
let q = !1, I = null, L = null;
|
|
6
6
|
const V = [], A = ".k-table-row[data-grid-row-index] [tabindex]", k = () => e?.value?.columns, S = (o) => {
|
|
7
|
-
const
|
|
8
|
-
[" ", "Spacebar", "Space", "Enter"].includes(
|
|
7
|
+
const m = o.key || o.code;
|
|
8
|
+
[" ", "Spacebar", "Space", "Enter"].includes(m) && (o.preventDefault(), o.stopPropagation(), u.value = o.target, o.target.click());
|
|
9
9
|
}, g = (o) => {
|
|
10
10
|
if (!u.value) return;
|
|
11
11
|
if (o.code === "Escape") {
|
|
12
12
|
o.stopPropagation(), u.value && u.value.focus();
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const m = Array.from(
|
|
16
16
|
document.querySelectorAll(
|
|
17
17
|
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
18
18
|
)
|
|
@@ -22,9 +22,13 @@ const _e = (e, t) => {
|
|
|
22
22
|
if (l) {
|
|
23
23
|
if (o.code === "Tab") {
|
|
24
24
|
const s = [
|
|
25
|
-
".k-filter-menu-container .k-dropdownlist[tabindex='0']",
|
|
26
|
-
".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
27
|
-
".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
|
|
25
|
+
// ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
|
|
26
|
+
// ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
27
|
+
// ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
|
|
28
|
+
// ".k-checkbox",
|
|
29
|
+
".k-dropdownlist[tabindex='0']",
|
|
30
|
+
"input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
31
|
+
"button:not([tabindex='-1']):not([disabled])",
|
|
28
32
|
".k-checkbox"
|
|
29
33
|
], v = t?.focusableMenuSelectors ?? s, b = Array.from(
|
|
30
34
|
l.querySelectorAll(v.join(","))
|
|
@@ -38,11 +42,11 @@ const _e = (e, t) => {
|
|
|
38
42
|
}
|
|
39
43
|
} else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
|
|
40
44
|
o.preventDefault(), o.stopPropagation();
|
|
41
|
-
const s =
|
|
45
|
+
const s = m.findIndex(
|
|
42
46
|
(b) => b === document.activeElement
|
|
43
47
|
);
|
|
44
48
|
let v = s;
|
|
45
|
-
o.code === "ArrowUp" ? v = s > 0 ? s - 1 :
|
|
49
|
+
o.code === "ArrowUp" ? v = s > 0 ? s - 1 : m.length - 1 : o.code === "ArrowDown" && (v = s < m.length - 1 ? s + 1 : 0), m[v]?.focus();
|
|
46
50
|
return;
|
|
47
51
|
}
|
|
48
52
|
if (o.code === "Tab") {
|
|
@@ -54,8 +58,8 @@ const _e = (e, t) => {
|
|
|
54
58
|
}
|
|
55
59
|
}, P = () => {
|
|
56
60
|
I = new MutationObserver((o) => {
|
|
57
|
-
o.forEach((
|
|
58
|
-
|
|
61
|
+
o.forEach((m) => {
|
|
62
|
+
m.addedNodes.forEach((l) => {
|
|
59
63
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
60
64
|
const s = l;
|
|
61
65
|
if (s.classList.contains("k-animation-container")) {
|
|
@@ -96,7 +100,7 @@ const _e = (e, t) => {
|
|
|
96
100
|
);
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
|
-
}),
|
|
103
|
+
}), m.removedNodes.forEach((l) => {
|
|
100
104
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
101
105
|
const s = l;
|
|
102
106
|
s.classList.contains("k-animation-container") && s.removeEventListener(
|
|
@@ -120,8 +124,8 @@ const _e = (e, t) => {
|
|
|
120
124
|
}, E = (o) => {
|
|
121
125
|
if (!o.type || !o)
|
|
122
126
|
return;
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
127
|
+
const m = o.target;
|
|
128
|
+
if (m) {
|
|
125
129
|
if (o.code === "Escape") {
|
|
126
130
|
const l = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
|
|
127
131
|
if (l) {
|
|
@@ -146,11 +150,11 @@ const _e = (e, t) => {
|
|
|
146
150
|
"Enter",
|
|
147
151
|
"Space"
|
|
148
152
|
].includes(o.code)) {
|
|
149
|
-
if (o.preventDefault(),
|
|
150
|
-
u.value =
|
|
153
|
+
if (o.preventDefault(), m.classList.contains("k-grid-header-menu") && m.classList.contains("k-grid-column-menu")) {
|
|
154
|
+
u.value = m;
|
|
151
155
|
return;
|
|
152
156
|
}
|
|
153
|
-
const l =
|
|
157
|
+
const l = m.closest(
|
|
154
158
|
".k-table-row[data-grid-row-index]"
|
|
155
159
|
);
|
|
156
160
|
if (l) {
|
|
@@ -219,12 +223,12 @@ const _e = (e, t) => {
|
|
|
219
223
|
} catch (s) {
|
|
220
224
|
console.error("ensureSingleTabindex error:", s);
|
|
221
225
|
}
|
|
222
|
-
},
|
|
226
|
+
}, m = Array.from(
|
|
223
227
|
e.value.$el.querySelectorAll(
|
|
224
228
|
".k-table-row[data-grid-row-index]"
|
|
225
229
|
)
|
|
226
230
|
);
|
|
227
|
-
|
|
231
|
+
m.length > 0 && m.forEach((s, v) => {
|
|
228
232
|
s.setAttribute("tabindex", v === 0 ? "0" : "-1");
|
|
229
233
|
});
|
|
230
234
|
const l = e.value.$el.querySelector(".k-table-tbody");
|
|
@@ -236,8 +240,8 @@ const _e = (e, t) => {
|
|
|
236
240
|
}
|
|
237
241
|
}, U = () => {
|
|
238
242
|
j(() => {
|
|
239
|
-
const
|
|
240
|
-
|
|
243
|
+
const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
244
|
+
m && m.forEach((l) => {
|
|
241
245
|
l.setAttribute("role", "button"), l.addEventListener(
|
|
242
246
|
"keydown",
|
|
243
247
|
S
|
|
@@ -245,8 +249,8 @@ const _e = (e, t) => {
|
|
|
245
249
|
}), P(), y();
|
|
246
250
|
});
|
|
247
251
|
}, f = () => {
|
|
248
|
-
const
|
|
249
|
-
|
|
252
|
+
const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
253
|
+
m && m.forEach((l) => {
|
|
250
254
|
l.removeEventListener(
|
|
251
255
|
"keydown",
|
|
252
256
|
S
|
|
@@ -308,26 +312,26 @@ const _e = (e, t) => {
|
|
|
308
312
|
l.removeEventListener("keydown", oe, !0);
|
|
309
313
|
});
|
|
310
314
|
});
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
315
|
+
const m = document.querySelector(".k-grid-header .k-table-thead");
|
|
316
|
+
if (m) {
|
|
313
317
|
const l = (s) => {
|
|
314
318
|
const v = s.target.closest("th");
|
|
315
319
|
v && (s.code === "Enter" || s.code === "Space") && v.dataset.featherKFilterable === "false" && v.dataset.featherKSortable === "false" && (s.preventDefault(), s.stopImmediatePropagation());
|
|
316
320
|
};
|
|
317
|
-
|
|
321
|
+
m.addEventListener(
|
|
318
322
|
"keydown",
|
|
319
323
|
l,
|
|
320
324
|
!0
|
|
321
325
|
// NOTE: capture phase
|
|
322
326
|
), V.push(() => {
|
|
323
|
-
|
|
327
|
+
m.removeEventListener(
|
|
324
328
|
"keydown",
|
|
325
329
|
l,
|
|
326
330
|
!0
|
|
327
331
|
);
|
|
328
332
|
});
|
|
329
333
|
}
|
|
330
|
-
}, O = function(o,
|
|
334
|
+
}, O = function(o, m) {
|
|
331
335
|
const l = o?.event.event.target, s = k();
|
|
332
336
|
if (!l || !s) return;
|
|
333
337
|
const v = l.classList.contains("k-link"), b = l.classList.contains("k-columnmenu-item"), D = s.find(($) => $.field === o.event.field)?.sortable && !0;
|
|
@@ -338,8 +342,8 @@ const _e = (e, t) => {
|
|
|
338
342
|
);
|
|
339
343
|
return;
|
|
340
344
|
}
|
|
341
|
-
typeof
|
|
342
|
-
u.value && u.value.focus(),
|
|
345
|
+
typeof m == "function" && j(() => {
|
|
346
|
+
u.value && u.value.focus(), m(o);
|
|
343
347
|
});
|
|
344
348
|
}
|
|
345
349
|
}, G = () => {
|
|
@@ -379,9 +383,9 @@ function ze(e) {
|
|
|
379
383
|
return;
|
|
380
384
|
}
|
|
381
385
|
if ((t.value ?? "").length === 10 && S.value.length === 8) {
|
|
382
|
-
const [d, M, r] = t.value.split("/"), i = parseInt(d),
|
|
383
|
-
if (G(w, i,
|
|
384
|
-
const B = new Date(w, i - 1,
|
|
386
|
+
const [d, M, r] = t.value.split("/"), i = parseInt(d), p = parseInt(M), w = parseInt(r);
|
|
387
|
+
if (G(w, i, p)) {
|
|
388
|
+
const B = new Date(w, i - 1, p);
|
|
385
389
|
U(B) ? e.onChange({ value: B, event: a }) : e.onChange({ value: null, event: a });
|
|
386
390
|
} else
|
|
387
391
|
e.onChange({ value: null, event: a });
|
|
@@ -391,28 +395,28 @@ function ze(e) {
|
|
|
391
395
|
return !(d && a < d || M && a > M);
|
|
392
396
|
}, f = h(() => {
|
|
393
397
|
if ((t.value ?? "").length === 10 && S.value.length === 8) {
|
|
394
|
-
const [a, d, M] = (t.value ?? "").split("/"), r = parseInt(a), i = parseInt(d),
|
|
395
|
-
if (G(
|
|
396
|
-
return new Date(
|
|
398
|
+
const [a, d, M] = (t.value ?? "").split("/"), r = parseInt(a), i = parseInt(d), p = parseInt(M);
|
|
399
|
+
if (G(p, r, i))
|
|
400
|
+
return new Date(p, r - 1, i);
|
|
397
401
|
}
|
|
398
402
|
return null;
|
|
399
403
|
}), y = h(() => (t.value ?? "").length === 10 && S.value.length === 8), O = (a, d) => new Date(a, d, 0).getDate(), G = (a, d, M) => d >= 1 && d <= 12 && a >= 1900 && M >= 1 && M <= O(a, d), o = (a) => {
|
|
400
404
|
t.value = a.value;
|
|
401
405
|
const d = a.event?.target;
|
|
402
406
|
u.value = d?.selectionStart ?? 0, T(a);
|
|
403
|
-
},
|
|
407
|
+
}, m = (a) => {
|
|
404
408
|
u.value = a.target.selectionStart ?? 0;
|
|
405
409
|
}, l = (a, d, M) => {
|
|
406
410
|
const r = d?.selectionStart ?? u.value ?? 0;
|
|
407
411
|
u.value = r;
|
|
408
|
-
let i = parseInt(P.value),
|
|
409
|
-
if (!(S.value.length >= 8) || !G(w, i,
|
|
412
|
+
let i = parseInt(P.value), p = parseInt(E.value), w = parseInt(C.value);
|
|
413
|
+
if (!(S.value.length >= 8) || !G(w, i, p)) {
|
|
410
414
|
const K = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
411
|
-
i = K.getMonth() + 1,
|
|
415
|
+
i = K.getMonth() + 1, p = K.getDate(), w = K.getFullYear(), t.value = `${String(i).padStart(2, "0")}/${String(p).padStart(
|
|
412
416
|
2,
|
|
413
417
|
"0"
|
|
414
418
|
)}/${String(w)}`;
|
|
415
|
-
const X = new Date(w, i - 1,
|
|
419
|
+
const X = new Date(w, i - 1, p);
|
|
416
420
|
e.onChange({ value: U(X) ? X : null, event: M }), $({ useRAF: !0 });
|
|
417
421
|
return;
|
|
418
422
|
}
|
|
@@ -421,9 +425,9 @@ function ze(e) {
|
|
|
421
425
|
i = a === "ArrowUp" ? i < 12 ? i + 1 : 1 : i > 1 ? i - 1 : 12;
|
|
422
426
|
else if (Q === "dd") {
|
|
423
427
|
const K = new Date(w, i, 0).getDate();
|
|
424
|
-
|
|
428
|
+
p = a === "ArrowUp" ? p < K ? p + 1 : 1 : p > 1 ? p - 1 : K;
|
|
425
429
|
} else Q === "yyyy" && (w = a === "ArrowUp" ? w + 1 : Math.max(1, w - 1));
|
|
426
|
-
t.value = `${String(i).padStart(2, "0")}/${String(
|
|
430
|
+
t.value = `${String(i).padStart(2, "0")}/${String(p).padStart(
|
|
427
431
|
2,
|
|
428
432
|
"0"
|
|
429
433
|
)}/${String(w)}`;
|
|
@@ -609,7 +613,7 @@ function ze(e) {
|
|
|
609
613
|
handleKeyDown: s,
|
|
610
614
|
handleWheel: v,
|
|
611
615
|
handleKeyUp: b,
|
|
612
|
-
handleClick:
|
|
616
|
+
handleClick: m,
|
|
613
617
|
handleBlur: D,
|
|
614
618
|
// Expose so consumers can re-run styling when needed
|
|
615
619
|
initStyling: ne
|
|
@@ -625,12 +629,12 @@ function Xe(e) {
|
|
|
625
629
|
}, U = (n, c) => e.allowReverse ?? !1 ? !0 : n <= c, f = h(() => (t.value?.length ?? 0) >= 23 && g.value.length >= 16), y = (n) => {
|
|
626
630
|
if ((n ?? "").length < 23 || g.value.length < 16)
|
|
627
631
|
return { start: null, end: null };
|
|
628
|
-
const c = n.substring(0, 10), x = n.substring(13, 23), [R, ee, ae] = c.split("/").map((se) => parseInt(se || "0", 10)), [ge, de, fe] = x.split("/").map((se) => parseInt(se || "0", 10)),
|
|
629
|
-
return { start: we ?
|
|
632
|
+
const c = n.substring(0, 10), x = n.substring(13, 23), [R, ee, ae] = c.split("/").map((se) => parseInt(se || "0", 10)), [ge, de, fe] = x.split("/").map((se) => parseInt(se || "0", 10)), pe = new Date(ae, R - 1, ee), he = new Date(fe, ge - 1, de), we = E(ae, R, ee) && pe.toString() !== "Invalid Date", ke = E(fe, ge, de) && he.toString() !== "Invalid Date";
|
|
633
|
+
return { start: we ? pe : null, end: ke ? he : null };
|
|
630
634
|
}, O = e.externalValid ?? _(!0), G = h(() => y(t.value)), o = h(() => {
|
|
631
635
|
const n = T(G.value.start), c = T(G.value.end);
|
|
632
636
|
return { start: n, end: c };
|
|
633
|
-
}),
|
|
637
|
+
}), m = h(() => {
|
|
634
638
|
if (!f.value) return;
|
|
635
639
|
const n = o.value.start, c = o.value.end;
|
|
636
640
|
if (!n || !c) return;
|
|
@@ -641,14 +645,14 @@ function Xe(e) {
|
|
|
641
645
|
const { start: n, end: c } = G.value;
|
|
642
646
|
if (!n || !c || !o.value.start || !o.value.end) return !1;
|
|
643
647
|
const x = o.value.start, R = o.value.end;
|
|
644
|
-
return !(!U(x, R) || typeof e.maxSpanDays == "number" &&
|
|
648
|
+
return !(!U(x, R) || typeof e.maxSpanDays == "number" && m.value !== void 0 && m.value > e.maxSpanDays);
|
|
645
649
|
}), s = h(() => {
|
|
646
650
|
const { start: n, end: c } = G.value;
|
|
647
651
|
if (!f.value) return "incomplete";
|
|
648
652
|
if (!n || !c) return "invalid-date";
|
|
649
653
|
if (!o.value.start || !o.value.end) return "out-of-bounds";
|
|
650
654
|
const x = o.value.start, R = o.value.end;
|
|
651
|
-
return U(x, R) ? typeof e.maxSpanDays == "number" &&
|
|
655
|
+
return U(x, R) ? typeof e.maxSpanDays == "number" && m.value !== void 0 && m.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
|
|
652
656
|
}), v = _(void 0), b = h(() => {
|
|
653
657
|
if (O.value !== !1) return "";
|
|
654
658
|
const { min: n, max: c } = e, x = v.value;
|
|
@@ -688,7 +692,7 @@ function Xe(e) {
|
|
|
688
692
|
return;
|
|
689
693
|
}
|
|
690
694
|
const ge = /* @__PURE__ */ new Date(), de = oe(R);
|
|
691
|
-
let fe = ee ? new Date(ee) : new Date(ge),
|
|
695
|
+
let fe = ee ? new Date(ee) : new Date(ge), pe = ae ? new Date(ae) : new Date(ge);
|
|
692
696
|
const he = (Y, ue) => {
|
|
693
697
|
if (ue === "mm") {
|
|
694
698
|
const Z = Y.getMonth() + 1, te = n === "ArrowUp" ? Z < 12 ? Z + 1 : 1 : Z > 1 ? Z - 1 : 12;
|
|
@@ -705,10 +709,10 @@ function Xe(e) {
|
|
|
705
709
|
Y.getDate() > te && Y.setDate(te);
|
|
706
710
|
}
|
|
707
711
|
};
|
|
708
|
-
de.side === "start" ? he(fe, de.part) : he(
|
|
709
|
-
const we = J(fe), ke = J(
|
|
712
|
+
de.side === "start" ? he(fe, de.part) : he(pe, de.part);
|
|
713
|
+
const we = J(fe), ke = J(pe);
|
|
710
714
|
t.value = `${we} - ${ke}`;
|
|
711
|
-
const se = T(fe), De = T(
|
|
715
|
+
const se = T(fe), De = T(pe);
|
|
712
716
|
se && De && U(se, De) ? e.onChange({ value: { start: se, end: De }, event: x }) : e.onChange({ value: null, event: x }), j(() => {
|
|
713
717
|
requestAnimationFrame(() => {
|
|
714
718
|
const Y = document.getElementById(
|
|
@@ -768,12 +772,12 @@ function Xe(e) {
|
|
|
768
772
|
const c = n.target;
|
|
769
773
|
u.value = c?.selectionStart ?? 0;
|
|
770
774
|
}
|
|
771
|
-
},
|
|
775
|
+
}, p = () => {
|
|
772
776
|
v.value = s.value, (e.manageValid ?? !0) && (O.value = l.value);
|
|
773
777
|
}, w = (n) => {
|
|
774
|
-
|
|
778
|
+
p();
|
|
775
779
|
}, B = (n) => {
|
|
776
|
-
console.log("Clear event:", n), t.value = "", u.value = 0, e.onChange({ value: null, event: n }),
|
|
780
|
+
console.log("Clear event:", n), t.value = "", u.value = 0, e.onChange({ value: null, event: n }), p(), j(() => {
|
|
777
781
|
const c = document.getElementById(
|
|
778
782
|
e.id
|
|
779
783
|
);
|
|
@@ -788,7 +792,7 @@ function Xe(e) {
|
|
|
788
792
|
if (t.value = `${J(c)} - ${J(x)}`, e.isOpen?.value && I.value && e.onRequestClose) {
|
|
789
793
|
const R = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
|
|
790
794
|
setTimeout(() => {
|
|
791
|
-
e.onRequestClose?.(), I.value = !1,
|
|
795
|
+
e.onRequestClose?.(), I.value = !1, p();
|
|
792
796
|
}, R);
|
|
793
797
|
}
|
|
794
798
|
return;
|
|
@@ -845,7 +849,7 @@ function Xe(e) {
|
|
|
845
849
|
label: "Valid (managed)",
|
|
846
850
|
value: `${O.value ?? "-"}`
|
|
847
851
|
},
|
|
848
|
-
{ label: "Span (days)", value: `${
|
|
852
|
+
{ label: "Span (days)", value: `${m.value ?? "-"}` },
|
|
849
853
|
{
|
|
850
854
|
label: "Reason",
|
|
851
855
|
value: `${s.value ?? "-"}`
|
|
@@ -915,7 +919,7 @@ function Xe(e) {
|
|
|
915
919
|
validComputed: N(l),
|
|
916
920
|
reason: N(s),
|
|
917
921
|
validationMessage: N(b),
|
|
918
|
-
spanDays: N(
|
|
922
|
+
spanDays: N(m),
|
|
919
923
|
month1: N(Q),
|
|
920
924
|
day1: N(z),
|
|
921
925
|
year1: N(W),
|
|
@@ -954,18 +958,18 @@ function Je(e) {
|
|
|
954
958
|
return r === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? r + 12 : r;
|
|
955
959
|
}), f = h(() => y.value ? `${String(U.value).padStart(2, "0")}:${String(C.value).padStart(2, "0")}:00` : null), y = h(
|
|
956
960
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
957
|
-
), O = (r, i,
|
|
961
|
+
), O = (r, i, p) => {
|
|
958
962
|
let w = r % 12;
|
|
959
963
|
return w === 0 && (w = 12), `${String(w).padStart(2, "0")}:${String(i).padStart(
|
|
960
964
|
2,
|
|
961
965
|
"0"
|
|
962
|
-
)} ${
|
|
966
|
+
)} ${p}`;
|
|
963
967
|
}, G = (r) => {
|
|
964
968
|
const i = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
965
969
|
if (!i) return null;
|
|
966
|
-
const
|
|
967
|
-
if (
|
|
968
|
-
let Q =
|
|
970
|
+
const p = parseInt(i[1]), w = parseInt(i[2]), B = i[3].toUpperCase();
|
|
971
|
+
if (p < 1 || p > 12 || w < 0 || w > 59) return null;
|
|
972
|
+
let Q = p % 12;
|
|
969
973
|
B === "PM" && (Q += 12);
|
|
970
974
|
const z = /* @__PURE__ */ new Date();
|
|
971
975
|
return z.setSeconds(0, 0), z.setHours(Q), z.setMinutes(w), z;
|
|
@@ -980,14 +984,14 @@ function Je(e) {
|
|
|
980
984
|
}
|
|
981
985
|
const i = G(t.value);
|
|
982
986
|
i && l(i) ? e.onChange({ value: i, event: r }) : e.onChange({ value: null, event: r });
|
|
983
|
-
},
|
|
984
|
-
const i = e.min ?? void 0,
|
|
987
|
+
}, m = (r) => r.getHours() * 60 + r.getMinutes(), l = (r) => {
|
|
988
|
+
const i = e.min ?? void 0, p = e.max ?? void 0, w = m(r);
|
|
985
989
|
if (i) {
|
|
986
|
-
const B =
|
|
990
|
+
const B = m(i);
|
|
987
991
|
if (w < B) return !1;
|
|
988
992
|
}
|
|
989
|
-
if (
|
|
990
|
-
const B = p
|
|
993
|
+
if (p) {
|
|
994
|
+
const B = m(p);
|
|
991
995
|
if (w > B) return !1;
|
|
992
996
|
}
|
|
993
997
|
return !0;
|
|
@@ -996,8 +1000,8 @@ function Je(e) {
|
|
|
996
1000
|
const i = r.event?.target;
|
|
997
1001
|
u.value = i?.selectionStart ?? 0;
|
|
998
1002
|
try {
|
|
999
|
-
const
|
|
1000
|
-
if (P(
|
|
1003
|
+
const p = u.value ?? 0;
|
|
1004
|
+
if (P(p) === "ampm" && (t.value ?? "").length >= 8) {
|
|
1001
1005
|
const w = t.value.charAt(6);
|
|
1002
1006
|
/[Aa]/.test(w) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, j(() => {
|
|
1003
1007
|
requestAnimationFrame(() => {
|
|
@@ -1020,7 +1024,7 @@ function Je(e) {
|
|
|
1020
1024
|
o(r);
|
|
1021
1025
|
}, v = (r) => {
|
|
1022
1026
|
u.value = r.target.selectionStart ?? 0;
|
|
1023
|
-
}, b = (r, i,
|
|
1027
|
+
}, b = (r, i, p) => {
|
|
1024
1028
|
const w = i?.selectionStart ?? u.value ?? 0;
|
|
1025
1029
|
u.value = w;
|
|
1026
1030
|
const B = P(w), Q = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
@@ -1029,7 +1033,7 @@ function Je(e) {
|
|
|
1029
1033
|
const K = /* @__PURE__ */ new Date(), X = K.getHours(), re = X >= 12 ? "PM" : "AM";
|
|
1030
1034
|
t.value = O(X, K.getMinutes(), re);
|
|
1031
1035
|
const ye = G(t.value);
|
|
1032
|
-
ye && l(ye) ? e.onChange({ value: ye, event:
|
|
1036
|
+
ye && l(ye) ? e.onChange({ value: ye, event: p }) : e.onChange({ value: null, event: p }), j(() => {
|
|
1033
1037
|
requestAnimationFrame(() => {
|
|
1034
1038
|
const n = document.getElementById(
|
|
1035
1039
|
e.id
|
|
@@ -1062,7 +1066,7 @@ function Je(e) {
|
|
|
1062
1066
|
"0"
|
|
1063
1067
|
)} ${ie}`;
|
|
1064
1068
|
const le = G(t.value);
|
|
1065
|
-
le && l(le) ? e.onChange({ value: le, event:
|
|
1069
|
+
le && l(le) ? e.onChange({ value: le, event: p }) : e.onChange({ value: null, event: p }), j(() => {
|
|
1066
1070
|
requestAnimationFrame(() => {
|
|
1067
1071
|
const K = document.getElementById(
|
|
1068
1072
|
e.id
|
|
@@ -1102,8 +1106,8 @@ function Je(e) {
|
|
|
1102
1106
|
if (r) {
|
|
1103
1107
|
const i = new Date(r);
|
|
1104
1108
|
if (i.toString() !== "Invalid Date") {
|
|
1105
|
-
const
|
|
1106
|
-
t.value = O(
|
|
1109
|
+
const p = i.getHours(), w = p >= 12 ? "PM" : "AM";
|
|
1110
|
+
t.value = O(p, i.getMinutes(), w);
|
|
1107
1111
|
return;
|
|
1108
1112
|
}
|
|
1109
1113
|
}
|
|
@@ -1174,10 +1178,10 @@ function Je(e) {
|
|
|
1174
1178
|
const i = {
|
|
1175
1179
|
hour: "2-digit",
|
|
1176
1180
|
minute: "2-digit"
|
|
1177
|
-
},
|
|
1181
|
+
}, p = e.min ? e.min.toLocaleTimeString("en-US", i) : null, w = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
|
|
1178
1182
|
if (r === "out-of-bounds") {
|
|
1179
|
-
if (
|
|
1180
|
-
if (
|
|
1183
|
+
if (p && w) return `Must be between ${p} and ${w}.`;
|
|
1184
|
+
if (p) return `Must be ${p} or later.`;
|
|
1181
1185
|
if (w) return `Must be ${w} or earlier.`;
|
|
1182
1186
|
}
|
|
1183
1187
|
return "";
|
|
@@ -1195,14 +1199,14 @@ function Je(e) {
|
|
|
1195
1199
|
);
|
|
1196
1200
|
return;
|
|
1197
1201
|
}
|
|
1198
|
-
const
|
|
1199
|
-
if (!
|
|
1202
|
+
const p = i.parentElement;
|
|
1203
|
+
if (!p) {
|
|
1200
1204
|
console.warn(
|
|
1201
1205
|
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
1202
1206
|
);
|
|
1203
1207
|
return;
|
|
1204
1208
|
}
|
|
1205
|
-
|
|
1209
|
+
p.classList.contains("fk-timepicker") || p.classList.add("fk-timepicker");
|
|
1206
1210
|
});
|
|
1207
1211
|
};
|
|
1208
1212
|
return xe(() => {
|
|
@@ -1240,7 +1244,7 @@ function Ue(e) {
|
|
|
1240
1244
|
}
|
|
1241
1245
|
const Ce = typeof window < "u" && typeof document < "u";
|
|
1242
1246
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
1243
|
-
const Oe = Object.prototype.toString, Be = (e) => Oe.call(e) === "[object Object]",
|
|
1247
|
+
const Oe = Object.prototype.toString, Be = (e) => Oe.call(e) === "[object Object]", me = () => {
|
|
1244
1248
|
}, Ke = /* @__PURE__ */ Ve();
|
|
1245
1249
|
function Ve() {
|
|
1246
1250
|
var e, t;
|
|
@@ -1304,11 +1308,11 @@ let Me = !1;
|
|
|
1304
1308
|
function Ne(e, t, u = {}) {
|
|
1305
1309
|
const { window: q = $e, ignore: I = [], capture: L = !0, detectIframe: V = !1, controls: A = !1 } = u;
|
|
1306
1310
|
if (!q)
|
|
1307
|
-
return A ? { stop:
|
|
1311
|
+
return A ? { stop: me, cancel: me, trigger: me } : me;
|
|
1308
1312
|
if (Ke && !Me) {
|
|
1309
1313
|
Me = !0;
|
|
1310
1314
|
const f = { passive: !0 };
|
|
1311
|
-
Array.from(q.document.body.children).forEach((y) => y.addEventListener("click",
|
|
1315
|
+
Array.from(q.document.body.children).forEach((y) => y.addEventListener("click", me, f)), q.document.documentElement.addEventListener("click", me, f);
|
|
1312
1316
|
}
|
|
1313
1317
|
let k = !0;
|
|
1314
1318
|
const S = (f) => ce(I).some((y) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(J,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(J=typeof globalThis<"u"?globalThis:J||self,t(J.FeatherKComposables={},J.Vue,J.useFocusTrap))})(this,(function(J,t,xe){"use strict";const Me=(e,n)=>{const u=t.ref(null);let q=!1,$=null,F=null;const K=[],A=".k-table-row[data-grid-row-index] [tabindex]",w=()=>e?.value?.columns,S=l=>{const y=l.key||l.code;[" ","Spacebar","Space","Enter"].includes(y)&&(l.preventDefault(),l.stopPropagation(),u.value=l.target,l.target.click())},v=l=>{if(!u.value)return;if(l.code==="Escape"){l.stopPropagation(),u.value&&u.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),i=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(i){if(l.code==="Tab"){const c=[".k-filter-menu-container .k-dropdownlist[tabindex='0']",".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",".k-checkbox"],g=n?.focusableMenuSelectors??c,b=Array.from(i.querySelectorAll(g.join(",")));if(b.length===0)return;const D=b.findIndex(N=>N===document.activeElement);let C;D===-1?C=0:l.shiftKey?C=(D-1+b.length)%b.length:C=(D+1)%b.length,l.preventDefault(),l.stopPropagation(),b[C]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const c=y.findIndex(b=>b===document.activeElement);let g=c;l.code==="ArrowUp"?g=c>0?c-1:y.length-1:l.code==="ArrowDown"&&(g=c<y.length-1?c+1:0),y[g]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const c=u.value?.parentElement;(l.shiftKey?c?.previousElementSibling:c?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},L=()=>{$=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;if(c.classList.contains("k-animation-container")){const b=u.value;b&&(b.dataset.featherKSortable==="true"||t.nextTick(()=>{c.querySelectorAll(".k-columnmenu-item-wrapper").forEach(N=>{N.textContent?.toLowerCase().includes("sort")&&N.remove()})})),c.addEventListener("keydown",v),t.nextTick(()=>{const D=()=>{const C=Array.from(c.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(C.length===1)C[0].focus(),C[0].click(),D.attempts=0;else if(C.length>1){D.attempts=0;return}else D.attempts===void 0&&(D.attempts=0),D.attempts++<3&&setTimeout(D,200)};D()})}c.querySelectorAll(".k-animation-container").forEach(b=>{b.addEventListener("keydown",v)})}}),y.removedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;c.classList.contains("k-animation-container")&&c.removeEventListener("keydown",v),c.querySelectorAll(".k-animation-container").forEach(b=>{b.removeEventListener("keydown",v)})}})})}),$.observe(document.body,{childList:!0,subtree:!0})},E=l=>{if(!l.type||!l)return;const y=l.target;if(y){if(l.code==="Escape"){const i=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(i){l.preventDefault(),l.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(g=>g.setAttribute("tabindex","-1"))}catch{}i.setAttribute("tabindex","0"),i.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","Space"].includes(l.code)){if(l.preventDefault(),y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){u.value=y;return}const i=y.closest(".k-table-row[data-grid-row-index]");if(i){if(["ArrowDown","ArrowUp"].includes(l.code)){const c=(b,D)=>{let C=D==="next"?b.nextElementSibling:b.previousElementSibling;for(;C;){const N=C;try{if(N.hasAttribute&&N.classList.contains("k-table-row"))return N}catch{}C=D==="next"?C.nextElementSibling:C.previousElementSibling}return null},g=l.code==="ArrowDown"?c(i,"next"):c(i,"previous");g&&(i.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault();const c=i.querySelectorAll(A);if(c.length===0)return;let g=Array.from(c).findIndex(b=>b===document.activeElement);if(g===-1&&document.activeElement===i){c[0].focus();return}l.code==="ArrowRight"?g=g===c.length-1?0:g+1:l.code==="ArrowLeft"&&(g=g===c.length-1?g-1:c.length-1),c[g].focus();return}}}}},T=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},I=()=>{if(!F)try{const l=()=>{try{const c=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!c||c.length===0||c.filter(D=>D.getAttribute("tabindex")==="0").length===1)return;const b=c.find(D=>D===document.activeElement||D.contains(document.activeElement));if(c.forEach(D=>D.setAttribute("tabindex","-1")),b){b.setAttribute("tabindex","0");return}c[0].setAttribute("tabindex","0")}catch(c){console.error("ensureSingleTabindex error:",c)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((c,g)=>{c.setAttribute("tabindex",g===0?"0":"-1")});const i=e.value.$el.querySelector(".k-table-tbody");i&&(F=new MutationObserver(()=>{l()}),F.observe(i,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},O=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.setAttribute("role","button"),i.addEventListener("keydown",S)}),L(),h()})},p=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.removeEventListener("keydown",S)}),$&&($.disconnect(),$=null),F&&(F.disconnect(),F=null),K.forEach(i=>i()),K.length=0},h=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((i,c)=>{const g=i.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!g)return;const b=w();if(b&&b[c]){const P=b[c].field??"";i.setAttribute("data-feather-k-field",P),i.setAttribute("data-feather-k-filterable",b[c].filterable===!1?"false":"true"),i.setAttribute("data-feather-k-sortable",b[c].sortable===!1?"false":"true")}const D=i.dataset.featherKFilterable!=="false",C=i.dataset.featherKSortable!=="false";g.setAttribute("tabindex","-1"),D||C?i.style.cursor="pointer":i.style.cursor="default",D?(i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-haspopup","menu")):(i.setAttribute("tabindex","0"),i.setAttribute("role","columnheader"),i.removeAttribute("aria-haspopup"));const N=P=>{P.target?.closest(".k-column-resizer")||(u.value=i,g.click())},_=P=>{if(D)u.value=i,P.preventDefault(),P.stopPropagation(),N(P);else if(C){u.value=i;const ee=new KeyboardEvent("keydown",{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0});i.dispatchEvent(ee)}};i.addEventListener("click",_),K.push(()=>{i.removeEventListener("click",_)});const re=P=>{if((P.code==="Enter"||P.code==="Space")&&(D||C)){if(u.value=i,u.value.focus(),D)P.preventDefault(),P.stopPropagation(),N(P);else if(C){const ee=i.querySelector(".k-link");ee&&ee.click()}}};i.addEventListener("keydown",re,!0),K.push(()=>{i.removeEventListener("keydown",re,!0)})});const y=document.querySelector(".k-grid-header .k-table-thead");if(y){const i=c=>{const g=c.target.closest("th");g&&(c.code==="Enter"||c.code==="Space")&&g.dataset.featherKFilterable==="false"&&g.dataset.featherKSortable==="false"&&(c.preventDefault(),c.stopImmediatePropagation())};y.addEventListener("keydown",i,!0),K.push(()=>{y.removeEventListener("keydown",i,!0)})}},U=function(l,y){const i=l?.event.event.target,c=w();if(!i||!c)return;const g=i.classList.contains("k-link"),b=i.classList.contains("k-columnmenu-item"),D=c.find(C=>C.field===l.event.field)?.sortable&&!0;if(!g){if(b&&!D){(l.event.sort&&void 0)?.filter(N=>N.field!==l.event.field);return}typeof y=="function"&&t.nextTick(()=>{u.value&&u.value.focus(),y(l)})}},j=()=>{if(!q)try{T(),I(),O(),q=!0}catch(l){console.error("initA11y failed:",l),p()}};return t.onBeforeUnmount(()=>{p()}),{activeFilterButton:u,handleGridKeyDown:E,handleSortChange:U,initA11y:j}};function Te(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.dateFormat??"mm/dd/yyyy"),F=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],w=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v=a=>a<=2?"mm":a<=5?"dd":S.value.length<=10?"yyyy":"mm",L=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),E=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),T=t.computed(()=>{const a=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(4,"0")}),I=a=>{if(S.value.length===0){e.onChange({value:null,event:a});return}if(S.value.length<8){e.onChange({value:null,event:a});return}if((n.value??"").length===10&&S.value.length===8){const[f,M,o]=n.value.split("/"),s=parseInt(f),m=parseInt(M),k=parseInt(o);if(j(k,s,m)){const V=new Date(k,s-1,m);O(V)?e.onChange({value:V,event:a}):e.onChange({value:null,event:a})}else e.onChange({value:null,event:a})}},O=a=>{const f=e.min??void 0,M=e.max??void 0;return!(f&&a<f||M&&a>M)},p=t.computed(()=>{if((n.value??"").length===10&&S.value.length===8){const[a,f,M]=(n.value??"").split("/"),o=parseInt(a),s=parseInt(f),m=parseInt(M);if(j(m,o,s))return new Date(m,o-1,s)}return null}),h=t.computed(()=>(n.value??"").length===10&&S.value.length===8),U=(a,f)=>new Date(a,f,0).getDate(),j=(a,f,M)=>f>=1&&f<=12&&a>=1900&&M>=1&&M<=U(a,f),l=a=>{n.value=a.value;const f=a.event?.target;u.value=f?.selectionStart??0,I(a)},y=a=>{u.value=a.target.selectionStart??0},i=(a,f,M)=>{const o=f?.selectionStart??u.value??0;u.value=o;let s=parseInt(L.value),m=parseInt(E.value),k=parseInt(T.value);if(!(S.value.length>=8)||!j(k,s,m)){const B=e.defaultValue??new Date;s=B.getMonth()+1,m=B.getDate(),k=B.getFullYear(),n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(k)}`;const W=new Date(k,s-1,m);e.onChange({value:O(W)?W:null,event:M}),C({useRAF:!0});return}const z=v(o);if(z==="mm")s=a==="ArrowUp"?s<12?s+1:1:s>1?s-1:12;else if(z==="dd"){const B=new Date(k,s,0).getDate();m=a==="ArrowUp"?m<B?m+1:1:m>1?m-1:B}else z==="yyyy"&&(k=a==="ArrowUp"?k+1:Math.max(1,k-1));n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(k)}`;const[G,H,ae]=n.value.split("/"),oe=new Date(parseInt(ae),parseInt(G)-1,parseInt(H));oe.toString()!=="Invalid Date"&&parseInt(ae)>=1e3?e.onChange({value:O(oe)?oe:null,event:M}):e.onChange({value:null,event:M}),C({useRAF:!0})},c=a=>{if(a.code==="Space"||a.key===" "){e.onShowCalendar(a);return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault();const f=a.target;i(a.key,f,a)}},g=a=>{a.preventDefault();const f=a.deltaY<0?"ArrowUp":"ArrowDown";i(f,a.target,a)},b=a=>{const f=a.target;if(w.includes(a.key)){u.value=f?.selectionStart??0;return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault(),u.value=f?.selectionStart??0}},D=a=>{K.value=!0,F.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const f=a.target;f&&(u.value=f.selectionStart??0)},C=a=>{const f=()=>{const M=document.getElementById(e.id);if(!M)return;const o=a?.pos??u.value??M.value.length;try{M.focus(),M.setSelectionRange(o,o)}catch{}};t.nextTick(()=>{if(a?.delay&&a.delay>0){setTimeout(f,a.delay);return}if(a?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const f=new Date(a);if(f.toString()!=="Invalid Date"){const M=(f.getMonth()+1).toString().padStart(2,"0"),o=f.getDate().toString().padStart(2,"0"),s=f.getFullYear().toString();n.value=`${M}/${o}/${s}`,C({delay:50});return}}},{immediate:!0});const N=t.computed(()=>[["Date",`${L.value} / ${E.value} / ${T.value}`],["Digits only",S.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),_=t.computed(()=>{if(!F.value){if(!h.value)return!0;const f=p.value;return f?O(f):!1}if(!K.value)return!0;const a=p.value;return!h.value||!a?!1:O(a)}),re=t.computed(()=>{if(!F.value){if(!h.value)return;const f=p.value;return f?O(f)?"valid":"out-of-bounds":"invalid-date"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const a=p.value;return a?O(a)?"valid":"out-of-bounds":"invalid-date"}),P=t.computed(()=>{const a=re.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-date")return`Must be in ${$.value} format.`;const f=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,M=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(a==="out-of-bounds"){if(f&&M)return`Must be between ${f} and ${M}.`;if(f)return`Must be on or after ${f}.`;if(M)return`Must be on or before ${M}.`}return""}),ee=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=a.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const M=f.parentElement;if(M){if(M.classList.contains("fk-datepicker"))return;M.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{ee()}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:N,placeholder:$,isValid:_,reason:t.readonly(re),validationMessage:P,digitsOnly:S,month:t.readonly(L),day:t.readonly(E),year:t.readonly(T),datePart:v,handleChange:l,handleKeyDown:c,handleWheel:g,handleKeyUp:b,handleClick:y,handleBlur:D,initStyling:ee}}function Ce(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(!1),K=365*(1440*60*1e3),A=new Date,w=new Date(A.getTime()-K),S=new Date(A.getTime()+K);e.min=e.min??w,e.max=e.max??S;const v=t.computed(()=>(n.value??"").replace(/\D/g,"")),L=(r,d)=>new Date(r,d,0).getDate(),E=(r,d,x)=>d>=1&&d<=12&&r>=1e3&&x>=1&&x<=L(r,d),T=r=>Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),I=r=>{if(!r)return null;const d=e.min,x=e.max,R=T(r);return R<T(d)||R>T(x)?null:r},O=(r,d)=>e.allowReverse??!1?!0:r<=d,p=t.computed(()=>(n.value?.length??0)>=23&&v.value.length>=16),h=r=>{if((r??"").length<23||v.value.length<16)return{start:null,end:null};const d=r.substring(0,10),x=r.substring(13,23),[R,Q,ne]=d.split("/").map(ie=>parseInt(ie||"0",10)),[me,ue,ce]=x.split("/").map(ie=>parseInt(ie||"0",10)),de=new Date(ne,R-1,Q),ye=new Date(ce,me-1,ue),be=E(ne,R,Q)&&de.toString()!=="Invalid Date",Se=E(ce,me,ue)&&ye.toString()!=="Invalid Date";return{start:be?de:null,end:Se?ye:null}},U=e.externalValid??t.ref(!0),j=t.computed(()=>h(n.value)),l=t.computed(()=>{const r=I(j.value.start),d=I(j.value.end);return{start:r,end:d}}),y=t.computed(()=>{if(!p.value)return;const r=l.value.start,d=l.value.end;if(!r||!d)return;const x=Math.abs(T(d)-T(r));return Math.round(x/864e5+1)}),i=t.computed(()=>{if(!p.value)return!1;const{start:r,end:d}=j.value;if(!r||!d||!l.value.start||!l.value.end)return!1;const x=l.value.start,R=l.value.end;return!(!O(x,R)||typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays)}),c=t.computed(()=>{const{start:r,end:d}=j.value;if(!p.value)return"incomplete";if(!r||!d)return"invalid-date";if(!l.value.start||!l.value.end)return"out-of-bounds";const x=l.value.start,R=l.value.end;return O(x,R)?typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),g=t.ref(void 0),b=t.computed(()=>{if(U.value!==!1)return"";const{min:r,max:d}=e,x=g.value;if(!x)return"";switch(x){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return r&&d?`Dates must be between ${_(r)} and ${_(d)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";case"valid":default:return""}}),D=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],N=(r,d)=>String(r).padStart(d,"0"),_=r=>`${N(r.getMonth()+1,2)}/${N(r.getDate(),2)}/${N(r.getFullYear(),4)}`,re=r=>r<=2?{side:"start",part:"mm"}:r<=5?{side:"start",part:(r<=3,"dd")}:r<=11?{side:"start",part:"yyyy"}:r<=15?{side:"end",part:"mm"}:r<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},P=(r,d,x)=>{const R=d?.selectionStart??u.value??0;u.value=R;const{start:Q,end:ne}=h(n.value);if(!Q&&!ne){const Y=new Date,le=_(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const X=document.getElementById(e.id),Z=u.value??0;X&&(X.focus(),X.setSelectionRange(Z,Z))})});return}const me=new Date,ue=re(R);let ce=Q?new Date(Q):new Date(me),de=ne?new Date(ne):new Date(me);const ye=(Y,le)=>{if(le==="mm"){const X=Y.getMonth()+1,Z=r==="ArrowUp"?X<12?X+1:1:X>1?X-1:12;Y.setMonth(Z-1);const ge=L(Y.getFullYear(),Z);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const X=L(Y.getFullYear(),Y.getMonth()+1),Z=Y.getDate(),ge=r==="ArrowUp"?Z<X?Z+1:1:Z>1?Z-1:X;Y.setDate(ge)}else if(le==="yyyy"){const X=Y.getFullYear();Y.setFullYear(r==="ArrowUp"?X+1:Math.max(1,X-1));const Z=L(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>Z&&Y.setDate(Z)}};ue.side==="start"?ye(ce,ue.part):ye(de,ue.part);const be=_(ce),Se=_(de);n.value=`${be} - ${Se}`;const ie=I(ce),ke=I(de);ie&&ke&&O(ie,ke)?e.onChange({value:{start:ie,end:ke},event:x}):e.onChange({value:null,event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=u.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},ee=r=>{const{start:d,end:x}=h(n.value);if(!d||!x){e.onChange({value:null,event:r});return}const R=I(d),Q=I(x);if(!R||!Q){e.onChange({value:null,event:r});return}if(!O(R,Q)){e.onChange({value:null,event:r});return}e.onChange({value:{start:R,end:Q},event:r})},a=r=>{const d=r.value??"",x=r.event;if(!d&&x&&x.type==="click"){V(x);return}n.value=d;const R=x?.target;u.value=R?.selectionStart??0,ee(r)},f=r=>{u.value=r.target.selectionStart??0},M=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),e.onShowCalendar(r);return}if(D.includes(r.key)){r.preventDefault();const d=r.target;P(r.key,d,r)}},o=r=>{r.preventDefault();const d=r.deltaY<0?"ArrowUp":"ArrowDown";P(d,r.target,r)},s=r=>{if(C.includes(r.key)||D.includes(r.key)){r.preventDefault();const d=r.target;u.value=d?.selectionStart??0}},m=()=>{g.value=c.value,(e.manageValid??!0)&&(U.value=i.value)},k=r=>{m()},V=r=>{console.log("Clear event:",r),n.value="",u.value=0,e.onChange({value:null,event:r}),m(),t.nextTick(()=>{const d=document.getElementById(e.id);d&&(d.focus(),d.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,r=>{const d=r?.start??null,x=r?.end??null;if(d&&x){if(n.value=`${_(d)} - ${_(x)}`,e.isOpen?.value&&$.value&&e.onRequestClose){const R=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),$.value=!1,m()},R)}return}},{immediate:!0});const z=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),G=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),H=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),ae=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),oe=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),B=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),W=t.computed(()=>{const{start:r,end:d}=h(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(z.value).padStart(2,"0")} / ${String(G.value).padStart(2,"0")} / ${String(H.value).padStart(4,"0")}`},{label:"End",value:`${String(ae.value).padStart(2,"0")} / ${String(oe.value).padStart(2,"0")} / ${String(B.value).padStart(4,"0")}`},{label:"Digits only",value:v.value},{label:"Mask complete",value:`${p.value}`},{label:"Parsed",value:`${r?r.toDateString():"-"} | ${d?d.toDateString():"-"}`},{label:"Valid (managed)",value:`${U.value??"-"}`},{label:"Span (days)",value:`${y.value??"-"}`},{label:"Reason",value:`${c.value??"-"}`},{label:"Cursor in",value:`${u.value??"-"} (${(()=>{const x=u.value??0,R=re(x);return`${R.side}.${R.part}`})()})`}]}),te=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const d=r.closest("div");if(!d){console.warn(`Parent div of #${e.id} not found for styling.`);return}d.classList.contains("fk-daterangepicker")||d.classList.add("fk-daterangepicker")})};t.onMounted(()=>{te()});const pe=()=>{t.nextTick(()=>{try{const r=Array.from(document.querySelectorAll(".k-animation-container"));if(!r.length)return;const x=[...r].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!x)return;const R=x.querySelectorAll(".k-calendar-table");let Q=!1;R.forEach(ne=>{ne.tabIndex===0&&(Q?ne.tabIndex=-1:Q=!0)})}catch(r){console.warn(r)}})};return e.isOpen&&t.watch(e.isOpen,r=>{r&&setTimeout(()=>pe(),0)},{immediate:!1}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:W,digitsOnly:v,valid:U,validComputed:t.readonly(i),reason:t.readonly(c),validationMessage:t.readonly(b),spanDays:t.readonly(y),month1:t.readonly(z),day1:t.readonly(G),year1:t.readonly(H),month2:t.readonly(ae),day2:t.readonly(oe),year2:t.readonly(B),handleChange:a,handleKeyDown:M,handleWheel:o,handleKeyUp:s,handleClick:f,handleBlur:k,handleClear:V,onCalendarChange:()=>{$.value=!0},initStyling:te}}function $e(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.timeFormat??"hh:mm AM"),F=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],w=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},L=o=>o<=2?"hh":o<=5?"mm":"ampm",E=t.computed(()=>{const o=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),23)}),T=t.computed(()=>{const o=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),59)}),I=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),O=t.computed(()=>{const o=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),s=I.value;return o===12?s==="AM"?0:12:s==="PM"?o+12:o}),p=t.computed(()=>h.value?`${String(O.value).padStart(2,"0")}:${String(T.value).padStart(2,"0")}:00`:null),h=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),U=(o,s,m)=>{let k=o%12;return k===0&&(k=12),`${String(k).padStart(2,"0")}:${String(s).padStart(2,"0")} ${m}`},j=o=>{const s=o.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!s)return null;const m=parseInt(s[1]),k=parseInt(s[2]),V=s[3].toUpperCase();if(m<1||m>12||k<0||k>59)return null;let z=m%12;V==="PM"&&(z+=12);const G=new Date;return G.setSeconds(0,0),G.setHours(z),G.setMinutes(k),G},l=o=>{if(S.value.length===0){e.onChange({value:null,event:o});return}if(!h.value){e.onChange({value:null,event:o});return}const s=j(n.value);s&&i(s)?e.onChange({value:s,event:o}):e.onChange({value:null,event:o})},y=o=>o.getHours()*60+o.getMinutes(),i=o=>{const s=e.min??void 0,m=e.max??void 0,k=y(o);if(s){const V=y(s);if(k<V)return!1}if(m){const V=y(m);if(k>V)return!1}return!0},c=o=>{n.value=o.value;const s=o.event?.target;u.value=s?.selectionStart??0;try{const m=u.value??0;if(L(m)==="ampm"&&(n.value??"").length>=8){const k=n.value.charAt(6);/[Aa]/.test(k)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})})):/[Pp]/.test(k)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})}))}}catch{}l(o)},g=o=>{u.value=o.target.selectionStart??0},b=(o,s,m)=>{const k=s?.selectionStart??u.value??0;u.value=k;const V=L(k),z=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!z){if((n.value??"").length===0||S.value.length===0){const B=new Date,W=B.getHours(),te=W>=12?"PM":"AM";n.value=U(W,B.getMinutes(),te);const pe=j(n.value);pe&&i(pe)?e.onChange({value:pe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id),d=u.value??0;r&&(r.focus(),r.setSelectionRange(d,d))})})}return}let G=parseInt(z[1]),H=parseInt(z[2]),ae=z[3].toUpperCase();if(V==="hh")o==="ArrowUp"?G=G<12?G+1:1:G=G>1?G-1:12;else if(V==="mm"){const B=e.minuteStepRef?.value??e.minuteStep??1;if(B===1)o==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(o==="ArrowUp"){const W=H%B;let te=W===0?H+B:H+(B-W);te>=60&&(te=0),H=te}else{const W=H%B;let te=W===0?H-B:H-W;te<0&&(te=60-B),H=te}}else V==="ampm"&&(ae=ae==="AM"?"PM":"AM");n.value=`${String(G).padStart(2,"0")}:${String(H).padStart(2,"0")} ${ae}`;const oe=j(n.value);oe&&i(oe)?e.onChange({value:oe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id),W=u.value??0;B&&(B.focus(),B.setSelectionRange(W,W))})})},D=o=>{if(o.code==="Space"||o.key===" "){e.onShowPicker(o);return}if(A.includes(o.key)){o.preventDefault();const s=o.target;b(o.key,s,o)}},C=o=>{o.preventDefault();const s=o.deltaY<0?"ArrowUp":"ArrowDown";b(s,o.target,o)},N=o=>{const s=o.target;if(w.includes(o.key)){u.value=s?.selectionStart??0;return}A.includes(o.key)&&(o.preventDefault(),u.value=s?.selectionStart??0)},_=o=>{K.value=!0,F.value&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const s=o.target;s&&(u.value=s.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,o=>{if(o){const s=new Date(o);if(s.toString()!=="Invalid Date"){const m=s.getHours(),k=m>=12?"PM":"AM";n.value=U(m,s.getMinutes(),k);return}}},{immediate:!0});const re=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",O.value],["Minute",T.value],["Period",I.value],["Time (24h)",p.value??"--:--:--"],["Digits only",S.value],["Parsed Date",P.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",ee.value],["reason",a.value],["validationMessage",f.value]]),P=t.computed(()=>j(n.value)??null),ee=t.computed(()=>{if(!F.value){if(!h.value)return!0;const s=P.value;return s?i(s):!1}if(!K.value)return!0;const o=P.value;return!h.value||!o?!1:i(o)}),a=t.computed(()=>{if(!F.value){if(!h.value)return;const s=P.value;return s?i(s)?"valid":"out-of-bounds":"invalid-time"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const o=P.value;return o?i(o)?"valid":"out-of-bounds":"invalid-time"}),f=t.computed(()=>{const o=a.value;if(!o||o==="valid")return"";if(o==="incomplete")return"Required";if(o==="invalid-time")return`Must be in ${$.value} format.`;const s={hour:"2-digit",minute:"2-digit"},m=e.min?e.min.toLocaleTimeString("en-US",s):null,k=e.max?e.max.toLocaleTimeString("en-US",s):null;if(o==="out-of-bounds"){if(m&&k)return`Must be between ${m} and ${k}.`;if(m)return`Must be ${m} or later.`;if(k)return`Must be ${k} or earlier.`}return""}),M=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const s=o.closest(".k-timepicker");if(!s){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const m=s.parentElement;if(!m){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}m.classList.contains("fk-timepicker")||m.classList.add("fk-timepicker")})};return t.onMounted(()=>{M()}),{raw:n,rules:v,debugEnabled:q,debugLines:re,placeholder:$,isValid:ee,reason:t.readonly(a),validationMessage:f,isComplete:h,inRangeTime:i,cursorPos:u,hour:t.readonly(E),hour24:t.readonly(O),minute:t.readonly(T),period:t.readonly(I),time24:t.readonly(p),parsedRawTime:t.readonly(P),handleChange:c,handleKeyDown:D,handleKeyUp:N,handleClick:g,handleWheel:C,handleBlur:_,initStyling:M}}function Ie(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const we=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Fe=Object.prototype.toString,Le=e=>Fe.call(e)==="[object Object]",se=()=>{},Pe=Re();function Re(){var e,n;return we&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function he(e){return Array.isArray(e)?e:[e]}function qe(e,n,u){return t.watch(e,n,{...u,immediate:!0})}const De=we?window:void 0;function fe(e){var n;const u=t.toValue(e);return(n=u?.$el)!=null?n:u}function ve(...e){const n=[],u=()=>{n.forEach(A=>A()),n.length=0},q=(A,w,S,v)=>(A.addEventListener(w,S,v),()=>A.removeEventListener(w,S,v)),$=t.computed(()=>{const A=he(t.toValue(e[0])).filter(w=>w!=null);return A.every(w=>typeof w!="string")?A:void 0}),F=qe(()=>{var A,w;return[(w=(A=$.value)==null?void 0:A.map(S=>fe(S)))!=null?w:[De].filter(S=>S!=null),he(t.toValue($.value?e[1]:e[0])),he(t.unref($.value?e[2]:e[1])),t.toValue($.value?e[3]:e[2])]},([A,w,S,v])=>{if(u(),!A?.length||!w?.length||!S?.length)return;const L=Le(v)?{...v}:v;n.push(...A.flatMap(E=>w.flatMap(T=>S.map(I=>q(E,T,I,L)))))},{flush:"post"}),K=()=>{F(),u()};return Ie(u),K}let Ae=!1;function Oe(e,n,u={}){const{window:q=De,ignore:$=[],capture:F=!0,detectIframe:K=!1,controls:A=!1}=u;if(!q)return A?{stop:se,cancel:se,trigger:se}:se;if(Pe&&!Ae){Ae=!0;const p={passive:!0};Array.from(q.document.body.children).forEach(h=>h.addEventListener("click",se,p)),q.document.documentElement.addEventListener("click",se,p)}let w=!0;const S=p=>t.toValue($).some(h=>{if(typeof h=="string")return Array.from(q.document.querySelectorAll(h)).some(U=>U===p.target||p.composedPath().includes(U));{const U=fe(h);return U&&(p.target===U||p.composedPath().includes(U))}});function v(p){const h=t.toValue(p);return h&&h.$.subTree.shapeFlag===16}function L(p,h){const U=t.toValue(p),j=U.$.subTree&&U.$.subTree.children;return j==null||!Array.isArray(j)?!1:j.some(l=>l.el===h.target||h.composedPath().includes(l.el))}const E=p=>{const h=fe(e);if(p.target!=null&&!(!(h instanceof Element)&&v(e)&&L(e,p))&&!(!h||h===p.target||p.composedPath().includes(h))){if("detail"in p&&p.detail===0&&(w=!S(p)),!w){w=!0;return}n(p)}};let T=!1;const I=[ve(q,"click",p=>{T||(T=!0,setTimeout(()=>{T=!1},0),E(p))},{passive:!0,capture:F}),ve(q,"pointerdown",p=>{const h=fe(e);w=!S(p)&&!!(h&&!p.composedPath().includes(h))},{passive:!0}),K&&ve(q,"blur",p=>{setTimeout(()=>{var h;const U=fe(e);((h=q.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!U?.contains(q.document.activeElement)&&n(p)},0)},{passive:!0})].filter(Boolean),O=()=>I.forEach(p=>p());return A?{stop:O,cancel:()=>{w=!1},trigger:p=>{w=!0,E(p),w=!1}}:O}function Ue(e){const n=t.shallowRef(null),u=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],q=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??u].flat(),$=v=>v?typeof e.initialFocus=="string"?v.querySelector(e.initialFocus)??v:typeof e.initialFocus=="function"?e.initialFocus(v)??v:v.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??v:null,{activate:F,deactivate:K}=xe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>$(n.value),...e.focusTrapOptions??{}});let A=null,w=t.ref(null);const S=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const v=(E,T)=>{const I=Array.from(E.querySelectorAll(T));if(!I.length)return null;const O=I.filter(p=>p.offsetParent!==null||p.getClientRects().length>0);return O[O.length-1]??I[I.length-1]??null},L=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of q){const T=v(L,E);if(T)return T}for(const E of q){const T=v(document,E);if(T)return T}return null};return Oe(n,v=>{w.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",v)}),t.watch(()=>e.isOpen.value,v=>{v?(w.value=null,t.nextTick(()=>{const L=S();L&&(n.value=L,setTimeout(()=>F(),0),A||(A=E=>{E.key==="Escape"&&(w.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",A,!0)))})):(K(),A&&(document.removeEventListener("keydown",A,!0),A=null),n.value=null,w.value==="outside"&&t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value,T=E?.querySelector("input"),I=document.activeElement;I&&(I===T||E&&E.contains(I))&&(T??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(L,0))}),e.returnFocusToTrigger!==!1&&w.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(L,0))})))}),{popupRef:n,activate:F,deactivate:K,lastCloseReason:t.readonly(w),setPopupEl:v=>n.value=v}}const Ve=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Be=e=>!!e&&typeof e=="object"&&"field"in e,Ee=(e,n)=>!e||typeof e!="object"?!1:Ve(e)?e.filters.some(u=>Ee(u,n)):Be(e)?e.field===n:!1,Ke=e=>{const n=t.ref({}),u=$=>!e.value||!e.value.filters?!1:e.value.filters.some(F=>Ee(F,$));return{activeClasses:n,hasFieldFilter:u,updateActiveClass:$=>{const F=u($);console.log("updateActiveClass for",$,"hasFilter:",F),n.value[$]=F?"active":"",console.log("activeClasses after update",n.value)}}};J.useGridA11y=Me,J.useGridFilter=Ke,J.useMaskedDateInput=Te,J.useMaskedDateRangeInput=Ce,J.useMaskedTimeInput=$e,J.usePopupTrap=Ue,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(J,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(J=typeof globalThis<"u"?globalThis:J||self,t(J.FeatherKComposables={},J.Vue,J.useFocusTrap))})(this,(function(J,t,xe){"use strict";const Me=(e,n)=>{const u=t.ref(null);let q=!1,$=null,F=null;const K=[],A=".k-table-row[data-grid-row-index] [tabindex]",w=()=>e?.value?.columns,S=l=>{const y=l.key||l.code;[" ","Spacebar","Space","Enter"].includes(y)&&(l.preventDefault(),l.stopPropagation(),u.value=l.target,l.target.click())},v=l=>{if(!u.value)return;if(l.code==="Escape"){l.stopPropagation(),u.value&&u.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),i=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(i){if(l.code==="Tab"){const c=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],g=n?.focusableMenuSelectors??c,b=Array.from(i.querySelectorAll(g.join(",")));if(b.length===0)return;const D=b.findIndex(N=>N===document.activeElement);let C;D===-1?C=0:l.shiftKey?C=(D-1+b.length)%b.length:C=(D+1)%b.length,l.preventDefault(),l.stopPropagation(),b[C]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const c=y.findIndex(b=>b===document.activeElement);let g=c;l.code==="ArrowUp"?g=c>0?c-1:y.length-1:l.code==="ArrowDown"&&(g=c<y.length-1?c+1:0),y[g]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const c=u.value?.parentElement;(l.shiftKey?c?.previousElementSibling:c?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},L=()=>{$=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;if(c.classList.contains("k-animation-container")){const b=u.value;b&&(b.dataset.featherKSortable==="true"||t.nextTick(()=>{c.querySelectorAll(".k-columnmenu-item-wrapper").forEach(N=>{N.textContent?.toLowerCase().includes("sort")&&N.remove()})})),c.addEventListener("keydown",v),t.nextTick(()=>{const D=()=>{const C=Array.from(c.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(C.length===1)C[0].focus(),C[0].click(),D.attempts=0;else if(C.length>1){D.attempts=0;return}else D.attempts===void 0&&(D.attempts=0),D.attempts++<3&&setTimeout(D,200)};D()})}c.querySelectorAll(".k-animation-container").forEach(b=>{b.addEventListener("keydown",v)})}}),y.removedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;c.classList.contains("k-animation-container")&&c.removeEventListener("keydown",v),c.querySelectorAll(".k-animation-container").forEach(b=>{b.removeEventListener("keydown",v)})}})})}),$.observe(document.body,{childList:!0,subtree:!0})},E=l=>{if(!l.type||!l)return;const y=l.target;if(y){if(l.code==="Escape"){const i=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(i){l.preventDefault(),l.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(g=>g.setAttribute("tabindex","-1"))}catch{}i.setAttribute("tabindex","0"),i.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","Space"].includes(l.code)){if(l.preventDefault(),y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){u.value=y;return}const i=y.closest(".k-table-row[data-grid-row-index]");if(i){if(["ArrowDown","ArrowUp"].includes(l.code)){const c=(b,D)=>{let C=D==="next"?b.nextElementSibling:b.previousElementSibling;for(;C;){const N=C;try{if(N.hasAttribute&&N.classList.contains("k-table-row"))return N}catch{}C=D==="next"?C.nextElementSibling:C.previousElementSibling}return null},g=l.code==="ArrowDown"?c(i,"next"):c(i,"previous");g&&(i.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault();const c=i.querySelectorAll(A);if(c.length===0)return;let g=Array.from(c).findIndex(b=>b===document.activeElement);if(g===-1&&document.activeElement===i){c[0].focus();return}l.code==="ArrowRight"?g=g===c.length-1?0:g+1:l.code==="ArrowLeft"&&(g=g===c.length-1?g-1:c.length-1),c[g].focus();return}}}}},T=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},I=()=>{if(!F)try{const l=()=>{try{const c=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!c||c.length===0||c.filter(D=>D.getAttribute("tabindex")==="0").length===1)return;const b=c.find(D=>D===document.activeElement||D.contains(document.activeElement));if(c.forEach(D=>D.setAttribute("tabindex","-1")),b){b.setAttribute("tabindex","0");return}c[0].setAttribute("tabindex","0")}catch(c){console.error("ensureSingleTabindex error:",c)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((c,g)=>{c.setAttribute("tabindex",g===0?"0":"-1")});const i=e.value.$el.querySelector(".k-table-tbody");i&&(F=new MutationObserver(()=>{l()}),F.observe(i,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},O=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.setAttribute("role","button"),i.addEventListener("keydown",S)}),L(),h()})},p=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.removeEventListener("keydown",S)}),$&&($.disconnect(),$=null),F&&(F.disconnect(),F=null),K.forEach(i=>i()),K.length=0},h=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((i,c)=>{const g=i.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!g)return;const b=w();if(b&&b[c]){const P=b[c].field??"";i.setAttribute("data-feather-k-field",P),i.setAttribute("data-feather-k-filterable",b[c].filterable===!1?"false":"true"),i.setAttribute("data-feather-k-sortable",b[c].sortable===!1?"false":"true")}const D=i.dataset.featherKFilterable!=="false",C=i.dataset.featherKSortable!=="false";g.setAttribute("tabindex","-1"),D||C?i.style.cursor="pointer":i.style.cursor="default",D?(i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-haspopup","menu")):(i.setAttribute("tabindex","0"),i.setAttribute("role","columnheader"),i.removeAttribute("aria-haspopup"));const N=P=>{P.target?.closest(".k-column-resizer")||(u.value=i,g.click())},_=P=>{if(D)u.value=i,P.preventDefault(),P.stopPropagation(),N(P);else if(C){u.value=i;const ee=new KeyboardEvent("keydown",{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0});i.dispatchEvent(ee)}};i.addEventListener("click",_),K.push(()=>{i.removeEventListener("click",_)});const re=P=>{if((P.code==="Enter"||P.code==="Space")&&(D||C)){if(u.value=i,u.value.focus(),D)P.preventDefault(),P.stopPropagation(),N(P);else if(C){const ee=i.querySelector(".k-link");ee&&ee.click()}}};i.addEventListener("keydown",re,!0),K.push(()=>{i.removeEventListener("keydown",re,!0)})});const y=document.querySelector(".k-grid-header .k-table-thead");if(y){const i=c=>{const g=c.target.closest("th");g&&(c.code==="Enter"||c.code==="Space")&&g.dataset.featherKFilterable==="false"&&g.dataset.featherKSortable==="false"&&(c.preventDefault(),c.stopImmediatePropagation())};y.addEventListener("keydown",i,!0),K.push(()=>{y.removeEventListener("keydown",i,!0)})}},U=function(l,y){const i=l?.event.event.target,c=w();if(!i||!c)return;const g=i.classList.contains("k-link"),b=i.classList.contains("k-columnmenu-item"),D=c.find(C=>C.field===l.event.field)?.sortable&&!0;if(!g){if(b&&!D){(l.event.sort&&void 0)?.filter(N=>N.field!==l.event.field);return}typeof y=="function"&&t.nextTick(()=>{u.value&&u.value.focus(),y(l)})}},j=()=>{if(!q)try{T(),I(),O(),q=!0}catch(l){console.error("initA11y failed:",l),p()}};return t.onBeforeUnmount(()=>{p()}),{activeFilterButton:u,handleGridKeyDown:E,handleSortChange:U,initA11y:j}};function Te(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.dateFormat??"mm/dd/yyyy"),F=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],w=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v=a=>a<=2?"mm":a<=5?"dd":S.value.length<=10?"yyyy":"mm",L=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),E=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),T=t.computed(()=>{const a=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(4,"0")}),I=a=>{if(S.value.length===0){e.onChange({value:null,event:a});return}if(S.value.length<8){e.onChange({value:null,event:a});return}if((n.value??"").length===10&&S.value.length===8){const[f,M,o]=n.value.split("/"),s=parseInt(f),m=parseInt(M),k=parseInt(o);if(j(k,s,m)){const V=new Date(k,s-1,m);O(V)?e.onChange({value:V,event:a}):e.onChange({value:null,event:a})}else e.onChange({value:null,event:a})}},O=a=>{const f=e.min??void 0,M=e.max??void 0;return!(f&&a<f||M&&a>M)},p=t.computed(()=>{if((n.value??"").length===10&&S.value.length===8){const[a,f,M]=(n.value??"").split("/"),o=parseInt(a),s=parseInt(f),m=parseInt(M);if(j(m,o,s))return new Date(m,o-1,s)}return null}),h=t.computed(()=>(n.value??"").length===10&&S.value.length===8),U=(a,f)=>new Date(a,f,0).getDate(),j=(a,f,M)=>f>=1&&f<=12&&a>=1900&&M>=1&&M<=U(a,f),l=a=>{n.value=a.value;const f=a.event?.target;u.value=f?.selectionStart??0,I(a)},y=a=>{u.value=a.target.selectionStart??0},i=(a,f,M)=>{const o=f?.selectionStart??u.value??0;u.value=o;let s=parseInt(L.value),m=parseInt(E.value),k=parseInt(T.value);if(!(S.value.length>=8)||!j(k,s,m)){const B=e.defaultValue??new Date;s=B.getMonth()+1,m=B.getDate(),k=B.getFullYear(),n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(k)}`;const W=new Date(k,s-1,m);e.onChange({value:O(W)?W:null,event:M}),C({useRAF:!0});return}const z=v(o);if(z==="mm")s=a==="ArrowUp"?s<12?s+1:1:s>1?s-1:12;else if(z==="dd"){const B=new Date(k,s,0).getDate();m=a==="ArrowUp"?m<B?m+1:1:m>1?m-1:B}else z==="yyyy"&&(k=a==="ArrowUp"?k+1:Math.max(1,k-1));n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(k)}`;const[G,H,ae]=n.value.split("/"),oe=new Date(parseInt(ae),parseInt(G)-1,parseInt(H));oe.toString()!=="Invalid Date"&&parseInt(ae)>=1e3?e.onChange({value:O(oe)?oe:null,event:M}):e.onChange({value:null,event:M}),C({useRAF:!0})},c=a=>{if(a.code==="Space"||a.key===" "){e.onShowCalendar(a);return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault();const f=a.target;i(a.key,f,a)}},g=a=>{a.preventDefault();const f=a.deltaY<0?"ArrowUp":"ArrowDown";i(f,a.target,a)},b=a=>{const f=a.target;if(w.includes(a.key)){u.value=f?.selectionStart??0;return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault(),u.value=f?.selectionStart??0}},D=a=>{K.value=!0,F.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const f=a.target;f&&(u.value=f.selectionStart??0)},C=a=>{const f=()=>{const M=document.getElementById(e.id);if(!M)return;const o=a?.pos??u.value??M.value.length;try{M.focus(),M.setSelectionRange(o,o)}catch{}};t.nextTick(()=>{if(a?.delay&&a.delay>0){setTimeout(f,a.delay);return}if(a?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const f=new Date(a);if(f.toString()!=="Invalid Date"){const M=(f.getMonth()+1).toString().padStart(2,"0"),o=f.getDate().toString().padStart(2,"0"),s=f.getFullYear().toString();n.value=`${M}/${o}/${s}`,C({delay:50});return}}},{immediate:!0});const N=t.computed(()=>[["Date",`${L.value} / ${E.value} / ${T.value}`],["Digits only",S.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),_=t.computed(()=>{if(!F.value){if(!h.value)return!0;const f=p.value;return f?O(f):!1}if(!K.value)return!0;const a=p.value;return!h.value||!a?!1:O(a)}),re=t.computed(()=>{if(!F.value){if(!h.value)return;const f=p.value;return f?O(f)?"valid":"out-of-bounds":"invalid-date"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const a=p.value;return a?O(a)?"valid":"out-of-bounds":"invalid-date"}),P=t.computed(()=>{const a=re.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-date")return`Must be in ${$.value} format.`;const f=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,M=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(a==="out-of-bounds"){if(f&&M)return`Must be between ${f} and ${M}.`;if(f)return`Must be on or after ${f}.`;if(M)return`Must be on or before ${M}.`}return""}),ee=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=a.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const M=f.parentElement;if(M){if(M.classList.contains("fk-datepicker"))return;M.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{ee()}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:N,placeholder:$,isValid:_,reason:t.readonly(re),validationMessage:P,digitsOnly:S,month:t.readonly(L),day:t.readonly(E),year:t.readonly(T),datePart:v,handleChange:l,handleKeyDown:c,handleWheel:g,handleKeyUp:b,handleClick:y,handleBlur:D,initStyling:ee}}function Ce(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(!1),K=365*(1440*60*1e3),A=new Date,w=new Date(A.getTime()-K),S=new Date(A.getTime()+K);e.min=e.min??w,e.max=e.max??S;const v=t.computed(()=>(n.value??"").replace(/\D/g,"")),L=(r,d)=>new Date(r,d,0).getDate(),E=(r,d,x)=>d>=1&&d<=12&&r>=1e3&&x>=1&&x<=L(r,d),T=r=>Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),I=r=>{if(!r)return null;const d=e.min,x=e.max,R=T(r);return R<T(d)||R>T(x)?null:r},O=(r,d)=>e.allowReverse??!1?!0:r<=d,p=t.computed(()=>(n.value?.length??0)>=23&&v.value.length>=16),h=r=>{if((r??"").length<23||v.value.length<16)return{start:null,end:null};const d=r.substring(0,10),x=r.substring(13,23),[R,Q,ne]=d.split("/").map(ie=>parseInt(ie||"0",10)),[me,ue,ce]=x.split("/").map(ie=>parseInt(ie||"0",10)),de=new Date(ne,R-1,Q),ye=new Date(ce,me-1,ue),be=E(ne,R,Q)&&de.toString()!=="Invalid Date",Se=E(ce,me,ue)&&ye.toString()!=="Invalid Date";return{start:be?de:null,end:Se?ye:null}},U=e.externalValid??t.ref(!0),j=t.computed(()=>h(n.value)),l=t.computed(()=>{const r=I(j.value.start),d=I(j.value.end);return{start:r,end:d}}),y=t.computed(()=>{if(!p.value)return;const r=l.value.start,d=l.value.end;if(!r||!d)return;const x=Math.abs(T(d)-T(r));return Math.round(x/864e5+1)}),i=t.computed(()=>{if(!p.value)return!1;const{start:r,end:d}=j.value;if(!r||!d||!l.value.start||!l.value.end)return!1;const x=l.value.start,R=l.value.end;return!(!O(x,R)||typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays)}),c=t.computed(()=>{const{start:r,end:d}=j.value;if(!p.value)return"incomplete";if(!r||!d)return"invalid-date";if(!l.value.start||!l.value.end)return"out-of-bounds";const x=l.value.start,R=l.value.end;return O(x,R)?typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),g=t.ref(void 0),b=t.computed(()=>{if(U.value!==!1)return"";const{min:r,max:d}=e,x=g.value;if(!x)return"";switch(x){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return r&&d?`Dates must be between ${_(r)} and ${_(d)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";case"valid":default:return""}}),D=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],N=(r,d)=>String(r).padStart(d,"0"),_=r=>`${N(r.getMonth()+1,2)}/${N(r.getDate(),2)}/${N(r.getFullYear(),4)}`,re=r=>r<=2?{side:"start",part:"mm"}:r<=5?{side:"start",part:(r<=3,"dd")}:r<=11?{side:"start",part:"yyyy"}:r<=15?{side:"end",part:"mm"}:r<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},P=(r,d,x)=>{const R=d?.selectionStart??u.value??0;u.value=R;const{start:Q,end:ne}=h(n.value);if(!Q&&!ne){const Y=new Date,le=_(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const X=document.getElementById(e.id),Z=u.value??0;X&&(X.focus(),X.setSelectionRange(Z,Z))})});return}const me=new Date,ue=re(R);let ce=Q?new Date(Q):new Date(me),de=ne?new Date(ne):new Date(me);const ye=(Y,le)=>{if(le==="mm"){const X=Y.getMonth()+1,Z=r==="ArrowUp"?X<12?X+1:1:X>1?X-1:12;Y.setMonth(Z-1);const ge=L(Y.getFullYear(),Z);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const X=L(Y.getFullYear(),Y.getMonth()+1),Z=Y.getDate(),ge=r==="ArrowUp"?Z<X?Z+1:1:Z>1?Z-1:X;Y.setDate(ge)}else if(le==="yyyy"){const X=Y.getFullYear();Y.setFullYear(r==="ArrowUp"?X+1:Math.max(1,X-1));const Z=L(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>Z&&Y.setDate(Z)}};ue.side==="start"?ye(ce,ue.part):ye(de,ue.part);const be=_(ce),Se=_(de);n.value=`${be} - ${Se}`;const ie=I(ce),ke=I(de);ie&&ke&&O(ie,ke)?e.onChange({value:{start:ie,end:ke},event:x}):e.onChange({value:null,event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=u.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},ee=r=>{const{start:d,end:x}=h(n.value);if(!d||!x){e.onChange({value:null,event:r});return}const R=I(d),Q=I(x);if(!R||!Q){e.onChange({value:null,event:r});return}if(!O(R,Q)){e.onChange({value:null,event:r});return}e.onChange({value:{start:R,end:Q},event:r})},a=r=>{const d=r.value??"",x=r.event;if(!d&&x&&x.type==="click"){V(x);return}n.value=d;const R=x?.target;u.value=R?.selectionStart??0,ee(r)},f=r=>{u.value=r.target.selectionStart??0},M=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),e.onShowCalendar(r);return}if(D.includes(r.key)){r.preventDefault();const d=r.target;P(r.key,d,r)}},o=r=>{r.preventDefault();const d=r.deltaY<0?"ArrowUp":"ArrowDown";P(d,r.target,r)},s=r=>{if(C.includes(r.key)||D.includes(r.key)){r.preventDefault();const d=r.target;u.value=d?.selectionStart??0}},m=()=>{g.value=c.value,(e.manageValid??!0)&&(U.value=i.value)},k=r=>{m()},V=r=>{console.log("Clear event:",r),n.value="",u.value=0,e.onChange({value:null,event:r}),m(),t.nextTick(()=>{const d=document.getElementById(e.id);d&&(d.focus(),d.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,r=>{const d=r?.start??null,x=r?.end??null;if(d&&x){if(n.value=`${_(d)} - ${_(x)}`,e.isOpen?.value&&$.value&&e.onRequestClose){const R=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),$.value=!1,m()},R)}return}},{immediate:!0});const z=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),G=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),H=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),ae=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),oe=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),B=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),W=t.computed(()=>{const{start:r,end:d}=h(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(z.value).padStart(2,"0")} / ${String(G.value).padStart(2,"0")} / ${String(H.value).padStart(4,"0")}`},{label:"End",value:`${String(ae.value).padStart(2,"0")} / ${String(oe.value).padStart(2,"0")} / ${String(B.value).padStart(4,"0")}`},{label:"Digits only",value:v.value},{label:"Mask complete",value:`${p.value}`},{label:"Parsed",value:`${r?r.toDateString():"-"} | ${d?d.toDateString():"-"}`},{label:"Valid (managed)",value:`${U.value??"-"}`},{label:"Span (days)",value:`${y.value??"-"}`},{label:"Reason",value:`${c.value??"-"}`},{label:"Cursor in",value:`${u.value??"-"} (${(()=>{const x=u.value??0,R=re(x);return`${R.side}.${R.part}`})()})`}]}),te=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const d=r.closest("div");if(!d){console.warn(`Parent div of #${e.id} not found for styling.`);return}d.classList.contains("fk-daterangepicker")||d.classList.add("fk-daterangepicker")})};t.onMounted(()=>{te()});const pe=()=>{t.nextTick(()=>{try{const r=Array.from(document.querySelectorAll(".k-animation-container"));if(!r.length)return;const x=[...r].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!x)return;const R=x.querySelectorAll(".k-calendar-table");let Q=!1;R.forEach(ne=>{ne.tabIndex===0&&(Q?ne.tabIndex=-1:Q=!0)})}catch(r){console.warn(r)}})};return e.isOpen&&t.watch(e.isOpen,r=>{r&&setTimeout(()=>pe(),0)},{immediate:!1}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:W,digitsOnly:v,valid:U,validComputed:t.readonly(i),reason:t.readonly(c),validationMessage:t.readonly(b),spanDays:t.readonly(y),month1:t.readonly(z),day1:t.readonly(G),year1:t.readonly(H),month2:t.readonly(ae),day2:t.readonly(oe),year2:t.readonly(B),handleChange:a,handleKeyDown:M,handleWheel:o,handleKeyUp:s,handleClick:f,handleBlur:k,handleClear:V,onCalendarChange:()=>{$.value=!0},initStyling:te}}function $e(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.timeFormat??"hh:mm AM"),F=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],w=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},L=o=>o<=2?"hh":o<=5?"mm":"ampm",E=t.computed(()=>{const o=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),23)}),T=t.computed(()=>{const o=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),59)}),I=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),O=t.computed(()=>{const o=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),s=I.value;return o===12?s==="AM"?0:12:s==="PM"?o+12:o}),p=t.computed(()=>h.value?`${String(O.value).padStart(2,"0")}:${String(T.value).padStart(2,"0")}:00`:null),h=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),U=(o,s,m)=>{let k=o%12;return k===0&&(k=12),`${String(k).padStart(2,"0")}:${String(s).padStart(2,"0")} ${m}`},j=o=>{const s=o.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!s)return null;const m=parseInt(s[1]),k=parseInt(s[2]),V=s[3].toUpperCase();if(m<1||m>12||k<0||k>59)return null;let z=m%12;V==="PM"&&(z+=12);const G=new Date;return G.setSeconds(0,0),G.setHours(z),G.setMinutes(k),G},l=o=>{if(S.value.length===0){e.onChange({value:null,event:o});return}if(!h.value){e.onChange({value:null,event:o});return}const s=j(n.value);s&&i(s)?e.onChange({value:s,event:o}):e.onChange({value:null,event:o})},y=o=>o.getHours()*60+o.getMinutes(),i=o=>{const s=e.min??void 0,m=e.max??void 0,k=y(o);if(s){const V=y(s);if(k<V)return!1}if(m){const V=y(m);if(k>V)return!1}return!0},c=o=>{n.value=o.value;const s=o.event?.target;u.value=s?.selectionStart??0;try{const m=u.value??0;if(L(m)==="ampm"&&(n.value??"").length>=8){const k=n.value.charAt(6);/[Aa]/.test(k)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})})):/[Pp]/.test(k)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})}))}}catch{}l(o)},g=o=>{u.value=o.target.selectionStart??0},b=(o,s,m)=>{const k=s?.selectionStart??u.value??0;u.value=k;const V=L(k),z=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!z){if((n.value??"").length===0||S.value.length===0){const B=new Date,W=B.getHours(),te=W>=12?"PM":"AM";n.value=U(W,B.getMinutes(),te);const pe=j(n.value);pe&&i(pe)?e.onChange({value:pe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id),d=u.value??0;r&&(r.focus(),r.setSelectionRange(d,d))})})}return}let G=parseInt(z[1]),H=parseInt(z[2]),ae=z[3].toUpperCase();if(V==="hh")o==="ArrowUp"?G=G<12?G+1:1:G=G>1?G-1:12;else if(V==="mm"){const B=e.minuteStepRef?.value??e.minuteStep??1;if(B===1)o==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(o==="ArrowUp"){const W=H%B;let te=W===0?H+B:H+(B-W);te>=60&&(te=0),H=te}else{const W=H%B;let te=W===0?H-B:H-W;te<0&&(te=60-B),H=te}}else V==="ampm"&&(ae=ae==="AM"?"PM":"AM");n.value=`${String(G).padStart(2,"0")}:${String(H).padStart(2,"0")} ${ae}`;const oe=j(n.value);oe&&i(oe)?e.onChange({value:oe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id),W=u.value??0;B&&(B.focus(),B.setSelectionRange(W,W))})})},D=o=>{if(o.code==="Space"||o.key===" "){e.onShowPicker(o);return}if(A.includes(o.key)){o.preventDefault();const s=o.target;b(o.key,s,o)}},C=o=>{o.preventDefault();const s=o.deltaY<0?"ArrowUp":"ArrowDown";b(s,o.target,o)},N=o=>{const s=o.target;if(w.includes(o.key)){u.value=s?.selectionStart??0;return}A.includes(o.key)&&(o.preventDefault(),u.value=s?.selectionStart??0)},_=o=>{K.value=!0,F.value&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const s=o.target;s&&(u.value=s.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,o=>{if(o){const s=new Date(o);if(s.toString()!=="Invalid Date"){const m=s.getHours(),k=m>=12?"PM":"AM";n.value=U(m,s.getMinutes(),k);return}}},{immediate:!0});const re=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",O.value],["Minute",T.value],["Period",I.value],["Time (24h)",p.value??"--:--:--"],["Digits only",S.value],["Parsed Date",P.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",ee.value],["reason",a.value],["validationMessage",f.value]]),P=t.computed(()=>j(n.value)??null),ee=t.computed(()=>{if(!F.value){if(!h.value)return!0;const s=P.value;return s?i(s):!1}if(!K.value)return!0;const o=P.value;return!h.value||!o?!1:i(o)}),a=t.computed(()=>{if(!F.value){if(!h.value)return;const s=P.value;return s?i(s)?"valid":"out-of-bounds":"invalid-time"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const o=P.value;return o?i(o)?"valid":"out-of-bounds":"invalid-time"}),f=t.computed(()=>{const o=a.value;if(!o||o==="valid")return"";if(o==="incomplete")return"Required";if(o==="invalid-time")return`Must be in ${$.value} format.`;const s={hour:"2-digit",minute:"2-digit"},m=e.min?e.min.toLocaleTimeString("en-US",s):null,k=e.max?e.max.toLocaleTimeString("en-US",s):null;if(o==="out-of-bounds"){if(m&&k)return`Must be between ${m} and ${k}.`;if(m)return`Must be ${m} or later.`;if(k)return`Must be ${k} or earlier.`}return""}),M=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const s=o.closest(".k-timepicker");if(!s){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const m=s.parentElement;if(!m){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}m.classList.contains("fk-timepicker")||m.classList.add("fk-timepicker")})};return t.onMounted(()=>{M()}),{raw:n,rules:v,debugEnabled:q,debugLines:re,placeholder:$,isValid:ee,reason:t.readonly(a),validationMessage:f,isComplete:h,inRangeTime:i,cursorPos:u,hour:t.readonly(E),hour24:t.readonly(O),minute:t.readonly(T),period:t.readonly(I),time24:t.readonly(p),parsedRawTime:t.readonly(P),handleChange:c,handleKeyDown:D,handleKeyUp:N,handleClick:g,handleWheel:C,handleBlur:_,initStyling:M}}function Ie(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const we=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Fe=Object.prototype.toString,Le=e=>Fe.call(e)==="[object Object]",se=()=>{},Pe=Re();function Re(){var e,n;return we&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function he(e){return Array.isArray(e)?e:[e]}function qe(e,n,u){return t.watch(e,n,{...u,immediate:!0})}const De=we?window:void 0;function fe(e){var n;const u=t.toValue(e);return(n=u?.$el)!=null?n:u}function ve(...e){const n=[],u=()=>{n.forEach(A=>A()),n.length=0},q=(A,w,S,v)=>(A.addEventListener(w,S,v),()=>A.removeEventListener(w,S,v)),$=t.computed(()=>{const A=he(t.toValue(e[0])).filter(w=>w!=null);return A.every(w=>typeof w!="string")?A:void 0}),F=qe(()=>{var A,w;return[(w=(A=$.value)==null?void 0:A.map(S=>fe(S)))!=null?w:[De].filter(S=>S!=null),he(t.toValue($.value?e[1]:e[0])),he(t.unref($.value?e[2]:e[1])),t.toValue($.value?e[3]:e[2])]},([A,w,S,v])=>{if(u(),!A?.length||!w?.length||!S?.length)return;const L=Le(v)?{...v}:v;n.push(...A.flatMap(E=>w.flatMap(T=>S.map(I=>q(E,T,I,L)))))},{flush:"post"}),K=()=>{F(),u()};return Ie(u),K}let Ae=!1;function Oe(e,n,u={}){const{window:q=De,ignore:$=[],capture:F=!0,detectIframe:K=!1,controls:A=!1}=u;if(!q)return A?{stop:se,cancel:se,trigger:se}:se;if(Pe&&!Ae){Ae=!0;const p={passive:!0};Array.from(q.document.body.children).forEach(h=>h.addEventListener("click",se,p)),q.document.documentElement.addEventListener("click",se,p)}let w=!0;const S=p=>t.toValue($).some(h=>{if(typeof h=="string")return Array.from(q.document.querySelectorAll(h)).some(U=>U===p.target||p.composedPath().includes(U));{const U=fe(h);return U&&(p.target===U||p.composedPath().includes(U))}});function v(p){const h=t.toValue(p);return h&&h.$.subTree.shapeFlag===16}function L(p,h){const U=t.toValue(p),j=U.$.subTree&&U.$.subTree.children;return j==null||!Array.isArray(j)?!1:j.some(l=>l.el===h.target||h.composedPath().includes(l.el))}const E=p=>{const h=fe(e);if(p.target!=null&&!(!(h instanceof Element)&&v(e)&&L(e,p))&&!(!h||h===p.target||p.composedPath().includes(h))){if("detail"in p&&p.detail===0&&(w=!S(p)),!w){w=!0;return}n(p)}};let T=!1;const I=[ve(q,"click",p=>{T||(T=!0,setTimeout(()=>{T=!1},0),E(p))},{passive:!0,capture:F}),ve(q,"pointerdown",p=>{const h=fe(e);w=!S(p)&&!!(h&&!p.composedPath().includes(h))},{passive:!0}),K&&ve(q,"blur",p=>{setTimeout(()=>{var h;const U=fe(e);((h=q.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!U?.contains(q.document.activeElement)&&n(p)},0)},{passive:!0})].filter(Boolean),O=()=>I.forEach(p=>p());return A?{stop:O,cancel:()=>{w=!1},trigger:p=>{w=!0,E(p),w=!1}}:O}function Ue(e){const n=t.shallowRef(null),u=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],q=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??u].flat(),$=v=>v?typeof e.initialFocus=="string"?v.querySelector(e.initialFocus)??v:typeof e.initialFocus=="function"?e.initialFocus(v)??v:v.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??v:null,{activate:F,deactivate:K}=xe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>$(n.value),...e.focusTrapOptions??{}});let A=null,w=t.ref(null);const S=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const v=(E,T)=>{const I=Array.from(E.querySelectorAll(T));if(!I.length)return null;const O=I.filter(p=>p.offsetParent!==null||p.getClientRects().length>0);return O[O.length-1]??I[I.length-1]??null},L=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of q){const T=v(L,E);if(T)return T}for(const E of q){const T=v(document,E);if(T)return T}return null};return Oe(n,v=>{w.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",v)}),t.watch(()=>e.isOpen.value,v=>{v?(w.value=null,t.nextTick(()=>{const L=S();L&&(n.value=L,setTimeout(()=>F(),0),A||(A=E=>{E.key==="Escape"&&(w.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",A,!0)))})):(K(),A&&(document.removeEventListener("keydown",A,!0),A=null),n.value=null,w.value==="outside"&&t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value,T=E?.querySelector("input"),I=document.activeElement;I&&(I===T||E&&E.contains(I))&&(T??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(L,0))}),e.returnFocusToTrigger!==!1&&w.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(L,0))})))}),{popupRef:n,activate:F,deactivate:K,lastCloseReason:t.readonly(w),setPopupEl:v=>n.value=v}}const Ve=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Be=e=>!!e&&typeof e=="object"&&"field"in e,Ee=(e,n)=>!e||typeof e!="object"?!1:Ve(e)?e.filters.some(u=>Ee(u,n)):Be(e)?e.field===n:!1,Ke=e=>{const n=t.ref({}),u=$=>!e.value||!e.value.filters?!1:e.value.filters.some(F=>Ee(F,$));return{activeClasses:n,hasFieldFilter:u,updateActiveClass:$=>{const F=u($);console.log("updateActiveClass for",$,"hasFilter:",F),n.value[$]=F?"active":"",console.log("activeClasses after update",n.value)}}};J.useGridA11y=Me,J.useGridFilter=Ke,J.useMaskedDateInput=Te,J.useMaskedDateRangeInput=Ce,J.useMaskedTimeInput=$e,J.usePopupTrap=Ue,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
|