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