@jblehm/super-list 1.0.27 → 1.0.29
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/README.md +1 -1
- package/dist/index.css +1 -1
- package/dist/super-list.js +183 -170
- package/dist/super-list.js.map +1 -1
- package/dist/super-list.umd.cjs +2 -2
- package/dist/super-list.umd.cjs.map +1 -1
- package/dist/super-list.vue.d.ts +9 -0
- package/package.json +1 -1
package/dist/super-list.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Y, ref as
|
|
1
|
+
import { defineComponent as Y, ref as p, computed as O, createElementBlock as M, openBlock as T, normalizeClass as R, withKeys as b, createElementVNode as B, useTemplateRef as Ee, watch as A, Fragment as ce, createCommentVNode as $, renderList as Se, withModifiers as oe, createBlock as fe, toDisplayString as me, useCssVars as Ae, onMounted as Le, onUnmounted as Fe, renderSlot as xe, createVNode as Z, nextTick as Be, resolveDynamicComponent as Ne, withCtx as be } from "vue";
|
|
2
2
|
import './index.css';class He {
|
|
3
3
|
eventsTypes = ["resize", "load", "scroll", "wheel", "touchmove"];
|
|
4
4
|
config = {
|
|
@@ -109,7 +109,7 @@ const je = ["tabindex", "placeholder", "size"], $e = /* @__PURE__ */ Y({
|
|
|
109
109
|
"update:press": null
|
|
110
110
|
},
|
|
111
111
|
setup(e, { expose: i, emit: a }) {
|
|
112
|
-
const v = a, o = e, d =
|
|
112
|
+
const v = a, o = e, d = p(null);
|
|
113
113
|
function w(h) {
|
|
114
114
|
"sourceCapabilities" in h && h.sourceCapabilities == null ? o.parentMethods.closeList() : o.parentMethods.openList();
|
|
115
115
|
}
|
|
@@ -120,9 +120,9 @@ const je = ["tabindex", "placeholder", "size"], $e = /* @__PURE__ */ Y({
|
|
|
120
120
|
h?.target?.value != null && v("update:query", h.target.value);
|
|
121
121
|
}
|
|
122
122
|
const c = O(() => {
|
|
123
|
-
const h = d?.value ? d.value.length : 0,
|
|
124
|
-
return h > 0 ? h :
|
|
125
|
-
}),
|
|
123
|
+
const h = d?.value ? d.value.length : 0, y = o.placeholder?.length || 0;
|
|
124
|
+
return h > 0 ? h : y > 0 ? y : 5;
|
|
125
|
+
}), r = O(() => o.enableButtonClick === !0 && o.enableTextFilter === !0 ? "" : "click-through"), g = O(() => o.showDropDown && !o.enableTextFilter || !o.showDropDown ? "dark-placeholder-text" : "light-placeholder-text");
|
|
126
126
|
function k() {
|
|
127
127
|
if (d?.value) {
|
|
128
128
|
const h = d.value;
|
|
@@ -132,28 +132,28 @@ const je = ["tabindex", "placeholder", "size"], $e = /* @__PURE__ */ Y({
|
|
|
132
132
|
function I() {
|
|
133
133
|
d?.value && d.value.focus();
|
|
134
134
|
}
|
|
135
|
-
return i({ blurInput: k, focusInput: I, textInputRef: d }), (h,
|
|
135
|
+
return i({ blurInput: k, focusInput: I, textInputRef: d }), (h, y) => (T(), M("input", {
|
|
136
136
|
ref_key: "textInputRef",
|
|
137
137
|
ref: d,
|
|
138
138
|
tabindex: e.enableTextFilter ? 0 : -1,
|
|
139
139
|
onKeydown: [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
y[0] || (y[0] = b((m) => e.parentMethods.press(m), ["enter"])),
|
|
141
|
+
y[1] || (y[1] = b((m) => e.parentMethods.press(), ["space"])),
|
|
142
|
+
y[2] || (y[2] = b((m) => e.parentMethods.press(m), ["esc"])),
|
|
143
|
+
y[3] || (y[3] = b((m) => e.parentMethods.press(m), ["up"])),
|
|
144
|
+
y[4] || (y[4] = b((m) => e.parentMethods.press(m), ["down"]))
|
|
145
145
|
],
|
|
146
|
-
onFocusin:
|
|
147
|
-
onFocusout:
|
|
148
|
-
onInput:
|
|
146
|
+
onFocusin: y[5] || (y[5] = (m) => w(m)),
|
|
147
|
+
onFocusout: y[6] || (y[6] = (m) => t(m)),
|
|
148
|
+
onInput: y[7] || (y[7] = (m) => s(m)),
|
|
149
149
|
type: "text",
|
|
150
150
|
"aria-autocomplete": "none",
|
|
151
151
|
autocomplete: "off",
|
|
152
152
|
placeholder: e.placeholder,
|
|
153
153
|
size: c.value,
|
|
154
154
|
class: R([[
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
r.value,
|
|
156
|
+
g.value,
|
|
157
157
|
{ "text-filter-disabled": !e.enableTextFilter }
|
|
158
158
|
], "list-filter-text-input"])
|
|
159
159
|
}, null, 42, je));
|
|
@@ -171,8 +171,8 @@ const je = ["tabindex", "placeholder", "size"], $e = /* @__PURE__ */ Y({
|
|
|
171
171
|
viewBox: "0 -16 16 17"
|
|
172
172
|
};
|
|
173
173
|
function ze(e, i) {
|
|
174
|
-
return
|
|
175
|
-
|
|
174
|
+
return T(), M("svg", Ve, i[0] || (i[0] = [
|
|
175
|
+
B("path", {
|
|
176
176
|
"shape-rendering": "geometricPrecision",
|
|
177
177
|
d: "M 6 -2.25 L 13.75 -14 A 0.5 0.5 90 0 1 15 -13 L 6.5 -0.5 A 2 1 90 0 1 5.5 -0.5 L 1 -6 A 0.5 0.5 90 0 1 2.25 -7 Z"
|
|
178
178
|
}, null, -1)
|
|
@@ -220,13 +220,13 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
220
220
|
const t = (Array.isArray(a.value) ? a.value : [a.value])[i.focusedIndex];
|
|
221
221
|
return t && typeof t == "object" && "scrollIntoView" in t && typeof t.scrollIntoView == "function" ? t : null;
|
|
222
222
|
});
|
|
223
|
-
|
|
223
|
+
A(
|
|
224
224
|
() => i.showDropDown,
|
|
225
225
|
() => o()
|
|
226
|
-
),
|
|
226
|
+
), A(
|
|
227
227
|
() => i.listElementOpenAndVisible,
|
|
228
228
|
() => d()
|
|
229
|
-
),
|
|
229
|
+
), A(
|
|
230
230
|
() => v.value,
|
|
231
231
|
() => d()
|
|
232
232
|
);
|
|
@@ -239,23 +239,23 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
239
239
|
const s = w.offsetTop - t.scrollTop < 0, c = w.offsetTop + w.offsetHeight - t.scrollTop > t.clientHeight;
|
|
240
240
|
s && (t.scrollTop = w.offsetTop), c && (t.scrollTop = w.offsetTop + w.clientHeight - t.clientHeight);
|
|
241
241
|
}
|
|
242
|
-
return (w, t) => (
|
|
243
|
-
(
|
|
242
|
+
return (w, t) => (T(), M(ce, null, [
|
|
243
|
+
(T(!0), M(ce, null, Se(e.filteredListItems, (s, c) => (T(), M("li", {
|
|
244
244
|
key: c,
|
|
245
245
|
ref_for: !0,
|
|
246
246
|
ref: "items",
|
|
247
247
|
onKeyup: [
|
|
248
|
-
t[0] || (t[0] = b((
|
|
249
|
-
t[1] || (t[1] = b((
|
|
250
|
-
t[2] || (t[2] = b((
|
|
248
|
+
t[0] || (t[0] = b((r) => e.parentMethods.press(r), ["enter"])),
|
|
249
|
+
t[1] || (t[1] = b((r) => e.parentMethods.press(r), ["space"])),
|
|
250
|
+
t[2] || (t[2] = b((r) => e.parentMethods.press(r), ["esc"]))
|
|
251
251
|
],
|
|
252
252
|
onKeydown: [
|
|
253
|
-
t[3] || (t[3] = b((
|
|
254
|
-
t[4] || (t[4] = b((
|
|
253
|
+
t[3] || (t[3] = b((r) => e.parentMethods.press(r), ["up"])),
|
|
254
|
+
t[4] || (t[4] = b((r) => e.parentMethods.press(r), ["down"]))
|
|
255
255
|
],
|
|
256
|
-
onFocusout: t[5] || (t[5] = (
|
|
256
|
+
onFocusout: t[5] || (t[5] = (r) => e.parentMethods.unfocus(r)),
|
|
257
257
|
tabindex: "-1",
|
|
258
|
-
onMousedown: oe((
|
|
258
|
+
onMousedown: oe((r) => e.parentMethods.updatedSelected(s), ["left"]),
|
|
259
259
|
class: R([
|
|
260
260
|
{ "list-option-selected": e.selectedIndex === c },
|
|
261
261
|
{
|
|
@@ -264,14 +264,14 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
264
264
|
"list-option"
|
|
265
265
|
])
|
|
266
266
|
}, [
|
|
267
|
-
|
|
268
|
-
e.selectedIndex === c ? (
|
|
267
|
+
B("span", Je, me(e.parentMethods.getLabel(s)), 1),
|
|
268
|
+
e.selectedIndex === c ? (T(), fe(Xe, {
|
|
269
269
|
key: 0,
|
|
270
270
|
class: "list-item-icon",
|
|
271
271
|
"aria-hidden": "true"
|
|
272
272
|
})) : $("", !0)
|
|
273
273
|
], 42, Ue))), 128)),
|
|
274
|
-
e.filteredListItems.length === 0 ? (
|
|
274
|
+
e.filteredListItems.length === 0 ? (T(), M("li", {
|
|
275
275
|
key: 0,
|
|
276
276
|
onKeyup: [
|
|
277
277
|
t[6] || (t[6] = b((s) => e.parentMethods.press(s), ["enter"])),
|
|
@@ -287,9 +287,9 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
287
287
|
tabindex: "-1",
|
|
288
288
|
class: "list-option-message"
|
|
289
289
|
}, t[20] || (t[20] = [
|
|
290
|
-
|
|
290
|
+
B("span", { class: "list-item-span" }, "No Items To Display.", -1)
|
|
291
291
|
]), 32)) : $("", !0),
|
|
292
|
-
e.totalOptionsCount && e.totalOptionsCount > (e.filteredListItems?.length || 0) ? (
|
|
292
|
+
e.totalOptionsCount && e.totalOptionsCount > (e.filteredListItems?.length || 0) ? (T(), M("li", {
|
|
293
293
|
key: 1,
|
|
294
294
|
onKeyup: [
|
|
295
295
|
t[13] || (t[13] = b((s) => e.parentMethods.press(s), ["enter"])),
|
|
@@ -305,7 +305,7 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
305
305
|
tabindex: "-1",
|
|
306
306
|
class: "list-option-message"
|
|
307
307
|
}, [
|
|
308
|
-
|
|
308
|
+
B("span", We, " +" + me(e.totalOptionsCount - e.filteredListItems?.length || 0) + " More Items...", 1)
|
|
309
309
|
], 32)) : $("", !0)
|
|
310
310
|
], 64));
|
|
311
311
|
}
|
|
@@ -363,76 +363,76 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
363
363
|
},
|
|
364
364
|
emits: ["reverseDropDownList"],
|
|
365
365
|
setup(e, { expose: i, emit: a }) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
"
|
|
371
|
-
"
|
|
366
|
+
Ae((u) => ({
|
|
367
|
+
"220f507e": k.value,
|
|
368
|
+
"935a72a0": F.value,
|
|
369
|
+
"935a6b1e": se.value,
|
|
370
|
+
"4076fb5c": q.value,
|
|
371
|
+
"51ba7f6b": G.value
|
|
372
372
|
}));
|
|
373
|
-
const v = a, o = e, d =
|
|
374
|
-
|
|
373
|
+
const v = a, o = e, d = p(null), w = p(null), t = p(null), s = p(0), c = p(0), r = p(0), g = p(0), k = p("0px"), I = p(!1), h = p([]), y = p(0), m = O(() => !I.value || window?.innerHeight == null ? !1 : X() && le()), V = O(() => o.maxListHeightPX >= y.value);
|
|
374
|
+
A(
|
|
375
375
|
() => m.value,
|
|
376
|
-
(
|
|
376
|
+
(u) => v("reverseDropDownList", u),
|
|
377
377
|
{ immediate: !0 }
|
|
378
378
|
);
|
|
379
|
-
const
|
|
379
|
+
const F = O(() => s.value + "px"), se = O(() => g.value + "px");
|
|
380
380
|
i({ listContainerRef: t });
|
|
381
|
-
const P = (
|
|
382
|
-
|
|
383
|
-
}, ie = (
|
|
384
|
-
const L = t?.value, x =
|
|
381
|
+
const P = (u) => {
|
|
382
|
+
u?.key && u.key === " " && u.preventDefault();
|
|
383
|
+
}, ie = (u) => {
|
|
384
|
+
const L = t?.value, x = u.target;
|
|
385
385
|
(!(L && x && L.contains(x)) || L.isEqualNode(x)) && o.parentMethods.focusInput();
|
|
386
386
|
};
|
|
387
|
-
function
|
|
387
|
+
function N() {
|
|
388
388
|
return w?.value ? (w?.value).clientHeight : 0;
|
|
389
389
|
}
|
|
390
390
|
function E() {
|
|
391
|
-
if (!I.value ||
|
|
392
|
-
const
|
|
393
|
-
return o.maxListHeightPX && o.maxListHeightPX >
|
|
391
|
+
if (!I.value || N() === 0) return o.maxListHeightPX;
|
|
392
|
+
const u = N() === 0 ? o.maxListHeightPX : +N();
|
|
393
|
+
return o.maxListHeightPX && o.maxListHeightPX > u ? u : o.maxListHeightPX;
|
|
394
394
|
}
|
|
395
395
|
function X() {
|
|
396
396
|
return c.value > E();
|
|
397
397
|
}
|
|
398
398
|
function le() {
|
|
399
|
-
return
|
|
399
|
+
return r.value < E();
|
|
400
400
|
}
|
|
401
401
|
const G = O(() => (o.maxListHeightPX || 0) + "px"), q = O(() => (o.listAnimationDurationMs || 0) + "ms"), _ = O(() => o.blockListChange ? h.value : o.filteredListItems);
|
|
402
|
-
|
|
402
|
+
A(
|
|
403
403
|
() => _,
|
|
404
|
-
(
|
|
405
|
-
|
|
404
|
+
(u) => {
|
|
405
|
+
u && (h.value = u.value);
|
|
406
406
|
},
|
|
407
407
|
{ immediate: !1, deep: !0 }
|
|
408
408
|
);
|
|
409
409
|
let C = setTimeout(() => {
|
|
410
|
-
}, 0),
|
|
410
|
+
}, 0), S = null;
|
|
411
411
|
function j() {
|
|
412
|
-
|
|
412
|
+
y.value = N(), clearTimeout(C), S && S.observe(), I.value = !0, z(void 0);
|
|
413
413
|
}
|
|
414
414
|
function re() {
|
|
415
415
|
clearTimeout(C), C = setTimeout(() => {
|
|
416
|
-
o.showDropDown || (I.value = !1,
|
|
416
|
+
o.showDropDown || (I.value = !1, S && S.unobserve());
|
|
417
417
|
}, o.listAnimationDurationMs + 50);
|
|
418
418
|
}
|
|
419
|
-
|
|
419
|
+
A(
|
|
420
420
|
() => o.showDropDown,
|
|
421
|
-
(
|
|
422
|
-
|
|
421
|
+
(u, L) => {
|
|
422
|
+
u !== L && (U(), u ? j() : re());
|
|
423
423
|
},
|
|
424
424
|
{ immediate: !0 }
|
|
425
425
|
);
|
|
426
|
-
function z(
|
|
427
|
-
U(),
|
|
426
|
+
function z(u) {
|
|
427
|
+
U(), Be(() => U()), ee(u);
|
|
428
428
|
}
|
|
429
|
-
function ee(
|
|
430
|
-
if (!o.enableScrollClose || !o.showDropDown || typeof t?.value?.contains != "function" ||
|
|
431
|
-
const x = ["scroll", "wheel", "touchmove"].includes(
|
|
429
|
+
function ee(u) {
|
|
430
|
+
if (!o.enableScrollClose || !o.showDropDown || typeof t?.value?.contains != "function" || u?.target?.nodeType == null || te(u)) return;
|
|
431
|
+
const x = ["scroll", "wheel", "touchmove"].includes(u?.type);
|
|
432
432
|
o.showDropDown && x && o.parentMethods.closeList();
|
|
433
433
|
}
|
|
434
|
-
function te(
|
|
435
|
-
const L = !!d.value?.contains(
|
|
434
|
+
function te(u) {
|
|
435
|
+
const L = !!d.value?.contains(u?.target), x = !!t.value?.contains(u.target), Q = [u?.srcElement?.id, u?.target?.id].includes("super-list-select-list");
|
|
436
436
|
return L || x || Q;
|
|
437
437
|
}
|
|
438
438
|
function U() {
|
|
@@ -440,13 +440,13 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
440
440
|
}
|
|
441
441
|
function J() {
|
|
442
442
|
if (d?.value == null) return;
|
|
443
|
-
const
|
|
444
|
-
c.value =
|
|
443
|
+
const u = d.value.getBoundingClientRect();
|
|
444
|
+
c.value = u.top, r.value = window.innerHeight - u.bottom, k.value = u.width + "px";
|
|
445
445
|
}
|
|
446
446
|
function W() {
|
|
447
447
|
if (d?.value == null || t?.value == null) return;
|
|
448
|
-
const
|
|
449
|
-
m.value ?
|
|
448
|
+
const u = ne().getBoundingClientRect(), L = t.value.getBoundingClientRect(), x = g.value, Q = s.value;
|
|
449
|
+
m.value ? g.value = x - (u.top - L.bottom) : g.value = x - (L.top - u.bottom), s.value = Q - (L.left - u.left);
|
|
450
450
|
}
|
|
451
451
|
function ue() {
|
|
452
452
|
return (d?.value).getElementsByTagName("button")[0];
|
|
@@ -455,18 +455,18 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
455
455
|
return d?.value;
|
|
456
456
|
}
|
|
457
457
|
return Le(() => {
|
|
458
|
-
|
|
459
|
-
}),
|
|
460
|
-
|
|
461
|
-
}), (
|
|
462
|
-
|
|
458
|
+
S = new He(z, ue()), setTimeout(() => z(void 0), 250);
|
|
459
|
+
}), Fe(() => {
|
|
460
|
+
S?.unobserve();
|
|
461
|
+
}), (u, L) => (T(), M(ce, null, [
|
|
462
|
+
B("div", {
|
|
463
463
|
ref_key: "dropDownButtonContainer",
|
|
464
464
|
ref: d,
|
|
465
465
|
class: "super-list-button-container"
|
|
466
466
|
}, [
|
|
467
|
-
xe(
|
|
467
|
+
xe(u.$slots, "default", {}, void 0, !0)
|
|
468
468
|
], 512),
|
|
469
|
-
|
|
469
|
+
B("div", {
|
|
470
470
|
id: "super-list-select-list",
|
|
471
471
|
ref_key: "listContainerRef",
|
|
472
472
|
ref: t,
|
|
@@ -483,7 +483,7 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
483
483
|
onKeydown: L[1] || (L[1] = b((x) => P(x), ["space"])),
|
|
484
484
|
onMouseup: L[2] || (L[2] = oe((x) => ie(x), ["left"]))
|
|
485
485
|
}, [
|
|
486
|
-
|
|
486
|
+
B("ul", {
|
|
487
487
|
tabindex: "-1",
|
|
488
488
|
ref_key: "dropDownListUL",
|
|
489
489
|
ref: w,
|
|
@@ -503,7 +503,7 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
503
503
|
], 34)
|
|
504
504
|
], 64));
|
|
505
505
|
}
|
|
506
|
-
}),
|
|
506
|
+
}), ye = /* @__PURE__ */ K(Ye, [["__scopeId", "data-v-53c634fd"]]), Ge = {}, _e = {
|
|
507
507
|
xmlns: "http://www.w3.org/2000/svg",
|
|
508
508
|
fill: "currentColor",
|
|
509
509
|
"aria-hidden": "true",
|
|
@@ -511,14 +511,14 @@ const Xe = /* @__PURE__ */ K(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = {
|
|
|
511
511
|
viewBox: "0 0 12 6"
|
|
512
512
|
};
|
|
513
513
|
function et(e, i) {
|
|
514
|
-
return
|
|
515
|
-
|
|
514
|
+
return T(), M("svg", _e, i[0] || (i[0] = [
|
|
515
|
+
B("path", {
|
|
516
516
|
"shape-rendering": "geometricPrecision",
|
|
517
517
|
d: "M 6 4 L 10 0.25 A 0.5 0.5 90 0 1 11 1.25 L 6.5 5.75 A 15 3 90 0 1 5.5 5.75 L 1 1.25 A 0.5 0.5 90 0 1 2 0.25 Z"
|
|
518
518
|
}, null, -1)
|
|
519
519
|
]));
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const ge = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
522
522
|
key: 2,
|
|
523
523
|
class: "list-button-icon custom-icon"
|
|
524
524
|
}, ot = /* @__PURE__ */ Y({
|
|
@@ -547,7 +547,7 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
547
547
|
}
|
|
548
548
|
},
|
|
549
549
|
setup(e, { expose: i }) {
|
|
550
|
-
const a = e, v =
|
|
550
|
+
const a = e, v = p(null);
|
|
551
551
|
function o() {
|
|
552
552
|
a.enableTextFilter || a.parentMethods.openList();
|
|
553
553
|
}
|
|
@@ -563,43 +563,43 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
563
563
|
function s() {
|
|
564
564
|
v?.value && v.value.focus();
|
|
565
565
|
}
|
|
566
|
-
return i({ blurInput: t, focusInput: s, buttonRef: v }), (c,
|
|
566
|
+
return i({ blurInput: t, focusInput: s, buttonRef: v }), (c, r) => (T(), M("button", {
|
|
567
567
|
ref_key: "buttonRef",
|
|
568
568
|
ref: v,
|
|
569
569
|
tabindex: e.enableTextFilter ? -1 : 0,
|
|
570
570
|
onKeydown: [
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
571
|
+
r[0] || (r[0] = b((g) => d(g), ["enter"])),
|
|
572
|
+
r[1] || (r[1] = b((g) => w(g), ["space"])),
|
|
573
|
+
r[2] || (r[2] = b((g) => e.parentMethods.press(g), ["esc"])),
|
|
574
|
+
r[3] || (r[3] = b((g) => e.parentMethods.press(g), ["up"])),
|
|
575
|
+
r[4] || (r[4] = b((g) => e.parentMethods.press(g), ["down"]))
|
|
576
576
|
],
|
|
577
|
-
onFocusout:
|
|
578
|
-
onClick:
|
|
577
|
+
onFocusout: r[5] || (r[5] = (g) => e.parentMethods.unfocus(g)),
|
|
578
|
+
onClick: r[6] || (r[6] = (g) => o()),
|
|
579
579
|
type: "button",
|
|
580
580
|
class: R([[{ "click-through": a.enableTextFilter || a.showDropDown }], "list-button"])
|
|
581
581
|
}, [
|
|
582
582
|
xe(c.$slots, "default", {}, void 0, !0),
|
|
583
|
-
|
|
583
|
+
B("span", {
|
|
584
584
|
class: R(["list-button-icon-div", { "bigger-gap": a.showDropDown }])
|
|
585
585
|
}, [
|
|
586
|
-
e.customIcon ? $("", !0) : (
|
|
586
|
+
e.customIcon ? $("", !0) : (T(), M("span", {
|
|
587
587
|
key: 0,
|
|
588
588
|
class: R(["list-button-icon", [{ "rotate-180": !a.showDropDown }]])
|
|
589
589
|
}, [
|
|
590
|
-
Z(
|
|
590
|
+
Z(ge, { "aria-hidden": "true" })
|
|
591
591
|
], 2)),
|
|
592
|
-
e.customIcon ? $("", !0) : (
|
|
592
|
+
e.customIcon ? $("", !0) : (T(), M("span", {
|
|
593
593
|
key: 1,
|
|
594
594
|
class: R(["list-button-icon", [{ "rotate-180": a.showDropDown }]])
|
|
595
595
|
}, [
|
|
596
|
-
e.customIcon == null ? (
|
|
596
|
+
e.customIcon == null ? (T(), fe(ge, {
|
|
597
597
|
key: 0,
|
|
598
598
|
"aria-hidden": "true"
|
|
599
599
|
})) : $("", !0)
|
|
600
600
|
], 2)),
|
|
601
|
-
e.customIcon ? (
|
|
602
|
-
(
|
|
601
|
+
e.customIcon ? (T(), M("span", nt, [
|
|
602
|
+
(T(), fe(Ne(e.customIcon), { "aria-hidden": "true" }))
|
|
603
603
|
])) : $("", !0)
|
|
604
604
|
], 2)
|
|
605
605
|
], 42, tt));
|
|
@@ -653,22 +653,26 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
653
653
|
colour: {
|
|
654
654
|
type: String,
|
|
655
655
|
default: "black"
|
|
656
|
+
},
|
|
657
|
+
scrollTextInputToTopOnMobile: {
|
|
658
|
+
type: Boolean,
|
|
659
|
+
default: !0
|
|
656
660
|
}
|
|
657
661
|
},
|
|
658
662
|
emits: { "update:selected": null },
|
|
659
663
|
setup(e, { expose: i, emit: a }) {
|
|
660
|
-
const v = a, o = e, d =
|
|
661
|
-
|
|
662
|
-
() =>
|
|
663
|
-
(n,
|
|
664
|
-
n !==
|
|
664
|
+
const v = a, o = e, d = p([]), w = new qe(), t = p(0), s = O(() => o.forceTextFilterVisibilityTo != null ? o.forceTextFilterVisibilityTo : t.value > o.maxListOptions), c = p(!1), r = p(!1), g = p(!1), k = p(!0), I = p(!1), h = p(!1), y = p(ye), m = p(he), V = p(we), F = p("");
|
|
665
|
+
A(
|
|
666
|
+
() => F.value,
|
|
667
|
+
(n, l) => {
|
|
668
|
+
n !== l && typeof o.options == "function" && x(n);
|
|
665
669
|
}
|
|
666
670
|
);
|
|
667
671
|
const se = () => {
|
|
668
672
|
s.value && m?.value?.blurInput();
|
|
669
673
|
}, P = () => {
|
|
670
|
-
clearTimeout(W), se(),
|
|
671
|
-
}, ie = O(() => h?.value === !0 ? "Error loading data" : I?.value === !0 ? "Loading..." : E(o.selected)),
|
|
674
|
+
clearTimeout(W), se(), F.value = "", c.value = !1, k.value = !0;
|
|
675
|
+
}, ie = O(() => h?.value === !0 ? "Error loading data" : I?.value === !0 ? "Loading..." : E(o.selected)), N = (n) => {
|
|
672
676
|
n && v("update:selected", n), P();
|
|
673
677
|
}, E = (n) => Re(
|
|
674
678
|
n,
|
|
@@ -686,31 +690,31 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
686
690
|
throw I.value = !0, h.value = !0, new Error("Invalid objectLabelKeyName for provided Dropdown list value.");
|
|
687
691
|
}
|
|
688
692
|
Le(() => {
|
|
689
|
-
typeof o.options != "function" && !Array.isArray(o.options) ? X() :
|
|
693
|
+
typeof o.options != "function" && !Array.isArray(o.options) ? X() : u();
|
|
690
694
|
});
|
|
691
|
-
const q =
|
|
692
|
-
|
|
695
|
+
const q = p(!1), _ = p(0), C = p(0), S = p(0);
|
|
696
|
+
A(
|
|
693
697
|
() => C.value,
|
|
694
|
-
(n,
|
|
695
|
-
n !=
|
|
698
|
+
(n, l) => {
|
|
699
|
+
n != l && !r.value && (S.value = n);
|
|
696
700
|
},
|
|
697
701
|
{ immediate: !0 }
|
|
698
|
-
),
|
|
699
|
-
() =>
|
|
702
|
+
), A(
|
|
703
|
+
() => r.value,
|
|
700
704
|
(n) => {
|
|
701
|
-
n || (
|
|
705
|
+
n || (S.value = C.value);
|
|
702
706
|
},
|
|
703
707
|
{ immediate: !0 }
|
|
704
708
|
);
|
|
705
709
|
const j = O(() => {
|
|
706
710
|
if (typeof o.options == "function" && !Array.isArray(o.options)) return d.value;
|
|
707
|
-
const n =
|
|
708
|
-
return n === "" ?
|
|
711
|
+
const n = F.value, l = d.value;
|
|
712
|
+
return n === "" ? l : l.filter((f) => E(f).toLowerCase().includes(n.toLowerCase()));
|
|
709
713
|
});
|
|
710
|
-
|
|
714
|
+
A(
|
|
711
715
|
() => j.value,
|
|
712
|
-
(n,
|
|
713
|
-
JSON.stringify(n) !== JSON.stringify(
|
|
716
|
+
(n, l) => {
|
|
717
|
+
JSON.stringify(n) !== JSON.stringify(l) && z();
|
|
714
718
|
},
|
|
715
719
|
{ immediate: !1, deep: !0 }
|
|
716
720
|
);
|
|
@@ -722,71 +726,80 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
722
726
|
};
|
|
723
727
|
function ee() {
|
|
724
728
|
if (o.selected == null) return -1;
|
|
725
|
-
const n = d.value.map((
|
|
726
|
-
if (
|
|
727
|
-
const
|
|
728
|
-
for (let
|
|
729
|
-
const H = JSON.stringify(d.value[
|
|
730
|
-
if (H === de) return
|
|
729
|
+
const n = d.value.map((f) => E(f)), l = n.filter((f) => f === E(o.selected));
|
|
730
|
+
if (l.length > 1) {
|
|
731
|
+
const f = l.map((D) => n.indexOf(D));
|
|
732
|
+
for (let D = 0; D < f.length; D++) {
|
|
733
|
+
const H = JSON.stringify(d.value[f[D]]), de = JSON.stringify(o.selected);
|
|
734
|
+
if (H === de) return f[D];
|
|
731
735
|
}
|
|
732
736
|
return -1;
|
|
733
737
|
}
|
|
734
738
|
return n.indexOf(E(o.selected));
|
|
735
739
|
}
|
|
736
740
|
const te = () => {
|
|
737
|
-
I.value || (c.value || (
|
|
741
|
+
I.value || (c.value || (r.value = !1, z(), U(), c.value = !0), q.value = !1, k.value = !1);
|
|
738
742
|
}, U = () => {
|
|
739
|
-
const n = window?.innerWidth != null && window.innerWidth < 640,
|
|
740
|
-
(n ||
|
|
741
|
-
}, J =
|
|
743
|
+
const n = window?.innerWidth != null && window.innerWidth < 640, l = screen?.width != null && screen.width < 640, f = m.value.textInputRef;
|
|
744
|
+
(n || l) && s.value && (ue(), o.scrollTextInputToTopOnMobile && f?.scrollIntoView({ block: "start", inline: "center" }));
|
|
745
|
+
}, J = p(!0);
|
|
742
746
|
let W = setTimeout(() => {
|
|
743
747
|
}, 0);
|
|
744
748
|
function ue() {
|
|
745
|
-
m.value.textInputRef
|
|
746
|
-
|
|
747
|
-
|
|
749
|
+
const n = m.value.textInputRef;
|
|
750
|
+
if (!n) return;
|
|
751
|
+
J.value = !1;
|
|
752
|
+
let l = null;
|
|
753
|
+
const f = () => {
|
|
754
|
+
l && clearInterval(l), clearTimeout(W), setTimeout(() => {
|
|
755
|
+
J.value = !0;
|
|
756
|
+
}, 100);
|
|
757
|
+
};
|
|
758
|
+
W = setTimeout(f, 5e3), l = setInterval(() => {
|
|
759
|
+
(c.value === !1 || n?.scrollTop === 0 && document.readyState === "complete") && f();
|
|
760
|
+
}, 100);
|
|
748
761
|
}
|
|
749
762
|
const ne = () => {
|
|
750
763
|
s?.value == !0 ? m.value.focusInput() : V?.value?.focusInput && V?.value?.focusInput();
|
|
751
764
|
};
|
|
752
|
-
async function
|
|
753
|
-
typeof o.options == "function" ? await x(
|
|
765
|
+
async function u() {
|
|
766
|
+
typeof o.options == "function" ? await x(F.value ? F.value : void 0, !0) : (ve(o.options), t.value = d.value.length), L();
|
|
754
767
|
}
|
|
755
|
-
i({ initializeOptions:
|
|
768
|
+
i({ initializeOptions: u, getLabel: E });
|
|
756
769
|
function L() {
|
|
757
|
-
ee() == -1 && d.value && !!d.value[0] &&
|
|
770
|
+
ee() == -1 && d.value && !!d.value[0] && N(d.value[0]);
|
|
758
771
|
}
|
|
759
|
-
async function x(n,
|
|
760
|
-
I.value =
|
|
761
|
-
const
|
|
772
|
+
async function x(n, l = !0) {
|
|
773
|
+
I.value = l;
|
|
774
|
+
const f = async () => o.options(o.maxListOptions, n || ""), D = (H) => {
|
|
762
775
|
(!H || !("data" in H)) && X(), ve(H.data), Q(H?.data?.length ?? 0).then(() => {
|
|
763
776
|
I.value = !1;
|
|
764
777
|
});
|
|
765
778
|
};
|
|
766
|
-
await w.resetAndExecute(
|
|
779
|
+
await w.resetAndExecute(f, D);
|
|
767
780
|
}
|
|
768
781
|
async function Q(n) {
|
|
769
|
-
const
|
|
770
|
-
(!
|
|
782
|
+
const l = async () => o.options(1, ""), f = (D) => {
|
|
783
|
+
(!D || !("totalNum" in D)) && le(), t.value = D.totalNum ?? n;
|
|
771
784
|
};
|
|
772
|
-
await w.resetAndExecute(
|
|
785
|
+
await w.resetAndExecute(l, f);
|
|
773
786
|
}
|
|
774
787
|
const pe = () => m?.value?.textInputRef?.getElementsByTagName("li")[C.value] ?? null, Ie = (n) => {
|
|
775
|
-
c.value == !1 ? te() : n &&
|
|
776
|
-
},
|
|
777
|
-
const
|
|
778
|
-
(
|
|
779
|
-
},
|
|
780
|
-
j.value.length > 0 ? (
|
|
788
|
+
c.value == !1 ? te() : n && Te(n);
|
|
789
|
+
}, Te = (n) => {
|
|
790
|
+
const l = n.key || n.code;
|
|
791
|
+
(l === "Tab" || l === "Escape") && P(), l === "ArrowDown" && Oe(n), l === "ArrowUp" && Me(n), (l === "Enter" || l === " ") && De(), n.preventDefault(), n.stopPropagation();
|
|
792
|
+
}, De = () => {
|
|
793
|
+
j.value.length > 0 ? (r.value = !0, N(j.value[C.value])) : P();
|
|
781
794
|
}, Oe = (n) => {
|
|
782
795
|
k.value = !0, C.value < j.value.length - 1 && (n.preventDefault(), q.value = !1, C.value++, pe()?.focus());
|
|
783
796
|
}, Me = (n) => {
|
|
784
797
|
k.value = !0, C.value > 0 && (n.preventDefault(), q.value = !1, C.value--, pe()?.focus());
|
|
785
798
|
}, Ce = (n) => {
|
|
786
799
|
if (c?.value === !1) return;
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
if (!(H ||
|
|
800
|
+
F.value.length > 0 && (r.value = !0);
|
|
801
|
+
const l = y?.value?.listContainerRef, f = m?.value?.textInputRef, D = n?.relatedTarget && f?.isEqualNode(n?.relatedTarget), H = n?.relatedTarget && l && l.contains(n?.relatedTarget), de = n?.relatedTarget && l && l.isEqualNode(n?.relatedTarget);
|
|
802
|
+
if (!(H || D)) {
|
|
790
803
|
if (de) {
|
|
791
804
|
ne();
|
|
792
805
|
return;
|
|
@@ -799,9 +812,9 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
799
812
|
}
|
|
800
813
|
function ke(n) {
|
|
801
814
|
(!o.objectLabelKeyName || o.objectLabelKeyName.length === 0) && G();
|
|
802
|
-
const
|
|
803
|
-
for (let
|
|
804
|
-
(typeof n[
|
|
815
|
+
const l = o.objectLabelKeyName;
|
|
816
|
+
for (let f = 0; f < n.length; f++)
|
|
817
|
+
(typeof n[f] != "object" || !(l in n[f])) && G();
|
|
805
818
|
}
|
|
806
819
|
const ae = {
|
|
807
820
|
openList: te,
|
|
@@ -809,29 +822,29 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
809
822
|
press: Ie,
|
|
810
823
|
mouseOverList: re,
|
|
811
824
|
getLabel: E,
|
|
812
|
-
updatedSelected:
|
|
825
|
+
updatedSelected: N,
|
|
813
826
|
focusInput: ne,
|
|
814
827
|
closeList: P
|
|
815
828
|
};
|
|
816
|
-
return (n,
|
|
829
|
+
return (n, l) => (T(), M("div", {
|
|
817
830
|
style: { position: "relative" },
|
|
818
831
|
class: R(n.$attrs.class)
|
|
819
832
|
}, [
|
|
820
|
-
Z(
|
|
833
|
+
Z(ye, {
|
|
821
834
|
ref_key: "itemListRef",
|
|
822
|
-
ref:
|
|
835
|
+
ref: y,
|
|
823
836
|
"show-drop-down": c.value,
|
|
824
837
|
filteredListItems: j.value,
|
|
825
838
|
mouseHoveringOnList: q.value,
|
|
826
|
-
focusedIndex:
|
|
839
|
+
focusedIndex: S.value,
|
|
827
840
|
selectedIndex: _.value,
|
|
828
841
|
"max-list-height-p-x": e.maxListHeightPX,
|
|
829
842
|
"list-animation-duration-ms": e.listAnimationDurationMs,
|
|
830
843
|
"parent-methods": ae,
|
|
831
|
-
blockListChange:
|
|
832
|
-
"onUpdate:blockListChange":
|
|
844
|
+
blockListChange: r.value,
|
|
845
|
+
"onUpdate:blockListChange": l[1] || (l[1] = (f) => r.value = f),
|
|
833
846
|
"total-options-count": t.value,
|
|
834
|
-
onReverseDropDownList:
|
|
847
|
+
onReverseDropDownList: l[2] || (l[2] = (f) => g.value = f),
|
|
835
848
|
enableScrollClose: J.value,
|
|
836
849
|
"enable-text-filter": s.value
|
|
837
850
|
}, {
|
|
@@ -843,7 +856,7 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
843
856
|
"show-drop-down": c.value,
|
|
844
857
|
"enable-text-filter": s.value,
|
|
845
858
|
"custom-icon": e.customIcon,
|
|
846
|
-
"reverse-drop-down-list":
|
|
859
|
+
"reverse-drop-down-list": g.value
|
|
847
860
|
}, {
|
|
848
861
|
default: be(() => [
|
|
849
862
|
Z(he, {
|
|
@@ -854,7 +867,7 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
854
867
|
placeholder: ie.value,
|
|
855
868
|
"enable-button-click": k.value,
|
|
856
869
|
"parent-methods": ae,
|
|
857
|
-
"onUpdate:query":
|
|
870
|
+
"onUpdate:query": l[0] || (l[0] = (f) => F.value = f)
|
|
858
871
|
}, null, 8, ["enable-text-filter", "show-drop-down", "placeholder", "enable-button-click"])
|
|
859
872
|
]),
|
|
860
873
|
_: 1
|
|
@@ -864,7 +877,7 @@ const ye = /* @__PURE__ */ K(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
|
864
877
|
}, 8, ["show-drop-down", "filteredListItems", "mouseHoveringOnList", "focusedIndex", "selectedIndex", "max-list-height-p-x", "list-animation-duration-ms", "blockListChange", "total-options-count", "enableScrollClose", "enable-text-filter"])
|
|
865
878
|
], 2));
|
|
866
879
|
}
|
|
867
|
-
}), lt = /* @__PURE__ */ K(st, [["__scopeId", "data-v-
|
|
880
|
+
}), lt = /* @__PURE__ */ K(st, [["__scopeId", "data-v-9cbaf19a"]]);
|
|
868
881
|
export {
|
|
869
882
|
lt as default
|
|
870
883
|
};
|