@validol4ik/uikit 0.3.40 → 0.3.42

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