adverich-kun-ui 0.1.358 → 0.1.360
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,231 +1,211 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
import { icons as
|
|
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 = {
|
|
1
|
+
import { mergeModels as R, useModel as S, onMounted as te, ref as _, watch as oe, createElementBlock as C, openBlock as s, createVNode as n, unref as l, isRef as A, createSlots as ie, withCtx as i, createCommentVNode as w, Fragment as ne, renderList as ae, createBlock as m, createElementVNode as re, createTextVNode as V, toDisplayString as z, withModifiers as se } from "vue";
|
|
2
|
+
import { icons as f } from "../../../../icons/index.js";
|
|
3
|
+
import { isNotEmpty as ue, isArray as $ } from "../../../../utils/utils.js";
|
|
4
|
+
import de from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
|
+
import ce from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
+
import x from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
+
import F from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
|
+
import me from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
+
import fe from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
10
|
+
import { useAutocomplete as pe } from "../composables/useAutocomplete.js";
|
|
11
|
+
import { KunAutocompleteProps as he } from "../composables/KunAutocompleteProps.js";
|
|
12
|
+
import ve from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
|
+
import ye from "../../../KunChip/src/components/KunChip.vue.js";
|
|
14
|
+
import v from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
15
|
+
const ke = {
|
|
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
|
+
}, be = { class: "flex justify-center align-center" }, xe = {
|
|
23
19
|
__name: "KunAutocomplete",
|
|
24
|
-
props: /* @__PURE__ */
|
|
20
|
+
props: /* @__PURE__ */ R(he, {
|
|
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:
|
|
36
|
-
search:
|
|
37
|
-
removeItem:
|
|
38
|
-
clearSelection:
|
|
39
|
-
lightReset:
|
|
40
|
-
openMenu:
|
|
41
|
-
closeMenu:
|
|
42
|
-
toggleMenu:
|
|
43
|
-
onMenuKeydown:
|
|
44
|
-
getSelectedItem:
|
|
45
|
-
textArr:
|
|
46
|
-
getItemText:
|
|
47
|
-
isAlphanumeric:
|
|
48
|
-
|
|
49
|
-
checkDisabled: Q,
|
|
26
|
+
emits: /* @__PURE__ */ R(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
27
|
+
setup(y, { emit: B }) {
|
|
28
|
+
const a = S(y, "modelValue"), I = S(y, "items"), u = y, p = B, {
|
|
29
|
+
textFieldRef: k,
|
|
30
|
+
listRef: b,
|
|
31
|
+
menuModel: r,
|
|
32
|
+
search: c,
|
|
33
|
+
removeItem: E,
|
|
34
|
+
clearSelection: N,
|
|
35
|
+
lightReset: T,
|
|
36
|
+
openMenu: g,
|
|
37
|
+
closeMenu: L,
|
|
38
|
+
toggleMenu: U,
|
|
39
|
+
onMenuKeydown: H,
|
|
40
|
+
getSelectedItem: O,
|
|
41
|
+
textArr: j,
|
|
42
|
+
getItemText: q,
|
|
43
|
+
isAlphanumeric: P,
|
|
44
|
+
checkDisabled: W,
|
|
50
45
|
itemToString: D,
|
|
51
|
-
placeholder:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
u.focusOnRender &&
|
|
46
|
+
placeholder: G
|
|
47
|
+
} = pe(u, p, a, I);
|
|
48
|
+
te(() => {
|
|
49
|
+
u.focusOnRender && k.value.focus();
|
|
55
50
|
});
|
|
56
|
-
const K =
|
|
51
|
+
const K = _(null), h = _(""), M = (e) => {
|
|
57
52
|
for (const o of u.rules) {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
return
|
|
53
|
+
const t = o(e);
|
|
54
|
+
if (t !== !0)
|
|
55
|
+
return h.value = t, p("validation", !1), !1;
|
|
61
56
|
}
|
|
62
|
-
return
|
|
57
|
+
return h.value = "", p("validation", !0), !0;
|
|
63
58
|
};
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
oe(() => a.value, (e, o) => {
|
|
60
|
+
ue(u.rules) && M(e);
|
|
66
61
|
});
|
|
67
|
-
function
|
|
62
|
+
function J() {
|
|
68
63
|
var e;
|
|
69
|
-
|
|
64
|
+
r.value = !1, (e = k.value.inputField) == null || e.focus();
|
|
70
65
|
}
|
|
71
|
-
function
|
|
72
|
-
var
|
|
66
|
+
function Q(e) {
|
|
67
|
+
var t, d;
|
|
73
68
|
const o = e.key;
|
|
74
69
|
if (o === "Tab" || o === "Shift") {
|
|
75
|
-
|
|
70
|
+
L();
|
|
76
71
|
return;
|
|
77
72
|
}
|
|
78
|
-
(
|
|
73
|
+
(P(o) || o === "Backspace") && g(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), r.value || g(), console.log("listRef.value", b.value), (d = (t = b.value) == null ? void 0 : t.focusWithKey) == null || d.call(t, o));
|
|
79
74
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
75
|
+
function X(e) {
|
|
76
|
+
p("search", c);
|
|
82
77
|
}
|
|
83
|
-
function
|
|
78
|
+
function Y() {
|
|
84
79
|
M(a);
|
|
85
80
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
81
|
+
function Z(e) {
|
|
82
|
+
H(e);
|
|
88
83
|
}
|
|
89
|
-
function
|
|
84
|
+
function ee() {
|
|
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
89
|
ref: K
|
|
95
90
|
}, [
|
|
96
|
-
|
|
97
|
-
modelValue:
|
|
91
|
+
n(ve, {
|
|
92
|
+
modelValue: l(c),
|
|
98
93
|
"onUpdate:modelValue": [
|
|
99
|
-
o[1] || (o[1] = (
|
|
100
|
-
|
|
94
|
+
o[1] || (o[1] = (t) => A(c) ? c.value = t : null),
|
|
95
|
+
X
|
|
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:
|
|
110
|
-
onHandleClick:
|
|
111
|
-
rounded:
|
|
112
|
-
onBlur:
|
|
113
|
-
onKeyDown:
|
|
114
|
-
placeholder: u.multiple &&
|
|
115
|
-
error: !!
|
|
116
|
-
"error-messages":
|
|
117
|
-
},
|
|
118
|
-
default:
|
|
119
|
-
|
|
120
|
-
(
|
|
121
|
-
key:
|
|
104
|
+
onFocusInput: Y,
|
|
105
|
+
onHandleClick: l(U),
|
|
106
|
+
rounded: l(r) ? "rounded-t" : "rounded",
|
|
107
|
+
onBlur: ee,
|
|
108
|
+
onKeyDown: Q,
|
|
109
|
+
placeholder: u.multiple && l($)(a.value) && a.value.length ? "" : l(G),
|
|
110
|
+
error: !!h.value,
|
|
111
|
+
"error-messages": h.value
|
|
112
|
+
}, ie({
|
|
113
|
+
default: i(() => [
|
|
114
|
+
l($)(a.value) ? (s(), C("div", ke, [
|
|
115
|
+
(s(!0), C(ne, null, ae(a.value, (t) => (s(), m(ye, {
|
|
116
|
+
key: t.id ?? t.name,
|
|
122
117
|
size: "small",
|
|
123
118
|
class: "ml-1"
|
|
124
119
|
}, {
|
|
125
|
-
default:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
default: i(() => [
|
|
121
|
+
re("div", be, [
|
|
122
|
+
V(z(l(q)(t, e.itemTitle)) + " ", 1),
|
|
123
|
+
n(v, {
|
|
129
124
|
color: "error",
|
|
130
|
-
icon:
|
|
125
|
+
icon: l(f).close,
|
|
131
126
|
size: "small",
|
|
132
127
|
class: "ml-1",
|
|
133
|
-
onClick: (
|
|
128
|
+
onClick: (d) => l(E)(t)
|
|
134
129
|
}, null, 8, ["icon", "onClick"])
|
|
135
130
|
])
|
|
136
131
|
]),
|
|
137
132
|
_: 2
|
|
138
133
|
}, 1024))), 128))
|
|
139
|
-
])) :
|
|
140
|
-
|
|
134
|
+
])) : w("", !0),
|
|
135
|
+
n(fe, {
|
|
141
136
|
transition: "fade",
|
|
142
|
-
"onClick:outside":
|
|
143
|
-
modelValue:
|
|
144
|
-
"onUpdate:modelValue": o[0] || (o[0] = (
|
|
137
|
+
"onClick:outside": l(T),
|
|
138
|
+
modelValue: l(r),
|
|
139
|
+
"onUpdate:modelValue": o[0] || (o[0] = (t) => A(r) ? r.value = t : null),
|
|
145
140
|
activator: "parent",
|
|
146
141
|
"z-index": e.zIndex,
|
|
147
142
|
"parent-ref": K.value,
|
|
148
143
|
location: "bottom",
|
|
149
144
|
origin: "bottom left",
|
|
150
|
-
onHandleEscape:
|
|
145
|
+
onHandleEscape: J,
|
|
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
|
-
default:
|
|
157
|
-
|
|
158
|
-
|
|
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, {
|
|
170
|
-
"onClick:select": t(q),
|
|
151
|
+
default: i(() => [
|
|
152
|
+
n(ce, {
|
|
153
|
+
"onClick:select": l(O),
|
|
171
154
|
ref_key: "listRef",
|
|
172
|
-
ref:
|
|
173
|
-
onKeyDown:
|
|
155
|
+
ref: b,
|
|
156
|
+
onKeyDown: Z,
|
|
174
157
|
selectable: !0
|
|
175
158
|
}, {
|
|
176
|
-
default:
|
|
177
|
-
|
|
159
|
+
default: i(() => [
|
|
160
|
+
n(de, {
|
|
178
161
|
items: I.value,
|
|
179
|
-
search:
|
|
162
|
+
search: l(c),
|
|
180
163
|
"searchable-keys": u.searchableKeys,
|
|
181
164
|
virtual: !1,
|
|
182
165
|
"items-per-intersection": 10,
|
|
183
|
-
enabled:
|
|
166
|
+
enabled: l(r),
|
|
184
167
|
"item-height": 48
|
|
185
168
|
}, {
|
|
186
|
-
default:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}))
|
|
227
|
-
];
|
|
228
|
-
}),
|
|
169
|
+
default: i(({ item: t, index: d, empty: le }) => [
|
|
170
|
+
!le && t ? (s(), m(x, {
|
|
171
|
+
value: t,
|
|
172
|
+
key: d + 1,
|
|
173
|
+
id: d + 1,
|
|
174
|
+
disabled: l(W)(t),
|
|
175
|
+
"bg-items": e.bgItemListColor,
|
|
176
|
+
"hover-bg": e.hoverItemListColor,
|
|
177
|
+
activeClass: e.selectedItemListColor,
|
|
178
|
+
density: e.density,
|
|
179
|
+
selectable: !0
|
|
180
|
+
}, {
|
|
181
|
+
default: i(() => [
|
|
182
|
+
n(F, { class: "text-wrap" }, {
|
|
183
|
+
default: i(() => [
|
|
184
|
+
V(z(l(D)(t, e.itemTitle ?? l(j), "hasDefault")), 1)
|
|
185
|
+
]),
|
|
186
|
+
_: 2
|
|
187
|
+
}, 1024),
|
|
188
|
+
n(me, {
|
|
189
|
+
text: e.itemSubtitle ? l(D)(t, e.itemSubtitle) : ""
|
|
190
|
+
}, null, 8, ["text"])
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (s(), m(x, {
|
|
194
|
+
key: 1,
|
|
195
|
+
disabled: ""
|
|
196
|
+
}, {
|
|
197
|
+
default: i(() => [
|
|
198
|
+
n(F, { class: "text-center w-full text-gray-500" }, {
|
|
199
|
+
default: i(() => o[2] || (o[2] = [
|
|
200
|
+
V(" No hay elementos disponibles ")
|
|
201
|
+
])),
|
|
202
|
+
_: 1,
|
|
203
|
+
__: [2]
|
|
204
|
+
})
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
}))
|
|
208
|
+
]),
|
|
229
209
|
_: 1
|
|
230
210
|
}, 8, ["items", "search", "searchable-keys", "enabled"])
|
|
231
211
|
]),
|
|
@@ -239,29 +219,29 @@ const Ve = {
|
|
|
239
219
|
}, [
|
|
240
220
|
e.hasIcons ? {
|
|
241
221
|
name: "append-inner",
|
|
242
|
-
fn:
|
|
243
|
-
e.clearable && a.value ? (
|
|
222
|
+
fn: i(() => [
|
|
223
|
+
e.clearable && a.value ? (s(), m(v, {
|
|
244
224
|
key: 0,
|
|
245
|
-
onClick:
|
|
225
|
+
onClick: l(N),
|
|
246
226
|
size: "small",
|
|
247
227
|
color: "error",
|
|
248
|
-
icon:
|
|
228
|
+
icon: l(f).close,
|
|
249
229
|
class: "mr-1 mt-1"
|
|
250
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
251
|
-
|
|
230
|
+
}, null, 8, ["onClick", "icon"])) : w("", !0),
|
|
231
|
+
n(v, {
|
|
252
232
|
color: "teal-darken-1",
|
|
253
233
|
size: "large",
|
|
254
234
|
class: "cursor-pointer",
|
|
255
|
-
icon:
|
|
256
|
-
onClick:
|
|
235
|
+
icon: l(r) ? l(f).menuUpOutline : l(f).menuDownOutline,
|
|
236
|
+
onClick: se(l(g), ["stop"])
|
|
257
237
|
}, null, 8, ["icon", "onClick"]),
|
|
258
|
-
e.required ? (
|
|
238
|
+
e.required ? (s(), m(v, {
|
|
259
239
|
key: 1,
|
|
260
240
|
color: "teal-darken-1",
|
|
261
241
|
size: "x-small",
|
|
262
242
|
class: "mb-4",
|
|
263
|
-
icon:
|
|
264
|
-
}, null, 8, ["icon"])) :
|
|
243
|
+
icon: l(f).asterisk
|
|
244
|
+
}, null, 8, ["icon"])) : w("", !0)
|
|
265
245
|
]),
|
|
266
246
|
key: "0"
|
|
267
247
|
} : void 0
|
|
@@ -270,5 +250,5 @@ const Ve = {
|
|
|
270
250
|
}
|
|
271
251
|
};
|
|
272
252
|
export {
|
|
273
|
-
|
|
253
|
+
xe as default
|
|
274
254
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as g, ref as
|
|
1
|
+
import { mergeModels as g, ref as v, useModel as D, provide as p, computed as B, onUpdated as C, createElementBlock as M, openBlock as S, mergeProps as I, withModifiers as E, renderSlot as L } from "vue";
|
|
2
2
|
const R = {
|
|
3
3
|
__name: "KunList",
|
|
4
4
|
props: /* @__PURE__ */ g({
|
|
@@ -21,32 +21,38 @@ const R = {
|
|
|
21
21
|
selectedModifiers: {}
|
|
22
22
|
}),
|
|
23
23
|
emits: /* @__PURE__ */ g(["keyDown", "click:select", "update:selected"], ["update:selected"]),
|
|
24
|
-
setup(o, { expose:
|
|
25
|
-
const
|
|
24
|
+
setup(o, { expose: w, emit: b }) {
|
|
25
|
+
const c = o, a = b, f = v(null), s = v([]), i = D(o, "selected");
|
|
26
26
|
p("registerListItemRef", (e) => {
|
|
27
|
-
e && !
|
|
27
|
+
e ? e.isConnected && !s.value.includes(e) && (s.value.push(e), s.value.sort((t, n) => {
|
|
28
|
+
const r = t.id ?? "", l = n.id ?? "";
|
|
29
|
+
return r.localeCompare(l, void 0, { numeric: !0, sensitivity: "base" });
|
|
30
|
+
})) : s.value = s.value.filter((t) => t && t.isConnected);
|
|
28
31
|
});
|
|
29
|
-
const m = B(() =>
|
|
30
|
-
function
|
|
31
|
-
if (!(!
|
|
32
|
+
const m = B(() => c.selectable && c.selectionMode === "multiple");
|
|
33
|
+
function y(e) {
|
|
34
|
+
if (!(!c.selectable || e == null))
|
|
32
35
|
if (m.value) {
|
|
33
|
-
const t =
|
|
34
|
-
|
|
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
|
+
s.value = s.value.filter((e) => e && e.isConnected);
|
|
43
|
+
});
|
|
38
44
|
function k(e) {
|
|
39
45
|
var t, n;
|
|
40
|
-
return !
|
|
46
|
+
return !c.selectable || e == null ? !1 : m.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
53
|
var r;
|
|
48
54
|
a("keyDown", e);
|
|
49
|
-
const t = e.key, n =
|
|
55
|
+
const t = e.key, n = s.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;
|
|
@@ -58,20 +64,20 @@ const R = {
|
|
|
58
64
|
const l = n.findIndex((x) => x === document.activeElement);
|
|
59
65
|
let d = -1;
|
|
60
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);
|
|
61
|
-
const
|
|
62
|
-
(r =
|
|
67
|
+
const u = n[d];
|
|
68
|
+
(r = u == null ? void 0 : u.focus) == null || r.call(u);
|
|
63
69
|
return;
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
function h(e = "ArrowDown") {
|
|
68
74
|
var l;
|
|
69
|
-
const t =
|
|
75
|
+
const t = s.value.filter(Boolean);
|
|
70
76
|
if (!t.length) return;
|
|
71
77
|
const n = e === "ArrowDown" ? 0 : t.length - 1, r = t[n];
|
|
72
78
|
(l = r == null ? void 0 : r.focus) == null || l.call(r);
|
|
73
79
|
}
|
|
74
|
-
return
|
|
80
|
+
return w({ focusWithKey: h, 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
83
|
} }), (e, t) => (S(), M("ul", I({
|
|
@@ -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
|
};
|