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