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