@featherk/composables 0.9.2 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/address/useUSAddress.d.ts +8 -3
- package/dist/address/useZipTextBox.d.ts +1 -0
- package/dist/featherk-composables.es.js +794 -772
- package/dist/featherk-composables.es.js.map +1 -0
- package/dist/featherk-composables.umd.js +2 -1
- package/dist/featherk-composables.umd.js.map +1 -0
- package/docs/address/useUSAddress.md +31 -0
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as Z, onBeforeUnmount as Ve, nextTick as W, computed as c, watchEffect as $e, toValue as le, reactive as Re, watch as de, onMounted as Me, readonly as J, getCurrentScope as Le, onScopeDispose as qe, unref as Oe, shallowRef as Ue } from "vue";
|
|
2
2
|
import { useFocusTrap as Ke } from "@vueuse/integrations/useFocusTrap";
|
|
3
3
|
const ut = (e, t) => {
|
|
4
|
-
const l =
|
|
5
|
-
let
|
|
6
|
-
const
|
|
4
|
+
const l = Z(null);
|
|
5
|
+
let h = !1, v = null, $ = null;
|
|
6
|
+
const M = [], k = ".k-table-row[data-grid-row-index] [tabindex]", C = () => {
|
|
7
7
|
const o = e?.value?.$el;
|
|
8
8
|
return o ? o.closest(".k-grid") : null;
|
|
9
9
|
}, D = (o) => {
|
|
10
|
-
const g =
|
|
10
|
+
const g = C();
|
|
11
11
|
if (!g) return !1;
|
|
12
12
|
const s = o.closest(".k-grid-aria-root");
|
|
13
13
|
if (s)
|
|
14
14
|
return g.contains(s);
|
|
15
|
-
const
|
|
15
|
+
const d = o.closest(
|
|
16
16
|
".k-grid-header, .k-grid-content, .k-grid-content-locked"
|
|
17
17
|
);
|
|
18
|
-
return
|
|
19
|
-
},
|
|
18
|
+
return d ? g.contains(d) : !1;
|
|
19
|
+
}, I = (o) => o.key === "Enter" || o.code === "Enter" || o.code === "NumpadEnter", V = () => e?.value?.columns, w = (o) => {
|
|
20
20
|
const g = o.key || o.code;
|
|
21
|
-
([" ", "Spacebar", "Space"].includes(g) ||
|
|
22
|
-
},
|
|
21
|
+
([" ", "Spacebar", "Space"].includes(g) || I(o)) && (o.preventDefault(), o.stopPropagation(), l.value = o.target, o.target.click());
|
|
22
|
+
}, y = (o) => {
|
|
23
23
|
if (!l.value) return;
|
|
24
24
|
if (o.code === "Escape") {
|
|
25
25
|
o.stopPropagation(), l.value && l.value.focus();
|
|
@@ -34,7 +34,7 @@ const ut = (e, t) => {
|
|
|
34
34
|
);
|
|
35
35
|
if (s) {
|
|
36
36
|
if (o.code === "Tab") {
|
|
37
|
-
const
|
|
37
|
+
const d = [
|
|
38
38
|
// ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
|
|
39
39
|
// ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
40
40
|
// ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
|
|
@@ -43,53 +43,53 @@ const ut = (e, t) => {
|
|
|
43
43
|
"input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
44
44
|
"button:not([tabindex='-1']):not([disabled])",
|
|
45
45
|
".k-checkbox"
|
|
46
|
-
], E = t?.focusableMenuSelectors ??
|
|
46
|
+
], E = t?.focusableMenuSelectors ?? d, m = Array.from(
|
|
47
47
|
s.querySelectorAll(E.join(","))
|
|
48
48
|
);
|
|
49
|
-
if (
|
|
50
|
-
const x =
|
|
51
|
-
(
|
|
49
|
+
if (m.length === 0) return;
|
|
50
|
+
const x = m.findIndex(
|
|
51
|
+
(Y) => Y === document.activeElement
|
|
52
52
|
);
|
|
53
53
|
let q;
|
|
54
|
-
x === -1 ? q = 0 : o.shiftKey ? q = (x - 1 +
|
|
54
|
+
x === -1 ? q = 0 : o.shiftKey ? q = (x - 1 + m.length) % m.length : q = (x + 1) % m.length, o.preventDefault(), o.stopPropagation(), m[q]?.focus();
|
|
55
55
|
}
|
|
56
56
|
} else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
|
|
57
57
|
o.preventDefault(), o.stopPropagation();
|
|
58
|
-
const
|
|
59
|
-
(
|
|
58
|
+
const d = g.findIndex(
|
|
59
|
+
(m) => m === document.activeElement
|
|
60
60
|
);
|
|
61
|
-
let E =
|
|
62
|
-
o.code === "ArrowUp" ? E =
|
|
61
|
+
let E = d;
|
|
62
|
+
o.code === "ArrowUp" ? E = d > 0 ? d - 1 : g.length - 1 : o.code === "ArrowDown" && (E = d < g.length - 1 ? d + 1 : 0), g[E]?.focus();
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (o.code === "Tab") {
|
|
66
66
|
o.preventDefault(), o.stopPropagation();
|
|
67
|
-
const
|
|
68
|
-
(o.shiftKey ?
|
|
67
|
+
const d = l.value?.parentElement;
|
|
68
|
+
(o.shiftKey ? d?.previousElementSibling : d?.nextElementSibling)?.querySelector(
|
|
69
69
|
"button, [role='button'], .k-link"
|
|
70
70
|
)?.focus();
|
|
71
71
|
}
|
|
72
|
-
},
|
|
73
|
-
|
|
72
|
+
}, F = () => {
|
|
73
|
+
v = new MutationObserver((o) => {
|
|
74
74
|
o.forEach((g) => {
|
|
75
75
|
g.addedNodes.forEach((s) => {
|
|
76
76
|
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
const d = s;
|
|
78
|
+
if (d.classList.contains("k-animation-container")) {
|
|
79
|
+
const m = l.value;
|
|
80
|
+
m && (m.dataset.featherKSortable === "true" || W(() => {
|
|
81
|
+
d.querySelectorAll(
|
|
82
82
|
".k-columnmenu-item-wrapper"
|
|
83
|
-
).forEach((
|
|
84
|
-
|
|
83
|
+
).forEach((Y) => {
|
|
84
|
+
Y.textContent?.toLowerCase().includes("sort") && Y.remove();
|
|
85
85
|
});
|
|
86
|
-
})),
|
|
86
|
+
})), d.addEventListener(
|
|
87
87
|
"keydown",
|
|
88
|
-
|
|
89
|
-
),
|
|
88
|
+
y
|
|
89
|
+
), W(() => {
|
|
90
90
|
const x = () => {
|
|
91
91
|
const q = Array.from(
|
|
92
|
-
|
|
92
|
+
d.querySelectorAll(
|
|
93
93
|
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
94
94
|
)
|
|
95
95
|
);
|
|
@@ -104,33 +104,33 @@ const ut = (e, t) => {
|
|
|
104
104
|
x();
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
d.querySelectorAll(
|
|
108
108
|
".k-animation-container"
|
|
109
|
-
).forEach((
|
|
110
|
-
|
|
109
|
+
).forEach((m) => {
|
|
110
|
+
m.addEventListener(
|
|
111
111
|
"keydown",
|
|
112
|
-
|
|
112
|
+
y
|
|
113
113
|
);
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
}), g.removedNodes.forEach((s) => {
|
|
117
117
|
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const d = s;
|
|
119
|
+
d.classList.contains("k-animation-container") && d.removeEventListener(
|
|
120
120
|
"keydown",
|
|
121
|
-
|
|
122
|
-
),
|
|
121
|
+
y
|
|
122
|
+
), d.querySelectorAll(
|
|
123
123
|
".k-animation-container"
|
|
124
|
-
).forEach((
|
|
125
|
-
|
|
124
|
+
).forEach((m) => {
|
|
125
|
+
m.removeEventListener(
|
|
126
126
|
"keydown",
|
|
127
|
-
|
|
127
|
+
y
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
-
}),
|
|
133
|
+
}), v.observe(document.body, {
|
|
134
134
|
childList: !0,
|
|
135
135
|
subtree: !0
|
|
136
136
|
});
|
|
@@ -139,7 +139,7 @@ const ut = (e, t) => {
|
|
|
139
139
|
return !!(["input", "textarea", "select", "button"].includes(g) || o.closest(
|
|
140
140
|
'.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'
|
|
141
141
|
));
|
|
142
|
-
},
|
|
142
|
+
}, f = (o) => {
|
|
143
143
|
if (!o.type || !o)
|
|
144
144
|
return;
|
|
145
145
|
const g = o.target;
|
|
@@ -149,10 +149,10 @@ const ut = (e, t) => {
|
|
|
149
149
|
);
|
|
150
150
|
if (!D(g))
|
|
151
151
|
return;
|
|
152
|
-
const
|
|
152
|
+
const d = ["ArrowLeft", "ArrowRight"].includes(
|
|
153
153
|
o.code
|
|
154
154
|
);
|
|
155
|
-
if (!(R(g) && !(s &&
|
|
155
|
+
if (!(R(g) && !(s && d))) {
|
|
156
156
|
if (o.code === "Escape") {
|
|
157
157
|
const E = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
|
|
158
158
|
if (E) {
|
|
@@ -186,42 +186,42 @@ const ut = (e, t) => {
|
|
|
186
186
|
if (["ArrowDown", "ArrowUp"].includes(o.code)) {
|
|
187
187
|
o.preventDefault(), o.stopPropagation();
|
|
188
188
|
const E = (x, q) => {
|
|
189
|
-
let
|
|
190
|
-
for (;
|
|
191
|
-
const r =
|
|
189
|
+
let Y = q === "next" ? x.nextElementSibling : x.previousElementSibling;
|
|
190
|
+
for (; Y; ) {
|
|
191
|
+
const r = Y;
|
|
192
192
|
try {
|
|
193
193
|
if (r.classList.contains("k-table-row"))
|
|
194
194
|
return r;
|
|
195
195
|
} catch {
|
|
196
196
|
}
|
|
197
|
-
|
|
197
|
+
Y = q === "next" ? Y.nextElementSibling : Y.previousElementSibling;
|
|
198
198
|
}
|
|
199
199
|
return null;
|
|
200
|
-
},
|
|
201
|
-
|
|
200
|
+
}, m = o.code === "ArrowDown" ? E(s, "next") : E(s, "previous");
|
|
201
|
+
m && (s.setAttribute("tabindex", "-1"), m.setAttribute("tabindex", "0"), m.focus());
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
if (["ArrowLeft", "ArrowRight"].includes(o.code)) {
|
|
205
205
|
o.preventDefault(), o.stopPropagation();
|
|
206
206
|
const E = s.querySelectorAll(
|
|
207
|
-
|
|
207
|
+
k
|
|
208
208
|
);
|
|
209
209
|
if (E.length === 0) return;
|
|
210
|
-
let
|
|
210
|
+
let m = Array.from(E).findIndex(
|
|
211
211
|
(x) => x === document.activeElement
|
|
212
212
|
);
|
|
213
|
-
if (
|
|
213
|
+
if (m === -1 && document.activeElement === s) {
|
|
214
214
|
E[0].focus();
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
o.code === "ArrowRight" ?
|
|
217
|
+
o.code === "ArrowRight" ? m = m === E.length - 1 ? 0 : m + 1 : o.code === "ArrowLeft" && (m = m === 0 ? E.length - 1 : m - 1), E[m].focus();
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
},
|
|
224
|
-
|
|
223
|
+
}, b = () => {
|
|
224
|
+
W(() => {
|
|
225
225
|
const o = e.value?.$el;
|
|
226
226
|
if (!o || typeof o.closest != "function") return;
|
|
227
227
|
const g = o.closest(".k-grid");
|
|
@@ -232,32 +232,32 @@ const ut = (e, t) => {
|
|
|
232
232
|
try {
|
|
233
233
|
const o = () => {
|
|
234
234
|
try {
|
|
235
|
-
const
|
|
235
|
+
const d = Array.from(
|
|
236
236
|
e.value.$el.querySelectorAll(
|
|
237
237
|
".k-table-row[data-grid-row-index]"
|
|
238
238
|
)
|
|
239
239
|
);
|
|
240
|
-
if (!
|
|
240
|
+
if (!d || d.length === 0 || d.filter(
|
|
241
241
|
(x) => x.getAttribute("tabindex") === "0"
|
|
242
242
|
).length === 1) return;
|
|
243
|
-
const
|
|
243
|
+
const m = d.find(
|
|
244
244
|
(x) => x === document.activeElement || x.contains(document.activeElement)
|
|
245
245
|
);
|
|
246
|
-
if (
|
|
247
|
-
|
|
246
|
+
if (d.forEach((x) => x.setAttribute("tabindex", "-1")), m) {
|
|
247
|
+
m.setAttribute("tabindex", "0");
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
} catch (
|
|
252
|
-
console.error("ensureSingleTabindex error:",
|
|
250
|
+
d[0].setAttribute("tabindex", "0");
|
|
251
|
+
} catch (d) {
|
|
252
|
+
console.error("ensureSingleTabindex error:", d);
|
|
253
253
|
}
|
|
254
254
|
}, g = Array.from(
|
|
255
255
|
e.value.$el.querySelectorAll(
|
|
256
256
|
".k-table-row[data-grid-row-index]"
|
|
257
257
|
)
|
|
258
258
|
);
|
|
259
|
-
g.length > 0 && g.forEach((
|
|
260
|
-
|
|
259
|
+
g.length > 0 && g.forEach((d, E) => {
|
|
260
|
+
d.setAttribute("tabindex", E === 0 ? "0" : "-1");
|
|
261
261
|
});
|
|
262
262
|
const s = e.value.$el.querySelector(".k-table-tbody");
|
|
263
263
|
s && ($ = new MutationObserver(() => {
|
|
@@ -266,87 +266,87 @@ const ut = (e, t) => {
|
|
|
266
266
|
} catch (o) {
|
|
267
267
|
console.error("Error setting up row navigation:", o);
|
|
268
268
|
}
|
|
269
|
-
},
|
|
270
|
-
|
|
269
|
+
}, j = () => {
|
|
270
|
+
W(() => {
|
|
271
271
|
const g = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
272
272
|
g && g.forEach((s) => {
|
|
273
273
|
s.setAttribute("role", "button"), s.addEventListener(
|
|
274
274
|
"keydown",
|
|
275
|
-
|
|
275
|
+
w
|
|
276
276
|
);
|
|
277
|
-
}),
|
|
277
|
+
}), F(), ee();
|
|
278
278
|
});
|
|
279
|
-
},
|
|
279
|
+
}, N = () => {
|
|
280
280
|
const g = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
281
281
|
g && g.forEach((s) => {
|
|
282
282
|
s.removeEventListener(
|
|
283
283
|
"keydown",
|
|
284
|
-
|
|
284
|
+
w
|
|
285
285
|
);
|
|
286
|
-
}),
|
|
287
|
-
},
|
|
286
|
+
}), v && (v.disconnect(), v = null), $ && ($.disconnect(), $ = null), M.forEach((s) => s()), M.length = 0;
|
|
287
|
+
}, ee = () => {
|
|
288
288
|
document.querySelectorAll(
|
|
289
289
|
".k-grid-header .k-table-thead th"
|
|
290
|
-
).forEach((s,
|
|
290
|
+
).forEach((s, d) => {
|
|
291
291
|
if (s.dataset.featherKHeaderBound === "true")
|
|
292
292
|
return;
|
|
293
293
|
const E = s.querySelector(
|
|
294
294
|
".k-grid-header-menu.k-grid-column-menu"
|
|
295
295
|
);
|
|
296
296
|
if (!E) return;
|
|
297
|
-
const
|
|
298
|
-
if (
|
|
299
|
-
const
|
|
300
|
-
s.setAttribute("data-feather-k-field",
|
|
297
|
+
const m = V();
|
|
298
|
+
if (m && m[d]) {
|
|
299
|
+
const S = m[d].field ?? "";
|
|
300
|
+
s.setAttribute("data-feather-k-field", S), s.setAttribute(
|
|
301
301
|
"data-feather-k-filterable",
|
|
302
|
-
|
|
302
|
+
m[d].filterable === !1 ? "false" : "true"
|
|
303
303
|
), s.setAttribute(
|
|
304
304
|
"data-feather-k-sortable",
|
|
305
|
-
|
|
305
|
+
m[d].sortable === !1 ? "false" : "true"
|
|
306
306
|
);
|
|
307
307
|
}
|
|
308
308
|
const x = s.dataset.featherKFilterable !== "false", q = s.dataset.featherKSortable !== "false";
|
|
309
309
|
E.setAttribute("tabindex", "-1"), x || q ? s.style.cursor = "pointer" : s.style.cursor = "default", x ? (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"));
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
}, r = (
|
|
310
|
+
const Y = (S) => {
|
|
311
|
+
S.target?.closest(".k-column-resizer") || (l.value = s, E.click());
|
|
312
|
+
}, r = (S) => {
|
|
313
313
|
if (x)
|
|
314
|
-
l.value = s,
|
|
314
|
+
l.value = s, S.preventDefault(), S.stopPropagation(), Y(S);
|
|
315
315
|
else if (q) {
|
|
316
316
|
l.value = s;
|
|
317
|
-
const
|
|
318
|
-
|
|
317
|
+
const U = s.querySelector(".k-link");
|
|
318
|
+
U && U.click();
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
|
-
s.addEventListener("click", r),
|
|
321
|
+
s.addEventListener("click", r), M.push(() => {
|
|
322
322
|
s.removeEventListener("click", r);
|
|
323
323
|
});
|
|
324
|
-
const
|
|
325
|
-
if ((
|
|
326
|
-
if (
|
|
327
|
-
|
|
324
|
+
const p = (S) => {
|
|
325
|
+
if ((I(S) || S.code === "Space") && (x || q)) {
|
|
326
|
+
if (S.preventDefault(), S.stopPropagation(), l.value = s, l.value.focus(), x)
|
|
327
|
+
Y(S);
|
|
328
328
|
else if (q) {
|
|
329
|
-
const
|
|
330
|
-
|
|
329
|
+
const U = s.querySelector(".k-link");
|
|
330
|
+
U && U.click();
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
};
|
|
334
|
-
s.addEventListener("keydown",
|
|
335
|
-
s.removeEventListener("keydown",
|
|
334
|
+
s.addEventListener("keydown", p, !0), M.push(() => {
|
|
335
|
+
s.removeEventListener("keydown", p, !0);
|
|
336
336
|
}), s.dataset.featherKHeaderBound = "true";
|
|
337
337
|
});
|
|
338
338
|
const g = document.querySelector(".k-grid-header .k-table-thead");
|
|
339
339
|
if (g && g.dataset.featherKHeaderBound !== "true") {
|
|
340
|
-
const s = (
|
|
341
|
-
const E =
|
|
342
|
-
E && (
|
|
340
|
+
const s = (d) => {
|
|
341
|
+
const E = d.target.closest("th");
|
|
342
|
+
E && (I(d) || d.code === "Space") && E.dataset.featherKFilterable === "false" && E.dataset.featherKSortable === "false" && (d.preventDefault(), d.stopImmediatePropagation());
|
|
343
343
|
};
|
|
344
344
|
g.addEventListener(
|
|
345
345
|
"keydown",
|
|
346
346
|
s,
|
|
347
347
|
!0
|
|
348
348
|
// NOTE: capture phase
|
|
349
|
-
),
|
|
349
|
+
), M.push(() => {
|
|
350
350
|
g.removeEventListener(
|
|
351
351
|
"keydown",
|
|
352
352
|
s,
|
|
@@ -354,146 +354,146 @@ const ut = (e, t) => {
|
|
|
354
354
|
);
|
|
355
355
|
}), g.dataset.featherKHeaderBound = "true";
|
|
356
356
|
}
|
|
357
|
-
},
|
|
358
|
-
const s = o?.event?.event.target,
|
|
359
|
-
if (!s || !
|
|
360
|
-
const E = s.classList.contains("k-grid-header-menu"),
|
|
357
|
+
}, te = function(o, g) {
|
|
358
|
+
const s = o?.event?.event.target, d = V();
|
|
359
|
+
if (!s || !d) return;
|
|
360
|
+
const E = s.classList.contains("k-grid-header-menu"), m = s.classList.contains("k-columnmenu-item"), x = d.find((q) => q.field === o?.event?.field)?.sortable && !0;
|
|
361
361
|
if (!E) {
|
|
362
|
-
if (
|
|
362
|
+
if (m && !x) {
|
|
363
363
|
o?.event?.sort?.filter(
|
|
364
|
-
(
|
|
364
|
+
(Y) => Y.field !== o?.event?.field
|
|
365
365
|
);
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
368
|
-
typeof g == "function" &&
|
|
369
|
-
l.value && l.value.focus(), g(o),
|
|
370
|
-
|
|
368
|
+
typeof g == "function" && W(() => {
|
|
369
|
+
l.value && l.value.focus(), g(o), W(() => {
|
|
370
|
+
ee();
|
|
371
371
|
});
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
-
},
|
|
375
|
-
if (!
|
|
374
|
+
}, se = () => {
|
|
375
|
+
if (!h)
|
|
376
376
|
try {
|
|
377
|
-
|
|
377
|
+
b(), L(), j(), h = !0;
|
|
378
378
|
} catch (o) {
|
|
379
|
-
console.error("initA11y failed:", o),
|
|
379
|
+
console.error("initA11y failed:", o), N();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
return Ve(() => {
|
|
383
|
-
|
|
383
|
+
N();
|
|
384
384
|
}), {
|
|
385
385
|
activeFilterButton: l,
|
|
386
|
-
handleGridKeyDown:
|
|
387
|
-
handleSortChange:
|
|
388
|
-
initA11y:
|
|
386
|
+
handleGridKeyDown: f,
|
|
387
|
+
handleSortChange: te,
|
|
388
|
+
initA11y: se
|
|
389
389
|
};
|
|
390
|
-
}, Ne = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Be = (e) => !!e && typeof e == "object" && "field" in e,
|
|
391
|
-
(l) =>
|
|
390
|
+
}, Ne = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Be = (e) => !!e && typeof e == "object" && "field" in e, Fe = (e, t) => !e || typeof e != "object" ? !1 : Ne(e) ? e.filters.some(
|
|
391
|
+
(l) => Fe(l, t)
|
|
392
392
|
) : Be(e) ? e.field === t : !1, ct = (e) => (t) => e.value?.filters && e.value.filters.some(
|
|
393
|
-
(l) =>
|
|
393
|
+
(l) => Fe(l, t)
|
|
394
394
|
) ? "active" : "", ze = "Enter a valid ZIP code with exactly 5 or 9 digits.", Ie = (e) => {
|
|
395
395
|
const t = e.replace(/\D/g, "").slice(0, 9);
|
|
396
396
|
return t.length > 5 ? `${t.slice(0, 5)}-${t.slice(5)}` : t;
|
|
397
397
|
}, He = (e, t) => e.slice(0, Math.max(0, t)).replace(/\D/g, "").length, Ze = (e) => e <= 5 ? e : Math.min(e + 1, 10), We = (e) => {
|
|
398
|
-
const t =
|
|
398
|
+
const t = Z(Ie(e.initialValue ?? "")), l = Z(!1), h = Z(
|
|
399
399
|
e.errorMessage?.trim() || ze
|
|
400
|
-
),
|
|
401
|
-
const
|
|
402
|
-
return
|
|
403
|
-
}),
|
|
404
|
-
const R = Ze(
|
|
405
|
-
|
|
406
|
-
|
|
400
|
+
), v = c(() => t.value.replace(/\D/g, "")), $ = c(() => {
|
|
401
|
+
const y = v.value.length;
|
|
402
|
+
return y === 5 || y === 9;
|
|
403
|
+
}), M = c(() => l.value && !$.value), k = c(() => !l.value || $.value), C = c(() => l.value), D = (y, F) => {
|
|
404
|
+
const R = Ze(F);
|
|
405
|
+
W(() => {
|
|
406
|
+
y.isConnected && y.setSelectionRange(R, R);
|
|
407
407
|
});
|
|
408
408
|
};
|
|
409
409
|
return {
|
|
410
410
|
// writable state
|
|
411
411
|
zipDisplay: t,
|
|
412
412
|
submitted: l,
|
|
413
|
-
errorMessage:
|
|
413
|
+
errorMessage: h,
|
|
414
414
|
// bindings
|
|
415
415
|
wrapperClass: "fk-zip-textbox",
|
|
416
416
|
// derived state
|
|
417
|
-
zipRaw:
|
|
417
|
+
zipRaw: v,
|
|
418
418
|
isZipValid: $,
|
|
419
|
-
showZipError:
|
|
420
|
-
textBoxValid:
|
|
421
|
-
textBoxValidate:
|
|
419
|
+
showZipError: M,
|
|
420
|
+
textBoxValid: k,
|
|
421
|
+
textBoxValidate: C,
|
|
422
422
|
// actions
|
|
423
|
-
handleZipInput: (...
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
423
|
+
handleZipInput: (...y) => {
|
|
424
|
+
const F = y[0], f = F?.event?.target, b = F?.value, L = Array.isArray(b) ? b.join("") : String(b ?? ""), j = f?.selectionStart !== void 0 && f.selectionStart !== null ? He(
|
|
425
|
+
f.value,
|
|
426
|
+
f.selectionStart
|
|
427
427
|
) : L.replace(/\D/g, "").length;
|
|
428
|
-
t.value = Ie(L),
|
|
428
|
+
t.value = Ie(L), f && D(f, j);
|
|
429
429
|
},
|
|
430
|
-
submitAndValidate: (
|
|
430
|
+
submitAndValidate: (y) => {
|
|
431
431
|
l.value = !0;
|
|
432
|
-
const
|
|
433
|
-
return !
|
|
432
|
+
const F = $.value;
|
|
433
|
+
return !F && y?.focus && W(() => {
|
|
434
434
|
document.getElementById(
|
|
435
435
|
e.id
|
|
436
436
|
)?.focus();
|
|
437
|
-
}),
|
|
437
|
+
}), F;
|
|
438
438
|
},
|
|
439
|
-
buildPayload: () => ({ zip:
|
|
439
|
+
buildPayload: () => ({ zip: v.value })
|
|
440
440
|
};
|
|
441
441
|
};
|
|
442
442
|
function Ye(e, t) {
|
|
443
|
-
const l =
|
|
443
|
+
const l = Z(!1);
|
|
444
444
|
$e(() => {
|
|
445
445
|
e.value?.setAttribute("aria-invalid", String(!t.isValid()));
|
|
446
446
|
});
|
|
447
|
-
function
|
|
448
|
-
const
|
|
449
|
-
(!
|
|
447
|
+
function h($) {
|
|
448
|
+
const M = e.value ?? $.currentTarget, k = $.relatedTarget;
|
|
449
|
+
(!M || !M.contains(k)) && (l.value = !0);
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function v() {
|
|
452
452
|
l.value = !1;
|
|
453
453
|
}
|
|
454
|
-
return { touched: l, onFocusout:
|
|
454
|
+
return { touched: l, onFocusout: h, reset: v };
|
|
455
455
|
}
|
|
456
456
|
function je(e, t) {
|
|
457
|
-
const l =
|
|
458
|
-
() =>
|
|
459
|
-
), $ =
|
|
457
|
+
const l = Z(!1), h = Z(!1), v = c(
|
|
458
|
+
() => le(t.submitted) || l.value
|
|
459
|
+
), $ = c(() => !v.value || t.isValid()), M = Ye(e, {
|
|
460
460
|
isValid: () => $.value
|
|
461
461
|
});
|
|
462
|
-
function
|
|
463
|
-
return
|
|
462
|
+
function k(w) {
|
|
463
|
+
return c(() => !v.value || le(w));
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function C(w) {
|
|
466
466
|
return Object.fromEntries(
|
|
467
|
-
Object.entries(
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
Object.entries(w).map(([y, F]) => [
|
|
468
|
+
y,
|
|
469
|
+
k(F)
|
|
470
470
|
])
|
|
471
471
|
);
|
|
472
472
|
}
|
|
473
|
-
function D(
|
|
474
|
-
const
|
|
475
|
-
if (!
|
|
476
|
-
|
|
473
|
+
function D(w) {
|
|
474
|
+
const y = le(w);
|
|
475
|
+
if (!y) return;
|
|
476
|
+
y.querySelector(
|
|
477
477
|
'.k-invalid input, .k-invalid[tabindex="0"]'
|
|
478
478
|
)?.focus();
|
|
479
479
|
}
|
|
480
|
-
function
|
|
481
|
-
if (
|
|
482
|
-
|
|
480
|
+
function I(w) {
|
|
481
|
+
if (h.value) {
|
|
482
|
+
h.value = !1;
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
|
|
485
|
+
M.onFocusout(w), M.touched.value && (l.value = !0);
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
l.value = !1,
|
|
487
|
+
function V() {
|
|
488
|
+
l.value = !1, h.value = !0, M.reset();
|
|
489
489
|
}
|
|
490
490
|
return {
|
|
491
491
|
touched: l,
|
|
492
|
-
fieldsetValidate:
|
|
493
|
-
onFocusout:
|
|
494
|
-
reset:
|
|
495
|
-
createFieldValidity:
|
|
496
|
-
createFieldValidationsMap:
|
|
492
|
+
fieldsetValidate: v,
|
|
493
|
+
onFocusout: I,
|
|
494
|
+
reset: V,
|
|
495
|
+
createFieldValidity: k,
|
|
496
|
+
createFieldValidationsMap: C,
|
|
497
497
|
focusFirstInvalidField: D
|
|
498
498
|
};
|
|
499
499
|
}
|
|
@@ -566,17 +566,17 @@ function _e() {
|
|
|
566
566
|
});
|
|
567
567
|
return {
|
|
568
568
|
formData: e,
|
|
569
|
-
onAddress1Input: (...
|
|
570
|
-
e.address1 = De(
|
|
569
|
+
onAddress1Input: (...M) => {
|
|
570
|
+
e.address1 = De(M[0]);
|
|
571
571
|
},
|
|
572
|
-
onAddress2Input: (...
|
|
573
|
-
e.address2 = De(
|
|
572
|
+
onAddress2Input: (...M) => {
|
|
573
|
+
e.address2 = De(M[0]);
|
|
574
574
|
},
|
|
575
|
-
onCityInput: (...
|
|
576
|
-
e.city = De(
|
|
575
|
+
onCityInput: (...M) => {
|
|
576
|
+
e.city = De(M[0]);
|
|
577
577
|
},
|
|
578
|
-
onStateChange: (
|
|
579
|
-
|
|
578
|
+
onStateChange: (M) => {
|
|
579
|
+
e.state = M.value;
|
|
580
580
|
},
|
|
581
581
|
resetFormData: () => {
|
|
582
582
|
e.address1 = "", e.address2 = "", e.city = "", e.state = null, e.zip = "";
|
|
@@ -585,35 +585,35 @@ function _e() {
|
|
|
585
585
|
}
|
|
586
586
|
function Je(e, t = "zip") {
|
|
587
587
|
const l = We({ id: t }), {
|
|
588
|
-
zipDisplay:
|
|
589
|
-
zipRaw:
|
|
588
|
+
zipDisplay: h,
|
|
589
|
+
zipRaw: v,
|
|
590
590
|
isZipValid: $,
|
|
591
|
-
wrapperClass:
|
|
592
|
-
handleZipInput:
|
|
591
|
+
wrapperClass: M,
|
|
592
|
+
handleZipInput: k
|
|
593
593
|
} = l;
|
|
594
|
-
return
|
|
594
|
+
return de(v, (D) => {
|
|
595
595
|
e.zip = D;
|
|
596
596
|
}), {
|
|
597
|
-
zipDisplay:
|
|
597
|
+
zipDisplay: h,
|
|
598
598
|
isZipValid: $,
|
|
599
|
-
zipWrapperClass:
|
|
600
|
-
onZipInput:
|
|
599
|
+
zipWrapperClass: M,
|
|
600
|
+
onZipInput: k,
|
|
601
601
|
resetZip: () => {
|
|
602
|
-
|
|
602
|
+
h.value = "", e.zip = "";
|
|
603
603
|
}
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
function Xe(e) {
|
|
607
|
-
const t =
|
|
607
|
+
const t = c(
|
|
608
608
|
() => e.formData.address1.trim() !== ""
|
|
609
|
-
), l =
|
|
610
|
-
() => t.value && l.value &&
|
|
609
|
+
), l = c(() => e.formData.city.trim() !== ""), h = c(() => !!e.formData.state), v = c(() => le(e.isZipValid)), $ = c(
|
|
610
|
+
() => t.value && l.value && h.value && v.value
|
|
611
611
|
);
|
|
612
612
|
return {
|
|
613
613
|
strictAddress1Valid: t,
|
|
614
614
|
strictCityValid: l,
|
|
615
|
-
strictStateValid:
|
|
616
|
-
strictZipValid:
|
|
615
|
+
strictStateValid: h,
|
|
616
|
+
strictZipValid: v,
|
|
617
617
|
strictAddressValid: $
|
|
618
618
|
};
|
|
619
619
|
}
|
|
@@ -624,99 +624,120 @@ function Qe(e) {
|
|
|
624
624
|
)?.focus();
|
|
625
625
|
}
|
|
626
626
|
function dt(e) {
|
|
627
|
-
const t =
|
|
628
|
-
|
|
627
|
+
const t = Z(
|
|
628
|
+
le(e.fieldsetRef)
|
|
629
629
|
);
|
|
630
630
|
$e(() => {
|
|
631
|
-
t.value =
|
|
631
|
+
t.value = le(e.fieldsetRef);
|
|
632
632
|
});
|
|
633
|
-
const l =
|
|
634
|
-
formData:
|
|
635
|
-
onAddress1Input:
|
|
636
|
-
onAddress2Input:
|
|
633
|
+
const l = Z(!1), h = c(() => le(e.required) ?? !0), {
|
|
634
|
+
formData: v,
|
|
635
|
+
onAddress1Input: $,
|
|
636
|
+
onAddress2Input: M,
|
|
637
637
|
onCityInput: k,
|
|
638
|
-
onStateChange:
|
|
639
|
-
resetFormData:
|
|
640
|
-
} = _e(),
|
|
641
|
-
strictAddress1Valid:
|
|
642
|
-
strictCityValid:
|
|
643
|
-
strictStateValid:
|
|
644
|
-
strictZipValid:
|
|
645
|
-
strictAddressValid:
|
|
638
|
+
onStateChange: C,
|
|
639
|
+
resetFormData: D
|
|
640
|
+
} = _e(), I = `${e.addressId}-zip`, { zipDisplay: V, isZipValid: w, zipWrapperClass: y, onZipInput: F, resetZip: R } = Je(v, I), {
|
|
641
|
+
strictAddress1Valid: f,
|
|
642
|
+
strictCityValid: b,
|
|
643
|
+
strictStateValid: L,
|
|
644
|
+
strictZipValid: j,
|
|
645
|
+
strictAddressValid: N
|
|
646
646
|
} = Xe({
|
|
647
|
-
formData:
|
|
648
|
-
isZipValid:
|
|
649
|
-
}),
|
|
647
|
+
formData: v,
|
|
648
|
+
isZipValid: w
|
|
649
|
+
}), ee = je(t, {
|
|
650
650
|
submitted: l,
|
|
651
|
-
isValid: () =>
|
|
651
|
+
isValid: () => N.value
|
|
652
|
+
}), { touched: te, fieldsetValidate: se, onFocusout: o, reset: g } = ee, s = ee.createFieldValidationsMap({
|
|
653
|
+
address1: f,
|
|
654
|
+
city: b,
|
|
655
|
+
state: L,
|
|
656
|
+
zip: j,
|
|
657
|
+
address: N
|
|
652
658
|
}), {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
659
|
+
address1: d,
|
|
660
|
+
city: E,
|
|
661
|
+
state: m,
|
|
662
|
+
zip: x,
|
|
663
|
+
address: q
|
|
664
|
+
} = s, Y = c(
|
|
665
|
+
() => h.value ? se.value : !1
|
|
666
|
+
), r = c(
|
|
667
|
+
() => h.value ? d.value : !0
|
|
668
|
+
), p = c(
|
|
669
|
+
() => h.value ? E.value : !0
|
|
670
|
+
), S = c(
|
|
671
|
+
() => h.value ? m.value : !0
|
|
672
|
+
), U = c(
|
|
673
|
+
() => h.value ? x.value : !0
|
|
674
|
+
), B = c(
|
|
675
|
+
() => h.value ? q.value : !0
|
|
676
|
+
), z = { value: null, label: "State" }, X = Ge.map(({ label: n, value: u }) => ({
|
|
677
|
+
label: n,
|
|
678
|
+
value: u
|
|
679
|
+
})), oe = c(() => ({
|
|
680
|
+
address1: v.address1.trim(),
|
|
681
|
+
address2: v.address2.trim(),
|
|
682
|
+
city: v.city.trim(),
|
|
683
|
+
state: (v.state ?? "").trim().toUpperCase(),
|
|
684
|
+
zip: v.zip.replace(/\D/g, "")
|
|
685
|
+
})), a = c(() => v.address1.trim() === "" && v.address2.trim() === "" && v.city.trim() === "" && (v.state ?? "").trim() === "" && v.zip.replace(/\D/g, "") === ""), i = c(() => !a.value), P = c(() => !h.value && i.value && (!f.value || !b.value || !L.value)), O = c(() => {
|
|
686
|
+
const n = v.zip.replace(/\D/g, "");
|
|
687
|
+
return !h.value && i.value && n.length !== 5 && n.length !== 9;
|
|
688
|
+
}), K = c(() => !h.value && i.value && !N.value), _ = c(() => !h.value && K.value && (te.value || l.value));
|
|
689
|
+
return de(h, (n) => {
|
|
690
|
+
n || (l.value = !1, g());
|
|
663
691
|
}), {
|
|
664
|
-
|
|
665
|
-
city: c,
|
|
666
|
-
state: E,
|
|
667
|
-
zip: p,
|
|
668
|
-
address: x
|
|
669
|
-
} = g, q = { value: null, label: "Select state" }, Z = Ge.map(({ label: O, value: K }) => ({
|
|
670
|
-
label: O,
|
|
671
|
-
value: K
|
|
672
|
-
})), r = m(() => ({
|
|
673
|
-
address1: b.address1.trim(),
|
|
674
|
-
address2: b.address2.trim(),
|
|
675
|
-
city: b.city.trim(),
|
|
676
|
-
state: (b.state ?? "").trim().toUpperCase(),
|
|
677
|
-
zip: b.zip.replace(/\D/g, "")
|
|
678
|
-
}));
|
|
679
|
-
return {
|
|
680
|
-
formData: b,
|
|
692
|
+
formData: v,
|
|
681
693
|
submitted: l,
|
|
682
|
-
touched:
|
|
683
|
-
addressValidate:
|
|
684
|
-
address1Valid:
|
|
685
|
-
cityValid:
|
|
686
|
-
stateValid:
|
|
687
|
-
zipValid:
|
|
688
|
-
addressValid:
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
694
|
+
touched: te,
|
|
695
|
+
addressValidate: Y,
|
|
696
|
+
address1Valid: r,
|
|
697
|
+
cityValid: p,
|
|
698
|
+
stateValid: S,
|
|
699
|
+
zipValid: U,
|
|
700
|
+
addressValid: B,
|
|
701
|
+
optionalFeedbackActive: _,
|
|
702
|
+
optionalPartialInvalid: K,
|
|
703
|
+
optionalMissingRequiredFields: P,
|
|
704
|
+
optionalZipInvalid: O,
|
|
705
|
+
stateDefaultItem: z,
|
|
706
|
+
stateOptions: X,
|
|
707
|
+
zipDisplay: V,
|
|
708
|
+
zipWrapperClass: y,
|
|
709
|
+
onAddress1Input: $,
|
|
710
|
+
onAddress2Input: M,
|
|
695
711
|
onCityInput: k,
|
|
696
|
-
onStateChange:
|
|
697
|
-
onZipInput:
|
|
698
|
-
onFieldsetFocusout:
|
|
699
|
-
|
|
700
|
-
|
|
712
|
+
onStateChange: C,
|
|
713
|
+
onZipInput: F,
|
|
714
|
+
onFieldsetFocusout: (n) => {
|
|
715
|
+
o(n);
|
|
716
|
+
},
|
|
717
|
+
normalizedPayload: oe,
|
|
718
|
+
validateForSubmit: async () => h.value ? (l.value = !0, N.value ? {
|
|
719
|
+
isValid: !0,
|
|
720
|
+
payload: oe.value
|
|
721
|
+
} : (await W(), Qe(t.value), { isValid: !1, payload: null })) : a.value || N.value ? (l.value = !1, {
|
|
701
722
|
isValid: !0,
|
|
702
|
-
payload:
|
|
703
|
-
} : (
|
|
723
|
+
payload: oe.value
|
|
724
|
+
}) : (l.value = !0, { isValid: !1, payload: null }),
|
|
704
725
|
reset: () => {
|
|
705
|
-
l.value = !1,
|
|
726
|
+
l.value = !1, g(), D(), R();
|
|
706
727
|
}
|
|
707
728
|
};
|
|
708
729
|
}
|
|
709
730
|
function ft(e) {
|
|
710
|
-
const t =
|
|
731
|
+
const t = Z(""), l = Z(void 0), h = Z(!!e.debug), v = Z(e.dateFormat ?? "mm/dd/yyyy"), $ = c(() => !!e.required), M = Z(!1), k = ["ArrowUp", "ArrowDown"], C = ["ArrowLeft", "ArrowRight"], D = c(() => (t.value ?? "").replace(/\D/g, "")), I = (r) => r <= 2 ? "mm" : r <= 5 ? "dd" : D.value.length <= 10 ? "yyyy" : "mm", V = c(() => {
|
|
711
732
|
const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
712
733
|
return parseInt(r).toString().padStart(2, "0");
|
|
713
|
-
}),
|
|
734
|
+
}), w = c(() => {
|
|
714
735
|
const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
|
|
715
736
|
return parseInt(r).toString().padStart(2, "0");
|
|
716
|
-
}),
|
|
737
|
+
}), y = c(() => {
|
|
717
738
|
const r = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
718
739
|
return parseInt(r).toString().padStart(4, "0");
|
|
719
|
-
}),
|
|
740
|
+
}), F = (r) => {
|
|
720
741
|
if (D.value.length === 0) {
|
|
721
742
|
e.onChange({ value: null, event: r });
|
|
722
743
|
return;
|
|
@@ -726,64 +747,64 @@ function ft(e) {
|
|
|
726
747
|
return;
|
|
727
748
|
}
|
|
728
749
|
if ((t.value ?? "").length === 10 && D.value.length === 8) {
|
|
729
|
-
const [
|
|
730
|
-
if (
|
|
731
|
-
const
|
|
732
|
-
R(
|
|
750
|
+
const [p, S, U] = t.value.split("/"), B = parseInt(p), z = parseInt(S), X = parseInt(U);
|
|
751
|
+
if (j(X, B, z)) {
|
|
752
|
+
const oe = new Date(X, B - 1, z);
|
|
753
|
+
R(oe) ? e.onChange({ value: oe, event: r }) : e.onChange({ value: null, event: r });
|
|
733
754
|
} else
|
|
734
755
|
e.onChange({ value: null, event: r });
|
|
735
756
|
}
|
|
736
757
|
}, R = (r) => {
|
|
737
|
-
const
|
|
738
|
-
return !(
|
|
739
|
-
},
|
|
758
|
+
const p = e.min ?? void 0, S = e.max ?? void 0;
|
|
759
|
+
return !(p && r < p || S && r > S);
|
|
760
|
+
}, f = c(() => {
|
|
740
761
|
if ((t.value ?? "").length === 10 && D.value.length === 8) {
|
|
741
|
-
const [r,
|
|
742
|
-
if (
|
|
743
|
-
return new Date(
|
|
762
|
+
const [r, p, S] = (t.value ?? "").split("/"), U = parseInt(r), B = parseInt(p), z = parseInt(S);
|
|
763
|
+
if (j(z, U, B))
|
|
764
|
+
return new Date(z, U - 1, B);
|
|
744
765
|
}
|
|
745
766
|
return null;
|
|
746
|
-
}),
|
|
767
|
+
}), b = c(() => (t.value ?? "").length === 10 && D.value.length === 8), L = (r, p) => new Date(r, p, 0).getDate(), j = (r, p, S) => p >= 1 && p <= 12 && r >= 1900 && S >= 1 && S <= L(r, p), N = (r) => {
|
|
747
768
|
t.value = r.value;
|
|
748
|
-
const
|
|
749
|
-
l.value =
|
|
750
|
-
},
|
|
769
|
+
const p = r.event?.target;
|
|
770
|
+
l.value = p?.selectionStart ?? 0, F(r);
|
|
771
|
+
}, ee = (r) => {
|
|
751
772
|
l.value = r.target.selectionStart ?? 0;
|
|
752
|
-
},
|
|
753
|
-
const
|
|
754
|
-
l.value =
|
|
755
|
-
let
|
|
756
|
-
if (!(D.value.length >= 8) || !
|
|
757
|
-
const
|
|
758
|
-
|
|
773
|
+
}, te = (r, p, S) => {
|
|
774
|
+
const U = p?.selectionStart ?? l.value ?? 0;
|
|
775
|
+
l.value = U;
|
|
776
|
+
let B = parseInt(V.value), z = parseInt(w.value), X = parseInt(y.value);
|
|
777
|
+
if (!(D.value.length >= 8) || !j(X, B, z)) {
|
|
778
|
+
const _ = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
779
|
+
B = _.getMonth() + 1, z = _.getDate(), X = _.getFullYear(), t.value = `${String(B).padStart(2, "0")}/${String(z).padStart(
|
|
759
780
|
2,
|
|
760
781
|
"0"
|
|
761
|
-
)}/${String(
|
|
762
|
-
const
|
|
763
|
-
e.onChange({ value: R(
|
|
782
|
+
)}/${String(X)}`;
|
|
783
|
+
const H = new Date(X, B - 1, z);
|
|
784
|
+
e.onChange({ value: R(H) ? H : null, event: S }), d({ useRAF: !0 });
|
|
764
785
|
return;
|
|
765
786
|
}
|
|
766
|
-
const a =
|
|
787
|
+
const a = I(U);
|
|
767
788
|
if (a === "mm")
|
|
768
|
-
|
|
789
|
+
B = r === "ArrowUp" ? B < 12 ? B + 1 : 1 : B > 1 ? B - 1 : 12;
|
|
769
790
|
else if (a === "dd") {
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
} else a === "yyyy" && (
|
|
773
|
-
t.value = `${String(
|
|
791
|
+
const _ = new Date(X, B, 0).getDate();
|
|
792
|
+
z = r === "ArrowUp" ? z < _ ? z + 1 : 1 : z > 1 ? z - 1 : _;
|
|
793
|
+
} else a === "yyyy" && (X = r === "ArrowUp" ? X + 1 : Math.max(1, X - 1));
|
|
794
|
+
t.value = `${String(B).padStart(2, "0")}/${String(z).padStart(
|
|
774
795
|
2,
|
|
775
796
|
"0"
|
|
776
|
-
)}/${String(
|
|
777
|
-
const [i,
|
|
778
|
-
parseInt(
|
|
797
|
+
)}/${String(X)}`;
|
|
798
|
+
const [i, P, O] = t.value.split("/"), K = new Date(
|
|
799
|
+
parseInt(O),
|
|
779
800
|
parseInt(i) - 1,
|
|
780
|
-
parseInt(
|
|
801
|
+
parseInt(P)
|
|
781
802
|
);
|
|
782
|
-
|
|
783
|
-
value: R(
|
|
784
|
-
event:
|
|
785
|
-
}) : e.onChange({ value: null, event:
|
|
786
|
-
},
|
|
803
|
+
K.toString() !== "Invalid Date" && parseInt(O) >= 1e3 ? e.onChange({
|
|
804
|
+
value: R(K) ? K : null,
|
|
805
|
+
event: S
|
|
806
|
+
}) : e.onChange({ value: null, event: S }), d({ useRAF: !0 });
|
|
807
|
+
}, se = (r) => {
|
|
787
808
|
if (r.code === "Space" || r.key === " ") {
|
|
788
809
|
r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
|
|
789
810
|
return;
|
|
@@ -792,71 +813,71 @@ function ft(e) {
|
|
|
792
813
|
r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
|
|
793
814
|
return;
|
|
794
815
|
}
|
|
795
|
-
if (
|
|
816
|
+
if (k.includes(r.key)) {
|
|
796
817
|
if (r.altKey) return;
|
|
797
818
|
r.preventDefault(), r.stopPropagation();
|
|
798
|
-
const
|
|
799
|
-
|
|
819
|
+
const p = r.target;
|
|
820
|
+
te(r.key, p, r);
|
|
800
821
|
return;
|
|
801
822
|
}
|
|
802
823
|
}, o = (r) => {
|
|
803
824
|
r.preventDefault();
|
|
804
|
-
const
|
|
805
|
-
|
|
825
|
+
const p = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
826
|
+
te(p, r.target, r);
|
|
806
827
|
}, g = (r) => {
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
l.value =
|
|
828
|
+
const p = r.target;
|
|
829
|
+
if (C.includes(r.key)) {
|
|
830
|
+
l.value = p?.selectionStart ?? 0;
|
|
810
831
|
return;
|
|
811
832
|
}
|
|
812
|
-
if (
|
|
833
|
+
if (k.includes(r.key)) {
|
|
813
834
|
if (r.altKey) return;
|
|
814
|
-
l.value =
|
|
835
|
+
l.value = p?.selectionStart ?? 0;
|
|
815
836
|
}
|
|
816
837
|
}, s = (r) => {
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
},
|
|
821
|
-
const
|
|
822
|
-
const
|
|
838
|
+
M.value = !0, $.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && D.value.length === 0 && (e.externalValue.value = "");
|
|
839
|
+
const p = r.target;
|
|
840
|
+
p && (l.value = p.selectionStart ?? 0);
|
|
841
|
+
}, d = (r) => {
|
|
842
|
+
const p = () => {
|
|
843
|
+
const S = document.getElementById(
|
|
823
844
|
e.id
|
|
824
845
|
);
|
|
825
|
-
if (!
|
|
826
|
-
const
|
|
846
|
+
if (!S) return;
|
|
847
|
+
const U = r?.pos ?? l.value ?? S.value.length;
|
|
827
848
|
try {
|
|
828
|
-
|
|
849
|
+
S.focus(), S.setSelectionRange(U, U);
|
|
829
850
|
} catch {
|
|
830
851
|
}
|
|
831
852
|
};
|
|
832
|
-
|
|
853
|
+
W(() => {
|
|
833
854
|
if (r?.delay && r.delay > 0) {
|
|
834
|
-
setTimeout(
|
|
855
|
+
setTimeout(p, r.delay);
|
|
835
856
|
return;
|
|
836
857
|
}
|
|
837
858
|
if (r?.useRAF) {
|
|
838
|
-
requestAnimationFrame(
|
|
859
|
+
requestAnimationFrame(p);
|
|
839
860
|
return;
|
|
840
861
|
}
|
|
841
|
-
|
|
862
|
+
p();
|
|
842
863
|
});
|
|
843
864
|
};
|
|
844
|
-
e.externalValue &&
|
|
865
|
+
e.externalValue && de(
|
|
845
866
|
e.externalValue,
|
|
846
867
|
(r) => {
|
|
847
868
|
if (r) {
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
850
|
-
const
|
|
851
|
-
t.value = `${
|
|
869
|
+
const p = new Date(r);
|
|
870
|
+
if (p.toString() !== "Invalid Date") {
|
|
871
|
+
const S = (p.getMonth() + 1).toString().padStart(2, "0"), U = p.getDate().toString().padStart(2, "0"), B = p.getFullYear().toString();
|
|
872
|
+
t.value = `${S}/${U}/${B}`, d({ delay: 50 });
|
|
852
873
|
return;
|
|
853
874
|
}
|
|
854
875
|
}
|
|
855
876
|
},
|
|
856
877
|
{ immediate: !0 }
|
|
857
878
|
);
|
|
858
|
-
const E =
|
|
859
|
-
["Date", `${
|
|
879
|
+
const E = c(() => [
|
|
880
|
+
["Date", `${V.value} / ${w.value} / ${y.value}`],
|
|
860
881
|
["Digits only", D.value],
|
|
861
882
|
[
|
|
862
883
|
"min",
|
|
@@ -874,50 +895,50 @@ function ft(e) {
|
|
|
874
895
|
day: "2-digit"
|
|
875
896
|
}) ?? null
|
|
876
897
|
]
|
|
877
|
-
]),
|
|
898
|
+
]), m = c(() => {
|
|
878
899
|
if (!$.value) {
|
|
879
|
-
if (!
|
|
880
|
-
const
|
|
881
|
-
return
|
|
900
|
+
if (!b.value) return !0;
|
|
901
|
+
const p = f.value;
|
|
902
|
+
return p ? R(p) : !1;
|
|
882
903
|
}
|
|
883
|
-
if (!
|
|
884
|
-
const r =
|
|
885
|
-
return !
|
|
886
|
-
}), x =
|
|
904
|
+
if (!M.value) return !0;
|
|
905
|
+
const r = f.value;
|
|
906
|
+
return !b.value || !r ? !1 : R(r);
|
|
907
|
+
}), x = c(() => {
|
|
887
908
|
if (!$.value) {
|
|
888
|
-
if (!
|
|
889
|
-
const
|
|
890
|
-
return
|
|
909
|
+
if (!b.value) return;
|
|
910
|
+
const p = f.value;
|
|
911
|
+
return p ? R(p) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
891
912
|
}
|
|
892
|
-
if (!
|
|
893
|
-
if (D.value.length === 0 || !
|
|
913
|
+
if (!M.value) return;
|
|
914
|
+
if (D.value.length === 0 || !b.value)
|
|
894
915
|
return "incomplete";
|
|
895
|
-
const r =
|
|
916
|
+
const r = f.value;
|
|
896
917
|
return r ? R(r) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
897
|
-
}), q =
|
|
918
|
+
}), q = c(() => {
|
|
898
919
|
const r = x.value;
|
|
899
920
|
if (!r || r === "valid") return "";
|
|
900
921
|
if (r === "incomplete")
|
|
901
922
|
return "Required";
|
|
902
923
|
if (r === "invalid-date")
|
|
903
|
-
return `Must be in ${
|
|
904
|
-
const
|
|
924
|
+
return `Must be in ${v.value} format.`;
|
|
925
|
+
const p = e.min ? e.min.toLocaleDateString("en-US", {
|
|
905
926
|
year: "numeric",
|
|
906
927
|
month: "2-digit",
|
|
907
928
|
day: "2-digit"
|
|
908
|
-
}) : null,
|
|
929
|
+
}) : null, S = e.max ? e.max.toLocaleDateString("en-US", {
|
|
909
930
|
year: "numeric",
|
|
910
931
|
month: "2-digit",
|
|
911
932
|
day: "2-digit"
|
|
912
933
|
}) : null;
|
|
913
934
|
if (r === "out-of-bounds") {
|
|
914
|
-
if (
|
|
915
|
-
if (
|
|
916
|
-
if (
|
|
935
|
+
if (p && S) return `Must be between ${p} and ${S}.`;
|
|
936
|
+
if (p) return `Must be on or after ${p}.`;
|
|
937
|
+
if (S) return `Must be on or before ${S}.`;
|
|
917
938
|
}
|
|
918
939
|
return "";
|
|
919
|
-
}),
|
|
920
|
-
|
|
940
|
+
}), Y = () => {
|
|
941
|
+
W(() => {
|
|
921
942
|
const r = document.getElementById(
|
|
922
943
|
e.id
|
|
923
944
|
);
|
|
@@ -925,16 +946,16 @@ function ft(e) {
|
|
|
925
946
|
console.warn(`ID (#${e.id}) not found for styling.`);
|
|
926
947
|
return;
|
|
927
948
|
}
|
|
928
|
-
const
|
|
929
|
-
if (!
|
|
949
|
+
const p = r.closest(".k-datepicker");
|
|
950
|
+
if (!p) {
|
|
930
951
|
console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
|
|
931
952
|
return;
|
|
932
953
|
}
|
|
933
|
-
const
|
|
934
|
-
if (
|
|
935
|
-
if (
|
|
954
|
+
const S = p.parentElement;
|
|
955
|
+
if (S) {
|
|
956
|
+
if (S.classList.contains("fk-datepicker"))
|
|
936
957
|
return;
|
|
937
|
-
|
|
958
|
+
S.classList.add("fk-datepicker");
|
|
938
959
|
} else
|
|
939
960
|
console.warn(
|
|
940
961
|
`Parent of .k-datepicker not found for #${e.id} styling.`
|
|
@@ -942,70 +963,70 @@ function ft(e) {
|
|
|
942
963
|
});
|
|
943
964
|
};
|
|
944
965
|
return Me(() => {
|
|
945
|
-
|
|
966
|
+
Y();
|
|
946
967
|
}), {
|
|
947
968
|
raw: t,
|
|
948
969
|
cursorPos: l,
|
|
949
|
-
debugEnabled:
|
|
970
|
+
debugEnabled: h,
|
|
950
971
|
debugLines: E,
|
|
951
|
-
placeholder:
|
|
952
|
-
isValid:
|
|
953
|
-
reason:
|
|
972
|
+
placeholder: v,
|
|
973
|
+
isValid: m,
|
|
974
|
+
reason: J(x),
|
|
954
975
|
validationMessage: q,
|
|
955
976
|
digitsOnly: D,
|
|
956
|
-
month:
|
|
957
|
-
day:
|
|
958
|
-
year:
|
|
959
|
-
datePart:
|
|
960
|
-
handleChange:
|
|
961
|
-
handleKeyDown:
|
|
977
|
+
month: J(V),
|
|
978
|
+
day: J(w),
|
|
979
|
+
year: J(y),
|
|
980
|
+
datePart: I,
|
|
981
|
+
handleChange: N,
|
|
982
|
+
handleKeyDown: se,
|
|
962
983
|
handleWheel: o,
|
|
963
984
|
handleKeyUp: g,
|
|
964
|
-
handleClick:
|
|
985
|
+
handleClick: ee,
|
|
965
986
|
handleBlur: s,
|
|
966
987
|
// Expose so consumers can re-run styling when needed
|
|
967
|
-
initStyling:
|
|
988
|
+
initStyling: Y
|
|
968
989
|
};
|
|
969
990
|
}
|
|
970
991
|
function pt(e) {
|
|
971
|
-
const t =
|
|
972
|
-
e.min = e.min ??
|
|
973
|
-
const
|
|
992
|
+
const t = Z(""), l = Z(void 0), h = Z(!!e.debug), v = Z(!1), $ = 1440 * 60 * 1e3, M = 365 * $, k = /* @__PURE__ */ new Date(), C = new Date(k.getTime() - M), D = new Date(k.getTime() + M);
|
|
993
|
+
e.min = e.min ?? C, e.max = e.max ?? D;
|
|
994
|
+
const I = c(() => (t.value ?? "").replace(/\D/g, "")), V = (n, u) => new Date(n, u, 0).getDate(), w = (n, u, A) => u >= 1 && u <= 12 && n >= 1e3 && A >= 1 && A <= V(n, u), y = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), F = (n) => {
|
|
974
995
|
if (!n) return null;
|
|
975
|
-
const u = e.min ?? new Date(Date.now() - 90 * $),
|
|
976
|
-
return
|
|
977
|
-
}, R = (n, u) => e.allowReverse ?? !1 ? !0 : n <= u,
|
|
978
|
-
if ((n ?? "").length < 23 ||
|
|
996
|
+
const u = e.min ?? new Date(Date.now() - 90 * $), A = e.max ?? /* @__PURE__ */ new Date(), T = y(n);
|
|
997
|
+
return T < y(u) || T > y(A) ? null : n;
|
|
998
|
+
}, R = (n, u) => e.allowReverse ?? !1 ? !0 : n <= u, f = c(() => (t.value?.length ?? 0) >= 23 && I.value.length >= 16), b = (n) => {
|
|
999
|
+
if ((n ?? "").length < 23 || I.value.length < 16)
|
|
979
1000
|
return { start: null, end: null };
|
|
980
|
-
const u = n.substring(0, 10),
|
|
981
|
-
return { start: we ?
|
|
982
|
-
}, L = e.externalValid ??
|
|
983
|
-
const n =
|
|
1001
|
+
const u = n.substring(0, 10), A = n.substring(13, 23), [T, ne, ae] = u.split("/").map((fe) => parseInt(fe || "0", 10)), [ce, ve, me] = A.split("/").map((fe) => parseInt(fe || "0", 10)), ge = new Date(ae, T - 1, ne), he = new Date(me, ce - 1, ve), we = w(ae, T, ne) && ge.toString() !== "Invalid Date", Ae = w(me, ce, ve) && he.toString() !== "Invalid Date";
|
|
1002
|
+
return { start: we ? ge : null, end: Ae ? he : null };
|
|
1003
|
+
}, L = e.externalValid ?? Z(!0), j = c(() => b(t.value)), N = c(() => {
|
|
1004
|
+
const n = F(j.value.start), u = F(j.value.end);
|
|
984
1005
|
return { start: n, end: u };
|
|
985
|
-
}),
|
|
986
|
-
if (!
|
|
987
|
-
const n =
|
|
1006
|
+
}), ee = c(() => {
|
|
1007
|
+
if (!f.value) return;
|
|
1008
|
+
const n = N.value.start, u = N.value.end;
|
|
988
1009
|
if (!n || !u) return;
|
|
989
|
-
const
|
|
990
|
-
return Math.round(
|
|
991
|
-
}),
|
|
992
|
-
if (!
|
|
993
|
-
const { start: n, end: u } =
|
|
994
|
-
if (!n || !u || !
|
|
995
|
-
const
|
|
996
|
-
return !(!R(
|
|
997
|
-
}),
|
|
998
|
-
const { start: n, end: u } =
|
|
999
|
-
if (!
|
|
1010
|
+
const A = Math.abs(y(u) - y(n));
|
|
1011
|
+
return Math.round(A / 864e5 + 1);
|
|
1012
|
+
}), te = c(() => {
|
|
1013
|
+
if (!f.value) return !1;
|
|
1014
|
+
const { start: n, end: u } = j.value;
|
|
1015
|
+
if (!n || !u || !N.value.start || !N.value.end) return !1;
|
|
1016
|
+
const A = N.value.start, T = N.value.end;
|
|
1017
|
+
return !(!R(A, T) || typeof e.maxSpanDays == "number" && ee.value !== void 0 && ee.value > e.maxSpanDays);
|
|
1018
|
+
}), se = c(() => {
|
|
1019
|
+
const { start: n, end: u } = j.value;
|
|
1020
|
+
if (!f.value) return "incomplete";
|
|
1000
1021
|
if (!n || !u) return "invalid-date";
|
|
1001
|
-
if (!
|
|
1002
|
-
const
|
|
1003
|
-
return R(
|
|
1004
|
-
}), o =
|
|
1022
|
+
if (!N.value.start || !N.value.end) return "out-of-bounds";
|
|
1023
|
+
const A = N.value.start, T = N.value.end;
|
|
1024
|
+
return R(A, T) ? typeof e.maxSpanDays == "number" && ee.value !== void 0 && ee.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
|
|
1025
|
+
}), o = Z(void 0), g = c(() => {
|
|
1005
1026
|
if (L.value !== !1) return "";
|
|
1006
|
-
const { min: n, max: u } = e,
|
|
1007
|
-
if (!
|
|
1008
|
-
switch (
|
|
1027
|
+
const { min: n, max: u } = e, A = o.value;
|
|
1028
|
+
if (!A) return "";
|
|
1029
|
+
switch (A) {
|
|
1009
1030
|
case "incomplete":
|
|
1010
1031
|
return "Required";
|
|
1011
1032
|
case "invalid-date":
|
|
@@ -1013,54 +1034,54 @@ function pt(e) {
|
|
|
1013
1034
|
case "reversed-range":
|
|
1014
1035
|
return "End Date must be on or after Start Date.";
|
|
1015
1036
|
case "out-of-bounds":
|
|
1016
|
-
return n && u ? `Dates must be between ${
|
|
1037
|
+
return n && u ? `Dates must be between ${m(n)} and ${m(u)}.` : "Dates must be within the allowed range.";
|
|
1017
1038
|
case "span-exceeds-limit":
|
|
1018
1039
|
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
1019
1040
|
default:
|
|
1020
1041
|
return "";
|
|
1021
1042
|
}
|
|
1022
|
-
}), s = ["ArrowUp", "ArrowDown"],
|
|
1043
|
+
}), s = ["ArrowUp", "ArrowDown"], d = ["ArrowLeft", "ArrowRight"], E = (n, u) => String(n).padStart(u, "0"), m = (n) => `${E(n.getMonth() + 1, 2)}/${E(n.getDate(), 2)}/${E(
|
|
1023
1044
|
n.getFullYear(),
|
|
1024
1045
|
4
|
|
1025
|
-
)}`, x = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, q = (n, u,
|
|
1026
|
-
const
|
|
1027
|
-
l.value =
|
|
1028
|
-
const { start: ne, end: ae } =
|
|
1046
|
+
)}`, x = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, q = (n, u, A) => {
|
|
1047
|
+
const T = u?.selectionStart ?? l.value ?? 0;
|
|
1048
|
+
l.value = T;
|
|
1049
|
+
const { start: ne, end: ae } = b(t.value);
|
|
1029
1050
|
if (!ne && !ae) {
|
|
1030
|
-
const G = /* @__PURE__ */ new Date(), ue =
|
|
1031
|
-
t.value = `${ue} - ${ue}`, e.onChange({ value: { start: G, end: G }, event:
|
|
1051
|
+
const G = /* @__PURE__ */ new Date(), ue = m(G);
|
|
1052
|
+
t.value = `${ue} - ${ue}`, e.onChange({ value: { start: G, end: G }, event: A }), W(() => {
|
|
1032
1053
|
requestAnimationFrame(() => {
|
|
1033
1054
|
const re = document.getElementById(
|
|
1034
1055
|
e.id
|
|
1035
|
-
),
|
|
1036
|
-
re && (re.focus(), re.setSelectionRange(
|
|
1056
|
+
), ie = l.value ?? 0;
|
|
1057
|
+
re && (re.focus(), re.setSelectionRange(ie, ie));
|
|
1037
1058
|
});
|
|
1038
1059
|
});
|
|
1039
1060
|
return;
|
|
1040
1061
|
}
|
|
1041
|
-
const ce = /* @__PURE__ */ new Date(),
|
|
1042
|
-
let me = ne ? new Date(ne) : new Date(ce),
|
|
1062
|
+
const ce = /* @__PURE__ */ new Date(), ve = x(T);
|
|
1063
|
+
let me = ne ? new Date(ne) : new Date(ce), ge = ae ? new Date(ae) : new Date(ce);
|
|
1043
1064
|
const he = (G, ue) => {
|
|
1044
1065
|
if (ue === "mm") {
|
|
1045
|
-
const re = G.getMonth() + 1,
|
|
1046
|
-
G.setMonth(
|
|
1047
|
-
const Se =
|
|
1066
|
+
const re = G.getMonth() + 1, ie = n === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
|
|
1067
|
+
G.setMonth(ie - 1);
|
|
1068
|
+
const Se = V(G.getFullYear(), ie);
|
|
1048
1069
|
G.getDate() > Se && G.setDate(Se);
|
|
1049
1070
|
} else if (ue === "dd") {
|
|
1050
|
-
const re =
|
|
1071
|
+
const re = V(G.getFullYear(), G.getMonth() + 1), ie = G.getDate(), Se = n === "ArrowUp" ? ie < re ? ie + 1 : 1 : ie > 1 ? ie - 1 : re;
|
|
1051
1072
|
G.setDate(Se);
|
|
1052
1073
|
} else if (ue === "yyyy") {
|
|
1053
1074
|
const re = G.getFullYear();
|
|
1054
1075
|
G.setFullYear(n === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
|
|
1055
|
-
const
|
|
1056
|
-
G.getDate() >
|
|
1076
|
+
const ie = V(G.getFullYear(), G.getMonth() + 1);
|
|
1077
|
+
G.getDate() > ie && G.setDate(ie);
|
|
1057
1078
|
}
|
|
1058
1079
|
};
|
|
1059
|
-
|
|
1060
|
-
const we =
|
|
1080
|
+
ve.side === "start" ? he(me, ve.part) : he(ge, ve.part);
|
|
1081
|
+
const we = m(me), Ae = m(ge);
|
|
1061
1082
|
t.value = `${we} - ${Ae}`;
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1083
|
+
const fe = F(me), ke = F(ge);
|
|
1084
|
+
fe && ke && R(fe, ke) ? e.onChange({ value: { start: fe, end: ke }, event: A }) : e.onChange({ value: null, event: A }), W(() => {
|
|
1064
1085
|
requestAnimationFrame(() => {
|
|
1065
1086
|
const G = document.getElementById(
|
|
1066
1087
|
e.id
|
|
@@ -1068,34 +1089,34 @@ function pt(e) {
|
|
|
1068
1089
|
G && (G.focus(), G.setSelectionRange(ue, ue));
|
|
1069
1090
|
});
|
|
1070
1091
|
});
|
|
1071
|
-
},
|
|
1072
|
-
const { start: u, end:
|
|
1073
|
-
if (!u || !
|
|
1092
|
+
}, Y = (n) => {
|
|
1093
|
+
const { start: u, end: A } = b(t.value);
|
|
1094
|
+
if (!u || !A) {
|
|
1074
1095
|
e.onChange({ value: null, event: n });
|
|
1075
1096
|
return;
|
|
1076
1097
|
}
|
|
1077
|
-
const
|
|
1078
|
-
if (!
|
|
1098
|
+
const T = F(u), ne = F(A);
|
|
1099
|
+
if (!T || !ne) {
|
|
1079
1100
|
e.onChange({ value: null, event: n });
|
|
1080
1101
|
return;
|
|
1081
1102
|
}
|
|
1082
|
-
if (!R(
|
|
1103
|
+
if (!R(T, ne)) {
|
|
1083
1104
|
e.onChange({ value: null, event: n });
|
|
1084
1105
|
return;
|
|
1085
1106
|
}
|
|
1086
|
-
e.onChange({ value: { start:
|
|
1107
|
+
e.onChange({ value: { start: T, end: ne }, event: n });
|
|
1087
1108
|
}, r = (n) => {
|
|
1088
|
-
const u = n.value ?? "",
|
|
1089
|
-
if (!u &&
|
|
1090
|
-
|
|
1109
|
+
const u = n.value ?? "", A = n.event;
|
|
1110
|
+
if (!u && A && A.type === "click") {
|
|
1111
|
+
oe(A);
|
|
1091
1112
|
return;
|
|
1092
1113
|
}
|
|
1093
1114
|
t.value = u;
|
|
1094
|
-
const
|
|
1095
|
-
l.value =
|
|
1096
|
-
},
|
|
1115
|
+
const T = A?.target;
|
|
1116
|
+
l.value = T?.selectionStart ?? 0, Y(n);
|
|
1117
|
+
}, p = (n) => {
|
|
1097
1118
|
l.value = n.target.selectionStart ?? 0;
|
|
1098
|
-
},
|
|
1119
|
+
}, S = (n) => {
|
|
1099
1120
|
if (n.code === "Space" || n.key === " ") {
|
|
1100
1121
|
n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
|
|
1101
1122
|
return;
|
|
@@ -1110,57 +1131,57 @@ function pt(e) {
|
|
|
1110
1131
|
q(n.key, u, n);
|
|
1111
1132
|
return;
|
|
1112
1133
|
}
|
|
1113
|
-
},
|
|
1134
|
+
}, U = (n) => {
|
|
1114
1135
|
n.preventDefault();
|
|
1115
1136
|
const u = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1116
1137
|
q(u, n.target, n);
|
|
1117
|
-
},
|
|
1118
|
-
if (
|
|
1138
|
+
}, B = (n) => {
|
|
1139
|
+
if (d.includes(n.key) || s.includes(n.key)) {
|
|
1119
1140
|
const u = n.target;
|
|
1120
1141
|
l.value = u?.selectionStart ?? 0;
|
|
1121
1142
|
}
|
|
1122
|
-
},
|
|
1123
|
-
o.value =
|
|
1124
|
-
},
|
|
1125
|
-
|
|
1126
|
-
},
|
|
1127
|
-
console.log("Clear event:", n), t.value = "", l.value = 0, e.onChange({ value: null, event: n }),
|
|
1143
|
+
}, z = () => {
|
|
1144
|
+
o.value = se.value, (e.manageValid ?? !0) && (L.value = te.value);
|
|
1145
|
+
}, X = (n) => {
|
|
1146
|
+
z();
|
|
1147
|
+
}, oe = (n) => {
|
|
1148
|
+
console.log("Clear event:", n), t.value = "", l.value = 0, e.onChange({ value: null, event: n }), z(), W(() => {
|
|
1128
1149
|
const u = document.getElementById(
|
|
1129
1150
|
e.id
|
|
1130
1151
|
);
|
|
1131
1152
|
u && (u.focus(), u.setSelectionRange(0, 0));
|
|
1132
1153
|
});
|
|
1133
1154
|
};
|
|
1134
|
-
e.externalValue &&
|
|
1155
|
+
e.externalValue && de(
|
|
1135
1156
|
e.externalValue,
|
|
1136
1157
|
(n) => {
|
|
1137
|
-
const u = n?.start ?? null,
|
|
1138
|
-
if (u &&
|
|
1139
|
-
if (t.value = `${
|
|
1140
|
-
const
|
|
1158
|
+
const u = n?.start ?? null, A = n?.end ?? null;
|
|
1159
|
+
if (u && A) {
|
|
1160
|
+
if (t.value = `${m(u)} - ${m(A)}`, e.isOpen?.value && v.value && e.onRequestClose) {
|
|
1161
|
+
const T = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
|
|
1141
1162
|
setTimeout(() => {
|
|
1142
|
-
e.onRequestClose?.(),
|
|
1143
|
-
},
|
|
1163
|
+
e.onRequestClose?.(), v.value = !1, z();
|
|
1164
|
+
}, T);
|
|
1144
1165
|
}
|
|
1145
1166
|
return;
|
|
1146
1167
|
}
|
|
1147
1168
|
},
|
|
1148
1169
|
{ immediate: !0 }
|
|
1149
1170
|
);
|
|
1150
|
-
const a =
|
|
1171
|
+
const a = c(
|
|
1151
1172
|
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
1152
|
-
), i =
|
|
1173
|
+
), i = c(
|
|
1153
1174
|
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
1154
|
-
),
|
|
1175
|
+
), P = c(
|
|
1155
1176
|
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
1156
|
-
),
|
|
1177
|
+
), O = c(
|
|
1157
1178
|
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
1158
|
-
),
|
|
1179
|
+
), K = c(
|
|
1159
1180
|
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
1160
|
-
),
|
|
1181
|
+
), _ = c(
|
|
1161
1182
|
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
1162
|
-
),
|
|
1163
|
-
const { start: n, end: u } =
|
|
1183
|
+
), H = c(() => {
|
|
1184
|
+
const { start: n, end: u } = b(t.value);
|
|
1164
1185
|
return [
|
|
1165
1186
|
{
|
|
1166
1187
|
label: "Raw",
|
|
@@ -1178,16 +1199,16 @@ function pt(e) {
|
|
|
1178
1199
|
label: "Start",
|
|
1179
1200
|
value: `${String(a.value).padStart(2, "0")} / ${String(
|
|
1180
1201
|
i.value
|
|
1181
|
-
).padStart(2, "0")} / ${String(
|
|
1202
|
+
).padStart(2, "0")} / ${String(P.value).padStart(4, "0")}`
|
|
1182
1203
|
},
|
|
1183
1204
|
{
|
|
1184
1205
|
label: "End",
|
|
1185
|
-
value: `${String(
|
|
1186
|
-
|
|
1187
|
-
).padStart(2, "0")} / ${String(
|
|
1206
|
+
value: `${String(O.value).padStart(2, "0")} / ${String(
|
|
1207
|
+
K.value
|
|
1208
|
+
).padStart(2, "0")} / ${String(_.value).padStart(4, "0")}`
|
|
1188
1209
|
},
|
|
1189
|
-
{ label: "Digits only", value:
|
|
1190
|
-
{ label: "Mask complete", value: `${
|
|
1210
|
+
{ label: "Digits only", value: I.value },
|
|
1211
|
+
{ label: "Mask complete", value: `${f.value}` },
|
|
1191
1212
|
{
|
|
1192
1213
|
label: "Parsed",
|
|
1193
1214
|
value: `${n ? n.toDateString() : "-"} | ${u ? u.toDateString() : "-"}`
|
|
@@ -1196,21 +1217,21 @@ function pt(e) {
|
|
|
1196
1217
|
label: "Valid (managed)",
|
|
1197
1218
|
value: `${L.value ?? "-"}`
|
|
1198
1219
|
},
|
|
1199
|
-
{ label: "Span (days)", value: `${
|
|
1220
|
+
{ label: "Span (days)", value: `${ee.value ?? "-"}` },
|
|
1200
1221
|
{
|
|
1201
1222
|
label: "Reason",
|
|
1202
|
-
value: `${
|
|
1223
|
+
value: `${se.value ?? "-"}`
|
|
1203
1224
|
},
|
|
1204
1225
|
{
|
|
1205
1226
|
label: "Cursor in",
|
|
1206
1227
|
value: `${l.value ?? "-"} (${(() => {
|
|
1207
|
-
const
|
|
1208
|
-
return `${
|
|
1228
|
+
const A = l.value ?? 0, T = x(A);
|
|
1229
|
+
return `${T.side}.${T.part}`;
|
|
1209
1230
|
})()})`
|
|
1210
1231
|
}
|
|
1211
1232
|
];
|
|
1212
|
-
}),
|
|
1213
|
-
|
|
1233
|
+
}), Q = () => {
|
|
1234
|
+
W(() => {
|
|
1214
1235
|
const n = document.getElementById(e.id);
|
|
1215
1236
|
if (!n) {
|
|
1216
1237
|
console.warn(`#${e.id} not found for styling.`);
|
|
@@ -1225,24 +1246,24 @@ function pt(e) {
|
|
|
1225
1246
|
});
|
|
1226
1247
|
};
|
|
1227
1248
|
Me(() => {
|
|
1228
|
-
|
|
1249
|
+
Q();
|
|
1229
1250
|
});
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1251
|
+
const pe = () => {
|
|
1252
|
+
W(() => {
|
|
1232
1253
|
try {
|
|
1233
1254
|
const n = Array.from(
|
|
1234
1255
|
document.querySelectorAll(".k-animation-container")
|
|
1235
1256
|
);
|
|
1236
1257
|
if (!n.length) return;
|
|
1237
|
-
const
|
|
1258
|
+
const A = [...n].reverse().find((ae) => ae.querySelector(".k-calendar"))?.querySelector(
|
|
1238
1259
|
".k-calendar"
|
|
1239
1260
|
);
|
|
1240
|
-
if (!
|
|
1241
|
-
const
|
|
1261
|
+
if (!A) return;
|
|
1262
|
+
const T = A.querySelectorAll(
|
|
1242
1263
|
".k-calendar-table"
|
|
1243
1264
|
);
|
|
1244
1265
|
let ne = !1;
|
|
1245
|
-
|
|
1266
|
+
T.forEach((ae) => {
|
|
1246
1267
|
ae.tabIndex === 0 && (ne ? ae.tabIndex = -1 : ne = !0);
|
|
1247
1268
|
});
|
|
1248
1269
|
} catch (n) {
|
|
@@ -1250,105 +1271,105 @@ function pt(e) {
|
|
|
1250
1271
|
}
|
|
1251
1272
|
});
|
|
1252
1273
|
};
|
|
1253
|
-
return e.isOpen &&
|
|
1274
|
+
return e.isOpen && de(
|
|
1254
1275
|
e.isOpen,
|
|
1255
1276
|
(n) => {
|
|
1256
|
-
n && setTimeout(() =>
|
|
1277
|
+
n && setTimeout(() => pe(), 0);
|
|
1257
1278
|
},
|
|
1258
1279
|
{ immediate: !1 }
|
|
1259
1280
|
), {
|
|
1260
1281
|
raw: t,
|
|
1261
1282
|
cursorPos: l,
|
|
1262
|
-
debugEnabled:
|
|
1263
|
-
debugLines:
|
|
1264
|
-
digitsOnly:
|
|
1283
|
+
debugEnabled: h,
|
|
1284
|
+
debugLines: H,
|
|
1285
|
+
digitsOnly: I,
|
|
1265
1286
|
valid: L,
|
|
1266
|
-
validComputed:
|
|
1267
|
-
reason:
|
|
1268
|
-
validationMessage:
|
|
1269
|
-
spanDays:
|
|
1270
|
-
month1:
|
|
1271
|
-
day1:
|
|
1272
|
-
year1:
|
|
1273
|
-
month2:
|
|
1274
|
-
day2:
|
|
1275
|
-
year2: _
|
|
1287
|
+
validComputed: J(te),
|
|
1288
|
+
reason: J(se),
|
|
1289
|
+
validationMessage: J(g),
|
|
1290
|
+
spanDays: J(ee),
|
|
1291
|
+
month1: J(a),
|
|
1292
|
+
day1: J(i),
|
|
1293
|
+
year1: J(P),
|
|
1294
|
+
month2: J(O),
|
|
1295
|
+
day2: J(K),
|
|
1296
|
+
year2: J(_),
|
|
1276
1297
|
handleChange: r,
|
|
1277
|
-
handleKeyDown:
|
|
1278
|
-
handleWheel:
|
|
1279
|
-
handleKeyUp:
|
|
1280
|
-
handleClick:
|
|
1281
|
-
handleBlur:
|
|
1282
|
-
handleClear:
|
|
1298
|
+
handleKeyDown: S,
|
|
1299
|
+
handleWheel: U,
|
|
1300
|
+
handleKeyUp: B,
|
|
1301
|
+
handleClick: p,
|
|
1302
|
+
handleBlur: X,
|
|
1303
|
+
handleClear: oe,
|
|
1283
1304
|
onCalendarChange: () => {
|
|
1284
|
-
|
|
1305
|
+
v.value = !0;
|
|
1285
1306
|
},
|
|
1286
|
-
initStyling:
|
|
1307
|
+
initStyling: Q
|
|
1287
1308
|
};
|
|
1288
1309
|
}
|
|
1289
|
-
function
|
|
1290
|
-
const t =
|
|
1310
|
+
function vt(e) {
|
|
1311
|
+
const t = Z(""), l = Z(void 0), h = Z(!!e.debug), v = Z(e.timeFormat ?? "hh:mm AM"), $ = c(() => !!e.required), M = Z(!1), k = ["ArrowUp", "ArrowDown"], C = ["ArrowLeft", "ArrowRight"], D = c(() => (t.value ?? "").replace(/\D/g, "")), I = {
|
|
1291
1312
|
H: /[0-9]/,
|
|
1292
1313
|
h: /[0-9]/,
|
|
1293
1314
|
M: /[0-9]/,
|
|
1294
1315
|
m: /[0-9]/,
|
|
1295
1316
|
A: /[AaPp]/,
|
|
1296
1317
|
a: /[Mm]/
|
|
1297
|
-
},
|
|
1318
|
+
}, V = (a) => a <= 2 ? "hh" : a <= 5 ? "mm" : "ampm", w = c(() => {
|
|
1298
1319
|
const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", i = parseInt(a);
|
|
1299
1320
|
return Math.min(Math.max(i, 0), 23);
|
|
1300
|
-
}),
|
|
1321
|
+
}), y = c(() => {
|
|
1301
1322
|
const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(a);
|
|
1302
1323
|
return Math.min(Math.max(i, 0), 59);
|
|
1303
|
-
}),
|
|
1304
|
-
const a = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i =
|
|
1324
|
+
}), F = c(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = c(() => {
|
|
1325
|
+
const a = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = F.value;
|
|
1305
1326
|
return a === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? a + 12 : a;
|
|
1306
|
-
}),
|
|
1327
|
+
}), f = c(() => b.value ? `${String(R.value).padStart(2, "0")}:${String(y.value).padStart(2, "0")}:00` : null), b = c(
|
|
1307
1328
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
1308
|
-
), L = (a, i,
|
|
1309
|
-
let
|
|
1310
|
-
return
|
|
1329
|
+
), L = (a, i, P) => {
|
|
1330
|
+
let O = a % 12;
|
|
1331
|
+
return O === 0 && (O = 12), `${String(O).padStart(2, "0")}:${String(i).padStart(
|
|
1311
1332
|
2,
|
|
1312
1333
|
"0"
|
|
1313
|
-
)} ${
|
|
1314
|
-
},
|
|
1334
|
+
)} ${P}`;
|
|
1335
|
+
}, j = (a) => {
|
|
1315
1336
|
const i = a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1316
1337
|
if (!i) return null;
|
|
1317
|
-
const
|
|
1318
|
-
if (
|
|
1319
|
-
let
|
|
1320
|
-
|
|
1321
|
-
const
|
|
1322
|
-
return
|
|
1323
|
-
},
|
|
1338
|
+
const P = parseInt(i[1]), O = parseInt(i[2]), K = i[3].toUpperCase();
|
|
1339
|
+
if (P < 1 || P > 12 || O < 0 || O > 59) return null;
|
|
1340
|
+
let _ = P % 12;
|
|
1341
|
+
K === "PM" && (_ += 12);
|
|
1342
|
+
const H = /* @__PURE__ */ new Date();
|
|
1343
|
+
return H.setSeconds(0, 0), H.setHours(_), H.setMinutes(O), H;
|
|
1344
|
+
}, N = (a) => {
|
|
1324
1345
|
if (D.value.length === 0) {
|
|
1325
1346
|
e.onChange({ value: null, event: a });
|
|
1326
1347
|
return;
|
|
1327
1348
|
}
|
|
1328
|
-
if (!
|
|
1349
|
+
if (!b.value) {
|
|
1329
1350
|
e.onChange({ value: null, event: a });
|
|
1330
1351
|
return;
|
|
1331
1352
|
}
|
|
1332
|
-
const i =
|
|
1333
|
-
i &&
|
|
1334
|
-
},
|
|
1335
|
-
const i = e.min ?? void 0,
|
|
1353
|
+
const i = j(t.value);
|
|
1354
|
+
i && te(i) ? e.onChange({ value: i, event: a }) : e.onChange({ value: null, event: a });
|
|
1355
|
+
}, ee = (a) => a.getHours() * 60 + a.getMinutes(), te = (a) => {
|
|
1356
|
+
const i = e.min ?? void 0, P = e.max ?? void 0, O = ee(a);
|
|
1336
1357
|
if (i) {
|
|
1337
|
-
const
|
|
1338
|
-
if (
|
|
1358
|
+
const K = ee(i);
|
|
1359
|
+
if (O < K) return !1;
|
|
1339
1360
|
}
|
|
1340
|
-
if (
|
|
1341
|
-
const
|
|
1342
|
-
if (
|
|
1361
|
+
if (P) {
|
|
1362
|
+
const K = ee(P);
|
|
1363
|
+
if (O > K) return !1;
|
|
1343
1364
|
}
|
|
1344
1365
|
return !0;
|
|
1345
|
-
},
|
|
1346
|
-
const i = a.getHours(),
|
|
1347
|
-
t.value = L(i, a.getMinutes(),
|
|
1366
|
+
}, se = (a) => {
|
|
1367
|
+
const i = a.getHours(), P = i >= 12 ? "PM" : "AM";
|
|
1368
|
+
t.value = L(i, a.getMinutes(), P);
|
|
1348
1369
|
}, o = (a, i) => {
|
|
1349
1370
|
e.onChange({ value: a, event: i });
|
|
1350
1371
|
}, g = () => {
|
|
1351
|
-
|
|
1372
|
+
W(() => {
|
|
1352
1373
|
requestAnimationFrame(() => {
|
|
1353
1374
|
requestAnimationFrame(() => {
|
|
1354
1375
|
const a = document.getElementById(
|
|
@@ -1365,20 +1386,20 @@ function mt(e) {
|
|
|
1365
1386
|
}, s = (a) => {
|
|
1366
1387
|
const i = a?.event?.target;
|
|
1367
1388
|
return i ? i.closest(".k-time-now") ? "now" : i.closest(".k-time-accept") ? "set" : null : null;
|
|
1368
|
-
},
|
|
1369
|
-
a &&
|
|
1389
|
+
}, d = (a, i) => {
|
|
1390
|
+
a && te(a) ? o(a, i) : o(null, i);
|
|
1370
1391
|
}, E = (...a) => {
|
|
1371
1392
|
const i = a[0];
|
|
1372
1393
|
if (!i) return;
|
|
1373
|
-
const
|
|
1374
|
-
if (
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1394
|
+
const P = s(i);
|
|
1395
|
+
if (P === "now") {
|
|
1396
|
+
const K = /* @__PURE__ */ new Date();
|
|
1397
|
+
se(K), d(K, i), g();
|
|
1377
1398
|
return;
|
|
1378
1399
|
}
|
|
1379
1400
|
if (i?.value instanceof Date) {
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1401
|
+
const K = new Date(i.value);
|
|
1402
|
+
se(K), d(K, i), P === "set" && g();
|
|
1382
1403
|
return;
|
|
1383
1404
|
}
|
|
1384
1405
|
if (i?.value === null) {
|
|
@@ -1386,43 +1407,43 @@ function mt(e) {
|
|
|
1386
1407
|
return;
|
|
1387
1408
|
}
|
|
1388
1409
|
t.value = i.value;
|
|
1389
|
-
const
|
|
1390
|
-
l.value =
|
|
1410
|
+
const O = i.event?.target;
|
|
1411
|
+
l.value = O?.selectionStart ?? 0;
|
|
1391
1412
|
try {
|
|
1392
|
-
const
|
|
1393
|
-
if (
|
|
1394
|
-
const
|
|
1395
|
-
/[Aa]/.test(
|
|
1413
|
+
const K = l.value ?? 0;
|
|
1414
|
+
if (V(K) === "ampm" && (t.value ?? "").length >= 8) {
|
|
1415
|
+
const _ = t.value.charAt(6);
|
|
1416
|
+
/[Aa]/.test(_) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, W(() => {
|
|
1396
1417
|
requestAnimationFrame(() => {
|
|
1397
|
-
const
|
|
1418
|
+
const H = document.getElementById(
|
|
1398
1419
|
e.id
|
|
1399
1420
|
);
|
|
1400
|
-
|
|
1421
|
+
H && (H.focus(), H.setSelectionRange(8, 8));
|
|
1401
1422
|
});
|
|
1402
|
-
})) : /[Pp]/.test(
|
|
1423
|
+
})) : /[Pp]/.test(_) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, W(() => {
|
|
1403
1424
|
requestAnimationFrame(() => {
|
|
1404
|
-
const
|
|
1425
|
+
const H = document.getElementById(
|
|
1405
1426
|
e.id
|
|
1406
1427
|
);
|
|
1407
|
-
|
|
1428
|
+
H && (H.focus(), H.setSelectionRange(8, 8));
|
|
1408
1429
|
});
|
|
1409
1430
|
}));
|
|
1410
1431
|
}
|
|
1411
1432
|
} catch {
|
|
1412
1433
|
}
|
|
1413
|
-
|
|
1414
|
-
},
|
|
1434
|
+
N(i);
|
|
1435
|
+
}, m = (a) => {
|
|
1415
1436
|
l.value = a.target.selectionStart ?? 0;
|
|
1416
|
-
}, x = (a, i,
|
|
1417
|
-
const
|
|
1418
|
-
l.value =
|
|
1419
|
-
const
|
|
1420
|
-
if (!
|
|
1437
|
+
}, x = (a, i, P) => {
|
|
1438
|
+
const O = i?.selectionStart ?? l.value ?? 0;
|
|
1439
|
+
l.value = O;
|
|
1440
|
+
const K = V(O), _ = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1441
|
+
if (!_) {
|
|
1421
1442
|
if ((t.value ?? "").length === 0 || D.value.length === 0) {
|
|
1422
|
-
const u = /* @__PURE__ */ new Date(),
|
|
1423
|
-
t.value = L(
|
|
1424
|
-
const ne =
|
|
1425
|
-
|
|
1443
|
+
const u = /* @__PURE__ */ new Date(), A = u.getHours(), T = A >= 12 ? "PM" : "AM";
|
|
1444
|
+
t.value = L(A, u.getMinutes(), T);
|
|
1445
|
+
const ne = j(t.value);
|
|
1446
|
+
d(ne, P), W(() => {
|
|
1426
1447
|
requestAnimationFrame(() => {
|
|
1427
1448
|
const ae = document.getElementById(
|
|
1428
1449
|
e.id
|
|
@@ -1433,34 +1454,34 @@ function mt(e) {
|
|
|
1433
1454
|
}
|
|
1434
1455
|
return;
|
|
1435
1456
|
}
|
|
1436
|
-
let
|
|
1437
|
-
if (
|
|
1438
|
-
a === "ArrowUp" ?
|
|
1439
|
-
else if (
|
|
1457
|
+
let H = parseInt(_[1]), Q = parseInt(_[2]), pe = _[3].toUpperCase();
|
|
1458
|
+
if (K === "hh")
|
|
1459
|
+
a === "ArrowUp" ? H = H < 12 ? H + 1 : 1 : H = H > 1 ? H - 1 : 12;
|
|
1460
|
+
else if (K === "mm") {
|
|
1440
1461
|
const u = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
|
|
1441
1462
|
if (u === 1)
|
|
1442
|
-
a === "ArrowUp" ?
|
|
1463
|
+
a === "ArrowUp" ? Q = Q < 59 ? Q + 1 : 0 : Q = Q > 0 ? Q - 1 : 59;
|
|
1443
1464
|
else if (a === "ArrowUp") {
|
|
1444
|
-
const
|
|
1445
|
-
let
|
|
1446
|
-
|
|
1465
|
+
const A = Q % u;
|
|
1466
|
+
let T = A === 0 ? Q + u : Q + (u - A);
|
|
1467
|
+
T >= 60 && (T = 0), Q = T;
|
|
1447
1468
|
} else {
|
|
1448
|
-
const
|
|
1449
|
-
let
|
|
1450
|
-
|
|
1469
|
+
const A = Q % u;
|
|
1470
|
+
let T = A === 0 ? Q - u : Q - A;
|
|
1471
|
+
T < 0 && (T = 60 - u), Q = T;
|
|
1451
1472
|
}
|
|
1452
|
-
} else
|
|
1453
|
-
t.value = `${String(
|
|
1473
|
+
} else K === "ampm" && (pe = pe === "AM" ? "PM" : "AM");
|
|
1474
|
+
t.value = `${String(H).padStart(2, "0")}:${String(Q).padStart(
|
|
1454
1475
|
2,
|
|
1455
1476
|
"0"
|
|
1456
|
-
)} ${
|
|
1457
|
-
const n =
|
|
1458
|
-
|
|
1477
|
+
)} ${pe}`;
|
|
1478
|
+
const n = j(t.value);
|
|
1479
|
+
d(n, P), W(() => {
|
|
1459
1480
|
requestAnimationFrame(() => {
|
|
1460
1481
|
const u = document.getElementById(
|
|
1461
1482
|
e.id
|
|
1462
|
-
),
|
|
1463
|
-
u && (u.focus(), u.setSelectionRange(
|
|
1483
|
+
), A = l.value ?? 0;
|
|
1484
|
+
u && (u.focus(), u.setSelectionRange(A, A));
|
|
1464
1485
|
});
|
|
1465
1486
|
});
|
|
1466
1487
|
}, q = (a) => {
|
|
@@ -1472,57 +1493,57 @@ function mt(e) {
|
|
|
1472
1493
|
a.preventDefault(), a.stopPropagation(), e.onShowPicker(a);
|
|
1473
1494
|
return;
|
|
1474
1495
|
}
|
|
1475
|
-
if (
|
|
1496
|
+
if (k.includes(a.key)) {
|
|
1476
1497
|
if (a.altKey) return;
|
|
1477
1498
|
a.preventDefault(), a.stopPropagation();
|
|
1478
1499
|
const i = a.target;
|
|
1479
1500
|
x(a.key, i, a);
|
|
1480
1501
|
return;
|
|
1481
1502
|
}
|
|
1482
|
-
},
|
|
1503
|
+
}, Y = (a) => {
|
|
1483
1504
|
a.preventDefault();
|
|
1484
1505
|
const i = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1485
1506
|
x(i, a.target, a);
|
|
1486
1507
|
}, r = (a) => {
|
|
1487
1508
|
const i = a.target;
|
|
1488
|
-
if (
|
|
1509
|
+
if (C.includes(a.key)) {
|
|
1489
1510
|
l.value = i?.selectionStart ?? 0;
|
|
1490
1511
|
return;
|
|
1491
1512
|
}
|
|
1492
|
-
if (
|
|
1513
|
+
if (k.includes(a.key)) {
|
|
1493
1514
|
if (a.altKey) return;
|
|
1494
1515
|
l.value = i?.selectionStart ?? 0;
|
|
1495
1516
|
}
|
|
1496
|
-
},
|
|
1497
|
-
|
|
1517
|
+
}, p = (a) => {
|
|
1518
|
+
M.value = !0, $.value && e.externalValue && e.externalValue.value === void 0 && D.value.length === 0 && (e.externalValue.value = "");
|
|
1498
1519
|
const i = a.target;
|
|
1499
1520
|
i && (l.value = i.selectionStart ?? 0);
|
|
1500
1521
|
};
|
|
1501
|
-
e.externalValue &&
|
|
1522
|
+
e.externalValue && de(
|
|
1502
1523
|
e.externalValue,
|
|
1503
1524
|
(a) => {
|
|
1504
1525
|
if (a) {
|
|
1505
1526
|
const i = new Date(a);
|
|
1506
1527
|
if (i.toString() !== "Invalid Date") {
|
|
1507
|
-
const
|
|
1508
|
-
t.value = L(
|
|
1528
|
+
const P = i.getHours(), O = P >= 12 ? "PM" : "AM";
|
|
1529
|
+
t.value = L(P, i.getMinutes(), O);
|
|
1509
1530
|
return;
|
|
1510
1531
|
}
|
|
1511
1532
|
}
|
|
1512
1533
|
},
|
|
1513
1534
|
{ immediate: !0 }
|
|
1514
1535
|
);
|
|
1515
|
-
const
|
|
1536
|
+
const S = c(() => [
|
|
1516
1537
|
["Time", t.value || "--:-- --"],
|
|
1517
|
-
["Hour (12h)",
|
|
1538
|
+
["Hour (12h)", w.value],
|
|
1518
1539
|
["Hour (24h)", R.value],
|
|
1519
|
-
["Minute",
|
|
1520
|
-
["Period",
|
|
1521
|
-
["Time (24h)",
|
|
1540
|
+
["Minute", y.value],
|
|
1541
|
+
["Period", F.value],
|
|
1542
|
+
["Time (24h)", f.value ?? "--:--:--"],
|
|
1522
1543
|
["Digits only", D.value],
|
|
1523
1544
|
[
|
|
1524
1545
|
"Parsed Date",
|
|
1525
|
-
|
|
1546
|
+
U.value?.toLocaleDateString("en-US", {
|
|
1526
1547
|
hour: "2-digit",
|
|
1527
1548
|
minute: "2-digit"
|
|
1528
1549
|
}) ?? null
|
|
@@ -1541,50 +1562,50 @@ function mt(e) {
|
|
|
1541
1562
|
minute: "2-digit"
|
|
1542
1563
|
}) ?? null
|
|
1543
1564
|
],
|
|
1544
|
-
["valid",
|
|
1545
|
-
["reason",
|
|
1546
|
-
["validationMessage",
|
|
1547
|
-
]),
|
|
1548
|
-
() =>
|
|
1549
|
-
),
|
|
1565
|
+
["valid", B.value],
|
|
1566
|
+
["reason", z.value],
|
|
1567
|
+
["validationMessage", X.value]
|
|
1568
|
+
]), U = c(
|
|
1569
|
+
() => j(t.value) ?? null
|
|
1570
|
+
), B = c(() => {
|
|
1550
1571
|
if (!$.value) {
|
|
1551
|
-
if (!
|
|
1552
|
-
const i =
|
|
1553
|
-
return i ?
|
|
1572
|
+
if (!b.value) return !0;
|
|
1573
|
+
const i = U.value;
|
|
1574
|
+
return i ? te(i) : !1;
|
|
1554
1575
|
}
|
|
1555
|
-
if (!
|
|
1556
|
-
const a =
|
|
1557
|
-
return !
|
|
1558
|
-
}),
|
|
1576
|
+
if (!M.value) return !0;
|
|
1577
|
+
const a = U.value;
|
|
1578
|
+
return !b.value || !a ? !1 : te(a);
|
|
1579
|
+
}), z = c(() => {
|
|
1559
1580
|
if (!$.value) {
|
|
1560
|
-
if (!
|
|
1561
|
-
const i =
|
|
1562
|
-
return i ?
|
|
1581
|
+
if (!b.value) return;
|
|
1582
|
+
const i = U.value;
|
|
1583
|
+
return i ? te(i) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1563
1584
|
}
|
|
1564
|
-
if (!
|
|
1565
|
-
if (D.value.length === 0 || !
|
|
1585
|
+
if (!M.value) return;
|
|
1586
|
+
if (D.value.length === 0 || !b.value)
|
|
1566
1587
|
return "incomplete";
|
|
1567
|
-
const a =
|
|
1568
|
-
return a ?
|
|
1569
|
-
}),
|
|
1570
|
-
const a =
|
|
1588
|
+
const a = U.value;
|
|
1589
|
+
return a ? te(a) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1590
|
+
}), X = c(() => {
|
|
1591
|
+
const a = z.value;
|
|
1571
1592
|
if (!a || a === "valid") return "";
|
|
1572
1593
|
if (a === "incomplete")
|
|
1573
1594
|
return "Required";
|
|
1574
1595
|
if (a === "invalid-time")
|
|
1575
|
-
return `Must be in ${
|
|
1596
|
+
return `Must be in ${v.value} format.`;
|
|
1576
1597
|
const i = {
|
|
1577
1598
|
hour: "2-digit",
|
|
1578
1599
|
minute: "2-digit"
|
|
1579
|
-
},
|
|
1600
|
+
}, P = e.min ? e.min.toLocaleTimeString("en-US", i) : null, O = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
|
|
1580
1601
|
if (a === "out-of-bounds") {
|
|
1581
|
-
if (
|
|
1582
|
-
if (
|
|
1583
|
-
if (
|
|
1602
|
+
if (P && O) return `Must be between ${P} and ${O}.`;
|
|
1603
|
+
if (P) return `Must be ${P} or later.`;
|
|
1604
|
+
if (O) return `Must be ${O} or earlier.`;
|
|
1584
1605
|
}
|
|
1585
1606
|
return "";
|
|
1586
|
-
}),
|
|
1587
|
-
|
|
1607
|
+
}), oe = () => {
|
|
1608
|
+
W(() => {
|
|
1588
1609
|
const a = document.getElementById(e.id);
|
|
1589
1610
|
if (!a) {
|
|
1590
1611
|
console.warn(`#${e.id} not found for styling.`);
|
|
@@ -1597,62 +1618,62 @@ function mt(e) {
|
|
|
1597
1618
|
);
|
|
1598
1619
|
return;
|
|
1599
1620
|
}
|
|
1600
|
-
const
|
|
1601
|
-
if (!
|
|
1621
|
+
const P = i.parentElement;
|
|
1622
|
+
if (!P) {
|
|
1602
1623
|
console.warn(
|
|
1603
1624
|
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
1604
1625
|
);
|
|
1605
1626
|
return;
|
|
1606
1627
|
}
|
|
1607
|
-
|
|
1628
|
+
P.classList.contains("fk-timepicker") || P.classList.add("fk-timepicker");
|
|
1608
1629
|
});
|
|
1609
1630
|
};
|
|
1610
1631
|
return Me(() => {
|
|
1611
|
-
|
|
1632
|
+
oe();
|
|
1612
1633
|
}), {
|
|
1613
1634
|
raw: t,
|
|
1614
|
-
rules:
|
|
1615
|
-
debugEnabled:
|
|
1616
|
-
debugLines:
|
|
1617
|
-
placeholder:
|
|
1618
|
-
isValid:
|
|
1619
|
-
reason:
|
|
1620
|
-
validationMessage:
|
|
1621
|
-
isComplete:
|
|
1622
|
-
inRangeTime:
|
|
1635
|
+
rules: I,
|
|
1636
|
+
debugEnabled: h,
|
|
1637
|
+
debugLines: S,
|
|
1638
|
+
placeholder: v,
|
|
1639
|
+
isValid: B,
|
|
1640
|
+
reason: J(z),
|
|
1641
|
+
validationMessage: X,
|
|
1642
|
+
isComplete: b,
|
|
1643
|
+
inRangeTime: te,
|
|
1623
1644
|
cursorPos: l,
|
|
1624
|
-
hour:
|
|
1625
|
-
hour24:
|
|
1626
|
-
minute:
|
|
1627
|
-
period:
|
|
1628
|
-
time24:
|
|
1629
|
-
parsedRawTime:
|
|
1645
|
+
hour: J(w),
|
|
1646
|
+
hour24: J(R),
|
|
1647
|
+
minute: J(y),
|
|
1648
|
+
period: J(F),
|
|
1649
|
+
time24: J(f),
|
|
1650
|
+
parsedRawTime: J(U),
|
|
1630
1651
|
handleChange: E,
|
|
1631
1652
|
handleKeyDown: q,
|
|
1632
1653
|
handleKeyUp: r,
|
|
1633
|
-
handleClick:
|
|
1634
|
-
handleWheel:
|
|
1635
|
-
handleBlur:
|
|
1654
|
+
handleClick: m,
|
|
1655
|
+
handleWheel: Y,
|
|
1656
|
+
handleBlur: p,
|
|
1636
1657
|
// Expose so consumers can reapply theming when Kendo updates DOM
|
|
1637
|
-
initStyling:
|
|
1658
|
+
initStyling: oe
|
|
1638
1659
|
};
|
|
1639
1660
|
}
|
|
1640
1661
|
function et(e) {
|
|
1641
1662
|
return Le() ? (qe(e), !0) : !1;
|
|
1642
1663
|
}
|
|
1643
|
-
const
|
|
1664
|
+
const Pe = typeof window < "u" && typeof document < "u";
|
|
1644
1665
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
1645
|
-
const tt = Object.prototype.toString, nt = (e) => tt.call(e) === "[object Object]",
|
|
1666
|
+
const tt = Object.prototype.toString, nt = (e) => tt.call(e) === "[object Object]", ye = () => {
|
|
1646
1667
|
}, at = /* @__PURE__ */ rt();
|
|
1647
1668
|
function rt() {
|
|
1648
1669
|
var e, t;
|
|
1649
|
-
return
|
|
1670
|
+
return Pe && ((e = window?.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window?.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
|
|
1650
1671
|
}
|
|
1651
1672
|
function Ee(e) {
|
|
1652
1673
|
return Array.isArray(e) ? e : [e];
|
|
1653
1674
|
}
|
|
1654
1675
|
function lt(e, t, l) {
|
|
1655
|
-
return
|
|
1676
|
+
return de(
|
|
1656
1677
|
e,
|
|
1657
1678
|
t,
|
|
1658
1679
|
{
|
|
@@ -1661,183 +1682,183 @@ function lt(e, t, l) {
|
|
|
1661
1682
|
}
|
|
1662
1683
|
);
|
|
1663
1684
|
}
|
|
1664
|
-
const
|
|
1685
|
+
const Te = Pe ? window : void 0;
|
|
1665
1686
|
function be(e) {
|
|
1666
1687
|
var t;
|
|
1667
|
-
const l =
|
|
1688
|
+
const l = le(e);
|
|
1668
1689
|
return (t = l?.$el) != null ? t : l;
|
|
1669
1690
|
}
|
|
1670
1691
|
function xe(...e) {
|
|
1671
1692
|
const t = [], l = () => {
|
|
1672
|
-
t.forEach((
|
|
1673
|
-
},
|
|
1674
|
-
const
|
|
1675
|
-
return
|
|
1693
|
+
t.forEach((k) => k()), t.length = 0;
|
|
1694
|
+
}, h = (k, C, D, I) => (k.addEventListener(C, D, I), () => k.removeEventListener(C, D, I)), v = c(() => {
|
|
1695
|
+
const k = Ee(le(e[0])).filter((C) => C != null);
|
|
1696
|
+
return k.every((C) => typeof C != "string") ? k : void 0;
|
|
1676
1697
|
}), $ = lt(
|
|
1677
1698
|
() => {
|
|
1678
|
-
var
|
|
1699
|
+
var k, C;
|
|
1679
1700
|
return [
|
|
1680
|
-
(
|
|
1681
|
-
Ee(
|
|
1682
|
-
Ee(Oe(
|
|
1701
|
+
(C = (k = v.value) == null ? void 0 : k.map((D) => be(D))) != null ? C : [Te].filter((D) => D != null),
|
|
1702
|
+
Ee(le(v.value ? e[1] : e[0])),
|
|
1703
|
+
Ee(Oe(v.value ? e[2] : e[1])),
|
|
1683
1704
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
1684
|
-
|
|
1705
|
+
le(v.value ? e[3] : e[2])
|
|
1685
1706
|
];
|
|
1686
1707
|
},
|
|
1687
|
-
([
|
|
1688
|
-
if (l(), !
|
|
1708
|
+
([k, C, D, I]) => {
|
|
1709
|
+
if (l(), !k?.length || !C?.length || !D?.length)
|
|
1689
1710
|
return;
|
|
1690
|
-
const
|
|
1711
|
+
const V = nt(I) ? { ...I } : I;
|
|
1691
1712
|
t.push(
|
|
1692
|
-
...
|
|
1693
|
-
(
|
|
1694
|
-
(
|
|
1713
|
+
...k.flatMap(
|
|
1714
|
+
(w) => C.flatMap(
|
|
1715
|
+
(y) => D.map((F) => h(w, y, F, V))
|
|
1695
1716
|
)
|
|
1696
1717
|
)
|
|
1697
1718
|
);
|
|
1698
1719
|
},
|
|
1699
1720
|
{ flush: "post" }
|
|
1700
|
-
),
|
|
1721
|
+
), M = () => {
|
|
1701
1722
|
$(), l();
|
|
1702
1723
|
};
|
|
1703
|
-
return et(l),
|
|
1724
|
+
return et(l), M;
|
|
1704
1725
|
}
|
|
1705
1726
|
let Ce = !1;
|
|
1706
1727
|
function ot(e, t, l = {}) {
|
|
1707
|
-
const { window:
|
|
1708
|
-
if (!
|
|
1709
|
-
return
|
|
1728
|
+
const { window: h = Te, ignore: v = [], capture: $ = !0, detectIframe: M = !1, controls: k = !1 } = l;
|
|
1729
|
+
if (!h)
|
|
1730
|
+
return k ? { stop: ye, cancel: ye, trigger: ye } : ye;
|
|
1710
1731
|
if (at && !Ce) {
|
|
1711
1732
|
Ce = !0;
|
|
1712
|
-
const
|
|
1713
|
-
Array.from(
|
|
1733
|
+
const f = { passive: !0 };
|
|
1734
|
+
Array.from(h.document.body.children).forEach((b) => b.addEventListener("click", ye, f)), h.document.documentElement.addEventListener("click", ye, f);
|
|
1714
1735
|
}
|
|
1715
|
-
let
|
|
1716
|
-
const D = (
|
|
1717
|
-
if (typeof
|
|
1718
|
-
return Array.from(
|
|
1736
|
+
let C = !0;
|
|
1737
|
+
const D = (f) => le(v).some((b) => {
|
|
1738
|
+
if (typeof b == "string")
|
|
1739
|
+
return Array.from(h.document.querySelectorAll(b)).some((L) => L === f.target || f.composedPath().includes(L));
|
|
1719
1740
|
{
|
|
1720
|
-
const L = be(
|
|
1721
|
-
return L && (
|
|
1741
|
+
const L = be(b);
|
|
1742
|
+
return L && (f.target === L || f.composedPath().includes(L));
|
|
1722
1743
|
}
|
|
1723
1744
|
});
|
|
1724
|
-
function
|
|
1725
|
-
const
|
|
1726
|
-
return
|
|
1745
|
+
function I(f) {
|
|
1746
|
+
const b = le(f);
|
|
1747
|
+
return b && b.$.subTree.shapeFlag === 16;
|
|
1727
1748
|
}
|
|
1728
|
-
function
|
|
1729
|
-
const L =
|
|
1730
|
-
return
|
|
1749
|
+
function V(f, b) {
|
|
1750
|
+
const L = le(f), j = L.$.subTree && L.$.subTree.children;
|
|
1751
|
+
return j == null || !Array.isArray(j) ? !1 : j.some((N) => N.el === b.target || b.composedPath().includes(N.el));
|
|
1731
1752
|
}
|
|
1732
|
-
const
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1735
|
-
if ("detail" in
|
|
1736
|
-
|
|
1753
|
+
const w = (f) => {
|
|
1754
|
+
const b = be(e);
|
|
1755
|
+
if (f.target != null && !(!(b instanceof Element) && I(e) && V(e, f)) && !(!b || b === f.target || f.composedPath().includes(b))) {
|
|
1756
|
+
if ("detail" in f && f.detail === 0 && (C = !D(f)), !C) {
|
|
1757
|
+
C = !0;
|
|
1737
1758
|
return;
|
|
1738
1759
|
}
|
|
1739
|
-
t(
|
|
1760
|
+
t(f);
|
|
1740
1761
|
}
|
|
1741
1762
|
};
|
|
1742
|
-
let
|
|
1743
|
-
const
|
|
1744
|
-
xe(
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}, 0),
|
|
1763
|
+
let y = !1;
|
|
1764
|
+
const F = [
|
|
1765
|
+
xe(h, "click", (f) => {
|
|
1766
|
+
y || (y = !0, setTimeout(() => {
|
|
1767
|
+
y = !1;
|
|
1768
|
+
}, 0), w(f));
|
|
1748
1769
|
}, { passive: !0, capture: $ }),
|
|
1749
|
-
xe(
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1770
|
+
xe(h, "pointerdown", (f) => {
|
|
1771
|
+
const b = be(e);
|
|
1772
|
+
C = !D(f) && !!(b && !f.composedPath().includes(b));
|
|
1752
1773
|
}, { passive: !0 }),
|
|
1753
|
-
|
|
1774
|
+
M && xe(h, "blur", (f) => {
|
|
1754
1775
|
setTimeout(() => {
|
|
1755
|
-
var
|
|
1776
|
+
var b;
|
|
1756
1777
|
const L = be(e);
|
|
1757
|
-
((
|
|
1778
|
+
((b = h.document.activeElement) == null ? void 0 : b.tagName) === "IFRAME" && !L?.contains(h.document.activeElement) && t(f);
|
|
1758
1779
|
}, 0);
|
|
1759
1780
|
}, { passive: !0 })
|
|
1760
|
-
].filter(Boolean), R = () =>
|
|
1761
|
-
return
|
|
1781
|
+
].filter(Boolean), R = () => F.forEach((f) => f());
|
|
1782
|
+
return k ? {
|
|
1762
1783
|
stop: R,
|
|
1763
1784
|
cancel: () => {
|
|
1764
|
-
|
|
1785
|
+
C = !1;
|
|
1765
1786
|
},
|
|
1766
|
-
trigger: (
|
|
1767
|
-
|
|
1787
|
+
trigger: (f) => {
|
|
1788
|
+
C = !0, w(f), C = !1;
|
|
1768
1789
|
}
|
|
1769
1790
|
} : R;
|
|
1770
1791
|
}
|
|
1771
|
-
function
|
|
1792
|
+
function mt(e) {
|
|
1772
1793
|
const t = Ue(null), l = [
|
|
1773
1794
|
".k-animation-container .k-popup",
|
|
1774
1795
|
".k-popup",
|
|
1775
1796
|
".k-timepicker-popup",
|
|
1776
1797
|
".k-menu-popup"
|
|
1777
|
-
],
|
|
1798
|
+
], h = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? l].flat(), v = (I) => I ? typeof e.initialFocus == "string" ? I.querySelector(e.initialFocus) ?? I : typeof e.initialFocus == "function" ? e.initialFocus(I) ?? I : I.querySelector(
|
|
1778
1799
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1779
|
-
) ??
|
|
1800
|
+
) ?? I : null, { activate: $, deactivate: M } = Ke(t, {
|
|
1780
1801
|
escapeDeactivates: !1,
|
|
1781
1802
|
clickOutsideDeactivates: !1,
|
|
1782
1803
|
fallbackFocus: () => t.value,
|
|
1783
|
-
initialFocus: () =>
|
|
1804
|
+
initialFocus: () => v(t.value),
|
|
1784
1805
|
...e.focusTrapOptions ?? {}
|
|
1785
1806
|
});
|
|
1786
|
-
let
|
|
1807
|
+
let k = null, C = Z(null);
|
|
1787
1808
|
const D = () => {
|
|
1788
1809
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1789
|
-
const
|
|
1790
|
-
const
|
|
1791
|
-
if (!
|
|
1792
|
-
const R =
|
|
1793
|
-
(
|
|
1810
|
+
const I = (w, y) => {
|
|
1811
|
+
const F = Array.from(w.querySelectorAll(y));
|
|
1812
|
+
if (!F.length) return null;
|
|
1813
|
+
const R = F.filter(
|
|
1814
|
+
(f) => f.offsetParent !== null || f.getClientRects().length > 0
|
|
1794
1815
|
);
|
|
1795
|
-
return R[R.length - 1] ??
|
|
1796
|
-
},
|
|
1797
|
-
for (const
|
|
1798
|
-
const
|
|
1799
|
-
if (
|
|
1816
|
+
return R[R.length - 1] ?? F[F.length - 1] ?? null;
|
|
1817
|
+
}, V = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
1818
|
+
for (const w of h) {
|
|
1819
|
+
const y = I(V, w);
|
|
1820
|
+
if (y) return y;
|
|
1800
1821
|
}
|
|
1801
|
-
for (const
|
|
1802
|
-
const
|
|
1803
|
-
if (
|
|
1822
|
+
for (const w of h) {
|
|
1823
|
+
const y = I(document, w);
|
|
1824
|
+
if (y) return y;
|
|
1804
1825
|
}
|
|
1805
1826
|
return null;
|
|
1806
1827
|
};
|
|
1807
|
-
return ot(t, (
|
|
1808
|
-
|
|
1809
|
-
}),
|
|
1828
|
+
return ot(t, (I) => {
|
|
1829
|
+
C.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", I);
|
|
1830
|
+
}), de(
|
|
1810
1831
|
() => e.isOpen.value,
|
|
1811
|
-
(
|
|
1812
|
-
|
|
1813
|
-
const
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
}, document.addEventListener("keydown",
|
|
1817
|
-
})) : (
|
|
1818
|
-
const
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1832
|
+
(I) => {
|
|
1833
|
+
I ? (C.value = null, W(() => {
|
|
1834
|
+
const V = D();
|
|
1835
|
+
V && (t.value = V, setTimeout(() => $(), 0), k || (k = (w) => {
|
|
1836
|
+
w.key === "Escape" && (C.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", w));
|
|
1837
|
+
}, document.addEventListener("keydown", k, !0)));
|
|
1838
|
+
})) : (M(), k && (document.removeEventListener("keydown", k, !0), k = null), t.value = null, C.value === "outside" && W(() => {
|
|
1839
|
+
const V = () => {
|
|
1840
|
+
const w = e.triggerEl?.value, y = w?.querySelector("input"), F = document.activeElement;
|
|
1841
|
+
F && (F === y || w && w.contains(F)) && (y ?? w)?.blur?.();
|
|
1821
1842
|
};
|
|
1822
|
-
requestAnimationFrame(() => setTimeout(
|
|
1823
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
1843
|
+
requestAnimationFrame(() => setTimeout(V, 0));
|
|
1844
|
+
}), e.returnFocusToTrigger !== !1 && C.value === "escape" && e.triggerEl?.value && (console.log(
|
|
1824
1845
|
"Returning focus to trigger element:",
|
|
1825
1846
|
e.triggerEl.value
|
|
1826
|
-
),
|
|
1827
|
-
const
|
|
1828
|
-
const
|
|
1829
|
-
if (!
|
|
1830
|
-
(
|
|
1847
|
+
), W(() => {
|
|
1848
|
+
const V = () => {
|
|
1849
|
+
const w = e.triggerEl?.value;
|
|
1850
|
+
if (!w) return;
|
|
1851
|
+
(w.querySelector("input") ?? w)?.focus?.();
|
|
1831
1852
|
};
|
|
1832
|
-
requestAnimationFrame(() => setTimeout(
|
|
1853
|
+
requestAnimationFrame(() => setTimeout(V, 0));
|
|
1833
1854
|
})));
|
|
1834
1855
|
}
|
|
1835
1856
|
), {
|
|
1836
1857
|
popupRef: t,
|
|
1837
1858
|
activate: $,
|
|
1838
|
-
deactivate:
|
|
1839
|
-
lastCloseReason:
|
|
1840
|
-
setPopupEl: (
|
|
1859
|
+
deactivate: M,
|
|
1860
|
+
lastCloseReason: J(C),
|
|
1861
|
+
setPopupEl: (I) => t.value = I
|
|
1841
1862
|
};
|
|
1842
1863
|
}
|
|
1843
1864
|
export {
|
|
@@ -1847,8 +1868,9 @@ export {
|
|
|
1847
1868
|
ct as useGridActiveFilter,
|
|
1848
1869
|
ft as useMaskedDateInput,
|
|
1849
1870
|
pt as useMaskedDateRangeInput,
|
|
1850
|
-
|
|
1851
|
-
|
|
1871
|
+
vt as useMaskedTimeInput,
|
|
1872
|
+
mt as usePopupTrap,
|
|
1852
1873
|
dt as useUSAddress,
|
|
1853
1874
|
We as useZipTextBox
|
|
1854
1875
|
};
|
|
1876
|
+
//# sourceMappingURL=featherk-composables.es.js.map
|