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