vue-composable-ui 1.1.5 → 1.3.0
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/combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js +144 -0
- package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js +21 -0
- package/dist/composable-ui.js +27 -27
- package/dist/composable-ui11.js +1 -1
- package/dist/composable-ui12.js +1 -1
- package/dist/composable-ui13.js +1 -1
- package/dist/composable-ui15.js +1 -1
- package/dist/composable-ui18.js +1 -1
- package/dist/composable-ui2.js +1 -1
- package/dist/composable-ui20.js +17 -18
- package/dist/composable-ui22.js +117 -105
- package/dist/composable-ui23.js +71 -82
- package/dist/composable-ui24.js +7 -4
- package/dist/composable-ui6.js +1 -1
- package/dist/composable-ui9.js +1 -1
- package/dist/menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js +82 -0
- package/dist/{menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js → menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js} +10 -9
- package/dist/popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js +64 -0
- package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js +23 -0
- package/dist/tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js +42 -0
- package/dist/tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js +81 -0
- package/dist/types/components/combobox/combobox.vue.d.ts +9 -1
- package/dist/types/components/injectionKeys.d.ts +20 -2
- package/dist/types/components/menu/menu.vue.d.ts +2 -0
- package/dist/types/components/popover/popover.vue.d.ts +21 -7
- package/dist/types/components/tooltip.vue.d.ts +2 -2
- package/dist/types/composables/formControl.d.ts +3 -4
- package/dist/types/composables/list.d.ts +8 -4
- package/dist/types/composables/listOption.d.ts +3 -4
- package/dist/types/composables/popover.d.ts +19 -11
- package/dist/types/main.d.ts +2 -2
- package/dist/types/utils/element.d.ts +10 -3
- package/package.json +1 -1
- package/dist/combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js +0 -139
- package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js +0 -20
- package/dist/menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js +0 -82
- package/dist/popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js +0 -50
- package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js +0 -30
- package/dist/tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js +0 -40
- package/dist/tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js +0 -85
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { defineComponent as R, computed as o, useModel as T, useId as U, shallowRef as _, ref as q, watch as z, provide as G, openBlock as c, createElementBlock as p, Fragment as b, unref as k, renderList as J, createBlock as x, createCommentVNode as Q, renderSlot as W, mergeModels as X, nextTick as A } from "vue";
|
|
2
|
+
import { toElement as O } from "./composable-ui24.js";
|
|
3
|
+
import { usePopover as Y } from "./composable-ui23.js";
|
|
4
|
+
import { useList as Z } from "./composable-ui22.js";
|
|
5
|
+
import { _ as S } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-BtODyQnH.js";
|
|
6
|
+
import { injectCombobox as ee } from "./composable-ui19.js";
|
|
7
|
+
const ne = /* @__PURE__ */ R({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "combobox",
|
|
10
|
+
props: /* @__PURE__ */ X({
|
|
11
|
+
displayValue: { type: Function, default: (e) => Array.isArray(e) ? e.map((a) => a.toString()).join(", ") : e?.toString() },
|
|
12
|
+
id: {},
|
|
13
|
+
activator: {},
|
|
14
|
+
name: {},
|
|
15
|
+
formValue: { type: Function, default: (e) => e }
|
|
16
|
+
}, {
|
|
17
|
+
modelValue: {},
|
|
18
|
+
modelModifiers: {}
|
|
19
|
+
}),
|
|
20
|
+
emits: ["update:modelValue"],
|
|
21
|
+
setup(e) {
|
|
22
|
+
const a = e, I = o(() => i.value ? r.value.map((t) => a.formValue(t)) : a.formValue(r.value)), r = T(e, "modelValue"), w = a.id ?? U(), f = `${w}-popover`, m = _(
|
|
23
|
+
null
|
|
24
|
+
), y = q(null), C = o(() => a.activator ?? O(m)), { isOpen: l, toggle: D, open: n, close: s } = Y(C, y, {
|
|
25
|
+
direction: "down",
|
|
26
|
+
align: "stretch",
|
|
27
|
+
position: "fixed",
|
|
28
|
+
closeOnOutsideClick: !0,
|
|
29
|
+
closeOnInsideClick: !1
|
|
30
|
+
}), {
|
|
31
|
+
items: E,
|
|
32
|
+
activeItem: u,
|
|
33
|
+
selectedItem: $,
|
|
34
|
+
isMultiselectable: i,
|
|
35
|
+
selectActiveItem: d,
|
|
36
|
+
activateSelectedItem: F,
|
|
37
|
+
activateFirstItem: v,
|
|
38
|
+
activateLastItem: V,
|
|
39
|
+
activateNextItem: M,
|
|
40
|
+
activatePrevItem: B
|
|
41
|
+
} = Z(r), g = o(() => a.displayValue(r.value)), L = o(() => u.value?.element.value ?? null), j = o(
|
|
42
|
+
() => $.value?.element.value ?? null
|
|
43
|
+
);
|
|
44
|
+
z(E, () => {
|
|
45
|
+
!u.value && E.value.length && (F({ focus: !1 }), u.value || v({ focus: !1 }));
|
|
46
|
+
});
|
|
47
|
+
function H() {
|
|
48
|
+
O(m)?.focus();
|
|
49
|
+
}
|
|
50
|
+
function K(t) {
|
|
51
|
+
if (l.value)
|
|
52
|
+
switch (t.code) {
|
|
53
|
+
case "Space":
|
|
54
|
+
d(), i.value || s({ focus: !0 });
|
|
55
|
+
break;
|
|
56
|
+
case "Enter":
|
|
57
|
+
d(), s({ focus: !0 });
|
|
58
|
+
break;
|
|
59
|
+
case "Tab":
|
|
60
|
+
d(), s({ focus: !0 });
|
|
61
|
+
return;
|
|
62
|
+
case "ArrowUp":
|
|
63
|
+
B({ focus: !1, loop: !1 });
|
|
64
|
+
break;
|
|
65
|
+
case "ArrowDown":
|
|
66
|
+
M({ focus: !1, loop: !1 });
|
|
67
|
+
break;
|
|
68
|
+
case "Home":
|
|
69
|
+
v({ focus: !1 });
|
|
70
|
+
break;
|
|
71
|
+
case "End":
|
|
72
|
+
V({ focus: !1 });
|
|
73
|
+
break;
|
|
74
|
+
case "Escape":
|
|
75
|
+
s({ focus: !0 });
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
else
|
|
81
|
+
switch (t.code) {
|
|
82
|
+
case "Space":
|
|
83
|
+
case "Enter":
|
|
84
|
+
n({ focus: !1 });
|
|
85
|
+
break;
|
|
86
|
+
case "End":
|
|
87
|
+
case "ArrowUp":
|
|
88
|
+
n({ focus: !1 }), A(() => V({ focus: !1 }));
|
|
89
|
+
break;
|
|
90
|
+
case "Home":
|
|
91
|
+
case "ArrowDown":
|
|
92
|
+
n({ focus: !1 }), A(() => v({ focus: !1 }));
|
|
93
|
+
break;
|
|
94
|
+
default:
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
t.preventDefault();
|
|
98
|
+
}
|
|
99
|
+
const h = o(() => ({
|
|
100
|
+
ref: m,
|
|
101
|
+
id: w,
|
|
102
|
+
"aria-controls": l.value ? f : void 0,
|
|
103
|
+
"aria-expanded": l.value,
|
|
104
|
+
"aria-activedescendant": u.value?.element.value?.id,
|
|
105
|
+
"aria-haspopup": "listbox",
|
|
106
|
+
role: "combobox"
|
|
107
|
+
}));
|
|
108
|
+
return G(ee, {
|
|
109
|
+
displayValue: g,
|
|
110
|
+
popoverId: f,
|
|
111
|
+
popoverRef: y,
|
|
112
|
+
activeItemEl: L,
|
|
113
|
+
selectedItemEl: j,
|
|
114
|
+
isOpen: l,
|
|
115
|
+
open: n,
|
|
116
|
+
close: s,
|
|
117
|
+
focus: H,
|
|
118
|
+
isMultiselectable: i,
|
|
119
|
+
activatorAttrs: h,
|
|
120
|
+
activatorOnKeyDown: K
|
|
121
|
+
}), (t, ae) => (c(), p(b, null, [
|
|
122
|
+
e.name ? (c(), p(b, { key: 0 }, [
|
|
123
|
+
k(i) ? (c(!0), p(b, { key: 0 }, J(I.value, (N, P) => (c(), x(S, {
|
|
124
|
+
name: `${e.name}[${P}]`,
|
|
125
|
+
value: N
|
|
126
|
+
}, null, 8, ["name", "value"]))), 256)) : (c(), x(S, {
|
|
127
|
+
key: 1,
|
|
128
|
+
name: e.name,
|
|
129
|
+
value: I.value
|
|
130
|
+
}, null, 8, ["name", "value"]))
|
|
131
|
+
], 64)) : Q("", !0),
|
|
132
|
+
W(t.$slots, "default", {
|
|
133
|
+
popoverId: f,
|
|
134
|
+
isOpen: k(l),
|
|
135
|
+
toggle: () => k(D)(),
|
|
136
|
+
displayValue: g.value,
|
|
137
|
+
attrs: h.value
|
|
138
|
+
})
|
|
139
|
+
], 64));
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export {
|
|
143
|
+
ne as _
|
|
144
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent as r, inject as n, unref as e, openBlock as i, createElementBlock as c, renderSlot as p, createCommentVNode as m } from "vue";
|
|
2
|
+
import { injectCombobox as s } from "./composable-ui19.js";
|
|
3
|
+
const d = ["id"], f = /* @__PURE__ */ r({
|
|
4
|
+
__name: "comboboxOptions",
|
|
5
|
+
setup(b) {
|
|
6
|
+
const o = n(s);
|
|
7
|
+
if (!o)
|
|
8
|
+
throw new Error("Combobox injectable context is not provided");
|
|
9
|
+
return (t, l) => e(o).isOpen.value ? (i(), c("div", {
|
|
10
|
+
key: 0,
|
|
11
|
+
ref: e(o).popoverRef,
|
|
12
|
+
id: e(o).popoverId,
|
|
13
|
+
role: "listbox"
|
|
14
|
+
}, [
|
|
15
|
+
p(t.$slots, "default")
|
|
16
|
+
], 8, d)) : m("", !0);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
f as _
|
|
21
|
+
};
|
package/dist/composable-ui.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { usePopover as e } from "./composable-ui23.js";
|
|
2
2
|
import { useList as p } from "./composable-ui22.js";
|
|
3
|
-
import { useListOption as
|
|
3
|
+
import { useListOption as x } from "./composable-ui21.js";
|
|
4
4
|
import { useFormControl as a } from "./composable-ui20.js";
|
|
5
|
-
import {
|
|
5
|
+
import { toElement as n } from "./composable-ui24.js";
|
|
6
6
|
import { useValidation as b } from "./composable-ui25.js";
|
|
7
|
-
import { injectCombobox as u, injectMenu as C, injectPopover as
|
|
8
|
-
import { _ as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { _ as
|
|
7
|
+
import { injectCombobox as u, injectMenu as C, injectPopover as l, injectTabs as T } from "./composable-ui19.js";
|
|
8
|
+
import { _ as P } from "./listbox.vue_vue_type_script_setup_true_lang-OvzuliPQ.js";
|
|
9
|
+
import { _ as j } from "./listboxOption.vue_vue_type_script_setup_true_lang-BhQm7GxW.js";
|
|
10
|
+
import { _ as M } from "./tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js";
|
|
11
11
|
import { _ as I } from "./tabList.vue_vue_type_script_setup_true_lang-BjKRcoyi.js";
|
|
12
12
|
import { _ as g } from "./tab.vue_vue_type_script_setup_true_lang-C12uJKqo.js";
|
|
13
13
|
import { _ as E } from "./tabPanel.vue_vue_type_script_setup_true_lang-DwEwu3p7.js";
|
|
14
|
-
import { _ as
|
|
15
|
-
import { _ as
|
|
16
|
-
import { _ as
|
|
17
|
-
import { _ as
|
|
18
|
-
import { _ as
|
|
19
|
-
import { _ as
|
|
20
|
-
import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-
|
|
14
|
+
import { _ as V } from "./popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js";
|
|
15
|
+
import { _ as k } from "./popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js";
|
|
16
|
+
import { _ as w } from "./tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js";
|
|
17
|
+
import { _ as z } from "./menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js";
|
|
18
|
+
import { _ as B } from "./menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js";
|
|
19
|
+
import { _ as H } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
|
|
20
|
+
import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js";
|
|
21
21
|
import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-BTDqx7mj.js";
|
|
22
|
-
import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-
|
|
22
|
+
import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js";
|
|
23
23
|
import { _ as W } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DmF_EaqI.js";
|
|
24
24
|
export {
|
|
25
25
|
K as Combobox,
|
|
26
26
|
Q as ComboboxInput,
|
|
27
27
|
W as ComboboxOption,
|
|
28
28
|
S as ComboboxOptions,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
P as Listbox,
|
|
30
|
+
j as ListboxOption,
|
|
31
|
+
z as Menu,
|
|
32
|
+
H as MenuItem,
|
|
33
|
+
B as MenuItems,
|
|
34
|
+
V as Popover,
|
|
35
|
+
k as PopoverDialog,
|
|
36
36
|
g as Tab,
|
|
37
|
-
|
|
37
|
+
M as TabContainer,
|
|
38
38
|
I as TabList,
|
|
39
39
|
E as TabPanel,
|
|
40
|
-
|
|
40
|
+
w as Tooltip,
|
|
41
41
|
u as injectCombobox,
|
|
42
42
|
C as injectMenu,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
l as injectPopover,
|
|
44
|
+
T as injectTabs,
|
|
45
|
+
n as toElement,
|
|
45
46
|
a as useFormControl,
|
|
46
|
-
n as useHTMLElement,
|
|
47
47
|
p as useList,
|
|
48
|
-
|
|
48
|
+
x as useListOption,
|
|
49
49
|
e as usePopover,
|
|
50
50
|
b as useValidation
|
|
51
51
|
};
|
package/dist/composable-ui11.js
CHANGED
package/dist/composable-ui12.js
CHANGED
package/dist/composable-ui13.js
CHANGED
package/dist/composable-ui15.js
CHANGED
package/dist/composable-ui18.js
CHANGED
package/dist/composable-ui2.js
CHANGED
package/dist/composable-ui20.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const a = t(!1), n = t(!0), l = t(), r = t("");
|
|
1
|
+
import { ref as n, onMounted as p, onBeforeUnmount as b, readonly as m, unref as g } from "vue";
|
|
2
|
+
function M(y, h = [], w = !0) {
|
|
3
|
+
const o = n(!1), t = n(!0), l = n(), r = n("");
|
|
5
4
|
let e, u;
|
|
6
5
|
function s() {
|
|
7
6
|
e?.focus();
|
|
8
7
|
}
|
|
9
8
|
function d() {
|
|
10
|
-
|
|
9
|
+
t.value = e.validity.valid, l.value = e.validity, r.value = e.validationMessage;
|
|
11
10
|
}
|
|
12
11
|
function f() {
|
|
13
12
|
if (!e) throw new Error("Form element is undefined");
|
|
14
|
-
const
|
|
15
|
-
for (const
|
|
16
|
-
const c =
|
|
13
|
+
const a = e.value;
|
|
14
|
+
for (const V of g(h)) {
|
|
15
|
+
const c = V(a);
|
|
17
16
|
if (c !== !0) {
|
|
18
17
|
e.setCustomValidity(c);
|
|
19
18
|
break;
|
|
@@ -22,34 +21,34 @@ function k(y, h = [], w = !0) {
|
|
|
22
21
|
}
|
|
23
22
|
function v() {
|
|
24
23
|
if (!e) throw new Error("Form element is undefined");
|
|
25
|
-
return e.setCustomValidity(""), e.validity.valid && f(), d(),
|
|
24
|
+
return e.setCustomValidity(""), e.validity.valid && f(), d(), t.value;
|
|
26
25
|
}
|
|
27
|
-
function C(
|
|
28
|
-
d(), g(w) ||
|
|
26
|
+
function C(a) {
|
|
27
|
+
d(), g(w) || a.preventDefault();
|
|
29
28
|
}
|
|
30
29
|
function E() {
|
|
31
|
-
v(),
|
|
30
|
+
v(), o.value = u !== e.value;
|
|
32
31
|
}
|
|
33
32
|
let i = new AbortController();
|
|
34
|
-
return
|
|
35
|
-
if (e =
|
|
33
|
+
return p(() => {
|
|
34
|
+
if (e = y.value, !e) throw new Error("Form element is undefined");
|
|
36
35
|
f(), u = e.value, e.addEventListener("change", E, {
|
|
37
36
|
signal: i.signal,
|
|
38
37
|
passive: !0
|
|
39
38
|
}), e.addEventListener("invalid", C, {
|
|
40
39
|
signal: i.signal
|
|
41
40
|
}), e?.autofocus && s();
|
|
42
|
-
}),
|
|
41
|
+
}), b(() => {
|
|
43
42
|
i.abort();
|
|
44
43
|
}), {
|
|
45
44
|
focus: s,
|
|
46
45
|
validate: v,
|
|
47
|
-
isValid:
|
|
46
|
+
isValid: t,
|
|
48
47
|
validity: m(l),
|
|
49
48
|
validationMessage: m(r),
|
|
50
|
-
isChanged:
|
|
49
|
+
isChanged: o
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
export {
|
|
54
|
-
|
|
53
|
+
M as useFormControl
|
|
55
54
|
};
|
package/dist/composable-ui22.js
CHANGED
|
@@ -1,144 +1,156 @@
|
|
|
1
|
-
import { shallowRef as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
return typeof n == "object" ? typeof l == "object" ? JSON.stringify(n) === JSON.stringify(l) : !1 : n === l;
|
|
1
|
+
import { shallowRef as F, ref as J, computed as d, provide as T, readonly as b, shallowReadonly as q, triggerRef as E, unref as f } from "vue";
|
|
2
|
+
import { toElement as C } from "./composable-ui24.js";
|
|
3
|
+
const G = /* @__PURE__ */ Symbol();
|
|
4
|
+
function w(u, s) {
|
|
5
|
+
return !!(u.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
7
6
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
function h(u, s) {
|
|
8
|
+
const [t, i] = [f(u), f(s)];
|
|
9
|
+
return typeof t == "object" ? typeof i == "object" ? JSON.stringify(t) === JSON.stringify(i) : !1 : t === i;
|
|
10
|
+
}
|
|
11
|
+
function W(u) {
|
|
12
|
+
let s = 0;
|
|
13
|
+
const t = F([]), i = J(), m = d(() => Array.isArray(u.value));
|
|
14
|
+
function c(e) {
|
|
15
|
+
const n = t.value.find((l) => l.id === e);
|
|
16
|
+
if (!n) throw new Error(`Item not found: (${e})`);
|
|
17
|
+
return n;
|
|
15
18
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
19
|
+
function L(e) {
|
|
20
|
+
const n = e.element.value;
|
|
21
|
+
if (n)
|
|
22
|
+
return n.focus(), n;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
24
|
+
function o(e, { focus: n = !1 } = {}) {
|
|
25
|
+
i.value = e?.id ?? void 0, e !== void 0 && n && L(e);
|
|
23
26
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
+
function A(e, { focus: n = !1 } = {}) {
|
|
28
|
+
const l = c(e);
|
|
29
|
+
return o(l, { focus: n });
|
|
27
30
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
31
|
+
function x(e) {
|
|
32
|
+
return i.value === e;
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
function _(e, n, l = !1) {
|
|
35
|
+
const r = s++, a = {
|
|
36
|
+
id: r,
|
|
37
|
+
value: n,
|
|
38
|
+
// Derived rather than captured: the ref is re-read on every access, so
|
|
39
|
+
// an option that remounts — a filtered list re-rendering, say — is
|
|
40
|
+
// still the element the list focuses and reads its id from, and one
|
|
41
|
+
// registered through a component resolves to that component's root.
|
|
42
|
+
element: d(() => C(e)),
|
|
43
|
+
disabled: l
|
|
44
|
+
}, g = a.element.value, S = t.value[t.value.length - 1]?.element.value;
|
|
45
|
+
let v = t.value.length;
|
|
46
|
+
return g && S && !w(S, g) && (v = t.value.findIndex((D) => {
|
|
47
|
+
const N = D.element.value;
|
|
48
|
+
return !!N && w(g, N);
|
|
49
|
+
}), v === -1 && (v = t.value.length)), t.value.splice(v, 0, a), E(t), r;
|
|
39
50
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
51
|
+
function j(e) {
|
|
52
|
+
x(e) && o();
|
|
53
|
+
const n = c(e), l = t.value.indexOf(n);
|
|
54
|
+
t.value.splice(l, 1), E(t);
|
|
44
55
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
(
|
|
56
|
+
function p(e) {
|
|
57
|
+
const n = c(e);
|
|
58
|
+
if (f(n.disabled)) return;
|
|
59
|
+
const l = f(n.value);
|
|
60
|
+
if (l !== void 0) {
|
|
61
|
+
if (f(m)) {
|
|
62
|
+
const r = u.value.findIndex(
|
|
63
|
+
(a) => h(l, a)
|
|
53
64
|
);
|
|
54
|
-
|
|
65
|
+
r > -1 ? u.value.splice(r, 1) : u.value = [...u.value, l];
|
|
55
66
|
} else
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
u.value = l;
|
|
68
|
+
o(n);
|
|
58
69
|
}
|
|
59
70
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
62
|
-
(
|
|
63
|
-
) :
|
|
71
|
+
function I(e) {
|
|
72
|
+
return f(m) ? !!u.value.find(
|
|
73
|
+
(n) => h(e.value, n)
|
|
74
|
+
) : h(u, e.value);
|
|
64
75
|
}
|
|
65
|
-
function
|
|
76
|
+
function M(e) {
|
|
66
77
|
try {
|
|
67
|
-
const
|
|
68
|
-
return
|
|
78
|
+
const n = c(e);
|
|
79
|
+
return I(n);
|
|
69
80
|
} catch {
|
|
70
81
|
return !1;
|
|
71
82
|
}
|
|
72
83
|
}
|
|
73
|
-
function
|
|
74
|
-
for (let
|
|
75
|
-
if (
|
|
76
|
-
return
|
|
84
|
+
function P({ focus: e = !1 } = {}) {
|
|
85
|
+
for (let n of t.value)
|
|
86
|
+
if (I(n))
|
|
87
|
+
return o(n, { focus: e });
|
|
77
88
|
}
|
|
78
|
-
function
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
89
|
+
function y({ focus: e = !1 } = {}) {
|
|
90
|
+
if (t.value.length)
|
|
91
|
+
return o(t.value[0], { focus: e });
|
|
81
92
|
}
|
|
82
|
-
function
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
93
|
+
function O({ focus: e = !1 } = {}) {
|
|
94
|
+
if (t.value.length)
|
|
95
|
+
return o(t.value[t.value.length - 1], { focus: e });
|
|
85
96
|
}
|
|
86
|
-
function
|
|
97
|
+
function R({
|
|
87
98
|
focus: e = !1,
|
|
88
|
-
loop:
|
|
99
|
+
loop: n = !1
|
|
89
100
|
} = {}) {
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
else if (
|
|
96
|
-
|
|
101
|
+
if (i.value === void 0) return y({ focus: e });
|
|
102
|
+
const l = c(i.value), r = t.value.indexOf(l);
|
|
103
|
+
let a;
|
|
104
|
+
if (r + 1 < t.value.length)
|
|
105
|
+
a = t.value[r + 1];
|
|
106
|
+
else if (n)
|
|
107
|
+
a = t.value[0];
|
|
97
108
|
else
|
|
98
109
|
return;
|
|
99
|
-
return
|
|
110
|
+
return o(a, { focus: e });
|
|
100
111
|
}
|
|
101
|
-
function
|
|
112
|
+
function B({
|
|
102
113
|
focus: e = !1,
|
|
103
|
-
loop:
|
|
114
|
+
loop: n = !1
|
|
104
115
|
} = {}) {
|
|
105
|
-
if (
|
|
106
|
-
const
|
|
107
|
-
let
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
else if (
|
|
111
|
-
|
|
116
|
+
if (i.value === void 0) return O({ focus: e });
|
|
117
|
+
const l = c(i.value), r = t.value.indexOf(l);
|
|
118
|
+
let a;
|
|
119
|
+
if (r - 1 > -1)
|
|
120
|
+
a = t.value[r - 1];
|
|
121
|
+
else if (n)
|
|
122
|
+
a = t.value[t.value.length - 1];
|
|
112
123
|
else
|
|
113
124
|
return;
|
|
114
|
-
return
|
|
125
|
+
return o(a, { focus: e });
|
|
115
126
|
}
|
|
116
|
-
return
|
|
117
|
-
value:
|
|
118
|
-
selectItem:
|
|
119
|
-
activateItem:
|
|
120
|
-
deactivateItem: () =>
|
|
121
|
-
isSelected:
|
|
122
|
-
isActive:
|
|
123
|
-
addItem:
|
|
124
|
-
removeItem:
|
|
127
|
+
return T(G, {
|
|
128
|
+
value: b(u),
|
|
129
|
+
selectItem: p,
|
|
130
|
+
activateItem: A,
|
|
131
|
+
deactivateItem: () => o(),
|
|
132
|
+
isSelected: M,
|
|
133
|
+
isActive: x,
|
|
134
|
+
addItem: _,
|
|
135
|
+
removeItem: j
|
|
125
136
|
}), {
|
|
126
|
-
items:
|
|
127
|
-
isMultiselectable:
|
|
128
|
-
activeItem:
|
|
129
|
-
() =>
|
|
137
|
+
items: q(t),
|
|
138
|
+
isMultiselectable: b(m),
|
|
139
|
+
activeItem: d(
|
|
140
|
+
() => i.value !== void 0 ? c(i.value) : void 0
|
|
130
141
|
),
|
|
142
|
+
selectedItem: d(() => t.value.find(I)),
|
|
131
143
|
selectActiveItem: () => {
|
|
132
|
-
|
|
144
|
+
i.value !== void 0 && p(i.value);
|
|
133
145
|
},
|
|
134
|
-
activateSelectedItem:
|
|
135
|
-
activateFirstItem:
|
|
136
|
-
activateLastItem:
|
|
137
|
-
activateNextItem:
|
|
138
|
-
activatePrevItem:
|
|
146
|
+
activateSelectedItem: P,
|
|
147
|
+
activateFirstItem: y,
|
|
148
|
+
activateLastItem: O,
|
|
149
|
+
activateNextItem: R,
|
|
150
|
+
activatePrevItem: B
|
|
139
151
|
};
|
|
140
152
|
}
|
|
141
153
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
154
|
+
G as injectList,
|
|
155
|
+
W as useList
|
|
144
156
|
};
|