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