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