@validol4ik/uikit 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppButtonCopy-CBOiSOFe.js → AppButtonCopy-4SswxN9E.js} +1 -1
- package/dist/{AppButtonCopy-CJq8F3gr.cjs → AppButtonCopy-C-ztdhMo.cjs} +1 -1
- package/dist/AppSelect-BmeBIImq.cjs +1 -0
- package/dist/AppSelect-BnjDEXM-.js +1985 -0
- package/dist/BottomSheet-DSqcRbL0.cjs +1 -0
- package/dist/BottomSheet-qodpM1oq.js +103 -0
- package/dist/DropdownButton-0caxYIDd.cjs +1 -0
- package/dist/{DropdownButton-C37a5e17.js → DropdownButton-CmUx9BXY.js} +8 -7
- package/dist/QDialog-Pw0XBuWk.js +264 -0
- package/dist/QDialog-f6QBtGnd.cjs +1 -0
- package/dist/QMenu-BEJJgJal.js +536 -0
- package/dist/QMenu-xk1k4IZT.cjs +1 -0
- package/dist/escape-key-BmiNyljw.cjs +1 -0
- package/dist/escape-key-DphMa6bO.js +281 -0
- package/dist/index-ChHy5BBm.cjs +1 -0
- package/dist/index-jCxpgc08.js +1838 -0
- package/dist/kl.woff +0 -0
- package/dist/style.css +1 -1
- package/dist/types/components/AppIcon/iconsList.d.ts +2 -2
- package/dist/types/components/buttons/CloseButton/CloseButton.vue.d.ts +5 -0
- package/dist/types/components/buttons/CloseButton/types.d.ts +4 -0
- package/dist/types/components/menu/BottomSheet/BottomSheet.vue.d.ts +38 -0
- package/dist/types/components/menu/BottomSheet/types.d.ts +11 -0
- package/dist/types/components/menu/MenuItem/MenuItem.vue.d.ts +29 -0
- package/dist/types/components/menu/MenuItem/types.d.ts +21 -0
- package/dist/types/components/menu/SystemMenu.vue.d.ts +17 -0
- package/dist/types/index.d.ts +58 -1
- package/dist/uikit.cjs +1 -1
- package/dist/uikit.es.js +10 -6
- package/package.json +1 -1
- package/dist/AppSelect-BOROROsn.cjs +0 -1
- package/dist/AppSelect-CZfoTaTG.js +0 -2304
- package/dist/DropdownButton-BQrXTfDg.cjs +0 -1
- package/dist/QMenu-Ci2SWpGp.js +0 -808
- package/dist/QMenu-DGfnSFI-.cjs +0 -1
- package/dist/index-CTeqfCv_.js +0 -1674
- package/dist/index-Cekw313Q.cjs +0 -1
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { ref as S, onMounted as fe, watch as C, computed as T, getCurrentInstance as he, nextTick as Ce, onBeforeUnmount as Q, h as J, Transition as He } from "vue";
|
|
2
|
+
import { i as ke, P as Me, c as Pe, r as We, a as Be } from "./focusout-DjvPXP_b.js";
|
|
3
|
+
import { p as ee, w as te, m as qe, x as Ae, y as j, z as ne, c as Re, u as Le, a as $e, B as ze, D as Fe, h as De, E as Ke, s as Ie } from "./index-jCxpgc08.js";
|
|
4
|
+
import { g as je, b as Oe, s as _e, u as Qe, c as Ue, d as Ne, e as Ve, f as Xe, h as Ye, i as Ze, j as oe, k as Ge, a as Je, l as et } from "./escape-key-DphMa6bO.js";
|
|
5
|
+
let K, q = 0;
|
|
6
|
+
const v = new Array(256);
|
|
7
|
+
for (let e = 0; e < 256; e++)
|
|
8
|
+
v[e] = (e + 256).toString(16).substring(1);
|
|
9
|
+
const tt = (() => {
|
|
10
|
+
const e = typeof crypto < "u" ? crypto : typeof window < "u" ? window.crypto || window.msCrypto : void 0;
|
|
11
|
+
if (e !== void 0) {
|
|
12
|
+
if (e.randomBytes !== void 0)
|
|
13
|
+
return e.randomBytes;
|
|
14
|
+
if (e.getRandomValues !== void 0)
|
|
15
|
+
return (t) => {
|
|
16
|
+
const o = new Uint8Array(t);
|
|
17
|
+
return e.getRandomValues(o), o;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return (t) => {
|
|
21
|
+
const o = [];
|
|
22
|
+
for (let n = t; n > 0; n--)
|
|
23
|
+
o.push(Math.floor(Math.random() * 256));
|
|
24
|
+
return o;
|
|
25
|
+
};
|
|
26
|
+
})(), le = 4096;
|
|
27
|
+
function O() {
|
|
28
|
+
(K === void 0 || q + 16 > le) && (q = 0, K = tt(le));
|
|
29
|
+
const e = Array.prototype.slice.call(K, q, q += 16);
|
|
30
|
+
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, v[e[0]] + v[e[1]] + v[e[2]] + v[e[3]] + "-" + v[e[4]] + v[e[5]] + "-" + v[e[6]] + v[e[7]] + "-" + v[e[8]] + v[e[9]] + "-" + v[e[10]] + v[e[11]] + v[e[12]] + v[e[13]] + v[e[14]] + v[e[15]];
|
|
31
|
+
}
|
|
32
|
+
function nt(e) {
|
|
33
|
+
return e ?? null;
|
|
34
|
+
}
|
|
35
|
+
function ie(e, t) {
|
|
36
|
+
return e ?? (t === !0 ? `f_${O()}` : null);
|
|
37
|
+
}
|
|
38
|
+
function xt({ getValue: e, required: t = !0 } = {}) {
|
|
39
|
+
if (ke.value === !0) {
|
|
40
|
+
const o = e !== void 0 ? S(nt(e())) : S(null);
|
|
41
|
+
return t === !0 && o.value === null && fe(() => {
|
|
42
|
+
o.value = `f_${O()}`;
|
|
43
|
+
}), e !== void 0 && C(e, (n) => {
|
|
44
|
+
o.value = ie(n, t);
|
|
45
|
+
}), o;
|
|
46
|
+
}
|
|
47
|
+
return e !== void 0 ? T(() => ie(e(), t)) : S(`f_${O()}`);
|
|
48
|
+
}
|
|
49
|
+
function ot() {
|
|
50
|
+
if (window.getSelection !== void 0) {
|
|
51
|
+
const e = window.getSelection();
|
|
52
|
+
e.empty !== void 0 ? e.empty() : e.removeAllRanges !== void 0 && (e.removeAllRanges(), Me.is.mobile !== !0 && e.addRange(document.createRange()));
|
|
53
|
+
} else document.selection !== void 0 && document.selection.empty();
|
|
54
|
+
}
|
|
55
|
+
const lt = {
|
|
56
|
+
/* SSR does not know about Element */
|
|
57
|
+
target: {
|
|
58
|
+
type: [Boolean, String, Element],
|
|
59
|
+
default: !0
|
|
60
|
+
},
|
|
61
|
+
noParentEvent: Boolean
|
|
62
|
+
}, it = {
|
|
63
|
+
...lt,
|
|
64
|
+
contextMenu: Boolean
|
|
65
|
+
};
|
|
66
|
+
function at({
|
|
67
|
+
showing: e,
|
|
68
|
+
avoidEmit: t,
|
|
69
|
+
// required for QPopupProxy (true)
|
|
70
|
+
configureAnchorEl: o
|
|
71
|
+
// optional
|
|
72
|
+
}) {
|
|
73
|
+
const { props: n, proxy: l, emit: c } = he(), i = S(null);
|
|
74
|
+
let f = null;
|
|
75
|
+
function h(a) {
|
|
76
|
+
return i.value === null ? !1 : a === void 0 || a.touches === void 0 || a.touches.length <= 1;
|
|
77
|
+
}
|
|
78
|
+
const s = {};
|
|
79
|
+
o === void 0 && (Object.assign(s, {
|
|
80
|
+
hide(a) {
|
|
81
|
+
l.hide(a);
|
|
82
|
+
},
|
|
83
|
+
toggle(a) {
|
|
84
|
+
l.toggle(a), a.qAnchorHandled = !0;
|
|
85
|
+
},
|
|
86
|
+
toggleKey(a) {
|
|
87
|
+
qe(a, 13) === !0 && s.toggle(a);
|
|
88
|
+
},
|
|
89
|
+
contextClick(a) {
|
|
90
|
+
l.hide(a), ee(a), Ce(() => {
|
|
91
|
+
l.show(a), a.qAnchorHandled = !0;
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
prevent: ee,
|
|
95
|
+
mobileTouch(a) {
|
|
96
|
+
if (s.mobileCleanup(a), h(a) !== !0) return;
|
|
97
|
+
l.hide(a), i.value.classList.add("non-selectable");
|
|
98
|
+
const r = a.target;
|
|
99
|
+
te(s, "anchor", [
|
|
100
|
+
[r, "touchmove", "mobileCleanup", "passive"],
|
|
101
|
+
[r, "touchend", "mobileCleanup", "passive"],
|
|
102
|
+
[r, "touchcancel", "mobileCleanup", "passive"],
|
|
103
|
+
[i.value, "contextmenu", "prevent", "notPassive"]
|
|
104
|
+
]), f = setTimeout(() => {
|
|
105
|
+
f = null, l.show(a), a.qAnchorHandled = !0;
|
|
106
|
+
}, 300);
|
|
107
|
+
},
|
|
108
|
+
mobileCleanup(a) {
|
|
109
|
+
i.value.classList.remove("non-selectable"), f !== null && (clearTimeout(f), f = null), e.value === !0 && a !== void 0 && ot();
|
|
110
|
+
}
|
|
111
|
+
}), o = function(a = n.contextMenu) {
|
|
112
|
+
if (n.noParentEvent === !0 || i.value === null) return;
|
|
113
|
+
let r;
|
|
114
|
+
a === !0 ? l.$q.platform.is.mobile === !0 ? r = [
|
|
115
|
+
[i.value, "touchstart", "mobileTouch", "passive"]
|
|
116
|
+
] : r = [
|
|
117
|
+
[i.value, "mousedown", "hide", "passive"],
|
|
118
|
+
[i.value, "contextmenu", "contextClick", "notPassive"]
|
|
119
|
+
] : r = [
|
|
120
|
+
[i.value, "click", "toggle", "passive"],
|
|
121
|
+
[i.value, "keyup", "toggleKey", "passive"]
|
|
122
|
+
], te(s, "anchor", r);
|
|
123
|
+
});
|
|
124
|
+
function d() {
|
|
125
|
+
Ae(s, "anchor");
|
|
126
|
+
}
|
|
127
|
+
function x(a) {
|
|
128
|
+
for (i.value = a; i.value.classList.contains("q-anchor--skip"); )
|
|
129
|
+
i.value = i.value.parentNode;
|
|
130
|
+
o();
|
|
131
|
+
}
|
|
132
|
+
function y() {
|
|
133
|
+
if (n.target === !1 || n.target === "" || l.$el.parentNode === null)
|
|
134
|
+
i.value = null;
|
|
135
|
+
else if (n.target === !0)
|
|
136
|
+
x(l.$el.parentNode);
|
|
137
|
+
else {
|
|
138
|
+
let a = n.target;
|
|
139
|
+
if (typeof n.target == "string")
|
|
140
|
+
try {
|
|
141
|
+
a = document.querySelector(n.target);
|
|
142
|
+
} catch {
|
|
143
|
+
a = void 0;
|
|
144
|
+
}
|
|
145
|
+
a != null ? (i.value = a.$el || a, o()) : (i.value = null, console.error(`Anchor: target "${n.target}" not found`));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return C(() => n.contextMenu, (a) => {
|
|
149
|
+
i.value !== null && (d(), o(a));
|
|
150
|
+
}), C(() => n.target, () => {
|
|
151
|
+
i.value !== null && d(), y();
|
|
152
|
+
}), C(() => n.noParentEvent, (a) => {
|
|
153
|
+
i.value !== null && (a === !0 ? d() : o());
|
|
154
|
+
}), fe(() => {
|
|
155
|
+
y(), t !== !0 && n.modelValue === !0 && i.value === null && c("update:modelValue", !1);
|
|
156
|
+
}), Q(() => {
|
|
157
|
+
f !== null && clearTimeout(f), d();
|
|
158
|
+
}), {
|
|
159
|
+
anchorEl: i,
|
|
160
|
+
canShow: h,
|
|
161
|
+
anchorEvents: s
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function ut(e, t) {
|
|
165
|
+
const o = S(null);
|
|
166
|
+
let n;
|
|
167
|
+
function l(f, h) {
|
|
168
|
+
const s = `${h !== void 0 ? "add" : "remove"}EventListener`, d = h !== void 0 ? h : n;
|
|
169
|
+
f !== window && f[s]("scroll", d, j.passive), window[s]("scroll", d, j.passive), n = h;
|
|
170
|
+
}
|
|
171
|
+
function c() {
|
|
172
|
+
o.value !== null && (l(o.value), o.value = null);
|
|
173
|
+
}
|
|
174
|
+
const i = C(() => e.noParentEvent, () => {
|
|
175
|
+
o.value !== null && (c(), t());
|
|
176
|
+
});
|
|
177
|
+
return Q(i), {
|
|
178
|
+
localScrollTarget: o,
|
|
179
|
+
unconfigureScrollTarget: c,
|
|
180
|
+
changeScrollEvent: l
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const { notPassiveCapture: A } = j, H = [];
|
|
184
|
+
function R(e) {
|
|
185
|
+
const t = e.target;
|
|
186
|
+
if (t === void 0 || t.nodeType === 8 || t.classList.contains("no-pointer-events") === !0) return;
|
|
187
|
+
let o = ne.length - 1;
|
|
188
|
+
for (; o >= 0; ) {
|
|
189
|
+
const n = ne[o].$;
|
|
190
|
+
if (n.type.name === "QTooltip") {
|
|
191
|
+
o--;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (n.type.name !== "QDialog")
|
|
195
|
+
break;
|
|
196
|
+
if (n.props.seamless !== !0) return;
|
|
197
|
+
o--;
|
|
198
|
+
}
|
|
199
|
+
for (let n = H.length - 1; n >= 0; n--) {
|
|
200
|
+
const l = H[n];
|
|
201
|
+
if ((l.anchorEl.value === null || l.anchorEl.value.contains(t) === !1) && (t === document.body || l.innerRef.value !== null && l.innerRef.value.contains(t) === !1))
|
|
202
|
+
e.qClickOutside = !0, l.onClickOutside(e);
|
|
203
|
+
else
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function rt(e) {
|
|
208
|
+
H.push(e), H.length === 1 && (document.addEventListener("mousedown", R, A), document.addEventListener("touchstart", R, A));
|
|
209
|
+
}
|
|
210
|
+
function ae(e) {
|
|
211
|
+
const t = H.findIndex((o) => o === e);
|
|
212
|
+
t !== -1 && (H.splice(t, 1), H.length === 0 && (document.removeEventListener("mousedown", R, A), document.removeEventListener("touchstart", R, A)));
|
|
213
|
+
}
|
|
214
|
+
let ue, re;
|
|
215
|
+
function se(e) {
|
|
216
|
+
const t = e.split(" ");
|
|
217
|
+
return t.length !== 2 ? !1 : ["top", "center", "bottom"].includes(t[0]) !== !0 ? (console.error("Anchor/Self position must start with one of top/center/bottom"), !1) : ["left", "middle", "right", "start", "end"].includes(t[1]) !== !0 ? (console.error("Anchor/Self position must end with one of left/middle/right/start/end"), !1) : !0;
|
|
218
|
+
}
|
|
219
|
+
function st(e) {
|
|
220
|
+
return e ? !(e.length !== 2 || typeof e[0] != "number" || typeof e[1] != "number") : !0;
|
|
221
|
+
}
|
|
222
|
+
const _ = {
|
|
223
|
+
"start#ltr": "left",
|
|
224
|
+
"start#rtl": "right",
|
|
225
|
+
"end#ltr": "right",
|
|
226
|
+
"end#rtl": "left"
|
|
227
|
+
};
|
|
228
|
+
["left", "middle", "right"].forEach((e) => {
|
|
229
|
+
_[`${e}#ltr`] = e, _[`${e}#rtl`] = e;
|
|
230
|
+
});
|
|
231
|
+
function ce(e, t) {
|
|
232
|
+
const o = e.split(" ");
|
|
233
|
+
return {
|
|
234
|
+
vertical: o[0],
|
|
235
|
+
horizontal: _[`${o[1]}#${t === !0 ? "rtl" : "ltr"}`]
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function ct(e, t) {
|
|
239
|
+
let { top: o, left: n, right: l, bottom: c, width: i, height: f } = e.getBoundingClientRect();
|
|
240
|
+
return t !== void 0 && (o -= t[1], n -= t[0], c += t[1], l += t[0], i += t[0], f += t[1]), {
|
|
241
|
+
top: o,
|
|
242
|
+
bottom: c,
|
|
243
|
+
height: f,
|
|
244
|
+
left: n,
|
|
245
|
+
right: l,
|
|
246
|
+
width: i,
|
|
247
|
+
middle: n + (l - n) / 2,
|
|
248
|
+
center: o + (c - o) / 2
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function dt(e, t, o) {
|
|
252
|
+
let { top: n, left: l } = e.getBoundingClientRect();
|
|
253
|
+
return n += t.top, l += t.left, o !== void 0 && (n += o[1], l += o[0]), {
|
|
254
|
+
top: n,
|
|
255
|
+
bottom: n + 1,
|
|
256
|
+
height: 1,
|
|
257
|
+
left: l,
|
|
258
|
+
right: l + 1,
|
|
259
|
+
width: 1,
|
|
260
|
+
middle: l,
|
|
261
|
+
center: n
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function ft(e, t) {
|
|
265
|
+
return {
|
|
266
|
+
top: 0,
|
|
267
|
+
center: t / 2,
|
|
268
|
+
bottom: t,
|
|
269
|
+
left: 0,
|
|
270
|
+
middle: e / 2,
|
|
271
|
+
right: e
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function de(e, t, o, n) {
|
|
275
|
+
return {
|
|
276
|
+
top: e[o.vertical] - t[n.vertical],
|
|
277
|
+
left: e[o.horizontal] - t[n.horizontal]
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function me(e, t = 0) {
|
|
281
|
+
if (e.targetEl === null || e.anchorEl === null || t > 5) return;
|
|
282
|
+
if (e.targetEl.offsetHeight === 0 || e.targetEl.offsetWidth === 0) {
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
me(e, t + 1);
|
|
285
|
+
}, 10);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const {
|
|
289
|
+
targetEl: o,
|
|
290
|
+
offset: n,
|
|
291
|
+
anchorEl: l,
|
|
292
|
+
anchorOrigin: c,
|
|
293
|
+
selfOrigin: i,
|
|
294
|
+
absoluteOffset: f,
|
|
295
|
+
fit: h,
|
|
296
|
+
cover: s,
|
|
297
|
+
maxHeight: d,
|
|
298
|
+
maxWidth: x
|
|
299
|
+
} = e;
|
|
300
|
+
if (Pe.is.ios === !0 && window.visualViewport !== void 0) {
|
|
301
|
+
const k = document.body.style, { offsetLeft: p, offsetTop: b } = window.visualViewport;
|
|
302
|
+
p !== ue && (k.setProperty("--q-pe-left", p + "px"), ue = p), b !== re && (k.setProperty("--q-pe-top", b + "px"), re = b);
|
|
303
|
+
}
|
|
304
|
+
const { scrollLeft: y, scrollTop: a } = o, r = f === void 0 ? ct(l, s === !0 ? [0, 0] : n) : dt(l, f, n);
|
|
305
|
+
Object.assign(o.style, {
|
|
306
|
+
top: 0,
|
|
307
|
+
left: 0,
|
|
308
|
+
minWidth: null,
|
|
309
|
+
minHeight: null,
|
|
310
|
+
maxWidth: x,
|
|
311
|
+
maxHeight: d,
|
|
312
|
+
visibility: "visible"
|
|
313
|
+
});
|
|
314
|
+
const { offsetWidth: W, offsetHeight: M } = o, { elWidth: B, elHeight: L } = h === !0 || s === !0 ? { elWidth: Math.max(r.width, W), elHeight: s === !0 ? Math.max(r.height, M) : M } : { elWidth: W, elHeight: M };
|
|
315
|
+
let g = { maxWidth: x, maxHeight: d };
|
|
316
|
+
(h === !0 || s === !0) && (g.minWidth = r.width + "px", s === !0 && (g.minHeight = r.height + "px")), Object.assign(o.style, g);
|
|
317
|
+
const w = ft(B, L);
|
|
318
|
+
let m = de(r, w, c, i);
|
|
319
|
+
if (f === void 0 || n === void 0)
|
|
320
|
+
I(m, r, w, c, i);
|
|
321
|
+
else {
|
|
322
|
+
const { top: k, left: p } = m;
|
|
323
|
+
I(m, r, w, c, i);
|
|
324
|
+
let b = !1;
|
|
325
|
+
if (m.top !== k) {
|
|
326
|
+
b = !0;
|
|
327
|
+
const E = 2 * n[1];
|
|
328
|
+
r.center = r.top -= E, r.bottom -= E + 2;
|
|
329
|
+
}
|
|
330
|
+
if (m.left !== p) {
|
|
331
|
+
b = !0;
|
|
332
|
+
const E = 2 * n[0];
|
|
333
|
+
r.middle = r.left -= E, r.right -= E + 2;
|
|
334
|
+
}
|
|
335
|
+
b === !0 && (m = de(r, w, c, i), I(m, r, w, c, i));
|
|
336
|
+
}
|
|
337
|
+
g = {
|
|
338
|
+
top: m.top + "px",
|
|
339
|
+
left: m.left + "px"
|
|
340
|
+
}, m.maxHeight !== void 0 && (g.maxHeight = m.maxHeight + "px", r.height > m.maxHeight && (g.minHeight = g.maxHeight)), m.maxWidth !== void 0 && (g.maxWidth = m.maxWidth + "px", r.width > m.maxWidth && (g.minWidth = g.maxWidth)), Object.assign(o.style, g), o.scrollTop !== a && (o.scrollTop = a), o.scrollLeft !== y && (o.scrollLeft = y);
|
|
341
|
+
}
|
|
342
|
+
function I(e, t, o, n, l) {
|
|
343
|
+
const c = o.bottom, i = o.right, f = je(), h = window.innerHeight - f, s = document.body.clientWidth;
|
|
344
|
+
if (e.top < 0 || e.top + c > h)
|
|
345
|
+
if (l.vertical === "center")
|
|
346
|
+
e.top = t[n.vertical] > h / 2 ? Math.max(0, h - c) : 0, e.maxHeight = Math.min(c, h);
|
|
347
|
+
else if (t[n.vertical] > h / 2) {
|
|
348
|
+
const d = Math.min(
|
|
349
|
+
h,
|
|
350
|
+
n.vertical === "center" ? t.center : n.vertical === l.vertical ? t.bottom : t.top
|
|
351
|
+
);
|
|
352
|
+
e.maxHeight = Math.min(c, d), e.top = Math.max(0, d - c);
|
|
353
|
+
} else
|
|
354
|
+
e.top = Math.max(
|
|
355
|
+
0,
|
|
356
|
+
n.vertical === "center" ? t.center : n.vertical === l.vertical ? t.top : t.bottom
|
|
357
|
+
), e.maxHeight = Math.min(c, h - e.top);
|
|
358
|
+
if (e.left < 0 || e.left + i > s)
|
|
359
|
+
if (e.maxWidth = Math.min(i, s), l.horizontal === "middle")
|
|
360
|
+
e.left = t[n.horizontal] > s / 2 ? Math.max(0, s - i) : 0;
|
|
361
|
+
else if (t[n.horizontal] > s / 2) {
|
|
362
|
+
const d = Math.min(
|
|
363
|
+
s,
|
|
364
|
+
n.horizontal === "middle" ? t.middle : n.horizontal === l.horizontal ? t.right : t.left
|
|
365
|
+
);
|
|
366
|
+
e.maxWidth = Math.min(i, d), e.left = Math.max(0, d - e.maxWidth);
|
|
367
|
+
} else
|
|
368
|
+
e.left = Math.max(
|
|
369
|
+
0,
|
|
370
|
+
n.horizontal === "middle" ? t.middle : n.horizontal === l.horizontal ? t.left : t.right
|
|
371
|
+
), e.maxWidth = Math.min(i, s - e.left);
|
|
372
|
+
}
|
|
373
|
+
const yt = Re({
|
|
374
|
+
name: "QMenu",
|
|
375
|
+
inheritAttrs: !1,
|
|
376
|
+
props: {
|
|
377
|
+
...it,
|
|
378
|
+
...Ue,
|
|
379
|
+
...Le,
|
|
380
|
+
...Qe,
|
|
381
|
+
persistent: Boolean,
|
|
382
|
+
autoClose: Boolean,
|
|
383
|
+
separateClosePopup: Boolean,
|
|
384
|
+
noEscDismiss: Boolean,
|
|
385
|
+
noRouteDismiss: Boolean,
|
|
386
|
+
noRefocus: Boolean,
|
|
387
|
+
noFocus: Boolean,
|
|
388
|
+
fit: Boolean,
|
|
389
|
+
cover: Boolean,
|
|
390
|
+
square: Boolean,
|
|
391
|
+
anchor: {
|
|
392
|
+
type: String,
|
|
393
|
+
validator: se
|
|
394
|
+
},
|
|
395
|
+
self: {
|
|
396
|
+
type: String,
|
|
397
|
+
validator: se
|
|
398
|
+
},
|
|
399
|
+
offset: {
|
|
400
|
+
type: Array,
|
|
401
|
+
validator: st
|
|
402
|
+
},
|
|
403
|
+
scrollTarget: _e,
|
|
404
|
+
touchPosition: Boolean,
|
|
405
|
+
maxHeight: {
|
|
406
|
+
type: String,
|
|
407
|
+
default: null
|
|
408
|
+
},
|
|
409
|
+
maxWidth: {
|
|
410
|
+
type: String,
|
|
411
|
+
default: null
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
emits: [
|
|
415
|
+
...Oe,
|
|
416
|
+
"click",
|
|
417
|
+
"escapeKey"
|
|
418
|
+
],
|
|
419
|
+
setup(e, { slots: t, emit: o, attrs: n }) {
|
|
420
|
+
let l = null, c, i, f;
|
|
421
|
+
const h = he(), { proxy: s } = h, { $q: d } = s, x = S(null), y = S(!1), a = T(
|
|
422
|
+
() => e.persistent !== !0 && e.noRouteDismiss !== !0
|
|
423
|
+
), r = $e(e, d), { registerTick: W, removeTick: M } = Ne(), { registerTimeout: B } = Ve(), { transitionProps: L, transitionStyle: g } = Xe(e), { localScrollTarget: w, changeScrollEvent: m, unconfigureScrollTarget: k } = ut(e, Z), { anchorEl: p, canShow: b } = at({ showing: y }), { hide: E } = Ye({
|
|
424
|
+
showing: y,
|
|
425
|
+
canShow: b,
|
|
426
|
+
handleShow: pe,
|
|
427
|
+
handleHide: be,
|
|
428
|
+
hideOnRouteChange: a,
|
|
429
|
+
processOnMount: !0
|
|
430
|
+
}), { showPortal: U, hidePortal: N, renderPortal: ve } = Ze(h, x, Ee, "menu"), $ = {
|
|
431
|
+
anchorEl: p,
|
|
432
|
+
innerRef: x,
|
|
433
|
+
onClickOutside(u) {
|
|
434
|
+
if (e.persistent !== !0 && y.value === !0)
|
|
435
|
+
return E(u), // always prevent touch event
|
|
436
|
+
(u.type === "touchstart" || u.target.classList.contains("q-dialog__backdrop")) && Ie(u), !0;
|
|
437
|
+
}
|
|
438
|
+
}, V = T(
|
|
439
|
+
() => ce(
|
|
440
|
+
e.anchor || (e.cover === !0 ? "center middle" : "bottom start"),
|
|
441
|
+
d.lang.rtl
|
|
442
|
+
)
|
|
443
|
+
), ge = T(() => e.cover === !0 ? V.value : ce(e.self || "top start", d.lang.rtl)), xe = T(
|
|
444
|
+
() => (e.square === !0 ? " q-menu--square" : "") + (r.value === !0 ? " q-menu--dark q-dark" : "")
|
|
445
|
+
), ye = T(() => e.autoClose === !0 ? { onClick: we } : {}), X = T(
|
|
446
|
+
() => y.value === !0 && e.persistent !== !0
|
|
447
|
+
);
|
|
448
|
+
C(X, (u) => {
|
|
449
|
+
u === !0 ? (et(F), rt($)) : (oe(F), ae($));
|
|
450
|
+
});
|
|
451
|
+
function z() {
|
|
452
|
+
Je(() => {
|
|
453
|
+
let u = x.value;
|
|
454
|
+
u && u.contains(document.activeElement) !== !0 && (u = u.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]") || u.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]") || u.querySelector("[autofocus], [data-autofocus]") || u, u.focus({ preventScroll: !0 }));
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function pe(u) {
|
|
458
|
+
if (l = e.noRefocus === !1 ? document.activeElement : null, Be(G), U(), Z(), c = void 0, u !== void 0 && (e.touchPosition || e.contextMenu)) {
|
|
459
|
+
const D = ze(u);
|
|
460
|
+
if (D.left !== void 0) {
|
|
461
|
+
const { top: Te, left: Se } = p.value.getBoundingClientRect();
|
|
462
|
+
c = { left: D.left - Se, top: D.top - Te };
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
i === void 0 && (i = C(
|
|
466
|
+
() => d.screen.width + "|" + d.screen.height + "|" + e.self + "|" + e.anchor + "|" + d.lang.rtl,
|
|
467
|
+
P
|
|
468
|
+
)), e.noFocus !== !0 && document.activeElement.blur(), W(() => {
|
|
469
|
+
P(), e.noFocus !== !0 && z();
|
|
470
|
+
}), B(() => {
|
|
471
|
+
d.platform.is.ios === !0 && (f = e.autoClose, x.value.click()), P(), U(!0), o("show", u);
|
|
472
|
+
}, e.transitionDuration);
|
|
473
|
+
}
|
|
474
|
+
function be(u) {
|
|
475
|
+
M(), N(), Y(!0), l !== null && // menu was hidden from code or ESC plugin
|
|
476
|
+
(u === void 0 || u.qClickOutside !== !0) && ((((u == null ? void 0 : u.type.indexOf("key")) === 0 ? l.closest('[tabindex]:not([tabindex^="-"])') : void 0) || l).focus(), l = null), B(() => {
|
|
477
|
+
N(!0), o("hide", u);
|
|
478
|
+
}, e.transitionDuration);
|
|
479
|
+
}
|
|
480
|
+
function Y(u) {
|
|
481
|
+
c = void 0, i !== void 0 && (i(), i = void 0), (u === !0 || y.value === !0) && (We(G), k(), ae($), oe(F)), u !== !0 && (l = null);
|
|
482
|
+
}
|
|
483
|
+
function Z() {
|
|
484
|
+
(p.value !== null || e.scrollTarget !== void 0) && (w.value = Ge(p.value, e.scrollTarget), m(w.value, P));
|
|
485
|
+
}
|
|
486
|
+
function we(u) {
|
|
487
|
+
f !== !0 ? (Fe(s, u), o("click", u)) : f = !1;
|
|
488
|
+
}
|
|
489
|
+
function G(u) {
|
|
490
|
+
X.value === !0 && e.noFocus !== !0 && Ke(x.value, u.target) !== !0 && z();
|
|
491
|
+
}
|
|
492
|
+
function F(u) {
|
|
493
|
+
e.noEscDismiss !== !0 && (o("escapeKey"), E(u));
|
|
494
|
+
}
|
|
495
|
+
function P() {
|
|
496
|
+
me({
|
|
497
|
+
targetEl: x.value,
|
|
498
|
+
offset: e.offset,
|
|
499
|
+
anchorEl: p.value,
|
|
500
|
+
anchorOrigin: V.value,
|
|
501
|
+
selfOrigin: ge.value,
|
|
502
|
+
absoluteOffset: c,
|
|
503
|
+
fit: e.fit,
|
|
504
|
+
cover: e.cover,
|
|
505
|
+
maxHeight: e.maxHeight,
|
|
506
|
+
maxWidth: e.maxWidth
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
function Ee() {
|
|
510
|
+
return J(
|
|
511
|
+
He,
|
|
512
|
+
L.value,
|
|
513
|
+
() => y.value === !0 ? J("div", {
|
|
514
|
+
role: "menu",
|
|
515
|
+
...n,
|
|
516
|
+
ref: x,
|
|
517
|
+
tabindex: -1,
|
|
518
|
+
class: [
|
|
519
|
+
"q-menu q-position-engine scroll" + xe.value,
|
|
520
|
+
n.class
|
|
521
|
+
],
|
|
522
|
+
style: [
|
|
523
|
+
n.style,
|
|
524
|
+
g.value
|
|
525
|
+
],
|
|
526
|
+
...ye.value
|
|
527
|
+
}, De(t.default)) : null
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
return Q(Y), Object.assign(s, { focus: z, updatePosition: P }), ve;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
export {
|
|
534
|
+
yt as Q,
|
|
535
|
+
xt as u
|
|
536
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("vue"),W=require("./focusout-DzWGke-4.cjs"),v=require("./index-ChHy5BBm.cjs"),y=require("./escape-key-BmiNyljw.cjs");let I,A=0;const x=new Array(256);for(let e=0;e<256;e++)x[e]=(e+256).toString(16).substring(1);const xe=(()=>{const e=typeof crypto<"u"?crypto:typeof window<"u"?window.crypto||window.msCrypto:void 0;if(e!==void 0){if(e.randomBytes!==void 0)return e.randomBytes;if(e.getRandomValues!==void 0)return t=>{const o=new Uint8Array(t);return e.getRandomValues(o),o}}return t=>{const o=[];for(let n=t;n>0;n--)o.push(Math.floor(Math.random()*256));return o}})(),G=4096;function _(){(I===void 0||A+16>G)&&(A=0,I=xe(G));const e=Array.prototype.slice.call(I,A,A+=16);return e[6]=e[6]&15|64,e[8]=e[8]&63|128,x[e[0]]+x[e[1]]+x[e[2]]+x[e[3]]+"-"+x[e[4]]+x[e[5]]+"-"+x[e[6]]+x[e[7]]+"-"+x[e[8]]+x[e[9]]+"-"+x[e[10]]+x[e[11]]+x[e[12]]+x[e[13]]+x[e[14]]+x[e[15]]}function ye(e){return e??null}function J(e,t){return e??(t===!0?`f_${_()}`:null)}function pe({getValue:e,required:t=!0}={}){if(W.isRuntimeSsrPreHydration.value===!0){const o=e!==void 0?a.ref(ye(e())):a.ref(null);return t===!0&&o.value===null&&a.onMounted(()=>{o.value=`f_${_()}`}),e!==void 0&&a.watch(e,n=>{o.value=J(n,t)}),o}return e!==void 0?a.computed(()=>J(e(),t)):a.ref(`f_${_()}`)}function be(){if(window.getSelection!==void 0){const e=window.getSelection();e.empty!==void 0?e.empty():e.removeAllRanges!==void 0&&(e.removeAllRanges(),W.Platform.is.mobile!==!0&&e.addRange(document.createRange()))}else document.selection!==void 0&&document.selection.empty()}const we={target:{type:[Boolean,String,Element],default:!0},noParentEvent:Boolean},Ee={...we,contextMenu:Boolean};function Te({showing:e,avoidEmit:t,configureAnchorEl:o}){const{props:n,proxy:i,emit:d}=a.getCurrentInstance(),l=a.ref(null);let h=null;function m(u){return l.value===null?!1:u===void 0||u.touches===void 0||u.touches.length<=1}const c={};o===void 0&&(Object.assign(c,{hide(u){i.hide(u)},toggle(u){i.toggle(u),u.qAnchorHandled=!0},toggleKey(u){v.isKeyCode(u,13)===!0&&c.toggle(u)},contextClick(u){i.hide(u),v.prevent(u),a.nextTick(()=>{i.show(u),u.qAnchorHandled=!0})},prevent:v.prevent,mobileTouch(u){if(c.mobileCleanup(u),m(u)!==!0)return;i.hide(u),l.value.classList.add("non-selectable");const s=u.target;v.addEvt(c,"anchor",[[s,"touchmove","mobileCleanup","passive"],[s,"touchend","mobileCleanup","passive"],[s,"touchcancel","mobileCleanup","passive"],[l.value,"contextmenu","prevent","notPassive"]]),h=setTimeout(()=>{h=null,i.show(u),u.qAnchorHandled=!0},300)},mobileCleanup(u){l.value.classList.remove("non-selectable"),h!==null&&(clearTimeout(h),h=null),e.value===!0&&u!==void 0&&be()}}),o=function(u=n.contextMenu){if(n.noParentEvent===!0||l.value===null)return;let s;u===!0?i.$q.platform.is.mobile===!0?s=[[l.value,"touchstart","mobileTouch","passive"]]:s=[[l.value,"mousedown","hide","passive"],[l.value,"contextmenu","contextClick","notPassive"]]:s=[[l.value,"click","toggle","passive"],[l.value,"keyup","toggleKey","passive"]],v.addEvt(c,"anchor",s)});function f(){v.cleanEvt(c,"anchor")}function b(u){for(l.value=u;l.value.classList.contains("q-anchor--skip");)l.value=l.value.parentNode;o()}function w(){if(n.target===!1||n.target===""||i.$el.parentNode===null)l.value=null;else if(n.target===!0)b(i.$el.parentNode);else{let u=n.target;if(typeof n.target=="string")try{u=document.querySelector(n.target)}catch{u=void 0}u!=null?(l.value=u.$el||u,o()):(l.value=null,console.error(`Anchor: target "${n.target}" not found`))}}return a.watch(()=>n.contextMenu,u=>{l.value!==null&&(f(),o(u))}),a.watch(()=>n.target,()=>{l.value!==null&&f(),w()}),a.watch(()=>n.noParentEvent,u=>{l.value!==null&&(u===!0?f():o())}),a.onMounted(()=>{w(),t!==!0&&n.modelValue===!0&&l.value===null&&d("update:modelValue",!1)}),a.onBeforeUnmount(()=>{h!==null&&clearTimeout(h),f()}),{anchorEl:l,canShow:m,anchorEvents:c}}function Se(e,t){const o=a.ref(null);let n;function i(h,m){const c=`${m!==void 0?"add":"remove"}EventListener`,f=m!==void 0?m:n;h!==window&&h[c]("scroll",f,v.listenOpts.passive),window[c]("scroll",f,v.listenOpts.passive),n=m}function d(){o.value!==null&&(i(o.value),o.value=null)}const l=a.watch(()=>e.noParentEvent,()=>{o.value!==null&&(d(),t())});return a.onBeforeUnmount(l),{localScrollTarget:o,unconfigureScrollTarget:d,changeScrollEvent:i}}const{notPassiveCapture:L}=v.listenOpts,H=[];function R(e){const t=e.target;if(t===void 0||t.nodeType===8||t.classList.contains("no-pointer-events")===!0)return;let o=v.portalProxyList.length-1;for(;o>=0;){const n=v.portalProxyList[o].$;if(n.type.name==="QTooltip"){o--;continue}if(n.type.name!=="QDialog")break;if(n.props.seamless!==!0)return;o--}for(let n=H.length-1;n>=0;n--){const i=H[n];if((i.anchorEl.value===null||i.anchorEl.value.contains(t)===!1)&&(t===document.body||i.innerRef.value!==null&&i.innerRef.value.contains(t)===!1))e.qClickOutside=!0,i.onClickOutside(e);else return}}function Ce(e){H.push(e),H.length===1&&(document.addEventListener("mousedown",R,L),document.addEventListener("touchstart",R,L))}function ee(e){const t=H.findIndex(o=>o===e);t!==-1&&(H.splice(t,1),H.length===0&&(document.removeEventListener("mousedown",R,L),document.removeEventListener("touchstart",R,L)))}let te,ne;function oe(e){const t=e.split(" ");return t.length!==2?!1:["top","center","bottom"].includes(t[0])!==!0?(console.error("Anchor/Self position must start with one of top/center/bottom"),!1):["left","middle","right","start","end"].includes(t[1])!==!0?(console.error("Anchor/Self position must end with one of left/middle/right/start/end"),!1):!0}function He(e){return e?!(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number"):!0}const j={"start#ltr":"left","start#rtl":"right","end#ltr":"right","end#rtl":"left"};["left","middle","right"].forEach(e=>{j[`${e}#ltr`]=e,j[`${e}#rtl`]=e});function ie(e,t){const o=e.split(" ");return{vertical:o[0],horizontal:j[`${o[1]}#${t===!0?"rtl":"ltr"}`]}}function Me(e,t){let{top:o,left:n,right:i,bottom:d,width:l,height:h}=e.getBoundingClientRect();return t!==void 0&&(o-=t[1],n-=t[0],d+=t[1],i+=t[0],l+=t[0],h+=t[1]),{top:o,bottom:d,height:h,left:n,right:i,width:l,middle:n+(i-n)/2,center:o+(d-o)/2}}function ke(e,t,o){let{top:n,left:i}=e.getBoundingClientRect();return n+=t.top,i+=t.left,o!==void 0&&(n+=o[1],i+=o[0]),{top:n,bottom:n+1,height:1,left:i,right:i+1,width:1,middle:i,center:n}}function Pe(e,t){return{top:0,center:t/2,bottom:t,left:0,middle:e/2,right:e}}function le(e,t,o,n){return{top:e[o.vertical]-t[n.vertical],left:e[o.horizontal]-t[n.horizontal]}}function ue(e,t=0){if(e.targetEl===null||e.anchorEl===null||t>5)return;if(e.targetEl.offsetHeight===0||e.targetEl.offsetWidth===0){setTimeout(()=>{ue(e,t+1)},10);return}const{targetEl:o,offset:n,anchorEl:i,anchorOrigin:d,selfOrigin:l,absoluteOffset:h,fit:m,cover:c,maxHeight:f,maxWidth:b}=e;if(W.client.is.ios===!0&&window.visualViewport!==void 0){const M=document.body.style,{offsetLeft:E,offsetTop:T}=window.visualViewport;E!==te&&(M.setProperty("--q-pe-left",E+"px"),te=E),T!==ne&&(M.setProperty("--q-pe-top",T+"px"),ne=T)}const{scrollLeft:w,scrollTop:u}=o,s=h===void 0?Me(i,c===!0?[0,0]:n):ke(i,h,n);Object.assign(o.style,{top:0,left:0,minWidth:null,minHeight:null,maxWidth:b,maxHeight:f,visibility:"visible"});const{offsetWidth:B,offsetHeight:k}=o,{elWidth:q,elHeight:$}=m===!0||c===!0?{elWidth:Math.max(s.width,B),elHeight:c===!0?Math.max(s.height,k):k}:{elWidth:B,elHeight:k};let p={maxWidth:b,maxHeight:f};(m===!0||c===!0)&&(p.minWidth=s.width+"px",c===!0&&(p.minHeight=s.height+"px")),Object.assign(o.style,p);const S=Pe(q,$);let g=le(s,S,d,l);if(h===void 0||n===void 0)O(g,s,S,d,l);else{const{top:M,left:E}=g;O(g,s,S,d,l);let T=!1;if(g.top!==M){T=!0;const C=2*n[1];s.center=s.top-=C,s.bottom-=C+2}if(g.left!==E){T=!0;const C=2*n[0];s.middle=s.left-=C,s.right-=C+2}T===!0&&(g=le(s,S,d,l),O(g,s,S,d,l))}p={top:g.top+"px",left:g.left+"px"},g.maxHeight!==void 0&&(p.maxHeight=g.maxHeight+"px",s.height>g.maxHeight&&(p.minHeight=p.maxHeight)),g.maxWidth!==void 0&&(p.maxWidth=g.maxWidth+"px",s.width>g.maxWidth&&(p.minWidth=p.maxWidth)),Object.assign(o.style,p),o.scrollTop!==u&&(o.scrollTop=u),o.scrollLeft!==w&&(o.scrollLeft=w)}function O(e,t,o,n,i){const d=o.bottom,l=o.right,h=y.getScrollbarWidth(),m=window.innerHeight-h,c=document.body.clientWidth;if(e.top<0||e.top+d>m)if(i.vertical==="center")e.top=t[n.vertical]>m/2?Math.max(0,m-d):0,e.maxHeight=Math.min(d,m);else if(t[n.vertical]>m/2){const f=Math.min(m,n.vertical==="center"?t.center:n.vertical===i.vertical?t.bottom:t.top);e.maxHeight=Math.min(d,f),e.top=Math.max(0,f-d)}else e.top=Math.max(0,n.vertical==="center"?t.center:n.vertical===i.vertical?t.top:t.bottom),e.maxHeight=Math.min(d,m-e.top);if(e.left<0||e.left+l>c)if(e.maxWidth=Math.min(l,c),i.horizontal==="middle")e.left=t[n.horizontal]>c/2?Math.max(0,c-l):0;else if(t[n.horizontal]>c/2){const f=Math.min(c,n.horizontal==="middle"?t.middle:n.horizontal===i.horizontal?t.right:t.left);e.maxWidth=Math.min(l,f),e.left=Math.max(0,f-e.maxWidth)}else e.left=Math.max(0,n.horizontal==="middle"?t.middle:n.horizontal===i.horizontal?t.left:t.right),e.maxWidth=Math.min(l,c-e.left)}const We=v.createComponent({name:"QMenu",inheritAttrs:!1,props:{...Ee,...y.useModelToggleProps,...v.useDarkProps,...y.useTransitionProps,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:oe},self:{type:String,validator:oe},offset:{type:Array,validator:He},scrollTarget:y.scrollTargetProp,touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...y.useModelToggleEmits,"click","escapeKey"],setup(e,{slots:t,emit:o,attrs:n}){let i=null,d,l,h;const m=a.getCurrentInstance(),{proxy:c}=m,{$q:f}=c,b=a.ref(null),w=a.ref(!1),u=a.computed(()=>e.persistent!==!0&&e.noRouteDismiss!==!0),s=v.useDark(e,f),{registerTick:B,removeTick:k}=y.useTick(),{registerTimeout:q}=y.useTimeout(),{transitionProps:$,transitionStyle:p}=y.useTransition(e),{localScrollTarget:S,changeScrollEvent:g,unconfigureScrollTarget:M}=Se(e,Y),{anchorEl:E,canShow:T}=Te({showing:w}),{hide:C}=y.useModelToggle({showing:w,canShow:T,handleShow:de,handleHide:fe,hideOnRouteChange:u,processOnMount:!0}),{showPortal:Q,hidePortal:U,renderPortal:re}=y.usePortal(m,b,me,"menu"),F={anchorEl:E,innerRef:b,onClickOutside(r){if(e.persistent!==!0&&w.value===!0)return C(r),(r.type==="touchstart"||r.target.classList.contains("q-dialog__backdrop"))&&v.stopAndPrevent(r),!0}},N=a.computed(()=>ie(e.anchor||(e.cover===!0?"center middle":"bottom start"),f.lang.rtl)),ae=a.computed(()=>e.cover===!0?N.value:ie(e.self||"top start",f.lang.rtl)),se=a.computed(()=>(e.square===!0?" q-menu--square":"")+(s.value===!0?" q-menu--dark q-dark":"")),ce=a.computed(()=>e.autoClose===!0?{onClick:he}:{}),V=a.computed(()=>w.value===!0&&e.persistent!==!0);a.watch(V,r=>{r===!0?(y.addEscapeKey(D),Ce(F)):(y.removeEscapeKey(D),ee(F))});function z(){y.addFocusFn(()=>{let r=b.value;r&&r.contains(document.activeElement)!==!0&&(r=r.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||r.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||r.querySelector("[autofocus], [data-autofocus]")||r,r.focus({preventScroll:!0}))})}function de(r){if(i=e.noRefocus===!1?document.activeElement:null,W.addFocusout(Z),Q(),Y(),d=void 0,r!==void 0&&(e.touchPosition||e.contextMenu)){const K=v.position(r);if(K.left!==void 0){const{top:ve,left:ge}=E.value.getBoundingClientRect();d={left:K.left-ge,top:K.top-ve}}}l===void 0&&(l=a.watch(()=>f.screen.width+"|"+f.screen.height+"|"+e.self+"|"+e.anchor+"|"+f.lang.rtl,P)),e.noFocus!==!0&&document.activeElement.blur(),B(()=>{P(),e.noFocus!==!0&&z()}),q(()=>{f.platform.is.ios===!0&&(h=e.autoClose,b.value.click()),P(),Q(!0),o("show",r)},e.transitionDuration)}function fe(r){k(),U(),X(!0),i!==null&&(r===void 0||r.qClickOutside!==!0)&&((((r==null?void 0:r.type.indexOf("key"))===0?i.closest('[tabindex]:not([tabindex^="-"])'):void 0)||i).focus(),i=null),q(()=>{U(!0),o("hide",r)},e.transitionDuration)}function X(r){d=void 0,l!==void 0&&(l(),l=void 0),(r===!0||w.value===!0)&&(W.removeFocusout(Z),M(),ee(F),y.removeEscapeKey(D)),r!==!0&&(i=null)}function Y(){(E.value!==null||e.scrollTarget!==void 0)&&(S.value=y.getScrollTarget(E.value,e.scrollTarget),g(S.value,P))}function he(r){h!==!0?(v.closePortalMenus(c,r),o("click",r)):h=!1}function Z(r){V.value===!0&&e.noFocus!==!0&&v.childHasFocus(b.value,r.target)!==!0&&z()}function D(r){e.noEscDismiss!==!0&&(o("escapeKey"),C(r))}function P(){ue({targetEl:b.value,offset:e.offset,anchorEl:E.value,anchorOrigin:N.value,selfOrigin:ae.value,absoluteOffset:d,fit:e.fit,cover:e.cover,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function me(){return a.h(a.Transition,$.value,()=>w.value===!0?a.h("div",{role:"menu",...n,ref:b,tabindex:-1,class:["q-menu q-position-engine scroll"+se.value,n.class],style:[n.style,p.value],...ce.value},v.hSlot(t.default)):null)}return a.onBeforeUnmount(X),Object.assign(c,{focus:z,updatePosition:P}),re}});exports.QMenu=We;exports.useId=pe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("vue"),u=require("./index-ChHy5BBm.cjs"),$=require("./focusout-DzWGke-4.cjs");let f=[],y=[];function k(e){y=y.filter(t=>t!==e)}function L(e){k(e),y.push(e)}function C(e){k(e),y.length===0&&f.length!==0&&(f[f.length-1](),f=[])}function M(e){y.length===0?e():f.push(e)}function q(e){f=f.filter(t=>t!==e)}const H={modelValue:{type:Boolean,default:null},"onUpdate:modelValue":[Function,Array]},N=["beforeShow","show","beforeHide","hide"];function W({showing:e,canShow:t,hideOnRouteChange:o,handleShow:l,handleHide:r,processOnMount:v}){const d=i.getCurrentInstance(),{props:s,emit:a,proxy:b}=d;let c;function h(n){e.value===!0?x(n):w(n)}function w(n){if(s.disable===!0||(n==null?void 0:n.qAnchorHandled)===!0||t!==void 0&&t(n)!==!0)return;const m=s["onUpdate:modelValue"]!==void 0;m===!0&&(a("update:modelValue",!0),c=n,i.nextTick(()=>{c===n&&(c=void 0)})),(s.modelValue===null||m===!1)&&P(n)}function P(n){e.value!==!0&&(e.value=!0,a("beforeShow",n),l!==void 0?l(n):a("show",n))}function x(n){if(s.disable===!0)return;const m=s["onUpdate:modelValue"]!==void 0;m===!0&&(a("update:modelValue",!1),c=n,i.nextTick(()=>{c===n&&(c=void 0)})),(s.modelValue===null||m===!1)&&E(n)}function E(n){e.value!==!1&&(e.value=!1,a("beforeHide",n),r!==void 0?r(n):a("hide",n))}function S(n){s.disable===!0&&n===!0?s["onUpdate:modelValue"]!==void 0&&a("update:modelValue",!1):n===!0!==e.value&&(n===!0?P:E)(c)}i.watch(()=>s.modelValue,S),o!==void 0&&u.vmHasRouter(d)===!0&&i.watch(()=>b.$route.fullPath,()=>{o.value===!0&&e.value===!0&&x()}),i.onMounted(()=>{S(s.modelValue)});const F={show:w,hide:x,toggle:h};return Object.assign(b,F),F}const V={};let I=1,O=document.body;function K(e,t){const o=document.createElement("div");if(o.id=t!==void 0?`q-portal--${t}--${I++}`:e,V.globalNodes!==void 0){const l=V.globalNodes.class;l!==void 0&&(o.className=l)}return O.appendChild(o),o}function U(e){e.remove()}const A=u.createComponent({name:"QPortal",setup(e,{slots:t}){return()=>t.default()}});function G(e){for(e=e.parent;e!=null;){if(e.type.name==="QGlobalDialog")return!0;if(e.type.name==="QDialog"||e.type.name==="QMenu")return!1;e=e.parent}return!1}function Q(e,t,o,l){const r=i.ref(!1),v=i.ref(!1);let d=null;const s={},a=l==="dialog"&&G(e);function b(h){if(h===!0){C(s),v.value=!0;return}v.value=!1,r.value===!1&&(a===!1&&d===null&&(d=K(!1,l)),r.value=!0,u.portalProxyList.push(e.proxy),L(s))}function c(h){if(v.value=!1,h!==!0)return;C(s),r.value=!1;const w=u.portalProxyList.indexOf(e.proxy);w!==-1&&u.portalProxyList.splice(w,1),d!==null&&(U(d),d=null)}return i.onUnmounted(()=>{c(!0)}),e.proxy.__qPortal=!0,$.injectProp(e.proxy,"contentEl",()=>t.value),{showPortal:b,hidePortal:c,portalIsActive:r,portalIsAccessible:v,renderPortal:()=>a===!0?o():r.value===!0?[i.h(i.Teleport,{to:d},i.h(A,o))]:void 0}}const B={transitionShow:{type:String,default:"fade"},transitionHide:{type:String,default:"fade"},transitionDuration:{type:[String,Number],default:300}};function _(e,t=()=>{},o=()=>{}){return{transitionProps:i.computed(()=>{const l=`q-transition--${e.transitionShow||t()}`,r=`q-transition--${e.transitionHide||o()}`;return{appear:!0,enterFromClass:`${l}-enter-from`,enterActiveClass:`${l}-enter-active`,enterToClass:`${l}-enter-to`,leaveFromClass:`${r}-leave-from`,leaveActiveClass:`${r}-leave-active`,leaveToClass:`${r}-leave-to`}}),transitionStyle:i.computed(()=>`--q-transition-duration: ${e.transitionDuration}ms`)}}function j(){let e;const t=i.getCurrentInstance();function o(){e=void 0}return i.onDeactivated(o),i.onBeforeUnmount(o),{removeTick:o,registerTick(l){e=l,i.nextTick(()=>{e===l&&(u.vmIsDestroyed(t)===!1&&e(),e=void 0)})}}}function z(){let e=null;const t=i.getCurrentInstance();function o(){e!==null&&(clearTimeout(e),e=null)}return i.onDeactivated(o),i.onBeforeUnmount(o),{removeTimeout:o,registerTimeout(l,r){o(),u.vmIsDestroyed(t)===!1&&(e=setTimeout(()=>{e=null,l()},r))}}}const X=[Element,String],Y=[null,document,document.body,document.scrollingElement,document.documentElement];function J(e,t){let o=u.getElement(t);if(o===void 0){if(e==null)return window;o=e.closest(".scroll,.scroll-y,.overflow-auto")}return Y.includes(o)?window:o}function R(e){return e===window?window.pageYOffset||window.scrollY||document.body.scrollTop||0:e.scrollTop}function Z(e){return e===window?window.pageXOffset||window.scrollX||document.body.scrollLeft||0:e.scrollLeft}let T;function ee(){if(T!==void 0)return T;const e=document.createElement("p"),t=document.createElement("div");u.css(e,{width:"100%",height:"200px"}),u.css(t,{position:"absolute",top:"0px",left:"0px",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),t.appendChild(e),document.body.appendChild(t);const o=e.offsetWidth;t.style.overflow="scroll";let l=e.offsetWidth;return o===l&&(l=t.clientWidth),t.remove(),T=o-l,T}function te(e,t=!0){return!e||e.nodeType!==Node.ELEMENT_NODE?!1:t?e.scrollHeight>e.clientHeight&&(e.classList.contains("scroll")||e.classList.contains("overflow-auto")||["auto","scroll"].includes(window.getComputedStyle(e)["overflow-y"])):e.scrollWidth>e.clientWidth&&(e.classList.contains("scroll")||e.classList.contains("overflow-auto")||["auto","scroll"].includes(window.getComputedStyle(e)["overflow-x"]))}const p=[];let g;function oe(e){g=e.keyCode===27}function ne(){g===!0&&(g=!1)}function le(e){g===!0&&(g=!1,u.isKeyCode(e,27)===!0&&p[p.length-1](e))}function D(e){window[e]("keydown",oe),window[e]("blur",ne),window[e]("keyup",le),g=!1}function ie(e){$.client.is.desktop===!0&&(p.push(e),p.length===1&&D("addEventListener"))}function re(e){const t=p.indexOf(e);t!==-1&&(p.splice(t,1),p.length===0&&D("removeEventListener"))}exports.addEscapeKey=ie;exports.addFocusFn=M;exports.getHorizontalScrollPosition=Z;exports.getScrollTarget=J;exports.getScrollbarWidth=ee;exports.getVerticalScrollPosition=R;exports.hasScrollbar=te;exports.removeEscapeKey=re;exports.removeFocusFn=q;exports.scrollTargetProp=X;exports.useModelToggle=W;exports.useModelToggleEmits=N;exports.useModelToggleProps=H;exports.usePortal=Q;exports.useTick=j;exports.useTimeout=z;exports.useTransition=_;exports.useTransitionProps=B;
|