adverich-kun-ui 0.1.147 → 0.1.149
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 { ref as
|
|
2
|
-
const
|
|
1
|
+
import { ref as w, inject as g, onMounted as p, onBeforeUnmount as B, computed as y, createElementBlock as c, openBlock as i, mergeProps as I, withKeys as x, withModifiers as A, createElementVNode as s, renderSlot as r, createBlock as h, createCommentVNode as d, resolveDynamicComponent as k, toDisplayString as S } from "vue";
|
|
2
|
+
const $ = ["aria-selected", "aria-disabled", "onKeydown"], C = { class: "shrink-0 flex items-center" }, E = ["src"], N = { class: "flex flex-col min-w-0 flex-1" }, j = { class: "font-medium truncate" }, K = { class: "text-sm text-gray-500 dark:text-gray-400 truncate" }, R = { class: "shrink-0 flex items-center ml-auto" }, L = ["src"], P = {
|
|
3
3
|
__name: "KunListItem",
|
|
4
4
|
props: {
|
|
5
5
|
value: {
|
|
@@ -31,59 +31,100 @@ const S = ["aria-selected", "aria-disabled", "onKeydown"], x = {
|
|
|
31
31
|
itemPosition: {
|
|
32
32
|
type: String,
|
|
33
33
|
default: "items-start"
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
prependIcon: [String, Object, Function],
|
|
36
|
+
appendIcon: [String, Object, Function],
|
|
37
|
+
prependAvatar: String,
|
|
38
|
+
appendAvatar: String,
|
|
39
|
+
title: [String, Number, Boolean],
|
|
40
|
+
subtitle: [String, Number, Boolean],
|
|
41
|
+
slim: Boolean
|
|
35
42
|
},
|
|
36
43
|
setup(e) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}),
|
|
41
|
-
|
|
44
|
+
const n = e, a = w(null), o = g("registerListItemRef", null), l = g("kunListContext", null);
|
|
45
|
+
p(() => {
|
|
46
|
+
o && a.value && o(a.value);
|
|
47
|
+
}), B(() => {
|
|
48
|
+
o && o(null);
|
|
42
49
|
});
|
|
43
|
-
const
|
|
44
|
-
var
|
|
45
|
-
return ((
|
|
46
|
-
}),
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
+
const v = y(() => {
|
|
51
|
+
var t;
|
|
52
|
+
return ((t = l == null ? void 0 : l.isSelected) == null ? void 0 : t.call(l, n.value)) ?? !1;
|
|
53
|
+
}), m = y(() => n.active);
|
|
54
|
+
function f() {
|
|
55
|
+
var t, u, b;
|
|
56
|
+
n.disabled || ((t = a.value) == null || t.dispatchEvent(
|
|
50
57
|
new CustomEvent("select", {
|
|
51
|
-
detail:
|
|
58
|
+
detail: n.value,
|
|
52
59
|
bubbles: !0
|
|
53
60
|
})
|
|
54
|
-
),
|
|
61
|
+
), l && n.value !== null && ((u = l.toggleItem) == null || u.call(l, n.value), (b = a.value) == null || b.dispatchEvent(
|
|
55
62
|
new CustomEvent("selected", {
|
|
56
|
-
detail:
|
|
63
|
+
detail: n.value,
|
|
57
64
|
bubbles: !0
|
|
58
65
|
})
|
|
59
66
|
)));
|
|
60
67
|
}
|
|
61
|
-
return (
|
|
68
|
+
return (t, u) => (i(), c("li", I({
|
|
62
69
|
ref_key: "liRef",
|
|
63
|
-
ref:
|
|
70
|
+
ref: a,
|
|
64
71
|
role: "option",
|
|
65
|
-
"aria-selected":
|
|
72
|
+
"aria-selected": v.value || m.value,
|
|
66
73
|
"aria-disabled": e.disabled,
|
|
67
74
|
tabindex: "-1",
|
|
68
|
-
class: ["w-full flex
|
|
75
|
+
class: ["w-full flex", [
|
|
69
76
|
"kun-list-item",
|
|
70
77
|
e.bgItems,
|
|
71
|
-
e.itemPosition,
|
|
72
78
|
e.textColor,
|
|
79
|
+
e.itemPosition,
|
|
73
80
|
{
|
|
74
81
|
"cursor-not-allowed opacity-50": e.disabled,
|
|
75
82
|
[`cursor-pointer ${e.hoverBg}`]: !e.disabled,
|
|
76
|
-
[e.activeClass]:
|
|
77
|
-
"px-4 py-2": !e.noGutters
|
|
83
|
+
[e.activeClass]: v.value || m.value,
|
|
84
|
+
"px-4 py-2": !e.noGutters,
|
|
85
|
+
"gap-2": !e.slim
|
|
78
86
|
}
|
|
79
87
|
]],
|
|
80
|
-
onKeydown:
|
|
81
|
-
onClick:
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
onKeydown: x(A(f, ["prevent"]), ["enter"]),
|
|
89
|
+
onClick: f
|
|
90
|
+
}, t.$attrs), [
|
|
91
|
+
s("div", C, [
|
|
92
|
+
r(t.$slots, "prepend", {}, () => [
|
|
93
|
+
e.prependAvatar ? (i(), c("img", {
|
|
94
|
+
key: 0,
|
|
95
|
+
src: e.prependAvatar,
|
|
96
|
+
class: "w-8 h-8 rounded-full"
|
|
97
|
+
}, null, 8, E)) : e.prependIcon ? (i(), h(k(e.prependIcon), {
|
|
98
|
+
key: 1,
|
|
99
|
+
class: "w-5 h-5"
|
|
100
|
+
})) : d("", !0)
|
|
101
|
+
])
|
|
102
|
+
]),
|
|
103
|
+
s("div", N, [
|
|
104
|
+
r(t.$slots, "default", {}, () => [
|
|
105
|
+
e.title ? r(t.$slots, "title", { key: 0 }, () => [
|
|
106
|
+
s("div", j, S(e.title), 1)
|
|
107
|
+
]) : d("", !0),
|
|
108
|
+
e.subtitle ? r(t.$slots, "subtitle", { key: 1 }, () => [
|
|
109
|
+
s("div", K, S(e.subtitle), 1)
|
|
110
|
+
]) : d("", !0)
|
|
111
|
+
])
|
|
112
|
+
]),
|
|
113
|
+
s("div", R, [
|
|
114
|
+
r(t.$slots, "append", {}, () => [
|
|
115
|
+
e.appendAvatar ? (i(), c("img", {
|
|
116
|
+
key: 0,
|
|
117
|
+
src: e.appendAvatar,
|
|
118
|
+
class: "w-8 h-8 rounded-full"
|
|
119
|
+
}, null, 8, L)) : e.appendIcon ? (i(), h(k(e.appendIcon), {
|
|
120
|
+
key: 1,
|
|
121
|
+
class: "w-5 h-5"
|
|
122
|
+
})) : d("", !0)
|
|
123
|
+
])
|
|
124
|
+
])
|
|
125
|
+
], 16, $));
|
|
85
126
|
}
|
|
86
127
|
};
|
|
87
128
|
export {
|
|
88
|
-
|
|
129
|
+
P as default
|
|
89
130
|
};
|