adverich-kun-ui 0.1.213 → 0.1.215
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as g, ref as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as g, ref as b, useModel as D, provide as w, computed as B, createElementBlock as M, openBlock as S, mergeProps as I, withModifiers as E, renderSlot as L } from "vue";
|
|
2
|
+
const K = ["selectable"], C = {
|
|
3
3
|
__name: "KunList",
|
|
4
4
|
props: /* @__PURE__ */ g({
|
|
5
5
|
nav: Boolean,
|
|
@@ -9,7 +9,7 @@ const R = {
|
|
|
9
9
|
selectionMode: {
|
|
10
10
|
type: String,
|
|
11
11
|
default: "single",
|
|
12
|
-
validator: (
|
|
12
|
+
validator: (l) => ["single", "multiple"].includes(l)
|
|
13
13
|
},
|
|
14
14
|
bgList: {
|
|
15
15
|
type: String,
|
|
@@ -27,9 +27,9 @@ const R = {
|
|
|
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(l, { expose: y, emit: p }) {
|
|
31
|
+
const u = l, a = p, f = b(null), c = b([]), s = D(l, "selected");
|
|
32
|
+
w("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 R = {
|
|
|
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
|
+
w("kunListContext", {
|
|
49
49
|
toggleItem: v,
|
|
50
50
|
isSelected: k
|
|
51
51
|
});
|
|
@@ -55,15 +55,15 @@ const R = {
|
|
|
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 o = document.activeElement;
|
|
59
|
+
(o == null ? void 0 : o.getAttribute("role")) === "menuitem" && o.click();
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
63
63
|
e.preventDefault();
|
|
64
|
-
const
|
|
64
|
+
const o = n.findIndex((x) => x === document.activeElement);
|
|
65
65
|
let d = -1;
|
|
66
|
-
|
|
66
|
+
o === -1 ? d = t === "ArrowDown" ? 0 : n.length - 1 : t === "ArrowDown" ? d = (o + 1) % n.length : t === "ArrowUp" && (d = (o - 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 R = {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
function h(e = "ArrowDown") {
|
|
74
|
-
var
|
|
74
|
+
var o;
|
|
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
|
+
(o = r == null ? void 0 : r.focus) == null || o.call(r);
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return y({ 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,23 +85,24 @@ const R = {
|
|
|
85
85
|
ref: f,
|
|
86
86
|
role: "list",
|
|
87
87
|
class: ["w-full kun-list", [
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
l.bgList,
|
|
89
|
+
l.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": !l.dense,
|
|
92
|
+
"space-y-0.5": l.dense,
|
|
93
|
+
"pl-4 border-l-2": l.sub,
|
|
94
|
+
"p-2 rounded-md": l.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))
|
|
99
|
+
onSelect: t[0] || (t[0] = (n) => a("click:select", n.detail)),
|
|
100
|
+
selectable: l.selectable
|
|
100
101
|
}, e.$attrs), [
|
|
101
102
|
L(e.$slots, "default")
|
|
102
|
-
], 16));
|
|
103
|
+
], 16, K));
|
|
103
104
|
}
|
|
104
105
|
};
|
|
105
106
|
export {
|
|
106
|
-
|
|
107
|
+
C as default
|
|
107
108
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { ref as V, inject as
|
|
1
|
+
import { ref as V, inject as $, onMounted as z, onBeforeUnmount as F, computed as i, createBlock as c, openBlock as n, unref as U, withCtx as C, resolveDynamicComponent as f, mergeProps as E, withKeys as j, withModifiers as K, createElementVNode as m, renderSlot as d, createElementBlock as l, createCommentVNode as s, normalizeClass as h, toDisplayString as k } from "vue";
|
|
2
2
|
import { RouterLink as q } from "vue-router";
|
|
3
|
-
const H = { class: "flex w-full items-center" }, J = {
|
|
4
|
-
key: 0,
|
|
5
|
-
class: "shrink-0 flex items-center gap-2 me-3"
|
|
6
|
-
}, Q = ["src"], T = { class: "flex flex-col min-w-0 flex-1" }, W = {
|
|
3
|
+
const H = { class: "flex w-full items-center" }, J = { class: "shrink-0 flex items-center gap-2 me-3" }, Q = ["src"], T = { class: "flex flex-col min-w-0 flex-1" }, W = {
|
|
7
4
|
key: 0,
|
|
8
5
|
class: "font-medium truncate"
|
|
9
6
|
}, X = {
|
|
10
7
|
key: 0,
|
|
11
8
|
class: "text-sm text-gray-500 dark:text-gray-400 truncate"
|
|
12
9
|
}, Y = {
|
|
13
|
-
key:
|
|
10
|
+
key: 0,
|
|
14
11
|
class: "shrink-0 flex items-center gap-2 ms-3"
|
|
15
12
|
}, Z = ["src"], _ = { class: "flex w-full items-center" }, ee = {
|
|
16
13
|
key: 0,
|
|
@@ -39,6 +36,7 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
39
36
|
type: String,
|
|
40
37
|
default: "bg-blue-100 text-blue-600 dark:bg-blue-900 dark:text-blue-300"
|
|
41
38
|
},
|
|
39
|
+
selectable: { type: Boolean, default: !1 },
|
|
42
40
|
variant: { type: String, default: "text" },
|
|
43
41
|
density: { type: String, default: "default" },
|
|
44
42
|
rounded: { type: [Boolean, String], default: !0 },
|
|
@@ -51,30 +49,32 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
51
49
|
itemPosition: { type: String, default: "items-start" },
|
|
52
50
|
itemClass: String,
|
|
53
51
|
prependIcon: [String, Object, Function],
|
|
54
|
-
appendIcon: [String, Object, Function],
|
|
55
52
|
prependAvatar: String,
|
|
53
|
+
prependClass: String,
|
|
54
|
+
appendIcon: [String, Object, Function],
|
|
56
55
|
appendAvatar: String,
|
|
56
|
+
appendClass: String,
|
|
57
57
|
title: [String, Number, Boolean],
|
|
58
58
|
subtitle: [String, Number, Boolean]
|
|
59
59
|
},
|
|
60
60
|
emits: ["click"],
|
|
61
|
-
setup(e, { emit:
|
|
62
|
-
const t = e,
|
|
61
|
+
setup(e, { emit: R }) {
|
|
62
|
+
const t = e, L = R, u = V(null), g = $("registerListItemRef", null), o = $("kunListContext", null);
|
|
63
63
|
z(() => {
|
|
64
|
-
|
|
64
|
+
g && u.value && g(u.value);
|
|
65
65
|
}), F(() => {
|
|
66
|
-
|
|
66
|
+
g && g(null);
|
|
67
67
|
});
|
|
68
|
-
const
|
|
68
|
+
const p = (a) => typeof a == "object" || typeof a == "function", N = i(() => !!(t.prependIcon || t.prependAvatar)), B = i(() => !!(t.appendIcon || t.appendAvatar)), w = i(() => {
|
|
69
69
|
var a;
|
|
70
70
|
return ((a = o == null ? void 0 : o.isSelected) == null ? void 0 : a.call(o, t.value)) ?? !1;
|
|
71
71
|
}), I = i(() => t.active), O = i(() => !!t.to);
|
|
72
72
|
function y(a, x = null) {
|
|
73
|
-
var v,
|
|
73
|
+
var v, b;
|
|
74
74
|
if (t.disabled) return;
|
|
75
|
-
|
|
75
|
+
L("click", a);
|
|
76
76
|
const r = ((v = u.value) == null ? void 0 : v.$el) ?? u.value;
|
|
77
|
-
r != null && r.dispatchEvent && r.dispatchEvent(new CustomEvent("select", { detail: t.value, bubbles: !0 })), o && t.value !== null && ((
|
|
77
|
+
r != null && r.dispatchEvent && r.dispatchEvent(new CustomEvent("select", { detail: t.value, bubbles: !0 })), o && t.selectable && t.value !== null && ((b = o.toggleItem) == null || b.call(o, t.value), r != null && r.dispatchEvent && r.dispatchEvent(new CustomEvent("selected", { detail: t.value, bubbles: !0 }))), x && x(a);
|
|
78
78
|
}
|
|
79
79
|
const P = i(() => {
|
|
80
80
|
switch (t.variant) {
|
|
@@ -100,7 +100,7 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
100
100
|
default:
|
|
101
101
|
return "py-3";
|
|
102
102
|
}
|
|
103
|
-
}), G = i(() => t.tile ? "rounded-none" : t.rounded === !0 ? "rounded-md" : t.rounded === !1 ? "" : `rounded-${t.rounded}`), M = i(() => t.ripple ? "relative overflow-hidden" : ""),
|
|
103
|
+
}), G = i(() => t.tile ? "rounded-none" : t.rounded === !0 ? "rounded-md" : t.rounded === !1 ? "" : `rounded-${t.rounded}`), M = i(() => t.ripple ? "relative overflow-hidden" : ""), A = i(() => [
|
|
104
104
|
ie,
|
|
105
105
|
P.value,
|
|
106
106
|
D.value,
|
|
@@ -111,7 +111,7 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
111
111
|
t.itemPosition,
|
|
112
112
|
{
|
|
113
113
|
"cursor-not-allowed opacity-50": t.disabled,
|
|
114
|
-
[`cursor-pointer ${t.hoverBg}`]: !t.disabled,
|
|
114
|
+
[`cursor-pointer ${t.hoverBg}`]: t.selectable && !t.disabled,
|
|
115
115
|
[t.activeClass]: w.value || I.value,
|
|
116
116
|
"px-4": !t.noGutters
|
|
117
117
|
},
|
|
@@ -123,38 +123,38 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
123
123
|
replace: e.replace,
|
|
124
124
|
custom: !0
|
|
125
125
|
}, {
|
|
126
|
-
default: C(({ href: r, navigate: v, isActive:
|
|
127
|
-
(n(), c(f(e.tag),
|
|
126
|
+
default: C(({ href: r, navigate: v, isActive: b }) => [
|
|
127
|
+
(n(), c(f(e.tag), E({
|
|
128
128
|
ref_key: "liRef",
|
|
129
129
|
ref: u,
|
|
130
130
|
href: r,
|
|
131
131
|
role: "option",
|
|
132
|
-
"aria-selected": w.value || I.value ||
|
|
132
|
+
"aria-selected": w.value || I.value || b,
|
|
133
133
|
"aria-disabled": e.disabled,
|
|
134
134
|
tabindex: "-1",
|
|
135
|
-
class:
|
|
135
|
+
class: A.value,
|
|
136
136
|
onClick: (S) => y(S, v),
|
|
137
|
-
onKeydown: K(
|
|
137
|
+
onKeydown: j(K((S) => y(S, v), ["prevent"]), ["enter"])
|
|
138
138
|
}, a.$attrs), {
|
|
139
139
|
default: C(() => [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
m("div", H, [
|
|
141
|
+
d(a.$slots, "prepend", {}, () => [
|
|
142
|
+
m("div", J, [
|
|
143
143
|
e.prependAvatar ? (n(), l("img", {
|
|
144
144
|
key: 0,
|
|
145
145
|
src: e.prependAvatar,
|
|
146
146
|
class: "w-8 h-8 rounded-full"
|
|
147
147
|
}, null, 8, Q)) : s("", !0),
|
|
148
|
-
|
|
148
|
+
p(e.prependIcon) ? (n(), c(f(e.prependIcon), {
|
|
149
149
|
key: 1,
|
|
150
150
|
class: "w-5 h-5"
|
|
151
151
|
})) : e.prependIcon ? (n(), l("i", {
|
|
152
152
|
key: 2,
|
|
153
|
-
class: h([e.
|
|
153
|
+
class: h([e.prependClass, "text-xl leading-none"])
|
|
154
154
|
}, null, 2)) : s("", !0)
|
|
155
155
|
])
|
|
156
|
-
])
|
|
157
|
-
|
|
156
|
+
]),
|
|
157
|
+
m("div", T, [
|
|
158
158
|
d(a.$slots, "default", {}, () => [
|
|
159
159
|
d(a.$slots, "title", {}, () => [
|
|
160
160
|
e.title ? (n(), l("div", W, k(e.title), 1)) : s("", !0)
|
|
@@ -164,19 +164,19 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
164
164
|
])
|
|
165
165
|
])
|
|
166
166
|
]),
|
|
167
|
-
|
|
167
|
+
B.value ? (n(), l("div", Y, [
|
|
168
168
|
d(a.$slots, "append", {}, () => [
|
|
169
169
|
e.appendAvatar ? (n(), l("img", {
|
|
170
170
|
key: 0,
|
|
171
171
|
src: e.appendAvatar,
|
|
172
172
|
class: "w-8 h-8 rounded-full"
|
|
173
173
|
}, null, 8, Z)) : s("", !0),
|
|
174
|
-
|
|
174
|
+
p(e.appendIcon) ? (n(), c(f(e.appendIcon), {
|
|
175
175
|
key: 1,
|
|
176
176
|
class: "w-5 h-5"
|
|
177
177
|
})) : e.appendIcon ? (n(), l("i", {
|
|
178
178
|
key: 2,
|
|
179
|
-
class: h([e.
|
|
179
|
+
class: h([e.appendClass, "text-xl leading-none"])
|
|
180
180
|
}, null, 2)) : s("", !0)
|
|
181
181
|
])
|
|
182
182
|
])) : s("", !0)
|
|
@@ -186,7 +186,7 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
186
186
|
}, 1040, ["href", "aria-selected", "aria-disabled", "class", "onClick", "onKeydown"]))
|
|
187
187
|
]),
|
|
188
188
|
_: 3
|
|
189
|
-
}, 8, ["to", "replace"])) : (n(), c(f(e.tag),
|
|
189
|
+
}, 8, ["to", "replace"])) : (n(), c(f(e.tag), E({
|
|
190
190
|
key: 1,
|
|
191
191
|
ref_key: "liRef",
|
|
192
192
|
ref: u,
|
|
@@ -194,20 +194,20 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
194
194
|
"aria-selected": w.value || I.value,
|
|
195
195
|
"aria-disabled": e.disabled,
|
|
196
196
|
tabindex: "-1",
|
|
197
|
-
class:
|
|
197
|
+
class: A.value,
|
|
198
198
|
onClick: y,
|
|
199
|
-
onKeydown: K(
|
|
199
|
+
onKeydown: j(K(y, ["prevent"]), ["enter"])
|
|
200
200
|
}, a.$attrs), {
|
|
201
201
|
default: C(() => [
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
m("div", _, [
|
|
203
|
+
N.value ? (n(), l("div", ee, [
|
|
204
204
|
d(a.$slots, "prepend", {}, () => [
|
|
205
205
|
e.prependAvatar ? (n(), l("img", {
|
|
206
206
|
key: 0,
|
|
207
207
|
src: e.prependAvatar,
|
|
208
208
|
class: "w-8 h-8 rounded-full"
|
|
209
209
|
}, null, 8, te)) : s("", !0),
|
|
210
|
-
|
|
210
|
+
p(e.prependIcon) ? (n(), c(f(e.prependIcon), {
|
|
211
211
|
key: 1,
|
|
212
212
|
class: "w-5 h-5"
|
|
213
213
|
})) : e.prependIcon ? (n(), l("i", {
|
|
@@ -216,7 +216,7 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
216
216
|
}, null, 2)) : s("", !0)
|
|
217
217
|
])
|
|
218
218
|
])) : s("", !0),
|
|
219
|
-
|
|
219
|
+
m("div", ne, [
|
|
220
220
|
d(a.$slots, "default", {}, () => [
|
|
221
221
|
d(a.$slots, "title", {}, () => [
|
|
222
222
|
e.title ? (n(), l("div", ae, k(e.title), 1)) : s("", !0)
|
|
@@ -226,14 +226,14 @@ const H = { class: "flex w-full items-center" }, J = {
|
|
|
226
226
|
])
|
|
227
227
|
])
|
|
228
228
|
]),
|
|
229
|
-
|
|
229
|
+
B.value ? (n(), l("div", se, [
|
|
230
230
|
d(a.$slots, "append", {}, () => [
|
|
231
231
|
e.appendAvatar ? (n(), l("img", {
|
|
232
232
|
key: 0,
|
|
233
233
|
src: e.appendAvatar,
|
|
234
234
|
class: "w-8 h-8 rounded-full"
|
|
235
235
|
}, null, 8, re)) : s("", !0),
|
|
236
|
-
|
|
236
|
+
p(e.appendIcon) ? (n(), c(f(e.appendIcon), {
|
|
237
237
|
key: 1,
|
|
238
238
|
class: "w-5 h-5"
|
|
239
239
|
})) : e.appendIcon ? (n(), l("i", {
|