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