@validol4ik/uikit 0.3.42 → 0.4.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.
@@ -1,3344 +0,0 @@
1
- import { computed as f, ref as T, h, getCurrentInstance as le, toRaw as $e, onMounted as tt, watch as K, onBeforeUpdate as Ml, inject as _o, onBeforeUnmount as ce, nextTick as ue, onDeactivated as Ct, onActivated as Ll, Transition as bt, onUnmounted as Eo, Teleport as Bo, onBeforeMount as Ao, onUpdated as To, defineComponent as Ro, openBlock as de, createElementBlock as ye, normalizeClass as st, toDisplayString as Ue, createCommentVNode as Pe, createVNode as Xe, unref as zo, withCtx as xe, mergeProps as Fo, createBlock as al, createElementVNode as At, createTextVNode as Tt, Fragment as ct, withModifiers as Mo } from "vue";
2
- import { u as Ol, s as ae, a as Il, h as Se, b as Hl, c as be, Q as Ae, d as Lo, i as kt, e as Oo, f as Io, p as pe, g as Ho, j as $o, R as Po, k as Do, l as rl, m as Wo, n as ge, v as jo, o as Rt, q as $l, r as No, t as sl, w as Ko, x as Pl, y as Qo, z as Uo, B as De, D as Xo, S as Yo, _ as Go } from "./index-DbNgqbW0.js";
3
- import { i as Zo, b as Dl, P as Jo, c as we, r as Pt, a as Wl } from "./focusout-DjvPXP_b.js";
4
- const lt = {
5
- dark: {
6
- type: Boolean,
7
- default: null
8
- }
9
- };
10
- function ot(e, t) {
11
- return f(() => e.dark === null ? t.dark.isActive : e.dark);
12
- }
13
- function en(e, t) {
14
- const l = T(null), o = f(() => e.disable === !0 ? null : h("span", {
15
- ref: l,
16
- class: "no-outline",
17
- tabindex: -1
18
- }));
19
- function a(i) {
20
- const u = t.value;
21
- i !== void 0 && i.type.indexOf("key") === 0 ? u !== null && document.activeElement !== u && u.contains(document.activeElement) === !0 && u.focus() : l.value !== null && (i === void 0 || u !== null && u.contains(i.target) === !0) && l.value.focus();
22
- }
23
- return {
24
- refocusTargetEl: o,
25
- refocusTarget: a
26
- };
27
- }
28
- const jl = {
29
- name: String
30
- };
31
- function tn(e = {}) {
32
- return (t, l, o) => {
33
- t[l](
34
- h("input", {
35
- class: "hidden" + (o || ""),
36
- ...e.value
37
- })
38
- );
39
- };
40
- }
41
- function ln(e) {
42
- return f(() => e.name || e.for);
43
- }
44
- const on = {
45
- xs: 30,
46
- sm: 35,
47
- md: 40,
48
- lg: 50,
49
- xl: 60
50
- }, nn = {
51
- ...lt,
52
- ...Hl,
53
- ...jl,
54
- modelValue: {
55
- required: !0,
56
- default: null
57
- },
58
- val: {},
59
- trueValue: { default: !0 },
60
- falseValue: { default: !1 },
61
- indeterminateValue: { default: null },
62
- checkedIcon: String,
63
- uncheckedIcon: String,
64
- indeterminateIcon: String,
65
- toggleOrder: {
66
- type: String,
67
- validator: (e) => e === "tf" || e === "ft"
68
- },
69
- toggleIndeterminate: Boolean,
70
- label: String,
71
- leftLabel: Boolean,
72
- color: String,
73
- keepColor: Boolean,
74
- dense: Boolean,
75
- disable: Boolean,
76
- tabindex: [String, Number]
77
- }, un = ["update:modelValue"];
78
- function an(e, t) {
79
- const { props: l, slots: o, emit: a, proxy: i } = le(), { $q: u } = i, d = ot(l, u), m = T(null), { refocusTargetEl: g, refocusTarget: c } = en(l, m), y = Ol(l, on), C = f(
80
- () => l.val !== void 0 && Array.isArray(l.modelValue)
81
- ), r = f(() => {
82
- const A = $e(l.val);
83
- return C.value === !0 ? l.modelValue.findIndex((U) => $e(U) === A) : -1;
84
- }), v = f(() => C.value === !0 ? r.value !== -1 : $e(l.modelValue) === $e(l.trueValue)), _ = f(() => C.value === !0 ? r.value === -1 : $e(l.modelValue) === $e(l.falseValue)), S = f(
85
- () => v.value === !1 && _.value === !1
86
- ), P = f(() => l.disable === !0 ? -1 : l.tabindex || 0), E = f(
87
- () => `q-${e} cursor-pointer no-outline row inline no-wrap items-center` + (l.disable === !0 ? " disabled" : "") + (d.value === !0 ? ` q-${e}--dark` : "") + (l.dense === !0 ? ` q-${e}--dense` : "") + (l.leftLabel === !0 ? " reverse" : "")
88
- ), q = f(() => {
89
- const A = v.value === !0 ? "truthy" : _.value === !0 ? "falsy" : "indet", U = l.color !== void 0 && (l.keepColor === !0 || _.value !== !0) ? ` text-${l.color}` : "";
90
- return `q-${e}__inner relative-position non-selectable q-${e}__inner--${A}${U}`;
91
- }), R = f(() => {
92
- const A = { type: "checkbox" };
93
- return l.name !== void 0 && Object.assign(A, {
94
- // see https://vuejs.org/guide/extras/render-function.html#creating-vnodes (.prop)
95
- ".checked": v.value,
96
- "^checked": v.value === !0 ? "checked" : void 0,
97
- name: l.name,
98
- value: C.value === !0 ? l.val : l.trueValue
99
- }), A;
100
- }), D = tn(R), B = f(() => {
101
- const A = {
102
- tabindex: P.value,
103
- role: "checkbox",
104
- "aria-label": l.label,
105
- "aria-checked": S.value === !0 ? "mixed" : v.value === !0 ? "true" : "false"
106
- };
107
- return l.disable === !0 && (A["aria-disabled"] = "true"), A;
108
- });
109
- function L(A) {
110
- A !== void 0 && (ae(A), c(A)), l.disable !== !0 && a("update:modelValue", H(), A);
111
- }
112
- function H() {
113
- if (C.value === !0) {
114
- if (v.value === !0) {
115
- const A = l.modelValue.slice();
116
- return A.splice(r.value, 1), A;
117
- }
118
- return l.modelValue.concat([l.val]);
119
- }
120
- if (v.value === !0) {
121
- if (l.toggleOrder !== "ft" || l.toggleIndeterminate === !1)
122
- return l.falseValue;
123
- } else if (_.value === !0) {
124
- if (l.toggleOrder === "ft" || l.toggleIndeterminate === !1)
125
- return l.trueValue;
126
- } else
127
- return l.toggleOrder !== "ft" ? l.trueValue : l.falseValue;
128
- return l.indeterminateValue;
129
- }
130
- function Q(A) {
131
- (A.keyCode === 13 || A.keyCode === 32) && ae(A);
132
- }
133
- function G(A) {
134
- (A.keyCode === 13 || A.keyCode === 32) && L(A);
135
- }
136
- const oe = t(v, S);
137
- return Object.assign(i, { toggle: L }), () => {
138
- const A = oe();
139
- l.disable !== !0 && D(
140
- A,
141
- "unshift",
142
- ` q-${e}__native absolute q-ma-none q-pa-none`
143
- );
144
- const U = [
145
- h("div", {
146
- class: q.value,
147
- style: y.value,
148
- "aria-hidden": "true"
149
- }, A)
150
- ];
151
- g.value !== null && U.push(g.value);
152
- const ne = l.label !== void 0 ? Il(o.default, [l.label]) : Se(o.default);
153
- return ne !== void 0 && U.push(
154
- h("div", {
155
- class: `q-${e}__label q-anchor--skip`
156
- }, ne)
157
- ), h("div", {
158
- ref: m,
159
- class: E.value,
160
- ...B.value,
161
- onClick: L,
162
- onKeydown: Q,
163
- onKeyup: G
164
- }, U);
165
- };
166
- }
167
- const rn = () => h("div", {
168
- key: "svg",
169
- class: "q-checkbox__bg absolute"
170
- }, [
171
- h("svg", {
172
- class: "q-checkbox__svg fit absolute-full",
173
- viewBox: "0 0 24 24"
174
- }, [
175
- h("path", {
176
- class: "q-checkbox__truthy",
177
- fill: "none",
178
- d: "M1.73,12.91 8.1,19.28 22.79,4.59"
179
- }),
180
- h("path", {
181
- class: "q-checkbox__indet",
182
- d: "M4,14H20V10H4"
183
- })
184
- ])
185
- ]), sn = be({
186
- name: "QCheckbox",
187
- props: nn,
188
- emits: un,
189
- setup(e) {
190
- const t = rn();
191
- function l(o, a) {
192
- const i = f(
193
- () => (o.value === !0 ? e.checkedIcon : a.value === !0 ? e.indeterminateIcon : e.uncheckedIcon) || null
194
- );
195
- return () => i.value !== null ? [
196
- h("div", {
197
- key: "icon",
198
- class: "q-checkbox__icon-container absolute-full flex flex-center no-wrap"
199
- }, [
200
- h(Ae, {
201
- class: "q-checkbox__icon",
202
- name: i.value
203
- })
204
- ])
205
- ] : [t];
206
- }
207
- return an("checkbox", l);
208
- }
209
- }), pt = be({
210
- name: "QItemSection",
211
- props: {
212
- avatar: Boolean,
213
- thumbnail: Boolean,
214
- side: Boolean,
215
- top: Boolean,
216
- noWrap: Boolean
217
- },
218
- setup(e, { slots: t }) {
219
- const l = f(
220
- () => `q-item__section column q-item__section--${e.avatar === !0 || e.side === !0 || e.thumbnail === !0 ? "side" : "main"}` + (e.top === !0 ? " q-item__section--top justify-start" : " justify-center") + (e.avatar === !0 ? " q-item__section--avatar" : "") + (e.thumbnail === !0 ? " q-item__section--thumbnail" : "") + (e.noWrap === !0 ? " q-item__section--nowrap" : "")
221
- );
222
- return () => h("div", { class: l.value }, Se(t.default));
223
- }
224
- }), Nl = be({
225
- name: "QItemLabel",
226
- props: {
227
- overline: Boolean,
228
- caption: Boolean,
229
- header: Boolean,
230
- lines: [Number, String]
231
- },
232
- setup(e, { slots: t }) {
233
- const l = f(() => parseInt(e.lines, 10)), o = f(
234
- () => "q-item__label" + (e.overline === !0 ? " q-item__label--overline text-overline" : "") + (e.caption === !0 ? " q-item__label--caption text-caption" : "") + (e.header === !0 ? " q-item__label--header" : "") + (l.value === 1 ? " ellipsis" : "")
235
- ), a = f(() => e.lines !== void 0 && l.value > 1 ? {
236
- overflow: "hidden",
237
- display: "-webkit-box",
238
- "-webkit-box-orient": "vertical",
239
- "-webkit-line-clamp": l.value
240
- } : null);
241
- return () => h("div", {
242
- style: a.value,
243
- class: o.value
244
- }, Se(t.default));
245
- }
246
- }), Kl = be({
247
- name: "QItem",
248
- props: {
249
- ...lt,
250
- ...Io,
251
- tag: {
252
- type: String,
253
- default: "div"
254
- },
255
- active: {
256
- type: Boolean,
257
- default: null
258
- },
259
- clickable: Boolean,
260
- dense: Boolean,
261
- insetLevel: Number,
262
- tabindex: [String, Number],
263
- focused: Boolean,
264
- manualFocus: Boolean
265
- },
266
- emits: ["click", "keyup"],
267
- setup(e, { slots: t, emit: l }) {
268
- const { proxy: { $q: o } } = le(), a = ot(e, o), { hasLink: i, linkAttrs: u, linkClass: d, linkTag: m, navigateOnClick: g } = Lo(), c = T(null), y = T(null), C = f(
269
- () => e.clickable === !0 || i.value === !0 || e.tag === "label"
270
- ), r = f(
271
- () => e.disable !== !0 && C.value === !0
272
- ), v = f(
273
- () => "q-item q-item-type row no-wrap" + (e.dense === !0 ? " q-item--dense" : "") + (a.value === !0 ? " q-item--dark" : "") + (i.value === !0 && e.active === null ? d.value : e.active === !0 ? ` q-item--active${e.activeClass !== void 0 ? ` ${e.activeClass}` : ""}` : "") + (e.disable === !0 ? " disabled" : "") + (r.value === !0 ? " q-item--clickable q-link cursor-pointer " + (e.manualFocus === !0 ? "q-manual-focusable" : "q-focusable q-hoverable") + (e.focused === !0 ? " q-manual-focusable--focused" : "") : "")
274
- ), _ = f(() => e.insetLevel === void 0 ? null : {
275
- ["padding" + (o.lang.rtl === !0 ? "Right" : "Left")]: 16 + e.insetLevel * 56 + "px"
276
- });
277
- function S(q) {
278
- r.value === !0 && (y.value !== null && (q.qKeyEvent !== !0 && document.activeElement === c.value ? y.value.focus() : document.activeElement === y.value && c.value.focus()), g(q));
279
- }
280
- function P(q) {
281
- if (r.value === !0 && kt(q, [13, 32]) === !0) {
282
- ae(q), q.qKeyEvent = !0;
283
- const R = new MouseEvent("click", q);
284
- R.qKeyEvent = !0, c.value.dispatchEvent(R);
285
- }
286
- l("keyup", q);
287
- }
288
- function E() {
289
- const q = Oo(t.default, []);
290
- return r.value === !0 && q.unshift(
291
- h("div", { class: "q-focus-helper", tabindex: -1, ref: y })
292
- ), q;
293
- }
294
- return () => {
295
- const q = {
296
- ref: c,
297
- class: v.value,
298
- style: _.value,
299
- role: "listitem",
300
- onClick: S,
301
- onKeyup: P
302
- };
303
- return r.value === !0 ? (q.tabindex = e.tabindex || "0", Object.assign(q, u.value)) : C.value === !0 && (q["aria-disabled"] = "true"), h(
304
- m.value,
305
- q,
306
- E()
307
- );
308
- };
309
- }
310
- }), cl = (e) => e ? !0 : "Обовʼязкове поле";
311
- let zt, dt = 0;
312
- const ee = new Array(256);
313
- for (let e = 0; e < 256; e++)
314
- ee[e] = (e + 256).toString(16).substring(1);
315
- const cn = (() => {
316
- const e = typeof crypto < "u" ? crypto : typeof window < "u" ? window.crypto || window.msCrypto : void 0;
317
- if (e !== void 0) {
318
- if (e.randomBytes !== void 0)
319
- return e.randomBytes;
320
- if (e.getRandomValues !== void 0)
321
- return (t) => {
322
- const l = new Uint8Array(t);
323
- return e.getRandomValues(l), l;
324
- };
325
- }
326
- return (t) => {
327
- const l = [];
328
- for (let o = t; o > 0; o--)
329
- l.push(Math.floor(Math.random() * 256));
330
- return l;
331
- };
332
- })(), dl = 4096;
333
- function Dt() {
334
- (zt === void 0 || dt + 16 > dl) && (dt = 0, zt = cn(dl));
335
- const e = Array.prototype.slice.call(zt, dt, dt += 16);
336
- return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, ee[e[0]] + ee[e[1]] + ee[e[2]] + ee[e[3]] + "-" + ee[e[4]] + ee[e[5]] + "-" + ee[e[6]] + ee[e[7]] + "-" + ee[e[8]] + ee[e[9]] + "-" + ee[e[10]] + ee[e[11]] + ee[e[12]] + ee[e[13]] + ee[e[14]] + ee[e[15]];
337
- }
338
- function dn(e) {
339
- return e ?? null;
340
- }
341
- function fl(e, t) {
342
- return e ?? (t === !0 ? `f_${Dt()}` : null);
343
- }
344
- function fn({ getValue: e, required: t = !0 } = {}) {
345
- if (Zo.value === !0) {
346
- const l = e !== void 0 ? T(dn(e())) : T(null);
347
- return t === !0 && l.value === null && tt(() => {
348
- l.value = `f_${Dt()}`;
349
- }), e !== void 0 && K(e, (o) => {
350
- l.value = fl(o, t);
351
- }), l;
352
- }
353
- return e !== void 0 ? f(() => fl(e(), t)) : T(`f_${Dt()}`);
354
- }
355
- const vl = /^on[A-Z]/;
356
- function vn() {
357
- const { attrs: e, vnode: t } = le(), l = {
358
- listeners: T({}),
359
- attributes: T({})
360
- };
361
- function o() {
362
- const a = {}, i = {};
363
- for (const u in e)
364
- u !== "class" && u !== "style" && vl.test(u) === !1 && (a[u] = e[u]);
365
- for (const u in t.props)
366
- vl.test(u) === !0 && (i[u] = t.props[u]);
367
- l.attributes.value = a, l.listeners.value = i;
368
- }
369
- return Ml(o), o(), l;
370
- }
371
- const mn = "_q_fo_";
372
- function hn({ validate: e, resetValidation: t, requiresQForm: l }) {
373
- const o = _o(mn, !1);
374
- if (o !== !1) {
375
- const { props: a, proxy: i } = le();
376
- Object.assign(i, { validate: e, resetValidation: t }), K(() => a.disable, (u) => {
377
- u === !0 ? (typeof t == "function" && t(), o.unbindComponent(i)) : o.bindComponent(i);
378
- }), tt(() => {
379
- a.disable !== !0 && o.bindComponent(i);
380
- }), ce(() => {
381
- a.disable !== !0 && o.unbindComponent(i);
382
- });
383
- } else l === !0 && console.error("Parent QForm not found on useFormChild()!");
384
- }
385
- const ml = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/, hl = /^#[0-9a-fA-F]{4}([0-9a-fA-F]{4})?$/, gl = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, ft = /^rgb\(((0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5]),){2}(0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5])\)$/, vt = /^rgba\(((0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5]),){2}(0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5]),(0|0\.[0-9]+[1-9]|0\.[1-9]+|1)\)$/, Ft = {
386
- date: (e) => /^-?[\d]+\/[0-1]\d\/[0-3]\d$/.test(e),
387
- time: (e) => /^([0-1]?\d|2[0-3]):[0-5]\d$/.test(e),
388
- fulltime: (e) => /^([0-1]?\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(e),
389
- timeOrFulltime: (e) => /^([0-1]?\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/.test(e),
390
- // -- RFC 5322 --
391
- // -- Added in v2.6.6 --
392
- // This is a basic helper validation.
393
- // For something more complex (like RFC 822) you should write and use your own rule.
394
- // We won't be accepting PRs to enhance the one below because of the reason above.
395
- // eslint-disable-next-line
396
- email: (e) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e),
397
- hexColor: (e) => ml.test(e),
398
- hexaColor: (e) => hl.test(e),
399
- hexOrHexaColor: (e) => gl.test(e),
400
- rgbColor: (e) => ft.test(e),
401
- rgbaColor: (e) => vt.test(e),
402
- rgbOrRgbaColor: (e) => ft.test(e) || vt.test(e),
403
- hexOrRgbColor: (e) => ml.test(e) || ft.test(e),
404
- hexaOrRgbaColor: (e) => hl.test(e) || vt.test(e),
405
- anyColor: (e) => gl.test(e) || ft.test(e) || vt.test(e)
406
- };
407
- function Ql(e, t = 250, l) {
408
- let o = null;
409
- function a() {
410
- const i = arguments, u = () => {
411
- o = null, l !== !0 && e.apply(this, i);
412
- };
413
- o !== null ? clearTimeout(o) : l === !0 && e.apply(this, i), o = setTimeout(u, t);
414
- }
415
- return a.cancel = () => {
416
- o !== null && clearTimeout(o);
417
- }, a;
418
- }
419
- const gn = [!0, !1, "ondemand"], pn = {
420
- modelValue: {},
421
- error: {
422
- type: Boolean,
423
- default: null
424
- },
425
- errorMessage: String,
426
- noErrorIcon: Boolean,
427
- rules: Array,
428
- reactiveRules: Boolean,
429
- lazyRules: {
430
- type: [Boolean, String],
431
- default: !1,
432
- // statement unneeded but avoids future vue implementation changes
433
- validator: (e) => gn.includes(e)
434
- }
435
- };
436
- function bn(e, t) {
437
- const { props: l, proxy: o } = le(), a = T(!1), i = T(null), u = T(!1);
438
- hn({ validate: _, resetValidation: v });
439
- let d = 0, m;
440
- const g = f(
441
- () => l.rules !== void 0 && l.rules !== null && l.rules.length !== 0
442
- ), c = f(() => l.disable !== !0 && g.value === !0 && t.value === !1), y = f(
443
- () => l.error === !0 || a.value === !0
444
- ), C = f(() => typeof l.errorMessage == "string" && l.errorMessage.length !== 0 ? l.errorMessage : i.value);
445
- K(() => l.modelValue, () => {
446
- u.value = !0, c.value === !0 && l.lazyRules === !1 && S();
447
- });
448
- function r() {
449
- l.lazyRules !== "ondemand" && c.value === !0 && u.value === !0 && S();
450
- }
451
- K(() => l.reactiveRules, (P) => {
452
- P === !0 ? m === void 0 && (m = K(() => l.rules, r, { immediate: !0, deep: !0 })) : m !== void 0 && (m(), m = void 0);
453
- }, { immediate: !0 }), K(() => l.lazyRules, r), K(e, (P) => {
454
- P === !0 ? u.value = !0 : c.value === !0 && l.lazyRules !== "ondemand" && S();
455
- });
456
- function v() {
457
- d++, t.value = !1, u.value = !1, a.value = !1, i.value = null, S.cancel();
458
- }
459
- function _(P = l.modelValue) {
460
- if (l.disable === !0 || g.value === !1)
461
- return !0;
462
- const E = ++d, q = t.value !== !0 ? () => {
463
- u.value = !0;
464
- } : () => {
465
- }, R = (B, L) => {
466
- B === !0 && q(), a.value = B, i.value = L || null, t.value = !1;
467
- }, D = [];
468
- for (let B = 0; B < l.rules.length; B++) {
469
- const L = l.rules[B];
470
- let H;
471
- if (typeof L == "function" ? H = L(P, Ft) : typeof L == "string" && Ft[L] !== void 0 && (H = Ft[L](P)), H === !1 || typeof H == "string")
472
- return R(!0, H), !1;
473
- H !== !0 && H !== void 0 && D.push(H);
474
- }
475
- return D.length === 0 ? (R(!1), !0) : (t.value = !0, Promise.all(D).then(
476
- (B) => {
477
- if (B === void 0 || Array.isArray(B) === !1 || B.length === 0)
478
- return E === d && R(!1), !0;
479
- const L = B.find((H) => H === !1 || typeof H == "string");
480
- return E === d && R(L !== void 0, L), L === void 0;
481
- },
482
- (B) => (E === d && (console.error(B), R(!0)), !1)
483
- ));
484
- }
485
- const S = Ql(_, 0);
486
- return ce(() => {
487
- m !== void 0 && m(), S.cancel();
488
- }), Object.assign(o, { resetValidation: v, validate: _ }), Dl(o, "hasError", () => y.value), {
489
- isDirtyModel: u,
490
- hasRules: g,
491
- hasError: y,
492
- errorMessage: C,
493
- validate: _,
494
- resetValidation: v
495
- };
496
- }
497
- let Be = [], et = [];
498
- function Ul(e) {
499
- et = et.filter((t) => t !== e);
500
- }
501
- function yn(e) {
502
- Ul(e), et.push(e);
503
- }
504
- function pl(e) {
505
- Ul(e), et.length === 0 && Be.length !== 0 && (Be[Be.length - 1](), Be = []);
506
- }
507
- function Nt(e) {
508
- et.length === 0 ? e() : Be.push(e);
509
- }
510
- function Sn(e) {
511
- Be = Be.filter((t) => t !== e);
512
- }
513
- function Wt(e) {
514
- return e != null && ("" + e).length !== 0;
515
- }
516
- const wn = {
517
- ...lt,
518
- ...pn,
519
- label: String,
520
- stackLabel: Boolean,
521
- hint: String,
522
- hideHint: Boolean,
523
- prefix: String,
524
- suffix: String,
525
- labelColor: String,
526
- color: String,
527
- bgColor: String,
528
- filled: Boolean,
529
- outlined: Boolean,
530
- borderless: Boolean,
531
- standout: [Boolean, String],
532
- square: Boolean,
533
- loading: Boolean,
534
- labelSlot: Boolean,
535
- bottomSlots: Boolean,
536
- hideBottomSpace: Boolean,
537
- rounded: Boolean,
538
- dense: Boolean,
539
- itemAligned: Boolean,
540
- counter: Boolean,
541
- clearable: Boolean,
542
- clearIcon: String,
543
- disable: Boolean,
544
- readonly: Boolean,
545
- autofocus: Boolean,
546
- for: String
547
- }, Kt = {
548
- ...wn,
549
- maxlength: [Number, String]
550
- }, Xl = ["update:modelValue", "clear", "focus", "blur"];
551
- function Yl({ requiredForAttr: e = !0, tagProp: t, changeEvent: l = !1 } = {}) {
552
- const { props: o, proxy: a } = le(), i = ot(o, a.$q), u = fn({
553
- required: e,
554
- getValue: () => o.for
555
- });
556
- return {
557
- requiredForAttr: e,
558
- changeEvent: l,
559
- tag: t === !0 ? f(() => o.tag) : { value: "label" },
560
- isDark: i,
561
- editable: f(
562
- () => o.disable !== !0 && o.readonly !== !0
563
- ),
564
- innerLoading: T(!1),
565
- focused: T(!1),
566
- hasPopupOpen: !1,
567
- splitAttrs: vn(),
568
- targetUid: u,
569
- rootRef: T(null),
570
- targetRef: T(null),
571
- controlRef: T(null)
572
- /**
573
- * user supplied additionals:
574
-
575
- * innerValue - computed
576
- * floatingLabel - computed
577
- * inputRef - computed
578
-
579
- * fieldClass - computed
580
- * hasShadow - computed
581
-
582
- * controlEvents - Object with fn(e)
583
-
584
- * getControl - fn
585
- * getInnerAppend - fn
586
- * getControlChild - fn
587
- * getShadowControl - fn
588
- * showPopup - fn
589
- */
590
- };
591
- }
592
- function Gl(e) {
593
- const { props: t, emit: l, slots: o, attrs: a, proxy: i } = le(), { $q: u } = i;
594
- let d = null;
595
- e.hasValue === void 0 && (e.hasValue = f(() => Wt(t.modelValue))), e.emitValue === void 0 && (e.emitValue = (k) => {
596
- l("update:modelValue", k);
597
- }), e.controlEvents === void 0 && (e.controlEvents = {
598
- onFocusin: Q,
599
- onFocusout: G
600
- }), Object.assign(e, {
601
- clearValue: oe,
602
- onControlFocusin: Q,
603
- onControlFocusout: G,
604
- focus: L
605
- }), e.computedCounter === void 0 && (e.computedCounter = f(() => {
606
- if (t.counter !== !1) {
607
- const k = typeof t.modelValue == "string" || typeof t.modelValue == "number" ? ("" + t.modelValue).length : Array.isArray(t.modelValue) === !0 ? t.modelValue.length : 0, M = t.maxlength !== void 0 ? t.maxlength : t.maxValues;
608
- return k + (M !== void 0 ? " / " + M : "");
609
- }
610
- }));
611
- const {
612
- isDirtyModel: m,
613
- hasRules: g,
614
- hasError: c,
615
- errorMessage: y,
616
- resetValidation: C
617
- } = bn(e.focused, e.innerLoading), r = e.floatingLabel !== void 0 ? f(() => t.stackLabel === !0 || e.focused.value === !0 || e.floatingLabel.value === !0) : f(() => t.stackLabel === !0 || e.focused.value === !0 || e.hasValue.value === !0), v = f(
618
- () => t.bottomSlots === !0 || t.hint !== void 0 || g.value === !0 || t.counter === !0 || t.error !== null
619
- ), _ = f(() => t.filled === !0 ? "filled" : t.outlined === !0 ? "outlined" : t.borderless === !0 ? "borderless" : t.standout ? "standout" : "standard"), S = f(
620
- () => `q-field row no-wrap items-start q-field--${_.value}` + (e.fieldClass !== void 0 ? ` ${e.fieldClass.value}` : "") + (t.rounded === !0 ? " q-field--rounded" : "") + (t.square === !0 ? " q-field--square" : "") + (r.value === !0 ? " q-field--float" : "") + (E.value === !0 ? " q-field--labeled" : "") + (t.dense === !0 ? " q-field--dense" : "") + (t.itemAligned === !0 ? " q-field--item-aligned q-item-type" : "") + (e.isDark.value === !0 ? " q-field--dark" : "") + (e.getControl === void 0 ? " q-field--auto-height" : "") + (e.focused.value === !0 ? " q-field--focused" : "") + (c.value === !0 ? " q-field--error" : "") + (c.value === !0 || e.focused.value === !0 ? " q-field--highlighted" : "") + (t.hideBottomSpace !== !0 && v.value === !0 ? " q-field--with-bottom" : "") + (t.disable === !0 ? " q-field--disabled" : t.readonly === !0 ? " q-field--readonly" : "")
621
- ), P = f(
622
- () => "q-field__control relative-position row no-wrap" + (t.bgColor !== void 0 ? ` bg-${t.bgColor}` : "") + (c.value === !0 ? " text-negative" : typeof t.standout == "string" && t.standout.length !== 0 && e.focused.value === !0 ? ` ${t.standout}` : t.color !== void 0 ? ` text-${t.color}` : "")
623
- ), E = f(
624
- () => t.labelSlot === !0 || t.label !== void 0
625
- ), q = f(
626
- () => "q-field__label no-pointer-events absolute ellipsis" + (t.labelColor !== void 0 && c.value !== !0 ? ` text-${t.labelColor}` : "")
627
- ), R = f(() => ({
628
- id: e.targetUid.value,
629
- editable: e.editable.value,
630
- focused: e.focused.value,
631
- floatingLabel: r.value,
632
- modelValue: t.modelValue,
633
- emitValue: e.emitValue
634
- })), D = f(() => {
635
- const k = {};
636
- return e.targetUid.value && (k.for = e.targetUid.value), t.disable === !0 && (k["aria-disabled"] = "true"), k;
637
- });
638
- function B() {
639
- const k = document.activeElement;
640
- let M = e.targetRef !== void 0 && e.targetRef.value;
641
- M && (k === null || k.id !== e.targetUid.value) && (M.hasAttribute("tabindex") === !0 || (M = M.querySelector("[tabindex]")), M && M !== k && M.focus({ preventScroll: !0 }));
642
- }
643
- function L() {
644
- Nt(B);
645
- }
646
- function H() {
647
- Sn(B);
648
- const k = document.activeElement;
649
- k !== null && e.rootRef.value.contains(k) && k.blur();
650
- }
651
- function Q(k) {
652
- d !== null && (clearTimeout(d), d = null), e.editable.value === !0 && e.focused.value === !1 && (e.focused.value = !0, l("focus", k));
653
- }
654
- function G(k, M) {
655
- d !== null && clearTimeout(d), d = setTimeout(() => {
656
- d = null, !(document.hasFocus() === !0 && (e.hasPopupOpen === !0 || e.controlRef === void 0 || e.controlRef.value === null || e.controlRef.value.contains(document.activeElement) !== !1)) && (e.focused.value === !0 && (e.focused.value = !1, l("blur", k)), M !== void 0 && M());
657
- });
658
- }
659
- function oe(k) {
660
- ae(k), u.platform.is.mobile !== !0 ? (e.targetRef !== void 0 && e.targetRef.value || e.rootRef.value).focus() : e.rootRef.value.contains(document.activeElement) === !0 && document.activeElement.blur(), t.type === "file" && (e.inputRef.value.value = null), l("update:modelValue", null), e.changeEvent === !0 && l("change", null), l("clear", t.modelValue), ue(() => {
661
- const M = m.value;
662
- C(), m.value = M;
663
- });
664
- }
665
- function A(k) {
666
- [13, 32].includes(k.keyCode) && oe(k);
667
- }
668
- function U() {
669
- const k = [];
670
- return o.prepend !== void 0 && k.push(
671
- h("div", {
672
- class: "q-field__prepend q-field__marginal row no-wrap items-center",
673
- key: "prepend",
674
- onClick: pe
675
- }, o.prepend())
676
- ), k.push(
677
- h("div", {
678
- class: "q-field__control-container col relative-position row no-wrap q-anchor--skip"
679
- }, ne())
680
- ), c.value === !0 && t.noErrorIcon === !1 && k.push(
681
- X("error", [
682
- h(Ae, { name: u.iconSet.field.error, color: "negative" })
683
- ])
684
- ), t.loading === !0 || e.innerLoading.value === !0 ? k.push(
685
- X(
686
- "inner-loading-append",
687
- o.loading !== void 0 ? o.loading() : [h(Ho, { color: t.color })]
688
- )
689
- ) : t.clearable === !0 && e.hasValue.value === !0 && e.editable.value === !0 && k.push(
690
- X("inner-clearable-append", [
691
- h(Ae, {
692
- class: "q-field__focusable-action",
693
- name: t.clearIcon || u.iconSet.field.clear,
694
- tabindex: 0,
695
- role: "button",
696
- "aria-hidden": "false",
697
- "aria-label": u.lang.label.clear,
698
- onKeyup: A,
699
- onClick: oe
700
- })
701
- ])
702
- ), o.append !== void 0 && k.push(
703
- h("div", {
704
- class: "q-field__append q-field__marginal row no-wrap items-center",
705
- key: "append",
706
- onClick: pe
707
- }, o.append())
708
- ), e.getInnerAppend !== void 0 && k.push(
709
- X("inner-append", e.getInnerAppend())
710
- ), e.getControlChild !== void 0 && k.push(
711
- e.getControlChild()
712
- ), k;
713
- }
714
- function ne() {
715
- const k = [];
716
- return t.prefix !== void 0 && t.prefix !== null && k.push(
717
- h("div", {
718
- class: "q-field__prefix no-pointer-events row items-center"
719
- }, t.prefix)
720
- ), e.getShadowControl !== void 0 && e.hasShadow.value === !0 && k.push(
721
- e.getShadowControl()
722
- ), e.getControl !== void 0 ? k.push(e.getControl()) : o.rawControl !== void 0 ? k.push(o.rawControl()) : o.control !== void 0 && k.push(
723
- h("div", {
724
- ref: e.targetRef,
725
- class: "q-field__native row",
726
- tabindex: -1,
727
- ...e.splitAttrs.attributes.value,
728
- "data-autofocus": t.autofocus === !0 || void 0
729
- }, o.control(R.value))
730
- ), E.value === !0 && k.push(
731
- h("div", {
732
- class: q.value
733
- }, Se(o.label, t.label))
734
- ), t.suffix !== void 0 && t.suffix !== null && k.push(
735
- h("div", {
736
- class: "q-field__suffix no-pointer-events row items-center"
737
- }, t.suffix)
738
- ), k.concat(Se(o.default));
739
- }
740
- function te() {
741
- let k, M;
742
- c.value === !0 ? y.value !== null ? (k = [h("div", { role: "alert" }, y.value)], M = `q--slot-error-${y.value}`) : (k = Se(o.error), M = "q--slot-error") : (t.hideHint !== !0 || e.focused.value === !0) && (t.hint !== void 0 ? (k = [h("div", t.hint)], M = `q--slot-hint-${t.hint}`) : (k = Se(o.hint), M = "q--slot-hint"));
743
- const se = t.counter === !0 || o.counter !== void 0;
744
- if (t.hideBottomSpace === !0 && se === !1 && k === void 0)
745
- return;
746
- const s = h("div", {
747
- key: M,
748
- class: "q-field__messages col"
749
- }, k);
750
- return h("div", {
751
- class: "q-field__bottom row items-start q-field__bottom--" + (t.hideBottomSpace !== !0 ? "animated" : "stale"),
752
- onClick: pe
753
- }, [
754
- t.hideBottomSpace === !0 ? s : h(bt, { name: "q-transition--field-message" }, () => s),
755
- se === !0 ? h("div", {
756
- class: "q-field__counter"
757
- }, o.counter !== void 0 ? o.counter() : e.computedCounter.value) : null
758
- ]);
759
- }
760
- function X(k, M) {
761
- return M === null ? null : h("div", {
762
- key: k,
763
- class: "q-field__append q-field__marginal row no-wrap items-center q-anchor--skip"
764
- }, M);
765
- }
766
- let re = !1;
767
- return Ct(() => {
768
- re = !0;
769
- }), Ll(() => {
770
- re === !0 && t.autofocus === !0 && i.focus();
771
- }), t.autofocus === !0 && tt(() => {
772
- i.focus();
773
- }), ce(() => {
774
- d !== null && clearTimeout(d);
775
- }), Object.assign(i, { focus: L, blur: H }), function() {
776
- const M = e.getControl === void 0 && o.control === void 0 ? {
777
- ...e.splitAttrs.attributes.value,
778
- "data-autofocus": t.autofocus === !0 || void 0,
779
- ...D.value
780
- } : D.value;
781
- return h(e.tag.value, {
782
- ref: e.rootRef,
783
- class: [
784
- S.value,
785
- a.class
786
- ],
787
- style: a.style,
788
- ...M
789
- }, [
790
- o.before !== void 0 ? h("div", {
791
- class: "q-field__before q-field__marginal row no-wrap items-center",
792
- onClick: pe
793
- }, o.before()) : null,
794
- h("div", {
795
- class: "q-field__inner relative-position col self-stretch"
796
- }, [
797
- h("div", {
798
- ref: e.controlRef,
799
- class: P.value,
800
- tabindex: -1,
801
- ...e.controlEvents
802
- }, U()),
803
- v.value === !0 ? te() : null
804
- ]),
805
- o.after !== void 0 ? h("div", {
806
- class: "q-field__after q-field__marginal row no-wrap items-center",
807
- onClick: pe
808
- }, o.after()) : null
809
- ]);
810
- };
811
- }
812
- const xn = be({
813
- name: "QField",
814
- inheritAttrs: !1,
815
- props: {
816
- ...Kt,
817
- tag: {
818
- type: String,
819
- default: "label"
820
- }
821
- },
822
- emits: Xl,
823
- setup() {
824
- return Gl(
825
- Yl({ tagProp: !0 })
826
- );
827
- }
828
- }), Cn = {
829
- xs: 8,
830
- sm: 10,
831
- md: 14,
832
- lg: 20,
833
- xl: 24
834
- }, kn = be({
835
- name: "QChip",
836
- props: {
837
- ...lt,
838
- ...Hl,
839
- dense: Boolean,
840
- icon: String,
841
- iconRight: String,
842
- iconRemove: String,
843
- iconSelected: String,
844
- label: [String, Number],
845
- color: String,
846
- textColor: String,
847
- modelValue: {
848
- type: Boolean,
849
- default: !0
850
- },
851
- selected: {
852
- type: Boolean,
853
- default: null
854
- },
855
- square: Boolean,
856
- outline: Boolean,
857
- clickable: Boolean,
858
- removable: Boolean,
859
- removeAriaLabel: String,
860
- tabindex: [String, Number],
861
- disable: Boolean,
862
- ripple: {
863
- type: [Boolean, Object],
864
- default: !0
865
- }
866
- },
867
- emits: ["update:modelValue", "update:selected", "remove", "click"],
868
- setup(e, { slots: t, emit: l }) {
869
- const { proxy: { $q: o } } = le(), a = ot(e, o), i = Ol(e, Cn), u = f(() => e.selected === !0 || e.icon !== void 0), d = f(() => e.selected === !0 ? e.iconSelected || o.iconSet.chip.selected : e.icon), m = f(() => e.iconRemove || o.iconSet.chip.remove), g = f(
870
- () => e.disable === !1 && (e.clickable === !0 || e.selected !== null)
871
- ), c = f(() => {
872
- const S = e.outline === !0 && e.color || e.textColor;
873
- return "q-chip row inline no-wrap items-center" + (e.outline === !1 && e.color !== void 0 ? ` bg-${e.color}` : "") + (S ? ` text-${S} q-chip--colored` : "") + (e.disable === !0 ? " disabled" : "") + (e.dense === !0 ? " q-chip--dense" : "") + (e.outline === !0 ? " q-chip--outline" : "") + (e.selected === !0 ? " q-chip--selected" : "") + (g.value === !0 ? " q-chip--clickable cursor-pointer non-selectable q-hoverable" : "") + (e.square === !0 ? " q-chip--square" : "") + (a.value === !0 ? " q-chip--dark q-dark" : "");
874
- }), y = f(() => {
875
- const S = e.disable === !0 ? { tabindex: -1, "aria-disabled": "true" } : { tabindex: e.tabindex || 0 }, P = {
876
- ...S,
877
- role: "button",
878
- "aria-hidden": "false",
879
- "aria-label": e.removeAriaLabel || o.lang.label.remove
880
- };
881
- return { chip: S, remove: P };
882
- });
883
- function C(S) {
884
- S.keyCode === 13 && r(S);
885
- }
886
- function r(S) {
887
- e.disable || (l("update:selected", !e.selected), l("click", S));
888
- }
889
- function v(S) {
890
- (S.keyCode === void 0 || S.keyCode === 13) && (ae(S), e.disable === !1 && (l("update:modelValue", !1), l("remove")));
891
- }
892
- function _() {
893
- const S = [];
894
- g.value === !0 && S.push(
895
- h("div", { class: "q-focus-helper" })
896
- ), u.value === !0 && S.push(
897
- h(Ae, {
898
- class: "q-chip__icon q-chip__icon--left",
899
- name: d.value
900
- })
901
- );
902
- const P = e.label !== void 0 ? [h("div", { class: "ellipsis" }, [e.label])] : void 0;
903
- return S.push(
904
- h("div", {
905
- class: "q-chip__content col row no-wrap items-center q-anchor--skip"
906
- }, Do(t.default, P))
907
- ), e.iconRight && S.push(
908
- h(Ae, {
909
- class: "q-chip__icon q-chip__icon--right",
910
- name: e.iconRight
911
- })
912
- ), e.removable === !0 && S.push(
913
- h(Ae, {
914
- class: "q-chip__icon q-chip__icon--remove cursor-pointer",
915
- name: m.value,
916
- ...y.value.remove,
917
- onClick: v,
918
- onKeyup: v
919
- })
920
- ), S;
921
- }
922
- return () => {
923
- if (e.modelValue === !1) return;
924
- const S = {
925
- class: c.value,
926
- style: i.value
927
- };
928
- return g.value === !0 && Object.assign(
929
- S,
930
- y.value.chip,
931
- { onClick: r, onKeyup: C }
932
- ), $o(
933
- "div",
934
- S,
935
- _(),
936
- "ripple",
937
- e.ripple !== !1 && e.disable !== !0,
938
- () => [[Po, e.ripple]]
939
- );
940
- };
941
- }
942
- });
943
- function qn() {
944
- if (window.getSelection !== void 0) {
945
- const e = window.getSelection();
946
- e.empty !== void 0 ? e.empty() : e.removeAllRanges !== void 0 && (e.removeAllRanges(), Jo.is.mobile !== !0 && e.addRange(document.createRange()));
947
- } else document.selection !== void 0 && document.selection.empty();
948
- }
949
- const Vn = {
950
- /* SSR does not know about Element */
951
- target: {
952
- type: [Boolean, String, Element],
953
- default: !0
954
- },
955
- noParentEvent: Boolean
956
- }, _n = {
957
- ...Vn,
958
- contextMenu: Boolean
959
- };
960
- function En({
961
- showing: e,
962
- avoidEmit: t,
963
- // required for QPopupProxy (true)
964
- configureAnchorEl: l
965
- // optional
966
- }) {
967
- const { props: o, proxy: a, emit: i } = le(), u = T(null);
968
- let d = null;
969
- function m(r) {
970
- return u.value === null ? !1 : r === void 0 || r.touches === void 0 || r.touches.length <= 1;
971
- }
972
- const g = {};
973
- l === void 0 && (Object.assign(g, {
974
- hide(r) {
975
- a.hide(r);
976
- },
977
- toggle(r) {
978
- a.toggle(r), r.qAnchorHandled = !0;
979
- },
980
- toggleKey(r) {
981
- kt(r, 13) === !0 && g.toggle(r);
982
- },
983
- contextClick(r) {
984
- a.hide(r), pe(r), ue(() => {
985
- a.show(r), r.qAnchorHandled = !0;
986
- });
987
- },
988
- prevent: pe,
989
- mobileTouch(r) {
990
- if (g.mobileCleanup(r), m(r) !== !0)
991
- return;
992
- a.hide(r), u.value.classList.add("non-selectable");
993
- const v = r.target;
994
- rl(g, "anchor", [
995
- [v, "touchmove", "mobileCleanup", "passive"],
996
- [v, "touchend", "mobileCleanup", "passive"],
997
- [v, "touchcancel", "mobileCleanup", "passive"],
998
- [u.value, "contextmenu", "prevent", "notPassive"]
999
- ]), d = setTimeout(() => {
1000
- d = null, a.show(r), r.qAnchorHandled = !0;
1001
- }, 300);
1002
- },
1003
- mobileCleanup(r) {
1004
- u.value.classList.remove("non-selectable"), d !== null && (clearTimeout(d), d = null), e.value === !0 && r !== void 0 && qn();
1005
- }
1006
- }), l = function(r = o.contextMenu) {
1007
- if (o.noParentEvent === !0 || u.value === null) return;
1008
- let v;
1009
- r === !0 ? a.$q.platform.is.mobile === !0 ? v = [
1010
- [u.value, "touchstart", "mobileTouch", "passive"]
1011
- ] : v = [
1012
- [u.value, "mousedown", "hide", "passive"],
1013
- [u.value, "contextmenu", "contextClick", "notPassive"]
1014
- ] : v = [
1015
- [u.value, "click", "toggle", "passive"],
1016
- [u.value, "keyup", "toggleKey", "passive"]
1017
- ], rl(g, "anchor", v);
1018
- });
1019
- function c() {
1020
- Wo(g, "anchor");
1021
- }
1022
- function y(r) {
1023
- for (u.value = r; u.value.classList.contains("q-anchor--skip"); )
1024
- u.value = u.value.parentNode;
1025
- l();
1026
- }
1027
- function C() {
1028
- if (o.target === !1 || o.target === "" || a.$el.parentNode === null)
1029
- u.value = null;
1030
- else if (o.target === !0)
1031
- y(a.$el.parentNode);
1032
- else {
1033
- let r = o.target;
1034
- if (typeof o.target == "string")
1035
- try {
1036
- r = document.querySelector(o.target);
1037
- } catch {
1038
- r = void 0;
1039
- }
1040
- r != null ? (u.value = r.$el || r, l()) : (u.value = null, console.error(`Anchor: target "${o.target}" not found`));
1041
- }
1042
- }
1043
- return K(() => o.contextMenu, (r) => {
1044
- u.value !== null && (c(), l(r));
1045
- }), K(() => o.target, () => {
1046
- u.value !== null && c(), C();
1047
- }), K(() => o.noParentEvent, (r) => {
1048
- u.value !== null && (r === !0 ? c() : l());
1049
- }), tt(() => {
1050
- C(), t !== !0 && o.modelValue === !0 && u.value === null && i("update:modelValue", !1);
1051
- }), ce(() => {
1052
- d !== null && clearTimeout(d), c();
1053
- }), {
1054
- anchorEl: u,
1055
- canShow: m,
1056
- anchorEvents: g
1057
- };
1058
- }
1059
- function Bn(e, t) {
1060
- const l = T(null);
1061
- let o;
1062
- function a(d, m) {
1063
- const g = `${m !== void 0 ? "add" : "remove"}EventListener`, c = m !== void 0 ? m : o;
1064
- d !== window && d[g]("scroll", c, ge.passive), window[g]("scroll", c, ge.passive), o = m;
1065
- }
1066
- function i() {
1067
- l.value !== null && (a(l.value), l.value = null);
1068
- }
1069
- const u = K(() => e.noParentEvent, () => {
1070
- l.value !== null && (i(), t());
1071
- });
1072
- return ce(u), {
1073
- localScrollTarget: l,
1074
- unconfigureScrollTarget: i,
1075
- changeScrollEvent: a
1076
- };
1077
- }
1078
- const Zl = {
1079
- modelValue: {
1080
- type: Boolean,
1081
- default: null
1082
- },
1083
- "onUpdate:modelValue": [Function, Array]
1084
- }, Jl = [
1085
- "beforeShow",
1086
- "show",
1087
- "beforeHide",
1088
- "hide"
1089
- ];
1090
- function eo({
1091
- showing: e,
1092
- canShow: t,
1093
- // optional
1094
- hideOnRouteChange: l,
1095
- // optional
1096
- handleShow: o,
1097
- // optional
1098
- handleHide: a,
1099
- // optional
1100
- processOnMount: i
1101
- // optional
1102
- }) {
1103
- const u = le(), { props: d, emit: m, proxy: g } = u;
1104
- let c;
1105
- function y(E) {
1106
- e.value === !0 ? v(E) : C(E);
1107
- }
1108
- function C(E) {
1109
- if (d.disable === !0 || E !== void 0 && E.qAnchorHandled === !0 || t !== void 0 && t(E) !== !0)
1110
- return;
1111
- const q = d["onUpdate:modelValue"] !== void 0;
1112
- q === !0 && (m("update:modelValue", !0), c = E, ue(() => {
1113
- c === E && (c = void 0);
1114
- })), (d.modelValue === null || q === !1) && r(E);
1115
- }
1116
- function r(E) {
1117
- e.value !== !0 && (e.value = !0, m("beforeShow", E), o !== void 0 ? o(E) : m("show", E));
1118
- }
1119
- function v(E) {
1120
- if (d.disable === !0)
1121
- return;
1122
- const q = d["onUpdate:modelValue"] !== void 0;
1123
- q === !0 && (m("update:modelValue", !1), c = E, ue(() => {
1124
- c === E && (c = void 0);
1125
- })), (d.modelValue === null || q === !1) && _(E);
1126
- }
1127
- function _(E) {
1128
- e.value !== !1 && (e.value = !1, m("beforeHide", E), a !== void 0 ? a(E) : m("hide", E));
1129
- }
1130
- function S(E) {
1131
- d.disable === !0 && E === !0 ? d["onUpdate:modelValue"] !== void 0 && m("update:modelValue", !1) : E === !0 !== e.value && (E === !0 ? r : _)(c);
1132
- }
1133
- K(() => d.modelValue, S), l !== void 0 && jo(u) === !0 && K(() => g.$route.fullPath, () => {
1134
- l.value === !0 && e.value === !0 && v();
1135
- }), tt(() => {
1136
- S(d.modelValue);
1137
- });
1138
- const P = { show: C, hide: v, toggle: y };
1139
- return Object.assign(g, P), P;
1140
- }
1141
- const bl = {};
1142
- let An = 1, Tn = document.body;
1143
- function Rn(e, t) {
1144
- const l = document.createElement("div");
1145
- if (l.id = t !== void 0 ? `q-portal--${t}--${An++}` : e, bl.globalNodes !== void 0) {
1146
- const o = bl.globalNodes.class;
1147
- o !== void 0 && (l.className = o);
1148
- }
1149
- return Tn.appendChild(l), l;
1150
- }
1151
- function zn(e) {
1152
- e.remove();
1153
- }
1154
- const Je = [];
1155
- function Fn(e, t) {
1156
- do {
1157
- if (e.$options.name === "QMenu") {
1158
- if (e.hide(t), e.$props.separateClosePopup === !0)
1159
- return Rt(e);
1160
- } else if (e.__qPortal === !0) {
1161
- const l = Rt(e);
1162
- return l !== void 0 && l.$options.name === "QPopupProxy" ? (e.hide(t), l) : e;
1163
- }
1164
- e = Rt(e);
1165
- } while (e != null);
1166
- }
1167
- const Mn = be({
1168
- name: "QPortal",
1169
- setup(e, { slots: t }) {
1170
- return () => t.default();
1171
- }
1172
- });
1173
- function Ln(e) {
1174
- for (e = e.parent; e != null; ) {
1175
- if (e.type.name === "QGlobalDialog")
1176
- return !0;
1177
- if (e.type.name === "QDialog" || e.type.name === "QMenu")
1178
- return !1;
1179
- e = e.parent;
1180
- }
1181
- return !1;
1182
- }
1183
- function to(e, t, l, o) {
1184
- const a = T(!1), i = T(!1);
1185
- let u = null;
1186
- const d = {}, m = o === "dialog" && Ln(e);
1187
- function g(y) {
1188
- if (y === !0) {
1189
- pl(d), i.value = !0;
1190
- return;
1191
- }
1192
- i.value = !1, a.value === !1 && (m === !1 && u === null && (u = Rn(!1, o)), a.value = !0, Je.push(e.proxy), yn(d));
1193
- }
1194
- function c(y) {
1195
- if (i.value = !1, y !== !0) return;
1196
- pl(d), a.value = !1;
1197
- const C = Je.indexOf(e.proxy);
1198
- C !== -1 && Je.splice(C, 1), u !== null && (zn(u), u = null);
1199
- }
1200
- return Eo(() => {
1201
- c(!0);
1202
- }), e.proxy.__qPortal = !0, Dl(e.proxy, "contentEl", () => t.value), {
1203
- showPortal: g,
1204
- hidePortal: c,
1205
- portalIsActive: a,
1206
- portalIsAccessible: i,
1207
- renderPortal: () => m === !0 ? l() : a.value === !0 ? [h(Bo, { to: u }, h(Mn, l))] : void 0
1208
- };
1209
- }
1210
- const lo = {
1211
- transitionShow: {
1212
- type: String,
1213
- default: "fade"
1214
- },
1215
- transitionHide: {
1216
- type: String,
1217
- default: "fade"
1218
- },
1219
- transitionDuration: {
1220
- type: [String, Number],
1221
- default: 300
1222
- }
1223
- };
1224
- function oo(e, t = () => {
1225
- }, l = () => {
1226
- }) {
1227
- return {
1228
- transitionProps: f(() => {
1229
- const o = `q-transition--${e.transitionShow || t()}`, a = `q-transition--${e.transitionHide || l()}`;
1230
- return {
1231
- appear: !0,
1232
- enterFromClass: `${o}-enter-from`,
1233
- enterActiveClass: `${o}-enter-active`,
1234
- enterToClass: `${o}-enter-to`,
1235
- leaveFromClass: `${a}-leave-from`,
1236
- leaveActiveClass: `${a}-leave-active`,
1237
- leaveToClass: `${a}-leave-to`
1238
- };
1239
- }),
1240
- transitionStyle: f(() => `--q-transition-duration: ${e.transitionDuration}ms`)
1241
- };
1242
- }
1243
- function no() {
1244
- let e;
1245
- const t = le();
1246
- function l() {
1247
- e = void 0;
1248
- }
1249
- return Ct(l), ce(l), {
1250
- removeTick: l,
1251
- registerTick(o) {
1252
- e = o, ue(() => {
1253
- e === o && ($l(t) === !1 && e(), e = void 0);
1254
- });
1255
- }
1256
- };
1257
- }
1258
- function io() {
1259
- let e = null;
1260
- const t = le();
1261
- function l() {
1262
- e !== null && (clearTimeout(e), e = null);
1263
- }
1264
- return Ct(l), ce(l), {
1265
- removeTimeout: l,
1266
- registerTimeout(o, a) {
1267
- l(), $l(t) === !1 && (e = setTimeout(() => {
1268
- e = null, o();
1269
- }, a));
1270
- }
1271
- };
1272
- }
1273
- const On = [Element, String], In = [null, document, document.body, document.scrollingElement, document.documentElement];
1274
- function Hn(e, t) {
1275
- let l = No(t);
1276
- if (l === void 0) {
1277
- if (e == null)
1278
- return window;
1279
- l = e.closest(".scroll,.scroll-y,.overflow-auto");
1280
- }
1281
- return In.includes(l) ? window : l;
1282
- }
1283
- function $n(e) {
1284
- return e === window ? window.pageYOffset || window.scrollY || document.body.scrollTop || 0 : e.scrollTop;
1285
- }
1286
- function Pn(e) {
1287
- return e === window ? window.pageXOffset || window.scrollX || document.body.scrollLeft || 0 : e.scrollLeft;
1288
- }
1289
- let mt;
1290
- function Dn() {
1291
- if (mt !== void 0)
1292
- return mt;
1293
- const e = document.createElement("p"), t = document.createElement("div");
1294
- sl(e, {
1295
- width: "100%",
1296
- height: "200px"
1297
- }), sl(t, {
1298
- position: "absolute",
1299
- top: "0px",
1300
- left: "0px",
1301
- visibility: "hidden",
1302
- width: "200px",
1303
- height: "150px",
1304
- overflow: "hidden"
1305
- }), t.appendChild(e), document.body.appendChild(t);
1306
- const l = e.offsetWidth;
1307
- t.style.overflow = "scroll";
1308
- let o = e.offsetWidth;
1309
- return l === o && (o = t.clientWidth), t.remove(), mt = l - o, mt;
1310
- }
1311
- function Wn(e, t = !0) {
1312
- 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"]));
1313
- }
1314
- const Te = [];
1315
- let je;
1316
- function jn(e) {
1317
- je = e.keyCode === 27;
1318
- }
1319
- function Nn() {
1320
- je === !0 && (je = !1);
1321
- }
1322
- function Kn(e) {
1323
- je === !0 && (je = !1, kt(e, 27) === !0 && Te[Te.length - 1](e));
1324
- }
1325
- function uo(e) {
1326
- window[e]("keydown", jn), window[e]("blur", Nn), window[e]("keyup", Kn), je = !1;
1327
- }
1328
- function ao(e) {
1329
- we.is.desktop === !0 && (Te.push(e), Te.length === 1 && uo("addEventListener"));
1330
- }
1331
- function yt(e) {
1332
- const t = Te.indexOf(e);
1333
- t !== -1 && (Te.splice(t, 1), Te.length === 0 && uo("removeEventListener"));
1334
- }
1335
- const { notPassiveCapture: St } = ge, Re = [];
1336
- function wt(e) {
1337
- const t = e.target;
1338
- if (t === void 0 || t.nodeType === 8 || t.classList.contains("no-pointer-events") === !0)
1339
- return;
1340
- let l = Je.length - 1;
1341
- for (; l >= 0; ) {
1342
- const o = Je[l].$;
1343
- if (o.type.name === "QTooltip") {
1344
- l--;
1345
- continue;
1346
- }
1347
- if (o.type.name !== "QDialog")
1348
- break;
1349
- if (o.props.seamless !== !0)
1350
- return;
1351
- l--;
1352
- }
1353
- for (let o = Re.length - 1; o >= 0; o--) {
1354
- const a = Re[o];
1355
- if ((a.anchorEl.value === null || a.anchorEl.value.contains(t) === !1) && (t === document.body || a.innerRef.value !== null && a.innerRef.value.contains(t) === !1))
1356
- e.qClickOutside = !0, a.onClickOutside(e);
1357
- else
1358
- return;
1359
- }
1360
- }
1361
- function Qn(e) {
1362
- Re.push(e), Re.length === 1 && (document.addEventListener("mousedown", wt, St), document.addEventListener("touchstart", wt, St));
1363
- }
1364
- function yl(e) {
1365
- const t = Re.findIndex((l) => l === e);
1366
- t !== -1 && (Re.splice(t, 1), Re.length === 0 && (document.removeEventListener("mousedown", wt, St), document.removeEventListener("touchstart", wt, St)));
1367
- }
1368
- let Sl, wl;
1369
- function xl(e) {
1370
- const t = e.split(" ");
1371
- 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;
1372
- }
1373
- function Un(e) {
1374
- return e ? !(e.length !== 2 || typeof e[0] != "number" || typeof e[1] != "number") : !0;
1375
- }
1376
- const jt = {
1377
- "start#ltr": "left",
1378
- "start#rtl": "right",
1379
- "end#ltr": "right",
1380
- "end#rtl": "left"
1381
- };
1382
- ["left", "middle", "right"].forEach((e) => {
1383
- jt[`${e}#ltr`] = e, jt[`${e}#rtl`] = e;
1384
- });
1385
- function Cl(e, t) {
1386
- const l = e.split(" ");
1387
- return {
1388
- vertical: l[0],
1389
- horizontal: jt[`${l[1]}#${t === !0 ? "rtl" : "ltr"}`]
1390
- };
1391
- }
1392
- function Xn(e, t) {
1393
- let { top: l, left: o, right: a, bottom: i, width: u, height: d } = e.getBoundingClientRect();
1394
- return t !== void 0 && (l -= t[1], o -= t[0], i += t[1], a += t[0], u += t[0], d += t[1]), {
1395
- top: l,
1396
- bottom: i,
1397
- height: d,
1398
- left: o,
1399
- right: a,
1400
- width: u,
1401
- middle: o + (a - o) / 2,
1402
- center: l + (i - l) / 2
1403
- };
1404
- }
1405
- function Yn(e, t, l) {
1406
- let { top: o, left: a } = e.getBoundingClientRect();
1407
- return o += t.top, a += t.left, l !== void 0 && (o += l[1], a += l[0]), {
1408
- top: o,
1409
- bottom: o + 1,
1410
- height: 1,
1411
- left: a,
1412
- right: a + 1,
1413
- width: 1,
1414
- middle: a,
1415
- center: o
1416
- };
1417
- }
1418
- function Gn(e, t) {
1419
- return {
1420
- top: 0,
1421
- center: t / 2,
1422
- bottom: t,
1423
- left: 0,
1424
- middle: e / 2,
1425
- right: e
1426
- };
1427
- }
1428
- function kl(e, t, l, o) {
1429
- return {
1430
- top: e[l.vertical] - t[o.vertical],
1431
- left: e[l.horizontal] - t[o.horizontal]
1432
- };
1433
- }
1434
- function ro(e, t = 0) {
1435
- if (e.targetEl === null || e.anchorEl === null || t > 5)
1436
- return;
1437
- if (e.targetEl.offsetHeight === 0 || e.targetEl.offsetWidth === 0) {
1438
- setTimeout(() => {
1439
- ro(e, t + 1);
1440
- }, 10);
1441
- return;
1442
- }
1443
- const {
1444
- targetEl: l,
1445
- offset: o,
1446
- anchorEl: a,
1447
- anchorOrigin: i,
1448
- selfOrigin: u,
1449
- absoluteOffset: d,
1450
- fit: m,
1451
- cover: g,
1452
- maxHeight: c,
1453
- maxWidth: y
1454
- } = e;
1455
- if (we.is.ios === !0 && window.visualViewport !== void 0) {
1456
- const B = document.body.style, { offsetLeft: L, offsetTop: H } = window.visualViewport;
1457
- L !== Sl && (B.setProperty("--q-pe-left", L + "px"), Sl = L), H !== wl && (B.setProperty("--q-pe-top", H + "px"), wl = H);
1458
- }
1459
- const { scrollLeft: C, scrollTop: r } = l, v = d === void 0 ? Xn(a, g === !0 ? [0, 0] : o) : Yn(a, d, o);
1460
- Object.assign(l.style, {
1461
- top: 0,
1462
- left: 0,
1463
- minWidth: null,
1464
- minHeight: null,
1465
- maxWidth: y,
1466
- maxHeight: c,
1467
- visibility: "visible"
1468
- });
1469
- const { offsetWidth: _, offsetHeight: S } = l, { elWidth: P, elHeight: E } = m === !0 || g === !0 ? { elWidth: Math.max(v.width, _), elHeight: g === !0 ? Math.max(v.height, S) : S } : { elWidth: _, elHeight: S };
1470
- let q = { maxWidth: y, maxHeight: c };
1471
- (m === !0 || g === !0) && (q.minWidth = v.width + "px", g === !0 && (q.minHeight = v.height + "px")), Object.assign(l.style, q);
1472
- const R = Gn(P, E);
1473
- let D = kl(v, R, i, u);
1474
- if (d === void 0 || o === void 0)
1475
- Mt(D, v, R, i, u);
1476
- else {
1477
- const { top: B, left: L } = D;
1478
- Mt(D, v, R, i, u);
1479
- let H = !1;
1480
- if (D.top !== B) {
1481
- H = !0;
1482
- const Q = 2 * o[1];
1483
- v.center = v.top -= Q, v.bottom -= Q + 2;
1484
- }
1485
- if (D.left !== L) {
1486
- H = !0;
1487
- const Q = 2 * o[0];
1488
- v.middle = v.left -= Q, v.right -= Q + 2;
1489
- }
1490
- H === !0 && (D = kl(v, R, i, u), Mt(D, v, R, i, u));
1491
- }
1492
- q = {
1493
- top: D.top + "px",
1494
- left: D.left + "px"
1495
- }, D.maxHeight !== void 0 && (q.maxHeight = D.maxHeight + "px", v.height > D.maxHeight && (q.minHeight = q.maxHeight)), D.maxWidth !== void 0 && (q.maxWidth = D.maxWidth + "px", v.width > D.maxWidth && (q.minWidth = q.maxWidth)), Object.assign(l.style, q), l.scrollTop !== r && (l.scrollTop = r), l.scrollLeft !== C && (l.scrollLeft = C);
1496
- }
1497
- function Mt(e, t, l, o, a) {
1498
- const i = l.bottom, u = l.right, d = Dn(), m = window.innerHeight - d, g = document.body.clientWidth;
1499
- if (e.top < 0 || e.top + i > m)
1500
- if (a.vertical === "center")
1501
- e.top = t[o.vertical] > m / 2 ? Math.max(0, m - i) : 0, e.maxHeight = Math.min(i, m);
1502
- else if (t[o.vertical] > m / 2) {
1503
- const c = Math.min(
1504
- m,
1505
- o.vertical === "center" ? t.center : o.vertical === a.vertical ? t.bottom : t.top
1506
- );
1507
- e.maxHeight = Math.min(i, c), e.top = Math.max(0, c - i);
1508
- } else
1509
- e.top = Math.max(
1510
- 0,
1511
- o.vertical === "center" ? t.center : o.vertical === a.vertical ? t.top : t.bottom
1512
- ), e.maxHeight = Math.min(i, m - e.top);
1513
- if (e.left < 0 || e.left + u > g)
1514
- if (e.maxWidth = Math.min(u, g), a.horizontal === "middle")
1515
- e.left = t[o.horizontal] > g / 2 ? Math.max(0, g - u) : 0;
1516
- else if (t[o.horizontal] > g / 2) {
1517
- const c = Math.min(
1518
- g,
1519
- o.horizontal === "middle" ? t.middle : o.horizontal === a.horizontal ? t.right : t.left
1520
- );
1521
- e.maxWidth = Math.min(u, c), e.left = Math.max(0, c - e.maxWidth);
1522
- } else
1523
- e.left = Math.max(
1524
- 0,
1525
- o.horizontal === "middle" ? t.middle : o.horizontal === a.horizontal ? t.left : t.right
1526
- ), e.maxWidth = Math.min(u, g - e.left);
1527
- }
1528
- const Zn = be({
1529
- name: "QMenu",
1530
- inheritAttrs: !1,
1531
- props: {
1532
- ..._n,
1533
- ...Zl,
1534
- ...lt,
1535
- ...lo,
1536
- persistent: Boolean,
1537
- autoClose: Boolean,
1538
- separateClosePopup: Boolean,
1539
- noRouteDismiss: Boolean,
1540
- noRefocus: Boolean,
1541
- noFocus: Boolean,
1542
- fit: Boolean,
1543
- cover: Boolean,
1544
- square: Boolean,
1545
- anchor: {
1546
- type: String,
1547
- validator: xl
1548
- },
1549
- self: {
1550
- type: String,
1551
- validator: xl
1552
- },
1553
- offset: {
1554
- type: Array,
1555
- validator: Un
1556
- },
1557
- scrollTarget: On,
1558
- touchPosition: Boolean,
1559
- maxHeight: {
1560
- type: String,
1561
- default: null
1562
- },
1563
- maxWidth: {
1564
- type: String,
1565
- default: null
1566
- }
1567
- },
1568
- emits: [
1569
- ...Jl,
1570
- "click",
1571
- "escapeKey"
1572
- ],
1573
- setup(e, { slots: t, emit: l, attrs: o }) {
1574
- let a = null, i, u, d;
1575
- const m = le(), { proxy: g } = m, { $q: c } = g, y = T(null), C = T(!1), r = f(
1576
- () => e.persistent !== !0 && e.noRouteDismiss !== !0
1577
- ), v = ot(e, c), { registerTick: _, removeTick: S } = no(), { registerTimeout: P } = io(), { transitionProps: E, transitionStyle: q } = oo(e), { localScrollTarget: R, changeScrollEvent: D, unconfigureScrollTarget: B } = Bn(e, O), { anchorEl: L, canShow: H } = En({ showing: C }), { hide: Q } = eo({
1578
- showing: C,
1579
- canShow: H,
1580
- handleShow: se,
1581
- handleHide: s,
1582
- hideOnRouteChange: r,
1583
- processOnMount: !0
1584
- }), { showPortal: G, hidePortal: oe, renderPortal: A } = to(m, y, N, "menu"), U = {
1585
- anchorEl: L,
1586
- innerRef: y,
1587
- onClickOutside(b) {
1588
- if (e.persistent !== !0 && C.value === !0)
1589
- return Q(b), // always prevent touch event
1590
- (b.type === "touchstart" || b.target.classList.contains("q-dialog__backdrop")) && ae(b), !0;
1591
- }
1592
- }, ne = f(
1593
- () => Cl(
1594
- e.anchor || (e.cover === !0 ? "center middle" : "bottom start"),
1595
- c.lang.rtl
1596
- )
1597
- ), te = f(() => e.cover === !0 ? ne.value : Cl(e.self || "top start", c.lang.rtl)), X = f(
1598
- () => (e.square === !0 ? " q-menu--square" : "") + (v.value === !0 ? " q-menu--dark q-dark" : "")
1599
- ), re = f(() => e.autoClose === !0 ? { onClick: V } : {}), k = f(
1600
- () => C.value === !0 && e.persistent !== !0
1601
- );
1602
- K(k, (b) => {
1603
- b === !0 ? (ao(F), Qn(U)) : (yt(F), yl(U));
1604
- });
1605
- function M() {
1606
- Nt(() => {
1607
- let b = y.value;
1608
- b && b.contains(document.activeElement) !== !0 && (b = b.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]") || b.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]") || b.querySelector("[autofocus], [data-autofocus]") || b, b.focus({ preventScroll: !0 }));
1609
- });
1610
- }
1611
- function se(b) {
1612
- if (a = e.noRefocus === !1 ? document.activeElement : null, Wl(I), G(), O(), i = void 0, b !== void 0 && (e.touchPosition || e.contextMenu)) {
1613
- const Z = Ko(b);
1614
- if (Z.left !== void 0) {
1615
- const { top: ve, left: ze } = L.value.getBoundingClientRect();
1616
- i = { left: Z.left - ze, top: Z.top - ve };
1617
- }
1618
- }
1619
- u === void 0 && (u = K(
1620
- () => c.screen.width + "|" + c.screen.height + "|" + e.self + "|" + e.anchor + "|" + c.lang.rtl,
1621
- z
1622
- )), e.noFocus !== !0 && document.activeElement.blur(), _(() => {
1623
- z(), e.noFocus !== !0 && M();
1624
- }), P(() => {
1625
- c.platform.is.ios === !0 && (d = e.autoClose, y.value.click()), z(), G(!0), l("show", b);
1626
- }, e.transitionDuration);
1627
- }
1628
- function s(b) {
1629
- S(), oe(), p(!0), a !== null && // menu was hidden from code or ESC plugin
1630
- (b === void 0 || b.qClickOutside !== !0) && (((b && b.type.indexOf("key") === 0 ? a.closest('[tabindex]:not([tabindex^="-"])') : void 0) || a).focus(), a = null), P(() => {
1631
- oe(!0), l("hide", b);
1632
- }, e.transitionDuration);
1633
- }
1634
- function p(b) {
1635
- i = void 0, u !== void 0 && (u(), u = void 0), (b === !0 || C.value === !0) && (Pt(I), B(), yl(U), yt(F)), b !== !0 && (a = null);
1636
- }
1637
- function O() {
1638
- (L.value !== null || e.scrollTarget !== void 0) && (R.value = Hn(L.value, e.scrollTarget), D(R.value, z));
1639
- }
1640
- function V(b) {
1641
- d !== !0 ? (Fn(g, b), l("click", b)) : d = !1;
1642
- }
1643
- function I(b) {
1644
- k.value === !0 && e.noFocus !== !0 && Pl(y.value, b.target) !== !0 && M();
1645
- }
1646
- function F(b) {
1647
- l("escapeKey"), Q(b);
1648
- }
1649
- function z() {
1650
- ro({
1651
- targetEl: y.value,
1652
- offset: e.offset,
1653
- anchorEl: L.value,
1654
- anchorOrigin: ne.value,
1655
- selfOrigin: te.value,
1656
- absoluteOffset: i,
1657
- fit: e.fit,
1658
- cover: e.cover,
1659
- maxHeight: e.maxHeight,
1660
- maxWidth: e.maxWidth
1661
- });
1662
- }
1663
- function N() {
1664
- return h(
1665
- bt,
1666
- E.value,
1667
- () => C.value === !0 ? h("div", {
1668
- role: "menu",
1669
- ...o,
1670
- ref: y,
1671
- tabindex: -1,
1672
- class: [
1673
- "q-menu q-position-engine scroll" + X.value,
1674
- o.class
1675
- ],
1676
- style: [
1677
- o.style,
1678
- q.value
1679
- ],
1680
- ...re.value
1681
- }, Se(t.default)) : null
1682
- );
1683
- }
1684
- return ce(p), Object.assign(g, { focus: M, updatePosition: z }), A;
1685
- }
1686
- });
1687
- function Jn(e, t, l) {
1688
- function o() {
1689
- }
1690
- return ce(() => {
1691
- e.value === !0 && void 0;
1692
- }), {
1693
- removeFromHistory: o,
1694
- addToHistory() {
1695
- }
1696
- };
1697
- }
1698
- let Ye = 0, Lt, Ot, Ze, It = !1, ql, Vl, _l, Ee = null;
1699
- function ei(e) {
1700
- ti(e) && ae(e);
1701
- }
1702
- function ti(e) {
1703
- if (e.target === document.body || e.target.classList.contains("q-layout__backdrop"))
1704
- return !0;
1705
- const t = Qo(e), l = e.shiftKey && !e.deltaX, o = !l && Math.abs(e.deltaX) <= Math.abs(e.deltaY), a = l || o ? e.deltaY : e.deltaX;
1706
- for (let i = 0; i < t.length; i++) {
1707
- const u = t[i];
1708
- if (Wn(u, o))
1709
- return o ? a < 0 && u.scrollTop === 0 ? !0 : a > 0 && u.scrollTop + u.clientHeight === u.scrollHeight : a < 0 && u.scrollLeft === 0 ? !0 : a > 0 && u.scrollLeft + u.clientWidth === u.scrollWidth;
1710
- }
1711
- return !0;
1712
- }
1713
- function El(e) {
1714
- e.target === document && (document.scrollingElement.scrollTop = document.scrollingElement.scrollTop);
1715
- }
1716
- function ht(e) {
1717
- It !== !0 && (It = !0, requestAnimationFrame(() => {
1718
- It = !1;
1719
- const { height: t } = e.target, { clientHeight: l, scrollTop: o } = document.scrollingElement;
1720
- (Ze === void 0 || t !== window.innerHeight) && (Ze = l - t, document.scrollingElement.scrollTop = o), o > Ze && (document.scrollingElement.scrollTop -= Math.ceil((o - Ze) / 8));
1721
- }));
1722
- }
1723
- function Bl(e) {
1724
- const t = document.body, l = window.visualViewport !== void 0;
1725
- if (e === "add") {
1726
- const { overflowY: o, overflowX: a } = window.getComputedStyle(t);
1727
- Lt = Pn(window), Ot = $n(window), ql = t.style.left, Vl = t.style.top, _l = window.location.href, t.style.left = `-${Lt}px`, t.style.top = `-${Ot}px`, a !== "hidden" && (a === "scroll" || t.scrollWidth > window.innerWidth) && t.classList.add("q-body--force-scrollbar-x"), o !== "hidden" && (o === "scroll" || t.scrollHeight > window.innerHeight) && t.classList.add("q-body--force-scrollbar-y"), t.classList.add("q-body--prevent-scroll"), document.qScrollPrevented = !0, we.is.ios === !0 && (l === !0 ? (window.scrollTo(0, 0), window.visualViewport.addEventListener("resize", ht, ge.passiveCapture), window.visualViewport.addEventListener("scroll", ht, ge.passiveCapture), window.scrollTo(0, 0)) : window.addEventListener("scroll", El, ge.passiveCapture));
1728
- }
1729
- we.is.desktop === !0 && we.is.mac === !0 && window[`${e}EventListener`]("wheel", ei, ge.notPassive), e === "remove" && (we.is.ios === !0 && (l === !0 ? (window.visualViewport.removeEventListener("resize", ht, ge.passiveCapture), window.visualViewport.removeEventListener("scroll", ht, ge.passiveCapture)) : window.removeEventListener("scroll", El, ge.passiveCapture)), t.classList.remove("q-body--prevent-scroll"), t.classList.remove("q-body--force-scrollbar-x"), t.classList.remove("q-body--force-scrollbar-y"), document.qScrollPrevented = !1, t.style.left = ql, t.style.top = Vl, window.location.href === _l && window.scrollTo(Lt, Ot), Ze = void 0);
1730
- }
1731
- function li(e) {
1732
- let t = "add";
1733
- if (e === !0) {
1734
- if (Ye++, Ee !== null) {
1735
- clearTimeout(Ee), Ee = null;
1736
- return;
1737
- }
1738
- if (Ye > 1)
1739
- return;
1740
- } else {
1741
- if (Ye === 0 || (Ye--, Ye > 0))
1742
- return;
1743
- if (t = "remove", we.is.ios === !0 && we.is.nativeMobile === !0) {
1744
- Ee !== null && clearTimeout(Ee), Ee = setTimeout(() => {
1745
- Bl(t), Ee = null;
1746
- }, 100);
1747
- return;
1748
- }
1749
- }
1750
- Bl(t);
1751
- }
1752
- function oi() {
1753
- let e;
1754
- return {
1755
- preventBodyScroll(t) {
1756
- t !== e && (e !== void 0 || t === !0) && (e = t, li(t));
1757
- }
1758
- };
1759
- }
1760
- let gt = 0;
1761
- const ni = {
1762
- standard: "fixed-full flex-center",
1763
- top: "fixed-top justify-center",
1764
- bottom: "fixed-bottom justify-center",
1765
- right: "fixed-right items-center",
1766
- left: "fixed-left items-center"
1767
- }, Al = {
1768
- standard: ["scale", "scale"],
1769
- top: ["slide-down", "slide-up"],
1770
- bottom: ["slide-up", "slide-down"],
1771
- right: ["slide-left", "slide-right"],
1772
- left: ["slide-right", "slide-left"]
1773
- }, ii = be({
1774
- name: "QDialog",
1775
- inheritAttrs: !1,
1776
- props: {
1777
- ...Zl,
1778
- ...lo,
1779
- transitionShow: String,
1780
- // override useTransitionProps
1781
- transitionHide: String,
1782
- // override useTransitionProps
1783
- persistent: Boolean,
1784
- autoClose: Boolean,
1785
- allowFocusOutside: Boolean,
1786
- noEscDismiss: Boolean,
1787
- noBackdropDismiss: Boolean,
1788
- noRouteDismiss: Boolean,
1789
- noRefocus: Boolean,
1790
- noFocus: Boolean,
1791
- noShake: Boolean,
1792
- seamless: Boolean,
1793
- maximized: Boolean,
1794
- fullWidth: Boolean,
1795
- fullHeight: Boolean,
1796
- square: Boolean,
1797
- backdropFilter: String,
1798
- position: {
1799
- type: String,
1800
- default: "standard",
1801
- validator: (e) => ["standard", "top", "bottom", "left", "right"].includes(e)
1802
- }
1803
- },
1804
- emits: [
1805
- ...Jl,
1806
- "shake",
1807
- "click",
1808
- "escapeKey"
1809
- ],
1810
- setup(e, { slots: t, emit: l, attrs: o }) {
1811
- const a = le(), i = T(null), u = T(!1), d = T(!1);
1812
- let m = null, g = null, c, y;
1813
- const C = f(
1814
- () => e.persistent !== !0 && e.noRouteDismiss !== !0 && e.seamless !== !0
1815
- ), { preventBodyScroll: r } = oi(), { registerTimeout: v } = io(), { registerTick: _, removeTick: S } = no(), { transitionProps: P, transitionStyle: E } = oo(
1816
- e,
1817
- () => Al[e.position][0],
1818
- () => Al[e.position][1]
1819
- ), q = f(() => E.value + (e.backdropFilter !== void 0 ? `;backdrop-filter:${e.backdropFilter};-webkit-backdrop-filter:${e.backdropFilter}` : "")), { showPortal: R, hidePortal: D, portalIsAccessible: B, renderPortal: L } = to(
1820
- a,
1821
- i,
1822
- O,
1823
- "dialog"
1824
- ), { hide: H } = eo({
1825
- showing: u,
1826
- hideOnRouteChange: C,
1827
- handleShow: U,
1828
- handleHide: ne,
1829
- processOnMount: !0
1830
- });
1831
- Jn(u);
1832
- const Q = f(
1833
- () => `q-dialog__inner flex no-pointer-events q-dialog__inner--${e.maximized === !0 ? "maximized" : "minimized"} q-dialog__inner--${e.position} ${ni[e.position]}` + (d.value === !0 ? " q-dialog__inner--animating" : "") + (e.fullWidth === !0 ? " q-dialog__inner--fullwidth" : "") + (e.fullHeight === !0 ? " q-dialog__inner--fullheight" : "") + (e.square === !0 ? " q-dialog__inner--square" : "")
1834
- ), G = f(() => u.value === !0 && e.seamless !== !0), oe = f(() => e.autoClose === !0 ? { onClick: se } : {}), A = f(() => [
1835
- `q-dialog fullscreen no-pointer-events q-dialog--${G.value === !0 ? "modal" : "seamless"}`,
1836
- o.class
1837
- ]);
1838
- K(() => e.maximized, (V) => {
1839
- u.value === !0 && M(V);
1840
- }), K(G, (V) => {
1841
- r(V), V === !0 ? (Wl(p), ao(re)) : (Pt(p), yt(re));
1842
- });
1843
- function U(V) {
1844
- g = e.noRefocus === !1 && document.activeElement !== null ? document.activeElement : null, M(e.maximized), R(), d.value = !0, e.noFocus !== !0 ? (document.activeElement !== null && document.activeElement.blur(), _(te)) : S(), v(() => {
1845
- if (a.proxy.$q.platform.is.ios === !0) {
1846
- if (e.seamless !== !0 && document.activeElement) {
1847
- const { top: I, bottom: F } = document.activeElement.getBoundingClientRect(), { innerHeight: z } = window, N = window.visualViewport !== void 0 ? window.visualViewport.height : z;
1848
- I > 0 && F > N / 2 && (document.scrollingElement.scrollTop = Math.min(
1849
- document.scrollingElement.scrollHeight - N,
1850
- F >= z ? 1 / 0 : Math.ceil(document.scrollingElement.scrollTop + F - N / 2)
1851
- )), document.activeElement.scrollIntoView();
1852
- }
1853
- y = !0, i.value.click(), y = !1;
1854
- }
1855
- R(!0), d.value = !1, l("show", V);
1856
- }, e.transitionDuration);
1857
- }
1858
- function ne(V) {
1859
- S(), k(!0), d.value = !0, D(), g !== null && (((V && V.type.indexOf("key") === 0 ? g.closest('[tabindex]:not([tabindex^="-"])') : void 0) || g).focus(), g = null), v(() => {
1860
- D(!0), d.value = !1, l("hide", V);
1861
- }, e.transitionDuration);
1862
- }
1863
- function te(V) {
1864
- Nt(() => {
1865
- let I = i.value;
1866
- if (I !== null) {
1867
- if (V !== void 0) {
1868
- const F = I.querySelector(V);
1869
- if (F !== null) {
1870
- F.focus({ preventScroll: !0 });
1871
- return;
1872
- }
1873
- }
1874
- I.contains(document.activeElement) !== !0 && (I = I.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]") || I.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]") || I.querySelector("[autofocus], [data-autofocus]") || I, I.focus({ preventScroll: !0 }));
1875
- }
1876
- });
1877
- }
1878
- function X(V) {
1879
- V && typeof V.focus == "function" ? V.focus({ preventScroll: !0 }) : te(), l("shake");
1880
- const I = i.value;
1881
- I !== null && (I.classList.remove("q-animate--scale"), I.classList.add("q-animate--scale"), m !== null && clearTimeout(m), m = setTimeout(() => {
1882
- m = null, i.value !== null && (I.classList.remove("q-animate--scale"), te());
1883
- }, 170));
1884
- }
1885
- function re() {
1886
- e.seamless !== !0 && (e.persistent === !0 || e.noEscDismiss === !0 ? e.maximized !== !0 && e.noShake !== !0 && X() : (l("escapeKey"), H()));
1887
- }
1888
- function k(V) {
1889
- m !== null && (clearTimeout(m), m = null), (V === !0 || u.value === !0) && (M(!1), e.seamless !== !0 && (r(!1), Pt(p), yt(re))), V !== !0 && (g = null);
1890
- }
1891
- function M(V) {
1892
- V === !0 ? c !== !0 && (gt < 1 && document.body.classList.add("q-body--dialog"), gt++, c = !0) : c === !0 && (gt < 2 && document.body.classList.remove("q-body--dialog"), gt--, c = !1);
1893
- }
1894
- function se(V) {
1895
- y !== !0 && (H(V), l("click", V));
1896
- }
1897
- function s(V) {
1898
- e.persistent !== !0 && e.noBackdropDismiss !== !0 ? H(V) : e.noShake !== !0 && X();
1899
- }
1900
- function p(V) {
1901
- e.allowFocusOutside !== !0 && B.value === !0 && Pl(i.value, V.target) !== !0 && te('[tabindex]:not([tabindex="-1"])');
1902
- }
1903
- Object.assign(a.proxy, {
1904
- // expose public methods
1905
- focus: te,
1906
- shake: X,
1907
- // private but needed by QSelect
1908
- __updateRefocusTarget(V) {
1909
- g = V || null;
1910
- }
1911
- }), ce(k);
1912
- function O() {
1913
- return h("div", {
1914
- role: "dialog",
1915
- "aria-modal": G.value === !0 ? "true" : "false",
1916
- ...o,
1917
- class: A.value
1918
- }, [
1919
- h(bt, {
1920
- name: "q-transition--fade",
1921
- appear: !0
1922
- }, () => G.value === !0 ? h("div", {
1923
- class: "q-dialog__backdrop fixed-full",
1924
- style: q.value,
1925
- "aria-hidden": "true",
1926
- tabindex: -1,
1927
- onClick: s
1928
- }) : null),
1929
- h(
1930
- bt,
1931
- P.value,
1932
- () => u.value === !0 ? h("div", {
1933
- ref: i,
1934
- class: Q.value,
1935
- style: E.value,
1936
- tabindex: -1,
1937
- ...oe.value
1938
- }, Se(t.default)) : null
1939
- )
1940
- ]);
1941
- }
1942
- return L;
1943
- }
1944
- });
1945
- let xt = !1;
1946
- {
1947
- const e = document.createElement("div");
1948
- e.setAttribute("dir", "rtl"), Object.assign(e.style, {
1949
- width: "1px",
1950
- height: "1px",
1951
- overflow: "auto"
1952
- });
1953
- const t = document.createElement("div");
1954
- Object.assign(t.style, {
1955
- width: "1000px",
1956
- height: "1px"
1957
- }), document.body.appendChild(e), e.appendChild(t), e.scrollLeft = -1e3, xt = e.scrollLeft >= 0, e.remove();
1958
- }
1959
- const fe = 1e3, ui = [
1960
- "start",
1961
- "center",
1962
- "end",
1963
- "start-force",
1964
- "center-force",
1965
- "end-force"
1966
- ], so = Array.prototype.filter, ai = window.getComputedStyle(document.body).overflowAnchor === void 0 ? Uo : function(e, t) {
1967
- e !== null && (e._qOverflowAnimationFrame !== void 0 && cancelAnimationFrame(e._qOverflowAnimationFrame), e._qOverflowAnimationFrame = requestAnimationFrame(() => {
1968
- if (e === null)
1969
- return;
1970
- e._qOverflowAnimationFrame = void 0;
1971
- const l = e.children || [];
1972
- so.call(l, (a) => a.dataset && a.dataset.qVsAnchor !== void 0).forEach((a) => {
1973
- delete a.dataset.qVsAnchor;
1974
- });
1975
- const o = l[t];
1976
- o && o.dataset && (o.dataset.qVsAnchor = "");
1977
- }));
1978
- };
1979
- function We(e, t) {
1980
- return e + t;
1981
- }
1982
- function Ht(e, t, l, o, a, i, u, d) {
1983
- const m = e === window ? document.scrollingElement || document.documentElement : e, g = a === !0 ? "offsetWidth" : "offsetHeight", c = {
1984
- scrollStart: 0,
1985
- scrollViewSize: -u - d,
1986
- scrollMaxSize: 0,
1987
- offsetStart: -u,
1988
- offsetEnd: -d
1989
- };
1990
- if (a === !0 ? (e === window ? (c.scrollStart = window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, c.scrollViewSize += document.documentElement.clientWidth) : (c.scrollStart = m.scrollLeft, c.scrollViewSize += m.clientWidth), c.scrollMaxSize = m.scrollWidth, i === !0 && (c.scrollStart = (xt === !0 ? c.scrollMaxSize - c.scrollViewSize : 0) - c.scrollStart)) : (e === window ? (c.scrollStart = window.pageYOffset || window.scrollY || document.body.scrollTop || 0, c.scrollViewSize += document.documentElement.clientHeight) : (c.scrollStart = m.scrollTop, c.scrollViewSize += m.clientHeight), c.scrollMaxSize = m.scrollHeight), l !== null)
1991
- for (let y = l.previousElementSibling; y !== null; y = y.previousElementSibling)
1992
- y.classList.contains("q-virtual-scroll--skip") === !1 && (c.offsetStart += y[g]);
1993
- if (o !== null)
1994
- for (let y = o.nextElementSibling; y !== null; y = y.nextElementSibling)
1995
- y.classList.contains("q-virtual-scroll--skip") === !1 && (c.offsetEnd += y[g]);
1996
- if (t !== e) {
1997
- const y = m.getBoundingClientRect(), C = t.getBoundingClientRect();
1998
- a === !0 ? (c.offsetStart += C.left - y.left, c.offsetEnd -= C.width) : (c.offsetStart += C.top - y.top, c.offsetEnd -= C.height), e !== window && (c.offsetStart += c.scrollStart), c.offsetEnd += c.scrollMaxSize - c.offsetStart;
1999
- }
2000
- return c;
2001
- }
2002
- function Tl(e, t, l, o) {
2003
- t === "end" && (t = (e === window ? document.body : e)[l === !0 ? "scrollWidth" : "scrollHeight"]), e === window ? l === !0 ? (o === !0 && (t = (xt === !0 ? document.body.scrollWidth - document.documentElement.clientWidth : 0) - t), window.scrollTo(t, window.pageYOffset || window.scrollY || document.body.scrollTop || 0)) : window.scrollTo(window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, t) : l === !0 ? (o === !0 && (t = (xt === !0 ? e.scrollWidth - e.offsetWidth : 0) - t), e.scrollLeft = t) : e.scrollTop = t;
2004
- }
2005
- function Ge(e, t, l, o) {
2006
- if (l >= o)
2007
- return 0;
2008
- const a = t.length, i = Math.floor(l / fe), u = Math.floor((o - 1) / fe) + 1;
2009
- let d = e.slice(i, u).reduce(We, 0);
2010
- return l % fe !== 0 && (d -= t.slice(i * fe, l).reduce(We, 0)), o % fe !== 0 && o !== a && (d -= t.slice(o, u * fe).reduce(We, 0)), d;
2011
- }
2012
- const ri = {
2013
- virtualScrollSliceSize: {
2014
- type: [Number, String],
2015
- default: 10
2016
- },
2017
- virtualScrollSliceRatioBefore: {
2018
- type: [Number, String],
2019
- default: 1
2020
- },
2021
- virtualScrollSliceRatioAfter: {
2022
- type: [Number, String],
2023
- default: 1
2024
- },
2025
- virtualScrollItemSize: {
2026
- type: [Number, String],
2027
- default: 24
2028
- },
2029
- virtualScrollStickySizeStart: {
2030
- type: [Number, String],
2031
- default: 0
2032
- },
2033
- virtualScrollStickySizeEnd: {
2034
- type: [Number, String],
2035
- default: 0
2036
- },
2037
- tableColspan: [Number, String]
2038
- }, Rl = {
2039
- virtualScrollHorizontal: Boolean,
2040
- onVirtualScroll: Function,
2041
- ...ri
2042
- };
2043
- function si({
2044
- virtualScrollLength: e,
2045
- getVirtualScrollTarget: t,
2046
- getVirtualScrollEl: l,
2047
- virtualScrollItemSizeComputed: o
2048
- // optional
2049
- }) {
2050
- const a = le(), { props: i, emit: u, proxy: d } = a, { $q: m } = d;
2051
- let g, c, y, C = [], r;
2052
- const v = T(0), _ = T(0), S = T({}), P = T(null), E = T(null), q = T(null), R = T({ from: 0, to: 0 }), D = f(() => i.tableColspan !== void 0 ? i.tableColspan : 100);
2053
- o === void 0 && (o = f(() => i.virtualScrollItemSize));
2054
- const B = f(() => o.value + ";" + i.virtualScrollHorizontal), L = f(
2055
- () => B.value + ";" + i.virtualScrollSliceRatioBefore + ";" + i.virtualScrollSliceRatioAfter
2056
- );
2057
- K(L, () => {
2058
- X();
2059
- }), K(B, H);
2060
- function H() {
2061
- te(c, !0);
2062
- }
2063
- function Q(s) {
2064
- te(s === void 0 ? c : s);
2065
- }
2066
- function G(s, p) {
2067
- const O = t();
2068
- if (O == null || O.nodeType === 8)
2069
- return;
2070
- const V = Ht(
2071
- O,
2072
- l(),
2073
- P.value,
2074
- E.value,
2075
- i.virtualScrollHorizontal,
2076
- m.lang.rtl,
2077
- i.virtualScrollStickySizeStart,
2078
- i.virtualScrollStickySizeEnd
2079
- );
2080
- y !== V.scrollViewSize && X(V.scrollViewSize), A(
2081
- O,
2082
- V,
2083
- Math.min(e.value - 1, Math.max(0, parseInt(s, 10) || 0)),
2084
- 0,
2085
- ui.indexOf(p) !== -1 ? p : c !== -1 && s > c ? "end" : "start"
2086
- );
2087
- }
2088
- function oe() {
2089
- const s = t();
2090
- if (s == null || s.nodeType === 8)
2091
- return;
2092
- const p = Ht(
2093
- s,
2094
- l(),
2095
- P.value,
2096
- E.value,
2097
- i.virtualScrollHorizontal,
2098
- m.lang.rtl,
2099
- i.virtualScrollStickySizeStart,
2100
- i.virtualScrollStickySizeEnd
2101
- ), O = e.value - 1, V = p.scrollMaxSize - p.offsetStart - p.offsetEnd - _.value;
2102
- if (g === p.scrollStart)
2103
- return;
2104
- if (p.scrollMaxSize <= 0) {
2105
- A(s, p, 0, 0);
2106
- return;
2107
- }
2108
- y !== p.scrollViewSize && X(p.scrollViewSize), U(R.value.from);
2109
- const I = Math.floor(p.scrollMaxSize - Math.max(p.scrollViewSize, p.offsetEnd) - Math.min(r[O], p.scrollViewSize / 2));
2110
- if (I > 0 && Math.ceil(p.scrollStart) >= I) {
2111
- A(
2112
- s,
2113
- p,
2114
- O,
2115
- p.scrollMaxSize - p.offsetEnd - C.reduce(We, 0)
2116
- );
2117
- return;
2118
- }
2119
- let F = 0, z = p.scrollStart - p.offsetStart, N = z;
2120
- if (z <= V && z + p.scrollViewSize >= v.value)
2121
- z -= v.value, F = R.value.from, N = z;
2122
- else
2123
- for (let b = 0; z >= C[b] && F < O; b++)
2124
- z -= C[b], F += fe;
2125
- for (; z > 0 && F < O; )
2126
- z -= r[F], z > -p.scrollViewSize ? (F++, N = z) : N = r[F] + z;
2127
- A(
2128
- s,
2129
- p,
2130
- F,
2131
- N
2132
- );
2133
- }
2134
- function A(s, p, O, V, I) {
2135
- const F = typeof I == "string" && I.indexOf("-force") !== -1, z = F === !0 ? I.replace("-force", "") : I, N = z !== void 0 ? z : "start";
2136
- let b = Math.max(0, O - S.value[N]), Z = b + S.value.total;
2137
- Z > e.value && (Z = e.value, b = Math.max(0, Z - S.value.total)), g = p.scrollStart;
2138
- const ve = b !== R.value.from || Z !== R.value.to;
2139
- if (ve === !1 && z === void 0) {
2140
- k(O);
2141
- return;
2142
- }
2143
- const { activeElement: ze } = document, me = q.value;
2144
- ve === !0 && me !== null && me !== ze && me.contains(ze) === !0 && (me.addEventListener("focusout", ne), setTimeout(() => {
2145
- me !== null && me.removeEventListener("focusout", ne);
2146
- })), ai(me, O - b);
2147
- const nt = z !== void 0 ? r.slice(b, O).reduce(We, 0) : 0;
2148
- if (ve === !0) {
2149
- const ke = Z >= R.value.from && b <= R.value.to ? R.value.to : Z;
2150
- R.value = { from: b, to: ke }, v.value = Ge(C, r, 0, b), _.value = Ge(C, r, Z, e.value), requestAnimationFrame(() => {
2151
- R.value.to !== Z && g === p.scrollStart && (R.value = { from: R.value.from, to: Z }, _.value = Ge(C, r, Z, e.value));
2152
- });
2153
- }
2154
- requestAnimationFrame(() => {
2155
- if (g !== p.scrollStart)
2156
- return;
2157
- ve === !0 && U(b);
2158
- const ke = r.slice(b, O).reduce(We, 0), qe = ke + p.offsetStart + v.value, it = qe + r[O];
2159
- let Ne = qe + V;
2160
- if (z !== void 0) {
2161
- const qt = ke - nt, Ke = p.scrollStart + qt;
2162
- Ne = F !== !0 && Ke < qe && it < Ke + p.scrollViewSize ? Ke : z === "end" ? it - p.scrollViewSize : qe - (z === "start" ? 0 : Math.round((p.scrollViewSize - r[O]) / 2));
2163
- }
2164
- g = Ne, Tl(
2165
- s,
2166
- Ne,
2167
- i.virtualScrollHorizontal,
2168
- m.lang.rtl
2169
- ), k(O);
2170
- });
2171
- }
2172
- function U(s) {
2173
- const p = q.value;
2174
- if (p) {
2175
- const O = so.call(
2176
- p.children,
2177
- (b) => b.classList && b.classList.contains("q-virtual-scroll--skip") === !1
2178
- ), V = O.length, I = i.virtualScrollHorizontal === !0 ? (b) => b.getBoundingClientRect().width : (b) => b.offsetHeight;
2179
- let F = s, z, N;
2180
- for (let b = 0; b < V; ) {
2181
- for (z = I(O[b]), b++; b < V && O[b].classList.contains("q-virtual-scroll--with-prev") === !0; )
2182
- z += I(O[b]), b++;
2183
- N = z - r[F], N !== 0 && (r[F] += N, C[Math.floor(F / fe)] += N), F++;
2184
- }
2185
- }
2186
- }
2187
- function ne() {
2188
- q.value !== null && q.value !== void 0 && q.value.focus();
2189
- }
2190
- function te(s, p) {
2191
- const O = 1 * o.value;
2192
- (p === !0 || Array.isArray(r) === !1) && (r = []);
2193
- const V = r.length;
2194
- r.length = e.value;
2195
- for (let F = e.value - 1; F >= V; F--)
2196
- r[F] = O;
2197
- const I = Math.floor((e.value - 1) / fe);
2198
- C = [];
2199
- for (let F = 0; F <= I; F++) {
2200
- let z = 0;
2201
- const N = Math.min((F + 1) * fe, e.value);
2202
- for (let b = F * fe; b < N; b++)
2203
- z += r[b];
2204
- C.push(z);
2205
- }
2206
- c = -1, g = void 0, v.value = Ge(C, r, 0, R.value.from), _.value = Ge(C, r, R.value.to, e.value), s >= 0 ? (U(R.value.from), ue(() => {
2207
- G(s);
2208
- })) : M();
2209
- }
2210
- function X(s) {
2211
- if (s === void 0 && typeof window < "u") {
2212
- const z = t();
2213
- z != null && z.nodeType !== 8 && (s = Ht(
2214
- z,
2215
- l(),
2216
- P.value,
2217
- E.value,
2218
- i.virtualScrollHorizontal,
2219
- m.lang.rtl,
2220
- i.virtualScrollStickySizeStart,
2221
- i.virtualScrollStickySizeEnd
2222
- ).scrollViewSize);
2223
- }
2224
- y = s;
2225
- const p = parseFloat(i.virtualScrollSliceRatioBefore) || 0, O = parseFloat(i.virtualScrollSliceRatioAfter) || 0, V = 1 + p + O, I = s === void 0 || s <= 0 ? 1 : Math.ceil(s / o.value), F = Math.max(
2226
- 1,
2227
- I,
2228
- Math.ceil((i.virtualScrollSliceSize > 0 ? i.virtualScrollSliceSize : 10) / V)
2229
- );
2230
- S.value = {
2231
- total: Math.ceil(F * V),
2232
- start: Math.ceil(F * p),
2233
- center: Math.ceil(F * (0.5 + p)),
2234
- end: Math.ceil(F * (1 + p)),
2235
- view: I
2236
- };
2237
- }
2238
- function re(s, p) {
2239
- const O = i.virtualScrollHorizontal === !0 ? "width" : "height", V = {
2240
- ["--q-virtual-scroll-item-" + O]: o.value + "px"
2241
- };
2242
- return [
2243
- s === "tbody" ? h(s, {
2244
- class: "q-virtual-scroll__padding",
2245
- key: "before",
2246
- ref: P
2247
- }, [
2248
- h("tr", [
2249
- h("td", {
2250
- style: { [O]: `${v.value}px`, ...V },
2251
- colspan: D.value
2252
- })
2253
- ])
2254
- ]) : h(s, {
2255
- class: "q-virtual-scroll__padding",
2256
- key: "before",
2257
- ref: P,
2258
- style: { [O]: `${v.value}px`, ...V }
2259
- }),
2260
- h(s, {
2261
- class: "q-virtual-scroll__content",
2262
- key: "content",
2263
- ref: q,
2264
- tabindex: -1
2265
- }, p.flat()),
2266
- s === "tbody" ? h(s, {
2267
- class: "q-virtual-scroll__padding",
2268
- key: "after",
2269
- ref: E
2270
- }, [
2271
- h("tr", [
2272
- h("td", {
2273
- style: { [O]: `${_.value}px`, ...V },
2274
- colspan: D.value
2275
- })
2276
- ])
2277
- ]) : h(s, {
2278
- class: "q-virtual-scroll__padding",
2279
- key: "after",
2280
- ref: E,
2281
- style: { [O]: `${_.value}px`, ...V }
2282
- })
2283
- ];
2284
- }
2285
- function k(s) {
2286
- c !== s && (i.onVirtualScroll !== void 0 && u("virtualScroll", {
2287
- index: s,
2288
- from: R.value.from,
2289
- to: R.value.to - 1,
2290
- direction: s < c ? "decrease" : "increase",
2291
- ref: d
2292
- }), c = s);
2293
- }
2294
- X();
2295
- const M = Ql(
2296
- oe,
2297
- m.platform.is.ios === !0 ? 120 : 35
2298
- );
2299
- Ao(() => {
2300
- X();
2301
- });
2302
- let se = !1;
2303
- return Ct(() => {
2304
- se = !0;
2305
- }), Ll(() => {
2306
- if (se !== !0) return;
2307
- const s = t();
2308
- g !== void 0 && s !== void 0 && s !== null && s.nodeType !== 8 ? Tl(
2309
- s,
2310
- g,
2311
- i.virtualScrollHorizontal,
2312
- m.lang.rtl
2313
- ) : G(c);
2314
- }), ce(() => {
2315
- M.cancel();
2316
- }), Object.assign(d, { scrollTo: G, reset: H, refresh: Q }), {
2317
- virtualScrollSliceRange: R,
2318
- virtualScrollSliceSizeComputed: S,
2319
- setVirtualScrollSize: X,
2320
- onVirtualScrollEvt: M,
2321
- localResetVirtualScroll: te,
2322
- padVirtualScroll: re,
2323
- scrollTo: G,
2324
- reset: H,
2325
- refresh: Q
2326
- };
2327
- }
2328
- const ci = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/, di = /[\u4e00-\u9fff\u3400-\u4dbf\u{20000}-\u{2a6df}\u{2a700}-\u{2b73f}\u{2b740}-\u{2b81f}\u{2b820}-\u{2ceaf}\uf900-\ufaff\u3300-\u33ff\ufe30-\ufe4f\uf900-\ufaff\u{2f800}-\u{2fa1f}]/u, fi = /[\u3131-\u314e\u314f-\u3163\uac00-\ud7a3]/, vi = /[a-z0-9_ -]$/i;
2329
- function mi(e) {
2330
- return function(l) {
2331
- if (l.type === "compositionend" || l.type === "change") {
2332
- if (l.target.qComposing !== !0) return;
2333
- l.target.qComposing = !1, e(l);
2334
- } else l.type === "compositionupdate" && l.target.qComposing !== !0 && typeof l.data == "string" && (we.is.firefox === !0 ? vi.test(l.data) === !1 : ci.test(l.data) === !0 || di.test(l.data) === !0 || fi.test(l.data) === !0) === !0 && (l.target.qComposing = !0);
2335
- };
2336
- }
2337
- function Ce(e, t) {
2338
- if (e === t)
2339
- return !0;
2340
- if (e !== null && t !== null && typeof e == "object" && typeof t == "object") {
2341
- if (e.constructor !== t.constructor)
2342
- return !1;
2343
- let l, o;
2344
- if (e.constructor === Array) {
2345
- if (l = e.length, l !== t.length)
2346
- return !1;
2347
- for (o = l; o-- !== 0; )
2348
- if (Ce(e[o], t[o]) !== !0)
2349
- return !1;
2350
- return !0;
2351
- }
2352
- if (e.constructor === Map) {
2353
- if (e.size !== t.size)
2354
- return !1;
2355
- let i = e.entries();
2356
- for (o = i.next(); o.done !== !0; ) {
2357
- if (t.has(o.value[0]) !== !0)
2358
- return !1;
2359
- o = i.next();
2360
- }
2361
- for (i = e.entries(), o = i.next(); o.done !== !0; ) {
2362
- if (Ce(o.value[1], t.get(o.value[0])) !== !0)
2363
- return !1;
2364
- o = i.next();
2365
- }
2366
- return !0;
2367
- }
2368
- if (e.constructor === Set) {
2369
- if (e.size !== t.size)
2370
- return !1;
2371
- const i = e.entries();
2372
- for (o = i.next(); o.done !== !0; ) {
2373
- if (t.has(o.value[0]) !== !0)
2374
- return !1;
2375
- o = i.next();
2376
- }
2377
- return !0;
2378
- }
2379
- if (e.buffer != null && e.buffer.constructor === ArrayBuffer) {
2380
- if (l = e.length, l !== t.length)
2381
- return !1;
2382
- for (o = l; o-- !== 0; )
2383
- if (e[o] !== t[o])
2384
- return !1;
2385
- return !0;
2386
- }
2387
- if (e.constructor === RegExp)
2388
- return e.source === t.source && e.flags === t.flags;
2389
- if (e.valueOf !== Object.prototype.valueOf)
2390
- return e.valueOf() === t.valueOf();
2391
- if (e.toString !== Object.prototype.toString)
2392
- return e.toString() === t.toString();
2393
- const a = Object.keys(e).filter((i) => e[i] !== void 0);
2394
- if (l = a.length, l !== Object.keys(t).filter((i) => t[i] !== void 0).length)
2395
- return !1;
2396
- for (o = l; o-- !== 0; ) {
2397
- const i = a[o];
2398
- if (Ce(e[i], t[i]) !== !0)
2399
- return !1;
2400
- }
2401
- return !0;
2402
- }
2403
- return e !== e && t !== t;
2404
- }
2405
- function zl(e, t, l) {
2406
- if (l <= t)
2407
- return t;
2408
- const o = l - t + 1;
2409
- let a = t + (e - t) % o;
2410
- return a < t && (a = o + a), a === 0 ? 0 : a;
2411
- }
2412
- const Fl = (e) => ["add", "add-unique", "toggle"].includes(e), hi = ".*+?^${}()|[]\\", gi = Object.keys(Kt);
2413
- function $t(e, t) {
2414
- if (typeof e == "function") return e;
2415
- const l = e !== void 0 ? e : t;
2416
- return (o) => o !== null && typeof o == "object" && l in o ? o[l] : o;
2417
- }
2418
- const pi = be({
2419
- name: "QSelect",
2420
- inheritAttrs: !1,
2421
- props: {
2422
- ...Rl,
2423
- ...jl,
2424
- ...Kt,
2425
- // override of useFieldProps > modelValue
2426
- modelValue: {
2427
- required: !0
2428
- },
2429
- multiple: Boolean,
2430
- displayValue: [String, Number],
2431
- displayValueHtml: Boolean,
2432
- dropdownIcon: String,
2433
- options: {
2434
- type: Array,
2435
- default: () => []
2436
- },
2437
- optionValue: [Function, String],
2438
- optionLabel: [Function, String],
2439
- optionDisable: [Function, String],
2440
- hideSelected: Boolean,
2441
- hideDropdownIcon: Boolean,
2442
- fillInput: Boolean,
2443
- maxValues: [Number, String],
2444
- optionsDense: Boolean,
2445
- optionsDark: {
2446
- type: Boolean,
2447
- default: null
2448
- },
2449
- optionsSelectedClass: String,
2450
- optionsHtml: Boolean,
2451
- optionsCover: Boolean,
2452
- menuShrink: Boolean,
2453
- menuAnchor: String,
2454
- menuSelf: String,
2455
- menuOffset: Array,
2456
- popupContentClass: String,
2457
- popupContentStyle: [String, Array, Object],
2458
- popupNoRouteDismiss: Boolean,
2459
- useInput: Boolean,
2460
- useChips: Boolean,
2461
- newValueMode: {
2462
- type: String,
2463
- validator: Fl
2464
- },
2465
- mapOptions: Boolean,
2466
- emitValue: Boolean,
2467
- disableTabSelection: Boolean,
2468
- inputDebounce: {
2469
- type: [Number, String],
2470
- default: 500
2471
- },
2472
- inputClass: [Array, String, Object],
2473
- inputStyle: [Array, String, Object],
2474
- tabindex: {
2475
- type: [String, Number],
2476
- default: 0
2477
- },
2478
- autocomplete: String,
2479
- transitionShow: {},
2480
- transitionHide: {},
2481
- transitionDuration: {},
2482
- behavior: {
2483
- type: String,
2484
- validator: (e) => ["default", "menu", "dialog"].includes(e),
2485
- default: "default"
2486
- },
2487
- // override of useVirtualScrollProps > virtualScrollItemSize (no default)
2488
- virtualScrollItemSize: Rl.virtualScrollItemSize.type,
2489
- onNewValue: Function,
2490
- onFilter: Function
2491
- },
2492
- emits: [
2493
- ...Xl,
2494
- "add",
2495
- "remove",
2496
- "inputValue",
2497
- "keyup",
2498
- "keypress",
2499
- "keydown",
2500
- "popupShow",
2501
- "popupHide",
2502
- "filterAbort"
2503
- ],
2504
- setup(e, { slots: t, emit: l }) {
2505
- const { proxy: o } = le(), { $q: a } = o, i = T(!1), u = T(!1), d = T(-1), m = T(""), g = T(!1), c = T(!1);
2506
- let y = null, C = null, r, v, _, S = null, P, E, q, R;
2507
- const D = T(null), B = T(null), L = T(null), H = T(null), Q = T(null), G = ln(e), oe = mi(ll), A = f(() => Array.isArray(e.options) ? e.options.length : 0), U = f(() => e.virtualScrollItemSize === void 0 ? e.optionsDense === !0 ? 24 : 48 : e.virtualScrollItemSize), {
2508
- virtualScrollSliceRange: ne,
2509
- virtualScrollSliceSizeComputed: te,
2510
- localResetVirtualScroll: X,
2511
- padVirtualScroll: re,
2512
- onVirtualScrollEvt: k,
2513
- scrollTo: M,
2514
- setVirtualScrollSize: se
2515
- } = si({
2516
- virtualScrollLength: A,
2517
- getVirtualScrollTarget: mo,
2518
- getVirtualScrollEl: el,
2519
- virtualScrollItemSizeComputed: U
2520
- }), s = Yl(), p = f(() => {
2521
- const n = e.mapOptions === !0 && e.multiple !== !0, w = e.modelValue !== void 0 && (e.modelValue !== null || n === !0) ? e.multiple === !0 && Array.isArray(e.modelValue) ? e.modelValue : [e.modelValue] : [];
2522
- if (e.mapOptions === !0 && Array.isArray(e.options) === !0) {
2523
- const x = e.mapOptions === !0 && r !== void 0 ? r : [], $ = w.map((j) => vo(j, x));
2524
- return e.modelValue === null && n === !0 ? $.filter((j) => j !== null) : $;
2525
- }
2526
- return w;
2527
- }), O = f(() => {
2528
- const n = {};
2529
- return gi.forEach((w) => {
2530
- const x = e[w];
2531
- x !== void 0 && (n[w] = x);
2532
- }), n;
2533
- }), V = f(() => e.optionsDark === null ? s.isDark.value : e.optionsDark), I = f(() => Wt(p.value)), F = f(() => {
2534
- let n = "q-field__input q-placeholder col";
2535
- return e.hideSelected === !0 || p.value.length === 0 ? [n, e.inputClass] : (n += " q-field__input--padding", e.inputClass === void 0 ? n : [n, e.inputClass]);
2536
- }), z = f(
2537
- () => (e.virtualScrollHorizontal === !0 ? "q-virtual-scroll--horizontal" : "") + (e.popupContentClass ? " " + e.popupContentClass : "")
2538
- ), N = f(() => A.value === 0), b = f(
2539
- () => p.value.map((n) => ie.value(n)).join(", ")
2540
- ), Z = f(() => e.displayValue !== void 0 ? e.displayValue : b.value), ve = f(() => e.optionsHtml === !0 ? () => !0 : (n) => n != null && n.html === !0), ze = f(() => e.displayValueHtml === !0 || e.displayValue === void 0 && (e.optionsHtml === !0 || p.value.some(ve.value))), me = f(() => s.focused.value === !0 ? e.tabindex : -1), nt = f(() => {
2541
- const n = {
2542
- tabindex: e.tabindex,
2543
- role: "combobox",
2544
- "aria-label": e.label,
2545
- "aria-readonly": e.readonly === !0 ? "true" : "false",
2546
- "aria-autocomplete": e.useInput === !0 ? "list" : "none",
2547
- "aria-expanded": i.value === !0 ? "true" : "false",
2548
- "aria-controls": `${s.targetUid.value}_lb`
2549
- };
2550
- return d.value >= 0 && (n["aria-activedescendant"] = `${s.targetUid.value}_${d.value}`), n;
2551
- }), ke = f(() => ({
2552
- id: `${s.targetUid.value}_lb`,
2553
- role: "listbox",
2554
- "aria-multiselectable": e.multiple === !0 ? "true" : "false"
2555
- })), qe = f(() => p.value.map((n, w) => ({
2556
- index: w,
2557
- opt: n,
2558
- html: ve.value(n),
2559
- selected: !0,
2560
- removeAtIndex: fo,
2561
- toggleOption: Ve,
2562
- tabindex: me.value
2563
- }))), it = f(() => {
2564
- if (A.value === 0)
2565
- return [];
2566
- const { from: n, to: w } = ne.value;
2567
- return e.options.slice(n, w).map((x, $) => {
2568
- const j = Fe.value(x) === !0, W = _t(x) === !0, J = n + $, Y = {
2569
- clickable: !0,
2570
- active: W,
2571
- activeClass: Ke.value,
2572
- manualFocus: !0,
2573
- focused: !1,
2574
- disable: j,
2575
- tabindex: -1,
2576
- dense: e.optionsDense,
2577
- dark: V.value,
2578
- role: "option",
2579
- "aria-selected": W === !0 ? "true" : "false",
2580
- id: `${s.targetUid.value}_${J}`,
2581
- onClick: () => {
2582
- Ve(x);
2583
- }
2584
- };
2585
- return j !== !0 && (d.value === J && (Y.focused = !0), a.platform.is.desktop === !0 && (Y.onMousemove = () => {
2586
- i.value === !0 && Me(J);
2587
- })), {
2588
- index: J,
2589
- opt: x,
2590
- html: ve.value(x),
2591
- label: ie.value(x),
2592
- selected: Y.active,
2593
- focused: Y.focused,
2594
- toggleOption: Ve,
2595
- setOptionIndex: Me,
2596
- itemProps: Y
2597
- };
2598
- });
2599
- }), Ne = f(() => e.dropdownIcon !== void 0 ? e.dropdownIcon : a.iconSet.arrow.dropdown), qt = f(
2600
- () => e.optionsCover === !1 && e.outlined !== !0 && e.standout !== !0 && e.borderless !== !0 && e.rounded !== !0
2601
- ), Ke = f(() => e.optionsSelectedClass !== void 0 ? e.optionsSelectedClass : e.color !== void 0 ? `text-${e.color}` : ""), he = f(() => $t(e.optionValue, "value")), ie = f(() => $t(e.optionLabel, "label")), Fe = f(() => $t(e.optionDisable, "disable")), ut = f(() => p.value.map(he.value)), co = f(() => {
2602
- const n = {
2603
- onInput: ll,
2604
- // Safari < 10.2 & UIWebView doesn't fire compositionend when
2605
- // switching focus before confirming composition choice
2606
- // this also fixes the issue where some browsers e.g. iOS Chrome
2607
- // fires "change" instead of "input" on autocomplete.
2608
- onChange: oe,
2609
- onKeydown: Jt,
2610
- onKeyup: Gt,
2611
- onKeypress: Zt,
2612
- onFocus: Xt,
2613
- onClick(w) {
2614
- v === !0 && De(w);
2615
- }
2616
- };
2617
- return n.onCompositionstart = n.onCompositionupdate = n.onCompositionend = oe, n;
2618
- });
2619
- K(p, (n) => {
2620
- r = n, e.useInput === !0 && e.fillInput === !0 && e.multiple !== !0 && s.innerLoading.value !== !0 && (u.value !== !0 && i.value !== !0 || I.value !== !0) && (_ !== !0 && He(), (u.value === !0 || i.value === !0) && Le(""));
2621
- }, { immediate: !0 }), K(() => e.fillInput, He), K(i, Et), K(A, Vo);
2622
- function Qt(n) {
2623
- return e.emitValue === !0 ? he.value(n) : n;
2624
- }
2625
- function Vt(n) {
2626
- if (n !== -1 && n < p.value.length)
2627
- if (e.multiple === !0) {
2628
- const w = e.modelValue.slice();
2629
- l("remove", { index: n, value: w.splice(n, 1)[0] }), l("update:modelValue", w);
2630
- } else
2631
- l("update:modelValue", null);
2632
- }
2633
- function fo(n) {
2634
- Vt(n), s.focus();
2635
- }
2636
- function Ut(n, w) {
2637
- const x = Qt(n);
2638
- if (e.multiple !== !0) {
2639
- e.fillInput === !0 && Qe(
2640
- ie.value(n),
2641
- !0,
2642
- !0
2643
- ), l("update:modelValue", x);
2644
- return;
2645
- }
2646
- if (p.value.length === 0) {
2647
- l("add", { index: 0, value: x }), l("update:modelValue", e.multiple === !0 ? [x] : x);
2648
- return;
2649
- }
2650
- if (w === !0 && _t(n) === !0 || e.maxValues !== void 0 && e.modelValue.length >= e.maxValues)
2651
- return;
2652
- const $ = e.modelValue.slice();
2653
- l("add", { index: $.length, value: x }), $.push(x), l("update:modelValue", $);
2654
- }
2655
- function Ve(n, w) {
2656
- if (s.editable.value !== !0 || n === void 0 || Fe.value(n) === !0)
2657
- return;
2658
- const x = he.value(n);
2659
- if (e.multiple !== !0) {
2660
- w !== !0 && (Qe(
2661
- e.fillInput === !0 ? ie.value(n) : "",
2662
- !0,
2663
- !0
2664
- ), _e()), B.value !== null && B.value.focus(), (p.value.length === 0 || Ce(he.value(p.value[0]), x) !== !0) && l("update:modelValue", e.emitValue === !0 ? x : n);
2665
- return;
2666
- }
2667
- if ((v !== !0 || g.value === !0) && s.focus(), Xt(), p.value.length === 0) {
2668
- const W = e.emitValue === !0 ? x : n;
2669
- l("add", { index: 0, value: W }), l("update:modelValue", e.multiple === !0 ? [W] : W);
2670
- return;
2671
- }
2672
- const $ = e.modelValue.slice(), j = ut.value.findIndex((W) => Ce(W, x));
2673
- if (j !== -1)
2674
- l("remove", { index: j, value: $.splice(j, 1)[0] });
2675
- else {
2676
- if (e.maxValues !== void 0 && $.length >= e.maxValues)
2677
- return;
2678
- const W = e.emitValue === !0 ? x : n;
2679
- l("add", { index: $.length, value: W }), $.push(W);
2680
- }
2681
- l("update:modelValue", $);
2682
- }
2683
- function Me(n) {
2684
- if (a.platform.is.desktop !== !0) return;
2685
- const w = n !== -1 && n < A.value ? n : -1;
2686
- d.value !== w && (d.value = w);
2687
- }
2688
- function at(n = 1, w) {
2689
- if (i.value === !0) {
2690
- let x = d.value;
2691
- do
2692
- x = zl(
2693
- x + n,
2694
- -1,
2695
- A.value - 1
2696
- );
2697
- while (x !== -1 && x !== d.value && Fe.value(e.options[x]) === !0);
2698
- d.value !== x && (Me(x), M(x), w !== !0 && e.useInput === !0 && e.fillInput === !0 && rt(
2699
- x >= 0 ? ie.value(e.options[x]) : P,
2700
- !0
2701
- ));
2702
- }
2703
- }
2704
- function vo(n, w) {
2705
- const x = ($) => Ce(he.value($), n);
2706
- return e.options.find(x) || w.find(x) || n;
2707
- }
2708
- function _t(n) {
2709
- const w = he.value(n);
2710
- return ut.value.find((x) => Ce(x, w)) !== void 0;
2711
- }
2712
- function Xt(n) {
2713
- e.useInput === !0 && B.value !== null && (n === void 0 || B.value === n.target && n.target.value === b.value) && B.value.select();
2714
- }
2715
- function Yt(n) {
2716
- kt(n, 27) === !0 && i.value === !0 && (De(n), _e(), He()), l("keyup", n);
2717
- }
2718
- function Gt(n) {
2719
- const { value: w } = n.target;
2720
- if (n.keyCode !== void 0) {
2721
- Yt(n);
2722
- return;
2723
- }
2724
- if (n.target.value = "", y !== null && (clearTimeout(y), y = null), C !== null && (clearTimeout(C), C = null), He(), typeof w == "string" && w.length !== 0) {
2725
- const x = w.toLocaleLowerCase(), $ = (W) => {
2726
- const J = e.options.find((Y) => String(W.value(Y)).toLocaleLowerCase() === x);
2727
- return J === void 0 ? !1 : (p.value.indexOf(J) === -1 ? Ve(J) : _e(), !0);
2728
- }, j = (W) => {
2729
- $(he) !== !0 && W !== !0 && $(ie) !== !0 && Le(w, !0, () => j(!0));
2730
- };
2731
- j();
2732
- } else
2733
- s.clearValue(n);
2734
- }
2735
- function Zt(n) {
2736
- l("keypress", n);
2737
- }
2738
- function Jt(n) {
2739
- if (l("keydown", n), Xo(n) === !0)
2740
- return;
2741
- const w = m.value.length !== 0 && (e.newValueMode !== void 0 || e.onNewValue !== void 0), x = n.shiftKey !== !0 && e.disableTabSelection !== !0 && e.multiple !== !0 && (d.value !== -1 || w === !0);
2742
- if (n.keyCode === 27) {
2743
- pe(n);
2744
- return;
2745
- }
2746
- if (n.keyCode === 9 && x === !1) {
2747
- Oe();
2748
- return;
2749
- }
2750
- if (n.target === void 0 || n.target.id !== s.targetUid.value || s.editable.value !== !0) return;
2751
- if (n.keyCode === 40 && s.innerLoading.value !== !0 && i.value === !1) {
2752
- ae(n), Ie();
2753
- return;
2754
- }
2755
- if (n.keyCode === 8 && (e.useChips === !0 || e.clearable === !0) && e.hideSelected !== !0 && m.value.length === 0) {
2756
- e.multiple === !0 && Array.isArray(e.modelValue) === !0 ? Vt(e.modelValue.length - 1) : e.multiple !== !0 && e.modelValue !== null && l("update:modelValue", null);
2757
- return;
2758
- }
2759
- (n.keyCode === 35 || n.keyCode === 36) && (typeof m.value != "string" || m.value.length === 0) && (ae(n), d.value = -1, at(n.keyCode === 36 ? 1 : -1, e.multiple)), (n.keyCode === 33 || n.keyCode === 34) && te.value !== void 0 && (ae(n), d.value = Math.max(
2760
- -1,
2761
- Math.min(
2762
- A.value,
2763
- d.value + (n.keyCode === 33 ? -1 : 1) * te.value.view
2764
- )
2765
- ), at(n.keyCode === 33 ? 1 : -1, e.multiple)), (n.keyCode === 38 || n.keyCode === 40) && (ae(n), at(n.keyCode === 38 ? -1 : 1, e.multiple));
2766
- const $ = A.value;
2767
- if ((q === void 0 || R < Date.now()) && (q = ""), $ > 0 && e.useInput !== !0 && n.key !== void 0 && n.key.length === 1 && n.altKey === !1 && n.ctrlKey === !1 && n.metaKey === !1 && (n.keyCode !== 32 || q.length !== 0)) {
2768
- i.value !== !0 && Ie(n);
2769
- const j = n.key.toLocaleLowerCase(), W = q.length === 1 && q[0] === j;
2770
- R = Date.now() + 1500, W === !1 && (ae(n), q += j);
2771
- const J = new RegExp("^" + q.split("").map((Bt) => hi.indexOf(Bt) !== -1 ? "\\" + Bt : Bt).join(".*"), "i");
2772
- let Y = d.value;
2773
- if (W === !0 || Y < 0 || J.test(ie.value(e.options[Y])) !== !0)
2774
- do
2775
- Y = zl(Y + 1, -1, $ - 1);
2776
- while (Y !== d.value && (Fe.value(e.options[Y]) === !0 || J.test(ie.value(e.options[Y])) !== !0));
2777
- d.value !== Y && ue(() => {
2778
- Me(Y), M(Y), Y >= 0 && e.useInput === !0 && e.fillInput === !0 && rt(ie.value(e.options[Y]), !0);
2779
- });
2780
- return;
2781
- }
2782
- if (!(n.keyCode !== 13 && (n.keyCode !== 32 || e.useInput === !0 || q !== "") && (n.keyCode !== 9 || x === !1))) {
2783
- if (n.keyCode !== 9 && ae(n), d.value !== -1 && d.value < $) {
2784
- Ve(e.options[d.value]);
2785
- return;
2786
- }
2787
- if (w === !0) {
2788
- const j = (W, J) => {
2789
- if (J) {
2790
- if (Fl(J) !== !0)
2791
- return;
2792
- } else
2793
- J = e.newValueMode;
2794
- if (Qe("", e.multiple !== !0, !0), W == null)
2795
- return;
2796
- (J === "toggle" ? Ve : Ut)(W, J === "add-unique"), e.multiple !== !0 && (B.value !== null && B.value.focus(), _e());
2797
- };
2798
- if (e.onNewValue !== void 0 ? l("newValue", m.value, j) : j(m.value), e.multiple !== !0)
2799
- return;
2800
- }
2801
- i.value === !0 ? Oe() : s.innerLoading.value !== !0 && Ie();
2802
- }
2803
- }
2804
- function el() {
2805
- return v === !0 ? Q.value : L.value !== null && L.value.contentEl !== null ? L.value.contentEl : void 0;
2806
- }
2807
- function mo() {
2808
- return el();
2809
- }
2810
- function ho() {
2811
- return e.hideSelected === !0 ? [] : t["selected-item"] !== void 0 ? qe.value.map((n) => t["selected-item"](n)).slice() : t.selected !== void 0 ? [].concat(t.selected()) : e.useChips === !0 ? qe.value.map((n, w) => h(kn, {
2812
- key: "option-" + w,
2813
- removable: s.editable.value === !0 && Fe.value(n.opt) !== !0,
2814
- dense: !0,
2815
- textColor: e.color,
2816
- tabindex: me.value,
2817
- onRemove() {
2818
- n.removeAtIndex(w);
2819
- }
2820
- }, () => h("span", {
2821
- class: "ellipsis",
2822
- [n.html === !0 ? "innerHTML" : "textContent"]: ie.value(n.opt)
2823
- }))) : [
2824
- h("span", {
2825
- [ze.value === !0 ? "innerHTML" : "textContent"]: Z.value
2826
- })
2827
- ];
2828
- }
2829
- function tl() {
2830
- if (N.value === !0)
2831
- return t["no-option"] !== void 0 ? t["no-option"]({ inputValue: m.value }) : void 0;
2832
- const n = t.option !== void 0 ? t.option : (x) => h(Kl, {
2833
- key: x.index,
2834
- ...x.itemProps
2835
- }, () => h(
2836
- pt,
2837
- () => h(
2838
- Nl,
2839
- () => h("span", {
2840
- [x.html === !0 ? "innerHTML" : "textContent"]: x.label
2841
- })
2842
- )
2843
- ));
2844
- let w = re("div", it.value.map(n));
2845
- return t["before-options"] !== void 0 && (w = t["before-options"]().concat(w)), Il(t["after-options"], w);
2846
- }
2847
- function go(n, w) {
2848
- const x = w === !0 ? { ...nt.value, ...s.splitAttrs.attributes.value } : void 0, $ = {
2849
- ref: w === !0 ? B : void 0,
2850
- key: "i_t",
2851
- class: F.value,
2852
- style: e.inputStyle,
2853
- value: m.value !== void 0 ? m.value : "",
2854
- // required for Android in order to show ENTER key when in form
2855
- type: "search",
2856
- ...x,
2857
- id: w === !0 ? s.targetUid.value : void 0,
2858
- maxlength: e.maxlength,
2859
- autocomplete: e.autocomplete,
2860
- "data-autofocus": n === !0 || e.autofocus === !0 || void 0,
2861
- disabled: e.disable === !0,
2862
- readonly: e.readonly === !0,
2863
- ...co.value
2864
- };
2865
- return n !== !0 && v === !0 && (Array.isArray($.class) === !0 ? $.class = [...$.class, "no-pointer-events"] : $.class += " no-pointer-events"), h("input", $);
2866
- }
2867
- function ll(n) {
2868
- y !== null && (clearTimeout(y), y = null), C !== null && (clearTimeout(C), C = null), !(n && n.target && n.target.qComposing === !0) && (rt(n.target.value || ""), _ = !0, P = m.value, s.focused.value !== !0 && (v !== !0 || g.value === !0) && s.focus(), e.onFilter !== void 0 && (y = setTimeout(() => {
2869
- y = null, Le(m.value);
2870
- }, e.inputDebounce)));
2871
- }
2872
- function rt(n, w) {
2873
- m.value !== n && (m.value = n, w === !0 || e.inputDebounce === 0 || e.inputDebounce === "0" ? l("inputValue", n) : C = setTimeout(() => {
2874
- C = null, l("inputValue", n);
2875
- }, e.inputDebounce));
2876
- }
2877
- function Qe(n, w, x) {
2878
- _ = x !== !0, e.useInput === !0 && (rt(n, !0), (w === !0 || x !== !0) && (P = n), w !== !0 && Le(n));
2879
- }
2880
- function Le(n, w, x) {
2881
- if (e.onFilter === void 0 || w !== !0 && s.focused.value !== !0)
2882
- return;
2883
- s.innerLoading.value === !0 ? l("filterAbort") : (s.innerLoading.value = !0, c.value = !0), n !== "" && e.multiple !== !0 && p.value.length !== 0 && _ !== !0 && n === ie.value(p.value[0]) && (n = "");
2884
- const $ = setTimeout(() => {
2885
- i.value === !0 && (i.value = !1);
2886
- }, 10);
2887
- S !== null && clearTimeout(S), S = $, l(
2888
- "filter",
2889
- n,
2890
- (j, W) => {
2891
- (w === !0 || s.focused.value === !0) && S === $ && (clearTimeout(S), typeof j == "function" && j(), c.value = !1, ue(() => {
2892
- s.innerLoading.value = !1, s.editable.value === !0 && (w === !0 ? i.value === !0 && _e() : i.value === !0 ? Et(!0) : i.value = !0), typeof W == "function" && ue(() => {
2893
- W(o);
2894
- }), typeof x == "function" && ue(() => {
2895
- x(o);
2896
- });
2897
- }));
2898
- },
2899
- () => {
2900
- s.focused.value === !0 && S === $ && (clearTimeout(S), s.innerLoading.value = !1, c.value = !1), i.value === !0 && (i.value = !1);
2901
- }
2902
- );
2903
- }
2904
- function po() {
2905
- return h(Zn, {
2906
- ref: L,
2907
- class: z.value,
2908
- style: e.popupContentStyle,
2909
- modelValue: i.value,
2910
- fit: e.menuShrink !== !0,
2911
- cover: e.optionsCover === !0 && N.value !== !0 && e.useInput !== !0,
2912
- anchor: e.menuAnchor,
2913
- self: e.menuSelf,
2914
- offset: e.menuOffset,
2915
- dark: V.value,
2916
- noParentEvent: !0,
2917
- noRefocus: !0,
2918
- noFocus: !0,
2919
- noRouteDismiss: e.popupNoRouteDismiss,
2920
- square: qt.value,
2921
- transitionShow: e.transitionShow,
2922
- transitionHide: e.transitionHide,
2923
- transitionDuration: e.transitionDuration,
2924
- separateClosePopup: !0,
2925
- ...ke.value,
2926
- onScrollPassive: k,
2927
- onBeforeShow: nl,
2928
- onBeforeHide: bo,
2929
- onShow: yo
2930
- }, tl);
2931
- }
2932
- function bo(n) {
2933
- il(n), Oe();
2934
- }
2935
- function yo() {
2936
- se();
2937
- }
2938
- function So(n) {
2939
- De(n), B.value !== null && B.value.focus(), g.value = !0, window.scrollTo(window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, 0);
2940
- }
2941
- function wo(n) {
2942
- De(n), ue(() => {
2943
- g.value = !1;
2944
- });
2945
- }
2946
- function xo() {
2947
- const n = [
2948
- h(xn, {
2949
- class: `col-auto ${s.fieldClass.value}`,
2950
- ...O.value,
2951
- for: s.targetUid.value,
2952
- dark: V.value,
2953
- square: !0,
2954
- loading: c.value,
2955
- itemAligned: !1,
2956
- filled: !0,
2957
- stackLabel: m.value.length !== 0,
2958
- ...s.splitAttrs.listeners.value,
2959
- onFocus: So,
2960
- onBlur: wo
2961
- }, {
2962
- ...t,
2963
- rawControl: () => s.getControl(!0),
2964
- before: void 0,
2965
- after: void 0
2966
- })
2967
- ];
2968
- return i.value === !0 && n.push(
2969
- h("div", {
2970
- ref: Q,
2971
- class: z.value + " scroll",
2972
- style: e.popupContentStyle,
2973
- ...ke.value,
2974
- onClick: pe,
2975
- onScrollPassive: k
2976
- }, tl())
2977
- ), h(ii, {
2978
- ref: H,
2979
- modelValue: u.value,
2980
- position: e.useInput === !0 ? "top" : void 0,
2981
- transitionShow: E,
2982
- transitionHide: e.transitionHide,
2983
- transitionDuration: e.transitionDuration,
2984
- noRouteDismiss: e.popupNoRouteDismiss,
2985
- onBeforeShow: nl,
2986
- onBeforeHide: Co,
2987
- onHide: ko,
2988
- onShow: qo
2989
- }, () => h("div", {
2990
- class: "q-select__dialog" + (V.value === !0 ? " q-select__dialog--dark q-dark" : "") + (g.value === !0 ? " q-select__dialog--focused" : "")
2991
- }, n));
2992
- }
2993
- function Co(n) {
2994
- il(n), H.value !== null && H.value.__updateRefocusTarget(
2995
- s.rootRef.value.querySelector(".q-field__native > [tabindex]:last-child")
2996
- ), s.focused.value = !1;
2997
- }
2998
- function ko(n) {
2999
- _e(), s.focused.value === !1 && l("blur", n), He();
3000
- }
3001
- function qo() {
3002
- const n = document.activeElement;
3003
- (n === null || n.id !== s.targetUid.value) && B.value !== null && B.value !== n && B.value.focus(), se();
3004
- }
3005
- function Oe() {
3006
- u.value !== !0 && (d.value = -1, i.value === !0 && (i.value = !1), s.focused.value === !1 && (S !== null && (clearTimeout(S), S = null), s.innerLoading.value === !0 && (l("filterAbort"), s.innerLoading.value = !1, c.value = !1)));
3007
- }
3008
- function Ie(n) {
3009
- s.editable.value === !0 && (v === !0 ? (s.onControlFocusin(n), u.value = !0, ue(() => {
3010
- s.focus();
3011
- })) : s.focus(), e.onFilter !== void 0 ? Le(m.value) : (N.value !== !0 || t["no-option"] !== void 0) && (i.value = !0));
3012
- }
3013
- function _e() {
3014
- u.value = !1, Oe();
3015
- }
3016
- function He() {
3017
- e.useInput === !0 && Qe(
3018
- e.multiple !== !0 && e.fillInput === !0 && p.value.length !== 0 && ie.value(p.value[0]) || "",
3019
- !0,
3020
- !0
3021
- );
3022
- }
3023
- function Et(n) {
3024
- let w = -1;
3025
- if (n === !0) {
3026
- if (p.value.length !== 0) {
3027
- const x = he.value(p.value[0]);
3028
- w = e.options.findIndex(($) => Ce(he.value($), x));
3029
- }
3030
- X(w);
3031
- }
3032
- Me(w);
3033
- }
3034
- function Vo(n, w) {
3035
- i.value === !0 && s.innerLoading.value === !1 && (X(-1, !0), ue(() => {
3036
- i.value === !0 && s.innerLoading.value === !1 && (n > w ? X() : Et(!0));
3037
- }));
3038
- }
3039
- function ol() {
3040
- u.value === !1 && L.value !== null && L.value.updatePosition();
3041
- }
3042
- function nl(n) {
3043
- n !== void 0 && De(n), l("popupShow", n), s.hasPopupOpen = !0, s.onControlFocusin(n);
3044
- }
3045
- function il(n) {
3046
- n !== void 0 && De(n), l("popupHide", n), s.hasPopupOpen = !1, s.onControlFocusout(n);
3047
- }
3048
- function ul() {
3049
- v = a.platform.is.mobile !== !0 && e.behavior !== "dialog" ? !1 : e.behavior !== "menu" && (e.useInput === !0 ? t["no-option"] !== void 0 || e.onFilter !== void 0 || N.value === !1 : !0), E = a.platform.is.ios === !0 && v === !0 && e.useInput === !0 ? "fade" : e.transitionShow;
3050
- }
3051
- return Ml(ul), To(ol), ul(), ce(() => {
3052
- y !== null && clearTimeout(y), C !== null && clearTimeout(C);
3053
- }), Object.assign(o, {
3054
- showPopup: Ie,
3055
- hidePopup: _e,
3056
- removeAtIndex: Vt,
3057
- add: Ut,
3058
- toggleOption: Ve,
3059
- getOptionIndex: () => d.value,
3060
- setOptionIndex: Me,
3061
- moveOptionSelection: at,
3062
- filter: Le,
3063
- updateMenuPosition: ol,
3064
- updateInputValue: Qe,
3065
- isOptionSelected: _t,
3066
- getEmittingOptionValue: Qt,
3067
- isOptionDisabled: (...n) => Fe.value.apply(null, n) === !0,
3068
- getOptionValue: (...n) => he.value.apply(null, n),
3069
- getOptionLabel: (...n) => ie.value.apply(null, n)
3070
- }), Object.assign(s, {
3071
- innerValue: p,
3072
- fieldClass: f(
3073
- () => `q-select q-field--auto-height q-select--with${e.useInput !== !0 ? "out" : ""}-input q-select--with${e.useChips !== !0 ? "out" : ""}-chips q-select--${e.multiple === !0 ? "multiple" : "single"}`
3074
- ),
3075
- inputRef: D,
3076
- targetRef: B,
3077
- hasValue: I,
3078
- showPopup: Ie,
3079
- floatingLabel: f(
3080
- () => e.hideSelected !== !0 && I.value === !0 || typeof m.value == "number" || m.value.length !== 0 || Wt(e.displayValue)
3081
- ),
3082
- getControlChild: () => {
3083
- if (s.editable.value !== !1 && (u.value === !0 || N.value !== !0 || t["no-option"] !== void 0))
3084
- return v === !0 ? xo() : po();
3085
- s.hasPopupOpen === !0 && (s.hasPopupOpen = !1);
3086
- },
3087
- controlEvents: {
3088
- onFocusin(n) {
3089
- s.onControlFocusin(n);
3090
- },
3091
- onFocusout(n) {
3092
- s.onControlFocusout(n, () => {
3093
- He(), Oe();
3094
- });
3095
- },
3096
- onClick(n) {
3097
- if (pe(n), v !== !0 && i.value === !0) {
3098
- Oe(), B.value !== null && B.value.focus();
3099
- return;
3100
- }
3101
- Ie(n);
3102
- }
3103
- },
3104
- getControl: (n) => {
3105
- const w = ho(), x = n === !0 || u.value !== !0 || v !== !0;
3106
- if (e.useInput === !0)
3107
- w.push(go(n, x));
3108
- else if (s.editable.value === !0) {
3109
- const j = x === !0 ? nt.value : void 0;
3110
- w.push(
3111
- h("input", {
3112
- ref: x === !0 ? B : void 0,
3113
- key: "d_t",
3114
- class: "q-select__focus-target",
3115
- id: x === !0 ? s.targetUid.value : void 0,
3116
- value: Z.value,
3117
- readonly: !0,
3118
- "data-autofocus": n === !0 || e.autofocus === !0 || void 0,
3119
- ...j,
3120
- onKeydown: Jt,
3121
- onKeyup: Yt,
3122
- onKeypress: Zt
3123
- })
3124
- ), x === !0 && typeof e.autocomplete == "string" && e.autocomplete.length !== 0 && w.push(
3125
- h("input", {
3126
- class: "q-select__autocomplete-input",
3127
- autocomplete: e.autocomplete,
3128
- tabindex: -1,
3129
- onKeyup: Gt
3130
- })
3131
- );
3132
- }
3133
- if (G.value !== void 0 && e.disable !== !0 && ut.value.length !== 0) {
3134
- const j = ut.value.map((W) => h("option", { value: W, selected: !0 }));
3135
- w.push(
3136
- h("select", {
3137
- class: "hidden",
3138
- name: G.value,
3139
- multiple: e.multiple
3140
- }, j)
3141
- );
3142
- }
3143
- const $ = e.useInput === !0 || x !== !0 ? void 0 : s.splitAttrs.attributes.value;
3144
- return h("div", {
3145
- class: "q-field__native row items-center",
3146
- ...$,
3147
- ...s.splitAttrs.listeners.value
3148
- }, w);
3149
- },
3150
- getInnerAppend: () => e.loading !== !0 && c.value !== !0 && e.hideDropdownIcon !== !0 ? [
3151
- h(Ae, {
3152
- class: "q-select__dropdown-icon" + (i.value === !0 ? " rotate-180" : ""),
3153
- name: Ne.value
3154
- })
3155
- ] : null
3156
- }), Gl(s);
3157
- }
3158
- }), bi = { class: "app-select__amount" }, yi = /* @__PURE__ */ Ro({
3159
- __name: "AppSelect",
3160
- props: {
3161
- modelValue: {},
3162
- size: { default: Yo.MD },
3163
- options: {},
3164
- multiple: { type: Boolean },
3165
- label: {},
3166
- placeholder: {},
3167
- required: { type: Boolean },
3168
- clearable: { type: Boolean },
3169
- disabled: { type: Boolean },
3170
- loading: { type: Boolean },
3171
- filtering: { type: Boolean },
3172
- autofocus: { type: Boolean },
3173
- rules: {},
3174
- lazyRules: { type: [Boolean, String] },
3175
- menuClass: {}
3176
- },
3177
- emits: ["update:modelValue"],
3178
- setup(e, { emit: t }) {
3179
- const l = e, o = t, a = T(!1), i = T(""), u = f({
3180
- get() {
3181
- if (l.modelValue) {
3182
- if (l.multiple && Array.isArray(l.modelValue))
3183
- return l.options.filter(
3184
- (r) => l.modelValue.includes(r.value)
3185
- );
3186
- if (!Array.isArray(l.modelValue))
3187
- return l.options.find(
3188
- (r) => r.value === l.modelValue
3189
- );
3190
- }
3191
- },
3192
- set(r) {
3193
- if (!r) {
3194
- o("update:modelValue", void 0);
3195
- return;
3196
- }
3197
- if (l.multiple && Array.isArray(r)) {
3198
- const v = r.map((_) => _.value);
3199
- o("update:modelValue", v);
3200
- } else Array.isArray(r) || o("update:modelValue", r.value);
3201
- }
3202
- }), d = f(() => {
3203
- var r;
3204
- if (Array.isArray(u.value)) {
3205
- if (l.multiple && u.value.length == 0)
3206
- return l.placeholder;
3207
- } else return ((r = u.value) == null ? void 0 : r.label) || l.placeholder || "";
3208
- return "";
3209
- }), m = f(() => !(!l.clearable || !l.modelValue || l.modelValue && Array.isArray(l.modelValue) && !l.modelValue.length)), g = f(() => i.value ? l.options.filter(
3210
- (r) => r.label.toLowerCase().includes(i.value.toLowerCase())
3211
- ) : l.options), c = f(() => {
3212
- if (l.rules)
3213
- return l.required ? [...l.rules, cl] : l.rules;
3214
- if (l.required)
3215
- return [cl];
3216
- }), y = () => {
3217
- u.value = void 0;
3218
- }, C = (r, v) => {
3219
- v(() => {
3220
- i.value = r;
3221
- });
3222
- };
3223
- return (r, v) => (de(), ye("div", {
3224
- class: st(["app-select", [{ "app-select_opened": a.value }, `app-select_${r.size}`]])
3225
- }, [
3226
- r.label ? (de(), ye("label", {
3227
- key: 0,
3228
- class: st(["app-select__label", { "app-select__label_bold": r.required }])
3229
- }, Ue(r.required ? `${r.label} *` : r.label), 3)) : Pe("", !0),
3230
- Xe(zo(pi), {
3231
- standout: "",
3232
- "hide-bottom-space": "",
3233
- "hide-dropdown-icon": "",
3234
- "no-error-icon": "",
3235
- behavior: "menu",
3236
- "popup-no-route-dismiss": "",
3237
- "popup-content-class": `app-select-menu app-select-menu_${r.size} ${r.menuClass}`,
3238
- placeholder: r.filtering && "Почніть вводити",
3239
- "input-debounce": "50",
3240
- modelValue: u.value,
3241
- "onUpdate:modelValue": v[0] || (v[0] = (_) => u.value = _),
3242
- options: g.value,
3243
- multiple: r.multiple,
3244
- "use-input": r.filtering && (Array.isArray(u.value) || !u.value),
3245
- rules: c.value,
3246
- "lazy-rules": r.lazyRules,
3247
- autofocus: r.autofocus,
3248
- disable: r.disabled,
3249
- loading: r.loading,
3250
- onFilter: C,
3251
- onPopupShow: v[1] || (v[1] = (_) => a.value = !0),
3252
- onPopupHide: v[2] || (v[2] = (_) => a.value = !1)
3253
- }, {
3254
- append: xe(() => [
3255
- m.value ? (de(), ye("i", {
3256
- key: 0,
3257
- class: "icon-kl icon-kl-close app-select__clear",
3258
- onClick: Mo(y, ["stop", "prevent"])
3259
- })) : Pe("", !0),
3260
- v[3] || (v[3] = At("i", { class: "icon-kl icon-kl-arrow-down app-select__drop-icon" }, null, -1))
3261
- ]),
3262
- selected: xe(() => {
3263
- var _, S;
3264
- return [
3265
- Array.isArray(u.value) ? (de(), ye(ct, { key: 0 }, [
3266
- !r.filtering || u.value.length ? (de(), ye("span", {
3267
- key: 0,
3268
- class: st([
3269
- "app-select__selected",
3270
- {
3271
- "app-select__placeholder": !((_ = u.value) != null && _.length) && r.placeholder
3272
- }
3273
- ])
3274
- }, [
3275
- (S = u.value) != null && S.length ? (de(), ye(ct, { key: 0 }, [
3276
- v[4] || (v[4] = Tt(" Вибрано ")),
3277
- At("span", bi, Ue(u.value.length), 1)
3278
- ], 64)) : (de(), ye(ct, { key: 1 }, [
3279
- Tt(Ue(l.placeholder), 1)
3280
- ], 64))
3281
- ], 2)) : Pe("", !0)
3282
- ], 64)) : (de(), ye(ct, { key: 1 }, [
3283
- !r.filtering || u.value ? (de(), ye("span", {
3284
- key: 0,
3285
- class: st([
3286
- "app-select__selected",
3287
- { "app-select__placeholder": !u.value && r.placeholder }
3288
- ])
3289
- }, Ue(d.value), 3)) : Pe("", !0)
3290
- ], 64))
3291
- ];
3292
- }),
3293
- option: xe((_) => [
3294
- Xe(Kl, Fo({
3295
- class: ["app-select__option", { "app-select__option_selected": _.selected }]
3296
- }, _.itemProps), {
3297
- default: xe(() => [
3298
- l.multiple ? (de(), al(pt, {
3299
- key: 0,
3300
- class: "option-multiple",
3301
- avatar: ""
3302
- }, {
3303
- default: xe(() => [
3304
- Xe(sn, {
3305
- size: "30px",
3306
- "model-value": _.selected,
3307
- "onUpdate:modelValue": () => _.toggleOption(_.opt)
3308
- }, null, 8, ["model-value", "onUpdate:modelValue"])
3309
- ]),
3310
- _: 2
3311
- }, 1024)) : Pe("", !0),
3312
- _.opt.done ? (de(), al(pt, {
3313
- key: 1,
3314
- class: "option-done",
3315
- avatar: ""
3316
- }, {
3317
- default: xe(() => v[5] || (v[5] = [
3318
- At("i", { class: "icon-kl icon-kl-check option-done__icon" }, null, -1)
3319
- ])),
3320
- _: 1
3321
- })) : Pe("", !0),
3322
- Xe(pt, null, {
3323
- default: xe(() => [
3324
- Xe(Nl, null, {
3325
- default: xe(() => [
3326
- Tt(Ue(_.opt.label), 1)
3327
- ]),
3328
- _: 2
3329
- }, 1024)
3330
- ]),
3331
- _: 2
3332
- }, 1024)
3333
- ]),
3334
- _: 2
3335
- }, 1040, ["class"])
3336
- ]),
3337
- _: 1
3338
- }, 8, ["popup-content-class", "placeholder", "modelValue", "options", "multiple", "use-input", "rules", "lazy-rules", "autofocus", "disable", "loading"])
3339
- ], 2));
3340
- }
3341
- }), Ci = /* @__PURE__ */ Go(yi, [["__scopeId", "data-v-c0cede33"]]);
3342
- export {
3343
- Ci as default
3344
- };