adverich-kun-ui 0.1.490 → 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,48 +1,48 @@
|
|
|
1
|
-
import { getCurrentInstance as z, useSlots as E,
|
|
2
|
-
import { KunNumberFieldProps as
|
|
3
|
-
import { useKunNumberField as
|
|
4
|
-
import
|
|
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
|
+
import { useKunNumberField as q } from "../composables/useKunNumberFieldComposable.js";
|
|
4
|
+
import G from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
5
5
|
import f from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import J from "../../../../icons/IconClose.vue.js";
|
|
7
|
+
const O = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "h-full"
|
|
10
|
-
},
|
|
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",
|
|
@@ -64,18 +64,18 @@ const J = {
|
|
|
64
64
|
focus: w,
|
|
65
65
|
handleFocus: g,
|
|
66
66
|
handleBlur: C
|
|
67
|
-
} =
|
|
67
|
+
} = q(p, b);
|
|
68
68
|
F({
|
|
69
69
|
numberInput: c,
|
|
70
70
|
rootRef: v,
|
|
71
71
|
focus: () => {
|
|
72
|
-
|
|
72
|
+
P(() => {
|
|
73
73
|
var e;
|
|
74
74
|
(e = c.value) == null || e.focus();
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
const S =
|
|
78
|
+
const S = R(() => p.density === "compact" ? "p-1" : p.density === "comfortable" ? "p-2" : "p-3");
|
|
79
79
|
return (e, s) => (r(), l("div", {
|
|
80
80
|
class: "w-full flex flex-col relative h-fit",
|
|
81
81
|
ref_key: "rootRef",
|
|
@@ -90,7 +90,7 @@ const J = {
|
|
|
90
90
|
"-top-2.25 text-xs opacity-80"
|
|
91
91
|
])
|
|
92
92
|
}, u(e.label), 3)) : n("", !0),
|
|
93
|
-
d("div",
|
|
93
|
+
d("div", U({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
94
94
|
d("div", {
|
|
95
95
|
class: y(["flex items-center w-full h-full border", [
|
|
96
96
|
e.bgInput,
|
|
@@ -100,16 +100,16 @@ const J = {
|
|
|
100
100
|
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
101
101
|
]])
|
|
102
102
|
}, [
|
|
103
|
-
!e.noArrows && e.controlVariant === "split" ? (r(), l("div",
|
|
103
|
+
!e.noArrows && e.controlVariant === "split" ? (r(), l("div", O, [
|
|
104
104
|
d("button", {
|
|
105
105
|
type: "button",
|
|
106
106
|
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
107
107
|
onClick: s[0] || (s[0] = (...t) => o(a) && o(a)(...t)),
|
|
108
108
|
disabled: e.disabled || e.readonly
|
|
109
|
-
}, "−", 8,
|
|
109
|
+
}, "−", 8, Q)
|
|
110
110
|
])) : n("", !0),
|
|
111
|
-
e.prefix ? (r(), l("div",
|
|
112
|
-
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, [
|
|
113
113
|
e.prependIcon ? (r(), I(f, {
|
|
114
114
|
key: 0,
|
|
115
115
|
icon: e.prependIcon
|
|
@@ -134,18 +134,18 @@ const J = {
|
|
|
134
134
|
onKeyup: s[4] || (s[4] = (t) => b("keyUp", t)),
|
|
135
135
|
inputmode: "decimal",
|
|
136
136
|
pattern: "[0-9]+([\\.,][0-9]+)?"
|
|
137
|
-
}, null, 42,
|
|
138
|
-
e.clearable && o(h) != null ? (r(), l("div",
|
|
139
|
-
V(
|
|
137
|
+
}, null, 42, Y),
|
|
138
|
+
e.clearable && o(h) != null ? (r(), l("div", Z, [
|
|
139
|
+
V(G, {
|
|
140
140
|
onClick: o(B),
|
|
141
141
|
rounded: "rounded-full",
|
|
142
142
|
bgColor: "bg-red-500/75",
|
|
143
143
|
disabled: e.disabled || e.readonly,
|
|
144
144
|
class: "h-6 w-6"
|
|
145
145
|
}, {
|
|
146
|
-
default:
|
|
146
|
+
default: H(() => [
|
|
147
147
|
V(f, {
|
|
148
|
-
icon:
|
|
148
|
+
icon: J,
|
|
149
149
|
size: "text-xs"
|
|
150
150
|
})
|
|
151
151
|
]),
|
|
@@ -153,21 +153,21 @@ const J = {
|
|
|
153
153
|
}, 8, ["onClick", "disabled"])
|
|
154
154
|
])) : n("", !0),
|
|
155
155
|
e.noArrows ? n("", !0) : (r(), l(j, { key: 4 }, [
|
|
156
|
-
e.controlVariant === "default" ? (r(), l("div",
|
|
156
|
+
e.controlVariant === "default" ? (r(), l("div", _, [
|
|
157
157
|
d("button", {
|
|
158
158
|
type: "button",
|
|
159
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",
|
|
160
160
|
onClick: s[5] || (s[5] = (...t) => o(i) && o(i)(...t)),
|
|
161
161
|
disabled: e.disabled || e.readonly
|
|
162
|
-
}, " ▲ ", 8,
|
|
162
|
+
}, " ▲ ", 8, ee),
|
|
163
163
|
d("button", {
|
|
164
164
|
type: "button",
|
|
165
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",
|
|
166
166
|
onClick: s[6] || (s[6] = (...t) => o(a) && o(a)(...t)),
|
|
167
167
|
disabled: e.disabled || e.readonly
|
|
168
|
-
}, " ▼ ", 8,
|
|
168
|
+
}, " ▼ ", 8, te)
|
|
169
169
|
])) : n("", !0),
|
|
170
|
-
e.controlVariant === "stacked" ? (r(), l("div",
|
|
170
|
+
e.controlVariant === "stacked" ? (r(), l("div", oe, [
|
|
171
171
|
d("div", {
|
|
172
172
|
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
173
173
|
onClick: s[7] || (s[7] = (...t) => o(i) && o(i)(...t))
|
|
@@ -176,7 +176,7 @@ const J = {
|
|
|
176
176
|
type: "button",
|
|
177
177
|
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
178
178
|
disabled: e.disabled || e.readonly
|
|
179
|
-
}, "▲", 8,
|
|
179
|
+
}, "▲", 8, re)
|
|
180
180
|
]),
|
|
181
181
|
d("div", {
|
|
182
182
|
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
@@ -186,37 +186,37 @@ const J = {
|
|
|
186
186
|
type: "button",
|
|
187
187
|
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
188
188
|
disabled: e.disabled || e.readonly
|
|
189
|
-
}, "▼", 8,
|
|
189
|
+
}, "▼", 8, se)
|
|
190
190
|
])
|
|
191
191
|
])) : n("", !0)
|
|
192
192
|
], 64)),
|
|
193
|
-
e.appendIcon || A ? (r(), l("div",
|
|
193
|
+
e.appendIcon || A ? (r(), l("div", le, [
|
|
194
194
|
e.appendIcon ? (r(), I(f, {
|
|
195
195
|
key: 0,
|
|
196
196
|
icon: e.appendIcon
|
|
197
197
|
}, null, 8, ["icon"])) : x(e.$slots, "append-icon", { key: 1 })
|
|
198
198
|
])) : n("", !0),
|
|
199
|
-
!e.noArrows && e.controlVariant === "split" ? (r(), l("div",
|
|
199
|
+
!e.noArrows && e.controlVariant === "split" ? (r(), l("div", ne, [
|
|
200
200
|
d("button", {
|
|
201
201
|
type: "button",
|
|
202
202
|
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
203
203
|
onClick: s[9] || (s[9] = (...t) => o(i) && o(i)(...t)),
|
|
204
204
|
disabled: e.disabled || e.readonly
|
|
205
|
-
}, "+", 8,
|
|
205
|
+
}, "+", 8, de)
|
|
206
206
|
])) : n("", !0),
|
|
207
|
-
e.suffix ? (r(), l("div",
|
|
207
|
+
e.suffix ? (r(), l("div", ie, u(e.suffix), 1)) : n("", !0)
|
|
208
208
|
], 2),
|
|
209
|
-
e.hideDetails ? n("", !0) : (r(), l("div",
|
|
210
|
-
e.error || e.errorMessages ? (r(), l("div",
|
|
211
|
-
Array.isArray(e.errorMessages) ? (r(), l("div",
|
|
212
|
-
(r(!0), l(j, null,
|
|
213
|
-
])) : typeof e.errorMessages == "string" ? (r(), l("div",
|
|
214
|
-
])) : 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)
|
|
215
215
|
]))
|
|
216
216
|
], 16)
|
|
217
217
|
], 512));
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
export {
|
|
221
|
-
|
|
221
|
+
we as default
|
|
222
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",
|
|
@@ -47,7 +47,7 @@ const Y = {
|
|
|
47
47
|
reset: E,
|
|
48
48
|
resetValidation: K,
|
|
49
49
|
clearInput: $
|
|
50
|
-
} =
|
|
50
|
+
} = X(a, p);
|
|
51
51
|
D({
|
|
52
52
|
validate: B,
|
|
53
53
|
reset: E,
|
|
@@ -55,13 +55,13 @@ const Y = {
|
|
|
55
55
|
inputField: b,
|
|
56
56
|
rootRef: w,
|
|
57
57
|
focus: () => {
|
|
58
|
-
|
|
58
|
+
U(() => {
|
|
59
59
|
var e;
|
|
60
60
|
(e = b.value) == null || e.focus();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
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);
|
|
65
65
|
function A() {
|
|
66
66
|
v.value = !v.value;
|
|
67
67
|
}
|
|
@@ -82,7 +82,7 @@ const Y = {
|
|
|
82
82
|
S.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
83
83
|
])
|
|
84
84
|
}, i(e.label), 3)) : r("", !0),
|
|
85
|
-
k("div",
|
|
85
|
+
k("div", J({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
86
86
|
k("div", {
|
|
87
87
|
class: u(["flex flex-row items-center w-full h-full border", [
|
|
88
88
|
e.bgInput,
|
|
@@ -92,7 +92,7 @@ const Y = {
|
|
|
92
92
|
t(y) ? "bg-red-200 dark:bg-red-900" : ""
|
|
93
93
|
]])
|
|
94
94
|
}, [
|
|
95
|
-
e.prefix ? (o(), n("div",
|
|
95
|
+
e.prefix ? (o(), n("div", Z, i(e.prefix), 1)) : r("", !0),
|
|
96
96
|
N.value ? (o(), n("div", {
|
|
97
97
|
key: 1,
|
|
98
98
|
class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
@@ -117,20 +117,20 @@ const Y = {
|
|
|
117
117
|
onInput: l[0] || (l[0] = (...s) => t(g) && t(g)(...s)),
|
|
118
118
|
onBlur: l[1] || (l[1] = (...s) => t(C) && t(C)(...s)),
|
|
119
119
|
onFocus: l[2] || (l[2] = (...s) => t(I) && t(I)(...s)),
|
|
120
|
-
onClick: l[3] || (l[3] =
|
|
120
|
+
onClick: l[3] || (l[3] = L((s) => p("handleClick"), ["stop"])),
|
|
121
121
|
onKeydown: l[4] || (l[4] = (s) => p("keyDown", s)),
|
|
122
122
|
onKeyup: l[5] || (l[5] = (s) => p("keyUp", s))
|
|
123
|
-
}, null, 42,
|
|
123
|
+
}, null, 42, _),
|
|
124
124
|
e.clearable && t(f) ? (o(), n("button", {
|
|
125
125
|
key: 2,
|
|
126
126
|
type: "button",
|
|
127
127
|
onClick: l[6] || (l[6] = (...s) => t($) && t($)(...s)),
|
|
128
128
|
class: u(["ml-2", e.textColor]),
|
|
129
129
|
disabled: e.disabled || e.readonly
|
|
130
|
-
}, " × ", 10,
|
|
130
|
+
}, " × ", 10, ee)) : r("", !0),
|
|
131
131
|
c(e.$slots, "default"),
|
|
132
|
-
e.type === "password" && e.showPasswordToggle ? (o(), n("div",
|
|
133
|
-
|
|
132
|
+
e.type === "password" && e.showPasswordToggle ? (o(), n("div", te, [
|
|
133
|
+
Q(Y, {
|
|
134
134
|
icon: z.value,
|
|
135
135
|
onClick: A
|
|
136
136
|
}, null, 8, ["icon"])
|
|
@@ -141,15 +141,15 @@ const Y = {
|
|
|
141
141
|
}, [
|
|
142
142
|
c(e.$slots, "append-inner")
|
|
143
143
|
], 2)) : r("", !0),
|
|
144
|
-
e.suffix ? (o(), n("div",
|
|
144
|
+
e.suffix ? (o(), n("div", le, i(e.suffix), 1)) : r("", !0)
|
|
145
145
|
], 2),
|
|
146
|
-
e.hideDetails ? r("", !0) : (o(), n("div",
|
|
146
|
+
e.hideDetails ? r("", !0) : (o(), n("div", se, [
|
|
147
147
|
t(y) ? (o(), n("div", {
|
|
148
148
|
key: 0,
|
|
149
149
|
id: `error-${m}`,
|
|
150
150
|
class: "text-red-500 text-sm text-center"
|
|
151
|
-
}, i(t(j) || e.errorMessage), 9,
|
|
152
|
-
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)
|
|
153
153
|
]))
|
|
154
154
|
], 16)
|
|
155
155
|
], 512);
|
|
@@ -157,5 +157,5 @@ const Y = {
|
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
fe as default
|
|
161
161
|
};
|