adverich-kun-ui 0.1.489 → 0.1.491
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,157 +1,160 @@
|
|
|
1
|
-
import { mergeModels as $, useModel 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
|
|
1
|
+
import { mergeModels as $, useModel as x, onMounted as se, ref as z, watch as ue, nextTick as A, createElementBlock as y, openBlock as u, createVNode as i, unref as o, withKeys as de, withModifiers as E, isRef as _, createSlots as ce, withCtx as n, createCommentVNode as g, normalizeClass as fe, createTextVNode as b, toDisplayString as V, createBlock as v, Fragment as me, renderList as pe, createElementVNode as ve } from "vue";
|
|
2
|
+
import { icons as k } from "../../../../icons/index.js";
|
|
3
|
+
import { isNotEmpty as O, isArray as R } from "../../../../utils/utils.js";
|
|
4
|
+
import ke from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
|
+
import he from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
+
import B from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
+
import F from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
|
+
import ye from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
+
import ge from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
10
|
+
import { useAutocomplete as be } from "../composables/useAutocomplete.js";
|
|
11
|
+
import { KunAutocompleteProps as Ce } from "../composables/KunAutocompleteProps.js";
|
|
12
|
+
import we from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
|
+
import Se from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
14
|
+
import Ve from "../../../KunChip/src/components/KunChip.vue.js";
|
|
15
15
|
import C from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
16
|
-
const
|
|
16
|
+
const De = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "flex flex-nowrap items-center space-x-1 min-w-3xs max-w-full overflow-x-auto overflow-y-hidden"
|
|
19
|
-
},
|
|
19
|
+
}, Ie = { class: "flex items-center" }, Ke = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "sticky top-0 z-10 p-2 border-b bg-select-background"
|
|
22
|
-
},
|
|
22
|
+
}, je = {
|
|
23
23
|
__name: "KunAutocomplete",
|
|
24
|
-
props: /* @__PURE__ */ $(
|
|
24
|
+
props: /* @__PURE__ */ $(Ce, {
|
|
25
25
|
modelValue: { default: null },
|
|
26
26
|
modelModifiers: {},
|
|
27
27
|
items: { default: [], type: Array, required: !0 },
|
|
28
28
|
itemsModifiers: {}
|
|
29
29
|
}),
|
|
30
30
|
emits: /* @__PURE__ */ $(["update:modelValue", "selectedItem", "createItem", "validation", "search", "keyDown", "keyDownEnter"], ["update:modelValue", "update:items"]),
|
|
31
|
-
setup(w, { expose:
|
|
32
|
-
const
|
|
33
|
-
textFieldRef:
|
|
31
|
+
setup(w, { expose: T, emit: N }) {
|
|
32
|
+
const s = x(w, "modelValue"), m = x(w, "items"), r = w, c = N, {
|
|
33
|
+
textFieldRef: p,
|
|
34
34
|
listRef: D,
|
|
35
35
|
menuModel: d,
|
|
36
|
-
search:
|
|
37
|
-
removeItem:
|
|
38
|
-
clearSelection:
|
|
39
|
-
lightReset:
|
|
36
|
+
search: a,
|
|
37
|
+
removeItem: U,
|
|
38
|
+
clearSelection: j,
|
|
39
|
+
lightReset: H,
|
|
40
40
|
openMenu: S,
|
|
41
|
-
closeMenu:
|
|
42
|
-
toggleMenu:
|
|
43
|
-
onMenuKeydown:
|
|
41
|
+
closeMenu: q,
|
|
42
|
+
toggleMenu: P,
|
|
43
|
+
onMenuKeydown: W,
|
|
44
44
|
getSelectedItem: I,
|
|
45
|
-
textArr:
|
|
46
|
-
getArrayText:
|
|
47
|
-
isAlphanumeric:
|
|
48
|
-
createItem:
|
|
49
|
-
checkDisabled:
|
|
45
|
+
textArr: G,
|
|
46
|
+
getArrayText: J,
|
|
47
|
+
isAlphanumeric: Q,
|
|
48
|
+
createItem: X,
|
|
49
|
+
checkDisabled: Y,
|
|
50
50
|
itemToString: K,
|
|
51
|
-
placeholder:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
placeholder: Z
|
|
52
|
+
} = be(r, c, s, m);
|
|
53
|
+
se(() => {
|
|
54
|
+
r.focusOnRender && p.value.focus();
|
|
55
55
|
});
|
|
56
|
-
const L =
|
|
57
|
-
for (const
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
return h.value =
|
|
56
|
+
const L = z(null), h = z(""), M = (e) => {
|
|
57
|
+
for (const l of r.rules) {
|
|
58
|
+
const t = l(e);
|
|
59
|
+
if (t !== !0)
|
|
60
|
+
return h.value = t, c("validation", !1), !1;
|
|
61
61
|
}
|
|
62
62
|
return h.value = "", c("validation", !0), !0;
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
ue(() => s.value, (e, l) => {
|
|
65
|
+
O(r.rules) && M(e);
|
|
66
66
|
});
|
|
67
|
-
function
|
|
67
|
+
function ee() {
|
|
68
68
|
var e;
|
|
69
|
-
d.value = !1, (e =
|
|
69
|
+
d.value = !1, (e = p.value.inputField) == null || e.focus();
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
var
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
|
|
71
|
+
function le(e) {
|
|
72
|
+
var t, f;
|
|
73
|
+
const l = e.key;
|
|
74
|
+
if (l === "Tab" || l === "Shift" || l === "Escape") {
|
|
75
|
+
q(), c("keyDown", l);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
(
|
|
79
|
-
}
|
|
80
|
-
function le(e) {
|
|
81
|
-
c("search", r);
|
|
78
|
+
(Q(l) || l === "Backspace") && S(), ["ArrowUp", "ArrowDown"].includes(l) && (e.preventDefault(), d.value || S(), (f = (t = D.value) == null ? void 0 : t.focusWithKey) == null || f.call(t, l));
|
|
82
79
|
}
|
|
83
|
-
function te() {
|
|
84
|
-
|
|
80
|
+
function te(e) {
|
|
81
|
+
c("search", a);
|
|
85
82
|
}
|
|
86
|
-
function oe(
|
|
87
|
-
|
|
83
|
+
function oe() {
|
|
84
|
+
M(s);
|
|
88
85
|
}
|
|
89
|
-
function ne() {
|
|
86
|
+
function ne(e) {
|
|
87
|
+
W(e);
|
|
90
88
|
}
|
|
91
89
|
function re() {
|
|
92
|
-
|
|
90
|
+
}
|
|
91
|
+
function ae() {
|
|
92
|
+
if (!a.value) return;
|
|
93
93
|
let e = null;
|
|
94
|
-
|
|
95
|
-
(
|
|
96
|
-
(
|
|
94
|
+
r.returnObject ? e = m.value.find(
|
|
95
|
+
(l) => Object.values(l).some(
|
|
96
|
+
(t) => String(t).toLowerCase() === String(a.value).toLowerCase()
|
|
97
97
|
)
|
|
98
|
-
) :
|
|
99
|
-
(
|
|
100
|
-
) : e =
|
|
101
|
-
(
|
|
102
|
-
), e && I(e),
|
|
98
|
+
) : r.itemValue ? e = m.value.find(
|
|
99
|
+
(l) => String(l[r.itemValue]).toLowerCase() === String(a.value).toLowerCase()
|
|
100
|
+
) : e = m.value.find(
|
|
101
|
+
(l) => typeof l == "object" ? Object.values(l).some((t) => String(t).toLowerCase() === String(a.value).toLowerCase()) : String(l).toLowerCase() === String(a.value).toLowerCase()
|
|
102
|
+
), e && (I(e), r.focusOnSelect && A(() => {
|
|
103
|
+
var l;
|
|
104
|
+
(l = p.value) == null || l.focus();
|
|
105
|
+
})), c("keyDownEnter");
|
|
103
106
|
}
|
|
104
|
-
return
|
|
105
|
-
focus: () => {
|
|
107
|
+
return T({
|
|
108
|
+
focus: () => A(() => {
|
|
106
109
|
var e;
|
|
107
|
-
(e =
|
|
108
|
-
}
|
|
109
|
-
}), (e,
|
|
110
|
+
return (e = p.value) == null ? void 0 : e.focus();
|
|
111
|
+
})
|
|
112
|
+
}), (e, l) => (u(), y("div", {
|
|
110
113
|
class: "w-full h-fit",
|
|
111
114
|
ref_key: "parentRef",
|
|
112
115
|
ref: L
|
|
113
116
|
}, [
|
|
114
|
-
|
|
115
|
-
modelValue:
|
|
117
|
+
i(we, {
|
|
118
|
+
modelValue: o(a),
|
|
116
119
|
"onUpdate:modelValue": [
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
l[1] || (l[1] = (t) => _(a) ? a.value = t : null),
|
|
121
|
+
te
|
|
119
122
|
],
|
|
120
123
|
label: e.label,
|
|
121
124
|
dirty: "",
|
|
122
125
|
"hide-details": e.hideDetails,
|
|
123
126
|
density: e.density,
|
|
124
127
|
ref_key: "textFieldRef",
|
|
125
|
-
ref:
|
|
128
|
+
ref: p,
|
|
126
129
|
autocomplete: "off",
|
|
127
|
-
onFocusInput:
|
|
128
|
-
onHandleClick:
|
|
129
|
-
rounded:
|
|
130
|
-
onBlur:
|
|
130
|
+
onFocusInput: oe,
|
|
131
|
+
onHandleClick: o(P),
|
|
132
|
+
rounded: o(d) ? "rounded-t" : "rounded",
|
|
133
|
+
onBlur: re,
|
|
131
134
|
onKeyDown: [
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
le,
|
|
136
|
+
de(E(ae, ["prevent"]), ["enter"])
|
|
134
137
|
],
|
|
135
|
-
placeholder:
|
|
138
|
+
placeholder: r.multiple && o(R)(s.value) && s.value.length ? "" : o(Z),
|
|
136
139
|
error: !!h.value,
|
|
137
140
|
"error-messages": h.value
|
|
138
|
-
},
|
|
141
|
+
}, ce({
|
|
139
142
|
"prepend-input-content": n(() => [
|
|
140
|
-
|
|
141
|
-
(u(!0), y(me, null,
|
|
142
|
-
key:
|
|
143
|
+
o(R)(s.value) && o(O)(s.value) ? (u(), y("div", De, [
|
|
144
|
+
(u(!0), y(me, null, pe(s.value, (t) => (u(), v(Ve, {
|
|
145
|
+
key: t.id ?? t.name,
|
|
143
146
|
size: "small",
|
|
144
147
|
variant: "pill"
|
|
145
148
|
}, {
|
|
146
149
|
default: n(() => [
|
|
147
|
-
|
|
148
|
-
b(V(
|
|
149
|
-
|
|
150
|
+
ve("div", Ie, [
|
|
151
|
+
b(V(o(J)(t)) + " ", 1),
|
|
152
|
+
i(C, {
|
|
150
153
|
color: "error",
|
|
151
|
-
icon:
|
|
154
|
+
icon: o(k).close,
|
|
152
155
|
size: "small",
|
|
153
156
|
class: "ml-1",
|
|
154
|
-
onClick: (
|
|
157
|
+
onClick: (f) => o(U)(t)
|
|
155
158
|
}, null, 8, ["icon", "onClick"])
|
|
156
159
|
])
|
|
157
160
|
]),
|
|
@@ -160,16 +163,16 @@ const Ve = {
|
|
|
160
163
|
])) : g("", !0)
|
|
161
164
|
]),
|
|
162
165
|
default: n(() => [
|
|
163
|
-
|
|
166
|
+
i(ge, {
|
|
164
167
|
transition: "fade",
|
|
165
|
-
"onClick:outside":
|
|
166
|
-
modelValue:
|
|
167
|
-
"onUpdate:modelValue":
|
|
168
|
+
"onClick:outside": o(H),
|
|
169
|
+
modelValue: o(d),
|
|
170
|
+
"onUpdate:modelValue": l[0] || (l[0] = (t) => _(d) ? d.value = t : null),
|
|
168
171
|
activator: "parent",
|
|
169
172
|
"z-index": e.zIndex,
|
|
170
173
|
"parent-ref": L.value,
|
|
171
174
|
origin: e.menuOrigin,
|
|
172
|
-
onHandleEscape:
|
|
175
|
+
onHandleEscape: ee,
|
|
173
176
|
bgColor: e.bgMenuColor,
|
|
174
177
|
"close-on-content-click": e.closeOnSelect,
|
|
175
178
|
width: "w-full",
|
|
@@ -177,11 +180,11 @@ const Ve = {
|
|
|
177
180
|
"hide-details": e.hideDetails
|
|
178
181
|
}, {
|
|
179
182
|
default: n(() => [
|
|
180
|
-
e.hasCreateItem ? (u(), y("div",
|
|
181
|
-
|
|
182
|
-
onClick:
|
|
183
|
+
e.hasCreateItem ? (u(), y("div", Ke, [
|
|
184
|
+
i(Se, {
|
|
185
|
+
onClick: o(X),
|
|
183
186
|
bgColor: e.btnCreateBg,
|
|
184
|
-
class:
|
|
187
|
+
class: fe(e.btnCreateClass)
|
|
185
188
|
}, {
|
|
186
189
|
default: n(() => [
|
|
187
190
|
b(V(e.btnCreateText), 1)
|
|
@@ -189,29 +192,29 @@ const Ve = {
|
|
|
189
192
|
_: 1
|
|
190
193
|
}, 8, ["onClick", "bgColor", "class"])
|
|
191
194
|
])) : g("", !0),
|
|
192
|
-
|
|
193
|
-
"onClick:select":
|
|
195
|
+
i(he, {
|
|
196
|
+
"onClick:select": o(I),
|
|
194
197
|
ref_key: "listRef",
|
|
195
198
|
ref: D,
|
|
196
|
-
onKeyDown:
|
|
199
|
+
onKeyDown: ne,
|
|
197
200
|
selectable: !0
|
|
198
201
|
}, {
|
|
199
202
|
default: n(() => [
|
|
200
|
-
|
|
201
|
-
items:
|
|
202
|
-
search:
|
|
203
|
-
"searchable-keys":
|
|
203
|
+
i(ke, {
|
|
204
|
+
items: m.value,
|
|
205
|
+
search: o(a),
|
|
206
|
+
"searchable-keys": r.searchableKeys,
|
|
204
207
|
virtual: !1,
|
|
205
208
|
"items-per-intersection": 10,
|
|
206
|
-
enabled:
|
|
209
|
+
enabled: o(d),
|
|
207
210
|
"item-height": 48
|
|
208
211
|
}, {
|
|
209
|
-
default: n(({ item:
|
|
210
|
-
!
|
|
211
|
-
value:
|
|
212
|
-
key: `kun-list-${
|
|
213
|
-
id: `kun-item-${
|
|
214
|
-
disabled:
|
|
212
|
+
default: n(({ item: t, index: f, empty: ie }) => [
|
|
213
|
+
!ie && t != null ? (u(), v(B, {
|
|
214
|
+
value: t,
|
|
215
|
+
key: `kun-list-${f + 1}`,
|
|
216
|
+
id: `kun-item-${f + 1}`,
|
|
217
|
+
disabled: o(Y)(t),
|
|
215
218
|
"bg-items": e.bgItemListColor,
|
|
216
219
|
"hover-bg": e.hoverItemListColor,
|
|
217
220
|
activeClass: e.selectedItemListColor,
|
|
@@ -219,24 +222,24 @@ const Ve = {
|
|
|
219
222
|
selectable: !0
|
|
220
223
|
}, {
|
|
221
224
|
default: n(() => [
|
|
222
|
-
|
|
225
|
+
i(F, { class: "text-wrap" }, {
|
|
223
226
|
default: n(() => [
|
|
224
|
-
b(V(
|
|
227
|
+
b(V(o(K)(t, e.itemTitle ?? o(G), "hasDefault")), 1)
|
|
225
228
|
]),
|
|
226
229
|
_: 2
|
|
227
230
|
}, 1024),
|
|
228
|
-
|
|
229
|
-
text: e.itemSubtitle ?
|
|
231
|
+
i(ye, {
|
|
232
|
+
text: e.itemSubtitle ? o(K)(t, e.itemSubtitle) : ""
|
|
230
233
|
}, null, 8, ["text"])
|
|
231
234
|
]),
|
|
232
235
|
_: 2
|
|
233
|
-
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (u(),
|
|
236
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (u(), v(B, {
|
|
234
237
|
key: 1,
|
|
235
238
|
disabled: ""
|
|
236
239
|
}, {
|
|
237
240
|
default: n(() => [
|
|
238
|
-
|
|
239
|
-
default: n(() =>
|
|
241
|
+
i(F, { class: "text-center w-full text-gray-500" }, {
|
|
242
|
+
default: n(() => l[2] || (l[2] = [
|
|
240
243
|
b(" No hay elementos disponibles ")
|
|
241
244
|
])),
|
|
242
245
|
_: 1,
|
|
@@ -260,27 +263,27 @@ const Ve = {
|
|
|
260
263
|
e.hasIcons ? {
|
|
261
264
|
name: "append-inner",
|
|
262
265
|
fn: n(() => [
|
|
263
|
-
e.clearable &&
|
|
266
|
+
e.clearable && s.value ? (u(), v(C, {
|
|
264
267
|
key: 0,
|
|
265
|
-
onClick:
|
|
268
|
+
onClick: o(j),
|
|
266
269
|
size: "small",
|
|
267
270
|
color: "error",
|
|
268
|
-
icon:
|
|
271
|
+
icon: o(k).close,
|
|
269
272
|
class: "mr-1 mt-1"
|
|
270
273
|
}, null, 8, ["onClick", "icon"])) : g("", !0),
|
|
271
|
-
|
|
274
|
+
i(C, {
|
|
272
275
|
color: "teal-darken-1",
|
|
273
276
|
size: "large",
|
|
274
277
|
class: "cursor-pointer",
|
|
275
|
-
icon:
|
|
276
|
-
onClick: E(
|
|
278
|
+
icon: o(d) ? o(k).menuUpOutline : o(k).menuDownOutline,
|
|
279
|
+
onClick: E(o(S), ["stop"])
|
|
277
280
|
}, null, 8, ["icon", "onClick"]),
|
|
278
|
-
e.required ? (u(),
|
|
281
|
+
e.required ? (u(), v(C, {
|
|
279
282
|
key: 1,
|
|
280
283
|
color: "teal-darken-1",
|
|
281
284
|
size: "x-small",
|
|
282
285
|
class: "mb-4",
|
|
283
|
-
icon:
|
|
286
|
+
icon: o(k).asterisk
|
|
284
287
|
}, null, 8, ["icon"])) : g("", !0)
|
|
285
288
|
]),
|
|
286
289
|
key: "0"
|
|
@@ -290,5 +293,5 @@ const Ve = {
|
|
|
290
293
|
}
|
|
291
294
|
};
|
|
292
295
|
export {
|
|
293
|
-
|
|
296
|
+
je as default
|
|
294
297
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getCurrentInstance as z, useSlots as E,
|
|
2
|
-
import { KunNumberFieldProps as
|
|
1
|
+
import { getCurrentInstance as z, useSlots as E, nextTick as P, computed as R, createElementBlock as l, openBlock as r, createCommentVNode as n, createElementVNode as d, normalizeClass as y, toDisplayString as u, mergeProps as U, unref as o, createBlock as I, renderSlot as x, createVNode as V, withCtx as H, Fragment as j, renderList as L } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as T } from "../composables/KunNumberFieldProps.js";
|
|
3
3
|
import { useKunNumberField as q } from "../composables/useKunNumberFieldComposable.js";
|
|
4
4
|
import G from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
5
5
|
import f from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
@@ -7,42 +7,42 @@ import J from "../../../../icons/IconClose.vue.js";
|
|
|
7
7
|
const O = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "h-full"
|
|
10
|
-
}, Q = ["disabled"],
|
|
10
|
+
}, Q = ["disabled"], W = {
|
|
11
11
|
key: 1,
|
|
12
12
|
class: "mx-2"
|
|
13
|
-
},
|
|
13
|
+
}, X = {
|
|
14
14
|
key: 2,
|
|
15
15
|
class: "flex items-center justify-center h-full pl-2"
|
|
16
|
-
},
|
|
16
|
+
}, Y = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], Z = {
|
|
17
17
|
key: 3,
|
|
18
18
|
class: "px-2"
|
|
19
|
-
},
|
|
19
|
+
}, _ = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "flex items-center h-full"
|
|
22
|
-
},
|
|
22
|
+
}, ee = ["disabled"], te = ["disabled"], oe = {
|
|
23
23
|
key: 1,
|
|
24
24
|
class: "flex flex-col items-center justify-center border-l border-slate-600"
|
|
25
|
-
},
|
|
25
|
+
}, re = ["disabled"], se = ["disabled"], le = {
|
|
26
26
|
key: 5,
|
|
27
27
|
class: "flex items-center justify-center h-full pr-1"
|
|
28
|
-
},
|
|
28
|
+
}, ne = {
|
|
29
29
|
key: 6,
|
|
30
30
|
class: "h-full"
|
|
31
|
-
},
|
|
31
|
+
}, de = ["disabled"], ie = {
|
|
32
32
|
key: 7,
|
|
33
33
|
class: "ml-2"
|
|
34
|
-
},
|
|
34
|
+
}, ae = {
|
|
35
35
|
key: 0,
|
|
36
36
|
class: "h-[1.25rem]"
|
|
37
|
-
},
|
|
37
|
+
}, ue = {
|
|
38
38
|
key: 0,
|
|
39
39
|
class: "text-red-500 text-sm text-center"
|
|
40
|
-
},
|
|
40
|
+
}, pe = { key: 0 }, be = { key: 1 }, ce = {
|
|
41
41
|
key: 1,
|
|
42
42
|
class: "text-xs text-center"
|
|
43
|
-
},
|
|
43
|
+
}, we = {
|
|
44
44
|
__name: "KunNumberField",
|
|
45
|
-
props:
|
|
45
|
+
props: T,
|
|
46
46
|
emits: [
|
|
47
47
|
"update:modelValue",
|
|
48
48
|
"focus",
|
|
@@ -69,11 +69,13 @@ const O = {
|
|
|
69
69
|
numberInput: c,
|
|
70
70
|
rootRef: v,
|
|
71
71
|
focus: () => {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
P(() => {
|
|
73
|
+
var e;
|
|
74
|
+
(e = c.value) == null || e.focus();
|
|
75
|
+
});
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
|
-
const S =
|
|
78
|
+
const S = R(() => p.density === "compact" ? "p-1" : p.density === "comfortable" ? "p-2" : "p-3");
|
|
77
79
|
return (e, s) => (r(), l("div", {
|
|
78
80
|
class: "w-full flex flex-col relative h-fit",
|
|
79
81
|
ref_key: "rootRef",
|
|
@@ -88,7 +90,7 @@ const O = {
|
|
|
88
90
|
"-top-2.25 text-xs opacity-80"
|
|
89
91
|
])
|
|
90
92
|
}, u(e.label), 3)) : n("", !0),
|
|
91
|
-
d("div",
|
|
93
|
+
d("div", U({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
92
94
|
d("div", {
|
|
93
95
|
class: y(["flex items-center w-full h-full border", [
|
|
94
96
|
e.bgInput,
|
|
@@ -106,8 +108,8 @@ const O = {
|
|
|
106
108
|
disabled: e.disabled || e.readonly
|
|
107
109
|
}, "−", 8, Q)
|
|
108
110
|
])) : n("", !0),
|
|
109
|
-
e.prefix ? (r(), l("div",
|
|
110
|
-
e.prependIcon || N ? (r(), l("div",
|
|
111
|
+
e.prefix ? (r(), l("div", W, u(e.prefix), 1)) : n("", !0),
|
|
112
|
+
e.prependIcon || N ? (r(), l("div", X, [
|
|
111
113
|
e.prependIcon ? (r(), I(f, {
|
|
112
114
|
key: 0,
|
|
113
115
|
icon: e.prependIcon
|
|
@@ -132,8 +134,8 @@ const O = {
|
|
|
132
134
|
onKeyup: s[4] || (s[4] = (t) => b("keyUp", t)),
|
|
133
135
|
inputmode: "decimal",
|
|
134
136
|
pattern: "[0-9]+([\\.,][0-9]+)?"
|
|
135
|
-
}, null, 42,
|
|
136
|
-
e.clearable && o(h) != null ? (r(), l("div",
|
|
137
|
+
}, null, 42, Y),
|
|
138
|
+
e.clearable && o(h) != null ? (r(), l("div", Z, [
|
|
137
139
|
V(G, {
|
|
138
140
|
onClick: o(B),
|
|
139
141
|
rounded: "rounded-full",
|
|
@@ -141,7 +143,7 @@ const O = {
|
|
|
141
143
|
disabled: e.disabled || e.readonly,
|
|
142
144
|
class: "h-6 w-6"
|
|
143
145
|
}, {
|
|
144
|
-
default:
|
|
146
|
+
default: H(() => [
|
|
145
147
|
V(f, {
|
|
146
148
|
icon: J,
|
|
147
149
|
size: "text-xs"
|
|
@@ -151,21 +153,21 @@ const O = {
|
|
|
151
153
|
}, 8, ["onClick", "disabled"])
|
|
152
154
|
])) : n("", !0),
|
|
153
155
|
e.noArrows ? n("", !0) : (r(), l(j, { key: 4 }, [
|
|
154
|
-
e.controlVariant === "default" ? (r(), l("div",
|
|
156
|
+
e.controlVariant === "default" ? (r(), l("div", _, [
|
|
155
157
|
d("button", {
|
|
156
158
|
type: "button",
|
|
157
159
|
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
158
160
|
onClick: s[5] || (s[5] = (...t) => o(i) && o(i)(...t)),
|
|
159
161
|
disabled: e.disabled || e.readonly
|
|
160
|
-
}, " ▲ ", 8,
|
|
162
|
+
}, " ▲ ", 8, ee),
|
|
161
163
|
d("button", {
|
|
162
164
|
type: "button",
|
|
163
165
|
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
164
166
|
onClick: s[6] || (s[6] = (...t) => o(a) && o(a)(...t)),
|
|
165
167
|
disabled: e.disabled || e.readonly
|
|
166
|
-
}, " ▼ ", 8,
|
|
168
|
+
}, " ▼ ", 8, te)
|
|
167
169
|
])) : n("", !0),
|
|
168
|
-
e.controlVariant === "stacked" ? (r(), l("div",
|
|
170
|
+
e.controlVariant === "stacked" ? (r(), l("div", oe, [
|
|
169
171
|
d("div", {
|
|
170
172
|
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
171
173
|
onClick: s[7] || (s[7] = (...t) => o(i) && o(i)(...t))
|
|
@@ -174,7 +176,7 @@ const O = {
|
|
|
174
176
|
type: "button",
|
|
175
177
|
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
176
178
|
disabled: e.disabled || e.readonly
|
|
177
|
-
}, "▲", 8,
|
|
179
|
+
}, "▲", 8, re)
|
|
178
180
|
]),
|
|
179
181
|
d("div", {
|
|
180
182
|
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
@@ -184,37 +186,37 @@ const O = {
|
|
|
184
186
|
type: "button",
|
|
185
187
|
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
186
188
|
disabled: e.disabled || e.readonly
|
|
187
|
-
}, "▼", 8,
|
|
189
|
+
}, "▼", 8, se)
|
|
188
190
|
])
|
|
189
191
|
])) : n("", !0)
|
|
190
192
|
], 64)),
|
|
191
|
-
e.appendIcon || A ? (r(), l("div",
|
|
193
|
+
e.appendIcon || A ? (r(), l("div", le, [
|
|
192
194
|
e.appendIcon ? (r(), I(f, {
|
|
193
195
|
key: 0,
|
|
194
196
|
icon: e.appendIcon
|
|
195
197
|
}, null, 8, ["icon"])) : x(e.$slots, "append-icon", { key: 1 })
|
|
196
198
|
])) : n("", !0),
|
|
197
|
-
!e.noArrows && e.controlVariant === "split" ? (r(), l("div",
|
|
199
|
+
!e.noArrows && e.controlVariant === "split" ? (r(), l("div", ne, [
|
|
198
200
|
d("button", {
|
|
199
201
|
type: "button",
|
|
200
202
|
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
201
203
|
onClick: s[9] || (s[9] = (...t) => o(i) && o(i)(...t)),
|
|
202
204
|
disabled: e.disabled || e.readonly
|
|
203
|
-
}, "+", 8,
|
|
205
|
+
}, "+", 8, de)
|
|
204
206
|
])) : n("", !0),
|
|
205
|
-
e.suffix ? (r(), l("div",
|
|
207
|
+
e.suffix ? (r(), l("div", ie, u(e.suffix), 1)) : n("", !0)
|
|
206
208
|
], 2),
|
|
207
|
-
e.hideDetails ? n("", !0) : (r(), l("div",
|
|
208
|
-
e.error || e.errorMessages ? (r(), l("div",
|
|
209
|
-
Array.isArray(e.errorMessages) ? (r(), l("div",
|
|
210
|
-
(r(!0), l(j, null,
|
|
211
|
-
])) : typeof e.errorMessages == "string" ? (r(), l("div",
|
|
212
|
-
])) : e.hint && (e.persistentHint || o(w)) ? (r(), l("div",
|
|
209
|
+
e.hideDetails ? n("", !0) : (r(), l("div", ae, [
|
|
210
|
+
e.error || e.errorMessages ? (r(), l("div", ue, [
|
|
211
|
+
Array.isArray(e.errorMessages) ? (r(), l("div", pe, [
|
|
212
|
+
(r(!0), l(j, null, L(e.errorMessages, (t, $) => (r(), l("div", { key: $ }, u(t), 1))), 128))
|
|
213
|
+
])) : typeof e.errorMessages == "string" ? (r(), l("div", be, u(e.errorMessages), 1)) : n("", !0)
|
|
214
|
+
])) : e.hint && (e.persistentHint || o(w)) ? (r(), l("div", ce, u(e.hint), 1)) : n("", !0)
|
|
213
215
|
]))
|
|
214
216
|
], 16)
|
|
215
217
|
], 512));
|
|
216
218
|
}
|
|
217
219
|
};
|
|
218
220
|
export {
|
|
219
|
-
|
|
221
|
+
we as default
|
|
220
222
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nextTick as U, getCurrentInstance as H, computed as d, useSlots as q, ref as G, createElementBlock as n, openBlock as o, createCommentVNode as r, createElementVNode as k, normalizeClass as u, toDisplayString as i, mergeProps as J, unref as t, renderSlot as c, withModifiers as L, createVNode as Q } from "vue";
|
|
2
2
|
import { icons as P } from "../../../../icons/index.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
3
|
+
import W from "../composables/KunTextFieldProps.js";
|
|
4
|
+
import X from "../composables/useKunTextFieldComposable.js";
|
|
5
|
+
import Y from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
6
|
+
const Z = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "mr-2"
|
|
9
|
-
},
|
|
9
|
+
}, _ = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "aria-invalid", "aria-describedby"], ee = ["disabled"], te = {
|
|
10
10
|
key: 3,
|
|
11
11
|
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
12
|
-
},
|
|
12
|
+
}, le = {
|
|
13
13
|
key: 5,
|
|
14
14
|
class: "ml-2"
|
|
15
|
-
},
|
|
15
|
+
}, se = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "h-[1.25rem]"
|
|
18
|
-
},
|
|
18
|
+
}, ne = ["id"], oe = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "text-xs text-center"
|
|
21
|
-
},
|
|
21
|
+
}, re = {
|
|
22
22
|
key: 2,
|
|
23
23
|
class: "text-xs text-right"
|
|
24
|
-
},
|
|
24
|
+
}, fe = {
|
|
25
25
|
__name: "KunTextField",
|
|
26
|
-
props: { ...
|
|
26
|
+
props: { ...W },
|
|
27
27
|
emits: [
|
|
28
28
|
"update:modelValue",
|
|
29
29
|
"focus",
|
|
@@ -32,34 +32,36 @@ const Y = {
|
|
|
32
32
|
"keyDown",
|
|
33
33
|
"keyUp"
|
|
34
34
|
],
|
|
35
|
-
setup(V, { expose: D, emit:
|
|
36
|
-
const a = V, p =
|
|
35
|
+
setup(V, { expose: D, emit: T }) {
|
|
36
|
+
const a = V, p = T, {
|
|
37
37
|
inputField: b,
|
|
38
38
|
inputValue: f,
|
|
39
39
|
rootRef: w,
|
|
40
40
|
inputFocused: h,
|
|
41
|
-
validationError:
|
|
41
|
+
validationError: j,
|
|
42
42
|
hasError: y,
|
|
43
43
|
handleInput: g,
|
|
44
44
|
handleBlur: C,
|
|
45
45
|
focusInput: I,
|
|
46
|
-
validate:
|
|
47
|
-
reset:
|
|
48
|
-
resetValidation:
|
|
46
|
+
validate: B,
|
|
47
|
+
reset: E,
|
|
48
|
+
resetValidation: K,
|
|
49
49
|
clearInput: $
|
|
50
|
-
} =
|
|
50
|
+
} = X(a, p);
|
|
51
51
|
D({
|
|
52
|
-
validate:
|
|
53
|
-
reset:
|
|
54
|
-
resetValidation:
|
|
52
|
+
validate: B,
|
|
53
|
+
reset: E,
|
|
54
|
+
resetValidation: K,
|
|
55
55
|
inputField: b,
|
|
56
56
|
rootRef: w,
|
|
57
57
|
focus: () => {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
U(() => {
|
|
59
|
+
var e;
|
|
60
|
+
(e = b.value) == null || e.focus();
|
|
61
|
+
});
|
|
60
62
|
}
|
|
61
63
|
});
|
|
62
|
-
const m = `input-${
|
|
64
|
+
const m = `input-${H().uid}`, S = d(() => h.value || f.value !== "" || a.dirty), x = q(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = G(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
|
|
63
65
|
function A() {
|
|
64
66
|
v.value = !v.value;
|
|
65
67
|
}
|
|
@@ -77,10 +79,10 @@ const Y = {
|
|
|
77
79
|
class: u([
|
|
78
80
|
e.labelColor,
|
|
79
81
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
80
|
-
|
|
82
|
+
S.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
81
83
|
])
|
|
82
84
|
}, i(e.label), 3)) : r("", !0),
|
|
83
|
-
k("div",
|
|
85
|
+
k("div", J({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
84
86
|
k("div", {
|
|
85
87
|
class: u(["flex flex-row items-center w-full h-full border", [
|
|
86
88
|
e.bgInput,
|
|
@@ -90,7 +92,7 @@ const Y = {
|
|
|
90
92
|
t(y) ? "bg-red-200 dark:bg-red-900" : ""
|
|
91
93
|
]])
|
|
92
94
|
}, [
|
|
93
|
-
e.prefix ? (o(), n("div",
|
|
95
|
+
e.prefix ? (o(), n("div", Z, i(e.prefix), 1)) : r("", !0),
|
|
94
96
|
N.value ? (o(), n("div", {
|
|
95
97
|
key: 1,
|
|
96
98
|
class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
@@ -115,20 +117,20 @@ const Y = {
|
|
|
115
117
|
onInput: l[0] || (l[0] = (...s) => t(g) && t(g)(...s)),
|
|
116
118
|
onBlur: l[1] || (l[1] = (...s) => t(C) && t(C)(...s)),
|
|
117
119
|
onFocus: l[2] || (l[2] = (...s) => t(I) && t(I)(...s)),
|
|
118
|
-
onClick: l[3] || (l[3] =
|
|
120
|
+
onClick: l[3] || (l[3] = L((s) => p("handleClick"), ["stop"])),
|
|
119
121
|
onKeydown: l[4] || (l[4] = (s) => p("keyDown", s)),
|
|
120
122
|
onKeyup: l[5] || (l[5] = (s) => p("keyUp", s))
|
|
121
|
-
}, null, 42,
|
|
123
|
+
}, null, 42, _),
|
|
122
124
|
e.clearable && t(f) ? (o(), n("button", {
|
|
123
125
|
key: 2,
|
|
124
126
|
type: "button",
|
|
125
127
|
onClick: l[6] || (l[6] = (...s) => t($) && t($)(...s)),
|
|
126
128
|
class: u(["ml-2", e.textColor]),
|
|
127
129
|
disabled: e.disabled || e.readonly
|
|
128
|
-
}, " × ", 10,
|
|
130
|
+
}, " × ", 10, ee)) : r("", !0),
|
|
129
131
|
c(e.$slots, "default"),
|
|
130
|
-
e.type === "password" && e.showPasswordToggle ? (o(), n("div",
|
|
131
|
-
|
|
132
|
+
e.type === "password" && e.showPasswordToggle ? (o(), n("div", te, [
|
|
133
|
+
Q(Y, {
|
|
132
134
|
icon: z.value,
|
|
133
135
|
onClick: A
|
|
134
136
|
}, null, 8, ["icon"])
|
|
@@ -139,15 +141,15 @@ const Y = {
|
|
|
139
141
|
}, [
|
|
140
142
|
c(e.$slots, "append-inner")
|
|
141
143
|
], 2)) : r("", !0),
|
|
142
|
-
e.suffix ? (o(), n("div",
|
|
144
|
+
e.suffix ? (o(), n("div", le, i(e.suffix), 1)) : r("", !0)
|
|
143
145
|
], 2),
|
|
144
|
-
e.hideDetails ? r("", !0) : (o(), n("div",
|
|
146
|
+
e.hideDetails ? r("", !0) : (o(), n("div", se, [
|
|
145
147
|
t(y) ? (o(), n("div", {
|
|
146
148
|
key: 0,
|
|
147
149
|
id: `error-${m}`,
|
|
148
150
|
class: "text-red-500 text-sm text-center"
|
|
149
|
-
}, i(t(
|
|
150
|
-
e.counter && e.maxlength ? (o(), n("div",
|
|
151
|
+
}, i(t(j) || e.errorMessage), 9, ne)) : e.hint && (e.persistentHint || t(h)) ? (o(), n("div", oe, i(e.hint), 1)) : r("", !0),
|
|
152
|
+
e.counter && e.maxlength ? (o(), n("div", re, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
|
|
151
153
|
]))
|
|
152
154
|
], 16)
|
|
153
155
|
], 512);
|
|
@@ -155,5 +157,5 @@ const Y = {
|
|
|
155
157
|
}
|
|
156
158
|
};
|
|
157
159
|
export {
|
|
158
|
-
|
|
160
|
+
fe as default
|
|
159
161
|
};
|