@featherk/composables 0.6.5 → 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.
- package/dist/date/useMaskedDateInput.d.ts +1 -0
- package/dist/featherk-composables.es.js +809 -755
- package/dist/featherk-composables.umd.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/range/useMaskedDateRangeInput.d.ts +1 -0
- package/dist/time/useMaskedTimeInput.d.ts +1 -0
- package/dist/useGridA11y.d.ts +3 -1
- package/dist/useGridFilter.d.ts +7 -0
- package/docs/date/useMaskedDateInput.md +49 -37
- package/docs/grid/useGridA11y.md +12 -1
- package/docs/range/useMaskedDateRangeInput.md +13 -1
- package/docs/time/useMaskedTimeInput.md +41 -27
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
-
},
|
|
382
|
-
const d = e.min ?? void 0,
|
|
383
|
-
return !(d && a < d ||
|
|
389
|
+
}, U = (a) => {
|
|
390
|
+
const d = e.min ?? void 0, M = e.max ?? void 0;
|
|
391
|
+
return !(d && a < d || M && a > M);
|
|
384
392
|
}, f = h(() => {
|
|
385
|
-
if ((t.value ?? "").length === 10 &&
|
|
386
|
-
const [a, d,
|
|
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 X = document.getElementById(
|
|
411
|
-
e.id
|
|
412
|
-
), Z = c.value ?? 0;
|
|
413
|
-
X && (X.focus(), X.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:
|
|
436
|
-
event:
|
|
437
|
-
}) : e.onChange({ value: null, event:
|
|
438
|
-
|
|
439
|
-
const z = document.getElementById(
|
|
440
|
-
e.id
|
|
441
|
-
), O = c.value ?? 0;
|
|
442
|
-
z && (z.focus(), z.setSelectionRange(O, O));
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
}, p = (a) => {
|
|
435
|
+
le.toString() !== "Invalid Date" && parseInt(ie) >= 1e3 ? e.onChange({
|
|
436
|
+
value: U(le) ? le : null,
|
|
437
|
+
event: M
|
|
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
|
|
478
|
-
t.value = `${
|
|
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,50 +522,50 @@ 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",
|
|
534
555
|
day: "2-digit"
|
|
535
|
-
}) : null,
|
|
556
|
+
}) : null, M = e.max ? e.max.toLocaleDateString("en-US", {
|
|
536
557
|
year: "numeric",
|
|
537
558
|
month: "2-digit",
|
|
538
559
|
day: "2-digit"
|
|
539
560
|
}) : null;
|
|
540
561
|
if (a === "out-of-bounds") {
|
|
541
|
-
if (d &&
|
|
562
|
+
if (d && M) return `Must be between ${d} and ${M}.`;
|
|
542
563
|
if (d) return `Must be on or after ${d}.`;
|
|
543
|
-
if (
|
|
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
|
);
|
|
@@ -553,80 +574,86 @@ function _e(e) {
|
|
|
553
574
|
return;
|
|
554
575
|
}
|
|
555
576
|
const d = a.closest(".k-datepicker");
|
|
556
|
-
if (d) {
|
|
557
|
-
const I = d.parentElement;
|
|
558
|
-
I ? I.classList.add("fk-datepicker") : console.warn(
|
|
559
|
-
`Parent of .k-datepicker not found for #${e.id} styling.`
|
|
560
|
-
);
|
|
561
|
-
} else {
|
|
577
|
+
if (!d) {
|
|
562
578
|
console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
|
|
563
579
|
return;
|
|
564
580
|
}
|
|
581
|
+
const M = d.parentElement;
|
|
582
|
+
if (M) {
|
|
583
|
+
if (M.classList.contains("fk-datepicker"))
|
|
584
|
+
return;
|
|
585
|
+
M.classList.add("fk-datepicker");
|
|
586
|
+
} else
|
|
587
|
+
console.warn(
|
|
588
|
+
`Parent of .k-datepicker not found for #${e.id} styling.`
|
|
589
|
+
);
|
|
565
590
|
});
|
|
566
591
|
};
|
|
567
592
|
return xe(() => {
|
|
568
|
-
|
|
593
|
+
ne();
|
|
569
594
|
}), {
|
|
570
595
|
raw: t,
|
|
571
|
-
cursorPos:
|
|
572
|
-
debugEnabled:
|
|
573
|
-
debugLines:
|
|
574
|
-
placeholder:
|
|
575
|
-
isValid:
|
|
576
|
-
reason:
|
|
577
|
-
validationMessage:
|
|
578
|
-
digitsOnly:
|
|
579
|
-
month:
|
|
580
|
-
day:
|
|
581
|
-
year:
|
|
582
|
-
datePart:
|
|
583
|
-
handleChange:
|
|
584
|
-
handleKeyDown:
|
|
585
|
-
handleWheel:
|
|
586
|
-
handleKeyUp:
|
|
587
|
-
handleClick:
|
|
588
|
-
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,
|
|
614
|
+
// Expose so consumers can re-run styling when needed
|
|
615
|
+
initStyling: ne
|
|
589
616
|
};
|
|
590
617
|
}
|
|
591
|
-
function
|
|
592
|
-
const t = _(""),
|
|
593
|
-
e.min = e.min ??
|
|
594
|
-
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) => {
|
|
595
622
|
if (!n) return null;
|
|
596
|
-
const
|
|
597
|
-
return
|
|
598
|
-
},
|
|
599
|
-
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)
|
|
600
627
|
return { start: null, end: null };
|
|
601
|
-
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";
|
|
602
629
|
return { start: we ? me : null, end: ke ? he : null };
|
|
603
|
-
},
|
|
604
|
-
const n =
|
|
605
|
-
return { start: n, end:
|
|
606
|
-
}),
|
|
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(() => {
|
|
607
634
|
if (!f.value) return;
|
|
608
|
-
const n =
|
|
609
|
-
if (!n || !
|
|
610
|
-
const
|
|
611
|
-
return Math.round(
|
|
612
|
-
}),
|
|
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(() => {
|
|
613
640
|
if (!f.value) return !1;
|
|
614
|
-
const { start: n, end:
|
|
615
|
-
if (!n || !
|
|
616
|
-
const
|
|
617
|
-
return !(!
|
|
618
|
-
}),
|
|
619
|
-
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;
|
|
620
647
|
if (!f.value) return "incomplete";
|
|
621
|
-
if (!n || !
|
|
622
|
-
if (!
|
|
623
|
-
const
|
|
624
|
-
return
|
|
625
|
-
}),
|
|
626
|
-
if (
|
|
627
|
-
const { min: n, max:
|
|
628
|
-
if (!
|
|
629
|
-
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) {
|
|
630
657
|
case "incomplete":
|
|
631
658
|
return "Required";
|
|
632
659
|
case "invalid-date":
|
|
@@ -634,90 +661,90 @@ function Ge(e) {
|
|
|
634
661
|
case "reversed-range":
|
|
635
662
|
return "End Date must be on or after Start Date.";
|
|
636
663
|
case "out-of-bounds":
|
|
637
|
-
return n &&
|
|
664
|
+
return n && c ? `Dates must be between ${J(n)} and ${J(c)}.` : "Dates must be within the allowed range.";
|
|
638
665
|
case "span-exceeds-limit":
|
|
639
666
|
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
640
667
|
case "valid":
|
|
641
668
|
default:
|
|
642
669
|
return "";
|
|
643
670
|
}
|
|
644
|
-
}),
|
|
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(
|
|
645
672
|
n.getFullYear(),
|
|
646
673
|
4
|
|
647
|
-
)}`,
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
const { start:
|
|
651
|
-
if (!
|
|
652
|
-
const
|
|
653
|
-
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(() => {
|
|
654
681
|
requestAnimationFrame(() => {
|
|
655
|
-
const
|
|
682
|
+
const Z = document.getElementById(
|
|
656
683
|
e.id
|
|
657
|
-
),
|
|
658
|
-
|
|
684
|
+
), te = u.value ?? 0;
|
|
685
|
+
Z && (Z.focus(), Z.setSelectionRange(te, te));
|
|
659
686
|
});
|
|
660
687
|
});
|
|
661
688
|
return;
|
|
662
689
|
}
|
|
663
|
-
const
|
|
664
|
-
let fe =
|
|
665
|
-
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) => {
|
|
666
693
|
if (ue === "mm") {
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
const
|
|
670
|
-
|
|
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);
|
|
671
698
|
} else if (ue === "dd") {
|
|
672
|
-
const
|
|
673
|
-
|
|
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);
|
|
674
701
|
} else if (ue === "yyyy") {
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
const
|
|
678
|
-
|
|
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);
|
|
679
706
|
}
|
|
680
707
|
};
|
|
681
708
|
de.side === "start" ? he(fe, de.part) : he(me, de.part);
|
|
682
|
-
const we =
|
|
709
|
+
const we = J(fe), ke = J(me);
|
|
683
710
|
t.value = `${we} - ${ke}`;
|
|
684
|
-
const se =
|
|
685
|
-
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(() => {
|
|
686
713
|
requestAnimationFrame(() => {
|
|
687
|
-
const
|
|
714
|
+
const Y = document.getElementById(
|
|
688
715
|
e.id
|
|
689
|
-
), ue =
|
|
690
|
-
|
|
716
|
+
), ue = u.value ?? 0;
|
|
717
|
+
Y && (Y.focus(), Y.setSelectionRange(ue, ue));
|
|
691
718
|
});
|
|
692
719
|
});
|
|
693
|
-
},
|
|
694
|
-
const { start:
|
|
695
|
-
if (!
|
|
720
|
+
}, ne = (n) => {
|
|
721
|
+
const { start: c, end: x } = y(t.value);
|
|
722
|
+
if (!c || !x) {
|
|
696
723
|
e.onChange({ value: null, event: n });
|
|
697
724
|
return;
|
|
698
725
|
}
|
|
699
|
-
const
|
|
700
|
-
if (!
|
|
726
|
+
const R = T(c), ee = T(x);
|
|
727
|
+
if (!R || !ee) {
|
|
701
728
|
e.onChange({ value: null, event: n });
|
|
702
729
|
return;
|
|
703
730
|
}
|
|
704
|
-
if (!R
|
|
731
|
+
if (!U(R, ee)) {
|
|
705
732
|
e.onChange({ value: null, event: n });
|
|
706
733
|
return;
|
|
707
734
|
}
|
|
708
|
-
e.onChange({ value: { start:
|
|
709
|
-
},
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
712
|
-
|
|
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);
|
|
713
740
|
return;
|
|
714
741
|
}
|
|
715
|
-
t.value =
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
},
|
|
719
|
-
|
|
720
|
-
},
|
|
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;
|
|
747
|
+
}, M = (n) => {
|
|
721
748
|
if (n.code === "Space" || n.key === " ") {
|
|
722
749
|
n.preventDefault(), e.onShowCalendar(n);
|
|
723
750
|
return;
|
|
@@ -726,63 +753,63 @@ function Ge(e) {
|
|
|
726
753
|
n.preventDefault(), e.onShowCalendar(n);
|
|
727
754
|
return;
|
|
728
755
|
}
|
|
729
|
-
if (
|
|
756
|
+
if (D.includes(n.key)) {
|
|
730
757
|
n.preventDefault();
|
|
731
|
-
const
|
|
732
|
-
|
|
758
|
+
const c = n.target;
|
|
759
|
+
F(n.key, c, n);
|
|
733
760
|
}
|
|
734
761
|
}, r = (n) => {
|
|
735
762
|
n.preventDefault();
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
},
|
|
739
|
-
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)) {
|
|
740
767
|
n.preventDefault();
|
|
741
|
-
const
|
|
742
|
-
|
|
768
|
+
const c = n.target;
|
|
769
|
+
u.value = c?.selectionStart ?? 0;
|
|
743
770
|
}
|
|
744
|
-
},
|
|
745
|
-
|
|
746
|
-
},
|
|
747
|
-
|
|
748
|
-
},
|
|
749
|
-
console.log("Clear event:", n), t.value = "",
|
|
750
|
-
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(
|
|
751
778
|
e.id
|
|
752
779
|
);
|
|
753
|
-
|
|
780
|
+
c && (c.focus(), c.setSelectionRange(0, 0));
|
|
754
781
|
});
|
|
755
782
|
};
|
|
756
783
|
e.externalValue && ve(
|
|
757
784
|
e.externalValue,
|
|
758
785
|
(n) => {
|
|
759
|
-
const
|
|
760
|
-
if (
|
|
761
|
-
if (t.value = `${
|
|
762
|
-
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;
|
|
763
790
|
setTimeout(() => {
|
|
764
|
-
e.onRequestClose?.(),
|
|
765
|
-
},
|
|
791
|
+
e.onRequestClose?.(), I.value = !1, m();
|
|
792
|
+
}, R);
|
|
766
793
|
}
|
|
767
794
|
return;
|
|
768
795
|
}
|
|
769
796
|
},
|
|
770
797
|
{ immediate: !0 }
|
|
771
798
|
);
|
|
772
|
-
const
|
|
799
|
+
const Q = h(
|
|
773
800
|
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
774
|
-
),
|
|
801
|
+
), z = h(
|
|
775
802
|
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
776
|
-
),
|
|
803
|
+
), W = h(
|
|
777
804
|
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
778
805
|
), ie = h(
|
|
779
806
|
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
780
|
-
),
|
|
807
|
+
), le = h(
|
|
781
808
|
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
782
|
-
),
|
|
809
|
+
), K = h(
|
|
783
810
|
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
784
811
|
), X = h(() => {
|
|
785
|
-
const { start: n, end:
|
|
812
|
+
const { start: n, end: c } = y(t.value);
|
|
786
813
|
return [
|
|
787
814
|
{
|
|
788
815
|
label: "Raw",
|
|
@@ -798,70 +825,74 @@ function Ge(e) {
|
|
|
798
825
|
},
|
|
799
826
|
{
|
|
800
827
|
label: "Start",
|
|
801
|
-
value: `${String(
|
|
802
|
-
|
|
803
|
-
).padStart(2, "0")} / ${String(
|
|
828
|
+
value: `${String(Q.value).padStart(2, "0")} / ${String(
|
|
829
|
+
z.value
|
|
830
|
+
).padStart(2, "0")} / ${String(W.value).padStart(4, "0")}`
|
|
804
831
|
},
|
|
805
832
|
{
|
|
806
833
|
label: "End",
|
|
807
834
|
value: `${String(ie.value).padStart(2, "0")} / ${String(
|
|
808
|
-
|
|
809
|
-
).padStart(2, "0")} / ${String(
|
|
835
|
+
le.value
|
|
836
|
+
).padStart(2, "0")} / ${String(K.value).padStart(4, "0")}`
|
|
810
837
|
},
|
|
811
|
-
{ label: "Digits only", value:
|
|
838
|
+
{ label: "Digits only", value: g.value },
|
|
812
839
|
{ label: "Mask complete", value: `${f.value}` },
|
|
813
840
|
{
|
|
814
841
|
label: "Parsed",
|
|
815
|
-
value: `${n ? n.toDateString() : "-"} | ${
|
|
842
|
+
value: `${n ? n.toDateString() : "-"} | ${c ? c.toDateString() : "-"}`
|
|
816
843
|
},
|
|
817
844
|
{
|
|
818
845
|
label: "Valid (managed)",
|
|
819
|
-
value: `${
|
|
846
|
+
value: `${O.value ?? "-"}`
|
|
820
847
|
},
|
|
821
|
-
{ label: "Span (days)", value: `${
|
|
848
|
+
{ label: "Span (days)", value: `${p.value ?? "-"}` },
|
|
822
849
|
{
|
|
823
850
|
label: "Reason",
|
|
824
|
-
value: `${
|
|
851
|
+
value: `${s.value ?? "-"}`
|
|
825
852
|
},
|
|
826
853
|
{
|
|
827
854
|
label: "Cursor in",
|
|
828
|
-
value: `${
|
|
829
|
-
const
|
|
830
|
-
return `${
|
|
855
|
+
value: `${u.value ?? "-"} (${(() => {
|
|
856
|
+
const x = u.value ?? 0, R = oe(x);
|
|
857
|
+
return `${R.side}.${R.part}`;
|
|
831
858
|
})()})`
|
|
832
859
|
}
|
|
833
860
|
];
|
|
834
|
-
}),
|
|
835
|
-
|
|
861
|
+
}), re = () => {
|
|
862
|
+
j(() => {
|
|
836
863
|
const n = document.getElementById(e.id);
|
|
837
864
|
if (!n) {
|
|
838
865
|
console.warn(`#${e.id} not found for styling.`);
|
|
839
866
|
return;
|
|
840
867
|
}
|
|
841
|
-
const
|
|
842
|
-
|
|
868
|
+
const c = n.closest("div");
|
|
869
|
+
if (!c) {
|
|
870
|
+
console.warn(`Parent div of #${e.id} not found for styling.`);
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
c.classList.contains("fk-daterangepicker") || c.classList.add("fk-daterangepicker");
|
|
843
874
|
});
|
|
844
875
|
};
|
|
845
876
|
xe(() => {
|
|
846
|
-
|
|
877
|
+
re();
|
|
847
878
|
});
|
|
848
|
-
const
|
|
849
|
-
|
|
879
|
+
const ye = () => {
|
|
880
|
+
j(() => {
|
|
850
881
|
try {
|
|
851
882
|
const n = Array.from(
|
|
852
883
|
document.querySelectorAll(".k-animation-container")
|
|
853
884
|
);
|
|
854
885
|
if (!n.length) return;
|
|
855
|
-
const
|
|
886
|
+
const x = [...n].reverse().find((ae) => ae.querySelector(".k-calendar"))?.querySelector(
|
|
856
887
|
".k-calendar"
|
|
857
888
|
);
|
|
858
|
-
if (!
|
|
859
|
-
const
|
|
889
|
+
if (!x) return;
|
|
890
|
+
const R = x.querySelectorAll(
|
|
860
891
|
".k-calendar-table"
|
|
861
892
|
);
|
|
862
|
-
let
|
|
863
|
-
|
|
864
|
-
|
|
893
|
+
let ee = !1;
|
|
894
|
+
R.forEach((ae) => {
|
|
895
|
+
ae.tabIndex === 0 && (ee ? ae.tabIndex = -1 : ee = !0);
|
|
865
896
|
});
|
|
866
897
|
} catch (n) {
|
|
867
898
|
console.warn(n);
|
|
@@ -871,224 +902,225 @@ function Ge(e) {
|
|
|
871
902
|
return e.isOpen && ve(
|
|
872
903
|
e.isOpen,
|
|
873
904
|
(n) => {
|
|
874
|
-
n && setTimeout(() =>
|
|
905
|
+
n && setTimeout(() => ye(), 0);
|
|
875
906
|
},
|
|
876
907
|
{ immediate: !1 }
|
|
877
908
|
), {
|
|
878
909
|
raw: t,
|
|
879
|
-
cursorPos:
|
|
880
|
-
debugEnabled:
|
|
910
|
+
cursorPos: u,
|
|
911
|
+
debugEnabled: q,
|
|
881
912
|
debugLines: X,
|
|
882
|
-
digitsOnly:
|
|
883
|
-
valid:
|
|
884
|
-
validComputed:
|
|
885
|
-
reason:
|
|
886
|
-
validationMessage:
|
|
887
|
-
spanDays:
|
|
888
|
-
month1:
|
|
889
|
-
day1:
|
|
890
|
-
year1:
|
|
891
|
-
month2:
|
|
892
|
-
day2:
|
|
893
|
-
year2: K
|
|
894
|
-
handleChange:
|
|
895
|
-
handleKeyDown:
|
|
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,
|
|
896
927
|
handleWheel: r,
|
|
897
|
-
handleKeyUp:
|
|
898
|
-
handleClick:
|
|
899
|
-
handleBlur:
|
|
900
|
-
handleClear:
|
|
928
|
+
handleKeyUp: i,
|
|
929
|
+
handleClick: d,
|
|
930
|
+
handleBlur: w,
|
|
931
|
+
handleClear: B,
|
|
901
932
|
onCalendarChange: () => {
|
|
902
|
-
|
|
903
|
-
}
|
|
933
|
+
I.value = !0;
|
|
934
|
+
},
|
|
935
|
+
initStyling: re
|
|
904
936
|
};
|
|
905
937
|
}
|
|
906
|
-
function
|
|
907
|
-
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 = {
|
|
908
940
|
H: /[0-9]/,
|
|
909
941
|
h: /[0-9]/,
|
|
910
942
|
M: /[0-9]/,
|
|
911
943
|
m: /[0-9]/,
|
|
912
944
|
A: /[AaPp]/,
|
|
913
945
|
a: /[Mm]/
|
|
914
|
-
},
|
|
915
|
-
const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0",
|
|
916
|
-
return Math.min(Math.max(
|
|
917
|
-
}),
|
|
918
|
-
const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0",
|
|
919
|
-
return Math.min(Math.max(
|
|
920
|
-
}),
|
|
921
|
-
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"),
|
|
922
|
-
return r === 12 ?
|
|
923
|
-
}), 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(
|
|
924
956
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
925
|
-
),
|
|
926
|
-
let
|
|
927
|
-
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(
|
|
928
960
|
2,
|
|
929
961
|
"0"
|
|
930
|
-
)} ${
|
|
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);
|
|
970
|
+
const z = /* @__PURE__ */ new Date();
|
|
971
|
+
return z.setSeconds(0, 0), z.setHours(Q), z.setMinutes(w), z;
|
|
931
972
|
}, o = (r) => {
|
|
932
|
-
|
|
933
|
-
if (!u) return null;
|
|
934
|
-
const v = parseInt(u[1]), M = parseInt(u[2]), U = u[3].toUpperCase();
|
|
935
|
-
if (v < 1 || v > 12 || M < 0 || M > 59) return null;
|
|
936
|
-
let ae = v % 12;
|
|
937
|
-
U === "PM" && (ae += 12);
|
|
938
|
-
const j = /* @__PURE__ */ new Date();
|
|
939
|
-
return j.setSeconds(0, 0), j.setHours(ae), j.setMinutes(M), j;
|
|
940
|
-
}, m = (r) => {
|
|
941
|
-
if (y.value.length === 0) {
|
|
973
|
+
if (S.value.length === 0) {
|
|
942
974
|
e.onChange({ value: null, event: r });
|
|
943
975
|
return;
|
|
944
976
|
}
|
|
945
|
-
if (!
|
|
977
|
+
if (!y.value) {
|
|
946
978
|
e.onChange({ value: null, event: r });
|
|
947
979
|
return;
|
|
948
980
|
}
|
|
949
|
-
const
|
|
950
|
-
|
|
951
|
-
},
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
const
|
|
955
|
-
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;
|
|
956
988
|
}
|
|
957
|
-
if (
|
|
958
|
-
const
|
|
959
|
-
if (
|
|
989
|
+
if (m) {
|
|
990
|
+
const B = p(m);
|
|
991
|
+
if (w > B) return !1;
|
|
960
992
|
}
|
|
961
993
|
return !0;
|
|
962
|
-
},
|
|
994
|
+
}, s = (r) => {
|
|
963
995
|
t.value = r.value;
|
|
964
|
-
const
|
|
965
|
-
|
|
996
|
+
const i = r.event?.target;
|
|
997
|
+
u.value = i?.selectionStart ?? 0;
|
|
966
998
|
try {
|
|
967
|
-
const
|
|
968
|
-
if (
|
|
969
|
-
const
|
|
970
|
-
/[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(() => {
|
|
971
1003
|
requestAnimationFrame(() => {
|
|
972
|
-
const
|
|
1004
|
+
const B = document.getElementById(
|
|
973
1005
|
e.id
|
|
974
1006
|
);
|
|
975
|
-
|
|
1007
|
+
B && (B.focus(), B.setSelectionRange(8, 8));
|
|
976
1008
|
});
|
|
977
|
-
})) : /[Pp]/.test(
|
|
1009
|
+
})) : /[Pp]/.test(w) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, j(() => {
|
|
978
1010
|
requestAnimationFrame(() => {
|
|
979
|
-
const
|
|
1011
|
+
const B = document.getElementById(
|
|
980
1012
|
e.id
|
|
981
1013
|
);
|
|
982
|
-
|
|
1014
|
+
B && (B.focus(), B.setSelectionRange(8, 8));
|
|
983
1015
|
});
|
|
984
1016
|
}));
|
|
985
1017
|
}
|
|
986
1018
|
} catch {
|
|
987
1019
|
}
|
|
988
|
-
|
|
989
|
-
},
|
|
990
|
-
|
|
991
|
-
},
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
const
|
|
995
|
-
if (!
|
|
996
|
-
if ((t.value ?? "").length === 0 ||
|
|
997
|
-
const
|
|
998
|
-
t.value =
|
|
999
|
-
const
|
|
1000
|
-
|
|
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(() => {
|
|
1001
1033
|
requestAnimationFrame(() => {
|
|
1002
1034
|
const n = document.getElementById(
|
|
1003
1035
|
e.id
|
|
1004
|
-
),
|
|
1005
|
-
n && (n.focus(), n.setSelectionRange(
|
|
1036
|
+
), c = u.value ?? 0;
|
|
1037
|
+
n && (n.focus(), n.setSelectionRange(c, c));
|
|
1006
1038
|
});
|
|
1007
1039
|
});
|
|
1008
1040
|
}
|
|
1009
1041
|
return;
|
|
1010
1042
|
}
|
|
1011
|
-
let
|
|
1012
|
-
if (
|
|
1013
|
-
r === "ArrowUp" ?
|
|
1014
|
-
else if (
|
|
1015
|
-
const
|
|
1016
|
-
if (
|
|
1017
|
-
r === "ArrowUp" ?
|
|
1043
|
+
let z = parseInt(Q[1]), W = parseInt(Q[2]), ie = Q[3].toUpperCase();
|
|
1044
|
+
if (B === "hh")
|
|
1045
|
+
r === "ArrowUp" ? z = z < 12 ? z + 1 : 1 : z = z > 1 ? z - 1 : 12;
|
|
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;
|
|
1018
1050
|
else if (r === "ArrowUp") {
|
|
1019
|
-
const X =
|
|
1020
|
-
let
|
|
1021
|
-
|
|
1051
|
+
const X = W % K;
|
|
1052
|
+
let re = X === 0 ? W + K : W + (K - X);
|
|
1053
|
+
re >= 60 && (re = 0), W = re;
|
|
1022
1054
|
} else {
|
|
1023
|
-
const X =
|
|
1024
|
-
let
|
|
1025
|
-
|
|
1055
|
+
const X = W % K;
|
|
1056
|
+
let re = X === 0 ? W - K : W - X;
|
|
1057
|
+
re < 0 && (re = 60 - K), W = re;
|
|
1026
1058
|
}
|
|
1027
|
-
} else
|
|
1028
|
-
t.value = `${String(
|
|
1059
|
+
} else B === "ampm" && (ie = ie === "AM" ? "PM" : "AM");
|
|
1060
|
+
t.value = `${String(z).padStart(2, "0")}:${String(W).padStart(
|
|
1029
1061
|
2,
|
|
1030
1062
|
"0"
|
|
1031
1063
|
)} ${ie}`;
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1064
|
+
const le = G(t.value);
|
|
1065
|
+
le && l(le) ? e.onChange({ value: le, event: m }) : e.onChange({ value: null, event: m }), j(() => {
|
|
1034
1066
|
requestAnimationFrame(() => {
|
|
1035
|
-
const
|
|
1067
|
+
const K = document.getElementById(
|
|
1036
1068
|
e.id
|
|
1037
|
-
), X =
|
|
1038
|
-
|
|
1069
|
+
), X = u.value ?? 0;
|
|
1070
|
+
K && (K.focus(), K.setSelectionRange(X, X));
|
|
1039
1071
|
});
|
|
1040
1072
|
});
|
|
1041
|
-
},
|
|
1073
|
+
}, D = (r) => {
|
|
1042
1074
|
if (r.code === "Space" || r.key === " ") {
|
|
1043
1075
|
e.onShowPicker(r);
|
|
1044
1076
|
return;
|
|
1045
1077
|
}
|
|
1046
|
-
if (
|
|
1078
|
+
if (A.includes(r.key)) {
|
|
1047
1079
|
r.preventDefault();
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1080
|
+
const i = r.target;
|
|
1081
|
+
b(r.key, i, r);
|
|
1050
1082
|
}
|
|
1051
|
-
},
|
|
1083
|
+
}, $ = (r) => {
|
|
1052
1084
|
r.preventDefault();
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1055
|
-
},
|
|
1056
|
-
const
|
|
1057
|
-
if (
|
|
1058
|
-
|
|
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;
|
|
1059
1091
|
return;
|
|
1060
1092
|
}
|
|
1061
|
-
|
|
1062
|
-
},
|
|
1063
|
-
|
|
1064
|
-
const
|
|
1065
|
-
|
|
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);
|
|
1066
1098
|
};
|
|
1067
1099
|
e.externalValue && ve(
|
|
1068
1100
|
e.externalValue,
|
|
1069
1101
|
(r) => {
|
|
1070
1102
|
if (r) {
|
|
1071
|
-
const
|
|
1072
|
-
if (
|
|
1073
|
-
const
|
|
1074
|
-
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);
|
|
1075
1107
|
return;
|
|
1076
1108
|
}
|
|
1077
1109
|
}
|
|
1078
1110
|
},
|
|
1079
1111
|
{ immediate: !0 }
|
|
1080
1112
|
);
|
|
1081
|
-
const
|
|
1113
|
+
const oe = h(() => [
|
|
1082
1114
|
["Time", t.value || "--:-- --"],
|
|
1083
|
-
["Hour (12h)",
|
|
1084
|
-
["Hour (24h)",
|
|
1085
|
-
["Minute",
|
|
1086
|
-
["Period",
|
|
1115
|
+
["Hour (12h)", E.value],
|
|
1116
|
+
["Hour (24h)", U.value],
|
|
1117
|
+
["Minute", C.value],
|
|
1118
|
+
["Period", T.value],
|
|
1087
1119
|
["Time (24h)", f.value ?? "--:--:--"],
|
|
1088
|
-
["Digits only",
|
|
1120
|
+
["Digits only", S.value],
|
|
1089
1121
|
[
|
|
1090
1122
|
"Parsed Date",
|
|
1091
|
-
|
|
1123
|
+
F.value?.toLocaleDateString("en-US", {
|
|
1092
1124
|
hour: "2-digit",
|
|
1093
1125
|
minute: "2-digit"
|
|
1094
1126
|
}) ?? null
|
|
@@ -1107,303 +1139,325 @@ function je(e) {
|
|
|
1107
1139
|
minute: "2-digit"
|
|
1108
1140
|
}) ?? null
|
|
1109
1141
|
],
|
|
1110
|
-
["valid",
|
|
1111
|
-
["reason",
|
|
1112
|
-
["validationMessage",
|
|
1113
|
-
]),
|
|
1114
|
-
() =>
|
|
1115
|
-
),
|
|
1116
|
-
if (!
|
|
1117
|
-
if (!
|
|
1118
|
-
const
|
|
1119
|
-
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;
|
|
1120
1152
|
}
|
|
1121
|
-
if (!
|
|
1122
|
-
const r =
|
|
1123
|
-
return !
|
|
1124
|
-
}),
|
|
1125
|
-
if (!
|
|
1126
|
-
if (!
|
|
1127
|
-
const
|
|
1128
|
-
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";
|
|
1129
1161
|
}
|
|
1130
|
-
if (!
|
|
1131
|
-
if (
|
|
1162
|
+
if (!V.value) return;
|
|
1163
|
+
if (S.value.length === 0 || !y.value)
|
|
1132
1164
|
return "incomplete";
|
|
1133
|
-
const r =
|
|
1134
|
-
return r ?
|
|
1135
|
-
}),
|
|
1136
|
-
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;
|
|
1137
1169
|
if (!r || r === "valid") return "";
|
|
1138
1170
|
if (r === "incomplete")
|
|
1139
1171
|
return "Required";
|
|
1140
1172
|
if (r === "invalid-time")
|
|
1141
|
-
return `Must be in ${
|
|
1142
|
-
const
|
|
1173
|
+
return `Must be in ${I.value} format.`;
|
|
1174
|
+
const i = {
|
|
1143
1175
|
hour: "2-digit",
|
|
1144
1176
|
minute: "2-digit"
|
|
1145
|
-
},
|
|
1177
|
+
}, m = e.min ? e.min.toLocaleTimeString("en-US", i) : null, w = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
|
|
1146
1178
|
if (r === "out-of-bounds") {
|
|
1147
|
-
if (
|
|
1148
|
-
if (
|
|
1149
|
-
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.`;
|
|
1150
1182
|
}
|
|
1151
1183
|
return "";
|
|
1152
|
-
}),
|
|
1153
|
-
|
|
1184
|
+
}), M = () => {
|
|
1185
|
+
j(() => {
|
|
1154
1186
|
const r = document.getElementById(e.id);
|
|
1155
1187
|
if (!r) {
|
|
1156
1188
|
console.warn(`#${e.id} not found for styling.`);
|
|
1157
1189
|
return;
|
|
1158
1190
|
}
|
|
1159
|
-
const
|
|
1160
|
-
if (!
|
|
1191
|
+
const i = r.closest(".k-timepicker");
|
|
1192
|
+
if (!i) {
|
|
1161
1193
|
console.warn(
|
|
1162
1194
|
`.k-timepicker parent of #${e.id} not found for styling.`
|
|
1163
1195
|
);
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
const m = i.parentElement;
|
|
1199
|
+
if (!m) {
|
|
1200
|
+
console.warn(
|
|
1167
1201
|
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
1168
1202
|
);
|
|
1203
|
+
return;
|
|
1169
1204
|
}
|
|
1205
|
+
m.classList.contains("fk-timepicker") || m.classList.add("fk-timepicker");
|
|
1170
1206
|
});
|
|
1171
1207
|
};
|
|
1172
1208
|
return xe(() => {
|
|
1173
|
-
|
|
1209
|
+
M();
|
|
1174
1210
|
}), {
|
|
1175
1211
|
raw: t,
|
|
1176
|
-
rules:
|
|
1177
|
-
debugEnabled:
|
|
1178
|
-
debugLines:
|
|
1179
|
-
placeholder:
|
|
1180
|
-
isValid:
|
|
1181
|
-
reason:
|
|
1182
|
-
validationMessage:
|
|
1183
|
-
isComplete:
|
|
1184
|
-
inRangeTime:
|
|
1185
|
-
cursorPos:
|
|
1186
|
-
hour:
|
|
1187
|
-
hour24:
|
|
1188
|
-
minute:
|
|
1189
|
-
period:
|
|
1190
|
-
time24:
|
|
1191
|
-
parsedRawTime:
|
|
1192
|
-
handleChange:
|
|
1193
|
-
handleKeyDown:
|
|
1194
|
-
handleKeyUp:
|
|
1195
|
-
handleClick:
|
|
1196
|
-
handleWheel:
|
|
1197
|
-
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,
|
|
1234
|
+
// Expose so consumers can reapply theming when Kendo updates DOM
|
|
1235
|
+
initStyling: M
|
|
1198
1236
|
};
|
|
1199
1237
|
}
|
|
1200
|
-
function
|
|
1238
|
+
function Ue(e) {
|
|
1201
1239
|
return Le() ? (Pe(e), !0) : !1;
|
|
1202
1240
|
}
|
|
1203
|
-
const
|
|
1241
|
+
const Ce = typeof window < "u" && typeof document < "u";
|
|
1204
1242
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
1205
|
-
const
|
|
1206
|
-
},
|
|
1207
|
-
function
|
|
1243
|
+
const Oe = Object.prototype.toString, Be = (e) => Oe.call(e) === "[object Object]", pe = () => {
|
|
1244
|
+
}, Ke = /* @__PURE__ */ Ve();
|
|
1245
|
+
function Ve() {
|
|
1208
1246
|
var e, t;
|
|
1209
|
-
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));
|
|
1210
1248
|
}
|
|
1211
1249
|
function Ae(e) {
|
|
1212
1250
|
return Array.isArray(e) ? e : [e];
|
|
1213
1251
|
}
|
|
1214
|
-
function
|
|
1252
|
+
function Ye(e, t, u) {
|
|
1215
1253
|
return ve(
|
|
1216
1254
|
e,
|
|
1217
1255
|
t,
|
|
1218
1256
|
{
|
|
1219
|
-
...
|
|
1257
|
+
...u,
|
|
1220
1258
|
immediate: !0
|
|
1221
1259
|
}
|
|
1222
1260
|
);
|
|
1223
1261
|
}
|
|
1224
|
-
const
|
|
1225
|
-
function
|
|
1262
|
+
const $e = Ce ? window : void 0;
|
|
1263
|
+
function be(e) {
|
|
1226
1264
|
var t;
|
|
1227
|
-
const
|
|
1228
|
-
return (t =
|
|
1265
|
+
const u = ce(e);
|
|
1266
|
+
return (t = u?.$el) != null ? t : u;
|
|
1229
1267
|
}
|
|
1230
1268
|
function Ee(...e) {
|
|
1231
|
-
const t = [],
|
|
1232
|
-
t.forEach((
|
|
1233
|
-
},
|
|
1234
|
-
const
|
|
1235
|
-
return
|
|
1236
|
-
}),
|
|
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(
|
|
1237
1275
|
() => {
|
|
1238
|
-
var
|
|
1276
|
+
var A, k;
|
|
1239
1277
|
return [
|
|
1240
|
-
(
|
|
1241
|
-
Ae(ce(
|
|
1242
|
-
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])),
|
|
1243
1281
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
1244
|
-
ce(
|
|
1282
|
+
ce(I.value ? e[3] : e[2])
|
|
1245
1283
|
];
|
|
1246
1284
|
},
|
|
1247
|
-
([
|
|
1248
|
-
if (
|
|
1285
|
+
([A, k, S, g]) => {
|
|
1286
|
+
if (u(), !A?.length || !k?.length || !S?.length)
|
|
1249
1287
|
return;
|
|
1250
|
-
const
|
|
1288
|
+
const P = Be(g) ? { ...g } : g;
|
|
1251
1289
|
t.push(
|
|
1252
|
-
...
|
|
1253
|
-
(
|
|
1254
|
-
(
|
|
1290
|
+
...A.flatMap(
|
|
1291
|
+
(E) => k.flatMap(
|
|
1292
|
+
(C) => S.map((T) => q(E, C, T, P))
|
|
1255
1293
|
)
|
|
1256
1294
|
)
|
|
1257
1295
|
);
|
|
1258
1296
|
},
|
|
1259
1297
|
{ flush: "post" }
|
|
1260
|
-
),
|
|
1261
|
-
|
|
1298
|
+
), V = () => {
|
|
1299
|
+
L(), u();
|
|
1262
1300
|
};
|
|
1263
|
-
return
|
|
1301
|
+
return Ue(u), V;
|
|
1264
1302
|
}
|
|
1265
1303
|
let Me = !1;
|
|
1266
|
-
function
|
|
1267
|
-
const { window:
|
|
1268
|
-
if (!
|
|
1269
|
-
return
|
|
1270
|
-
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) {
|
|
1271
1309
|
Me = !0;
|
|
1272
1310
|
const f = { passive: !0 };
|
|
1273
|
-
Array.from(
|
|
1311
|
+
Array.from(q.document.body.children).forEach((y) => y.addEventListener("click", pe, f)), q.document.documentElement.addEventListener("click", pe, f);
|
|
1274
1312
|
}
|
|
1275
|
-
let
|
|
1276
|
-
const
|
|
1277
|
-
if (typeof
|
|
1278
|
-
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));
|
|
1279
1317
|
{
|
|
1280
|
-
const
|
|
1281
|
-
return
|
|
1318
|
+
const O = be(y);
|
|
1319
|
+
return O && (f.target === O || f.composedPath().includes(O));
|
|
1282
1320
|
}
|
|
1283
1321
|
});
|
|
1284
|
-
function
|
|
1285
|
-
const
|
|
1286
|
-
return
|
|
1322
|
+
function g(f) {
|
|
1323
|
+
const y = ce(f);
|
|
1324
|
+
return y && y.$.subTree.shapeFlag === 16;
|
|
1287
1325
|
}
|
|
1288
|
-
function
|
|
1289
|
-
const
|
|
1290
|
-
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));
|
|
1291
1329
|
}
|
|
1292
|
-
const
|
|
1293
|
-
const
|
|
1294
|
-
if (f.target != null && !(!(
|
|
1295
|
-
if ("detail" in f && f.detail === 0 && (
|
|
1296
|
-
|
|
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;
|
|
1297
1335
|
return;
|
|
1298
1336
|
}
|
|
1299
1337
|
t(f);
|
|
1300
1338
|
}
|
|
1301
1339
|
};
|
|
1302
|
-
let
|
|
1303
|
-
const
|
|
1304
|
-
Ee(
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
}, 0),
|
|
1308
|
-
}, { passive: !0, capture:
|
|
1309
|
-
Ee(
|
|
1310
|
-
const
|
|
1311
|
-
|
|
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));
|
|
1312
1350
|
}, { passive: !0 }),
|
|
1313
|
-
|
|
1351
|
+
V && Ee(q, "blur", (f) => {
|
|
1314
1352
|
setTimeout(() => {
|
|
1315
|
-
var
|
|
1316
|
-
const
|
|
1317
|
-
((
|
|
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);
|
|
1318
1356
|
}, 0);
|
|
1319
1357
|
}, { passive: !0 })
|
|
1320
|
-
].filter(Boolean),
|
|
1321
|
-
return
|
|
1322
|
-
stop:
|
|
1358
|
+
].filter(Boolean), U = () => T.forEach((f) => f());
|
|
1359
|
+
return A ? {
|
|
1360
|
+
stop: U,
|
|
1323
1361
|
cancel: () => {
|
|
1324
|
-
|
|
1362
|
+
k = !1;
|
|
1325
1363
|
},
|
|
1326
1364
|
trigger: (f) => {
|
|
1327
|
-
|
|
1365
|
+
k = !0, E(f), k = !1;
|
|
1328
1366
|
}
|
|
1329
|
-
} :
|
|
1367
|
+
} : U;
|
|
1330
1368
|
}
|
|
1331
|
-
function
|
|
1332
|
-
const t = Re(null),
|
|
1369
|
+
function Qe(e) {
|
|
1370
|
+
const t = Re(null), u = [
|
|
1333
1371
|
".k-animation-container .k-popup",
|
|
1334
1372
|
".k-popup",
|
|
1335
1373
|
".k-timepicker-popup",
|
|
1336
1374
|
".k-menu-popup"
|
|
1337
|
-
],
|
|
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(
|
|
1338
1376
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1339
|
-
) ??
|
|
1377
|
+
) ?? g : null, { activate: L, deactivate: V } = qe(t, {
|
|
1340
1378
|
escapeDeactivates: !1,
|
|
1341
1379
|
clickOutsideDeactivates: !1,
|
|
1342
1380
|
fallbackFocus: () => t.value,
|
|
1343
|
-
initialFocus: () =>
|
|
1381
|
+
initialFocus: () => I(t.value),
|
|
1344
1382
|
...e.focusTrapOptions ?? {}
|
|
1345
1383
|
});
|
|
1346
|
-
let
|
|
1347
|
-
const
|
|
1384
|
+
let A = null, k = _(null);
|
|
1385
|
+
const S = () => {
|
|
1348
1386
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1349
|
-
const
|
|
1350
|
-
const
|
|
1351
|
-
if (
|
|
1352
|
-
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(
|
|
1353
1391
|
(f) => f.offsetParent !== null || f.getClientRects().length > 0
|
|
1354
1392
|
);
|
|
1355
|
-
return
|
|
1356
|
-
},
|
|
1357
|
-
for (const
|
|
1358
|
-
const
|
|
1359
|
-
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;
|
|
1360
1398
|
}
|
|
1361
|
-
for (const
|
|
1362
|
-
const
|
|
1363
|
-
if (
|
|
1399
|
+
for (const E of q) {
|
|
1400
|
+
const C = g(document, E);
|
|
1401
|
+
if (C) return C;
|
|
1364
1402
|
}
|
|
1365
1403
|
return null;
|
|
1366
1404
|
};
|
|
1367
|
-
return
|
|
1368
|
-
|
|
1405
|
+
return Ne(t, (g) => {
|
|
1406
|
+
k.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", g);
|
|
1369
1407
|
}), ve(
|
|
1370
1408
|
() => e.isOpen.value,
|
|
1371
|
-
(
|
|
1372
|
-
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
}, document.addEventListener("keydown",
|
|
1377
|
-
})) : (
|
|
1378
|
-
const
|
|
1379
|
-
const
|
|
1380
|
-
|
|
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?.();
|
|
1381
1419
|
};
|
|
1382
|
-
requestAnimationFrame(() => setTimeout(
|
|
1383
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
1420
|
+
requestAnimationFrame(() => setTimeout(P, 0));
|
|
1421
|
+
}), e.returnFocusToTrigger !== !1 && k.value === "escape" && e.triggerEl?.value && (console.log(
|
|
1384
1422
|
"Returning focus to trigger element:",
|
|
1385
1423
|
e.triggerEl.value
|
|
1386
|
-
),
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1389
|
-
if (!
|
|
1390
|
-
(
|
|
1424
|
+
), j(() => {
|
|
1425
|
+
const P = () => {
|
|
1426
|
+
const E = e.triggerEl?.value;
|
|
1427
|
+
if (!E) return;
|
|
1428
|
+
(E.querySelector("input") ?? E)?.focus?.();
|
|
1391
1429
|
};
|
|
1392
|
-
requestAnimationFrame(() => setTimeout(
|
|
1430
|
+
requestAnimationFrame(() => setTimeout(P, 0));
|
|
1393
1431
|
})));
|
|
1394
1432
|
}
|
|
1395
1433
|
), {
|
|
1396
1434
|
popupRef: t,
|
|
1397
|
-
activate:
|
|
1398
|
-
deactivate:
|
|
1399
|
-
lastCloseReason:
|
|
1400
|
-
setPopupEl: (
|
|
1435
|
+
activate: L,
|
|
1436
|
+
deactivate: V,
|
|
1437
|
+
lastCloseReason: N(k),
|
|
1438
|
+
setPopupEl: (g) => t.value = g
|
|
1401
1439
|
};
|
|
1402
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
|
+
};
|
|
1403
1456
|
export {
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1457
|
+
_e as useGridA11y,
|
|
1458
|
+
Ze as useGridFilter,
|
|
1459
|
+
ze as useMaskedDateInput,
|
|
1460
|
+
Xe as useMaskedDateRangeInput,
|
|
1461
|
+
Je as useMaskedTimeInput,
|
|
1462
|
+
Qe as usePopupTrap
|
|
1409
1463
|
};
|