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