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