@featherk/composables 0.9.7 → 0.9.8
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/dist/featherk-composables.es.js +1053 -1043
- 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/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 Z, computed as d, watchEffect as Fe, toValue as le, reactive as Re, watch as de, onMounted as Me, readonly as X, 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 p = 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 p ? b.contains(p) : !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 p = [
|
|
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 ?? p, 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 p = b.findIndex(
|
|
59
|
+
(v) => v === document.activeElement
|
|
60
60
|
);
|
|
61
|
-
let E =
|
|
62
|
-
o.code === "ArrowUp" ? E =
|
|
61
|
+
let E = p;
|
|
62
|
+
o.code === "ArrowUp" ? E = p > 0 ? p - 1 : b.length - 1 : o.code === "ArrowDown" && (E = p < b.length - 1 ? p + 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 p = l.value?.parentElement;
|
|
68
|
+
(o.shiftKey ? p?.previousElementSibling : p?.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 p = u;
|
|
78
|
+
if (p.classList.contains("k-animation-container")) {
|
|
79
|
+
const v = l.value;
|
|
80
|
+
v && (v.dataset.featherKSortable === "true" || Z(() => {
|
|
81
|
+
p.querySelectorAll(
|
|
82
82
|
".k-columnmenu-item-wrapper"
|
|
83
83
|
).forEach((Y) => {
|
|
84
84
|
Y.textContent?.toLowerCase().includes("sort") && Y.remove();
|
|
85
85
|
});
|
|
86
|
-
})),
|
|
86
|
+
})), p.addEventListener(
|
|
87
87
|
"keydown",
|
|
88
|
-
|
|
89
|
-
),
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
88
|
+
h
|
|
89
|
+
), Z(() => {
|
|
90
|
+
const M = () => {
|
|
91
|
+
const L = Array.from(
|
|
92
|
+
p.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
|
+
p.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 p = u;
|
|
119
|
+
p.classList.contains("k-animation-container") && p.removeEventListener(
|
|
120
120
|
"keydown",
|
|
121
|
-
|
|
122
|
-
),
|
|
121
|
+
h
|
|
122
|
+
), p.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
|
+
}, H = (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
|
}, f = (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 p = ["ArrowLeft", "ArrowRight"].includes(
|
|
153
153
|
o.code
|
|
154
154
|
);
|
|
155
|
-
if (!(
|
|
155
|
+
if (!(H(b) && !(u && p))) {
|
|
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
|
+
}, w = () => {
|
|
224
|
+
Z(() => {
|
|
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
|
+
}, V = () => {
|
|
231
|
+
if (!g)
|
|
232
232
|
try {
|
|
233
233
|
const o = () => {
|
|
234
234
|
try {
|
|
235
|
-
const
|
|
235
|
+
const p = 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 (!p || p.length === 0 || p.filter(
|
|
241
|
+
(M) => M.getAttribute("tabindex") === "0"
|
|
242
242
|
).length === 1) return;
|
|
243
|
-
const
|
|
244
|
-
(
|
|
243
|
+
const v = p.find(
|
|
244
|
+
(M) => M === document.activeElement || M.contains(document.activeElement)
|
|
245
245
|
);
|
|
246
|
-
if (
|
|
247
|
-
|
|
246
|
+
if (p.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
|
+
p[0].setAttribute("tabindex", "0");
|
|
251
|
+
} catch (p) {
|
|
252
|
+
console.error("ensureSingleTabindex error:", p);
|
|
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((p, E) => {
|
|
260
|
+
p.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
|
+
}, N = () => {
|
|
270
|
+
Z(() => {
|
|
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
|
+
}, J = () => {
|
|
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, p) => {
|
|
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[p]) {
|
|
299
|
+
const a = v[p].field ?? "";
|
|
300
|
+
u.setAttribute("data-feather-k-field", a), u.setAttribute(
|
|
301
301
|
"data-feather-k-filterable",
|
|
302
|
-
|
|
303
|
-
),
|
|
302
|
+
v[p].filterable === !1 ? "false" : "true"
|
|
303
|
+
), u.setAttribute(
|
|
304
304
|
"data-feather-k-sortable",
|
|
305
|
-
|
|
305
|
+
v[p].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 = (p) => {
|
|
341
|
+
const E = p.target.closest("th");
|
|
342
|
+
E && (y(p) || p.code === "Space") && E.dataset.featherKFilterable === "false" && E.dataset.featherKSortable === "false" && (p.preventDefault(), p.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, p = R();
|
|
359
|
+
if (!u || !p) return;
|
|
360
|
+
const E = u.classList.contains("k-grid-header-menu"), v = u.classList.contains("k-columnmenu-item"), M = p.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" && Z(() => {
|
|
369
|
+
l.value && l.value.focus(), b(o), Z(() => {
|
|
370
|
+
j();
|
|
371
371
|
});
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
-
},
|
|
375
|
-
if (!
|
|
374
|
+
}, ie = () => {
|
|
375
|
+
if (!D)
|
|
376
376
|
try {
|
|
377
|
-
|
|
377
|
+
w(), V(), N(), D = !0;
|
|
378
378
|
} catch (o) {
|
|
379
|
-
console.error("initA11y failed:", o),
|
|
379
|
+
console.error("initA11y failed:", o), J();
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
return Ve(() => {
|
|
383
|
-
|
|
383
|
+
J();
|
|
384
384
|
}), {
|
|
385
385
|
activeFilterButton: l,
|
|
386
386
|
handleGridKeyDown: f,
|
|
387
|
-
handleSortChange:
|
|
388
|
-
initA11y:
|
|
387
|
+
handleSortChange: ee,
|
|
388
|
+
initA11y: ie
|
|
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 H = Ze(I);
|
|
405
|
+
Z(() => {
|
|
406
|
+
h.isConnected && h.setSelectionRange(H, H);
|
|
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
|
|
423
|
+
handleZipInput: (...h) => {
|
|
424
|
+
const I = h[0], f = I?.event?.target, w = I?.value, V = Array.isArray(w) ? w.join("") : String(w ?? ""), N = f?.selectionStart !== void 0 && f.selectionStart !== null ? He(
|
|
425
425
|
f.value,
|
|
426
426
|
f.selectionStart
|
|
427
|
-
) :
|
|
428
|
-
t.value = Ie(
|
|
427
|
+
) : V.replace(/\D/g, "").length;
|
|
428
|
+
t.value = Ie(V), f && T(f, N);
|
|
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 && Z(() => {
|
|
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: H, resetZip: f } = Je(g, R), {
|
|
645
|
+
strictAddress1Valid: w,
|
|
646
|
+
strictCityValid: V,
|
|
647
|
+
strictStateValid: N,
|
|
648
|
+
strictZipValid: J,
|
|
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: ie, fieldsetValidate: o, onFocusout: b, reset: u } = ee, p = ee.createFieldValidationsMap({
|
|
657
|
+
address1: w,
|
|
658
|
+
city: V,
|
|
659
|
+
state: N,
|
|
660
|
+
zip: J,
|
|
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
|
+
} = p, 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
|
+
), K = d(
|
|
679
|
+
() => m.value ? Y.value : !0
|
|
680
|
+
), B = { value: null, label: "State" }, W = je.map(({ label: s, value: S }) => ({
|
|
681
|
+
label: s,
|
|
682
|
+
value: S
|
|
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 && (!w.value || !V.value || !N.value)), _ = d(() => {
|
|
690
|
+
const s = g.zip.replace(/\D/g, "");
|
|
691
|
+
return !m.value && F.value && s.length !== 5 && s.length !== 9;
|
|
692
|
+
}), Q = d(() => !m.value && F.value && !j.value), O = d(() => !m.value && Q.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: ie,
|
|
701
|
+
addressValidate: ae,
|
|
702
|
+
address1Valid: se,
|
|
703
|
+
cityValid: a,
|
|
704
|
+
stateValid: c,
|
|
705
|
+
zipValid: $,
|
|
706
|
+
addressValid: K,
|
|
707
|
+
optionalFeedbackActive: O,
|
|
708
|
+
optionalPartialInvalid: Q,
|
|
709
|
+
optionalMissingRequiredFields: q,
|
|
710
|
+
optionalZipInvalid: _,
|
|
711
|
+
stateDefaultItem: B,
|
|
712
|
+
stateOptions: W,
|
|
713
|
+
zipDisplay: k,
|
|
714
|
+
zipWrapperClass: I,
|
|
715
|
+
onAddress1Input: C,
|
|
716
|
+
onAddress2Input: A,
|
|
717
|
+
onCityInput: x,
|
|
718
|
+
onStateChange: T,
|
|
719
|
+
onZipInput: H,
|
|
720
|
+
onFieldsetFocusout: (s) => {
|
|
721
|
+
const S = et(t.value, s);
|
|
722
|
+
b(s), !m.value && S && (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 Z(), 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(), f();
|
|
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
|
+
}), H = (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 (j(
|
|
752
|
-
const
|
|
753
|
-
|
|
756
|
+
if ((t.value ?? "").length === 10 && y.value.length === 8) {
|
|
757
|
+
const [c, $, K] = t.value.split("/"), B = parseInt(c), W = parseInt($), n = parseInt(K);
|
|
758
|
+
if (j(n, B, W)) {
|
|
759
|
+
const i = N(n, B, W);
|
|
760
|
+
f(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 (j(
|
|
764
|
-
return
|
|
764
|
+
}, f = (a) => {
|
|
765
|
+
const c = e.min ?? void 0, $ = e.max ?? void 0;
|
|
766
|
+
return !(c && a < c || $ && a > $);
|
|
767
|
+
}, w = d(() => {
|
|
768
|
+
if ((t.value ?? "").length === 10 && y.value.length === 8) {
|
|
769
|
+
const [a, c, $] = (t.value ?? "").split("/"), K = parseInt(a), B = parseInt(c), W = parseInt($);
|
|
770
|
+
if (j(W, K, B))
|
|
771
|
+
return N(W, K, B);
|
|
765
772
|
}
|
|
766
773
|
return null;
|
|
767
|
-
}),
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
l.value =
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
774
|
+
}), V = d(() => (t.value ?? "").length === 10 && y.value.length === 8), N = (a, c, $) => {
|
|
775
|
+
const K = /* @__PURE__ */ new Date(0);
|
|
776
|
+
return K.setFullYear(a, c - 1, $), K.setHours(0, 0, 0, 0), K;
|
|
777
|
+
}, J = (a, c) => N(a, c + 1, 0).getDate(), j = (a, c, $) => c >= 1 && c <= 12 && a >= C && $ >= 1 && $ <= J(a, c), ee = (a) => {
|
|
778
|
+
t.value = a.value;
|
|
779
|
+
const c = a.event?.target;
|
|
780
|
+
l.value = c?.selectionStart ?? 0, H(a);
|
|
781
|
+
}, ie = (a) => {
|
|
782
|
+
l.value = a.target.selectionStart ?? 0;
|
|
783
|
+
}, o = (a, c, $) => {
|
|
784
|
+
const K = c?.selectionStart ?? l.value ?? 0;
|
|
785
|
+
l.value = K;
|
|
786
|
+
let B = parseInt(k.value), W = parseInt(h.value), n = parseInt(I.value);
|
|
787
|
+
if (!(y.value.length >= 8) || !j(n, B, W)) {
|
|
788
|
+
const z = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
789
|
+
B = z.getMonth() + 1, W = z.getDate(), n = z.getFullYear(), t.value = `${String(B).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 = N(n, B, W);
|
|
794
|
+
e.onChange({ value: f(ue) ? ue : null, event: $ }), v({ useRAF: !0 });
|
|
785
795
|
return;
|
|
786
796
|
}
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
B =
|
|
790
|
-
else if (
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
} else
|
|
794
|
-
t.value = `${String(B).padStart(2, "0")}/${String(
|
|
797
|
+
const F = R(K);
|
|
798
|
+
if (F === "mm")
|
|
799
|
+
B = a === "ArrowUp" ? B < 12 ? B + 1 : 1 : B > 1 ? B - 1 : 12;
|
|
800
|
+
else if (F === "dd") {
|
|
801
|
+
const z = new Date(n, B, 0).getDate();
|
|
802
|
+
W = a === "ArrowUp" ? W < z ? W + 1 : 1 : W > 1 ? W - 1 : z;
|
|
803
|
+
} else F === "yyyy" && (n = a === "ArrowUp" ? n + 1 : Math.max(1, n - 1));
|
|
804
|
+
t.value = `${String(B).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, _, Q] = t.value.split("/"), O = N(
|
|
809
|
+
parseInt(Q),
|
|
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(Q) >= 1e3 ? e.onChange({
|
|
814
|
+
value: f(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
|
+
}, p = (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 K = a?.pos ?? l.value ?? $.value.length;
|
|
848
858
|
try {
|
|
849
|
-
|
|
859
|
+
$.focus(), $.setSelectionRange(K, K);
|
|
850
860
|
} catch {
|
|
851
861
|
}
|
|
852
862
|
};
|
|
853
|
-
|
|
854
|
-
if (
|
|
855
|
-
setTimeout(
|
|
863
|
+
Z(() => {
|
|
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"), K = c.getDate().toString().padStart(2, "0"), B = c.getFullYear().toString();
|
|
882
|
+
t.value = `${$}/${K}/${B}`, 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 (!V.value) return !0;
|
|
911
|
+
const c = w.value;
|
|
912
|
+
return c ? f(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 = w.value;
|
|
916
|
+
return !V.value || !a ? !1 : f(a);
|
|
917
|
+
}), Y = d(() => {
|
|
918
|
+
if (!g.value) {
|
|
919
|
+
if (!V.value) return;
|
|
920
|
+
const c = w.value;
|
|
921
|
+
return c ? f(c) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
912
922
|
}
|
|
913
|
-
if (!
|
|
914
|
-
if (
|
|
923
|
+
if (!A.value) return;
|
|
924
|
+
if (y.value.length === 0 || !V.value)
|
|
915
925
|
return "incomplete";
|
|
916
|
-
const
|
|
917
|
-
return
|
|
918
|
-
}),
|
|
919
|
-
const
|
|
920
|
-
if (!
|
|
921
|
-
if (
|
|
926
|
+
const a = w.value;
|
|
927
|
+
return a ? f(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
|
+
Z(() => {
|
|
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,70 @@ 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: X(Y),
|
|
985
|
+
validationMessage: ae,
|
|
986
|
+
digitsOnly: y,
|
|
987
|
+
month: X(k),
|
|
988
|
+
day: X(h),
|
|
989
|
+
year: X(I),
|
|
990
|
+
datePart: R,
|
|
991
|
+
handleChange: ee,
|
|
992
|
+
handleKeyDown: b,
|
|
993
|
+
handleWheel: u,
|
|
994
|
+
handleKeyUp: p,
|
|
995
|
+
handleClick: ie,
|
|
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, S) => s >= 1 && s <= 12 && r >= 1e3 && S >= 1 && S <= 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), S = e.max ?? /* @__PURE__ */ new Date(), P = h(r);
|
|
1007
|
+
return P < h(s) || P > h(S) ? null : r;
|
|
1008
|
+
}, H = (r, s) => e.allowReverse ?? !1 ? !0 : r <= s, f = d(() => (t.value?.length ?? 0) >= 23 && y.value.length >= 16), w = (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), S = r.substring(13, 23), [P, te, ne] = s.split("/").map((pe) => parseInt(pe || "0", 10)), [fe, ve, me] = S.split("/").map((pe) => parseInt(pe || "0", 10)), ge = new Date(ne, P - 1, te), he = new Date(me, fe - 1, ve), we = k(ne, P, 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
|
-
}),
|
|
1013
|
+
}, V = e.externalValid ?? U(!0), N = d(() => w(t.value)), J = d(() => {
|
|
1014
|
+
const r = I(N.value.start), s = I(N.value.end);
|
|
1015
|
+
return { start: r, end: s };
|
|
1016
|
+
}), j = d(() => {
|
|
1007
1017
|
if (!f.value) return;
|
|
1008
|
-
const
|
|
1009
|
-
if (!
|
|
1010
|
-
const
|
|
1011
|
-
return Math.round(
|
|
1012
|
-
}),
|
|
1018
|
+
const r = J.value.start, s = J.value.end;
|
|
1019
|
+
if (!r || !s) return;
|
|
1020
|
+
const S = Math.abs(h(s) - h(r));
|
|
1021
|
+
return Math.round(S / 864e5 + 1);
|
|
1022
|
+
}), ee = d(() => {
|
|
1013
1023
|
if (!f.value) return !1;
|
|
1014
|
-
const { start:
|
|
1015
|
-
if (!
|
|
1016
|
-
const
|
|
1017
|
-
return !(!
|
|
1018
|
-
}),
|
|
1019
|
-
const { start:
|
|
1024
|
+
const { start: r, end: s } = N.value;
|
|
1025
|
+
if (!r || !s || !J.value.start || !J.value.end) return !1;
|
|
1026
|
+
const S = J.value.start, P = J.value.end;
|
|
1027
|
+
return !(!H(S, P) || typeof e.maxSpanDays == "number" && j.value !== void 0 && j.value > e.maxSpanDays);
|
|
1028
|
+
}), ie = d(() => {
|
|
1029
|
+
const { start: r, end: s } = N.value;
|
|
1020
1030
|
if (!f.value) return "incomplete";
|
|
1021
|
-
if (!
|
|
1022
|
-
if (!
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1025
|
-
}), o =
|
|
1026
|
-
if (
|
|
1027
|
-
const { min:
|
|
1028
|
-
if (!
|
|
1029
|
-
switch (
|
|
1031
|
+
if (!r || !s) return "invalid-date";
|
|
1032
|
+
if (!J.value.start || !J.value.end) return "out-of-bounds";
|
|
1033
|
+
const S = J.value.start, P = J.value.end;
|
|
1034
|
+
return H(S, P) ? typeof e.maxSpanDays == "number" && j.value !== void 0 && j.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
|
|
1035
|
+
}), o = U(void 0), b = d(() => {
|
|
1036
|
+
if (V.value !== !1) return "";
|
|
1037
|
+
const { min: r, max: s } = e, S = o.value;
|
|
1038
|
+
if (!S) return "";
|
|
1039
|
+
switch (S) {
|
|
1030
1040
|
case "incomplete":
|
|
1031
1041
|
return "Required";
|
|
1032
1042
|
case "invalid-date":
|
|
@@ -1034,154 +1044,154 @@ function pt(e) {
|
|
|
1034
1044
|
case "reversed-range":
|
|
1035
1045
|
return "End Date must be on or after Start Date.";
|
|
1036
1046
|
case "out-of-bounds":
|
|
1037
|
-
return
|
|
1047
|
+
return r && s ? `Dates must be between ${v(r)} and ${v(s)}.` : "Dates must be within the allowed range.";
|
|
1038
1048
|
case "span-exceeds-limit":
|
|
1039
1049
|
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
1040
1050
|
default:
|
|
1041
1051
|
return "";
|
|
1042
1052
|
}
|
|
1043
|
-
}),
|
|
1044
|
-
|
|
1053
|
+
}), u = ["ArrowUp", "ArrowDown"], p = ["ArrowLeft", "ArrowRight"], E = (r, s) => String(r).padStart(s, "0"), v = (r) => `${E(r.getMonth() + 1, 2)}/${E(r.getDate(), 2)}/${E(
|
|
1054
|
+
r.getFullYear(),
|
|
1045
1055
|
4
|
|
1046
|
-
)}`,
|
|
1047
|
-
const
|
|
1048
|
-
l.value =
|
|
1049
|
-
const { start:
|
|
1050
|
-
if (!
|
|
1051
|
-
const G = /* @__PURE__ */ new Date(),
|
|
1052
|
-
t.value = `${
|
|
1056
|
+
)}`, 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, S) => {
|
|
1057
|
+
const P = s?.selectionStart ?? l.value ?? 0;
|
|
1058
|
+
l.value = P;
|
|
1059
|
+
const { start: te, end: ne } = w(t.value);
|
|
1060
|
+
if (!te && !ne) {
|
|
1061
|
+
const G = /* @__PURE__ */ new Date(), ce = v(G);
|
|
1062
|
+
t.value = `${ce} - ${ce}`, e.onChange({ value: { start: G, end: G }, event: S }), Z(() => {
|
|
1053
1063
|
requestAnimationFrame(() => {
|
|
1054
1064
|
const re = document.getElementById(
|
|
1055
1065
|
e.id
|
|
1056
|
-
),
|
|
1057
|
-
re && (re.focus(), re.setSelectionRange(
|
|
1066
|
+
), oe = l.value ?? 0;
|
|
1067
|
+
re && (re.focus(), re.setSelectionRange(oe, oe));
|
|
1058
1068
|
});
|
|
1059
1069
|
});
|
|
1060
1070
|
return;
|
|
1061
1071
|
}
|
|
1062
|
-
const
|
|
1063
|
-
let me =
|
|
1064
|
-
const he = (G,
|
|
1065
|
-
if (
|
|
1066
|
-
const re = G.getMonth() + 1,
|
|
1067
|
-
G.setMonth(
|
|
1068
|
-
const Se =
|
|
1072
|
+
const fe = /* @__PURE__ */ new Date(), ve = M(P);
|
|
1073
|
+
let me = te ? new Date(te) : new Date(fe), ge = ne ? new Date(ne) : new Date(fe);
|
|
1074
|
+
const he = (G, ce) => {
|
|
1075
|
+
if (ce === "mm") {
|
|
1076
|
+
const re = G.getMonth() + 1, oe = r === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
|
|
1077
|
+
G.setMonth(oe - 1);
|
|
1078
|
+
const Se = R(G.getFullYear(), oe);
|
|
1069
1079
|
G.getDate() > Se && G.setDate(Se);
|
|
1070
|
-
} else if (
|
|
1071
|
-
const re =
|
|
1080
|
+
} else if (ce === "dd") {
|
|
1081
|
+
const re = R(G.getFullYear(), G.getMonth() + 1), oe = G.getDate(), Se = r === "ArrowUp" ? oe < re ? oe + 1 : 1 : oe > 1 ? oe - 1 : re;
|
|
1072
1082
|
G.setDate(Se);
|
|
1073
|
-
} else if (
|
|
1083
|
+
} else if (ce === "yyyy") {
|
|
1074
1084
|
const re = G.getFullYear();
|
|
1075
|
-
G.setFullYear(
|
|
1076
|
-
const
|
|
1077
|
-
G.getDate() >
|
|
1085
|
+
G.setFullYear(r === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
|
|
1086
|
+
const oe = R(G.getFullYear(), G.getMonth() + 1);
|
|
1087
|
+
G.getDate() > oe && G.setDate(oe);
|
|
1078
1088
|
}
|
|
1079
1089
|
};
|
|
1080
1090
|
ve.side === "start" ? he(me, ve.part) : he(ge, ve.part);
|
|
1081
|
-
const we =
|
|
1091
|
+
const we = v(me), Ae = v(ge);
|
|
1082
1092
|
t.value = `${we} - ${Ae}`;
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1093
|
+
const pe = I(me), ke = I(ge);
|
|
1094
|
+
pe && ke && H(pe, ke) ? e.onChange({ value: { start: pe, end: ke }, event: S }) : e.onChange({ value: null, event: S }), Z(() => {
|
|
1085
1095
|
requestAnimationFrame(() => {
|
|
1086
1096
|
const G = document.getElementById(
|
|
1087
1097
|
e.id
|
|
1088
|
-
),
|
|
1089
|
-
G && (G.focus(), G.setSelectionRange(
|
|
1098
|
+
), ce = l.value ?? 0;
|
|
1099
|
+
G && (G.focus(), G.setSelectionRange(ce, ce));
|
|
1090
1100
|
});
|
|
1091
1101
|
});
|
|
1092
|
-
}, Y = (
|
|
1093
|
-
const { start:
|
|
1094
|
-
if (!
|
|
1095
|
-
e.onChange({ value: null, event:
|
|
1102
|
+
}, Y = (r) => {
|
|
1103
|
+
const { start: s, end: S } = w(t.value);
|
|
1104
|
+
if (!s || !S) {
|
|
1105
|
+
e.onChange({ value: null, event: r });
|
|
1096
1106
|
return;
|
|
1097
1107
|
}
|
|
1098
|
-
const
|
|
1099
|
-
if (!
|
|
1100
|
-
e.onChange({ value: null, event:
|
|
1108
|
+
const P = I(s), te = I(S);
|
|
1109
|
+
if (!P || !te) {
|
|
1110
|
+
e.onChange({ value: null, event: r });
|
|
1101
1111
|
return;
|
|
1102
1112
|
}
|
|
1103
|
-
if (!
|
|
1104
|
-
e.onChange({ value: null, event:
|
|
1113
|
+
if (!H(P, te)) {
|
|
1114
|
+
e.onChange({ value: null, event: r });
|
|
1105
1115
|
return;
|
|
1106
1116
|
}
|
|
1107
|
-
e.onChange({ value: { start:
|
|
1108
|
-
},
|
|
1109
|
-
const
|
|
1110
|
-
if (!
|
|
1111
|
-
|
|
1117
|
+
e.onChange({ value: { start: P, end: te }, event: r });
|
|
1118
|
+
}, ae = (r) => {
|
|
1119
|
+
const s = r.value ?? "", S = r.event;
|
|
1120
|
+
if (!s && S && S.type === "click") {
|
|
1121
|
+
W(S);
|
|
1112
1122
|
return;
|
|
1113
1123
|
}
|
|
1114
|
-
t.value =
|
|
1115
|
-
const
|
|
1116
|
-
l.value =
|
|
1117
|
-
},
|
|
1118
|
-
l.value =
|
|
1119
|
-
},
|
|
1120
|
-
if (
|
|
1121
|
-
|
|
1124
|
+
t.value = s;
|
|
1125
|
+
const P = S?.target;
|
|
1126
|
+
l.value = P?.selectionStart ?? 0, Y(r);
|
|
1127
|
+
}, se = (r) => {
|
|
1128
|
+
l.value = r.target.selectionStart ?? 0;
|
|
1129
|
+
}, a = (r) => {
|
|
1130
|
+
if (r.code === "Space" || r.key === " ") {
|
|
1131
|
+
r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
|
|
1122
1132
|
return;
|
|
1123
1133
|
}
|
|
1124
|
-
if (
|
|
1125
|
-
|
|
1134
|
+
if (r.key === "ArrowDown" && r.altKey) {
|
|
1135
|
+
r.preventDefault(), r.stopPropagation(), e.onShowCalendar(r);
|
|
1126
1136
|
return;
|
|
1127
1137
|
}
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1138
|
+
if (u.includes(r.key)) {
|
|
1139
|
+
r.preventDefault(), r.stopPropagation();
|
|
1140
|
+
const s = r.target;
|
|
1141
|
+
L(r.key, s, r);
|
|
1132
1142
|
return;
|
|
1133
1143
|
}
|
|
1134
|
-
},
|
|
1135
|
-
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
},
|
|
1139
|
-
if (
|
|
1140
|
-
const
|
|
1141
|
-
l.value =
|
|
1144
|
+
}, c = (r) => {
|
|
1145
|
+
r.preventDefault();
|
|
1146
|
+
const s = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1147
|
+
L(s, r.target, r);
|
|
1148
|
+
}, $ = (r) => {
|
|
1149
|
+
if (p.includes(r.key) || u.includes(r.key)) {
|
|
1150
|
+
const s = r.target;
|
|
1151
|
+
l.value = s?.selectionStart ?? 0;
|
|
1142
1152
|
}
|
|
1143
|
-
},
|
|
1144
|
-
o.value =
|
|
1145
|
-
},
|
|
1146
|
-
|
|
1147
|
-
},
|
|
1148
|
-
console.log("Clear event:",
|
|
1149
|
-
const
|
|
1153
|
+
}, K = () => {
|
|
1154
|
+
o.value = ie.value, (e.manageValid ?? !0) && (V.value = ee.value);
|
|
1155
|
+
}, B = (r) => {
|
|
1156
|
+
K();
|
|
1157
|
+
}, W = (r) => {
|
|
1158
|
+
console.log("Clear event:", r), t.value = "", l.value = 0, e.onChange({ value: null, event: r }), K(), Z(() => {
|
|
1159
|
+
const s = document.getElementById(
|
|
1150
1160
|
e.id
|
|
1151
1161
|
);
|
|
1152
|
-
|
|
1162
|
+
s && (s.focus(), s.setSelectionRange(0, 0));
|
|
1153
1163
|
});
|
|
1154
1164
|
};
|
|
1155
1165
|
e.externalValue && de(
|
|
1156
1166
|
e.externalValue,
|
|
1157
|
-
(
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
if (t.value = `${
|
|
1161
|
-
const
|
|
1167
|
+
(r) => {
|
|
1168
|
+
const s = r?.start ?? null, S = r?.end ?? null;
|
|
1169
|
+
if (s && S) {
|
|
1170
|
+
if (t.value = `${v(s)} - ${v(S)}`, e.isOpen?.value && m.value && e.onRequestClose) {
|
|
1171
|
+
const P = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
|
|
1162
1172
|
setTimeout(() => {
|
|
1163
|
-
e.onRequestClose?.(),
|
|
1164
|
-
},
|
|
1173
|
+
e.onRequestClose?.(), m.value = !1, K();
|
|
1174
|
+
}, P);
|
|
1165
1175
|
}
|
|
1166
1176
|
return;
|
|
1167
1177
|
}
|
|
1168
1178
|
},
|
|
1169
1179
|
{ immediate: !0 }
|
|
1170
1180
|
);
|
|
1171
|
-
const
|
|
1181
|
+
const n = d(
|
|
1172
1182
|
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
1173
|
-
), i =
|
|
1183
|
+
), i = d(
|
|
1174
1184
|
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
1175
|
-
),
|
|
1185
|
+
), F = d(
|
|
1176
1186
|
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
1177
|
-
),
|
|
1187
|
+
), q = d(
|
|
1178
1188
|
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
1179
|
-
),
|
|
1189
|
+
), _ = d(
|
|
1180
1190
|
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
1181
|
-
),
|
|
1191
|
+
), Q = d(
|
|
1182
1192
|
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
1183
|
-
),
|
|
1184
|
-
const { start:
|
|
1193
|
+
), O = d(() => {
|
|
1194
|
+
const { start: r, end: s } = w(t.value);
|
|
1185
1195
|
return [
|
|
1186
1196
|
{
|
|
1187
1197
|
label: "Raw",
|
|
@@ -1197,209 +1207,209 @@ function pt(e) {
|
|
|
1197
1207
|
},
|
|
1198
1208
|
{
|
|
1199
1209
|
label: "Start",
|
|
1200
|
-
value: `${String(
|
|
1210
|
+
value: `${String(n.value).padStart(2, "0")} / ${String(
|
|
1201
1211
|
i.value
|
|
1202
|
-
).padStart(2, "0")} / ${String(
|
|
1212
|
+
).padStart(2, "0")} / ${String(F.value).padStart(4, "0")}`
|
|
1203
1213
|
},
|
|
1204
1214
|
{
|
|
1205
1215
|
label: "End",
|
|
1206
|
-
value: `${String(
|
|
1207
|
-
|
|
1208
|
-
).padStart(2, "0")} / ${String(
|
|
1216
|
+
value: `${String(q.value).padStart(2, "0")} / ${String(
|
|
1217
|
+
_.value
|
|
1218
|
+
).padStart(2, "0")} / ${String(Q.value).padStart(4, "0")}`
|
|
1209
1219
|
},
|
|
1210
|
-
{ label: "Digits only", value:
|
|
1220
|
+
{ label: "Digits only", value: y.value },
|
|
1211
1221
|
{ label: "Mask complete", value: `${f.value}` },
|
|
1212
1222
|
{
|
|
1213
1223
|
label: "Parsed",
|
|
1214
|
-
value: `${
|
|
1224
|
+
value: `${r ? r.toDateString() : "-"} | ${s ? s.toDateString() : "-"}`
|
|
1215
1225
|
},
|
|
1216
1226
|
{
|
|
1217
1227
|
label: "Valid (managed)",
|
|
1218
|
-
value: `${
|
|
1228
|
+
value: `${V.value ?? "-"}`
|
|
1219
1229
|
},
|
|
1220
|
-
{ label: "Span (days)", value: `${
|
|
1230
|
+
{ label: "Span (days)", value: `${j.value ?? "-"}` },
|
|
1221
1231
|
{
|
|
1222
1232
|
label: "Reason",
|
|
1223
|
-
value: `${
|
|
1233
|
+
value: `${ie.value ?? "-"}`
|
|
1224
1234
|
},
|
|
1225
1235
|
{
|
|
1226
1236
|
label: "Cursor in",
|
|
1227
1237
|
value: `${l.value ?? "-"} (${(() => {
|
|
1228
|
-
const
|
|
1229
|
-
return `${
|
|
1238
|
+
const S = l.value ?? 0, P = M(S);
|
|
1239
|
+
return `${P.side}.${P.part}`;
|
|
1230
1240
|
})()})`
|
|
1231
1241
|
}
|
|
1232
1242
|
];
|
|
1233
|
-
}),
|
|
1234
|
-
|
|
1235
|
-
const
|
|
1236
|
-
if (!
|
|
1243
|
+
}), z = () => {
|
|
1244
|
+
Z(() => {
|
|
1245
|
+
const r = document.getElementById(e.id);
|
|
1246
|
+
if (!r) {
|
|
1237
1247
|
console.warn(`#${e.id} not found for styling.`);
|
|
1238
1248
|
return;
|
|
1239
1249
|
}
|
|
1240
|
-
const
|
|
1241
|
-
if (!
|
|
1250
|
+
const s = r.closest("div");
|
|
1251
|
+
if (!s) {
|
|
1242
1252
|
console.warn(`Parent div of #${e.id} not found for styling.`);
|
|
1243
1253
|
return;
|
|
1244
1254
|
}
|
|
1245
|
-
|
|
1255
|
+
s.classList.contains("fk-daterangepicker") || s.classList.add("fk-daterangepicker");
|
|
1246
1256
|
});
|
|
1247
1257
|
};
|
|
1248
1258
|
Me(() => {
|
|
1249
|
-
|
|
1259
|
+
z();
|
|
1250
1260
|
});
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1261
|
+
const ue = () => {
|
|
1262
|
+
Z(() => {
|
|
1253
1263
|
try {
|
|
1254
|
-
const
|
|
1264
|
+
const r = Array.from(
|
|
1255
1265
|
document.querySelectorAll(".k-animation-container")
|
|
1256
1266
|
);
|
|
1257
|
-
if (!
|
|
1258
|
-
const
|
|
1267
|
+
if (!r.length) return;
|
|
1268
|
+
const S = [...r].reverse().find((ne) => ne.querySelector(".k-calendar"))?.querySelector(
|
|
1259
1269
|
".k-calendar"
|
|
1260
1270
|
);
|
|
1261
|
-
if (!
|
|
1262
|
-
const
|
|
1271
|
+
if (!S) return;
|
|
1272
|
+
const P = S.querySelectorAll(
|
|
1263
1273
|
".k-calendar-table"
|
|
1264
1274
|
);
|
|
1265
|
-
let
|
|
1266
|
-
|
|
1267
|
-
|
|
1275
|
+
let te = !1;
|
|
1276
|
+
P.forEach((ne) => {
|
|
1277
|
+
ne.tabIndex === 0 && (te ? ne.tabIndex = -1 : te = !0);
|
|
1268
1278
|
});
|
|
1269
|
-
} catch (
|
|
1270
|
-
console.warn(
|
|
1279
|
+
} catch (r) {
|
|
1280
|
+
console.warn(r);
|
|
1271
1281
|
}
|
|
1272
1282
|
});
|
|
1273
1283
|
};
|
|
1274
1284
|
return e.isOpen && de(
|
|
1275
1285
|
e.isOpen,
|
|
1276
|
-
(
|
|
1277
|
-
|
|
1286
|
+
(r) => {
|
|
1287
|
+
r && setTimeout(() => ue(), 0);
|
|
1278
1288
|
},
|
|
1279
1289
|
{ immediate: !1 }
|
|
1280
1290
|
), {
|
|
1281
1291
|
raw: t,
|
|
1282
1292
|
cursorPos: l,
|
|
1283
|
-
debugEnabled:
|
|
1284
|
-
debugLines:
|
|
1285
|
-
digitsOnly:
|
|
1286
|
-
valid:
|
|
1287
|
-
validComputed:
|
|
1288
|
-
reason:
|
|
1289
|
-
validationMessage:
|
|
1290
|
-
spanDays:
|
|
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:
|
|
1293
|
+
debugEnabled: D,
|
|
1294
|
+
debugLines: O,
|
|
1295
|
+
digitsOnly: y,
|
|
1296
|
+
valid: V,
|
|
1297
|
+
validComputed: X(ee),
|
|
1298
|
+
reason: X(ie),
|
|
1299
|
+
validationMessage: X(b),
|
|
1300
|
+
spanDays: X(j),
|
|
1301
|
+
month1: X(n),
|
|
1302
|
+
day1: X(i),
|
|
1303
|
+
year1: X(F),
|
|
1304
|
+
month2: X(q),
|
|
1305
|
+
day2: X(_),
|
|
1306
|
+
year2: X(Q),
|
|
1307
|
+
handleChange: ae,
|
|
1308
|
+
handleKeyDown: a,
|
|
1309
|
+
handleWheel: c,
|
|
1310
|
+
handleKeyUp: $,
|
|
1311
|
+
handleClick: se,
|
|
1312
|
+
handleBlur: B,
|
|
1313
|
+
handleClear: W,
|
|
1304
1314
|
onCalendarChange: () => {
|
|
1305
|
-
|
|
1315
|
+
m.value = !0;
|
|
1306
1316
|
},
|
|
1307
|
-
initStyling:
|
|
1317
|
+
initStyling: z
|
|
1308
1318
|
};
|
|
1309
1319
|
}
|
|
1310
|
-
function
|
|
1311
|
-
const t =
|
|
1320
|
+
function mt(e) {
|
|
1321
|
+
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
1322
|
H: /[0-9]/,
|
|
1313
1323
|
h: /[0-9]/,
|
|
1314
1324
|
M: /[0-9]/,
|
|
1315
1325
|
m: /[0-9]/,
|
|
1316
1326
|
A: /[AaPp]/,
|
|
1317
1327
|
a: /[Mm]/
|
|
1318
|
-
},
|
|
1319
|
-
const
|
|
1328
|
+
}, R = (n) => n <= 2 ? "hh" : n <= 5 ? "mm" : "ampm", k = d(() => {
|
|
1329
|
+
const n = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", i = parseInt(n);
|
|
1320
1330
|
return Math.min(Math.max(i, 0), 23);
|
|
1321
|
-
}),
|
|
1322
|
-
const
|
|
1331
|
+
}), h = d(() => {
|
|
1332
|
+
const n = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(n);
|
|
1323
1333
|
return Math.min(Math.max(i, 0), 59);
|
|
1324
|
-
}),
|
|
1325
|
-
const
|
|
1326
|
-
return
|
|
1327
|
-
}), f =
|
|
1334
|
+
}), I = d(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), H = d(() => {
|
|
1335
|
+
const n = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = I.value;
|
|
1336
|
+
return n === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? n + 12 : n;
|
|
1337
|
+
}), f = d(() => w.value ? `${String(H.value).padStart(2, "0")}:${String(h.value).padStart(2, "0")}:00` : null), w = d(
|
|
1328
1338
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
1329
|
-
),
|
|
1330
|
-
let
|
|
1331
|
-
return
|
|
1339
|
+
), V = (n, i, F) => {
|
|
1340
|
+
let q = n % 12;
|
|
1341
|
+
return q === 0 && (q = 12), `${String(q).padStart(2, "0")}:${String(i).padStart(
|
|
1332
1342
|
2,
|
|
1333
1343
|
"0"
|
|
1334
|
-
)} ${
|
|
1335
|
-
},
|
|
1336
|
-
const i =
|
|
1344
|
+
)} ${F}`;
|
|
1345
|
+
}, N = (n) => {
|
|
1346
|
+
const i = n.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1337
1347
|
if (!i) return null;
|
|
1338
|
-
const
|
|
1339
|
-
if (
|
|
1340
|
-
let
|
|
1341
|
-
|
|
1342
|
-
const
|
|
1343
|
-
return
|
|
1344
|
-
},
|
|
1345
|
-
if (
|
|
1346
|
-
e.onChange({ value: null, event:
|
|
1348
|
+
const F = parseInt(i[1]), q = parseInt(i[2]), _ = i[3].toUpperCase();
|
|
1349
|
+
if (F < 1 || F > 12 || q < 0 || q > 59) return null;
|
|
1350
|
+
let Q = F % 12;
|
|
1351
|
+
_ === "PM" && (Q += 12);
|
|
1352
|
+
const O = /* @__PURE__ */ new Date();
|
|
1353
|
+
return O.setSeconds(0, 0), O.setHours(Q), O.setMinutes(q), O;
|
|
1354
|
+
}, J = (n) => {
|
|
1355
|
+
if (T.value.length === 0) {
|
|
1356
|
+
e.onChange({ value: null, event: n });
|
|
1347
1357
|
return;
|
|
1348
1358
|
}
|
|
1349
|
-
if (!
|
|
1350
|
-
e.onChange({ value: null, event:
|
|
1359
|
+
if (!w.value) {
|
|
1360
|
+
e.onChange({ value: null, event: n });
|
|
1351
1361
|
return;
|
|
1352
1362
|
}
|
|
1353
|
-
const i =
|
|
1354
|
-
i &&
|
|
1355
|
-
},
|
|
1356
|
-
const i = e.min ?? void 0,
|
|
1363
|
+
const i = N(t.value);
|
|
1364
|
+
i && ee(i) ? e.onChange({ value: i, event: n }) : e.onChange({ value: null, event: n });
|
|
1365
|
+
}, j = (n) => n.getHours() * 60 + n.getMinutes(), ee = (n) => {
|
|
1366
|
+
const i = e.min ?? void 0, F = e.max ?? void 0, q = j(n);
|
|
1357
1367
|
if (i) {
|
|
1358
|
-
const
|
|
1359
|
-
if (
|
|
1368
|
+
const _ = j(i);
|
|
1369
|
+
if (q < _) return !1;
|
|
1360
1370
|
}
|
|
1361
|
-
if (
|
|
1362
|
-
const
|
|
1363
|
-
if (
|
|
1371
|
+
if (F) {
|
|
1372
|
+
const _ = j(F);
|
|
1373
|
+
if (q > _) return !1;
|
|
1364
1374
|
}
|
|
1365
1375
|
return !0;
|
|
1366
|
-
},
|
|
1367
|
-
const i =
|
|
1368
|
-
t.value =
|
|
1369
|
-
}, o = (
|
|
1370
|
-
e.onChange({ value:
|
|
1371
|
-
},
|
|
1372
|
-
|
|
1376
|
+
}, ie = (n) => {
|
|
1377
|
+
const i = n.getHours(), F = i >= 12 ? "PM" : "AM";
|
|
1378
|
+
t.value = V(i, n.getMinutes(), F);
|
|
1379
|
+
}, o = (n, i) => {
|
|
1380
|
+
e.onChange({ value: n, event: i });
|
|
1381
|
+
}, b = () => {
|
|
1382
|
+
Z(() => {
|
|
1373
1383
|
requestAnimationFrame(() => {
|
|
1374
1384
|
requestAnimationFrame(() => {
|
|
1375
|
-
const
|
|
1385
|
+
const n = document.getElementById(
|
|
1376
1386
|
e.id
|
|
1377
1387
|
);
|
|
1378
|
-
if (
|
|
1379
|
-
|
|
1380
|
-
const i = (
|
|
1381
|
-
|
|
1388
|
+
if (n) {
|
|
1389
|
+
n.focus();
|
|
1390
|
+
const i = (n.value ?? "").length;
|
|
1391
|
+
n.setSelectionRange(i, i);
|
|
1382
1392
|
}
|
|
1383
1393
|
});
|
|
1384
1394
|
});
|
|
1385
1395
|
});
|
|
1386
|
-
},
|
|
1387
|
-
const i =
|
|
1396
|
+
}, u = (n) => {
|
|
1397
|
+
const i = n?.event?.target;
|
|
1388
1398
|
return i ? i.closest(".k-time-now") ? "now" : i.closest(".k-time-accept") ? "set" : null : null;
|
|
1389
|
-
},
|
|
1390
|
-
|
|
1391
|
-
}, E = (...
|
|
1392
|
-
const i =
|
|
1399
|
+
}, p = (n, i) => {
|
|
1400
|
+
n && ee(n) ? o(n, i) : o(null, i);
|
|
1401
|
+
}, E = (...n) => {
|
|
1402
|
+
const i = n[0];
|
|
1393
1403
|
if (!i) return;
|
|
1394
|
-
const
|
|
1395
|
-
if (
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1404
|
+
const F = u(i);
|
|
1405
|
+
if (F === "now") {
|
|
1406
|
+
const _ = /* @__PURE__ */ new Date();
|
|
1407
|
+
ie(_), p(_, i), b();
|
|
1398
1408
|
return;
|
|
1399
1409
|
}
|
|
1400
1410
|
if (i?.value instanceof Date) {
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1411
|
+
const _ = new Date(i.value);
|
|
1412
|
+
ie(_), p(_, i), F === "set" && b();
|
|
1403
1413
|
return;
|
|
1404
1414
|
}
|
|
1405
1415
|
if (i?.value === null) {
|
|
@@ -1407,143 +1417,143 @@ function vt(e) {
|
|
|
1407
1417
|
return;
|
|
1408
1418
|
}
|
|
1409
1419
|
t.value = i.value;
|
|
1410
|
-
const
|
|
1411
|
-
l.value =
|
|
1420
|
+
const q = i.event?.target;
|
|
1421
|
+
l.value = q?.selectionStart ?? 0;
|
|
1412
1422
|
try {
|
|
1413
|
-
const
|
|
1414
|
-
if (
|
|
1415
|
-
const
|
|
1416
|
-
/[Aa]/.test(
|
|
1423
|
+
const _ = l.value ?? 0;
|
|
1424
|
+
if (R(_) === "ampm" && (t.value ?? "").length >= 8) {
|
|
1425
|
+
const Q = t.value.charAt(6);
|
|
1426
|
+
/[Aa]/.test(Q) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, Z(() => {
|
|
1417
1427
|
requestAnimationFrame(() => {
|
|
1418
|
-
const
|
|
1428
|
+
const O = document.getElementById(
|
|
1419
1429
|
e.id
|
|
1420
1430
|
);
|
|
1421
|
-
|
|
1431
|
+
O && (O.focus(), O.setSelectionRange(8, 8));
|
|
1422
1432
|
});
|
|
1423
|
-
})) : /[Pp]/.test(
|
|
1433
|
+
})) : /[Pp]/.test(Q) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, Z(() => {
|
|
1424
1434
|
requestAnimationFrame(() => {
|
|
1425
|
-
const
|
|
1435
|
+
const O = document.getElementById(
|
|
1426
1436
|
e.id
|
|
1427
1437
|
);
|
|
1428
|
-
|
|
1438
|
+
O && (O.focus(), O.setSelectionRange(8, 8));
|
|
1429
1439
|
});
|
|
1430
1440
|
}));
|
|
1431
1441
|
}
|
|
1432
1442
|
} catch {
|
|
1433
1443
|
}
|
|
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
|
-
|
|
1444
|
+
J(i);
|
|
1445
|
+
}, v = (n) => {
|
|
1446
|
+
l.value = n.target.selectionStart ?? 0;
|
|
1447
|
+
}, M = (n, i, F) => {
|
|
1448
|
+
const q = i?.selectionStart ?? l.value ?? 0;
|
|
1449
|
+
l.value = q;
|
|
1450
|
+
const _ = R(q), Q = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1451
|
+
if (!Q) {
|
|
1452
|
+
if ((t.value ?? "").length === 0 || T.value.length === 0) {
|
|
1453
|
+
const s = /* @__PURE__ */ new Date(), S = s.getHours(), P = S >= 12 ? "PM" : "AM";
|
|
1454
|
+
t.value = V(S, s.getMinutes(), P);
|
|
1455
|
+
const te = N(t.value);
|
|
1456
|
+
p(te, F), Z(() => {
|
|
1447
1457
|
requestAnimationFrame(() => {
|
|
1448
|
-
const
|
|
1458
|
+
const ne = document.getElementById(
|
|
1449
1459
|
e.id
|
|
1450
|
-
),
|
|
1451
|
-
|
|
1460
|
+
), fe = l.value ?? 0;
|
|
1461
|
+
ne && (ne.focus(), ne.setSelectionRange(fe, fe));
|
|
1452
1462
|
});
|
|
1453
1463
|
});
|
|
1454
1464
|
}
|
|
1455
1465
|
return;
|
|
1456
1466
|
}
|
|
1457
|
-
let
|
|
1458
|
-
if (
|
|
1459
|
-
|
|
1460
|
-
else if (
|
|
1461
|
-
const
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1464
|
-
else if (
|
|
1465
|
-
const
|
|
1466
|
-
let
|
|
1467
|
-
|
|
1467
|
+
let O = parseInt(Q[1]), z = parseInt(Q[2]), ue = Q[3].toUpperCase();
|
|
1468
|
+
if (_ === "hh")
|
|
1469
|
+
n === "ArrowUp" ? O = O < 12 ? O + 1 : 1 : O = O > 1 ? O - 1 : 12;
|
|
1470
|
+
else if (_ === "mm") {
|
|
1471
|
+
const s = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
|
|
1472
|
+
if (s === 1)
|
|
1473
|
+
n === "ArrowUp" ? z = z < 59 ? z + 1 : 0 : z = z > 0 ? z - 1 : 59;
|
|
1474
|
+
else if (n === "ArrowUp") {
|
|
1475
|
+
const S = z % s;
|
|
1476
|
+
let P = S === 0 ? z + s : z + (s - S);
|
|
1477
|
+
P >= 60 && (P = 0), z = P;
|
|
1468
1478
|
} else {
|
|
1469
|
-
const
|
|
1470
|
-
let
|
|
1471
|
-
|
|
1479
|
+
const S = z % s;
|
|
1480
|
+
let P = S === 0 ? z - s : z - S;
|
|
1481
|
+
P < 0 && (P = 60 - s), z = P;
|
|
1472
1482
|
}
|
|
1473
|
-
} else
|
|
1474
|
-
t.value = `${String(
|
|
1483
|
+
} else _ === "ampm" && (ue = ue === "AM" ? "PM" : "AM");
|
|
1484
|
+
t.value = `${String(O).padStart(2, "0")}:${String(z).padStart(
|
|
1475
1485
|
2,
|
|
1476
1486
|
"0"
|
|
1477
|
-
)} ${
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1487
|
+
)} ${ue}`;
|
|
1488
|
+
const r = N(t.value);
|
|
1489
|
+
p(r, F), Z(() => {
|
|
1480
1490
|
requestAnimationFrame(() => {
|
|
1481
|
-
const
|
|
1491
|
+
const s = document.getElementById(
|
|
1482
1492
|
e.id
|
|
1483
|
-
),
|
|
1484
|
-
|
|
1493
|
+
), S = l.value ?? 0;
|
|
1494
|
+
s && (s.focus(), s.setSelectionRange(S, S));
|
|
1485
1495
|
});
|
|
1486
1496
|
});
|
|
1487
|
-
},
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1497
|
+
}, L = (n) => {
|
|
1498
|
+
if (n.code === "Space" || n.key === " ") {
|
|
1499
|
+
n.preventDefault(), n.stopPropagation(), e.onShowPicker(n);
|
|
1490
1500
|
return;
|
|
1491
1501
|
}
|
|
1492
|
-
if (
|
|
1493
|
-
|
|
1502
|
+
if (n.key === "ArrowDown" && n.altKey) {
|
|
1503
|
+
n.preventDefault(), n.stopPropagation(), e.onShowPicker(n);
|
|
1494
1504
|
return;
|
|
1495
1505
|
}
|
|
1496
|
-
if (
|
|
1497
|
-
if (
|
|
1498
|
-
|
|
1499
|
-
const i =
|
|
1500
|
-
|
|
1506
|
+
if (A.includes(n.key)) {
|
|
1507
|
+
if (n.altKey) return;
|
|
1508
|
+
n.preventDefault(), n.stopPropagation();
|
|
1509
|
+
const i = n.target;
|
|
1510
|
+
M(n.key, i, n);
|
|
1501
1511
|
return;
|
|
1502
1512
|
}
|
|
1503
|
-
}, Y = (
|
|
1504
|
-
|
|
1505
|
-
const i =
|
|
1506
|
-
|
|
1507
|
-
},
|
|
1508
|
-
const i =
|
|
1509
|
-
if (
|
|
1513
|
+
}, Y = (n) => {
|
|
1514
|
+
n.preventDefault();
|
|
1515
|
+
const i = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1516
|
+
M(i, n.target, n);
|
|
1517
|
+
}, ae = (n) => {
|
|
1518
|
+
const i = n.target;
|
|
1519
|
+
if (x.includes(n.key)) {
|
|
1510
1520
|
l.value = i?.selectionStart ?? 0;
|
|
1511
1521
|
return;
|
|
1512
1522
|
}
|
|
1513
|
-
if (
|
|
1514
|
-
if (
|
|
1523
|
+
if (A.includes(n.key)) {
|
|
1524
|
+
if (n.altKey) return;
|
|
1515
1525
|
l.value = i?.selectionStart ?? 0;
|
|
1516
1526
|
}
|
|
1517
|
-
},
|
|
1518
|
-
|
|
1519
|
-
const i =
|
|
1527
|
+
}, se = (n) => {
|
|
1528
|
+
C.value = !0, g.value && e.externalValue && e.externalValue.value === void 0 && T.value.length === 0 && (e.externalValue.value = "");
|
|
1529
|
+
const i = n.target;
|
|
1520
1530
|
i && (l.value = i.selectionStart ?? 0);
|
|
1521
1531
|
};
|
|
1522
1532
|
e.externalValue && de(
|
|
1523
1533
|
e.externalValue,
|
|
1524
|
-
(
|
|
1525
|
-
if (
|
|
1526
|
-
const i = new Date(
|
|
1534
|
+
(n) => {
|
|
1535
|
+
if (n) {
|
|
1536
|
+
const i = new Date(n);
|
|
1527
1537
|
if (i.toString() !== "Invalid Date") {
|
|
1528
|
-
const
|
|
1529
|
-
t.value =
|
|
1538
|
+
const F = i.getHours(), q = F >= 12 ? "PM" : "AM";
|
|
1539
|
+
t.value = V(F, i.getMinutes(), q);
|
|
1530
1540
|
return;
|
|
1531
1541
|
}
|
|
1532
1542
|
}
|
|
1533
1543
|
},
|
|
1534
1544
|
{ immediate: !0 }
|
|
1535
1545
|
);
|
|
1536
|
-
const
|
|
1546
|
+
const a = d(() => [
|
|
1537
1547
|
["Time", t.value || "--:-- --"],
|
|
1538
|
-
["Hour (12h)",
|
|
1539
|
-
["Hour (24h)",
|
|
1540
|
-
["Minute",
|
|
1541
|
-
["Period",
|
|
1548
|
+
["Hour (12h)", k.value],
|
|
1549
|
+
["Hour (24h)", H.value],
|
|
1550
|
+
["Minute", h.value],
|
|
1551
|
+
["Period", I.value],
|
|
1542
1552
|
["Time (24h)", f.value ?? "--:--:--"],
|
|
1543
|
-
["Digits only",
|
|
1553
|
+
["Digits only", T.value],
|
|
1544
1554
|
[
|
|
1545
1555
|
"Parsed Date",
|
|
1546
|
-
|
|
1556
|
+
c.value?.toLocaleDateString("en-US", {
|
|
1547
1557
|
hour: "2-digit",
|
|
1548
1558
|
minute: "2-digit"
|
|
1549
1559
|
}) ?? null
|
|
@@ -1562,117 +1572,117 @@ function vt(e) {
|
|
|
1562
1572
|
minute: "2-digit"
|
|
1563
1573
|
}) ?? null
|
|
1564
1574
|
],
|
|
1565
|
-
["valid",
|
|
1566
|
-
["reason",
|
|
1567
|
-
["validationMessage",
|
|
1568
|
-
]),
|
|
1569
|
-
() =>
|
|
1570
|
-
),
|
|
1571
|
-
if (
|
|
1572
|
-
if (!
|
|
1573
|
-
const i =
|
|
1574
|
-
return i ?
|
|
1575
|
+
["valid", $.value],
|
|
1576
|
+
["reason", K.value],
|
|
1577
|
+
["validationMessage", B.value]
|
|
1578
|
+
]), c = d(
|
|
1579
|
+
() => N(t.value) ?? null
|
|
1580
|
+
), $ = d(() => {
|
|
1581
|
+
if (!g.value) {
|
|
1582
|
+
if (!w.value) return !0;
|
|
1583
|
+
const i = c.value;
|
|
1584
|
+
return i ? ee(i) : !1;
|
|
1575
1585
|
}
|
|
1576
|
-
if (!
|
|
1577
|
-
const
|
|
1578
|
-
return !
|
|
1579
|
-
}),
|
|
1580
|
-
if (
|
|
1581
|
-
if (!
|
|
1582
|
-
const i =
|
|
1583
|
-
return i ?
|
|
1586
|
+
if (!C.value) return !0;
|
|
1587
|
+
const n = c.value;
|
|
1588
|
+
return !w.value || !n ? !1 : ee(n);
|
|
1589
|
+
}), K = d(() => {
|
|
1590
|
+
if (!g.value) {
|
|
1591
|
+
if (!w.value) return;
|
|
1592
|
+
const i = c.value;
|
|
1593
|
+
return i ? ee(i) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1584
1594
|
}
|
|
1585
|
-
if (!
|
|
1586
|
-
if (
|
|
1595
|
+
if (!C.value) return;
|
|
1596
|
+
if (T.value.length === 0 || !w.value)
|
|
1587
1597
|
return "incomplete";
|
|
1588
|
-
const
|
|
1589
|
-
return
|
|
1590
|
-
}),
|
|
1591
|
-
const
|
|
1592
|
-
if (!
|
|
1593
|
-
if (
|
|
1598
|
+
const n = c.value;
|
|
1599
|
+
return n ? ee(n) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
1600
|
+
}), B = d(() => {
|
|
1601
|
+
const n = K.value;
|
|
1602
|
+
if (!n || n === "valid") return "";
|
|
1603
|
+
if (n === "incomplete")
|
|
1594
1604
|
return "Required";
|
|
1595
|
-
if (
|
|
1596
|
-
return `Must be in ${
|
|
1605
|
+
if (n === "invalid-time")
|
|
1606
|
+
return `Must be in ${m.value} format.`;
|
|
1597
1607
|
const i = {
|
|
1598
1608
|
hour: "2-digit",
|
|
1599
1609
|
minute: "2-digit"
|
|
1600
|
-
},
|
|
1601
|
-
if (
|
|
1602
|
-
if (
|
|
1603
|
-
if (
|
|
1604
|
-
if (
|
|
1610
|
+
}, F = e.min ? e.min.toLocaleTimeString("en-US", i) : null, q = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
|
|
1611
|
+
if (n === "out-of-bounds") {
|
|
1612
|
+
if (F && q) return `Must be between ${F} and ${q}.`;
|
|
1613
|
+
if (F) return `Must be ${F} or later.`;
|
|
1614
|
+
if (q) return `Must be ${q} or earlier.`;
|
|
1605
1615
|
}
|
|
1606
1616
|
return "";
|
|
1607
|
-
}),
|
|
1608
|
-
|
|
1609
|
-
const
|
|
1610
|
-
if (!
|
|
1617
|
+
}), W = () => {
|
|
1618
|
+
Z(() => {
|
|
1619
|
+
const n = document.getElementById(e.id);
|
|
1620
|
+
if (!n) {
|
|
1611
1621
|
console.warn(`#${e.id} not found for styling.`);
|
|
1612
1622
|
return;
|
|
1613
1623
|
}
|
|
1614
|
-
const i =
|
|
1624
|
+
const i = n.closest(".k-timepicker");
|
|
1615
1625
|
if (!i) {
|
|
1616
1626
|
console.warn(
|
|
1617
1627
|
`.k-timepicker parent of #${e.id} not found for styling.`
|
|
1618
1628
|
);
|
|
1619
1629
|
return;
|
|
1620
1630
|
}
|
|
1621
|
-
const
|
|
1622
|
-
if (!
|
|
1631
|
+
const F = i.parentElement;
|
|
1632
|
+
if (!F) {
|
|
1623
1633
|
console.warn(
|
|
1624
1634
|
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
1625
1635
|
);
|
|
1626
1636
|
return;
|
|
1627
1637
|
}
|
|
1628
|
-
|
|
1638
|
+
F.classList.contains("fk-timepicker") || F.classList.add("fk-timepicker");
|
|
1629
1639
|
});
|
|
1630
1640
|
};
|
|
1631
1641
|
return Me(() => {
|
|
1632
|
-
|
|
1642
|
+
W();
|
|
1633
1643
|
}), {
|
|
1634
1644
|
raw: t,
|
|
1635
|
-
rules:
|
|
1636
|
-
debugEnabled:
|
|
1637
|
-
debugLines:
|
|
1638
|
-
placeholder:
|
|
1639
|
-
isValid:
|
|
1640
|
-
reason:
|
|
1641
|
-
validationMessage:
|
|
1642
|
-
isComplete:
|
|
1643
|
-
inRangeTime:
|
|
1645
|
+
rules: y,
|
|
1646
|
+
debugEnabled: D,
|
|
1647
|
+
debugLines: a,
|
|
1648
|
+
placeholder: m,
|
|
1649
|
+
isValid: $,
|
|
1650
|
+
reason: X(K),
|
|
1651
|
+
validationMessage: B,
|
|
1652
|
+
isComplete: w,
|
|
1653
|
+
inRangeTime: ee,
|
|
1644
1654
|
cursorPos: l,
|
|
1645
|
-
hour:
|
|
1646
|
-
hour24:
|
|
1647
|
-
minute:
|
|
1648
|
-
period:
|
|
1649
|
-
time24:
|
|
1650
|
-
parsedRawTime:
|
|
1655
|
+
hour: X(k),
|
|
1656
|
+
hour24: X(H),
|
|
1657
|
+
minute: X(h),
|
|
1658
|
+
period: X(I),
|
|
1659
|
+
time24: X(f),
|
|
1660
|
+
parsedRawTime: X(c),
|
|
1651
1661
|
handleChange: E,
|
|
1652
|
-
handleKeyDown:
|
|
1653
|
-
handleKeyUp:
|
|
1654
|
-
handleClick:
|
|
1662
|
+
handleKeyDown: L,
|
|
1663
|
+
handleKeyUp: ae,
|
|
1664
|
+
handleClick: v,
|
|
1655
1665
|
handleWheel: Y,
|
|
1656
|
-
handleBlur:
|
|
1666
|
+
handleBlur: se,
|
|
1657
1667
|
// Expose so consumers can reapply theming when Kendo updates DOM
|
|
1658
|
-
initStyling:
|
|
1668
|
+
initStyling: W
|
|
1659
1669
|
};
|
|
1660
1670
|
}
|
|
1661
|
-
function
|
|
1671
|
+
function tt(e) {
|
|
1662
1672
|
return Le() ? (qe(e), !0) : !1;
|
|
1663
1673
|
}
|
|
1664
|
-
const
|
|
1674
|
+
const Te = typeof window < "u" && typeof document < "u";
|
|
1665
1675
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
1666
|
-
const
|
|
1667
|
-
},
|
|
1668
|
-
function
|
|
1676
|
+
const nt = Object.prototype.toString, at = (e) => nt.call(e) === "[object Object]", ye = () => {
|
|
1677
|
+
}, rt = /* @__PURE__ */ lt();
|
|
1678
|
+
function lt() {
|
|
1669
1679
|
var e, t;
|
|
1670
|
-
return
|
|
1680
|
+
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
1681
|
}
|
|
1672
1682
|
function Ee(e) {
|
|
1673
1683
|
return Array.isArray(e) ? e : [e];
|
|
1674
1684
|
}
|
|
1675
|
-
function
|
|
1685
|
+
function ot(e, t, l) {
|
|
1676
1686
|
return de(
|
|
1677
1687
|
e,
|
|
1678
1688
|
t,
|
|
@@ -1682,7 +1692,7 @@ function lt(e, t, l) {
|
|
|
1682
1692
|
}
|
|
1683
1693
|
);
|
|
1684
1694
|
}
|
|
1685
|
-
const
|
|
1695
|
+
const Pe = Te ? window : void 0;
|
|
1686
1696
|
function be(e) {
|
|
1687
1697
|
var t;
|
|
1688
1698
|
const l = le(e);
|
|
@@ -1690,187 +1700,187 @@ function be(e) {
|
|
|
1690
1700
|
}
|
|
1691
1701
|
function xe(...e) {
|
|
1692
1702
|
const t = [], l = () => {
|
|
1693
|
-
t.forEach((
|
|
1694
|
-
},
|
|
1695
|
-
const
|
|
1696
|
-
return
|
|
1697
|
-
}),
|
|
1703
|
+
t.forEach((A) => A()), t.length = 0;
|
|
1704
|
+
}, D = (A, x, T, y) => (A.addEventListener(x, T, y), () => A.removeEventListener(x, T, y)), m = d(() => {
|
|
1705
|
+
const A = Ee(le(e[0])).filter((x) => x != null);
|
|
1706
|
+
return A.every((x) => typeof x != "string") ? A : void 0;
|
|
1707
|
+
}), g = ot(
|
|
1698
1708
|
() => {
|
|
1699
|
-
var
|
|
1709
|
+
var A, x;
|
|
1700
1710
|
return [
|
|
1701
|
-
(
|
|
1702
|
-
Ee(le(
|
|
1703
|
-
Ee(Oe(
|
|
1711
|
+
(x = (A = m.value) == null ? void 0 : A.map((T) => be(T))) != null ? x : [Pe].filter((T) => T != null),
|
|
1712
|
+
Ee(le(m.value ? e[1] : e[0])),
|
|
1713
|
+
Ee(Oe(m.value ? e[2] : e[1])),
|
|
1704
1714
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
1705
|
-
le(
|
|
1715
|
+
le(m.value ? e[3] : e[2])
|
|
1706
1716
|
];
|
|
1707
1717
|
},
|
|
1708
|
-
([
|
|
1709
|
-
if (l(), !
|
|
1718
|
+
([A, x, T, y]) => {
|
|
1719
|
+
if (l(), !A?.length || !x?.length || !T?.length)
|
|
1710
1720
|
return;
|
|
1711
|
-
const
|
|
1721
|
+
const R = at(y) ? { ...y } : y;
|
|
1712
1722
|
t.push(
|
|
1713
|
-
...
|
|
1714
|
-
(
|
|
1715
|
-
(
|
|
1723
|
+
...A.flatMap(
|
|
1724
|
+
(k) => x.flatMap(
|
|
1725
|
+
(h) => T.map((I) => D(k, h, I, R))
|
|
1716
1726
|
)
|
|
1717
1727
|
)
|
|
1718
1728
|
);
|
|
1719
1729
|
},
|
|
1720
1730
|
{ flush: "post" }
|
|
1721
|
-
),
|
|
1722
|
-
|
|
1731
|
+
), C = () => {
|
|
1732
|
+
g(), l();
|
|
1723
1733
|
};
|
|
1724
|
-
return
|
|
1734
|
+
return tt(l), C;
|
|
1725
1735
|
}
|
|
1726
1736
|
let Ce = !1;
|
|
1727
|
-
function
|
|
1728
|
-
const { window:
|
|
1729
|
-
if (!
|
|
1730
|
-
return
|
|
1731
|
-
if (
|
|
1737
|
+
function it(e, t, l = {}) {
|
|
1738
|
+
const { window: D = Pe, ignore: m = [], capture: g = !0, detectIframe: C = !1, controls: A = !1 } = l;
|
|
1739
|
+
if (!D)
|
|
1740
|
+
return A ? { stop: ye, cancel: ye, trigger: ye } : ye;
|
|
1741
|
+
if (rt && !Ce) {
|
|
1732
1742
|
Ce = !0;
|
|
1733
1743
|
const f = { passive: !0 };
|
|
1734
|
-
Array.from(
|
|
1744
|
+
Array.from(D.document.body.children).forEach((w) => w.addEventListener("click", ye, f)), D.document.documentElement.addEventListener("click", ye, f);
|
|
1735
1745
|
}
|
|
1736
|
-
let
|
|
1737
|
-
const
|
|
1738
|
-
if (typeof
|
|
1739
|
-
return Array.from(
|
|
1746
|
+
let x = !0;
|
|
1747
|
+
const T = (f) => le(m).some((w) => {
|
|
1748
|
+
if (typeof w == "string")
|
|
1749
|
+
return Array.from(D.document.querySelectorAll(w)).some((V) => V === f.target || f.composedPath().includes(V));
|
|
1740
1750
|
{
|
|
1741
|
-
const
|
|
1742
|
-
return
|
|
1751
|
+
const V = be(w);
|
|
1752
|
+
return V && (f.target === V || f.composedPath().includes(V));
|
|
1743
1753
|
}
|
|
1744
1754
|
});
|
|
1745
|
-
function
|
|
1746
|
-
const
|
|
1747
|
-
return
|
|
1755
|
+
function y(f) {
|
|
1756
|
+
const w = le(f);
|
|
1757
|
+
return w && w.$.subTree.shapeFlag === 16;
|
|
1748
1758
|
}
|
|
1749
|
-
function
|
|
1750
|
-
const
|
|
1751
|
-
return
|
|
1759
|
+
function R(f, w) {
|
|
1760
|
+
const V = le(f), N = V.$.subTree && V.$.subTree.children;
|
|
1761
|
+
return N == null || !Array.isArray(N) ? !1 : N.some((J) => J.el === w.target || w.composedPath().includes(J.el));
|
|
1752
1762
|
}
|
|
1753
|
-
const
|
|
1754
|
-
const
|
|
1755
|
-
if (f.target != null && !(!(
|
|
1756
|
-
if ("detail" in f && f.detail === 0 && (
|
|
1757
|
-
|
|
1763
|
+
const k = (f) => {
|
|
1764
|
+
const w = be(e);
|
|
1765
|
+
if (f.target != null && !(!(w instanceof Element) && y(e) && R(e, f)) && !(!w || w === f.target || f.composedPath().includes(w))) {
|
|
1766
|
+
if ("detail" in f && f.detail === 0 && (x = !T(f)), !x) {
|
|
1767
|
+
x = !0;
|
|
1758
1768
|
return;
|
|
1759
1769
|
}
|
|
1760
1770
|
t(f);
|
|
1761
1771
|
}
|
|
1762
1772
|
};
|
|
1763
|
-
let
|
|
1764
|
-
const
|
|
1765
|
-
xe(
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
}, 0),
|
|
1769
|
-
}, { passive: !0, capture:
|
|
1770
|
-
xe(
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1773
|
+
let h = !1;
|
|
1774
|
+
const I = [
|
|
1775
|
+
xe(D, "click", (f) => {
|
|
1776
|
+
h || (h = !0, setTimeout(() => {
|
|
1777
|
+
h = !1;
|
|
1778
|
+
}, 0), k(f));
|
|
1779
|
+
}, { passive: !0, capture: g }),
|
|
1780
|
+
xe(D, "pointerdown", (f) => {
|
|
1781
|
+
const w = be(e);
|
|
1782
|
+
x = !T(f) && !!(w && !f.composedPath().includes(w));
|
|
1773
1783
|
}, { passive: !0 }),
|
|
1774
|
-
|
|
1784
|
+
C && xe(D, "blur", (f) => {
|
|
1775
1785
|
setTimeout(() => {
|
|
1776
|
-
var
|
|
1777
|
-
const
|
|
1778
|
-
((
|
|
1786
|
+
var w;
|
|
1787
|
+
const V = be(e);
|
|
1788
|
+
((w = D.document.activeElement) == null ? void 0 : w.tagName) === "IFRAME" && !V?.contains(D.document.activeElement) && t(f);
|
|
1779
1789
|
}, 0);
|
|
1780
1790
|
}, { passive: !0 })
|
|
1781
|
-
].filter(Boolean),
|
|
1782
|
-
return
|
|
1783
|
-
stop:
|
|
1791
|
+
].filter(Boolean), H = () => I.forEach((f) => f());
|
|
1792
|
+
return A ? {
|
|
1793
|
+
stop: H,
|
|
1784
1794
|
cancel: () => {
|
|
1785
|
-
|
|
1795
|
+
x = !1;
|
|
1786
1796
|
},
|
|
1787
1797
|
trigger: (f) => {
|
|
1788
|
-
|
|
1798
|
+
x = !0, k(f), x = !1;
|
|
1789
1799
|
}
|
|
1790
|
-
} :
|
|
1800
|
+
} : H;
|
|
1791
1801
|
}
|
|
1792
|
-
function
|
|
1802
|
+
function gt(e) {
|
|
1793
1803
|
const t = Ue(null), l = [
|
|
1794
1804
|
".k-animation-container .k-popup",
|
|
1795
1805
|
".k-popup",
|
|
1796
1806
|
".k-timepicker-popup",
|
|
1797
1807
|
".k-menu-popup"
|
|
1798
|
-
],
|
|
1808
|
+
], 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
1809
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1800
|
-
) ??
|
|
1810
|
+
) ?? y : null, { activate: g, deactivate: C } = Ne(t, {
|
|
1801
1811
|
escapeDeactivates: !1,
|
|
1802
1812
|
clickOutsideDeactivates: !1,
|
|
1803
1813
|
fallbackFocus: () => t.value,
|
|
1804
|
-
initialFocus: () =>
|
|
1814
|
+
initialFocus: () => m(t.value),
|
|
1805
1815
|
...e.focusTrapOptions ?? {}
|
|
1806
1816
|
});
|
|
1807
|
-
let
|
|
1808
|
-
const
|
|
1817
|
+
let A = null, x = U(null);
|
|
1818
|
+
const T = () => {
|
|
1809
1819
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
1810
|
-
const
|
|
1811
|
-
const
|
|
1812
|
-
if (!
|
|
1813
|
-
const
|
|
1820
|
+
const y = (k, h) => {
|
|
1821
|
+
const I = Array.from(k.querySelectorAll(h));
|
|
1822
|
+
if (!I.length) return null;
|
|
1823
|
+
const H = I.filter(
|
|
1814
1824
|
(f) => f.offsetParent !== null || f.getClientRects().length > 0
|
|
1815
1825
|
);
|
|
1816
|
-
return
|
|
1817
|
-
},
|
|
1818
|
-
for (const
|
|
1819
|
-
const
|
|
1820
|
-
if (
|
|
1826
|
+
return H[H.length - 1] ?? I[I.length - 1] ?? null;
|
|
1827
|
+
}, R = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
1828
|
+
for (const k of D) {
|
|
1829
|
+
const h = y(R, k);
|
|
1830
|
+
if (h) return h;
|
|
1821
1831
|
}
|
|
1822
|
-
for (const
|
|
1823
|
-
const
|
|
1824
|
-
if (
|
|
1832
|
+
for (const k of D) {
|
|
1833
|
+
const h = y(document, k);
|
|
1834
|
+
if (h) return h;
|
|
1825
1835
|
}
|
|
1826
1836
|
return null;
|
|
1827
1837
|
};
|
|
1828
|
-
return
|
|
1829
|
-
|
|
1838
|
+
return it(t, (y) => {
|
|
1839
|
+
x.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", y);
|
|
1830
1840
|
}), de(
|
|
1831
1841
|
() => e.isOpen.value,
|
|
1832
|
-
(
|
|
1833
|
-
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
}, document.addEventListener("keydown",
|
|
1838
|
-
})) : (
|
|
1839
|
-
const
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
+
(y) => {
|
|
1843
|
+
y ? (x.value = null, Z(() => {
|
|
1844
|
+
const R = T();
|
|
1845
|
+
R && (t.value = R, setTimeout(() => g(), 0), A || (A = (k) => {
|
|
1846
|
+
k.key === "Escape" && (x.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", k));
|
|
1847
|
+
}, document.addEventListener("keydown", A, !0)));
|
|
1848
|
+
})) : (C(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, x.value === "outside" && Z(() => {
|
|
1849
|
+
const R = () => {
|
|
1850
|
+
const k = e.triggerEl?.value, h = k?.querySelector("input"), I = document.activeElement;
|
|
1851
|
+
I && (I === h || k && k.contains(I)) && (h ?? k)?.blur?.();
|
|
1842
1852
|
};
|
|
1843
|
-
requestAnimationFrame(() => setTimeout(
|
|
1844
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
1853
|
+
requestAnimationFrame(() => setTimeout(R, 0));
|
|
1854
|
+
}), e.returnFocusToTrigger !== !1 && x.value === "escape" && e.triggerEl?.value && (console.log(
|
|
1845
1855
|
"Returning focus to trigger element:",
|
|
1846
1856
|
e.triggerEl.value
|
|
1847
|
-
),
|
|
1848
|
-
const
|
|
1849
|
-
const
|
|
1850
|
-
if (!
|
|
1851
|
-
(
|
|
1857
|
+
), Z(() => {
|
|
1858
|
+
const R = () => {
|
|
1859
|
+
const k = e.triggerEl?.value;
|
|
1860
|
+
if (!k) return;
|
|
1861
|
+
(k.querySelector("input") ?? k)?.focus?.();
|
|
1852
1862
|
};
|
|
1853
|
-
requestAnimationFrame(() => setTimeout(
|
|
1863
|
+
requestAnimationFrame(() => setTimeout(R, 0));
|
|
1854
1864
|
})));
|
|
1855
1865
|
}
|
|
1856
1866
|
), {
|
|
1857
1867
|
popupRef: t,
|
|
1858
|
-
activate:
|
|
1859
|
-
deactivate:
|
|
1860
|
-
lastCloseReason:
|
|
1861
|
-
setPopupEl: (
|
|
1868
|
+
activate: g,
|
|
1869
|
+
deactivate: C,
|
|
1870
|
+
lastCloseReason: X(x),
|
|
1871
|
+
setPopupEl: (y) => t.value = y
|
|
1862
1872
|
};
|
|
1863
1873
|
}
|
|
1864
1874
|
export {
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
+
We as useFieldsetTouchTracker,
|
|
1876
|
+
_e as useFieldsetValidationKit,
|
|
1877
|
+
ct as useGridA11y,
|
|
1878
|
+
dt as useGridActiveFilter,
|
|
1879
|
+
pt as useMaskedDateInput,
|
|
1880
|
+
vt as useMaskedDateRangeInput,
|
|
1881
|
+
mt as useMaskedTimeInput,
|
|
1882
|
+
gt as usePopupTrap,
|
|
1883
|
+
ft as useUSAddress,
|
|
1884
|
+
Ye as useZipTextBox
|
|
1875
1885
|
};
|
|
1876
1886
|
//# sourceMappingURL=featherk-composables.es.js.map
|