@featherk/composables 0.6.17 → 0.6.18
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ref as J, onBeforeUnmount as Ie, nextTick as
|
|
1
|
+
import { ref as J, onBeforeUnmount as Ie, nextTick as W, computed as h, watch as ge, onMounted as xe, readonly as Y, getCurrentScope as Le, onScopeDispose as Te, toValue as de, unref as Fe, shallowRef as Re } from "vue";
|
|
2
2
|
import { useFocusTrap as qe } from "@vueuse/integrations/useFocusTrap";
|
|
3
3
|
const _e = (e, t) => {
|
|
4
4
|
const s = J(null);
|
|
5
5
|
let U = !1, P = null, L = null;
|
|
6
|
-
const N = [], A = ".k-table-row[data-grid-row-index] [tabindex]",
|
|
6
|
+
const N = [], A = ".k-table-row[data-grid-row-index] [tabindex]", S = (o) => o.key === "Enter" || o.code === "Enter" || o.code === "NumpadEnter", b = () => e?.value?.columns, w = (o) => {
|
|
7
7
|
const m = o.key || o.code;
|
|
8
|
-
([" ", "Spacebar", "Space"].includes(m) ||
|
|
8
|
+
([" ", "Spacebar", "Space"].includes(m) || S(o)) && (o.preventDefault(), o.stopPropagation(), s.value = o.target, o.target.click());
|
|
9
9
|
}, I = (o) => {
|
|
10
10
|
if (!s.value) return;
|
|
11
11
|
if (o.code === "Escape") {
|
|
@@ -35,7 +35,7 @@ const _e = (e, t) => {
|
|
|
35
35
|
);
|
|
36
36
|
if (g.length === 0) return;
|
|
37
37
|
const k = g.findIndex(
|
|
38
|
-
(
|
|
38
|
+
(j) => j === document.activeElement
|
|
39
39
|
);
|
|
40
40
|
let D;
|
|
41
41
|
k === -1 ? D = 0 : o.shiftKey ? D = (k - 1 + g.length) % g.length : D = (k + 1) % g.length, o.preventDefault(), o.stopPropagation(), g[D]?.focus();
|
|
@@ -64,16 +64,16 @@ const _e = (e, t) => {
|
|
|
64
64
|
const c = i;
|
|
65
65
|
if (c.classList.contains("k-animation-container")) {
|
|
66
66
|
const g = s.value;
|
|
67
|
-
g && (g.dataset.featherKSortable === "true" ||
|
|
67
|
+
g && (g.dataset.featherKSortable === "true" || W(() => {
|
|
68
68
|
c.querySelectorAll(
|
|
69
69
|
".k-columnmenu-item-wrapper"
|
|
70
|
-
).forEach((
|
|
71
|
-
|
|
70
|
+
).forEach((j) => {
|
|
71
|
+
j.textContent?.toLowerCase().includes("sort") && j.remove();
|
|
72
72
|
});
|
|
73
73
|
})), c.addEventListener(
|
|
74
74
|
"keydown",
|
|
75
75
|
I
|
|
76
|
-
),
|
|
76
|
+
), W(() => {
|
|
77
77
|
const k = () => {
|
|
78
78
|
const D = Array.from(
|
|
79
79
|
c.querySelectorAll(
|
|
@@ -169,10 +169,10 @@ const _e = (e, t) => {
|
|
|
169
169
|
const c = (g, k) => {
|
|
170
170
|
let D = k === "next" ? g.nextElementSibling : g.previousElementSibling;
|
|
171
171
|
for (; D; ) {
|
|
172
|
-
const
|
|
172
|
+
const j = D;
|
|
173
173
|
try {
|
|
174
|
-
if (
|
|
175
|
-
return
|
|
174
|
+
if (j.classList.contains("k-table-row"))
|
|
175
|
+
return j;
|
|
176
176
|
} catch {
|
|
177
177
|
}
|
|
178
178
|
D = k === "next" ? D.nextElementSibling : D.previousElementSibling;
|
|
@@ -202,7 +202,7 @@ const _e = (e, t) => {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}, O = () => {
|
|
205
|
-
|
|
205
|
+
W(() => {
|
|
206
206
|
const o = e.value.$el.closest(".k-grid");
|
|
207
207
|
o && o.classList.add("fk-grid");
|
|
208
208
|
});
|
|
@@ -246,14 +246,14 @@ const _e = (e, t) => {
|
|
|
246
246
|
console.error("Error setting up row navigation:", o);
|
|
247
247
|
}
|
|
248
248
|
}, y = () => {
|
|
249
|
-
|
|
249
|
+
W(() => {
|
|
250
250
|
const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
251
251
|
m && m.forEach((i) => {
|
|
252
252
|
i.setAttribute("role", "button"), i.addEventListener(
|
|
253
253
|
"keydown",
|
|
254
254
|
w
|
|
255
255
|
);
|
|
256
|
-
}), E(),
|
|
256
|
+
}), E(), _();
|
|
257
257
|
});
|
|
258
258
|
}, R = () => {
|
|
259
259
|
const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
@@ -263,15 +263,17 @@ const _e = (e, t) => {
|
|
|
263
263
|
w
|
|
264
264
|
);
|
|
265
265
|
}), P && (P.disconnect(), P = null), L && (L.disconnect(), L = null), N.forEach((i) => i()), N.length = 0;
|
|
266
|
-
},
|
|
266
|
+
}, _ = () => {
|
|
267
267
|
document.querySelectorAll(
|
|
268
268
|
".k-grid-header .k-table-thead th"
|
|
269
269
|
).forEach((i, c) => {
|
|
270
|
+
if (i.dataset.featherKHeaderBound === "true")
|
|
271
|
+
return;
|
|
270
272
|
const v = i.querySelector(
|
|
271
273
|
".k-grid-header-menu.k-grid-column-menu"
|
|
272
274
|
);
|
|
273
275
|
if (!v) return;
|
|
274
|
-
const g =
|
|
276
|
+
const g = b();
|
|
275
277
|
if (g && g[c]) {
|
|
276
278
|
const n = g[c].field ?? "";
|
|
277
279
|
i.setAttribute("data-feather-k-field", n), i.setAttribute(
|
|
@@ -284,31 +286,24 @@ const _e = (e, t) => {
|
|
|
284
286
|
}
|
|
285
287
|
const k = i.dataset.featherKFilterable !== "false", D = i.dataset.featherKSortable !== "false";
|
|
286
288
|
v.setAttribute("tabindex", "-1"), k || D ? i.style.cursor = "pointer" : i.style.cursor = "default", k ? (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"));
|
|
287
|
-
const
|
|
289
|
+
const j = (n) => {
|
|
288
290
|
n.target?.closest(".k-column-resizer") || (s.value = i, v.click());
|
|
289
291
|
}, oe = (n) => {
|
|
290
292
|
if (k)
|
|
291
|
-
s.value = i, n.preventDefault(), n.stopPropagation(),
|
|
293
|
+
s.value = i, n.preventDefault(), n.stopPropagation(), j(n);
|
|
292
294
|
else if (D) {
|
|
293
295
|
s.value = i;
|
|
294
|
-
const d =
|
|
295
|
-
|
|
296
|
-
code: "Enter",
|
|
297
|
-
keyCode: 13,
|
|
298
|
-
which: 13,
|
|
299
|
-
bubbles: !0,
|
|
300
|
-
cancelable: !0
|
|
301
|
-
});
|
|
302
|
-
i.dispatchEvent(d);
|
|
296
|
+
const d = i.querySelector(".k-link");
|
|
297
|
+
d && d.click();
|
|
303
298
|
}
|
|
304
299
|
};
|
|
305
300
|
i.addEventListener("click", oe), N.push(() => {
|
|
306
301
|
i.removeEventListener("click", oe);
|
|
307
302
|
});
|
|
308
303
|
const le = (n) => {
|
|
309
|
-
if ((
|
|
310
|
-
if (s.value = i, s.value.focus(), k)
|
|
311
|
-
|
|
304
|
+
if ((S(n) || n.code === "Space") && (k || D)) {
|
|
305
|
+
if (n.preventDefault(), n.stopPropagation(), s.value = i, s.value.focus(), k)
|
|
306
|
+
j(n);
|
|
312
307
|
else if (D) {
|
|
313
308
|
const d = i.querySelector(".k-link");
|
|
314
309
|
d && d.click();
|
|
@@ -317,13 +312,13 @@ const _e = (e, t) => {
|
|
|
317
312
|
};
|
|
318
313
|
i.addEventListener("keydown", le, !0), N.push(() => {
|
|
319
314
|
i.removeEventListener("keydown", le, !0);
|
|
320
|
-
});
|
|
315
|
+
}), i.dataset.featherKHeaderBound = "true";
|
|
321
316
|
});
|
|
322
317
|
const m = document.querySelector(".k-grid-header .k-table-thead");
|
|
323
|
-
if (m) {
|
|
318
|
+
if (m && m.dataset.featherKHeaderBound !== "true") {
|
|
324
319
|
const i = (c) => {
|
|
325
320
|
const v = c.target.closest("th");
|
|
326
|
-
v && (
|
|
321
|
+
v && (S(c) || c.code === "Space") && v.dataset.featherKFilterable === "false" && v.dataset.featherKSortable === "false" && (c.preventDefault(), c.stopImmediatePropagation());
|
|
327
322
|
};
|
|
328
323
|
m.addEventListener(
|
|
329
324
|
"keydown",
|
|
@@ -336,21 +331,23 @@ const _e = (e, t) => {
|
|
|
336
331
|
i,
|
|
337
332
|
!0
|
|
338
333
|
);
|
|
339
|
-
});
|
|
334
|
+
}), m.dataset.featherKHeaderBound = "true";
|
|
340
335
|
}
|
|
341
336
|
}, X = function(o, m) {
|
|
342
|
-
const i = o?.event?.event.target, c =
|
|
337
|
+
const i = o?.event?.event.target, c = b();
|
|
343
338
|
if (!i || !c) return;
|
|
344
|
-
const v = i.classList.contains("k-
|
|
339
|
+
const v = i.classList.contains("k-grid-header-menu"), g = i.classList.contains("k-columnmenu-item"), k = c.find((D) => D.field === o?.event?.field)?.sortable && !0;
|
|
345
340
|
if (!v) {
|
|
346
341
|
if (g && !k) {
|
|
347
342
|
o?.event?.sort?.filter(
|
|
348
|
-
(
|
|
343
|
+
(j) => j.field !== o?.event?.field
|
|
349
344
|
);
|
|
350
345
|
return;
|
|
351
346
|
}
|
|
352
|
-
typeof m == "function" &&
|
|
353
|
-
s.value && s.value.focus(), m(o)
|
|
347
|
+
typeof m == "function" && W(() => {
|
|
348
|
+
s.value && s.value.focus(), m(o), W(() => {
|
|
349
|
+
_();
|
|
350
|
+
});
|
|
354
351
|
});
|
|
355
352
|
}
|
|
356
353
|
}, ne = () => {
|
|
@@ -371,7 +368,7 @@ const _e = (e, t) => {
|
|
|
371
368
|
};
|
|
372
369
|
};
|
|
373
370
|
function ze(e) {
|
|
374
|
-
const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(e.dateFormat ?? "mm/dd/yyyy"), L = h(() => !!e.required), N = J(!1), A = ["ArrowUp", "ArrowDown"],
|
|
371
|
+
const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(e.dateFormat ?? "mm/dd/yyyy"), L = h(() => !!e.required), N = J(!1), A = ["ArrowUp", "ArrowDown"], S = ["ArrowLeft", "ArrowRight"], b = h(() => (t.value ?? "").replace(/\D/g, "")), w = (n) => n <= 2 ? "mm" : n <= 5 ? "dd" : b.value.length <= 10 ? "yyyy" : "mm", I = h(() => {
|
|
375
372
|
const n = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
376
373
|
return parseInt(n).toString().padStart(2, "0");
|
|
377
374
|
}), E = h(() => {
|
|
@@ -381,17 +378,17 @@ function ze(e) {
|
|
|
381
378
|
const n = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
382
379
|
return parseInt(n).toString().padStart(4, "0");
|
|
383
380
|
}), T = (n) => {
|
|
384
|
-
if (
|
|
381
|
+
if (b.value.length === 0) {
|
|
385
382
|
e.onChange({ value: null, event: n });
|
|
386
383
|
return;
|
|
387
384
|
}
|
|
388
|
-
if (
|
|
385
|
+
if (b.value.length < 8) {
|
|
389
386
|
e.onChange({ value: null, event: n });
|
|
390
387
|
return;
|
|
391
388
|
}
|
|
392
|
-
if ((t.value ?? "").length === 10 &&
|
|
393
|
-
const [d, C,
|
|
394
|
-
if (
|
|
389
|
+
if ((t.value ?? "").length === 10 && b.value.length === 8) {
|
|
390
|
+
const [d, C, G] = t.value.split("/"), K = parseInt(d), B = parseInt(C), Z = parseInt(G);
|
|
391
|
+
if (_(Z, K, B)) {
|
|
395
392
|
const ie = new Date(Z, K - 1, B);
|
|
396
393
|
O(ie) ? e.onChange({ value: ie, event: n }) : e.onChange({ value: null, event: n });
|
|
397
394
|
} else
|
|
@@ -401,25 +398,25 @@ function ze(e) {
|
|
|
401
398
|
const d = e.min ?? void 0, C = e.max ?? void 0;
|
|
402
399
|
return !(d && n < d || C && n > C);
|
|
403
400
|
}, f = h(() => {
|
|
404
|
-
if ((t.value ?? "").length === 10 &&
|
|
405
|
-
const [n, d, C] = (t.value ?? "").split("/"),
|
|
406
|
-
if (
|
|
407
|
-
return new Date(B,
|
|
401
|
+
if ((t.value ?? "").length === 10 && b.value.length === 8) {
|
|
402
|
+
const [n, d, C] = (t.value ?? "").split("/"), G = parseInt(n), K = parseInt(d), B = parseInt(C);
|
|
403
|
+
if (_(B, G, K))
|
|
404
|
+
return new Date(B, G - 1, K);
|
|
408
405
|
}
|
|
409
406
|
return null;
|
|
410
|
-
}), y = h(() => (t.value ?? "").length === 10 &&
|
|
407
|
+
}), y = h(() => (t.value ?? "").length === 10 && b.value.length === 8), R = (n, d) => new Date(n, d, 0).getDate(), _ = (n, d, C) => d >= 1 && d <= 12 && n >= 1900 && C >= 1 && C <= R(n, d), X = (n) => {
|
|
411
408
|
t.value = n.value;
|
|
412
409
|
const d = n.event?.target;
|
|
413
410
|
s.value = d?.selectionStart ?? 0, T(n);
|
|
414
411
|
}, ne = (n) => {
|
|
415
412
|
s.value = n.target.selectionStart ?? 0;
|
|
416
413
|
}, o = (n, d, C) => {
|
|
417
|
-
const
|
|
418
|
-
s.value =
|
|
414
|
+
const G = d?.selectionStart ?? s.value ?? 0;
|
|
415
|
+
s.value = G;
|
|
419
416
|
let K = parseInt(I.value), B = parseInt(E.value), Z = parseInt(M.value);
|
|
420
|
-
if (!(
|
|
421
|
-
const
|
|
422
|
-
K =
|
|
417
|
+
if (!(b.value.length >= 8) || !_(Z, K, B)) {
|
|
418
|
+
const z = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
419
|
+
K = z.getMonth() + 1, B = z.getDate(), Z = z.getFullYear(), t.value = `${String(K).padStart(2, "0")}/${String(B).padStart(
|
|
423
420
|
2,
|
|
424
421
|
"0"
|
|
425
422
|
)}/${String(Z)}`;
|
|
@@ -427,12 +424,12 @@ function ze(e) {
|
|
|
427
424
|
e.onChange({ value: O(q) ? q : null, event: C }), g({ useRAF: !0 });
|
|
428
425
|
return;
|
|
429
426
|
}
|
|
430
|
-
const a = w(
|
|
427
|
+
const a = w(G);
|
|
431
428
|
if (a === "mm")
|
|
432
429
|
K = n === "ArrowUp" ? K < 12 ? K + 1 : 1 : K > 1 ? K - 1 : 12;
|
|
433
430
|
else if (a === "dd") {
|
|
434
|
-
const
|
|
435
|
-
B = n === "ArrowUp" ? B <
|
|
431
|
+
const z = new Date(Z, K, 0).getDate();
|
|
432
|
+
B = n === "ArrowUp" ? B < z ? B + 1 : 1 : B > 1 ? B - 1 : z;
|
|
436
433
|
} else a === "yyyy" && (Z = n === "ArrowUp" ? Z + 1 : Math.max(1, Z - 1));
|
|
437
434
|
t.value = `${String(K).padStart(2, "0")}/${String(B).padStart(
|
|
438
435
|
2,
|
|
@@ -469,7 +466,7 @@ function ze(e) {
|
|
|
469
466
|
o(d, n.target, n);
|
|
470
467
|
}, c = (n) => {
|
|
471
468
|
const d = n.target;
|
|
472
|
-
if (
|
|
469
|
+
if (S.includes(n.key)) {
|
|
473
470
|
s.value = d?.selectionStart ?? 0;
|
|
474
471
|
return;
|
|
475
472
|
}
|
|
@@ -478,7 +475,7 @@ function ze(e) {
|
|
|
478
475
|
s.value = d?.selectionStart ?? 0;
|
|
479
476
|
}
|
|
480
477
|
}, v = (n) => {
|
|
481
|
-
N.value = !0, L.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 &&
|
|
478
|
+
N.value = !0, L.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && b.value.length === 0 && (e.externalValue.value = "");
|
|
482
479
|
const d = n.target;
|
|
483
480
|
d && (s.value = d.selectionStart ?? 0);
|
|
484
481
|
}, g = (n) => {
|
|
@@ -487,13 +484,13 @@ function ze(e) {
|
|
|
487
484
|
e.id
|
|
488
485
|
);
|
|
489
486
|
if (!C) return;
|
|
490
|
-
const
|
|
487
|
+
const G = n?.pos ?? s.value ?? C.value.length;
|
|
491
488
|
try {
|
|
492
|
-
C.focus(), C.setSelectionRange(
|
|
489
|
+
C.focus(), C.setSelectionRange(G, G);
|
|
493
490
|
} catch {
|
|
494
491
|
}
|
|
495
492
|
};
|
|
496
|
-
|
|
493
|
+
W(() => {
|
|
497
494
|
if (n?.delay && n.delay > 0) {
|
|
498
495
|
setTimeout(d, n.delay);
|
|
499
496
|
return;
|
|
@@ -511,8 +508,8 @@ function ze(e) {
|
|
|
511
508
|
if (n) {
|
|
512
509
|
const d = new Date(n);
|
|
513
510
|
if (d.toString() !== "Invalid Date") {
|
|
514
|
-
const C = (d.getMonth() + 1).toString().padStart(2, "0"),
|
|
515
|
-
t.value = `${C}/${
|
|
511
|
+
const C = (d.getMonth() + 1).toString().padStart(2, "0"), G = d.getDate().toString().padStart(2, "0"), K = d.getFullYear().toString();
|
|
512
|
+
t.value = `${C}/${G}/${K}`, g({ delay: 50 });
|
|
516
513
|
return;
|
|
517
514
|
}
|
|
518
515
|
}
|
|
@@ -521,7 +518,7 @@ function ze(e) {
|
|
|
521
518
|
);
|
|
522
519
|
const k = h(() => [
|
|
523
520
|
["Date", `${I.value} / ${E.value} / ${M.value}`],
|
|
524
|
-
["Digits only",
|
|
521
|
+
["Digits only", b.value],
|
|
525
522
|
[
|
|
526
523
|
"min",
|
|
527
524
|
e.min?.toLocaleDateString("en-US", {
|
|
@@ -547,19 +544,19 @@ function ze(e) {
|
|
|
547
544
|
if (!N.value) return !0;
|
|
548
545
|
const n = f.value;
|
|
549
546
|
return !y.value || !n ? !1 : O(n);
|
|
550
|
-
}),
|
|
547
|
+
}), j = h(() => {
|
|
551
548
|
if (!L.value) {
|
|
552
549
|
if (!y.value) return;
|
|
553
550
|
const d = f.value;
|
|
554
551
|
return d ? O(d) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
555
552
|
}
|
|
556
553
|
if (!N.value) return;
|
|
557
|
-
if (
|
|
554
|
+
if (b.value.length === 0 || !y.value)
|
|
558
555
|
return "incomplete";
|
|
559
556
|
const n = f.value;
|
|
560
557
|
return n ? O(n) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
561
558
|
}), oe = h(() => {
|
|
562
|
-
const n =
|
|
559
|
+
const n = j.value;
|
|
563
560
|
if (!n || n === "valid") return "";
|
|
564
561
|
if (n === "incomplete")
|
|
565
562
|
return "Required";
|
|
@@ -581,7 +578,7 @@ function ze(e) {
|
|
|
581
578
|
}
|
|
582
579
|
return "";
|
|
583
580
|
}), le = () => {
|
|
584
|
-
|
|
581
|
+
W(() => {
|
|
585
582
|
const n = document.getElementById(
|
|
586
583
|
e.id
|
|
587
584
|
);
|
|
@@ -614,12 +611,12 @@ function ze(e) {
|
|
|
614
611
|
debugLines: k,
|
|
615
612
|
placeholder: P,
|
|
616
613
|
isValid: D,
|
|
617
|
-
reason:
|
|
614
|
+
reason: Y(j),
|
|
618
615
|
validationMessage: oe,
|
|
619
|
-
digitsOnly:
|
|
620
|
-
month:
|
|
621
|
-
day:
|
|
622
|
-
year:
|
|
616
|
+
digitsOnly: b,
|
|
617
|
+
month: Y(I),
|
|
618
|
+
day: Y(E),
|
|
619
|
+
year: Y(M),
|
|
623
620
|
datePart: w,
|
|
624
621
|
handleChange: X,
|
|
625
622
|
handleKeyDown: m,
|
|
@@ -632,8 +629,8 @@ function ze(e) {
|
|
|
632
629
|
};
|
|
633
630
|
}
|
|
634
631
|
function Xe(e) {
|
|
635
|
-
const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(!1), L = 1440 * 60 * 1e3, N = 365 * L, A = /* @__PURE__ */ new Date(),
|
|
636
|
-
e.min = e.min ??
|
|
632
|
+
const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(!1), L = 1440 * 60 * 1e3, N = 365 * L, A = /* @__PURE__ */ new Date(), S = new Date(A.getTime() - N), b = new Date(A.getTime() + N);
|
|
633
|
+
e.min = e.min ?? S, e.max = e.max ?? b;
|
|
637
634
|
const w = h(() => (t.value ?? "").replace(/\D/g, "")), I = (r, u) => new Date(r, u, 0).getDate(), E = (r, u, p) => u >= 1 && u <= 12 && r >= 1e3 && p >= 1 && p <= I(r, u), M = (r) => Date.UTC(r.getFullYear(), r.getMonth(), r.getDate()), T = (r) => {
|
|
638
635
|
if (!r) return null;
|
|
639
636
|
const u = e.min ?? new Date(Date.now() - 90 * L), p = e.max ?? /* @__PURE__ */ new Date(), x = M(r);
|
|
@@ -643,8 +640,8 @@ function Xe(e) {
|
|
|
643
640
|
return { start: null, end: null };
|
|
644
641
|
const u = r.substring(0, 10), p = r.substring(13, 23), [x, ee, te] = u.split("/").map((ce) => parseInt(ce || "0", 10)), [se, fe, pe] = p.split("/").map((ce) => parseInt(ce || "0", 10)), me = new Date(te, x - 1, ee), he = new Date(pe, se - 1, fe), we = E(te, x, ee) && me.toString() !== "Invalid Date", ke = E(pe, se, fe) && he.toString() !== "Invalid Date";
|
|
645
642
|
return { start: we ? me : null, end: ke ? he : null };
|
|
646
|
-
}, R = e.externalValid ?? J(!0),
|
|
647
|
-
const r = T(
|
|
643
|
+
}, R = e.externalValid ?? J(!0), _ = h(() => y(t.value)), X = h(() => {
|
|
644
|
+
const r = T(_.value.start), u = T(_.value.end);
|
|
648
645
|
return { start: r, end: u };
|
|
649
646
|
}), ne = h(() => {
|
|
650
647
|
if (!f.value) return;
|
|
@@ -654,12 +651,12 @@ function Xe(e) {
|
|
|
654
651
|
return Math.round(p / 864e5 + 1);
|
|
655
652
|
}), o = h(() => {
|
|
656
653
|
if (!f.value) return !1;
|
|
657
|
-
const { start: r, end: u } =
|
|
654
|
+
const { start: r, end: u } = _.value;
|
|
658
655
|
if (!r || !u || !X.value.start || !X.value.end) return !1;
|
|
659
656
|
const p = X.value.start, x = X.value.end;
|
|
660
657
|
return !(!O(p, x) || typeof e.maxSpanDays == "number" && ne.value !== void 0 && ne.value > e.maxSpanDays);
|
|
661
658
|
}), m = h(() => {
|
|
662
|
-
const { start: r, end: u } =
|
|
659
|
+
const { start: r, end: u } = _.value;
|
|
663
660
|
if (!f.value) return "incomplete";
|
|
664
661
|
if (!r || !u) return "invalid-date";
|
|
665
662
|
if (!X.value.start || !X.value.end) return "out-of-bounds";
|
|
@@ -686,13 +683,13 @@ function Xe(e) {
|
|
|
686
683
|
}), v = ["ArrowUp", "ArrowDown"], g = ["ArrowLeft", "ArrowRight"], k = (r, u) => String(r).padStart(u, "0"), D = (r) => `${k(r.getMonth() + 1, 2)}/${k(r.getDate(), 2)}/${k(
|
|
687
684
|
r.getFullYear(),
|
|
688
685
|
4
|
|
689
|
-
)}`,
|
|
686
|
+
)}`, j = (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" }, oe = (r, u, p) => {
|
|
690
687
|
const x = u?.selectionStart ?? s.value ?? 0;
|
|
691
688
|
s.value = x;
|
|
692
689
|
const { start: ee, end: te } = y(t.value);
|
|
693
690
|
if (!ee && !te) {
|
|
694
|
-
const
|
|
695
|
-
t.value = `${ue} - ${ue}`, e.onChange({ value: { start:
|
|
691
|
+
const H = /* @__PURE__ */ new Date(), ue = D(H);
|
|
692
|
+
t.value = `${ue} - ${ue}`, e.onChange({ value: { start: H, end: H }, event: p }), W(() => {
|
|
696
693
|
requestAnimationFrame(() => {
|
|
697
694
|
const re = document.getElementById(
|
|
698
695
|
e.id
|
|
@@ -702,34 +699,34 @@ function Xe(e) {
|
|
|
702
699
|
});
|
|
703
700
|
return;
|
|
704
701
|
}
|
|
705
|
-
const se = /* @__PURE__ */ new Date(), fe =
|
|
702
|
+
const se = /* @__PURE__ */ new Date(), fe = j(x);
|
|
706
703
|
let pe = ee ? new Date(ee) : new Date(se), me = te ? new Date(te) : new Date(se);
|
|
707
|
-
const he = (
|
|
704
|
+
const he = (H, ue) => {
|
|
708
705
|
if (ue === "mm") {
|
|
709
|
-
const re =
|
|
710
|
-
|
|
711
|
-
const
|
|
712
|
-
|
|
706
|
+
const re = H.getMonth() + 1, ae = r === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
|
|
707
|
+
H.setMonth(ae - 1);
|
|
708
|
+
const be = I(H.getFullYear(), ae);
|
|
709
|
+
H.getDate() > be && H.setDate(be);
|
|
713
710
|
} else if (ue === "dd") {
|
|
714
|
-
const re = I(
|
|
715
|
-
|
|
711
|
+
const re = I(H.getFullYear(), H.getMonth() + 1), ae = H.getDate(), be = r === "ArrowUp" ? ae < re ? ae + 1 : 1 : ae > 1 ? ae - 1 : re;
|
|
712
|
+
H.setDate(be);
|
|
716
713
|
} else if (ue === "yyyy") {
|
|
717
|
-
const re =
|
|
718
|
-
|
|
719
|
-
const ae = I(
|
|
720
|
-
|
|
714
|
+
const re = H.getFullYear();
|
|
715
|
+
H.setFullYear(r === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
|
|
716
|
+
const ae = I(H.getFullYear(), H.getMonth() + 1);
|
|
717
|
+
H.getDate() > ae && H.setDate(ae);
|
|
721
718
|
}
|
|
722
719
|
};
|
|
723
720
|
fe.side === "start" ? he(pe, fe.part) : he(me, fe.part);
|
|
724
721
|
const we = D(pe), ke = D(me);
|
|
725
722
|
t.value = `${we} - ${ke}`;
|
|
726
723
|
const ce = T(pe), De = T(me);
|
|
727
|
-
ce && De && O(ce, De) ? e.onChange({ value: { start: ce, end: De }, event: p }) : e.onChange({ value: null, event: p }),
|
|
724
|
+
ce && De && O(ce, De) ? e.onChange({ value: { start: ce, end: De }, event: p }) : e.onChange({ value: null, event: p }), W(() => {
|
|
728
725
|
requestAnimationFrame(() => {
|
|
729
|
-
const
|
|
726
|
+
const H = document.getElementById(
|
|
730
727
|
e.id
|
|
731
728
|
), ue = s.value ?? 0;
|
|
732
|
-
|
|
729
|
+
H && (H.focus(), H.setSelectionRange(ue, ue));
|
|
733
730
|
});
|
|
734
731
|
});
|
|
735
732
|
}, le = (r) => {
|
|
@@ -774,7 +771,7 @@ function Xe(e) {
|
|
|
774
771
|
oe(r.key, u, r);
|
|
775
772
|
return;
|
|
776
773
|
}
|
|
777
|
-
},
|
|
774
|
+
}, G = (r) => {
|
|
778
775
|
r.preventDefault();
|
|
779
776
|
const u = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
780
777
|
oe(u, r.target, r);
|
|
@@ -788,7 +785,7 @@ function Xe(e) {
|
|
|
788
785
|
}, Z = (r) => {
|
|
789
786
|
B();
|
|
790
787
|
}, ie = (r) => {
|
|
791
|
-
console.log("Clear event:", r), t.value = "", s.value = 0, e.onChange({ value: null, event: r }), B(),
|
|
788
|
+
console.log("Clear event:", r), t.value = "", s.value = 0, e.onChange({ value: null, event: r }), B(), W(() => {
|
|
792
789
|
const u = document.getElementById(
|
|
793
790
|
e.id
|
|
794
791
|
);
|
|
@@ -821,7 +818,7 @@ function Xe(e) {
|
|
|
821
818
|
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
822
819
|
), V = h(
|
|
823
820
|
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
824
|
-
),
|
|
821
|
+
), z = h(
|
|
825
822
|
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
826
823
|
), q = h(() => {
|
|
827
824
|
const { start: r, end: u } = y(t.value);
|
|
@@ -848,7 +845,7 @@ function Xe(e) {
|
|
|
848
845
|
label: "End",
|
|
849
846
|
value: `${String(F.value).padStart(2, "0")} / ${String(
|
|
850
847
|
V.value
|
|
851
|
-
).padStart(2, "0")} / ${String(
|
|
848
|
+
).padStart(2, "0")} / ${String(z.value).padStart(4, "0")}`
|
|
852
849
|
},
|
|
853
850
|
{ label: "Digits only", value: w.value },
|
|
854
851
|
{ label: "Mask complete", value: `${f.value}` },
|
|
@@ -868,13 +865,13 @@ function Xe(e) {
|
|
|
868
865
|
{
|
|
869
866
|
label: "Cursor in",
|
|
870
867
|
value: `${s.value ?? "-"} (${(() => {
|
|
871
|
-
const p = s.value ?? 0, x =
|
|
868
|
+
const p = s.value ?? 0, x = j(p);
|
|
872
869
|
return `${x.side}.${x.part}`;
|
|
873
870
|
})()})`
|
|
874
871
|
}
|
|
875
872
|
];
|
|
876
873
|
}), Q = () => {
|
|
877
|
-
|
|
874
|
+
W(() => {
|
|
878
875
|
const r = document.getElementById(e.id);
|
|
879
876
|
if (!r) {
|
|
880
877
|
console.warn(`#${e.id} not found for styling.`);
|
|
@@ -892,7 +889,7 @@ function Xe(e) {
|
|
|
892
889
|
Q();
|
|
893
890
|
});
|
|
894
891
|
const ye = () => {
|
|
895
|
-
|
|
892
|
+
W(() => {
|
|
896
893
|
try {
|
|
897
894
|
const r = Array.from(
|
|
898
895
|
document.querySelectorAll(".k-animation-container")
|
|
@@ -927,19 +924,19 @@ function Xe(e) {
|
|
|
927
924
|
debugLines: q,
|
|
928
925
|
digitsOnly: w,
|
|
929
926
|
valid: R,
|
|
930
|
-
validComputed:
|
|
931
|
-
reason:
|
|
932
|
-
validationMessage:
|
|
933
|
-
spanDays:
|
|
934
|
-
month1:
|
|
935
|
-
day1:
|
|
936
|
-
year1:
|
|
937
|
-
month2:
|
|
938
|
-
day2:
|
|
939
|
-
year2:
|
|
927
|
+
validComputed: Y(o),
|
|
928
|
+
reason: Y(m),
|
|
929
|
+
validationMessage: Y(c),
|
|
930
|
+
spanDays: Y(ne),
|
|
931
|
+
month1: Y(a),
|
|
932
|
+
day1: Y(l),
|
|
933
|
+
year1: Y($),
|
|
934
|
+
month2: Y(F),
|
|
935
|
+
day2: Y(V),
|
|
936
|
+
year2: Y(z),
|
|
940
937
|
handleChange: n,
|
|
941
938
|
handleKeyDown: C,
|
|
942
|
-
handleWheel:
|
|
939
|
+
handleWheel: G,
|
|
943
940
|
handleKeyUp: K,
|
|
944
941
|
handleClick: d,
|
|
945
942
|
handleBlur: Z,
|
|
@@ -951,7 +948,7 @@ function Xe(e) {
|
|
|
951
948
|
};
|
|
952
949
|
}
|
|
953
950
|
function Je(e) {
|
|
954
|
-
const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(e.timeFormat ?? "hh:mm AM"), L = h(() => !!e.required), N = J(!1), A = ["ArrowUp", "ArrowDown"],
|
|
951
|
+
const t = J(""), s = J(void 0), U = J(!!e.debug), P = J(e.timeFormat ?? "hh:mm AM"), L = h(() => !!e.required), N = J(!1), A = ["ArrowUp", "ArrowDown"], S = ["ArrowLeft", "ArrowRight"], b = h(() => (t.value ?? "").replace(/\D/g, "")), w = {
|
|
955
952
|
H: /[0-9]/,
|
|
956
953
|
h: /[0-9]/,
|
|
957
954
|
M: /[0-9]/,
|
|
@@ -975,17 +972,17 @@ function Je(e) {
|
|
|
975
972
|
2,
|
|
976
973
|
"0"
|
|
977
974
|
)} ${$}`;
|
|
978
|
-
},
|
|
975
|
+
}, _ = (a) => {
|
|
979
976
|
const l = a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
980
977
|
if (!l) return null;
|
|
981
978
|
const $ = parseInt(l[1]), F = parseInt(l[2]), V = l[3].toUpperCase();
|
|
982
979
|
if ($ < 1 || $ > 12 || F < 0 || F > 59) return null;
|
|
983
|
-
let
|
|
984
|
-
V === "PM" && (
|
|
980
|
+
let z = $ % 12;
|
|
981
|
+
V === "PM" && (z += 12);
|
|
985
982
|
const q = /* @__PURE__ */ new Date();
|
|
986
|
-
return q.setSeconds(0, 0), q.setHours(
|
|
983
|
+
return q.setSeconds(0, 0), q.setHours(z), q.setMinutes(F), q;
|
|
987
984
|
}, X = (a) => {
|
|
988
|
-
if (
|
|
985
|
+
if (b.value.length === 0) {
|
|
989
986
|
e.onChange({ value: null, event: a });
|
|
990
987
|
return;
|
|
991
988
|
}
|
|
@@ -993,7 +990,7 @@ function Je(e) {
|
|
|
993
990
|
e.onChange({ value: null, event: a });
|
|
994
991
|
return;
|
|
995
992
|
}
|
|
996
|
-
const l =
|
|
993
|
+
const l = _(t.value);
|
|
997
994
|
l && o(l) ? e.onChange({ value: l, event: a }) : e.onChange({ value: null, event: a });
|
|
998
995
|
}, ne = (a) => a.getHours() * 60 + a.getMinutes(), o = (a) => {
|
|
999
996
|
const l = e.min ?? void 0, $ = e.max ?? void 0, F = ne(a);
|
|
@@ -1012,7 +1009,7 @@ function Je(e) {
|
|
|
1012
1009
|
}, i = (a, l) => {
|
|
1013
1010
|
e.onChange({ value: a, event: l });
|
|
1014
1011
|
}, c = () => {
|
|
1015
|
-
|
|
1012
|
+
W(() => {
|
|
1016
1013
|
requestAnimationFrame(() => {
|
|
1017
1014
|
requestAnimationFrame(() => {
|
|
1018
1015
|
const a = document.getElementById(
|
|
@@ -1055,15 +1052,15 @@ function Je(e) {
|
|
|
1055
1052
|
try {
|
|
1056
1053
|
const V = s.value ?? 0;
|
|
1057
1054
|
if (I(V) === "ampm" && (t.value ?? "").length >= 8) {
|
|
1058
|
-
const
|
|
1059
|
-
/[Aa]/.test(
|
|
1055
|
+
const z = t.value.charAt(6);
|
|
1056
|
+
/[Aa]/.test(z) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, W(() => {
|
|
1060
1057
|
requestAnimationFrame(() => {
|
|
1061
1058
|
const q = document.getElementById(
|
|
1062
1059
|
e.id
|
|
1063
1060
|
);
|
|
1064
1061
|
q && (q.focus(), q.setSelectionRange(8, 8));
|
|
1065
1062
|
});
|
|
1066
|
-
})) : /[Pp]/.test(
|
|
1063
|
+
})) : /[Pp]/.test(z) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, W(() => {
|
|
1067
1064
|
requestAnimationFrame(() => {
|
|
1068
1065
|
const q = document.getElementById(
|
|
1069
1066
|
e.id
|
|
@@ -1077,16 +1074,16 @@ function Je(e) {
|
|
|
1077
1074
|
X(l);
|
|
1078
1075
|
}, D = (a) => {
|
|
1079
1076
|
s.value = a.target.selectionStart ?? 0;
|
|
1080
|
-
},
|
|
1077
|
+
}, j = (a, l, $) => {
|
|
1081
1078
|
const F = l?.selectionStart ?? s.value ?? 0;
|
|
1082
1079
|
s.value = F;
|
|
1083
|
-
const V = I(F),
|
|
1084
|
-
if (!
|
|
1085
|
-
if ((t.value ?? "").length === 0 ||
|
|
1080
|
+
const V = I(F), z = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1081
|
+
if (!z) {
|
|
1082
|
+
if ((t.value ?? "").length === 0 || b.value.length === 0) {
|
|
1086
1083
|
const u = /* @__PURE__ */ new Date(), p = u.getHours(), x = p >= 12 ? "PM" : "AM";
|
|
1087
1084
|
t.value = R(p, u.getMinutes(), x);
|
|
1088
|
-
const ee =
|
|
1089
|
-
g(ee, $),
|
|
1085
|
+
const ee = _(t.value);
|
|
1086
|
+
g(ee, $), W(() => {
|
|
1090
1087
|
requestAnimationFrame(() => {
|
|
1091
1088
|
const te = document.getElementById(
|
|
1092
1089
|
e.id
|
|
@@ -1097,7 +1094,7 @@ function Je(e) {
|
|
|
1097
1094
|
}
|
|
1098
1095
|
return;
|
|
1099
1096
|
}
|
|
1100
|
-
let q = parseInt(
|
|
1097
|
+
let q = parseInt(z[1]), Q = parseInt(z[2]), ye = z[3].toUpperCase();
|
|
1101
1098
|
if (V === "hh")
|
|
1102
1099
|
a === "ArrowUp" ? q = q < 12 ? q + 1 : 1 : q = q > 1 ? q - 1 : 12;
|
|
1103
1100
|
else if (V === "mm") {
|
|
@@ -1118,8 +1115,8 @@ function Je(e) {
|
|
|
1118
1115
|
2,
|
|
1119
1116
|
"0"
|
|
1120
1117
|
)} ${ye}`;
|
|
1121
|
-
const r =
|
|
1122
|
-
g(r, $),
|
|
1118
|
+
const r = _(t.value);
|
|
1119
|
+
g(r, $), W(() => {
|
|
1123
1120
|
requestAnimationFrame(() => {
|
|
1124
1121
|
const u = document.getElementById(
|
|
1125
1122
|
e.id
|
|
@@ -1140,16 +1137,16 @@ function Je(e) {
|
|
|
1140
1137
|
if (a.altKey) return;
|
|
1141
1138
|
a.preventDefault(), a.stopPropagation();
|
|
1142
1139
|
const l = a.target;
|
|
1143
|
-
|
|
1140
|
+
j(a.key, l, a);
|
|
1144
1141
|
return;
|
|
1145
1142
|
}
|
|
1146
1143
|
}, le = (a) => {
|
|
1147
1144
|
a.preventDefault();
|
|
1148
1145
|
const l = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1149
|
-
|
|
1146
|
+
j(l, a.target, a);
|
|
1150
1147
|
}, n = (a) => {
|
|
1151
1148
|
const l = a.target;
|
|
1152
|
-
if (
|
|
1149
|
+
if (S.includes(a.key)) {
|
|
1153
1150
|
s.value = l?.selectionStart ?? 0;
|
|
1154
1151
|
return;
|
|
1155
1152
|
}
|
|
@@ -1158,7 +1155,7 @@ function Je(e) {
|
|
|
1158
1155
|
s.value = l?.selectionStart ?? 0;
|
|
1159
1156
|
}
|
|
1160
1157
|
}, d = (a) => {
|
|
1161
|
-
N.value = !0, L.value && e.externalValue && e.externalValue.value === void 0 &&
|
|
1158
|
+
N.value = !0, L.value && e.externalValue && e.externalValue.value === void 0 && b.value.length === 0 && (e.externalValue.value = "");
|
|
1162
1159
|
const l = a.target;
|
|
1163
1160
|
l && (s.value = l.selectionStart ?? 0);
|
|
1164
1161
|
};
|
|
@@ -1183,10 +1180,10 @@ function Je(e) {
|
|
|
1183
1180
|
["Minute", M.value],
|
|
1184
1181
|
["Period", T.value],
|
|
1185
1182
|
["Time (24h)", f.value ?? "--:--:--"],
|
|
1186
|
-
["Digits only",
|
|
1183
|
+
["Digits only", b.value],
|
|
1187
1184
|
[
|
|
1188
1185
|
"Parsed Date",
|
|
1189
|
-
|
|
1186
|
+
G.value?.toLocaleDateString("en-US", {
|
|
1190
1187
|
hour: "2-digit",
|
|
1191
1188
|
minute: "2-digit"
|
|
1192
1189
|
}) ?? null
|
|
@@ -1208,27 +1205,27 @@ function Je(e) {
|
|
|
1208
1205
|
["valid", K.value],
|
|
1209
1206
|
["reason", B.value],
|
|
1210
1207
|
["validationMessage", Z.value]
|
|
1211
|
-
]),
|
|
1212
|
-
() =>
|
|
1208
|
+
]), G = h(
|
|
1209
|
+
() => _(t.value) ?? null
|
|
1213
1210
|
), K = h(() => {
|
|
1214
1211
|
if (!L.value) {
|
|
1215
1212
|
if (!y.value) return !0;
|
|
1216
|
-
const l =
|
|
1213
|
+
const l = G.value;
|
|
1217
1214
|
return l ? o(l) : !1;
|
|
1218
1215
|
}
|
|
1219
1216
|
if (!N.value) return !0;
|
|
1220
|
-
const a =
|
|
1217
|
+
const a = G.value;
|
|
1221
1218
|
return !y.value || !a ? !1 : o(a);
|
|
1222
1219
|
}), B = h(() => {
|
|
1223
1220
|
if (!L.value) {
|
|
1224
1221
|
if (!y.value) return;
|
|
1225
|
-
const l =
|
|
1222
|
+
const l = G.value;
|
|
1226
1223
|
return l ? o(l) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1227
1224
|
}
|
|
1228
1225
|
if (!N.value) return;
|
|
1229
|
-
if (
|
|
1226
|
+
if (b.value.length === 0 || !y.value)
|
|
1230
1227
|
return "incomplete";
|
|
1231
|
-
const a =
|
|
1228
|
+
const a = G.value;
|
|
1232
1229
|
return a ? o(a) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1233
1230
|
}), Z = h(() => {
|
|
1234
1231
|
const a = B.value;
|
|
@@ -1248,7 +1245,7 @@ function Je(e) {
|
|
|
1248
1245
|
}
|
|
1249
1246
|
return "";
|
|
1250
1247
|
}), ie = () => {
|
|
1251
|
-
|
|
1248
|
+
W(() => {
|
|
1252
1249
|
const a = document.getElementById(e.id);
|
|
1253
1250
|
if (!a) {
|
|
1254
1251
|
console.warn(`#${e.id} not found for styling.`);
|
|
@@ -1280,17 +1277,17 @@ function Je(e) {
|
|
|
1280
1277
|
debugLines: C,
|
|
1281
1278
|
placeholder: P,
|
|
1282
1279
|
isValid: K,
|
|
1283
|
-
reason:
|
|
1280
|
+
reason: Y(B),
|
|
1284
1281
|
validationMessage: Z,
|
|
1285
1282
|
isComplete: y,
|
|
1286
1283
|
inRangeTime: o,
|
|
1287
1284
|
cursorPos: s,
|
|
1288
|
-
hour:
|
|
1289
|
-
hour24:
|
|
1290
|
-
minute:
|
|
1291
|
-
period:
|
|
1292
|
-
time24:
|
|
1293
|
-
parsedRawTime:
|
|
1285
|
+
hour: Y(E),
|
|
1286
|
+
hour24: Y(O),
|
|
1287
|
+
minute: Y(M),
|
|
1288
|
+
period: Y(T),
|
|
1289
|
+
time24: Y(f),
|
|
1290
|
+
parsedRawTime: Y(G),
|
|
1294
1291
|
handleChange: k,
|
|
1295
1292
|
handleKeyDown: oe,
|
|
1296
1293
|
handleKeyUp: n,
|
|
@@ -1326,7 +1323,7 @@ function Ne(e, t, s) {
|
|
|
1326
1323
|
);
|
|
1327
1324
|
}
|
|
1328
1325
|
const $e = Ce ? window : void 0;
|
|
1329
|
-
function
|
|
1326
|
+
function Se(e) {
|
|
1330
1327
|
var t;
|
|
1331
1328
|
const s = de(e);
|
|
1332
1329
|
return (t = s?.$el) != null ? t : s;
|
|
@@ -1334,28 +1331,28 @@ function be(e) {
|
|
|
1334
1331
|
function Ee(...e) {
|
|
1335
1332
|
const t = [], s = () => {
|
|
1336
1333
|
t.forEach((A) => A()), t.length = 0;
|
|
1337
|
-
}, U = (A,
|
|
1338
|
-
const A = Ae(de(e[0])).filter((
|
|
1339
|
-
return A.every((
|
|
1334
|
+
}, U = (A, S, b, w) => (A.addEventListener(S, b, w), () => A.removeEventListener(S, b, w)), P = h(() => {
|
|
1335
|
+
const A = Ae(de(e[0])).filter((S) => S != null);
|
|
1336
|
+
return A.every((S) => typeof S != "string") ? A : void 0;
|
|
1340
1337
|
}), L = Ne(
|
|
1341
1338
|
() => {
|
|
1342
|
-
var A,
|
|
1339
|
+
var A, S;
|
|
1343
1340
|
return [
|
|
1344
|
-
(
|
|
1341
|
+
(S = (A = P.value) == null ? void 0 : A.map((b) => Se(b))) != null ? S : [$e].filter((b) => b != null),
|
|
1345
1342
|
Ae(de(P.value ? e[1] : e[0])),
|
|
1346
1343
|
Ae(Fe(P.value ? e[2] : e[1])),
|
|
1347
1344
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
1348
1345
|
de(P.value ? e[3] : e[2])
|
|
1349
1346
|
];
|
|
1350
1347
|
},
|
|
1351
|
-
([A,
|
|
1352
|
-
if (s(), !A?.length || !
|
|
1348
|
+
([A, S, b, w]) => {
|
|
1349
|
+
if (s(), !A?.length || !S?.length || !b?.length)
|
|
1353
1350
|
return;
|
|
1354
1351
|
const I = Ke(w) ? { ...w } : w;
|
|
1355
1352
|
t.push(
|
|
1356
1353
|
...A.flatMap(
|
|
1357
|
-
(E) =>
|
|
1358
|
-
(M) =>
|
|
1354
|
+
(E) => S.flatMap(
|
|
1355
|
+
(M) => b.map((T) => U(E, M, T, I))
|
|
1359
1356
|
)
|
|
1360
1357
|
)
|
|
1361
1358
|
);
|
|
@@ -1367,7 +1364,7 @@ function Ee(...e) {
|
|
|
1367
1364
|
return Ue(s), N;
|
|
1368
1365
|
}
|
|
1369
1366
|
let Me = !1;
|
|
1370
|
-
function
|
|
1367
|
+
function He(e, t, s = {}) {
|
|
1371
1368
|
const { window: U = $e, ignore: P = [], capture: L = !0, detectIframe: N = !1, controls: A = !1 } = s;
|
|
1372
1369
|
if (!U)
|
|
1373
1370
|
return A ? { stop: ve, cancel: ve, trigger: ve } : ve;
|
|
@@ -1376,12 +1373,12 @@ function Ye(e, t, s = {}) {
|
|
|
1376
1373
|
const f = { passive: !0 };
|
|
1377
1374
|
Array.from(U.document.body.children).forEach((y) => y.addEventListener("click", ve, f)), U.document.documentElement.addEventListener("click", ve, f);
|
|
1378
1375
|
}
|
|
1379
|
-
let
|
|
1380
|
-
const
|
|
1376
|
+
let S = !0;
|
|
1377
|
+
const b = (f) => de(P).some((y) => {
|
|
1381
1378
|
if (typeof y == "string")
|
|
1382
1379
|
return Array.from(U.document.querySelectorAll(y)).some((R) => R === f.target || f.composedPath().includes(R));
|
|
1383
1380
|
{
|
|
1384
|
-
const R =
|
|
1381
|
+
const R = Se(y);
|
|
1385
1382
|
return R && (f.target === R || f.composedPath().includes(R));
|
|
1386
1383
|
}
|
|
1387
1384
|
});
|
|
@@ -1390,14 +1387,14 @@ function Ye(e, t, s = {}) {
|
|
|
1390
1387
|
return y && y.$.subTree.shapeFlag === 16;
|
|
1391
1388
|
}
|
|
1392
1389
|
function I(f, y) {
|
|
1393
|
-
const R = de(f),
|
|
1394
|
-
return
|
|
1390
|
+
const R = de(f), _ = R.$.subTree && R.$.subTree.children;
|
|
1391
|
+
return _ == null || !Array.isArray(_) ? !1 : _.some((X) => X.el === y.target || y.composedPath().includes(X.el));
|
|
1395
1392
|
}
|
|
1396
1393
|
const E = (f) => {
|
|
1397
|
-
const y =
|
|
1394
|
+
const y = Se(e);
|
|
1398
1395
|
if (f.target != null && !(!(y instanceof Element) && w(e) && I(e, f)) && !(!y || y === f.target || f.composedPath().includes(y))) {
|
|
1399
|
-
if ("detail" in f && f.detail === 0 && (
|
|
1400
|
-
|
|
1396
|
+
if ("detail" in f && f.detail === 0 && (S = !b(f)), !S) {
|
|
1397
|
+
S = !0;
|
|
1401
1398
|
return;
|
|
1402
1399
|
}
|
|
1403
1400
|
t(f);
|
|
@@ -1411,13 +1408,13 @@ function Ye(e, t, s = {}) {
|
|
|
1411
1408
|
}, 0), E(f));
|
|
1412
1409
|
}, { passive: !0, capture: L }),
|
|
1413
1410
|
Ee(U, "pointerdown", (f) => {
|
|
1414
|
-
const y =
|
|
1415
|
-
|
|
1411
|
+
const y = Se(e);
|
|
1412
|
+
S = !b(f) && !!(y && !f.composedPath().includes(y));
|
|
1416
1413
|
}, { passive: !0 }),
|
|
1417
1414
|
N && Ee(U, "blur", (f) => {
|
|
1418
1415
|
setTimeout(() => {
|
|
1419
1416
|
var y;
|
|
1420
|
-
const R =
|
|
1417
|
+
const R = Se(e);
|
|
1421
1418
|
((y = U.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !R?.contains(U.document.activeElement) && t(f);
|
|
1422
1419
|
}, 0);
|
|
1423
1420
|
}, { passive: !0 })
|
|
@@ -1425,10 +1422,10 @@ function Ye(e, t, s = {}) {
|
|
|
1425
1422
|
return A ? {
|
|
1426
1423
|
stop: O,
|
|
1427
1424
|
cancel: () => {
|
|
1428
|
-
|
|
1425
|
+
S = !1;
|
|
1429
1426
|
},
|
|
1430
1427
|
trigger: (f) => {
|
|
1431
|
-
|
|
1428
|
+
S = !0, E(f), S = !1;
|
|
1432
1429
|
}
|
|
1433
1430
|
} : O;
|
|
1434
1431
|
}
|
|
@@ -1447,8 +1444,8 @@ function Qe(e) {
|
|
|
1447
1444
|
initialFocus: () => P(t.value),
|
|
1448
1445
|
...e.focusTrapOptions ?? {}
|
|
1449
1446
|
});
|
|
1450
|
-
let A = null,
|
|
1451
|
-
const
|
|
1447
|
+
let A = null, S = J(null);
|
|
1448
|
+
const b = () => {
|
|
1452
1449
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1453
1450
|
const w = (E, M) => {
|
|
1454
1451
|
const T = Array.from(E.querySelectorAll(M));
|
|
@@ -1468,26 +1465,26 @@ function Qe(e) {
|
|
|
1468
1465
|
}
|
|
1469
1466
|
return null;
|
|
1470
1467
|
};
|
|
1471
|
-
return
|
|
1472
|
-
|
|
1468
|
+
return He(t, (w) => {
|
|
1469
|
+
S.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", w);
|
|
1473
1470
|
}), ge(
|
|
1474
1471
|
() => e.isOpen.value,
|
|
1475
1472
|
(w) => {
|
|
1476
|
-
w ? (
|
|
1477
|
-
const I =
|
|
1473
|
+
w ? (S.value = null, W(() => {
|
|
1474
|
+
const I = b();
|
|
1478
1475
|
I && (t.value = I, setTimeout(() => L(), 0), A || (A = (E) => {
|
|
1479
|
-
E.key === "Escape" && (
|
|
1476
|
+
E.key === "Escape" && (S.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", E));
|
|
1480
1477
|
}, document.addEventListener("keydown", A, !0)));
|
|
1481
|
-
})) : (N(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null,
|
|
1478
|
+
})) : (N(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, S.value === "outside" && W(() => {
|
|
1482
1479
|
const I = () => {
|
|
1483
1480
|
const E = e.triggerEl?.value, M = E?.querySelector("input"), T = document.activeElement;
|
|
1484
1481
|
T && (T === M || E && E.contains(T)) && (M ?? E)?.blur?.();
|
|
1485
1482
|
};
|
|
1486
1483
|
requestAnimationFrame(() => setTimeout(I, 0));
|
|
1487
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
1484
|
+
}), e.returnFocusToTrigger !== !1 && S.value === "escape" && e.triggerEl?.value && (console.log(
|
|
1488
1485
|
"Returning focus to trigger element:",
|
|
1489
1486
|
e.triggerEl.value
|
|
1490
|
-
),
|
|
1487
|
+
), W(() => {
|
|
1491
1488
|
const I = () => {
|
|
1492
1489
|
const E = e.triggerEl?.value;
|
|
1493
1490
|
if (!E) return;
|
|
@@ -1500,11 +1497,11 @@ function Qe(e) {
|
|
|
1500
1497
|
popupRef: t,
|
|
1501
1498
|
activate: L,
|
|
1502
1499
|
deactivate: N,
|
|
1503
|
-
lastCloseReason:
|
|
1500
|
+
lastCloseReason: Y(S),
|
|
1504
1501
|
setPopupEl: (w) => t.value = w
|
|
1505
1502
|
};
|
|
1506
1503
|
}
|
|
1507
|
-
const
|
|
1504
|
+
const Ye = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), We = (e) => !!e && typeof e == "object" && "field" in e, Pe = (e, t) => !e || typeof e != "object" ? !1 : Ye(e) ? e.filters.some(
|
|
1508
1505
|
(s) => Pe(s, t)
|
|
1509
1506
|
) : We(e) ? e.field === t : !1, Ze = (e) => {
|
|
1510
1507
|
const t = J({}), s = (P) => !e.value || !e.value.filters ? !1 : e.value.filters.some(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(te,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):(te=typeof globalThis<"u"?globalThis:te||self,t(te.FeatherKComposables={},te.Vue,te.useFocusTrap))})(this,(function(te,t,xe){"use strict";const Me=(e,n)=>{const c=t.ref(null);let U=!1,$=null,I=null;const N=[],A=".k-table-row[data-grid-row-index] [tabindex]",b=l=>l.key==="Enter"||l.code==="Enter"||l.code==="NumpadEnter",S=()=>e?.value?.columns,w=l=>{const y=l.key||l.code;([" ","Spacebar","Space"].includes(y)||b(l))&&(l.preventDefault(),l.stopPropagation(),c.value=l.target,l.target.click())},P=l=>{if(!c.value)return;if(l.code==="Escape"){l.stopPropagation(),c.value&&c.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),s=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(s){if(l.code==="Tab"){const d=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],g=n?.focusableMenuSelectors??d,h=Array.from(s.querySelectorAll(g.join(",")));if(h.length===0)return;const k=h.findIndex(H=>H===document.activeElement);let D;k===-1?D=0:l.shiftKey?D=(k-1+h.length)%h.length:D=(k+1)%h.length,l.preventDefault(),l.stopPropagation(),h[D]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const d=y.findIndex(h=>h===document.activeElement);let g=d;l.code==="ArrowUp"?g=d>0?d-1:y.length-1:l.code==="ArrowDown"&&(g=d<y.length-1?d+1:0),y[g]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const d=c.value?.parentElement;(l.shiftKey?d?.previousElementSibling:d?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},E=()=>{$=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(s=>{if(s.nodeType===Node.ELEMENT_NODE){const d=s;if(d.classList.contains("k-animation-container")){const h=c.value;h&&(h.dataset.featherKSortable==="true"||t.nextTick(()=>{d.querySelectorAll(".k-columnmenu-item-wrapper").forEach(H=>{H.textContent?.toLowerCase().includes("sort")&&H.remove()})})),d.addEventListener("keydown",P),t.nextTick(()=>{const k=()=>{const D=Array.from(d.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(D.length===1)D[0].focus(),D[0].click(),k.attempts=0;else if(D.length>1){k.attempts=0;return}else k.attempts===void 0&&(k.attempts=0),k.attempts++<3&&setTimeout(k,200)};k()})}d.querySelectorAll(".k-animation-container").forEach(h=>{h.addEventListener("keydown",P)})}}),y.removedNodes.forEach(s=>{if(s.nodeType===Node.ELEMENT_NODE){const d=s;d.classList.contains("k-animation-container")&&d.removeEventListener("keydown",P),d.querySelectorAll(".k-animation-container").forEach(h=>{h.removeEventListener("keydown",P)})}})})}),$.observe(document.body,{childList:!0,subtree:!0})},M=l=>{const y=l.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(y)||l.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},F=l=>{if(!l.type||!l)return;const y=l.target;if(y&&!M(y)){if(l.code==="Escape"){const s=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(s){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{}s.setAttribute("tabindex","0"),s.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(l.code)){if(y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){c.value=y;return}const s=y.closest(".k-table-row[data-grid-row-index]");if(s){if(["ArrowDown","ArrowUp"].includes(l.code)){l.preventDefault(),l.stopPropagation();const d=(h,k)=>{let D=k==="next"?h.nextElementSibling:h.previousElementSibling;for(;D;){const H=D;try{if(H.classList.contains("k-table-row"))return H}catch{}D=k==="next"?D.nextElementSibling:D.previousElementSibling}return null},g=l.code==="ArrowDown"?d(s,"next"):d(s,"previous");g&&(s.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault(),l.stopPropagation();const d=s.querySelectorAll(A);if(d.length===0)return;let g=Array.from(d).findIndex(h=>h===document.activeElement);if(g===-1&&document.activeElement===s){d[0].focus();return}l.code==="ArrowRight"?g=g===d.length-1?0:g+1:l.code==="ArrowLeft"&&(g=g===d.length-1?g-1:d.length-1),d[g].focus();return}}}}},O=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},p=()=>{if(!I)try{const l=()=>{try{const d=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!d||d.length===0||d.filter(k=>k.getAttribute("tabindex")==="0").length===1)return;const h=d.find(k=>k===document.activeElement||k.contains(document.activeElement));if(d.forEach(k=>k.setAttribute("tabindex","-1")),h){h.setAttribute("tabindex","0");return}d[0].setAttribute("tabindex","0")}catch(d){console.error("ensureSingleTabindex error:",d)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((d,g)=>{d.setAttribute("tabindex",g===0?"0":"-1")});const s=e.value.$el.querySelector(".k-table-tbody");s&&(I=new MutationObserver(()=>{l()}),I.observe(s,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},v=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(s=>{s.setAttribute("role","button"),s.addEventListener("keydown",w)}),E(),W()})},R=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(s=>{s.removeEventListener("keydown",w)}),$&&($.disconnect(),$=null),I&&(I.disconnect(),I=null),N.forEach(s=>s()),N.length=0},W=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((s,d)=>{const g=s.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!g)return;const h=S();if(h&&h[d]){const r=h[d].field??"";s.setAttribute("data-feather-k-field",r),s.setAttribute("data-feather-k-filterable",h[d].filterable===!1?"false":"true"),s.setAttribute("data-feather-k-sortable",h[d].sortable===!1?"false":"true")}const k=s.dataset.featherKFilterable!=="false",D=s.dataset.featherKSortable!=="false";g.setAttribute("tabindex","-1"),k||D?s.style.cursor="pointer":s.style.cursor="default",k?(s.setAttribute("tabindex","0"),s.setAttribute("role","button"),s.setAttribute("aria-haspopup","menu")):(s.setAttribute("tabindex","0"),s.setAttribute("role","columnheader"),s.removeAttribute("aria-haspopup"));const H=r=>{r.target?.closest(".k-column-resizer")||(c.value=s,g.click())},re=r=>{if(k)c.value=s,r.preventDefault(),r.stopPropagation(),H(r);else if(D){c.value=s;const f=new KeyboardEvent("keydown",{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0});s.dispatchEvent(f)}};s.addEventListener("click",re),N.push(()=>{s.removeEventListener("click",re)});const oe=r=>{if((b(r)||r.code==="Space")&&(k||D)){if(c.value=s,c.value.focus(),k)r.preventDefault(),r.stopPropagation(),H(r);else if(D){const f=s.querySelector(".k-link");f&&f.click()}}};s.addEventListener("keydown",oe,!0),N.push(()=>{s.removeEventListener("keydown",oe,!0)})});const y=document.querySelector(".k-grid-header .k-table-thead");if(y){const s=d=>{const g=d.target.closest("th");g&&(b(d)||d.code==="Space")&&g.dataset.featherKFilterable==="false"&&g.dataset.featherKSortable==="false"&&(d.preventDefault(),d.stopImmediatePropagation())};y.addEventListener("keydown",s,!0),N.push(()=>{y.removeEventListener("keydown",s,!0)})}},_=function(l,y){const s=l?.event?.event.target,d=S();if(!s||!d)return;const g=s.classList.contains("k-link"),h=s.classList.contains("k-columnmenu-item"),k=d.find(D=>D.field===l?.event?.field)?.sortable&&!0;if(!g){if(h&&!k){l?.event?.sort?.filter(H=>H.field!==l?.event?.field);return}typeof y=="function"&&t.nextTick(()=>{c.value&&c.value.focus(),y(l)})}},Z=()=>{if(!U)try{O(),p(),v(),U=!0}catch(l){console.error("initA11y failed:",l),R()}};return t.onBeforeUnmount(()=>{R()}),{activeFilterButton:c,handleGridKeyDown:F,handleSortChange:_,initA11y:Z}};function Te(e){const n=t.ref(""),c=t.ref(void 0),U=t.ref(!!e.debug),$=t.ref(e.dateFormat??"mm/dd/yyyy"),I=t.computed(()=>!!e.required),N=t.ref(!1),A=["ArrowUp","ArrowDown"],b=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),w=r=>r<=2?"mm":r<=5?"dd":S.value.length<=10?"yyyy":"mm",P=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),E=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),M=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),F=r=>{if(S.value.length===0){e.onChange({value:null,event:r});return}if(S.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&S.value.length===8){const[f,T,j]=n.value.split("/"),V=parseInt(f),K=parseInt(T),X=parseInt(j);if(W(X,V,K)){const ae=new Date(X,V-1,K);O(ae)?e.onChange({value:ae,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},O=r=>{const f=e.min??void 0,T=e.max??void 0;return!(f&&r<f||T&&r>T)},p=t.computed(()=>{if((n.value??"").length===10&&S.value.length===8){const[r,f,T]=(n.value??"").split("/"),j=parseInt(r),V=parseInt(f),K=parseInt(T);if(W(K,j,V))return new Date(K,j-1,V)}return null}),v=t.computed(()=>(n.value??"").length===10&&S.value.length===8),R=(r,f)=>new Date(r,f,0).getDate(),W=(r,f,T)=>f>=1&&f<=12&&r>=1900&&T>=1&&T<=R(r,f),_=r=>{n.value=r.value;const f=r.event?.target;c.value=f?.selectionStart??0,F(r)},Z=r=>{c.value=r.target.selectionStart??0},l=(r,f,T)=>{const j=f?.selectionStart??c.value??0;c.value=j;let V=parseInt(P.value),K=parseInt(E.value),X=parseInt(M.value);if(!(S.value.length>=8)||!W(X,V,K)){const G=e.defaultValue??new Date;V=G.getMonth()+1,K=G.getDate(),X=G.getFullYear(),n.value=`${String(V).padStart(2,"0")}/${String(K).padStart(2,"0")}/${String(X)}`;const q=new Date(X,V-1,K);e.onChange({value:O(q)?q:null,event:T}),h({useRAF:!0});return}const a=w(j);if(a==="mm")V=r==="ArrowUp"?V<12?V+1:1:V>1?V-1:12;else if(a==="dd"){const G=new Date(X,V,0).getDate();K=r==="ArrowUp"?K<G?K+1:1:K>1?K-1:G}else a==="yyyy"&&(X=r==="ArrowUp"?X+1:Math.max(1,X-1));n.value=`${String(V).padStart(2,"0")}/${String(K).padStart(2,"0")}/${String(X)}`;const[i,C,L]=n.value.split("/"),B=new Date(parseInt(L),parseInt(i)-1,parseInt(C));B.toString()!=="Invalid Date"&&parseInt(L)>=1e3?e.onChange({value:O(B)?B:null,event:T}):e.onChange({value:null,event:T}),h({useRAF:!0})},y=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(A.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const f=r.target;l(r.key,f,r);return}},s=r=>{r.preventDefault();const f=r.deltaY<0?"ArrowUp":"ArrowDown";l(f,r.target,r)},d=r=>{const f=r.target;if(b.includes(r.key)){c.value=f?.selectionStart??0;return}if(A.includes(r.key)){if(r.altKey)return;c.value=f?.selectionStart??0}},g=r=>{N.value=!0,I.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const f=r.target;f&&(c.value=f.selectionStart??0)},h=r=>{const f=()=>{const T=document.getElementById(e.id);if(!T)return;const j=r?.pos??c.value??T.value.length;try{T.focus(),T.setSelectionRange(j,j)}catch{}};t.nextTick(()=>{if(r?.delay&&r.delay>0){setTimeout(f,r.delay);return}if(r?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const f=new Date(r);if(f.toString()!=="Invalid Date"){const T=(f.getMonth()+1).toString().padStart(2,"0"),j=f.getDate().toString().padStart(2,"0"),V=f.getFullYear().toString();n.value=`${T}/${j}/${V}`,h({delay:50});return}}},{immediate:!0});const k=t.computed(()=>[["Date",`${P.value} / ${E.value} / ${M.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]]),D=t.computed(()=>{if(!I.value){if(!v.value)return!0;const f=p.value;return f?O(f):!1}if(!N.value)return!0;const r=p.value;return!v.value||!r?!1:O(r)}),H=t.computed(()=>{if(!I.value){if(!v.value)return;const f=p.value;return f?O(f)?"valid":"out-of-bounds":"invalid-date"}if(!N.value)return;if(S.value.length===0||!v.value)return"incomplete";const r=p.value;return r?O(r)?"valid":"out-of-bounds":"invalid-date"}),re=t.computed(()=>{const r=H.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="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,T=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(f&&T)return`Must be between ${f} and ${T}.`;if(f)return`Must be on or after ${f}.`;if(T)return`Must be on or before ${T}.`}return""}),oe=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=r.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const T=f.parentElement;if(T){if(T.classList.contains("fk-datepicker"))return;T.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{oe()}),{raw:n,cursorPos:c,debugEnabled:U,debugLines:k,placeholder:$,isValid:D,reason:t.readonly(H),validationMessage:re,digitsOnly:S,month:t.readonly(P),day:t.readonly(E),year:t.readonly(M),datePart:w,handleChange:_,handleKeyDown:y,handleWheel:s,handleKeyUp:d,handleClick:Z,handleBlur:g,initStyling:oe}}function Ce(e){const n=t.ref(""),c=t.ref(void 0),U=t.ref(!!e.debug),$=t.ref(!1),I=1440*60*1e3,N=365*I,A=new Date,b=new Date(A.getTime()-N),S=new Date(A.getTime()+N);e.min=e.min??b,e.max=e.max??S;const w=t.computed(()=>(n.value??"").replace(/\D/g,"")),P=(o,u)=>new Date(o,u,0).getDate(),E=(o,u,m)=>u>=1&&u<=12&&o>=1e3&&m>=1&&m<=P(o,u),M=o=>Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()),F=o=>{if(!o)return null;const u=e.min??new Date(Date.now()-90*I),m=e.max??new Date,x=M(o);return x<M(u)||x>M(m)?null:o},O=(o,u)=>e.allowReverse??!1?!0:o<=u,p=t.computed(()=>(n.value?.length??0)>=23&&w.value.length>=16),v=o=>{if((o??"").length<23||w.value.length<16)return{start:null,end:null};const u=o.substring(0,10),m=o.substring(13,23),[x,J,Q]=u.split("/").map(se=>parseInt(se||"0",10)),[ie,ce,de]=m.split("/").map(se=>parseInt(se||"0",10)),fe=new Date(Q,x-1,J),ye=new Date(de,ie-1,ce),be=E(Q,x,J)&&fe.toString()!=="Invalid Date",Se=E(de,ie,ce)&&ye.toString()!=="Invalid Date";return{start:be?fe:null,end:Se?ye:null}},R=e.externalValid??t.ref(!0),W=t.computed(()=>v(n.value)),_=t.computed(()=>{const o=F(W.value.start),u=F(W.value.end);return{start:o,end:u}}),Z=t.computed(()=>{if(!p.value)return;const o=_.value.start,u=_.value.end;if(!o||!u)return;const m=Math.abs(M(u)-M(o));return Math.round(m/864e5+1)}),l=t.computed(()=>{if(!p.value)return!1;const{start:o,end:u}=W.value;if(!o||!u||!_.value.start||!_.value.end)return!1;const m=_.value.start,x=_.value.end;return!(!O(m,x)||typeof e.maxSpanDays=="number"&&Z.value!==void 0&&Z.value>e.maxSpanDays)}),y=t.computed(()=>{const{start:o,end:u}=W.value;if(!p.value)return"incomplete";if(!o||!u)return"invalid-date";if(!_.value.start||!_.value.end)return"out-of-bounds";const m=_.value.start,x=_.value.end;return O(m,x)?typeof e.maxSpanDays=="number"&&Z.value!==void 0&&Z.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),s=t.ref(void 0),d=t.computed(()=>{if(R.value!==!1)return"";const{min:o,max:u}=e,m=s.value;if(!m)return"";switch(m){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 o&&u?`Dates must be between ${D(o)} and ${D(u)}.`:"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.";default:return""}}),g=["ArrowUp","ArrowDown"],h=["ArrowLeft","ArrowRight"],k=(o,u)=>String(o).padStart(u,"0"),D=o=>`${k(o.getMonth()+1,2)}/${k(o.getDate(),2)}/${k(o.getFullYear(),4)}`,H=o=>o<=2?{side:"start",part:"mm"}:o<=5?{side:"start",part:(o<=3,"dd")}:o<=11?{side:"start",part:"yyyy"}:o<=15?{side:"end",part:"mm"}:o<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},re=(o,u,m)=>{const x=u?.selectionStart??c.value??0;c.value=x;const{start:J,end:Q}=v(n.value);if(!J&&!Q){const Y=new Date,le=D(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const ee=document.getElementById(e.id),ne=c.value??0;ee&&(ee.focus(),ee.setSelectionRange(ne,ne))})});return}const ie=new Date,ce=H(x);let de=J?new Date(J):new Date(ie),fe=Q?new Date(Q):new Date(ie);const ye=(Y,le)=>{if(le==="mm"){const ee=Y.getMonth()+1,ne=o==="ArrowUp"?ee<12?ee+1:1:ee>1?ee-1:12;Y.setMonth(ne-1);const ge=P(Y.getFullYear(),ne);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const ee=P(Y.getFullYear(),Y.getMonth()+1),ne=Y.getDate(),ge=o==="ArrowUp"?ne<ee?ne+1:1:ne>1?ne-1:ee;Y.setDate(ge)}else if(le==="yyyy"){const ee=Y.getFullYear();Y.setFullYear(o==="ArrowUp"?ee+1:Math.max(1,ee-1));const ne=P(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>ne&&Y.setDate(ne)}};ce.side==="start"?ye(de,ce.part):ye(fe,ce.part);const be=D(de),Se=D(fe);n.value=`${be} - ${Se}`;const se=F(de),we=F(fe);se&&we&&O(se,we)?e.onChange({value:{start:se,end:we},event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=c.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},oe=o=>{const{start:u,end:m}=v(n.value);if(!u||!m){e.onChange({value:null,event:o});return}const x=F(u),J=F(m);if(!x||!J){e.onChange({value:null,event:o});return}if(!O(x,J)){e.onChange({value:null,event:o});return}e.onChange({value:{start:x,end:J},event:o})},r=o=>{const u=o.value??"",m=o.event;if(!u&&m&&m.type==="click"){ae(m);return}n.value=u;const x=m?.target;c.value=x?.selectionStart??0,oe(o)},f=o=>{c.value=o.target.selectionStart??0},T=o=>{if(o.code==="Space"||o.key===" "){o.preventDefault(),o.stopPropagation(),e.onShowCalendar(o);return}if(o.key==="ArrowDown"&&o.altKey){o.preventDefault(),o.stopPropagation(),e.onShowCalendar(o);return}if(g.includes(o.key)){o.preventDefault(),o.stopPropagation();const u=o.target;re(o.key,u,o);return}},j=o=>{o.preventDefault();const u=o.deltaY<0?"ArrowUp":"ArrowDown";re(u,o.target,o)},V=o=>{if(h.includes(o.key)||g.includes(o.key)){const u=o.target;c.value=u?.selectionStart??0}},K=()=>{s.value=y.value,(e.manageValid??!0)&&(R.value=l.value)},X=o=>{K()},ae=o=>{console.log("Clear event:",o),n.value="",c.value=0,e.onChange({value:null,event:o}),K(),t.nextTick(()=>{const u=document.getElementById(e.id);u&&(u.focus(),u.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,o=>{const u=o?.start??null,m=o?.end??null;if(u&&m){if(n.value=`${D(u)} - ${D(m)}`,e.isOpen?.value&&$.value&&e.onRequestClose){const x=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),$.value=!1,K()},x)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),i=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),C=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),L=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),B=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),G=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),q=t.computed(()=>{const{start:o,end:u}=v(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(a.value).padStart(2,"0")} / ${String(i.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(L.value).padStart(2,"0")} / ${String(B.value).padStart(2,"0")} / ${String(G.value).padStart(4,"0")}`},{label:"Digits only",value:w.value},{label:"Mask complete",value:`${p.value}`},{label:"Parsed",value:`${o?o.toDateString():"-"} | ${u?u.toDateString():"-"}`},{label:"Valid (managed)",value:`${R.value??"-"}`},{label:"Span (days)",value:`${Z.value??"-"}`},{label:"Reason",value:`${y.value??"-"}`},{label:"Cursor in",value:`${c.value??"-"} (${(()=>{const m=c.value??0,x=H(m);return`${x.side}.${x.part}`})()})`}]}),z=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const u=o.closest("div");if(!u){console.warn(`Parent div of #${e.id} not found for styling.`);return}u.classList.contains("fk-daterangepicker")||u.classList.add("fk-daterangepicker")})};t.onMounted(()=>{z()});const me=()=>{t.nextTick(()=>{try{const o=Array.from(document.querySelectorAll(".k-animation-container"));if(!o.length)return;const m=[...o].reverse().find(Q=>Q.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!m)return;const x=m.querySelectorAll(".k-calendar-table");let J=!1;x.forEach(Q=>{Q.tabIndex===0&&(J?Q.tabIndex=-1:J=!0)})}catch(o){console.warn(o)}})};return e.isOpen&&t.watch(e.isOpen,o=>{o&&setTimeout(()=>me(),0)},{immediate:!1}),{raw:n,cursorPos:c,debugEnabled:U,debugLines:q,digitsOnly:w,valid:R,validComputed:t.readonly(l),reason:t.readonly(y),validationMessage:t.readonly(d),spanDays:t.readonly(Z),month1:t.readonly(a),day1:t.readonly(i),year1:t.readonly(C),month2:t.readonly(L),day2:t.readonly(B),year2:t.readonly(G),handleChange:r,handleKeyDown:T,handleWheel:j,handleKeyUp:V,handleClick:f,handleBlur:X,handleClear:ae,onCalendarChange:()=>{$.value=!0},initStyling:z}}function $e(e){const n=t.ref(""),c=t.ref(void 0),U=t.ref(!!e.debug),$=t.ref(e.timeFormat??"hh:mm AM"),I=t.computed(()=>!!e.required),N=t.ref(!1),A=["ArrowUp","ArrowDown"],b=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),w={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},P=a=>a<=2?"hh":a<=5?"mm":"ampm",E=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",i=parseInt(a);return Math.min(Math.max(i,0),23)}),M=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",i=parseInt(a);return Math.min(Math.max(i,0),59)}),F=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),O=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),i=F.value;return a===12?i==="AM"?0:12:i==="PM"?a+12:a}),p=t.computed(()=>v.value?`${String(O.value).padStart(2,"0")}:${String(M.value).padStart(2,"0")}:00`:null),v=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),R=(a,i,C)=>{let L=a%12;return L===0&&(L=12),`${String(L).padStart(2,"0")}:${String(i).padStart(2,"0")} ${C}`},W=a=>{const i=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!i)return null;const C=parseInt(i[1]),L=parseInt(i[2]),B=i[3].toUpperCase();if(C<1||C>12||L<0||L>59)return null;let G=C%12;B==="PM"&&(G+=12);const q=new Date;return q.setSeconds(0,0),q.setHours(G),q.setMinutes(L),q},_=a=>{if(S.value.length===0){e.onChange({value:null,event:a});return}if(!v.value){e.onChange({value:null,event:a});return}const i=W(n.value);i&&l(i)?e.onChange({value:i,event:a}):e.onChange({value:null,event:a})},Z=a=>a.getHours()*60+a.getMinutes(),l=a=>{const i=e.min??void 0,C=e.max??void 0,L=Z(a);if(i){const B=Z(i);if(L<B)return!1}if(C){const B=Z(C);if(L>B)return!1}return!0},y=a=>{const i=a.getHours(),C=i>=12?"PM":"AM";n.value=R(i,a.getMinutes(),C)},s=(a,i)=>{e.onChange({value:a,event:i})},d=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const i=(a.value??"").length;a.setSelectionRange(i,i)}})})})},g=a=>{const i=a?.event?.target;return i?i.closest(".k-time-now")?"now":i.closest(".k-time-accept")?"set":null:null},h=(a,i)=>{a&&l(a)?s(a,i):s(null,i)},k=(...a)=>{const i=a[0];if(!i)return;const C=g(i);if(C==="now"){const B=new Date;y(B),h(B,i),d();return}if(i?.value instanceof Date){const B=new Date(i.value);y(B),h(B,i),C==="set"&&d();return}if(i?.value===null){n.value="",s(null,i);return}n.value=i.value;const L=i.event?.target;c.value=L?.selectionStart??0;try{const B=c.value??0;if(P(B)==="ampm"&&(n.value??"").length>=8){const G=n.value.charAt(6);/[Aa]/.test(G)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const q=document.getElementById(e.id);q&&(q.focus(),q.setSelectionRange(8,8))})})):/[Pp]/.test(G)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const q=document.getElementById(e.id);q&&(q.focus(),q.setSelectionRange(8,8))})}))}}catch{}_(i)},D=a=>{c.value=a.target.selectionStart??0},H=(a,i,C)=>{const L=i?.selectionStart??c.value??0;c.value=L;const B=P(L),G=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!G){if((n.value??"").length===0||S.value.length===0){const u=new Date,m=u.getHours(),x=m>=12?"PM":"AM";n.value=R(m,u.getMinutes(),x);const J=W(n.value);h(J,C),t.nextTick(()=>{requestAnimationFrame(()=>{const Q=document.getElementById(e.id),ie=c.value??0;Q&&(Q.focus(),Q.setSelectionRange(ie,ie))})})}return}let q=parseInt(G[1]),z=parseInt(G[2]),me=G[3].toUpperCase();if(B==="hh")a==="ArrowUp"?q=q<12?q+1:1:q=q>1?q-1:12;else if(B==="mm"){const u=e.minuteStepRef?.value??e.minuteStep??1;if(u===1)a==="ArrowUp"?z=z<59?z+1:0:z=z>0?z-1:59;else if(a==="ArrowUp"){const m=z%u;let x=m===0?z+u:z+(u-m);x>=60&&(x=0),z=x}else{const m=z%u;let x=m===0?z-u:z-m;x<0&&(x=60-u),z=x}}else B==="ampm"&&(me=me==="AM"?"PM":"AM");n.value=`${String(q).padStart(2,"0")}:${String(z).padStart(2,"0")} ${me}`;const o=W(n.value);h(o,C),t.nextTick(()=>{requestAnimationFrame(()=>{const u=document.getElementById(e.id),m=c.value??0;u&&(u.focus(),u.setSelectionRange(m,m))})})},re=a=>{if(a.code==="Space"||a.key===" "){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(a.key==="ArrowDown"&&a.altKey){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const i=a.target;H(a.key,i,a);return}},oe=a=>{a.preventDefault();const i=a.deltaY<0?"ArrowUp":"ArrowDown";H(i,a.target,a)},r=a=>{const i=a.target;if(b.includes(a.key)){c.value=i?.selectionStart??0;return}if(A.includes(a.key)){if(a.altKey)return;c.value=i?.selectionStart??0}},f=a=>{N.value=!0,I.value&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const i=a.target;i&&(c.value=i.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const i=new Date(a);if(i.toString()!=="Invalid Date"){const C=i.getHours(),L=C>=12?"PM":"AM";n.value=R(C,i.getMinutes(),L);return}}},{immediate:!0});const T=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",O.value],["Minute",M.value],["Period",F.value],["Time (24h)",p.value??"--:--:--"],["Digits only",S.value],["Parsed Date",j.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",V.value],["reason",K.value],["validationMessage",X.value]]),j=t.computed(()=>W(n.value)??null),V=t.computed(()=>{if(!I.value){if(!v.value)return!0;const i=j.value;return i?l(i):!1}if(!N.value)return!0;const a=j.value;return!v.value||!a?!1:l(a)}),K=t.computed(()=>{if(!I.value){if(!v.value)return;const i=j.value;return i?l(i)?"valid":"out-of-bounds":"invalid-time"}if(!N.value)return;if(S.value.length===0||!v.value)return"incomplete";const a=j.value;return a?l(a)?"valid":"out-of-bounds":"invalid-time"}),X=t.computed(()=>{const a=K.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${$.value} format.`;const i={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",i):null,L=e.max?e.max.toLocaleTimeString("en-US",i):null;if(a==="out-of-bounds"){if(C&&L)return`Must be between ${C} and ${L}.`;if(C)return`Must be ${C} or later.`;if(L)return`Must be ${L} or earlier.`}return""}),ae=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const i=a.closest(".k-timepicker");if(!i){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=i.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return t.onMounted(()=>{ae()}),{raw:n,rules:w,debugEnabled:U,debugLines:T,placeholder:$,isValid:V,reason:t.readonly(K),validationMessage:X,isComplete:v,inRangeTime:l,cursorPos:c,hour:t.readonly(E),hour24:t.readonly(O),minute:t.readonly(M),period:t.readonly(F),time24:t.readonly(p),parsedRawTime:t.readonly(j),handleChange:k,handleKeyDown:re,handleKeyUp:r,handleClick:D,handleWheel:oe,handleBlur:f,initStyling:ae}}function Pe(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const ke=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ie=Object.prototype.toString,Fe=e=>Ie.call(e)==="[object Object]",ue=()=>{},Le=Re();function Re(){var e,n;return ke&&((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,c){return t.watch(e,n,{...c,immediate:!0})}const De=ke?window:void 0;function pe(e){var n;const c=t.toValue(e);return(n=c?.$el)!=null?n:c}function ve(...e){const n=[],c=()=>{n.forEach(A=>A()),n.length=0},U=(A,b,S,w)=>(A.addEventListener(b,S,w),()=>A.removeEventListener(b,S,w)),$=t.computed(()=>{const A=he(t.toValue(e[0])).filter(b=>b!=null);return A.every(b=>typeof b!="string")?A:void 0}),I=qe(()=>{var A,b;return[(b=(A=$.value)==null?void 0:A.map(S=>pe(S)))!=null?b:[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,b,S,w])=>{if(c(),!A?.length||!b?.length||!S?.length)return;const P=Fe(w)?{...w}:w;n.push(...A.flatMap(E=>b.flatMap(M=>S.map(F=>U(E,M,F,P)))))},{flush:"post"}),N=()=>{I(),c()};return Pe(c),N}let Ae=!1;function Ue(e,n,c={}){const{window:U=De,ignore:$=[],capture:I=!0,detectIframe:N=!1,controls:A=!1}=c;if(!U)return A?{stop:ue,cancel:ue,trigger:ue}:ue;if(Le&&!Ae){Ae=!0;const p={passive:!0};Array.from(U.document.body.children).forEach(v=>v.addEventListener("click",ue,p)),U.document.documentElement.addEventListener("click",ue,p)}let b=!0;const S=p=>t.toValue($).some(v=>{if(typeof v=="string")return Array.from(U.document.querySelectorAll(v)).some(R=>R===p.target||p.composedPath().includes(R));{const R=pe(v);return R&&(p.target===R||p.composedPath().includes(R))}});function w(p){const v=t.toValue(p);return v&&v.$.subTree.shapeFlag===16}function P(p,v){const R=t.toValue(p),W=R.$.subTree&&R.$.subTree.children;return W==null||!Array.isArray(W)?!1:W.some(_=>_.el===v.target||v.composedPath().includes(_.el))}const E=p=>{const v=pe(e);if(p.target!=null&&!(!(v instanceof Element)&&w(e)&&P(e,p))&&!(!v||v===p.target||p.composedPath().includes(v))){if("detail"in p&&p.detail===0&&(b=!S(p)),!b){b=!0;return}n(p)}};let M=!1;const F=[ve(U,"click",p=>{M||(M=!0,setTimeout(()=>{M=!1},0),E(p))},{passive:!0,capture:I}),ve(U,"pointerdown",p=>{const v=pe(e);b=!S(p)&&!!(v&&!p.composedPath().includes(v))},{passive:!0}),N&&ve(U,"blur",p=>{setTimeout(()=>{var v;const R=pe(e);((v=U.document.activeElement)==null?void 0:v.tagName)==="IFRAME"&&!R?.contains(U.document.activeElement)&&n(p)},0)},{passive:!0})].filter(Boolean),O=()=>F.forEach(p=>p());return A?{stop:O,cancel:()=>{b=!1},trigger:p=>{b=!0,E(p),b=!1}}:O}function Oe(e){const n=t.shallowRef(null),c=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],U=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??c].flat(),$=w=>w?typeof e.initialFocus=="string"?w.querySelector(e.initialFocus)??w:typeof e.initialFocus=="function"?e.initialFocus(w)??w:w.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??w:null,{activate:I,deactivate:N}=xe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>$(n.value),...e.focusTrapOptions??{}});let A=null,b=t.ref(null);const S=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const w=(E,M)=>{const F=Array.from(E.querySelectorAll(M));if(!F.length)return null;const O=F.filter(p=>p.offsetParent!==null||p.getClientRects().length>0);return O[O.length-1]??F[F.length-1]??null},P=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of U){const M=w(P,E);if(M)return M}for(const E of U){const M=w(document,E);if(M)return M}return null};return Ue(n,w=>{b.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",w)}),t.watch(()=>e.isOpen.value,w=>{w?(b.value=null,t.nextTick(()=>{const P=S();P&&(n.value=P,setTimeout(()=>I(),0),A||(A=E=>{E.key==="Escape"&&(b.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",A,!0)))})):(N(),A&&(document.removeEventListener("keydown",A,!0),A=null),n.value=null,b.value==="outside"&&t.nextTick(()=>{const P=()=>{const E=e.triggerEl?.value,M=E?.querySelector("input"),F=document.activeElement;F&&(F===M||E&&E.contains(F))&&(M??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(P,0))}),e.returnFocusToTrigger!==!1&&b.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const P=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(P,0))})))}),{popupRef:n,activate:I,deactivate:N,lastCloseReason:t.readonly(b),setPopupEl:w=>n.value=w}}const Ve=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ke=e=>!!e&&typeof e=="object"&&"field"in e,Ee=(e,n)=>!e||typeof e!="object"?!1:Ve(e)?e.filters.some(c=>Ee(c,n)):Ke(e)?e.field===n:!1,Be=e=>{const n=t.ref({}),c=$=>!e.value||!e.value.filters?!1:e.value.filters.some(I=>Ee(I,$));return{activeClasses:n,hasFieldFilter:c,updateActiveClass:$=>{const I=c($);console.log("updateActiveClass for",$,"hasFilter:",I),n.value[$]=I?"active":"",console.log("activeClasses after update",n.value)}}};te.useGridA11y=Me,te.useGridFilter=Be,te.useMaskedDateInput=Te,te.useMaskedDateRangeInput=Ce,te.useMaskedTimeInput=$e,te.usePopupTrap=Oe,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(te,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):(te=typeof globalThis<"u"?globalThis:te||self,t(te.FeatherKComposables={},te.Vue,te.useFocusTrap))})(this,(function(te,t,Ee){"use strict";const Me=(e,n)=>{const c=t.ref(null);let U=!1,$=null,I=null;const N=[],A=".k-table-row[data-grid-row-index] [tabindex]",S=l=>l.key==="Enter"||l.code==="Enter"||l.code==="NumpadEnter",b=()=>e?.value?.columns,w=l=>{const y=l.key||l.code;([" ","Spacebar","Space"].includes(y)||S(l))&&(l.preventDefault(),l.stopPropagation(),c.value=l.target,l.target.click())},P=l=>{if(!c.value)return;if(l.code==="Escape"){l.stopPropagation(),c.value&&c.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),s=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(s){if(l.code==="Tab"){const d=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],g=n?.focusableMenuSelectors??d,h=Array.from(s.querySelectorAll(g.join(",")));if(h.length===0)return;const k=h.findIndex(Y=>Y===document.activeElement);let D;k===-1?D=0:l.shiftKey?D=(k-1+h.length)%h.length:D=(k+1)%h.length,l.preventDefault(),l.stopPropagation(),h[D]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const d=y.findIndex(h=>h===document.activeElement);let g=d;l.code==="ArrowUp"?g=d>0?d-1:y.length-1:l.code==="ArrowDown"&&(g=d<y.length-1?d+1:0),y[g]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const d=c.value?.parentElement;(l.shiftKey?d?.previousElementSibling:d?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},x=()=>{$=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(s=>{if(s.nodeType===Node.ELEMENT_NODE){const d=s;if(d.classList.contains("k-animation-container")){const h=c.value;h&&(h.dataset.featherKSortable==="true"||t.nextTick(()=>{d.querySelectorAll(".k-columnmenu-item-wrapper").forEach(Y=>{Y.textContent?.toLowerCase().includes("sort")&&Y.remove()})})),d.addEventListener("keydown",P),t.nextTick(()=>{const k=()=>{const D=Array.from(d.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(D.length===1)D[0].focus(),D[0].click(),k.attempts=0;else if(D.length>1){k.attempts=0;return}else k.attempts===void 0&&(k.attempts=0),k.attempts++<3&&setTimeout(k,200)};k()})}d.querySelectorAll(".k-animation-container").forEach(h=>{h.addEventListener("keydown",P)})}}),y.removedNodes.forEach(s=>{if(s.nodeType===Node.ELEMENT_NODE){const d=s;d.classList.contains("k-animation-container")&&d.removeEventListener("keydown",P),d.querySelectorAll(".k-animation-container").forEach(h=>{h.removeEventListener("keydown",P)})}})})}),$.observe(document.body,{childList:!0,subtree:!0})},M=l=>{const y=l.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(y)||l.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},F=l=>{if(!l.type||!l)return;const y=l.target;if(y&&!M(y)){if(l.code==="Escape"){const s=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(s){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{}s.setAttribute("tabindex","0"),s.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(l.code)){if(y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){c.value=y;return}const s=y.closest(".k-table-row[data-grid-row-index]");if(s){if(["ArrowDown","ArrowUp"].includes(l.code)){l.preventDefault(),l.stopPropagation();const d=(h,k)=>{let D=k==="next"?h.nextElementSibling:h.previousElementSibling;for(;D;){const Y=D;try{if(Y.classList.contains("k-table-row"))return Y}catch{}D=k==="next"?D.nextElementSibling:D.previousElementSibling}return null},g=l.code==="ArrowDown"?d(s,"next"):d(s,"previous");g&&(s.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault(),l.stopPropagation();const d=s.querySelectorAll(A);if(d.length===0)return;let g=Array.from(d).findIndex(h=>h===document.activeElement);if(g===-1&&document.activeElement===s){d[0].focus();return}l.code==="ArrowRight"?g=g===d.length-1?0:g+1:l.code==="ArrowLeft"&&(g=g===d.length-1?g-1:d.length-1),d[g].focus();return}}}}},O=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},p=()=>{if(!I)try{const l=()=>{try{const d=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!d||d.length===0||d.filter(k=>k.getAttribute("tabindex")==="0").length===1)return;const h=d.find(k=>k===document.activeElement||k.contains(document.activeElement));if(d.forEach(k=>k.setAttribute("tabindex","-1")),h){h.setAttribute("tabindex","0");return}d[0].setAttribute("tabindex","0")}catch(d){console.error("ensureSingleTabindex error:",d)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((d,g)=>{d.setAttribute("tabindex",g===0?"0":"-1")});const s=e.value.$el.querySelector(".k-table-tbody");s&&(I=new MutationObserver(()=>{l()}),I.observe(s,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},v=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(s=>{s.setAttribute("role","button"),s.addEventListener("keydown",w)}),x(),G()})},R=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(s=>{s.removeEventListener("keydown",w)}),$&&($.disconnect(),$=null),I&&(I.disconnect(),I=null),N.forEach(s=>s()),N.length=0},G=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((s,d)=>{if(s.dataset.featherKHeaderBound==="true")return;const g=s.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!g)return;const h=b();if(h&&h[d]){const r=h[d].field??"";s.setAttribute("data-feather-k-field",r),s.setAttribute("data-feather-k-filterable",h[d].filterable===!1?"false":"true"),s.setAttribute("data-feather-k-sortable",h[d].sortable===!1?"false":"true")}const k=s.dataset.featherKFilterable!=="false",D=s.dataset.featherKSortable!=="false";g.setAttribute("tabindex","-1"),k||D?s.style.cursor="pointer":s.style.cursor="default",k?(s.setAttribute("tabindex","0"),s.setAttribute("role","button"),s.setAttribute("aria-haspopup","menu")):(s.setAttribute("tabindex","0"),s.setAttribute("role","columnheader"),s.removeAttribute("aria-haspopup"));const Y=r=>{r.target?.closest(".k-column-resizer")||(c.value=s,g.click())},re=r=>{if(k)c.value=s,r.preventDefault(),r.stopPropagation(),Y(r);else if(D){c.value=s;const f=s.querySelector(".k-link");f&&f.click()}};s.addEventListener("click",re),N.push(()=>{s.removeEventListener("click",re)});const oe=r=>{if((S(r)||r.code==="Space")&&(k||D)){if(r.preventDefault(),r.stopPropagation(),c.value=s,c.value.focus(),k)Y(r);else if(D){const f=s.querySelector(".k-link");f&&f.click()}}};s.addEventListener("keydown",oe,!0),N.push(()=>{s.removeEventListener("keydown",oe,!0)}),s.dataset.featherKHeaderBound="true"});const y=document.querySelector(".k-grid-header .k-table-thead");if(y&&y.dataset.featherKHeaderBound!=="true"){const s=d=>{const g=d.target.closest("th");g&&(S(d)||d.code==="Space")&&g.dataset.featherKFilterable==="false"&&g.dataset.featherKSortable==="false"&&(d.preventDefault(),d.stopImmediatePropagation())};y.addEventListener("keydown",s,!0),N.push(()=>{y.removeEventListener("keydown",s,!0)}),y.dataset.featherKHeaderBound="true"}},_=function(l,y){const s=l?.event?.event.target,d=b();if(!s||!d)return;const g=s.classList.contains("k-grid-header-menu"),h=s.classList.contains("k-columnmenu-item"),k=d.find(D=>D.field===l?.event?.field)?.sortable&&!0;if(!g){if(h&&!k){l?.event?.sort?.filter(Y=>Y.field!==l?.event?.field);return}typeof y=="function"&&t.nextTick(()=>{c.value&&c.value.focus(),y(l),t.nextTick(()=>{G()})})}},Z=()=>{if(!U)try{O(),p(),v(),U=!0}catch(l){console.error("initA11y failed:",l),R()}};return t.onBeforeUnmount(()=>{R()}),{activeFilterButton:c,handleGridKeyDown:F,handleSortChange:_,initA11y:Z}};function Te(e){const n=t.ref(""),c=t.ref(void 0),U=t.ref(!!e.debug),$=t.ref(e.dateFormat??"mm/dd/yyyy"),I=t.computed(()=>!!e.required),N=t.ref(!1),A=["ArrowUp","ArrowDown"],S=["ArrowLeft","ArrowRight"],b=t.computed(()=>(n.value??"").replace(/\D/g,"")),w=r=>r<=2?"mm":r<=5?"dd":b.value.length<=10?"yyyy":"mm",P=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),x=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),M=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),F=r=>{if(b.value.length===0){e.onChange({value:null,event:r});return}if(b.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&b.value.length===8){const[f,T,j]=n.value.split("/"),K=parseInt(f),V=parseInt(T),X=parseInt(j);if(G(X,K,V)){const ae=new Date(X,K-1,V);O(ae)?e.onChange({value:ae,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},O=r=>{const f=e.min??void 0,T=e.max??void 0;return!(f&&r<f||T&&r>T)},p=t.computed(()=>{if((n.value??"").length===10&&b.value.length===8){const[r,f,T]=(n.value??"").split("/"),j=parseInt(r),K=parseInt(f),V=parseInt(T);if(G(V,j,K))return new Date(V,j-1,K)}return null}),v=t.computed(()=>(n.value??"").length===10&&b.value.length===8),R=(r,f)=>new Date(r,f,0).getDate(),G=(r,f,T)=>f>=1&&f<=12&&r>=1900&&T>=1&&T<=R(r,f),_=r=>{n.value=r.value;const f=r.event?.target;c.value=f?.selectionStart??0,F(r)},Z=r=>{c.value=r.target.selectionStart??0},l=(r,f,T)=>{const j=f?.selectionStart??c.value??0;c.value=j;let K=parseInt(P.value),V=parseInt(x.value),X=parseInt(M.value);if(!(b.value.length>=8)||!G(X,K,V)){const W=e.defaultValue??new Date;K=W.getMonth()+1,V=W.getDate(),X=W.getFullYear(),n.value=`${String(K).padStart(2,"0")}/${String(V).padStart(2,"0")}/${String(X)}`;const q=new Date(X,K-1,V);e.onChange({value:O(q)?q:null,event:T}),h({useRAF:!0});return}const a=w(j);if(a==="mm")K=r==="ArrowUp"?K<12?K+1:1:K>1?K-1:12;else if(a==="dd"){const W=new Date(X,K,0).getDate();V=r==="ArrowUp"?V<W?V+1:1:V>1?V-1:W}else a==="yyyy"&&(X=r==="ArrowUp"?X+1:Math.max(1,X-1));n.value=`${String(K).padStart(2,"0")}/${String(V).padStart(2,"0")}/${String(X)}`;const[i,C,L]=n.value.split("/"),B=new Date(parseInt(L),parseInt(i)-1,parseInt(C));B.toString()!=="Invalid Date"&&parseInt(L)>=1e3?e.onChange({value:O(B)?B:null,event:T}):e.onChange({value:null,event:T}),h({useRAF:!0})},y=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(A.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const f=r.target;l(r.key,f,r);return}},s=r=>{r.preventDefault();const f=r.deltaY<0?"ArrowUp":"ArrowDown";l(f,r.target,r)},d=r=>{const f=r.target;if(S.includes(r.key)){c.value=f?.selectionStart??0;return}if(A.includes(r.key)){if(r.altKey)return;c.value=f?.selectionStart??0}},g=r=>{N.value=!0,I.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&b.value.length===0&&(e.externalValue.value="");const f=r.target;f&&(c.value=f.selectionStart??0)},h=r=>{const f=()=>{const T=document.getElementById(e.id);if(!T)return;const j=r?.pos??c.value??T.value.length;try{T.focus(),T.setSelectionRange(j,j)}catch{}};t.nextTick(()=>{if(r?.delay&&r.delay>0){setTimeout(f,r.delay);return}if(r?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const f=new Date(r);if(f.toString()!=="Invalid Date"){const T=(f.getMonth()+1).toString().padStart(2,"0"),j=f.getDate().toString().padStart(2,"0"),K=f.getFullYear().toString();n.value=`${T}/${j}/${K}`,h({delay:50});return}}},{immediate:!0});const k=t.computed(()=>[["Date",`${P.value} / ${x.value} / ${M.value}`],["Digits only",b.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]]),D=t.computed(()=>{if(!I.value){if(!v.value)return!0;const f=p.value;return f?O(f):!1}if(!N.value)return!0;const r=p.value;return!v.value||!r?!1:O(r)}),Y=t.computed(()=>{if(!I.value){if(!v.value)return;const f=p.value;return f?O(f)?"valid":"out-of-bounds":"invalid-date"}if(!N.value)return;if(b.value.length===0||!v.value)return"incomplete";const r=p.value;return r?O(r)?"valid":"out-of-bounds":"invalid-date"}),re=t.computed(()=>{const r=Y.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="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,T=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(f&&T)return`Must be between ${f} and ${T}.`;if(f)return`Must be on or after ${f}.`;if(T)return`Must be on or before ${T}.`}return""}),oe=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=r.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const T=f.parentElement;if(T){if(T.classList.contains("fk-datepicker"))return;T.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{oe()}),{raw:n,cursorPos:c,debugEnabled:U,debugLines:k,placeholder:$,isValid:D,reason:t.readonly(Y),validationMessage:re,digitsOnly:b,month:t.readonly(P),day:t.readonly(x),year:t.readonly(M),datePart:w,handleChange:_,handleKeyDown:y,handleWheel:s,handleKeyUp:d,handleClick:Z,handleBlur:g,initStyling:oe}}function Ce(e){const n=t.ref(""),c=t.ref(void 0),U=t.ref(!!e.debug),$=t.ref(!1),I=1440*60*1e3,N=365*I,A=new Date,S=new Date(A.getTime()-N),b=new Date(A.getTime()+N);e.min=e.min??S,e.max=e.max??b;const w=t.computed(()=>(n.value??"").replace(/\D/g,"")),P=(o,u)=>new Date(o,u,0).getDate(),x=(o,u,m)=>u>=1&&u<=12&&o>=1e3&&m>=1&&m<=P(o,u),M=o=>Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()),F=o=>{if(!o)return null;const u=e.min??new Date(Date.now()-90*I),m=e.max??new Date,E=M(o);return E<M(u)||E>M(m)?null:o},O=(o,u)=>e.allowReverse??!1?!0:o<=u,p=t.computed(()=>(n.value?.length??0)>=23&&w.value.length>=16),v=o=>{if((o??"").length<23||w.value.length<16)return{start:null,end:null};const u=o.substring(0,10),m=o.substring(13,23),[E,J,Q]=u.split("/").map(se=>parseInt(se||"0",10)),[ie,ce,de]=m.split("/").map(se=>parseInt(se||"0",10)),fe=new Date(Q,E-1,J),ye=new Date(de,ie-1,ce),Se=x(Q,E,J)&&fe.toString()!=="Invalid Date",be=x(de,ie,ce)&&ye.toString()!=="Invalid Date";return{start:Se?fe:null,end:be?ye:null}},R=e.externalValid??t.ref(!0),G=t.computed(()=>v(n.value)),_=t.computed(()=>{const o=F(G.value.start),u=F(G.value.end);return{start:o,end:u}}),Z=t.computed(()=>{if(!p.value)return;const o=_.value.start,u=_.value.end;if(!o||!u)return;const m=Math.abs(M(u)-M(o));return Math.round(m/864e5+1)}),l=t.computed(()=>{if(!p.value)return!1;const{start:o,end:u}=G.value;if(!o||!u||!_.value.start||!_.value.end)return!1;const m=_.value.start,E=_.value.end;return!(!O(m,E)||typeof e.maxSpanDays=="number"&&Z.value!==void 0&&Z.value>e.maxSpanDays)}),y=t.computed(()=>{const{start:o,end:u}=G.value;if(!p.value)return"incomplete";if(!o||!u)return"invalid-date";if(!_.value.start||!_.value.end)return"out-of-bounds";const m=_.value.start,E=_.value.end;return O(m,E)?typeof e.maxSpanDays=="number"&&Z.value!==void 0&&Z.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),s=t.ref(void 0),d=t.computed(()=>{if(R.value!==!1)return"";const{min:o,max:u}=e,m=s.value;if(!m)return"";switch(m){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 o&&u?`Dates must be between ${D(o)} and ${D(u)}.`:"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.";default:return""}}),g=["ArrowUp","ArrowDown"],h=["ArrowLeft","ArrowRight"],k=(o,u)=>String(o).padStart(u,"0"),D=o=>`${k(o.getMonth()+1,2)}/${k(o.getDate(),2)}/${k(o.getFullYear(),4)}`,Y=o=>o<=2?{side:"start",part:"mm"}:o<=5?{side:"start",part:(o<=3,"dd")}:o<=11?{side:"start",part:"yyyy"}:o<=15?{side:"end",part:"mm"}:o<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},re=(o,u,m)=>{const E=u?.selectionStart??c.value??0;c.value=E;const{start:J,end:Q}=v(n.value);if(!J&&!Q){const H=new Date,le=D(H);n.value=`${le} - ${le}`,e.onChange({value:{start:H,end:H},event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const ee=document.getElementById(e.id),ne=c.value??0;ee&&(ee.focus(),ee.setSelectionRange(ne,ne))})});return}const ie=new Date,ce=Y(E);let de=J?new Date(J):new Date(ie),fe=Q?new Date(Q):new Date(ie);const ye=(H,le)=>{if(le==="mm"){const ee=H.getMonth()+1,ne=o==="ArrowUp"?ee<12?ee+1:1:ee>1?ee-1:12;H.setMonth(ne-1);const ge=P(H.getFullYear(),ne);H.getDate()>ge&&H.setDate(ge)}else if(le==="dd"){const ee=P(H.getFullYear(),H.getMonth()+1),ne=H.getDate(),ge=o==="ArrowUp"?ne<ee?ne+1:1:ne>1?ne-1:ee;H.setDate(ge)}else if(le==="yyyy"){const ee=H.getFullYear();H.setFullYear(o==="ArrowUp"?ee+1:Math.max(1,ee-1));const ne=P(H.getFullYear(),H.getMonth()+1);H.getDate()>ne&&H.setDate(ne)}};ce.side==="start"?ye(de,ce.part):ye(fe,ce.part);const Se=D(de),be=D(fe);n.value=`${Se} - ${be}`;const se=F(de),we=F(fe);se&&we&&O(se,we)?e.onChange({value:{start:se,end:we},event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const H=document.getElementById(e.id),le=c.value??0;H&&(H.focus(),H.setSelectionRange(le,le))})})},oe=o=>{const{start:u,end:m}=v(n.value);if(!u||!m){e.onChange({value:null,event:o});return}const E=F(u),J=F(m);if(!E||!J){e.onChange({value:null,event:o});return}if(!O(E,J)){e.onChange({value:null,event:o});return}e.onChange({value:{start:E,end:J},event:o})},r=o=>{const u=o.value??"",m=o.event;if(!u&&m&&m.type==="click"){ae(m);return}n.value=u;const E=m?.target;c.value=E?.selectionStart??0,oe(o)},f=o=>{c.value=o.target.selectionStart??0},T=o=>{if(o.code==="Space"||o.key===" "){o.preventDefault(),o.stopPropagation(),e.onShowCalendar(o);return}if(o.key==="ArrowDown"&&o.altKey){o.preventDefault(),o.stopPropagation(),e.onShowCalendar(o);return}if(g.includes(o.key)){o.preventDefault(),o.stopPropagation();const u=o.target;re(o.key,u,o);return}},j=o=>{o.preventDefault();const u=o.deltaY<0?"ArrowUp":"ArrowDown";re(u,o.target,o)},K=o=>{if(h.includes(o.key)||g.includes(o.key)){const u=o.target;c.value=u?.selectionStart??0}},V=()=>{s.value=y.value,(e.manageValid??!0)&&(R.value=l.value)},X=o=>{V()},ae=o=>{console.log("Clear event:",o),n.value="",c.value=0,e.onChange({value:null,event:o}),V(),t.nextTick(()=>{const u=document.getElementById(e.id);u&&(u.focus(),u.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,o=>{const u=o?.start??null,m=o?.end??null;if(u&&m){if(n.value=`${D(u)} - ${D(m)}`,e.isOpen?.value&&$.value&&e.onRequestClose){const E=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),$.value=!1,V()},E)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),i=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),C=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),L=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),B=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),W=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),q=t.computed(()=>{const{start:o,end:u}=v(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(a.value).padStart(2,"0")} / ${String(i.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(L.value).padStart(2,"0")} / ${String(B.value).padStart(2,"0")} / ${String(W.value).padStart(4,"0")}`},{label:"Digits only",value:w.value},{label:"Mask complete",value:`${p.value}`},{label:"Parsed",value:`${o?o.toDateString():"-"} | ${u?u.toDateString():"-"}`},{label:"Valid (managed)",value:`${R.value??"-"}`},{label:"Span (days)",value:`${Z.value??"-"}`},{label:"Reason",value:`${y.value??"-"}`},{label:"Cursor in",value:`${c.value??"-"} (${(()=>{const m=c.value??0,E=Y(m);return`${E.side}.${E.part}`})()})`}]}),z=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const u=o.closest("div");if(!u){console.warn(`Parent div of #${e.id} not found for styling.`);return}u.classList.contains("fk-daterangepicker")||u.classList.add("fk-daterangepicker")})};t.onMounted(()=>{z()});const me=()=>{t.nextTick(()=>{try{const o=Array.from(document.querySelectorAll(".k-animation-container"));if(!o.length)return;const m=[...o].reverse().find(Q=>Q.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!m)return;const E=m.querySelectorAll(".k-calendar-table");let J=!1;E.forEach(Q=>{Q.tabIndex===0&&(J?Q.tabIndex=-1:J=!0)})}catch(o){console.warn(o)}})};return e.isOpen&&t.watch(e.isOpen,o=>{o&&setTimeout(()=>me(),0)},{immediate:!1}),{raw:n,cursorPos:c,debugEnabled:U,debugLines:q,digitsOnly:w,valid:R,validComputed:t.readonly(l),reason:t.readonly(y),validationMessage:t.readonly(d),spanDays:t.readonly(Z),month1:t.readonly(a),day1:t.readonly(i),year1:t.readonly(C),month2:t.readonly(L),day2:t.readonly(B),year2:t.readonly(W),handleChange:r,handleKeyDown:T,handleWheel:j,handleKeyUp:K,handleClick:f,handleBlur:X,handleClear:ae,onCalendarChange:()=>{$.value=!0},initStyling:z}}function $e(e){const n=t.ref(""),c=t.ref(void 0),U=t.ref(!!e.debug),$=t.ref(e.timeFormat??"hh:mm AM"),I=t.computed(()=>!!e.required),N=t.ref(!1),A=["ArrowUp","ArrowDown"],S=["ArrowLeft","ArrowRight"],b=t.computed(()=>(n.value??"").replace(/\D/g,"")),w={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},P=a=>a<=2?"hh":a<=5?"mm":"ampm",x=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",i=parseInt(a);return Math.min(Math.max(i,0),23)}),M=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",i=parseInt(a);return Math.min(Math.max(i,0),59)}),F=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),O=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),i=F.value;return a===12?i==="AM"?0:12:i==="PM"?a+12:a}),p=t.computed(()=>v.value?`${String(O.value).padStart(2,"0")}:${String(M.value).padStart(2,"0")}:00`:null),v=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),R=(a,i,C)=>{let L=a%12;return L===0&&(L=12),`${String(L).padStart(2,"0")}:${String(i).padStart(2,"0")} ${C}`},G=a=>{const i=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!i)return null;const C=parseInt(i[1]),L=parseInt(i[2]),B=i[3].toUpperCase();if(C<1||C>12||L<0||L>59)return null;let W=C%12;B==="PM"&&(W+=12);const q=new Date;return q.setSeconds(0,0),q.setHours(W),q.setMinutes(L),q},_=a=>{if(b.value.length===0){e.onChange({value:null,event:a});return}if(!v.value){e.onChange({value:null,event:a});return}const i=G(n.value);i&&l(i)?e.onChange({value:i,event:a}):e.onChange({value:null,event:a})},Z=a=>a.getHours()*60+a.getMinutes(),l=a=>{const i=e.min??void 0,C=e.max??void 0,L=Z(a);if(i){const B=Z(i);if(L<B)return!1}if(C){const B=Z(C);if(L>B)return!1}return!0},y=a=>{const i=a.getHours(),C=i>=12?"PM":"AM";n.value=R(i,a.getMinutes(),C)},s=(a,i)=>{e.onChange({value:a,event:i})},d=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const i=(a.value??"").length;a.setSelectionRange(i,i)}})})})},g=a=>{const i=a?.event?.target;return i?i.closest(".k-time-now")?"now":i.closest(".k-time-accept")?"set":null:null},h=(a,i)=>{a&&l(a)?s(a,i):s(null,i)},k=(...a)=>{const i=a[0];if(!i)return;const C=g(i);if(C==="now"){const B=new Date;y(B),h(B,i),d();return}if(i?.value instanceof Date){const B=new Date(i.value);y(B),h(B,i),C==="set"&&d();return}if(i?.value===null){n.value="",s(null,i);return}n.value=i.value;const L=i.event?.target;c.value=L?.selectionStart??0;try{const B=c.value??0;if(P(B)==="ampm"&&(n.value??"").length>=8){const W=n.value.charAt(6);/[Aa]/.test(W)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const q=document.getElementById(e.id);q&&(q.focus(),q.setSelectionRange(8,8))})})):/[Pp]/.test(W)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const q=document.getElementById(e.id);q&&(q.focus(),q.setSelectionRange(8,8))})}))}}catch{}_(i)},D=a=>{c.value=a.target.selectionStart??0},Y=(a,i,C)=>{const L=i?.selectionStart??c.value??0;c.value=L;const B=P(L),W=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!W){if((n.value??"").length===0||b.value.length===0){const u=new Date,m=u.getHours(),E=m>=12?"PM":"AM";n.value=R(m,u.getMinutes(),E);const J=G(n.value);h(J,C),t.nextTick(()=>{requestAnimationFrame(()=>{const Q=document.getElementById(e.id),ie=c.value??0;Q&&(Q.focus(),Q.setSelectionRange(ie,ie))})})}return}let q=parseInt(W[1]),z=parseInt(W[2]),me=W[3].toUpperCase();if(B==="hh")a==="ArrowUp"?q=q<12?q+1:1:q=q>1?q-1:12;else if(B==="mm"){const u=e.minuteStepRef?.value??e.minuteStep??1;if(u===1)a==="ArrowUp"?z=z<59?z+1:0:z=z>0?z-1:59;else if(a==="ArrowUp"){const m=z%u;let E=m===0?z+u:z+(u-m);E>=60&&(E=0),z=E}else{const m=z%u;let E=m===0?z-u:z-m;E<0&&(E=60-u),z=E}}else B==="ampm"&&(me=me==="AM"?"PM":"AM");n.value=`${String(q).padStart(2,"0")}:${String(z).padStart(2,"0")} ${me}`;const o=G(n.value);h(o,C),t.nextTick(()=>{requestAnimationFrame(()=>{const u=document.getElementById(e.id),m=c.value??0;u&&(u.focus(),u.setSelectionRange(m,m))})})},re=a=>{if(a.code==="Space"||a.key===" "){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(a.key==="ArrowDown"&&a.altKey){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const i=a.target;Y(a.key,i,a);return}},oe=a=>{a.preventDefault();const i=a.deltaY<0?"ArrowUp":"ArrowDown";Y(i,a.target,a)},r=a=>{const i=a.target;if(S.includes(a.key)){c.value=i?.selectionStart??0;return}if(A.includes(a.key)){if(a.altKey)return;c.value=i?.selectionStart??0}},f=a=>{N.value=!0,I.value&&e.externalValue&&e.externalValue.value===void 0&&b.value.length===0&&(e.externalValue.value="");const i=a.target;i&&(c.value=i.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const i=new Date(a);if(i.toString()!=="Invalid Date"){const C=i.getHours(),L=C>=12?"PM":"AM";n.value=R(C,i.getMinutes(),L);return}}},{immediate:!0});const T=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",x.value],["Hour (24h)",O.value],["Minute",M.value],["Period",F.value],["Time (24h)",p.value??"--:--:--"],["Digits only",b.value],["Parsed Date",j.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",K.value],["reason",V.value],["validationMessage",X.value]]),j=t.computed(()=>G(n.value)??null),K=t.computed(()=>{if(!I.value){if(!v.value)return!0;const i=j.value;return i?l(i):!1}if(!N.value)return!0;const a=j.value;return!v.value||!a?!1:l(a)}),V=t.computed(()=>{if(!I.value){if(!v.value)return;const i=j.value;return i?l(i)?"valid":"out-of-bounds":"invalid-time"}if(!N.value)return;if(b.value.length===0||!v.value)return"incomplete";const a=j.value;return a?l(a)?"valid":"out-of-bounds":"invalid-time"}),X=t.computed(()=>{const a=V.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${$.value} format.`;const i={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",i):null,L=e.max?e.max.toLocaleTimeString("en-US",i):null;if(a==="out-of-bounds"){if(C&&L)return`Must be between ${C} and ${L}.`;if(C)return`Must be ${C} or later.`;if(L)return`Must be ${L} or earlier.`}return""}),ae=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const i=a.closest(".k-timepicker");if(!i){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=i.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return t.onMounted(()=>{ae()}),{raw:n,rules:w,debugEnabled:U,debugLines:T,placeholder:$,isValid:K,reason:t.readonly(V),validationMessage:X,isComplete:v,inRangeTime:l,cursorPos:c,hour:t.readonly(x),hour24:t.readonly(O),minute:t.readonly(M),period:t.readonly(F),time24:t.readonly(p),parsedRawTime:t.readonly(j),handleChange:k,handleKeyDown:re,handleKeyUp:r,handleClick:D,handleWheel:oe,handleBlur:f,initStyling:ae}}function Pe(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const ke=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ie=Object.prototype.toString,Fe=e=>Ie.call(e)==="[object Object]",ue=()=>{},Le=Re();function Re(){var e,n;return ke&&((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,c){return t.watch(e,n,{...c,immediate:!0})}const De=ke?window:void 0;function pe(e){var n;const c=t.toValue(e);return(n=c?.$el)!=null?n:c}function ve(...e){const n=[],c=()=>{n.forEach(A=>A()),n.length=0},U=(A,S,b,w)=>(A.addEventListener(S,b,w),()=>A.removeEventListener(S,b,w)),$=t.computed(()=>{const A=he(t.toValue(e[0])).filter(S=>S!=null);return A.every(S=>typeof S!="string")?A:void 0}),I=qe(()=>{var A,S;return[(S=(A=$.value)==null?void 0:A.map(b=>pe(b)))!=null?S:[De].filter(b=>b!=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,S,b,w])=>{if(c(),!A?.length||!S?.length||!b?.length)return;const P=Fe(w)?{...w}:w;n.push(...A.flatMap(x=>S.flatMap(M=>b.map(F=>U(x,M,F,P)))))},{flush:"post"}),N=()=>{I(),c()};return Pe(c),N}let Ae=!1;function Ue(e,n,c={}){const{window:U=De,ignore:$=[],capture:I=!0,detectIframe:N=!1,controls:A=!1}=c;if(!U)return A?{stop:ue,cancel:ue,trigger:ue}:ue;if(Le&&!Ae){Ae=!0;const p={passive:!0};Array.from(U.document.body.children).forEach(v=>v.addEventListener("click",ue,p)),U.document.documentElement.addEventListener("click",ue,p)}let S=!0;const b=p=>t.toValue($).some(v=>{if(typeof v=="string")return Array.from(U.document.querySelectorAll(v)).some(R=>R===p.target||p.composedPath().includes(R));{const R=pe(v);return R&&(p.target===R||p.composedPath().includes(R))}});function w(p){const v=t.toValue(p);return v&&v.$.subTree.shapeFlag===16}function P(p,v){const R=t.toValue(p),G=R.$.subTree&&R.$.subTree.children;return G==null||!Array.isArray(G)?!1:G.some(_=>_.el===v.target||v.composedPath().includes(_.el))}const x=p=>{const v=pe(e);if(p.target!=null&&!(!(v instanceof Element)&&w(e)&&P(e,p))&&!(!v||v===p.target||p.composedPath().includes(v))){if("detail"in p&&p.detail===0&&(S=!b(p)),!S){S=!0;return}n(p)}};let M=!1;const F=[ve(U,"click",p=>{M||(M=!0,setTimeout(()=>{M=!1},0),x(p))},{passive:!0,capture:I}),ve(U,"pointerdown",p=>{const v=pe(e);S=!b(p)&&!!(v&&!p.composedPath().includes(v))},{passive:!0}),N&&ve(U,"blur",p=>{setTimeout(()=>{var v;const R=pe(e);((v=U.document.activeElement)==null?void 0:v.tagName)==="IFRAME"&&!R?.contains(U.document.activeElement)&&n(p)},0)},{passive:!0})].filter(Boolean),O=()=>F.forEach(p=>p());return A?{stop:O,cancel:()=>{S=!1},trigger:p=>{S=!0,x(p),S=!1}}:O}function Oe(e){const n=t.shallowRef(null),c=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],U=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??c].flat(),$=w=>w?typeof e.initialFocus=="string"?w.querySelector(e.initialFocus)??w:typeof e.initialFocus=="function"?e.initialFocus(w)??w:w.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??w:null,{activate:I,deactivate:N}=Ee.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>$(n.value),...e.focusTrapOptions??{}});let A=null,S=t.ref(null);const b=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const w=(x,M)=>{const F=Array.from(x.querySelectorAll(M));if(!F.length)return null;const O=F.filter(p=>p.offsetParent!==null||p.getClientRects().length>0);return O[O.length-1]??F[F.length-1]??null},P=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const x of U){const M=w(P,x);if(M)return M}for(const x of U){const M=w(document,x);if(M)return M}return null};return Ue(n,w=>{S.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",w)}),t.watch(()=>e.isOpen.value,w=>{w?(S.value=null,t.nextTick(()=>{const P=b();P&&(n.value=P,setTimeout(()=>I(),0),A||(A=x=>{x.key==="Escape"&&(S.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",x))},document.addEventListener("keydown",A,!0)))})):(N(),A&&(document.removeEventListener("keydown",A,!0),A=null),n.value=null,S.value==="outside"&&t.nextTick(()=>{const P=()=>{const x=e.triggerEl?.value,M=x?.querySelector("input"),F=document.activeElement;F&&(F===M||x&&x.contains(F))&&(M??x)?.blur?.()};requestAnimationFrame(()=>setTimeout(P,0))}),e.returnFocusToTrigger!==!1&&S.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const P=()=>{const x=e.triggerEl?.value;if(!x)return;(x.querySelector("input")??x)?.focus?.()};requestAnimationFrame(()=>setTimeout(P,0))})))}),{popupRef:n,activate:I,deactivate:N,lastCloseReason:t.readonly(S),setPopupEl:w=>n.value=w}}const Ke=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ve=e=>!!e&&typeof e=="object"&&"field"in e,xe=(e,n)=>!e||typeof e!="object"?!1:Ke(e)?e.filters.some(c=>xe(c,n)):Ve(e)?e.field===n:!1,Be=e=>{const n=t.ref({}),c=$=>!e.value||!e.value.filters?!1:e.value.filters.some(I=>xe(I,$));return{activeClasses:n,hasFieldFilter:c,updateActiveClass:$=>{const I=c($);console.log("updateActiveClass for",$,"hasFilter:",I),n.value[$]=I?"active":"",console.log("activeClasses after update",n.value)}}};te.useGridA11y=Me,te.useGridFilter=Be,te.useMaskedDateInput=Te,te.useMaskedDateRangeInput=Ce,te.useMaskedTimeInput=$e,te.usePopupTrap=Oe,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|