adverich-kun-ui 0.1.358 → 0.1.359
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,43 +1,39 @@
|
|
|
1
|
-
import { mergeModels as
|
|
1
|
+
import { mergeModels as _, useModel as x, onMounted as ne, ref as A, watch as ie, createElementBlock as C, openBlock as s, createVNode as i, unref as t, isRef as z, createSlots as ae, withCtx as n, createCommentVNode as w, Fragment as re, renderList as se, createBlock as c, createElementVNode as ue, createTextVNode as V, toDisplayString as $, withModifiers as de } from "vue";
|
|
2
2
|
import { icons as m } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useAutocomplete as
|
|
11
|
-
import { KunAutocompleteProps as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
const Ve = {
|
|
3
|
+
import { isNotEmpty as ce, isArray as F } from "../../../../utils/utils.js";
|
|
4
|
+
import me from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
|
+
import fe from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
+
import B from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
+
import E from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
|
+
import pe from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
+
import he from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
10
|
+
import { useAutocomplete as ve } from "../composables/useAutocomplete.js";
|
|
11
|
+
import { KunAutocompleteProps as ye } from "../composables/KunAutocompleteProps.js";
|
|
12
|
+
import ke from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
|
+
import ge from "../../../KunChip/src/components/KunChip.vue.js";
|
|
14
|
+
import v from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
15
|
+
const be = {
|
|
17
16
|
key: 0,
|
|
18
17
|
class: "flex justify-center align-center"
|
|
19
|
-
},
|
|
20
|
-
key: 0,
|
|
21
|
-
class: "sticky top-0 z-10 p-2 border-b"
|
|
22
|
-
}, Ue = {
|
|
18
|
+
}, Ce = { class: "flex justify-center align-center" }, Be = {
|
|
23
19
|
__name: "KunAutocomplete",
|
|
24
|
-
props: /* @__PURE__ */
|
|
20
|
+
props: /* @__PURE__ */ _(ye, {
|
|
25
21
|
modelValue: { default: null },
|
|
26
22
|
modelModifiers: {},
|
|
27
23
|
items: { default: [], type: Array, required: !0 },
|
|
28
24
|
itemsModifiers: {}
|
|
29
25
|
}),
|
|
30
|
-
emits: /* @__PURE__ */
|
|
31
|
-
setup(
|
|
32
|
-
const a =
|
|
33
|
-
textFieldRef:
|
|
34
|
-
listRef:
|
|
35
|
-
menuModel:
|
|
26
|
+
emits: /* @__PURE__ */ _(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
27
|
+
setup(y, { emit: N }) {
|
|
28
|
+
const a = x(y, "modelValue"), I = x(y, "items"), u = y, f = N, {
|
|
29
|
+
textFieldRef: k,
|
|
30
|
+
listRef: g,
|
|
31
|
+
menuModel: r,
|
|
36
32
|
search: d,
|
|
37
|
-
removeItem:
|
|
33
|
+
removeItem: T,
|
|
38
34
|
clearSelection: L,
|
|
39
35
|
lightReset: U,
|
|
40
|
-
openMenu:
|
|
36
|
+
openMenu: b,
|
|
41
37
|
closeMenu: H,
|
|
42
38
|
toggleMenu: O,
|
|
43
39
|
onMenuKeydown: j,
|
|
@@ -45,15 +41,14 @@ const Ve = {
|
|
|
45
41
|
textArr: P,
|
|
46
42
|
getItemText: W,
|
|
47
43
|
isAlphanumeric: G,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
u.focusOnRender && C.value.focus();
|
|
44
|
+
checkDisabled: J,
|
|
45
|
+
itemToString: S,
|
|
46
|
+
placeholder: Q
|
|
47
|
+
} = ve(u, f, a, I);
|
|
48
|
+
ne(() => {
|
|
49
|
+
u.focusOnRender && k.value.focus();
|
|
55
50
|
});
|
|
56
|
-
const
|
|
51
|
+
const D = A(null), p = A(""), K = (e) => {
|
|
57
52
|
for (const o of u.rules) {
|
|
58
53
|
const l = o(e);
|
|
59
54
|
if (l !== !0)
|
|
@@ -61,162 +56,150 @@ const Ve = {
|
|
|
61
56
|
}
|
|
62
57
|
return p.value = "", f("validation", !0), !0;
|
|
63
58
|
};
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
ie(() => a.value, (e, o) => {
|
|
60
|
+
ce(u.rules) && K(e);
|
|
66
61
|
});
|
|
67
|
-
function
|
|
62
|
+
function X() {
|
|
68
63
|
var e;
|
|
69
|
-
|
|
64
|
+
r.value = !1, (e = k.value.inputField) == null || e.focus();
|
|
70
65
|
}
|
|
71
|
-
function
|
|
66
|
+
function Y(e) {
|
|
72
67
|
var l, h;
|
|
73
68
|
const o = e.key;
|
|
74
69
|
if (o === "Tab" || o === "Shift") {
|
|
75
70
|
H();
|
|
76
71
|
return;
|
|
77
72
|
}
|
|
78
|
-
(G(o) || o === "Backspace") &&
|
|
73
|
+
(G(o) || o === "Backspace") && b(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), r.value || b(), console.log("listRef.value", g.value), (h = (l = g.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
|
|
79
74
|
}
|
|
80
|
-
function
|
|
75
|
+
function Z(e) {
|
|
81
76
|
f("search", d);
|
|
82
77
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
78
|
+
function ee() {
|
|
79
|
+
K(a);
|
|
85
80
|
}
|
|
86
|
-
function
|
|
81
|
+
function le(e) {
|
|
87
82
|
j(e);
|
|
88
83
|
}
|
|
89
|
-
function
|
|
84
|
+
function te() {
|
|
90
85
|
}
|
|
91
|
-
return (e, o) => (
|
|
86
|
+
return (e, o) => (s(), C("div", {
|
|
92
87
|
class: "w-full h-fit",
|
|
93
88
|
ref_key: "parentRef",
|
|
94
|
-
ref:
|
|
89
|
+
ref: D
|
|
95
90
|
}, [
|
|
96
|
-
i(
|
|
91
|
+
i(ke, {
|
|
97
92
|
modelValue: t(d),
|
|
98
93
|
"onUpdate:modelValue": [
|
|
99
|
-
o[1] || (o[1] = (l) =>
|
|
100
|
-
|
|
94
|
+
o[1] || (o[1] = (l) => z(d) ? d.value = l : null),
|
|
95
|
+
Z
|
|
101
96
|
],
|
|
102
97
|
label: e.label,
|
|
103
98
|
dirty: "",
|
|
104
99
|
"hide-details": e.hideDetails,
|
|
105
100
|
density: e.density,
|
|
106
101
|
ref_key: "textFieldRef",
|
|
107
|
-
ref:
|
|
102
|
+
ref: k,
|
|
108
103
|
autocomplete: "off",
|
|
109
|
-
onFocusInput:
|
|
104
|
+
onFocusInput: ee,
|
|
110
105
|
onHandleClick: t(O),
|
|
111
|
-
rounded: t(
|
|
112
|
-
onBlur:
|
|
113
|
-
onKeyDown:
|
|
114
|
-
placeholder: u.multiple && t(F)(a.value) && a.value.length ? "" : t(
|
|
106
|
+
rounded: t(r) ? "rounded-t" : "rounded",
|
|
107
|
+
onBlur: te,
|
|
108
|
+
onKeyDown: Y,
|
|
109
|
+
placeholder: u.multiple && t(F)(a.value) && a.value.length ? "" : t(Q),
|
|
115
110
|
error: !!p.value,
|
|
116
111
|
"error-messages": p.value
|
|
117
112
|
}, ae({
|
|
118
113
|
default: n(() => [
|
|
119
|
-
t(F)(a.value) ? (
|
|
120
|
-
(
|
|
114
|
+
t(F)(a.value) ? (s(), C("div", be, [
|
|
115
|
+
(s(!0), C(re, null, se(a.value, (l) => (s(), c(ge, {
|
|
121
116
|
key: l.id ?? l.name,
|
|
122
117
|
size: "small",
|
|
123
118
|
class: "ml-1"
|
|
124
119
|
}, {
|
|
125
120
|
default: n(() => [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
i(
|
|
121
|
+
ue("div", Ce, [
|
|
122
|
+
V($(t(W)(l, e.itemTitle)) + " ", 1),
|
|
123
|
+
i(v, {
|
|
129
124
|
color: "error",
|
|
130
125
|
icon: t(m).close,
|
|
131
126
|
size: "small",
|
|
132
127
|
class: "ml-1",
|
|
133
|
-
onClick: (h) => t(
|
|
128
|
+
onClick: (h) => t(T)(l)
|
|
134
129
|
}, null, 8, ["icon", "onClick"])
|
|
135
130
|
])
|
|
136
131
|
]),
|
|
137
132
|
_: 2
|
|
138
133
|
}, 1024))), 128))
|
|
139
|
-
])) :
|
|
140
|
-
i(
|
|
134
|
+
])) : w("", !0),
|
|
135
|
+
i(he, {
|
|
141
136
|
transition: "fade",
|
|
142
137
|
"onClick:outside": t(U),
|
|
143
|
-
modelValue: t(
|
|
144
|
-
"onUpdate:modelValue": o[0] || (o[0] = (l) =>
|
|
138
|
+
modelValue: t(r),
|
|
139
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => z(r) ? r.value = l : null),
|
|
145
140
|
activator: "parent",
|
|
146
141
|
"z-index": e.zIndex,
|
|
147
|
-
"parent-ref":
|
|
142
|
+
"parent-ref": D.value,
|
|
148
143
|
location: "bottom",
|
|
149
144
|
origin: "bottom left",
|
|
150
|
-
onHandleEscape:
|
|
145
|
+
onHandleEscape: X,
|
|
151
146
|
"close-on-content-click": e.closeOnSelect,
|
|
152
147
|
width: "w-full",
|
|
153
148
|
"max-height": e.maxHeight,
|
|
154
149
|
"hide-details": e.hideDetails
|
|
155
150
|
}, {
|
|
156
151
|
default: n(() => [
|
|
157
|
-
|
|
158
|
-
i(Ce, {
|
|
159
|
-
onClick: t(J),
|
|
160
|
-
bgColor: e.btnCreateBg,
|
|
161
|
-
class: ce(e.btnCreateClass)
|
|
162
|
-
}, {
|
|
163
|
-
default: n(() => [
|
|
164
|
-
y(V(e.btnCreateText), 1)
|
|
165
|
-
]),
|
|
166
|
-
_: 1
|
|
167
|
-
}, 8, ["onClick", "bgColor", "class"])
|
|
168
|
-
])) : v("", !0),
|
|
169
|
-
i(he, {
|
|
152
|
+
i(fe, {
|
|
170
153
|
"onClick:select": t(q),
|
|
171
154
|
ref_key: "listRef",
|
|
172
|
-
ref:
|
|
173
|
-
onKeyDown:
|
|
155
|
+
ref: g,
|
|
156
|
+
onKeyDown: le,
|
|
174
157
|
selectable: !0
|
|
175
158
|
}, {
|
|
176
159
|
default: n(() => [
|
|
177
|
-
i(
|
|
160
|
+
i(me, {
|
|
178
161
|
items: I.value,
|
|
179
162
|
search: t(d),
|
|
180
163
|
"searchable-keys": u.searchableKeys,
|
|
181
164
|
virtual: !1,
|
|
182
165
|
"items-per-intersection": 10,
|
|
183
|
-
enabled: t(
|
|
166
|
+
enabled: t(r),
|
|
184
167
|
"item-height": 48
|
|
185
168
|
}, {
|
|
186
|
-
default: n(({ item: l, index: h, empty:
|
|
187
|
-
var
|
|
169
|
+
default: n(({ item: l, index: h, empty: oe }) => {
|
|
170
|
+
var M, R;
|
|
188
171
|
return [
|
|
189
|
-
!
|
|
172
|
+
!oe && l ? (s(), c(B, {
|
|
190
173
|
value: l,
|
|
191
|
-
key: ((
|
|
192
|
-
disabled: t(
|
|
174
|
+
key: ((M = l.id) == null ? void 0 : M.toString()) ?? l.name,
|
|
175
|
+
disabled: t(J)(l),
|
|
193
176
|
"bg-items": e.bgItemListColor,
|
|
194
177
|
"hover-bg": e.hoverItemListColor,
|
|
195
178
|
activeClass: e.selectedItemListColor,
|
|
196
179
|
density: e.density,
|
|
197
|
-
id: ((
|
|
180
|
+
id: ((R = l.id) == null ? void 0 : R.toString()) ?? l.name,
|
|
198
181
|
selectable: !0
|
|
199
182
|
}, {
|
|
200
183
|
default: n(() => [
|
|
201
|
-
i(
|
|
184
|
+
i(E, { class: "text-wrap" }, {
|
|
202
185
|
default: n(() => [
|
|
203
|
-
|
|
186
|
+
V($(t(S)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
|
|
204
187
|
]),
|
|
205
188
|
_: 2
|
|
206
189
|
}, 1024),
|
|
207
|
-
i(
|
|
208
|
-
text: e.itemSubtitle ? t(
|
|
190
|
+
i(pe, {
|
|
191
|
+
text: e.itemSubtitle ? t(S)(l, e.itemSubtitle) : ""
|
|
209
192
|
}, null, 8, ["text"])
|
|
210
193
|
]),
|
|
211
194
|
_: 2
|
|
212
|
-
}, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (
|
|
195
|
+
}, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (s(), c(B, {
|
|
213
196
|
key: 1,
|
|
214
197
|
disabled: ""
|
|
215
198
|
}, {
|
|
216
199
|
default: n(() => [
|
|
217
|
-
i(
|
|
200
|
+
i(E, { class: "text-center w-full text-gray-500" }, {
|
|
218
201
|
default: n(() => o[2] || (o[2] = [
|
|
219
|
-
|
|
202
|
+
V(" No hay elementos disponibles ")
|
|
220
203
|
])),
|
|
221
204
|
_: 1,
|
|
222
205
|
__: [2]
|
|
@@ -240,28 +223,28 @@ const Ve = {
|
|
|
240
223
|
e.hasIcons ? {
|
|
241
224
|
name: "append-inner",
|
|
242
225
|
fn: n(() => [
|
|
243
|
-
e.clearable && a.value ? (
|
|
226
|
+
e.clearable && a.value ? (s(), c(v, {
|
|
244
227
|
key: 0,
|
|
245
228
|
onClick: t(L),
|
|
246
229
|
size: "small",
|
|
247
230
|
color: "error",
|
|
248
231
|
icon: t(m).close,
|
|
249
232
|
class: "mr-1 mt-1"
|
|
250
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
251
|
-
i(
|
|
233
|
+
}, null, 8, ["onClick", "icon"])) : w("", !0),
|
|
234
|
+
i(v, {
|
|
252
235
|
color: "teal-darken-1",
|
|
253
236
|
size: "large",
|
|
254
237
|
class: "cursor-pointer",
|
|
255
|
-
icon: t(
|
|
256
|
-
onClick:
|
|
238
|
+
icon: t(r) ? t(m).menuUpOutline : t(m).menuDownOutline,
|
|
239
|
+
onClick: de(t(b), ["stop"])
|
|
257
240
|
}, null, 8, ["icon", "onClick"]),
|
|
258
|
-
e.required ? (
|
|
241
|
+
e.required ? (s(), c(v, {
|
|
259
242
|
key: 1,
|
|
260
243
|
color: "teal-darken-1",
|
|
261
244
|
size: "x-small",
|
|
262
245
|
class: "mb-4",
|
|
263
246
|
icon: t(m).asterisk
|
|
264
|
-
}, null, 8, ["icon"])) :
|
|
247
|
+
}, null, 8, ["icon"])) : w("", !0)
|
|
265
248
|
]),
|
|
266
249
|
key: "0"
|
|
267
250
|
} : void 0
|
|
@@ -270,5 +253,5 @@ const Ve = {
|
|
|
270
253
|
}
|
|
271
254
|
};
|
|
272
255
|
export {
|
|
273
|
-
|
|
256
|
+
Be as default
|
|
274
257
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { mergeModels as
|
|
1
|
+
import { mergeModels as m, ref as v, useModel as D, provide as p, computed as B, onUpdated as C, createElementBlock as I, openBlock as M, mergeProps as S, withModifiers as E, renderSlot as L } from "vue";
|
|
2
2
|
const R = {
|
|
3
3
|
__name: "KunList",
|
|
4
|
-
props: /* @__PURE__ */
|
|
4
|
+
props: /* @__PURE__ */ m({
|
|
5
5
|
nav: Boolean,
|
|
6
6
|
sub: Boolean,
|
|
7
7
|
dense: Boolean,
|
|
@@ -20,33 +20,39 @@ const R = {
|
|
|
20
20
|
},
|
|
21
21
|
selectedModifiers: {}
|
|
22
22
|
}),
|
|
23
|
-
emits: /* @__PURE__ */
|
|
24
|
-
setup(o, { expose:
|
|
25
|
-
const
|
|
23
|
+
emits: /* @__PURE__ */ m(["keyDown", "click:select", "update:selected"], ["update:selected"]),
|
|
24
|
+
setup(o, { expose: w, emit: b }) {
|
|
25
|
+
const d = o, a = b, f = v(null), r = v([]), i = D(o, "selected");
|
|
26
26
|
p("registerListItemRef", (e) => {
|
|
27
|
-
e && !
|
|
27
|
+
e ? (console.log(e), e.isConnected && !r.value.includes(e) && (r.value.push(e), r.value.sort((t, n) => {
|
|
28
|
+
const s = t.id ?? "", l = n.id ?? "";
|
|
29
|
+
return s.localeCompare(l, void 0, { numeric: !0, sensitivity: "base" });
|
|
30
|
+
}))) : r.value = r.value.filter((t) => t && t.isConnected);
|
|
28
31
|
});
|
|
29
|
-
const
|
|
30
|
-
function
|
|
31
|
-
if (!(!
|
|
32
|
-
if (
|
|
33
|
-
const t =
|
|
34
|
-
|
|
32
|
+
const g = B(() => d.selectable && d.selectionMode === "multiple");
|
|
33
|
+
function y(e) {
|
|
34
|
+
if (!(!d.selectable || e == null))
|
|
35
|
+
if (g.value) {
|
|
36
|
+
const t = i.value.includes(e);
|
|
37
|
+
i.value = t ? i.value.filter((n) => n !== e) : [...i.value, e];
|
|
35
38
|
} else
|
|
36
|
-
|
|
39
|
+
i.value = e;
|
|
37
40
|
}
|
|
41
|
+
C(() => {
|
|
42
|
+
r.value = r.value.filter((e) => e && e.isConnected);
|
|
43
|
+
});
|
|
38
44
|
function k(e) {
|
|
39
45
|
var t, n;
|
|
40
|
-
return !
|
|
46
|
+
return !d.selectable || e == null ? !1 : g.value ? (n = (t = i.value) == null ? void 0 : t.includes) == null ? void 0 : n.call(t, e) : i.value === e;
|
|
41
47
|
}
|
|
42
48
|
p("kunListContext", {
|
|
43
|
-
toggleItem:
|
|
49
|
+
toggleItem: y,
|
|
44
50
|
isSelected: k
|
|
45
51
|
});
|
|
46
52
|
function A(e) {
|
|
47
|
-
var
|
|
53
|
+
var s;
|
|
48
54
|
a("keyDown", e);
|
|
49
|
-
const t = e.key, n =
|
|
55
|
+
const t = e.key, n = r.value.filter((l) => l && l.isConnected);
|
|
50
56
|
if (!(!n.length || !["ArrowUp", "ArrowDown", "Enter"].includes(t))) {
|
|
51
57
|
if (t === "Enter") {
|
|
52
58
|
const l = document.activeElement;
|
|
@@ -55,26 +61,26 @@ const R = {
|
|
|
55
61
|
}
|
|
56
62
|
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
57
63
|
e.preventDefault();
|
|
58
|
-
const l = n.findIndex((
|
|
59
|
-
let
|
|
60
|
-
l === -1 ?
|
|
61
|
-
const
|
|
62
|
-
(
|
|
64
|
+
const l = n.findIndex((h) => h === document.activeElement);
|
|
65
|
+
let u = -1;
|
|
66
|
+
l === -1 ? (console.log(1), u = t === "ArrowDown" ? 0 : n.length - 1) : t === "ArrowDown" ? (console.log(2), u = (l + 1) % n.length) : t === "ArrowUp" && (console.log(3), u = (l - 1 + n.length) % n.length), console.log(`currentIndex: ${u}`);
|
|
67
|
+
const c = n[u];
|
|
68
|
+
(s = c == null ? void 0 : c.focus) == null || s.call(c);
|
|
63
69
|
return;
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
|
-
function
|
|
73
|
+
function x(e = "ArrowDown") {
|
|
68
74
|
var l;
|
|
69
|
-
const t =
|
|
75
|
+
const t = r.value.filter(Boolean);
|
|
70
76
|
if (!t.length) return;
|
|
71
|
-
const n = e === "ArrowDown" ? 0 : t.length - 1,
|
|
72
|
-
(l =
|
|
77
|
+
const n = e === "ArrowDown" ? 0 : t.length - 1, s = t[n];
|
|
78
|
+
(l = s == null ? void 0 : s.focus) == null || l.call(s);
|
|
73
79
|
}
|
|
74
|
-
return
|
|
80
|
+
return w({ focusWithKey: x, focus: () => {
|
|
75
81
|
var e, t;
|
|
76
82
|
return (t = (e = f.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
|
|
77
|
-
} }), (e, t) => (
|
|
83
|
+
} }), (e, t) => (M(), I("ul", S({
|
|
78
84
|
ref_key: "ulRef",
|
|
79
85
|
ref: f,
|
|
80
86
|
role: "list",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { useAttrs as
|
|
2
|
-
import
|
|
3
|
-
import { RouterLink as
|
|
4
|
-
const
|
|
1
|
+
import { useAttrs as H, computed as r, ref as J, inject as R, getCurrentInstance as Q, onMounted as T, onBeforeUnmount as W, createBlock as o, openBlock as l, unref as X, withCtx as $, resolveDynamicComponent as v, mergeProps as h, withKeys as L, withModifiers as P, createElementVNode as C, createElementBlock as a, createCommentVNode as s, renderSlot as c, normalizeClass as i, toDisplayString as I } from "vue";
|
|
2
|
+
import M from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
3
|
+
import { RouterLink as Y } from "vue-router";
|
|
4
|
+
const Z = { class: "flex w-full items-center" }, _ = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "shrink-0 flex items-center gap-2 me-2"
|
|
7
|
-
},
|
|
7
|
+
}, ee = ["src"], te = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "shrink-0 flex items-center gap-2 ms-3"
|
|
10
|
-
},
|
|
10
|
+
}, ne = ["src"], le = { class: "flex w-full items-center" }, ae = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "shrink-0 flex items-center gap-2 me-2"
|
|
13
|
-
},
|
|
13
|
+
}, se = ["src"], re = {
|
|
14
14
|
key: 1,
|
|
15
15
|
class: "shrink-0 flex items-center gap-2 ms-3"
|
|
16
|
-
},
|
|
16
|
+
}, ie = ["src"], de = "w-full flex transition duration-150 ease-in-out", fe = {
|
|
17
17
|
__name: "KunListItem",
|
|
18
18
|
props: {
|
|
19
19
|
value: [String, Number, Boolean, Object, Array, null],
|
|
@@ -46,31 +46,35 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
46
46
|
titleClass: { type: String, default: "font-medium" },
|
|
47
47
|
subtitle: [String, Number, Boolean],
|
|
48
48
|
subtitleClass: { type: String, default: "text-sm text-slate-800 dark:text-slate-200" },
|
|
49
|
-
containerClass: { type: [String, Array, Object], default: "" }
|
|
49
|
+
containerClass: { type: [String, Array, Object], default: "" },
|
|
50
|
+
id: [String, Number]
|
|
50
51
|
},
|
|
51
52
|
emits: ["click"],
|
|
52
53
|
setup(e, { emit: D }) {
|
|
53
|
-
const
|
|
54
|
-
const { class:
|
|
54
|
+
const B = H(), x = r(() => B.class), j = r(() => {
|
|
55
|
+
const { class: n, ...m } = B;
|
|
55
56
|
return m;
|
|
56
|
-
}), t = e, G = D, f =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}), Q(() => {
|
|
60
|
-
y && y(null);
|
|
57
|
+
}), t = e, G = D, f = J(null), g = R("registerListItemRef", null), u = R("kunListContext", null), E = r(() => {
|
|
58
|
+
var n;
|
|
59
|
+
return t.id ? t.id : `kun-list-item-${((n = Q()) == null ? void 0 : n.uid) ?? Math.random().toString(36).slice(2, 7)}`;
|
|
61
60
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
T(() => {
|
|
62
|
+
g && f.value && g(f.value);
|
|
63
|
+
}), W(() => {
|
|
64
|
+
g && g(null);
|
|
65
|
+
});
|
|
66
|
+
const y = (n) => typeof n == "object" || typeof n == "function", K = r(() => !!(t.prependIcon || t.prependAvatar)), N = r(() => !!(t.appendIcon || t.appendAvatar)), S = r(() => {
|
|
67
|
+
var n;
|
|
68
|
+
return ((n = u == null ? void 0 : u.isSelected) == null ? void 0 : n.call(u, t.value)) ?? !1;
|
|
69
|
+
}), w = r(() => t.active), V = r(() => !!t.to);
|
|
70
|
+
function b(n, m = null) {
|
|
67
71
|
var p, k;
|
|
68
72
|
if (t.disabled) return;
|
|
69
|
-
G("click",
|
|
73
|
+
G("click", n);
|
|
70
74
|
const d = ((p = f.value) == null ? void 0 : p.$el) ?? f.value;
|
|
71
|
-
d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("select", { detail: t.value, bubbles: !0 })),
|
|
75
|
+
d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("select", { detail: t.value, bubbles: !0 })), u && t.selectable && t.value !== null && ((k = u.toggleItem) == null || k.call(u, t.value), d != null && d.dispatchEvent && d.dispatchEvent(new CustomEvent("selected", { detail: t.value, bubbles: !0 }))), m && m(n);
|
|
72
76
|
}
|
|
73
|
-
const
|
|
77
|
+
const z = r(() => {
|
|
74
78
|
switch (t.variant) {
|
|
75
79
|
case "outlined":
|
|
76
80
|
return "border border-gray-300 dark:border-gray-700";
|
|
@@ -85,7 +89,7 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
85
89
|
default:
|
|
86
90
|
return "";
|
|
87
91
|
}
|
|
88
|
-
}),
|
|
92
|
+
}), F = r(() => {
|
|
89
93
|
switch (t.density) {
|
|
90
94
|
case "comfortable":
|
|
91
95
|
return "py-2";
|
|
@@ -94,12 +98,12 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
94
98
|
default:
|
|
95
99
|
return "py-3";
|
|
96
100
|
}
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
V.value,
|
|
101
|
+
}), U = r(() => t.tile ? "rounded-none" : t.rounded === !0 ? "rounded-md" : t.rounded === !1 ? "" : `rounded-${t.rounded}`), q = r(() => t.ripple ? "relative overflow-hidden" : ""), O = r(() => [
|
|
102
|
+
de,
|
|
100
103
|
z.value,
|
|
101
104
|
F.value,
|
|
102
105
|
U.value,
|
|
106
|
+
q.value,
|
|
103
107
|
t.textColor,
|
|
104
108
|
t.itemPosition,
|
|
105
109
|
t.bgItems,
|
|
@@ -111,14 +115,15 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
111
115
|
},
|
|
112
116
|
t.containerClass
|
|
113
117
|
]);
|
|
114
|
-
return (
|
|
118
|
+
return (n, m) => V.value ? (l(), o(X(Y), {
|
|
115
119
|
key: 0,
|
|
116
120
|
to: e.to,
|
|
117
121
|
replace: e.replace,
|
|
118
122
|
custom: !0
|
|
119
123
|
}, {
|
|
120
|
-
default:
|
|
121
|
-
(
|
|
124
|
+
default: $(({ href: d, navigate: p, isActive: k }) => [
|
|
125
|
+
(l(), o(v(e.tag), h({
|
|
126
|
+
id: E.value,
|
|
122
127
|
ref_key: "liRef",
|
|
123
128
|
ref: f,
|
|
124
129
|
href: d,
|
|
@@ -128,20 +133,20 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
128
133
|
tabindex: "-1",
|
|
129
134
|
class: O.value,
|
|
130
135
|
onClick: (A) => b(A, p),
|
|
131
|
-
onKeydown: L(
|
|
132
|
-
},
|
|
133
|
-
default:
|
|
134
|
-
C("div",
|
|
135
|
-
|
|
136
|
-
c(
|
|
137
|
-
e.prependAvatar ? (
|
|
136
|
+
onKeydown: L(P((A) => b(A, p), ["prevent"]), ["enter"])
|
|
137
|
+
}, n.$attrs), {
|
|
138
|
+
default: $(() => [
|
|
139
|
+
C("div", Z, [
|
|
140
|
+
K.value || n.$slots.prepend ? (l(), a("div", _, [
|
|
141
|
+
c(n.$slots, "prepend", {}, () => [
|
|
142
|
+
e.prependAvatar ? (l(), a("img", {
|
|
138
143
|
key: 0,
|
|
139
144
|
src: e.prependAvatar,
|
|
140
145
|
class: i(["rounded-full", e.prependClass])
|
|
141
|
-
}, null, 10,
|
|
146
|
+
}, null, 10, ee)) : y(e.prependIcon) ? (l(), o(v(e.prependIcon), {
|
|
142
147
|
key: 1,
|
|
143
148
|
class: i(e.prependClass)
|
|
144
|
-
}, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (
|
|
149
|
+
}, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (l(), o(M, {
|
|
145
150
|
key: 2,
|
|
146
151
|
icon: e.prependIcon,
|
|
147
152
|
class: i(e.prependClass)
|
|
@@ -151,32 +156,32 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
151
156
|
C("div", h({
|
|
152
157
|
class: ["flex flex-col min-w-0 flex-1", x.value]
|
|
153
158
|
}, j.value), [
|
|
154
|
-
c(
|
|
155
|
-
c(
|
|
156
|
-
e.title ? (
|
|
159
|
+
c(n.$slots, "default", {}, () => [
|
|
160
|
+
c(n.$slots, "title", {}, () => [
|
|
161
|
+
e.title ? (l(), a("div", {
|
|
157
162
|
key: 0,
|
|
158
163
|
class: i(["truncate", e.titleClass])
|
|
159
164
|
}, I(e.title), 3)) : s("", !0)
|
|
160
165
|
]),
|
|
161
|
-
c(
|
|
162
|
-
e.subtitle ? (
|
|
166
|
+
c(n.$slots, "subtitle", {}, () => [
|
|
167
|
+
e.subtitle ? (l(), a("div", {
|
|
163
168
|
key: 0,
|
|
164
169
|
class: i(["truncate", e.subtitleClass])
|
|
165
170
|
}, I(e.subtitle), 3)) : s("", !0)
|
|
166
171
|
])
|
|
167
172
|
])
|
|
168
173
|
], 16),
|
|
169
|
-
|
|
170
|
-
c(
|
|
171
|
-
e.appendAvatar ? (
|
|
174
|
+
N.value ? (l(), a("div", te, [
|
|
175
|
+
c(n.$slots, "append", {}, () => [
|
|
176
|
+
e.appendAvatar ? (l(), a("img", {
|
|
172
177
|
key: 0,
|
|
173
178
|
src: e.appendAvatar,
|
|
174
179
|
class: "w-8 h-8 rounded-full"
|
|
175
|
-
}, null, 8,
|
|
176
|
-
|
|
180
|
+
}, null, 8, ne)) : s("", !0),
|
|
181
|
+
y(e.appendIcon) ? (l(), o(v(e.appendIcon), {
|
|
177
182
|
key: 1,
|
|
178
183
|
class: "w-5 h-5"
|
|
179
|
-
})) : e.appendIcon ? (
|
|
184
|
+
})) : e.appendIcon ? (l(), a("i", {
|
|
180
185
|
key: 2,
|
|
181
186
|
class: i([e.appendClass, "text-xl leading-none"])
|
|
182
187
|
}, null, 2)) : s("", !0)
|
|
@@ -185,11 +190,12 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
185
190
|
])
|
|
186
191
|
]),
|
|
187
192
|
_: 2
|
|
188
|
-
}, 1040, ["href", "aria-selected", "aria-disabled", "class", "onClick", "onKeydown"]))
|
|
193
|
+
}, 1040, ["id", "href", "aria-selected", "aria-disabled", "class", "onClick", "onKeydown"]))
|
|
189
194
|
]),
|
|
190
195
|
_: 3
|
|
191
|
-
}, 8, ["to", "replace"])) : (
|
|
196
|
+
}, 8, ["to", "replace"])) : (l(), o(v(e.tag), h({
|
|
192
197
|
key: 1,
|
|
198
|
+
id: E.value,
|
|
193
199
|
ref_key: "liRef",
|
|
194
200
|
ref: f,
|
|
195
201
|
role: "option",
|
|
@@ -198,20 +204,20 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
198
204
|
tabindex: "-1",
|
|
199
205
|
class: [O.value],
|
|
200
206
|
onClick: b,
|
|
201
|
-
onKeydown: L(
|
|
202
|
-
},
|
|
203
|
-
default:
|
|
204
|
-
C("div",
|
|
205
|
-
|
|
206
|
-
c(
|
|
207
|
-
e.prependAvatar ? (
|
|
207
|
+
onKeydown: L(P(b, ["prevent"]), ["enter"])
|
|
208
|
+
}, n.$attrs), {
|
|
209
|
+
default: $(() => [
|
|
210
|
+
C("div", le, [
|
|
211
|
+
K.value || n.$slots.prepend ? (l(), a("div", ae, [
|
|
212
|
+
c(n.$slots, "prepend", {}, () => [
|
|
213
|
+
e.prependAvatar ? (l(), a("img", {
|
|
208
214
|
key: 0,
|
|
209
215
|
src: e.prependAvatar,
|
|
210
216
|
class: i(["rounded-full", e.prependClass])
|
|
211
|
-
}, null, 10,
|
|
217
|
+
}, null, 10, se)) : y(e.prependIcon) ? (l(), o(v(e.prependIcon), {
|
|
212
218
|
key: 1,
|
|
213
219
|
class: i(e.prependClass)
|
|
214
|
-
}, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (
|
|
220
|
+
}, null, 8, ["class"])) : typeof e.prependIcon == "string" ? (l(), o(M, {
|
|
215
221
|
key: 2,
|
|
216
222
|
icon: e.prependIcon,
|
|
217
223
|
class: i(e.prependClass)
|
|
@@ -221,32 +227,32 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
221
227
|
C("div", h({
|
|
222
228
|
class: ["flex flex-col min-w-0 flex-1", x.value]
|
|
223
229
|
}, j.value), [
|
|
224
|
-
c(
|
|
225
|
-
c(
|
|
226
|
-
e.title ? (
|
|
230
|
+
c(n.$slots, "default", {}, () => [
|
|
231
|
+
c(n.$slots, "title", {}, () => [
|
|
232
|
+
e.title ? (l(), a("div", {
|
|
227
233
|
key: 0,
|
|
228
234
|
class: i(["truncate", e.titleClass])
|
|
229
235
|
}, I(e.title), 3)) : s("", !0)
|
|
230
236
|
]),
|
|
231
|
-
c(
|
|
232
|
-
e.subtitle ? (
|
|
237
|
+
c(n.$slots, "subtitle", {}, () => [
|
|
238
|
+
e.subtitle ? (l(), a("div", {
|
|
233
239
|
key: 0,
|
|
234
240
|
class: i(["truncate", e.subtitleClass])
|
|
235
241
|
}, I(e.subtitle), 3)) : s("", !0)
|
|
236
242
|
])
|
|
237
243
|
])
|
|
238
244
|
], 16),
|
|
239
|
-
|
|
240
|
-
c(
|
|
241
|
-
e.appendAvatar ? (
|
|
245
|
+
N.value ? (l(), a("div", re, [
|
|
246
|
+
c(n.$slots, "append", {}, () => [
|
|
247
|
+
e.appendAvatar ? (l(), a("img", {
|
|
242
248
|
key: 0,
|
|
243
249
|
src: e.appendAvatar,
|
|
244
250
|
class: "w-8 h-8 rounded-full"
|
|
245
|
-
}, null, 8,
|
|
246
|
-
|
|
251
|
+
}, null, 8, ie)) : s("", !0),
|
|
252
|
+
y(e.appendIcon) ? (l(), o(v(e.appendIcon), {
|
|
247
253
|
key: 1,
|
|
248
254
|
class: "w-5 h-5"
|
|
249
|
-
})) : e.appendIcon ? (
|
|
255
|
+
})) : e.appendIcon ? (l(), a("i", {
|
|
250
256
|
key: 2,
|
|
251
257
|
class: i([e.appendIcon, "text-xl leading-none"])
|
|
252
258
|
}, null, 2)) : s("", !0)
|
|
@@ -255,9 +261,9 @@ const X = { class: "flex w-full items-center" }, Y = {
|
|
|
255
261
|
])
|
|
256
262
|
]),
|
|
257
263
|
_: 3
|
|
258
|
-
}, 16, ["aria-selected", "aria-disabled", "class", "onKeydown"]));
|
|
264
|
+
}, 16, ["id", "aria-selected", "aria-disabled", "class", "onKeydown"]));
|
|
259
265
|
}
|
|
260
266
|
};
|
|
261
267
|
export {
|
|
262
|
-
|
|
268
|
+
fe as default
|
|
263
269
|
};
|