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