@featherk/composables 0.10.8 → 0.10.9
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,31 +1,31 @@
|
|
|
1
|
-
import { ref as U, onBeforeUnmount as
|
|
2
|
-
import { useFocusTrap as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
const
|
|
1
|
+
import { ref as U, onBeforeUnmount as Pe, nextTick as B, computed as v, watchEffect as Te, toValue as oe, reactive as Ve, watch as ue, unref as Le, onMounted as Me, readonly as X, shallowRef as Ke } from "vue";
|
|
2
|
+
import { useFocusTrap as qe } from "@vueuse/integrations/useFocusTrap";
|
|
3
|
+
const it = (e, t) => {
|
|
4
|
+
const r = U(null);
|
|
5
|
+
let g = !1, f = null, p = null;
|
|
6
|
+
const A = [], C = ".k-table-row[data-grid-row-index] [tabindex]", T = () => {
|
|
7
7
|
const i = e?.value?.$el;
|
|
8
8
|
return i ? i.closest(".k-grid") : null;
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
9
|
+
}, q = (i) => {
|
|
10
|
+
const w = T();
|
|
11
|
+
if (!w) return !1;
|
|
12
12
|
const d = i.closest(".k-grid-aria-root");
|
|
13
13
|
if (d)
|
|
14
|
-
return
|
|
15
|
-
const
|
|
14
|
+
return w.contains(d);
|
|
15
|
+
const b = i.closest(
|
|
16
16
|
".k-grid-header, .k-grid-content, .k-grid-content-locked"
|
|
17
17
|
);
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
([" ", "Spacebar", "Space"].includes(
|
|
18
|
+
return b ? w.contains(b) : !1;
|
|
19
|
+
}, D = (i) => i.key === "Enter" || i.code === "Enter" || i.code === "NumpadEnter", $ = () => e?.value?.columns, s = (i) => {
|
|
20
|
+
const w = i.key || i.code;
|
|
21
|
+
([" ", "Spacebar", "Space"].includes(w) || D(i)) && (i.preventDefault(), i.stopPropagation(), r.value = i.target, i.target.click());
|
|
22
22
|
}, l = (i) => {
|
|
23
|
-
if (!
|
|
23
|
+
if (!r.value) return;
|
|
24
24
|
if (i.code === "Escape") {
|
|
25
|
-
i.stopPropagation(),
|
|
25
|
+
i.stopPropagation(), r.value && r.value.focus();
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const w = Array.from(
|
|
29
29
|
document.querySelectorAll(
|
|
30
30
|
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
31
31
|
)
|
|
@@ -34,7 +34,7 @@ const pt = (e, t) => {
|
|
|
34
34
|
);
|
|
35
35
|
if (d) {
|
|
36
36
|
if (i.code === "Tab") {
|
|
37
|
-
const
|
|
37
|
+
const b = [
|
|
38
38
|
// ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
|
|
39
39
|
// ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
40
40
|
// ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
|
|
@@ -43,86 +43,86 @@ const pt = (e, t) => {
|
|
|
43
43
|
"input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
44
44
|
"button:not([tabindex='-1']):not([disabled])",
|
|
45
45
|
".k-checkbox"
|
|
46
|
-
],
|
|
47
|
-
d.querySelectorAll(
|
|
46
|
+
], I = t?.focusableMenuSelectors ?? b, S = Array.from(
|
|
47
|
+
d.querySelectorAll(I.join(","))
|
|
48
48
|
);
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
49
|
+
if (S.length === 0) return;
|
|
50
|
+
const M = S.findIndex(
|
|
51
51
|
(W) => W === document.activeElement
|
|
52
52
|
);
|
|
53
|
-
let
|
|
54
|
-
|
|
53
|
+
let K;
|
|
54
|
+
M === -1 ? K = 0 : i.shiftKey ? K = (M - 1 + S.length) % S.length : K = (M + 1) % S.length, i.preventDefault(), i.stopPropagation(), S[K]?.focus();
|
|
55
55
|
}
|
|
56
56
|
} else if (i.code === "ArrowUp" || i.code === "ArrowDown") {
|
|
57
57
|
i.preventDefault(), i.stopPropagation();
|
|
58
|
-
const
|
|
59
|
-
(
|
|
58
|
+
const b = w.findIndex(
|
|
59
|
+
(S) => S === document.activeElement
|
|
60
60
|
);
|
|
61
|
-
let
|
|
62
|
-
i.code === "ArrowUp" ?
|
|
61
|
+
let I = b;
|
|
62
|
+
i.code === "ArrowUp" ? I = b > 0 ? b - 1 : w.length - 1 : i.code === "ArrowDown" && (I = b < w.length - 1 ? b + 1 : 0), w[I]?.focus();
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (i.code === "Tab") {
|
|
66
66
|
i.preventDefault(), i.stopPropagation();
|
|
67
|
-
const
|
|
68
|
-
(i.shiftKey ?
|
|
67
|
+
const b = r.value?.parentElement;
|
|
68
|
+
(i.shiftKey ? b?.previousElementSibling : b?.nextElementSibling)?.querySelector(
|
|
69
69
|
"button, [role='button'], .k-link"
|
|
70
70
|
)?.focus();
|
|
71
71
|
}
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
i.forEach((
|
|
75
|
-
|
|
72
|
+
}, y = () => {
|
|
73
|
+
f = new MutationObserver((i) => {
|
|
74
|
+
i.forEach((w) => {
|
|
75
|
+
w.addedNodes.forEach((d) => {
|
|
76
76
|
if (d.nodeType === Node.ELEMENT_NODE) {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
const b = d;
|
|
78
|
+
if (b.classList.contains("k-animation-container")) {
|
|
79
|
+
const S = r.value;
|
|
80
|
+
S && (S.dataset.featherKSortable === "true" || B(() => {
|
|
81
|
+
b.querySelectorAll(
|
|
82
82
|
".k-columnmenu-item-wrapper"
|
|
83
83
|
).forEach((W) => {
|
|
84
84
|
W.textContent?.toLowerCase().includes("sort") && W.remove();
|
|
85
85
|
});
|
|
86
|
-
})),
|
|
86
|
+
})), b.addEventListener(
|
|
87
87
|
"keydown",
|
|
88
88
|
l
|
|
89
89
|
), B(() => {
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
90
|
+
const M = () => {
|
|
91
|
+
const K = Array.from(
|
|
92
|
+
b.querySelectorAll(
|
|
93
93
|
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
94
94
|
)
|
|
95
95
|
);
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
else if (
|
|
99
|
-
|
|
96
|
+
if (K.length === 1)
|
|
97
|
+
K[0].focus(), K[0].click(), M.attempts = 0;
|
|
98
|
+
else if (K.length > 1) {
|
|
99
|
+
M.attempts = 0;
|
|
100
100
|
return;
|
|
101
101
|
} else
|
|
102
|
-
|
|
102
|
+
M.attempts === void 0 && (M.attempts = 0), M.attempts++ < 3 && setTimeout(M, 200);
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
M();
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
b.querySelectorAll(
|
|
108
108
|
".k-animation-container"
|
|
109
|
-
).forEach((
|
|
110
|
-
|
|
109
|
+
).forEach((S) => {
|
|
110
|
+
S.addEventListener(
|
|
111
111
|
"keydown",
|
|
112
112
|
l
|
|
113
113
|
);
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
}),
|
|
116
|
+
}), w.removedNodes.forEach((d) => {
|
|
117
117
|
if (d.nodeType === Node.ELEMENT_NODE) {
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const b = d;
|
|
119
|
+
b.classList.contains("k-animation-container") && b.removeEventListener(
|
|
120
120
|
"keydown",
|
|
121
121
|
l
|
|
122
|
-
),
|
|
122
|
+
), b.querySelectorAll(
|
|
123
123
|
".k-animation-container"
|
|
124
|
-
).forEach((
|
|
125
|
-
|
|
124
|
+
).forEach((S) => {
|
|
125
|
+
S.removeEventListener(
|
|
126
126
|
"keydown",
|
|
127
127
|
l
|
|
128
128
|
);
|
|
@@ -130,42 +130,42 @@ const pt = (e, t) => {
|
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
-
}),
|
|
133
|
+
}), f.observe(document.body, {
|
|
134
134
|
childList: !0,
|
|
135
135
|
subtree: !0
|
|
136
136
|
});
|
|
137
|
-
},
|
|
138
|
-
const
|
|
139
|
-
return !!(["input", "textarea", "select", "button"].includes(
|
|
137
|
+
}, L = (i) => {
|
|
138
|
+
const w = i.tagName.toLowerCase();
|
|
139
|
+
return !!(["input", "textarea", "select", "button"].includes(w) || i.closest(
|
|
140
140
|
'.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'
|
|
141
141
|
));
|
|
142
|
-
},
|
|
142
|
+
}, h = (i) => {
|
|
143
143
|
if (!i.type || !i)
|
|
144
144
|
return;
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
147
|
-
const d =
|
|
145
|
+
const w = i.target;
|
|
146
|
+
if (!w) return;
|
|
147
|
+
const d = w.closest(
|
|
148
148
|
".k-table-row[data-grid-row-index]"
|
|
149
149
|
);
|
|
150
|
-
if (!
|
|
150
|
+
if (!q(w))
|
|
151
151
|
return;
|
|
152
|
-
const
|
|
152
|
+
const b = ["ArrowLeft", "ArrowRight"].includes(
|
|
153
153
|
i.code
|
|
154
154
|
);
|
|
155
|
-
if (!(
|
|
155
|
+
if (!(L(w) && !(d && b))) {
|
|
156
156
|
if (i.code === "Escape") {
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
157
|
+
const I = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
|
|
158
|
+
if (I) {
|
|
159
159
|
i.preventDefault(), i.stopPropagation();
|
|
160
160
|
try {
|
|
161
161
|
Array.from(
|
|
162
162
|
e?.value.$el.querySelectorAll(
|
|
163
163
|
".k-table-row[data-grid-row-index]"
|
|
164
164
|
)
|
|
165
|
-
).forEach((
|
|
165
|
+
).forEach((M) => M.setAttribute("tabindex", "-1"));
|
|
166
166
|
} catch {
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
I.setAttribute("tabindex", "0"), I.focus();
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -178,15 +178,15 @@ const pt = (e, t) => {
|
|
|
178
178
|
"NumpadEnter",
|
|
179
179
|
"Space"
|
|
180
180
|
].includes(i.code)) {
|
|
181
|
-
if (
|
|
182
|
-
|
|
181
|
+
if (w.classList.contains("k-grid-header-menu") && w.classList.contains("k-grid-column-menu")) {
|
|
182
|
+
r.value = w;
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
if (d) {
|
|
186
186
|
if (["ArrowDown", "ArrowUp"].includes(i.code)) {
|
|
187
187
|
i.preventDefault(), i.stopPropagation();
|
|
188
|
-
const
|
|
189
|
-
let W =
|
|
188
|
+
const I = (M, K) => {
|
|
189
|
+
let W = K === "next" ? M.nextElementSibling : M.previousElementSibling;
|
|
190
190
|
for (; W; ) {
|
|
191
191
|
const ae = W;
|
|
192
192
|
try {
|
|
@@ -194,204 +194,204 @@ const pt = (e, t) => {
|
|
|
194
194
|
return ae;
|
|
195
195
|
} catch {
|
|
196
196
|
}
|
|
197
|
-
W =
|
|
197
|
+
W = K === "next" ? W.nextElementSibling : W.previousElementSibling;
|
|
198
198
|
}
|
|
199
199
|
return null;
|
|
200
|
-
},
|
|
201
|
-
|
|
200
|
+
}, S = i.code === "ArrowDown" ? I(d, "next") : I(d, "previous");
|
|
201
|
+
S && (d.setAttribute("tabindex", "-1"), S.setAttribute("tabindex", "0"), S.focus());
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
if (["ArrowLeft", "ArrowRight"].includes(i.code)) {
|
|
205
205
|
i.preventDefault(), i.stopPropagation();
|
|
206
|
-
const
|
|
207
|
-
|
|
206
|
+
const I = d.querySelectorAll(
|
|
207
|
+
C
|
|
208
208
|
);
|
|
209
|
-
if (
|
|
210
|
-
let
|
|
211
|
-
(
|
|
209
|
+
if (I.length === 0) return;
|
|
210
|
+
let S = Array.from(I).findIndex(
|
|
211
|
+
(M) => M === document.activeElement
|
|
212
212
|
);
|
|
213
|
-
if (
|
|
214
|
-
|
|
213
|
+
if (S === -1 && document.activeElement === d) {
|
|
214
|
+
I[0].focus();
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
i.code === "ArrowRight" ?
|
|
217
|
+
i.code === "ArrowRight" ? S = S === I.length - 1 ? 0 : S + 1 : i.code === "ArrowLeft" && (S = S === 0 ? I.length - 1 : S - 1), I[S].focus();
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
},
|
|
223
|
+
}, k = () => {
|
|
224
224
|
B(() => {
|
|
225
225
|
const i = e.value?.$el;
|
|
226
226
|
if (!i || typeof i.closest != "function") return;
|
|
227
|
-
const
|
|
228
|
-
|
|
227
|
+
const w = i.closest(".k-grid");
|
|
228
|
+
w && w.classList.add("fk-grid");
|
|
229
229
|
});
|
|
230
|
-
},
|
|
231
|
-
if (!
|
|
230
|
+
}, x = () => {
|
|
231
|
+
if (!p)
|
|
232
232
|
try {
|
|
233
233
|
const i = () => {
|
|
234
234
|
try {
|
|
235
|
-
const
|
|
235
|
+
const b = Array.from(
|
|
236
236
|
e.value.$el.querySelectorAll(
|
|
237
237
|
".k-table-row[data-grid-row-index]"
|
|
238
238
|
)
|
|
239
239
|
);
|
|
240
|
-
if (!
|
|
241
|
-
(
|
|
240
|
+
if (!b || b.length === 0 || b.filter(
|
|
241
|
+
(M) => M.getAttribute("tabindex") === "0"
|
|
242
242
|
).length === 1) return;
|
|
243
|
-
const
|
|
244
|
-
(
|
|
243
|
+
const S = b.find(
|
|
244
|
+
(M) => M === document.activeElement || M.contains(document.activeElement)
|
|
245
245
|
);
|
|
246
|
-
if (
|
|
247
|
-
|
|
246
|
+
if (b.forEach((M) => M.setAttribute("tabindex", "-1")), S) {
|
|
247
|
+
S.setAttribute("tabindex", "0");
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
} catch (
|
|
252
|
-
console.error("ensureSingleTabindex error:",
|
|
250
|
+
b[0].setAttribute("tabindex", "0");
|
|
251
|
+
} catch (b) {
|
|
252
|
+
console.error("ensureSingleTabindex error:", b);
|
|
253
253
|
}
|
|
254
|
-
},
|
|
254
|
+
}, w = Array.from(
|
|
255
255
|
e.value.$el.querySelectorAll(
|
|
256
256
|
".k-table-row[data-grid-row-index]"
|
|
257
257
|
)
|
|
258
258
|
);
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
w.length > 0 && w.forEach((b, I) => {
|
|
260
|
+
b.setAttribute("tabindex", I === 0 ? "0" : "-1");
|
|
261
261
|
});
|
|
262
262
|
const d = e.value.$el.querySelector(".k-table-tbody");
|
|
263
|
-
d && (
|
|
263
|
+
d && (p = new MutationObserver(() => {
|
|
264
264
|
i();
|
|
265
|
-
}),
|
|
265
|
+
}), p.observe(d, { childList: !0, subtree: !0 }));
|
|
266
266
|
} catch (i) {
|
|
267
267
|
console.error("Error setting up row navigation:", i);
|
|
268
268
|
}
|
|
269
|
-
},
|
|
269
|
+
}, V = () => {
|
|
270
270
|
B(() => {
|
|
271
|
-
const
|
|
272
|
-
|
|
271
|
+
const w = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
272
|
+
w && w.forEach((d) => {
|
|
273
273
|
d.setAttribute("role", "button"), d.addEventListener(
|
|
274
274
|
"keydown",
|
|
275
275
|
s
|
|
276
276
|
);
|
|
277
|
-
}),
|
|
277
|
+
}), y(), _();
|
|
278
278
|
});
|
|
279
279
|
}, Y = () => {
|
|
280
|
-
const
|
|
281
|
-
|
|
280
|
+
const w = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
281
|
+
w && w.forEach((d) => {
|
|
282
282
|
d.removeEventListener(
|
|
283
283
|
"keydown",
|
|
284
284
|
s
|
|
285
285
|
);
|
|
286
|
-
}),
|
|
287
|
-
},
|
|
286
|
+
}), f && (f.disconnect(), f = null), p && (p.disconnect(), p = null), A.forEach((d) => d()), A.length = 0;
|
|
287
|
+
}, _ = () => {
|
|
288
288
|
document.querySelectorAll(
|
|
289
289
|
".k-grid-header .k-table-thead th"
|
|
290
|
-
).forEach((d,
|
|
290
|
+
).forEach((d, b) => {
|
|
291
291
|
if (d.dataset.featherKHeaderBound === "true")
|
|
292
292
|
return;
|
|
293
|
-
const
|
|
293
|
+
const I = d.querySelector(
|
|
294
294
|
".k-grid-header-menu.k-grid-column-menu"
|
|
295
295
|
);
|
|
296
|
-
if (!
|
|
297
|
-
const
|
|
298
|
-
if (
|
|
299
|
-
const a = b
|
|
296
|
+
if (!I) return;
|
|
297
|
+
const S = $();
|
|
298
|
+
if (S && S[b]) {
|
|
299
|
+
const a = S[b].field ?? "";
|
|
300
300
|
d.setAttribute("data-feather-k-field", a), d.setAttribute(
|
|
301
301
|
"data-feather-k-filterable",
|
|
302
|
-
b
|
|
302
|
+
S[b].filterable === !1 ? "false" : "true"
|
|
303
303
|
), d.setAttribute(
|
|
304
304
|
"data-feather-k-sortable",
|
|
305
|
-
b
|
|
305
|
+
S[b].sortable === !1 ? "false" : "true"
|
|
306
306
|
);
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
|
|
308
|
+
const M = d.dataset.featherKFilterable !== "false", K = d.dataset.featherKSortable !== "false";
|
|
309
|
+
I.setAttribute("tabindex", "-1"), M || K ? d.style.cursor = "pointer" : d.style.cursor = "default", M ? (d.setAttribute("tabindex", "0"), d.setAttribute("role", "button"), d.setAttribute("aria-haspopup", "menu")) : (d.setAttribute("tabindex", "0"), d.setAttribute("role", "columnheader"), d.removeAttribute("aria-haspopup"));
|
|
310
310
|
const W = (a) => {
|
|
311
|
-
a.target?.closest(".k-column-resizer") || (
|
|
311
|
+
a.target?.closest(".k-column-resizer") || (r.value = d, I.click());
|
|
312
312
|
}, ae = (a) => {
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
else if (
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
|
|
313
|
+
if (M)
|
|
314
|
+
r.value = d, a.preventDefault(), a.stopPropagation(), W(a);
|
|
315
|
+
else if (K) {
|
|
316
|
+
r.value = d;
|
|
317
|
+
const m = d.querySelector(".k-link");
|
|
318
|
+
m && m.click();
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
|
-
d.addEventListener("click", ae),
|
|
321
|
+
d.addEventListener("click", ae), A.push(() => {
|
|
322
322
|
d.removeEventListener("click", ae);
|
|
323
323
|
});
|
|
324
324
|
const se = (a) => {
|
|
325
|
-
if ((
|
|
326
|
-
if (a.preventDefault(), a.stopPropagation(),
|
|
325
|
+
if ((D(a) || a.code === "Space") && (M || K)) {
|
|
326
|
+
if (a.preventDefault(), a.stopPropagation(), r.value = d, r.value.focus(), M)
|
|
327
327
|
W(a);
|
|
328
|
-
else if (
|
|
329
|
-
const
|
|
330
|
-
|
|
328
|
+
else if (K) {
|
|
329
|
+
const m = d.querySelector(".k-link");
|
|
330
|
+
m && m.click();
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
};
|
|
334
|
-
d.addEventListener("keydown", se, !0),
|
|
334
|
+
d.addEventListener("keydown", se, !0), A.push(() => {
|
|
335
335
|
d.removeEventListener("keydown", se, !0);
|
|
336
336
|
}), d.dataset.featherKHeaderBound = "true";
|
|
337
337
|
});
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
340
|
-
const d = (
|
|
341
|
-
const
|
|
342
|
-
|
|
338
|
+
const w = document.querySelector(".k-grid-header .k-table-thead");
|
|
339
|
+
if (w && w.dataset.featherKHeaderBound !== "true") {
|
|
340
|
+
const d = (b) => {
|
|
341
|
+
const I = b.target.closest("th");
|
|
342
|
+
I && (D(b) || b.code === "Space") && I.dataset.featherKFilterable === "false" && I.dataset.featherKSortable === "false" && (b.preventDefault(), b.stopImmediatePropagation());
|
|
343
343
|
};
|
|
344
|
-
|
|
344
|
+
w.addEventListener(
|
|
345
345
|
"keydown",
|
|
346
346
|
d,
|
|
347
347
|
!0
|
|
348
348
|
// NOTE: capture phase
|
|
349
|
-
),
|
|
350
|
-
|
|
349
|
+
), A.push(() => {
|
|
350
|
+
w.removeEventListener(
|
|
351
351
|
"keydown",
|
|
352
352
|
d,
|
|
353
353
|
!0
|
|
354
354
|
);
|
|
355
|
-
}),
|
|
355
|
+
}), w.dataset.featherKHeaderBound = "true";
|
|
356
356
|
}
|
|
357
|
-
}, Q = function(i,
|
|
358
|
-
const d = i?.event?.event.target,
|
|
359
|
-
if (!d || !
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
362
|
-
if (
|
|
357
|
+
}, Q = function(i, w) {
|
|
358
|
+
const d = i?.event?.event.target, b = $();
|
|
359
|
+
if (!d || !b) return;
|
|
360
|
+
const I = d.classList.contains("k-grid-header-menu"), S = d.classList.contains("k-columnmenu-item"), M = b.find((K) => K.field === i?.event?.field)?.sortable && !0;
|
|
361
|
+
if (!I) {
|
|
362
|
+
if (S && !M) {
|
|
363
363
|
i?.event?.sort?.filter(
|
|
364
364
|
(W) => W.field !== i?.event?.field
|
|
365
365
|
);
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
368
|
-
typeof
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
typeof w == "function" && B(() => {
|
|
369
|
+
r.value && r.value.focus(), w(i), B(() => {
|
|
370
|
+
_();
|
|
371
371
|
});
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
374
|
}, le = () => {
|
|
375
|
-
if (!
|
|
375
|
+
if (!g)
|
|
376
376
|
try {
|
|
377
|
-
|
|
377
|
+
k(), x(), V(), g = !0;
|
|
378
378
|
} catch (i) {
|
|
379
379
|
console.error("initA11y failed:", i), Y();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
|
-
return
|
|
382
|
+
return Pe(() => {
|
|
383
383
|
Y();
|
|
384
384
|
}), {
|
|
385
|
-
activeFilterButton:
|
|
386
|
-
handleGridKeyDown:
|
|
385
|
+
activeFilterButton: r,
|
|
386
|
+
handleGridKeyDown: h,
|
|
387
387
|
handleSortChange: Q,
|
|
388
388
|
initA11y: le
|
|
389
389
|
};
|
|
390
|
-
},
|
|
391
|
-
(
|
|
392
|
-
) :
|
|
393
|
-
(
|
|
394
|
-
) ? "active" : "",
|
|
390
|
+
}, Ne = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Oe = (e) => !!e && typeof e == "object" && "field" in e, Fe = (e, t) => !e || typeof e != "object" ? !1 : Ne(e) ? e.filters.some(
|
|
391
|
+
(r) => Fe(r, t)
|
|
392
|
+
) : Oe(e) ? e.field === t : !1, st = (e) => (t) => e.value?.filters && e.value.filters.some(
|
|
393
|
+
(r) => Fe(r, t)
|
|
394
|
+
) ? "active" : "", Ue = [
|
|
395
395
|
"button",
|
|
396
396
|
"a",
|
|
397
397
|
"input",
|
|
@@ -409,29 +409,29 @@ const pt = (e, t) => {
|
|
|
409
409
|
".k-hierarchy-cell",
|
|
410
410
|
".k-grid-header-menu",
|
|
411
411
|
".k-column-menu"
|
|
412
|
-
],
|
|
412
|
+
], ut = (e) => {
|
|
413
413
|
const {
|
|
414
414
|
onRowAction: t,
|
|
415
|
-
gridRef:
|
|
416
|
-
dataItems:
|
|
417
|
-
ignoreSelectors:
|
|
418
|
-
shouldIgnoreTarget:
|
|
419
|
-
enableKeyboardAction:
|
|
420
|
-
} = e,
|
|
421
|
-
...
|
|
422
|
-
...
|
|
423
|
-
],
|
|
415
|
+
gridRef: r,
|
|
416
|
+
dataItems: g,
|
|
417
|
+
ignoreSelectors: f = [],
|
|
418
|
+
shouldIgnoreTarget: p,
|
|
419
|
+
enableKeyboardAction: A = !0
|
|
420
|
+
} = e, C = [
|
|
421
|
+
...Ue,
|
|
422
|
+
...f
|
|
423
|
+
], T = (s, l) => {
|
|
424
424
|
if (!s) return !1;
|
|
425
|
-
const
|
|
426
|
-
return s.closest && s.closest(
|
|
427
|
-
},
|
|
425
|
+
const y = C.join(",");
|
|
426
|
+
return s.closest && s.closest(y) ? !0 : p && l ? p(s, l) : !1;
|
|
427
|
+
}, q = (s) => {
|
|
428
428
|
if (typeof window > "u") return !1;
|
|
429
429
|
const l = window.getSelection();
|
|
430
430
|
if (!l || l.isCollapsed || !l.toString().trim())
|
|
431
431
|
return !1;
|
|
432
432
|
if (s && l.anchorNode && l.focusNode) {
|
|
433
|
-
const
|
|
434
|
-
return
|
|
433
|
+
const y = s.closest(".k-table-row") || s.closest(".k-grid") || s, L = l.anchorNode.nodeType === Node.ELEMENT_NODE ? l.anchorNode : l.anchorNode.parentElement, h = l.focusNode.nodeType === Node.ELEMENT_NODE ? l.focusNode : l.focusNode.parentElement, k = !!(L && y.contains(L)), x = !!(h && y.contains(h));
|
|
434
|
+
return k || x;
|
|
435
435
|
}
|
|
436
436
|
return !0;
|
|
437
437
|
};
|
|
@@ -440,10 +440,10 @@ const pt = (e, t) => {
|
|
|
440
440
|
const l = s?.htmlEvent || s?.event || s?.nativeEvent || (s instanceof Event ? s : void 0);
|
|
441
441
|
if (l && l.button !== void 0 && l.button !== 0)
|
|
442
442
|
return;
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
443
|
+
const y = l?.target || s?.target;
|
|
444
|
+
if (y && T(y, l || s) || q(y))
|
|
445
445
|
return;
|
|
446
|
-
const
|
|
446
|
+
const L = {
|
|
447
447
|
dataItem: s.dataItem,
|
|
448
448
|
rowIndex: s.rowIndex,
|
|
449
449
|
field: s.field,
|
|
@@ -454,30 +454,30 @@ const pt = (e, t) => {
|
|
|
454
454
|
metaKey: !!l?.metaKey,
|
|
455
455
|
altKey: !!l?.altKey
|
|
456
456
|
};
|
|
457
|
-
t(s.dataItem,
|
|
457
|
+
t(s.dataItem, L);
|
|
458
458
|
},
|
|
459
459
|
handleRowKeyDown: (s, l) => {
|
|
460
|
-
if (!
|
|
461
|
-
const
|
|
462
|
-
if (!(
|
|
463
|
-
const
|
|
464
|
-
if (!
|
|
465
|
-
const
|
|
460
|
+
if (!A) return;
|
|
461
|
+
const y = s.key || s.code;
|
|
462
|
+
if (!(y === "Enter" || y === "NumpadEnter" || y === " " || y === "Space" || s.code === "Enter" || s.code === "NumpadEnter" || s.code === "Space")) return;
|
|
463
|
+
const h = s.target;
|
|
464
|
+
if (!h) return;
|
|
465
|
+
const k = h.closest(
|
|
466
466
|
".k-table-row[data-grid-row-index], .k-table-row"
|
|
467
467
|
);
|
|
468
|
-
if (!
|
|
468
|
+
if (!k || T(h, s))
|
|
469
469
|
return;
|
|
470
470
|
s.preventDefault(), s.stopPropagation();
|
|
471
|
-
const
|
|
471
|
+
const x = k.getAttribute("data-grid-row-index"), V = x !== null ? parseInt(x, 10) : void 0;
|
|
472
472
|
let Y = l;
|
|
473
473
|
if (Y === void 0) {
|
|
474
|
-
const Q = (Array.isArray(
|
|
475
|
-
Q &&
|
|
474
|
+
const Q = (Array.isArray(g) ? g : g?.value) || r?.value?.props?.dataItems || r?.value?.dataItems;
|
|
475
|
+
Q && V !== void 0 && V >= 0 && V < Q.length && (Y = Q[V]);
|
|
476
476
|
}
|
|
477
477
|
if (Y === void 0) return;
|
|
478
|
-
const
|
|
478
|
+
const _ = {
|
|
479
479
|
dataItem: Y,
|
|
480
|
-
rowIndex:
|
|
480
|
+
rowIndex: V,
|
|
481
481
|
event: s,
|
|
482
482
|
triggerType: "keyboard",
|
|
483
483
|
ctrlKey: !!s.ctrlKey,
|
|
@@ -485,117 +485,117 @@ const pt = (e, t) => {
|
|
|
485
485
|
metaKey: !!s.metaKey,
|
|
486
486
|
altKey: !!s.altKey
|
|
487
487
|
};
|
|
488
|
-
t(Y,
|
|
488
|
+
t(Y, _);
|
|
489
489
|
},
|
|
490
|
-
isIgnoredTarget:
|
|
490
|
+
isIgnoredTarget: T
|
|
491
491
|
};
|
|
492
|
-
},
|
|
492
|
+
}, Be = "Enter a valid ZIP code with exactly 5 or 9 digits.", Ce = (e) => {
|
|
493
493
|
const t = e.replace(/\D/g, "").slice(0, 9);
|
|
494
494
|
return t.length > 5 ? `${t.slice(0, 5)}-${t.slice(5)}` : t;
|
|
495
|
-
},
|
|
496
|
-
const t = U(Ce(e.initialValue ?? "")),
|
|
497
|
-
e.errorMessage?.trim() ||
|
|
498
|
-
),
|
|
499
|
-
const l =
|
|
495
|
+
}, ze = (e, t) => e.slice(0, Math.max(0, t)).replace(/\D/g, "").length, He = (e) => e <= 5 ? e : Math.min(e + 1, 10), Ze = (e) => {
|
|
496
|
+
const t = U(Ce(e.initialValue ?? "")), r = U(!1), g = U(
|
|
497
|
+
e.errorMessage?.trim() || Be
|
|
498
|
+
), f = v(() => t.value.replace(/\D/g, "")), p = v(() => {
|
|
499
|
+
const l = f.value.length;
|
|
500
500
|
return l === 5 || l === 9;
|
|
501
|
-
}),
|
|
502
|
-
const
|
|
501
|
+
}), A = v(() => r.value && !p.value), C = v(() => !r.value || p.value), T = v(() => r.value), q = (l, y) => {
|
|
502
|
+
const L = He(y);
|
|
503
503
|
B(() => {
|
|
504
|
-
l.isConnected && l.setSelectionRange(
|
|
504
|
+
l.isConnected && l.setSelectionRange(L, L);
|
|
505
505
|
});
|
|
506
506
|
};
|
|
507
507
|
return {
|
|
508
508
|
// writable state
|
|
509
509
|
zipDisplay: t,
|
|
510
|
-
submitted:
|
|
511
|
-
errorMessage:
|
|
510
|
+
submitted: r,
|
|
511
|
+
errorMessage: g,
|
|
512
512
|
// bindings
|
|
513
513
|
wrapperClass: "fk-zip-textbox",
|
|
514
514
|
// derived state
|
|
515
|
-
zipRaw:
|
|
516
|
-
isZipValid:
|
|
517
|
-
showZipError:
|
|
518
|
-
textBoxValid:
|
|
519
|
-
textBoxValidate:
|
|
515
|
+
zipRaw: f,
|
|
516
|
+
isZipValid: p,
|
|
517
|
+
showZipError: A,
|
|
518
|
+
textBoxValid: C,
|
|
519
|
+
textBoxValidate: T,
|
|
520
520
|
// actions
|
|
521
521
|
handleZipInput: (...l) => {
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
) :
|
|
526
|
-
t.value = Ce(
|
|
522
|
+
const y = l[0], h = y?.event?.target, k = y?.value, x = Array.isArray(k) ? k.join("") : String(k ?? ""), V = h?.selectionStart !== void 0 && h.selectionStart !== null ? ze(
|
|
523
|
+
h.value,
|
|
524
|
+
h.selectionStart
|
|
525
|
+
) : x.replace(/\D/g, "").length;
|
|
526
|
+
t.value = Ce(x), h && q(h, V);
|
|
527
527
|
},
|
|
528
528
|
submitAndValidate: (l) => {
|
|
529
|
-
|
|
530
|
-
const
|
|
531
|
-
return !
|
|
529
|
+
r.value = !0;
|
|
530
|
+
const y = p.value;
|
|
531
|
+
return !y && l?.focus && B(() => {
|
|
532
532
|
document.getElementById(
|
|
533
533
|
e.id
|
|
534
534
|
)?.focus();
|
|
535
|
-
}),
|
|
535
|
+
}), y;
|
|
536
536
|
},
|
|
537
|
-
buildPayload: () => ({ zip:
|
|
537
|
+
buildPayload: () => ({ zip: f.value })
|
|
538
538
|
};
|
|
539
539
|
};
|
|
540
|
-
function
|
|
541
|
-
const
|
|
542
|
-
|
|
540
|
+
function Ye(e, t) {
|
|
541
|
+
const r = U(!1);
|
|
542
|
+
Te(() => {
|
|
543
543
|
e.value?.setAttribute("aria-invalid", String(!t.isValid()));
|
|
544
544
|
});
|
|
545
|
-
function
|
|
546
|
-
const
|
|
547
|
-
(!
|
|
545
|
+
function g(p) {
|
|
546
|
+
const A = e.value ?? p.currentTarget, C = p.relatedTarget;
|
|
547
|
+
(!A || !A.contains(C)) && (r.value = !0);
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
|
|
549
|
+
function f() {
|
|
550
|
+
r.value = !1;
|
|
551
551
|
}
|
|
552
|
-
return { touched:
|
|
552
|
+
return { touched: r, onFocusout: g, reset: f };
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
const
|
|
556
|
-
() => oe(t.submitted) ||
|
|
557
|
-
),
|
|
558
|
-
isValid: () =>
|
|
554
|
+
function We(e, t) {
|
|
555
|
+
const r = U(!1), g = U(!1), f = v(
|
|
556
|
+
() => oe(t.submitted) || r.value
|
|
557
|
+
), p = v(() => !f.value || t.isValid()), A = Ye(e, {
|
|
558
|
+
isValid: () => p.value
|
|
559
559
|
});
|
|
560
|
-
function
|
|
561
|
-
return v(() => !
|
|
560
|
+
function C(s) {
|
|
561
|
+
return v(() => !f.value || oe(s));
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function T(s) {
|
|
564
564
|
return Object.fromEntries(
|
|
565
|
-
Object.entries(s).map(([l,
|
|
565
|
+
Object.entries(s).map(([l, y]) => [
|
|
566
566
|
l,
|
|
567
|
-
|
|
567
|
+
C(y)
|
|
568
568
|
])
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function q(s) {
|
|
572
572
|
const l = oe(s);
|
|
573
573
|
if (!l) return;
|
|
574
574
|
l.querySelector(
|
|
575
575
|
'.k-invalid input, .k-invalid[tabindex="0"]'
|
|
576
576
|
)?.focus();
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
if (
|
|
580
|
-
|
|
578
|
+
function D(s) {
|
|
579
|
+
if (g.value) {
|
|
580
|
+
g.value = !1;
|
|
581
581
|
return;
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
A.onFocusout(s), A.touched.value && (r.value = !0);
|
|
584
584
|
}
|
|
585
585
|
function $() {
|
|
586
|
-
|
|
586
|
+
r.value = !1, g.value = !0, A.reset();
|
|
587
587
|
}
|
|
588
588
|
return {
|
|
589
|
-
touched:
|
|
590
|
-
fieldsetValidate:
|
|
591
|
-
onFocusout:
|
|
589
|
+
touched: r,
|
|
590
|
+
fieldsetValidate: f,
|
|
591
|
+
onFocusout: D,
|
|
592
592
|
reset: $,
|
|
593
|
-
createFieldValidity:
|
|
594
|
-
createFieldValidationsMap:
|
|
595
|
-
focusFirstInvalidField:
|
|
593
|
+
createFieldValidity: C,
|
|
594
|
+
createFieldValidationsMap: T,
|
|
595
|
+
focusFirstInvalidField: q
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
const
|
|
598
|
+
const Ge = [
|
|
599
599
|
{ label: "Alabama", value: "AL" },
|
|
600
600
|
{ label: "Alaska", value: "AK" },
|
|
601
601
|
{ label: "Arizona", value: "AZ" },
|
|
@@ -654,8 +654,8 @@ function De(e) {
|
|
|
654
654
|
}
|
|
655
655
|
return "";
|
|
656
656
|
}
|
|
657
|
-
function
|
|
658
|
-
const e =
|
|
657
|
+
function je() {
|
|
658
|
+
const e = Ve({
|
|
659
659
|
address1: "",
|
|
660
660
|
address2: "",
|
|
661
661
|
city: "",
|
|
@@ -664,373 +664,348 @@ function Qe() {
|
|
|
664
664
|
});
|
|
665
665
|
return {
|
|
666
666
|
formData: e,
|
|
667
|
-
onAddress1Input: (...
|
|
668
|
-
e.address1 = De(
|
|
667
|
+
onAddress1Input: (...A) => {
|
|
668
|
+
e.address1 = De(A[0]);
|
|
669
669
|
},
|
|
670
|
-
onAddress2Input: (...
|
|
671
|
-
e.address2 = De(
|
|
670
|
+
onAddress2Input: (...A) => {
|
|
671
|
+
e.address2 = De(A[0]);
|
|
672
672
|
},
|
|
673
|
-
onCityInput: (...
|
|
674
|
-
e.city = De(
|
|
673
|
+
onCityInput: (...A) => {
|
|
674
|
+
e.city = De(A[0]);
|
|
675
675
|
},
|
|
676
|
-
onStateChange: (
|
|
677
|
-
e.state =
|
|
676
|
+
onStateChange: (A) => {
|
|
677
|
+
e.state = A.value;
|
|
678
678
|
},
|
|
679
679
|
resetFormData: () => {
|
|
680
680
|
e.address1 = "", e.address2 = "", e.city = "", e.state = null, e.zip = "";
|
|
681
681
|
}
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
|
-
function
|
|
685
|
-
const
|
|
686
|
-
zipDisplay:
|
|
687
|
-
zipRaw:
|
|
688
|
-
isZipValid:
|
|
689
|
-
wrapperClass:
|
|
690
|
-
handleZipInput:
|
|
691
|
-
} =
|
|
692
|
-
return ue(
|
|
693
|
-
e.zip =
|
|
684
|
+
function _e(e, t = "zip") {
|
|
685
|
+
const r = Ze({ id: t }), {
|
|
686
|
+
zipDisplay: g,
|
|
687
|
+
zipRaw: f,
|
|
688
|
+
isZipValid: p,
|
|
689
|
+
wrapperClass: A,
|
|
690
|
+
handleZipInput: C
|
|
691
|
+
} = r;
|
|
692
|
+
return ue(f, (q) => {
|
|
693
|
+
e.zip = q;
|
|
694
694
|
}), {
|
|
695
|
-
zipDisplay:
|
|
696
|
-
isZipValid:
|
|
697
|
-
zipWrapperClass:
|
|
698
|
-
onZipInput:
|
|
695
|
+
zipDisplay: g,
|
|
696
|
+
isZipValid: p,
|
|
697
|
+
zipWrapperClass: A,
|
|
698
|
+
onZipInput: C,
|
|
699
699
|
resetZip: () => {
|
|
700
|
-
|
|
700
|
+
g.value = "", e.zip = "";
|
|
701
701
|
}
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function Je(e) {
|
|
705
705
|
const t = v(
|
|
706
706
|
() => e.formData.address1.trim() !== ""
|
|
707
|
-
),
|
|
708
|
-
() => t.value &&
|
|
707
|
+
), r = v(() => e.formData.city.trim() !== ""), g = v(() => !!e.formData.state), f = v(() => oe(e.isZipValid)), p = v(
|
|
708
|
+
() => t.value && r.value && g.value && f.value
|
|
709
709
|
);
|
|
710
710
|
return {
|
|
711
711
|
strictAddress1Valid: t,
|
|
712
|
-
strictCityValid:
|
|
713
|
-
strictStateValid:
|
|
714
|
-
strictZipValid:
|
|
715
|
-
strictAddressValid:
|
|
712
|
+
strictCityValid: r,
|
|
713
|
+
strictStateValid: g,
|
|
714
|
+
strictZipValid: f,
|
|
715
|
+
strictAddressValid: p
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Xe(e) {
|
|
719
719
|
if (!e) return;
|
|
720
720
|
e.querySelector(
|
|
721
721
|
'.k-invalid input, .k-invalid[tabindex="0"]'
|
|
722
722
|
)?.focus();
|
|
723
723
|
}
|
|
724
|
-
function
|
|
725
|
-
const
|
|
726
|
-
return !
|
|
724
|
+
function Qe(e, t) {
|
|
725
|
+
const r = e ?? t.currentTarget, g = t.relatedTarget;
|
|
726
|
+
return !r || !r.contains(g);
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function ct(e) {
|
|
729
729
|
const t = U(
|
|
730
730
|
oe(e.fieldsetRef)
|
|
731
731
|
);
|
|
732
|
-
|
|
732
|
+
Te(() => {
|
|
733
733
|
t.value = oe(e.fieldsetRef);
|
|
734
734
|
});
|
|
735
|
-
const
|
|
736
|
-
formData:
|
|
737
|
-
onAddress1Input:
|
|
738
|
-
onAddress2Input:
|
|
739
|
-
onCityInput:
|
|
740
|
-
onStateChange:
|
|
741
|
-
resetFormData:
|
|
742
|
-
} =
|
|
743
|
-
strictAddress1Valid:
|
|
744
|
-
strictCityValid:
|
|
745
|
-
strictStateValid:
|
|
735
|
+
const r = U(!1), g = U(!1), f = v(() => oe(e.required) ?? !0), {
|
|
736
|
+
formData: p,
|
|
737
|
+
onAddress1Input: A,
|
|
738
|
+
onAddress2Input: C,
|
|
739
|
+
onCityInput: T,
|
|
740
|
+
onStateChange: q,
|
|
741
|
+
resetFormData: D
|
|
742
|
+
} = je(), $ = `${e.addressId}-zip`, { zipDisplay: s, isZipValid: l, zipWrapperClass: y, onZipInput: L, resetZip: h } = _e(p, $), {
|
|
743
|
+
strictAddress1Valid: k,
|
|
744
|
+
strictCityValid: x,
|
|
745
|
+
strictStateValid: V,
|
|
746
746
|
strictZipValid: Y,
|
|
747
|
-
strictAddressValid:
|
|
748
|
-
} =
|
|
749
|
-
formData:
|
|
747
|
+
strictAddressValid: _
|
|
748
|
+
} = Je({
|
|
749
|
+
formData: p,
|
|
750
750
|
isZipValid: l
|
|
751
|
-
}), Q =
|
|
752
|
-
submitted:
|
|
753
|
-
isValid: () =>
|
|
754
|
-
}), { touched: le, fieldsetValidate: i, onFocusout:
|
|
755
|
-
address1:
|
|
756
|
-
city:
|
|
757
|
-
state:
|
|
751
|
+
}), Q = We(t, {
|
|
752
|
+
submitted: r,
|
|
753
|
+
isValid: () => _.value
|
|
754
|
+
}), { touched: le, fieldsetValidate: i, onFocusout: w, reset: d } = Q, b = Q.createFieldValidationsMap({
|
|
755
|
+
address1: k,
|
|
756
|
+
city: x,
|
|
757
|
+
state: V,
|
|
758
758
|
zip: Y,
|
|
759
|
-
address:
|
|
759
|
+
address: _
|
|
760
760
|
}), {
|
|
761
|
-
address1:
|
|
762
|
-
city:
|
|
763
|
-
state:
|
|
764
|
-
zip:
|
|
761
|
+
address1: I,
|
|
762
|
+
city: S,
|
|
763
|
+
state: M,
|
|
764
|
+
zip: K,
|
|
765
765
|
address: W
|
|
766
|
-
} =
|
|
767
|
-
() =>
|
|
766
|
+
} = b, ae = v(
|
|
767
|
+
() => f.value ? i.value : !1
|
|
768
768
|
), se = v(
|
|
769
|
-
() =>
|
|
769
|
+
() => f.value ? I.value : !0
|
|
770
770
|
), a = v(
|
|
771
|
-
() =>
|
|
772
|
-
),
|
|
773
|
-
() =>
|
|
771
|
+
() => f.value ? S.value : !0
|
|
772
|
+
), m = v(
|
|
773
|
+
() => f.value ? M.value : !0
|
|
774
774
|
), R = v(
|
|
775
|
-
() =>
|
|
775
|
+
() => f.value ? K.value : !0
|
|
776
776
|
), z = v(
|
|
777
|
-
() =>
|
|
778
|
-
), H = { value: null, label: "State" },
|
|
777
|
+
() => f.value ? W.value : !0
|
|
778
|
+
), H = { value: null, label: "State" }, G = Ge.map(({ label: c, value: E }) => ({
|
|
779
779
|
label: c,
|
|
780
|
-
value:
|
|
780
|
+
value: E
|
|
781
781
|
})), n = v(() => ({
|
|
782
|
-
address1:
|
|
783
|
-
address2:
|
|
784
|
-
city:
|
|
785
|
-
state: (
|
|
786
|
-
zip:
|
|
787
|
-
})), u = v(() =>
|
|
788
|
-
const c =
|
|
789
|
-
return !
|
|
790
|
-
}), ee = v(() => !
|
|
782
|
+
address1: p.address1.trim(),
|
|
783
|
+
address2: p.address2.trim(),
|
|
784
|
+
city: p.city.trim(),
|
|
785
|
+
state: (p.state ?? "").trim().toUpperCase(),
|
|
786
|
+
zip: p.zip.replace(/\D/g, "")
|
|
787
|
+
})), u = v(() => p.address1.trim() === "" && p.address2.trim() === "" && p.city.trim() === "" && (p.state ?? "").trim() === "" && p.zip.replace(/\D/g, "") === ""), F = v(() => !u.value), N = v(() => !f.value && F.value && (!k.value || !x.value || !V.value)), j = v(() => {
|
|
788
|
+
const c = p.zip.replace(/\D/g, "");
|
|
789
|
+
return !f.value && F.value && c.length !== 5 && c.length !== 9;
|
|
790
|
+
}), ee = v(() => !f.value && F.value && !_.value), O = v(() => !f.value && ee.value && (g.value || r.value));
|
|
791
791
|
return ue(n, () => {
|
|
792
|
-
|
|
793
|
-
}), ue(
|
|
794
|
-
c || (
|
|
792
|
+
f.value || (g.value = !1);
|
|
793
|
+
}), ue(f, (c) => {
|
|
794
|
+
c || (r.value = !1, g.value = !1, d());
|
|
795
795
|
}), {
|
|
796
|
-
formData:
|
|
797
|
-
submitted:
|
|
796
|
+
formData: p,
|
|
797
|
+
submitted: r,
|
|
798
798
|
touched: le,
|
|
799
799
|
addressValidate: ae,
|
|
800
800
|
address1Valid: se,
|
|
801
801
|
cityValid: a,
|
|
802
|
-
stateValid:
|
|
802
|
+
stateValid: m,
|
|
803
803
|
zipValid: R,
|
|
804
804
|
addressValid: z,
|
|
805
805
|
optionalFeedbackActive: O,
|
|
806
806
|
optionalPartialInvalid: ee,
|
|
807
807
|
optionalMissingRequiredFields: N,
|
|
808
|
-
optionalZipInvalid:
|
|
808
|
+
optionalZipInvalid: j,
|
|
809
809
|
stateDefaultItem: H,
|
|
810
|
-
stateOptions:
|
|
810
|
+
stateOptions: G,
|
|
811
811
|
zipDisplay: s,
|
|
812
|
-
zipWrapperClass:
|
|
813
|
-
onAddress1Input:
|
|
814
|
-
onAddress2Input:
|
|
815
|
-
onCityInput:
|
|
816
|
-
onStateChange:
|
|
817
|
-
onZipInput:
|
|
812
|
+
zipWrapperClass: y,
|
|
813
|
+
onAddress1Input: A,
|
|
814
|
+
onAddress2Input: C,
|
|
815
|
+
onCityInput: T,
|
|
816
|
+
onStateChange: q,
|
|
817
|
+
onZipInput: L,
|
|
818
818
|
onFieldsetFocusout: (c) => {
|
|
819
|
-
const
|
|
820
|
-
|
|
819
|
+
const E = Qe(t.value, c);
|
|
820
|
+
w(c), !f.value && E && (g.value = !0);
|
|
821
821
|
},
|
|
822
822
|
normalizedPayload: n,
|
|
823
|
-
validateForSubmit: async () =>
|
|
823
|
+
validateForSubmit: async () => f.value ? (r.value = !0, _.value ? {
|
|
824
824
|
isValid: !0,
|
|
825
825
|
payload: n.value
|
|
826
|
-
} : (await B(),
|
|
826
|
+
} : (await B(), Xe(t.value), { isValid: !1, payload: null })) : u.value || _.value ? (r.value = !1, {
|
|
827
827
|
isValid: !0,
|
|
828
828
|
payload: n.value
|
|
829
|
-
}) : (
|
|
829
|
+
}) : (r.value = !0, { isValid: !1, payload: null }),
|
|
830
830
|
reset: () => {
|
|
831
|
-
|
|
831
|
+
r.value = !1, g.value = !1, d(), D(), h();
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
834
|
}
|
|
835
|
-
|
|
836
|
-
return qe() ? (Ne(e), !0) : !1;
|
|
837
|
-
}
|
|
838
|
-
const Re = typeof window < "u" && typeof document < "u";
|
|
835
|
+
const et = typeof window < "u" && typeof document < "u";
|
|
839
836
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
840
|
-
const
|
|
841
|
-
}
|
|
842
|
-
function st() {
|
|
843
|
-
var e, t;
|
|
844
|
-
return Re && ((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));
|
|
845
|
-
}
|
|
837
|
+
const tt = Object.prototype.toString, nt = (e) => tt.call(e) === "[object Object]", Se = () => {
|
|
838
|
+
};
|
|
846
839
|
function Ee(e) {
|
|
847
840
|
return Array.isArray(e) ? e : [e];
|
|
848
841
|
}
|
|
849
|
-
function
|
|
850
|
-
return ue(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
...o,
|
|
855
|
-
immediate: !0
|
|
856
|
-
}
|
|
857
|
-
);
|
|
842
|
+
function at(e, t, r) {
|
|
843
|
+
return ue(e, t, {
|
|
844
|
+
...r,
|
|
845
|
+
immediate: !0
|
|
846
|
+
});
|
|
858
847
|
}
|
|
859
|
-
const
|
|
860
|
-
function
|
|
848
|
+
const Re = et ? window : void 0;
|
|
849
|
+
function he(e) {
|
|
861
850
|
var t;
|
|
862
|
-
const
|
|
863
|
-
return (t =
|
|
851
|
+
const r = oe(e);
|
|
852
|
+
return (t = r?.$el) !== null && t !== void 0 ? t : r;
|
|
864
853
|
}
|
|
865
854
|
function Ie(...e) {
|
|
866
|
-
const t =
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
const $ = lt(w) ? { ...w } : w;
|
|
886
|
-
t.push(
|
|
887
|
-
...S.flatMap(
|
|
888
|
-
(s) => E.flatMap(
|
|
889
|
-
(l) => F.map((p) => k(s, l, p, $))
|
|
890
|
-
)
|
|
891
|
-
)
|
|
892
|
-
);
|
|
893
|
-
},
|
|
894
|
-
{ flush: "post" }
|
|
895
|
-
), x = () => {
|
|
896
|
-
y(), o();
|
|
897
|
-
};
|
|
898
|
-
return rt(o), x;
|
|
855
|
+
const t = (g, f, p, A) => (g.addEventListener(f, p, A), () => g.removeEventListener(f, p, A)), r = v(() => {
|
|
856
|
+
const g = Ee(oe(e[0])).filter((f) => f != null);
|
|
857
|
+
return g.every((f) => typeof f != "string") ? g : void 0;
|
|
858
|
+
});
|
|
859
|
+
return at(() => {
|
|
860
|
+
var g, f;
|
|
861
|
+
return [
|
|
862
|
+
(g = (f = r.value) === null || f === void 0 ? void 0 : f.map((p) => he(p))) !== null && g !== void 0 ? g : [Re].filter((p) => p != null),
|
|
863
|
+
Ee(oe(r.value ? e[1] : e[0])),
|
|
864
|
+
Ee(Le(r.value ? e[2] : e[1])),
|
|
865
|
+
oe(r.value ? e[3] : e[2])
|
|
866
|
+
];
|
|
867
|
+
}, ([g, f, p, A], C, T) => {
|
|
868
|
+
if (!g?.length || !f?.length || !p?.length) return;
|
|
869
|
+
const q = nt(A) ? { ...A } : A, D = g.flatMap(($) => f.flatMap((s) => p.map((l) => t($, s, l, q))));
|
|
870
|
+
T(() => {
|
|
871
|
+
D.forEach(($) => $());
|
|
872
|
+
});
|
|
873
|
+
}, { flush: "post" });
|
|
899
874
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
let E = !0;
|
|
911
|
-
const F = (m) => oe(h).some((A) => {
|
|
912
|
-
if (typeof A == "string")
|
|
913
|
-
return Array.from(k.document.querySelectorAll(A)).some((P) => P === m.target || m.composedPath().includes(P));
|
|
875
|
+
function $e(e, t, r = {}) {
|
|
876
|
+
const { window: g = Re, ignore: f = [], capture: p = !0, detectIframe: A = !1, controls: C = !1 } = r;
|
|
877
|
+
if (!g) return C ? {
|
|
878
|
+
stop: Se,
|
|
879
|
+
cancel: Se,
|
|
880
|
+
trigger: Se
|
|
881
|
+
} : Se;
|
|
882
|
+
let T = !0;
|
|
883
|
+
const q = (h) => oe(f).some((k) => {
|
|
884
|
+
if (typeof k == "string") return Array.from(g.document.querySelectorAll(k)).some((x) => x === h.target || h.composedPath().includes(x));
|
|
914
885
|
{
|
|
915
|
-
const
|
|
916
|
-
return
|
|
886
|
+
const x = he(k);
|
|
887
|
+
return x && (h.target === x || h.composedPath().includes(x));
|
|
917
888
|
}
|
|
918
889
|
});
|
|
919
|
-
function
|
|
920
|
-
const
|
|
921
|
-
return
|
|
890
|
+
function D(h) {
|
|
891
|
+
const k = oe(h);
|
|
892
|
+
return k && k.$.subTree.shapeFlag === 16;
|
|
922
893
|
}
|
|
923
|
-
function $(
|
|
924
|
-
const
|
|
925
|
-
return
|
|
894
|
+
function $(h, k) {
|
|
895
|
+
const x = oe(h), V = x.$.subTree && x.$.subTree.children;
|
|
896
|
+
return V == null || !Array.isArray(V) ? !1 : V.some((Y) => Y.el === k.target || k.composedPath().includes(Y.el));
|
|
926
897
|
}
|
|
927
|
-
const s = (
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
if ("detail" in
|
|
931
|
-
|
|
898
|
+
const s = (h) => {
|
|
899
|
+
const k = he(e);
|
|
900
|
+
if (h.target != null && !(!(k instanceof Element) && D(e) && $(e, h)) && !(!k || k === h.target || h.composedPath().includes(k))) {
|
|
901
|
+
if ("detail" in h && h.detail === 0 && (T = !q(h)), !T) {
|
|
902
|
+
T = !0;
|
|
932
903
|
return;
|
|
933
904
|
}
|
|
934
|
-
t(
|
|
905
|
+
t(h);
|
|
935
906
|
}
|
|
936
907
|
};
|
|
937
908
|
let l = !1;
|
|
938
|
-
const
|
|
939
|
-
Ie(
|
|
909
|
+
const y = [
|
|
910
|
+
Ie(g, "click", (h) => {
|
|
940
911
|
l || (l = !0, setTimeout(() => {
|
|
941
912
|
l = !1;
|
|
942
|
-
}, 0), s(
|
|
943
|
-
}, {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
913
|
+
}, 0), s(h));
|
|
914
|
+
}, {
|
|
915
|
+
passive: !0,
|
|
916
|
+
capture: p
|
|
917
|
+
}),
|
|
918
|
+
Ie(g, "pointerdown", (h) => {
|
|
919
|
+
const k = he(e);
|
|
920
|
+
T = !q(h) && !!(k && !h.composedPath().includes(k));
|
|
947
921
|
}, { passive: !0 }),
|
|
948
|
-
|
|
922
|
+
A && Ie(g, "blur", (h) => {
|
|
949
923
|
setTimeout(() => {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
(
|
|
924
|
+
const k = he(e);
|
|
925
|
+
let x = g.document.activeElement;
|
|
926
|
+
for (; x?.shadowRoot; ) x = x.shadowRoot.activeElement;
|
|
927
|
+
x?.tagName === "IFRAME" && !k?.contains(g.document.activeElement) && t(h);
|
|
953
928
|
}, 0);
|
|
954
929
|
}, { passive: !0 })
|
|
955
|
-
].filter(Boolean),
|
|
956
|
-
return
|
|
957
|
-
stop:
|
|
930
|
+
].filter(Boolean), L = () => y.forEach((h) => h());
|
|
931
|
+
return C ? {
|
|
932
|
+
stop: L,
|
|
958
933
|
cancel: () => {
|
|
959
|
-
|
|
934
|
+
T = !1;
|
|
960
935
|
},
|
|
961
|
-
trigger: (
|
|
962
|
-
|
|
936
|
+
trigger: (h) => {
|
|
937
|
+
T = !0, s(h), T = !1;
|
|
963
938
|
}
|
|
964
|
-
} :
|
|
939
|
+
} : L;
|
|
965
940
|
}
|
|
966
941
|
const xe = (e) => {
|
|
967
942
|
if (e instanceof HTMLElement) return e;
|
|
968
943
|
const t = e?.$el;
|
|
969
944
|
return t instanceof HTMLElement ? t : null;
|
|
970
|
-
},
|
|
971
|
-
const t = U(null),
|
|
972
|
-
const l =
|
|
945
|
+
}, rt = (e) => e instanceof HTMLButtonElement || e.getAttribute("role") === "button" || e.hasAttribute("aria-haspopup"), dt = (e) => {
|
|
946
|
+
const t = U(null), r = e.menuItemSelector ?? ".k-menu-item:not(.k-disabled)", g = () => xe(e.triggerRef.value), f = () => e.resolveFocusTarget?.() ?? xe(e.focusTargetRef?.value), p = () => {
|
|
947
|
+
const l = f();
|
|
973
948
|
if (l)
|
|
974
949
|
return l.focus(), !0;
|
|
975
|
-
const
|
|
976
|
-
return
|
|
977
|
-
},
|
|
978
|
-
xe(e.menuRef.value)?.querySelector(
|
|
979
|
-
},
|
|
950
|
+
const y = g();
|
|
951
|
+
return y?.focus(), !!y;
|
|
952
|
+
}, A = () => {
|
|
953
|
+
xe(e.menuRef.value)?.querySelector(r)?.focus();
|
|
954
|
+
}, C = (l) => {
|
|
980
955
|
e.isOpen.value && (t.value = l, e.requestHide());
|
|
981
956
|
};
|
|
982
|
-
|
|
957
|
+
$e(e.menuRef, () => C("outside-click"), {
|
|
983
958
|
ignore: [e.triggerRef]
|
|
984
959
|
}), e.manageAriaExpanded !== !1 && ue(
|
|
985
960
|
[e.isOpen, e.triggerRef],
|
|
986
961
|
([l]) => {
|
|
987
|
-
const
|
|
988
|
-
!
|
|
962
|
+
const y = g();
|
|
963
|
+
!y || !rt(y) || y.setAttribute("aria-expanded", l ? "true" : "false");
|
|
989
964
|
},
|
|
990
965
|
{ immediate: !0, flush: "post" }
|
|
991
966
|
);
|
|
992
|
-
const
|
|
967
|
+
const T = () => {
|
|
993
968
|
if (e.isOpen.value) {
|
|
994
|
-
|
|
969
|
+
C("trigger-click");
|
|
995
970
|
return;
|
|
996
971
|
}
|
|
997
|
-
e.requestShow(), B(
|
|
972
|
+
e.requestShow(), B(A);
|
|
998
973
|
};
|
|
999
974
|
return {
|
|
1000
975
|
/**
|
|
1001
976
|
* Handles Kendo Menu selection: records keyboard or mouse modality,
|
|
1002
977
|
* requests popup close, then runs the optional caller-owned action.
|
|
1003
978
|
*/
|
|
1004
|
-
handleMenuSelect: (l,
|
|
1005
|
-
|
|
979
|
+
handleMenuSelect: (l, y) => {
|
|
980
|
+
C(
|
|
1006
981
|
l.event?.type?.startsWith("key") ? "keyboard" : "mouse-selection"
|
|
1007
|
-
),
|
|
982
|
+
), y?.(l);
|
|
1008
983
|
},
|
|
1009
984
|
/**
|
|
1010
985
|
* Toggles the action menu. When opening, focuses the first enabled Kendo
|
|
1011
986
|
* Menu item after Vue renders the popup.
|
|
1012
987
|
*/
|
|
1013
|
-
handleActionButtonClick:
|
|
988
|
+
handleActionButtonClick: T,
|
|
1014
989
|
/**
|
|
1015
990
|
* Handles trigger keyboard input: Enter and Space toggle the menu; Escape
|
|
1016
991
|
* closes an open menu or focuses the configured target when already closed.
|
|
1017
992
|
*/
|
|
1018
993
|
handleActionButtonKeydown: (l) => {
|
|
1019
994
|
if (l.key === "Enter" || l.code === "Space") {
|
|
1020
|
-
l.preventDefault(),
|
|
995
|
+
l.preventDefault(), T();
|
|
1021
996
|
return;
|
|
1022
997
|
}
|
|
1023
998
|
if (l.key === "Escape") {
|
|
1024
999
|
if (l.preventDefault(), l.stopPropagation(), e.isOpen.value) {
|
|
1025
|
-
|
|
1000
|
+
C("keyboard");
|
|
1026
1001
|
return;
|
|
1027
1002
|
}
|
|
1028
|
-
|
|
1003
|
+
p();
|
|
1029
1004
|
}
|
|
1030
1005
|
},
|
|
1031
1006
|
/** Closes the open menu through the keyboard path when Escape is pressed inside it. */
|
|
1032
1007
|
handleActionMenuEscape: (l) => {
|
|
1033
|
-
l.preventDefault(), l.stopPropagation(),
|
|
1008
|
+
l.preventDefault(), l.stopPropagation(), C("keyboard");
|
|
1034
1009
|
},
|
|
1035
1010
|
/**
|
|
1036
1011
|
* Restores focus after Kendo Popup closes: keyboard closes prefer the
|
|
@@ -1039,92 +1014,92 @@ const xe = (e) => {
|
|
|
1039
1014
|
*/
|
|
1040
1015
|
handlePopupClose: () => {
|
|
1041
1016
|
B(() => {
|
|
1042
|
-
t.value === "keyboard" ?
|
|
1017
|
+
t.value === "keyboard" ? p() : t.value === "mouse-selection" && g()?.focus(), t.value = null;
|
|
1043
1018
|
});
|
|
1044
1019
|
}
|
|
1045
1020
|
};
|
|
1046
1021
|
};
|
|
1047
|
-
function
|
|
1048
|
-
const t = U(""),
|
|
1022
|
+
function ft(e) {
|
|
1023
|
+
const t = U(""), r = U(void 0), g = U(!!e.debug), f = U(e.dateFormat ?? "mm/dd/yyyy"), p = v(() => !!e.required), A = 1e3, C = U(!1), T = ["ArrowUp", "ArrowDown"], q = ["ArrowLeft", "ArrowRight"], D = v(() => (t.value ?? "").replace(/\D/g, "")), $ = (a) => a <= 2 ? "mm" : a <= 5 ? "dd" : D.value.length <= 10 ? "yyyy" : "mm", s = v(() => {
|
|
1049
1024
|
const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
1050
1025
|
return parseInt(a).toString().padStart(2, "0");
|
|
1051
1026
|
}), l = v(() => {
|
|
1052
1027
|
const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
|
|
1053
1028
|
return parseInt(a).toString().padStart(2, "0");
|
|
1054
|
-
}),
|
|
1029
|
+
}), y = v(() => {
|
|
1055
1030
|
const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
1056
1031
|
return parseInt(a).toString().padStart(4, "0");
|
|
1057
|
-
}),
|
|
1058
|
-
if (
|
|
1032
|
+
}), L = (a) => {
|
|
1033
|
+
if (D.value.length === 0) {
|
|
1059
1034
|
e.onChange({ value: null, event: a });
|
|
1060
1035
|
return;
|
|
1061
1036
|
}
|
|
1062
|
-
if (
|
|
1037
|
+
if (D.value.length < 8) {
|
|
1063
1038
|
e.onChange({ value: null, event: a });
|
|
1064
1039
|
return;
|
|
1065
1040
|
}
|
|
1066
|
-
if ((t.value ?? "").length === 10 &&
|
|
1067
|
-
const [
|
|
1068
|
-
if (
|
|
1069
|
-
const u =
|
|
1070
|
-
|
|
1041
|
+
if ((t.value ?? "").length === 10 && D.value.length === 8) {
|
|
1042
|
+
const [m, R, z] = t.value.split("/"), H = parseInt(m), G = parseInt(R), n = parseInt(z);
|
|
1043
|
+
if (_(n, H, G)) {
|
|
1044
|
+
const u = V(n, H, G);
|
|
1045
|
+
h(u) ? e.onChange({ value: u, event: a }) : e.onChange({ value: null, event: a });
|
|
1071
1046
|
} else
|
|
1072
1047
|
e.onChange({ value: null, event: a });
|
|
1073
1048
|
}
|
|
1074
|
-
},
|
|
1075
|
-
const
|
|
1076
|
-
return !(
|
|
1077
|
-
},
|
|
1078
|
-
if ((t.value ?? "").length === 10 &&
|
|
1079
|
-
const [a,
|
|
1080
|
-
if (
|
|
1081
|
-
return
|
|
1049
|
+
}, h = (a) => {
|
|
1050
|
+
const m = e.min ?? void 0, R = e.max ?? void 0;
|
|
1051
|
+
return !(m && a < m || R && a > R);
|
|
1052
|
+
}, k = v(() => {
|
|
1053
|
+
if ((t.value ?? "").length === 10 && D.value.length === 8) {
|
|
1054
|
+
const [a, m, R] = (t.value ?? "").split("/"), z = parseInt(a), H = parseInt(m), G = parseInt(R);
|
|
1055
|
+
if (_(G, z, H))
|
|
1056
|
+
return V(G, z, H);
|
|
1082
1057
|
}
|
|
1083
1058
|
return null;
|
|
1084
|
-
}),
|
|
1059
|
+
}), x = v(() => (t.value ?? "").length === 10 && D.value.length === 8), V = (a, m, R) => {
|
|
1085
1060
|
const z = /* @__PURE__ */ new Date(0);
|
|
1086
|
-
return z.setFullYear(a,
|
|
1087
|
-
}, Y = (a,
|
|
1061
|
+
return z.setFullYear(a, m - 1, R), z.setHours(0, 0, 0, 0), z;
|
|
1062
|
+
}, Y = (a, m) => V(a, m + 1, 0).getDate(), _ = (a, m, R) => m >= 1 && m <= 12 && a >= A && R >= 1 && R <= Y(a, m), Q = (a) => {
|
|
1088
1063
|
t.value = a.value;
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1064
|
+
const m = a.event?.target;
|
|
1065
|
+
r.value = m?.selectionStart ?? 0, L(a);
|
|
1091
1066
|
}, le = (a) => {
|
|
1092
|
-
|
|
1093
|
-
}, i = (a,
|
|
1094
|
-
const z =
|
|
1095
|
-
|
|
1096
|
-
let H = parseInt(s.value),
|
|
1097
|
-
if (!(
|
|
1067
|
+
r.value = a.target.selectionStart ?? 0;
|
|
1068
|
+
}, i = (a, m, R) => {
|
|
1069
|
+
const z = m?.selectionStart ?? r.value ?? 0;
|
|
1070
|
+
r.value = z;
|
|
1071
|
+
let H = parseInt(s.value), G = parseInt(l.value), n = parseInt(y.value);
|
|
1072
|
+
if (!(D.value.length >= 8) || !_(n, H, G)) {
|
|
1098
1073
|
const Z = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
1099
|
-
H = Z.getMonth() + 1,
|
|
1074
|
+
H = Z.getMonth() + 1, G = Z.getDate(), n = Z.getFullYear(), t.value = `${String(H).padStart(2, "0")}/${String(G).padStart(
|
|
1100
1075
|
2,
|
|
1101
1076
|
"0"
|
|
1102
1077
|
)}/${String(n)}`;
|
|
1103
|
-
const ce =
|
|
1104
|
-
e.onChange({ value:
|
|
1078
|
+
const ce = V(n, H, G);
|
|
1079
|
+
e.onChange({ value: h(ce) ? ce : null, event: R }), S({ useRAF: !0 });
|
|
1105
1080
|
return;
|
|
1106
1081
|
}
|
|
1107
|
-
const
|
|
1108
|
-
if (
|
|
1082
|
+
const F = $(z);
|
|
1083
|
+
if (F === "mm")
|
|
1109
1084
|
H = a === "ArrowUp" ? H < 12 ? H + 1 : 1 : H > 1 ? H - 1 : 12;
|
|
1110
|
-
else if (
|
|
1085
|
+
else if (F === "dd") {
|
|
1111
1086
|
const Z = new Date(n, H, 0).getDate();
|
|
1112
|
-
|
|
1113
|
-
} else
|
|
1114
|
-
t.value = `${String(H).padStart(2, "0")}/${String(
|
|
1087
|
+
G = a === "ArrowUp" ? G < Z ? G + 1 : 1 : G > 1 ? G - 1 : Z;
|
|
1088
|
+
} else F === "yyyy" && (n = a === "ArrowUp" ? n + 1 : Math.max(1, n - 1));
|
|
1089
|
+
t.value = `${String(H).padStart(2, "0")}/${String(G).padStart(
|
|
1115
1090
|
2,
|
|
1116
1091
|
"0"
|
|
1117
1092
|
)}/${String(n)}`;
|
|
1118
|
-
const [N,
|
|
1093
|
+
const [N, j, ee] = t.value.split("/"), O = V(
|
|
1119
1094
|
parseInt(ee),
|
|
1120
1095
|
parseInt(N),
|
|
1121
|
-
parseInt(
|
|
1096
|
+
parseInt(j)
|
|
1122
1097
|
);
|
|
1123
1098
|
O.toString() !== "Invalid Date" && parseInt(ee) >= 1e3 ? e.onChange({
|
|
1124
|
-
value:
|
|
1099
|
+
value: h(O) ? O : null,
|
|
1125
1100
|
event: R
|
|
1126
|
-
}) : e.onChange({ value: null, event: R }),
|
|
1127
|
-
},
|
|
1101
|
+
}) : e.onChange({ value: null, event: R }), S({ useRAF: !0 });
|
|
1102
|
+
}, w = (a) => {
|
|
1128
1103
|
if (a.code === "Space" || a.key === " ") {
|
|
1129
1104
|
a.preventDefault(), a.stopPropagation(), e.onShowCalendar(a);
|
|
1130
1105
|
return;
|
|
@@ -1133,38 +1108,38 @@ function ht(e) {
|
|
|
1133
1108
|
a.preventDefault(), a.stopPropagation(), e.onShowCalendar(a);
|
|
1134
1109
|
return;
|
|
1135
1110
|
}
|
|
1136
|
-
if (
|
|
1111
|
+
if (T.includes(a.key)) {
|
|
1137
1112
|
if (a.altKey) return;
|
|
1138
1113
|
a.preventDefault(), a.stopPropagation();
|
|
1139
|
-
const
|
|
1140
|
-
i(a.key,
|
|
1114
|
+
const m = a.target;
|
|
1115
|
+
i(a.key, m, a);
|
|
1141
1116
|
return;
|
|
1142
1117
|
}
|
|
1143
1118
|
}, d = (a) => {
|
|
1144
1119
|
a.preventDefault();
|
|
1145
|
-
const
|
|
1146
|
-
i(
|
|
1147
|
-
},
|
|
1148
|
-
const
|
|
1149
|
-
if (
|
|
1150
|
-
|
|
1120
|
+
const m = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1121
|
+
i(m, a.target, a);
|
|
1122
|
+
}, b = (a) => {
|
|
1123
|
+
const m = a.target;
|
|
1124
|
+
if (q.includes(a.key)) {
|
|
1125
|
+
r.value = m?.selectionStart ?? 0;
|
|
1151
1126
|
return;
|
|
1152
1127
|
}
|
|
1153
|
-
if (
|
|
1128
|
+
if (T.includes(a.key)) {
|
|
1154
1129
|
if (a.altKey) return;
|
|
1155
|
-
|
|
1130
|
+
r.value = m?.selectionStart ?? 0;
|
|
1156
1131
|
}
|
|
1157
|
-
},
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
},
|
|
1162
|
-
const
|
|
1132
|
+
}, I = (a) => {
|
|
1133
|
+
C.value = !0, p.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && D.value.length === 0 && (e.externalValue.value = "");
|
|
1134
|
+
const m = a.target;
|
|
1135
|
+
m && (r.value = m.selectionStart ?? 0);
|
|
1136
|
+
}, S = (a) => {
|
|
1137
|
+
const m = () => {
|
|
1163
1138
|
const R = document.getElementById(
|
|
1164
1139
|
e.id
|
|
1165
1140
|
);
|
|
1166
1141
|
if (!R) return;
|
|
1167
|
-
const z = a?.pos ??
|
|
1142
|
+
const z = a?.pos ?? r.value ?? R.value.length;
|
|
1168
1143
|
try {
|
|
1169
1144
|
R.focus(), R.setSelectionRange(z, z);
|
|
1170
1145
|
} catch {
|
|
@@ -1172,33 +1147,33 @@ function ht(e) {
|
|
|
1172
1147
|
};
|
|
1173
1148
|
B(() => {
|
|
1174
1149
|
if (a?.delay && a.delay > 0) {
|
|
1175
|
-
setTimeout(
|
|
1150
|
+
setTimeout(m, a.delay);
|
|
1176
1151
|
return;
|
|
1177
1152
|
}
|
|
1178
1153
|
if (a?.useRAF) {
|
|
1179
|
-
requestAnimationFrame(
|
|
1154
|
+
requestAnimationFrame(m);
|
|
1180
1155
|
return;
|
|
1181
1156
|
}
|
|
1182
|
-
|
|
1157
|
+
m();
|
|
1183
1158
|
});
|
|
1184
1159
|
};
|
|
1185
1160
|
e.externalValue && ue(
|
|
1186
1161
|
e.externalValue,
|
|
1187
1162
|
(a) => {
|
|
1188
1163
|
if (a) {
|
|
1189
|
-
const
|
|
1190
|
-
if (
|
|
1191
|
-
const R = (
|
|
1192
|
-
t.value = `${R}/${z}/${H}`,
|
|
1164
|
+
const m = new Date(a);
|
|
1165
|
+
if (m.toString() !== "Invalid Date") {
|
|
1166
|
+
const R = (m.getMonth() + 1).toString().padStart(2, "0"), z = m.getDate().toString().padStart(2, "0"), H = m.getFullYear().toString();
|
|
1167
|
+
t.value = `${R}/${z}/${H}`, S({ delay: 50 });
|
|
1193
1168
|
return;
|
|
1194
1169
|
}
|
|
1195
1170
|
}
|
|
1196
1171
|
},
|
|
1197
1172
|
{ immediate: !0 }
|
|
1198
1173
|
);
|
|
1199
|
-
const
|
|
1200
|
-
["Date", `${s.value} / ${l.value} / ${
|
|
1201
|
-
["Digits only",
|
|
1174
|
+
const M = v(() => [
|
|
1175
|
+
["Date", `${s.value} / ${l.value} / ${y.value}`],
|
|
1176
|
+
["Digits only", D.value],
|
|
1202
1177
|
[
|
|
1203
1178
|
"min",
|
|
1204
1179
|
e.min?.toLocaleDateString("en-US", {
|
|
@@ -1215,34 +1190,34 @@ function ht(e) {
|
|
|
1215
1190
|
day: "2-digit"
|
|
1216
1191
|
}) ?? null
|
|
1217
1192
|
]
|
|
1218
|
-
]),
|
|
1219
|
-
if (!
|
|
1220
|
-
if (!
|
|
1221
|
-
const
|
|
1222
|
-
return
|
|
1193
|
+
]), K = v(() => {
|
|
1194
|
+
if (!p.value) {
|
|
1195
|
+
if (!x.value) return !0;
|
|
1196
|
+
const m = k.value;
|
|
1197
|
+
return m ? h(m) : !1;
|
|
1223
1198
|
}
|
|
1224
|
-
if (!
|
|
1225
|
-
const a =
|
|
1226
|
-
return !
|
|
1199
|
+
if (!C.value) return !0;
|
|
1200
|
+
const a = k.value;
|
|
1201
|
+
return !x.value || !a ? !1 : h(a);
|
|
1227
1202
|
}), W = v(() => {
|
|
1228
|
-
if (!
|
|
1229
|
-
if (!
|
|
1230
|
-
const
|
|
1231
|
-
return
|
|
1203
|
+
if (!p.value) {
|
|
1204
|
+
if (!x.value) return;
|
|
1205
|
+
const m = k.value;
|
|
1206
|
+
return m ? h(m) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
1232
1207
|
}
|
|
1233
|
-
if (!
|
|
1234
|
-
if (
|
|
1208
|
+
if (!C.value) return;
|
|
1209
|
+
if (D.value.length === 0 || !x.value)
|
|
1235
1210
|
return "incomplete";
|
|
1236
|
-
const a =
|
|
1237
|
-
return a ?
|
|
1211
|
+
const a = k.value;
|
|
1212
|
+
return a ? h(a) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
1238
1213
|
}), ae = v(() => {
|
|
1239
1214
|
const a = W.value;
|
|
1240
1215
|
if (!a || a === "valid") return "";
|
|
1241
1216
|
if (a === "incomplete")
|
|
1242
1217
|
return "Required";
|
|
1243
1218
|
if (a === "invalid-date")
|
|
1244
|
-
return `Must be in ${
|
|
1245
|
-
const
|
|
1219
|
+
return `Must be in ${f.value} format.`;
|
|
1220
|
+
const m = e.min ? e.min.toLocaleDateString("en-US", {
|
|
1246
1221
|
year: "numeric",
|
|
1247
1222
|
month: "2-digit",
|
|
1248
1223
|
day: "2-digit"
|
|
@@ -1252,8 +1227,8 @@ function ht(e) {
|
|
|
1252
1227
|
day: "2-digit"
|
|
1253
1228
|
}) : null;
|
|
1254
1229
|
if (a === "out-of-bounds") {
|
|
1255
|
-
if (
|
|
1256
|
-
if (
|
|
1230
|
+
if (m && R) return `Must be between ${m} and ${R}.`;
|
|
1231
|
+
if (m) return `Must be on or after ${m}.`;
|
|
1257
1232
|
if (R) return `Must be on or before ${R}.`;
|
|
1258
1233
|
}
|
|
1259
1234
|
return "";
|
|
@@ -1266,12 +1241,12 @@ function ht(e) {
|
|
|
1266
1241
|
console.warn(`ID (#${e.id}) not found for styling.`);
|
|
1267
1242
|
return;
|
|
1268
1243
|
}
|
|
1269
|
-
const
|
|
1270
|
-
if (!
|
|
1244
|
+
const m = a.closest(".k-datepicker");
|
|
1245
|
+
if (!m) {
|
|
1271
1246
|
console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
|
|
1272
1247
|
return;
|
|
1273
1248
|
}
|
|
1274
|
-
const R =
|
|
1249
|
+
const R = m.parentElement;
|
|
1275
1250
|
if (R) {
|
|
1276
1251
|
if (R.classList.contains("fk-datepicker"))
|
|
1277
1252
|
return;
|
|
@@ -1286,64 +1261,64 @@ function ht(e) {
|
|
|
1286
1261
|
se();
|
|
1287
1262
|
}), {
|
|
1288
1263
|
raw: t,
|
|
1289
|
-
cursorPos:
|
|
1290
|
-
debugEnabled:
|
|
1291
|
-
debugLines:
|
|
1292
|
-
placeholder:
|
|
1293
|
-
isValid:
|
|
1264
|
+
cursorPos: r,
|
|
1265
|
+
debugEnabled: g,
|
|
1266
|
+
debugLines: M,
|
|
1267
|
+
placeholder: f,
|
|
1268
|
+
isValid: K,
|
|
1294
1269
|
reason: X(W),
|
|
1295
1270
|
validationMessage: ae,
|
|
1296
|
-
digitsOnly:
|
|
1271
|
+
digitsOnly: D,
|
|
1297
1272
|
month: X(s),
|
|
1298
1273
|
day: X(l),
|
|
1299
|
-
year: X(
|
|
1274
|
+
year: X(y),
|
|
1300
1275
|
datePart: $,
|
|
1301
1276
|
handleChange: Q,
|
|
1302
|
-
handleKeyDown:
|
|
1277
|
+
handleKeyDown: w,
|
|
1303
1278
|
handleWheel: d,
|
|
1304
|
-
handleKeyUp:
|
|
1279
|
+
handleKeyUp: b,
|
|
1305
1280
|
handleClick: le,
|
|
1306
|
-
handleBlur:
|
|
1281
|
+
handleBlur: I,
|
|
1307
1282
|
// Expose so consumers can re-run styling when needed
|
|
1308
1283
|
initStyling: se
|
|
1309
1284
|
};
|
|
1310
1285
|
}
|
|
1311
|
-
function
|
|
1312
|
-
const t = U(""),
|
|
1313
|
-
e.min = e.min ??
|
|
1314
|
-
const
|
|
1315
|
-
if (!
|
|
1316
|
-
const c = e.min ?? new Date(Date.now() - 90 *
|
|
1317
|
-
return
|
|
1318
|
-
},
|
|
1319
|
-
if ((
|
|
1286
|
+
function pt(e) {
|
|
1287
|
+
const t = U(""), r = U(void 0), g = U(!!e.debug), f = U(!1), p = 1440 * 60 * 1e3, A = 365 * p, C = /* @__PURE__ */ new Date(), T = new Date(C.getTime() - A), q = new Date(C.getTime() + A);
|
|
1288
|
+
e.min = e.min ?? T, e.max = e.max ?? q;
|
|
1289
|
+
const D = v(() => (t.value ?? "").replace(/\D/g, "")), $ = (o, c) => new Date(o, c, 0).getDate(), s = (o, c, E) => c >= 1 && c <= 12 && o >= 1e3 && E >= 1 && E <= $(o, c), l = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), y = (o) => {
|
|
1290
|
+
if (!o) return null;
|
|
1291
|
+
const c = e.min ?? new Date(Date.now() - 90 * p), E = e.max ?? /* @__PURE__ */ new Date(), P = l(o);
|
|
1292
|
+
return P < l(c) || P > l(E) ? null : o;
|
|
1293
|
+
}, L = (o, c) => e.allowReverse ?? !1 ? !0 : o <= c, h = v(() => (t.value?.length ?? 0) >= 23 && D.value.length >= 16), k = (o) => {
|
|
1294
|
+
if ((o ?? "").length < 23 || D.value.length < 16)
|
|
1320
1295
|
return { start: null, end: null };
|
|
1321
|
-
const c =
|
|
1322
|
-
return { start:
|
|
1323
|
-
},
|
|
1324
|
-
const
|
|
1325
|
-
return { start:
|
|
1326
|
-
}),
|
|
1327
|
-
if (!
|
|
1328
|
-
const
|
|
1329
|
-
if (!
|
|
1330
|
-
const
|
|
1331
|
-
return Math.round(
|
|
1296
|
+
const c = o.substring(0, 10), E = o.substring(13, 23), [P, te, ne] = c.split("/").map((pe) => parseInt(pe || "0", 10)), [fe, me, ve] = E.split("/").map((pe) => parseInt(pe || "0", 10)), ge = new Date(ne, P - 1, te), ye = new Date(ve, fe - 1, me), ke = s(ne, P, te) && ge.toString() !== "Invalid Date", we = s(ve, fe, me) && ye.toString() !== "Invalid Date";
|
|
1297
|
+
return { start: ke ? ge : null, end: we ? ye : null };
|
|
1298
|
+
}, x = e.externalValid ?? U(!0), V = v(() => k(t.value)), Y = v(() => {
|
|
1299
|
+
const o = y(V.value.start), c = y(V.value.end);
|
|
1300
|
+
return { start: o, end: c };
|
|
1301
|
+
}), _ = v(() => {
|
|
1302
|
+
if (!h.value) return;
|
|
1303
|
+
const o = Y.value.start, c = Y.value.end;
|
|
1304
|
+
if (!o || !c) return;
|
|
1305
|
+
const E = Math.abs(l(c) - l(o));
|
|
1306
|
+
return Math.round(E / 864e5 + 1);
|
|
1332
1307
|
}), Q = U(!1), le = v(() => {
|
|
1333
1308
|
if (!Q.value) return;
|
|
1334
|
-
const { start:
|
|
1335
|
-
if (!
|
|
1336
|
-
if (!
|
|
1309
|
+
const { start: o, end: c } = V.value;
|
|
1310
|
+
if (!h.value) return "incomplete";
|
|
1311
|
+
if (!o || !c) return "invalid-date";
|
|
1337
1312
|
if (!Y.value.start || !Y.value.end) return "out-of-bounds";
|
|
1338
|
-
const
|
|
1339
|
-
return
|
|
1313
|
+
const E = Y.value.start, P = Y.value.end;
|
|
1314
|
+
return L(E, P) ? typeof e.maxSpanDays == "number" && _.value !== void 0 && _.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
|
|
1340
1315
|
}), i = v(() => {
|
|
1341
|
-
const
|
|
1342
|
-
return
|
|
1343
|
-
}),
|
|
1344
|
-
const { min:
|
|
1345
|
-
if (!
|
|
1346
|
-
switch (
|
|
1316
|
+
const o = le.value;
|
|
1317
|
+
return o === void 0 || o === "valid";
|
|
1318
|
+
}), w = v(() => {
|
|
1319
|
+
const { min: o, max: c } = e, E = le.value;
|
|
1320
|
+
if (!E) return "";
|
|
1321
|
+
switch (E) {
|
|
1347
1322
|
case "incomplete":
|
|
1348
1323
|
return "Required";
|
|
1349
1324
|
case "invalid-date":
|
|
@@ -1351,118 +1326,118 @@ function bt(e) {
|
|
|
1351
1326
|
case "reversed-range":
|
|
1352
1327
|
return "End Date must be on or after Start Date.";
|
|
1353
1328
|
case "out-of-bounds":
|
|
1354
|
-
return
|
|
1329
|
+
return o && c ? `Dates must be between ${S(o)} and ${S(c)}.` : "Dates must be within the allowed range.";
|
|
1355
1330
|
case "span-exceeds-limit":
|
|
1356
1331
|
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
1357
1332
|
default:
|
|
1358
1333
|
return "";
|
|
1359
1334
|
}
|
|
1360
|
-
}), d = ["ArrowUp", "ArrowDown"],
|
|
1361
|
-
|
|
1335
|
+
}), d = ["ArrowUp", "ArrowDown"], b = ["ArrowLeft", "ArrowRight"], I = (o, c) => String(o).padStart(c, "0"), S = (o) => `${I(o.getMonth() + 1, 2)}/${I(o.getDate(), 2)}/${I(
|
|
1336
|
+
o.getFullYear(),
|
|
1362
1337
|
4
|
|
1363
|
-
)}`,
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1366
|
-
const { start: te, end: ne } =
|
|
1338
|
+
)}`, M = (o) => o <= 2 ? { side: "start", part: "mm" } : o <= 5 ? { side: "start", part: (o <= 3, "dd") } : o <= 11 ? { side: "start", part: "yyyy" } : o <= 15 ? { side: "end", part: "mm" } : o <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, K = (o, c, E) => {
|
|
1339
|
+
const P = c?.selectionStart ?? r.value ?? 0;
|
|
1340
|
+
r.value = P;
|
|
1341
|
+
const { start: te, end: ne } = k(t.value);
|
|
1367
1342
|
if (!te && !ne) {
|
|
1368
|
-
const J = /* @__PURE__ */ new Date(), de =
|
|
1369
|
-
t.value = `${de} - ${de}`, e.onChange({ value: { start: J, end: J }, event:
|
|
1343
|
+
const J = /* @__PURE__ */ new Date(), de = S(J);
|
|
1344
|
+
t.value = `${de} - ${de}`, e.onChange({ value: { start: J, end: J }, event: E }), B(() => {
|
|
1370
1345
|
requestAnimationFrame(() => {
|
|
1371
1346
|
const re = document.getElementById(
|
|
1372
1347
|
e.id
|
|
1373
|
-
), ie =
|
|
1348
|
+
), ie = r.value ?? 0;
|
|
1374
1349
|
re && (re.focus(), re.setSelectionRange(ie, ie));
|
|
1375
1350
|
});
|
|
1376
1351
|
});
|
|
1377
1352
|
return;
|
|
1378
1353
|
}
|
|
1379
|
-
const fe = /* @__PURE__ */ new Date(), me =
|
|
1354
|
+
const fe = /* @__PURE__ */ new Date(), me = M(P);
|
|
1380
1355
|
let ve = te ? new Date(te) : new Date(fe), ge = ne ? new Date(ne) : new Date(fe);
|
|
1381
|
-
const
|
|
1356
|
+
const ye = (J, de) => {
|
|
1382
1357
|
if (de === "mm") {
|
|
1383
|
-
const re = J.getMonth() + 1, ie =
|
|
1358
|
+
const re = J.getMonth() + 1, ie = o === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
|
|
1384
1359
|
J.setMonth(ie - 1);
|
|
1385
|
-
const
|
|
1386
|
-
J.getDate() >
|
|
1360
|
+
const be = $(J.getFullYear(), ie);
|
|
1361
|
+
J.getDate() > be && J.setDate(be);
|
|
1387
1362
|
} else if (de === "dd") {
|
|
1388
|
-
const re = $(J.getFullYear(), J.getMonth() + 1), ie = J.getDate(),
|
|
1389
|
-
J.setDate(
|
|
1363
|
+
const re = $(J.getFullYear(), J.getMonth() + 1), ie = J.getDate(), be = o === "ArrowUp" ? ie < re ? ie + 1 : 1 : ie > 1 ? ie - 1 : re;
|
|
1364
|
+
J.setDate(be);
|
|
1390
1365
|
} else if (de === "yyyy") {
|
|
1391
1366
|
const re = J.getFullYear();
|
|
1392
|
-
J.setFullYear(
|
|
1367
|
+
J.setFullYear(o === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
|
|
1393
1368
|
const ie = $(J.getFullYear(), J.getMonth() + 1);
|
|
1394
1369
|
J.getDate() > ie && J.setDate(ie);
|
|
1395
1370
|
}
|
|
1396
1371
|
};
|
|
1397
|
-
me.side === "start" ?
|
|
1398
|
-
const
|
|
1399
|
-
t.value = `${
|
|
1400
|
-
const pe =
|
|
1401
|
-
pe && Ae &&
|
|
1372
|
+
me.side === "start" ? ye(ve, me.part) : ye(ge, me.part);
|
|
1373
|
+
const ke = S(ve), we = S(ge);
|
|
1374
|
+
t.value = `${ke} - ${we}`;
|
|
1375
|
+
const pe = y(ve), Ae = y(ge);
|
|
1376
|
+
pe && Ae && L(pe, Ae) ? e.onChange({ value: { start: pe, end: Ae }, event: E }) : e.onChange({ value: null, event: E }), B(() => {
|
|
1402
1377
|
requestAnimationFrame(() => {
|
|
1403
1378
|
const J = document.getElementById(
|
|
1404
1379
|
e.id
|
|
1405
|
-
), de =
|
|
1380
|
+
), de = r.value ?? 0;
|
|
1406
1381
|
J && (J.focus(), J.setSelectionRange(de, de));
|
|
1407
1382
|
});
|
|
1408
1383
|
});
|
|
1409
|
-
}, W = (
|
|
1410
|
-
const { start: c, end:
|
|
1411
|
-
if (!c || !
|
|
1412
|
-
e.onChange({ value: null, event:
|
|
1384
|
+
}, W = (o) => {
|
|
1385
|
+
const { start: c, end: E } = k(t.value);
|
|
1386
|
+
if (!c || !E) {
|
|
1387
|
+
e.onChange({ value: null, event: o });
|
|
1413
1388
|
return;
|
|
1414
1389
|
}
|
|
1415
|
-
const
|
|
1416
|
-
if (!
|
|
1417
|
-
e.onChange({ value: null, event:
|
|
1390
|
+
const P = y(c), te = y(E);
|
|
1391
|
+
if (!P || !te) {
|
|
1392
|
+
e.onChange({ value: null, event: o });
|
|
1418
1393
|
return;
|
|
1419
1394
|
}
|
|
1420
|
-
if (!
|
|
1421
|
-
e.onChange({ value: null, event:
|
|
1395
|
+
if (!L(P, te)) {
|
|
1396
|
+
e.onChange({ value: null, event: o });
|
|
1422
1397
|
return;
|
|
1423
1398
|
}
|
|
1424
|
-
e.onChange({ value: { start:
|
|
1425
|
-
}, ae = (
|
|
1426
|
-
const c =
|
|
1427
|
-
if (!c &&
|
|
1428
|
-
|
|
1399
|
+
e.onChange({ value: { start: P, end: te }, event: o });
|
|
1400
|
+
}, ae = (o) => {
|
|
1401
|
+
const c = o.value ?? "", E = o.event;
|
|
1402
|
+
if (!c && E && E.type === "click") {
|
|
1403
|
+
G(E);
|
|
1429
1404
|
return;
|
|
1430
1405
|
}
|
|
1431
1406
|
t.value = c;
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
}, se = (
|
|
1435
|
-
|
|
1436
|
-
}, a = (
|
|
1437
|
-
if (
|
|
1438
|
-
|
|
1407
|
+
const P = E?.target;
|
|
1408
|
+
r.value = P?.selectionStart ?? 0, W(o);
|
|
1409
|
+
}, se = (o) => {
|
|
1410
|
+
r.value = o.target.selectionStart ?? 0;
|
|
1411
|
+
}, a = (o) => {
|
|
1412
|
+
if (o.code === "Space" || o.key === " ") {
|
|
1413
|
+
o.preventDefault(), o.stopPropagation(), e.onShowCalendar(o);
|
|
1439
1414
|
return;
|
|
1440
1415
|
}
|
|
1441
|
-
if (
|
|
1442
|
-
|
|
1416
|
+
if (o.key === "ArrowDown" && o.altKey) {
|
|
1417
|
+
o.preventDefault(), o.stopPropagation(), e.onShowCalendar(o);
|
|
1443
1418
|
return;
|
|
1444
1419
|
}
|
|
1445
|
-
if (d.includes(
|
|
1446
|
-
|
|
1447
|
-
const c =
|
|
1448
|
-
|
|
1420
|
+
if (d.includes(o.key)) {
|
|
1421
|
+
o.preventDefault(), o.stopPropagation();
|
|
1422
|
+
const c = o.target;
|
|
1423
|
+
K(o.key, c, o);
|
|
1449
1424
|
return;
|
|
1450
1425
|
}
|
|
1451
|
-
},
|
|
1452
|
-
|
|
1453
|
-
const c =
|
|
1454
|
-
|
|
1455
|
-
}, R = (
|
|
1456
|
-
if (
|
|
1457
|
-
const c =
|
|
1458
|
-
|
|
1426
|
+
}, m = (o) => {
|
|
1427
|
+
o.preventDefault();
|
|
1428
|
+
const c = o.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1429
|
+
K(c, o.target, o);
|
|
1430
|
+
}, R = (o) => {
|
|
1431
|
+
if (b.includes(o.key) || d.includes(o.key)) {
|
|
1432
|
+
const c = o.target;
|
|
1433
|
+
r.value = c?.selectionStart ?? 0;
|
|
1459
1434
|
}
|
|
1460
1435
|
}, z = () => {
|
|
1461
|
-
Q.value = !0, (e.manageValid ?? !0) && (
|
|
1462
|
-
}, H = (
|
|
1436
|
+
Q.value = !0, (e.manageValid ?? !0) && (x.value = i.value);
|
|
1437
|
+
}, H = (o) => {
|
|
1463
1438
|
z();
|
|
1464
|
-
},
|
|
1465
|
-
t.value = "",
|
|
1439
|
+
}, G = (o) => {
|
|
1440
|
+
t.value = "", r.value = 0, e.onChange({ value: null, event: o }), z(), B(() => {
|
|
1466
1441
|
const c = document.getElementById(
|
|
1467
1442
|
e.id
|
|
1468
1443
|
);
|
|
@@ -1471,14 +1446,14 @@ function bt(e) {
|
|
|
1471
1446
|
};
|
|
1472
1447
|
e.externalValue && ue(
|
|
1473
1448
|
e.externalValue,
|
|
1474
|
-
(
|
|
1475
|
-
const c =
|
|
1476
|
-
if (c &&
|
|
1477
|
-
if (t.value = `${
|
|
1478
|
-
const
|
|
1449
|
+
(o) => {
|
|
1450
|
+
const c = o?.start ?? null, E = o?.end ?? null;
|
|
1451
|
+
if (c && E) {
|
|
1452
|
+
if (t.value = `${S(c)} - ${S(E)}`, e.isOpen?.value && f.value && e.onRequestClose) {
|
|
1453
|
+
const P = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
|
|
1479
1454
|
setTimeout(() => {
|
|
1480
|
-
e.onRequestClose?.(),
|
|
1481
|
-
},
|
|
1455
|
+
e.onRequestClose?.(), f.value = !1, z();
|
|
1456
|
+
}, P);
|
|
1482
1457
|
}
|
|
1483
1458
|
return;
|
|
1484
1459
|
}
|
|
@@ -1489,16 +1464,16 @@ function bt(e) {
|
|
|
1489
1464
|
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
1490
1465
|
), u = v(
|
|
1491
1466
|
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
1492
|
-
),
|
|
1467
|
+
), F = v(
|
|
1493
1468
|
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
1494
1469
|
), N = v(
|
|
1495
1470
|
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
1496
|
-
),
|
|
1471
|
+
), j = v(
|
|
1497
1472
|
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
1498
1473
|
), ee = v(
|
|
1499
1474
|
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
1500
1475
|
), O = v(() => {
|
|
1501
|
-
const { start:
|
|
1476
|
+
const { start: o, end: c } = k(t.value);
|
|
1502
1477
|
return [
|
|
1503
1478
|
{
|
|
1504
1479
|
label: "Raw",
|
|
@@ -1516,45 +1491,45 @@ function bt(e) {
|
|
|
1516
1491
|
label: "Start",
|
|
1517
1492
|
value: `${String(n.value).padStart(2, "0")} / ${String(
|
|
1518
1493
|
u.value
|
|
1519
|
-
).padStart(2, "0")} / ${String(
|
|
1494
|
+
).padStart(2, "0")} / ${String(F.value).padStart(4, "0")}`
|
|
1520
1495
|
},
|
|
1521
1496
|
{
|
|
1522
1497
|
label: "End",
|
|
1523
1498
|
value: `${String(N.value).padStart(2, "0")} / ${String(
|
|
1524
|
-
|
|
1499
|
+
j.value
|
|
1525
1500
|
).padStart(2, "0")} / ${String(ee.value).padStart(4, "0")}`
|
|
1526
1501
|
},
|
|
1527
|
-
{ label: "Digits only", value:
|
|
1528
|
-
{ label: "Mask complete", value: `${
|
|
1502
|
+
{ label: "Digits only", value: D.value },
|
|
1503
|
+
{ label: "Mask complete", value: `${h.value}` },
|
|
1529
1504
|
{
|
|
1530
1505
|
label: "Parsed",
|
|
1531
|
-
value: `${
|
|
1506
|
+
value: `${o ? o.toDateString() : "-"} | ${c ? c.toDateString() : "-"}`
|
|
1532
1507
|
},
|
|
1533
1508
|
{
|
|
1534
1509
|
label: "Valid (managed)",
|
|
1535
|
-
value: `${
|
|
1510
|
+
value: `${x.value ?? "-"}`
|
|
1536
1511
|
},
|
|
1537
|
-
{ label: "Span (days)", value: `${
|
|
1512
|
+
{ label: "Span (days)", value: `${_.value ?? "-"}` },
|
|
1538
1513
|
{
|
|
1539
1514
|
label: "Reason",
|
|
1540
1515
|
value: `${le.value ?? "-"}`
|
|
1541
1516
|
},
|
|
1542
1517
|
{
|
|
1543
1518
|
label: "Cursor in",
|
|
1544
|
-
value: `${
|
|
1545
|
-
const
|
|
1546
|
-
return `${
|
|
1519
|
+
value: `${r.value ?? "-"} (${(() => {
|
|
1520
|
+
const E = r.value ?? 0, P = M(E);
|
|
1521
|
+
return `${P.side}.${P.part}`;
|
|
1547
1522
|
})()})`
|
|
1548
1523
|
}
|
|
1549
1524
|
];
|
|
1550
1525
|
}), Z = () => {
|
|
1551
1526
|
B(() => {
|
|
1552
|
-
const
|
|
1553
|
-
if (!
|
|
1527
|
+
const o = document.getElementById(e.id);
|
|
1528
|
+
if (!o) {
|
|
1554
1529
|
console.warn(`#${e.id} not found for styling.`);
|
|
1555
1530
|
return;
|
|
1556
1531
|
}
|
|
1557
|
-
const c =
|
|
1532
|
+
const c = o.closest("div");
|
|
1558
1533
|
if (!c) {
|
|
1559
1534
|
console.warn(`Parent div of #${e.id} not found for styling.`);
|
|
1560
1535
|
return;
|
|
@@ -1568,64 +1543,64 @@ function bt(e) {
|
|
|
1568
1543
|
const ce = () => {
|
|
1569
1544
|
B(() => {
|
|
1570
1545
|
try {
|
|
1571
|
-
const
|
|
1546
|
+
const o = Array.from(
|
|
1572
1547
|
document.querySelectorAll(".k-animation-container")
|
|
1573
1548
|
);
|
|
1574
|
-
if (!
|
|
1575
|
-
const
|
|
1549
|
+
if (!o.length) return;
|
|
1550
|
+
const E = [...o].reverse().find((ne) => ne.querySelector(".k-calendar"))?.querySelector(
|
|
1576
1551
|
".k-calendar"
|
|
1577
1552
|
);
|
|
1578
|
-
if (!
|
|
1579
|
-
const
|
|
1553
|
+
if (!E) return;
|
|
1554
|
+
const P = E.querySelectorAll(
|
|
1580
1555
|
".k-calendar-table"
|
|
1581
1556
|
);
|
|
1582
1557
|
let te = !1;
|
|
1583
|
-
|
|
1558
|
+
P.forEach((ne) => {
|
|
1584
1559
|
ne.tabIndex === 0 && (te ? ne.tabIndex = -1 : te = !0);
|
|
1585
1560
|
});
|
|
1586
|
-
} catch (
|
|
1587
|
-
console.warn(
|
|
1561
|
+
} catch (o) {
|
|
1562
|
+
console.warn(o);
|
|
1588
1563
|
}
|
|
1589
1564
|
});
|
|
1590
1565
|
};
|
|
1591
1566
|
return e.isOpen && ue(
|
|
1592
1567
|
e.isOpen,
|
|
1593
|
-
(
|
|
1594
|
-
|
|
1568
|
+
(o) => {
|
|
1569
|
+
o && setTimeout(() => ce(), 0);
|
|
1595
1570
|
},
|
|
1596
1571
|
{ immediate: !1 }
|
|
1597
1572
|
), {
|
|
1598
1573
|
raw: t,
|
|
1599
|
-
cursorPos:
|
|
1600
|
-
debugEnabled:
|
|
1574
|
+
cursorPos: r,
|
|
1575
|
+
debugEnabled: g,
|
|
1601
1576
|
debugLines: O,
|
|
1602
|
-
digitsOnly:
|
|
1603
|
-
valid:
|
|
1577
|
+
digitsOnly: D,
|
|
1578
|
+
valid: x,
|
|
1604
1579
|
validComputed: X(i),
|
|
1605
1580
|
reason: X(le),
|
|
1606
|
-
validationMessage: X(
|
|
1607
|
-
spanDays: X(
|
|
1581
|
+
validationMessage: X(w),
|
|
1582
|
+
spanDays: X(_),
|
|
1608
1583
|
month1: X(n),
|
|
1609
1584
|
day1: X(u),
|
|
1610
|
-
year1: X(
|
|
1585
|
+
year1: X(F),
|
|
1611
1586
|
month2: X(N),
|
|
1612
|
-
day2: X(
|
|
1587
|
+
day2: X(j),
|
|
1613
1588
|
year2: X(ee),
|
|
1614
1589
|
handleChange: ae,
|
|
1615
1590
|
handleKeyDown: a,
|
|
1616
|
-
handleWheel:
|
|
1591
|
+
handleWheel: m,
|
|
1617
1592
|
handleKeyUp: R,
|
|
1618
1593
|
handleClick: se,
|
|
1619
1594
|
handleBlur: H,
|
|
1620
|
-
handleClear:
|
|
1595
|
+
handleClear: G,
|
|
1621
1596
|
onCalendarChange: () => {
|
|
1622
|
-
|
|
1597
|
+
f.value = !0;
|
|
1623
1598
|
},
|
|
1624
1599
|
initStyling: Z
|
|
1625
1600
|
};
|
|
1626
1601
|
}
|
|
1627
|
-
function
|
|
1628
|
-
const t = U(""),
|
|
1602
|
+
function mt(e) {
|
|
1603
|
+
const t = U(""), r = U(void 0), g = U(!!e.debug), f = U(e.timeFormat ?? "hh:mm AM"), p = v(() => !!e.required), A = U(!1), C = ["ArrowUp", "ArrowDown"], T = ["ArrowLeft", "ArrowRight"], q = v(() => (t.value ?? "").replace(/\D/g, "")), D = {
|
|
1629
1604
|
H: /[0-9]/,
|
|
1630
1605
|
h: /[0-9]/,
|
|
1631
1606
|
M: /[0-9]/,
|
|
@@ -1638,54 +1613,54 @@ function St(e) {
|
|
|
1638
1613
|
}), l = v(() => {
|
|
1639
1614
|
const n = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", u = parseInt(n);
|
|
1640
1615
|
return Math.min(Math.max(u, 0), 59);
|
|
1641
|
-
}),
|
|
1642
|
-
const n = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), u =
|
|
1616
|
+
}), y = v(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), L = v(() => {
|
|
1617
|
+
const n = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), u = y.value;
|
|
1643
1618
|
return n === 12 ? u === "AM" ? 0 : 12 : u === "PM" ? n + 12 : n;
|
|
1644
|
-
}),
|
|
1619
|
+
}), h = v(() => k.value ? `${String(L.value).padStart(2, "0")}:${String(l.value).padStart(2, "0")}:00` : null), k = v(
|
|
1645
1620
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
1646
|
-
),
|
|
1621
|
+
), x = (n, u, F) => {
|
|
1647
1622
|
let N = n % 12;
|
|
1648
1623
|
return N === 0 && (N = 12), `${String(N).padStart(2, "0")}:${String(u).padStart(
|
|
1649
1624
|
2,
|
|
1650
1625
|
"0"
|
|
1651
|
-
)} ${
|
|
1652
|
-
},
|
|
1626
|
+
)} ${F}`;
|
|
1627
|
+
}, V = (n) => {
|
|
1653
1628
|
const u = n.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1654
1629
|
if (!u) return null;
|
|
1655
|
-
const
|
|
1656
|
-
if (
|
|
1657
|
-
let ee =
|
|
1658
|
-
|
|
1630
|
+
const F = parseInt(u[1]), N = parseInt(u[2]), j = u[3].toUpperCase();
|
|
1631
|
+
if (F < 1 || F > 12 || N < 0 || N > 59) return null;
|
|
1632
|
+
let ee = F % 12;
|
|
1633
|
+
j === "PM" && (ee += 12);
|
|
1659
1634
|
const O = /* @__PURE__ */ new Date();
|
|
1660
1635
|
return O.setSeconds(0, 0), O.setHours(ee), O.setMinutes(N), O;
|
|
1661
1636
|
}, Y = (n) => {
|
|
1662
|
-
if (
|
|
1637
|
+
if (q.value.length === 0) {
|
|
1663
1638
|
e.onChange({ value: null, event: n });
|
|
1664
1639
|
return;
|
|
1665
1640
|
}
|
|
1666
|
-
if (!
|
|
1641
|
+
if (!k.value) {
|
|
1667
1642
|
e.onChange({ value: null, event: n });
|
|
1668
1643
|
return;
|
|
1669
1644
|
}
|
|
1670
|
-
const u =
|
|
1645
|
+
const u = V(t.value);
|
|
1671
1646
|
u && Q(u) ? e.onChange({ value: u, event: n }) : e.onChange({ value: null, event: n });
|
|
1672
|
-
},
|
|
1673
|
-
const u = e.min ?? void 0,
|
|
1647
|
+
}, _ = (n) => n.getHours() * 60 + n.getMinutes(), Q = (n) => {
|
|
1648
|
+
const u = e.min ?? void 0, F = e.max ?? void 0, N = _(n);
|
|
1674
1649
|
if (u) {
|
|
1675
|
-
const
|
|
1676
|
-
if (N <
|
|
1650
|
+
const j = _(u);
|
|
1651
|
+
if (N < j) return !1;
|
|
1677
1652
|
}
|
|
1678
|
-
if (
|
|
1679
|
-
const
|
|
1680
|
-
if (N >
|
|
1653
|
+
if (F) {
|
|
1654
|
+
const j = _(F);
|
|
1655
|
+
if (N > j) return !1;
|
|
1681
1656
|
}
|
|
1682
1657
|
return !0;
|
|
1683
1658
|
}, le = (n) => {
|
|
1684
|
-
const u = n.getHours(),
|
|
1685
|
-
t.value =
|
|
1659
|
+
const u = n.getHours(), F = u >= 12 ? "PM" : "AM";
|
|
1660
|
+
t.value = x(u, n.getMinutes(), F);
|
|
1686
1661
|
}, i = (n, u) => {
|
|
1687
1662
|
e.onChange({ value: n, event: u });
|
|
1688
|
-
},
|
|
1663
|
+
}, w = () => {
|
|
1689
1664
|
B(() => {
|
|
1690
1665
|
requestAnimationFrame(() => {
|
|
1691
1666
|
requestAnimationFrame(() => {
|
|
@@ -1703,20 +1678,20 @@ function St(e) {
|
|
|
1703
1678
|
}, d = (n) => {
|
|
1704
1679
|
const u = n?.event?.target;
|
|
1705
1680
|
return u ? u.closest(".k-time-now") ? "now" : u.closest(".k-time-accept") ? "set" : null : null;
|
|
1706
|
-
},
|
|
1681
|
+
}, b = (n, u) => {
|
|
1707
1682
|
n && Q(n) ? i(n, u) : i(null, u);
|
|
1708
|
-
},
|
|
1683
|
+
}, I = (...n) => {
|
|
1709
1684
|
const u = n[0];
|
|
1710
1685
|
if (!u) return;
|
|
1711
|
-
const
|
|
1712
|
-
if (
|
|
1713
|
-
const
|
|
1714
|
-
le(
|
|
1686
|
+
const F = d(u);
|
|
1687
|
+
if (F === "now") {
|
|
1688
|
+
const j = /* @__PURE__ */ new Date();
|
|
1689
|
+
le(j), b(j, u), w();
|
|
1715
1690
|
return;
|
|
1716
1691
|
}
|
|
1717
1692
|
if (u?.value instanceof Date) {
|
|
1718
|
-
const
|
|
1719
|
-
le(
|
|
1693
|
+
const j = new Date(u.value);
|
|
1694
|
+
le(j), b(j, u), F === "set" && w();
|
|
1720
1695
|
return;
|
|
1721
1696
|
}
|
|
1722
1697
|
if (u?.value === null) {
|
|
@@ -1725,10 +1700,10 @@ function St(e) {
|
|
|
1725
1700
|
}
|
|
1726
1701
|
t.value = u.value;
|
|
1727
1702
|
const N = u.event?.target;
|
|
1728
|
-
|
|
1703
|
+
r.value = N?.selectionStart ?? 0;
|
|
1729
1704
|
try {
|
|
1730
|
-
const
|
|
1731
|
-
if ($(
|
|
1705
|
+
const j = r.value ?? 0;
|
|
1706
|
+
if ($(j) === "ampm" && (t.value ?? "").length >= 8) {
|
|
1732
1707
|
const ee = t.value.charAt(6);
|
|
1733
1708
|
/[Aa]/.test(ee) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, B(() => {
|
|
1734
1709
|
requestAnimationFrame(() => {
|
|
@@ -1749,22 +1724,22 @@ function St(e) {
|
|
|
1749
1724
|
} catch {
|
|
1750
1725
|
}
|
|
1751
1726
|
Y(u);
|
|
1752
|
-
},
|
|
1753
|
-
|
|
1754
|
-
},
|
|
1755
|
-
const N = u?.selectionStart ??
|
|
1756
|
-
|
|
1757
|
-
const
|
|
1727
|
+
}, S = (n) => {
|
|
1728
|
+
r.value = n.target.selectionStart ?? 0;
|
|
1729
|
+
}, M = (n, u, F) => {
|
|
1730
|
+
const N = u?.selectionStart ?? r.value ?? 0;
|
|
1731
|
+
r.value = N;
|
|
1732
|
+
const j = $(N), ee = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1758
1733
|
if (!ee) {
|
|
1759
|
-
if ((t.value ?? "").length === 0 ||
|
|
1760
|
-
const c = /* @__PURE__ */ new Date(),
|
|
1761
|
-
t.value =
|
|
1762
|
-
const te =
|
|
1763
|
-
|
|
1734
|
+
if ((t.value ?? "").length === 0 || q.value.length === 0) {
|
|
1735
|
+
const c = /* @__PURE__ */ new Date(), E = c.getHours(), P = E >= 12 ? "PM" : "AM";
|
|
1736
|
+
t.value = x(E, c.getMinutes(), P);
|
|
1737
|
+
const te = V(t.value);
|
|
1738
|
+
b(te, F), B(() => {
|
|
1764
1739
|
requestAnimationFrame(() => {
|
|
1765
1740
|
const ne = document.getElementById(
|
|
1766
1741
|
e.id
|
|
1767
|
-
), fe =
|
|
1742
|
+
), fe = r.value ?? 0;
|
|
1768
1743
|
ne && (ne.focus(), ne.setSelectionRange(fe, fe));
|
|
1769
1744
|
});
|
|
1770
1745
|
});
|
|
@@ -1772,36 +1747,36 @@ function St(e) {
|
|
|
1772
1747
|
return;
|
|
1773
1748
|
}
|
|
1774
1749
|
let O = parseInt(ee[1]), Z = parseInt(ee[2]), ce = ee[3].toUpperCase();
|
|
1775
|
-
if (
|
|
1750
|
+
if (j === "hh")
|
|
1776
1751
|
n === "ArrowUp" ? O = O < 12 ? O + 1 : 1 : O = O > 1 ? O - 1 : 12;
|
|
1777
|
-
else if (
|
|
1752
|
+
else if (j === "mm") {
|
|
1778
1753
|
const c = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
|
|
1779
1754
|
if (c === 1)
|
|
1780
1755
|
n === "ArrowUp" ? Z = Z < 59 ? Z + 1 : 0 : Z = Z > 0 ? Z - 1 : 59;
|
|
1781
1756
|
else if (n === "ArrowUp") {
|
|
1782
|
-
const
|
|
1783
|
-
let
|
|
1784
|
-
|
|
1757
|
+
const E = Z % c;
|
|
1758
|
+
let P = E === 0 ? Z + c : Z + (c - E);
|
|
1759
|
+
P >= 60 && (P = 0), Z = P;
|
|
1785
1760
|
} else {
|
|
1786
|
-
const
|
|
1787
|
-
let
|
|
1788
|
-
|
|
1761
|
+
const E = Z % c;
|
|
1762
|
+
let P = E === 0 ? Z - c : Z - E;
|
|
1763
|
+
P < 0 && (P = 60 - c), Z = P;
|
|
1789
1764
|
}
|
|
1790
|
-
} else
|
|
1765
|
+
} else j === "ampm" && (ce = ce === "AM" ? "PM" : "AM");
|
|
1791
1766
|
t.value = `${String(O).padStart(2, "0")}:${String(Z).padStart(
|
|
1792
1767
|
2,
|
|
1793
1768
|
"0"
|
|
1794
1769
|
)} ${ce}`;
|
|
1795
|
-
const
|
|
1796
|
-
|
|
1770
|
+
const o = V(t.value);
|
|
1771
|
+
b(o, F), B(() => {
|
|
1797
1772
|
requestAnimationFrame(() => {
|
|
1798
1773
|
const c = document.getElementById(
|
|
1799
1774
|
e.id
|
|
1800
|
-
),
|
|
1801
|
-
c && (c.focus(), c.setSelectionRange(
|
|
1775
|
+
), E = r.value ?? 0;
|
|
1776
|
+
c && (c.focus(), c.setSelectionRange(E, E));
|
|
1802
1777
|
});
|
|
1803
1778
|
});
|
|
1804
|
-
},
|
|
1779
|
+
}, K = (n) => {
|
|
1805
1780
|
if (n.code === "Space" || n.key === " ") {
|
|
1806
1781
|
n.preventDefault(), n.stopPropagation(), e.onShowPicker(n);
|
|
1807
1782
|
return;
|
|
@@ -1810,31 +1785,31 @@ function St(e) {
|
|
|
1810
1785
|
n.preventDefault(), n.stopPropagation(), e.onShowPicker(n);
|
|
1811
1786
|
return;
|
|
1812
1787
|
}
|
|
1813
|
-
if (
|
|
1788
|
+
if (C.includes(n.key)) {
|
|
1814
1789
|
if (n.altKey) return;
|
|
1815
1790
|
n.preventDefault(), n.stopPropagation();
|
|
1816
1791
|
const u = n.target;
|
|
1817
|
-
|
|
1792
|
+
M(n.key, u, n);
|
|
1818
1793
|
return;
|
|
1819
1794
|
}
|
|
1820
1795
|
}, W = (n) => {
|
|
1821
1796
|
n.preventDefault();
|
|
1822
1797
|
const u = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1823
|
-
|
|
1798
|
+
M(u, n.target, n);
|
|
1824
1799
|
}, ae = (n) => {
|
|
1825
1800
|
const u = n.target;
|
|
1826
|
-
if (
|
|
1827
|
-
|
|
1801
|
+
if (T.includes(n.key)) {
|
|
1802
|
+
r.value = u?.selectionStart ?? 0;
|
|
1828
1803
|
return;
|
|
1829
1804
|
}
|
|
1830
|
-
if (
|
|
1805
|
+
if (C.includes(n.key)) {
|
|
1831
1806
|
if (n.altKey) return;
|
|
1832
|
-
|
|
1807
|
+
r.value = u?.selectionStart ?? 0;
|
|
1833
1808
|
}
|
|
1834
1809
|
}, se = (n) => {
|
|
1835
|
-
|
|
1810
|
+
A.value = !0, p.value && e.externalValue && e.externalValue.value === void 0 && q.value.length === 0 && (e.externalValue.value = "");
|
|
1836
1811
|
const u = n.target;
|
|
1837
|
-
u && (
|
|
1812
|
+
u && (r.value = u.selectionStart ?? 0);
|
|
1838
1813
|
};
|
|
1839
1814
|
e.externalValue && ue(
|
|
1840
1815
|
e.externalValue,
|
|
@@ -1842,8 +1817,8 @@ function St(e) {
|
|
|
1842
1817
|
if (n) {
|
|
1843
1818
|
const u = new Date(n);
|
|
1844
1819
|
if (u.toString() !== "Invalid Date") {
|
|
1845
|
-
const
|
|
1846
|
-
t.value =
|
|
1820
|
+
const F = u.getHours(), N = F >= 12 ? "PM" : "AM";
|
|
1821
|
+
t.value = x(F, u.getMinutes(), N);
|
|
1847
1822
|
return;
|
|
1848
1823
|
}
|
|
1849
1824
|
}
|
|
@@ -1853,14 +1828,14 @@ function St(e) {
|
|
|
1853
1828
|
const a = v(() => [
|
|
1854
1829
|
["Time", t.value || "--:-- --"],
|
|
1855
1830
|
["Hour (12h)", s.value],
|
|
1856
|
-
["Hour (24h)",
|
|
1831
|
+
["Hour (24h)", L.value],
|
|
1857
1832
|
["Minute", l.value],
|
|
1858
|
-
["Period",
|
|
1859
|
-
["Time (24h)",
|
|
1860
|
-
["Digits only",
|
|
1833
|
+
["Period", y.value],
|
|
1834
|
+
["Time (24h)", h.value ?? "--:--:--"],
|
|
1835
|
+
["Digits only", q.value],
|
|
1861
1836
|
[
|
|
1862
1837
|
"Parsed Date",
|
|
1863
|
-
|
|
1838
|
+
m.value?.toLocaleDateString("en-US", {
|
|
1864
1839
|
hour: "2-digit",
|
|
1865
1840
|
minute: "2-digit"
|
|
1866
1841
|
}) ?? null
|
|
@@ -1882,27 +1857,27 @@ function St(e) {
|
|
|
1882
1857
|
["valid", R.value],
|
|
1883
1858
|
["reason", z.value],
|
|
1884
1859
|
["validationMessage", H.value]
|
|
1885
|
-
]),
|
|
1886
|
-
() =>
|
|
1860
|
+
]), m = v(
|
|
1861
|
+
() => V(t.value) ?? null
|
|
1887
1862
|
), R = v(() => {
|
|
1888
|
-
if (!
|
|
1889
|
-
if (!
|
|
1890
|
-
const u =
|
|
1863
|
+
if (!p.value) {
|
|
1864
|
+
if (!k.value) return !0;
|
|
1865
|
+
const u = m.value;
|
|
1891
1866
|
return u ? Q(u) : !1;
|
|
1892
1867
|
}
|
|
1893
|
-
if (!
|
|
1894
|
-
const n =
|
|
1895
|
-
return !
|
|
1868
|
+
if (!A.value) return !0;
|
|
1869
|
+
const n = m.value;
|
|
1870
|
+
return !k.value || !n ? !1 : Q(n);
|
|
1896
1871
|
}), z = v(() => {
|
|
1897
|
-
if (!
|
|
1898
|
-
if (!
|
|
1899
|
-
const u =
|
|
1872
|
+
if (!p.value) {
|
|
1873
|
+
if (!k.value) return;
|
|
1874
|
+
const u = m.value;
|
|
1900
1875
|
return u ? Q(u) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1901
1876
|
}
|
|
1902
|
-
if (!
|
|
1903
|
-
if (
|
|
1877
|
+
if (!A.value) return;
|
|
1878
|
+
if (q.value.length === 0 || !k.value)
|
|
1904
1879
|
return "incomplete";
|
|
1905
|
-
const n =
|
|
1880
|
+
const n = m.value;
|
|
1906
1881
|
return n ? Q(n) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1907
1882
|
}), H = v(() => {
|
|
1908
1883
|
const n = z.value;
|
|
@@ -1910,18 +1885,18 @@ function St(e) {
|
|
|
1910
1885
|
if (n === "incomplete")
|
|
1911
1886
|
return "Required";
|
|
1912
1887
|
if (n === "invalid-time")
|
|
1913
|
-
return `Must be in ${
|
|
1888
|
+
return `Must be in ${f.value} format.`;
|
|
1914
1889
|
const u = {
|
|
1915
1890
|
hour: "2-digit",
|
|
1916
1891
|
minute: "2-digit"
|
|
1917
|
-
},
|
|
1892
|
+
}, F = e.min ? e.min.toLocaleTimeString("en-US", u) : null, N = e.max ? e.max.toLocaleTimeString("en-US", u) : null;
|
|
1918
1893
|
if (n === "out-of-bounds") {
|
|
1919
|
-
if (
|
|
1920
|
-
if (
|
|
1894
|
+
if (F && N) return `Must be between ${F} and ${N}.`;
|
|
1895
|
+
if (F) return `Must be ${F} or later.`;
|
|
1921
1896
|
if (N) return `Must be ${N} or earlier.`;
|
|
1922
1897
|
}
|
|
1923
1898
|
return "";
|
|
1924
|
-
}),
|
|
1899
|
+
}), G = () => {
|
|
1925
1900
|
B(() => {
|
|
1926
1901
|
const n = document.getElementById(e.id);
|
|
1927
1902
|
if (!n) {
|
|
@@ -1935,99 +1910,99 @@ function St(e) {
|
|
|
1935
1910
|
);
|
|
1936
1911
|
return;
|
|
1937
1912
|
}
|
|
1938
|
-
const
|
|
1939
|
-
if (!
|
|
1913
|
+
const F = u.parentElement;
|
|
1914
|
+
if (!F) {
|
|
1940
1915
|
console.warn(
|
|
1941
1916
|
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
1942
1917
|
);
|
|
1943
1918
|
return;
|
|
1944
1919
|
}
|
|
1945
|
-
|
|
1920
|
+
F.classList.contains("fk-timepicker") || F.classList.add("fk-timepicker");
|
|
1946
1921
|
});
|
|
1947
1922
|
};
|
|
1948
1923
|
return Me(() => {
|
|
1949
|
-
|
|
1924
|
+
G();
|
|
1950
1925
|
}), {
|
|
1951
1926
|
raw: t,
|
|
1952
|
-
rules:
|
|
1953
|
-
debugEnabled:
|
|
1927
|
+
rules: D,
|
|
1928
|
+
debugEnabled: g,
|
|
1954
1929
|
debugLines: a,
|
|
1955
|
-
placeholder:
|
|
1930
|
+
placeholder: f,
|
|
1956
1931
|
isValid: R,
|
|
1957
1932
|
reason: X(z),
|
|
1958
1933
|
validationMessage: H,
|
|
1959
|
-
isComplete:
|
|
1934
|
+
isComplete: k,
|
|
1960
1935
|
inRangeTime: Q,
|
|
1961
|
-
cursorPos:
|
|
1936
|
+
cursorPos: r,
|
|
1962
1937
|
hour: X(s),
|
|
1963
|
-
hour24: X(
|
|
1938
|
+
hour24: X(L),
|
|
1964
1939
|
minute: X(l),
|
|
1965
|
-
period: X(
|
|
1966
|
-
time24: X(
|
|
1967
|
-
parsedRawTime: X(
|
|
1968
|
-
handleChange:
|
|
1969
|
-
handleKeyDown:
|
|
1940
|
+
period: X(y),
|
|
1941
|
+
time24: X(h),
|
|
1942
|
+
parsedRawTime: X(m),
|
|
1943
|
+
handleChange: I,
|
|
1944
|
+
handleKeyDown: K,
|
|
1970
1945
|
handleKeyUp: ae,
|
|
1971
|
-
handleClick:
|
|
1946
|
+
handleClick: S,
|
|
1972
1947
|
handleWheel: W,
|
|
1973
1948
|
handleBlur: se,
|
|
1974
1949
|
// Expose so consumers can reapply theming when Kendo updates DOM
|
|
1975
|
-
initStyling:
|
|
1950
|
+
initStyling: G
|
|
1976
1951
|
};
|
|
1977
1952
|
}
|
|
1978
|
-
function
|
|
1979
|
-
const t =
|
|
1953
|
+
function vt(e) {
|
|
1954
|
+
const t = Ke(null), r = [
|
|
1980
1955
|
".k-animation-container .k-popup",
|
|
1981
1956
|
".k-popup",
|
|
1982
1957
|
".k-timepicker-popup",
|
|
1983
1958
|
".k-menu-popup"
|
|
1984
|
-
],
|
|
1959
|
+
], g = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? r].flat(), f = (D) => D ? typeof e.initialFocus == "string" ? D.querySelector(e.initialFocus) ?? D : typeof e.initialFocus == "function" ? e.initialFocus(D) ?? D : D.querySelector(
|
|
1985
1960
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1986
|
-
) ??
|
|
1961
|
+
) ?? D : null, { activate: p, deactivate: A } = qe(t, {
|
|
1987
1962
|
escapeDeactivates: !1,
|
|
1988
1963
|
clickOutsideDeactivates: !1,
|
|
1989
1964
|
fallbackFocus: () => t.value,
|
|
1990
|
-
initialFocus: () =>
|
|
1965
|
+
initialFocus: () => f(t.value),
|
|
1991
1966
|
...e.focusTrapOptions ?? {}
|
|
1992
1967
|
});
|
|
1993
|
-
let
|
|
1994
|
-
const
|
|
1968
|
+
let C = null, T = U(null);
|
|
1969
|
+
const q = () => {
|
|
1995
1970
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1996
|
-
const
|
|
1997
|
-
const
|
|
1998
|
-
if (!
|
|
1999
|
-
const
|
|
2000
|
-
(
|
|
1971
|
+
const D = (s, l) => {
|
|
1972
|
+
const y = Array.from(s.querySelectorAll(l));
|
|
1973
|
+
if (!y.length) return null;
|
|
1974
|
+
const L = y.filter(
|
|
1975
|
+
(h) => h.offsetParent !== null || h.getClientRects().length > 0
|
|
2001
1976
|
);
|
|
2002
|
-
return
|
|
1977
|
+
return L[L.length - 1] ?? y[y.length - 1] ?? null;
|
|
2003
1978
|
}, $ = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
2004
|
-
for (const s of
|
|
2005
|
-
const l =
|
|
1979
|
+
for (const s of g) {
|
|
1980
|
+
const l = D($, s);
|
|
2006
1981
|
if (l) return l;
|
|
2007
1982
|
}
|
|
2008
|
-
for (const s of
|
|
2009
|
-
const l =
|
|
1983
|
+
for (const s of g) {
|
|
1984
|
+
const l = D(document, s);
|
|
2010
1985
|
if (l) return l;
|
|
2011
1986
|
}
|
|
2012
1987
|
return null;
|
|
2013
1988
|
};
|
|
2014
|
-
return
|
|
2015
|
-
|
|
1989
|
+
return $e(t, (D) => {
|
|
1990
|
+
T.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", D);
|
|
2016
1991
|
}), ue(
|
|
2017
1992
|
() => e.isOpen.value,
|
|
2018
|
-
(
|
|
2019
|
-
|
|
2020
|
-
const $ =
|
|
2021
|
-
$ && (t.value = $, setTimeout(() =>
|
|
2022
|
-
s.key === "Escape" && (
|
|
2023
|
-
}, document.addEventListener("keydown",
|
|
2024
|
-
})) : (
|
|
1993
|
+
(D) => {
|
|
1994
|
+
D ? (T.value = null, B(() => {
|
|
1995
|
+
const $ = q();
|
|
1996
|
+
$ && (t.value = $, setTimeout(() => p(), 0), C || (C = (s) => {
|
|
1997
|
+
s.key === "Escape" && (T.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", s));
|
|
1998
|
+
}, document.addEventListener("keydown", C, !0)));
|
|
1999
|
+
})) : (A(), C && (document.removeEventListener("keydown", C, !0), C = null), t.value = null, T.value === "outside" && B(() => {
|
|
2025
2000
|
const $ = () => {
|
|
2026
|
-
const s = e.triggerEl?.value, l = s?.querySelector("input"),
|
|
2027
|
-
|
|
2001
|
+
const s = e.triggerEl?.value, l = s?.querySelector("input"), y = document.activeElement;
|
|
2002
|
+
y && (y === l || s && s.contains(y)) && (l ?? s)?.blur?.();
|
|
2028
2003
|
};
|
|
2029
2004
|
requestAnimationFrame(() => setTimeout($, 0));
|
|
2030
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
2005
|
+
}), e.returnFocusToTrigger !== !1 && T.value === "escape" && e.triggerEl?.value && B(() => {
|
|
2031
2006
|
const $ = () => {
|
|
2032
2007
|
const s = e.triggerEl?.value;
|
|
2033
2008
|
if (!s) return;
|
|
@@ -2038,24 +2013,24 @@ function wt(e) {
|
|
|
2038
2013
|
}
|
|
2039
2014
|
), {
|
|
2040
2015
|
popupRef: t,
|
|
2041
|
-
activate:
|
|
2042
|
-
deactivate:
|
|
2043
|
-
lastCloseReason: X(
|
|
2044
|
-
setPopupEl: (
|
|
2016
|
+
activate: p,
|
|
2017
|
+
deactivate: A,
|
|
2018
|
+
lastCloseReason: X(T),
|
|
2019
|
+
setPopupEl: (D) => t.value = D
|
|
2045
2020
|
};
|
|
2046
2021
|
}
|
|
2047
2022
|
export {
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2023
|
+
Ye as useFieldsetTouchTracker,
|
|
2024
|
+
We as useFieldsetValidationKit,
|
|
2025
|
+
it as useGridA11y,
|
|
2026
|
+
st as useGridActiveFilter,
|
|
2027
|
+
ut as useGridRowAction,
|
|
2028
|
+
ft as useMaskedDateInput,
|
|
2029
|
+
pt as useMaskedDateRangeInput,
|
|
2030
|
+
mt as useMaskedTimeInput,
|
|
2031
|
+
dt as usePopupMenu,
|
|
2032
|
+
vt as usePopupTrap,
|
|
2033
|
+
ct as useUSAddress,
|
|
2034
|
+
Ze as useZipTextBox
|
|
2060
2035
|
};
|
|
2061
2036
|
//# sourceMappingURL=featherk-composables.es.js.map
|