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