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