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