@quidgest/ui 0.16.40 → 0.16.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.
- package/dist/json/api.json +1 -1
- package/dist/ui.css +1 -1
- package/dist/ui.esm.js +15 -9
- package/dist/ui.js +2 -2
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +6 -6
- package/dist/ui.scss +2 -2
- package/esm/components/QSelect/QSelect.d.ts.map +1 -1
- package/esm/components/QSelect/QSelect.vue.js +108 -102
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as ce, mergeModels as Z, useModel as fe, toRef as z, ref as ee, useTemplateRef as _, onMounted as me, computed as q, nextTick as O, watch as D, createElementBlock as c, openBlock as
|
|
1
|
+
import { defineComponent as ce, mergeModels as Z, useModel as fe, toRef as z, ref as ee, useTemplateRef as _, onMounted as me, computed as q, nextTick as O, watch as D, createElementBlock as c, openBlock as t, Fragment as y, createVNode as T, unref as o, normalizeClass as pe, createSlots as ve, withCtx as f, withDirectives as be, createBlock as m, createCommentVNode as p, renderList as le, createTextVNode as w, mergeProps as B, toDisplayString as g, normalizeProps as ae, createElementVNode as te, vModelText as ye, renderSlot as h, withModifiers as ge } from "vue";
|
|
2
2
|
import { DEFAULT_TEXTS as he, DEFAULT_ICONS as ke } from "./constants.js";
|
|
3
3
|
import { QBadge as M } from "../QBadge/index.js";
|
|
4
4
|
import { QButton as _e } from "../QButton/index.js";
|
|
@@ -59,98 +59,98 @@ const De = {
|
|
|
59
59
|
active: s,
|
|
60
60
|
required: z(e, "required"),
|
|
61
61
|
multiple: z(e, "multiple")
|
|
62
|
-
}),
|
|
62
|
+
}), u = ee(!1), V = ee(0), S = _("trigger"), ie = _("list"), U = _("content"), N = _("badgesContainer"), W = _("allBadges");
|
|
63
63
|
me($);
|
|
64
64
|
const P = q(() => r.value.length === 0), r = q(() => {
|
|
65
|
-
var
|
|
65
|
+
var a;
|
|
66
66
|
if (e.multiple)
|
|
67
|
-
return ((
|
|
67
|
+
return ((a = s.value) == null ? void 0 : a.map((d) => j(d))) ?? [];
|
|
68
68
|
const l = typeof s.value < "u" ? j(s.value) : void 0;
|
|
69
69
|
return l ? [l] : [];
|
|
70
70
|
}), H = q(() => {
|
|
71
|
-
var
|
|
71
|
+
var a;
|
|
72
72
|
const l = /* @__PURE__ */ new Map();
|
|
73
|
-
return (
|
|
74
|
-
l.set(
|
|
73
|
+
return (a = e.items) == null || a.forEach((d, i) => {
|
|
74
|
+
l.set(d.key, i);
|
|
75
75
|
}), l;
|
|
76
76
|
}), A = q(
|
|
77
77
|
() => {
|
|
78
78
|
var l;
|
|
79
|
-
return (l = r.value) == null ? void 0 : l.map((
|
|
79
|
+
return (l = r.value) == null ? void 0 : l.map((a) => a[e.itemLabel]).join(", ");
|
|
80
80
|
}
|
|
81
|
-
),
|
|
81
|
+
), L = q(
|
|
82
82
|
() => e.clearable && !e.readonly && !e.disabled && !e.loading && !P.value
|
|
83
83
|
);
|
|
84
84
|
function j(l) {
|
|
85
|
-
var
|
|
86
|
-
return (
|
|
85
|
+
var a;
|
|
86
|
+
return (a = e.items) == null ? void 0 : a.find((d) => d[e.itemValue] === l);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
e.multiple && l < s.value.length && (!e.required || s.value.length > 1) ? K.value = s.value.toSpliced(l, 1) :
|
|
88
|
+
function ne(l) {
|
|
89
|
+
e.multiple && l < s.value.length && (!e.required || s.value.length > 1) ? K.value = s.value.toSpliced(l, 1) : k();
|
|
90
90
|
}
|
|
91
91
|
function I(l) {
|
|
92
|
-
Array.isArray(l) ? (s.value = l.sort((
|
|
92
|
+
Array.isArray(l) ? (s.value = l.sort((a, d) => H.value.get(a) - H.value.get(d)), $()) : (s.value = l, E());
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
94
|
+
function k() {
|
|
95
|
+
I(e.emptyValue), J();
|
|
96
96
|
}
|
|
97
97
|
function re(l) {
|
|
98
|
-
var
|
|
99
|
-
!((
|
|
98
|
+
var a, d, i;
|
|
99
|
+
!((a = U.value) != null && a.contains(l.relatedTarget)) && !((i = (d = S.value) == null ? void 0 : d.fieldRef) != null && i.contains(l.relatedTarget)) && E();
|
|
100
100
|
}
|
|
101
101
|
function G() {
|
|
102
|
-
|
|
102
|
+
u.value || (C("before-show"), u.value = !0);
|
|
103
103
|
}
|
|
104
104
|
function E() {
|
|
105
|
-
|
|
105
|
+
u.value && (C("before-hide"), u.value = !1);
|
|
106
106
|
}
|
|
107
107
|
function X() {
|
|
108
|
-
e.readonly || e.disabled || (
|
|
108
|
+
e.readonly || e.disabled || (u.value ? E() : G());
|
|
109
109
|
}
|
|
110
110
|
function x(l) {
|
|
111
|
-
!l.key || e.readonly || e.disabled || (["Enter", " ", "ArrowDown", "ArrowUp", "Home", "End", "Delete"].includes(l.key) && (l.preventDefault(), l.stopPropagation()), ["Enter", " ", "ArrowDown"].includes(l.key) && G(), ["Escape", "Tab"].includes(l.key) && (
|
|
111
|
+
!l.key || e.readonly || e.disabled || (["Enter", " ", "ArrowDown", "ArrowUp", "Home", "End", "Delete"].includes(l.key) && (l.preventDefault(), l.stopPropagation()), ["Enter", " ", "ArrowDown"].includes(l.key) && G(), ["Escape", "Tab"].includes(l.key) && (u.value ? E() : L.value && l.key === "Escape" && k()), L.value && l.key === "Delete" && k());
|
|
112
112
|
}
|
|
113
113
|
function se(l) {
|
|
114
114
|
l.key.length === 1 && l.preventDefault(), x(l);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function de() {
|
|
117
117
|
var l;
|
|
118
118
|
e.loading ? (l = U.value) == null || l.focus() : Y(), C("show");
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function ue() {
|
|
121
121
|
J(), C("hide");
|
|
122
122
|
}
|
|
123
123
|
function J() {
|
|
124
|
-
var l,
|
|
125
|
-
(
|
|
124
|
+
var l, a;
|
|
125
|
+
(a = (l = S.value) == null ? void 0 : l.fieldRef) == null || a.focus();
|
|
126
126
|
}
|
|
127
127
|
function Y() {
|
|
128
128
|
var l;
|
|
129
|
-
(l =
|
|
129
|
+
(l = ie.value) == null || l.$el.focus();
|
|
130
130
|
}
|
|
131
131
|
async function $() {
|
|
132
|
-
var
|
|
132
|
+
var n;
|
|
133
133
|
if (await O(), !e.multiple || !e.badges || !N.value) return;
|
|
134
|
-
let l = 0,
|
|
134
|
+
let l = 0, a = 0;
|
|
135
135
|
await O();
|
|
136
|
-
const
|
|
137
|
-
for (const
|
|
138
|
-
const v =
|
|
139
|
-
if (l + v <=
|
|
140
|
-
l += v,
|
|
136
|
+
const d = N.value.offsetWidth, i = 4;
|
|
137
|
+
for (const b of W.value ?? []) {
|
|
138
|
+
const v = b.$el.scrollWidth + i;
|
|
139
|
+
if (l + v <= d)
|
|
140
|
+
l += v, a++;
|
|
141
141
|
else break;
|
|
142
142
|
}
|
|
143
|
-
V.value = (((
|
|
143
|
+
V.value = (((n = W.value) == null ? void 0 : n.length) ?? 0) - a;
|
|
144
144
|
}
|
|
145
145
|
return D(
|
|
146
146
|
() => e.loading,
|
|
147
147
|
(l) => {
|
|
148
|
-
!l &&
|
|
148
|
+
!l && u.value && O(Y);
|
|
149
149
|
}
|
|
150
|
-
), D(() => e.badges, $), D(() => e.clearable, $), D(K, I), (l,
|
|
151
|
-
var
|
|
152
|
-
return
|
|
153
|
-
|
|
150
|
+
), D(() => e.badges, $), D(() => e.clearable, $), D(K, I), (l, a) => {
|
|
151
|
+
var d;
|
|
152
|
+
return t(), c(
|
|
153
|
+
y,
|
|
154
154
|
null,
|
|
155
155
|
[
|
|
156
156
|
T(o(qe), {
|
|
@@ -170,7 +170,7 @@ const De = {
|
|
|
170
170
|
readonly: e.readonly,
|
|
171
171
|
disabled: e.disabled,
|
|
172
172
|
"data-loading": e.loading,
|
|
173
|
-
"aria-expanded":
|
|
173
|
+
"aria-expanded": u.value,
|
|
174
174
|
"aria-haspopup": "listbox",
|
|
175
175
|
size: e.size,
|
|
176
176
|
invalid: e.invalid,
|
|
@@ -179,13 +179,13 @@ const De = {
|
|
|
179
179
|
}, ve({
|
|
180
180
|
append: f(() => [
|
|
181
181
|
h(l.$slots, "append"),
|
|
182
|
-
|
|
182
|
+
L.value ? (t(), m(o(Le), {
|
|
183
183
|
key: 0,
|
|
184
184
|
icons: e.icons,
|
|
185
185
|
texts: e.texts,
|
|
186
|
-
onClick:
|
|
186
|
+
onClick: k
|
|
187
187
|
}, null, 8, ["icons", "texts"])) : p("v-if", !0),
|
|
188
|
-
e.readonly ? p("v-if", !0) : (
|
|
188
|
+
e.readonly ? p("v-if", !0) : (t(), m(o(_e), {
|
|
189
189
|
key: 1,
|
|
190
190
|
class: "q-select__chevron",
|
|
191
191
|
"aria-label": e.texts.showOptions,
|
|
@@ -198,7 +198,7 @@ const De = {
|
|
|
198
198
|
}, {
|
|
199
199
|
default: f(() => [
|
|
200
200
|
T(o(Ve), {
|
|
201
|
-
"model-value":
|
|
201
|
+
"model-value": u.value,
|
|
202
202
|
icons: e.icons
|
|
203
203
|
}, null, 8, ["model-value", "icons"])
|
|
204
204
|
]),
|
|
@@ -207,9 +207,9 @@ const De = {
|
|
|
207
207
|
}, 8, ["aria-label", "disabled"]))
|
|
208
208
|
]),
|
|
209
209
|
default: f(() => [
|
|
210
|
-
P.value ? (
|
|
211
|
-
!e.readonly && !e.disabled ? (
|
|
212
|
-
|
|
210
|
+
P.value ? (t(), c("span", Me, [
|
|
211
|
+
!e.readonly && !e.disabled ? (t(), c(
|
|
212
|
+
y,
|
|
213
213
|
{ key: 0 },
|
|
214
214
|
[
|
|
215
215
|
w(
|
|
@@ -221,46 +221,47 @@ const De = {
|
|
|
221
221
|
64
|
|
222
222
|
/* STABLE_FRAGMENT */
|
|
223
223
|
)) : p("v-if", !0)
|
|
224
|
-
])) : (
|
|
225
|
-
|
|
224
|
+
])) : (t(), c(
|
|
225
|
+
y,
|
|
226
226
|
{ key: 0 },
|
|
227
227
|
[
|
|
228
|
-
e.badges ? (
|
|
228
|
+
e.badges ? (t(), c(
|
|
229
229
|
"span",
|
|
230
230
|
De,
|
|
231
231
|
[
|
|
232
|
-
e.multiple ? (
|
|
233
|
-
|
|
232
|
+
e.multiple ? (t(), c(
|
|
233
|
+
y,
|
|
234
234
|
{ key: 0 },
|
|
235
235
|
[
|
|
236
|
-
(
|
|
237
|
-
|
|
236
|
+
(t(!0), c(
|
|
237
|
+
y,
|
|
238
238
|
null,
|
|
239
|
-
le(s.value, (
|
|
240
|
-
|
|
241
|
-
{ key:
|
|
239
|
+
le(s.value, (i, n) => (t(), c(
|
|
240
|
+
y,
|
|
241
|
+
{ key: n },
|
|
242
242
|
[
|
|
243
|
-
|
|
243
|
+
n < s.value.length - V.value ? (t(), m(o(M), {
|
|
244
244
|
key: 0,
|
|
245
245
|
pill: "",
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
disabled: e.readonly || e.disabled,
|
|
247
|
+
removable: !e.required || s.value.length > 1,
|
|
248
|
+
"onClick:remove": () => ne(n)
|
|
248
249
|
}, {
|
|
249
250
|
default: f(() => {
|
|
250
|
-
var
|
|
251
|
+
var b, v;
|
|
251
252
|
return [
|
|
252
|
-
(
|
|
253
|
+
(b = r.value[n]) != null && b.icon ? (t(), m(
|
|
253
254
|
o(Q),
|
|
254
255
|
B({
|
|
255
256
|
key: 0,
|
|
256
257
|
ref_for: !0
|
|
257
|
-
}, r.value[
|
|
258
|
+
}, r.value[n].icon),
|
|
258
259
|
null,
|
|
259
260
|
16
|
|
260
261
|
/* FULL_PROPS */
|
|
261
262
|
)) : p("v-if", !0),
|
|
262
263
|
w(
|
|
263
|
-
" " + g((v = r.value[
|
|
264
|
+
" " + g((v = r.value[n]) == null ? void 0 : v[e.itemLabel]),
|
|
264
265
|
1
|
|
265
266
|
/* TEXT */
|
|
266
267
|
)
|
|
@@ -268,7 +269,7 @@ const De = {
|
|
|
268
269
|
}),
|
|
269
270
|
_: 2
|
|
270
271
|
/* DYNAMIC */
|
|
271
|
-
}, 1032, ["removable", "onClick:remove"])) : p("v-if", !0)
|
|
272
|
+
}, 1032, ["disabled", "removable", "onClick:remove"])) : p("v-if", !0)
|
|
272
273
|
],
|
|
273
274
|
64
|
|
274
275
|
/* STABLE_FRAGMENT */
|
|
@@ -276,10 +277,11 @@ const De = {
|
|
|
276
277
|
128
|
|
277
278
|
/* KEYED_FRAGMENT */
|
|
278
279
|
)),
|
|
279
|
-
V.value > 0 ? (
|
|
280
|
+
V.value > 0 ? (t(), m(o(M), {
|
|
280
281
|
key: 0,
|
|
281
282
|
pill: "",
|
|
282
|
-
class: "q-select__badge-count"
|
|
283
|
+
class: "q-select__badge-count",
|
|
284
|
+
disabled: e.readonly || e.disabled
|
|
283
285
|
}, {
|
|
284
286
|
default: f(() => [
|
|
285
287
|
w(
|
|
@@ -290,33 +292,34 @@ const De = {
|
|
|
290
292
|
]),
|
|
291
293
|
_: 1
|
|
292
294
|
/* STABLE */
|
|
293
|
-
})) : p("v-if", !0),
|
|
294
|
-
(
|
|
295
|
-
|
|
295
|
+
}, 8, ["disabled"])) : p("v-if", !0),
|
|
296
|
+
(t(!0), c(
|
|
297
|
+
y,
|
|
296
298
|
null,
|
|
297
|
-
le(s.value, (
|
|
298
|
-
key:
|
|
299
|
+
le(s.value, (i, n) => (t(), m(o(M), {
|
|
300
|
+
key: n,
|
|
299
301
|
ref_for: !0,
|
|
300
302
|
ref: "allBadges",
|
|
301
303
|
pill: "",
|
|
304
|
+
disabled: "",
|
|
302
305
|
class: "q-select__badge-hidden",
|
|
303
|
-
removable: !e.
|
|
306
|
+
removable: !e.required || s.value.length > 1
|
|
304
307
|
}, {
|
|
305
308
|
default: f(() => {
|
|
306
|
-
var
|
|
309
|
+
var b, v;
|
|
307
310
|
return [
|
|
308
|
-
(
|
|
311
|
+
(b = r.value[n]) != null && b.icon ? (t(), m(
|
|
309
312
|
o(Q),
|
|
310
313
|
B({
|
|
311
314
|
key: 0,
|
|
312
315
|
ref_for: !0
|
|
313
|
-
}, r.value[
|
|
316
|
+
}, r.value[n].icon),
|
|
314
317
|
null,
|
|
315
318
|
16
|
|
316
319
|
/* FULL_PROPS */
|
|
317
320
|
)) : p("v-if", !0),
|
|
318
321
|
w(
|
|
319
|
-
" " + g((v = r.value[
|
|
322
|
+
" " + g((v = r.value[n]) == null ? void 0 : v[e.itemLabel]),
|
|
320
323
|
1
|
|
321
324
|
/* TEXT */
|
|
322
325
|
)
|
|
@@ -331,22 +334,25 @@ const De = {
|
|
|
331
334
|
],
|
|
332
335
|
64
|
|
333
336
|
/* STABLE_FRAGMENT */
|
|
334
|
-
)) : (
|
|
337
|
+
)) : (t(), m(o(M), {
|
|
335
338
|
key: 1,
|
|
336
|
-
pill: ""
|
|
339
|
+
pill: "",
|
|
340
|
+
disabled: e.readonly || e.disabled,
|
|
341
|
+
removable: !e.required,
|
|
342
|
+
"onClick:remove": k
|
|
337
343
|
}, {
|
|
338
344
|
default: f(() => {
|
|
339
|
-
var
|
|
345
|
+
var i, n;
|
|
340
346
|
return [
|
|
341
|
-
(
|
|
347
|
+
(i = r.value[0]) != null && i.icon ? (t(), m(
|
|
342
348
|
o(Q),
|
|
343
|
-
|
|
349
|
+
ae(B({ key: 0 }, r.value[0].icon)),
|
|
344
350
|
null,
|
|
345
351
|
16
|
|
346
352
|
/* FULL_PROPS */
|
|
347
353
|
)) : p("v-if", !0),
|
|
348
354
|
w(
|
|
349
|
-
" " + g((
|
|
355
|
+
" " + g((n = r.value[0]) == null ? void 0 : n[e.itemLabel]),
|
|
350
356
|
1
|
|
351
357
|
/* TEXT */
|
|
352
358
|
)
|
|
@@ -354,11 +360,11 @@ const De = {
|
|
|
354
360
|
}),
|
|
355
361
|
_: 1
|
|
356
362
|
/* STABLE */
|
|
357
|
-
}))
|
|
363
|
+
}, 8, ["disabled", "removable"]))
|
|
358
364
|
],
|
|
359
365
|
512
|
|
360
366
|
/* NEED_PATCH */
|
|
361
|
-
)) : (
|
|
367
|
+
)) : (t(), c(
|
|
362
368
|
"span",
|
|
363
369
|
Te,
|
|
364
370
|
g(A.value),
|
|
@@ -369,19 +375,19 @@ const De = {
|
|
|
369
375
|
64
|
|
370
376
|
/* STABLE_FRAGMENT */
|
|
371
377
|
)),
|
|
372
|
-
|
|
378
|
+
be(te("input", B({
|
|
373
379
|
id: `${o(R)}_input`
|
|
374
380
|
}, l.$attrs, {
|
|
375
|
-
"onUpdate:modelValue":
|
|
381
|
+
"onUpdate:modelValue": a[0] || (a[0] = (i) => A.value = i),
|
|
376
382
|
class: "q-select__input",
|
|
377
383
|
inputmode: "none",
|
|
378
384
|
type: "text",
|
|
379
385
|
autocomplete: "off",
|
|
380
386
|
tabindex: e.disabled ? -1 : 0,
|
|
381
|
-
"aria-keyshortcuts":
|
|
387
|
+
"aria-keyshortcuts": L.value ? "Delete" : void 0,
|
|
382
388
|
onKeydown: se
|
|
383
389
|
}), null, 16, Qe), [
|
|
384
|
-
[
|
|
390
|
+
[ye, A.value]
|
|
385
391
|
])
|
|
386
392
|
]),
|
|
387
393
|
_: 2
|
|
@@ -391,9 +397,9 @@ const De = {
|
|
|
391
397
|
name: "prepend",
|
|
392
398
|
fn: f(() => [
|
|
393
399
|
h(l.$slots, "prepend"),
|
|
394
|
-
r.value.length === 1 && r.value[0].icon && !e.badges ? (
|
|
400
|
+
r.value.length === 1 && r.value[0].icon && !e.badges ? (t(), m(
|
|
395
401
|
o(Q),
|
|
396
|
-
|
|
402
|
+
ae(B({ key: 0 }, r.value[0].icon)),
|
|
397
403
|
null,
|
|
398
404
|
16
|
|
399
405
|
/* FULL_PROPS */
|
|
@@ -410,21 +416,21 @@ const De = {
|
|
|
410
416
|
} : void 0
|
|
411
417
|
]), 1032, ["id", "label", "required", "class", "readonly", "disabled", "data-loading", "aria-expanded", "size", "invalid"]),
|
|
412
418
|
T(o(Be), {
|
|
413
|
-
modelValue:
|
|
414
|
-
"onUpdate:modelValue":
|
|
419
|
+
modelValue: u.value,
|
|
420
|
+
"onUpdate:modelValue": a[1] || (a[1] = (i) => u.value = i),
|
|
415
421
|
spy: "",
|
|
416
422
|
trigger: "manual",
|
|
417
423
|
placement: "bottom-start",
|
|
418
424
|
width: "anchor",
|
|
419
425
|
"scroll-lock": "",
|
|
420
426
|
inline: e.inline,
|
|
421
|
-
anchor: (
|
|
427
|
+
anchor: (d = o(S)) == null ? void 0 : d.fieldRef,
|
|
422
428
|
offset: 2,
|
|
423
|
-
onEnter:
|
|
424
|
-
onLeave:
|
|
429
|
+
onEnter: de,
|
|
430
|
+
onLeave: ue
|
|
425
431
|
}, {
|
|
426
432
|
default: f(() => [
|
|
427
|
-
|
|
433
|
+
te("div", {
|
|
428
434
|
ref: "content",
|
|
429
435
|
"data-testid": "combobox-dropdown",
|
|
430
436
|
"data-key": o(R),
|
|
@@ -434,9 +440,9 @@ const De = {
|
|
|
434
440
|
onKeydown: ge(x, ["stop"])
|
|
435
441
|
}, [
|
|
436
442
|
h(l.$slots, "body.prepend"),
|
|
437
|
-
e.loading ? (
|
|
443
|
+
e.loading ? (t(), c("div", Se, [
|
|
438
444
|
T(o(Ce), { size: 24 })
|
|
439
|
-
])) : (
|
|
445
|
+
])) : (t(), m(o(we), {
|
|
440
446
|
key: 1,
|
|
441
447
|
ref: "list",
|
|
442
448
|
class: "q-select__items",
|
|
@@ -450,8 +456,8 @@ const De = {
|
|
|
450
456
|
"item-value": e.itemValue,
|
|
451
457
|
"onUpdate:modelValue": I
|
|
452
458
|
}, {
|
|
453
|
-
item: f(({ item:
|
|
454
|
-
h(l.$slots, "item", { item:
|
|
459
|
+
item: f(({ item: i }) => [
|
|
460
|
+
h(l.$slots, "item", { item: i })
|
|
455
461
|
]),
|
|
456
462
|
_: 3
|
|
457
463
|
/* FORWARDED */
|