@validol4ik/uikit 0.10.2 → 0.11.1

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,1985 +0,0 @@
1
- import { getCurrentInstance as ve, ref as F, onBeforeUpdate as Ot, inject as il, watch as Z, onMounted as It, onBeforeUnmount as Ee, computed as c, nextTick as ne, onDeactivated as Mt, onActivated as Et, h as p, Transition as al, onBeforeMount as rl, onUpdated as sl, defineComponent as cl, openBlock as oe, createElementBlock as ue, normalizeClass as Ne, toDisplayString as Ke, createCommentVNode as Qe, createVNode as Ct, unref as dl, withCtx as tt, mergeProps as fl, Fragment as Ue, createTextVNode as wt, createElementVNode as Vt, withModifiers as vl } from "vue";
2
- import { u as Tt, s as ce, p as de, a as Lt, Q as ze, b as ml, h as Be, c as Te, d as gl, e as pl, f as hl, g as Sl, R as bl, n as yl, i as Cl, j as wl, k as Vl, l as Ae, m as ql, o as kl, q as _l, S as xl, P as Al, _ as Bl } from "./index-DFNWQp-Z.js";
3
- import { u as zl, Q as Rl } from "./QMenu-k3AStoLY.js";
4
- import { b as Fl, c as Ol } from "./focusout-DjvPXP_b.js";
5
- import { a as Il, r as Ml } from "./escape-key-BlsDwJUQ.js";
6
- import { Q as El } from "./QDialog-Cy2w4ntF.js";
7
- const qt = (e) => e ? !0 : "Обовʼязкове поле", kt = /^on[A-Z]/;
8
- function Tl() {
9
- const { attrs: e, vnode: l } = ve(), o = {
10
- listeners: F({}),
11
- attributes: F({})
12
- };
13
- function u() {
14
- const h = {}, i = {};
15
- for (const d in e)
16
- d !== "class" && d !== "style" && kt.test(d) === !1 && (h[d] = e[d]);
17
- for (const d in l.props)
18
- kt.test(d) === !0 && (i[d] = l.props[d]);
19
- o.attributes.value = h, o.listeners.value = i;
20
- }
21
- return Ot(u), u(), o;
22
- }
23
- const Ll = "_q_fo_";
24
- function Hl({ validate: e, resetValidation: l, requiresQForm: o }) {
25
- const u = il(Ll, !1);
26
- if (u !== !1) {
27
- const { props: h, proxy: i } = ve();
28
- Object.assign(i, { validate: e, resetValidation: l }), Z(() => h.disable, (d) => {
29
- d === !0 ? (typeof l == "function" && l(), u.unbindComponent(i)) : u.bindComponent(i);
30
- }), It(() => {
31
- h.disable !== !0 && u.bindComponent(i);
32
- }), Ee(() => {
33
- h.disable !== !0 && u.unbindComponent(i);
34
- });
35
- } else o === !0 && console.error("Parent QForm not found on useFormChild()!");
36
- }
37
- const _t = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/, xt = /^#[0-9a-fA-F]{4}([0-9a-fA-F]{4})?$/, At = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, We = /^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])\)$/, Xe = /^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)\)$/, lt = {
38
- date: (e) => /^-?[\d]+\/[0-1]\d\/[0-3]\d$/.test(e),
39
- time: (e) => /^([0-1]?\d|2[0-3]):[0-5]\d$/.test(e),
40
- fulltime: (e) => /^([0-1]?\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(e),
41
- timeOrFulltime: (e) => /^([0-1]?\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/.test(e),
42
- // -- RFC 5322 --
43
- // -- Added in v2.6.6 --
44
- // This is a basic helper validation.
45
- // For something more complex (like RFC 822) you should write and use your own rule.
46
- // We won't be accepting PRs to enhance the one below because of the reason above.
47
- // eslint-disable-next-line
48
- 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),
49
- hexColor: (e) => _t.test(e),
50
- hexaColor: (e) => xt.test(e),
51
- hexOrHexaColor: (e) => At.test(e),
52
- rgbColor: (e) => We.test(e),
53
- rgbaColor: (e) => Xe.test(e),
54
- rgbOrRgbaColor: (e) => We.test(e) || Xe.test(e),
55
- hexOrRgbColor: (e) => _t.test(e) || We.test(e),
56
- hexaOrRgbaColor: (e) => xt.test(e) || Xe.test(e),
57
- anyColor: (e) => At.test(e) || We.test(e) || Xe.test(e)
58
- };
59
- function Ht(e, l = 250, o) {
60
- let u = null;
61
- function h() {
62
- const i = arguments, d = () => {
63
- u = null, e.apply(this, i);
64
- };
65
- u !== null ? clearTimeout(u) : o === !0 && e.apply(this, i), u = setTimeout(d, l);
66
- }
67
- return h.cancel = () => {
68
- u !== null && clearTimeout(u);
69
- }, h;
70
- }
71
- const $l = [!0, !1, "ondemand"], Dl = {
72
- modelValue: {},
73
- error: {
74
- type: Boolean,
75
- default: null
76
- },
77
- errorMessage: String,
78
- noErrorIcon: Boolean,
79
- rules: Array,
80
- reactiveRules: Boolean,
81
- lazyRules: {
82
- type: [Boolean, String],
83
- default: !1,
84
- // statement unneeded but avoids future vue implementation changes
85
- validator: (e) => $l.includes(e)
86
- }
87
- };
88
- function Pl(e, l) {
89
- const { props: o, proxy: u } = ve(), h = F(!1), i = F(null), d = F(!1);
90
- Hl({ validate: v, resetValidation: R });
91
- let S = 0, b;
92
- const O = c(
93
- () => o.rules !== void 0 && o.rules !== null && o.rules.length !== 0
94
- ), g = c(() => o.disable !== !0 && O.value === !0 && l.value === !1), y = c(
95
- () => o.error === !0 || h.value === !0
96
- ), _ = c(() => typeof o.errorMessage == "string" && o.errorMessage.length !== 0 ? o.errorMessage : i.value);
97
- Z(() => o.modelValue, () => {
98
- d.value = !0, g.value === !0 && o.lazyRules === !1 && f();
99
- });
100
- function x() {
101
- o.lazyRules !== "ondemand" && g.value === !0 && d.value === !0 && f();
102
- }
103
- Z(() => o.reactiveRules, (C) => {
104
- C === !0 ? b === void 0 && (b = Z(() => o.rules, x, { immediate: !0, deep: !0 })) : b !== void 0 && (b(), b = void 0);
105
- }, { immediate: !0 }), Z(() => o.lazyRules, x), Z(e, (C) => {
106
- C === !0 ? d.value = !0 : g.value === !0 && o.lazyRules !== "ondemand" && f();
107
- });
108
- function R() {
109
- S++, l.value = !1, d.value = !1, h.value = !1, i.value = null, f.cancel();
110
- }
111
- function v(C = o.modelValue) {
112
- if (o.disable === !0 || O.value === !1)
113
- return !0;
114
- const N = ++S, K = l.value !== !0 ? () => {
115
- d.value = !0;
116
- } : () => {
117
- }, I = (B, L) => {
118
- B === !0 && K(), h.value = B, i.value = L || null, l.value = !1;
119
- }, J = [];
120
- for (let B = 0; B < o.rules.length; B++) {
121
- const L = o.rules[B];
122
- let H;
123
- if (typeof L == "function" ? H = L(C, lt) : typeof L == "string" && lt[L] !== void 0 && (H = lt[L](C)), H === !1 || typeof H == "string")
124
- return I(!0, H), !1;
125
- H !== !0 && H !== void 0 && J.push(H);
126
- }
127
- return J.length === 0 ? (I(!1), !0) : (l.value = !0, Promise.all(J).then(
128
- (B) => {
129
- if (B === void 0 || Array.isArray(B) === !1 || B.length === 0)
130
- return N === S && I(!1), !0;
131
- const L = B.find((H) => H === !1 || typeof H == "string");
132
- return N === S && I(L !== void 0, L), L === void 0;
133
- },
134
- (B) => (N === S && (console.error(B), I(!0)), !1)
135
- ));
136
- }
137
- const f = Ht(v, 0);
138
- return Ee(() => {
139
- b == null || b(), f.cancel();
140
- }), Object.assign(u, { resetValidation: R, validate: v }), Fl(u, "hasError", () => y.value), {
141
- isDirtyModel: d,
142
- hasRules: O,
143
- hasError: y,
144
- errorMessage: _,
145
- validate: v,
146
- resetValidation: R
147
- };
148
- }
149
- function nt(e) {
150
- return e != null && ("" + e).length !== 0;
151
- }
152
- const jl = {
153
- ...Tt,
154
- ...Dl,
155
- label: String,
156
- stackLabel: Boolean,
157
- hint: String,
158
- hideHint: Boolean,
159
- prefix: String,
160
- suffix: String,
161
- labelColor: String,
162
- color: String,
163
- bgColor: String,
164
- filled: Boolean,
165
- outlined: Boolean,
166
- borderless: Boolean,
167
- standout: [Boolean, String],
168
- square: Boolean,
169
- loading: Boolean,
170
- labelSlot: Boolean,
171
- bottomSlots: Boolean,
172
- hideBottomSpace: Boolean,
173
- rounded: Boolean,
174
- dense: Boolean,
175
- itemAligned: Boolean,
176
- counter: Boolean,
177
- clearable: Boolean,
178
- clearIcon: String,
179
- disable: Boolean,
180
- readonly: Boolean,
181
- autofocus: Boolean,
182
- for: String
183
- }, it = {
184
- ...jl,
185
- maxlength: [Number, String]
186
- }, $t = ["update:modelValue", "clear", "focus", "blur"];
187
- function Dt({ requiredForAttr: e = !0, tagProp: l, changeEvent: o = !1 } = {}) {
188
- const { props: u, proxy: h } = ve(), i = Lt(u, h.$q), d = zl({
189
- required: e,
190
- getValue: () => u.for
191
- });
192
- return {
193
- requiredForAttr: e,
194
- changeEvent: o,
195
- tag: l === !0 ? c(() => u.tag) : { value: "label" },
196
- isDark: i,
197
- editable: c(
198
- () => u.disable !== !0 && u.readonly !== !0
199
- ),
200
- innerLoading: F(!1),
201
- focused: F(!1),
202
- hasPopupOpen: !1,
203
- splitAttrs: Tl(),
204
- targetUid: d,
205
- rootRef: F(null),
206
- targetRef: F(null),
207
- controlRef: F(null)
208
- /**
209
- * user supplied additionals:
210
-
211
- * innerValue - computed
212
- * floatingLabel - computed
213
- * inputRef - computed
214
-
215
- * fieldClass - computed
216
- * hasShadow - computed
217
-
218
- * controlEvents - Object with fn(e)
219
-
220
- * getControl - fn
221
- * getInnerAppend - fn
222
- * getControlChild - fn
223
- * getShadowControl - fn
224
- * showPopup - fn
225
- */
226
- };
227
- }
228
- function Pt(e) {
229
- const { props: l, emit: o, slots: u, attrs: h, proxy: i } = ve(), { $q: d } = i;
230
- let S = null;
231
- e.hasValue === void 0 && (e.hasValue = c(() => nt(l.modelValue))), e.emitValue === void 0 && (e.emitValue = (m) => {
232
- o("update:modelValue", m);
233
- }), e.controlEvents === void 0 && (e.controlEvents = {
234
- onFocusin: ie,
235
- onFocusout: te
236
- }), Object.assign(e, {
237
- clearValue: ae,
238
- onControlFocusin: ie,
239
- onControlFocusout: te,
240
- focus: L
241
- }), e.computedCounter === void 0 && (e.computedCounter = c(() => {
242
- if (l.counter !== !1) {
243
- const m = typeof l.modelValue == "string" || typeof l.modelValue == "number" ? ("" + l.modelValue).length : Array.isArray(l.modelValue) === !0 ? l.modelValue.length : 0, V = l.maxlength !== void 0 ? l.maxlength : l.maxValues;
244
- return m + (V !== void 0 ? " / " + V : "");
245
- }
246
- }));
247
- const {
248
- isDirtyModel: b,
249
- hasRules: O,
250
- hasError: g,
251
- errorMessage: y,
252
- resetValidation: _
253
- } = Pl(e.focused, e.innerLoading), x = e.floatingLabel !== void 0 ? c(() => l.stackLabel === !0 || e.focused.value === !0 || e.floatingLabel.value === !0) : c(() => l.stackLabel === !0 || e.focused.value === !0 || e.hasValue.value === !0), R = c(
254
- () => l.bottomSlots === !0 || l.hint !== void 0 || O.value === !0 || l.counter === !0 || l.error !== null
255
- ), v = c(() => l.filled === !0 ? "filled" : l.outlined === !0 ? "outlined" : l.borderless === !0 ? "borderless" : l.standout ? "standout" : "standard"), f = c(
256
- () => `q-field row no-wrap items-start q-field--${v.value}` + (e.fieldClass !== void 0 ? ` ${e.fieldClass.value}` : "") + (l.rounded === !0 ? " q-field--rounded" : "") + (l.square === !0 ? " q-field--square" : "") + (x.value === !0 ? " q-field--float" : "") + (N.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" : "") + (g.value === !0 ? " q-field--error" : "") + (g.value === !0 || e.focused.value === !0 ? " q-field--highlighted" : "") + (l.hideBottomSpace !== !0 && R.value === !0 ? " q-field--with-bottom" : "") + (l.disable === !0 ? " q-field--disabled" : l.readonly === !0 ? " q-field--readonly" : "")
257
- ), C = c(
258
- () => "q-field__control relative-position row no-wrap" + (l.bgColor !== void 0 ? ` bg-${l.bgColor}` : "") + (g.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}` : "")
259
- ), N = c(
260
- () => l.labelSlot === !0 || l.label !== void 0
261
- ), K = c(
262
- () => "q-field__label no-pointer-events absolute ellipsis" + (l.labelColor !== void 0 && g.value !== !0 ? ` text-${l.labelColor}` : "")
263
- ), I = c(() => ({
264
- id: e.targetUid.value,
265
- editable: e.editable.value,
266
- focused: e.focused.value,
267
- floatingLabel: x.value,
268
- modelValue: l.modelValue,
269
- emitValue: e.emitValue
270
- })), J = c(() => {
271
- const m = {};
272
- return e.targetUid.value && (m.for = e.targetUid.value), l.disable === !0 && (m["aria-disabled"] = "true"), m;
273
- });
274
- function B() {
275
- var W;
276
- const m = document.activeElement;
277
- let V = (W = e.targetRef) == null ? void 0 : W.value;
278
- V && (m === null || m.id !== e.targetUid.value) && (V.hasAttribute("tabindex") === !0 || (V = V.querySelector("[tabindex]")), V !== m && (V == null || V.focus({ preventScroll: !0 })));
279
- }
280
- function L() {
281
- Il(B);
282
- }
283
- function H() {
284
- Ml(B);
285
- const m = document.activeElement;
286
- m !== null && e.rootRef.value.contains(m) && m.blur();
287
- }
288
- function ie(m) {
289
- S !== null && (clearTimeout(S), S = null), e.editable.value === !0 && e.focused.value === !1 && (e.focused.value = !0, o("focus", m));
290
- }
291
- function te(m, V) {
292
- S !== null && clearTimeout(S), S = setTimeout(() => {
293
- S = 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, o("blur", m)), V == null || V());
294
- });
295
- }
296
- function ae(m) {
297
- var V;
298
- ce(m), d.platform.is.mobile !== !0 ? (((V = e.targetRef) == null ? void 0 : V.value) || e.rootRef.value).focus() : e.rootRef.value.contains(document.activeElement) === !0 && document.activeElement.blur(), l.type === "file" && (e.inputRef.value.value = null), o("update:modelValue", null), e.changeEvent === !0 && o("change", null), o("clear", l.modelValue), ne(() => {
299
- const W = b.value;
300
- _(), b.value = W;
301
- });
302
- }
303
- function Q(m) {
304
- [13, 32].includes(m.keyCode) && ae(m);
305
- }
306
- function me() {
307
- const m = [];
308
- return u.prepend !== void 0 && m.push(
309
- p("div", {
310
- class: "q-field__prepend q-field__marginal row no-wrap items-center",
311
- key: "prepend",
312
- onClick: de
313
- }, u.prepend())
314
- ), m.push(
315
- p("div", {
316
- class: "q-field__control-container col relative-position row no-wrap q-anchor--skip"
317
- }, be())
318
- ), g.value === !0 && l.noErrorIcon === !1 && m.push(
319
- U("error", [
320
- p(ze, { name: d.iconSet.field.error, color: "negative" })
321
- ])
322
- ), l.loading === !0 || e.innerLoading.value === !0 ? m.push(
323
- U(
324
- "inner-loading-append",
325
- u.loading !== void 0 ? u.loading() : [p(ml, { color: l.color })]
326
- )
327
- ) : l.clearable === !0 && e.hasValue.value === !0 && e.editable.value === !0 && m.push(
328
- U("inner-clearable-append", [
329
- p(ze, {
330
- class: "q-field__focusable-action",
331
- name: l.clearIcon || d.iconSet.field.clear,
332
- tabindex: 0,
333
- role: "button",
334
- "aria-hidden": "false",
335
- "aria-label": d.lang.label.clear,
336
- onKeyup: Q,
337
- onClick: ae
338
- })
339
- ])
340
- ), u.append !== void 0 && m.push(
341
- p("div", {
342
- class: "q-field__append q-field__marginal row no-wrap items-center",
343
- key: "append",
344
- onClick: de
345
- }, u.append())
346
- ), e.getInnerAppend !== void 0 && m.push(
347
- U("inner-append", e.getInnerAppend())
348
- ), e.getControlChild !== void 0 && m.push(
349
- e.getControlChild()
350
- ), m;
351
- }
352
- function be() {
353
- const m = [];
354
- return l.prefix !== void 0 && l.prefix !== null && m.push(
355
- p("div", {
356
- class: "q-field__prefix no-pointer-events row items-center"
357
- }, l.prefix)
358
- ), e.getShadowControl !== void 0 && e.hasShadow.value === !0 && m.push(
359
- e.getShadowControl()
360
- ), N.value === !0 && m.push(
361
- p("div", {
362
- class: K.value
363
- }, Be(u.label, l.label))
364
- ), e.getControl !== void 0 ? m.push(e.getControl()) : u.rawControl !== void 0 ? m.push(u.rawControl()) : u.control !== void 0 && m.push(
365
- p("div", {
366
- ref: e.targetRef,
367
- class: "q-field__native row",
368
- tabindex: -1,
369
- ...e.splitAttrs.attributes.value,
370
- "data-autofocus": l.autofocus === !0 || void 0
371
- }, u.control(I.value))
372
- ), l.suffix !== void 0 && l.suffix !== null && m.push(
373
- p("div", {
374
- class: "q-field__suffix no-pointer-events row items-center"
375
- }, l.suffix)
376
- ), m.concat(Be(u.default));
377
- }
378
- function re() {
379
- let m, V;
380
- g.value === !0 ? y.value !== null ? (m = [p("div", { role: "alert" }, y.value)], V = `q--slot-error-${y.value}`) : (m = Be(u.error), V = "q--slot-error") : (l.hideHint !== !0 || e.focused.value === !0) && (l.hint !== void 0 ? (m = [p("div", l.hint)], V = `q--slot-hint-${l.hint}`) : (m = Be(u.hint), V = "q--slot-hint"));
381
- const W = l.counter === !0 || u.counter !== void 0;
382
- if (l.hideBottomSpace === !0 && W === !1 && m === void 0) return;
383
- const n = p("div", {
384
- key: V,
385
- class: "q-field__messages col"
386
- }, m);
387
- return p("div", {
388
- class: "q-field__bottom row items-start q-field__bottom--" + (l.hideBottomSpace !== !0 ? "animated" : "stale"),
389
- onClick: de
390
- }, [
391
- l.hideBottomSpace === !0 ? n : p(al, { name: "q-transition--field-message" }, () => n),
392
- W === !0 ? p("div", {
393
- class: "q-field__counter"
394
- }, u.counter !== void 0 ? u.counter() : e.computedCounter.value) : null
395
- ]);
396
- }
397
- function U(m, V) {
398
- return V === null ? null : p("div", {
399
- key: m,
400
- class: "q-field__append q-field__marginal row no-wrap items-center q-anchor--skip"
401
- }, V);
402
- }
403
- let ye = !1;
404
- return Mt(() => {
405
- ye = !0;
406
- }), Et(() => {
407
- ye === !0 && l.autofocus === !0 && i.focus();
408
- }), l.autofocus === !0 && It(() => {
409
- i.focus();
410
- }), Ee(() => {
411
- S !== null && clearTimeout(S);
412
- }), Object.assign(i, { focus: L, blur: H }), function() {
413
- const V = e.getControl === void 0 && u.control === void 0 ? {
414
- ...e.splitAttrs.attributes.value,
415
- "data-autofocus": l.autofocus === !0 || void 0,
416
- ...J.value
417
- } : J.value;
418
- return p(e.tag.value, {
419
- ref: e.rootRef,
420
- class: [
421
- f.value,
422
- h.class
423
- ],
424
- style: h.style,
425
- ...V
426
- }, [
427
- u.before !== void 0 ? p("div", {
428
- class: "q-field__before q-field__marginal row no-wrap items-center",
429
- onClick: de
430
- }, u.before()) : null,
431
- p("div", {
432
- class: "q-field__inner relative-position col self-stretch"
433
- }, [
434
- p("div", {
435
- ref: e.controlRef,
436
- class: C.value,
437
- tabindex: -1,
438
- ...e.controlEvents
439
- }, me()),
440
- R.value === !0 ? re() : null
441
- ]),
442
- u.after !== void 0 ? p("div", {
443
- class: "q-field__after q-field__marginal row no-wrap items-center",
444
- onClick: de
445
- }, u.after()) : null
446
- ]);
447
- };
448
- }
449
- const Nl = Te({
450
- name: "QField",
451
- inheritAttrs: !1,
452
- props: {
453
- ...it,
454
- tag: {
455
- type: String,
456
- default: "label"
457
- }
458
- },
459
- emits: $t,
460
- setup() {
461
- return Pt(
462
- Dt({ tagProp: !0 })
463
- );
464
- }
465
- }), Kl = {
466
- xs: 8,
467
- sm: 10,
468
- md: 14,
469
- lg: 20,
470
- xl: 24
471
- }, Ql = Te({
472
- name: "QChip",
473
- props: {
474
- ...Tt,
475
- ...gl,
476
- dense: Boolean,
477
- icon: String,
478
- iconRight: String,
479
- iconRemove: String,
480
- iconSelected: String,
481
- label: [String, Number],
482
- color: String,
483
- textColor: String,
484
- modelValue: {
485
- type: Boolean,
486
- default: !0
487
- },
488
- selected: {
489
- type: Boolean,
490
- default: null
491
- },
492
- square: Boolean,
493
- outline: Boolean,
494
- clickable: Boolean,
495
- removable: Boolean,
496
- removeAriaLabel: String,
497
- tabindex: [String, Number],
498
- disable: Boolean,
499
- ripple: {
500
- type: [Boolean, Object],
501
- default: !0
502
- }
503
- },
504
- emits: ["update:modelValue", "update:selected", "remove", "click"],
505
- setup(e, { slots: l, emit: o }) {
506
- const { proxy: { $q: u } } = ve(), h = Lt(e, u), i = pl(e, Kl), d = c(() => e.selected === !0 || e.icon !== void 0), S = c(() => e.selected === !0 ? e.iconSelected || u.iconSet.chip.selected : e.icon), b = c(() => e.iconRemove || u.iconSet.chip.remove), O = c(
507
- () => e.disable === !1 && (e.clickable === !0 || e.selected !== null)
508
- ), g = c(() => {
509
- const f = e.outline === !0 && e.color || e.textColor;
510
- return "q-chip row inline no-wrap items-center" + (e.outline === !1 && e.color !== void 0 ? ` bg-${e.color}` : "") + (f ? ` text-${f} 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" : "") + (O.value === !0 ? " q-chip--clickable cursor-pointer non-selectable q-hoverable" : "") + (e.square === !0 ? " q-chip--square" : "") + (h.value === !0 ? " q-chip--dark q-dark" : "");
511
- }), y = c(() => {
512
- const f = e.disable === !0 ? { tabindex: -1, "aria-disabled": "true" } : { tabindex: e.tabindex || 0 }, C = {
513
- ...f,
514
- role: "button",
515
- "aria-hidden": "false",
516
- "aria-label": e.removeAriaLabel || u.lang.label.remove
517
- };
518
- return { chip: f, remove: C };
519
- });
520
- function _(f) {
521
- f.keyCode === 13 && x(f);
522
- }
523
- function x(f) {
524
- e.disable || (o("update:selected", !e.selected), o("click", f));
525
- }
526
- function R(f) {
527
- (f.keyCode === void 0 || f.keyCode === 13) && (ce(f), e.disable === !1 && (o("update:modelValue", !1), o("remove")));
528
- }
529
- function v() {
530
- const f = [];
531
- O.value === !0 && f.push(
532
- p("div", { class: "q-focus-helper" })
533
- ), d.value === !0 && f.push(
534
- p(ze, {
535
- class: "q-chip__icon q-chip__icon--left",
536
- name: S.value
537
- })
538
- );
539
- const C = e.label !== void 0 ? [p("div", { class: "ellipsis" }, [e.label])] : void 0;
540
- return f.push(
541
- p("div", {
542
- class: "q-chip__content col row no-wrap items-center q-anchor--skip"
543
- }, Sl(l.default, C))
544
- ), e.iconRight && f.push(
545
- p(ze, {
546
- class: "q-chip__icon q-chip__icon--right",
547
- name: e.iconRight
548
- })
549
- ), e.removable === !0 && f.push(
550
- p(ze, {
551
- class: "q-chip__icon q-chip__icon--remove cursor-pointer",
552
- name: b.value,
553
- ...y.value.remove,
554
- onClick: R,
555
- onKeyup: R
556
- })
557
- ), f;
558
- }
559
- return () => {
560
- if (e.modelValue === !1) return;
561
- const f = {
562
- class: g.value,
563
- style: i.value
564
- };
565
- return O.value === !0 && Object.assign(
566
- f,
567
- y.value.chip,
568
- { onClick: x, onKeyup: _ }
569
- ), hl(
570
- "div",
571
- f,
572
- v(),
573
- "ripple",
574
- e.ripple !== !1 && e.disable !== !0,
575
- () => [[bl, e.ripple]]
576
- );
577
- };
578
- }
579
- }), Ul = Te({
580
- name: "QItemSection",
581
- props: {
582
- avatar: Boolean,
583
- thumbnail: Boolean,
584
- side: Boolean,
585
- top: Boolean,
586
- noWrap: Boolean
587
- },
588
- setup(e, { slots: l }) {
589
- const o = c(
590
- () => `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" : "")
591
- );
592
- return () => p("div", { class: o.value }, Be(l.default));
593
- }
594
- }), Wl = Te({
595
- name: "QItemLabel",
596
- props: {
597
- overline: Boolean,
598
- caption: Boolean,
599
- header: Boolean,
600
- lines: [Number, String]
601
- },
602
- setup(e, { slots: l }) {
603
- const o = c(() => parseInt(e.lines, 10)), u = c(
604
- () => "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" : "") + (o.value === 1 ? " ellipsis" : "")
605
- ), h = c(() => e.lines !== void 0 && o.value > 1 ? {
606
- overflow: "hidden",
607
- display: "-webkit-box",
608
- "-webkit-box-orient": "vertical",
609
- "-webkit-line-clamp": o.value
610
- } : null);
611
- return () => p("div", {
612
- style: h.value,
613
- class: u.value
614
- }, Be(l.default));
615
- }
616
- });
617
- let Ye = !1;
618
- {
619
- const e = document.createElement("div");
620
- e.setAttribute("dir", "rtl"), Object.assign(e.style, {
621
- width: "1px",
622
- height: "1px",
623
- overflow: "auto"
624
- });
625
- const l = document.createElement("div");
626
- Object.assign(l.style, {
627
- width: "1000px",
628
- height: "1px"
629
- }), document.body.appendChild(e), e.appendChild(l), e.scrollLeft = -1e3, Ye = e.scrollLeft >= 0, e.remove();
630
- }
631
- const ee = 1e3, Xl = [
632
- "start",
633
- "center",
634
- "end",
635
- "start-force",
636
- "center-force",
637
- "end-force"
638
- ], jt = Array.prototype.filter, Yl = window.getComputedStyle(document.body).overflowAnchor === void 0 ? yl : function(e, l) {
639
- e !== null && (e._qOverflowAnimationFrame !== void 0 && cancelAnimationFrame(e._qOverflowAnimationFrame), e._qOverflowAnimationFrame = requestAnimationFrame(() => {
640
- if (e === null) return;
641
- e._qOverflowAnimationFrame = void 0;
642
- const o = e.children || [];
643
- jt.call(o, (h) => h.dataset && h.dataset.qVsAnchor !== void 0).forEach((h) => {
644
- delete h.dataset.qVsAnchor;
645
- });
646
- const u = o[l];
647
- u != null && u.dataset && (u.dataset.qVsAnchor = "");
648
- }));
649
- };
650
- function Re(e, l) {
651
- return e + l;
652
- }
653
- function ot(e, l, o, u, h, i, d, S) {
654
- const b = e === window ? document.scrollingElement || document.documentElement : e, O = h === !0 ? "offsetWidth" : "offsetHeight", g = {
655
- scrollStart: 0,
656
- scrollViewSize: -d - S,
657
- scrollMaxSize: 0,
658
- offsetStart: -d,
659
- offsetEnd: -S
660
- };
661
- if (h === !0 ? (e === window ? (g.scrollStart = window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, g.scrollViewSize += document.documentElement.clientWidth) : (g.scrollStart = b.scrollLeft, g.scrollViewSize += b.clientWidth), g.scrollMaxSize = b.scrollWidth, i === !0 && (g.scrollStart = (Ye === !0 ? g.scrollMaxSize - g.scrollViewSize : 0) - g.scrollStart)) : (e === window ? (g.scrollStart = window.pageYOffset || window.scrollY || document.body.scrollTop || 0, g.scrollViewSize += document.documentElement.clientHeight) : (g.scrollStart = b.scrollTop, g.scrollViewSize += b.clientHeight), g.scrollMaxSize = b.scrollHeight), o !== null)
662
- for (let y = o.previousElementSibling; y !== null; y = y.previousElementSibling)
663
- y.classList.contains("q-virtual-scroll--skip") === !1 && (g.offsetStart += y[O]);
664
- if (u !== null)
665
- for (let y = u.nextElementSibling; y !== null; y = y.nextElementSibling)
666
- y.classList.contains("q-virtual-scroll--skip") === !1 && (g.offsetEnd += y[O]);
667
- if (l !== e) {
668
- const y = b.getBoundingClientRect(), _ = l.getBoundingClientRect();
669
- h === !0 ? (g.offsetStart += _.left - y.left, g.offsetEnd -= _.width) : (g.offsetStart += _.top - y.top, g.offsetEnd -= _.height), e !== window && (g.offsetStart += g.scrollStart), g.offsetEnd += g.scrollMaxSize - g.offsetStart;
670
- }
671
- return g;
672
- }
673
- function Bt(e, l, o, u) {
674
- l === "end" && (l = (e === window ? document.body : e)[o === !0 ? "scrollWidth" : "scrollHeight"]), e === window ? o === !0 ? (u === !0 && (l = (Ye === !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) : o === !0 ? (u === !0 && (l = (Ye === !0 ? e.scrollWidth - e.offsetWidth : 0) - l), e.scrollLeft = l) : e.scrollTop = l;
675
- }
676
- function Me(e, l, o, u) {
677
- if (o >= u)
678
- return 0;
679
- const h = l.length, i = Math.floor(o / ee), d = Math.floor((u - 1) / ee) + 1;
680
- let S = e.slice(i, d).reduce(Re, 0);
681
- return o % ee !== 0 && (S -= l.slice(i * ee, o).reduce(Re, 0)), u % ee !== 0 && u !== h && (S -= l.slice(u, d * ee).reduce(Re, 0)), S;
682
- }
683
- const Zl = {
684
- virtualScrollSliceSize: {
685
- type: [Number, String],
686
- default: 10
687
- },
688
- virtualScrollSliceRatioBefore: {
689
- type: [Number, String],
690
- default: 1
691
- },
692
- virtualScrollSliceRatioAfter: {
693
- type: [Number, String],
694
- default: 1
695
- },
696
- virtualScrollItemSize: {
697
- type: [Number, String],
698
- default: 24
699
- },
700
- virtualScrollStickySizeStart: {
701
- type: [Number, String],
702
- default: 0
703
- },
704
- virtualScrollStickySizeEnd: {
705
- type: [Number, String],
706
- default: 0
707
- },
708
- tableColspan: [Number, String]
709
- }, zt = {
710
- virtualScrollHorizontal: Boolean,
711
- onVirtualScroll: Function,
712
- ...Zl
713
- };
714
- function Jl({
715
- virtualScrollLength: e,
716
- getVirtualScrollTarget: l,
717
- getVirtualScrollEl: o,
718
- virtualScrollItemSizeComputed: u
719
- // optional
720
- }) {
721
- const h = ve(), { props: i, emit: d, proxy: S } = h, { $q: b } = S;
722
- let O, g, y, _ = [], x;
723
- const R = F(0), v = F(0), f = F({}), C = F(null), N = F(null), K = F(null), I = F({ from: 0, to: 0 }), J = c(() => i.tableColspan !== void 0 ? i.tableColspan : 100);
724
- u === void 0 && (u = c(() => i.virtualScrollItemSize));
725
- const B = c(() => u.value + ";" + i.virtualScrollHorizontal), L = c(
726
- () => B.value + ";" + i.virtualScrollSliceRatioBefore + ";" + i.virtualScrollSliceRatioAfter
727
- );
728
- Z(L, () => {
729
- U();
730
- }), Z(B, H);
731
- function H() {
732
- re(g, !0);
733
- }
734
- function ie(n) {
735
- re(n === void 0 ? g : n);
736
- }
737
- function te(n, s) {
738
- const q = l();
739
- if (q == null || q.nodeType === 8) return;
740
- const T = ot(
741
- q,
742
- o(),
743
- C.value,
744
- N.value,
745
- i.virtualScrollHorizontal,
746
- b.lang.rtl,
747
- i.virtualScrollStickySizeStart,
748
- i.virtualScrollStickySizeEnd
749
- );
750
- y !== T.scrollViewSize && U(T.scrollViewSize), Q(
751
- q,
752
- T,
753
- Math.min(e.value - 1, Math.max(0, parseInt(n, 10) || 0)),
754
- 0,
755
- Xl.indexOf(s) !== -1 ? s : g !== -1 && n > g ? "end" : "start"
756
- );
757
- }
758
- function ae() {
759
- const n = l();
760
- if (n == null || n.nodeType === 8) return;
761
- const s = ot(
762
- n,
763
- o(),
764
- C.value,
765
- N.value,
766
- i.virtualScrollHorizontal,
767
- b.lang.rtl,
768
- i.virtualScrollStickySizeStart,
769
- i.virtualScrollStickySizeEnd
770
- ), q = e.value - 1, T = s.scrollMaxSize - s.offsetStart - s.offsetEnd - v.value;
771
- if (O === s.scrollStart) return;
772
- if (s.scrollMaxSize <= 0) {
773
- Q(n, s, 0, 0);
774
- return;
775
- }
776
- y !== s.scrollViewSize && U(s.scrollViewSize), me(I.value.from);
777
- const P = Math.floor(s.scrollMaxSize - Math.max(s.scrollViewSize, s.offsetEnd) - Math.min(x[q], s.scrollViewSize / 2));
778
- if (P > 0 && Math.ceil(s.scrollStart) >= P) {
779
- Q(
780
- n,
781
- s,
782
- q,
783
- s.scrollMaxSize - s.offsetEnd - _.reduce(Re, 0)
784
- );
785
- return;
786
- }
787
- let z = 0, A = s.scrollStart - s.offsetStart, j = A;
788
- if (A <= T && A + s.scrollViewSize >= R.value)
789
- A -= R.value, z = I.value.from, j = A;
790
- else
791
- for (let k = 0; A >= _[k] && z < q; k++)
792
- A -= _[k], z += ee;
793
- for (; A > 0 && z < q; )
794
- A -= x[z], A > -s.scrollViewSize ? (z++, j = A) : j = x[z] + A;
795
- Q(
796
- n,
797
- s,
798
- z,
799
- j
800
- );
801
- }
802
- function Q(n, s, q, T, P) {
803
- const z = typeof P == "string" && P.indexOf("-force") !== -1, A = z === !0 ? P.replace("-force", "") : P, j = A !== void 0 ? A : "start";
804
- let k = Math.max(0, q - f.value[j]), X = k + f.value.total;
805
- X > e.value && (X = e.value, k = Math.max(0, X - f.value.total)), O = s.scrollStart;
806
- const se = k !== I.value.from || X !== I.value.to;
807
- if (se === !1 && A === void 0) {
808
- m(q);
809
- return;
810
- }
811
- const { activeElement: Le } = document, G = K.value;
812
- se === !0 && G !== null && G !== Le && G.contains(Le) === !0 && (G.addEventListener("focusout", be), setTimeout(() => {
813
- G == null || G.removeEventListener("focusout", be);
814
- })), Yl(G, q - k);
815
- const He = A !== void 0 ? x.slice(k, q).reduce(Re, 0) : 0;
816
- if (se === !0) {
817
- const ge = X >= I.value.from && k <= I.value.to ? I.value.to : X;
818
- I.value = { from: k, to: ge }, R.value = Me(_, x, 0, k), v.value = Me(_, x, X, e.value), requestAnimationFrame(() => {
819
- I.value.to !== X && O === s.scrollStart && (I.value = { from: I.value.from, to: X }, v.value = Me(_, x, X, e.value));
820
- });
821
- }
822
- requestAnimationFrame(() => {
823
- if (O !== s.scrollStart) return;
824
- se === !0 && me(k);
825
- const ge = x.slice(k, q).reduce(Re, 0), pe = ge + s.offsetStart + R.value, $e = pe + x[q];
826
- let Fe = pe + T;
827
- if (A !== void 0) {
828
- const Ze = ge - He, Oe = s.scrollStart + Ze;
829
- Fe = z !== !0 && Oe < pe && $e < Oe + s.scrollViewSize ? Oe : A === "end" ? $e - s.scrollViewSize : pe - (A === "start" ? 0 : Math.round((s.scrollViewSize - x[q]) / 2));
830
- }
831
- O = Fe, Bt(
832
- n,
833
- Fe,
834
- i.virtualScrollHorizontal,
835
- b.lang.rtl
836
- ), m(q);
837
- });
838
- }
839
- function me(n) {
840
- const s = K.value;
841
- if (s) {
842
- const q = jt.call(
843
- s.children,
844
- (k) => k.classList && k.classList.contains("q-virtual-scroll--skip") === !1
845
- ), T = q.length, P = i.virtualScrollHorizontal === !0 ? (k) => k.getBoundingClientRect().width : (k) => k.offsetHeight;
846
- let z = n, A, j;
847
- for (let k = 0; k < T; ) {
848
- for (A = P(q[k]), k++; k < T && q[k].classList.contains("q-virtual-scroll--with-prev") === !0; )
849
- A += P(q[k]), k++;
850
- j = A - x[z], j !== 0 && (x[z] += j, _[Math.floor(z / ee)] += j), z++;
851
- }
852
- }
853
- }
854
- function be() {
855
- var n;
856
- (n = K.value) == null || n.focus();
857
- }
858
- function re(n, s) {
859
- const q = 1 * u.value;
860
- (s === !0 || Array.isArray(x) === !1) && (x = []);
861
- const T = x.length;
862
- x.length = e.value;
863
- for (let z = e.value - 1; z >= T; z--)
864
- x[z] = q;
865
- const P = Math.floor((e.value - 1) / ee);
866
- _ = [];
867
- for (let z = 0; z <= P; z++) {
868
- let A = 0;
869
- const j = Math.min((z + 1) * ee, e.value);
870
- for (let k = z * ee; k < j; k++)
871
- A += x[k];
872
- _.push(A);
873
- }
874
- g = -1, O = void 0, R.value = Me(_, x, 0, I.value.from), v.value = Me(_, x, I.value.to, e.value), n >= 0 ? (me(I.value.from), ne(() => {
875
- te(n);
876
- })) : V();
877
- }
878
- function U(n) {
879
- if (n === void 0 && typeof window < "u") {
880
- const A = l();
881
- A != null && A.nodeType !== 8 && (n = ot(
882
- A,
883
- o(),
884
- C.value,
885
- N.value,
886
- i.virtualScrollHorizontal,
887
- b.lang.rtl,
888
- i.virtualScrollStickySizeStart,
889
- i.virtualScrollStickySizeEnd
890
- ).scrollViewSize);
891
- }
892
- y = n;
893
- const s = parseFloat(i.virtualScrollSliceRatioBefore) || 0, q = parseFloat(i.virtualScrollSliceRatioAfter) || 0, T = 1 + s + q, P = n === void 0 || n <= 0 ? 1 : Math.ceil(n / u.value), z = Math.max(
894
- 1,
895
- P,
896
- Math.ceil((i.virtualScrollSliceSize > 0 ? i.virtualScrollSliceSize : 10) / T)
897
- );
898
- f.value = {
899
- total: Math.ceil(z * T),
900
- start: Math.ceil(z * s),
901
- center: Math.ceil(z * (0.5 + s)),
902
- end: Math.ceil(z * (1 + s)),
903
- view: P
904
- };
905
- }
906
- function ye(n, s) {
907
- const q = i.virtualScrollHorizontal === !0 ? "width" : "height", T = {
908
- ["--q-virtual-scroll-item-" + q]: u.value + "px"
909
- };
910
- return [
911
- n === "tbody" ? p(n, {
912
- class: "q-virtual-scroll__padding",
913
- key: "before",
914
- ref: C
915
- }, [
916
- p("tr", [
917
- p("td", {
918
- style: { [q]: `${R.value}px`, ...T },
919
- colspan: J.value
920
- })
921
- ])
922
- ]) : p(n, {
923
- class: "q-virtual-scroll__padding",
924
- key: "before",
925
- ref: C,
926
- style: { [q]: `${R.value}px`, ...T }
927
- }),
928
- p(n, {
929
- class: "q-virtual-scroll__content",
930
- key: "content",
931
- ref: K,
932
- tabindex: -1
933
- }, s.flat()),
934
- n === "tbody" ? p(n, {
935
- class: "q-virtual-scroll__padding",
936
- key: "after",
937
- ref: N
938
- }, [
939
- p("tr", [
940
- p("td", {
941
- style: { [q]: `${v.value}px`, ...T },
942
- colspan: J.value
943
- })
944
- ])
945
- ]) : p(n, {
946
- class: "q-virtual-scroll__padding",
947
- key: "after",
948
- ref: N,
949
- style: { [q]: `${v.value}px`, ...T }
950
- })
951
- ];
952
- }
953
- function m(n) {
954
- g !== n && (i.onVirtualScroll !== void 0 && d("virtualScroll", {
955
- index: n,
956
- from: I.value.from,
957
- to: I.value.to - 1,
958
- direction: n < g ? "decrease" : "increase",
959
- ref: S
960
- }), g = n);
961
- }
962
- U();
963
- const V = Ht(
964
- ae,
965
- b.platform.is.ios === !0 ? 120 : 35
966
- );
967
- rl(() => {
968
- U();
969
- });
970
- let W = !1;
971
- return Mt(() => {
972
- W = !0;
973
- }), Et(() => {
974
- if (W !== !0) return;
975
- const n = l();
976
- O !== void 0 && n !== void 0 && n !== null && n.nodeType !== 8 ? Bt(
977
- n,
978
- O,
979
- i.virtualScrollHorizontal,
980
- b.lang.rtl
981
- ) : te(g);
982
- }), Ee(() => {
983
- V.cancel();
984
- }), Object.assign(S, { scrollTo: te, reset: H, refresh: ie }), {
985
- virtualScrollSliceRange: I,
986
- virtualScrollSliceSizeComputed: f,
987
- setVirtualScrollSize: U,
988
- onVirtualScrollEvt: V,
989
- localResetVirtualScroll: re,
990
- padVirtualScroll: ye,
991
- scrollTo: te,
992
- reset: H,
993
- refresh: ie
994
- };
995
- }
996
- const Gl = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/, eo = /[\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, to = /[\u3131-\u314e\u314f-\u3163\uac00-\ud7a3]/, lo = /[a-z0-9_ -]$/i;
997
- function oo(e) {
998
- return function(o) {
999
- if (o.type === "compositionend" || o.type === "change") {
1000
- if (o.target.qComposing !== !0) return;
1001
- o.target.qComposing = !1, e(o);
1002
- } else o.type === "compositionupdate" && o.target.qComposing !== !0 && typeof o.data == "string" && (Ol.is.firefox === !0 ? lo.test(o.data) === !1 : Gl.test(o.data) === !0 || eo.test(o.data) === !0 || to.test(o.data) === !0) === !0 && (o.target.qComposing = !0);
1003
- };
1004
- }
1005
- function fe(e, l) {
1006
- if (e === l)
1007
- return !0;
1008
- if (e !== null && l !== null && typeof e == "object" && typeof l == "object") {
1009
- if (e.constructor !== l.constructor)
1010
- return !1;
1011
- let o, u;
1012
- if (e.constructor === Array) {
1013
- if (o = e.length, o !== l.length)
1014
- return !1;
1015
- for (u = o; u-- !== 0; )
1016
- if (fe(e[u], l[u]) !== !0)
1017
- return !1;
1018
- return !0;
1019
- }
1020
- if (e.constructor === Map) {
1021
- if (e.size !== l.size)
1022
- return !1;
1023
- let i = e.entries();
1024
- for (u = i.next(); u.done !== !0; ) {
1025
- if (l.has(u.value[0]) !== !0)
1026
- return !1;
1027
- u = i.next();
1028
- }
1029
- for (i = e.entries(), u = i.next(); u.done !== !0; ) {
1030
- if (fe(u.value[1], l.get(u.value[0])) !== !0)
1031
- return !1;
1032
- u = i.next();
1033
- }
1034
- return !0;
1035
- }
1036
- if (e.constructor === Set) {
1037
- if (e.size !== l.size)
1038
- return !1;
1039
- const i = e.entries();
1040
- for (u = i.next(); u.done !== !0; ) {
1041
- if (l.has(u.value[0]) !== !0)
1042
- return !1;
1043
- u = i.next();
1044
- }
1045
- return !0;
1046
- }
1047
- if (e.buffer != null && e.buffer.constructor === ArrayBuffer) {
1048
- if (o = e.length, o !== l.length)
1049
- return !1;
1050
- for (u = o; u-- !== 0; )
1051
- if (e[u] !== l[u])
1052
- return !1;
1053
- return !0;
1054
- }
1055
- if (e.constructor === RegExp)
1056
- return e.source === l.source && e.flags === l.flags;
1057
- if (e.valueOf !== Object.prototype.valueOf)
1058
- return e.valueOf() === l.valueOf();
1059
- if (e.toString !== Object.prototype.toString)
1060
- return e.toString() === l.toString();
1061
- const h = Object.keys(e).filter((i) => e[i] !== void 0);
1062
- if (o = h.length, o !== Object.keys(l).filter((i) => l[i] !== void 0).length)
1063
- return !1;
1064
- for (u = o; u-- !== 0; ) {
1065
- const i = h[u];
1066
- if (fe(e[i], l[i]) !== !0)
1067
- return !1;
1068
- }
1069
- return !0;
1070
- }
1071
- return e !== e && l !== l;
1072
- }
1073
- function Rt(e, l, o) {
1074
- if (o <= l)
1075
- return l;
1076
- const u = o - l + 1;
1077
- let h = l + (e - l) % u;
1078
- return h < l && (h = u + h), h === 0 ? 0 : h;
1079
- }
1080
- const Ft = (e) => ["add", "add-unique", "toggle"].includes(e), uo = ".*+?^${}()|[]\\", no = Object.keys(it);
1081
- function ut(e, l) {
1082
- if (typeof e == "function") return e;
1083
- const o = e !== void 0 ? e : l;
1084
- return (u) => u !== null && typeof u == "object" && o in u ? u[o] : u;
1085
- }
1086
- const io = Te({
1087
- name: "QSelect",
1088
- inheritAttrs: !1,
1089
- props: {
1090
- ...zt,
1091
- ...Cl,
1092
- ...it,
1093
- // override of useFieldProps > modelValue
1094
- modelValue: {
1095
- required: !0
1096
- },
1097
- multiple: Boolean,
1098
- displayValue: [String, Number],
1099
- displayValueHtml: Boolean,
1100
- dropdownIcon: String,
1101
- options: {
1102
- type: Array,
1103
- default: () => []
1104
- },
1105
- optionValue: [Function, String],
1106
- optionLabel: [Function, String],
1107
- optionDisable: [Function, String],
1108
- hideSelected: Boolean,
1109
- hideDropdownIcon: Boolean,
1110
- fillInput: Boolean,
1111
- maxValues: [Number, String],
1112
- optionsDense: Boolean,
1113
- optionsDark: {
1114
- type: Boolean,
1115
- default: null
1116
- },
1117
- optionsSelectedClass: String,
1118
- optionsHtml: Boolean,
1119
- optionsCover: Boolean,
1120
- menuShrink: Boolean,
1121
- menuAnchor: String,
1122
- menuSelf: String,
1123
- menuOffset: Array,
1124
- popupContentClass: String,
1125
- popupContentStyle: [String, Array, Object],
1126
- popupNoRouteDismiss: Boolean,
1127
- useInput: Boolean,
1128
- useChips: Boolean,
1129
- newValueMode: {
1130
- type: String,
1131
- validator: Ft
1132
- },
1133
- mapOptions: Boolean,
1134
- emitValue: Boolean,
1135
- disableTabSelection: Boolean,
1136
- inputDebounce: {
1137
- type: [Number, String],
1138
- default: 500
1139
- },
1140
- inputClass: [Array, String, Object],
1141
- inputStyle: [Array, String, Object],
1142
- tabindex: {
1143
- type: [String, Number],
1144
- default: 0
1145
- },
1146
- autocomplete: String,
1147
- transitionShow: {},
1148
- transitionHide: {},
1149
- transitionDuration: {},
1150
- behavior: {
1151
- type: String,
1152
- validator: (e) => ["default", "menu", "dialog"].includes(e),
1153
- default: "default"
1154
- },
1155
- // override of useVirtualScrollProps > virtualScrollItemSize (no default)
1156
- virtualScrollItemSize: zt.virtualScrollItemSize.type,
1157
- onNewValue: Function,
1158
- onFilter: Function
1159
- },
1160
- emits: [
1161
- ...$t,
1162
- "add",
1163
- "remove",
1164
- "inputValue",
1165
- "keyup",
1166
- "keypress",
1167
- "keydown",
1168
- "popupShow",
1169
- "popupHide",
1170
- "filterAbort"
1171
- ],
1172
- setup(e, { slots: l, emit: o }) {
1173
- const { proxy: u } = ve(), { $q: h } = u, i = F(!1), d = F(!1), S = F(-1), b = F(""), O = F(!1), g = F(!1);
1174
- let y = null, _ = null, x, R, v, f = null, C, N, K, I;
1175
- const J = F(null), B = F(null), L = F(null), H = F(null), ie = F(null), te = wl(e), ae = oo(pt), Q = c(() => Array.isArray(e.options) ? e.options.length : 0), me = c(() => e.virtualScrollItemSize === void 0 ? e.optionsDense === !0 ? 24 : 48 : e.virtualScrollItemSize), {
1176
- virtualScrollSliceRange: be,
1177
- virtualScrollSliceSizeComputed: re,
1178
- localResetVirtualScroll: U,
1179
- padVirtualScroll: ye,
1180
- onVirtualScrollEvt: m,
1181
- scrollTo: V,
1182
- setVirtualScrollSize: W
1183
- } = Jl({
1184
- virtualScrollLength: Q,
1185
- getVirtualScrollTarget: Ut,
1186
- getVirtualScrollEl: mt,
1187
- virtualScrollItemSizeComputed: me
1188
- }), n = Dt(), s = c(() => {
1189
- const t = e.mapOptions === !0 && e.multiple !== !0, a = e.modelValue !== void 0 && (e.modelValue !== null || t === !0) ? e.multiple === !0 && Array.isArray(e.modelValue) ? e.modelValue : [e.modelValue] : [];
1190
- if (e.mapOptions === !0 && Array.isArray(e.options) === !0) {
1191
- const r = e.mapOptions === !0 && x !== void 0 ? x : [], w = a.map((M) => Qt(M, r));
1192
- return e.modelValue === null && t === !0 ? w.filter((M) => M !== null) : w;
1193
- }
1194
- return a;
1195
- }), q = c(() => {
1196
- const t = {};
1197
- return no.forEach((a) => {
1198
- const r = e[a];
1199
- r !== void 0 && (t[a] = r);
1200
- }), t;
1201
- }), T = c(() => e.optionsDark === null ? n.isDark.value : e.optionsDark), P = c(() => nt(s.value)), z = c(() => {
1202
- let t = "q-field__input q-placeholder col";
1203
- return e.hideSelected === !0 || s.value.length === 0 ? [t, e.inputClass] : (t += " q-field__input--padding", e.inputClass === void 0 ? t : [t, e.inputClass]);
1204
- }), A = c(
1205
- () => (e.virtualScrollHorizontal === !0 ? "q-virtual-scroll--horizontal" : "") + (e.popupContentClass ? " " + e.popupContentClass : "")
1206
- ), j = c(() => Q.value === 0), k = c(
1207
- () => s.value.map((t) => Y.value(t)).join(", ")
1208
- ), X = c(() => e.displayValue !== void 0 ? e.displayValue : k.value), se = c(() => e.optionsHtml === !0 ? () => !0 : (t) => (t == null ? void 0 : t.html) === !0), Le = c(() => e.displayValueHtml === !0 || e.displayValue === void 0 && (e.optionsHtml === !0 || s.value.some(se.value))), G = c(() => n.focused.value === !0 ? e.tabindex : -1), He = c(() => {
1209
- const t = {
1210
- tabindex: e.tabindex,
1211
- role: "combobox",
1212
- "aria-label": e.label,
1213
- "aria-readonly": e.readonly === !0 ? "true" : "false",
1214
- "aria-autocomplete": e.useInput === !0 ? "list" : "none",
1215
- "aria-expanded": i.value === !0 ? "true" : "false",
1216
- "aria-controls": `${n.targetUid.value}_lb`
1217
- };
1218
- return S.value >= 0 && (t["aria-activedescendant"] = `${n.targetUid.value}_${S.value}`), t;
1219
- }), ge = c(() => ({
1220
- id: `${n.targetUid.value}_lb`,
1221
- role: "listbox",
1222
- "aria-multiselectable": e.multiple === !0 ? "true" : "false"
1223
- })), pe = c(() => s.value.map((t, a) => ({
1224
- index: a,
1225
- opt: t,
1226
- html: se.value(t),
1227
- selected: !0,
1228
- removeAtIndex: Kt,
1229
- toggleOption: he,
1230
- tabindex: G.value
1231
- }))), $e = c(() => {
1232
- if (Q.value === 0)
1233
- return [];
1234
- const { from: t, to: a } = be.value;
1235
- return e.options.slice(t, a).map((r, w) => {
1236
- const M = Ce.value(r) === !0, $ = Ge(r) === !0, E = t + w, D = {
1237
- clickable: !0,
1238
- active: $,
1239
- activeClass: Oe.value,
1240
- manualFocus: !0,
1241
- focused: !1,
1242
- disable: M,
1243
- tabindex: -1,
1244
- dense: e.optionsDense,
1245
- dark: T.value,
1246
- role: "option",
1247
- "aria-selected": $ === !0 ? "true" : "false",
1248
- id: `${n.targetUid.value}_${E}`,
1249
- onClick: () => {
1250
- he(r);
1251
- }
1252
- };
1253
- return M !== !0 && (S.value === E && (D.focused = !0), h.platform.is.desktop === !0 && (D.onMousemove = () => {
1254
- i.value === !0 && we(E);
1255
- })), {
1256
- index: E,
1257
- opt: r,
1258
- html: se.value(r),
1259
- label: Y.value(r),
1260
- selected: D.active,
1261
- focused: D.focused,
1262
- toggleOption: he,
1263
- setOptionIndex: we,
1264
- itemProps: D
1265
- };
1266
- });
1267
- }), Fe = c(() => e.dropdownIcon !== void 0 ? e.dropdownIcon : h.iconSet.arrow.dropdown), Ze = c(
1268
- () => e.optionsCover === !1 && e.outlined !== !0 && e.standout !== !0 && e.borderless !== !0 && e.rounded !== !0
1269
- ), Oe = c(() => e.optionsSelectedClass !== void 0 ? e.optionsSelectedClass : e.color !== void 0 ? `text-${e.color}` : ""), le = c(() => ut(e.optionValue, "value")), Y = c(() => ut(e.optionLabel, "label")), Ce = c(() => ut(e.optionDisable, "disable")), De = c(() => s.value.map(le.value)), Nt = c(() => {
1270
- const t = {
1271
- onInput: pt,
1272
- // Safari < 10.2 & UIWebView doesn't fire compositionend when
1273
- // switching focus before confirming composition choice
1274
- // this also fixes the issue where some browsers e.g. iOS Chrome
1275
- // fires "change" instead of "input" on autocomplete.
1276
- onChange: ae,
1277
- onKeydown: vt,
1278
- onKeyup: dt,
1279
- onKeypress: ft,
1280
- onFocus: st,
1281
- onClick(a) {
1282
- R === !0 && Ae(a);
1283
- }
1284
- };
1285
- return t.onCompositionstart = t.onCompositionupdate = t.onCompositionend = ae, t;
1286
- });
1287
- Z(s, (t) => {
1288
- x = t, e.useInput === !0 && e.fillInput === !0 && e.multiple !== !0 && n.innerLoading.value !== !0 && (d.value !== !0 && i.value !== !0 || P.value !== !0) && (v !== !0 && _e(), (d.value === !0 || i.value === !0) && Ve(""));
1289
- }, { immediate: !0 }), Z(() => e.fillInput, _e), Z(i, et), Z(Q, nl);
1290
- function at(t) {
1291
- return e.emitValue === !0 ? le.value(t) : t;
1292
- }
1293
- function Je(t) {
1294
- if (t !== -1 && t < s.value.length)
1295
- if (e.multiple === !0) {
1296
- const a = e.modelValue.slice();
1297
- o("remove", { index: t, value: a.splice(t, 1)[0] }), o("update:modelValue", a);
1298
- } else
1299
- o("update:modelValue", null);
1300
- }
1301
- function Kt(t) {
1302
- Je(t), n.focus();
1303
- }
1304
- function rt(t, a) {
1305
- const r = at(t);
1306
- if (e.multiple !== !0) {
1307
- e.fillInput === !0 && Ie(
1308
- Y.value(t),
1309
- !0,
1310
- !0
1311
- ), o("update:modelValue", r);
1312
- return;
1313
- }
1314
- if (s.value.length === 0) {
1315
- o("add", { index: 0, value: r }), o("update:modelValue", e.multiple === !0 ? [r] : r);
1316
- return;
1317
- }
1318
- if (a === !0 && Ge(t) === !0 || e.maxValues !== void 0 && e.modelValue.length >= e.maxValues) return;
1319
- const w = e.modelValue.slice();
1320
- o("add", { index: w.length, value: r }), w.push(r), o("update:modelValue", w);
1321
- }
1322
- function he(t, a) {
1323
- var $;
1324
- if (n.editable.value !== !0 || t === void 0 || Ce.value(t) === !0) return;
1325
- const r = le.value(t);
1326
- if (e.multiple !== !0) {
1327
- a !== !0 && (Ie(
1328
- e.fillInput === !0 ? Y.value(t) : "",
1329
- !0,
1330
- !0
1331
- ), Se()), ($ = B.value) == null || $.focus(), (s.value.length === 0 || fe(le.value(s.value[0]), r) !== !0) && o("update:modelValue", e.emitValue === !0 ? r : t);
1332
- return;
1333
- }
1334
- if ((R !== !0 || O.value === !0) && n.focus(), st(), s.value.length === 0) {
1335
- const E = e.emitValue === !0 ? r : t;
1336
- o("add", { index: 0, value: E }), o("update:modelValue", e.multiple === !0 ? [E] : E);
1337
- return;
1338
- }
1339
- const w = e.modelValue.slice(), M = De.value.findIndex((E) => fe(E, r));
1340
- if (M !== -1)
1341
- o("remove", { index: M, value: w.splice(M, 1)[0] });
1342
- else {
1343
- if (e.maxValues !== void 0 && w.length >= e.maxValues) return;
1344
- const E = e.emitValue === !0 ? r : t;
1345
- o("add", { index: w.length, value: E }), w.push(E);
1346
- }
1347
- o("update:modelValue", w);
1348
- }
1349
- function we(t) {
1350
- if (h.platform.is.desktop !== !0) return;
1351
- const a = t !== -1 && t < Q.value ? t : -1;
1352
- S.value !== a && (S.value = a);
1353
- }
1354
- function Pe(t = 1, a) {
1355
- if (i.value === !0) {
1356
- let r = S.value;
1357
- do
1358
- r = Rt(
1359
- r + t,
1360
- -1,
1361
- Q.value - 1
1362
- );
1363
- while (r !== -1 && r !== S.value && Ce.value(e.options[r]) === !0);
1364
- S.value !== r && (we(r), V(r), a !== !0 && e.useInput === !0 && e.fillInput === !0 && je(
1365
- r >= 0 ? Y.value(e.options[r]) : C,
1366
- !0
1367
- ));
1368
- }
1369
- }
1370
- function Qt(t, a) {
1371
- const r = (w) => fe(le.value(w), t);
1372
- return e.options.find(r) || a.find(r) || t;
1373
- }
1374
- function Ge(t) {
1375
- const a = le.value(t);
1376
- return De.value.find((r) => fe(r, a)) !== void 0;
1377
- }
1378
- function st(t) {
1379
- e.useInput === !0 && B.value !== null && (t === void 0 || B.value === t.target && t.target.value === k.value) && B.value.select();
1380
- }
1381
- function ct(t) {
1382
- ql(t, 27) === !0 && i.value === !0 && (Ae(t), Se(), _e()), o("keyup", t);
1383
- }
1384
- function dt(t) {
1385
- const { value: a } = t.target;
1386
- if (t.keyCode !== void 0) {
1387
- ct(t);
1388
- return;
1389
- }
1390
- if (t.target.value = "", y !== null && (clearTimeout(y), y = null), _ !== null && (clearTimeout(_), _ = null), _e(), typeof a == "string" && a.length !== 0) {
1391
- const r = a.toLocaleLowerCase(), w = ($) => {
1392
- const E = e.options.find((D) => String($.value(D)).toLocaleLowerCase() === r);
1393
- return E === void 0 ? !1 : (s.value.indexOf(E) === -1 ? he(E) : Se(), !0);
1394
- }, M = ($) => {
1395
- w(le) !== !0 && $ !== !0 && w(Y) !== !0 && Ve(a, !0, () => M(!0));
1396
- };
1397
- M();
1398
- } else
1399
- n.clearValue(t);
1400
- }
1401
- function ft(t) {
1402
- o("keypress", t);
1403
- }
1404
- function vt(t) {
1405
- if (o("keydown", t), Vl(t) === !0) return;
1406
- const a = b.value.length !== 0 && (e.newValueMode !== void 0 || e.onNewValue !== void 0), r = t.shiftKey !== !0 && e.disableTabSelection !== !0 && e.multiple !== !0 && (S.value !== -1 || a === !0);
1407
- if (t.keyCode === 27) {
1408
- de(t);
1409
- return;
1410
- }
1411
- if (t.keyCode === 9 && r === !1) {
1412
- qe();
1413
- return;
1414
- }
1415
- if (t.target === void 0 || t.target.id !== n.targetUid.value || n.editable.value !== !0) return;
1416
- if (t.keyCode === 40 && n.innerLoading.value !== !0 && i.value === !1) {
1417
- ce(t), ke();
1418
- return;
1419
- }
1420
- if (t.keyCode === 8 && (e.useChips === !0 || e.clearable === !0) && e.hideSelected !== !0 && b.value.length === 0) {
1421
- e.multiple === !0 && Array.isArray(e.modelValue) === !0 ? Je(e.modelValue.length - 1) : e.multiple !== !0 && e.modelValue !== null && o("update:modelValue", null);
1422
- return;
1423
- }
1424
- (t.keyCode === 35 || t.keyCode === 36) && (typeof b.value != "string" || b.value.length === 0) && (ce(t), S.value = -1, Pe(t.keyCode === 36 ? 1 : -1, e.multiple)), (t.keyCode === 33 || t.keyCode === 34) && re.value !== void 0 && (ce(t), S.value = Math.max(
1425
- -1,
1426
- Math.min(
1427
- Q.value,
1428
- S.value + (t.keyCode === 33 ? -1 : 1) * re.value.view
1429
- )
1430
- ), Pe(t.keyCode === 33 ? 1 : -1, e.multiple)), (t.keyCode === 38 || t.keyCode === 40) && (ce(t), Pe(t.keyCode === 38 ? -1 : 1, e.multiple));
1431
- const w = Q.value;
1432
- if ((K === void 0 || I < Date.now()) && (K = ""), w > 0 && e.useInput !== !0 && t.key !== void 0 && t.key.length === 1 && t.altKey === !1 && t.ctrlKey === !1 && t.metaKey === !1 && (t.keyCode !== 32 || K.length !== 0)) {
1433
- i.value !== !0 && ke(t);
1434
- const M = t.key.toLocaleLowerCase(), $ = K.length === 1 && K[0] === M;
1435
- I = Date.now() + 1500, $ === !1 && (ce(t), K += M);
1436
- const E = new RegExp("^" + K.split("").map((xe) => uo.indexOf(xe) !== -1 ? "\\" + xe : xe).join(".*"), "i");
1437
- let D = S.value;
1438
- if ($ === !0 || D < 0 || E.test(Y.value(e.options[D])) !== !0)
1439
- do
1440
- D = Rt(D + 1, -1, w - 1);
1441
- while (D !== S.value && (Ce.value(e.options[D]) === !0 || E.test(Y.value(e.options[D])) !== !0));
1442
- S.value !== D && ne(() => {
1443
- we(D), V(D), D >= 0 && e.useInput === !0 && e.fillInput === !0 && je(Y.value(e.options[D]), !0);
1444
- });
1445
- return;
1446
- }
1447
- if (!(t.keyCode !== 13 && (t.keyCode !== 32 || e.useInput === !0 || K !== "") && (t.keyCode !== 9 || r === !1))) {
1448
- if (t.keyCode !== 9 && ce(t), S.value !== -1 && S.value < w) {
1449
- he(e.options[S.value]);
1450
- return;
1451
- }
1452
- if (a === !0) {
1453
- const M = ($, E) => {
1454
- var xe;
1455
- if (E) {
1456
- if (Ft(E) !== !0) return;
1457
- } else
1458
- E = e.newValueMode;
1459
- if (Ie("", e.multiple !== !0, !0), $ == null) return;
1460
- (E === "toggle" ? he : rt)($, E === "add-unique"), e.multiple !== !0 && ((xe = B.value) == null || xe.focus(), Se());
1461
- };
1462
- if (e.onNewValue !== void 0 ? o("newValue", b.value, M) : M(b.value), e.multiple !== !0) return;
1463
- }
1464
- i.value === !0 ? qe() : n.innerLoading.value !== !0 && ke();
1465
- }
1466
- }
1467
- function mt() {
1468
- return R === !0 ? ie.value : L.value !== null && L.value.contentEl !== null ? L.value.contentEl : void 0;
1469
- }
1470
- function Ut() {
1471
- return mt();
1472
- }
1473
- function Wt() {
1474
- return e.hideSelected === !0 ? [] : l["selected-item"] !== void 0 ? pe.value.map((t) => l["selected-item"](t)).slice() : l.selected !== void 0 ? [].concat(l.selected()) : e.useChips === !0 ? pe.value.map((t, a) => p(Ql, {
1475
- key: "option-" + a,
1476
- removable: n.editable.value === !0 && Ce.value(t.opt) !== !0,
1477
- dense: !0,
1478
- textColor: e.color,
1479
- tabindex: G.value,
1480
- onRemove() {
1481
- t.removeAtIndex(a);
1482
- }
1483
- }, () => p("span", {
1484
- class: "ellipsis",
1485
- [t.html === !0 ? "innerHTML" : "textContent"]: Y.value(t.opt)
1486
- }))) : [
1487
- p("span", {
1488
- class: "ellipsis",
1489
- [Le.value === !0 ? "innerHTML" : "textContent"]: X.value
1490
- })
1491
- ];
1492
- }
1493
- function gt() {
1494
- if (j.value === !0)
1495
- return l["no-option"] !== void 0 ? l["no-option"]({ inputValue: b.value }) : void 0;
1496
- const t = l.option !== void 0 ? l.option : (r) => p(kl, {
1497
- key: r.index,
1498
- ...r.itemProps
1499
- }, () => p(
1500
- Ul,
1501
- () => p(
1502
- Wl,
1503
- () => p("span", {
1504
- [r.html === !0 ? "innerHTML" : "textContent"]: r.label
1505
- })
1506
- )
1507
- ));
1508
- let a = ye("div", $e.value.map(t));
1509
- return l["before-options"] !== void 0 && (a = l["before-options"]().concat(a)), _l(l["after-options"], a);
1510
- }
1511
- function Xt(t, a) {
1512
- const r = a === !0 ? { ...He.value, ...n.splitAttrs.attributes.value } : void 0, w = {
1513
- ref: a === !0 ? B : void 0,
1514
- key: "i_t",
1515
- class: z.value,
1516
- style: e.inputStyle,
1517
- value: b.value !== void 0 ? b.value : "",
1518
- // required for Android in order to show ENTER key when in form
1519
- type: "search",
1520
- ...r,
1521
- id: a === !0 ? n.targetUid.value : void 0,
1522
- maxlength: e.maxlength,
1523
- autocomplete: e.autocomplete,
1524
- "data-autofocus": t === !0 || e.autofocus === !0 || void 0,
1525
- disabled: e.disable === !0,
1526
- readonly: e.readonly === !0,
1527
- ...Nt.value
1528
- };
1529
- return t !== !0 && R === !0 && (Array.isArray(w.class) === !0 ? w.class = [...w.class, "no-pointer-events"] : w.class += " no-pointer-events"), p("input", w);
1530
- }
1531
- function pt(t) {
1532
- y !== null && (clearTimeout(y), y = null), _ !== null && (clearTimeout(_), _ = null), !(t && t.target && t.target.qComposing === !0) && (je(t.target.value || ""), v = !0, C = b.value, n.focused.value !== !0 && (R !== !0 || O.value === !0) && n.focus(), e.onFilter !== void 0 && (y = setTimeout(() => {
1533
- y = null, Ve(b.value);
1534
- }, e.inputDebounce)));
1535
- }
1536
- function je(t, a) {
1537
- b.value !== t && (b.value = t, a === !0 || e.inputDebounce === 0 || e.inputDebounce === "0" ? o("inputValue", t) : _ = setTimeout(() => {
1538
- _ = null, o("inputValue", t);
1539
- }, e.inputDebounce));
1540
- }
1541
- function Ie(t, a, r) {
1542
- v = r !== !0, e.useInput === !0 && (je(t, !0), (a === !0 || r !== !0) && (C = t), a !== !0 && Ve(t));
1543
- }
1544
- function Ve(t, a, r) {
1545
- if (e.onFilter === void 0 || a !== !0 && n.focused.value !== !0) return;
1546
- n.innerLoading.value === !0 ? o("filterAbort") : (n.innerLoading.value = !0, g.value = !0), t !== "" && e.multiple !== !0 && s.value.length !== 0 && v !== !0 && t === Y.value(s.value[0]) && (t = "");
1547
- const w = setTimeout(() => {
1548
- i.value === !0 && (i.value = !1);
1549
- }, 10);
1550
- f !== null && clearTimeout(f), f = w, o(
1551
- "filter",
1552
- t,
1553
- (M, $) => {
1554
- (a === !0 || n.focused.value === !0) && f === w && (clearTimeout(f), typeof M == "function" && M(), g.value = !1, ne(() => {
1555
- n.innerLoading.value = !1, n.editable.value === !0 && (a === !0 ? i.value === !0 && Se() : i.value === !0 ? et(!0) : i.value = !0), typeof $ == "function" && ne(() => {
1556
- $(u);
1557
- }), typeof r == "function" && ne(() => {
1558
- r(u);
1559
- });
1560
- }));
1561
- },
1562
- () => {
1563
- n.focused.value === !0 && f === w && (clearTimeout(f), n.innerLoading.value = !1, g.value = !1), i.value === !0 && (i.value = !1);
1564
- }
1565
- );
1566
- }
1567
- function Yt() {
1568
- return p(Rl, {
1569
- ref: L,
1570
- class: A.value,
1571
- style: e.popupContentStyle,
1572
- modelValue: i.value,
1573
- fit: e.menuShrink !== !0,
1574
- cover: e.optionsCover === !0 && j.value !== !0 && e.useInput !== !0,
1575
- anchor: e.menuAnchor,
1576
- self: e.menuSelf,
1577
- offset: e.menuOffset,
1578
- dark: T.value,
1579
- noParentEvent: !0,
1580
- noRefocus: !0,
1581
- noFocus: !0,
1582
- noRouteDismiss: e.popupNoRouteDismiss,
1583
- square: Ze.value,
1584
- transitionShow: e.transitionShow,
1585
- transitionHide: e.transitionHide,
1586
- transitionDuration: e.transitionDuration,
1587
- separateClosePopup: !0,
1588
- ...ge.value,
1589
- onScrollPassive: m,
1590
- onBeforeShow: St,
1591
- onBeforeHide: Zt,
1592
- onShow: Jt
1593
- }, gt);
1594
- }
1595
- function Zt(t) {
1596
- bt(t), qe();
1597
- }
1598
- function Jt() {
1599
- W();
1600
- }
1601
- function Gt(t) {
1602
- var a;
1603
- Ae(t), (a = B.value) == null || a.focus(), O.value = !0, window.scrollTo(window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, 0);
1604
- }
1605
- function el(t) {
1606
- Ae(t), ne(() => {
1607
- O.value = !1;
1608
- });
1609
- }
1610
- function tl() {
1611
- const t = [
1612
- p(Nl, {
1613
- class: `col-auto ${n.fieldClass.value}`,
1614
- ...q.value,
1615
- for: n.targetUid.value,
1616
- dark: T.value,
1617
- square: !0,
1618
- loading: g.value,
1619
- itemAligned: !1,
1620
- filled: !0,
1621
- stackLabel: b.value.length !== 0,
1622
- ...n.splitAttrs.listeners.value,
1623
- onFocus: Gt,
1624
- onBlur: el
1625
- }, {
1626
- ...l,
1627
- rawControl: () => n.getControl(!0),
1628
- before: void 0,
1629
- after: void 0
1630
- })
1631
- ];
1632
- return i.value === !0 && t.push(
1633
- p("div", {
1634
- ref: ie,
1635
- class: A.value + " scroll",
1636
- style: e.popupContentStyle,
1637
- ...ge.value,
1638
- onClick: de,
1639
- onScrollPassive: m
1640
- }, gt())
1641
- ), p(El, {
1642
- ref: H,
1643
- modelValue: d.value,
1644
- position: e.useInput === !0 ? "top" : void 0,
1645
- transitionShow: N,
1646
- transitionHide: e.transitionHide,
1647
- transitionDuration: e.transitionDuration,
1648
- noRouteDismiss: e.popupNoRouteDismiss,
1649
- onBeforeShow: St,
1650
- onBeforeHide: ll,
1651
- onHide: ol,
1652
- onShow: ul
1653
- }, () => p("div", {
1654
- class: "q-select__dialog" + (T.value === !0 ? " q-select__dialog--dark q-dark" : "") + (O.value === !0 ? " q-select__dialog--focused" : "")
1655
- }, t));
1656
- }
1657
- function ll(t) {
1658
- bt(t), H.value !== null && H.value.__updateRefocusTarget(
1659
- n.rootRef.value.querySelector(".q-field__native > [tabindex]:last-child")
1660
- ), n.focused.value = !1;
1661
- }
1662
- function ol(t) {
1663
- Se(), n.focused.value === !1 && o("blur", t), _e();
1664
- }
1665
- function ul() {
1666
- const t = document.activeElement;
1667
- (t === null || t.id !== n.targetUid.value) && B.value !== null && B.value !== t && B.value.focus(), W();
1668
- }
1669
- function qe() {
1670
- d.value !== !0 && (S.value = -1, i.value === !0 && (i.value = !1), n.focused.value === !1 && (f !== null && (clearTimeout(f), f = null), n.innerLoading.value === !0 && (o("filterAbort"), n.innerLoading.value = !1, g.value = !1)));
1671
- }
1672
- function ke(t) {
1673
- n.editable.value === !0 && (R === !0 ? (n.onControlFocusin(t), d.value = !0, ne(() => {
1674
- n.focus();
1675
- })) : n.focus(), e.onFilter !== void 0 ? Ve(b.value) : (j.value !== !0 || l["no-option"] !== void 0) && (i.value = !0));
1676
- }
1677
- function Se() {
1678
- d.value = !1, qe();
1679
- }
1680
- function _e() {
1681
- e.useInput === !0 && Ie(
1682
- e.multiple !== !0 && e.fillInput === !0 && s.value.length !== 0 && Y.value(s.value[0]) || "",
1683
- !0,
1684
- !0
1685
- );
1686
- }
1687
- function et(t) {
1688
- let a = -1;
1689
- if (t === !0) {
1690
- if (s.value.length !== 0) {
1691
- const r = le.value(s.value[0]);
1692
- a = e.options.findIndex((w) => fe(le.value(w), r));
1693
- }
1694
- U(a);
1695
- }
1696
- we(a);
1697
- }
1698
- function nl(t, a) {
1699
- i.value === !0 && n.innerLoading.value === !1 && (U(-1, !0), ne(() => {
1700
- i.value === !0 && n.innerLoading.value === !1 && (t > a ? U() : et(!0));
1701
- }));
1702
- }
1703
- function ht() {
1704
- d.value === !1 && L.value !== null && L.value.updatePosition();
1705
- }
1706
- function St(t) {
1707
- t !== void 0 && Ae(t), o("popupShow", t), n.hasPopupOpen = !0, n.onControlFocusin(t);
1708
- }
1709
- function bt(t) {
1710
- t !== void 0 && Ae(t), o("popupHide", t), n.hasPopupOpen = !1, n.onControlFocusout(t);
1711
- }
1712
- function yt() {
1713
- R = h.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), N = h.platform.is.ios === !0 && R === !0 && e.useInput === !0 ? "fade" : e.transitionShow;
1714
- }
1715
- return Ot(yt), sl(ht), yt(), Ee(() => {
1716
- y !== null && clearTimeout(y), _ !== null && clearTimeout(_);
1717
- }), Object.assign(u, {
1718
- showPopup: ke,
1719
- hidePopup: Se,
1720
- removeAtIndex: Je,
1721
- add: rt,
1722
- toggleOption: he,
1723
- getOptionIndex: () => S.value,
1724
- setOptionIndex: we,
1725
- moveOptionSelection: Pe,
1726
- filter: Ve,
1727
- updateMenuPosition: ht,
1728
- updateInputValue: Ie,
1729
- isOptionSelected: Ge,
1730
- getEmittingOptionValue: at,
1731
- isOptionDisabled: (...t) => Ce.value.apply(null, t) === !0,
1732
- getOptionValue: (...t) => le.value.apply(null, t),
1733
- getOptionLabel: (...t) => Y.value.apply(null, t)
1734
- }), Object.assign(n, {
1735
- innerValue: s,
1736
- fieldClass: c(
1737
- () => `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"}`
1738
- ),
1739
- inputRef: J,
1740
- targetRef: B,
1741
- hasValue: P,
1742
- showPopup: ke,
1743
- floatingLabel: c(
1744
- () => e.hideSelected !== !0 && P.value === !0 || typeof b.value == "number" || b.value.length !== 0 || nt(e.displayValue)
1745
- ),
1746
- getControlChild: () => {
1747
- if (n.editable.value !== !1 && (d.value === !0 || j.value !== !0 || l["no-option"] !== void 0))
1748
- return R === !0 ? tl() : Yt();
1749
- n.hasPopupOpen === !0 && (n.hasPopupOpen = !1);
1750
- },
1751
- controlEvents: {
1752
- onFocusin(t) {
1753
- n.onControlFocusin(t);
1754
- },
1755
- onFocusout(t) {
1756
- n.onControlFocusout(t, () => {
1757
- _e(), qe();
1758
- });
1759
- },
1760
- onClick(t) {
1761
- var a;
1762
- if (de(t), R !== !0 && i.value === !0) {
1763
- qe(), (a = B.value) == null || a.focus();
1764
- return;
1765
- }
1766
- ke(t);
1767
- }
1768
- },
1769
- getControl: (t) => {
1770
- const a = Wt(), r = t === !0 || d.value !== !0 || R !== !0;
1771
- if (e.useInput === !0)
1772
- a.push(Xt(t, r));
1773
- else if (n.editable.value === !0) {
1774
- const M = r === !0 ? He.value : void 0;
1775
- a.push(
1776
- p("input", {
1777
- ref: r === !0 ? B : void 0,
1778
- key: "d_t",
1779
- class: "q-select__focus-target",
1780
- id: r === !0 ? n.targetUid.value : void 0,
1781
- value: X.value,
1782
- readonly: !0,
1783
- "data-autofocus": t === !0 || e.autofocus === !0 || void 0,
1784
- ...M,
1785
- onKeydown: vt,
1786
- onKeyup: ct,
1787
- onKeypress: ft
1788
- })
1789
- ), r === !0 && typeof e.autocomplete == "string" && e.autocomplete.length !== 0 && a.push(
1790
- p("input", {
1791
- class: "q-select__autocomplete-input",
1792
- autocomplete: e.autocomplete,
1793
- tabindex: -1,
1794
- onKeyup: dt
1795
- })
1796
- );
1797
- }
1798
- if (te.value !== void 0 && e.disable !== !0 && De.value.length !== 0) {
1799
- const M = De.value.map(($) => p("option", { value: $, selected: !0 }));
1800
- a.push(
1801
- p("select", {
1802
- class: "hidden",
1803
- name: te.value,
1804
- multiple: e.multiple
1805
- }, M)
1806
- );
1807
- }
1808
- const w = e.useInput === !0 || r !== !0 ? void 0 : n.splitAttrs.attributes.value;
1809
- return p("div", {
1810
- class: "q-field__native row items-center",
1811
- ...w,
1812
- ...n.splitAttrs.listeners.value
1813
- }, a);
1814
- },
1815
- getInnerAppend: () => e.loading !== !0 && g.value !== !0 && e.hideDropdownIcon !== !0 ? [
1816
- p(ze, {
1817
- class: "q-select__dropdown-icon" + (i.value === !0 ? " rotate-180" : ""),
1818
- name: Fe.value
1819
- })
1820
- ] : null
1821
- }), Pt(n);
1822
- }
1823
- }), ao = { class: "app-select__amount" }, ro = /* @__PURE__ */ cl({
1824
- __name: "AppSelect",
1825
- props: {
1826
- modelValue: {},
1827
- size: { default: xl.MD },
1828
- options: {},
1829
- multiple: { type: Boolean },
1830
- label: {},
1831
- placeholder: {},
1832
- required: { type: Boolean },
1833
- clearable: { type: Boolean },
1834
- disabled: { type: Boolean },
1835
- loading: { type: Boolean },
1836
- filtering: { type: Boolean },
1837
- autofocus: { type: Boolean },
1838
- rules: {},
1839
- lazyRules: { type: [Boolean, String] },
1840
- menuClass: {},
1841
- glass: { type: Boolean },
1842
- isMobile: { type: Boolean }
1843
- },
1844
- emits: ["update:modelValue", "popupShow", "popupHide"],
1845
- setup(e, { emit: l }) {
1846
- const o = e, u = l, h = F(!1), i = F(""), d = c({
1847
- get() {
1848
- if (o.modelValue) {
1849
- if (o.multiple && Array.isArray(o.modelValue))
1850
- return o.options.filter(
1851
- (v) => o.modelValue.includes(v.value)
1852
- );
1853
- if (!Array.isArray(o.modelValue))
1854
- return o.options.find(
1855
- (v) => v.value === o.modelValue
1856
- );
1857
- }
1858
- },
1859
- set(v) {
1860
- if (!v) {
1861
- u("update:modelValue", void 0);
1862
- return;
1863
- }
1864
- if (o.multiple && Array.isArray(v)) {
1865
- const f = v.map((C) => C.value);
1866
- u("update:modelValue", f);
1867
- } else Array.isArray(v) || u("update:modelValue", v.value);
1868
- }
1869
- }), S = c(() => {
1870
- var v;
1871
- if (Array.isArray(d.value)) {
1872
- if (o.multiple && d.value.length == 0)
1873
- return o.placeholder;
1874
- } else return ((v = d.value) == null ? void 0 : v.label) || o.placeholder || "";
1875
- return "";
1876
- }), b = c(() => !(!o.clearable || !o.modelValue || o.modelValue && Array.isArray(o.modelValue) && !o.modelValue.length)), O = c(() => i.value ? o.options.filter(
1877
- (v) => v.label.toLowerCase().includes(i.value.toLowerCase())
1878
- ) : o.options), g = c(() => {
1879
- if (o.rules)
1880
- return o.required ? [...o.rules, qt] : o.rules;
1881
- if (o.required)
1882
- return [qt];
1883
- }), y = () => {
1884
- h.value = !0, u("popupShow");
1885
- }, _ = () => {
1886
- h.value = !1, u("popupHide");
1887
- }, x = () => {
1888
- d.value = void 0;
1889
- }, R = (v, f) => {
1890
- f(() => {
1891
- i.value = v;
1892
- });
1893
- };
1894
- return (v, f) => (oe(), ue("div", {
1895
- class: Ne(["app-select", [{ "app-select_opened": h.value }, `app-select_${v.size}`]])
1896
- }, [
1897
- v.label ? (oe(), ue("label", {
1898
- key: 0,
1899
- class: Ne(["app-select__label", { "app-select__label_bold": v.required }])
1900
- }, Ke(v.required ? `${v.label} *` : v.label), 3)) : Qe("", !0),
1901
- Ct(dl(io), {
1902
- standout: "",
1903
- "hide-bottom-space": "",
1904
- "hide-dropdown-icon": "",
1905
- "no-error-icon": "",
1906
- behavior: "menu",
1907
- "popup-no-route-dismiss": "",
1908
- "popup-content-class": `kl-menu ${v.glass ? "glass-menu" : ""} app-select-menu app-select-menu_${v.size} ${v.menuClass}`,
1909
- placeholder: v.filtering && "Почніть вводити",
1910
- "input-debounce": "50",
1911
- modelValue: d.value,
1912
- "onUpdate:modelValue": f[0] || (f[0] = (C) => d.value = C),
1913
- options: O.value,
1914
- multiple: v.multiple,
1915
- "use-input": v.filtering && (Array.isArray(d.value) || !d.value),
1916
- rules: g.value,
1917
- "lazy-rules": v.lazyRules,
1918
- autofocus: v.autofocus,
1919
- disable: v.disabled,
1920
- loading: v.loading,
1921
- "menu-offset": [0, 2],
1922
- onFilter: R,
1923
- onPopupShow: y,
1924
- onPopupHide: _
1925
- }, {
1926
- append: tt(() => [
1927
- b.value ? (oe(), ue("i", {
1928
- key: 0,
1929
- class: "icon-kl icon-kl-circle-close app-select__clear",
1930
- onClick: vl(x, ["stop", "prevent"])
1931
- })) : Qe("", !0),
1932
- f[1] || (f[1] = Vt("i", { class: "icon-kl icon-kl-arrow-down app-select__drop-icon" }, null, -1))
1933
- ]),
1934
- selected: tt(() => {
1935
- var C, N;
1936
- return [
1937
- Array.isArray(d.value) ? (oe(), ue(Ue, { key: 0 }, [
1938
- !v.filtering || d.value.length ? (oe(), ue("span", {
1939
- key: 0,
1940
- class: Ne([
1941
- "app-select__selected",
1942
- {
1943
- "app-select__placeholder": !((C = d.value) != null && C.length) && v.placeholder
1944
- }
1945
- ])
1946
- }, [
1947
- (N = d.value) != null && N.length ? (oe(), ue(Ue, { key: 0 }, [
1948
- f[2] || (f[2] = wt(" Вибрано ", -1)),
1949
- Vt("span", ao, Ke(d.value.length), 1)
1950
- ], 64)) : (oe(), ue(Ue, { key: 1 }, [
1951
- wt(Ke(o.placeholder), 1)
1952
- ], 64))
1953
- ], 2)) : Qe("", !0)
1954
- ], 64)) : (oe(), ue(Ue, { key: 1 }, [
1955
- !v.filtering || d.value ? (oe(), ue("span", {
1956
- key: 0,
1957
- class: Ne([
1958
- "app-select__selected",
1959
- { "app-select__placeholder": !d.value && v.placeholder }
1960
- ])
1961
- }, Ke(S.value), 3)) : Qe("", !0)
1962
- ], 64))
1963
- ];
1964
- }),
1965
- option: tt((C) => [
1966
- Ct(Al, fl({
1967
- "no-arrow": "",
1968
- label: C.opt.label,
1969
- checked: C.opt.done,
1970
- active: C.selected,
1971
- "is-mobile": v.isMobile,
1972
- checkbox: o.multiple,
1973
- "model-value": C.selected
1974
- }, o.multiple ? { ...C.itemProps, onClick: void 0 } : C.itemProps, {
1975
- "onUpdate:modelValue": () => C.toggleOption(C.opt)
1976
- }), null, 16, ["label", "checked", "active", "is-mobile", "checkbox", "model-value", "onUpdate:modelValue"])
1977
- ]),
1978
- _: 1
1979
- }, 8, ["popup-content-class", "placeholder", "modelValue", "options", "multiple", "use-input", "rules", "lazy-rules", "autofocus", "disable", "loading"])
1980
- ], 2));
1981
- }
1982
- }), po = /* @__PURE__ */ Bl(ro, [["__scopeId", "data-v-21482233"]]);
1983
- export {
1984
- po as default
1985
- };