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