adverich-kun-ui 0.1.219 → 0.1.221
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.
|
@@ -197,7 +197,8 @@ const Ie = {
|
|
|
197
197
|
disabled: t(X)(l),
|
|
198
198
|
class: fe(Z(l)),
|
|
199
199
|
density: e.density,
|
|
200
|
-
id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name
|
|
200
|
+
id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name,
|
|
201
|
+
selectable: !0
|
|
201
202
|
}, {
|
|
202
203
|
default: i(() => [
|
|
203
204
|
a(E, { class: "text-wrap" }, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as g, ref as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as g, ref as w, useModel as D, provide as p, computed as B, createElementBlock as M, openBlock as S, mergeProps as I, withModifiers as E, renderSlot as L } from "vue";
|
|
2
|
+
const R = {
|
|
3
3
|
__name: "KunList",
|
|
4
4
|
props: /* @__PURE__ */ g({
|
|
5
5
|
nav: Boolean,
|
|
@@ -9,7 +9,7 @@ const K = ["selectable"], C = {
|
|
|
9
9
|
selectionMode: {
|
|
10
10
|
type: String,
|
|
11
11
|
default: "single",
|
|
12
|
-
validator: (
|
|
12
|
+
validator: (o) => ["single", "multiple"].includes(o)
|
|
13
13
|
},
|
|
14
14
|
bgList: {
|
|
15
15
|
type: String,
|
|
@@ -27,9 +27,9 @@ const K = ["selectable"], C = {
|
|
|
27
27
|
selectedModifiers: {}
|
|
28
28
|
}),
|
|
29
29
|
emits: /* @__PURE__ */ g(["keyDown", "click:select", "update:selected"], ["update:selected"]),
|
|
30
|
-
setup(
|
|
31
|
-
const u =
|
|
32
|
-
|
|
30
|
+
setup(o, { expose: b, emit: y }) {
|
|
31
|
+
const u = o, a = y, f = w(null), c = w([]), s = D(o, "selected");
|
|
32
|
+
p("registerListItemRef", (e) => {
|
|
33
33
|
e && !c.value.includes(e) && c.value.push(e);
|
|
34
34
|
});
|
|
35
35
|
const m = B(() => u.selectable && u.selectionMode === "multiple");
|
|
@@ -45,7 +45,7 @@ const K = ["selectable"], C = {
|
|
|
45
45
|
var t, n;
|
|
46
46
|
return !u.selectable || e == null ? !1 : m.value ? (n = (t = s.value) == null ? void 0 : t.includes) == null ? void 0 : n.call(t, e) : s.value === e;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
p("kunListContext", {
|
|
49
49
|
toggleItem: v,
|
|
50
50
|
isSelected: k
|
|
51
51
|
});
|
|
@@ -55,15 +55,15 @@ const K = ["selectable"], C = {
|
|
|
55
55
|
const t = e.key, n = c.value.filter(Boolean);
|
|
56
56
|
if (!(!n.length || !["ArrowUp", "ArrowDown", "Enter"].includes(t))) {
|
|
57
57
|
if (t === "Enter") {
|
|
58
|
-
const
|
|
59
|
-
(
|
|
58
|
+
const l = document.activeElement;
|
|
59
|
+
(l == null ? void 0 : l.getAttribute("role")) === "menuitem" && l.click();
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
63
63
|
e.preventDefault();
|
|
64
|
-
const
|
|
64
|
+
const l = n.findIndex((x) => x === document.activeElement);
|
|
65
65
|
let d = -1;
|
|
66
|
-
|
|
66
|
+
l === -1 ? d = t === "ArrowDown" ? 0 : n.length - 1 : t === "ArrowDown" ? d = (l + 1) % n.length : t === "ArrowUp" && (d = (l - 1 + n.length) % n.length);
|
|
67
67
|
const i = n[d];
|
|
68
68
|
(r = i == null ? void 0 : i.focus) == null || r.call(i);
|
|
69
69
|
return;
|
|
@@ -71,13 +71,13 @@ const K = ["selectable"], C = {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
function h(e = "ArrowDown") {
|
|
74
|
-
var
|
|
74
|
+
var l;
|
|
75
75
|
const t = c.value.filter(Boolean);
|
|
76
76
|
if (!t.length) return;
|
|
77
77
|
const n = e === "ArrowDown" ? 0 : t.length - 1, r = t[n];
|
|
78
|
-
(
|
|
78
|
+
(l = r == null ? void 0 : r.focus) == null || l.call(r);
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return b({ focusWithKey: h, focus: () => {
|
|
81
81
|
var e, t;
|
|
82
82
|
return (t = (e = f.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
|
|
83
83
|
} }), (e, t) => (S(), M("ul", I({
|
|
@@ -85,24 +85,23 @@ const K = ["selectable"], C = {
|
|
|
85
85
|
ref: f,
|
|
86
86
|
role: "list",
|
|
87
87
|
class: ["w-full kun-list", [
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
o.bgList,
|
|
89
|
+
o.borderColor,
|
|
90
90
|
{
|
|
91
|
-
"space-y-1": !
|
|
92
|
-
"space-y-0.5":
|
|
93
|
-
"pl-4 border-l-2":
|
|
94
|
-
"p-2 rounded-md":
|
|
91
|
+
"space-y-1": !o.dense,
|
|
92
|
+
"space-y-0.5": o.dense,
|
|
93
|
+
"pl-4 border-l-2": o.sub,
|
|
94
|
+
"p-2 rounded-md": o.nav
|
|
95
95
|
}
|
|
96
96
|
]],
|
|
97
97
|
tabindex: "-1",
|
|
98
98
|
onKeydown: E(A, ["prevent"]),
|
|
99
|
-
onSelect: t[0] || (t[0] = (n) => a("click:select", n.detail))
|
|
100
|
-
selectable: l.selectable
|
|
99
|
+
onSelect: t[0] || (t[0] = (n) => a("click:select", n.detail))
|
|
101
100
|
}, e.$attrs), [
|
|
102
101
|
L(e.$slots, "default")
|
|
103
|
-
], 16
|
|
102
|
+
], 16));
|
|
104
103
|
}
|
|
105
104
|
};
|
|
106
105
|
export {
|
|
107
|
-
|
|
106
|
+
R as default
|
|
108
107
|
};
|