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