@featherk/composables 0.17.1 → 0.18.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 +62 -15
- package/dist/address.cjs +2 -0
- package/dist/address.cjs.map +1 -0
- package/dist/address.mjs +6 -0
- package/dist/address.mjs.map +1 -0
- package/dist/chunks/useActiveIdRegistry-BG8VR__Z.mjs +43 -0
- package/dist/chunks/useActiveIdRegistry-BG8VR__Z.mjs.map +1 -0
- package/dist/chunks/useActiveIdRegistry-C1b00tqW.cjs +2 -0
- package/dist/chunks/useActiveIdRegistry-C1b00tqW.cjs.map +1 -0
- package/dist/chunks/useCompositeId-DyrJ0Fqj.cjs +2 -0
- package/dist/chunks/useCompositeId-DyrJ0Fqj.cjs.map +1 -0
- package/dist/chunks/useCompositeId-xg87ehXQ.mjs +9 -0
- package/dist/chunks/useCompositeId-xg87ehXQ.mjs.map +1 -0
- package/dist/chunks/useFieldsetValidationKit-7W1XDbbr.cjs +2 -0
- package/dist/chunks/useFieldsetValidationKit-7W1XDbbr.cjs.map +1 -0
- package/dist/chunks/useFieldsetValidationKit-x0Rh48mE.mjs +64 -0
- package/dist/chunks/useFieldsetValidationKit-x0Rh48mE.mjs.map +1 -0
- package/dist/chunks/useGridRowAction-Di25yeqb.cjs +2 -0
- package/dist/chunks/useGridRowAction-Di25yeqb.cjs.map +1 -0
- package/dist/chunks/useGridRowAction-akjwkV_F.mjs +532 -0
- package/dist/chunks/useGridRowAction-akjwkV_F.mjs.map +1 -0
- package/dist/chunks/useIntersectionObserver-A4xQV_pl.mjs +23 -0
- package/dist/chunks/useIntersectionObserver-A4xQV_pl.mjs.map +1 -0
- package/dist/chunks/useIntersectionObserver-CfgNAo2N.cjs +2 -0
- package/dist/chunks/useIntersectionObserver-CfgNAo2N.cjs.map +1 -0
- package/dist/chunks/useMaskedDateInput-COOksUM_.mjs +276 -0
- package/dist/chunks/useMaskedDateInput-COOksUM_.mjs.map +1 -0
- package/dist/chunks/useMaskedDateInput-wRnYlR3L.cjs +2 -0
- package/dist/chunks/useMaskedDateInput-wRnYlR3L.cjs.map +1 -0
- package/dist/chunks/useMaskedDateRangeInput-DST5aQe0.cjs +2 -0
- package/dist/chunks/useMaskedDateRangeInput-DST5aQe0.cjs.map +1 -0
- package/dist/chunks/useMaskedDateRangeInput-owYSg36r.mjs +328 -0
- package/dist/chunks/useMaskedDateRangeInput-owYSg36r.mjs.map +1 -0
- package/dist/chunks/useMaskedTimeInput-DPd2lysd.cjs +2 -0
- package/dist/chunks/useMaskedTimeInput-DPd2lysd.cjs.map +1 -0
- package/dist/chunks/useMaskedTimeInput-DjtBdvsf.mjs +363 -0
- package/dist/chunks/useMaskedTimeInput-DjtBdvsf.mjs.map +1 -0
- package/dist/chunks/usePopupMenu-CZLtgrXk.mjs +296 -0
- package/dist/chunks/usePopupMenu-CZLtgrXk.mjs.map +1 -0
- package/dist/chunks/usePopupMenu-DeTWakUH.cjs +2 -0
- package/dist/chunks/usePopupMenu-DeTWakUH.cjs.map +1 -0
- package/dist/chunks/usePopupTrap-DQudM6YA.cjs +2 -0
- package/dist/chunks/usePopupTrap-DQudM6YA.cjs.map +1 -0
- package/dist/chunks/usePopupTrap-DeuXHLZR.mjs +105 -0
- package/dist/chunks/usePopupTrap-DeuXHLZR.mjs.map +1 -0
- package/dist/chunks/useUSAddress-BYZZfbHc.cjs +2 -0
- package/dist/chunks/useUSAddress-BYZZfbHc.cjs.map +1 -0
- package/dist/chunks/useUSAddress-CRcqdqrZ.mjs +291 -0
- package/dist/chunks/useUSAddress-CRcqdqrZ.mjs.map +1 -0
- package/dist/chunks/useWindow-C4XFBuJA.mjs +210 -0
- package/dist/chunks/useWindow-C4XFBuJA.mjs.map +1 -0
- package/dist/chunks/useWindow-Yia2I6zX.cjs +2 -0
- package/dist/chunks/useWindow-Yia2I6zX.cjs.map +1 -0
- package/dist/date/useMaskedDateInput.d.ts +4 -0
- package/dist/date.cjs +2 -0
- package/dist/date.cjs.map +1 -0
- package/dist/date.mjs +5 -0
- package/dist/date.mjs.map +1 -0
- package/dist/{docs-manifest.js → docs-manifest.mjs} +24 -24
- package/dist/form.cjs +2 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.mjs +6 -0
- package/dist/form.mjs.map +1 -0
- package/dist/geometry.cjs +2 -0
- package/dist/geometry.cjs.map +1 -0
- package/dist/geometry.mjs +60 -0
- package/dist/geometry.mjs.map +1 -0
- package/dist/grid.cjs +2 -0
- package/dist/grid.cjs.map +1 -0
- package/dist/grid.mjs +7 -0
- package/dist/grid.mjs.map +1 -0
- package/dist/id.cjs +2 -0
- package/dist/id.cjs.map +1 -0
- package/dist/id.mjs +5 -0
- package/dist/id.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -0
- package/dist/menu.cjs +2 -0
- package/dist/menu.cjs.map +1 -0
- package/dist/menu.mjs +5 -0
- package/dist/menu.mjs.map +1 -0
- package/dist/observer.cjs +2 -0
- package/dist/observer.cjs.map +1 -0
- package/dist/observer.mjs +5 -0
- package/dist/observer.mjs.map +1 -0
- package/dist/range/useMaskedDateRangeInput.d.ts +4 -0
- package/dist/range.cjs +2 -0
- package/dist/range.cjs.map +1 -0
- package/dist/range.mjs +5 -0
- package/dist/range.mjs.map +1 -0
- package/dist/registry.cjs +2 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.mjs +6 -0
- package/dist/registry.mjs.map +1 -0
- package/dist/time/useMaskedTimeInput.d.ts +4 -0
- package/dist/time.cjs +2 -0
- package/dist/time.cjs.map +1 -0
- package/dist/time.mjs +5 -0
- package/dist/time.mjs.map +1 -0
- package/dist/trap.cjs +2 -0
- package/dist/trap.cjs.map +1 -0
- package/dist/trap.mjs +7 -0
- package/dist/trap.mjs.map +1 -0
- package/dist/window.cjs +2 -0
- package/dist/window.cjs.map +1 -0
- package/dist/window.mjs +6 -0
- package/dist/window.mjs.map +1 -0
- package/docs/date/useMaskedDateInput.md +3 -0
- package/docs/range/useMaskedDateRangeInput.md +6 -7
- package/docs/time/useMaskedTimeInput.md +3 -0
- package/package.json +38 -36
- package/dist/featherk-composables.es.js +0 -2628
- package/dist/featherk-composables.es.js.map +0 -1
- package/dist/featherk-composables.umd.js +0 -2
- package/dist/featherk-composables.umd.js.map +0 -1
- /package/dist/{docs-manifest.d.ts → docs-manifest.d.mts} +0 -0
|
@@ -1,2628 +0,0 @@
|
|
|
1
|
-
import { ref as Y, onBeforeUnmount as He, nextTick as j, computed as y, watchEffect as Ke, toValue as re, reactive as We, watch as ae, useId as Xe, unref as _e, onUnmounted as Fe, shallowRef as ve, shallowReactive as Ze, readonly as te, isRef as Pe, onScopeDispose as Me, onMounted as Le } from "vue";
|
|
2
|
-
import { useFocusTrap as Ge } from "@vueuse/integrations/useFocusTrap";
|
|
3
|
-
const Ct = (e, t) => {
|
|
4
|
-
const a = Y(null);
|
|
5
|
-
let f = !1, l = null, p = null;
|
|
6
|
-
const b = [], k = ".k-table-row[data-grid-row-index] [tabindex]", L = () => {
|
|
7
|
-
const d = e?.value?.$el;
|
|
8
|
-
return d ? d.closest(".k-grid") : null;
|
|
9
|
-
}, z = (d) => {
|
|
10
|
-
const I = L();
|
|
11
|
-
if (!I) return !1;
|
|
12
|
-
const m = d.closest(".k-grid-aria-root");
|
|
13
|
-
if (m)
|
|
14
|
-
return I.contains(m);
|
|
15
|
-
const E = d.closest(
|
|
16
|
-
".k-grid-header, .k-grid-content, .k-grid-content-locked"
|
|
17
|
-
);
|
|
18
|
-
return E ? I.contains(E) : !1;
|
|
19
|
-
}, M = (d) => d.key === "Enter" || d.code === "Enter" || d.code === "NumpadEnter", C = () => e?.value?.columns, x = (d) => {
|
|
20
|
-
const I = d.key || d.code;
|
|
21
|
-
([" ", "Spacebar", "Space"].includes(I) || M(d)) && (d.preventDefault(), d.stopPropagation(), a.value = d.target, d.target.click());
|
|
22
|
-
}, A = (d) => {
|
|
23
|
-
if (!a.value) return;
|
|
24
|
-
if (d.code === "Escape") {
|
|
25
|
-
d.stopPropagation(), a.value && a.value.focus();
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const I = Array.from(
|
|
29
|
-
document.querySelectorAll(
|
|
30
|
-
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
31
|
-
)
|
|
32
|
-
), m = document.querySelector(
|
|
33
|
-
".k-animation-container .k-popup .k-column-menu .k-filter-menu-container"
|
|
34
|
-
);
|
|
35
|
-
if (m) {
|
|
36
|
-
if (d.code === "Tab") {
|
|
37
|
-
const E = [
|
|
38
|
-
// ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
|
|
39
|
-
// ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
40
|
-
// ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
|
|
41
|
-
// ".k-checkbox",
|
|
42
|
-
".k-dropdownlist[tabindex='0']",
|
|
43
|
-
"input.k-input-inner:not([tabindex='-1']):not([disabled])",
|
|
44
|
-
"button:not([tabindex='-1']):not([disabled])",
|
|
45
|
-
".k-checkbox"
|
|
46
|
-
], F = t?.focusableMenuSelectors ?? E, D = Array.from(
|
|
47
|
-
m.querySelectorAll(F.join(","))
|
|
48
|
-
);
|
|
49
|
-
if (D.length === 0) return;
|
|
50
|
-
const P = D.findIndex(
|
|
51
|
-
(Z) => Z === document.activeElement
|
|
52
|
-
);
|
|
53
|
-
let K;
|
|
54
|
-
P === -1 ? K = 0 : d.shiftKey ? K = (P - 1 + D.length) % D.length : K = (P + 1) % D.length, d.preventDefault(), d.stopPropagation(), D[K]?.focus();
|
|
55
|
-
}
|
|
56
|
-
} else if (d.code === "ArrowUp" || d.code === "ArrowDown") {
|
|
57
|
-
d.preventDefault(), d.stopPropagation();
|
|
58
|
-
const E = I.findIndex(
|
|
59
|
-
(D) => D === document.activeElement
|
|
60
|
-
);
|
|
61
|
-
let F = E;
|
|
62
|
-
d.code === "ArrowUp" ? F = E > 0 ? E - 1 : I.length - 1 : d.code === "ArrowDown" && (F = E < I.length - 1 ? E + 1 : 0), I[F]?.focus();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (d.code === "Tab") {
|
|
66
|
-
d.preventDefault(), d.stopPropagation();
|
|
67
|
-
const E = a.value?.parentElement;
|
|
68
|
-
(d.shiftKey ? E?.previousElementSibling : E?.nextElementSibling)?.querySelector(
|
|
69
|
-
"button, [role='button'], .k-link"
|
|
70
|
-
)?.focus();
|
|
71
|
-
}
|
|
72
|
-
}, V = () => {
|
|
73
|
-
l = new MutationObserver((d) => {
|
|
74
|
-
d.forEach((I) => {
|
|
75
|
-
I.addedNodes.forEach((m) => {
|
|
76
|
-
if (m.nodeType === Node.ELEMENT_NODE) {
|
|
77
|
-
const E = m;
|
|
78
|
-
if (E.classList.contains("k-animation-container")) {
|
|
79
|
-
const D = a.value;
|
|
80
|
-
D && (D.dataset.featherKSortable === "true" || j(() => {
|
|
81
|
-
E.querySelectorAll(
|
|
82
|
-
".k-columnmenu-item-wrapper"
|
|
83
|
-
).forEach((Z) => {
|
|
84
|
-
Z.textContent?.toLowerCase().includes("sort") && Z.remove();
|
|
85
|
-
});
|
|
86
|
-
})), E.addEventListener(
|
|
87
|
-
"keydown",
|
|
88
|
-
A
|
|
89
|
-
), j(() => {
|
|
90
|
-
const P = () => {
|
|
91
|
-
const K = Array.from(
|
|
92
|
-
E.querySelectorAll(
|
|
93
|
-
".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
|
|
94
|
-
)
|
|
95
|
-
);
|
|
96
|
-
if (K.length === 1)
|
|
97
|
-
K[0].focus(), K[0].click(), P.attempts = 0;
|
|
98
|
-
else if (K.length > 1) {
|
|
99
|
-
P.attempts = 0;
|
|
100
|
-
return;
|
|
101
|
-
} else
|
|
102
|
-
P.attempts === void 0 && (P.attempts = 0), P.attempts++ < 3 && setTimeout(P, 200);
|
|
103
|
-
};
|
|
104
|
-
P();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
E.querySelectorAll(
|
|
108
|
-
".k-animation-container"
|
|
109
|
-
).forEach((D) => {
|
|
110
|
-
D.addEventListener(
|
|
111
|
-
"keydown",
|
|
112
|
-
A
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}), I.removedNodes.forEach((m) => {
|
|
117
|
-
if (m.nodeType === Node.ELEMENT_NODE) {
|
|
118
|
-
const E = m;
|
|
119
|
-
E.classList.contains("k-animation-container") && E.removeEventListener(
|
|
120
|
-
"keydown",
|
|
121
|
-
A
|
|
122
|
-
), E.querySelectorAll(
|
|
123
|
-
".k-animation-container"
|
|
124
|
-
).forEach((D) => {
|
|
125
|
-
D.removeEventListener(
|
|
126
|
-
"keydown",
|
|
127
|
-
A
|
|
128
|
-
);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
}), l.observe(document.body, {
|
|
134
|
-
childList: !0,
|
|
135
|
-
subtree: !0
|
|
136
|
-
});
|
|
137
|
-
}, v = (d) => {
|
|
138
|
-
const I = d.tagName.toLowerCase();
|
|
139
|
-
return !!(["input", "textarea", "select", "button"].includes(I) || d.closest(
|
|
140
|
-
'.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'
|
|
141
|
-
));
|
|
142
|
-
}, c = (d) => {
|
|
143
|
-
if (!d.type || !d)
|
|
144
|
-
return;
|
|
145
|
-
const I = d.target;
|
|
146
|
-
if (!I) return;
|
|
147
|
-
const m = I.closest(
|
|
148
|
-
".k-table-row[data-grid-row-index]"
|
|
149
|
-
);
|
|
150
|
-
if (!z(I))
|
|
151
|
-
return;
|
|
152
|
-
const E = ["ArrowLeft", "ArrowRight"].includes(
|
|
153
|
-
d.code
|
|
154
|
-
);
|
|
155
|
-
if (!(v(I) && !(m && E))) {
|
|
156
|
-
if (d.code === "Escape") {
|
|
157
|
-
const F = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
|
|
158
|
-
if (F) {
|
|
159
|
-
d.preventDefault(), d.stopPropagation();
|
|
160
|
-
try {
|
|
161
|
-
Array.from(
|
|
162
|
-
e?.value.$el.querySelectorAll(
|
|
163
|
-
".k-table-row[data-grid-row-index]"
|
|
164
|
-
)
|
|
165
|
-
).forEach((P) => P.setAttribute("tabindex", "-1"));
|
|
166
|
-
} catch {
|
|
167
|
-
}
|
|
168
|
-
F.setAttribute("tabindex", "0"), F.focus();
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if ([
|
|
173
|
-
"ArrowDown",
|
|
174
|
-
"ArrowLeft",
|
|
175
|
-
"ArrowRight",
|
|
176
|
-
"ArrowUp",
|
|
177
|
-
"Enter",
|
|
178
|
-
"NumpadEnter",
|
|
179
|
-
"Space"
|
|
180
|
-
].includes(d.code)) {
|
|
181
|
-
if (I.classList.contains("k-grid-header-menu") && I.classList.contains("k-grid-column-menu")) {
|
|
182
|
-
a.value = I;
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (m) {
|
|
186
|
-
if (["ArrowDown", "ArrowUp"].includes(d.code)) {
|
|
187
|
-
d.preventDefault(), d.stopPropagation();
|
|
188
|
-
const F = (P, K) => {
|
|
189
|
-
let Z = K === "next" ? P.nextElementSibling : P.previousElementSibling;
|
|
190
|
-
for (; Z; ) {
|
|
191
|
-
const ne = Z;
|
|
192
|
-
try {
|
|
193
|
-
if (ne.classList.contains("k-table-row"))
|
|
194
|
-
return ne;
|
|
195
|
-
} catch {
|
|
196
|
-
}
|
|
197
|
-
Z = K === "next" ? Z.nextElementSibling : Z.previousElementSibling;
|
|
198
|
-
}
|
|
199
|
-
return null;
|
|
200
|
-
}, D = d.code === "ArrowDown" ? F(m, "next") : F(m, "previous");
|
|
201
|
-
D && (m.setAttribute("tabindex", "-1"), D.setAttribute("tabindex", "0"), D.focus());
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
if (["ArrowLeft", "ArrowRight"].includes(d.code)) {
|
|
205
|
-
d.preventDefault(), d.stopPropagation();
|
|
206
|
-
const F = m.querySelectorAll(
|
|
207
|
-
k
|
|
208
|
-
);
|
|
209
|
-
if (F.length === 0) return;
|
|
210
|
-
let D = Array.from(F).findIndex(
|
|
211
|
-
(P) => P === document.activeElement
|
|
212
|
-
);
|
|
213
|
-
if (D === -1 && document.activeElement === m) {
|
|
214
|
-
F[0].focus();
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
d.code === "ArrowRight" ? D = D === F.length - 1 ? 0 : D + 1 : d.code === "ArrowLeft" && (D = D === 0 ? F.length - 1 : D - 1), F[D].focus();
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}, g = () => {
|
|
224
|
-
j(() => {
|
|
225
|
-
const d = e.value?.$el;
|
|
226
|
-
if (!d || typeof d.closest != "function") return;
|
|
227
|
-
const I = d.closest(".k-grid");
|
|
228
|
-
I && I.classList.add("fk-grid");
|
|
229
|
-
});
|
|
230
|
-
}, R = () => {
|
|
231
|
-
if (!p)
|
|
232
|
-
try {
|
|
233
|
-
const d = () => {
|
|
234
|
-
try {
|
|
235
|
-
const E = Array.from(
|
|
236
|
-
e.value.$el.querySelectorAll(
|
|
237
|
-
".k-table-row[data-grid-row-index]"
|
|
238
|
-
)
|
|
239
|
-
);
|
|
240
|
-
if (!E || E.length === 0 || E.filter(
|
|
241
|
-
(P) => P.getAttribute("tabindex") === "0"
|
|
242
|
-
).length === 1) return;
|
|
243
|
-
const D = E.find(
|
|
244
|
-
(P) => P === document.activeElement || P.contains(document.activeElement)
|
|
245
|
-
);
|
|
246
|
-
if (E.forEach((P) => P.setAttribute("tabindex", "-1")), D) {
|
|
247
|
-
D.setAttribute("tabindex", "0");
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
E[0].setAttribute("tabindex", "0");
|
|
251
|
-
} catch (E) {
|
|
252
|
-
console.error("ensureSingleTabindex error:", E);
|
|
253
|
-
}
|
|
254
|
-
}, I = Array.from(
|
|
255
|
-
e.value.$el.querySelectorAll(
|
|
256
|
-
".k-table-row[data-grid-row-index]"
|
|
257
|
-
)
|
|
258
|
-
);
|
|
259
|
-
I.length > 0 && I.forEach((E, F) => {
|
|
260
|
-
E.setAttribute("tabindex", F === 0 ? "0" : "-1");
|
|
261
|
-
});
|
|
262
|
-
const m = e.value.$el.querySelector(".k-table-tbody");
|
|
263
|
-
m && (p = new MutationObserver(() => {
|
|
264
|
-
d();
|
|
265
|
-
}), p.observe(m, { childList: !0, subtree: !0 }));
|
|
266
|
-
} catch (d) {
|
|
267
|
-
console.error("Error setting up row navigation:", d);
|
|
268
|
-
}
|
|
269
|
-
}, q = () => {
|
|
270
|
-
j(() => {
|
|
271
|
-
const I = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
272
|
-
I && I.forEach((m) => {
|
|
273
|
-
m.setAttribute("role", "button"), m.addEventListener(
|
|
274
|
-
"keydown",
|
|
275
|
-
x
|
|
276
|
-
);
|
|
277
|
-
}), V(), W();
|
|
278
|
-
});
|
|
279
|
-
}, X = () => {
|
|
280
|
-
const I = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
281
|
-
I && I.forEach((m) => {
|
|
282
|
-
m.removeEventListener(
|
|
283
|
-
"keydown",
|
|
284
|
-
x
|
|
285
|
-
);
|
|
286
|
-
}), l && (l.disconnect(), l = null), p && (p.disconnect(), p = null), b.forEach((m) => m()), b.length = 0;
|
|
287
|
-
}, W = () => {
|
|
288
|
-
document.querySelectorAll(
|
|
289
|
-
".k-grid-header .k-table-thead th"
|
|
290
|
-
).forEach((m, E) => {
|
|
291
|
-
if (m.dataset.featherKHeaderBound === "true")
|
|
292
|
-
return;
|
|
293
|
-
const F = m.querySelector(
|
|
294
|
-
".k-grid-header-menu.k-grid-column-menu"
|
|
295
|
-
);
|
|
296
|
-
if (!F) return;
|
|
297
|
-
const D = C();
|
|
298
|
-
if (D && D[E]) {
|
|
299
|
-
const n = D[E].field ?? "";
|
|
300
|
-
m.setAttribute("data-feather-k-field", n), m.setAttribute(
|
|
301
|
-
"data-feather-k-filterable",
|
|
302
|
-
D[E].filterable === !1 ? "false" : "true"
|
|
303
|
-
), m.setAttribute(
|
|
304
|
-
"data-feather-k-sortable",
|
|
305
|
-
D[E].sortable === !1 ? "false" : "true"
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
const P = m.dataset.featherKFilterable !== "false", K = m.dataset.featherKSortable !== "false";
|
|
309
|
-
F.setAttribute("tabindex", "-1"), P || K ? m.style.cursor = "pointer" : m.style.cursor = "default", P ? (m.setAttribute("tabindex", "0"), m.setAttribute("role", "button"), m.setAttribute("aria-haspopup", "menu")) : (m.setAttribute("tabindex", "0"), m.setAttribute("role", "columnheader"), m.removeAttribute("aria-haspopup"));
|
|
310
|
-
const Z = (n) => {
|
|
311
|
-
n.target?.closest(".k-column-resizer") || (a.value = m, F.click());
|
|
312
|
-
}, ne = (n) => {
|
|
313
|
-
if (P)
|
|
314
|
-
a.value = m, n.preventDefault(), n.stopPropagation(), Z(n);
|
|
315
|
-
else if (K) {
|
|
316
|
-
a.value = m;
|
|
317
|
-
const o = m.querySelector(".k-link");
|
|
318
|
-
o && o.click();
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
m.addEventListener("click", ne), b.push(() => {
|
|
322
|
-
m.removeEventListener("click", ne);
|
|
323
|
-
});
|
|
324
|
-
const se = (n) => {
|
|
325
|
-
if ((M(n) || n.code === "Space") && (P || K)) {
|
|
326
|
-
if (n.preventDefault(), n.stopPropagation(), a.value = m, a.value.focus(), P)
|
|
327
|
-
Z(n);
|
|
328
|
-
else if (K) {
|
|
329
|
-
const o = m.querySelector(".k-link");
|
|
330
|
-
o && o.click();
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
m.addEventListener("keydown", se, !0), b.push(() => {
|
|
335
|
-
m.removeEventListener("keydown", se, !0);
|
|
336
|
-
}), m.dataset.featherKHeaderBound = "true";
|
|
337
|
-
});
|
|
338
|
-
const I = document.querySelector(".k-grid-header .k-table-thead");
|
|
339
|
-
if (I && I.dataset.featherKHeaderBound !== "true") {
|
|
340
|
-
const m = (E) => {
|
|
341
|
-
const F = E.target.closest("th");
|
|
342
|
-
F && (M(E) || E.code === "Space") && F.dataset.featherKFilterable === "false" && F.dataset.featherKSortable === "false" && (E.preventDefault(), E.stopImmediatePropagation());
|
|
343
|
-
};
|
|
344
|
-
I.addEventListener(
|
|
345
|
-
"keydown",
|
|
346
|
-
m,
|
|
347
|
-
!0
|
|
348
|
-
// NOTE: capture phase
|
|
349
|
-
), b.push(() => {
|
|
350
|
-
I.removeEventListener(
|
|
351
|
-
"keydown",
|
|
352
|
-
m,
|
|
353
|
-
!0
|
|
354
|
-
);
|
|
355
|
-
}), I.dataset.featherKHeaderBound = "true";
|
|
356
|
-
}
|
|
357
|
-
}, B = function(d, I) {
|
|
358
|
-
const m = d?.event?.event.target, E = C();
|
|
359
|
-
if (!m || !E) return;
|
|
360
|
-
const F = m.classList.contains("k-grid-header-menu"), D = m.classList.contains("k-columnmenu-item"), P = E.find((K) => K.field === d?.event?.field)?.sortable && !0;
|
|
361
|
-
if (!F) {
|
|
362
|
-
if (D && !P) {
|
|
363
|
-
d?.event?.sort?.filter(
|
|
364
|
-
(Z) => Z.field !== d?.event?.field
|
|
365
|
-
);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
typeof I == "function" && j(() => {
|
|
369
|
-
a.value && a.value.focus(), I(d), j(() => {
|
|
370
|
-
W();
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}, _ = () => {
|
|
375
|
-
if (!f)
|
|
376
|
-
try {
|
|
377
|
-
g(), R(), q(), f = !0;
|
|
378
|
-
} catch (d) {
|
|
379
|
-
console.error("initA11y failed:", d), X();
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
return He(() => {
|
|
383
|
-
X();
|
|
384
|
-
}), {
|
|
385
|
-
activeFilterButton: a,
|
|
386
|
-
handleGridKeyDown: c,
|
|
387
|
-
handleSortChange: B,
|
|
388
|
-
initA11y: _
|
|
389
|
-
};
|
|
390
|
-
}, je = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Je = (e) => !!e && typeof e == "object" && "field" in e, Ue = (e, t) => !e || typeof e != "object" ? !1 : je(e) ? e.filters.some(
|
|
391
|
-
(a) => Ue(a, t)
|
|
392
|
-
) : Je(e) ? e.field === t : !1, Rt = (e) => (t) => e.value?.filters && e.value.filters.some(
|
|
393
|
-
(a) => Ue(a, t)
|
|
394
|
-
) ? "active" : "", Qe = [
|
|
395
|
-
"button",
|
|
396
|
-
"a",
|
|
397
|
-
"input",
|
|
398
|
-
"select",
|
|
399
|
-
"textarea",
|
|
400
|
-
'[role="button"]',
|
|
401
|
-
'[role="checkbox"]',
|
|
402
|
-
'[role="link"]',
|
|
403
|
-
'[role="menuitem"]',
|
|
404
|
-
'[role="option"]',
|
|
405
|
-
".k-checkbox",
|
|
406
|
-
".k-button",
|
|
407
|
-
".k-dropdown",
|
|
408
|
-
".k-picker",
|
|
409
|
-
".k-hierarchy-cell",
|
|
410
|
-
".k-grid-header-menu",
|
|
411
|
-
".k-column-menu"
|
|
412
|
-
], Ft = (e) => {
|
|
413
|
-
const {
|
|
414
|
-
onRowAction: t,
|
|
415
|
-
gridRef: a,
|
|
416
|
-
dataItems: f,
|
|
417
|
-
ignoreSelectors: l = [],
|
|
418
|
-
shouldIgnoreTarget: p,
|
|
419
|
-
enableKeyboardAction: b = !0
|
|
420
|
-
} = e, k = [
|
|
421
|
-
...Qe,
|
|
422
|
-
...l
|
|
423
|
-
], L = (v, c) => {
|
|
424
|
-
if (!v) return !1;
|
|
425
|
-
const g = k.join(",");
|
|
426
|
-
return v.closest && v.closest(g) ? !0 : p && c ? p(v, c) : !1;
|
|
427
|
-
}, z = (v) => {
|
|
428
|
-
const g = v?.closest?.(
|
|
429
|
-
".k-table-row[data-grid-row-index]"
|
|
430
|
-
)?.getAttribute("data-grid-row-index");
|
|
431
|
-
if (g == null) return;
|
|
432
|
-
const R = parseInt(g, 10);
|
|
433
|
-
return Number.isNaN(R) ? void 0 : R;
|
|
434
|
-
}, M = (v) => {
|
|
435
|
-
if (!v || typeof v.clientX != "number")
|
|
436
|
-
return;
|
|
437
|
-
const c = typeof window < "u" && window.scrollX || 0, g = typeof window < "u" && window.scrollY || 0, R = typeof window < "u" && window.screenX || 0, q = typeof window < "u" && window.screenY || 0;
|
|
438
|
-
return {
|
|
439
|
-
clientX: v.clientX,
|
|
440
|
-
clientY: v.clientY,
|
|
441
|
-
pageX: typeof v.pageX == "number" ? v.pageX : v.clientX + c,
|
|
442
|
-
pageY: typeof v.pageY == "number" ? v.pageY : v.clientY + g,
|
|
443
|
-
screenX: typeof v.screenX == "number" ? v.screenX : v.clientX + R,
|
|
444
|
-
screenY: typeof v.screenY == "number" ? v.screenY : v.clientY + q
|
|
445
|
-
};
|
|
446
|
-
}, C = (v) => {
|
|
447
|
-
if (!v || typeof v.getBoundingClientRect != "function")
|
|
448
|
-
return;
|
|
449
|
-
const c = v.getBoundingClientRect();
|
|
450
|
-
if (!c) return;
|
|
451
|
-
const g = c.left, R = c.bottom, q = typeof window < "u" && window.scrollX || 0, X = typeof window < "u" && window.scrollY || 0;
|
|
452
|
-
return {
|
|
453
|
-
clientX: g,
|
|
454
|
-
clientY: R,
|
|
455
|
-
pageX: g + q,
|
|
456
|
-
pageY: R + X,
|
|
457
|
-
screenX: g,
|
|
458
|
-
screenY: R
|
|
459
|
-
};
|
|
460
|
-
}, x = (v) => {
|
|
461
|
-
if (typeof window > "u") return !1;
|
|
462
|
-
const c = window.getSelection();
|
|
463
|
-
if (!c || c.isCollapsed || !c.toString().trim())
|
|
464
|
-
return !1;
|
|
465
|
-
if (v && c.anchorNode && c.focusNode) {
|
|
466
|
-
const g = v.closest(".k-table-row") || v.closest(".k-grid") || v, R = c.anchorNode.nodeType === Node.ELEMENT_NODE ? c.anchorNode : c.anchorNode.parentElement, q = c.focusNode.nodeType === Node.ELEMENT_NODE ? c.focusNode : c.focusNode.parentElement, X = !!(R && g.contains(R)), W = !!(q && g.contains(q));
|
|
467
|
-
return X || W;
|
|
468
|
-
}
|
|
469
|
-
return !0;
|
|
470
|
-
};
|
|
471
|
-
return {
|
|
472
|
-
handleRowClick: (v) => {
|
|
473
|
-
const c = v?.htmlEvent || v?.event || v?.nativeEvent || (v instanceof Event ? v : void 0);
|
|
474
|
-
if (c && c.button !== void 0 && c.button !== 0)
|
|
475
|
-
return;
|
|
476
|
-
const g = c?.target || v?.target;
|
|
477
|
-
if (g && L(g, c || v) || x(g))
|
|
478
|
-
return;
|
|
479
|
-
const R = {
|
|
480
|
-
dataItem: v.dataItem,
|
|
481
|
-
rowIndex: v.rowIndex ?? z(g),
|
|
482
|
-
field: v.field,
|
|
483
|
-
event: c || v,
|
|
484
|
-
triggerType: "click",
|
|
485
|
-
ctrlKey: !!c?.ctrlKey,
|
|
486
|
-
shiftKey: !!c?.shiftKey,
|
|
487
|
-
metaKey: !!c?.metaKey,
|
|
488
|
-
altKey: !!c?.altKey,
|
|
489
|
-
coordinates: M(c) ?? C(g)
|
|
490
|
-
};
|
|
491
|
-
t(v.dataItem, R);
|
|
492
|
-
},
|
|
493
|
-
handleRowKeyDown: (v, c) => {
|
|
494
|
-
if (!b) return;
|
|
495
|
-
const g = v.key || v.code;
|
|
496
|
-
if (!(g === "Enter" || g === "NumpadEnter" || g === " " || g === "Space" || v.code === "Enter" || v.code === "NumpadEnter" || v.code === "Space")) return;
|
|
497
|
-
const q = v.target;
|
|
498
|
-
if (!q) return;
|
|
499
|
-
const X = q.closest(
|
|
500
|
-
".k-table-row[data-grid-row-index], .k-table-row"
|
|
501
|
-
);
|
|
502
|
-
if (!X || L(q, v))
|
|
503
|
-
return;
|
|
504
|
-
v.preventDefault(), v.stopPropagation();
|
|
505
|
-
const W = X.getAttribute("data-grid-row-index"), B = W !== null ? parseInt(W, 10) : void 0;
|
|
506
|
-
let _ = c;
|
|
507
|
-
if (_ === void 0) {
|
|
508
|
-
const I = (Array.isArray(f) ? f : f?.value) || a?.value?.props?.dataItems || a?.value?.dataItems;
|
|
509
|
-
I && B !== void 0 && B >= 0 && B < I.length && (_ = I[B]);
|
|
510
|
-
}
|
|
511
|
-
if (_ === void 0) return;
|
|
512
|
-
const d = {
|
|
513
|
-
dataItem: _,
|
|
514
|
-
rowIndex: B,
|
|
515
|
-
event: v,
|
|
516
|
-
triggerType: "keyboard",
|
|
517
|
-
ctrlKey: !!v.ctrlKey,
|
|
518
|
-
shiftKey: !!v.shiftKey,
|
|
519
|
-
metaKey: !!v.metaKey,
|
|
520
|
-
altKey: !!v.altKey,
|
|
521
|
-
coordinates: C(X)
|
|
522
|
-
};
|
|
523
|
-
t(_, d);
|
|
524
|
-
},
|
|
525
|
-
isIgnoredTarget: L
|
|
526
|
-
};
|
|
527
|
-
}, et = "Enter a valid ZIP code with exactly 5 or 9 digits.", $e = (e) => {
|
|
528
|
-
const t = e.replace(/\D/g, "").slice(0, 9);
|
|
529
|
-
return t.length > 5 ? `${t.slice(0, 5)}-${t.slice(5)}` : t;
|
|
530
|
-
}, tt = (e, t) => e.slice(0, Math.max(0, t)).replace(/\D/g, "").length, nt = (e) => e <= 5 ? e : Math.min(e + 1, 10), rt = (e) => {
|
|
531
|
-
const t = Y($e(e.initialValue ?? "")), a = Y(!1), f = Y(
|
|
532
|
-
e.errorMessage?.trim() || et
|
|
533
|
-
), l = y(() => t.value.replace(/\D/g, "")), p = y(() => {
|
|
534
|
-
const A = l.value.length;
|
|
535
|
-
return A === 5 || A === 9;
|
|
536
|
-
}), b = y(() => a.value && !p.value), k = y(() => !a.value || p.value), L = y(() => a.value), z = (A, V) => {
|
|
537
|
-
const v = nt(V);
|
|
538
|
-
j(() => {
|
|
539
|
-
A.isConnected && A.setSelectionRange(v, v);
|
|
540
|
-
});
|
|
541
|
-
};
|
|
542
|
-
return {
|
|
543
|
-
// writable state
|
|
544
|
-
zipDisplay: t,
|
|
545
|
-
submitted: a,
|
|
546
|
-
errorMessage: f,
|
|
547
|
-
// bindings
|
|
548
|
-
wrapperClass: "fk-zip-textbox",
|
|
549
|
-
// derived state
|
|
550
|
-
zipRaw: l,
|
|
551
|
-
isZipValid: p,
|
|
552
|
-
showZipError: b,
|
|
553
|
-
textBoxValid: k,
|
|
554
|
-
textBoxValidate: L,
|
|
555
|
-
// actions
|
|
556
|
-
handleZipInput: (...A) => {
|
|
557
|
-
const V = A[0], c = V?.event?.target, g = V?.value, R = Array.isArray(g) ? g.join("") : String(g ?? ""), q = c?.selectionStart !== void 0 && c.selectionStart !== null ? tt(
|
|
558
|
-
c.value,
|
|
559
|
-
c.selectionStart
|
|
560
|
-
) : R.replace(/\D/g, "").length;
|
|
561
|
-
t.value = $e(R), c && z(c, q);
|
|
562
|
-
},
|
|
563
|
-
submitAndValidate: (A) => {
|
|
564
|
-
a.value = !0;
|
|
565
|
-
const V = p.value;
|
|
566
|
-
return !V && A?.focus && j(() => {
|
|
567
|
-
document.getElementById(
|
|
568
|
-
e.id
|
|
569
|
-
)?.focus();
|
|
570
|
-
}), V;
|
|
571
|
-
},
|
|
572
|
-
buildPayload: () => ({ zip: l.value })
|
|
573
|
-
};
|
|
574
|
-
};
|
|
575
|
-
function at(e, t) {
|
|
576
|
-
const a = Y(!1);
|
|
577
|
-
Ke(() => {
|
|
578
|
-
e.value?.setAttribute("aria-invalid", String(!t.isValid()));
|
|
579
|
-
});
|
|
580
|
-
function f(p) {
|
|
581
|
-
const b = e.value ?? p.currentTarget, k = p.relatedTarget;
|
|
582
|
-
(!b || !b.contains(k)) && (a.value = !0);
|
|
583
|
-
}
|
|
584
|
-
function l() {
|
|
585
|
-
a.value = !1;
|
|
586
|
-
}
|
|
587
|
-
return { touched: a, onFocusout: f, reset: l };
|
|
588
|
-
}
|
|
589
|
-
function ot(e, t) {
|
|
590
|
-
const a = Y(!1), f = Y(!1), l = y(
|
|
591
|
-
() => re(t.submitted) || a.value
|
|
592
|
-
), p = y(() => !l.value || t.isValid()), b = at(e, {
|
|
593
|
-
isValid: () => p.value
|
|
594
|
-
});
|
|
595
|
-
function k(x) {
|
|
596
|
-
return y(() => !l.value || re(x));
|
|
597
|
-
}
|
|
598
|
-
function L(x) {
|
|
599
|
-
return Object.fromEntries(
|
|
600
|
-
Object.entries(x).map(([A, V]) => [
|
|
601
|
-
A,
|
|
602
|
-
k(V)
|
|
603
|
-
])
|
|
604
|
-
);
|
|
605
|
-
}
|
|
606
|
-
function z(x) {
|
|
607
|
-
const A = re(x);
|
|
608
|
-
if (!A) return;
|
|
609
|
-
A.querySelector(
|
|
610
|
-
'.k-invalid input, .k-invalid[tabindex="0"]'
|
|
611
|
-
)?.focus();
|
|
612
|
-
}
|
|
613
|
-
function M(x) {
|
|
614
|
-
if (f.value) {
|
|
615
|
-
f.value = !1;
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
b.onFocusout(x), b.touched.value && (a.value = !0);
|
|
619
|
-
}
|
|
620
|
-
function C() {
|
|
621
|
-
a.value = !1, f.value = !0, b.reset();
|
|
622
|
-
}
|
|
623
|
-
return {
|
|
624
|
-
touched: a,
|
|
625
|
-
fieldsetValidate: l,
|
|
626
|
-
onFocusout: M,
|
|
627
|
-
reset: C,
|
|
628
|
-
createFieldValidity: k,
|
|
629
|
-
createFieldValidationsMap: L,
|
|
630
|
-
focusFirstInvalidField: z
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
const lt = [
|
|
634
|
-
{ label: "Alabama", value: "AL" },
|
|
635
|
-
{ label: "Alaska", value: "AK" },
|
|
636
|
-
{ label: "Arizona", value: "AZ" },
|
|
637
|
-
{ label: "Arkansas", value: "AR" },
|
|
638
|
-
{ label: "California", value: "CA" },
|
|
639
|
-
{ label: "Colorado", value: "CO" },
|
|
640
|
-
{ label: "Connecticut", value: "CT" },
|
|
641
|
-
{ label: "Delaware", value: "DE" },
|
|
642
|
-
{ label: "Florida", value: "FL" },
|
|
643
|
-
{ label: "Georgia", value: "GA" },
|
|
644
|
-
{ label: "Hawaii", value: "HI" },
|
|
645
|
-
{ label: "Idaho", value: "ID" },
|
|
646
|
-
{ label: "Illinois", value: "IL" },
|
|
647
|
-
{ label: "Indiana", value: "IN" },
|
|
648
|
-
{ label: "Iowa", value: "IA" },
|
|
649
|
-
{ label: "Kansas", value: "KS" },
|
|
650
|
-
{ label: "Kentucky", value: "KY" },
|
|
651
|
-
{ label: "Louisiana", value: "LA" },
|
|
652
|
-
{ label: "Maine", value: "ME" },
|
|
653
|
-
{ label: "Maryland", value: "MD" },
|
|
654
|
-
{ label: "Massachusetts", value: "MA" },
|
|
655
|
-
{ label: "Michigan", value: "MI" },
|
|
656
|
-
{ label: "Minnesota", value: "MN" },
|
|
657
|
-
{ label: "Mississippi", value: "MS" },
|
|
658
|
-
{ label: "Missouri", value: "MO" },
|
|
659
|
-
{ label: "Montana", value: "MT" },
|
|
660
|
-
{ label: "Nebraska", value: "NE" },
|
|
661
|
-
{ label: "Nevada", value: "NV" },
|
|
662
|
-
{ label: "New Hampshire", value: "NH" },
|
|
663
|
-
{ label: "New Jersey", value: "NJ" },
|
|
664
|
-
{ label: "New Mexico", value: "NM" },
|
|
665
|
-
{ label: "New York", value: "NY" },
|
|
666
|
-
{ label: "North Carolina", value: "NC" },
|
|
667
|
-
{ label: "North Dakota", value: "ND" },
|
|
668
|
-
{ label: "Ohio", value: "OH" },
|
|
669
|
-
{ label: "Oklahoma", value: "OK" },
|
|
670
|
-
{ label: "Oregon", value: "OR" },
|
|
671
|
-
{ label: "Pennsylvania", value: "PA" },
|
|
672
|
-
{ label: "Rhode Island", value: "RI" },
|
|
673
|
-
{ label: "South Carolina", value: "SC" },
|
|
674
|
-
{ label: "South Dakota", value: "SD" },
|
|
675
|
-
{ label: "Tennessee", value: "TN" },
|
|
676
|
-
{ label: "Texas", value: "TX" },
|
|
677
|
-
{ label: "Utah", value: "UT" },
|
|
678
|
-
{ label: "Vermont", value: "VT" },
|
|
679
|
-
{ label: "Virginia", value: "VA" },
|
|
680
|
-
{ label: "Washington", value: "WA" },
|
|
681
|
-
{ label: "West Virginia", value: "WV" },
|
|
682
|
-
{ label: "Wisconsin", value: "WI" },
|
|
683
|
-
{ label: "Wyoming", value: "WY" }
|
|
684
|
-
];
|
|
685
|
-
function Ie(e) {
|
|
686
|
-
if (e && typeof e == "object" && "value" in e) {
|
|
687
|
-
const t = e.value;
|
|
688
|
-
return typeof t == "string" ? t : String(t ?? "");
|
|
689
|
-
}
|
|
690
|
-
return "";
|
|
691
|
-
}
|
|
692
|
-
function it() {
|
|
693
|
-
const e = We({
|
|
694
|
-
address1: "",
|
|
695
|
-
address2: "",
|
|
696
|
-
city: "",
|
|
697
|
-
state: null,
|
|
698
|
-
zip: ""
|
|
699
|
-
});
|
|
700
|
-
return {
|
|
701
|
-
formData: e,
|
|
702
|
-
onAddress1Input: (...b) => {
|
|
703
|
-
e.address1 = Ie(b[0]);
|
|
704
|
-
},
|
|
705
|
-
onAddress2Input: (...b) => {
|
|
706
|
-
e.address2 = Ie(b[0]);
|
|
707
|
-
},
|
|
708
|
-
onCityInput: (...b) => {
|
|
709
|
-
e.city = Ie(b[0]);
|
|
710
|
-
},
|
|
711
|
-
onStateChange: (b) => {
|
|
712
|
-
e.state = b.value;
|
|
713
|
-
},
|
|
714
|
-
resetFormData: () => {
|
|
715
|
-
e.address1 = "", e.address2 = "", e.city = "", e.state = null, e.zip = "";
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
function st(e, t = "zip") {
|
|
720
|
-
const a = rt({ id: t }), {
|
|
721
|
-
zipDisplay: f,
|
|
722
|
-
zipRaw: l,
|
|
723
|
-
isZipValid: p,
|
|
724
|
-
wrapperClass: b,
|
|
725
|
-
handleZipInput: k
|
|
726
|
-
} = a;
|
|
727
|
-
return ae(l, (z) => {
|
|
728
|
-
e.zip = z;
|
|
729
|
-
}), {
|
|
730
|
-
zipDisplay: f,
|
|
731
|
-
isZipValid: p,
|
|
732
|
-
zipWrapperClass: b,
|
|
733
|
-
onZipInput: k,
|
|
734
|
-
resetZip: () => {
|
|
735
|
-
f.value = "", e.zip = "";
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
function ut(e) {
|
|
740
|
-
const t = y(
|
|
741
|
-
() => e.formData.address1.trim() !== ""
|
|
742
|
-
), a = y(() => e.formData.city.trim() !== ""), f = y(() => !!e.formData.state), l = y(() => re(e.isZipValid)), p = y(
|
|
743
|
-
() => t.value && a.value && f.value && l.value
|
|
744
|
-
);
|
|
745
|
-
return {
|
|
746
|
-
strictAddress1Valid: t,
|
|
747
|
-
strictCityValid: a,
|
|
748
|
-
strictStateValid: f,
|
|
749
|
-
strictZipValid: l,
|
|
750
|
-
strictAddressValid: p
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
function ct(e) {
|
|
754
|
-
if (!e) return;
|
|
755
|
-
e.querySelector(
|
|
756
|
-
'.k-invalid input, .k-invalid[tabindex="0"]'
|
|
757
|
-
)?.focus();
|
|
758
|
-
}
|
|
759
|
-
function dt(e, t) {
|
|
760
|
-
const a = e ?? t.currentTarget, f = t.relatedTarget;
|
|
761
|
-
return !a || !a.contains(f);
|
|
762
|
-
}
|
|
763
|
-
function Lt(e) {
|
|
764
|
-
const t = Y(
|
|
765
|
-
re(e.fieldsetRef)
|
|
766
|
-
);
|
|
767
|
-
Ke(() => {
|
|
768
|
-
t.value = re(e.fieldsetRef);
|
|
769
|
-
});
|
|
770
|
-
const a = Y(!1), f = Y(!1), l = y(() => re(e.required) ?? !0), {
|
|
771
|
-
formData: p,
|
|
772
|
-
onAddress1Input: b,
|
|
773
|
-
onAddress2Input: k,
|
|
774
|
-
onCityInput: L,
|
|
775
|
-
onStateChange: z,
|
|
776
|
-
resetFormData: M
|
|
777
|
-
} = it(), C = `${e.addressId}-zip`, { zipDisplay: x, isZipValid: A, zipWrapperClass: V, onZipInput: v, resetZip: c } = st(p, C), {
|
|
778
|
-
strictAddress1Valid: g,
|
|
779
|
-
strictCityValid: R,
|
|
780
|
-
strictStateValid: q,
|
|
781
|
-
strictZipValid: X,
|
|
782
|
-
strictAddressValid: W
|
|
783
|
-
} = ut({
|
|
784
|
-
formData: p,
|
|
785
|
-
isZipValid: A
|
|
786
|
-
}), B = ot(t, {
|
|
787
|
-
submitted: a,
|
|
788
|
-
isValid: () => W.value
|
|
789
|
-
}), { touched: _, fieldsetValidate: d, onFocusout: I, reset: m } = B, E = B.createFieldValidationsMap({
|
|
790
|
-
address1: g,
|
|
791
|
-
city: R,
|
|
792
|
-
state: q,
|
|
793
|
-
zip: X,
|
|
794
|
-
address: W
|
|
795
|
-
}), {
|
|
796
|
-
address1: F,
|
|
797
|
-
city: D,
|
|
798
|
-
state: P,
|
|
799
|
-
zip: K,
|
|
800
|
-
address: Z
|
|
801
|
-
} = E, ne = y(
|
|
802
|
-
() => l.value ? d.value : !1
|
|
803
|
-
), se = y(
|
|
804
|
-
() => l.value ? F.value : !0
|
|
805
|
-
), n = y(
|
|
806
|
-
() => l.value ? D.value : !0
|
|
807
|
-
), o = y(
|
|
808
|
-
() => l.value ? P.value : !0
|
|
809
|
-
), S = y(
|
|
810
|
-
() => l.value ? K.value : !0
|
|
811
|
-
), u = y(
|
|
812
|
-
() => l.value ? Z.value : !0
|
|
813
|
-
), h = { value: null, label: "State" }, $ = lt.map(({ label: w, value: O }) => ({
|
|
814
|
-
label: w,
|
|
815
|
-
value: O
|
|
816
|
-
})), r = y(() => ({
|
|
817
|
-
address1: p.address1.trim(),
|
|
818
|
-
address2: p.address2.trim(),
|
|
819
|
-
city: p.city.trim(),
|
|
820
|
-
state: (p.state ?? "").trim().toUpperCase(),
|
|
821
|
-
zip: p.zip.replace(/\D/g, "")
|
|
822
|
-
})), s = y(() => p.address1.trim() === "" && p.address2.trim() === "" && p.city.trim() === "" && (p.state ?? "").trim() === "" && p.zip.replace(/\D/g, "") === ""), T = y(() => !s.value), N = y(() => !l.value && T.value && (!g.value || !R.value || !q.value)), U = y(() => {
|
|
823
|
-
const w = p.zip.replace(/\D/g, "");
|
|
824
|
-
return !l.value && T.value && w.length !== 5 && w.length !== 9;
|
|
825
|
-
}), Q = y(() => !l.value && T.value && !W.value), G = y(() => !l.value && Q.value && (f.value || a.value));
|
|
826
|
-
return ae(r, () => {
|
|
827
|
-
l.value || (f.value = !1);
|
|
828
|
-
}), ae(l, (w) => {
|
|
829
|
-
w || (a.value = !1, f.value = !1, m());
|
|
830
|
-
}), {
|
|
831
|
-
formData: p,
|
|
832
|
-
submitted: a,
|
|
833
|
-
touched: _,
|
|
834
|
-
addressValidate: ne,
|
|
835
|
-
address1Valid: se,
|
|
836
|
-
cityValid: n,
|
|
837
|
-
stateValid: o,
|
|
838
|
-
zipValid: S,
|
|
839
|
-
addressValid: u,
|
|
840
|
-
optionalFeedbackActive: G,
|
|
841
|
-
optionalPartialInvalid: Q,
|
|
842
|
-
optionalMissingRequiredFields: N,
|
|
843
|
-
optionalZipInvalid: U,
|
|
844
|
-
stateDefaultItem: h,
|
|
845
|
-
stateOptions: $,
|
|
846
|
-
zipDisplay: x,
|
|
847
|
-
zipWrapperClass: V,
|
|
848
|
-
onAddress1Input: b,
|
|
849
|
-
onAddress2Input: k,
|
|
850
|
-
onCityInput: L,
|
|
851
|
-
onStateChange: z,
|
|
852
|
-
onZipInput: v,
|
|
853
|
-
onFieldsetFocusout: (w) => {
|
|
854
|
-
const O = dt(t.value, w);
|
|
855
|
-
I(w), !l.value && O && (f.value = !0);
|
|
856
|
-
},
|
|
857
|
-
normalizedPayload: r,
|
|
858
|
-
validateForSubmit: async () => l.value ? (a.value = !0, W.value ? {
|
|
859
|
-
isValid: !0,
|
|
860
|
-
payload: r.value
|
|
861
|
-
} : (await j(), ct(t.value), { isValid: !1, payload: null })) : s.value || W.value ? (a.value = !1, {
|
|
862
|
-
isValid: !0,
|
|
863
|
-
payload: r.value
|
|
864
|
-
}) : (a.value = !0, { isValid: !1, payload: null }),
|
|
865
|
-
reset: () => {
|
|
866
|
-
a.value = !1, f.value = !1, m(), M(), c();
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
const Oe = (e) => e === "left" ? "right" : e === "right" ? "left" : "center", Ve = (e) => e === "top" ? "bottom" : e === "bottom" ? "top" : "center", Te = (e, t, a, f) => {
|
|
871
|
-
const l = e.left + (a.horizontal === "right" ? e.width : a.horizontal === "center" ? e.width / 2 : 0), p = e.top + (a.vertical === "bottom" ? e.height : a.vertical === "center" ? e.height / 2 : 0), b = t ? f.horizontal === "right" ? t.width : f.horizontal === "center" ? t.width / 2 : 0 : 0, k = t ? f.vertical === "bottom" ? t.height : f.vertical === "center" ? t.height / 2 : 0 : 0;
|
|
872
|
-
return { left: l - b, top: p - k };
|
|
873
|
-
}, Ne = (e, t, a, f) => t >= f - a ? a : Math.min(Math.max(e, a), f - t), ft = ({
|
|
874
|
-
anchor: e,
|
|
875
|
-
popup: t,
|
|
876
|
-
anchorAlign: a,
|
|
877
|
-
popupAlign: f,
|
|
878
|
-
bounds: l,
|
|
879
|
-
collision: p
|
|
880
|
-
}) => {
|
|
881
|
-
const b = Te(e, t, a, f);
|
|
882
|
-
if (!t) return b;
|
|
883
|
-
let { left: k, top: L } = b;
|
|
884
|
-
if (p.horizontal === "fit")
|
|
885
|
-
k = Ne(k, t.width, l.left, l.right);
|
|
886
|
-
else {
|
|
887
|
-
const z = k + t.width - l.right, M = l.left - k;
|
|
888
|
-
if (z > 0 || M > 0) {
|
|
889
|
-
const C = Te(
|
|
890
|
-
e,
|
|
891
|
-
t,
|
|
892
|
-
{
|
|
893
|
-
horizontal: Oe(a.horizontal),
|
|
894
|
-
vertical: a.vertical
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
horizontal: Oe(f.horizontal),
|
|
898
|
-
vertical: f.vertical
|
|
899
|
-
}
|
|
900
|
-
), x = Math.max(z, 0) + Math.max(M, 0);
|
|
901
|
-
Math.max(C.left + t.width - l.right, 0) + Math.max(l.left - C.left, 0) < x && (k = C.left);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
if (p.vertical === "fit")
|
|
905
|
-
L = Ne(L, t.height, l.top, l.bottom);
|
|
906
|
-
else {
|
|
907
|
-
const z = L + t.height - l.bottom, M = l.top - L;
|
|
908
|
-
if (z > 0 || M > 0) {
|
|
909
|
-
const C = Te(
|
|
910
|
-
e,
|
|
911
|
-
t,
|
|
912
|
-
{
|
|
913
|
-
horizontal: a.horizontal,
|
|
914
|
-
vertical: Ve(a.vertical)
|
|
915
|
-
},
|
|
916
|
-
{
|
|
917
|
-
horizontal: f.horizontal,
|
|
918
|
-
vertical: Ve(f.vertical)
|
|
919
|
-
}
|
|
920
|
-
), x = Math.max(z, 0) + Math.max(M, 0);
|
|
921
|
-
Math.max(C.top + t.height - l.bottom, 0) + Math.max(l.top - C.top, 0) < x && (L = C.top);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
return { left: k, top: L };
|
|
925
|
-
}, Pt = (e = "fkid") => {
|
|
926
|
-
const t = `${e}-${Xe()}`;
|
|
927
|
-
return { instanceId: t, compose: (...f) => [t, ...f].filter((l) => l != null).map(String).join("-") };
|
|
928
|
-
}, pt = typeof window < "u" && typeof document < "u";
|
|
929
|
-
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
930
|
-
const vt = Object.prototype.toString, mt = (e) => vt.call(e) === "[object Object]", Ae = () => {
|
|
931
|
-
};
|
|
932
|
-
function Ce(e) {
|
|
933
|
-
return Array.isArray(e) ? e : [e];
|
|
934
|
-
}
|
|
935
|
-
function ht(e, t, a) {
|
|
936
|
-
return ae(e, t, {
|
|
937
|
-
...a,
|
|
938
|
-
immediate: !0
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
const Ye = pt ? window : void 0;
|
|
942
|
-
function Se(e) {
|
|
943
|
-
var t;
|
|
944
|
-
const a = re(e);
|
|
945
|
-
return (t = a?.$el) !== null && t !== void 0 ? t : a;
|
|
946
|
-
}
|
|
947
|
-
function Re(...e) {
|
|
948
|
-
const t = (f, l, p, b) => (f.addEventListener(l, p, b), () => f.removeEventListener(l, p, b)), a = y(() => {
|
|
949
|
-
const f = Ce(re(e[0])).filter((l) => l != null);
|
|
950
|
-
return f.every((l) => typeof l != "string") ? f : void 0;
|
|
951
|
-
});
|
|
952
|
-
return ht(() => {
|
|
953
|
-
var f, l;
|
|
954
|
-
return [
|
|
955
|
-
(f = (l = a.value) === null || l === void 0 ? void 0 : l.map((p) => Se(p))) !== null && f !== void 0 ? f : [Ye].filter((p) => p != null),
|
|
956
|
-
Ce(re(a.value ? e[1] : e[0])),
|
|
957
|
-
Ce(_e(a.value ? e[2] : e[1])),
|
|
958
|
-
re(a.value ? e[3] : e[2])
|
|
959
|
-
];
|
|
960
|
-
}, ([f, l, p, b], k, L) => {
|
|
961
|
-
if (!f?.length || !l?.length || !p?.length) return;
|
|
962
|
-
const z = mt(b) ? { ...b } : b, M = f.flatMap((C) => l.flatMap((x) => p.map((A) => t(C, x, A, z))));
|
|
963
|
-
L(() => {
|
|
964
|
-
M.forEach((C) => C());
|
|
965
|
-
});
|
|
966
|
-
}, { flush: "post" });
|
|
967
|
-
}
|
|
968
|
-
function Be(e, t, a = {}) {
|
|
969
|
-
const { window: f = Ye, ignore: l = [], capture: p = !0, detectIframe: b = !1, controls: k = !1 } = a;
|
|
970
|
-
if (!f) return k ? {
|
|
971
|
-
stop: Ae,
|
|
972
|
-
cancel: Ae,
|
|
973
|
-
trigger: Ae
|
|
974
|
-
} : Ae;
|
|
975
|
-
let L = !0;
|
|
976
|
-
const z = (c) => re(l).some((g) => {
|
|
977
|
-
if (typeof g == "string") return Array.from(f.document.querySelectorAll(g)).some((R) => R === c.target || c.composedPath().includes(R));
|
|
978
|
-
{
|
|
979
|
-
const R = Se(g);
|
|
980
|
-
return R && (c.target === R || c.composedPath().includes(R));
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
function M(c) {
|
|
984
|
-
const g = re(c);
|
|
985
|
-
return g && g.$.subTree.shapeFlag === 16;
|
|
986
|
-
}
|
|
987
|
-
function C(c, g) {
|
|
988
|
-
const R = re(c), q = R.$.subTree && R.$.subTree.children;
|
|
989
|
-
return q == null || !Array.isArray(q) ? !1 : q.some((X) => X.el === g.target || g.composedPath().includes(X.el));
|
|
990
|
-
}
|
|
991
|
-
const x = (c) => {
|
|
992
|
-
const g = Se(e);
|
|
993
|
-
if (c.target != null && !(!(g instanceof Element) && M(e) && C(e, c)) && !(!g || g === c.target || c.composedPath().includes(g))) {
|
|
994
|
-
if ("detail" in c && c.detail === 0 && (L = !z(c)), !L) {
|
|
995
|
-
L = !0;
|
|
996
|
-
return;
|
|
997
|
-
}
|
|
998
|
-
t(c);
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
let A = !1;
|
|
1002
|
-
const V = [
|
|
1003
|
-
Re(f, "click", (c) => {
|
|
1004
|
-
A || (A = !0, setTimeout(() => {
|
|
1005
|
-
A = !1;
|
|
1006
|
-
}, 0), x(c));
|
|
1007
|
-
}, {
|
|
1008
|
-
passive: !0,
|
|
1009
|
-
capture: p
|
|
1010
|
-
}),
|
|
1011
|
-
Re(f, "pointerdown", (c) => {
|
|
1012
|
-
const g = Se(e);
|
|
1013
|
-
L = !z(c) && !!(g && !c.composedPath().includes(g));
|
|
1014
|
-
}, { passive: !0 }),
|
|
1015
|
-
b && Re(f, "blur", (c) => {
|
|
1016
|
-
setTimeout(() => {
|
|
1017
|
-
const g = Se(e);
|
|
1018
|
-
let R = f.document.activeElement;
|
|
1019
|
-
for (; R?.shadowRoot; ) R = R.shadowRoot.activeElement;
|
|
1020
|
-
R?.tagName === "IFRAME" && !g?.contains(f.document.activeElement) && t(c);
|
|
1021
|
-
}, 0);
|
|
1022
|
-
}, { passive: !0 })
|
|
1023
|
-
].filter(Boolean), v = () => V.forEach((c) => c());
|
|
1024
|
-
return k ? {
|
|
1025
|
-
stop: v,
|
|
1026
|
-
cancel: () => {
|
|
1027
|
-
L = !1;
|
|
1028
|
-
},
|
|
1029
|
-
trigger: (c) => {
|
|
1030
|
-
L = !0, x(c), L = !1;
|
|
1031
|
-
}
|
|
1032
|
-
} : v;
|
|
1033
|
-
}
|
|
1034
|
-
const gt = (e) => {
|
|
1035
|
-
let t = null;
|
|
1036
|
-
const a = () => {
|
|
1037
|
-
t?.disconnect(), t = null;
|
|
1038
|
-
};
|
|
1039
|
-
return typeof window < "u" && typeof window.IntersectionObserver == "function" && ae(
|
|
1040
|
-
[e.target, () => e.root()],
|
|
1041
|
-
([l, p]) => {
|
|
1042
|
-
a(), l && (t = new IntersectionObserver(
|
|
1043
|
-
([b]) => {
|
|
1044
|
-
b && e.onChange(b);
|
|
1045
|
-
},
|
|
1046
|
-
{ root: p, threshold: e.threshold ?? 1 }
|
|
1047
|
-
), t.observe(l));
|
|
1048
|
-
},
|
|
1049
|
-
{ immediate: !0 }
|
|
1050
|
-
), Fe(a), { disconnect: a };
|
|
1051
|
-
}, wt = ".k-table-row", we = (e) => {
|
|
1052
|
-
if (e instanceof HTMLElement) return e;
|
|
1053
|
-
const t = e?.$el;
|
|
1054
|
-
return t instanceof HTMLElement ? t : null;
|
|
1055
|
-
}, yt = (e, t) => t === "row" ? e.matches("tr.k-table-row") : !e.matches("tr.k-table-row"), bt = (e, t) => {
|
|
1056
|
-
console.warn(
|
|
1057
|
-
`usePopupMenu: triggerMode "${t}" does not match resolved element <${e.tagName.toLowerCase()}${e.className ? `.${e.className.split(" ").join(".")}` : ""}>; ARIA management skipped.`
|
|
1058
|
-
);
|
|
1059
|
-
}, St = (e) => {
|
|
1060
|
-
let t = e.parentElement, a = null;
|
|
1061
|
-
for (; t; ) {
|
|
1062
|
-
const { overflow: f, overflowX: l, overflowY: p } = window.getComputedStyle(t), b = /auto|scroll|overlay/.test(`${f} ${l}`), k = /auto|scroll|overlay/.test(`${f} ${p}`);
|
|
1063
|
-
if ((b || k) && (a ??= t), b && t.scrollWidth > t.clientWidth || k && t.scrollHeight > t.clientHeight)
|
|
1064
|
-
return t;
|
|
1065
|
-
t = t.parentElement;
|
|
1066
|
-
}
|
|
1067
|
-
return a;
|
|
1068
|
-
}, $t = (e) => {
|
|
1069
|
-
const t = Y(null), a = e.menuItemSelector ?? ".k-menu-item:not(.k-disabled)", f = e.triggerMode, l = e.anchor === !0 ? {} : e.anchor, p = l?.activationPoint ? l.activationPoint === !0 ? {} : l.activationPoint : null, b = ve(null), k = ve(null), L = l?.anchorAlign ?? {
|
|
1070
|
-
horizontal: "left",
|
|
1071
|
-
vertical: "bottom"
|
|
1072
|
-
}, z = l?.popupAlign ?? {
|
|
1073
|
-
horizontal: "left",
|
|
1074
|
-
vertical: "top"
|
|
1075
|
-
}, M = l?.collision ?? {
|
|
1076
|
-
horizontal: "flip",
|
|
1077
|
-
vertical: "flip"
|
|
1078
|
-
}, C = ve(null), x = () => we(e.triggerRef.value), A = y(() => x()), V = y(
|
|
1079
|
-
() => l && l.hideWhenAnchorClipped !== !1 ? A.value : null
|
|
1080
|
-
), v = () => {
|
|
1081
|
-
const u = l?.clipRoot ? re(l.clipRoot) : null;
|
|
1082
|
-
if (u) {
|
|
1083
|
-
const h = u.getBoundingClientRect();
|
|
1084
|
-
return {
|
|
1085
|
-
left: h.left,
|
|
1086
|
-
top: h.top,
|
|
1087
|
-
right: h.right,
|
|
1088
|
-
bottom: h.bottom
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
return {
|
|
1092
|
-
left: 0,
|
|
1093
|
-
top: 0,
|
|
1094
|
-
right: window.innerWidth,
|
|
1095
|
-
bottom: window.innerHeight
|
|
1096
|
-
};
|
|
1097
|
-
}, c = y(() => {
|
|
1098
|
-
const u = b.value;
|
|
1099
|
-
if (!e.isOpen.value || !u) return { left: 0, top: 0 };
|
|
1100
|
-
const h = v(), $ = ft({
|
|
1101
|
-
anchor: u,
|
|
1102
|
-
popup: C.value,
|
|
1103
|
-
anchorAlign: L,
|
|
1104
|
-
popupAlign: z,
|
|
1105
|
-
bounds: h,
|
|
1106
|
-
collision: M
|
|
1107
|
-
});
|
|
1108
|
-
return {
|
|
1109
|
-
left: $.left + window.scrollX,
|
|
1110
|
-
top: $.top + window.scrollY
|
|
1111
|
-
};
|
|
1112
|
-
}), g = () => {
|
|
1113
|
-
const u = e.resolveFocusTarget?.() ?? we(e.focusTargetRef?.value);
|
|
1114
|
-
return u || (e.focusTargetContainerSelector ? x()?.closest(
|
|
1115
|
-
e.focusTargetContainerSelector
|
|
1116
|
-
) ?? null : null);
|
|
1117
|
-
}, R = (u, h) => {
|
|
1118
|
-
if (!p) return !1;
|
|
1119
|
-
const $ = we(u);
|
|
1120
|
-
if (!$)
|
|
1121
|
-
return k.value = null, !1;
|
|
1122
|
-
const r = $.getBoundingClientRect();
|
|
1123
|
-
if (h.triggerType === "keyboard") {
|
|
1124
|
-
const s = p.keyboardPosition, T = s?.y ?? "center", N = typeof T == "number" ? T : T === "top" ? 0 : T === "bottom" ? r.height : r.height / 2;
|
|
1125
|
-
return k.value = {
|
|
1126
|
-
trigger: $,
|
|
1127
|
-
point: { x: s?.x ?? 8, y: N },
|
|
1128
|
-
hasMatchedTrigger: !1
|
|
1129
|
-
}, !0;
|
|
1130
|
-
}
|
|
1131
|
-
return h.coordinates ? (k.value = {
|
|
1132
|
-
trigger: $,
|
|
1133
|
-
point: {
|
|
1134
|
-
x: h.coordinates.clientX - r.left + (p.pointerOffset?.x ?? 0),
|
|
1135
|
-
y: h.coordinates.clientY - r.top + (p.pointerOffset?.y ?? 0)
|
|
1136
|
-
},
|
|
1137
|
-
hasMatchedTrigger: !1
|
|
1138
|
-
}, !0) : (k.value = null, !1);
|
|
1139
|
-
}, q = () => {
|
|
1140
|
-
if (f !== "button") return null;
|
|
1141
|
-
if (e.escapeFocusTarget) return e.escapeFocusTarget();
|
|
1142
|
-
const u = e.escapeFocusContainerSelector ?? wt;
|
|
1143
|
-
return (x() ?? document.activeElement)?.closest(u) ?? null;
|
|
1144
|
-
}, X = () => {
|
|
1145
|
-
const u = g() ?? q();
|
|
1146
|
-
if (u)
|
|
1147
|
-
return u.focus(), !0;
|
|
1148
|
-
const h = x();
|
|
1149
|
-
return h?.focus(), !!h;
|
|
1150
|
-
}, W = () => {
|
|
1151
|
-
we(e.menuRef.value)?.querySelector(a)?.focus({ preventScroll: !0 });
|
|
1152
|
-
}, B = ve(null), _ = ve(null);
|
|
1153
|
-
let d = !1;
|
|
1154
|
-
const I = () => {
|
|
1155
|
-
const u = t.value;
|
|
1156
|
-
if (u === "keyboard" || u === "escape") {
|
|
1157
|
-
const h = B.value ?? _.value;
|
|
1158
|
-
h?.focus(), u === "keyboard" && h && h === _.value && (d = !0);
|
|
1159
|
-
} else t.value === "mouse-selection" && _.value?.focus();
|
|
1160
|
-
t.value = null, B.value = null, _.value = null;
|
|
1161
|
-
}, m = (u) => {
|
|
1162
|
-
e.isOpen.value && (t.value = u, B.value = g() ?? (u === "escape" ? q() : null), _.value = x(), K(!1), e.requestHide(), j(I));
|
|
1163
|
-
};
|
|
1164
|
-
ae(
|
|
1165
|
-
[A, k],
|
|
1166
|
-
([u], h, $) => {
|
|
1167
|
-
if (!l || !u) {
|
|
1168
|
-
b.value = null;
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
let r = null;
|
|
1172
|
-
const s = () => {
|
|
1173
|
-
r = null;
|
|
1174
|
-
const U = k.value;
|
|
1175
|
-
if (p) {
|
|
1176
|
-
U && U.trigger === u ? U.hasMatchedTrigger = !0 : U?.hasMatchedTrigger && (U.trigger = u);
|
|
1177
|
-
const Q = u.getBoundingClientRect();
|
|
1178
|
-
b.value = U?.trigger === u ? new DOMRect(
|
|
1179
|
-
Q.left + U.point.x,
|
|
1180
|
-
Q.top + U.point.y,
|
|
1181
|
-
0,
|
|
1182
|
-
0
|
|
1183
|
-
) : null;
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
b.value = l.getRect?.(u) ?? u.getBoundingClientRect();
|
|
1187
|
-
}, T = () => {
|
|
1188
|
-
r === null && (r = window.requestAnimationFrame(s));
|
|
1189
|
-
}, N = typeof window.ResizeObserver == "function" ? new window.ResizeObserver(T) : null;
|
|
1190
|
-
N?.observe(u), window.addEventListener("scroll", T, {
|
|
1191
|
-
capture: !0,
|
|
1192
|
-
passive: !0
|
|
1193
|
-
}), window.addEventListener("resize", T, { passive: !0 }), T(), $(() => {
|
|
1194
|
-
r !== null && window.cancelAnimationFrame(r), N?.disconnect(), window.removeEventListener("scroll", T, !0), window.removeEventListener("resize", T);
|
|
1195
|
-
});
|
|
1196
|
-
},
|
|
1197
|
-
{ immediate: !0, flush: "post" }
|
|
1198
|
-
);
|
|
1199
|
-
const E = () => {
|
|
1200
|
-
const u = we(
|
|
1201
|
-
e.popupContentRef?.value ?? e.menuRef.value
|
|
1202
|
-
);
|
|
1203
|
-
return u?.closest(".k-popup") ?? u;
|
|
1204
|
-
};
|
|
1205
|
-
l && ae(
|
|
1206
|
-
e.isOpen,
|
|
1207
|
-
(u, h, $) => {
|
|
1208
|
-
if (!u) {
|
|
1209
|
-
C.value = null;
|
|
1210
|
-
return;
|
|
1211
|
-
}
|
|
1212
|
-
let r = null;
|
|
1213
|
-
const s = () => {
|
|
1214
|
-
r = null;
|
|
1215
|
-
const Q = E();
|
|
1216
|
-
C.value = Q?.getBoundingClientRect() ?? null;
|
|
1217
|
-
}, T = () => {
|
|
1218
|
-
r === null && (r = window.requestAnimationFrame(s));
|
|
1219
|
-
}, N = E(), U = N && typeof window.ResizeObserver == "function" ? new window.ResizeObserver(T) : null;
|
|
1220
|
-
U?.observe(N), T(), $(() => {
|
|
1221
|
-
r !== null && window.cancelAnimationFrame(r), U?.disconnect();
|
|
1222
|
-
});
|
|
1223
|
-
},
|
|
1224
|
-
{ immediate: !0, flush: "post" }
|
|
1225
|
-
), gt({
|
|
1226
|
-
target: V,
|
|
1227
|
-
root: () => l?.clipRoot ? re(l.clipRoot) : A.value ? St(A.value) : null,
|
|
1228
|
-
threshold: l?.intersectionThreshold ?? (p ? 0 : 0.5),
|
|
1229
|
-
onChange: (u) => {
|
|
1230
|
-
u.isIntersecting || m("anchor-hidden");
|
|
1231
|
-
}
|
|
1232
|
-
}), Be(e.menuRef, () => m("outside-click"), {
|
|
1233
|
-
ignore: [A]
|
|
1234
|
-
});
|
|
1235
|
-
let F = null, D = null;
|
|
1236
|
-
const P = () => {
|
|
1237
|
-
F?.isConnected && F.setAttribute("aria-expanded", "false"), F = null;
|
|
1238
|
-
}, K = (u) => {
|
|
1239
|
-
if (e.manageMenuTriggerAria === !1) return;
|
|
1240
|
-
const h = A.value;
|
|
1241
|
-
if (!h) {
|
|
1242
|
-
F?.isConnected && F.setAttribute("aria-expanded", u ? "true" : "false");
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
if (!yt(h, f)) {
|
|
1246
|
-
bt(h, f), P();
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
F && F !== h && P(), h.setAttribute("aria-expanded", u ? "true" : "false"), F = h;
|
|
1250
|
-
}, Z = () => {
|
|
1251
|
-
const u = we(e.menuRef.value), h = u?.matches('[role="menubar"]') ? u : u?.querySelector('[role="menubar"]'), $ = re(e.menuLabel)?.trim();
|
|
1252
|
-
D && D !== h && D.removeAttribute("aria-label"), h && ($ ? h.setAttribute("aria-label", $) : h.removeAttribute("aria-label")), D = h ?? null;
|
|
1253
|
-
};
|
|
1254
|
-
ae(
|
|
1255
|
-
[e.isOpen, e.triggerRef],
|
|
1256
|
-
([u]) => {
|
|
1257
|
-
K(u), !u && p && (k.value = null, b.value = null);
|
|
1258
|
-
},
|
|
1259
|
-
{ immediate: !0, flush: "post" }
|
|
1260
|
-
), ae(
|
|
1261
|
-
[e.isOpen, e.menuRef, () => re(e.menuLabel)],
|
|
1262
|
-
Z,
|
|
1263
|
-
{ immediate: !0, flush: "post" }
|
|
1264
|
-
), Fe(() => {
|
|
1265
|
-
k.value = null, P(), D?.removeAttribute("aria-label");
|
|
1266
|
-
}), ae(
|
|
1267
|
-
e.isOpen,
|
|
1268
|
-
(u) => {
|
|
1269
|
-
u && W();
|
|
1270
|
-
},
|
|
1271
|
-
{ flush: "post" }
|
|
1272
|
-
);
|
|
1273
|
-
const ne = (...u) => {
|
|
1274
|
-
const h = u[0];
|
|
1275
|
-
if (d) {
|
|
1276
|
-
d = !1;
|
|
1277
|
-
return;
|
|
1278
|
-
}
|
|
1279
|
-
if (e.isOpen.value) {
|
|
1280
|
-
m("trigger-click");
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
e.requestShow(h);
|
|
1284
|
-
};
|
|
1285
|
-
return {
|
|
1286
|
-
/**
|
|
1287
|
-
* Sets the anchor activation state, controlling whether the popup menu
|
|
1288
|
-
* should respond to trigger interactions.
|
|
1289
|
-
*/
|
|
1290
|
-
setAnchorActivation: R,
|
|
1291
|
-
/**
|
|
1292
|
-
* Handles Kendo Menu selection: records keyboard or mouse modality,
|
|
1293
|
-
* requests popup close, then runs the optional caller-owned action.
|
|
1294
|
-
*/
|
|
1295
|
-
handleMenuSelect: (u, h) => {
|
|
1296
|
-
m(
|
|
1297
|
-
u.event?.type?.startsWith("key") ? "keyboard" : "mouse-selection"
|
|
1298
|
-
), h?.(u);
|
|
1299
|
-
},
|
|
1300
|
-
/**
|
|
1301
|
-
* Toggles the action menu. When opening, focuses the first enabled Kendo
|
|
1302
|
-
* Menu item after Vue renders the popup.
|
|
1303
|
-
*/
|
|
1304
|
-
handleTriggerClick: ne,
|
|
1305
|
-
/**
|
|
1306
|
-
* Handles trigger keyboard input: Enter and Space toggle the menu; Escape
|
|
1307
|
-
* closes an open menu or focuses the configured target when already closed.
|
|
1308
|
-
*/
|
|
1309
|
-
handleTriggerKeydown: (...u) => {
|
|
1310
|
-
const h = u[0], $ = u[1];
|
|
1311
|
-
if (h.key === "Enter" || h.code === "Space") {
|
|
1312
|
-
h.preventDefault(), ne($);
|
|
1313
|
-
return;
|
|
1314
|
-
}
|
|
1315
|
-
if (h.key === "Escape") {
|
|
1316
|
-
if (h.preventDefault(), h.stopPropagation(), e.isOpen.value) {
|
|
1317
|
-
m("escape");
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
X();
|
|
1321
|
-
}
|
|
1322
|
-
},
|
|
1323
|
-
/** Closes the open menu through the keyboard path when Escape is pressed inside it. */
|
|
1324
|
-
handleMenuEscape: (u) => {
|
|
1325
|
-
u.preventDefault(), u.stopPropagation(), m("escape");
|
|
1326
|
-
},
|
|
1327
|
-
/**
|
|
1328
|
-
* Restores focus after Kendo Popup closes: keyboard menu selection and
|
|
1329
|
-
* Escape prefer the configured focus target (Escape then falls back to
|
|
1330
|
-
* `escapeFocusTarget`), mouse selections return to the trigger, and
|
|
1331
|
-
* outside clicks do not move focus.
|
|
1332
|
-
*/
|
|
1333
|
-
handlePopupClose: () => {
|
|
1334
|
-
j(I);
|
|
1335
|
-
},
|
|
1336
|
-
offset: c
|
|
1337
|
-
};
|
|
1338
|
-
}, Ot = () => {
|
|
1339
|
-
const e = /* @__PURE__ */ new Set();
|
|
1340
|
-
return { register: (l) => {
|
|
1341
|
-
e.add(l), Fe(() => e.delete(l));
|
|
1342
|
-
}, deactivateOthers: (l) => {
|
|
1343
|
-
e.forEach((p) => {
|
|
1344
|
-
p !== l && p.deactivate();
|
|
1345
|
-
});
|
|
1346
|
-
}, deactivateAll: () => {
|
|
1347
|
-
e.forEach((l) => l.deactivate());
|
|
1348
|
-
} };
|
|
1349
|
-
}, kt = (e) => {
|
|
1350
|
-
if (e instanceof HTMLElement) return e;
|
|
1351
|
-
const t = e && "$el" in e ? e.$el : null;
|
|
1352
|
-
return t instanceof HTMLElement ? t : null;
|
|
1353
|
-
}, Vt = () => {
|
|
1354
|
-
const e = Ze(/* @__PURE__ */ new Map()), t = Y(null), a = (k, L) => {
|
|
1355
|
-
const z = kt(L);
|
|
1356
|
-
z ? e.set(k, z) : e.delete(k);
|
|
1357
|
-
}, f = (k) => e.get(k) ?? null, l = (k) => {
|
|
1358
|
-
t.value = k;
|
|
1359
|
-
}, p = () => {
|
|
1360
|
-
t.value = null;
|
|
1361
|
-
}, b = (k) => t.value === k;
|
|
1362
|
-
return {
|
|
1363
|
-
activeId: te(t),
|
|
1364
|
-
isActive: y(() => t.value !== null),
|
|
1365
|
-
activeElement: y(
|
|
1366
|
-
() => t.value !== null ? f(t.value) : null
|
|
1367
|
-
),
|
|
1368
|
-
register: a,
|
|
1369
|
-
resolve: f,
|
|
1370
|
-
activate: l,
|
|
1371
|
-
deactivate: p,
|
|
1372
|
-
isIdActive: b
|
|
1373
|
-
};
|
|
1374
|
-
}, ze = {
|
|
1375
|
-
title: "My Window",
|
|
1376
|
-
draggable: !0,
|
|
1377
|
-
resizable: !0,
|
|
1378
|
-
closable: !0,
|
|
1379
|
-
fixed: !0,
|
|
1380
|
-
minimizeButton: !0,
|
|
1381
|
-
maximizeButton: !0,
|
|
1382
|
-
initialLeft: void 0,
|
|
1383
|
-
initialTop: void 0,
|
|
1384
|
-
initialWidth: 500,
|
|
1385
|
-
initialHeight: 500,
|
|
1386
|
-
width: 500,
|
|
1387
|
-
height: 500,
|
|
1388
|
-
left: void 0,
|
|
1389
|
-
top: void 0
|
|
1390
|
-
}, At = (e) => e === "DEFAULT" || e === "MINIMIZED" || e === "FULLSCREEN", Et = 120, Dt = 100, xt = ["n", "e", "s", "w", "ne", "nw", "se", "sw"], ye = (e, t, a) => Math.min(Math.max(e, t), a), qe = (e) => typeof e == "object" && e !== null && "drag" in e && "left" in e && "top" in e && "width" in e && "height" in e && typeof e.left == "number" && typeof e.top == "number" && typeof e.width == "number" && typeof e.height == "number", Mt = (e, t, a) => Math.max(e - t - a, 0);
|
|
1391
|
-
function Nt(e = {}) {
|
|
1392
|
-
Pe(e.settings) && (e.settings.value = {
|
|
1393
|
-
...ze,
|
|
1394
|
-
...e.settings.value
|
|
1395
|
-
});
|
|
1396
|
-
const t = Pe(e.settings) ? e.settings : Y({ ...ze, ...e.settings }), a = ve(null), f = Y(!1), l = Y(e.initialStage ?? "DEFAULT"), p = Y(!1), b = Y(!1), k = Y(0), L = Y(0), z = y(() => t.value.minWidth ?? Et), M = y(
|
|
1397
|
-
() => t.value.minHeight ?? Dt
|
|
1398
|
-
);
|
|
1399
|
-
let C = null, x = null;
|
|
1400
|
-
const A = () => {
|
|
1401
|
-
const n = t.value.fixed ? 0 : window.scrollX, o = t.value.fixed ? 0 : window.scrollY;
|
|
1402
|
-
return {
|
|
1403
|
-
left: n,
|
|
1404
|
-
top: o,
|
|
1405
|
-
right: n + document.documentElement.clientWidth,
|
|
1406
|
-
bottom: o + document.documentElement.clientHeight
|
|
1407
|
-
};
|
|
1408
|
-
}, V = () => ({
|
|
1409
|
-
left: t.value.left ?? k.value,
|
|
1410
|
-
top: t.value.top ?? L.value,
|
|
1411
|
-
width: t.value.width ?? t.value.initialWidth,
|
|
1412
|
-
height: t.value.height ?? t.value.initialHeight
|
|
1413
|
-
}), v = async (n) => {
|
|
1414
|
-
x = null;
|
|
1415
|
-
const o = t.value.left !== void 0 && t.value.top !== void 0;
|
|
1416
|
-
if (n?.resetPosition || !o) {
|
|
1417
|
-
const S = Number.parseFloat(
|
|
1418
|
-
window.getComputedStyle(document.documentElement).fontSize
|
|
1419
|
-
), u = Number.isFinite(S) ? S : 16, h = t.value.fixed ? 0 : window.scrollX, $ = t.value.fixed ? 0 : window.scrollY;
|
|
1420
|
-
t.value.left = void 0, t.value.top = void 0, t.value.width = void 0, t.value.height = void 0, k.value = t.value.initialLeft ?? h + Mt(
|
|
1421
|
-
window.innerWidth,
|
|
1422
|
-
t.value.initialWidth,
|
|
1423
|
-
u
|
|
1424
|
-
), L.value = t.value.initialTop ?? $ + u, f.value = !0, await j(), t.value.width = t.value.initialWidth, t.value.height = t.value.initialHeight;
|
|
1425
|
-
} else
|
|
1426
|
-
f.value = !0;
|
|
1427
|
-
e.onOpen?.();
|
|
1428
|
-
}, c = () => {
|
|
1429
|
-
l.value = "DEFAULT", f.value = !1, e.onClose?.();
|
|
1430
|
-
}, g = (...n) => {
|
|
1431
|
-
const o = n[2];
|
|
1432
|
-
if (typeof o != "object" || o === null || !("state" in o) || !At(o.state))
|
|
1433
|
-
return;
|
|
1434
|
-
const S = o.state;
|
|
1435
|
-
S !== l.value && (x = null, l.value = S, e.onStageChange?.(S));
|
|
1436
|
-
}, R = (...n) => {
|
|
1437
|
-
const o = n[0];
|
|
1438
|
-
if (qe(o)) {
|
|
1439
|
-
const S = a.value?.$el, h = (S instanceof Element ? S.querySelector(".k-window-titlebar") : null)?.getBoundingClientRect(), $ = h?.width ?? o.width, r = h?.height ?? o.height, s = A(), T = Math.max(
|
|
1440
|
-
s.right - $,
|
|
1441
|
-
s.left
|
|
1442
|
-
), N = Math.max(
|
|
1443
|
-
s.bottom - r,
|
|
1444
|
-
s.top
|
|
1445
|
-
);
|
|
1446
|
-
t.value.left = ye(o.left, s.left, T), t.value.top = ye(o.top, s.top, N), p.value = o.drag && !o.end, e.onMove?.(o);
|
|
1447
|
-
}
|
|
1448
|
-
}, q = (n) => {
|
|
1449
|
-
const { direction: o, start: S } = n, u = A(), h = n.pointerX - n.startX, $ = n.pointerY - n.startY;
|
|
1450
|
-
let r = S.left, s = S.top, T = S.left + S.width, N = S.top + S.height;
|
|
1451
|
-
return o.includes("n") && (s = ye(
|
|
1452
|
-
S.top + $,
|
|
1453
|
-
Math.min(u.top, S.top),
|
|
1454
|
-
N - M.value
|
|
1455
|
-
)), o.includes("s") && (N = ye(
|
|
1456
|
-
N + $,
|
|
1457
|
-
s + M.value,
|
|
1458
|
-
Math.max(u.bottom, N)
|
|
1459
|
-
)), o.includes("w") && (r = ye(
|
|
1460
|
-
S.left + h,
|
|
1461
|
-
Math.min(u.left, S.left),
|
|
1462
|
-
T - z.value
|
|
1463
|
-
)), o.includes("e") && (T = ye(
|
|
1464
|
-
T + h,
|
|
1465
|
-
r + z.value,
|
|
1466
|
-
Math.max(u.right, T)
|
|
1467
|
-
)), { left: r, top: s, width: T - r, height: N - s };
|
|
1468
|
-
}, X = (n) => {
|
|
1469
|
-
const o = V(), S = x ?? o, u = A(), h = Math.max(u.right, o.left + o.width) - o.left, $ = Math.max(u.bottom, o.top + o.height) - o.top;
|
|
1470
|
-
return {
|
|
1471
|
-
left: o.left,
|
|
1472
|
-
top: o.top,
|
|
1473
|
-
width: Math.max(
|
|
1474
|
-
Math.min(o.width + n.width - S.width, h),
|
|
1475
|
-
z.value
|
|
1476
|
-
),
|
|
1477
|
-
height: Math.max(
|
|
1478
|
-
Math.min(
|
|
1479
|
-
o.height + n.height - S.height,
|
|
1480
|
-
$
|
|
1481
|
-
),
|
|
1482
|
-
M.value
|
|
1483
|
-
)
|
|
1484
|
-
};
|
|
1485
|
-
}, W = (n) => {
|
|
1486
|
-
C && (C.pointerX = n.clientX, C.pointerY = n.clientY);
|
|
1487
|
-
}, B = () => {
|
|
1488
|
-
C = null, window.removeEventListener("pointermove", W, !0), window.removeEventListener("pointerup", _, !0), window.removeEventListener("pointercancel", _, !0);
|
|
1489
|
-
};
|
|
1490
|
-
function _() {
|
|
1491
|
-
window.setTimeout(B, 0);
|
|
1492
|
-
}
|
|
1493
|
-
const d = (n, o) => {
|
|
1494
|
-
const S = xt.find(
|
|
1495
|
-
(u) => o.classList.contains(`k-resize-${u}`)
|
|
1496
|
-
);
|
|
1497
|
-
B(), S && (C = {
|
|
1498
|
-
direction: S,
|
|
1499
|
-
start: V(),
|
|
1500
|
-
startX: n.clientX,
|
|
1501
|
-
startY: n.clientY,
|
|
1502
|
-
pointerX: n.clientX,
|
|
1503
|
-
pointerY: n.clientY
|
|
1504
|
-
}, window.addEventListener("pointermove", W, !0), window.addEventListener("pointerup", _, !0), window.addEventListener("pointercancel", _, !0));
|
|
1505
|
-
}, I = (...n) => {
|
|
1506
|
-
const o = n[0];
|
|
1507
|
-
if (qe(o)) {
|
|
1508
|
-
const S = C ? q(C) : X(o);
|
|
1509
|
-
x = { width: o.width, height: o.height }, t.value.left = S.left, t.value.top = S.top, t.value.width = S.width, t.value.height = S.height, b.value = o.drag && !o.end, o.end && B(), e.onResize?.({ ...o, ...S });
|
|
1510
|
-
}
|
|
1511
|
-
}, m = (n) => {
|
|
1512
|
-
const o = n.target instanceof Element ? n.target.closest(".k-resize-handle") : null;
|
|
1513
|
-
o && (n.preventDefault(), d(n, o));
|
|
1514
|
-
}, E = (n) => {
|
|
1515
|
-
re(e.titlebarDoubleClick) === !1 && n.target instanceof Element && n.target.closest(".k-window-titlebar") && (n.preventDefault(), n.stopPropagation());
|
|
1516
|
-
};
|
|
1517
|
-
let F, D;
|
|
1518
|
-
const P = () => {
|
|
1519
|
-
F?.(), F = void 0;
|
|
1520
|
-
}, K = () => {
|
|
1521
|
-
D?.(), D = void 0;
|
|
1522
|
-
};
|
|
1523
|
-
ae(
|
|
1524
|
-
a,
|
|
1525
|
-
(n) => {
|
|
1526
|
-
P(), K(), B(), b.value = !1, p.value = !1;
|
|
1527
|
-
const o = n?.$el;
|
|
1528
|
-
o instanceof HTMLElement && (o.addEventListener("pointerdown", m, {
|
|
1529
|
-
capture: !0
|
|
1530
|
-
}), F = () => o.removeEventListener("pointerdown", m, {
|
|
1531
|
-
capture: !0
|
|
1532
|
-
}), o.addEventListener("dblclick", E, {
|
|
1533
|
-
capture: !0
|
|
1534
|
-
}), D = () => o.removeEventListener("dblclick", E, {
|
|
1535
|
-
capture: !0
|
|
1536
|
-
}));
|
|
1537
|
-
},
|
|
1538
|
-
{ flush: "post" }
|
|
1539
|
-
), Me(P), Me(K), Me(B);
|
|
1540
|
-
const Z = y(() => {
|
|
1541
|
-
const n = ["fk-window"];
|
|
1542
|
-
return t.value.draggable && l.value !== "FULLSCREEN" && n.push("fk-window-can-drag"), p.value && n.push("fk-window-is-dragging"), b.value && n.push("fk-window-is-resizing"), t.value.fixed && n.push("fk-window-fixed"), t.value.minimizeButton || n.push("fk-window-hide-minimize"), t.value.maximizeButton || n.push("fk-window-hide-maximize"), t.value.closable || n.push("fk-window-hide-close"), n.join(" ");
|
|
1543
|
-
}), ne = y(() => ({
|
|
1544
|
-
title: t.value.title,
|
|
1545
|
-
draggable: t.value.draggable,
|
|
1546
|
-
resizable: t.value.resizable,
|
|
1547
|
-
left: t.value.left,
|
|
1548
|
-
top: t.value.top,
|
|
1549
|
-
initialLeft: k.value,
|
|
1550
|
-
initialTop: L.value,
|
|
1551
|
-
initialWidth: t.value.initialWidth,
|
|
1552
|
-
initialHeight: t.value.initialHeight,
|
|
1553
|
-
width: t.value.width,
|
|
1554
|
-
height: t.value.height,
|
|
1555
|
-
minWidth: z.value,
|
|
1556
|
-
minHeight: M.value,
|
|
1557
|
-
stage: l.value,
|
|
1558
|
-
windowClass: Z.value
|
|
1559
|
-
}));
|
|
1560
|
-
return {
|
|
1561
|
-
windowRef: a,
|
|
1562
|
-
settings: t,
|
|
1563
|
-
visible: f,
|
|
1564
|
-
stage: l,
|
|
1565
|
-
isDragging: p,
|
|
1566
|
-
isResizing: b,
|
|
1567
|
-
props: ne,
|
|
1568
|
-
events: {
|
|
1569
|
-
move: R,
|
|
1570
|
-
resize: I,
|
|
1571
|
-
stagechange: g,
|
|
1572
|
-
close: c
|
|
1573
|
-
},
|
|
1574
|
-
open: v,
|
|
1575
|
-
close: c
|
|
1576
|
-
};
|
|
1577
|
-
}
|
|
1578
|
-
function zt(e) {
|
|
1579
|
-
const t = Y(""), a = Y(void 0), f = Y(!!e.debug), l = Y(e.dateFormat ?? "mm/dd/yyyy"), p = y(() => !!e.required), b = 1e3, k = Y(!1), L = ["ArrowUp", "ArrowDown"], z = ["ArrowLeft", "ArrowRight"], M = y(() => (t.value ?? "").replace(/\D/g, "")), C = (n) => n <= 2 ? "mm" : n <= 5 ? "dd" : M.value.length <= 10 ? "yyyy" : "mm", x = y(() => {
|
|
1580
|
-
const n = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
1581
|
-
return parseInt(n).toString().padStart(2, "0");
|
|
1582
|
-
}), A = y(() => {
|
|
1583
|
-
const n = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
|
|
1584
|
-
return parseInt(n).toString().padStart(2, "0");
|
|
1585
|
-
}), V = y(() => {
|
|
1586
|
-
const n = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
1587
|
-
return parseInt(n).toString().padStart(4, "0");
|
|
1588
|
-
}), v = (n) => {
|
|
1589
|
-
if (M.value.length === 0) {
|
|
1590
|
-
e.onChange({ value: null, event: n });
|
|
1591
|
-
return;
|
|
1592
|
-
}
|
|
1593
|
-
if (M.value.length < 8) {
|
|
1594
|
-
e.onChange({ value: null, event: n });
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
if ((t.value ?? "").length === 10 && M.value.length === 8) {
|
|
1598
|
-
const [o, S, u] = t.value.split("/"), h = parseInt(o), $ = parseInt(S), r = parseInt(u);
|
|
1599
|
-
if (W(r, h, $)) {
|
|
1600
|
-
const s = q(r, h, $);
|
|
1601
|
-
c(s) ? e.onChange({ value: s, event: n }) : e.onChange({ value: null, event: n });
|
|
1602
|
-
} else
|
|
1603
|
-
e.onChange({ value: null, event: n });
|
|
1604
|
-
}
|
|
1605
|
-
}, c = (n) => {
|
|
1606
|
-
const o = e.min ?? void 0, S = e.max ?? void 0;
|
|
1607
|
-
return !(o && n < o || S && n > S);
|
|
1608
|
-
}, g = y(() => {
|
|
1609
|
-
if ((t.value ?? "").length === 10 && M.value.length === 8) {
|
|
1610
|
-
const [n, o, S] = (t.value ?? "").split("/"), u = parseInt(n), h = parseInt(o), $ = parseInt(S);
|
|
1611
|
-
if (W($, u, h))
|
|
1612
|
-
return q($, u, h);
|
|
1613
|
-
}
|
|
1614
|
-
return null;
|
|
1615
|
-
}), R = y(() => (t.value ?? "").length === 10 && M.value.length === 8), q = (n, o, S) => {
|
|
1616
|
-
const u = /* @__PURE__ */ new Date(0);
|
|
1617
|
-
return u.setFullYear(n, o - 1, S), u.setHours(0, 0, 0, 0), u;
|
|
1618
|
-
}, X = (n, o) => q(n, o + 1, 0).getDate(), W = (n, o, S) => o >= 1 && o <= 12 && n >= b && S >= 1 && S <= X(n, o), B = (n) => {
|
|
1619
|
-
t.value = n.value;
|
|
1620
|
-
const o = n.event?.target;
|
|
1621
|
-
a.value = o?.selectionStart ?? 0, v(n);
|
|
1622
|
-
}, _ = (n) => {
|
|
1623
|
-
a.value = n.target.selectionStart ?? 0;
|
|
1624
|
-
}, d = (n, o, S) => {
|
|
1625
|
-
const u = o?.selectionStart ?? a.value ?? 0;
|
|
1626
|
-
a.value = u;
|
|
1627
|
-
let h = parseInt(x.value), $ = parseInt(A.value), r = parseInt(V.value);
|
|
1628
|
-
if (!(M.value.length >= 8) || !W(r, h, $)) {
|
|
1629
|
-
const J = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
1630
|
-
h = J.getMonth() + 1, $ = J.getDate(), r = J.getFullYear(), t.value = `${String(h).padStart(2, "0")}/${String($).padStart(
|
|
1631
|
-
2,
|
|
1632
|
-
"0"
|
|
1633
|
-
)}/${String(r)}`;
|
|
1634
|
-
const ce = q(r, h, $);
|
|
1635
|
-
e.onChange({ value: c(ce) ? ce : null, event: S }), D({ useRAF: !0 });
|
|
1636
|
-
return;
|
|
1637
|
-
}
|
|
1638
|
-
const T = C(u);
|
|
1639
|
-
if (T === "mm")
|
|
1640
|
-
h = n === "ArrowUp" ? h < 12 ? h + 1 : 1 : h > 1 ? h - 1 : 12;
|
|
1641
|
-
else if (T === "dd") {
|
|
1642
|
-
const J = new Date(r, h, 0).getDate();
|
|
1643
|
-
$ = n === "ArrowUp" ? $ < J ? $ + 1 : 1 : $ > 1 ? $ - 1 : J;
|
|
1644
|
-
} else T === "yyyy" && (r = n === "ArrowUp" ? r + 1 : Math.max(1, r - 1));
|
|
1645
|
-
t.value = `${String(h).padStart(2, "0")}/${String($).padStart(
|
|
1646
|
-
2,
|
|
1647
|
-
"0"
|
|
1648
|
-
)}/${String(r)}`;
|
|
1649
|
-
const [N, U, Q] = t.value.split("/"), G = q(
|
|
1650
|
-
parseInt(Q),
|
|
1651
|
-
parseInt(N),
|
|
1652
|
-
parseInt(U)
|
|
1653
|
-
);
|
|
1654
|
-
G.toString() !== "Invalid Date" && parseInt(Q) >= 1e3 ? e.onChange({
|
|
1655
|
-
value: c(G) ? G : null,
|
|
1656
|
-
event: S
|
|
1657
|
-
}) : e.onChange({ value: null, event: S }), D({ useRAF: !0 });
|
|
1658
|
-
}, I = (n) => {
|
|
1659
|
-
if (n.code === "Space" || n.key === " ") {
|
|
1660
|
-
n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1663
|
-
if (n.key === "ArrowDown" && n.altKey) {
|
|
1664
|
-
n.preventDefault(), n.stopPropagation(), e.onShowCalendar(n);
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1667
|
-
if (L.includes(n.key)) {
|
|
1668
|
-
if (n.altKey) return;
|
|
1669
|
-
n.preventDefault(), n.stopPropagation();
|
|
1670
|
-
const o = n.target;
|
|
1671
|
-
d(n.key, o, n);
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
}, m = (n) => {
|
|
1675
|
-
n.preventDefault();
|
|
1676
|
-
const o = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1677
|
-
d(o, n.target, n);
|
|
1678
|
-
}, E = (n) => {
|
|
1679
|
-
const o = n.target;
|
|
1680
|
-
if (z.includes(n.key)) {
|
|
1681
|
-
a.value = o?.selectionStart ?? 0;
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
if (L.includes(n.key)) {
|
|
1685
|
-
if (n.altKey) return;
|
|
1686
|
-
a.value = o?.selectionStart ?? 0;
|
|
1687
|
-
}
|
|
1688
|
-
}, F = (n) => {
|
|
1689
|
-
k.value = !0, p.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && M.value.length === 0 && (e.externalValue.value = "");
|
|
1690
|
-
const o = n.target;
|
|
1691
|
-
o && (a.value = o.selectionStart ?? 0);
|
|
1692
|
-
}, D = (n) => {
|
|
1693
|
-
const o = () => {
|
|
1694
|
-
const S = document.getElementById(
|
|
1695
|
-
e.id
|
|
1696
|
-
);
|
|
1697
|
-
if (!S) return;
|
|
1698
|
-
const u = n?.pos ?? a.value ?? S.value.length;
|
|
1699
|
-
try {
|
|
1700
|
-
S.focus(), S.setSelectionRange(u, u);
|
|
1701
|
-
} catch {
|
|
1702
|
-
}
|
|
1703
|
-
};
|
|
1704
|
-
j(() => {
|
|
1705
|
-
if (n?.delay && n.delay > 0) {
|
|
1706
|
-
setTimeout(o, n.delay);
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
if (n?.useRAF) {
|
|
1710
|
-
requestAnimationFrame(o);
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
o();
|
|
1714
|
-
});
|
|
1715
|
-
};
|
|
1716
|
-
e.externalValue && ae(
|
|
1717
|
-
e.externalValue,
|
|
1718
|
-
(n) => {
|
|
1719
|
-
if (n) {
|
|
1720
|
-
const o = new Date(n);
|
|
1721
|
-
if (o.toString() !== "Invalid Date") {
|
|
1722
|
-
const S = (o.getMonth() + 1).toString().padStart(2, "0"), u = o.getDate().toString().padStart(2, "0"), h = o.getFullYear().toString();
|
|
1723
|
-
t.value = `${S}/${u}/${h}`, D({ delay: 50 });
|
|
1724
|
-
return;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
},
|
|
1728
|
-
{ immediate: !0 }
|
|
1729
|
-
);
|
|
1730
|
-
const P = y(() => [
|
|
1731
|
-
["Date", `${x.value} / ${A.value} / ${V.value}`],
|
|
1732
|
-
["Digits only", M.value],
|
|
1733
|
-
[
|
|
1734
|
-
"min",
|
|
1735
|
-
e.min?.toLocaleDateString("en-US", {
|
|
1736
|
-
year: "numeric",
|
|
1737
|
-
month: "2-digit",
|
|
1738
|
-
day: "2-digit"
|
|
1739
|
-
}) ?? null
|
|
1740
|
-
],
|
|
1741
|
-
[
|
|
1742
|
-
"max",
|
|
1743
|
-
e.max?.toLocaleDateString("en-US", {
|
|
1744
|
-
year: "numeric",
|
|
1745
|
-
month: "2-digit",
|
|
1746
|
-
day: "2-digit"
|
|
1747
|
-
}) ?? null
|
|
1748
|
-
]
|
|
1749
|
-
]), K = y(() => {
|
|
1750
|
-
if (!p.value) {
|
|
1751
|
-
if (!R.value) return !0;
|
|
1752
|
-
const o = g.value;
|
|
1753
|
-
return o ? c(o) : !1;
|
|
1754
|
-
}
|
|
1755
|
-
if (!k.value) return !0;
|
|
1756
|
-
const n = g.value;
|
|
1757
|
-
return !R.value || !n ? !1 : c(n);
|
|
1758
|
-
}), Z = y(() => {
|
|
1759
|
-
if (!p.value) {
|
|
1760
|
-
if (!R.value) return;
|
|
1761
|
-
const o = g.value;
|
|
1762
|
-
return o ? c(o) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
1763
|
-
}
|
|
1764
|
-
if (!k.value) return;
|
|
1765
|
-
if (M.value.length === 0 || !R.value)
|
|
1766
|
-
return "incomplete";
|
|
1767
|
-
const n = g.value;
|
|
1768
|
-
return n ? c(n) ? "valid" : "out-of-bounds" : "invalid-date";
|
|
1769
|
-
}), ne = y(() => {
|
|
1770
|
-
const n = Z.value;
|
|
1771
|
-
if (!n || n === "valid") return "";
|
|
1772
|
-
if (n === "incomplete")
|
|
1773
|
-
return "Required";
|
|
1774
|
-
if (n === "invalid-date")
|
|
1775
|
-
return `Must be in ${l.value} format.`;
|
|
1776
|
-
const o = e.min ? e.min.toLocaleDateString("en-US", {
|
|
1777
|
-
year: "numeric",
|
|
1778
|
-
month: "2-digit",
|
|
1779
|
-
day: "2-digit"
|
|
1780
|
-
}) : null, S = e.max ? e.max.toLocaleDateString("en-US", {
|
|
1781
|
-
year: "numeric",
|
|
1782
|
-
month: "2-digit",
|
|
1783
|
-
day: "2-digit"
|
|
1784
|
-
}) : null;
|
|
1785
|
-
if (n === "out-of-bounds") {
|
|
1786
|
-
if (o && S) return `Must be between ${o} and ${S}.`;
|
|
1787
|
-
if (o) return `Must be on or after ${o}.`;
|
|
1788
|
-
if (S) return `Must be on or before ${S}.`;
|
|
1789
|
-
}
|
|
1790
|
-
return "";
|
|
1791
|
-
}), se = () => {
|
|
1792
|
-
j(() => {
|
|
1793
|
-
const n = document.getElementById(
|
|
1794
|
-
e.id
|
|
1795
|
-
);
|
|
1796
|
-
if (!n) {
|
|
1797
|
-
console.warn(`ID (#${e.id}) not found for styling.`);
|
|
1798
|
-
return;
|
|
1799
|
-
}
|
|
1800
|
-
const o = n.closest(".k-datepicker");
|
|
1801
|
-
if (!o) {
|
|
1802
|
-
console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
|
|
1803
|
-
return;
|
|
1804
|
-
}
|
|
1805
|
-
const S = o.parentElement;
|
|
1806
|
-
if (S) {
|
|
1807
|
-
if (S.classList.contains("fk-datepicker"))
|
|
1808
|
-
return;
|
|
1809
|
-
S.classList.add("fk-datepicker");
|
|
1810
|
-
} else
|
|
1811
|
-
console.warn(
|
|
1812
|
-
`Parent of .k-datepicker not found for #${e.id} styling.`
|
|
1813
|
-
);
|
|
1814
|
-
});
|
|
1815
|
-
};
|
|
1816
|
-
return Le(() => {
|
|
1817
|
-
se();
|
|
1818
|
-
}), {
|
|
1819
|
-
raw: t,
|
|
1820
|
-
cursorPos: a,
|
|
1821
|
-
debugEnabled: f,
|
|
1822
|
-
debugLines: P,
|
|
1823
|
-
placeholder: l,
|
|
1824
|
-
isValid: K,
|
|
1825
|
-
reason: te(Z),
|
|
1826
|
-
validationMessage: ne,
|
|
1827
|
-
digitsOnly: M,
|
|
1828
|
-
month: te(x),
|
|
1829
|
-
day: te(A),
|
|
1830
|
-
year: te(V),
|
|
1831
|
-
datePart: C,
|
|
1832
|
-
handleChange: B,
|
|
1833
|
-
handleKeyDown: I,
|
|
1834
|
-
handleWheel: m,
|
|
1835
|
-
handleKeyUp: E,
|
|
1836
|
-
handleClick: _,
|
|
1837
|
-
handleBlur: F,
|
|
1838
|
-
// Expose so consumers can re-run styling when needed
|
|
1839
|
-
initStyling: se
|
|
1840
|
-
};
|
|
1841
|
-
}
|
|
1842
|
-
function qt(e) {
|
|
1843
|
-
const t = Y(""), a = Y(void 0), f = Y(!!e.debug), l = Y(!1), p = 1440 * 60 * 1e3, b = 365 * p, k = /* @__PURE__ */ new Date(), L = new Date(k.getTime() - b), z = new Date(k.getTime() + b);
|
|
1844
|
-
e.min = e.min ?? L, e.max = e.max ?? z;
|
|
1845
|
-
const M = y(() => (t.value ?? "").replace(/\D/g, "")), C = (i, w) => new Date(i, w, 0).getDate(), x = (i, w, O) => w >= 1 && w <= 12 && i >= 1e3 && O >= 1 && O <= C(i, w), A = (i) => Date.UTC(i.getFullYear(), i.getMonth(), i.getDate()), V = (i) => {
|
|
1846
|
-
if (!i) return null;
|
|
1847
|
-
const w = e.min ?? new Date(Date.now() - 90 * p), O = e.max ?? /* @__PURE__ */ new Date(), H = A(i);
|
|
1848
|
-
return H < A(w) || H > A(O) ? null : i;
|
|
1849
|
-
}, v = (i, w) => e.allowReverse ?? !1 ? !0 : i <= w, c = y(() => (t.value?.length ?? 0) >= 23 && M.value.length >= 16), g = (i) => {
|
|
1850
|
-
if ((i ?? "").length < 23 || M.value.length < 16)
|
|
1851
|
-
return { start: null, end: null };
|
|
1852
|
-
const w = i.substring(0, 10), O = i.substring(13, 23), [H, oe, le] = w.split("/").map((pe) => parseInt(pe || "0", 10)), [fe, me, he] = O.split("/").map((pe) => parseInt(pe || "0", 10)), ge = new Date(le, H - 1, oe), be = new Date(he, fe - 1, me), Ee = x(le, H, oe) && ge.toString() !== "Invalid Date", De = x(he, fe, me) && be.toString() !== "Invalid Date";
|
|
1853
|
-
return { start: Ee ? ge : null, end: De ? be : null };
|
|
1854
|
-
}, R = e.externalValid ?? Y(!0), q = y(() => g(t.value)), X = y(() => {
|
|
1855
|
-
const i = V(q.value.start), w = V(q.value.end);
|
|
1856
|
-
return { start: i, end: w };
|
|
1857
|
-
}), W = y(() => {
|
|
1858
|
-
if (!c.value) return;
|
|
1859
|
-
const i = X.value.start, w = X.value.end;
|
|
1860
|
-
if (!i || !w) return;
|
|
1861
|
-
const O = Math.abs(A(w) - A(i));
|
|
1862
|
-
return Math.round(O / 864e5 + 1);
|
|
1863
|
-
}), B = Y(!1), _ = y(() => {
|
|
1864
|
-
if (!B.value) return;
|
|
1865
|
-
const { start: i, end: w } = q.value;
|
|
1866
|
-
if (!c.value) return "incomplete";
|
|
1867
|
-
if (!i || !w) return "invalid-date";
|
|
1868
|
-
if (!X.value.start || !X.value.end) return "out-of-bounds";
|
|
1869
|
-
const O = X.value.start, H = X.value.end;
|
|
1870
|
-
return v(O, H) ? typeof e.maxSpanDays == "number" && W.value !== void 0 && W.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
|
|
1871
|
-
}), d = y(() => {
|
|
1872
|
-
const i = _.value;
|
|
1873
|
-
return i === void 0 || i === "valid";
|
|
1874
|
-
}), I = y(() => {
|
|
1875
|
-
const { min: i, max: w } = e, O = _.value;
|
|
1876
|
-
if (!O) return "";
|
|
1877
|
-
switch (O) {
|
|
1878
|
-
case "incomplete":
|
|
1879
|
-
return "Required";
|
|
1880
|
-
case "invalid-date":
|
|
1881
|
-
return "One or both dates invalid.";
|
|
1882
|
-
case "reversed-range":
|
|
1883
|
-
return "End Date must be on or after Start Date.";
|
|
1884
|
-
case "out-of-bounds":
|
|
1885
|
-
return i && w ? `Dates must be between ${D(i)} and ${D(w)}.` : "Dates must be within the allowed range.";
|
|
1886
|
-
case "span-exceeds-limit":
|
|
1887
|
-
return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
|
|
1888
|
-
default:
|
|
1889
|
-
return "";
|
|
1890
|
-
}
|
|
1891
|
-
}), m = ["ArrowUp", "ArrowDown"], E = ["ArrowLeft", "ArrowRight"], F = (i, w) => String(i).padStart(w, "0"), D = (i) => `${F(i.getMonth() + 1, 2)}/${F(i.getDate(), 2)}/${F(
|
|
1892
|
-
i.getFullYear(),
|
|
1893
|
-
4
|
|
1894
|
-
)}`, P = (i) => i <= 2 ? { side: "start", part: "mm" } : i <= 5 ? { side: "start", part: (i <= 3, "dd") } : i <= 11 ? { side: "start", part: "yyyy" } : i <= 15 ? { side: "end", part: "mm" } : i <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, K = (i, w, O) => {
|
|
1895
|
-
const H = w?.selectionStart ?? a.value ?? 0;
|
|
1896
|
-
a.value = H;
|
|
1897
|
-
const { start: oe, end: le } = g(t.value);
|
|
1898
|
-
if (!oe && !le) {
|
|
1899
|
-
const ee = /* @__PURE__ */ new Date(), de = D(ee);
|
|
1900
|
-
t.value = `${de} - ${de}`, e.onChange({ value: { start: ee, end: ee }, event: O }), j(() => {
|
|
1901
|
-
requestAnimationFrame(() => {
|
|
1902
|
-
const ie = document.getElementById(
|
|
1903
|
-
e.id
|
|
1904
|
-
), ue = a.value ?? 0;
|
|
1905
|
-
ie && (ie.focus(), ie.setSelectionRange(ue, ue));
|
|
1906
|
-
});
|
|
1907
|
-
});
|
|
1908
|
-
return;
|
|
1909
|
-
}
|
|
1910
|
-
const fe = /* @__PURE__ */ new Date(), me = P(H);
|
|
1911
|
-
let he = oe ? new Date(oe) : new Date(fe), ge = le ? new Date(le) : new Date(fe);
|
|
1912
|
-
const be = (ee, de) => {
|
|
1913
|
-
if (de === "mm") {
|
|
1914
|
-
const ie = ee.getMonth() + 1, ue = i === "ArrowUp" ? ie < 12 ? ie + 1 : 1 : ie > 1 ? ie - 1 : 12;
|
|
1915
|
-
ee.setMonth(ue - 1);
|
|
1916
|
-
const ke = C(ee.getFullYear(), ue);
|
|
1917
|
-
ee.getDate() > ke && ee.setDate(ke);
|
|
1918
|
-
} else if (de === "dd") {
|
|
1919
|
-
const ie = C(ee.getFullYear(), ee.getMonth() + 1), ue = ee.getDate(), ke = i === "ArrowUp" ? ue < ie ? ue + 1 : 1 : ue > 1 ? ue - 1 : ie;
|
|
1920
|
-
ee.setDate(ke);
|
|
1921
|
-
} else if (de === "yyyy") {
|
|
1922
|
-
const ie = ee.getFullYear();
|
|
1923
|
-
ee.setFullYear(i === "ArrowUp" ? ie + 1 : Math.max(1, ie - 1));
|
|
1924
|
-
const ue = C(ee.getFullYear(), ee.getMonth() + 1);
|
|
1925
|
-
ee.getDate() > ue && ee.setDate(ue);
|
|
1926
|
-
}
|
|
1927
|
-
};
|
|
1928
|
-
me.side === "start" ? be(he, me.part) : be(ge, me.part);
|
|
1929
|
-
const Ee = D(he), De = D(ge);
|
|
1930
|
-
t.value = `${Ee} - ${De}`;
|
|
1931
|
-
const pe = V(he), xe = V(ge);
|
|
1932
|
-
pe && xe && v(pe, xe) ? e.onChange({ value: { start: pe, end: xe }, event: O }) : e.onChange({ value: null, event: O }), j(() => {
|
|
1933
|
-
requestAnimationFrame(() => {
|
|
1934
|
-
const ee = document.getElementById(
|
|
1935
|
-
e.id
|
|
1936
|
-
), de = a.value ?? 0;
|
|
1937
|
-
ee && (ee.focus(), ee.setSelectionRange(de, de));
|
|
1938
|
-
});
|
|
1939
|
-
});
|
|
1940
|
-
}, Z = (i) => {
|
|
1941
|
-
const { start: w, end: O } = g(t.value);
|
|
1942
|
-
if (!w || !O) {
|
|
1943
|
-
e.onChange({ value: null, event: i });
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
|
-
const H = V(w), oe = V(O);
|
|
1947
|
-
if (!H || !oe) {
|
|
1948
|
-
e.onChange({ value: null, event: i });
|
|
1949
|
-
return;
|
|
1950
|
-
}
|
|
1951
|
-
if (!v(H, oe)) {
|
|
1952
|
-
e.onChange({ value: null, event: i });
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
e.onChange({ value: { start: H, end: oe }, event: i });
|
|
1956
|
-
}, ne = (i) => {
|
|
1957
|
-
const w = i.value ?? "", O = i.event;
|
|
1958
|
-
if (!w && O && O.type === "click") {
|
|
1959
|
-
$(O);
|
|
1960
|
-
return;
|
|
1961
|
-
}
|
|
1962
|
-
t.value = w;
|
|
1963
|
-
const H = O?.target;
|
|
1964
|
-
a.value = H?.selectionStart ?? 0, Z(i);
|
|
1965
|
-
}, se = (i) => {
|
|
1966
|
-
a.value = i.target.selectionStart ?? 0;
|
|
1967
|
-
}, n = (i) => {
|
|
1968
|
-
if (i.code === "Space" || i.key === " ") {
|
|
1969
|
-
i.preventDefault(), i.stopPropagation(), e.onShowCalendar(i);
|
|
1970
|
-
return;
|
|
1971
|
-
}
|
|
1972
|
-
if (i.key === "ArrowDown" && i.altKey) {
|
|
1973
|
-
i.preventDefault(), i.stopPropagation(), e.onShowCalendar(i);
|
|
1974
|
-
return;
|
|
1975
|
-
}
|
|
1976
|
-
if (m.includes(i.key)) {
|
|
1977
|
-
i.preventDefault(), i.stopPropagation();
|
|
1978
|
-
const w = i.target;
|
|
1979
|
-
K(i.key, w, i);
|
|
1980
|
-
return;
|
|
1981
|
-
}
|
|
1982
|
-
}, o = (i) => {
|
|
1983
|
-
i.preventDefault();
|
|
1984
|
-
const w = i.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
1985
|
-
K(w, i.target, i);
|
|
1986
|
-
}, S = (i) => {
|
|
1987
|
-
if (E.includes(i.key) || m.includes(i.key)) {
|
|
1988
|
-
const w = i.target;
|
|
1989
|
-
a.value = w?.selectionStart ?? 0;
|
|
1990
|
-
}
|
|
1991
|
-
}, u = () => {
|
|
1992
|
-
B.value = !0, (e.manageValid ?? !0) && (R.value = d.value);
|
|
1993
|
-
}, h = (i) => {
|
|
1994
|
-
u();
|
|
1995
|
-
}, $ = (i) => {
|
|
1996
|
-
t.value = "", a.value = 0, e.onChange({ value: null, event: i }), u(), j(() => {
|
|
1997
|
-
const w = document.getElementById(
|
|
1998
|
-
e.id
|
|
1999
|
-
);
|
|
2000
|
-
w && (w.focus(), w.setSelectionRange(0, 0));
|
|
2001
|
-
});
|
|
2002
|
-
};
|
|
2003
|
-
e.externalValue && ae(
|
|
2004
|
-
e.externalValue,
|
|
2005
|
-
(i) => {
|
|
2006
|
-
const w = i?.start ?? null, O = i?.end ?? null;
|
|
2007
|
-
if (w && O) {
|
|
2008
|
-
if (t.value = `${D(w)} - ${D(O)}`, e.isOpen?.value && l.value && e.onRequestClose) {
|
|
2009
|
-
const H = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
|
|
2010
|
-
setTimeout(() => {
|
|
2011
|
-
e.onRequestClose?.(), l.value = !1, u();
|
|
2012
|
-
}, H);
|
|
2013
|
-
}
|
|
2014
|
-
return;
|
|
2015
|
-
}
|
|
2016
|
-
},
|
|
2017
|
-
{ immediate: !0 }
|
|
2018
|
-
);
|
|
2019
|
-
const r = y(
|
|
2020
|
-
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
2021
|
-
), s = y(
|
|
2022
|
-
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
2023
|
-
), T = y(
|
|
2024
|
-
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
2025
|
-
), N = y(
|
|
2026
|
-
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
2027
|
-
), U = y(
|
|
2028
|
-
() => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
|
|
2029
|
-
), Q = y(
|
|
2030
|
-
() => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
|
|
2031
|
-
), G = y(() => {
|
|
2032
|
-
const { start: i, end: w } = g(t.value);
|
|
2033
|
-
return [
|
|
2034
|
-
{
|
|
2035
|
-
label: "Raw",
|
|
2036
|
-
value: t.value
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
label: "Min Date",
|
|
2040
|
-
value: `${e.min ? e.min.toDateString() : "-"}`
|
|
2041
|
-
},
|
|
2042
|
-
{
|
|
2043
|
-
label: "Max Date",
|
|
2044
|
-
value: `${e.max ? e.max.toDateString() : "-"}`
|
|
2045
|
-
},
|
|
2046
|
-
{
|
|
2047
|
-
label: "Start",
|
|
2048
|
-
value: `${String(r.value).padStart(2, "0")} / ${String(
|
|
2049
|
-
s.value
|
|
2050
|
-
).padStart(2, "0")} / ${String(T.value).padStart(4, "0")}`
|
|
2051
|
-
},
|
|
2052
|
-
{
|
|
2053
|
-
label: "End",
|
|
2054
|
-
value: `${String(N.value).padStart(2, "0")} / ${String(
|
|
2055
|
-
U.value
|
|
2056
|
-
).padStart(2, "0")} / ${String(Q.value).padStart(4, "0")}`
|
|
2057
|
-
},
|
|
2058
|
-
{ label: "Digits only", value: M.value },
|
|
2059
|
-
{ label: "Mask complete", value: `${c.value}` },
|
|
2060
|
-
{
|
|
2061
|
-
label: "Parsed",
|
|
2062
|
-
value: `${i ? i.toDateString() : "-"} | ${w ? w.toDateString() : "-"}`
|
|
2063
|
-
},
|
|
2064
|
-
{
|
|
2065
|
-
label: "Valid (managed)",
|
|
2066
|
-
value: `${R.value ?? "-"}`
|
|
2067
|
-
},
|
|
2068
|
-
{ label: "Span (days)", value: `${W.value ?? "-"}` },
|
|
2069
|
-
{
|
|
2070
|
-
label: "Reason",
|
|
2071
|
-
value: `${_.value ?? "-"}`
|
|
2072
|
-
},
|
|
2073
|
-
{
|
|
2074
|
-
label: "Cursor in",
|
|
2075
|
-
value: `${a.value ?? "-"} (${(() => {
|
|
2076
|
-
const O = a.value ?? 0, H = P(O);
|
|
2077
|
-
return `${H.side}.${H.part}`;
|
|
2078
|
-
})()})`
|
|
2079
|
-
}
|
|
2080
|
-
];
|
|
2081
|
-
}), J = () => {
|
|
2082
|
-
j(() => {
|
|
2083
|
-
const i = document.getElementById(e.id);
|
|
2084
|
-
if (!i) {
|
|
2085
|
-
console.warn(`#${e.id} not found for styling.`);
|
|
2086
|
-
return;
|
|
2087
|
-
}
|
|
2088
|
-
const w = i.closest("div");
|
|
2089
|
-
if (!w) {
|
|
2090
|
-
console.warn(`Parent div of #${e.id} not found for styling.`);
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
w.classList.contains("fk-daterangepicker") || w.classList.add("fk-daterangepicker");
|
|
2094
|
-
});
|
|
2095
|
-
};
|
|
2096
|
-
Le(() => {
|
|
2097
|
-
J();
|
|
2098
|
-
});
|
|
2099
|
-
const ce = () => {
|
|
2100
|
-
j(() => {
|
|
2101
|
-
try {
|
|
2102
|
-
const i = Array.from(
|
|
2103
|
-
document.querySelectorAll(".k-animation-container")
|
|
2104
|
-
);
|
|
2105
|
-
if (!i.length) return;
|
|
2106
|
-
const O = [...i].reverse().find((le) => le.querySelector(".k-calendar"))?.querySelector(
|
|
2107
|
-
".k-calendar"
|
|
2108
|
-
);
|
|
2109
|
-
if (!O) return;
|
|
2110
|
-
const H = O.querySelectorAll(
|
|
2111
|
-
".k-calendar-table"
|
|
2112
|
-
);
|
|
2113
|
-
let oe = !1;
|
|
2114
|
-
H.forEach((le) => {
|
|
2115
|
-
le.tabIndex === 0 && (oe ? le.tabIndex = -1 : oe = !0);
|
|
2116
|
-
});
|
|
2117
|
-
} catch (i) {
|
|
2118
|
-
console.warn(i);
|
|
2119
|
-
}
|
|
2120
|
-
});
|
|
2121
|
-
};
|
|
2122
|
-
return e.isOpen && ae(
|
|
2123
|
-
e.isOpen,
|
|
2124
|
-
(i) => {
|
|
2125
|
-
i && setTimeout(() => ce(), 0);
|
|
2126
|
-
},
|
|
2127
|
-
{ immediate: !1 }
|
|
2128
|
-
), {
|
|
2129
|
-
raw: t,
|
|
2130
|
-
cursorPos: a,
|
|
2131
|
-
debugEnabled: f,
|
|
2132
|
-
debugLines: G,
|
|
2133
|
-
digitsOnly: M,
|
|
2134
|
-
valid: R,
|
|
2135
|
-
validComputed: te(d),
|
|
2136
|
-
reason: te(_),
|
|
2137
|
-
validationMessage: te(I),
|
|
2138
|
-
spanDays: te(W),
|
|
2139
|
-
month1: te(r),
|
|
2140
|
-
day1: te(s),
|
|
2141
|
-
year1: te(T),
|
|
2142
|
-
month2: te(N),
|
|
2143
|
-
day2: te(U),
|
|
2144
|
-
year2: te(Q),
|
|
2145
|
-
handleChange: ne,
|
|
2146
|
-
handleKeyDown: n,
|
|
2147
|
-
handleWheel: o,
|
|
2148
|
-
handleKeyUp: S,
|
|
2149
|
-
handleClick: se,
|
|
2150
|
-
handleBlur: h,
|
|
2151
|
-
handleClear: $,
|
|
2152
|
-
onCalendarChange: () => {
|
|
2153
|
-
l.value = !0;
|
|
2154
|
-
},
|
|
2155
|
-
initStyling: J
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
|
-
function Kt(e) {
|
|
2159
|
-
const t = Y(""), a = Y(void 0), f = Y(!!e.debug), l = Y(e.timeFormat ?? "hh:mm AM"), p = y(() => !!e.required), b = Y(!1), k = ["ArrowUp", "ArrowDown"], L = ["ArrowLeft", "ArrowRight"], z = y(() => (t.value ?? "").replace(/\D/g, "")), M = {
|
|
2160
|
-
H: /[0-9]/,
|
|
2161
|
-
h: /[0-9]/,
|
|
2162
|
-
M: /[0-9]/,
|
|
2163
|
-
m: /[0-9]/,
|
|
2164
|
-
A: /[AaPp]/,
|
|
2165
|
-
a: /[Mm]/
|
|
2166
|
-
}, C = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm", x = y(() => {
|
|
2167
|
-
const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", s = parseInt(r);
|
|
2168
|
-
return Math.min(Math.max(s, 0), 23);
|
|
2169
|
-
}), A = y(() => {
|
|
2170
|
-
const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", s = parseInt(r);
|
|
2171
|
-
return Math.min(Math.max(s, 0), 59);
|
|
2172
|
-
}), V = y(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), v = y(() => {
|
|
2173
|
-
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), s = V.value;
|
|
2174
|
-
return r === 12 ? s === "AM" ? 0 : 12 : s === "PM" ? r + 12 : r;
|
|
2175
|
-
}), c = y(() => g.value ? `${String(v.value).padStart(2, "0")}:${String(A.value).padStart(2, "0")}:00` : null), g = y(
|
|
2176
|
-
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
2177
|
-
), R = (r, s, T) => {
|
|
2178
|
-
let N = r % 12;
|
|
2179
|
-
return N === 0 && (N = 12), `${String(N).padStart(2, "0")}:${String(s).padStart(
|
|
2180
|
-
2,
|
|
2181
|
-
"0"
|
|
2182
|
-
)} ${T}`;
|
|
2183
|
-
}, q = (r) => {
|
|
2184
|
-
const s = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
2185
|
-
if (!s) return null;
|
|
2186
|
-
const T = parseInt(s[1]), N = parseInt(s[2]), U = s[3].toUpperCase();
|
|
2187
|
-
if (T < 1 || T > 12 || N < 0 || N > 59) return null;
|
|
2188
|
-
let Q = T % 12;
|
|
2189
|
-
U === "PM" && (Q += 12);
|
|
2190
|
-
const G = /* @__PURE__ */ new Date();
|
|
2191
|
-
return G.setSeconds(0, 0), G.setHours(Q), G.setMinutes(N), G;
|
|
2192
|
-
}, X = (r) => {
|
|
2193
|
-
if (z.value.length === 0) {
|
|
2194
|
-
e.onChange({ value: null, event: r });
|
|
2195
|
-
return;
|
|
2196
|
-
}
|
|
2197
|
-
if (!g.value) {
|
|
2198
|
-
e.onChange({ value: null, event: r });
|
|
2199
|
-
return;
|
|
2200
|
-
}
|
|
2201
|
-
const s = q(t.value);
|
|
2202
|
-
s && B(s) ? e.onChange({ value: s, event: r }) : e.onChange({ value: null, event: r });
|
|
2203
|
-
}, W = (r) => r.getHours() * 60 + r.getMinutes(), B = (r) => {
|
|
2204
|
-
const s = e.min ?? void 0, T = e.max ?? void 0, N = W(r);
|
|
2205
|
-
if (s) {
|
|
2206
|
-
const U = W(s);
|
|
2207
|
-
if (N < U) return !1;
|
|
2208
|
-
}
|
|
2209
|
-
if (T) {
|
|
2210
|
-
const U = W(T);
|
|
2211
|
-
if (N > U) return !1;
|
|
2212
|
-
}
|
|
2213
|
-
return !0;
|
|
2214
|
-
}, _ = (r) => {
|
|
2215
|
-
const s = r.getHours(), T = s >= 12 ? "PM" : "AM";
|
|
2216
|
-
t.value = R(s, r.getMinutes(), T);
|
|
2217
|
-
}, d = (r, s) => {
|
|
2218
|
-
e.onChange({ value: r, event: s });
|
|
2219
|
-
}, I = () => {
|
|
2220
|
-
j(() => {
|
|
2221
|
-
requestAnimationFrame(() => {
|
|
2222
|
-
requestAnimationFrame(() => {
|
|
2223
|
-
const r = document.getElementById(
|
|
2224
|
-
e.id
|
|
2225
|
-
);
|
|
2226
|
-
if (r) {
|
|
2227
|
-
r.focus();
|
|
2228
|
-
const s = (r.value ?? "").length;
|
|
2229
|
-
r.setSelectionRange(s, s);
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
});
|
|
2233
|
-
});
|
|
2234
|
-
}, m = (r) => {
|
|
2235
|
-
const s = r?.event?.target;
|
|
2236
|
-
return s ? s.closest(".k-time-now") ? "now" : s.closest(".k-time-accept") ? "set" : null : null;
|
|
2237
|
-
}, E = (r, s) => {
|
|
2238
|
-
r && B(r) ? d(r, s) : d(null, s);
|
|
2239
|
-
}, F = (...r) => {
|
|
2240
|
-
const s = r[0];
|
|
2241
|
-
if (!s) return;
|
|
2242
|
-
const T = m(s);
|
|
2243
|
-
if (T === "now") {
|
|
2244
|
-
const U = /* @__PURE__ */ new Date();
|
|
2245
|
-
_(U), E(U, s), I();
|
|
2246
|
-
return;
|
|
2247
|
-
}
|
|
2248
|
-
if (s?.value instanceof Date) {
|
|
2249
|
-
const U = new Date(s.value);
|
|
2250
|
-
_(U), E(U, s), T === "set" && I();
|
|
2251
|
-
return;
|
|
2252
|
-
}
|
|
2253
|
-
if (s?.value === null) {
|
|
2254
|
-
t.value = "", d(null, s);
|
|
2255
|
-
return;
|
|
2256
|
-
}
|
|
2257
|
-
t.value = s.value;
|
|
2258
|
-
const N = s.event?.target;
|
|
2259
|
-
a.value = N?.selectionStart ?? 0;
|
|
2260
|
-
try {
|
|
2261
|
-
const U = a.value ?? 0;
|
|
2262
|
-
if (C(U) === "ampm" && (t.value ?? "").length >= 8) {
|
|
2263
|
-
const Q = t.value.charAt(6);
|
|
2264
|
-
/[Aa]/.test(Q) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, j(() => {
|
|
2265
|
-
requestAnimationFrame(() => {
|
|
2266
|
-
const G = document.getElementById(
|
|
2267
|
-
e.id
|
|
2268
|
-
);
|
|
2269
|
-
G && (G.focus(), G.setSelectionRange(8, 8));
|
|
2270
|
-
});
|
|
2271
|
-
})) : /[Pp]/.test(Q) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, j(() => {
|
|
2272
|
-
requestAnimationFrame(() => {
|
|
2273
|
-
const G = document.getElementById(
|
|
2274
|
-
e.id
|
|
2275
|
-
);
|
|
2276
|
-
G && (G.focus(), G.setSelectionRange(8, 8));
|
|
2277
|
-
});
|
|
2278
|
-
}));
|
|
2279
|
-
}
|
|
2280
|
-
} catch {
|
|
2281
|
-
}
|
|
2282
|
-
X(s);
|
|
2283
|
-
}, D = (r) => {
|
|
2284
|
-
a.value = r.target.selectionStart ?? 0;
|
|
2285
|
-
}, P = (r, s, T) => {
|
|
2286
|
-
const N = s?.selectionStart ?? a.value ?? 0;
|
|
2287
|
-
a.value = N;
|
|
2288
|
-
const U = C(N), Q = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
2289
|
-
if (!Q) {
|
|
2290
|
-
if ((t.value ?? "").length === 0 || z.value.length === 0) {
|
|
2291
|
-
const w = /* @__PURE__ */ new Date(), O = w.getHours(), H = O >= 12 ? "PM" : "AM";
|
|
2292
|
-
t.value = R(O, w.getMinutes(), H);
|
|
2293
|
-
const oe = q(t.value);
|
|
2294
|
-
E(oe, T), j(() => {
|
|
2295
|
-
requestAnimationFrame(() => {
|
|
2296
|
-
const le = document.getElementById(
|
|
2297
|
-
e.id
|
|
2298
|
-
), fe = a.value ?? 0;
|
|
2299
|
-
le && (le.focus(), le.setSelectionRange(fe, fe));
|
|
2300
|
-
});
|
|
2301
|
-
});
|
|
2302
|
-
}
|
|
2303
|
-
return;
|
|
2304
|
-
}
|
|
2305
|
-
let G = parseInt(Q[1]), J = parseInt(Q[2]), ce = Q[3].toUpperCase();
|
|
2306
|
-
if (U === "hh")
|
|
2307
|
-
r === "ArrowUp" ? G = G < 12 ? G + 1 : 1 : G = G > 1 ? G - 1 : 12;
|
|
2308
|
-
else if (U === "mm") {
|
|
2309
|
-
const w = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
|
|
2310
|
-
if (w === 1)
|
|
2311
|
-
r === "ArrowUp" ? J = J < 59 ? J + 1 : 0 : J = J > 0 ? J - 1 : 59;
|
|
2312
|
-
else if (r === "ArrowUp") {
|
|
2313
|
-
const O = J % w;
|
|
2314
|
-
let H = O === 0 ? J + w : J + (w - O);
|
|
2315
|
-
H >= 60 && (H = 0), J = H;
|
|
2316
|
-
} else {
|
|
2317
|
-
const O = J % w;
|
|
2318
|
-
let H = O === 0 ? J - w : J - O;
|
|
2319
|
-
H < 0 && (H = 60 - w), J = H;
|
|
2320
|
-
}
|
|
2321
|
-
} else U === "ampm" && (ce = ce === "AM" ? "PM" : "AM");
|
|
2322
|
-
t.value = `${String(G).padStart(2, "0")}:${String(J).padStart(
|
|
2323
|
-
2,
|
|
2324
|
-
"0"
|
|
2325
|
-
)} ${ce}`;
|
|
2326
|
-
const i = q(t.value);
|
|
2327
|
-
E(i, T), j(() => {
|
|
2328
|
-
requestAnimationFrame(() => {
|
|
2329
|
-
const w = document.getElementById(
|
|
2330
|
-
e.id
|
|
2331
|
-
), O = a.value ?? 0;
|
|
2332
|
-
w && (w.focus(), w.setSelectionRange(O, O));
|
|
2333
|
-
});
|
|
2334
|
-
});
|
|
2335
|
-
}, K = (r) => {
|
|
2336
|
-
if (r.code === "Space" || r.key === " ") {
|
|
2337
|
-
r.preventDefault(), r.stopPropagation(), e.onShowPicker(r);
|
|
2338
|
-
return;
|
|
2339
|
-
}
|
|
2340
|
-
if (r.key === "ArrowDown" && r.altKey) {
|
|
2341
|
-
r.preventDefault(), r.stopPropagation(), e.onShowPicker(r);
|
|
2342
|
-
return;
|
|
2343
|
-
}
|
|
2344
|
-
if (k.includes(r.key)) {
|
|
2345
|
-
if (r.altKey) return;
|
|
2346
|
-
r.preventDefault(), r.stopPropagation();
|
|
2347
|
-
const s = r.target;
|
|
2348
|
-
P(r.key, s, r);
|
|
2349
|
-
return;
|
|
2350
|
-
}
|
|
2351
|
-
}, Z = (r) => {
|
|
2352
|
-
r.preventDefault();
|
|
2353
|
-
const s = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
|
|
2354
|
-
P(s, r.target, r);
|
|
2355
|
-
}, ne = (r) => {
|
|
2356
|
-
const s = r.target;
|
|
2357
|
-
if (L.includes(r.key)) {
|
|
2358
|
-
a.value = s?.selectionStart ?? 0;
|
|
2359
|
-
return;
|
|
2360
|
-
}
|
|
2361
|
-
if (k.includes(r.key)) {
|
|
2362
|
-
if (r.altKey) return;
|
|
2363
|
-
a.value = s?.selectionStart ?? 0;
|
|
2364
|
-
}
|
|
2365
|
-
}, se = (r) => {
|
|
2366
|
-
b.value = !0, p.value && e.externalValue && e.externalValue.value === void 0 && z.value.length === 0 && (e.externalValue.value = "");
|
|
2367
|
-
const s = r.target;
|
|
2368
|
-
s && (a.value = s.selectionStart ?? 0);
|
|
2369
|
-
};
|
|
2370
|
-
e.externalValue && ae(
|
|
2371
|
-
e.externalValue,
|
|
2372
|
-
(r) => {
|
|
2373
|
-
if (r) {
|
|
2374
|
-
const s = new Date(r);
|
|
2375
|
-
if (s.toString() !== "Invalid Date") {
|
|
2376
|
-
const T = s.getHours(), N = T >= 12 ? "PM" : "AM";
|
|
2377
|
-
t.value = R(T, s.getMinutes(), N);
|
|
2378
|
-
return;
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
},
|
|
2382
|
-
{ immediate: !0 }
|
|
2383
|
-
);
|
|
2384
|
-
const n = y(() => [
|
|
2385
|
-
["Time", t.value || "--:-- --"],
|
|
2386
|
-
["Hour (12h)", x.value],
|
|
2387
|
-
["Hour (24h)", v.value],
|
|
2388
|
-
["Minute", A.value],
|
|
2389
|
-
["Period", V.value],
|
|
2390
|
-
["Time (24h)", c.value ?? "--:--:--"],
|
|
2391
|
-
["Digits only", z.value],
|
|
2392
|
-
[
|
|
2393
|
-
"Parsed Date",
|
|
2394
|
-
o.value?.toLocaleDateString("en-US", {
|
|
2395
|
-
hour: "2-digit",
|
|
2396
|
-
minute: "2-digit"
|
|
2397
|
-
}) ?? null
|
|
2398
|
-
],
|
|
2399
|
-
[
|
|
2400
|
-
"min",
|
|
2401
|
-
e.min?.toLocaleTimeString("en-US", {
|
|
2402
|
-
hour: "2-digit",
|
|
2403
|
-
minute: "2-digit"
|
|
2404
|
-
}) ?? null
|
|
2405
|
-
],
|
|
2406
|
-
[
|
|
2407
|
-
"max",
|
|
2408
|
-
e.max?.toLocaleTimeString("en-US", {
|
|
2409
|
-
hour: "2-digit",
|
|
2410
|
-
minute: "2-digit"
|
|
2411
|
-
}) ?? null
|
|
2412
|
-
],
|
|
2413
|
-
["valid", S.value],
|
|
2414
|
-
["reason", u.value],
|
|
2415
|
-
["validationMessage", h.value]
|
|
2416
|
-
]), o = y(
|
|
2417
|
-
() => q(t.value) ?? null
|
|
2418
|
-
), S = y(() => {
|
|
2419
|
-
if (!p.value) {
|
|
2420
|
-
if (!g.value) return !0;
|
|
2421
|
-
const s = o.value;
|
|
2422
|
-
return s ? B(s) : !1;
|
|
2423
|
-
}
|
|
2424
|
-
if (!b.value) return !0;
|
|
2425
|
-
const r = o.value;
|
|
2426
|
-
return !g.value || !r ? !1 : B(r);
|
|
2427
|
-
}), u = y(() => {
|
|
2428
|
-
if (!p.value) {
|
|
2429
|
-
if (!g.value) return;
|
|
2430
|
-
const s = o.value;
|
|
2431
|
-
return s ? B(s) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
2432
|
-
}
|
|
2433
|
-
if (!b.value) return;
|
|
2434
|
-
if (z.value.length === 0 || !g.value)
|
|
2435
|
-
return "incomplete";
|
|
2436
|
-
const r = o.value;
|
|
2437
|
-
return r ? B(r) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
2438
|
-
}), h = y(() => {
|
|
2439
|
-
const r = u.value;
|
|
2440
|
-
if (!r || r === "valid") return "";
|
|
2441
|
-
if (r === "incomplete")
|
|
2442
|
-
return "Required";
|
|
2443
|
-
if (r === "invalid-time")
|
|
2444
|
-
return `Must be in ${l.value} format.`;
|
|
2445
|
-
const s = {
|
|
2446
|
-
hour: "2-digit",
|
|
2447
|
-
minute: "2-digit"
|
|
2448
|
-
}, T = e.min ? e.min.toLocaleTimeString("en-US", s) : null, N = e.max ? e.max.toLocaleTimeString("en-US", s) : null;
|
|
2449
|
-
if (r === "out-of-bounds") {
|
|
2450
|
-
if (T && N) return `Must be between ${T} and ${N}.`;
|
|
2451
|
-
if (T) return `Must be ${T} or later.`;
|
|
2452
|
-
if (N) return `Must be ${N} or earlier.`;
|
|
2453
|
-
}
|
|
2454
|
-
return "";
|
|
2455
|
-
}), $ = () => {
|
|
2456
|
-
j(() => {
|
|
2457
|
-
const r = document.getElementById(e.id);
|
|
2458
|
-
if (!r) {
|
|
2459
|
-
console.warn(`#${e.id} not found for styling.`);
|
|
2460
|
-
return;
|
|
2461
|
-
}
|
|
2462
|
-
const s = r.closest(".k-timepicker");
|
|
2463
|
-
if (!s) {
|
|
2464
|
-
console.warn(
|
|
2465
|
-
`.k-timepicker parent of #${e.id} not found for styling.`
|
|
2466
|
-
);
|
|
2467
|
-
return;
|
|
2468
|
-
}
|
|
2469
|
-
const T = s.parentElement;
|
|
2470
|
-
if (!T) {
|
|
2471
|
-
console.warn(
|
|
2472
|
-
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
2473
|
-
);
|
|
2474
|
-
return;
|
|
2475
|
-
}
|
|
2476
|
-
T.classList.contains("fk-timepicker") || T.classList.add("fk-timepicker");
|
|
2477
|
-
});
|
|
2478
|
-
};
|
|
2479
|
-
return Le(() => {
|
|
2480
|
-
$();
|
|
2481
|
-
}), {
|
|
2482
|
-
raw: t,
|
|
2483
|
-
rules: M,
|
|
2484
|
-
debugEnabled: f,
|
|
2485
|
-
debugLines: n,
|
|
2486
|
-
placeholder: l,
|
|
2487
|
-
isValid: S,
|
|
2488
|
-
reason: te(u),
|
|
2489
|
-
validationMessage: h,
|
|
2490
|
-
isComplete: g,
|
|
2491
|
-
inRangeTime: B,
|
|
2492
|
-
cursorPos: a,
|
|
2493
|
-
hour: te(x),
|
|
2494
|
-
hour24: te(v),
|
|
2495
|
-
minute: te(A),
|
|
2496
|
-
period: te(V),
|
|
2497
|
-
time24: te(c),
|
|
2498
|
-
parsedRawTime: te(o),
|
|
2499
|
-
handleChange: F,
|
|
2500
|
-
handleKeyDown: K,
|
|
2501
|
-
handleKeyUp: ne,
|
|
2502
|
-
handleClick: D,
|
|
2503
|
-
handleWheel: Z,
|
|
2504
|
-
handleBlur: se,
|
|
2505
|
-
// Expose so consumers can reapply theming when Kendo updates DOM
|
|
2506
|
-
initStyling: $
|
|
2507
|
-
};
|
|
2508
|
-
}
|
|
2509
|
-
const Ut = {
|
|
2510
|
-
outsideClick: !1,
|
|
2511
|
-
returnFocusToTrigger: !1,
|
|
2512
|
-
focusTrapOptions: {
|
|
2513
|
-
returnFocusOnDeactivate: !1
|
|
2514
|
-
}
|
|
2515
|
-
}, Yt = {
|
|
2516
|
-
outsideClick: !1
|
|
2517
|
-
};
|
|
2518
|
-
function Bt(e) {
|
|
2519
|
-
const t = ve(null), a = [
|
|
2520
|
-
".k-animation-container .k-popup",
|
|
2521
|
-
".k-popup",
|
|
2522
|
-
".k-timepicker-popup",
|
|
2523
|
-
".k-menu-popup"
|
|
2524
|
-
], f = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? a].flat(), l = (M) => M ? typeof e.initialFocus == "string" ? M.querySelector(e.initialFocus) ?? M : typeof e.initialFocus == "function" ? e.initialFocus(M) ?? M : M.querySelector(
|
|
2525
|
-
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
2526
|
-
) ?? M : null, { activate: p, deactivate: b } = Ge(t, {
|
|
2527
|
-
escapeDeactivates: !1,
|
|
2528
|
-
clickOutsideDeactivates: !1,
|
|
2529
|
-
// Without this, focus-trap's own default (false) preventDefault()s and
|
|
2530
|
-
// swallows every outside pointerdown/click while active - not just ones
|
|
2531
|
-
// that would close it - blocking interaction with anything else on the
|
|
2532
|
-
// page (e.g. another trigger in the same row) until the trap deactivates.
|
|
2533
|
-
allowOutsideClick: !0,
|
|
2534
|
-
fallbackFocus: () => t.value,
|
|
2535
|
-
initialFocus: () => l(t.value),
|
|
2536
|
-
...e.focusTrapOptions ?? {}
|
|
2537
|
-
});
|
|
2538
|
-
let k = null, L = Y(null);
|
|
2539
|
-
const z = () => {
|
|
2540
|
-
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
2541
|
-
const M = (x, A) => {
|
|
2542
|
-
const V = Array.from(x.querySelectorAll(A));
|
|
2543
|
-
if (!V.length) return null;
|
|
2544
|
-
const v = V.filter(
|
|
2545
|
-
(c) => c.offsetParent !== null || c.getClientRects().length > 0
|
|
2546
|
-
);
|
|
2547
|
-
return v[v.length - 1] ?? V[V.length - 1] ?? null;
|
|
2548
|
-
}, C = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
2549
|
-
for (const x of f) {
|
|
2550
|
-
const A = M(C, x);
|
|
2551
|
-
if (A) return A;
|
|
2552
|
-
}
|
|
2553
|
-
for (const x of f) {
|
|
2554
|
-
const A = M(document, x);
|
|
2555
|
-
if (A) return A;
|
|
2556
|
-
}
|
|
2557
|
-
return null;
|
|
2558
|
-
};
|
|
2559
|
-
return e.outsideClick !== !1 && Be(
|
|
2560
|
-
t,
|
|
2561
|
-
(M) => {
|
|
2562
|
-
e.isOpen.value && (L.value = "outside", e.onRequestClose?.("outside", M));
|
|
2563
|
-
},
|
|
2564
|
-
e.outsideClick
|
|
2565
|
-
), ae(
|
|
2566
|
-
() => e.isOpen.value,
|
|
2567
|
-
(M) => {
|
|
2568
|
-
M ? (L.value = null, j(() => {
|
|
2569
|
-
const C = z();
|
|
2570
|
-
C && (C.tabIndex < 0 && (C.tabIndex = -1), t.value = C, setTimeout(() => {
|
|
2571
|
-
try {
|
|
2572
|
-
p();
|
|
2573
|
-
} catch (x) {
|
|
2574
|
-
console.warn(
|
|
2575
|
-
"usePopupTrap: focus trap failed to activate",
|
|
2576
|
-
x
|
|
2577
|
-
);
|
|
2578
|
-
}
|
|
2579
|
-
}, 0), k || (k = (x) => {
|
|
2580
|
-
x.key === "Escape" && (L.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", x));
|
|
2581
|
-
}, document.addEventListener("keydown", k, !0)));
|
|
2582
|
-
})) : (b(), k && (document.removeEventListener("keydown", k, !0), k = null), t.value = null, L.value === "outside" && j(() => {
|
|
2583
|
-
const C = () => {
|
|
2584
|
-
const x = e.triggerEl?.value, A = x?.querySelector("input"), V = document.activeElement;
|
|
2585
|
-
V && (V === A || x && x.contains(V)) && (A ?? x)?.blur?.();
|
|
2586
|
-
};
|
|
2587
|
-
requestAnimationFrame(() => setTimeout(C, 0));
|
|
2588
|
-
}), e.returnFocusToTrigger !== !1 && L.value === "escape" && e.triggerEl?.value && j(() => {
|
|
2589
|
-
const C = () => {
|
|
2590
|
-
const x = e.triggerEl?.value;
|
|
2591
|
-
if (!x) return;
|
|
2592
|
-
(x.querySelector("input") ?? x)?.focus?.();
|
|
2593
|
-
};
|
|
2594
|
-
requestAnimationFrame(() => setTimeout(C, 0));
|
|
2595
|
-
}));
|
|
2596
|
-
}
|
|
2597
|
-
), {
|
|
2598
|
-
popupRef: t,
|
|
2599
|
-
activate: p,
|
|
2600
|
-
deactivate: b,
|
|
2601
|
-
lastCloseReason: te(L),
|
|
2602
|
-
setPopupEl: (M) => t.value = M
|
|
2603
|
-
};
|
|
2604
|
-
}
|
|
2605
|
-
export {
|
|
2606
|
-
Yt as DIALOG_TRAP_OPTIONS,
|
|
2607
|
-
Ut as POPUP_MENU_TRAP_OPTIONS,
|
|
2608
|
-
ze as WINDOW_SETTINGS_DEFAULTS,
|
|
2609
|
-
ft as computeCollisionOffset,
|
|
2610
|
-
Vt as useActiveIdRegistry,
|
|
2611
|
-
Pt as useCompositeId,
|
|
2612
|
-
Ot as useExclusiveGroup,
|
|
2613
|
-
at as useFieldsetTouchTracker,
|
|
2614
|
-
ot as useFieldsetValidationKit,
|
|
2615
|
-
Ct as useGridA11y,
|
|
2616
|
-
Rt as useGridActiveFilter,
|
|
2617
|
-
Ft as useGridRowAction,
|
|
2618
|
-
gt as useIntersectionObserver,
|
|
2619
|
-
zt as useMaskedDateInput,
|
|
2620
|
-
qt as useMaskedDateRangeInput,
|
|
2621
|
-
Kt as useMaskedTimeInput,
|
|
2622
|
-
$t as usePopupMenu,
|
|
2623
|
-
Bt as usePopupTrap,
|
|
2624
|
-
Lt as useUSAddress,
|
|
2625
|
-
Nt as useWindow,
|
|
2626
|
-
rt as useZipTextBox
|
|
2627
|
-
};
|
|
2628
|
-
//# sourceMappingURL=featherk-composables.es.js.map
|