adverich-kun-ui 0.1.117 → 0.1.119
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.
- package/dist/components/KunAlert/src/components/KunAlert.vue.js +40 -50
- package/dist/components/KunNumberField/src/components/KunNumberField.vue.js +177 -0
- package/dist/components/KunNumberField/src/composables/KunNumberFieldProps.js +48 -0
- package/dist/components/KunNumberField/src/composables/numberFormatUtils.js +7 -0
- package/dist/components/KunNumberField/src/composables/useKunNumberFieldComposable.js +60 -0
- package/dist/index.js +40 -38
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { onMounted as h, computed as m, createElementBlock as i, createCommentVNode as n, openBlock as a, mergeProps as w, withKeys as z, withModifiers as B, createElementVNode as u, normalizeClass as r, createVNode as g, toDisplayString as c, createBlock as y, withCtx as x, createTextVNode as f } from "vue";
|
|
2
|
+
import b from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
3
|
+
import C from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
4
|
+
const V = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "flex justify-center py-4"
|
|
7
|
-
},
|
|
7
|
+
}, N = {
|
|
8
8
|
key: 2,
|
|
9
9
|
class: "flex gap-4 mt-4"
|
|
10
|
-
},
|
|
10
|
+
}, K = {
|
|
11
11
|
__name: "KunAlert",
|
|
12
12
|
props: {
|
|
13
13
|
modelValue: Boolean,
|
|
@@ -80,30 +80,20 @@ const B = {
|
|
|
80
80
|
type: String,
|
|
81
81
|
default: "p-2"
|
|
82
82
|
},
|
|
83
|
-
margin: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
default: !1
|
|
90
|
-
},
|
|
91
|
-
persistent: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: !1
|
|
94
|
-
},
|
|
95
|
-
persistentLabel: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: "Aceptar"
|
|
98
|
-
},
|
|
99
|
-
actionLabel: {
|
|
100
|
-
type: String,
|
|
101
|
-
default: ""
|
|
102
|
-
}
|
|
83
|
+
margin: { type: String, default: "m-2" },
|
|
84
|
+
fullscreen: { type: Boolean, default: !1 },
|
|
85
|
+
persistent: { type: Boolean, default: !1 },
|
|
86
|
+
persistentLabel: { type: String, default: "Aceptar" },
|
|
87
|
+
actionLabel: { type: String, default: "" },
|
|
88
|
+
timeout: { type: Number, default: 2500 }
|
|
103
89
|
},
|
|
104
90
|
emits: ["update:modelValue", "action"],
|
|
105
|
-
setup(e, { emit:
|
|
106
|
-
const l = e,
|
|
91
|
+
setup(e, { emit: S }) {
|
|
92
|
+
const l = e, d = S;
|
|
93
|
+
h(() => setTimeout(() => {
|
|
94
|
+
d("update:modelValue", !1);
|
|
95
|
+
}, l.timeout));
|
|
96
|
+
const p = m(() => {
|
|
107
97
|
if (l.fullscreen) return `fixed inset-0 flex items-center justify-center ${l.margin}`;
|
|
108
98
|
const t = l.margin;
|
|
109
99
|
switch (l.position) {
|
|
@@ -128,35 +118,35 @@ const B = {
|
|
|
128
118
|
default:
|
|
129
119
|
return `fixed top-0 left-1/2 transform -translate-x-1/2 ${t}`;
|
|
130
120
|
}
|
|
131
|
-
}),
|
|
132
|
-
|
|
121
|
+
}), $ = m(() => `${l.fullscreen ? "w-full h-full" : "w-fit"} ${l.transition}`), s = () => {
|
|
122
|
+
d("update:modelValue", !1);
|
|
133
123
|
}, k = () => {
|
|
134
124
|
!l.persistent && !l.fullscreen && s();
|
|
135
125
|
}, v = (t) => {
|
|
136
126
|
!l.persistent && l.fullscreen && s();
|
|
137
127
|
};
|
|
138
|
-
return (t, o) => e.modelValue ? (a(), i("div",
|
|
128
|
+
return (t, o) => e.modelValue ? (a(), i("div", w({
|
|
139
129
|
key: 0,
|
|
140
|
-
class: [
|
|
130
|
+
class: ["px-2", [$.value, p.value]],
|
|
141
131
|
style: { zIndex: e.zIndex },
|
|
142
|
-
onClick:
|
|
143
|
-
onKeydown:
|
|
132
|
+
onClick: B(k, ["self"]),
|
|
133
|
+
onKeydown: z(v, ["esc"]),
|
|
144
134
|
tabindex: "0"
|
|
145
135
|
}, t.$attrs), [
|
|
146
|
-
|
|
136
|
+
u("div", {
|
|
147
137
|
class: r([e.alertClass, e.textColor, e.bgColor, e.borderColor])
|
|
148
138
|
}, [
|
|
149
|
-
e.icon ? (a(), i("div",
|
|
150
|
-
|
|
139
|
+
e.icon ? (a(), i("div", V, [
|
|
140
|
+
u("div", {
|
|
151
141
|
class: r(["rounded-full p-4", e.iconBgColor])
|
|
152
142
|
}, [
|
|
153
|
-
|
|
143
|
+
g(b, {
|
|
154
144
|
icon: e.icon,
|
|
155
145
|
size: e.iconSize
|
|
156
146
|
}, null, 8, ["icon", "size"])
|
|
157
147
|
], 2)
|
|
158
148
|
])) : n("", !0),
|
|
159
|
-
|
|
149
|
+
u("div", {
|
|
160
150
|
class: r(["text-center flex flex-col justify-center items-center", e.paddingContainer])
|
|
161
151
|
}, [
|
|
162
152
|
e.title ? (a(), i("div", {
|
|
@@ -167,37 +157,37 @@ const B = {
|
|
|
167
157
|
key: 1,
|
|
168
158
|
class: r(e.messageClass)
|
|
169
159
|
}, c(e.message), 3)) : n("", !0),
|
|
170
|
-
e.persistent ? (a(), i("div",
|
|
171
|
-
e.actionLabel ? (a(),
|
|
160
|
+
e.persistent ? (a(), i("div", N, [
|
|
161
|
+
e.actionLabel ? (a(), y(C, {
|
|
172
162
|
key: 0,
|
|
173
163
|
onClick: o[0] || (o[0] = (L) => t.$emit("action"))
|
|
174
164
|
}, {
|
|
175
|
-
default:
|
|
176
|
-
|
|
165
|
+
default: x(() => [
|
|
166
|
+
f(c(e.actionLabel), 1)
|
|
177
167
|
]),
|
|
178
168
|
_: 1
|
|
179
169
|
})) : n("", !0),
|
|
180
|
-
e.closable ? n("", !0) : (a(),
|
|
170
|
+
e.closable ? n("", !0) : (a(), y(C, {
|
|
181
171
|
key: 1,
|
|
182
172
|
onClick: s
|
|
183
173
|
}, {
|
|
184
|
-
default:
|
|
185
|
-
|
|
174
|
+
default: x(() => [
|
|
175
|
+
f(c(e.persistentLabel), 1)
|
|
186
176
|
]),
|
|
187
177
|
_: 1
|
|
188
178
|
}))
|
|
189
179
|
])) : n("", !0),
|
|
190
180
|
e.closable ? (a(), i("button", {
|
|
191
181
|
key: 3,
|
|
192
|
-
class: "absolute top-0 right-1 text-xl focus:outline-none cursor-pointer",
|
|
182
|
+
class: "absolute top-0 right-1 px-1 text-xl focus:outline-none cursor-pointer",
|
|
193
183
|
onClick: s
|
|
194
184
|
}, [
|
|
195
|
-
|
|
185
|
+
g(b, {
|
|
196
186
|
icon: "hand",
|
|
197
187
|
size: "text-base",
|
|
198
188
|
class: "mr-1"
|
|
199
189
|
}),
|
|
200
|
-
o[1] || (o[1] =
|
|
190
|
+
o[1] || (o[1] = f(" × "))
|
|
201
191
|
])) : n("", !0)
|
|
202
192
|
], 2)
|
|
203
193
|
], 2)
|
|
@@ -205,5 +195,5 @@ const B = {
|
|
|
205
195
|
}
|
|
206
196
|
};
|
|
207
197
|
export {
|
|
208
|
-
|
|
198
|
+
K as default
|
|
209
199
|
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { getCurrentInstance as F, createElementBlock as s, openBlock as l, createCommentVNode as i, createElementVNode as d, normalizeClass as u, unref as t, toDisplayString as p, mergeProps as M, Fragment as N, renderList as B } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as K } from "../composables/KunNumberFieldProps.js";
|
|
3
|
+
import { useKunNumberField as A } from "../composables/useKunNumberFieldComposable.js";
|
|
4
|
+
const D = { class: "w-full flex flex-col relative" }, z = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "h-full"
|
|
7
|
+
}, E = ["disabled"], P = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "mr-2"
|
|
10
|
+
}, $ = {
|
|
11
|
+
key: 2,
|
|
12
|
+
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
13
|
+
}, H = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], L = ["disabled"], S = {
|
|
14
|
+
key: 4,
|
|
15
|
+
class: "flex items-center h-full"
|
|
16
|
+
}, q = ["disabled"], G = ["disabled"], J = {
|
|
17
|
+
key: 5,
|
|
18
|
+
class: "flex flex-col items-center justify-center border-l border-slate-600"
|
|
19
|
+
}, O = ["disabled"], Q = ["disabled"], R = {
|
|
20
|
+
key: 6,
|
|
21
|
+
class: "flex items-center justify-center min-w-[32px] h-full px-1 cursor-pointer"
|
|
22
|
+
}, T = {
|
|
23
|
+
key: 7,
|
|
24
|
+
class: "h-full"
|
|
25
|
+
}, U = ["disabled"], W = {
|
|
26
|
+
key: 8,
|
|
27
|
+
class: "ml-2"
|
|
28
|
+
}, X = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "h-[1.25rem]"
|
|
31
|
+
}, Y = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "text-red-500 text-sm text-center"
|
|
34
|
+
}, Z = { key: 0 }, _ = { key: 1 }, ee = {
|
|
35
|
+
key: 1,
|
|
36
|
+
class: "text-xs text-center"
|
|
37
|
+
}, se = {
|
|
38
|
+
__name: "KunNumberField",
|
|
39
|
+
props: K,
|
|
40
|
+
emits: ["update:modelValue"],
|
|
41
|
+
setup(m, { emit: v }) {
|
|
42
|
+
const g = m, w = v, b = `number-input-${F().uid}`, {
|
|
43
|
+
inputValue: y,
|
|
44
|
+
numberInput: C,
|
|
45
|
+
inputKey: x,
|
|
46
|
+
updateValue: I,
|
|
47
|
+
onIncrement: n,
|
|
48
|
+
onDecrement: a,
|
|
49
|
+
onClear: c,
|
|
50
|
+
focus: f,
|
|
51
|
+
handleFocus: h,
|
|
52
|
+
isActive: V,
|
|
53
|
+
handleBlur: k
|
|
54
|
+
} = A(g, w);
|
|
55
|
+
return (e, o) => (l(), s("div", D, [
|
|
56
|
+
e.label ? (l(), s("label", {
|
|
57
|
+
key: 0,
|
|
58
|
+
for: b,
|
|
59
|
+
class: u([
|
|
60
|
+
e.labelColor,
|
|
61
|
+
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
62
|
+
t(V) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
63
|
+
])
|
|
64
|
+
}, p(e.label), 3)) : i("", !0),
|
|
65
|
+
d("div", M({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
66
|
+
d("div", {
|
|
67
|
+
class: u(["flex items-center w-full h-full border", [
|
|
68
|
+
e.bgInput,
|
|
69
|
+
e.rounded,
|
|
70
|
+
t(f) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
71
|
+
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
72
|
+
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
73
|
+
]])
|
|
74
|
+
}, [
|
|
75
|
+
e.controlVariant === "split" ? (l(), s("div", z, [
|
|
76
|
+
d("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
79
|
+
onClick: o[0] || (o[0] = (...r) => t(a) && t(a)(...r)),
|
|
80
|
+
disabled: e.disabled || e.readonly
|
|
81
|
+
}, "−", 8, E)
|
|
82
|
+
])) : i("", !0),
|
|
83
|
+
e.prefix ? (l(), s("div", P, p(e.prefix), 1)) : i("", !0),
|
|
84
|
+
e.prependIcon ? (l(), s("div", $, [
|
|
85
|
+
d("i", {
|
|
86
|
+
class: u(e.prependIcon)
|
|
87
|
+
}, null, 2)
|
|
88
|
+
])) : i("", !0),
|
|
89
|
+
(l(), s("input", {
|
|
90
|
+
id: b,
|
|
91
|
+
ref_key: "numberInput",
|
|
92
|
+
ref: C,
|
|
93
|
+
key: t(x),
|
|
94
|
+
type: "text",
|
|
95
|
+
value: t(y),
|
|
96
|
+
placeholder: e.placeholder,
|
|
97
|
+
readonly: e.readonly,
|
|
98
|
+
disabled: e.disabled,
|
|
99
|
+
maxlength: e.maxlength,
|
|
100
|
+
autocomplete: "off",
|
|
101
|
+
class: u(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
102
|
+
"aria-invalid": e.error ? "true" : "false",
|
|
103
|
+
onInput: o[1] || (o[1] = (r) => t(I)(r.target.value)),
|
|
104
|
+
onFocus: o[2] || (o[2] = (...r) => t(h) && t(h)(...r)),
|
|
105
|
+
onBlur: o[3] || (o[3] = (...r) => t(k) && t(k)(...r))
|
|
106
|
+
}, null, 42, H)),
|
|
107
|
+
e.clearable && t(y) != null ? (l(), s("button", {
|
|
108
|
+
key: 3,
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: o[4] || (o[4] = (...r) => t(c) && t(c)(...r)),
|
|
111
|
+
class: u(["ml-2", e.textColor]),
|
|
112
|
+
disabled: e.disabled || e.readonly
|
|
113
|
+
}, " × ", 10, L)) : i("", !0),
|
|
114
|
+
e.controlVariant === "default" ? (l(), s("div", S, [
|
|
115
|
+
d("button", {
|
|
116
|
+
type: "button",
|
|
117
|
+
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",
|
|
118
|
+
onClick: o[5] || (o[5] = (...r) => t(n) && t(n)(...r)),
|
|
119
|
+
disabled: e.disabled || e.readonly
|
|
120
|
+
}, " ▲ ", 8, q),
|
|
121
|
+
d("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
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",
|
|
124
|
+
onClick: o[6] || (o[6] = (...r) => t(a) && t(a)(...r)),
|
|
125
|
+
disabled: e.disabled || e.readonly
|
|
126
|
+
}, " ▼ ", 8, G)
|
|
127
|
+
])) : e.controlVariant === "stacked" ? (l(), s("div", J, [
|
|
128
|
+
d("div", {
|
|
129
|
+
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
130
|
+
onClick: o[7] || (o[7] = (...r) => t(n) && t(n)(...r))
|
|
131
|
+
}, [
|
|
132
|
+
d("button", {
|
|
133
|
+
type: "button",
|
|
134
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
135
|
+
disabled: e.disabled || e.readonly
|
|
136
|
+
}, "▲", 8, O)
|
|
137
|
+
]),
|
|
138
|
+
d("div", {
|
|
139
|
+
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
140
|
+
onClick: o[8] || (o[8] = (...r) => t(a) && t(a)(...r))
|
|
141
|
+
}, [
|
|
142
|
+
d("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
145
|
+
disabled: e.disabled || e.readonly
|
|
146
|
+
}, "▼", 8, Q)
|
|
147
|
+
])
|
|
148
|
+
])) : i("", !0),
|
|
149
|
+
e.appendIcon ? (l(), s("div", R, [
|
|
150
|
+
d("i", {
|
|
151
|
+
class: u(e.appendIcon)
|
|
152
|
+
}, null, 2)
|
|
153
|
+
])) : i("", !0),
|
|
154
|
+
e.controlVariant === "split" ? (l(), s("div", T, [
|
|
155
|
+
d("button", {
|
|
156
|
+
type: "button",
|
|
157
|
+
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
158
|
+
onClick: o[9] || (o[9] = (...r) => t(n) && t(n)(...r)),
|
|
159
|
+
disabled: e.disabled || e.readonly
|
|
160
|
+
}, "+", 8, U)
|
|
161
|
+
])) : i("", !0),
|
|
162
|
+
e.suffix ? (l(), s("div", W, p(e.suffix), 1)) : i("", !0)
|
|
163
|
+
], 2),
|
|
164
|
+
e.hideDetails ? i("", !0) : (l(), s("div", X, [
|
|
165
|
+
e.error || e.errorMessages ? (l(), s("div", Y, [
|
|
166
|
+
Array.isArray(e.errorMessages) ? (l(), s("div", Z, [
|
|
167
|
+
(l(!0), s(N, null, B(e.errorMessages, (r, j) => (l(), s("div", { key: j }, p(r), 1))), 128))
|
|
168
|
+
])) : typeof e.errorMessages == "string" ? (l(), s("div", _, p(e.errorMessages), 1)) : i("", !0)
|
|
169
|
+
])) : e.hint && (e.persistentHint || t(f)) ? (l(), s("div", ee, p(e.hint), 1)) : i("", !0)
|
|
170
|
+
]))
|
|
171
|
+
], 16)
|
|
172
|
+
]));
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
export {
|
|
176
|
+
se as default
|
|
177
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
// Core
|
|
3
|
+
modelValue: { type: [Number, String], default: null },
|
|
4
|
+
type: { type: String, default: "text" },
|
|
5
|
+
placeholder: { type: String, default: "" },
|
|
6
|
+
label: { type: String, default: "" },
|
|
7
|
+
dirty: { type: Boolean, default: !1 },
|
|
8
|
+
// Decoradores
|
|
9
|
+
prefix: { type: String, default: "" },
|
|
10
|
+
suffix: { type: String, default: "" },
|
|
11
|
+
prependIcon: String,
|
|
12
|
+
appendIcon: String,
|
|
13
|
+
// Estilo y diseño
|
|
14
|
+
rounded: { type: String, default: "rounded" },
|
|
15
|
+
borderColor: { type: String, default: "border-gray-300 dark:border-gray-700" },
|
|
16
|
+
textColor: { type: String, default: "text-black dark:text-white" },
|
|
17
|
+
labelColor: { type: String, default: "text-black/80 dark:text-white/80" },
|
|
18
|
+
placeholderColor: { type: String, default: "placeholder-black/60 dark:placeholder-white/60" },
|
|
19
|
+
bgInput: { type: String, default: "bg-slate-200 dark:bg-slate-800" },
|
|
20
|
+
textCenter: { type: Boolean, default: !1 },
|
|
21
|
+
controlVariant: { type: String, default: "default" },
|
|
22
|
+
// Estado
|
|
23
|
+
error: { type: Boolean, default: !1 },
|
|
24
|
+
errorMessages: [String, Array],
|
|
25
|
+
rules: { type: Array, default: () => [] },
|
|
26
|
+
disabled: { type: Boolean, default: !1 },
|
|
27
|
+
readonly: { type: Boolean, default: !1 },
|
|
28
|
+
clearable: { type: Boolean, default: !1 },
|
|
29
|
+
maxlength: { type: [Number, String], default: null },
|
|
30
|
+
counter: { type: Boolean, default: !1 },
|
|
31
|
+
debounce: { type: Number, default: 300 },
|
|
32
|
+
// Ayuda y detalles
|
|
33
|
+
hint: { type: String, default: "" },
|
|
34
|
+
persistentHint: { type: Boolean, default: !1 },
|
|
35
|
+
hideDetails: { type: Boolean, default: !1 },
|
|
36
|
+
validateOnBlur: { type: Boolean, default: !1 },
|
|
37
|
+
// Reglas numéricas
|
|
38
|
+
min: { type: Number, default: -1 / 0 },
|
|
39
|
+
max: { type: Number, default: 1 / 0 },
|
|
40
|
+
step: { type: Number, default: 1 },
|
|
41
|
+
locale: { type: String, default: "es-AR" },
|
|
42
|
+
separator: { type: String, default: "." },
|
|
43
|
+
useGrouping: { type: Boolean, default: !0 },
|
|
44
|
+
precision: { type: Number, default: 2 }
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
e as KunNumberFieldProps
|
|
48
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ref as a, computed as p, watch as b, nextTick as g } from "vue";
|
|
2
|
+
import { normalizeNumber as y } from "./numberFormatUtils.js";
|
|
3
|
+
function F(u, o) {
|
|
4
|
+
const e = a(u.modelValue), r = a(null), f = a(0);
|
|
5
|
+
function i(n) {
|
|
6
|
+
if (!n) {
|
|
7
|
+
e.value = "0", o("update:modelValue", 0);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const t = y(n, u.separator).split(u.separator);
|
|
11
|
+
if (t.length > 2) {
|
|
12
|
+
d();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
t.length === 2 && t[1].length > u.precision && (t[1] = t[1].slice(0, u.precision));
|
|
16
|
+
const c = t.join(u.separator);
|
|
17
|
+
c === e.value ? d() : e.value = c, o("update:modelValue", c || 0);
|
|
18
|
+
}
|
|
19
|
+
function d() {
|
|
20
|
+
f.value++, g(() => {
|
|
21
|
+
var n;
|
|
22
|
+
(n = r.value) == null || n.focus();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function m() {
|
|
26
|
+
i((e.value || 0) + u.step);
|
|
27
|
+
}
|
|
28
|
+
function s() {
|
|
29
|
+
i((e.value || 0) - u.step);
|
|
30
|
+
}
|
|
31
|
+
function v() {
|
|
32
|
+
e.value = null, o("update:modelValue", null);
|
|
33
|
+
}
|
|
34
|
+
const l = a(!1);
|
|
35
|
+
function V() {
|
|
36
|
+
l.value = !0, e.value || (e.value = "");
|
|
37
|
+
}
|
|
38
|
+
function h() {
|
|
39
|
+
l.value = !1, e.value || (e.value = 0);
|
|
40
|
+
}
|
|
41
|
+
const I = p(() => l.value || !!u.modelValue || u.dirty);
|
|
42
|
+
return b(() => u.modelValue, (n) => {
|
|
43
|
+
e.value = n;
|
|
44
|
+
}), {
|
|
45
|
+
inputValue: e,
|
|
46
|
+
numberInput: r,
|
|
47
|
+
inputKey: f,
|
|
48
|
+
updateValue: i,
|
|
49
|
+
onIncrement: m,
|
|
50
|
+
onDecrement: s,
|
|
51
|
+
onClear: v,
|
|
52
|
+
focus: l,
|
|
53
|
+
handleFocus: V,
|
|
54
|
+
isActive: I,
|
|
55
|
+
handleBlur: h
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
F as useKunNumberField
|
|
60
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import u from "./components/KunBudge/src/components/KunBudge.vue.js";
|
|
|
8
8
|
import f from "./components/KunCard/src/components/KunCard.vue.js";
|
|
9
9
|
import K from "./components/KunCardActions/src/components/KunCardActions.vue.js";
|
|
10
10
|
import _ from "./components/KunCardItem/src/components/KunCardItem.vue.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import e from "./components/KunCardSubtitle/src/components/KunCardSubtitle.vue.js";
|
|
12
|
+
import p from "./components/KunCardText/src/components/KunCardText.vue.js";
|
|
13
13
|
import c from "./components/KunCardTitle/src/components/KunCardTitle.vue.js";
|
|
14
14
|
import $ from "./components/KunChip/src/components/KunChip.vue.js";
|
|
15
15
|
import l from "./components/KunCol/src/components/KunCol.vue.js";
|
|
@@ -25,17 +25,18 @@ import x from "./components/KunListItem/src/components/KunListItem.vue.js";
|
|
|
25
25
|
import h from "./components/KunListItemAction/src/components/KunListItemAction.vue.js";
|
|
26
26
|
import g from "./components/KunListItemAvatar/src/components/KunListItemAvatar.vue.js";
|
|
27
27
|
import w from "./components/KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
28
|
+
import F from "./components/KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
29
|
+
import v from "./components/KunListItemText/src/components/KunListItemText.vue.js";
|
|
30
|
+
import B from "./components/KunListSubheader/src/components/KunListSubheader.vue.js";
|
|
31
31
|
import y from "./components/kunMenu/src/components/kunMenu.vue.js";
|
|
32
|
-
import D from "./components/
|
|
33
|
-
import G from "./components/
|
|
34
|
-
import R from "./components/
|
|
35
|
-
import j from "./components/
|
|
36
|
-
import k from "./components/
|
|
37
|
-
import q from "./components/
|
|
38
|
-
import M from "./components/
|
|
32
|
+
import D from "./components/KunNumberField/src/components/KunNumberField.vue.js";
|
|
33
|
+
import G from "./components/KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
|
|
34
|
+
import R from "./components/KunRow/src/components/KunRow.vue.js";
|
|
35
|
+
import j from "./components/KunSlider/src/components/KunSlider.vue.js";
|
|
36
|
+
import k from "./components/KunSpacer/src/components/KunSpacer.vue.js";
|
|
37
|
+
import q from "./components/KunSwitch/src/components/KunSwitch.vue.js";
|
|
38
|
+
import M from "./components/KunTextField/src/components/KunTextField.vue.js";
|
|
39
|
+
import N from "./components/KunToolbar/src/components/KunToolbar.vue.js";
|
|
39
40
|
import z from "./components/KunTooltip/src/components/KunTooltip.vue.js";
|
|
40
41
|
const n = {
|
|
41
42
|
KunAlert: r,
|
|
@@ -47,9 +48,9 @@ const n = {
|
|
|
47
48
|
KunCard: f,
|
|
48
49
|
KunCardActions: K,
|
|
49
50
|
KunCardItem: _,
|
|
50
|
-
KunCardSubtitle:
|
|
51
|
-
KunListItemTitle:
|
|
52
|
-
KunCardText:
|
|
51
|
+
KunCardSubtitle: e,
|
|
52
|
+
KunListItemTitle: F,
|
|
53
|
+
KunCardText: p,
|
|
53
54
|
KunCardTitle: c,
|
|
54
55
|
KunChip: $,
|
|
55
56
|
KunCol: l,
|
|
@@ -65,19 +66,20 @@ const n = {
|
|
|
65
66
|
KunListItemAction: h,
|
|
66
67
|
KunListItemAvatar: g,
|
|
67
68
|
KunListItemSubtitle: w,
|
|
68
|
-
KunListItemText:
|
|
69
|
-
KunListSubheader:
|
|
69
|
+
KunListItemText: v,
|
|
70
|
+
KunListSubheader: B,
|
|
70
71
|
KunMenu: y,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
KunNumberField: D,
|
|
73
|
+
KunLoaderCircular: G,
|
|
74
|
+
KunRow: R,
|
|
75
|
+
KunSlider: j,
|
|
76
|
+
KunSpacer: k,
|
|
77
|
+
KunSwitch: q,
|
|
78
|
+
KunTextField: M,
|
|
79
|
+
KunToolbar: N,
|
|
78
80
|
KunTooltip: z
|
|
79
81
|
};
|
|
80
|
-
function
|
|
82
|
+
function wm(i) {
|
|
81
83
|
for (const m in n)
|
|
82
84
|
i.component(m, n[m]);
|
|
83
85
|
}
|
|
@@ -91,8 +93,8 @@ export {
|
|
|
91
93
|
f as KunCard,
|
|
92
94
|
K as KunCardActions,
|
|
93
95
|
_ as KunCardItem,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
e as KunCardSubtitle,
|
|
97
|
+
p as KunCardText,
|
|
96
98
|
c as KunCardTitle,
|
|
97
99
|
$ as KunChip,
|
|
98
100
|
l as KunCol,
|
|
@@ -108,17 +110,17 @@ export {
|
|
|
108
110
|
h as KunListItemAction,
|
|
109
111
|
g as KunListItemAvatar,
|
|
110
112
|
w as KunListItemSubtitle,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
v as KunListItemText,
|
|
114
|
+
F as KunListItemTitle,
|
|
115
|
+
B as KunListSubheader,
|
|
116
|
+
G as KunLoaderCircular,
|
|
115
117
|
y as KunMenu,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
R as KunRow,
|
|
119
|
+
j as KunSlider,
|
|
120
|
+
k as KunSpacer,
|
|
121
|
+
q as KunSwitch,
|
|
122
|
+
M as KunTextField,
|
|
123
|
+
N as KunToolbar,
|
|
122
124
|
z as KunTooltip,
|
|
123
|
-
|
|
125
|
+
wm as install
|
|
124
126
|
};
|