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