@featherk/composables 0.6.3 → 0.6.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/featherk-composables.es.js +778 -741
- package/dist/featherk-composables.umd.js +1 -1
- package/dist/range/useMaskedDateRangeInput.d.ts +2 -0
- package/dist/time/useMaskedTimeInput.d.ts +3 -0
- package/docs/date/useMaskedDateInput.md +1 -1
- package/docs/range/useMaskedDateRangeInput.md +4 -0
- package/docs/time/useMaskedTimeInput.md +18 -2
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useFocusTrap as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
[" ", "Spacebar", "Space", "Enter"].includes(
|
|
1
|
+
import { ref as _, onBeforeUnmount as Ie, nextTick as N, computed as h, watch as ve, onMounted as xe, readonly as K, getCurrentScope as Le, onScopeDispose as Pe, toValue as ce, unref as Te, shallowRef as Re } from "vue";
|
|
2
|
+
import { useFocusTrap as qe } from "@vueuse/integrations/useFocusTrap";
|
|
3
|
+
const We = (e) => {
|
|
4
|
+
const t = _(null);
|
|
5
|
+
let c = !1, P = null, T = null;
|
|
6
|
+
const V = [], W = ".k-table-row[data-grid-row-index] [tabindex]", k = () => e?.value?.columns, b = (o) => {
|
|
7
|
+
const m = o.key || o.code;
|
|
8
|
+
[" ", "Spacebar", "Space", "Enter"].includes(m) && (o.preventDefault(), o.stopPropagation(), t.value = o.target, o.target.click());
|
|
9
9
|
}, y = (o) => {
|
|
10
|
-
if (!
|
|
10
|
+
if (!t.value) return;
|
|
11
11
|
if (o.code === "Escape") {
|
|
12
|
-
o.preventDefault(), o.stopPropagation(),
|
|
12
|
+
o.preventDefault(), o.stopPropagation(), t.value && t.value.focus();
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const m = Array.from(
|
|
16
16
|
document.querySelectorAll(
|
|
17
17
|
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
18
18
|
)
|
|
@@ -23,72 +23,72 @@ const Ve = (e) => {
|
|
|
23
23
|
".k-filter-menu-container .k-dropdownlist[tabindex='0']",
|
|
24
24
|
".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
25
25
|
".k-filter-menu-container button:not([tabindex='-1']):not([disabled])"
|
|
26
|
-
],
|
|
26
|
+
], p = Array.from(
|
|
27
27
|
l.querySelectorAll(i.join(","))
|
|
28
28
|
);
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
(
|
|
29
|
+
if (p.length === 0) return;
|
|
30
|
+
const A = p.findIndex(
|
|
31
|
+
(C) => C === document.activeElement
|
|
32
32
|
);
|
|
33
|
-
let
|
|
34
|
-
|
|
33
|
+
let S;
|
|
34
|
+
A === -1 ? S = 0 : o.shiftKey ? S = (A - 1 + p.length) % p.length : S = (A + 1) % p.length, o.preventDefault(), o.stopPropagation(), p[S]?.focus();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
} else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
|
|
38
38
|
o.preventDefault(), o.stopPropagation();
|
|
39
|
-
const i =
|
|
40
|
-
(
|
|
39
|
+
const i = m.findIndex(
|
|
40
|
+
(A) => A === document.activeElement
|
|
41
41
|
);
|
|
42
|
-
let
|
|
43
|
-
o.code === "ArrowUp" ?
|
|
42
|
+
let p = i;
|
|
43
|
+
o.code === "ArrowUp" ? p = i > 0 ? i - 1 : m.length - 1 : o.code === "ArrowDown" && (p = i < m.length - 1 ? i + 1 : 0), m[p]?.focus();
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
o.code === "Tab" && (o.preventDefault(), o.stopPropagation(), o.shiftKey ? (
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
o.forEach((
|
|
50
|
-
|
|
46
|
+
o.code === "Tab" && (o.preventDefault(), o.stopPropagation(), o.shiftKey ? (t.value?.previousElementSibling).focus() : (t.value?.nextElementSibling).focus());
|
|
47
|
+
}, w = () => {
|
|
48
|
+
P = new MutationObserver((o) => {
|
|
49
|
+
o.forEach((m) => {
|
|
50
|
+
m.addedNodes.forEach((l) => {
|
|
51
51
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
52
52
|
const i = l;
|
|
53
53
|
if (i.classList.contains("k-animation-container")) {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const A = t.value;
|
|
55
|
+
A && (A.dataset.featherKSortable === "true" || N(() => {
|
|
56
56
|
i.querySelectorAll(
|
|
57
57
|
".k-columnmenu-item-wrapper"
|
|
58
|
-
).forEach((
|
|
59
|
-
|
|
58
|
+
).forEach((G) => {
|
|
59
|
+
G.textContent?.toLowerCase().includes("sort") && G.remove();
|
|
60
60
|
});
|
|
61
61
|
})), i.addEventListener(
|
|
62
62
|
"keydown",
|
|
63
63
|
y
|
|
64
64
|
), N(() => {
|
|
65
|
-
const
|
|
66
|
-
const
|
|
65
|
+
const S = () => {
|
|
66
|
+
const C = Array.from(
|
|
67
67
|
i.querySelectorAll(
|
|
68
68
|
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
69
69
|
)
|
|
70
70
|
);
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
else if (
|
|
74
|
-
|
|
71
|
+
if (C.length === 1)
|
|
72
|
+
C[0].focus(), C[0].click(), S.attempts = 0;
|
|
73
|
+
else if (C.length > 1) {
|
|
74
|
+
S.attempts = 0;
|
|
75
75
|
return;
|
|
76
76
|
} else
|
|
77
|
-
|
|
77
|
+
S.attempts === void 0 && (S.attempts = 0), S.attempts++ < 3 && setTimeout(S, 200);
|
|
78
78
|
};
|
|
79
|
-
|
|
79
|
+
S();
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
i.querySelectorAll(
|
|
83
83
|
".k-animation-container"
|
|
84
|
-
).forEach((
|
|
85
|
-
|
|
84
|
+
).forEach((A) => {
|
|
85
|
+
A.addEventListener(
|
|
86
86
|
"keydown",
|
|
87
87
|
y
|
|
88
88
|
);
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
}),
|
|
91
|
+
}), m.removedNodes.forEach((l) => {
|
|
92
92
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
93
93
|
const i = l;
|
|
94
94
|
i.classList.contains("k-animation-container") && i.removeEventListener(
|
|
@@ -96,8 +96,8 @@ const Ve = (e) => {
|
|
|
96
96
|
y
|
|
97
97
|
), i.querySelectorAll(
|
|
98
98
|
".k-animation-container"
|
|
99
|
-
).forEach((
|
|
100
|
-
|
|
99
|
+
).forEach((A) => {
|
|
100
|
+
A.removeEventListener(
|
|
101
101
|
"keydown",
|
|
102
102
|
y
|
|
103
103
|
);
|
|
@@ -105,15 +105,15 @@ const Ve = (e) => {
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
|
-
}),
|
|
108
|
+
}), P.observe(document.body, {
|
|
109
109
|
childList: !0,
|
|
110
110
|
subtree: !0
|
|
111
111
|
});
|
|
112
112
|
}, L = (o) => {
|
|
113
113
|
if (!o.type || !o)
|
|
114
114
|
return;
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
115
|
+
const m = o.target;
|
|
116
|
+
if (m) {
|
|
117
117
|
if (o.code === "Escape") {
|
|
118
118
|
const l = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
|
|
119
119
|
if (l) {
|
|
@@ -123,7 +123,7 @@ const Ve = (e) => {
|
|
|
123
123
|
e?.value.$el.querySelectorAll(
|
|
124
124
|
".k-table-row[data-grid-row-index]"
|
|
125
125
|
)
|
|
126
|
-
).forEach((
|
|
126
|
+
).forEach((p) => p.setAttribute("tabindex", "-1"));
|
|
127
127
|
} catch {
|
|
128
128
|
}
|
|
129
129
|
l.setAttribute("tabindex", "0"), l.focus();
|
|
@@ -138,57 +138,57 @@ const Ve = (e) => {
|
|
|
138
138
|
"Enter",
|
|
139
139
|
"Space"
|
|
140
140
|
].includes(o.code)) {
|
|
141
|
-
if (o.preventDefault(),
|
|
142
|
-
|
|
141
|
+
if (o.preventDefault(), m.classList.contains("k-grid-header-menu") && m.classList.contains("k-grid-column-menu")) {
|
|
142
|
+
t.value = m;
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
const l =
|
|
145
|
+
const l = m.closest(
|
|
146
146
|
".k-table-row[data-grid-row-index]"
|
|
147
147
|
);
|
|
148
148
|
if (l) {
|
|
149
149
|
if (["ArrowDown", "ArrowUp"].includes(o.code)) {
|
|
150
|
-
const i = (
|
|
151
|
-
let
|
|
152
|
-
for (;
|
|
153
|
-
const
|
|
150
|
+
const i = (A, S) => {
|
|
151
|
+
let C = S === "next" ? A.nextElementSibling : A.previousElementSibling;
|
|
152
|
+
for (; C; ) {
|
|
153
|
+
const G = C;
|
|
154
154
|
try {
|
|
155
|
-
if (
|
|
156
|
-
return
|
|
155
|
+
if (G.hasAttribute && G.classList.contains("k-table-row"))
|
|
156
|
+
return G;
|
|
157
157
|
} catch {
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
C = S === "next" ? C.nextElementSibling : C.previousElementSibling;
|
|
160
160
|
}
|
|
161
161
|
return null;
|
|
162
|
-
},
|
|
163
|
-
|
|
162
|
+
}, p = o.code === "ArrowDown" ? i(l, "next") : i(l, "previous");
|
|
163
|
+
p && (l.setAttribute("tabindex", "-1"), p.setAttribute("tabindex", "0"), p.focus());
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
if (["ArrowLeft", "ArrowRight"].includes(o.code)) {
|
|
167
167
|
o.preventDefault();
|
|
168
168
|
const i = l.querySelectorAll(
|
|
169
|
-
|
|
169
|
+
W
|
|
170
170
|
);
|
|
171
171
|
if (i.length === 0) return;
|
|
172
|
-
let
|
|
173
|
-
(
|
|
172
|
+
let p = Array.from(i).findIndex(
|
|
173
|
+
(A) => A === document.activeElement
|
|
174
174
|
);
|
|
175
|
-
if (
|
|
175
|
+
if (p === -1 && document.activeElement === l) {
|
|
176
176
|
i[0].focus();
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
o.code === "ArrowRight" ?
|
|
179
|
+
o.code === "ArrowRight" ? p = p === i.length - 1 ? 0 : p + 1 : o.code === "ArrowLeft" && (p = p === i.length - 1 ? p - 1 : i.length - 1), i[p].focus();
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
},
|
|
185
|
+
}, D = () => {
|
|
186
186
|
N(() => {
|
|
187
187
|
const o = e.value.$el.closest(".k-grid");
|
|
188
188
|
o && o.classList.add("fk-grid");
|
|
189
189
|
});
|
|
190
|
-
},
|
|
191
|
-
if (!
|
|
190
|
+
}, x = () => {
|
|
191
|
+
if (!T)
|
|
192
192
|
try {
|
|
193
193
|
const o = () => {
|
|
194
194
|
try {
|
|
@@ -198,81 +198,81 @@ const Ve = (e) => {
|
|
|
198
198
|
)
|
|
199
199
|
);
|
|
200
200
|
if (!i || i.length === 0 || i.filter(
|
|
201
|
-
(
|
|
201
|
+
(S) => S.getAttribute("tabindex") === "0"
|
|
202
202
|
).length === 1) return;
|
|
203
|
-
const
|
|
204
|
-
(
|
|
203
|
+
const A = i.find(
|
|
204
|
+
(S) => S === document.activeElement || S.contains(document.activeElement)
|
|
205
205
|
);
|
|
206
|
-
if (i.forEach((
|
|
207
|
-
|
|
206
|
+
if (i.forEach((S) => S.setAttribute("tabindex", "-1")), A) {
|
|
207
|
+
A.setAttribute("tabindex", "0");
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
210
|
i[0].setAttribute("tabindex", "0");
|
|
211
211
|
} catch (i) {
|
|
212
212
|
console.error("ensureSingleTabindex error:", i);
|
|
213
213
|
}
|
|
214
|
-
},
|
|
214
|
+
}, m = Array.from(
|
|
215
215
|
e.value.$el.querySelectorAll(
|
|
216
216
|
".k-table-row[data-grid-row-index]"
|
|
217
217
|
)
|
|
218
218
|
);
|
|
219
|
-
|
|
220
|
-
i.setAttribute("tabindex",
|
|
219
|
+
m.length > 0 && m.forEach((i, p) => {
|
|
220
|
+
i.setAttribute("tabindex", p === 0 ? "0" : "-1");
|
|
221
221
|
});
|
|
222
222
|
const l = e.value.$el.querySelector(".k-table-tbody");
|
|
223
|
-
l && (
|
|
223
|
+
l && (T = new MutationObserver(() => {
|
|
224
224
|
o();
|
|
225
|
-
}),
|
|
225
|
+
}), T.observe(l, { childList: !0, subtree: !0 }));
|
|
226
226
|
} catch (o) {
|
|
227
227
|
console.error("Error setting up row navigation:", o);
|
|
228
228
|
}
|
|
229
|
-
},
|
|
229
|
+
}, $ = () => {
|
|
230
230
|
N(() => {
|
|
231
|
-
const
|
|
232
|
-
|
|
231
|
+
const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
232
|
+
m && m.forEach((l) => {
|
|
233
233
|
l.setAttribute("role", "button"), l.addEventListener(
|
|
234
234
|
"keydown",
|
|
235
|
-
|
|
235
|
+
b
|
|
236
236
|
);
|
|
237
|
-
}),
|
|
237
|
+
}), w(), f();
|
|
238
238
|
});
|
|
239
|
-
},
|
|
240
|
-
const
|
|
241
|
-
|
|
239
|
+
}, R = () => {
|
|
240
|
+
const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
241
|
+
m && m.forEach((l) => {
|
|
242
242
|
l.removeEventListener(
|
|
243
243
|
"keydown",
|
|
244
|
-
|
|
244
|
+
b
|
|
245
245
|
);
|
|
246
|
-
}),
|
|
246
|
+
}), P && (P.disconnect(), P = null), T && (T.disconnect(), T = null), V.forEach((l) => l()), V.length = 0;
|
|
247
247
|
}, f = () => {
|
|
248
248
|
document.querySelectorAll(
|
|
249
249
|
".k-grid-header .k-table-thead th"
|
|
250
250
|
).forEach((l, i) => {
|
|
251
|
-
const
|
|
251
|
+
const p = l.querySelector(
|
|
252
252
|
".k-grid-header-menu.k-grid-column-menu"
|
|
253
253
|
);
|
|
254
|
-
if (!
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
const
|
|
258
|
-
l.setAttribute("data-feather-k-field",
|
|
254
|
+
if (!p) return;
|
|
255
|
+
const A = k();
|
|
256
|
+
if (A && A[i]) {
|
|
257
|
+
const H = A[i].field ?? "";
|
|
258
|
+
l.setAttribute("data-feather-k-field", H), l.setAttribute(
|
|
259
259
|
"data-feather-k-filterable",
|
|
260
|
-
|
|
260
|
+
A[i].filterable === !1 ? "false" : "true"
|
|
261
261
|
), l.setAttribute(
|
|
262
262
|
"data-feather-k-sortable",
|
|
263
|
-
|
|
263
|
+
A[i].sortable === !1 ? "false" : "true"
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
else if (
|
|
274
|
-
|
|
275
|
-
const
|
|
266
|
+
const S = l.dataset.featherKFilterable !== "false", C = l.dataset.featherKSortable !== "false";
|
|
267
|
+
p.setAttribute("tabindex", "-1"), S || C ? l.style.cursor = "pointer" : l.style.cursor = "default", S ? (l.setAttribute("tabindex", "0"), l.setAttribute("role", "button"), l.setAttribute("aria-haspopup", "menu")) : (l.setAttribute("tabindex", "0"), l.setAttribute("role", "columnheader"), l.removeAttribute("aria-haspopup"));
|
|
268
|
+
const G = (H) => {
|
|
269
|
+
H.target?.closest(".k-column-resizer") || (t.value = l, p.click());
|
|
270
|
+
}, oe = (H) => {
|
|
271
|
+
if (S)
|
|
272
|
+
t.value = l, H.preventDefault(), H.stopPropagation(), G(H);
|
|
273
|
+
else if (C) {
|
|
274
|
+
t.value = l;
|
|
275
|
+
const J = new KeyboardEvent("keydown", {
|
|
276
276
|
key: "Enter",
|
|
277
277
|
code: "Enter",
|
|
278
278
|
keyCode: 13,
|
|
@@ -280,88 +280,88 @@ const Ve = (e) => {
|
|
|
280
280
|
bubbles: !0,
|
|
281
281
|
cancelable: !0
|
|
282
282
|
});
|
|
283
|
-
l.dispatchEvent(
|
|
283
|
+
l.dispatchEvent(J);
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
|
-
l.addEventListener("click",
|
|
287
|
-
l.removeEventListener("click",
|
|
286
|
+
l.addEventListener("click", oe), V.push(() => {
|
|
287
|
+
l.removeEventListener("click", oe);
|
|
288
288
|
});
|
|
289
|
-
const
|
|
290
|
-
if ((
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
-
else if (
|
|
294
|
-
const
|
|
295
|
-
|
|
289
|
+
const Q = (H) => {
|
|
290
|
+
if ((H.code === "Enter" || H.code === "Space") && (S || C)) {
|
|
291
|
+
if (t.value = l, t.value.focus(), S)
|
|
292
|
+
H.preventDefault(), H.stopPropagation(), G(H);
|
|
293
|
+
else if (C) {
|
|
294
|
+
const J = l.querySelector(".k-link");
|
|
295
|
+
J && J.click();
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
|
-
l.addEventListener("keydown",
|
|
300
|
-
l.removeEventListener("keydown",
|
|
299
|
+
l.addEventListener("keydown", Q, !0), V.push(() => {
|
|
300
|
+
l.removeEventListener("keydown", Q, !0);
|
|
301
301
|
});
|
|
302
302
|
});
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
303
|
+
const m = document.querySelector(".k-grid-header .k-table-thead");
|
|
304
|
+
if (m) {
|
|
305
305
|
const l = (i) => {
|
|
306
|
-
const
|
|
307
|
-
|
|
306
|
+
const p = i.target.closest("th");
|
|
307
|
+
p && (i.code === "Enter" || i.code === "Space") && p.dataset.featherKFilterable === "false" && p.dataset.featherKSortable === "false" && (i.preventDefault(), i.stopImmediatePropagation());
|
|
308
308
|
};
|
|
309
|
-
|
|
309
|
+
m.addEventListener(
|
|
310
310
|
"keydown",
|
|
311
311
|
l,
|
|
312
312
|
!0
|
|
313
313
|
// NOTE: capture phase
|
|
314
|
-
),
|
|
315
|
-
|
|
314
|
+
), V.push(() => {
|
|
315
|
+
m.removeEventListener(
|
|
316
316
|
"keydown",
|
|
317
317
|
l,
|
|
318
318
|
!0
|
|
319
319
|
);
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
|
-
},
|
|
323
|
-
const l = o?.event.event.target, i =
|
|
322
|
+
}, g = function(o, m) {
|
|
323
|
+
const l = o?.event.event.target, i = k();
|
|
324
324
|
if (!l || !i) return;
|
|
325
|
-
const
|
|
326
|
-
if (!
|
|
327
|
-
if (
|
|
325
|
+
const p = l.classList.contains("k-link"), A = l.classList.contains("k-columnmenu-item"), S = i.find((C) => C.field === o.event.field)?.sortable && !0;
|
|
326
|
+
if (!p) {
|
|
327
|
+
if (A && !S) {
|
|
328
328
|
(o.event.sort && void 0)?.filter(
|
|
329
|
-
(
|
|
329
|
+
(G) => G.field !== o.event.field
|
|
330
330
|
);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
|
-
typeof
|
|
334
|
-
|
|
333
|
+
typeof m == "function" && N(() => {
|
|
334
|
+
t.value && t.value.focus(), m(o);
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
|
-
},
|
|
338
|
-
if (!
|
|
337
|
+
}, F = () => {
|
|
338
|
+
if (!c)
|
|
339
339
|
try {
|
|
340
|
-
|
|
340
|
+
D(), x(), $(), c = !0;
|
|
341
341
|
} catch (o) {
|
|
342
|
-
console.error("initA11y failed:", o),
|
|
342
|
+
console.error("initA11y failed:", o), R();
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
|
-
return
|
|
346
|
-
|
|
345
|
+
return Ie(() => {
|
|
346
|
+
R();
|
|
347
347
|
}), {
|
|
348
|
-
activeFilterButton:
|
|
348
|
+
activeFilterButton: t,
|
|
349
349
|
handleGridKeyDown: L,
|
|
350
|
-
handleSortChange:
|
|
351
|
-
initA11y:
|
|
350
|
+
handleSortChange: g,
|
|
351
|
+
initA11y: F
|
|
352
352
|
};
|
|
353
353
|
};
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
const a =
|
|
354
|
+
function _e(e) {
|
|
355
|
+
const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(e.dateFormat ?? "mm/dd/yyyy"), V = h(() => !!e.required), W = _(!1), k = ["ArrowUp", "ArrowDown"], b = ["ArrowLeft", "ArrowRight"], y = h(() => (t.value ?? "").replace(/\D/g, "")), w = (a) => a <= 2 ? "mm" : a <= 5 ? "dd" : y.value.length <= 10 ? "yyyy" : "mm", L = h(() => {
|
|
356
|
+
const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
357
357
|
return parseInt(a).toString().padStart(2, "0");
|
|
358
|
-
}),
|
|
359
|
-
const a =
|
|
358
|
+
}), D = h(() => {
|
|
359
|
+
const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
|
|
360
360
|
return parseInt(a).toString().padStart(2, "0");
|
|
361
|
-
}),
|
|
362
|
-
const a =
|
|
361
|
+
}), x = h(() => {
|
|
362
|
+
const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
363
363
|
return parseInt(a).toString().padStart(4, "0");
|
|
364
|
-
}),
|
|
364
|
+
}), $ = (a) => {
|
|
365
365
|
if (y.value.length === 0) {
|
|
366
366
|
e.onChange({ value: null, event: a });
|
|
367
367
|
return;
|
|
@@ -370,120 +370,120 @@ function Ye(e) {
|
|
|
370
370
|
e.onChange({ value: null, event: a });
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
if ((
|
|
374
|
-
const [
|
|
375
|
-
if (o(
|
|
376
|
-
const
|
|
377
|
-
|
|
373
|
+
if ((t.value ?? "").length === 10 && y.value.length === 8) {
|
|
374
|
+
const [d, I, te] = t.value.split("/"), r = parseInt(d), u = parseInt(I), v = parseInt(te);
|
|
375
|
+
if (o(v, r, u)) {
|
|
376
|
+
const M = new Date(v, r - 1, u);
|
|
377
|
+
R(M) ? e.onChange({ value: M, event: a }) : e.onChange({ value: null, event: a });
|
|
378
378
|
} else
|
|
379
379
|
e.onChange({ value: null, event: a });
|
|
380
380
|
}
|
|
381
|
-
},
|
|
382
|
-
const
|
|
383
|
-
return !(
|
|
384
|
-
}, f =
|
|
385
|
-
if ((
|
|
386
|
-
const [a,
|
|
387
|
-
if (o(
|
|
388
|
-
return new Date(
|
|
381
|
+
}, R = (a) => {
|
|
382
|
+
const d = e.min ?? void 0, I = e.max ?? void 0;
|
|
383
|
+
return !(d && a < d || I && a > I);
|
|
384
|
+
}, f = h(() => {
|
|
385
|
+
if ((t.value ?? "").length === 10 && y.value.length === 8) {
|
|
386
|
+
const [a, d, I] = (t.value ?? "").split("/"), te = parseInt(a), r = parseInt(d), u = parseInt(I);
|
|
387
|
+
if (o(u, te, r))
|
|
388
|
+
return new Date(u, te - 1, r);
|
|
389
389
|
}
|
|
390
390
|
return null;
|
|
391
|
-
}),
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
|
|
391
|
+
}), g = h(() => (t.value ?? "").length === 10 && y.value.length === 8), F = (a, d) => new Date(a, d, 0).getDate(), o = (a, d, I) => d >= 1 && d <= 12 && a >= 1900 && I >= 1 && I <= F(a, d), m = (a) => {
|
|
392
|
+
t.value = a.value;
|
|
393
|
+
const d = a.event?.target;
|
|
394
|
+
c.value = d?.selectionStart ?? 0, $(a);
|
|
395
395
|
}, l = (a) => {
|
|
396
|
-
|
|
397
|
-
}, i = (a,
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
let
|
|
401
|
-
if (!(y.value.length >= 8) || !o(
|
|
402
|
-
const
|
|
403
|
-
|
|
396
|
+
c.value = a.target.selectionStart ?? 0;
|
|
397
|
+
}, i = (a, d, I) => {
|
|
398
|
+
const te = d?.selectionStart ?? c.value ?? 0;
|
|
399
|
+
c.value = te;
|
|
400
|
+
let r = parseInt(L.value), u = parseInt(D.value), v = parseInt(x.value);
|
|
401
|
+
if (!(y.value.length >= 8) || !o(v, r, u)) {
|
|
402
|
+
const z = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
403
|
+
r = z.getMonth() + 1, u = z.getDate(), v = z.getFullYear(), t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
|
|
404
404
|
2,
|
|
405
405
|
"0"
|
|
406
|
-
)}/${String(
|
|
407
|
-
const
|
|
408
|
-
e.onChange({ value:
|
|
406
|
+
)}/${String(v)}`;
|
|
407
|
+
const O = new Date(v, r - 1, u);
|
|
408
|
+
e.onChange({ value: R(O) ? O : null, event: I }), N(() => {
|
|
409
409
|
requestAnimationFrame(() => {
|
|
410
|
-
const
|
|
410
|
+
const X = document.getElementById(
|
|
411
411
|
e.id
|
|
412
|
-
),
|
|
413
|
-
|
|
412
|
+
), Z = c.value ?? 0;
|
|
413
|
+
X && (X.focus(), X.setSelectionRange(Z, Z));
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
else if (
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
} else
|
|
425
|
-
|
|
418
|
+
const U = w(te);
|
|
419
|
+
if (U === "mm")
|
|
420
|
+
r = a === "ArrowUp" ? r < 12 ? r + 1 : 1 : r > 1 ? r - 1 : 12;
|
|
421
|
+
else if (U === "dd") {
|
|
422
|
+
const z = new Date(v, r, 0).getDate();
|
|
423
|
+
u = a === "ArrowUp" ? u < z ? u + 1 : 1 : u > 1 ? u - 1 : z;
|
|
424
|
+
} else U === "yyyy" && (v = a === "ArrowUp" ? v + 1 : Math.max(1, v - 1));
|
|
425
|
+
t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
|
|
426
426
|
2,
|
|
427
427
|
"0"
|
|
428
|
-
)}/${String(
|
|
429
|
-
const [
|
|
430
|
-
parseInt(
|
|
431
|
-
parseInt(
|
|
432
|
-
parseInt(
|
|
428
|
+
)}/${String(v)}`;
|
|
429
|
+
const [ae, j, Y] = t.value.split("/"), ie = new Date(
|
|
430
|
+
parseInt(Y),
|
|
431
|
+
parseInt(ae) - 1,
|
|
432
|
+
parseInt(j)
|
|
433
433
|
);
|
|
434
|
-
|
|
435
|
-
value:
|
|
436
|
-
event:
|
|
437
|
-
}) : e.onChange({ value: null, event:
|
|
434
|
+
ie.toString() !== "Invalid Date" && parseInt(Y) >= 1e3 ? e.onChange({
|
|
435
|
+
value: R(ie) ? ie : null,
|
|
436
|
+
event: I
|
|
437
|
+
}) : e.onChange({ value: null, event: I }), N(() => {
|
|
438
438
|
requestAnimationFrame(() => {
|
|
439
|
-
const
|
|
439
|
+
const z = document.getElementById(
|
|
440
440
|
e.id
|
|
441
|
-
),
|
|
442
|
-
|
|
441
|
+
), O = c.value ?? 0;
|
|
442
|
+
z && (z.focus(), z.setSelectionRange(O, O));
|
|
443
443
|
});
|
|
444
444
|
});
|
|
445
|
-
},
|
|
445
|
+
}, p = (a) => {
|
|
446
446
|
if (a.code === "Space" || a.key === " ") {
|
|
447
447
|
e.onShowCalendar(a);
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
|
-
if (
|
|
450
|
+
if (k.includes(a.key)) {
|
|
451
451
|
a.preventDefault();
|
|
452
|
-
const
|
|
453
|
-
i(a.key,
|
|
452
|
+
const d = a.target;
|
|
453
|
+
i(a.key, d, a);
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, A = (a) => {
|
|
456
456
|
a.preventDefault();
|
|
457
|
-
const
|
|
458
|
-
i(
|
|
459
|
-
},
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
|
|
457
|
+
const d = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
458
|
+
i(d, a.target, a);
|
|
459
|
+
}, S = (a) => {
|
|
460
|
+
const d = a.target;
|
|
461
|
+
if (b.includes(a.key)) {
|
|
462
|
+
c.value = d?.selectionStart ?? 0;
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
|
-
|
|
466
|
-
},
|
|
467
|
-
|
|
468
|
-
const
|
|
469
|
-
|
|
465
|
+
k.includes(a.key) && (a.preventDefault(), c.value = d?.selectionStart ?? 0);
|
|
466
|
+
}, C = (a) => {
|
|
467
|
+
W.value = !0, V.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && y.value.length === 0 && (e.externalValue.value = "");
|
|
468
|
+
const d = a.target;
|
|
469
|
+
d && (c.value = d.selectionStart ?? 0);
|
|
470
470
|
};
|
|
471
|
-
e.externalValue &&
|
|
471
|
+
e.externalValue && ve(
|
|
472
472
|
e.externalValue,
|
|
473
473
|
(a) => {
|
|
474
474
|
if (a) {
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
const
|
|
478
|
-
|
|
475
|
+
const d = new Date(a);
|
|
476
|
+
if (d.toString() !== "Invalid Date") {
|
|
477
|
+
const I = (d.getMonth() + 1).toString().padStart(2, "0"), te = d.getDate().toString().padStart(2, "0"), r = d.getFullYear().toString();
|
|
478
|
+
t.value = `${I}/${te}/${r}`;
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
},
|
|
483
483
|
{ immediate: !0 }
|
|
484
484
|
);
|
|
485
|
-
const
|
|
486
|
-
["Date", `${L.value} / ${
|
|
485
|
+
const G = h(() => [
|
|
486
|
+
["Date", `${L.value} / ${D.value} / ${x.value}`],
|
|
487
487
|
["Digits only", y.value],
|
|
488
488
|
[
|
|
489
489
|
"min",
|
|
@@ -501,49 +501,49 @@ function Ye(e) {
|
|
|
501
501
|
day: "2-digit"
|
|
502
502
|
}) ?? null
|
|
503
503
|
]
|
|
504
|
-
]),
|
|
505
|
-
if (!
|
|
506
|
-
if (!
|
|
507
|
-
const
|
|
508
|
-
return
|
|
504
|
+
]), oe = h(() => {
|
|
505
|
+
if (!V.value) {
|
|
506
|
+
if (!g.value) return !0;
|
|
507
|
+
const d = f.value;
|
|
508
|
+
return d ? R(d) : !1;
|
|
509
509
|
}
|
|
510
|
-
if (!
|
|
510
|
+
if (!W.value) return !0;
|
|
511
511
|
const a = f.value;
|
|
512
|
-
return !
|
|
513
|
-
}),
|
|
514
|
-
if (!
|
|
515
|
-
if (!
|
|
516
|
-
const
|
|
517
|
-
return
|
|
512
|
+
return !g.value || !a ? !1 : R(a);
|
|
513
|
+
}), Q = h(() => {
|
|
514
|
+
if (!V.value) {
|
|
515
|
+
if (!g.value) return;
|
|
516
|
+
const d = f.value;
|
|
517
|
+
return d ? R(d) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
518
518
|
}
|
|
519
|
-
if (!
|
|
520
|
-
if (y.value.length === 0 || !
|
|
519
|
+
if (!W.value) return;
|
|
520
|
+
if (y.value.length === 0 || !g.value)
|
|
521
521
|
return "incomplete";
|
|
522
522
|
const a = f.value;
|
|
523
|
-
return a ?
|
|
524
|
-
}),
|
|
525
|
-
const a =
|
|
523
|
+
return a ? R(a) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
524
|
+
}), H = h(() => {
|
|
525
|
+
const a = Q.value;
|
|
526
526
|
if (!a || a === "valid") return "";
|
|
527
527
|
if (a === "incomplete")
|
|
528
528
|
return "Required";
|
|
529
529
|
if (a === "invalid-date")
|
|
530
|
-
return `Must be in ${
|
|
531
|
-
const
|
|
530
|
+
return `Must be in ${T.value} format.`;
|
|
531
|
+
const d = e.min ? e.min.toLocaleDateString("en-US", {
|
|
532
532
|
year: "numeric",
|
|
533
533
|
month: "2-digit",
|
|
534
534
|
day: "2-digit"
|
|
535
|
-
}) : null,
|
|
535
|
+
}) : null, I = e.max ? e.max.toLocaleDateString("en-US", {
|
|
536
536
|
year: "numeric",
|
|
537
537
|
month: "2-digit",
|
|
538
538
|
day: "2-digit"
|
|
539
539
|
}) : null;
|
|
540
540
|
if (a === "out-of-bounds") {
|
|
541
|
-
if (
|
|
542
|
-
if (
|
|
543
|
-
if (
|
|
541
|
+
if (d && I) return `Must be between ${d} and ${I}.`;
|
|
542
|
+
if (d) return `Must be on or after ${d}.`;
|
|
543
|
+
if (I) return `Must be on or before ${I}.`;
|
|
544
544
|
}
|
|
545
545
|
return "";
|
|
546
|
-
}),
|
|
546
|
+
}), J = () => {
|
|
547
547
|
N(() => {
|
|
548
548
|
const a = document.getElementById(
|
|
549
549
|
e.id
|
|
@@ -552,76 +552,81 @@ function Ye(e) {
|
|
|
552
552
|
console.warn(`ID (#${e.id}) not found for styling.`);
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
|
|
558
|
-
|
|
555
|
+
const d = a.closest(".k-datepicker");
|
|
556
|
+
if (d) {
|
|
557
|
+
const I = d.parentElement;
|
|
558
|
+
I ? I.classList.add("fk-datepicker") : console.warn(
|
|
559
|
+
`Parent of .k-datepicker not found for #${e.id} styling.`
|
|
560
|
+
);
|
|
561
|
+
} else {
|
|
559
562
|
console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
|
|
560
563
|
return;
|
|
561
564
|
}
|
|
562
565
|
});
|
|
563
566
|
};
|
|
564
|
-
return
|
|
565
|
-
|
|
567
|
+
return xe(() => {
|
|
568
|
+
J();
|
|
566
569
|
}), {
|
|
567
|
-
raw:
|
|
568
|
-
cursorPos:
|
|
569
|
-
debugEnabled:
|
|
570
|
-
debugLines:
|
|
571
|
-
placeholder:
|
|
572
|
-
isValid:
|
|
573
|
-
reason:
|
|
574
|
-
validationMessage:
|
|
570
|
+
raw: t,
|
|
571
|
+
cursorPos: c,
|
|
572
|
+
debugEnabled: P,
|
|
573
|
+
debugLines: G,
|
|
574
|
+
placeholder: T,
|
|
575
|
+
isValid: oe,
|
|
576
|
+
reason: K(Q),
|
|
577
|
+
validationMessage: H,
|
|
575
578
|
digitsOnly: y,
|
|
576
|
-
month:
|
|
577
|
-
day:
|
|
578
|
-
year:
|
|
579
|
-
datePart:
|
|
580
|
-
handleChange:
|
|
581
|
-
handleKeyDown:
|
|
582
|
-
handleWheel:
|
|
583
|
-
handleKeyUp:
|
|
579
|
+
month: K(L),
|
|
580
|
+
day: K(D),
|
|
581
|
+
year: K(x),
|
|
582
|
+
datePart: w,
|
|
583
|
+
handleChange: m,
|
|
584
|
+
handleKeyDown: p,
|
|
585
|
+
handleWheel: A,
|
|
586
|
+
handleKeyUp: S,
|
|
584
587
|
handleClick: l,
|
|
585
|
-
handleBlur:
|
|
588
|
+
handleBlur: C
|
|
586
589
|
};
|
|
587
590
|
}
|
|
588
|
-
function
|
|
589
|
-
const
|
|
590
|
-
e.min = e.min ??
|
|
591
|
-
const
|
|
592
|
-
if (!
|
|
593
|
-
const s = e.min,
|
|
594
|
-
return
|
|
595
|
-
},
|
|
596
|
-
if ((
|
|
591
|
+
function Ge(e) {
|
|
592
|
+
const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(!1), W = 365 * (1440 * 60 * 1e3), k = /* @__PURE__ */ new Date(), b = new Date(k.getTime() - W), y = new Date(k.getTime() + W);
|
|
593
|
+
e.min = e.min ?? b, e.max = e.max ?? y;
|
|
594
|
+
const w = h(() => (t.value ?? "").replace(/\D/g, "")), L = (n, s) => new Date(n, s, 0).getDate(), D = (n, s, E) => s >= 1 && s <= 12 && n >= 1e3 && E >= 1 && E <= L(n, s), x = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), $ = (n) => {
|
|
595
|
+
if (!n) return null;
|
|
596
|
+
const s = e.min, E = e.max, q = x(n);
|
|
597
|
+
return q < x(s) || q > x(E) ? null : n;
|
|
598
|
+
}, R = (n, s) => e.allowReverse ?? !1 ? !0 : n <= s, f = h(() => (t.value?.length ?? 0) >= 23 && w.value.length >= 16), g = (n) => {
|
|
599
|
+
if ((n ?? "").length < 23 || w.value.length < 16)
|
|
597
600
|
return { start: null, end: null };
|
|
598
|
-
const s =
|
|
599
|
-
return { start:
|
|
600
|
-
},
|
|
601
|
-
const
|
|
602
|
-
return { start:
|
|
603
|
-
}), l =
|
|
604
|
-
if (!f.value) return;
|
|
605
|
-
const t = c.value.start, s = c.value.end;
|
|
606
|
-
if (!t || !s) return;
|
|
607
|
-
const h = (j) => Date.UTC(j.getFullYear(), j.getMonth(), j.getDate()), C = Math.abs(h(s) - h(t));
|
|
608
|
-
return Math.round(C / 864e5);
|
|
609
|
-
}), i = D(() => {
|
|
610
|
-
const { start: t, end: s } = o.value;
|
|
601
|
+
const s = n.substring(0, 10), E = n.substring(13, 23), [q, ne, le] = s.split("/").map((se) => parseInt(se || "0", 10)), [ye, de, fe] = E.split("/").map((se) => parseInt(se || "0", 10)), me = new Date(le, q - 1, ne), he = new Date(fe, ye - 1, de), we = D(le, q, ne) && me.toString() !== "Invalid Date", ke = D(fe, ye, de) && he.toString() !== "Invalid Date";
|
|
602
|
+
return { start: we ? me : null, end: ke ? he : null };
|
|
603
|
+
}, F = e.externalValid ?? _(!0), o = h(() => g(t.value)), m = h(() => {
|
|
604
|
+
const n = $(o.value.start), s = $(o.value.end);
|
|
605
|
+
return { start: n, end: s };
|
|
606
|
+
}), l = h(() => {
|
|
611
607
|
if (!f.value) return;
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
608
|
+
const n = m.value.start, s = m.value.end;
|
|
609
|
+
if (!n || !s) return;
|
|
610
|
+
const E = Math.abs(x(s) - x(n));
|
|
611
|
+
return Math.round(E / 864e5 + 1);
|
|
612
|
+
}), i = h(() => {
|
|
613
|
+
if (!f.value) return !1;
|
|
614
|
+
const { start: n, end: s } = o.value;
|
|
615
|
+
if (!n || !s || !m.value.start || !m.value.end) return !1;
|
|
616
|
+
const E = m.value.start, q = m.value.end;
|
|
617
|
+
return !(!R(E, q) || typeof e.maxSpanDays == "number" && l.value !== void 0 && l.value > e.maxSpanDays);
|
|
618
|
+
}), p = h(() => {
|
|
619
|
+
const { start: n, end: s } = o.value;
|
|
617
620
|
if (!f.value) return "incomplete";
|
|
618
|
-
if (!
|
|
619
|
-
if (!
|
|
620
|
-
const
|
|
621
|
-
return
|
|
622
|
-
}),
|
|
623
|
-
|
|
624
|
-
|
|
621
|
+
if (!n || !s) return "invalid-date";
|
|
622
|
+
if (!m.value.start || !m.value.end) return "out-of-bounds";
|
|
623
|
+
const E = m.value.start, q = m.value.end;
|
|
624
|
+
return R(E, q) ? typeof e.maxSpanDays == "number" && l.value !== void 0 && l.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
|
|
625
|
+
}), A = _(void 0), S = h(() => {
|
|
626
|
+
if (F.value !== !1) return "";
|
|
627
|
+
const { min: n, max: s } = e, E = A.value;
|
|
628
|
+
if (!E) return "";
|
|
629
|
+
switch (E) {
|
|
625
630
|
case "incomplete":
|
|
626
631
|
return "Required";
|
|
627
632
|
case "invalid-date":
|
|
@@ -629,151 +634,159 @@ function Ne(e) {
|
|
|
629
634
|
case "reversed-range":
|
|
630
635
|
return "End Date must be on or after Start Date.";
|
|
631
636
|
case "out-of-bounds":
|
|
632
|
-
return
|
|
637
|
+
return n && s ? `Dates must be between ${Q(n)} and ${Q(s)}.` : "Dates must be within the allowed range.";
|
|
633
638
|
case "span-exceeds-limit":
|
|
634
639
|
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
635
640
|
case "valid":
|
|
636
641
|
default:
|
|
637
642
|
return "";
|
|
638
643
|
}
|
|
639
|
-
})
|
|
640
|
-
|
|
641
|
-
i,
|
|
642
|
-
(t) => {
|
|
643
|
-
(e.manageValid ?? !0) && (O.value = t);
|
|
644
|
-
},
|
|
645
|
-
{ immediate: !0 }
|
|
646
|
-
);
|
|
647
|
-
const w = ["ArrowUp", "ArrowDown"], P = ["ArrowLeft", "ArrowRight"], W = (t, s) => String(t).padStart(s, "0"), X = (t) => `${W(t.getMonth() + 1, 2)}/${W(t.getDate(), 2)}/${W(
|
|
648
|
-
t.getFullYear(),
|
|
644
|
+
}), C = ["ArrowUp", "ArrowDown"], G = ["ArrowLeft", "ArrowRight"], oe = (n, s) => String(n).padStart(s, "0"), Q = (n) => `${oe(n.getMonth() + 1, 2)}/${oe(n.getDate(), 2)}/${oe(
|
|
645
|
+
n.getFullYear(),
|
|
649
646
|
4
|
|
650
|
-
)}`,
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
const { start:
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
|
|
647
|
+
)}`, H = (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" }, J = (n, s, E) => {
|
|
648
|
+
const q = s?.selectionStart ?? c.value ?? 0;
|
|
649
|
+
c.value = q;
|
|
650
|
+
const { start: ne, end: le } = g(t.value);
|
|
651
|
+
if (!ne && !le) {
|
|
652
|
+
const B = /* @__PURE__ */ new Date(), ue = Q(B);
|
|
653
|
+
t.value = `${ue} - ${ue}`, e.onChange({ value: { start: B, end: B }, event: E }), N(() => {
|
|
657
654
|
requestAnimationFrame(() => {
|
|
658
|
-
const
|
|
655
|
+
const ee = document.getElementById(
|
|
659
656
|
e.id
|
|
660
|
-
),
|
|
661
|
-
|
|
657
|
+
), re = c.value ?? 0;
|
|
658
|
+
ee && (ee.focus(), ee.setSelectionRange(re, re));
|
|
662
659
|
});
|
|
663
660
|
});
|
|
664
661
|
return;
|
|
665
662
|
}
|
|
666
|
-
const
|
|
667
|
-
let
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
} else if (
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
} else if (
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
const
|
|
681
|
-
|
|
663
|
+
const ye = /* @__PURE__ */ new Date(), de = H(q);
|
|
664
|
+
let fe = ne ? new Date(ne) : new Date(ye), me = le ? new Date(le) : new Date(ye);
|
|
665
|
+
const he = (B, ue) => {
|
|
666
|
+
if (ue === "mm") {
|
|
667
|
+
const ee = B.getMonth() + 1, re = n === "ArrowUp" ? ee < 12 ? ee + 1 : 1 : ee > 1 ? ee - 1 : 12;
|
|
668
|
+
B.setMonth(re - 1);
|
|
669
|
+
const be = L(B.getFullYear(), re);
|
|
670
|
+
B.getDate() > be && B.setDate(be);
|
|
671
|
+
} else if (ue === "dd") {
|
|
672
|
+
const ee = L(B.getFullYear(), B.getMonth() + 1), re = B.getDate(), be = n === "ArrowUp" ? re < ee ? re + 1 : 1 : re > 1 ? re - 1 : ee;
|
|
673
|
+
B.setDate(be);
|
|
674
|
+
} else if (ue === "yyyy") {
|
|
675
|
+
const ee = B.getFullYear();
|
|
676
|
+
B.setFullYear(n === "ArrowUp" ? ee + 1 : Math.max(1, ee - 1));
|
|
677
|
+
const re = L(B.getFullYear(), B.getMonth() + 1);
|
|
678
|
+
B.getDate() > re && B.setDate(re);
|
|
682
679
|
}
|
|
683
680
|
};
|
|
684
|
-
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
|
|
681
|
+
de.side === "start" ? he(fe, de.part) : he(me, de.part);
|
|
682
|
+
const we = Q(fe), ke = Q(me);
|
|
683
|
+
t.value = `${we} - ${ke}`;
|
|
684
|
+
const se = $(fe), De = $(me);
|
|
685
|
+
se && De && R(se, De) ? e.onChange({ value: { start: se, end: De }, event: E }) : e.onChange({ value: null, event: E }), N(() => {
|
|
689
686
|
requestAnimationFrame(() => {
|
|
690
|
-
const
|
|
687
|
+
const B = document.getElementById(
|
|
691
688
|
e.id
|
|
692
|
-
),
|
|
693
|
-
|
|
689
|
+
), ue = c.value ?? 0;
|
|
690
|
+
B && (B.focus(), B.setSelectionRange(ue, ue));
|
|
694
691
|
});
|
|
695
692
|
});
|
|
696
|
-
},
|
|
697
|
-
const { start: s, end:
|
|
698
|
-
if (!s || !
|
|
699
|
-
e.onChange({ value: null, event:
|
|
693
|
+
}, a = (n) => {
|
|
694
|
+
const { start: s, end: E } = g(t.value);
|
|
695
|
+
if (!s || !E) {
|
|
696
|
+
e.onChange({ value: null, event: n });
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const q = $(s), ne = $(E);
|
|
700
|
+
if (!q || !ne) {
|
|
701
|
+
e.onChange({ value: null, event: n });
|
|
700
702
|
return;
|
|
701
703
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
e.onChange({ value: null, event: t });
|
|
704
|
+
if (!R(q, ne)) {
|
|
705
|
+
e.onChange({ value: null, event: n });
|
|
705
706
|
return;
|
|
706
707
|
}
|
|
707
|
-
|
|
708
|
-
|
|
708
|
+
e.onChange({ value: { start: q, end: ne }, event: n });
|
|
709
|
+
}, d = (n) => {
|
|
710
|
+
const s = n.value ?? "", E = n.event;
|
|
711
|
+
if (!s && E && E.type === "click") {
|
|
712
|
+
U(E);
|
|
709
713
|
return;
|
|
710
714
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
},
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
if (t.code === "Space" || t.key === " ") {
|
|
720
|
-
t.preventDefault(), e.onShowCalendar(t);
|
|
715
|
+
t.value = s;
|
|
716
|
+
const q = E?.target;
|
|
717
|
+
c.value = q?.selectionStart ?? 0, a(n);
|
|
718
|
+
}, I = (n) => {
|
|
719
|
+
c.value = n.target.selectionStart ?? 0;
|
|
720
|
+
}, te = (n) => {
|
|
721
|
+
if (n.code === "Space" || n.key === " ") {
|
|
722
|
+
n.preventDefault(), e.onShowCalendar(n);
|
|
721
723
|
return;
|
|
722
724
|
}
|
|
723
|
-
if (
|
|
724
|
-
|
|
725
|
+
if (n.key === "ArrowDown" && n.altKey) {
|
|
726
|
+
n.preventDefault(), e.onShowCalendar(n);
|
|
725
727
|
return;
|
|
726
728
|
}
|
|
727
|
-
if (
|
|
728
|
-
|
|
729
|
-
const s =
|
|
730
|
-
|
|
729
|
+
if (C.includes(n.key)) {
|
|
730
|
+
n.preventDefault();
|
|
731
|
+
const s = n.target;
|
|
732
|
+
J(n.key, s, n);
|
|
731
733
|
}
|
|
732
|
-
},
|
|
733
|
-
|
|
734
|
-
const s =
|
|
735
|
-
|
|
736
|
-
},
|
|
737
|
-
if (
|
|
738
|
-
|
|
739
|
-
const s =
|
|
740
|
-
|
|
734
|
+
}, r = (n) => {
|
|
735
|
+
n.preventDefault();
|
|
736
|
+
const s = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
737
|
+
J(s, n.target, n);
|
|
738
|
+
}, u = (n) => {
|
|
739
|
+
if (G.includes(n.key) || C.includes(n.key)) {
|
|
740
|
+
n.preventDefault();
|
|
741
|
+
const s = n.target;
|
|
742
|
+
c.value = s?.selectionStart ?? 0;
|
|
741
743
|
}
|
|
744
|
+
}, v = () => {
|
|
745
|
+
A.value = p.value, (e.manageValid ?? !0) && (F.value = i.value);
|
|
746
|
+
}, M = (n) => {
|
|
747
|
+
v();
|
|
748
|
+
}, U = (n) => {
|
|
749
|
+
console.log("Clear event:", n), t.value = "", c.value = 0, e.onChange({ value: null, event: n }), v(), N(() => {
|
|
750
|
+
const s = document.getElementById(
|
|
751
|
+
e.id
|
|
752
|
+
);
|
|
753
|
+
s && (s.focus(), s.setSelectionRange(0, 0));
|
|
754
|
+
});
|
|
742
755
|
};
|
|
743
|
-
e.externalValue &&
|
|
756
|
+
e.externalValue && ve(
|
|
744
757
|
e.externalValue,
|
|
745
|
-
(
|
|
746
|
-
const s =
|
|
747
|
-
if (s &&
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
758
|
+
(n) => {
|
|
759
|
+
const s = n?.start ?? null, E = n?.end ?? null;
|
|
760
|
+
if (s && E) {
|
|
761
|
+
if (t.value = `${Q(s)} - ${Q(E)}`, e.isOpen?.value && T.value && e.onRequestClose) {
|
|
762
|
+
const q = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
|
|
750
763
|
setTimeout(() => {
|
|
751
|
-
e.onRequestClose?.(),
|
|
752
|
-
},
|
|
764
|
+
e.onRequestClose?.(), T.value = !1, v();
|
|
765
|
+
}, q);
|
|
753
766
|
}
|
|
754
767
|
return;
|
|
755
768
|
}
|
|
756
769
|
},
|
|
757
770
|
{ immediate: !0 }
|
|
758
771
|
);
|
|
759
|
-
const
|
|
760
|
-
() =>
|
|
761
|
-
),
|
|
762
|
-
() =>
|
|
763
|
-
),
|
|
764
|
-
() =>
|
|
765
|
-
),
|
|
766
|
-
() =>
|
|
767
|
-
),
|
|
768
|
-
() =>
|
|
769
|
-
),
|
|
770
|
-
() =>
|
|
771
|
-
),
|
|
772
|
-
const { start:
|
|
772
|
+
const ae = h(
|
|
773
|
+
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
774
|
+
), j = h(
|
|
775
|
+
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
776
|
+
), Y = h(
|
|
777
|
+
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
778
|
+
), ie = h(
|
|
779
|
+
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
780
|
+
), z = h(
|
|
781
|
+
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
782
|
+
), O = h(
|
|
783
|
+
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
784
|
+
), X = h(() => {
|
|
785
|
+
const { start: n, end: s } = g(t.value);
|
|
773
786
|
return [
|
|
774
787
|
{
|
|
775
788
|
label: "Raw",
|
|
776
|
-
value:
|
|
789
|
+
value: t.value
|
|
777
790
|
},
|
|
778
791
|
{
|
|
779
792
|
label: "Min Date",
|
|
@@ -785,287 +798,301 @@ function Ne(e) {
|
|
|
785
798
|
},
|
|
786
799
|
{
|
|
787
800
|
label: "Start",
|
|
788
|
-
value: `${String(
|
|
789
|
-
|
|
790
|
-
).padStart(2, "0")} / ${String(
|
|
801
|
+
value: `${String(ae.value).padStart(2, "0")} / ${String(
|
|
802
|
+
j.value
|
|
803
|
+
).padStart(2, "0")} / ${String(Y.value).padStart(4, "0")}`
|
|
791
804
|
},
|
|
792
805
|
{
|
|
793
806
|
label: "End",
|
|
794
|
-
value: `${String(
|
|
795
|
-
|
|
796
|
-
).padStart(2, "0")} / ${String(
|
|
807
|
+
value: `${String(ie.value).padStart(2, "0")} / ${String(
|
|
808
|
+
z.value
|
|
809
|
+
).padStart(2, "0")} / ${String(O.value).padStart(4, "0")}`
|
|
797
810
|
},
|
|
798
|
-
{ label: "Digits only", value:
|
|
811
|
+
{ label: "Digits only", value: w.value },
|
|
799
812
|
{ label: "Mask complete", value: `${f.value}` },
|
|
800
813
|
{
|
|
801
814
|
label: "Parsed",
|
|
802
|
-
value: `${
|
|
815
|
+
value: `${n ? n.toDateString() : "-"} | ${s ? s.toDateString() : "-"}`
|
|
803
816
|
},
|
|
804
817
|
{
|
|
805
818
|
label: "Valid (managed)",
|
|
806
|
-
value: `${
|
|
819
|
+
value: `${F.value ?? "-"}`
|
|
807
820
|
},
|
|
808
821
|
{ label: "Span (days)", value: `${l.value ?? "-"}` },
|
|
809
822
|
{
|
|
810
823
|
label: "Reason",
|
|
811
|
-
value: `${
|
|
824
|
+
value: `${p.value ?? "-"}`
|
|
812
825
|
},
|
|
813
826
|
{
|
|
814
827
|
label: "Cursor in",
|
|
815
|
-
value: `${
|
|
816
|
-
const
|
|
817
|
-
return `${
|
|
828
|
+
value: `${c.value ?? "-"} (${(() => {
|
|
829
|
+
const E = c.value ?? 0, q = H(E);
|
|
830
|
+
return `${q.side}.${q.part}`;
|
|
818
831
|
})()})`
|
|
819
832
|
}
|
|
820
833
|
];
|
|
821
|
-
}),
|
|
834
|
+
}), Z = () => {
|
|
822
835
|
N(() => {
|
|
823
|
-
const
|
|
824
|
-
if (!
|
|
836
|
+
const n = document.getElementById(e.id);
|
|
837
|
+
if (!n) {
|
|
825
838
|
console.warn(`#${e.id} not found for styling.`);
|
|
826
839
|
return;
|
|
827
840
|
}
|
|
828
|
-
const s =
|
|
841
|
+
const s = n.closest("div");
|
|
829
842
|
s ? s.classList.add("fk-daterangepicker") : console.warn(`Parent div of #${e.id} not found for styling.`);
|
|
830
843
|
});
|
|
831
844
|
};
|
|
832
|
-
|
|
833
|
-
|
|
845
|
+
xe(() => {
|
|
846
|
+
Z();
|
|
834
847
|
});
|
|
835
|
-
const
|
|
848
|
+
const ge = () => {
|
|
836
849
|
N(() => {
|
|
837
850
|
try {
|
|
838
|
-
const
|
|
851
|
+
const n = Array.from(
|
|
839
852
|
document.querySelectorAll(".k-animation-container")
|
|
840
853
|
);
|
|
841
|
-
if (!
|
|
842
|
-
const
|
|
854
|
+
if (!n.length) return;
|
|
855
|
+
const E = [...n].reverse().find((le) => le.querySelector(".k-calendar"))?.querySelector(
|
|
843
856
|
".k-calendar"
|
|
844
857
|
);
|
|
845
|
-
if (!
|
|
846
|
-
const
|
|
858
|
+
if (!E) return;
|
|
859
|
+
const q = E.querySelectorAll(
|
|
847
860
|
".k-calendar-table"
|
|
848
861
|
);
|
|
849
|
-
let
|
|
850
|
-
|
|
851
|
-
|
|
862
|
+
let ne = !1;
|
|
863
|
+
q.forEach((le) => {
|
|
864
|
+
le.tabIndex === 0 && (ne ? le.tabIndex = -1 : ne = !0);
|
|
852
865
|
});
|
|
853
|
-
} catch (
|
|
854
|
-
console.warn(
|
|
866
|
+
} catch (n) {
|
|
867
|
+
console.warn(n);
|
|
855
868
|
}
|
|
856
869
|
});
|
|
857
870
|
};
|
|
858
|
-
return e.isOpen &&
|
|
871
|
+
return e.isOpen && ve(
|
|
859
872
|
e.isOpen,
|
|
860
|
-
(
|
|
861
|
-
|
|
873
|
+
(n) => {
|
|
874
|
+
n && setTimeout(() => ge(), 0);
|
|
862
875
|
},
|
|
863
876
|
{ immediate: !1 }
|
|
864
877
|
), {
|
|
865
|
-
raw:
|
|
866
|
-
cursorPos:
|
|
867
|
-
debugEnabled:
|
|
868
|
-
debugLines:
|
|
869
|
-
digitsOnly:
|
|
870
|
-
valid:
|
|
871
|
-
validComputed:
|
|
872
|
-
reason:
|
|
873
|
-
validationMessage:
|
|
874
|
-
spanDays:
|
|
875
|
-
month1:
|
|
876
|
-
day1:
|
|
877
|
-
year1:
|
|
878
|
-
month2:
|
|
879
|
-
day2:
|
|
880
|
-
year2:
|
|
881
|
-
handleChange:
|
|
882
|
-
handleKeyDown:
|
|
883
|
-
handleWheel:
|
|
884
|
-
handleKeyUp:
|
|
885
|
-
handleClick:
|
|
878
|
+
raw: t,
|
|
879
|
+
cursorPos: c,
|
|
880
|
+
debugEnabled: P,
|
|
881
|
+
debugLines: X,
|
|
882
|
+
digitsOnly: w,
|
|
883
|
+
valid: F,
|
|
884
|
+
validComputed: K(i),
|
|
885
|
+
reason: K(p),
|
|
886
|
+
validationMessage: K(S),
|
|
887
|
+
spanDays: K(l),
|
|
888
|
+
month1: K(ae),
|
|
889
|
+
day1: K(j),
|
|
890
|
+
year1: K(Y),
|
|
891
|
+
month2: K(ie),
|
|
892
|
+
day2: K(z),
|
|
893
|
+
year2: K(O),
|
|
894
|
+
handleChange: d,
|
|
895
|
+
handleKeyDown: te,
|
|
896
|
+
handleWheel: r,
|
|
897
|
+
handleKeyUp: u,
|
|
898
|
+
handleClick: I,
|
|
899
|
+
handleBlur: M,
|
|
900
|
+
handleClear: U,
|
|
886
901
|
onCalendarChange: () => {
|
|
887
|
-
|
|
902
|
+
T.value = !0;
|
|
888
903
|
}
|
|
889
904
|
};
|
|
890
905
|
}
|
|
891
|
-
function
|
|
892
|
-
const
|
|
906
|
+
function je(e) {
|
|
907
|
+
const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(e.timeFormat ?? "hh:mm AM"), V = h(() => !!e.required), W = _(!1), k = ["ArrowUp", "ArrowDown"], b = ["ArrowLeft", "ArrowRight"], y = h(() => (t.value ?? "").replace(/\D/g, "")), w = {
|
|
893
908
|
H: /[0-9]/,
|
|
894
909
|
h: /[0-9]/,
|
|
895
910
|
M: /[0-9]/,
|
|
896
911
|
m: /[0-9]/,
|
|
897
912
|
A: /[AaPp]/,
|
|
898
913
|
a: /[Mm]/
|
|
899
|
-
}, L = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm",
|
|
900
|
-
const r =
|
|
914
|
+
}, L = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm", D = h(() => {
|
|
915
|
+
const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", u = parseInt(r);
|
|
901
916
|
return Math.min(Math.max(u, 0), 23);
|
|
902
|
-
}),
|
|
903
|
-
const r =
|
|
917
|
+
}), x = h(() => {
|
|
918
|
+
const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", u = parseInt(r);
|
|
904
919
|
return Math.min(Math.max(u, 0), 59);
|
|
905
|
-
}),
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
920
|
+
}), $ = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = h(() => {
|
|
921
|
+
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), u = $.value;
|
|
922
|
+
return r === 12 ? u === "AM" ? 0 : 12 : u === "PM" ? r + 12 : r;
|
|
923
|
+
}), f = h(() => g.value ? `${String(R.value).padStart(2, "0")}:${String(x.value).padStart(2, "0")}:00` : null), g = h(
|
|
924
|
+
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
925
|
+
), F = (r, u, v) => {
|
|
926
|
+
let M = r % 12;
|
|
927
|
+
return M === 0 && (M = 12), `${String(M).padStart(2, "0")}:${String(u).padStart(
|
|
910
928
|
2,
|
|
911
929
|
"0"
|
|
912
930
|
)} ${v}`;
|
|
913
|
-
},
|
|
931
|
+
}, o = (r) => {
|
|
914
932
|
const u = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
915
933
|
if (!u) return null;
|
|
916
|
-
const v = parseInt(u[1]),
|
|
917
|
-
if (v < 1 || v > 12 ||
|
|
918
|
-
let
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
return
|
|
922
|
-
},
|
|
934
|
+
const v = parseInt(u[1]), M = parseInt(u[2]), U = u[3].toUpperCase();
|
|
935
|
+
if (v < 1 || v > 12 || M < 0 || M > 59) return null;
|
|
936
|
+
let ae = v % 12;
|
|
937
|
+
U === "PM" && (ae += 12);
|
|
938
|
+
const j = /* @__PURE__ */ new Date();
|
|
939
|
+
return j.setSeconds(0, 0), j.setHours(ae), j.setMinutes(M), j;
|
|
940
|
+
}, m = (r) => {
|
|
923
941
|
if (y.value.length === 0) {
|
|
924
942
|
e.onChange({ value: null, event: r });
|
|
925
943
|
return;
|
|
926
944
|
}
|
|
927
|
-
if (!
|
|
945
|
+
if (!g.value) {
|
|
928
946
|
e.onChange({ value: null, event: r });
|
|
929
947
|
return;
|
|
930
948
|
}
|
|
931
|
-
const u =
|
|
932
|
-
u &&
|
|
933
|
-
},
|
|
934
|
-
const u = e.min ?? void 0, v = e.max ?? void 0,
|
|
949
|
+
const u = o(t.value);
|
|
950
|
+
u && i(u) ? e.onChange({ value: u, event: r }) : e.onChange({ value: null, event: r });
|
|
951
|
+
}, l = (r) => r.getHours() * 60 + r.getMinutes(), i = (r) => {
|
|
952
|
+
const u = e.min ?? void 0, v = e.max ?? void 0, M = l(r);
|
|
935
953
|
if (u) {
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
954
|
+
const U = l(u);
|
|
955
|
+
if (M < U) return !1;
|
|
938
956
|
}
|
|
939
957
|
if (v) {
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
958
|
+
const U = l(v);
|
|
959
|
+
if (M > U) return !1;
|
|
942
960
|
}
|
|
943
961
|
return !0;
|
|
944
|
-
},
|
|
945
|
-
|
|
962
|
+
}, p = (r) => {
|
|
963
|
+
t.value = r.value;
|
|
946
964
|
const u = r.event?.target;
|
|
947
|
-
|
|
965
|
+
c.value = u?.selectionStart ?? 0;
|
|
948
966
|
try {
|
|
949
|
-
const v =
|
|
950
|
-
if (L(v) === "ampm" && (
|
|
951
|
-
const
|
|
952
|
-
/[Aa]/.test(
|
|
967
|
+
const v = c.value ?? 0;
|
|
968
|
+
if (L(v) === "ampm" && (t.value ?? "").length >= 8) {
|
|
969
|
+
const M = t.value.charAt(6);
|
|
970
|
+
/[Aa]/.test(M) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, N(() => {
|
|
953
971
|
requestAnimationFrame(() => {
|
|
954
|
-
const
|
|
972
|
+
const U = document.getElementById(
|
|
955
973
|
e.id
|
|
956
974
|
);
|
|
957
|
-
|
|
975
|
+
U && (U.focus(), U.setSelectionRange(8, 8));
|
|
958
976
|
});
|
|
959
|
-
})) : /[Pp]/.test(
|
|
977
|
+
})) : /[Pp]/.test(M) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, N(() => {
|
|
960
978
|
requestAnimationFrame(() => {
|
|
961
|
-
const
|
|
979
|
+
const U = document.getElementById(
|
|
962
980
|
e.id
|
|
963
981
|
);
|
|
964
|
-
|
|
982
|
+
U && (U.focus(), U.setSelectionRange(8, 8));
|
|
965
983
|
});
|
|
966
984
|
}));
|
|
967
985
|
}
|
|
968
986
|
} catch {
|
|
969
987
|
}
|
|
970
|
-
|
|
971
|
-
},
|
|
972
|
-
|
|
973
|
-
},
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
if (!
|
|
978
|
-
if ((
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
const
|
|
982
|
-
|
|
988
|
+
m(r);
|
|
989
|
+
}, A = (r) => {
|
|
990
|
+
c.value = r.target.selectionStart ?? 0;
|
|
991
|
+
}, S = (r, u, v) => {
|
|
992
|
+
const M = u?.selectionStart ?? c.value ?? 0;
|
|
993
|
+
c.value = M;
|
|
994
|
+
const U = L(M), ae = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
995
|
+
if (!ae) {
|
|
996
|
+
if ((t.value ?? "").length === 0 || y.value.length === 0) {
|
|
997
|
+
const O = /* @__PURE__ */ new Date(), X = O.getHours(), Z = X >= 12 ? "PM" : "AM";
|
|
998
|
+
t.value = F(X, O.getMinutes(), Z);
|
|
999
|
+
const ge = o(t.value);
|
|
1000
|
+
ge && i(ge) ? e.onChange({ value: ge, event: v }) : e.onChange({ value: null, event: v }), N(() => {
|
|
983
1001
|
requestAnimationFrame(() => {
|
|
984
|
-
const
|
|
1002
|
+
const n = document.getElementById(
|
|
985
1003
|
e.id
|
|
986
|
-
),
|
|
987
|
-
|
|
1004
|
+
), s = c.value ?? 0;
|
|
1005
|
+
n && (n.focus(), n.setSelectionRange(s, s));
|
|
988
1006
|
});
|
|
989
1007
|
});
|
|
990
1008
|
}
|
|
991
1009
|
return;
|
|
992
1010
|
}
|
|
993
|
-
let
|
|
994
|
-
if (
|
|
995
|
-
r === "ArrowUp" ?
|
|
996
|
-
else if (
|
|
997
|
-
const
|
|
998
|
-
if (
|
|
999
|
-
r === "ArrowUp" ?
|
|
1011
|
+
let j = parseInt(ae[1]), Y = parseInt(ae[2]), ie = ae[3].toUpperCase();
|
|
1012
|
+
if (U === "hh")
|
|
1013
|
+
r === "ArrowUp" ? j = j < 12 ? j + 1 : 1 : j = j > 1 ? j - 1 : 12;
|
|
1014
|
+
else if (U === "mm") {
|
|
1015
|
+
const O = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
|
|
1016
|
+
if (O === 1)
|
|
1017
|
+
r === "ArrowUp" ? Y = Y < 59 ? Y + 1 : 0 : Y = Y > 0 ? Y - 1 : 59;
|
|
1000
1018
|
else if (r === "ArrowUp") {
|
|
1001
|
-
const
|
|
1002
|
-
let
|
|
1003
|
-
|
|
1019
|
+
const X = Y % O;
|
|
1020
|
+
let Z = X === 0 ? Y + O : Y + (O - X);
|
|
1021
|
+
Z >= 60 && (Z = 0), Y = Z;
|
|
1004
1022
|
} else {
|
|
1005
|
-
const
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1023
|
+
const X = Y % O;
|
|
1024
|
+
let Z = X === 0 ? Y - O : Y - X;
|
|
1025
|
+
Z < 0 && (Z = 60 - O), Y = Z;
|
|
1008
1026
|
}
|
|
1009
|
-
} else
|
|
1010
|
-
|
|
1027
|
+
} else U === "ampm" && (ie = ie === "AM" ? "PM" : "AM");
|
|
1028
|
+
t.value = `${String(j).padStart(2, "0")}:${String(Y).padStart(
|
|
1011
1029
|
2,
|
|
1012
1030
|
"0"
|
|
1013
|
-
)} ${
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1031
|
+
)} ${ie}`;
|
|
1032
|
+
const z = o(t.value);
|
|
1033
|
+
z && i(z) ? e.onChange({ value: z, event: v }) : e.onChange({ value: null, event: v }), N(() => {
|
|
1016
1034
|
requestAnimationFrame(() => {
|
|
1017
|
-
const
|
|
1035
|
+
const O = document.getElementById(
|
|
1018
1036
|
e.id
|
|
1019
|
-
),
|
|
1020
|
-
|
|
1037
|
+
), X = c.value ?? 0;
|
|
1038
|
+
O && (O.focus(), O.setSelectionRange(X, X));
|
|
1021
1039
|
});
|
|
1022
1040
|
});
|
|
1023
|
-
},
|
|
1041
|
+
}, C = (r) => {
|
|
1024
1042
|
if (r.code === "Space" || r.key === " ") {
|
|
1025
1043
|
e.onShowPicker(r);
|
|
1026
1044
|
return;
|
|
1027
1045
|
}
|
|
1028
|
-
if (
|
|
1046
|
+
if (k.includes(r.key)) {
|
|
1029
1047
|
r.preventDefault();
|
|
1030
1048
|
const u = r.target;
|
|
1031
|
-
|
|
1049
|
+
S(r.key, u, r);
|
|
1032
1050
|
}
|
|
1033
|
-
},
|
|
1051
|
+
}, G = (r) => {
|
|
1034
1052
|
r.preventDefault();
|
|
1035
1053
|
const u = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1036
|
-
|
|
1037
|
-
},
|
|
1054
|
+
S(u, r.target, r);
|
|
1055
|
+
}, oe = (r) => {
|
|
1038
1056
|
const u = r.target;
|
|
1039
|
-
if (
|
|
1040
|
-
|
|
1057
|
+
if (b.includes(r.key)) {
|
|
1058
|
+
c.value = u?.selectionStart ?? 0;
|
|
1041
1059
|
return;
|
|
1042
1060
|
}
|
|
1043
|
-
|
|
1044
|
-
},
|
|
1045
|
-
|
|
1061
|
+
k.includes(r.key) && (r.preventDefault(), c.value = u?.selectionStart ?? 0);
|
|
1062
|
+
}, Q = (r) => {
|
|
1063
|
+
W.value = !0, V.value && e.externalValue && e.externalValue.value === void 0 && y.value.length === 0 && (e.externalValue.value = "");
|
|
1046
1064
|
const u = r.target;
|
|
1047
|
-
u && (
|
|
1065
|
+
u && (c.value = u.selectionStart ?? 0);
|
|
1048
1066
|
};
|
|
1049
|
-
e.externalValue &&
|
|
1067
|
+
e.externalValue && ve(
|
|
1050
1068
|
e.externalValue,
|
|
1051
1069
|
(r) => {
|
|
1052
1070
|
if (r) {
|
|
1053
1071
|
const u = new Date(r);
|
|
1054
1072
|
if (u.toString() !== "Invalid Date") {
|
|
1055
|
-
const v = u.getHours(),
|
|
1056
|
-
|
|
1073
|
+
const v = u.getHours(), M = v >= 12 ? "PM" : "AM";
|
|
1074
|
+
t.value = F(v, u.getMinutes(), M);
|
|
1057
1075
|
return;
|
|
1058
1076
|
}
|
|
1059
1077
|
}
|
|
1060
1078
|
},
|
|
1061
1079
|
{ immediate: !0 }
|
|
1062
1080
|
);
|
|
1063
|
-
const
|
|
1064
|
-
["Time",
|
|
1065
|
-
["Hour (12h)",
|
|
1066
|
-
["
|
|
1067
|
-
["
|
|
1081
|
+
const H = h(() => [
|
|
1082
|
+
["Time", t.value || "--:-- --"],
|
|
1083
|
+
["Hour (12h)", D.value],
|
|
1084
|
+
["Hour (24h)", R.value],
|
|
1085
|
+
["Minute", x.value],
|
|
1086
|
+
["Period", $.value],
|
|
1087
|
+
["Time (24h)", f.value ?? "--:--:--"],
|
|
1068
1088
|
["Digits only", y.value],
|
|
1089
|
+
[
|
|
1090
|
+
"Parsed Date",
|
|
1091
|
+
J.value?.toLocaleDateString("en-US", {
|
|
1092
|
+
hour: "2-digit",
|
|
1093
|
+
minute: "2-digit"
|
|
1094
|
+
}) ?? null
|
|
1095
|
+
],
|
|
1069
1096
|
[
|
|
1070
1097
|
"min",
|
|
1071
1098
|
e.min?.toLocaleTimeString("en-US", {
|
|
@@ -1080,49 +1107,49 @@ function He(e) {
|
|
|
1080
1107
|
minute: "2-digit"
|
|
1081
1108
|
}) ?? null
|
|
1082
1109
|
],
|
|
1083
|
-
["valid",
|
|
1084
|
-
["reason",
|
|
1085
|
-
["validationMessage",
|
|
1086
|
-
]),
|
|
1087
|
-
() =>
|
|
1088
|
-
),
|
|
1089
|
-
if (!
|
|
1090
|
-
if (!
|
|
1091
|
-
const u =
|
|
1092
|
-
return u ?
|
|
1110
|
+
["valid", a.value],
|
|
1111
|
+
["reason", d.value],
|
|
1112
|
+
["validationMessage", I.value]
|
|
1113
|
+
]), J = h(
|
|
1114
|
+
() => o(t.value) ?? null
|
|
1115
|
+
), a = h(() => {
|
|
1116
|
+
if (!V.value) {
|
|
1117
|
+
if (!g.value) return !0;
|
|
1118
|
+
const u = J.value;
|
|
1119
|
+
return u ? i(u) : !1;
|
|
1093
1120
|
}
|
|
1094
|
-
if (!
|
|
1095
|
-
const r =
|
|
1096
|
-
return !
|
|
1097
|
-
}),
|
|
1098
|
-
if (!
|
|
1099
|
-
if (!
|
|
1100
|
-
const u =
|
|
1101
|
-
return u ?
|
|
1121
|
+
if (!W.value) return !0;
|
|
1122
|
+
const r = J.value;
|
|
1123
|
+
return !g.value || !r ? !1 : i(r);
|
|
1124
|
+
}), d = h(() => {
|
|
1125
|
+
if (!V.value) {
|
|
1126
|
+
if (!g.value) return;
|
|
1127
|
+
const u = J.value;
|
|
1128
|
+
return u ? i(u) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1102
1129
|
}
|
|
1103
|
-
if (!
|
|
1104
|
-
if (y.value.length === 0 || !
|
|
1130
|
+
if (!W.value) return;
|
|
1131
|
+
if (y.value.length === 0 || !g.value)
|
|
1105
1132
|
return "incomplete";
|
|
1106
|
-
const r =
|
|
1107
|
-
return r ?
|
|
1108
|
-
}),
|
|
1109
|
-
const r =
|
|
1133
|
+
const r = J.value;
|
|
1134
|
+
return r ? i(r) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1135
|
+
}), I = h(() => {
|
|
1136
|
+
const r = d.value;
|
|
1110
1137
|
if (!r || r === "valid") return "";
|
|
1111
1138
|
if (r === "incomplete")
|
|
1112
1139
|
return "Required";
|
|
1113
1140
|
if (r === "invalid-time")
|
|
1114
|
-
return `Must be in ${
|
|
1141
|
+
return `Must be in ${T.value} format.`;
|
|
1115
1142
|
const u = {
|
|
1116
1143
|
hour: "2-digit",
|
|
1117
1144
|
minute: "2-digit"
|
|
1118
|
-
}, v = e.min ? e.min.toLocaleTimeString("en-US", u) : null,
|
|
1145
|
+
}, v = e.min ? e.min.toLocaleTimeString("en-US", u) : null, M = e.max ? e.max.toLocaleTimeString("en-US", u) : null;
|
|
1119
1146
|
if (r === "out-of-bounds") {
|
|
1120
|
-
if (v &&
|
|
1147
|
+
if (v && M) return `Must be between ${v} and ${M}.`;
|
|
1121
1148
|
if (v) return `Must be ${v} or later.`;
|
|
1122
|
-
if (
|
|
1149
|
+
if (M) return `Must be ${M} or earlier.`;
|
|
1123
1150
|
}
|
|
1124
1151
|
return "";
|
|
1125
|
-
}),
|
|
1152
|
+
}), te = () => {
|
|
1126
1153
|
N(() => {
|
|
1127
1154
|
const r = document.getElementById(e.id);
|
|
1128
1155
|
if (!r) {
|
|
@@ -1130,243 +1157,253 @@ function He(e) {
|
|
|
1130
1157
|
return;
|
|
1131
1158
|
}
|
|
1132
1159
|
const u = r.closest(".k-timepicker");
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1160
|
+
if (!u)
|
|
1161
|
+
console.warn(
|
|
1162
|
+
`.k-timepicker parent of #${e.id} not found for styling.`
|
|
1163
|
+
);
|
|
1164
|
+
else {
|
|
1165
|
+
const v = u.parentElement;
|
|
1166
|
+
v ? v.classList.add("fk-timepicker") : console.warn(
|
|
1167
|
+
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1136
1170
|
});
|
|
1137
1171
|
};
|
|
1138
|
-
return
|
|
1139
|
-
|
|
1172
|
+
return xe(() => {
|
|
1173
|
+
te();
|
|
1140
1174
|
}), {
|
|
1141
|
-
raw:
|
|
1142
|
-
rules:
|
|
1143
|
-
debugEnabled:
|
|
1144
|
-
debugLines:
|
|
1145
|
-
placeholder:
|
|
1146
|
-
isValid:
|
|
1147
|
-
reason:
|
|
1148
|
-
validationMessage:
|
|
1149
|
-
isComplete:
|
|
1150
|
-
inRangeTime:
|
|
1151
|
-
cursorPos:
|
|
1152
|
-
hour:
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1175
|
+
raw: t,
|
|
1176
|
+
rules: w,
|
|
1177
|
+
debugEnabled: P,
|
|
1178
|
+
debugLines: H,
|
|
1179
|
+
placeholder: T,
|
|
1180
|
+
isValid: a,
|
|
1181
|
+
reason: K(d),
|
|
1182
|
+
validationMessage: I,
|
|
1183
|
+
isComplete: g,
|
|
1184
|
+
inRangeTime: i,
|
|
1185
|
+
cursorPos: c,
|
|
1186
|
+
hour: K(D),
|
|
1187
|
+
hour24: K(R),
|
|
1188
|
+
minute: K(x),
|
|
1189
|
+
period: K($),
|
|
1190
|
+
time24: K(f),
|
|
1191
|
+
parsedRawTime: K(J),
|
|
1192
|
+
handleChange: p,
|
|
1193
|
+
handleKeyDown: C,
|
|
1194
|
+
handleKeyUp: oe,
|
|
1195
|
+
handleClick: A,
|
|
1196
|
+
handleWheel: G,
|
|
1197
|
+
handleBlur: Q
|
|
1161
1198
|
};
|
|
1162
1199
|
}
|
|
1163
|
-
function
|
|
1164
|
-
return
|
|
1200
|
+
function Fe(e) {
|
|
1201
|
+
return Le() ? (Pe(e), !0) : !1;
|
|
1165
1202
|
}
|
|
1166
|
-
const
|
|
1203
|
+
const $e = typeof window < "u" && typeof document < "u";
|
|
1167
1204
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
1168
|
-
const
|
|
1169
|
-
},
|
|
1170
|
-
function
|
|
1171
|
-
var e,
|
|
1172
|
-
return
|
|
1205
|
+
const Ue = Object.prototype.toString, Oe = (e) => Ue.call(e) === "[object Object]", pe = () => {
|
|
1206
|
+
}, Be = /* @__PURE__ */ Ke();
|
|
1207
|
+
function Ke() {
|
|
1208
|
+
var e, t;
|
|
1209
|
+
return $e && ((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));
|
|
1173
1210
|
}
|
|
1174
|
-
function
|
|
1211
|
+
function Ae(e) {
|
|
1175
1212
|
return Array.isArray(e) ? e : [e];
|
|
1176
1213
|
}
|
|
1177
|
-
function
|
|
1178
|
-
return
|
|
1214
|
+
function Ve(e, t, c) {
|
|
1215
|
+
return ve(
|
|
1179
1216
|
e,
|
|
1180
|
-
|
|
1217
|
+
t,
|
|
1181
1218
|
{
|
|
1182
|
-
...
|
|
1219
|
+
...c,
|
|
1183
1220
|
immediate: !0
|
|
1184
1221
|
}
|
|
1185
1222
|
);
|
|
1186
1223
|
}
|
|
1187
|
-
const
|
|
1188
|
-
function
|
|
1189
|
-
var
|
|
1190
|
-
const
|
|
1191
|
-
return (
|
|
1224
|
+
const Ce = $e ? window : void 0;
|
|
1225
|
+
function Se(e) {
|
|
1226
|
+
var t;
|
|
1227
|
+
const c = ce(e);
|
|
1228
|
+
return (t = c?.$el) != null ? t : c;
|
|
1192
1229
|
}
|
|
1193
|
-
function
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1196
|
-
},
|
|
1197
|
-
const
|
|
1198
|
-
return
|
|
1199
|
-
}),
|
|
1230
|
+
function Ee(...e) {
|
|
1231
|
+
const t = [], c = () => {
|
|
1232
|
+
t.forEach((k) => k()), t.length = 0;
|
|
1233
|
+
}, P = (k, b, y, w) => (k.addEventListener(b, y, w), () => k.removeEventListener(b, y, w)), T = h(() => {
|
|
1234
|
+
const k = Ae(ce(e[0])).filter((b) => b != null);
|
|
1235
|
+
return k.every((b) => typeof b != "string") ? k : void 0;
|
|
1236
|
+
}), V = Ve(
|
|
1200
1237
|
() => {
|
|
1201
|
-
var
|
|
1238
|
+
var k, b;
|
|
1202
1239
|
return [
|
|
1203
|
-
(
|
|
1204
|
-
|
|
1205
|
-
|
|
1240
|
+
(b = (k = T.value) == null ? void 0 : k.map((y) => Se(y))) != null ? b : [Ce].filter((y) => y != null),
|
|
1241
|
+
Ae(ce(T.value ? e[1] : e[0])),
|
|
1242
|
+
Ae(Te(T.value ? e[2] : e[1])),
|
|
1206
1243
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
1207
|
-
|
|
1244
|
+
ce(T.value ? e[3] : e[2])
|
|
1208
1245
|
];
|
|
1209
1246
|
},
|
|
1210
|
-
([
|
|
1211
|
-
if (
|
|
1247
|
+
([k, b, y, w]) => {
|
|
1248
|
+
if (c(), !k?.length || !b?.length || !y?.length)
|
|
1212
1249
|
return;
|
|
1213
|
-
const L =
|
|
1214
|
-
|
|
1215
|
-
...
|
|
1216
|
-
(
|
|
1217
|
-
(
|
|
1250
|
+
const L = Oe(w) ? { ...w } : w;
|
|
1251
|
+
t.push(
|
|
1252
|
+
...k.flatMap(
|
|
1253
|
+
(D) => b.flatMap(
|
|
1254
|
+
(x) => y.map(($) => P(D, x, $, L))
|
|
1218
1255
|
)
|
|
1219
1256
|
)
|
|
1220
1257
|
);
|
|
1221
1258
|
},
|
|
1222
1259
|
{ flush: "post" }
|
|
1223
|
-
),
|
|
1224
|
-
|
|
1260
|
+
), W = () => {
|
|
1261
|
+
V(), c();
|
|
1225
1262
|
};
|
|
1226
|
-
return
|
|
1263
|
+
return Fe(c), W;
|
|
1227
1264
|
}
|
|
1228
|
-
let
|
|
1229
|
-
function
|
|
1230
|
-
const { window:
|
|
1231
|
-
if (!
|
|
1232
|
-
return
|
|
1233
|
-
if (
|
|
1234
|
-
|
|
1265
|
+
let Me = !1;
|
|
1266
|
+
function Ye(e, t, c = {}) {
|
|
1267
|
+
const { window: P = Ce, ignore: T = [], capture: V = !0, detectIframe: W = !1, controls: k = !1 } = c;
|
|
1268
|
+
if (!P)
|
|
1269
|
+
return k ? { stop: pe, cancel: pe, trigger: pe } : pe;
|
|
1270
|
+
if (Be && !Me) {
|
|
1271
|
+
Me = !0;
|
|
1235
1272
|
const f = { passive: !0 };
|
|
1236
|
-
Array.from(
|
|
1273
|
+
Array.from(P.document.body.children).forEach((g) => g.addEventListener("click", pe, f)), P.document.documentElement.addEventListener("click", pe, f);
|
|
1237
1274
|
}
|
|
1238
|
-
let
|
|
1239
|
-
const y = (f) =>
|
|
1240
|
-
if (typeof
|
|
1241
|
-
return Array.from(
|
|
1275
|
+
let b = !0;
|
|
1276
|
+
const y = (f) => ce(T).some((g) => {
|
|
1277
|
+
if (typeof g == "string")
|
|
1278
|
+
return Array.from(P.document.querySelectorAll(g)).some((F) => F === f.target || f.composedPath().includes(F));
|
|
1242
1279
|
{
|
|
1243
|
-
const
|
|
1244
|
-
return
|
|
1280
|
+
const F = Se(g);
|
|
1281
|
+
return F && (f.target === F || f.composedPath().includes(F));
|
|
1245
1282
|
}
|
|
1246
1283
|
});
|
|
1247
|
-
function
|
|
1248
|
-
const
|
|
1249
|
-
return
|
|
1284
|
+
function w(f) {
|
|
1285
|
+
const g = ce(f);
|
|
1286
|
+
return g && g.$.subTree.shapeFlag === 16;
|
|
1250
1287
|
}
|
|
1251
|
-
function L(f,
|
|
1252
|
-
const
|
|
1253
|
-
return o == null || !Array.isArray(o) ? !1 : o.some((
|
|
1288
|
+
function L(f, g) {
|
|
1289
|
+
const F = ce(f), o = F.$.subTree && F.$.subTree.children;
|
|
1290
|
+
return o == null || !Array.isArray(o) ? !1 : o.some((m) => m.el === g.target || g.composedPath().includes(m.el));
|
|
1254
1291
|
}
|
|
1255
|
-
const
|
|
1256
|
-
const
|
|
1257
|
-
if (f.target != null && !(!(
|
|
1258
|
-
if ("detail" in f && f.detail === 0 && (
|
|
1259
|
-
|
|
1292
|
+
const D = (f) => {
|
|
1293
|
+
const g = Se(e);
|
|
1294
|
+
if (f.target != null && !(!(g instanceof Element) && w(e) && L(e, f)) && !(!g || g === f.target || f.composedPath().includes(g))) {
|
|
1295
|
+
if ("detail" in f && f.detail === 0 && (b = !y(f)), !b) {
|
|
1296
|
+
b = !0;
|
|
1260
1297
|
return;
|
|
1261
1298
|
}
|
|
1262
|
-
|
|
1299
|
+
t(f);
|
|
1263
1300
|
}
|
|
1264
1301
|
};
|
|
1265
|
-
let
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
}, 0),
|
|
1271
|
-
}, { passive: !0, capture:
|
|
1272
|
-
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1302
|
+
let x = !1;
|
|
1303
|
+
const $ = [
|
|
1304
|
+
Ee(P, "click", (f) => {
|
|
1305
|
+
x || (x = !0, setTimeout(() => {
|
|
1306
|
+
x = !1;
|
|
1307
|
+
}, 0), D(f));
|
|
1308
|
+
}, { passive: !0, capture: V }),
|
|
1309
|
+
Ee(P, "pointerdown", (f) => {
|
|
1310
|
+
const g = Se(e);
|
|
1311
|
+
b = !y(f) && !!(g && !f.composedPath().includes(g));
|
|
1275
1312
|
}, { passive: !0 }),
|
|
1276
|
-
|
|
1313
|
+
W && Ee(P, "blur", (f) => {
|
|
1277
1314
|
setTimeout(() => {
|
|
1278
|
-
var
|
|
1279
|
-
const
|
|
1280
|
-
((
|
|
1315
|
+
var g;
|
|
1316
|
+
const F = Se(e);
|
|
1317
|
+
((g = P.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !F?.contains(P.document.activeElement) && t(f);
|
|
1281
1318
|
}, 0);
|
|
1282
1319
|
}, { passive: !0 })
|
|
1283
|
-
].filter(Boolean),
|
|
1284
|
-
return
|
|
1285
|
-
stop:
|
|
1320
|
+
].filter(Boolean), R = () => $.forEach((f) => f());
|
|
1321
|
+
return k ? {
|
|
1322
|
+
stop: R,
|
|
1286
1323
|
cancel: () => {
|
|
1287
|
-
|
|
1324
|
+
b = !1;
|
|
1288
1325
|
},
|
|
1289
1326
|
trigger: (f) => {
|
|
1290
|
-
|
|
1327
|
+
b = !0, D(f), b = !1;
|
|
1291
1328
|
}
|
|
1292
|
-
} :
|
|
1329
|
+
} : R;
|
|
1293
1330
|
}
|
|
1294
|
-
function
|
|
1295
|
-
const
|
|
1331
|
+
function ze(e) {
|
|
1332
|
+
const t = Re(null), c = [
|
|
1296
1333
|
".k-animation-container .k-popup",
|
|
1297
1334
|
".k-popup",
|
|
1298
1335
|
".k-timepicker-popup",
|
|
1299
1336
|
".k-menu-popup"
|
|
1300
|
-
],
|
|
1337
|
+
], P = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? c].flat(), T = (w) => w ? typeof e.initialFocus == "string" ? w.querySelector(e.initialFocus) ?? w : typeof e.initialFocus == "function" ? e.initialFocus(w) ?? w : w.querySelector(
|
|
1301
1338
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1302
|
-
) ??
|
|
1339
|
+
) ?? w : null, { activate: V, deactivate: W } = qe(t, {
|
|
1303
1340
|
escapeDeactivates: !1,
|
|
1304
1341
|
clickOutsideDeactivates: !1,
|
|
1305
|
-
fallbackFocus: () =>
|
|
1306
|
-
initialFocus: () =>
|
|
1342
|
+
fallbackFocus: () => t.value,
|
|
1343
|
+
initialFocus: () => T(t.value),
|
|
1307
1344
|
...e.focusTrapOptions ?? {}
|
|
1308
1345
|
});
|
|
1309
|
-
let
|
|
1346
|
+
let k = null, b = _(null);
|
|
1310
1347
|
const y = () => {
|
|
1311
1348
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1312
|
-
const
|
|
1313
|
-
const
|
|
1314
|
-
if (
|
|
1315
|
-
const
|
|
1349
|
+
const w = (D, x) => {
|
|
1350
|
+
const $ = Array.from(D.querySelectorAll(x));
|
|
1351
|
+
if (!$.length) return null;
|
|
1352
|
+
const R = $.filter(
|
|
1316
1353
|
(f) => f.offsetParent !== null || f.getClientRects().length > 0
|
|
1317
1354
|
);
|
|
1318
|
-
return
|
|
1355
|
+
return R[R.length - 1] ?? $[$.length - 1] ?? null;
|
|
1319
1356
|
}, L = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
1320
|
-
for (const
|
|
1321
|
-
const
|
|
1322
|
-
if (
|
|
1357
|
+
for (const D of P) {
|
|
1358
|
+
const x = w(L, D);
|
|
1359
|
+
if (x) return x;
|
|
1323
1360
|
}
|
|
1324
|
-
for (const
|
|
1325
|
-
const
|
|
1326
|
-
if (
|
|
1361
|
+
for (const D of P) {
|
|
1362
|
+
const x = w(document, D);
|
|
1363
|
+
if (x) return x;
|
|
1327
1364
|
}
|
|
1328
1365
|
return null;
|
|
1329
1366
|
};
|
|
1330
|
-
return
|
|
1331
|
-
|
|
1332
|
-
}),
|
|
1367
|
+
return Ye(t, (w) => {
|
|
1368
|
+
b.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", w);
|
|
1369
|
+
}), ve(
|
|
1333
1370
|
() => e.isOpen.value,
|
|
1334
|
-
(
|
|
1335
|
-
|
|
1371
|
+
(w) => {
|
|
1372
|
+
w ? (b.value = null, N(() => {
|
|
1336
1373
|
const L = y();
|
|
1337
|
-
L && (
|
|
1338
|
-
|
|
1339
|
-
}, document.addEventListener("keydown",
|
|
1340
|
-
})) : (
|
|
1374
|
+
L && (t.value = L, setTimeout(() => V(), 0), k || (k = (D) => {
|
|
1375
|
+
D.key === "Escape" && (b.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", D));
|
|
1376
|
+
}, document.addEventListener("keydown", k, !0)));
|
|
1377
|
+
})) : (W(), k && (document.removeEventListener("keydown", k, !0), k = null), t.value = null, b.value === "outside" && N(() => {
|
|
1341
1378
|
const L = () => {
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1379
|
+
const D = e.triggerEl?.value, x = D?.querySelector("input"), $ = document.activeElement;
|
|
1380
|
+
$ && ($ === x || D && D.contains($)) && (x ?? D)?.blur?.();
|
|
1344
1381
|
};
|
|
1345
1382
|
requestAnimationFrame(() => setTimeout(L, 0));
|
|
1346
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
1383
|
+
}), e.returnFocusToTrigger !== !1 && b.value === "escape" && e.triggerEl?.value && (console.log(
|
|
1347
1384
|
"Returning focus to trigger element:",
|
|
1348
1385
|
e.triggerEl.value
|
|
1349
1386
|
), N(() => {
|
|
1350
1387
|
const L = () => {
|
|
1351
|
-
const
|
|
1352
|
-
if (!
|
|
1353
|
-
(
|
|
1388
|
+
const D = e.triggerEl?.value;
|
|
1389
|
+
if (!D) return;
|
|
1390
|
+
(D.querySelector("input") ?? D)?.focus?.();
|
|
1354
1391
|
};
|
|
1355
1392
|
requestAnimationFrame(() => setTimeout(L, 0));
|
|
1356
1393
|
})));
|
|
1357
1394
|
}
|
|
1358
1395
|
), {
|
|
1359
|
-
popupRef:
|
|
1360
|
-
activate:
|
|
1361
|
-
deactivate:
|
|
1362
|
-
lastCloseReason:
|
|
1363
|
-
setPopupEl: (
|
|
1396
|
+
popupRef: t,
|
|
1397
|
+
activate: V,
|
|
1398
|
+
deactivate: W,
|
|
1399
|
+
lastCloseReason: K(b),
|
|
1400
|
+
setPopupEl: (w) => t.value = w
|
|
1364
1401
|
};
|
|
1365
1402
|
}
|
|
1366
1403
|
export {
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1404
|
+
We as useGridA11y,
|
|
1405
|
+
_e as useMaskedDateInput,
|
|
1406
|
+
Ge as useMaskedDateRangeInput,
|
|
1407
|
+
je as useMaskedTimeInput,
|
|
1408
|
+
ze as usePopupTrap
|
|
1372
1409
|
};
|