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