@featherk/composables 0.6.12 → 0.6.13
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.
|
@@ -2,7 +2,7 @@ import { ref as _, onBeforeUnmount as Te, nextTick as j, computed as h, watch as
|
|
|
2
2
|
import { useFocusTrap as qe } from "@vueuse/integrations/useFocusTrap";
|
|
3
3
|
const _e = (e, t) => {
|
|
4
4
|
const u = _(null);
|
|
5
|
-
let q = !1, I = null,
|
|
5
|
+
let q = !1, I = null, T = null;
|
|
6
6
|
const V = [], A = ".k-table-row[data-grid-row-index] [tabindex]", k = () => e?.value?.columns, S = (o) => {
|
|
7
7
|
const m = o.key || o.code;
|
|
8
8
|
[" ", "Spacebar", "Space", "Enter"].includes(m) && (o.preventDefault(), o.stopPropagation(), u.value = o.target, o.target.click());
|
|
@@ -164,7 +164,7 @@ const _e = (e, t) => {
|
|
|
164
164
|
for (; $; ) {
|
|
165
165
|
const H = $;
|
|
166
166
|
try {
|
|
167
|
-
if (H.
|
|
167
|
+
if (H.classList.contains("k-table-row"))
|
|
168
168
|
return H;
|
|
169
169
|
} catch {
|
|
170
170
|
}
|
|
@@ -199,8 +199,8 @@ const _e = (e, t) => {
|
|
|
199
199
|
const o = e.value.$el.closest(".k-grid");
|
|
200
200
|
o && o.classList.add("fk-grid");
|
|
201
201
|
});
|
|
202
|
-
},
|
|
203
|
-
if (!
|
|
202
|
+
}, L = () => {
|
|
203
|
+
if (!T)
|
|
204
204
|
try {
|
|
205
205
|
const o = () => {
|
|
206
206
|
try {
|
|
@@ -232,9 +232,9 @@ const _e = (e, t) => {
|
|
|
232
232
|
s.setAttribute("tabindex", v === 0 ? "0" : "-1");
|
|
233
233
|
});
|
|
234
234
|
const l = e.value.$el.querySelector(".k-table-tbody");
|
|
235
|
-
l && (
|
|
235
|
+
l && (T = new MutationObserver(() => {
|
|
236
236
|
o();
|
|
237
|
-
}),
|
|
237
|
+
}), T.observe(l, { childList: !0, subtree: !0 }));
|
|
238
238
|
} catch (o) {
|
|
239
239
|
console.error("Error setting up row navigation:", o);
|
|
240
240
|
}
|
|
@@ -255,7 +255,7 @@ const _e = (e, t) => {
|
|
|
255
255
|
"keydown",
|
|
256
256
|
S
|
|
257
257
|
);
|
|
258
|
-
}), I && (I.disconnect(), I = null),
|
|
258
|
+
}), I && (I.disconnect(), I = null), T && (T.disconnect(), T = null), V.forEach((l) => l()), V.length = 0;
|
|
259
259
|
}, y = () => {
|
|
260
260
|
document.querySelectorAll(
|
|
261
261
|
".k-grid-header .k-table-thead th"
|
|
@@ -332,13 +332,13 @@ const _e = (e, t) => {
|
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
334
|
}, O = function(o, m) {
|
|
335
|
-
const l = o?.event
|
|
335
|
+
const l = o?.event?.event.target, s = k();
|
|
336
336
|
if (!l || !s) return;
|
|
337
|
-
const v = l.classList.contains("k-link"), b = l.classList.contains("k-columnmenu-item"), D = s.find(($) => $.field === o
|
|
337
|
+
const v = l.classList.contains("k-link"), b = l.classList.contains("k-columnmenu-item"), D = s.find(($) => $.field === o?.event?.field)?.sortable && !0;
|
|
338
338
|
if (!v) {
|
|
339
339
|
if (b && !D) {
|
|
340
|
-
|
|
341
|
-
(H) => H.field !== o
|
|
340
|
+
o?.event?.sort?.filter(
|
|
341
|
+
(H) => H.field !== o?.event?.field
|
|
342
342
|
);
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
@@ -349,7 +349,7 @@ const _e = (e, t) => {
|
|
|
349
349
|
}, G = () => {
|
|
350
350
|
if (!q)
|
|
351
351
|
try {
|
|
352
|
-
C(),
|
|
352
|
+
C(), L(), U(), q = !0;
|
|
353
353
|
} catch (o) {
|
|
354
354
|
console.error("initA11y failed:", o), f();
|
|
355
355
|
}
|
|
@@ -364,7 +364,7 @@ const _e = (e, t) => {
|
|
|
364
364
|
};
|
|
365
365
|
};
|
|
366
366
|
function ze(e) {
|
|
367
|
-
const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(e.dateFormat ?? "mm/dd/yyyy"),
|
|
367
|
+
const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(e.dateFormat ?? "mm/dd/yyyy"), T = h(() => !!e.required), V = _(!1), A = ["ArrowUp", "ArrowDown"], k = ["ArrowLeft", "ArrowRight"], S = h(() => (t.value ?? "").replace(/\D/g, "")), g = (a) => a <= 2 ? "mm" : a <= 5 ? "dd" : S.value.length <= 10 ? "yyyy" : "mm", P = h(() => {
|
|
368
368
|
const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
369
369
|
return parseInt(a).toString().padStart(2, "0");
|
|
370
370
|
}), E = h(() => {
|
|
@@ -373,7 +373,7 @@ function ze(e) {
|
|
|
373
373
|
}), C = h(() => {
|
|
374
374
|
const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
375
375
|
return parseInt(a).toString().padStart(4, "0");
|
|
376
|
-
}),
|
|
376
|
+
}), L = (a) => {
|
|
377
377
|
if (S.value.length === 0) {
|
|
378
378
|
e.onChange({ value: null, event: a });
|
|
379
379
|
return;
|
|
@@ -403,7 +403,7 @@ function ze(e) {
|
|
|
403
403
|
}), y = h(() => (t.value ?? "").length === 10 && S.value.length === 8), O = (a, d) => new Date(a, d, 0).getDate(), G = (a, d, M) => d >= 1 && d <= 12 && a >= 1900 && M >= 1 && M <= O(a, d), o = (a) => {
|
|
404
404
|
t.value = a.value;
|
|
405
405
|
const d = a.event?.target;
|
|
406
|
-
u.value = d?.selectionStart ?? 0,
|
|
406
|
+
u.value = d?.selectionStart ?? 0, L(a);
|
|
407
407
|
}, m = (a) => {
|
|
408
408
|
u.value = a.target.selectionStart ?? 0;
|
|
409
409
|
}, l = (a, d, M) => {
|
|
@@ -466,7 +466,7 @@ function ze(e) {
|
|
|
466
466
|
a.preventDefault(), u.value = d?.selectionStart ?? 0;
|
|
467
467
|
}
|
|
468
468
|
}, D = (a) => {
|
|
469
|
-
V.value = !0,
|
|
469
|
+
V.value = !0, T.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && S.value.length === 0 && (e.externalValue.value = "");
|
|
470
470
|
const d = a.target;
|
|
471
471
|
d && (u.value = d.selectionStart ?? 0);
|
|
472
472
|
}, $ = (a) => {
|
|
@@ -527,7 +527,7 @@ function ze(e) {
|
|
|
527
527
|
}) ?? null
|
|
528
528
|
]
|
|
529
529
|
]), J = h(() => {
|
|
530
|
-
if (!
|
|
530
|
+
if (!T.value) {
|
|
531
531
|
if (!y.value) return !0;
|
|
532
532
|
const d = f.value;
|
|
533
533
|
return d ? U(d) : !1;
|
|
@@ -536,7 +536,7 @@ function ze(e) {
|
|
|
536
536
|
const a = f.value;
|
|
537
537
|
return !y.value || !a ? !1 : U(a);
|
|
538
538
|
}), oe = h(() => {
|
|
539
|
-
if (!
|
|
539
|
+
if (!T.value) {
|
|
540
540
|
if (!y.value) return;
|
|
541
541
|
const d = f.value;
|
|
542
542
|
return d ? U(d) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
@@ -620,11 +620,11 @@ function ze(e) {
|
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
622
|
function Xe(e) {
|
|
623
|
-
const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(!1),
|
|
623
|
+
const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(!1), T = 1440 * 60 * 1e3, V = 365 * T, A = /* @__PURE__ */ new Date(), k = new Date(A.getTime() - V), S = new Date(A.getTime() + V);
|
|
624
624
|
e.min = e.min ?? k, e.max = e.max ?? S;
|
|
625
|
-
const g = h(() => (t.value ?? "").replace(/\D/g, "")), P = (n, c) => new Date(n, c, 0).getDate(), E = (n, c, x) => c >= 1 && c <= 12 && n >= 1e3 && x >= 1 && x <= P(n, c), C = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()),
|
|
625
|
+
const g = h(() => (t.value ?? "").replace(/\D/g, "")), P = (n, c) => new Date(n, c, 0).getDate(), E = (n, c, x) => c >= 1 && c <= 12 && n >= 1e3 && x >= 1 && x <= P(n, c), C = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), L = (n) => {
|
|
626
626
|
if (!n) return null;
|
|
627
|
-
const c = e.min, x = e.max, R = C(n);
|
|
627
|
+
const c = e.min ?? new Date(Date.now() - 90 * T), x = e.max ?? /* @__PURE__ */ new Date(), R = C(n);
|
|
628
628
|
return R < C(c) || R > C(x) ? null : n;
|
|
629
629
|
}, U = (n, c) => e.allowReverse ?? !1 ? !0 : n <= c, f = h(() => (t.value?.length ?? 0) >= 23 && g.value.length >= 16), y = (n) => {
|
|
630
630
|
if ((n ?? "").length < 23 || g.value.length < 16)
|
|
@@ -632,7 +632,7 @@ function Xe(e) {
|
|
|
632
632
|
const c = n.substring(0, 10), x = n.substring(13, 23), [R, ee, ae] = c.split("/").map((se) => parseInt(se || "0", 10)), [ge, de, fe] = x.split("/").map((se) => parseInt(se || "0", 10)), pe = new Date(ae, R - 1, ee), he = new Date(fe, ge - 1, de), we = E(ae, R, ee) && pe.toString() !== "Invalid Date", ke = E(fe, ge, de) && he.toString() !== "Invalid Date";
|
|
633
633
|
return { start: we ? pe : null, end: ke ? he : null };
|
|
634
634
|
}, O = e.externalValid ?? _(!0), G = h(() => y(t.value)), o = h(() => {
|
|
635
|
-
const n =
|
|
635
|
+
const n = L(G.value.start), c = L(G.value.end);
|
|
636
636
|
return { start: n, end: c };
|
|
637
637
|
}), m = h(() => {
|
|
638
638
|
if (!f.value) return;
|
|
@@ -668,7 +668,6 @@ function Xe(e) {
|
|
|
668
668
|
return n && c ? `Dates must be between ${J(n)} and ${J(c)}.` : "Dates must be within the allowed range.";
|
|
669
669
|
case "span-exceeds-limit":
|
|
670
670
|
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
671
|
-
case "valid":
|
|
672
671
|
default:
|
|
673
672
|
return "";
|
|
674
673
|
}
|
|
@@ -712,7 +711,7 @@ function Xe(e) {
|
|
|
712
711
|
de.side === "start" ? he(fe, de.part) : he(pe, de.part);
|
|
713
712
|
const we = J(fe), ke = J(pe);
|
|
714
713
|
t.value = `${we} - ${ke}`;
|
|
715
|
-
const se =
|
|
714
|
+
const se = L(fe), De = L(pe);
|
|
716
715
|
se && De && U(se, De) ? e.onChange({ value: { start: se, end: De }, event: x }) : e.onChange({ value: null, event: x }), j(() => {
|
|
717
716
|
requestAnimationFrame(() => {
|
|
718
717
|
const Y = document.getElementById(
|
|
@@ -727,7 +726,7 @@ function Xe(e) {
|
|
|
727
726
|
e.onChange({ value: null, event: n });
|
|
728
727
|
return;
|
|
729
728
|
}
|
|
730
|
-
const R =
|
|
729
|
+
const R = L(c), ee = L(x);
|
|
731
730
|
if (!R || !ee) {
|
|
732
731
|
e.onChange({ value: null, event: n });
|
|
733
732
|
return;
|
|
@@ -940,7 +939,7 @@ function Xe(e) {
|
|
|
940
939
|
};
|
|
941
940
|
}
|
|
942
941
|
function Je(e) {
|
|
943
|
-
const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(e.timeFormat ?? "hh:mm AM"),
|
|
942
|
+
const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(e.timeFormat ?? "hh:mm AM"), T = h(() => !!e.required), V = _(!1), A = ["ArrowUp", "ArrowDown"], k = ["ArrowLeft", "ArrowRight"], S = h(() => (t.value ?? "").replace(/\D/g, "")), g = {
|
|
944
943
|
H: /[0-9]/,
|
|
945
944
|
h: /[0-9]/,
|
|
946
945
|
M: /[0-9]/,
|
|
@@ -953,8 +952,8 @@ function Je(e) {
|
|
|
953
952
|
}), C = h(() => {
|
|
954
953
|
const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(r);
|
|
955
954
|
return Math.min(Math.max(i, 0), 59);
|
|
956
|
-
}),
|
|
957
|
-
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i =
|
|
955
|
+
}), L = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), U = h(() => {
|
|
956
|
+
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = L.value;
|
|
958
957
|
return r === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? r + 12 : r;
|
|
959
958
|
}), f = h(() => y.value ? `${String(U.value).padStart(2, "0")}:${String(C.value).padStart(2, "0")}:00` : null), y = h(
|
|
960
959
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
@@ -1096,7 +1095,7 @@ function Je(e) {
|
|
|
1096
1095
|
}
|
|
1097
1096
|
A.includes(r.key) && (r.preventDefault(), u.value = i?.selectionStart ?? 0);
|
|
1098
1097
|
}, J = (r) => {
|
|
1099
|
-
V.value = !0,
|
|
1098
|
+
V.value = !0, T.value && e.externalValue && e.externalValue.value === void 0 && S.value.length === 0 && (e.externalValue.value = "");
|
|
1100
1099
|
const i = r.target;
|
|
1101
1100
|
i && (u.value = i.selectionStart ?? 0);
|
|
1102
1101
|
};
|
|
@@ -1119,7 +1118,7 @@ function Je(e) {
|
|
|
1119
1118
|
["Hour (12h)", E.value],
|
|
1120
1119
|
["Hour (24h)", U.value],
|
|
1121
1120
|
["Minute", C.value],
|
|
1122
|
-
["Period",
|
|
1121
|
+
["Period", L.value],
|
|
1123
1122
|
["Time (24h)", f.value ?? "--:--:--"],
|
|
1124
1123
|
["Digits only", S.value],
|
|
1125
1124
|
[
|
|
@@ -1149,7 +1148,7 @@ function Je(e) {
|
|
|
1149
1148
|
]), F = h(
|
|
1150
1149
|
() => G(t.value) ?? null
|
|
1151
1150
|
), ne = h(() => {
|
|
1152
|
-
if (!
|
|
1151
|
+
if (!T.value) {
|
|
1153
1152
|
if (!y.value) return !0;
|
|
1154
1153
|
const i = F.value;
|
|
1155
1154
|
return i ? l(i) : !1;
|
|
@@ -1158,7 +1157,7 @@ function Je(e) {
|
|
|
1158
1157
|
const r = F.value;
|
|
1159
1158
|
return !y.value || !r ? !1 : l(r);
|
|
1160
1159
|
}), a = h(() => {
|
|
1161
|
-
if (!
|
|
1160
|
+
if (!T.value) {
|
|
1162
1161
|
if (!y.value) return;
|
|
1163
1162
|
const i = F.value;
|
|
1164
1163
|
return i ? l(i) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
@@ -1226,7 +1225,7 @@ function Je(e) {
|
|
|
1226
1225
|
hour: N(E),
|
|
1227
1226
|
hour24: N(U),
|
|
1228
1227
|
minute: N(C),
|
|
1229
|
-
period: N(
|
|
1228
|
+
period: N(L),
|
|
1230
1229
|
time24: N(f),
|
|
1231
1230
|
parsedRawTime: N(F),
|
|
1232
1231
|
handleChange: s,
|
|
@@ -1275,7 +1274,7 @@ function Ee(...e) {
|
|
|
1275
1274
|
}, q = (A, k, S, g) => (A.addEventListener(k, S, g), () => A.removeEventListener(k, S, g)), I = h(() => {
|
|
1276
1275
|
const A = Ae(ce(e[0])).filter((k) => k != null);
|
|
1277
1276
|
return A.every((k) => typeof k != "string") ? A : void 0;
|
|
1278
|
-
}),
|
|
1277
|
+
}), T = Ye(
|
|
1279
1278
|
() => {
|
|
1280
1279
|
var A, k;
|
|
1281
1280
|
return [
|
|
@@ -1293,20 +1292,20 @@ function Ee(...e) {
|
|
|
1293
1292
|
t.push(
|
|
1294
1293
|
...A.flatMap(
|
|
1295
1294
|
(E) => k.flatMap(
|
|
1296
|
-
(C) => S.map((
|
|
1295
|
+
(C) => S.map((L) => q(E, C, L, P))
|
|
1297
1296
|
)
|
|
1298
1297
|
)
|
|
1299
1298
|
);
|
|
1300
1299
|
},
|
|
1301
1300
|
{ flush: "post" }
|
|
1302
1301
|
), V = () => {
|
|
1303
|
-
|
|
1302
|
+
T(), u();
|
|
1304
1303
|
};
|
|
1305
1304
|
return Ue(u), V;
|
|
1306
1305
|
}
|
|
1307
1306
|
let Me = !1;
|
|
1308
1307
|
function Ne(e, t, u = {}) {
|
|
1309
|
-
const { window: q = $e, ignore: I = [], capture:
|
|
1308
|
+
const { window: q = $e, ignore: I = [], capture: T = !0, detectIframe: V = !1, controls: A = !1 } = u;
|
|
1310
1309
|
if (!q)
|
|
1311
1310
|
return A ? { stop: me, cancel: me, trigger: me } : me;
|
|
1312
1311
|
if (Ke && !Me) {
|
|
@@ -1342,12 +1341,12 @@ function Ne(e, t, u = {}) {
|
|
|
1342
1341
|
}
|
|
1343
1342
|
};
|
|
1344
1343
|
let C = !1;
|
|
1345
|
-
const
|
|
1344
|
+
const L = [
|
|
1346
1345
|
Ee(q, "click", (f) => {
|
|
1347
1346
|
C || (C = !0, setTimeout(() => {
|
|
1348
1347
|
C = !1;
|
|
1349
1348
|
}, 0), E(f));
|
|
1350
|
-
}, { passive: !0, capture:
|
|
1349
|
+
}, { passive: !0, capture: T }),
|
|
1351
1350
|
Ee(q, "pointerdown", (f) => {
|
|
1352
1351
|
const y = be(e);
|
|
1353
1352
|
k = !S(f) && !!(y && !f.composedPath().includes(y));
|
|
@@ -1359,7 +1358,7 @@ function Ne(e, t, u = {}) {
|
|
|
1359
1358
|
((y = q.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !O?.contains(q.document.activeElement) && t(f);
|
|
1360
1359
|
}, 0);
|
|
1361
1360
|
}, { passive: !0 })
|
|
1362
|
-
].filter(Boolean), U = () =>
|
|
1361
|
+
].filter(Boolean), U = () => L.forEach((f) => f());
|
|
1363
1362
|
return A ? {
|
|
1364
1363
|
stop: U,
|
|
1365
1364
|
cancel: () => {
|
|
@@ -1378,7 +1377,7 @@ function Qe(e) {
|
|
|
1378
1377
|
".k-menu-popup"
|
|
1379
1378
|
], q = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? u].flat(), I = (g) => g ? typeof e.initialFocus == "string" ? g.querySelector(e.initialFocus) ?? g : typeof e.initialFocus == "function" ? e.initialFocus(g) ?? g : g.querySelector(
|
|
1380
1379
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1381
|
-
) ?? g : null, { activate:
|
|
1380
|
+
) ?? g : null, { activate: T, deactivate: V } = qe(t, {
|
|
1382
1381
|
escapeDeactivates: !1,
|
|
1383
1382
|
clickOutsideDeactivates: !1,
|
|
1384
1383
|
fallbackFocus: () => t.value,
|
|
@@ -1389,12 +1388,12 @@ function Qe(e) {
|
|
|
1389
1388
|
const S = () => {
|
|
1390
1389
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1391
1390
|
const g = (E, C) => {
|
|
1392
|
-
const
|
|
1393
|
-
if (!
|
|
1394
|
-
const U =
|
|
1391
|
+
const L = Array.from(E.querySelectorAll(C));
|
|
1392
|
+
if (!L.length) return null;
|
|
1393
|
+
const U = L.filter(
|
|
1395
1394
|
(f) => f.offsetParent !== null || f.getClientRects().length > 0
|
|
1396
1395
|
);
|
|
1397
|
-
return U[U.length - 1] ??
|
|
1396
|
+
return U[U.length - 1] ?? L[L.length - 1] ?? null;
|
|
1398
1397
|
}, P = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
1399
1398
|
for (const E of q) {
|
|
1400
1399
|
const C = g(P, E);
|
|
@@ -1413,13 +1412,13 @@ function Qe(e) {
|
|
|
1413
1412
|
(g) => {
|
|
1414
1413
|
g ? (k.value = null, j(() => {
|
|
1415
1414
|
const P = S();
|
|
1416
|
-
P && (t.value = P, setTimeout(() =>
|
|
1415
|
+
P && (t.value = P, setTimeout(() => T(), 0), A || (A = (E) => {
|
|
1417
1416
|
E.key === "Escape" && (k.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", E));
|
|
1418
1417
|
}, document.addEventListener("keydown", A, !0)));
|
|
1419
1418
|
})) : (V(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, k.value === "outside" && j(() => {
|
|
1420
1419
|
const P = () => {
|
|
1421
|
-
const E = e.triggerEl?.value, C = E?.querySelector("input"),
|
|
1422
|
-
|
|
1420
|
+
const E = e.triggerEl?.value, C = E?.querySelector("input"), L = document.activeElement;
|
|
1421
|
+
L && (L === C || E && E.contains(L)) && (C ?? E)?.blur?.();
|
|
1423
1422
|
};
|
|
1424
1423
|
requestAnimationFrame(() => setTimeout(P, 0));
|
|
1425
1424
|
}), e.returnFocusToTrigger !== !1 && k.value === "escape" && e.triggerEl?.value && (console.log(
|
|
@@ -1436,7 +1435,7 @@ function Qe(e) {
|
|
|
1436
1435
|
}
|
|
1437
1436
|
), {
|
|
1438
1437
|
popupRef: t,
|
|
1439
|
-
activate:
|
|
1438
|
+
activate: T,
|
|
1440
1439
|
deactivate: V,
|
|
1441
1440
|
lastCloseReason: N(k),
|
|
1442
1441
|
setPopupEl: (g) => t.value = g
|
|
@@ -1446,14 +1445,14 @@ const He = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray
|
|
|
1446
1445
|
(u) => Ie(u, t)
|
|
1447
1446
|
) : We(e) ? e.field === t : !1, Ze = (e) => {
|
|
1448
1447
|
const t = _({}), u = (I) => !e.value || !e.value.filters ? !1 : e.value.filters.some(
|
|
1449
|
-
(
|
|
1448
|
+
(T) => Ie(T, I)
|
|
1450
1449
|
);
|
|
1451
1450
|
return {
|
|
1452
1451
|
activeClasses: t,
|
|
1453
1452
|
hasFieldFilter: u,
|
|
1454
1453
|
updateActiveClass: (I) => {
|
|
1455
|
-
const
|
|
1456
|
-
console.log("updateActiveClass for", I, "hasFilter:",
|
|
1454
|
+
const T = u(I);
|
|
1455
|
+
console.log("updateActiveClass for", I, "hasFilter:", T), t.value[I] = T ? "active" : "", console.log("activeClasses after update", t.value);
|
|
1457
1456
|
}
|
|
1458
1457
|
};
|
|
1459
1458
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(J,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(J=typeof globalThis<"u"?globalThis:J||self,t(J.FeatherKComposables={},J.Vue,J.useFocusTrap))})(this,(function(J,t,xe){"use strict";const Me=(e,n)=>{const u=t.ref(null);let q=!1,$=null,F=null;const K=[],A=".k-table-row[data-grid-row-index] [tabindex]",w=()=>e?.value?.columns,S=l=>{const y=l.key||l.code;[" ","Spacebar","Space","Enter"].includes(y)&&(l.preventDefault(),l.stopPropagation(),u.value=l.target,l.target.click())},v=l=>{if(!u.value)return;if(l.code==="Escape"){l.stopPropagation(),u.value&&u.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),i=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(i){if(l.code==="Tab"){const c=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],g=n?.focusableMenuSelectors??c,b=Array.from(i.querySelectorAll(g.join(",")));if(b.length===0)return;const D=b.findIndex(N=>N===document.activeElement);let C;D===-1?C=0:l.shiftKey?C=(D-1+b.length)%b.length:C=(D+1)%b.length,l.preventDefault(),l.stopPropagation(),b[C]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const c=y.findIndex(b=>b===document.activeElement);let g=c;l.code==="ArrowUp"?g=c>0?c-1:y.length-1:l.code==="ArrowDown"&&(g=c<y.length-1?c+1:0),y[g]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const c=u.value?.parentElement;(l.shiftKey?c?.previousElementSibling:c?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},L=()=>{$=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;if(c.classList.contains("k-animation-container")){const b=u.value;b&&(b.dataset.featherKSortable==="true"||t.nextTick(()=>{c.querySelectorAll(".k-columnmenu-item-wrapper").forEach(N=>{N.textContent?.toLowerCase().includes("sort")&&N.remove()})})),c.addEventListener("keydown",v),t.nextTick(()=>{const D=()=>{const C=Array.from(c.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(C.length===1)C[0].focus(),C[0].click(),D.attempts=0;else if(C.length>1){D.attempts=0;return}else D.attempts===void 0&&(D.attempts=0),D.attempts++<3&&setTimeout(D,200)};D()})}c.querySelectorAll(".k-animation-container").forEach(b=>{b.addEventListener("keydown",v)})}}),y.removedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;c.classList.contains("k-animation-container")&&c.removeEventListener("keydown",v),c.querySelectorAll(".k-animation-container").forEach(b=>{b.removeEventListener("keydown",v)})}})})}),$.observe(document.body,{childList:!0,subtree:!0})},E=l=>{if(!l.type||!l)return;const y=l.target;if(y){if(l.code==="Escape"){const i=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(i){l.preventDefault(),l.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(g=>g.setAttribute("tabindex","-1"))}catch{}i.setAttribute("tabindex","0"),i.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","Space"].includes(l.code)){if(l.preventDefault(),y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){u.value=y;return}const i=y.closest(".k-table-row[data-grid-row-index]");if(i){if(["ArrowDown","ArrowUp"].includes(l.code)){const c=(b,D)=>{let C=D==="next"?b.nextElementSibling:b.previousElementSibling;for(;C;){const N=C;try{if(N.hasAttribute&&N.classList.contains("k-table-row"))return N}catch{}C=D==="next"?C.nextElementSibling:C.previousElementSibling}return null},g=l.code==="ArrowDown"?c(i,"next"):c(i,"previous");g&&(i.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault();const c=i.querySelectorAll(A);if(c.length===0)return;let g=Array.from(c).findIndex(b=>b===document.activeElement);if(g===-1&&document.activeElement===i){c[0].focus();return}l.code==="ArrowRight"?g=g===c.length-1?0:g+1:l.code==="ArrowLeft"&&(g=g===c.length-1?g-1:c.length-1),c[g].focus();return}}}}},T=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},I=()=>{if(!F)try{const l=()=>{try{const c=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!c||c.length===0||c.filter(D=>D.getAttribute("tabindex")==="0").length===1)return;const b=c.find(D=>D===document.activeElement||D.contains(document.activeElement));if(c.forEach(D=>D.setAttribute("tabindex","-1")),b){b.setAttribute("tabindex","0");return}c[0].setAttribute("tabindex","0")}catch(c){console.error("ensureSingleTabindex error:",c)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((c,g)=>{c.setAttribute("tabindex",g===0?"0":"-1")});const i=e.value.$el.querySelector(".k-table-tbody");i&&(F=new MutationObserver(()=>{l()}),F.observe(i,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},O=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.setAttribute("role","button"),i.addEventListener("keydown",S)}),L(),h()})},p=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.removeEventListener("keydown",S)}),$&&($.disconnect(),$=null),F&&(F.disconnect(),F=null),K.forEach(i=>i()),K.length=0},h=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((i,c)=>{const g=i.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!g)return;const b=w();if(b&&b[c]){const P=b[c].field??"";i.setAttribute("data-feather-k-field",P),i.setAttribute("data-feather-k-filterable",b[c].filterable===!1?"false":"true"),i.setAttribute("data-feather-k-sortable",b[c].sortable===!1?"false":"true")}const D=i.dataset.featherKFilterable!=="false",C=i.dataset.featherKSortable!=="false";g.setAttribute("tabindex","-1"),D||C?i.style.cursor="pointer":i.style.cursor="default",D?(i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-haspopup","menu")):(i.setAttribute("tabindex","0"),i.setAttribute("role","columnheader"),i.removeAttribute("aria-haspopup"));const N=P=>{P.target?.closest(".k-column-resizer")||(u.value=i,g.click())},_=P=>{if(D)u.value=i,P.preventDefault(),P.stopPropagation(),N(P);else if(C){u.value=i;const ee=new KeyboardEvent("keydown",{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0});i.dispatchEvent(ee)}};i.addEventListener("click",_),K.push(()=>{i.removeEventListener("click",_)});const re=P=>{if((P.code==="Enter"||P.code==="Space")&&(D||C)){if(u.value=i,u.value.focus(),D)P.preventDefault(),P.stopPropagation(),N(P);else if(C){const ee=i.querySelector(".k-link");ee&&ee.click()}}};i.addEventListener("keydown",re,!0),K.push(()=>{i.removeEventListener("keydown",re,!0)})});const y=document.querySelector(".k-grid-header .k-table-thead");if(y){const i=c=>{const g=c.target.closest("th");g&&(c.code==="Enter"||c.code==="Space")&&g.dataset.featherKFilterable==="false"&&g.dataset.featherKSortable==="false"&&(c.preventDefault(),c.stopImmediatePropagation())};y.addEventListener("keydown",i,!0),K.push(()=>{y.removeEventListener("keydown",i,!0)})}},U=function(l,y){const i=l?.event.event.target,c=w();if(!i||!c)return;const g=i.classList.contains("k-link"),b=i.classList.contains("k-columnmenu-item"),D=c.find(C=>C.field===l.event.field)?.sortable&&!0;if(!g){if(b&&!D){(l.event.sort&&void 0)?.filter(N=>N.field!==l.event.field);return}typeof y=="function"&&t.nextTick(()=>{u.value&&u.value.focus(),y(l)})}},j=()=>{if(!q)try{T(),I(),O(),q=!0}catch(l){console.error("initA11y failed:",l),p()}};return t.onBeforeUnmount(()=>{p()}),{activeFilterButton:u,handleGridKeyDown:E,handleSortChange:U,initA11y:j}};function Te(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.dateFormat??"mm/dd/yyyy"),F=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],w=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v=a=>a<=2?"mm":a<=5?"dd":S.value.length<=10?"yyyy":"mm",L=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),E=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),T=t.computed(()=>{const a=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(4,"0")}),I=a=>{if(S.value.length===0){e.onChange({value:null,event:a});return}if(S.value.length<8){e.onChange({value:null,event:a});return}if((n.value??"").length===10&&S.value.length===8){const[f,M,o]=n.value.split("/"),s=parseInt(f),m=parseInt(M),k=parseInt(o);if(j(k,s,m)){const V=new Date(k,s-1,m);O(V)?e.onChange({value:V,event:a}):e.onChange({value:null,event:a})}else e.onChange({value:null,event:a})}},O=a=>{const f=e.min??void 0,M=e.max??void 0;return!(f&&a<f||M&&a>M)},p=t.computed(()=>{if((n.value??"").length===10&&S.value.length===8){const[a,f,M]=(n.value??"").split("/"),o=parseInt(a),s=parseInt(f),m=parseInt(M);if(j(m,o,s))return new Date(m,o-1,s)}return null}),h=t.computed(()=>(n.value??"").length===10&&S.value.length===8),U=(a,f)=>new Date(a,f,0).getDate(),j=(a,f,M)=>f>=1&&f<=12&&a>=1900&&M>=1&&M<=U(a,f),l=a=>{n.value=a.value;const f=a.event?.target;u.value=f?.selectionStart??0,I(a)},y=a=>{u.value=a.target.selectionStart??0},i=(a,f,M)=>{const o=f?.selectionStart??u.value??0;u.value=o;let s=parseInt(L.value),m=parseInt(E.value),k=parseInt(T.value);if(!(S.value.length>=8)||!j(k,s,m)){const B=e.defaultValue??new Date;s=B.getMonth()+1,m=B.getDate(),k=B.getFullYear(),n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(k)}`;const W=new Date(k,s-1,m);e.onChange({value:O(W)?W:null,event:M}),C({useRAF:!0});return}const z=v(o);if(z==="mm")s=a==="ArrowUp"?s<12?s+1:1:s>1?s-1:12;else if(z==="dd"){const B=new Date(k,s,0).getDate();m=a==="ArrowUp"?m<B?m+1:1:m>1?m-1:B}else z==="yyyy"&&(k=a==="ArrowUp"?k+1:Math.max(1,k-1));n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(k)}`;const[G,H,ae]=n.value.split("/"),oe=new Date(parseInt(ae),parseInt(G)-1,parseInt(H));oe.toString()!=="Invalid Date"&&parseInt(ae)>=1e3?e.onChange({value:O(oe)?oe:null,event:M}):e.onChange({value:null,event:M}),C({useRAF:!0})},c=a=>{if(a.code==="Space"||a.key===" "){e.onShowCalendar(a);return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault();const f=a.target;i(a.key,f,a)}},g=a=>{a.preventDefault();const f=a.deltaY<0?"ArrowUp":"ArrowDown";i(f,a.target,a)},b=a=>{const f=a.target;if(w.includes(a.key)){u.value=f?.selectionStart??0;return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault(),u.value=f?.selectionStart??0}},D=a=>{K.value=!0,F.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const f=a.target;f&&(u.value=f.selectionStart??0)},C=a=>{const f=()=>{const M=document.getElementById(e.id);if(!M)return;const o=a?.pos??u.value??M.value.length;try{M.focus(),M.setSelectionRange(o,o)}catch{}};t.nextTick(()=>{if(a?.delay&&a.delay>0){setTimeout(f,a.delay);return}if(a?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const f=new Date(a);if(f.toString()!=="Invalid Date"){const M=(f.getMonth()+1).toString().padStart(2,"0"),o=f.getDate().toString().padStart(2,"0"),s=f.getFullYear().toString();n.value=`${M}/${o}/${s}`,C({delay:50});return}}},{immediate:!0});const N=t.computed(()=>[["Date",`${L.value} / ${E.value} / ${T.value}`],["Digits only",S.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),_=t.computed(()=>{if(!F.value){if(!h.value)return!0;const f=p.value;return f?O(f):!1}if(!K.value)return!0;const a=p.value;return!h.value||!a?!1:O(a)}),re=t.computed(()=>{if(!F.value){if(!h.value)return;const f=p.value;return f?O(f)?"valid":"out-of-bounds":"invalid-date"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const a=p.value;return a?O(a)?"valid":"out-of-bounds":"invalid-date"}),P=t.computed(()=>{const a=re.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-date")return`Must be in ${$.value} format.`;const f=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,M=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(a==="out-of-bounds"){if(f&&M)return`Must be between ${f} and ${M}.`;if(f)return`Must be on or after ${f}.`;if(M)return`Must be on or before ${M}.`}return""}),ee=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=a.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const M=f.parentElement;if(M){if(M.classList.contains("fk-datepicker"))return;M.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{ee()}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:N,placeholder:$,isValid:_,reason:t.readonly(re),validationMessage:P,digitsOnly:S,month:t.readonly(L),day:t.readonly(E),year:t.readonly(T),datePart:v,handleChange:l,handleKeyDown:c,handleWheel:g,handleKeyUp:b,handleClick:y,handleBlur:D,initStyling:ee}}function Ce(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(!1),K=365*(1440*60*1e3),A=new Date,w=new Date(A.getTime()-K),S=new Date(A.getTime()+K);e.min=e.min??w,e.max=e.max??S;const v=t.computed(()=>(n.value??"").replace(/\D/g,"")),L=(r,d)=>new Date(r,d,0).getDate(),E=(r,d,x)=>d>=1&&d<=12&&r>=1e3&&x>=1&&x<=L(r,d),T=r=>Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),I=r=>{if(!r)return null;const d=e.min,x=e.max,R=T(r);return R<T(d)||R>T(x)?null:r},O=(r,d)=>e.allowReverse??!1?!0:r<=d,p=t.computed(()=>(n.value?.length??0)>=23&&v.value.length>=16),h=r=>{if((r??"").length<23||v.value.length<16)return{start:null,end:null};const d=r.substring(0,10),x=r.substring(13,23),[R,Q,ne]=d.split("/").map(ie=>parseInt(ie||"0",10)),[me,ue,ce]=x.split("/").map(ie=>parseInt(ie||"0",10)),de=new Date(ne,R-1,Q),ye=new Date(ce,me-1,ue),be=E(ne,R,Q)&&de.toString()!=="Invalid Date",Se=E(ce,me,ue)&&ye.toString()!=="Invalid Date";return{start:be?de:null,end:Se?ye:null}},U=e.externalValid??t.ref(!0),j=t.computed(()=>h(n.value)),l=t.computed(()=>{const r=I(j.value.start),d=I(j.value.end);return{start:r,end:d}}),y=t.computed(()=>{if(!p.value)return;const r=l.value.start,d=l.value.end;if(!r||!d)return;const x=Math.abs(T(d)-T(r));return Math.round(x/864e5+1)}),i=t.computed(()=>{if(!p.value)return!1;const{start:r,end:d}=j.value;if(!r||!d||!l.value.start||!l.value.end)return!1;const x=l.value.start,R=l.value.end;return!(!O(x,R)||typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays)}),c=t.computed(()=>{const{start:r,end:d}=j.value;if(!p.value)return"incomplete";if(!r||!d)return"invalid-date";if(!l.value.start||!l.value.end)return"out-of-bounds";const x=l.value.start,R=l.value.end;return O(x,R)?typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),g=t.ref(void 0),b=t.computed(()=>{if(U.value!==!1)return"";const{min:r,max:d}=e,x=g.value;if(!x)return"";switch(x){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return r&&d?`Dates must be between ${_(r)} and ${_(d)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";case"valid":default:return""}}),D=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],N=(r,d)=>String(r).padStart(d,"0"),_=r=>`${N(r.getMonth()+1,2)}/${N(r.getDate(),2)}/${N(r.getFullYear(),4)}`,re=r=>r<=2?{side:"start",part:"mm"}:r<=5?{side:"start",part:(r<=3,"dd")}:r<=11?{side:"start",part:"yyyy"}:r<=15?{side:"end",part:"mm"}:r<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},P=(r,d,x)=>{const R=d?.selectionStart??u.value??0;u.value=R;const{start:Q,end:ne}=h(n.value);if(!Q&&!ne){const Y=new Date,le=_(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const X=document.getElementById(e.id),Z=u.value??0;X&&(X.focus(),X.setSelectionRange(Z,Z))})});return}const me=new Date,ue=re(R);let ce=Q?new Date(Q):new Date(me),de=ne?new Date(ne):new Date(me);const ye=(Y,le)=>{if(le==="mm"){const X=Y.getMonth()+1,Z=r==="ArrowUp"?X<12?X+1:1:X>1?X-1:12;Y.setMonth(Z-1);const ge=L(Y.getFullYear(),Z);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const X=L(Y.getFullYear(),Y.getMonth()+1),Z=Y.getDate(),ge=r==="ArrowUp"?Z<X?Z+1:1:Z>1?Z-1:X;Y.setDate(ge)}else if(le==="yyyy"){const X=Y.getFullYear();Y.setFullYear(r==="ArrowUp"?X+1:Math.max(1,X-1));const Z=L(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>Z&&Y.setDate(Z)}};ue.side==="start"?ye(ce,ue.part):ye(de,ue.part);const be=_(ce),Se=_(de);n.value=`${be} - ${Se}`;const ie=I(ce),ke=I(de);ie&&ke&&O(ie,ke)?e.onChange({value:{start:ie,end:ke},event:x}):e.onChange({value:null,event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=u.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},ee=r=>{const{start:d,end:x}=h(n.value);if(!d||!x){e.onChange({value:null,event:r});return}const R=I(d),Q=I(x);if(!R||!Q){e.onChange({value:null,event:r});return}if(!O(R,Q)){e.onChange({value:null,event:r});return}e.onChange({value:{start:R,end:Q},event:r})},a=r=>{const d=r.value??"",x=r.event;if(!d&&x&&x.type==="click"){V(x);return}n.value=d;const R=x?.target;u.value=R?.selectionStart??0,ee(r)},f=r=>{u.value=r.target.selectionStart??0},M=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),e.onShowCalendar(r);return}if(D.includes(r.key)){r.preventDefault();const d=r.target;P(r.key,d,r)}},o=r=>{r.preventDefault();const d=r.deltaY<0?"ArrowUp":"ArrowDown";P(d,r.target,r)},s=r=>{if(C.includes(r.key)||D.includes(r.key)){r.preventDefault();const d=r.target;u.value=d?.selectionStart??0}},m=()=>{g.value=c.value,(e.manageValid??!0)&&(U.value=i.value)},k=r=>{m()},V=r=>{console.log("Clear event:",r),n.value="",u.value=0,e.onChange({value:null,event:r}),m(),t.nextTick(()=>{const d=document.getElementById(e.id);d&&(d.focus(),d.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,r=>{const d=r?.start??null,x=r?.end??null;if(d&&x){if(n.value=`${_(d)} - ${_(x)}`,e.isOpen?.value&&$.value&&e.onRequestClose){const R=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),$.value=!1,m()},R)}return}},{immediate:!0});const z=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),G=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),H=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),ae=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),oe=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),B=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),W=t.computed(()=>{const{start:r,end:d}=h(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(z.value).padStart(2,"0")} / ${String(G.value).padStart(2,"0")} / ${String(H.value).padStart(4,"0")}`},{label:"End",value:`${String(ae.value).padStart(2,"0")} / ${String(oe.value).padStart(2,"0")} / ${String(B.value).padStart(4,"0")}`},{label:"Digits only",value:v.value},{label:"Mask complete",value:`${p.value}`},{label:"Parsed",value:`${r?r.toDateString():"-"} | ${d?d.toDateString():"-"}`},{label:"Valid (managed)",value:`${U.value??"-"}`},{label:"Span (days)",value:`${y.value??"-"}`},{label:"Reason",value:`${c.value??"-"}`},{label:"Cursor in",value:`${u.value??"-"} (${(()=>{const x=u.value??0,R=re(x);return`${R.side}.${R.part}`})()})`}]}),te=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const d=r.closest("div");if(!d){console.warn(`Parent div of #${e.id} not found for styling.`);return}d.classList.contains("fk-daterangepicker")||d.classList.add("fk-daterangepicker")})};t.onMounted(()=>{te()});const pe=()=>{t.nextTick(()=>{try{const r=Array.from(document.querySelectorAll(".k-animation-container"));if(!r.length)return;const x=[...r].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!x)return;const R=x.querySelectorAll(".k-calendar-table");let Q=!1;R.forEach(ne=>{ne.tabIndex===0&&(Q?ne.tabIndex=-1:Q=!0)})}catch(r){console.warn(r)}})};return e.isOpen&&t.watch(e.isOpen,r=>{r&&setTimeout(()=>pe(),0)},{immediate:!1}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:W,digitsOnly:v,valid:U,validComputed:t.readonly(i),reason:t.readonly(c),validationMessage:t.readonly(b),spanDays:t.readonly(y),month1:t.readonly(z),day1:t.readonly(G),year1:t.readonly(H),month2:t.readonly(ae),day2:t.readonly(oe),year2:t.readonly(B),handleChange:a,handleKeyDown:M,handleWheel:o,handleKeyUp:s,handleClick:f,handleBlur:k,handleClear:V,onCalendarChange:()=>{$.value=!0},initStyling:te}}function $e(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.timeFormat??"hh:mm AM"),F=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],w=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},L=o=>o<=2?"hh":o<=5?"mm":"ampm",E=t.computed(()=>{const o=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),23)}),T=t.computed(()=>{const o=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),59)}),I=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),O=t.computed(()=>{const o=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),s=I.value;return o===12?s==="AM"?0:12:s==="PM"?o+12:o}),p=t.computed(()=>h.value?`${String(O.value).padStart(2,"0")}:${String(T.value).padStart(2,"0")}:00`:null),h=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),U=(o,s,m)=>{let k=o%12;return k===0&&(k=12),`${String(k).padStart(2,"0")}:${String(s).padStart(2,"0")} ${m}`},j=o=>{const s=o.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!s)return null;const m=parseInt(s[1]),k=parseInt(s[2]),V=s[3].toUpperCase();if(m<1||m>12||k<0||k>59)return null;let z=m%12;V==="PM"&&(z+=12);const G=new Date;return G.setSeconds(0,0),G.setHours(z),G.setMinutes(k),G},l=o=>{if(S.value.length===0){e.onChange({value:null,event:o});return}if(!h.value){e.onChange({value:null,event:o});return}const s=j(n.value);s&&i(s)?e.onChange({value:s,event:o}):e.onChange({value:null,event:o})},y=o=>o.getHours()*60+o.getMinutes(),i=o=>{const s=e.min??void 0,m=e.max??void 0,k=y(o);if(s){const V=y(s);if(k<V)return!1}if(m){const V=y(m);if(k>V)return!1}return!0},c=o=>{n.value=o.value;const s=o.event?.target;u.value=s?.selectionStart??0;try{const m=u.value??0;if(L(m)==="ampm"&&(n.value??"").length>=8){const k=n.value.charAt(6);/[Aa]/.test(k)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})})):/[Pp]/.test(k)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})}))}}catch{}l(o)},g=o=>{u.value=o.target.selectionStart??0},b=(o,s,m)=>{const k=s?.selectionStart??u.value??0;u.value=k;const V=L(k),z=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!z){if((n.value??"").length===0||S.value.length===0){const B=new Date,W=B.getHours(),te=W>=12?"PM":"AM";n.value=U(W,B.getMinutes(),te);const pe=j(n.value);pe&&i(pe)?e.onChange({value:pe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id),d=u.value??0;r&&(r.focus(),r.setSelectionRange(d,d))})})}return}let G=parseInt(z[1]),H=parseInt(z[2]),ae=z[3].toUpperCase();if(V==="hh")o==="ArrowUp"?G=G<12?G+1:1:G=G>1?G-1:12;else if(V==="mm"){const B=e.minuteStepRef?.value??e.minuteStep??1;if(B===1)o==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(o==="ArrowUp"){const W=H%B;let te=W===0?H+B:H+(B-W);te>=60&&(te=0),H=te}else{const W=H%B;let te=W===0?H-B:H-W;te<0&&(te=60-B),H=te}}else V==="ampm"&&(ae=ae==="AM"?"PM":"AM");n.value=`${String(G).padStart(2,"0")}:${String(H).padStart(2,"0")} ${ae}`;const oe=j(n.value);oe&&i(oe)?e.onChange({value:oe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id),W=u.value??0;B&&(B.focus(),B.setSelectionRange(W,W))})})},D=o=>{if(o.code==="Space"||o.key===" "){e.onShowPicker(o);return}if(A.includes(o.key)){o.preventDefault();const s=o.target;b(o.key,s,o)}},C=o=>{o.preventDefault();const s=o.deltaY<0?"ArrowUp":"ArrowDown";b(s,o.target,o)},N=o=>{const s=o.target;if(w.includes(o.key)){u.value=s?.selectionStart??0;return}A.includes(o.key)&&(o.preventDefault(),u.value=s?.selectionStart??0)},_=o=>{K.value=!0,F.value&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const s=o.target;s&&(u.value=s.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,o=>{if(o){const s=new Date(o);if(s.toString()!=="Invalid Date"){const m=s.getHours(),k=m>=12?"PM":"AM";n.value=U(m,s.getMinutes(),k);return}}},{immediate:!0});const re=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",O.value],["Minute",T.value],["Period",I.value],["Time (24h)",p.value??"--:--:--"],["Digits only",S.value],["Parsed Date",P.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",ee.value],["reason",a.value],["validationMessage",f.value]]),P=t.computed(()=>j(n.value)??null),ee=t.computed(()=>{if(!F.value){if(!h.value)return!0;const s=P.value;return s?i(s):!1}if(!K.value)return!0;const o=P.value;return!h.value||!o?!1:i(o)}),a=t.computed(()=>{if(!F.value){if(!h.value)return;const s=P.value;return s?i(s)?"valid":"out-of-bounds":"invalid-time"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const o=P.value;return o?i(o)?"valid":"out-of-bounds":"invalid-time"}),f=t.computed(()=>{const o=a.value;if(!o||o==="valid")return"";if(o==="incomplete")return"Required";if(o==="invalid-time")return`Must be in ${$.value} format.`;const s={hour:"2-digit",minute:"2-digit"},m=e.min?e.min.toLocaleTimeString("en-US",s):null,k=e.max?e.max.toLocaleTimeString("en-US",s):null;if(o==="out-of-bounds"){if(m&&k)return`Must be between ${m} and ${k}.`;if(m)return`Must be ${m} or later.`;if(k)return`Must be ${k} or earlier.`}return""}),M=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const s=o.closest(".k-timepicker");if(!s){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const m=s.parentElement;if(!m){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}m.classList.contains("fk-timepicker")||m.classList.add("fk-timepicker")})};return t.onMounted(()=>{M()}),{raw:n,rules:v,debugEnabled:q,debugLines:re,placeholder:$,isValid:ee,reason:t.readonly(a),validationMessage:f,isComplete:h,inRangeTime:i,cursorPos:u,hour:t.readonly(E),hour24:t.readonly(O),minute:t.readonly(T),period:t.readonly(I),time24:t.readonly(p),parsedRawTime:t.readonly(P),handleChange:c,handleKeyDown:D,handleKeyUp:N,handleClick:g,handleWheel:C,handleBlur:_,initStyling:M}}function Ie(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const we=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Fe=Object.prototype.toString,Le=e=>Fe.call(e)==="[object Object]",se=()=>{},Pe=Re();function Re(){var e,n;return we&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function he(e){return Array.isArray(e)?e:[e]}function qe(e,n,u){return t.watch(e,n,{...u,immediate:!0})}const De=we?window:void 0;function fe(e){var n;const u=t.toValue(e);return(n=u?.$el)!=null?n:u}function ve(...e){const n=[],u=()=>{n.forEach(A=>A()),n.length=0},q=(A,w,S,v)=>(A.addEventListener(w,S,v),()=>A.removeEventListener(w,S,v)),$=t.computed(()=>{const A=he(t.toValue(e[0])).filter(w=>w!=null);return A.every(w=>typeof w!="string")?A:void 0}),F=qe(()=>{var A,w;return[(w=(A=$.value)==null?void 0:A.map(S=>fe(S)))!=null?w:[De].filter(S=>S!=null),he(t.toValue($.value?e[1]:e[0])),he(t.unref($.value?e[2]:e[1])),t.toValue($.value?e[3]:e[2])]},([A,w,S,v])=>{if(u(),!A?.length||!w?.length||!S?.length)return;const L=Le(v)?{...v}:v;n.push(...A.flatMap(E=>w.flatMap(T=>S.map(I=>q(E,T,I,L)))))},{flush:"post"}),K=()=>{F(),u()};return Ie(u),K}let Ae=!1;function Oe(e,n,u={}){const{window:q=De,ignore:$=[],capture:F=!0,detectIframe:K=!1,controls:A=!1}=u;if(!q)return A?{stop:se,cancel:se,trigger:se}:se;if(Pe&&!Ae){Ae=!0;const p={passive:!0};Array.from(q.document.body.children).forEach(h=>h.addEventListener("click",se,p)),q.document.documentElement.addEventListener("click",se,p)}let w=!0;const S=p=>t.toValue($).some(h=>{if(typeof h=="string")return Array.from(q.document.querySelectorAll(h)).some(U=>U===p.target||p.composedPath().includes(U));{const U=fe(h);return U&&(p.target===U||p.composedPath().includes(U))}});function v(p){const h=t.toValue(p);return h&&h.$.subTree.shapeFlag===16}function L(p,h){const U=t.toValue(p),j=U.$.subTree&&U.$.subTree.children;return j==null||!Array.isArray(j)?!1:j.some(l=>l.el===h.target||h.composedPath().includes(l.el))}const E=p=>{const h=fe(e);if(p.target!=null&&!(!(h instanceof Element)&&v(e)&&L(e,p))&&!(!h||h===p.target||p.composedPath().includes(h))){if("detail"in p&&p.detail===0&&(w=!S(p)),!w){w=!0;return}n(p)}};let T=!1;const I=[ve(q,"click",p=>{T||(T=!0,setTimeout(()=>{T=!1},0),E(p))},{passive:!0,capture:F}),ve(q,"pointerdown",p=>{const h=fe(e);w=!S(p)&&!!(h&&!p.composedPath().includes(h))},{passive:!0}),K&&ve(q,"blur",p=>{setTimeout(()=>{var h;const U=fe(e);((h=q.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!U?.contains(q.document.activeElement)&&n(p)},0)},{passive:!0})].filter(Boolean),O=()=>I.forEach(p=>p());return A?{stop:O,cancel:()=>{w=!1},trigger:p=>{w=!0,E(p),w=!1}}:O}function Ue(e){const n=t.shallowRef(null),u=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],q=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??u].flat(),$=v=>v?typeof e.initialFocus=="string"?v.querySelector(e.initialFocus)??v:typeof e.initialFocus=="function"?e.initialFocus(v)??v:v.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??v:null,{activate:F,deactivate:K}=xe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>$(n.value),...e.focusTrapOptions??{}});let A=null,w=t.ref(null);const S=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const v=(E,T)=>{const I=Array.from(E.querySelectorAll(T));if(!I.length)return null;const O=I.filter(p=>p.offsetParent!==null||p.getClientRects().length>0);return O[O.length-1]??I[I.length-1]??null},L=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of q){const T=v(L,E);if(T)return T}for(const E of q){const T=v(document,E);if(T)return T}return null};return Oe(n,v=>{w.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",v)}),t.watch(()=>e.isOpen.value,v=>{v?(w.value=null,t.nextTick(()=>{const L=S();L&&(n.value=L,setTimeout(()=>F(),0),A||(A=E=>{E.key==="Escape"&&(w.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",A,!0)))})):(K(),A&&(document.removeEventListener("keydown",A,!0),A=null),n.value=null,w.value==="outside"&&t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value,T=E?.querySelector("input"),I=document.activeElement;I&&(I===T||E&&E.contains(I))&&(T??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(L,0))}),e.returnFocusToTrigger!==!1&&w.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(L,0))})))}),{popupRef:n,activate:F,deactivate:K,lastCloseReason:t.readonly(w),setPopupEl:v=>n.value=v}}const Ve=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Be=e=>!!e&&typeof e=="object"&&"field"in e,Ee=(e,n)=>!e||typeof e!="object"?!1:Ve(e)?e.filters.some(u=>Ee(u,n)):Be(e)?e.field===n:!1,Ke=e=>{const n=t.ref({}),u=$=>!e.value||!e.value.filters?!1:e.value.filters.some(F=>Ee(F,$));return{activeClasses:n,hasFieldFilter:u,updateActiveClass:$=>{const F=u($);console.log("updateActiveClass for",$,"hasFilter:",F),n.value[$]=F?"active":"",console.log("activeClasses after update",n.value)}}};J.useGridA11y=Me,J.useGridFilter=Ke,J.useMaskedDateInput=Te,J.useMaskedDateRangeInput=Ce,J.useMaskedTimeInput=$e,J.usePopupTrap=Ue,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(J,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(J=typeof globalThis<"u"?globalThis:J||self,t(J.FeatherKComposables={},J.Vue,J.useFocusTrap))})(this,(function(J,t,xe){"use strict";const Me=(e,n)=>{const u=t.ref(null);let q=!1,$=null,I=null;const K=[],A=".k-table-row[data-grid-row-index] [tabindex]",k=()=>e?.value?.columns,S=l=>{const y=l.key||l.code;[" ","Spacebar","Space","Enter"].includes(y)&&(l.preventDefault(),l.stopPropagation(),u.value=l.target,l.target.click())},v=l=>{if(!u.value)return;if(l.code==="Escape"){l.stopPropagation(),u.value&&u.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),i=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(i){if(l.code==="Tab"){const c=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],g=n?.focusableMenuSelectors??c,b=Array.from(i.querySelectorAll(g.join(",")));if(b.length===0)return;const D=b.findIndex(N=>N===document.activeElement);let C;D===-1?C=0:l.shiftKey?C=(D-1+b.length)%b.length:C=(D+1)%b.length,l.preventDefault(),l.stopPropagation(),b[C]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const c=y.findIndex(b=>b===document.activeElement);let g=c;l.code==="ArrowUp"?g=c>0?c-1:y.length-1:l.code==="ArrowDown"&&(g=c<y.length-1?c+1:0),y[g]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const c=u.value?.parentElement;(l.shiftKey?c?.previousElementSibling:c?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},L=()=>{$=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;if(c.classList.contains("k-animation-container")){const b=u.value;b&&(b.dataset.featherKSortable==="true"||t.nextTick(()=>{c.querySelectorAll(".k-columnmenu-item-wrapper").forEach(N=>{N.textContent?.toLowerCase().includes("sort")&&N.remove()})})),c.addEventListener("keydown",v),t.nextTick(()=>{const D=()=>{const C=Array.from(c.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(C.length===1)C[0].focus(),C[0].click(),D.attempts=0;else if(C.length>1){D.attempts=0;return}else D.attempts===void 0&&(D.attempts=0),D.attempts++<3&&setTimeout(D,200)};D()})}c.querySelectorAll(".k-animation-container").forEach(b=>{b.addEventListener("keydown",v)})}}),y.removedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const c=i;c.classList.contains("k-animation-container")&&c.removeEventListener("keydown",v),c.querySelectorAll(".k-animation-container").forEach(b=>{b.removeEventListener("keydown",v)})}})})}),$.observe(document.body,{childList:!0,subtree:!0})},E=l=>{if(!l.type||!l)return;const y=l.target;if(y){if(l.code==="Escape"){const i=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(i){l.preventDefault(),l.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(g=>g.setAttribute("tabindex","-1"))}catch{}i.setAttribute("tabindex","0"),i.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","Space"].includes(l.code)){if(l.preventDefault(),y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){u.value=y;return}const i=y.closest(".k-table-row[data-grid-row-index]");if(i){if(["ArrowDown","ArrowUp"].includes(l.code)){const c=(b,D)=>{let C=D==="next"?b.nextElementSibling:b.previousElementSibling;for(;C;){const N=C;try{if(N.classList.contains("k-table-row"))return N}catch{}C=D==="next"?C.nextElementSibling:C.previousElementSibling}return null},g=l.code==="ArrowDown"?c(i,"next"):c(i,"previous");g&&(i.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault();const c=i.querySelectorAll(A);if(c.length===0)return;let g=Array.from(c).findIndex(b=>b===document.activeElement);if(g===-1&&document.activeElement===i){c[0].focus();return}l.code==="ArrowRight"?g=g===c.length-1?0:g+1:l.code==="ArrowLeft"&&(g=g===c.length-1?g-1:c.length-1),c[g].focus();return}}}}},T=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},F=()=>{if(!I)try{const l=()=>{try{const c=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!c||c.length===0||c.filter(D=>D.getAttribute("tabindex")==="0").length===1)return;const b=c.find(D=>D===document.activeElement||D.contains(document.activeElement));if(c.forEach(D=>D.setAttribute("tabindex","-1")),b){b.setAttribute("tabindex","0");return}c[0].setAttribute("tabindex","0")}catch(c){console.error("ensureSingleTabindex error:",c)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((c,g)=>{c.setAttribute("tabindex",g===0?"0":"-1")});const i=e.value.$el.querySelector(".k-table-tbody");i&&(I=new MutationObserver(()=>{l()}),I.observe(i,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},U=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.setAttribute("role","button"),i.addEventListener("keydown",S)}),L(),h()})},p=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(i=>{i.removeEventListener("keydown",S)}),$&&($.disconnect(),$=null),I&&(I.disconnect(),I=null),K.forEach(i=>i()),K.length=0},h=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((i,c)=>{const g=i.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!g)return;const b=k();if(b&&b[c]){const P=b[c].field??"";i.setAttribute("data-feather-k-field",P),i.setAttribute("data-feather-k-filterable",b[c].filterable===!1?"false":"true"),i.setAttribute("data-feather-k-sortable",b[c].sortable===!1?"false":"true")}const D=i.dataset.featherKFilterable!=="false",C=i.dataset.featherKSortable!=="false";g.setAttribute("tabindex","-1"),D||C?i.style.cursor="pointer":i.style.cursor="default",D?(i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-haspopup","menu")):(i.setAttribute("tabindex","0"),i.setAttribute("role","columnheader"),i.removeAttribute("aria-haspopup"));const N=P=>{P.target?.closest(".k-column-resizer")||(u.value=i,g.click())},_=P=>{if(D)u.value=i,P.preventDefault(),P.stopPropagation(),N(P);else if(C){u.value=i;const ee=new KeyboardEvent("keydown",{key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0});i.dispatchEvent(ee)}};i.addEventListener("click",_),K.push(()=>{i.removeEventListener("click",_)});const re=P=>{if((P.code==="Enter"||P.code==="Space")&&(D||C)){if(u.value=i,u.value.focus(),D)P.preventDefault(),P.stopPropagation(),N(P);else if(C){const ee=i.querySelector(".k-link");ee&&ee.click()}}};i.addEventListener("keydown",re,!0),K.push(()=>{i.removeEventListener("keydown",re,!0)})});const y=document.querySelector(".k-grid-header .k-table-thead");if(y){const i=c=>{const g=c.target.closest("th");g&&(c.code==="Enter"||c.code==="Space")&&g.dataset.featherKFilterable==="false"&&g.dataset.featherKSortable==="false"&&(c.preventDefault(),c.stopImmediatePropagation())};y.addEventListener("keydown",i,!0),K.push(()=>{y.removeEventListener("keydown",i,!0)})}},O=function(l,y){const i=l?.event?.event.target,c=k();if(!i||!c)return;const g=i.classList.contains("k-link"),b=i.classList.contains("k-columnmenu-item"),D=c.find(C=>C.field===l?.event?.field)?.sortable&&!0;if(!g){if(b&&!D){l?.event?.sort?.filter(N=>N.field!==l?.event?.field);return}typeof y=="function"&&t.nextTick(()=>{u.value&&u.value.focus(),y(l)})}},j=()=>{if(!q)try{T(),F(),U(),q=!0}catch(l){console.error("initA11y failed:",l),p()}};return t.onBeforeUnmount(()=>{p()}),{activeFilterButton:u,handleGridKeyDown:E,handleSortChange:O,initA11y:j}};function Te(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.dateFormat??"mm/dd/yyyy"),I=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],k=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v=a=>a<=2?"mm":a<=5?"dd":S.value.length<=10?"yyyy":"mm",L=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),E=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),T=t.computed(()=>{const a=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(4,"0")}),F=a=>{if(S.value.length===0){e.onChange({value:null,event:a});return}if(S.value.length<8){e.onChange({value:null,event:a});return}if((n.value??"").length===10&&S.value.length===8){const[f,M,o]=n.value.split("/"),s=parseInt(f),m=parseInt(M),w=parseInt(o);if(j(w,s,m)){const V=new Date(w,s-1,m);U(V)?e.onChange({value:V,event:a}):e.onChange({value:null,event:a})}else e.onChange({value:null,event:a})}},U=a=>{const f=e.min??void 0,M=e.max??void 0;return!(f&&a<f||M&&a>M)},p=t.computed(()=>{if((n.value??"").length===10&&S.value.length===8){const[a,f,M]=(n.value??"").split("/"),o=parseInt(a),s=parseInt(f),m=parseInt(M);if(j(m,o,s))return new Date(m,o-1,s)}return null}),h=t.computed(()=>(n.value??"").length===10&&S.value.length===8),O=(a,f)=>new Date(a,f,0).getDate(),j=(a,f,M)=>f>=1&&f<=12&&a>=1900&&M>=1&&M<=O(a,f),l=a=>{n.value=a.value;const f=a.event?.target;u.value=f?.selectionStart??0,F(a)},y=a=>{u.value=a.target.selectionStart??0},i=(a,f,M)=>{const o=f?.selectionStart??u.value??0;u.value=o;let s=parseInt(L.value),m=parseInt(E.value),w=parseInt(T.value);if(!(S.value.length>=8)||!j(w,s,m)){const B=e.defaultValue??new Date;s=B.getMonth()+1,m=B.getDate(),w=B.getFullYear(),n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(w)}`;const W=new Date(w,s-1,m);e.onChange({value:U(W)?W:null,event:M}),C({useRAF:!0});return}const z=v(o);if(z==="mm")s=a==="ArrowUp"?s<12?s+1:1:s>1?s-1:12;else if(z==="dd"){const B=new Date(w,s,0).getDate();m=a==="ArrowUp"?m<B?m+1:1:m>1?m-1:B}else z==="yyyy"&&(w=a==="ArrowUp"?w+1:Math.max(1,w-1));n.value=`${String(s).padStart(2,"0")}/${String(m).padStart(2,"0")}/${String(w)}`;const[G,H,ae]=n.value.split("/"),oe=new Date(parseInt(ae),parseInt(G)-1,parseInt(H));oe.toString()!=="Invalid Date"&&parseInt(ae)>=1e3?e.onChange({value:U(oe)?oe:null,event:M}):e.onChange({value:null,event:M}),C({useRAF:!0})},c=a=>{if(a.code==="Space"||a.key===" "){e.onShowCalendar(a);return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault();const f=a.target;i(a.key,f,a)}},g=a=>{a.preventDefault();const f=a.deltaY<0?"ArrowUp":"ArrowDown";i(f,a.target,a)},b=a=>{const f=a.target;if(k.includes(a.key)){u.value=f?.selectionStart??0;return}if(A.includes(a.key)){if(a.altKey)return;a.preventDefault(),u.value=f?.selectionStart??0}},D=a=>{K.value=!0,I.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const f=a.target;f&&(u.value=f.selectionStart??0)},C=a=>{const f=()=>{const M=document.getElementById(e.id);if(!M)return;const o=a?.pos??u.value??M.value.length;try{M.focus(),M.setSelectionRange(o,o)}catch{}};t.nextTick(()=>{if(a?.delay&&a.delay>0){setTimeout(f,a.delay);return}if(a?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const f=new Date(a);if(f.toString()!=="Invalid Date"){const M=(f.getMonth()+1).toString().padStart(2,"0"),o=f.getDate().toString().padStart(2,"0"),s=f.getFullYear().toString();n.value=`${M}/${o}/${s}`,C({delay:50});return}}},{immediate:!0});const N=t.computed(()=>[["Date",`${L.value} / ${E.value} / ${T.value}`],["Digits only",S.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),_=t.computed(()=>{if(!I.value){if(!h.value)return!0;const f=p.value;return f?U(f):!1}if(!K.value)return!0;const a=p.value;return!h.value||!a?!1:U(a)}),re=t.computed(()=>{if(!I.value){if(!h.value)return;const f=p.value;return f?U(f)?"valid":"out-of-bounds":"invalid-date"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const a=p.value;return a?U(a)?"valid":"out-of-bounds":"invalid-date"}),P=t.computed(()=>{const a=re.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-date")return`Must be in ${$.value} format.`;const f=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,M=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(a==="out-of-bounds"){if(f&&M)return`Must be between ${f} and ${M}.`;if(f)return`Must be on or after ${f}.`;if(M)return`Must be on or before ${M}.`}return""}),ee=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=a.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const M=f.parentElement;if(M){if(M.classList.contains("fk-datepicker"))return;M.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{ee()}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:N,placeholder:$,isValid:_,reason:t.readonly(re),validationMessage:P,digitsOnly:S,month:t.readonly(L),day:t.readonly(E),year:t.readonly(T),datePart:v,handleChange:l,handleKeyDown:c,handleWheel:g,handleKeyUp:b,handleClick:y,handleBlur:D,initStyling:ee}}function Ce(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(!1),I=1440*60*1e3,K=365*I,A=new Date,k=new Date(A.getTime()-K),S=new Date(A.getTime()+K);e.min=e.min??k,e.max=e.max??S;const v=t.computed(()=>(n.value??"").replace(/\D/g,"")),L=(r,d)=>new Date(r,d,0).getDate(),E=(r,d,x)=>d>=1&&d<=12&&r>=1e3&&x>=1&&x<=L(r,d),T=r=>Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),F=r=>{if(!r)return null;const d=e.min??new Date(Date.now()-90*I),x=e.max??new Date,R=T(r);return R<T(d)||R>T(x)?null:r},U=(r,d)=>e.allowReverse??!1?!0:r<=d,p=t.computed(()=>(n.value?.length??0)>=23&&v.value.length>=16),h=r=>{if((r??"").length<23||v.value.length<16)return{start:null,end:null};const d=r.substring(0,10),x=r.substring(13,23),[R,Q,ne]=d.split("/").map(ie=>parseInt(ie||"0",10)),[me,ue,ce]=x.split("/").map(ie=>parseInt(ie||"0",10)),de=new Date(ne,R-1,Q),ye=new Date(ce,me-1,ue),be=E(ne,R,Q)&&de.toString()!=="Invalid Date",Se=E(ce,me,ue)&&ye.toString()!=="Invalid Date";return{start:be?de:null,end:Se?ye:null}},O=e.externalValid??t.ref(!0),j=t.computed(()=>h(n.value)),l=t.computed(()=>{const r=F(j.value.start),d=F(j.value.end);return{start:r,end:d}}),y=t.computed(()=>{if(!p.value)return;const r=l.value.start,d=l.value.end;if(!r||!d)return;const x=Math.abs(T(d)-T(r));return Math.round(x/864e5+1)}),i=t.computed(()=>{if(!p.value)return!1;const{start:r,end:d}=j.value;if(!r||!d||!l.value.start||!l.value.end)return!1;const x=l.value.start,R=l.value.end;return!(!U(x,R)||typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays)}),c=t.computed(()=>{const{start:r,end:d}=j.value;if(!p.value)return"incomplete";if(!r||!d)return"invalid-date";if(!l.value.start||!l.value.end)return"out-of-bounds";const x=l.value.start,R=l.value.end;return U(x,R)?typeof e.maxSpanDays=="number"&&y.value!==void 0&&y.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),g=t.ref(void 0),b=t.computed(()=>{if(O.value!==!1)return"";const{min:r,max:d}=e,x=g.value;if(!x)return"";switch(x){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return r&&d?`Dates must be between ${_(r)} and ${_(d)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),D=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],N=(r,d)=>String(r).padStart(d,"0"),_=r=>`${N(r.getMonth()+1,2)}/${N(r.getDate(),2)}/${N(r.getFullYear(),4)}`,re=r=>r<=2?{side:"start",part:"mm"}:r<=5?{side:"start",part:(r<=3,"dd")}:r<=11?{side:"start",part:"yyyy"}:r<=15?{side:"end",part:"mm"}:r<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},P=(r,d,x)=>{const R=d?.selectionStart??u.value??0;u.value=R;const{start:Q,end:ne}=h(n.value);if(!Q&&!ne){const Y=new Date,le=_(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const X=document.getElementById(e.id),Z=u.value??0;X&&(X.focus(),X.setSelectionRange(Z,Z))})});return}const me=new Date,ue=re(R);let ce=Q?new Date(Q):new Date(me),de=ne?new Date(ne):new Date(me);const ye=(Y,le)=>{if(le==="mm"){const X=Y.getMonth()+1,Z=r==="ArrowUp"?X<12?X+1:1:X>1?X-1:12;Y.setMonth(Z-1);const ge=L(Y.getFullYear(),Z);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const X=L(Y.getFullYear(),Y.getMonth()+1),Z=Y.getDate(),ge=r==="ArrowUp"?Z<X?Z+1:1:Z>1?Z-1:X;Y.setDate(ge)}else if(le==="yyyy"){const X=Y.getFullYear();Y.setFullYear(r==="ArrowUp"?X+1:Math.max(1,X-1));const Z=L(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>Z&&Y.setDate(Z)}};ue.side==="start"?ye(ce,ue.part):ye(de,ue.part);const be=_(ce),Se=_(de);n.value=`${be} - ${Se}`;const ie=F(ce),we=F(de);ie&&we&&U(ie,we)?e.onChange({value:{start:ie,end:we},event:x}):e.onChange({value:null,event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=u.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},ee=r=>{const{start:d,end:x}=h(n.value);if(!d||!x){e.onChange({value:null,event:r});return}const R=F(d),Q=F(x);if(!R||!Q){e.onChange({value:null,event:r});return}if(!U(R,Q)){e.onChange({value:null,event:r});return}e.onChange({value:{start:R,end:Q},event:r})},a=r=>{const d=r.value??"",x=r.event;if(!d&&x&&x.type==="click"){V(x);return}n.value=d;const R=x?.target;u.value=R?.selectionStart??0,ee(r)},f=r=>{u.value=r.target.selectionStart??0},M=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),e.onShowCalendar(r);return}if(D.includes(r.key)){r.preventDefault();const d=r.target;P(r.key,d,r)}},o=r=>{r.preventDefault();const d=r.deltaY<0?"ArrowUp":"ArrowDown";P(d,r.target,r)},s=r=>{if(C.includes(r.key)||D.includes(r.key)){r.preventDefault();const d=r.target;u.value=d?.selectionStart??0}},m=()=>{g.value=c.value,(e.manageValid??!0)&&(O.value=i.value)},w=r=>{m()},V=r=>{console.log("Clear event:",r),n.value="",u.value=0,e.onChange({value:null,event:r}),m(),t.nextTick(()=>{const d=document.getElementById(e.id);d&&(d.focus(),d.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,r=>{const d=r?.start??null,x=r?.end??null;if(d&&x){if(n.value=`${_(d)} - ${_(x)}`,e.isOpen?.value&&$.value&&e.onRequestClose){const R=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),$.value=!1,m()},R)}return}},{immediate:!0});const z=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),G=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),H=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),ae=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),oe=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),B=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),W=t.computed(()=>{const{start:r,end:d}=h(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(z.value).padStart(2,"0")} / ${String(G.value).padStart(2,"0")} / ${String(H.value).padStart(4,"0")}`},{label:"End",value:`${String(ae.value).padStart(2,"0")} / ${String(oe.value).padStart(2,"0")} / ${String(B.value).padStart(4,"0")}`},{label:"Digits only",value:v.value},{label:"Mask complete",value:`${p.value}`},{label:"Parsed",value:`${r?r.toDateString():"-"} | ${d?d.toDateString():"-"}`},{label:"Valid (managed)",value:`${O.value??"-"}`},{label:"Span (days)",value:`${y.value??"-"}`},{label:"Reason",value:`${c.value??"-"}`},{label:"Cursor in",value:`${u.value??"-"} (${(()=>{const x=u.value??0,R=re(x);return`${R.side}.${R.part}`})()})`}]}),te=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const d=r.closest("div");if(!d){console.warn(`Parent div of #${e.id} not found for styling.`);return}d.classList.contains("fk-daterangepicker")||d.classList.add("fk-daterangepicker")})};t.onMounted(()=>{te()});const pe=()=>{t.nextTick(()=>{try{const r=Array.from(document.querySelectorAll(".k-animation-container"));if(!r.length)return;const x=[...r].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!x)return;const R=x.querySelectorAll(".k-calendar-table");let Q=!1;R.forEach(ne=>{ne.tabIndex===0&&(Q?ne.tabIndex=-1:Q=!0)})}catch(r){console.warn(r)}})};return e.isOpen&&t.watch(e.isOpen,r=>{r&&setTimeout(()=>pe(),0)},{immediate:!1}),{raw:n,cursorPos:u,debugEnabled:q,debugLines:W,digitsOnly:v,valid:O,validComputed:t.readonly(i),reason:t.readonly(c),validationMessage:t.readonly(b),spanDays:t.readonly(y),month1:t.readonly(z),day1:t.readonly(G),year1:t.readonly(H),month2:t.readonly(ae),day2:t.readonly(oe),year2:t.readonly(B),handleChange:a,handleKeyDown:M,handleWheel:o,handleKeyUp:s,handleClick:f,handleBlur:w,handleClear:V,onCalendarChange:()=>{$.value=!0},initStyling:te}}function $e(e){const n=t.ref(""),u=t.ref(void 0),q=t.ref(!!e.debug),$=t.ref(e.timeFormat??"hh:mm AM"),I=t.computed(()=>!!e.required),K=t.ref(!1),A=["ArrowUp","ArrowDown"],k=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),v={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},L=o=>o<=2?"hh":o<=5?"mm":"ampm",E=t.computed(()=>{const o=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),23)}),T=t.computed(()=>{const o=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),59)}),F=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),U=t.computed(()=>{const o=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),s=F.value;return o===12?s==="AM"?0:12:s==="PM"?o+12:o}),p=t.computed(()=>h.value?`${String(U.value).padStart(2,"0")}:${String(T.value).padStart(2,"0")}:00`:null),h=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),O=(o,s,m)=>{let w=o%12;return w===0&&(w=12),`${String(w).padStart(2,"0")}:${String(s).padStart(2,"0")} ${m}`},j=o=>{const s=o.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!s)return null;const m=parseInt(s[1]),w=parseInt(s[2]),V=s[3].toUpperCase();if(m<1||m>12||w<0||w>59)return null;let z=m%12;V==="PM"&&(z+=12);const G=new Date;return G.setSeconds(0,0),G.setHours(z),G.setMinutes(w),G},l=o=>{if(S.value.length===0){e.onChange({value:null,event:o});return}if(!h.value){e.onChange({value:null,event:o});return}const s=j(n.value);s&&i(s)?e.onChange({value:s,event:o}):e.onChange({value:null,event:o})},y=o=>o.getHours()*60+o.getMinutes(),i=o=>{const s=e.min??void 0,m=e.max??void 0,w=y(o);if(s){const V=y(s);if(w<V)return!1}if(m){const V=y(m);if(w>V)return!1}return!0},c=o=>{n.value=o.value;const s=o.event?.target;u.value=s?.selectionStart??0;try{const m=u.value??0;if(L(m)==="ampm"&&(n.value??"").length>=8){const w=n.value.charAt(6);/[Aa]/.test(w)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})})):/[Pp]/.test(w)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const V=document.getElementById(e.id);V&&(V.focus(),V.setSelectionRange(8,8))})}))}}catch{}l(o)},g=o=>{u.value=o.target.selectionStart??0},b=(o,s,m)=>{const w=s?.selectionStart??u.value??0;u.value=w;const V=L(w),z=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!z){if((n.value??"").length===0||S.value.length===0){const B=new Date,W=B.getHours(),te=W>=12?"PM":"AM";n.value=O(W,B.getMinutes(),te);const pe=j(n.value);pe&&i(pe)?e.onChange({value:pe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id),d=u.value??0;r&&(r.focus(),r.setSelectionRange(d,d))})})}return}let G=parseInt(z[1]),H=parseInt(z[2]),ae=z[3].toUpperCase();if(V==="hh")o==="ArrowUp"?G=G<12?G+1:1:G=G>1?G-1:12;else if(V==="mm"){const B=e.minuteStepRef?.value??e.minuteStep??1;if(B===1)o==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(o==="ArrowUp"){const W=H%B;let te=W===0?H+B:H+(B-W);te>=60&&(te=0),H=te}else{const W=H%B;let te=W===0?H-B:H-W;te<0&&(te=60-B),H=te}}else V==="ampm"&&(ae=ae==="AM"?"PM":"AM");n.value=`${String(G).padStart(2,"0")}:${String(H).padStart(2,"0")} ${ae}`;const oe=j(n.value);oe&&i(oe)?e.onChange({value:oe,event:m}):e.onChange({value:null,event:m}),t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id),W=u.value??0;B&&(B.focus(),B.setSelectionRange(W,W))})})},D=o=>{if(o.code==="Space"||o.key===" "){e.onShowPicker(o);return}if(A.includes(o.key)){o.preventDefault();const s=o.target;b(o.key,s,o)}},C=o=>{o.preventDefault();const s=o.deltaY<0?"ArrowUp":"ArrowDown";b(s,o.target,o)},N=o=>{const s=o.target;if(k.includes(o.key)){u.value=s?.selectionStart??0;return}A.includes(o.key)&&(o.preventDefault(),u.value=s?.selectionStart??0)},_=o=>{K.value=!0,I.value&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const s=o.target;s&&(u.value=s.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,o=>{if(o){const s=new Date(o);if(s.toString()!=="Invalid Date"){const m=s.getHours(),w=m>=12?"PM":"AM";n.value=O(m,s.getMinutes(),w);return}}},{immediate:!0});const re=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",U.value],["Minute",T.value],["Period",F.value],["Time (24h)",p.value??"--:--:--"],["Digits only",S.value],["Parsed Date",P.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",ee.value],["reason",a.value],["validationMessage",f.value]]),P=t.computed(()=>j(n.value)??null),ee=t.computed(()=>{if(!I.value){if(!h.value)return!0;const s=P.value;return s?i(s):!1}if(!K.value)return!0;const o=P.value;return!h.value||!o?!1:i(o)}),a=t.computed(()=>{if(!I.value){if(!h.value)return;const s=P.value;return s?i(s)?"valid":"out-of-bounds":"invalid-time"}if(!K.value)return;if(S.value.length===0||!h.value)return"incomplete";const o=P.value;return o?i(o)?"valid":"out-of-bounds":"invalid-time"}),f=t.computed(()=>{const o=a.value;if(!o||o==="valid")return"";if(o==="incomplete")return"Required";if(o==="invalid-time")return`Must be in ${$.value} format.`;const s={hour:"2-digit",minute:"2-digit"},m=e.min?e.min.toLocaleTimeString("en-US",s):null,w=e.max?e.max.toLocaleTimeString("en-US",s):null;if(o==="out-of-bounds"){if(m&&w)return`Must be between ${m} and ${w}.`;if(m)return`Must be ${m} or later.`;if(w)return`Must be ${w} or earlier.`}return""}),M=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const s=o.closest(".k-timepicker");if(!s){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const m=s.parentElement;if(!m){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}m.classList.contains("fk-timepicker")||m.classList.add("fk-timepicker")})};return t.onMounted(()=>{M()}),{raw:n,rules:v,debugEnabled:q,debugLines:re,placeholder:$,isValid:ee,reason:t.readonly(a),validationMessage:f,isComplete:h,inRangeTime:i,cursorPos:u,hour:t.readonly(E),hour24:t.readonly(U),minute:t.readonly(T),period:t.readonly(F),time24:t.readonly(p),parsedRawTime:t.readonly(P),handleChange:c,handleKeyDown:D,handleKeyUp:N,handleClick:g,handleWheel:C,handleBlur:_,initStyling:M}}function Ie(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const ke=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Fe=Object.prototype.toString,Le=e=>Fe.call(e)==="[object Object]",se=()=>{},Pe=Re();function Re(){var e,n;return 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,u){return t.watch(e,n,{...u,immediate:!0})}const De=ke?window:void 0;function fe(e){var n;const u=t.toValue(e);return(n=u?.$el)!=null?n:u}function ve(...e){const n=[],u=()=>{n.forEach(A=>A()),n.length=0},q=(A,k,S,v)=>(A.addEventListener(k,S,v),()=>A.removeEventListener(k,S,v)),$=t.computed(()=>{const A=he(t.toValue(e[0])).filter(k=>k!=null);return A.every(k=>typeof k!="string")?A:void 0}),I=qe(()=>{var A,k;return[(k=(A=$.value)==null?void 0:A.map(S=>fe(S)))!=null?k:[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,k,S,v])=>{if(u(),!A?.length||!k?.length||!S?.length)return;const L=Le(v)?{...v}:v;n.push(...A.flatMap(E=>k.flatMap(T=>S.map(F=>q(E,T,F,L)))))},{flush:"post"}),K=()=>{I(),u()};return Ie(u),K}let Ae=!1;function Ue(e,n,u={}){const{window:q=De,ignore:$=[],capture:I=!0,detectIframe:K=!1,controls:A=!1}=u;if(!q)return A?{stop:se,cancel:se,trigger:se}:se;if(Pe&&!Ae){Ae=!0;const p={passive:!0};Array.from(q.document.body.children).forEach(h=>h.addEventListener("click",se,p)),q.document.documentElement.addEventListener("click",se,p)}let k=!0;const S=p=>t.toValue($).some(h=>{if(typeof h=="string")return Array.from(q.document.querySelectorAll(h)).some(O=>O===p.target||p.composedPath().includes(O));{const O=fe(h);return O&&(p.target===O||p.composedPath().includes(O))}});function v(p){const h=t.toValue(p);return h&&h.$.subTree.shapeFlag===16}function L(p,h){const O=t.toValue(p),j=O.$.subTree&&O.$.subTree.children;return j==null||!Array.isArray(j)?!1:j.some(l=>l.el===h.target||h.composedPath().includes(l.el))}const E=p=>{const h=fe(e);if(p.target!=null&&!(!(h instanceof Element)&&v(e)&&L(e,p))&&!(!h||h===p.target||p.composedPath().includes(h))){if("detail"in p&&p.detail===0&&(k=!S(p)),!k){k=!0;return}n(p)}};let T=!1;const F=[ve(q,"click",p=>{T||(T=!0,setTimeout(()=>{T=!1},0),E(p))},{passive:!0,capture:I}),ve(q,"pointerdown",p=>{const h=fe(e);k=!S(p)&&!!(h&&!p.composedPath().includes(h))},{passive:!0}),K&&ve(q,"blur",p=>{setTimeout(()=>{var h;const O=fe(e);((h=q.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!O?.contains(q.document.activeElement)&&n(p)},0)},{passive:!0})].filter(Boolean),U=()=>F.forEach(p=>p());return A?{stop:U,cancel:()=>{k=!1},trigger:p=>{k=!0,E(p),k=!1}}:U}function Oe(e){const n=t.shallowRef(null),u=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],q=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??u].flat(),$=v=>v?typeof e.initialFocus=="string"?v.querySelector(e.initialFocus)??v:typeof e.initialFocus=="function"?e.initialFocus(v)??v:v.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??v:null,{activate:I,deactivate:K}=xe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>$(n.value),...e.focusTrapOptions??{}});let A=null,k=t.ref(null);const S=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const v=(E,T)=>{const F=Array.from(E.querySelectorAll(T));if(!F.length)return null;const U=F.filter(p=>p.offsetParent!==null||p.getClientRects().length>0);return U[U.length-1]??F[F.length-1]??null},L=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of q){const T=v(L,E);if(T)return T}for(const E of q){const T=v(document,E);if(T)return T}return null};return Ue(n,v=>{k.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",v)}),t.watch(()=>e.isOpen.value,v=>{v?(k.value=null,t.nextTick(()=>{const L=S();L&&(n.value=L,setTimeout(()=>I(),0),A||(A=E=>{E.key==="Escape"&&(k.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",A,!0)))})):(K(),A&&(document.removeEventListener("keydown",A,!0),A=null),n.value=null,k.value==="outside"&&t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value,T=E?.querySelector("input"),F=document.activeElement;F&&(F===T||E&&E.contains(F))&&(T??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(L,0))}),e.returnFocusToTrigger!==!1&&k.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const L=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(L,0))})))}),{popupRef:n,activate:I,deactivate:K,lastCloseReason:t.readonly(k),setPopupEl:v=>n.value=v}}const Ve=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Be=e=>!!e&&typeof e=="object"&&"field"in e,Ee=(e,n)=>!e||typeof e!="object"?!1:Ve(e)?e.filters.some(u=>Ee(u,n)):Be(e)?e.field===n:!1,Ke=e=>{const n=t.ref({}),u=$=>!e.value||!e.value.filters?!1:e.value.filters.some(I=>Ee(I,$));return{activeClasses:n,hasFieldFilter:u,updateActiveClass:$=>{const I=u($);console.log("updateActiveClass for",$,"hasFilter:",I),n.value[$]=I?"active":"",console.log("activeClasses after update",n.value)}}};J.useGridA11y=Me,J.useGridFilter=Ke,J.useMaskedDateInput=Te,J.useMaskedDateRangeInput=Ce,J.useMaskedTimeInput=$e,J.usePopupTrap=Oe,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
|