@jblehm/super-list 1.0.11 → 1.0.14
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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
# superlist V1.0.
|
|
1
|
+
# superlist V1.0.13
|
|
2
2
|
An un-styled text searchable combobox for Vue.
|
|
@@ -56,6 +56,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
56
56
|
type: BooleanConstructor;
|
|
57
57
|
default: boolean;
|
|
58
58
|
};
|
|
59
|
+
enableTextFilter: {
|
|
60
|
+
type: PropType<boolean | null>;
|
|
61
|
+
required: true;
|
|
62
|
+
};
|
|
59
63
|
}>, {
|
|
60
64
|
listContainerRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
|
|
61
65
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -105,6 +109,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
105
109
|
type: BooleanConstructor;
|
|
106
110
|
default: boolean;
|
|
107
111
|
};
|
|
112
|
+
enableTextFilter: {
|
|
113
|
+
type: PropType<boolean | null>;
|
|
114
|
+
required: true;
|
|
115
|
+
};
|
|
108
116
|
}>> & Readonly<{
|
|
109
117
|
onReverseDropDownList?: ((...args: any[]) => any) | undefined;
|
|
110
118
|
}>, {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { type PropType } from 'vue';
|
|
2
|
+
declare function blurInput(): void;
|
|
3
|
+
declare function focusInput(): void;
|
|
2
4
|
declare function __VLS_template(): {
|
|
3
5
|
slots: {
|
|
4
6
|
default?(_: {}): any;
|
|
5
7
|
};
|
|
6
|
-
refs: {
|
|
8
|
+
refs: {
|
|
9
|
+
buttonRef: HTMLButtonElement;
|
|
10
|
+
};
|
|
7
11
|
attrs: Partial<{}>;
|
|
8
12
|
};
|
|
9
13
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
@@ -28,7 +32,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
28
32
|
type: BooleanConstructor;
|
|
29
33
|
required: true;
|
|
30
34
|
};
|
|
31
|
-
}>, {
|
|
35
|
+
}>, {
|
|
36
|
+
blurInput: typeof blurInput;
|
|
37
|
+
focusInput: typeof focusInput;
|
|
38
|
+
buttonRef: import("vue").Ref<null, null>;
|
|
39
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
40
|
parentMethods: {
|
|
33
41
|
type: ObjectConstructor;
|
|
34
42
|
required: true;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.list-filter-text-input[data-v-
|
|
1
|
+
.list-filter-text-input[data-v-93cf8991]{color:var(--superlist-text-colour, rgb(17, 24, 39));text-align:center;padding:.125rem 2rem .125rem .5rem!important;width:100%;height:100%;margin:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:transparent;border:0 none;pointer-events:auto;cursor:text;touch-action:none}.list-filter-text-input[data-v-93cf8991]:focus,.list-filter-text-input[data-v-93cf8991]:focus-visible,.list-filter-text-input[data-v-93cf8991]:active{text-align:left}.click-through[data-v-93cf8991]{pointer-events:none}.dark-placeholder-text[data-v-93cf8991]::placeholder{color:var(--superlist-text-colour, rgb(17, 24, 39))}.light-placeholder-text[data-v-93cf8991]::placeholder{color:var(--superlist-disabled-text-colour, rgb(120, 125, 130))}.text-filter-disabled[data-v-93cf8991]{background-color:transparent;border:none;outline:none;box-shadow:none;filter:none}@media (min-width: 640px){.list-filter-text-input[data-v-93cf8991]{font-size:.875rem;line-height:1.5rem}}.list-option[data-v-f1a723a6]{text-transform:capitalize;display:inline-flex;width:100%;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:transparent;color:var(--superlist-text-colour, rgb(55, 60, 65));transition-property:font-weight,background-color,color,text-shadow;transition-duration:.5s;transition-timing-function:ease;font-weight:400;text-shadow:1px 1px 3px var(--superlist-background-colour, white)}.list-option[data-v-f1a723a6]:focus-visible,.list-option>span[data-v-f1a723a6]:focus-visible{outline:none}.list-option-selected[data-v-f1a723a6]{font-weight:600}.list-option-message[data-v-f1a723a6]{text-shadow:1px 1px 3px var(--superlist-background-colour, white);text-transform:capitalize;display:inline-flex;width:100%;position:relative;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:transparent;color:var(--superlist-disabled-text-colour, rgb(120, 125, 130))}.list-option-active[data-v-f1a723a6]:hover,.list-option-active[data-v-f1a723a6],.list-option-selected[data-v-f1a723a6]:hover,.list-option[data-v-f1a723a6]:hover{font-weight:600;background-color:var(--superlist-theme-colour, rgb(77, 168, 11, .8));color:var(--superlist-background-colour, white);text-shadow:1px 1px 3px var(--superlist-theme-colour, rgb(77, 168, 11, .8));transition-duration:0s!important}.list-item-icon[data-v-f1a723a6]{display:flex;height:1rem;width:1rem;position:absolute;right:.7rem;margin-top:-.1rem;align-self:center}.list-item-span[data-v-f1a723a6]{padding:.5rem 1.75rem .5rem .75rem;width:100%;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.list-normal[data-v-84dc0bfc]{top:var(--parent-y)}.list-reverse[data-v-84dc0bfc]{bottom:var(--parent-y)}.select-list[data-v-84dc0bfc]{--parent-width: var(--3f25a304);--parent-x: var(--39d34c36);--parent-y: var(--39d34ff7);--duration: var(--0cc221d8);--border-radius: var(--superlist-list-border-radius, 0);border-radius:var(--border-radius);width:var(--parent-width);min-width:var(--parent-width);left:var(--parent-x);display:block;transition-property:max-height,opacity,visibility;transition-duration:var(--duration, .3s);transition-timing-function:cubic-bezier(.1,.9,.35,.98);position:absolute;backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);background-color:#ffffffb3;align-items:baseline;opacity:.25;z-index:999;visibility:collapse;overflow:auto;max-height:0;border:none!important}.select-list[data-v-84dc0bfc]:focus-visible,.select-list>ul[data-v-84dc0bfc]:focus-visible,.super-list-button-container[data-v-84dc0bfc]:focus-visible{outline:none}.super-list-button-container[data-v-84dc0bfc]{height:100%;width:100%}.select-list.select-list-open[data-v-84dc0bfc]{z-index:999999;--max-height: var(--faf36f1e);max-height:var(--max-height, 0)}.select-list.no-scroll[data-v-84dc0bfc]{overflow:hidden}.select-list-fixed[data-v-84dc0bfc]{position:fixed;opacity:1;visibility:visible}.list-content[data-v-84dc0bfc]{--duration: var(--0cc221d8);overflow:visible;margin:0;padding:0;border-style:none;color:var(--superlist-text-colour, rgb(55, 60, 65));list-style:none;max-width:100%}.select-list.select-list-scrollable[data-v-84dc0bfc]{border-radius:var(--border-radius)}@media (min-width: 640px){.select-list.select-list-scrollable[data-v-84dc0bfc]{border-radius:var(--border-radius) 0 0 var(--border-radius)}.list-content[data-v-84dc0bfc]{font-size:.875rem;line-height:1.25rem}}.list-button-icon[data-v-01ef8e37]{display:flex;transition-timing-function:ease-in-out;transition-duration:.2s;transition-property:transform;width:.6rem;transform:rotate(0);color:var(--superlist-text-colour, rgb(17, 24, 39));justify-content:center;max-height:18%}.list-button-icon.custom-icon[data-v-01ef8e37]{max-height:100%;width:1.25rem}.list-button-icon.rotate-180[data-v-01ef8e37]{transform:rotate(180deg)}.list-button[data-v-01ef8e37]{position:relative;padding:0;margin:0;width:100%;max-height:100%;height:100%;background-color:var(--superlist-background-colour, white);align-items:center;pointer-events:auto;cursor:pointer}.list-button[data-v-01ef8e37]:focus,.list-button[data-v-01ef8e37]:focus-visible,.list-button[data-v-01ef8e37]:active{text-align:left}.list-button-icon-div[data-v-01ef8e37]{pointer-events:none;position:absolute;top:0;bottom:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-right:.75rem;max-height:100%;height:100%;gap:max(.15rem,calc(6.25% + .075rem));transition:gap .2s}.list-button-icon-div.bigger-gap[data-v-01ef8e37]{gap:calc(40% - .25rem)}.click-through[data-v-01ef8e37]{pointer-events:none}[data-v-e1f079fa]{box-sizing:border-box}
|
package/dist/super-list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import './index.css';class
|
|
1
|
+
import { defineComponent as Z, ref as m, computed as O, openBlock as x, createElementBlock as M, withKeys as h, normalizeClass as R, createElementVNode as H, useTemplateRef as Ee, watch as F, Fragment as de, renderList as Se, withModifiers as te, toDisplayString as ve, createBlock as ce, createCommentVNode as K, useCssVars as Ae, onMounted as we, onUnmounted as Fe, renderSlot as Le, createVNode as Q, nextTick as He, resolveDynamicComponent as Ne, withCtx as me } from "vue";
|
|
2
|
+
import './index.css';class Be {
|
|
3
3
|
eventsTypes = ["resize", "load", "scroll", "wheel", "touchmove"];
|
|
4
4
|
config = {
|
|
5
5
|
attributes: !0,
|
|
@@ -8,12 +8,12 @@ import './index.css';class He {
|
|
|
8
8
|
};
|
|
9
9
|
mutationObserver;
|
|
10
10
|
callbackFunction;
|
|
11
|
-
constructor(
|
|
12
|
-
this.targetNode =
|
|
11
|
+
constructor(i, d = document.body) {
|
|
12
|
+
this.targetNode = d, this.callbackFunction = (g) => i(g), this.mutationObserver = new MutationObserver(() => i());
|
|
13
13
|
}
|
|
14
14
|
observe() {
|
|
15
15
|
this.mutationObserver.observe(this.targetNode, this.config);
|
|
16
|
-
for (const
|
|
16
|
+
for (const i of this.eventsTypes) this.addListener(i);
|
|
17
17
|
this.addResizeListener(), this.addTransitionEndListener();
|
|
18
18
|
}
|
|
19
19
|
pauseMutationObserver() {
|
|
@@ -24,14 +24,14 @@ import './index.css';class He {
|
|
|
24
24
|
}
|
|
25
25
|
unobserve() {
|
|
26
26
|
this.mutationObserver.disconnect();
|
|
27
|
-
for (const
|
|
27
|
+
for (const i of this.eventsTypes) this.removeListener(i);
|
|
28
28
|
this.removeResizeListener(), this.removeTransitionEndListener();
|
|
29
29
|
}
|
|
30
|
-
addListener(
|
|
31
|
-
document.addEventListener(
|
|
30
|
+
addListener(i) {
|
|
31
|
+
document.addEventListener(i, this.callbackFunction, !0);
|
|
32
32
|
}
|
|
33
|
-
removeListener(
|
|
34
|
-
document.removeEventListener(
|
|
33
|
+
removeListener(i) {
|
|
34
|
+
document.removeEventListener(i, this.callbackFunction, !0);
|
|
35
35
|
}
|
|
36
36
|
addTransitionEndListener() {
|
|
37
37
|
this.targetNode.addEventListener("transitionend", this.callbackFunction);
|
|
@@ -46,40 +46,40 @@ import './index.css';class He {
|
|
|
46
46
|
window.removeEventListener("resize", this.callbackFunction);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return e == null ? "" : typeof e == "object" ? e[
|
|
49
|
+
function Pe(e, i, d, g) {
|
|
50
|
+
return i != null ? i(e) : e == null ? "" : typeof e == "object" ? e[d] : g ? Re(e, g) : "" + e;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
52
|
+
function Re(e, i) {
|
|
53
|
+
return i.find((d) => d.type === e)?.label ?? "";
|
|
54
54
|
}
|
|
55
|
-
class
|
|
55
|
+
class qe {
|
|
56
56
|
constructor() {
|
|
57
57
|
this.abortController = new AbortController(), this.func = () => {
|
|
58
58
|
}, this.then = () => {
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
async abortablePromise(
|
|
62
|
-
const o = await
|
|
63
|
-
if (!
|
|
64
|
-
return
|
|
61
|
+
async abortablePromise(i, d, g) {
|
|
62
|
+
const o = await d();
|
|
63
|
+
if (!i.aborted)
|
|
64
|
+
return g(o);
|
|
65
65
|
}
|
|
66
|
-
setFunc(
|
|
67
|
-
this.func =
|
|
66
|
+
setFunc(i) {
|
|
67
|
+
this.func = i;
|
|
68
68
|
}
|
|
69
|
-
setThen(
|
|
70
|
-
this.then =
|
|
69
|
+
setThen(i) {
|
|
70
|
+
this.then = i;
|
|
71
71
|
}
|
|
72
72
|
execute() {
|
|
73
73
|
return this.abortablePromise(this.abortController.signal, this.func, this.then);
|
|
74
74
|
}
|
|
75
|
-
abort(
|
|
76
|
-
this.abortController.abort(
|
|
75
|
+
abort(i) {
|
|
76
|
+
this.abortController.abort(i || "Aborted By Controller."), this.abortController = new AbortController();
|
|
77
77
|
}
|
|
78
|
-
resetAndExecute(
|
|
79
|
-
return this.abort("New Request From Controller."), this.setFunc(
|
|
78
|
+
resetAndExecute(i, d) {
|
|
79
|
+
return this.abort("New Request From Controller."), this.setFunc(i), this.setThen(d), this.execute();
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const je = ["tabindex", "placeholder", "size"], $e = /* @__PURE__ */ Z({
|
|
83
83
|
__name: "ListTextInput",
|
|
84
84
|
props: {
|
|
85
85
|
enableTextFilter: {
|
|
@@ -108,75 +108,88 @@ const qe = ["tabindex", "placeholder", "size"], je = /* @__PURE__ */ Q({
|
|
|
108
108
|
"update:query": null,
|
|
109
109
|
"update:press": null
|
|
110
110
|
},
|
|
111
|
-
setup(e, { expose:
|
|
112
|
-
const
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
function t(
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
setup(e, { expose: i, emit: d }) {
|
|
112
|
+
const g = d, o = e, f = m(null);
|
|
113
|
+
function w() {
|
|
114
|
+
N();
|
|
115
|
+
}
|
|
116
|
+
function t(u) {
|
|
117
|
+
u.preventDefault(), u.stopPropagation(), u.stopImmediatePropagation();
|
|
118
|
+
}
|
|
119
|
+
function s(u) {
|
|
120
|
+
u.cancelable && u.preventDefault(), u.stopImmediatePropagation(), u.stopPropagation();
|
|
121
|
+
}
|
|
122
|
+
function v(u) {
|
|
123
|
+
u?.target && u.target === f.value || o.parentMethods.unfocus(u);
|
|
124
|
+
}
|
|
125
|
+
function l(u) {
|
|
126
|
+
u.target && u.target.value != null && g("update:query", u.target.value);
|
|
127
|
+
}
|
|
128
|
+
const y = O(() => {
|
|
129
|
+
const u = f?.value ? f.value.length : 0, c = o.placeholder?.length || 0;
|
|
130
|
+
return u > 0 ? u : c > 0 ? c : 5;
|
|
131
|
+
}), k = O(() => o.enableButtonClick === !0 && o.enableTextFilter === !0 ? "" : "click-through"), I = O(() => o.showDropDown && !o.enableTextFilter || !o.showDropDown ? "dark-placeholder-text" : "light-placeholder-text");
|
|
132
|
+
function E() {
|
|
133
|
+
if (f?.value) {
|
|
134
|
+
const u = f.value;
|
|
135
|
+
u.blur(), u.value = "";
|
|
127
136
|
}
|
|
128
137
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
138
|
+
function N() {
|
|
139
|
+
f?.value && f.value.focus();
|
|
131
140
|
}
|
|
132
|
-
return
|
|
141
|
+
return i({ blurInput: E, focusInput: N, textInputRef: f }), (u, c) => (x(), M("input", {
|
|
133
142
|
ref_key: "textInputRef",
|
|
134
|
-
ref:
|
|
143
|
+
ref: f,
|
|
135
144
|
tabindex: e.enableTextFilter ? 0 : -1,
|
|
136
145
|
onKeydown: [
|
|
137
|
-
c[0] || (c[0] =
|
|
138
|
-
c[1] || (c[1] =
|
|
139
|
-
c[2] || (c[2] =
|
|
140
|
-
c[3] || (c[3] =
|
|
141
|
-
c[4] || (c[4] =
|
|
146
|
+
c[0] || (c[0] = h((p) => e.parentMethods.press(p), ["enter"])),
|
|
147
|
+
c[1] || (c[1] = h((p) => e.parentMethods.press(), ["space"])),
|
|
148
|
+
c[2] || (c[2] = h((p) => e.parentMethods.press(p), ["esc"])),
|
|
149
|
+
c[3] || (c[3] = h((p) => e.parentMethods.press(p), ["up"])),
|
|
150
|
+
c[4] || (c[4] = h((p) => e.parentMethods.press(p), ["down"]))
|
|
142
151
|
],
|
|
143
|
-
onFocusin: c[5] || (c[5] = (
|
|
144
|
-
onFocusout: c[6] || (c[6] = (
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
onFocusin: c[5] || (c[5] = (p) => e.parentMethods.openList()),
|
|
153
|
+
onFocusout: c[6] || (c[6] = (p) => v(p)),
|
|
154
|
+
onMousedown: c[7] || (c[7] = (p) => e.parentMethods.openList()),
|
|
155
|
+
onMouseup: c[8] || (c[8] = (p) => s(p)),
|
|
156
|
+
onTouchstart: c[9] || (c[9] = (p) => w()),
|
|
157
|
+
onTouchend: c[10] || (c[10] = (p) => s(p)),
|
|
158
|
+
onTouchmove: c[11] || (c[11] = (p) => t(p)),
|
|
159
|
+
onInput: c[12] || (c[12] = (p) => l(p)),
|
|
147
160
|
type: "text",
|
|
148
161
|
"aria-autocomplete": "none",
|
|
149
162
|
autocomplete: "off",
|
|
150
163
|
placeholder: e.placeholder,
|
|
151
|
-
size:
|
|
152
|
-
class:
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
size: y.value,
|
|
165
|
+
class: R([[
|
|
166
|
+
k.value,
|
|
167
|
+
I.value,
|
|
155
168
|
{ "text-filter-disabled": !e.enableTextFilter }
|
|
156
169
|
], "list-filter-text-input"])
|
|
157
|
-
}, null, 42,
|
|
170
|
+
}, null, 42, je));
|
|
158
171
|
}
|
|
159
|
-
}),
|
|
160
|
-
const
|
|
161
|
-
for (const [
|
|
162
|
-
|
|
163
|
-
return
|
|
164
|
-
}, be = /* @__PURE__ */ $
|
|
172
|
+
}), V = (e, i) => {
|
|
173
|
+
const d = e.__vccOpts || e;
|
|
174
|
+
for (const [g, o] of i)
|
|
175
|
+
d[g] = o;
|
|
176
|
+
return d;
|
|
177
|
+
}, be = /* @__PURE__ */ V($e, [["__scopeId", "data-v-93cf8991"]]), Ke = {}, Ve = {
|
|
165
178
|
xmlns: "http://www.w3.org/2000/svg",
|
|
166
179
|
fill: "currentColor",
|
|
167
180
|
"aria-hidden": "true",
|
|
168
181
|
"data-slot": "icon",
|
|
169
182
|
viewBox: "0 -16 16 17"
|
|
170
183
|
};
|
|
171
|
-
function
|
|
172
|
-
return
|
|
173
|
-
|
|
184
|
+
function ze(e, i) {
|
|
185
|
+
return x(), M("svg", Ve, i[0] || (i[0] = [
|
|
186
|
+
H("path", {
|
|
174
187
|
"shape-rendering": "geometricPrecision",
|
|
175
188
|
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"
|
|
176
189
|
}, null, -1)
|
|
177
190
|
]));
|
|
178
191
|
}
|
|
179
|
-
const
|
|
192
|
+
const Xe = /* @__PURE__ */ V(Ke, [["render", ze]]), Ue = ["onMousedown"], Je = { class: "list-item-span" }, We = { class: "list-item-span" }, Qe = /* @__PURE__ */ Z({
|
|
180
193
|
__name: "ListItem",
|
|
181
194
|
props: {
|
|
182
195
|
mouseHoveringOnList: {
|
|
@@ -213,101 +226,101 @@ const ze = /* @__PURE__ */ $($e, [["render", Ve]]), Xe = ["onMousedown"], Ue = {
|
|
|
213
226
|
}
|
|
214
227
|
},
|
|
215
228
|
setup(e) {
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
218
|
-
const t = (Array.isArray(
|
|
229
|
+
const i = e, d = Ee("items"), g = O(() => {
|
|
230
|
+
if (!d?.value) return null;
|
|
231
|
+
const t = (Array.isArray(d.value) ? d.value : [d.value])[i.focusedIndex];
|
|
219
232
|
return t && typeof t == "object" && "scrollIntoView" in t && typeof t.scrollIntoView == "function" ? t : null;
|
|
220
233
|
});
|
|
221
234
|
F(
|
|
222
|
-
() =>
|
|
235
|
+
() => i.showDropDown,
|
|
223
236
|
() => o()
|
|
224
237
|
), F(
|
|
225
|
-
() =>
|
|
226
|
-
() =>
|
|
238
|
+
() => i.listElementOpenAndVisible,
|
|
239
|
+
() => f()
|
|
227
240
|
), F(
|
|
228
|
-
() =>
|
|
229
|
-
() =>
|
|
241
|
+
() => g.value,
|
|
242
|
+
() => f()
|
|
230
243
|
);
|
|
231
244
|
function o() {
|
|
232
|
-
!
|
|
245
|
+
!i.showDropDown || !g?.value?.parentElement?.parentElement || (g.value.parentElement.parentElement.scrollTop = g.value.offsetTop);
|
|
233
246
|
}
|
|
234
|
-
function
|
|
235
|
-
const
|
|
236
|
-
if (!
|
|
237
|
-
const
|
|
238
|
-
|
|
247
|
+
function f() {
|
|
248
|
+
const w = g.value, t = w?.parentElement?.parentElement;
|
|
249
|
+
if (!i.showDropDown || !w || !t) return;
|
|
250
|
+
const s = w.offsetTop - t.scrollTop < 0, v = w.offsetTop + w.offsetHeight - t.scrollTop > t.clientHeight;
|
|
251
|
+
s && (t.scrollTop = w.offsetTop), v && (t.scrollTop = w.offsetTop + w.clientHeight - t.clientHeight);
|
|
239
252
|
}
|
|
240
|
-
return (
|
|
241
|
-
(
|
|
242
|
-
key:
|
|
253
|
+
return (w, t) => (x(), M(de, null, [
|
|
254
|
+
(x(!0), M(de, null, Se(e.filteredListItems, (s, v) => (x(), M("li", {
|
|
255
|
+
key: v,
|
|
243
256
|
ref_for: !0,
|
|
244
257
|
ref: "items",
|
|
245
258
|
onKeyup: [
|
|
246
|
-
t[0] || (t[0] =
|
|
247
|
-
t[1] || (t[1] =
|
|
248
|
-
t[2] || (t[2] =
|
|
259
|
+
t[0] || (t[0] = h((l) => e.parentMethods.press(l), ["enter"])),
|
|
260
|
+
t[1] || (t[1] = h((l) => e.parentMethods.press(l), ["space"])),
|
|
261
|
+
t[2] || (t[2] = h((l) => e.parentMethods.press(l), ["esc"]))
|
|
249
262
|
],
|
|
250
263
|
onKeydown: [
|
|
251
|
-
t[3] || (t[3] =
|
|
252
|
-
t[4] || (t[4] =
|
|
264
|
+
t[3] || (t[3] = h((l) => e.parentMethods.press(l), ["up"])),
|
|
265
|
+
t[4] || (t[4] = h((l) => e.parentMethods.press(l), ["down"]))
|
|
253
266
|
],
|
|
254
|
-
onFocusout: t[5] || (t[5] = (
|
|
267
|
+
onFocusout: t[5] || (t[5] = (l) => e.parentMethods.unfocus(l)),
|
|
255
268
|
tabindex: "-1",
|
|
256
|
-
onMousedown: te((
|
|
257
|
-
class:
|
|
258
|
-
{ "list-option-selected": e.selectedIndex ===
|
|
269
|
+
onMousedown: te((l) => e.parentMethods.updatedSelected(s), ["left"]),
|
|
270
|
+
class: R([
|
|
271
|
+
{ "list-option-selected": e.selectedIndex === v },
|
|
259
272
|
{
|
|
260
|
-
"list-option-active": e.filteredListItems.length === 1 || e.focusedIndex ===
|
|
273
|
+
"list-option-active": e.filteredListItems.length === 1 || e.focusedIndex === v && !e.mouseHoveringOnList
|
|
261
274
|
},
|
|
262
275
|
"list-option"
|
|
263
276
|
])
|
|
264
277
|
}, [
|
|
265
|
-
|
|
266
|
-
e.selectedIndex ===
|
|
278
|
+
H("span", Je, ve(e.parentMethods.getLabel(s)), 1),
|
|
279
|
+
e.selectedIndex === v ? (x(), ce(Xe, {
|
|
267
280
|
key: 0,
|
|
268
281
|
class: "list-item-icon",
|
|
269
282
|
"aria-hidden": "true"
|
|
270
|
-
})) :
|
|
271
|
-
], 42,
|
|
272
|
-
e.filteredListItems.length === 0 ? (
|
|
283
|
+
})) : K("", !0)
|
|
284
|
+
], 42, Ue))), 128)),
|
|
285
|
+
e.filteredListItems.length === 0 ? (x(), M("li", {
|
|
273
286
|
key: 0,
|
|
274
287
|
onKeyup: [
|
|
275
|
-
t[6] || (t[6] =
|
|
276
|
-
t[7] || (t[7] =
|
|
277
|
-
t[8] || (t[8] =
|
|
288
|
+
t[6] || (t[6] = h((s) => e.parentMethods.press(s), ["enter"])),
|
|
289
|
+
t[7] || (t[7] = h((s) => e.parentMethods.press(s), ["space"])),
|
|
290
|
+
t[8] || (t[8] = h((s) => e.parentMethods.press(s), ["esc"]))
|
|
278
291
|
],
|
|
279
292
|
onKeydown: [
|
|
280
|
-
t[9] || (t[9] =
|
|
281
|
-
t[10] || (t[10] =
|
|
293
|
+
t[9] || (t[9] = h((s) => e.parentMethods.press(s), ["up"])),
|
|
294
|
+
t[10] || (t[10] = h((s) => e.parentMethods.press(s), ["down"]))
|
|
282
295
|
],
|
|
283
|
-
onFocusout: t[11] || (t[11] = (
|
|
284
|
-
onMousedown: t[12] || (t[12] = te((
|
|
296
|
+
onFocusout: t[11] || (t[11] = (s) => e.parentMethods.unfocus(s)),
|
|
297
|
+
onMousedown: t[12] || (t[12] = te((s) => e.parentMethods.closeList(s), ["left"])),
|
|
285
298
|
tabindex: "-1",
|
|
286
299
|
class: "list-option-message"
|
|
287
300
|
}, t[20] || (t[20] = [
|
|
288
|
-
|
|
289
|
-
]), 32)) :
|
|
290
|
-
e.totalOptionsCount && e.totalOptionsCount > (e.filteredListItems?.length || 0) ? (
|
|
301
|
+
H("span", { class: "list-item-span" }, "No Items To Display.", -1)
|
|
302
|
+
]), 32)) : K("", !0),
|
|
303
|
+
e.totalOptionsCount && e.totalOptionsCount > (e.filteredListItems?.length || 0) ? (x(), M("li", {
|
|
291
304
|
key: 1,
|
|
292
305
|
onKeyup: [
|
|
293
|
-
t[13] || (t[13] =
|
|
294
|
-
t[14] || (t[14] =
|
|
295
|
-
t[15] || (t[15] =
|
|
306
|
+
t[13] || (t[13] = h((s) => e.parentMethods.press(s), ["enter"])),
|
|
307
|
+
t[14] || (t[14] = h((s) => e.parentMethods.press(s), ["space"])),
|
|
308
|
+
t[15] || (t[15] = h((s) => e.parentMethods.press(s), ["esc"]))
|
|
296
309
|
],
|
|
297
310
|
onKeydown: [
|
|
298
|
-
t[16] || (t[16] =
|
|
299
|
-
t[17] || (t[17] =
|
|
311
|
+
t[16] || (t[16] = h((s) => e.parentMethods.press(s), ["up"])),
|
|
312
|
+
t[17] || (t[17] = h((s) => e.parentMethods.press(s), ["down"]))
|
|
300
313
|
],
|
|
301
|
-
onFocusout: t[18] || (t[18] = (
|
|
302
|
-
onMousedown: t[19] || (t[19] = te((
|
|
314
|
+
onFocusout: t[18] || (t[18] = (s) => e.parentMethods.unfocus(s)),
|
|
315
|
+
onMousedown: t[19] || (t[19] = te((s) => e.parentMethods.closeList(s), ["left"])),
|
|
303
316
|
tabindex: "-1",
|
|
304
317
|
class: "list-option-message"
|
|
305
318
|
}, [
|
|
306
|
-
|
|
307
|
-
], 32)) :
|
|
319
|
+
H("span", We, " +" + ve(e.totalOptionsCount - e.filteredListItems?.length || 0) + " More Items...", 1)
|
|
320
|
+
], 32)) : K("", !0)
|
|
308
321
|
], 64));
|
|
309
322
|
}
|
|
310
|
-
}),
|
|
323
|
+
}), Ze = /* @__PURE__ */ V(Qe, [["__scopeId", "data-v-f1a723a6"]]), Ye = /* @__PURE__ */ Z({
|
|
311
324
|
__name: "ItemList",
|
|
312
325
|
props: {
|
|
313
326
|
mouseHoveringOnList: {
|
|
@@ -353,137 +366,141 @@ const ze = /* @__PURE__ */ $($e, [["render", Ve]]), Xe = ["onMousedown"], Ue = {
|
|
|
353
366
|
enableScrollClose: {
|
|
354
367
|
type: Boolean,
|
|
355
368
|
default: !0
|
|
369
|
+
},
|
|
370
|
+
enableTextFilter: {
|
|
371
|
+
type: Boolean,
|
|
372
|
+
required: !0
|
|
356
373
|
}
|
|
357
374
|
},
|
|
358
375
|
emits: ["reverseDropDownList"],
|
|
359
|
-
setup(e, { expose:
|
|
360
|
-
Ae((
|
|
361
|
-
"
|
|
362
|
-
"
|
|
363
|
-
"
|
|
364
|
-
"
|
|
365
|
-
|
|
376
|
+
setup(e, { expose: i, emit: d }) {
|
|
377
|
+
Ae((a) => ({
|
|
378
|
+
"3f25a304": k.value,
|
|
379
|
+
"39d34c36": p.value,
|
|
380
|
+
"39d34ff7": ne.value,
|
|
381
|
+
"0cc221d8": j.value,
|
|
382
|
+
faf36f1e: Y.value
|
|
366
383
|
}));
|
|
367
|
-
const
|
|
384
|
+
const g = d, o = e, f = m(null), w = m(null), t = m(null), s = m(0), v = m(0), l = m(0), y = m(0), k = m("0px"), I = m(!1), E = m([]), N = m(0), u = O(() => !I.value || window?.innerHeight == null ? !1 : X() && se()), c = O(() => o.maxListHeightPX >= N.value);
|
|
368
385
|
F(
|
|
369
|
-
() =>
|
|
370
|
-
(
|
|
386
|
+
() => u.value,
|
|
387
|
+
(a) => g("reverseDropDownList", a),
|
|
371
388
|
{ immediate: !0 }
|
|
372
389
|
);
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
},
|
|
378
|
-
const
|
|
379
|
-
(!(
|
|
390
|
+
const p = O(() => s.value + "px"), ne = O(() => y.value + "px");
|
|
391
|
+
i({ listContainerRef: t });
|
|
392
|
+
const q = (a) => {
|
|
393
|
+
a?.key && a.key === " " && a.preventDefault();
|
|
394
|
+
}, oe = (a) => {
|
|
395
|
+
const L = t?.value, T = a.target;
|
|
396
|
+
(!(L && T && L.contains(T)) || L.isEqualNode(T)) && o.parentMethods.focusInput();
|
|
380
397
|
};
|
|
381
|
-
function
|
|
382
|
-
return
|
|
398
|
+
function B() {
|
|
399
|
+
return w?.value ? (w?.value).clientHeight : 0;
|
|
383
400
|
}
|
|
384
|
-
function
|
|
385
|
-
if (!o.showDropDown ||
|
|
386
|
-
const
|
|
387
|
-
return o.maxListHeightPX && o.maxListHeightPX >
|
|
401
|
+
function S() {
|
|
402
|
+
if (!o.showDropDown || B() === 0) return o.maxListHeightPX;
|
|
403
|
+
const a = B() === 0 ? o.maxListHeightPX : +B();
|
|
404
|
+
return o.maxListHeightPX && o.maxListHeightPX > a ? a : o.maxListHeightPX;
|
|
388
405
|
}
|
|
389
|
-
function
|
|
390
|
-
return
|
|
406
|
+
function X() {
|
|
407
|
+
return v.value > S();
|
|
391
408
|
}
|
|
392
409
|
function se() {
|
|
393
|
-
return
|
|
410
|
+
return l.value < S();
|
|
394
411
|
}
|
|
395
|
-
const Y =
|
|
412
|
+
const Y = O(() => (o.maxListHeightPX || 0) + "px"), j = O(() => (o.listAnimationDurationMs || 0) + "ms"), G = O(() => o.blockListChange ? E.value : o.filteredListItems);
|
|
396
413
|
F(
|
|
397
414
|
() => G,
|
|
398
|
-
(
|
|
399
|
-
|
|
415
|
+
(a) => {
|
|
416
|
+
a && (E.value = a.value);
|
|
400
417
|
},
|
|
401
418
|
{ immediate: !1, deep: !0 }
|
|
402
419
|
);
|
|
403
|
-
let
|
|
420
|
+
let C = setTimeout(() => {
|
|
404
421
|
}, 0), A = null;
|
|
405
|
-
function
|
|
406
|
-
|
|
422
|
+
function $() {
|
|
423
|
+
N.value = B(), clearTimeout(C), A && A.observe(), I.value = !0, z(void 0);
|
|
407
424
|
}
|
|
408
425
|
function ie() {
|
|
409
|
-
clearTimeout(
|
|
410
|
-
o.showDropDown || (
|
|
426
|
+
clearTimeout(C), C = setTimeout(() => {
|
|
427
|
+
o.showDropDown || (I.value = !1, A && A.unobserve());
|
|
411
428
|
}, o.listAnimationDurationMs + 50);
|
|
412
429
|
}
|
|
413
430
|
F(
|
|
414
431
|
() => o.showDropDown,
|
|
415
|
-
(
|
|
416
|
-
|
|
432
|
+
(a, L) => {
|
|
433
|
+
a !== L && (a ? $() : ie());
|
|
417
434
|
},
|
|
418
435
|
{ immediate: !0 }
|
|
419
436
|
);
|
|
420
|
-
function
|
|
421
|
-
|
|
437
|
+
function z(a) {
|
|
438
|
+
U(), He(() => U()), _(a);
|
|
422
439
|
}
|
|
423
|
-
function _(
|
|
424
|
-
if (!o.enableScrollClose || !
|
|
425
|
-
const
|
|
426
|
-
o.showDropDown &&
|
|
440
|
+
function _(a) {
|
|
441
|
+
if (!o.enableScrollClose || !a?.target || typeof t?.value?.contains != "function" || a?.target?.nodeType == null) return;
|
|
442
|
+
const L = ["scroll", "wheel", "touchmove"].includes(a?.type), T = !t.value.contains(a.target);
|
|
443
|
+
o.showDropDown && L && T && o.parentMethods.closeList();
|
|
427
444
|
}
|
|
428
|
-
function
|
|
429
|
-
le(),
|
|
445
|
+
function U() {
|
|
446
|
+
le(), J();
|
|
430
447
|
}
|
|
431
448
|
function le() {
|
|
432
|
-
if (
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
function U() {
|
|
437
|
-
if (r?.value == null || t?.value == null) return;
|
|
438
|
-
const u = re().getBoundingClientRect(), y = t.value.getBoundingClientRect(), x = N.value, ee = i.value;
|
|
439
|
-
C.value ? N.value = x - (u.top - y.bottom) : N.value = x - (y.top - u.bottom), i.value = ee - (y.left - u.left);
|
|
449
|
+
if (f?.value == null) return;
|
|
450
|
+
const a = f.value.getBoundingClientRect();
|
|
451
|
+
v.value = a.top, l.value = window.innerHeight - a.bottom, k.value = a.width + "px";
|
|
440
452
|
}
|
|
441
453
|
function J() {
|
|
442
|
-
|
|
454
|
+
if (f?.value == null || t?.value == null) return;
|
|
455
|
+
const a = re().getBoundingClientRect(), L = t.value.getBoundingClientRect(), T = y.value, ee = s.value;
|
|
456
|
+
u.value ? y.value = T - (a.top - L.bottom) : y.value = T - (L.top - a.bottom), s.value = ee - (L.left - a.left);
|
|
457
|
+
}
|
|
458
|
+
function W() {
|
|
459
|
+
return (f?.value).getElementsByTagName("button")[0];
|
|
443
460
|
}
|
|
444
461
|
function re() {
|
|
445
|
-
return
|
|
462
|
+
return f?.value;
|
|
446
463
|
}
|
|
447
|
-
return
|
|
448
|
-
A = new
|
|
464
|
+
return we(() => {
|
|
465
|
+
A = new Be(z, W()), setTimeout(() => z(void 0), 250);
|
|
449
466
|
}), Fe(() => {
|
|
450
467
|
A?.unobserve();
|
|
451
|
-
}), (
|
|
452
|
-
|
|
468
|
+
}), (a, L) => (x(), M(de, null, [
|
|
469
|
+
H("div", {
|
|
453
470
|
ref_key: "dropDownButtonContainer",
|
|
454
|
-
ref:
|
|
471
|
+
ref: f,
|
|
455
472
|
class: "super-list-button-container"
|
|
456
473
|
}, [
|
|
457
|
-
|
|
474
|
+
Le(a.$slots, "default", {}, void 0, !0)
|
|
458
475
|
], 512),
|
|
459
|
-
|
|
476
|
+
H("div", {
|
|
460
477
|
ref_key: "listContainerRef",
|
|
461
478
|
ref: t,
|
|
462
|
-
onMouseenter:
|
|
479
|
+
onMouseenter: L[0] || (L[0] = (T) => e.parentMethods.mouseOverList()),
|
|
463
480
|
tabindex: "-1",
|
|
464
|
-
class:
|
|
481
|
+
class: R([
|
|
465
482
|
"select-list",
|
|
466
|
-
|
|
483
|
+
u.value ? "list-reverse" : "list-normal",
|
|
467
484
|
{ "select-list-open": e.showDropDown },
|
|
468
|
-
{ "no-scroll":
|
|
469
|
-
{ "select-list-fixed":
|
|
470
|
-
{ "select-list-scrollable": !
|
|
485
|
+
{ "no-scroll": c.value && I.value },
|
|
486
|
+
{ "select-list-fixed": I.value },
|
|
487
|
+
{ "select-list-scrollable": !c.value }
|
|
471
488
|
]),
|
|
472
|
-
onKeydown:
|
|
473
|
-
onMouseup:
|
|
489
|
+
onKeydown: L[1] || (L[1] = h((T) => q(T), ["space"])),
|
|
490
|
+
onMouseup: L[2] || (L[2] = te((T) => oe(T), ["left"]))
|
|
474
491
|
}, [
|
|
475
|
-
|
|
492
|
+
H("ul", {
|
|
476
493
|
tabindex: "-1",
|
|
477
494
|
ref_key: "dropDownListUL",
|
|
478
|
-
ref:
|
|
495
|
+
ref: w,
|
|
479
496
|
class: "list-content"
|
|
480
497
|
}, [
|
|
481
|
-
|
|
482
|
-
filteredListItems:
|
|
498
|
+
Q(Ze, {
|
|
499
|
+
filteredListItems: E.value,
|
|
483
500
|
mouseHoveringOnList: e.mouseHoveringOnList,
|
|
484
501
|
focusedIndex: e.focusedIndex,
|
|
485
502
|
selectedIndex: e.selectedIndex,
|
|
486
|
-
listElementOpenAndVisible:
|
|
503
|
+
listElementOpenAndVisible: I.value,
|
|
487
504
|
"parent-methods": e.parentMethods,
|
|
488
505
|
"show-drop-down": e.showDropDown,
|
|
489
506
|
"total-options-count": e.totalOptionsCount
|
|
@@ -492,25 +509,25 @@ const ze = /* @__PURE__ */ $($e, [["render", Ve]]), Xe = ["onMousedown"], Ue = {
|
|
|
492
509
|
], 34)
|
|
493
510
|
], 64));
|
|
494
511
|
}
|
|
495
|
-
}),
|
|
512
|
+
}), ge = /* @__PURE__ */ V(Ye, [["__scopeId", "data-v-84dc0bfc"]]), Ge = {}, _e = {
|
|
496
513
|
xmlns: "http://www.w3.org/2000/svg",
|
|
497
514
|
fill: "currentColor",
|
|
498
515
|
"aria-hidden": "true",
|
|
499
516
|
"data-slot": "icon",
|
|
500
517
|
viewBox: "0 0 12 6"
|
|
501
518
|
};
|
|
502
|
-
function
|
|
503
|
-
return
|
|
504
|
-
|
|
519
|
+
function et(e, i) {
|
|
520
|
+
return x(), M("svg", _e, i[0] || (i[0] = [
|
|
521
|
+
H("path", {
|
|
505
522
|
"shape-rendering": "geometricPrecision",
|
|
506
523
|
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"
|
|
507
524
|
}, null, -1)
|
|
508
525
|
]));
|
|
509
526
|
}
|
|
510
|
-
const
|
|
527
|
+
const he = /* @__PURE__ */ V(Ge, [["render", et]]), tt = ["tabindex"], nt = {
|
|
511
528
|
key: 2,
|
|
512
529
|
class: "list-button-icon custom-icon"
|
|
513
|
-
},
|
|
530
|
+
}, ot = /* @__PURE__ */ Z({
|
|
514
531
|
__name: "ListButton",
|
|
515
532
|
props: {
|
|
516
533
|
// eslint-disable-line
|
|
@@ -535,57 +552,65 @@ const ge = /* @__PURE__ */ $(Ye, [["render", _e]]), et = ["tabindex"], tt = {
|
|
|
535
552
|
required: !0
|
|
536
553
|
}
|
|
537
554
|
},
|
|
538
|
-
setup(e) {
|
|
539
|
-
const
|
|
540
|
-
function
|
|
541
|
-
|
|
555
|
+
setup(e, { expose: i }) {
|
|
556
|
+
const d = e, g = m(null);
|
|
557
|
+
function o() {
|
|
558
|
+
d.enableTextFilter || d.parentMethods.openList();
|
|
559
|
+
}
|
|
560
|
+
function f(v) {
|
|
561
|
+
d.enableTextFilter ? (d.parentMethods.focusInput(), v.stopPropagation(), v.preventDefault()) : d.parentMethods.press(v);
|
|
542
562
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
563
|
+
function w(v) {
|
|
564
|
+
d.enableTextFilter || d.parentMethods.press(v);
|
|
545
565
|
}
|
|
546
|
-
function
|
|
547
|
-
|
|
566
|
+
function t() {
|
|
567
|
+
g?.value && g.value.blur();
|
|
548
568
|
}
|
|
549
|
-
|
|
569
|
+
function s() {
|
|
570
|
+
g?.value && g.value.focus();
|
|
571
|
+
}
|
|
572
|
+
return i({ blurInput: t, focusInput: s, buttonRef: g }), (v, l) => (x(), M("button", {
|
|
573
|
+
ref_key: "buttonRef",
|
|
574
|
+
ref: g,
|
|
550
575
|
tabindex: e.enableTextFilter ? -1 : 0,
|
|
551
576
|
onKeydown: [
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
577
|
+
l[0] || (l[0] = h((y) => f(y), ["enter"])),
|
|
578
|
+
l[1] || (l[1] = h((y) => w(y), ["space"])),
|
|
579
|
+
l[2] || (l[2] = h((y) => e.parentMethods.press(y), ["esc"])),
|
|
580
|
+
l[3] || (l[3] = h((y) => e.parentMethods.press(y), ["up"])),
|
|
581
|
+
l[4] || (l[4] = h((y) => e.parentMethods.press(y), ["down"]))
|
|
557
582
|
],
|
|
558
|
-
onFocusout:
|
|
559
|
-
onClick:
|
|
583
|
+
onFocusout: l[5] || (l[5] = (y) => e.parentMethods.unfocus(y)),
|
|
584
|
+
onClick: l[6] || (l[6] = (y) => o()),
|
|
560
585
|
type: "button",
|
|
561
|
-
class:
|
|
586
|
+
class: R([[{ "click-through": d.enableTextFilter || d.showDropDown }], "list-button"])
|
|
562
587
|
}, [
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
class:
|
|
588
|
+
Le(v.$slots, "default", {}, void 0, !0),
|
|
589
|
+
H("span", {
|
|
590
|
+
class: R(["list-button-icon-div", { "bigger-gap": d.showDropDown }])
|
|
566
591
|
}, [
|
|
567
|
-
e.customIcon ?
|
|
592
|
+
e.customIcon ? K("", !0) : (x(), M("span", {
|
|
568
593
|
key: 0,
|
|
569
|
-
class:
|
|
594
|
+
class: R(["list-button-icon", [{ "rotate-180": !d.showDropDown }]])
|
|
570
595
|
}, [
|
|
571
|
-
|
|
596
|
+
Q(he, { "aria-hidden": "true" })
|
|
572
597
|
], 2)),
|
|
573
|
-
e.customIcon ?
|
|
598
|
+
e.customIcon ? K("", !0) : (x(), M("span", {
|
|
574
599
|
key: 1,
|
|
575
|
-
class:
|
|
600
|
+
class: R(["list-button-icon", [{ "rotate-180": d.showDropDown }]])
|
|
576
601
|
}, [
|
|
577
|
-
e.customIcon == null ? (
|
|
602
|
+
e.customIcon == null ? (x(), ce(he, {
|
|
578
603
|
key: 0,
|
|
579
604
|
"aria-hidden": "true"
|
|
580
|
-
})) :
|
|
605
|
+
})) : K("", !0)
|
|
581
606
|
], 2)),
|
|
582
|
-
e.customIcon ? (
|
|
583
|
-
(
|
|
584
|
-
])) :
|
|
607
|
+
e.customIcon ? (x(), M("span", nt, [
|
|
608
|
+
(x(), ce(Ne(e.customIcon), { "aria-hidden": "true" }))
|
|
609
|
+
])) : K("", !0)
|
|
585
610
|
], 2)
|
|
586
|
-
], 42,
|
|
611
|
+
], 42, tt));
|
|
587
612
|
}
|
|
588
|
-
}),
|
|
613
|
+
}), ye = /* @__PURE__ */ V(ot, [["__scopeId", "data-v-01ef8e37"]]), st = /* @__PURE__ */ Z({
|
|
589
614
|
__name: "super-list",
|
|
590
615
|
props: {
|
|
591
616
|
selected: {
|
|
@@ -637,213 +662,215 @@ const ge = /* @__PURE__ */ $(Ye, [["render", _e]]), et = ["tabindex"], tt = {
|
|
|
637
662
|
}
|
|
638
663
|
},
|
|
639
664
|
emits: { "update:selected": null },
|
|
640
|
-
setup(e, { expose:
|
|
641
|
-
const
|
|
665
|
+
setup(e, { expose: i, emit: d }) {
|
|
666
|
+
const g = d, o = e, f = m([]), w = new qe(), t = m(0), s = O(() => o.forceTextFilterVisibilityTo != null ? o.forceTextFilterVisibilityTo : t.value > o.maxListOptions), v = m(!1), l = m(!1), y = m(!1), k = m(!0), I = m(!1), E = m(!1), N = m(ge), u = m(be), c = m(ye), p = m("");
|
|
642
667
|
F(
|
|
643
|
-
() =>
|
|
644
|
-
(n,
|
|
645
|
-
n !==
|
|
668
|
+
() => p.value,
|
|
669
|
+
(n, r) => {
|
|
670
|
+
n !== r && typeof o.options == "function" && ee(n);
|
|
646
671
|
}
|
|
647
672
|
);
|
|
648
673
|
const ne = () => {
|
|
649
|
-
|
|
650
|
-
},
|
|
651
|
-
clearTimeout(
|
|
652
|
-
}, oe =
|
|
653
|
-
n &&
|
|
654
|
-
},
|
|
674
|
+
s.value && u?.value?.blurInput();
|
|
675
|
+
}, q = () => {
|
|
676
|
+
clearTimeout(W), ne(), p.value = "", v.value = !1, k.value = !0;
|
|
677
|
+
}, oe = O(() => E?.value === !0 ? "Error loading data" : I?.value === !0 ? "Loading..." : S(o.selected)), B = (n) => {
|
|
678
|
+
n && g("update:selected", n), q();
|
|
679
|
+
}, S = (n) => Pe(
|
|
655
680
|
n,
|
|
656
|
-
|
|
681
|
+
o.customPlaceHolderFunction,
|
|
657
682
|
o.objectLabelKeyName,
|
|
658
683
|
o.enumKeyToLabelObjectArray
|
|
659
684
|
);
|
|
660
|
-
function
|
|
661
|
-
|
|
662
|
-
}
|
|
663
|
-
function z() {
|
|
664
|
-
throw d.value = !0, c.value = !0, new Error("Invalid options argument provided to ListInputComponent");
|
|
685
|
+
function X() {
|
|
686
|
+
throw I.value = !0, E.value = !0, new Error("Invalid options argument provided to ListInputComponent");
|
|
665
687
|
}
|
|
666
688
|
function se() {
|
|
667
|
-
throw
|
|
689
|
+
throw I.value = !0, E.value = !0, new Error("Invalid response provided to ListInputComponent, no total count key found");
|
|
668
690
|
}
|
|
669
691
|
function Y() {
|
|
670
|
-
throw
|
|
692
|
+
throw I.value = !0, E.value = !0, new Error("Invalid objectLabelKeyName for provided Dropdown list value.");
|
|
671
693
|
}
|
|
672
|
-
|
|
673
|
-
typeof o.options != "function" && !Array.isArray(o.options) ?
|
|
694
|
+
we(() => {
|
|
695
|
+
typeof o.options != "function" && !Array.isArray(o.options) ? X() : L();
|
|
674
696
|
});
|
|
675
|
-
const
|
|
697
|
+
const j = m(!1), G = m(0), C = m(0), A = m(0);
|
|
676
698
|
F(
|
|
677
|
-
() =>
|
|
678
|
-
(n,
|
|
679
|
-
n !=
|
|
699
|
+
() => C.value,
|
|
700
|
+
(n, r) => {
|
|
701
|
+
n != r && !l.value && (A.value = n);
|
|
680
702
|
},
|
|
681
703
|
{ immediate: !0 }
|
|
682
704
|
), F(
|
|
683
|
-
() =>
|
|
705
|
+
() => l.value,
|
|
684
706
|
(n) => {
|
|
685
|
-
n || (A.value =
|
|
707
|
+
n || (A.value = C.value);
|
|
686
708
|
},
|
|
687
709
|
{ immediate: !0 }
|
|
688
710
|
);
|
|
689
|
-
const
|
|
690
|
-
if (typeof o.options == "function" && !Array.isArray(o.options)) return
|
|
691
|
-
const n =
|
|
692
|
-
return n === "" ?
|
|
711
|
+
const $ = O(() => {
|
|
712
|
+
if (typeof o.options == "function" && !Array.isArray(o.options)) return f.value;
|
|
713
|
+
const n = p.value, r = f.value;
|
|
714
|
+
return n === "" ? r : r.filter((b) => S(b).toLowerCase().includes(n.toLowerCase()));
|
|
693
715
|
});
|
|
694
716
|
F(
|
|
695
|
-
() =>
|
|
696
|
-
(n,
|
|
697
|
-
JSON.stringify(n) !== JSON.stringify(
|
|
717
|
+
() => $.value,
|
|
718
|
+
(n, r) => {
|
|
719
|
+
JSON.stringify(n) !== JSON.stringify(r) && z();
|
|
698
720
|
},
|
|
699
721
|
{ immediate: !1, deep: !0 }
|
|
700
722
|
);
|
|
701
723
|
const ie = () => {
|
|
702
|
-
|
|
703
|
-
},
|
|
724
|
+
j.value = !0;
|
|
725
|
+
}, z = () => {
|
|
704
726
|
const n = _();
|
|
705
|
-
G.value = n,
|
|
727
|
+
G.value = n, C.value = n > -1 ? n : 0;
|
|
706
728
|
};
|
|
707
729
|
function _() {
|
|
708
730
|
if (o.selected == null) return -1;
|
|
709
|
-
const n =
|
|
710
|
-
if (
|
|
711
|
-
const
|
|
712
|
-
for (let
|
|
713
|
-
const
|
|
714
|
-
if (
|
|
731
|
+
const n = f.value.map((b) => S(b)), r = n.filter((b) => b === S(o.selected));
|
|
732
|
+
if (r.length > 1) {
|
|
733
|
+
const b = r.map((D) => n.indexOf(D));
|
|
734
|
+
for (let D = 0; D < b.length; D++) {
|
|
735
|
+
const P = JSON.stringify(f.value[b[D]]), ae = JSON.stringify(o.selected);
|
|
736
|
+
if (P === ae) return b[D];
|
|
715
737
|
}
|
|
716
738
|
return -1;
|
|
717
739
|
}
|
|
718
|
-
return n.indexOf(
|
|
740
|
+
return n.indexOf(S(o.selected));
|
|
719
741
|
}
|
|
720
|
-
const
|
|
721
|
-
|
|
742
|
+
const U = () => {
|
|
743
|
+
I.value || (v.value || (l.value = !1, z(), le(), v.value = !0), j.value = !1, k.value = !1);
|
|
722
744
|
}, le = () => {
|
|
723
|
-
const n = window
|
|
724
|
-
n &&
|
|
725
|
-
},
|
|
726
|
-
let
|
|
745
|
+
const n = window?.innerWidth != null && window.innerWidth < 640, r = screen?.width != null && screen.width < 640, b = u.value.textInputRef;
|
|
746
|
+
(n || r) && s.value && (re(), b?.scrollIntoView({ block: "start" }));
|
|
747
|
+
}, J = m(!0);
|
|
748
|
+
let W = setTimeout(() => {
|
|
727
749
|
}, 0);
|
|
728
750
|
function re() {
|
|
729
|
-
|
|
730
|
-
|
|
751
|
+
u.value.textInputRef && (clearTimeout(W), J.value = !1, W = setTimeout(() => {
|
|
752
|
+
J.value = !0;
|
|
731
753
|
}, 300));
|
|
732
754
|
}
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
755
|
+
const a = () => {
|
|
756
|
+
s?.value == !0 ? u.value.focusInput() : c?.value?.focusInput && c?.value?.focusInput();
|
|
757
|
+
};
|
|
758
|
+
async function L() {
|
|
759
|
+
typeof o.options == "function" ? await ee(p.value ? p.value : void 0, !0) : (pe(o.options), t.value = f.value.length), T();
|
|
760
|
+
}
|
|
761
|
+
i({ initializeOptions: L, getLabel: S });
|
|
762
|
+
function T() {
|
|
763
|
+
_() == -1 && f.value && !!f.value[0] && B(f.value[0]);
|
|
764
|
+
}
|
|
765
|
+
async function ee(n, r = !0) {
|
|
766
|
+
I.value = r;
|
|
767
|
+
const b = async () => o.options(o.maxListOptions, n || ""), D = (P) => {
|
|
768
|
+
(!P || !("data" in P)) && X(), pe(P.data), xe(P?.data?.length ?? 0).then(() => {
|
|
769
|
+
I.value = !1;
|
|
746
770
|
});
|
|
747
771
|
};
|
|
748
|
-
await
|
|
772
|
+
await w.resetAndExecute(b, D);
|
|
749
773
|
}
|
|
750
|
-
async function
|
|
751
|
-
const
|
|
752
|
-
(!
|
|
774
|
+
async function xe(n) {
|
|
775
|
+
const r = async () => o.options(1, ""), b = (D) => {
|
|
776
|
+
(!D || !("totalNum" in D)) && se(), t.value = D.totalNum ?? n;
|
|
753
777
|
};
|
|
754
|
-
await
|
|
778
|
+
await w.resetAndExecute(r, b);
|
|
755
779
|
}
|
|
756
|
-
const fe = () =>
|
|
757
|
-
|
|
758
|
-
}, Ie = (n) => {
|
|
759
|
-
const l = n.key || n.code;
|
|
760
|
-
(l === "Tab" || l === "Escape") && P(), l === "ArrowDown" && Te(n), l === "ArrowUp" && Oe(n), (l === "Enter" || l === " ") && De(), n.preventDefault(), n.stopPropagation();
|
|
761
|
-
}, De = () => {
|
|
762
|
-
q.value.length > 0 ? (p.value = !0, V(q.value[O.value])) : P();
|
|
780
|
+
const fe = () => u?.value?.textInputRef?.getElementsByTagName("li")[C.value] ?? null, Ie = (n) => {
|
|
781
|
+
v.value == !1 ? U() : n && Te(n);
|
|
763
782
|
}, Te = (n) => {
|
|
764
|
-
|
|
783
|
+
const r = n.key || n.code;
|
|
784
|
+
(r === "Tab" || r === "Escape") && q(), r === "ArrowDown" && Oe(n), r === "ArrowUp" && Me(n), (r === "Enter" || r === " ") && De(), n.preventDefault(), n.stopPropagation();
|
|
785
|
+
}, De = () => {
|
|
786
|
+
$.value.length > 0 ? (l.value = !0, B($.value[C.value])) : q();
|
|
765
787
|
}, Oe = (n) => {
|
|
766
|
-
k.value = !0,
|
|
788
|
+
k.value = !0, C.value < $.value.length - 1 && (n.preventDefault(), j.value = !1, C.value++, fe()?.focus());
|
|
767
789
|
}, Me = (n) => {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
790
|
+
k.value = !0, C.value > 0 && (n.preventDefault(), j.value = !1, C.value--, fe()?.focus());
|
|
791
|
+
}, Ce = (n) => {
|
|
792
|
+
if (v?.value === !1) return;
|
|
793
|
+
p.value.length > 0 && (l.value = !0);
|
|
794
|
+
const r = N?.value?.listContainerRef, b = u?.value?.textInputRef, D = n?.relatedTarget && b?.isEqualNode(n?.relatedTarget), P = n?.relatedTarget && r && r.contains(n?.relatedTarget), ae = n?.relatedTarget && r && r.isEqualNode(n?.relatedTarget);
|
|
795
|
+
if (!(P || D)) {
|
|
772
796
|
if (ae) {
|
|
773
|
-
|
|
797
|
+
a();
|
|
774
798
|
return;
|
|
775
799
|
}
|
|
776
|
-
|
|
800
|
+
q();
|
|
777
801
|
}
|
|
778
802
|
};
|
|
779
803
|
function pe(n) {
|
|
780
|
-
Array.isArray(n) ||
|
|
804
|
+
Array.isArray(n) || X(), n.length > 0 && typeof n[0] == "object" && ke(n), f.value = n;
|
|
781
805
|
}
|
|
782
|
-
function
|
|
806
|
+
function ke(n) {
|
|
783
807
|
(!o.objectLabelKeyName || o.objectLabelKeyName.length === 0) && Y();
|
|
784
|
-
const
|
|
785
|
-
for (let
|
|
786
|
-
(typeof n[
|
|
808
|
+
const r = o.objectLabelKeyName;
|
|
809
|
+
for (let b = 0; b < n.length; b++)
|
|
810
|
+
(typeof n[b] != "object" || !(r in n[b])) && Y();
|
|
787
811
|
}
|
|
788
812
|
const ue = {
|
|
789
|
-
openList:
|
|
790
|
-
unfocus:
|
|
791
|
-
press:
|
|
813
|
+
openList: U,
|
|
814
|
+
unfocus: Ce,
|
|
815
|
+
press: Ie,
|
|
792
816
|
mouseOverList: ie,
|
|
793
|
-
getLabel:
|
|
794
|
-
updatedSelected:
|
|
795
|
-
focusInput:
|
|
796
|
-
closeList:
|
|
817
|
+
getLabel: S,
|
|
818
|
+
updatedSelected: B,
|
|
819
|
+
focusInput: a,
|
|
820
|
+
closeList: q
|
|
797
821
|
};
|
|
798
|
-
return (n,
|
|
822
|
+
return (n, r) => (x(), M("div", {
|
|
799
823
|
style: { position: "relative" },
|
|
800
|
-
class:
|
|
824
|
+
class: R(n.$attrs.class)
|
|
801
825
|
}, [
|
|
802
|
-
|
|
826
|
+
Q(ge, {
|
|
803
827
|
ref_key: "itemListRef",
|
|
804
|
-
ref:
|
|
805
|
-
"show-drop-down":
|
|
806
|
-
filteredListItems:
|
|
807
|
-
mouseHoveringOnList:
|
|
828
|
+
ref: N,
|
|
829
|
+
"show-drop-down": v.value,
|
|
830
|
+
filteredListItems: $.value,
|
|
831
|
+
mouseHoveringOnList: j.value,
|
|
808
832
|
focusedIndex: A.value,
|
|
809
833
|
selectedIndex: G.value,
|
|
810
834
|
"max-list-height-p-x": e.maxListHeightPX,
|
|
811
835
|
"list-animation-duration-ms": e.listAnimationDurationMs,
|
|
812
836
|
"parent-methods": ue,
|
|
813
|
-
blockListChange:
|
|
814
|
-
"onUpdate:blockListChange":
|
|
837
|
+
blockListChange: l.value,
|
|
838
|
+
"onUpdate:blockListChange": r[1] || (r[1] = (b) => l.value = b),
|
|
815
839
|
"total-options-count": t.value,
|
|
816
|
-
onReverseDropDownList:
|
|
817
|
-
enableScrollClose:
|
|
840
|
+
onReverseDropDownList: r[2] || (r[2] = (b) => y.value = b),
|
|
841
|
+
enableScrollClose: J.value,
|
|
842
|
+
"enable-text-filter": s.value
|
|
818
843
|
}, {
|
|
819
844
|
default: me(() => [
|
|
820
|
-
|
|
845
|
+
Q(ye, {
|
|
846
|
+
ref_key: "dropDownButtonInput",
|
|
847
|
+
ref: c,
|
|
821
848
|
"parent-methods": ue,
|
|
822
|
-
"show-drop-down":
|
|
823
|
-
"enable-text-filter":
|
|
849
|
+
"show-drop-down": v.value,
|
|
850
|
+
"enable-text-filter": s.value,
|
|
824
851
|
"custom-icon": e.customIcon,
|
|
825
|
-
"reverse-drop-down-list":
|
|
852
|
+
"reverse-drop-down-list": y.value
|
|
826
853
|
}, {
|
|
827
854
|
default: me(() => [
|
|
828
|
-
|
|
855
|
+
Q(be, {
|
|
829
856
|
ref_key: "dropDownTextInput",
|
|
830
|
-
ref:
|
|
831
|
-
"enable-text-filter":
|
|
832
|
-
"show-drop-down":
|
|
857
|
+
ref: u,
|
|
858
|
+
"enable-text-filter": s.value,
|
|
859
|
+
"show-drop-down": v.value,
|
|
833
860
|
placeholder: oe.value,
|
|
834
861
|
"enable-button-click": k.value,
|
|
835
862
|
"parent-methods": ue,
|
|
836
|
-
"onUpdate:query":
|
|
863
|
+
"onUpdate:query": r[0] || (r[0] = (b) => p.value = b)
|
|
837
864
|
}, null, 8, ["enable-text-filter", "show-drop-down", "placeholder", "enable-button-click"])
|
|
838
865
|
]),
|
|
839
866
|
_: 1
|
|
840
867
|
}, 8, ["show-drop-down", "enable-text-filter", "custom-icon", "reverse-drop-down-list"])
|
|
841
868
|
]),
|
|
842
869
|
_: 1
|
|
843
|
-
}, 8, ["show-drop-down", "filteredListItems", "mouseHoveringOnList", "focusedIndex", "selectedIndex", "max-list-height-p-x", "list-animation-duration-ms", "blockListChange", "total-options-count", "enableScrollClose"])
|
|
870
|
+
}, 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"])
|
|
844
871
|
], 2));
|
|
845
872
|
}
|
|
846
|
-
}), lt = /* @__PURE__ */
|
|
873
|
+
}), lt = /* @__PURE__ */ V(st, [["__scopeId", "data-v-e1f079fa"]]);
|
|
847
874
|
export {
|
|
848
875
|
lt as default
|
|
849
876
|
};
|
package/dist/super-list.vue.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
51
51
|
};
|
|
52
52
|
}>, {
|
|
53
53
|
initializeOptions: typeof initializeOptions;
|
|
54
|
-
getLabel: (value?: string | number | object | null
|
|
54
|
+
getLabel: (value?: string | number | object | null) => string;
|
|
55
55
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
56
56
|
"update:selected": (...args: any[]) => void;
|
|
57
57
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jblehm/super-list",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/ListInputComponents",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"types": "vue-tsc",
|
|
29
29
|
"preview": "vite preview",
|
|
30
30
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
31
|
-
"format": "prettier --write src/"
|
|
31
|
+
"format": "prettier --write src/",
|
|
32
|
+
"serve": "vite serve --host"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"vue": "^3.5.10"
|