adverich-kun-ui 0.1.225 → 0.1.227
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,17 +1,17 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { KunNumberFieldProps as
|
|
3
|
-
import { useKunNumberField as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { getCurrentInstance as x, useSlots as z, computed as E, createElementBlock as l, openBlock as s, createCommentVNode as n, createElementVNode as i, normalizeClass as p, unref as o, toDisplayString as u, mergeProps as P, createBlock as g, renderSlot as C, Fragment as I, renderList as U } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as H } from "../composables/KunNumberFieldProps.js";
|
|
3
|
+
import { useKunNumberField as L } from "../composables/useKunNumberFieldComposable.js";
|
|
4
|
+
import V from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
5
|
+
const q = { class: "w-full flex flex-col relative" }, G = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "h-full"
|
|
8
|
-
},
|
|
8
|
+
}, J = ["disabled"], O = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "mr-2"
|
|
11
|
-
},
|
|
11
|
+
}, Q = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "flex items-center justify-center h-full pl-1"
|
|
14
|
-
},
|
|
14
|
+
}, R = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], T = ["disabled"], W = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "flex items-center h-full"
|
|
17
17
|
}, X = ["disabled"], Y = ["disabled"], Z = {
|
|
@@ -37,30 +37,37 @@ const G = { class: "w-full flex flex-col relative" }, J = {
|
|
|
37
37
|
class: "text-xs text-center"
|
|
38
38
|
}, ce = {
|
|
39
39
|
__name: "KunNumberField",
|
|
40
|
-
props:
|
|
41
|
-
emits: [
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
props: H,
|
|
41
|
+
emits: [
|
|
42
|
+
"update:modelValue",
|
|
43
|
+
"focusInput",
|
|
44
|
+
"blurInput",
|
|
45
|
+
"handleClick",
|
|
46
|
+
"keyDown",
|
|
47
|
+
"keyUp"
|
|
48
|
+
],
|
|
49
|
+
setup(j, { emit: A }) {
|
|
50
|
+
const b = j, y = A, c = `number-input-${x().uid}`, k = z(), D = !!k["prepend-icon"], F = !!k["append-icon"], {
|
|
44
51
|
inputValue: f,
|
|
45
|
-
numberInput:
|
|
46
|
-
inputKey:
|
|
47
|
-
updateValue:
|
|
52
|
+
numberInput: K,
|
|
53
|
+
inputKey: B,
|
|
54
|
+
updateValue: M,
|
|
48
55
|
onIncrement: d,
|
|
49
56
|
onDecrement: a,
|
|
50
|
-
onClear:
|
|
51
|
-
focus:
|
|
52
|
-
handleFocus:
|
|
53
|
-
isActive:
|
|
54
|
-
handleBlur:
|
|
55
|
-
} =
|
|
56
|
-
return (e,
|
|
57
|
-
e.label ? (
|
|
57
|
+
onClear: m,
|
|
58
|
+
focus: h,
|
|
59
|
+
handleFocus: v,
|
|
60
|
+
isActive: N,
|
|
61
|
+
handleBlur: w
|
|
62
|
+
} = L(b, y), S = E(() => b.density === "compact" ? "p-1" : b.density === "comfortable" ? "p-2" : "p-3");
|
|
63
|
+
return (e, r) => (s(), l("div", q, [
|
|
64
|
+
e.label ? (s(), l("label", {
|
|
58
65
|
key: 0,
|
|
59
|
-
for:
|
|
66
|
+
for: c,
|
|
60
67
|
class: p([
|
|
61
68
|
e.labelColor,
|
|
62
69
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
63
|
-
|
|
70
|
+
o(N) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
64
71
|
])
|
|
65
72
|
}, u(e.label), 3)) : n("", !0),
|
|
66
73
|
i("div", P({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
@@ -68,70 +75,72 @@ const G = { class: "w-full flex flex-col relative" }, J = {
|
|
|
68
75
|
class: p(["flex items-center w-full h-full border", [
|
|
69
76
|
e.bgInput,
|
|
70
77
|
e.rounded,
|
|
71
|
-
|
|
78
|
+
o(h) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
72
79
|
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
73
80
|
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
74
81
|
]])
|
|
75
82
|
}, [
|
|
76
|
-
!e.noArrows && e.controlVariant === "split" ? (
|
|
83
|
+
!e.noArrows && e.controlVariant === "split" ? (s(), l("div", G, [
|
|
77
84
|
i("button", {
|
|
78
85
|
type: "button",
|
|
79
86
|
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
80
|
-
onClick:
|
|
87
|
+
onClick: r[0] || (r[0] = (...t) => o(a) && o(a)(...t)),
|
|
81
88
|
disabled: e.disabled || e.readonly
|
|
82
|
-
}, "−", 8,
|
|
89
|
+
}, "−", 8, J)
|
|
83
90
|
])) : n("", !0),
|
|
84
|
-
e.prefix ? (
|
|
85
|
-
e.prependIcon ||
|
|
86
|
-
e.prependIcon ? (
|
|
91
|
+
e.prefix ? (s(), l("div", O, u(e.prefix), 1)) : n("", !0),
|
|
92
|
+
e.prependIcon || D ? (s(), l("div", Q, [
|
|
93
|
+
e.prependIcon ? (s(), g(V, {
|
|
87
94
|
key: 0,
|
|
88
95
|
icon: e.prependIcon
|
|
89
|
-
}, null, 8, ["icon"])) :
|
|
96
|
+
}, null, 8, ["icon"])) : C(e.$slots, "prepend-icon", { key: 1 })
|
|
90
97
|
])) : n("", !0),
|
|
91
|
-
(
|
|
92
|
-
id:
|
|
98
|
+
(s(), l("input", {
|
|
99
|
+
id: c,
|
|
93
100
|
ref_key: "numberInput",
|
|
94
|
-
ref:
|
|
95
|
-
key:
|
|
101
|
+
ref: K,
|
|
102
|
+
key: o(B),
|
|
96
103
|
type: "text",
|
|
97
|
-
value:
|
|
104
|
+
value: o(f),
|
|
98
105
|
placeholder: e.placeholder,
|
|
99
106
|
readonly: e.readonly,
|
|
100
107
|
disabled: e.disabled,
|
|
101
108
|
maxlength: e.maxlength,
|
|
102
109
|
autocomplete: "off",
|
|
103
|
-
class: p(["w-full h-full bg-transparent rounded focus:outline-none", [
|
|
110
|
+
class: p(["w-full h-full bg-transparent rounded focus:outline-none", [S.value, e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
104
111
|
"aria-invalid": e.error ? "true" : "false",
|
|
105
|
-
onInput:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
onInput: r[1] || (r[1] = (t) => o(M)(t.target.value)),
|
|
113
|
+
onBlur: r[2] || (r[2] = (...t) => o(w) && o(w)(...t)),
|
|
114
|
+
onFocus: r[3] || (r[3] = (...t) => o(v) && o(v)(...t)),
|
|
115
|
+
onKeydown: r[4] || (r[4] = (t) => y("keyDown", t)),
|
|
116
|
+
onKeyup: r[5] || (r[5] = (t) => y("keyUp", t))
|
|
117
|
+
}, null, 42, R)),
|
|
118
|
+
e.clearable && o(f) != null ? (s(), l("button", {
|
|
110
119
|
key: 3,
|
|
111
120
|
type: "button",
|
|
112
|
-
onClick:
|
|
121
|
+
onClick: r[6] || (r[6] = (...t) => o(m) && o(m)(...t)),
|
|
113
122
|
class: p(["ml-2", e.textColor]),
|
|
114
123
|
disabled: e.disabled || e.readonly
|
|
115
|
-
}, " × ", 10,
|
|
116
|
-
e.noArrows ? n("", !0) : (
|
|
117
|
-
e.controlVariant === "default" ? (
|
|
124
|
+
}, " × ", 10, T)) : n("", !0),
|
|
125
|
+
e.noArrows ? n("", !0) : (s(), l(I, { key: 4 }, [
|
|
126
|
+
e.controlVariant === "default" ? (s(), l("div", W, [
|
|
118
127
|
i("button", {
|
|
119
128
|
type: "button",
|
|
120
129
|
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",
|
|
121
|
-
onClick:
|
|
130
|
+
onClick: r[7] || (r[7] = (...t) => o(d) && o(d)(...t)),
|
|
122
131
|
disabled: e.disabled || e.readonly
|
|
123
132
|
}, " ▲ ", 8, X),
|
|
124
133
|
i("button", {
|
|
125
134
|
type: "button",
|
|
126
135
|
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",
|
|
127
|
-
onClick:
|
|
136
|
+
onClick: r[8] || (r[8] = (...t) => o(a) && o(a)(...t)),
|
|
128
137
|
disabled: e.disabled || e.readonly
|
|
129
138
|
}, " ▼ ", 8, Y)
|
|
130
139
|
])) : n("", !0),
|
|
131
|
-
e.controlVariant === "stacked" ? (
|
|
140
|
+
e.controlVariant === "stacked" ? (s(), l("div", Z, [
|
|
132
141
|
i("div", {
|
|
133
142
|
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
134
|
-
onClick:
|
|
143
|
+
onClick: r[9] || (r[9] = (...t) => o(d) && o(d)(...t))
|
|
135
144
|
}, [
|
|
136
145
|
i("button", {
|
|
137
146
|
type: "button",
|
|
@@ -141,7 +150,7 @@ const G = { class: "w-full flex flex-col relative" }, J = {
|
|
|
141
150
|
]),
|
|
142
151
|
i("div", {
|
|
143
152
|
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
144
|
-
onClick:
|
|
153
|
+
onClick: r[10] || (r[10] = (...t) => o(a) && o(a)(...t))
|
|
145
154
|
}, [
|
|
146
155
|
i("button", {
|
|
147
156
|
type: "button",
|
|
@@ -151,28 +160,28 @@ const G = { class: "w-full flex flex-col relative" }, J = {
|
|
|
151
160
|
])
|
|
152
161
|
])) : n("", !0)
|
|
153
162
|
], 64)),
|
|
154
|
-
e.appendIcon ||
|
|
155
|
-
e.appendIcon ? (
|
|
163
|
+
e.appendIcon || F ? (s(), l("div", te, [
|
|
164
|
+
e.appendIcon ? (s(), g(V, {
|
|
156
165
|
key: 0,
|
|
157
166
|
icon: e.appendIcon
|
|
158
|
-
}, null, 8, ["icon"])) :
|
|
167
|
+
}, null, 8, ["icon"])) : C(e.$slots, "append-icon", { key: 1 })
|
|
159
168
|
])) : n("", !0),
|
|
160
|
-
!e.noArrows && e.controlVariant === "split" ? (
|
|
169
|
+
!e.noArrows && e.controlVariant === "split" ? (s(), l("div", oe, [
|
|
161
170
|
i("button", {
|
|
162
171
|
type: "button",
|
|
163
172
|
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
164
|
-
onClick:
|
|
173
|
+
onClick: r[11] || (r[11] = (...t) => o(d) && o(d)(...t)),
|
|
165
174
|
disabled: e.disabled || e.readonly
|
|
166
175
|
}, "+", 8, re)
|
|
167
176
|
])) : n("", !0),
|
|
168
|
-
e.suffix ? (
|
|
177
|
+
e.suffix ? (s(), l("div", se, u(e.suffix), 1)) : n("", !0)
|
|
169
178
|
], 2),
|
|
170
|
-
e.hideDetails ? n("", !0) : (
|
|
171
|
-
e.error || e.errorMessages ? (
|
|
172
|
-
Array.isArray(e.errorMessages) ? (
|
|
173
|
-
(
|
|
174
|
-
])) : typeof e.errorMessages == "string" ? (
|
|
175
|
-
])) : e.hint && (e.persistentHint ||
|
|
179
|
+
e.hideDetails ? n("", !0) : (s(), l("div", le, [
|
|
180
|
+
e.error || e.errorMessages ? (s(), l("div", ne, [
|
|
181
|
+
Array.isArray(e.errorMessages) ? (s(), l("div", ie, [
|
|
182
|
+
(s(!0), l(I, null, U(e.errorMessages, (t, $) => (s(), l("div", { key: $ }, u(t), 1))), 128))
|
|
183
|
+
])) : typeof e.errorMessages == "string" ? (s(), l("div", de, u(e.errorMessages), 1)) : n("", !0)
|
|
184
|
+
])) : e.hint && (e.persistentHint || o(h)) ? (s(), l("div", ae, u(e.hint), 1)) : n("", !0)
|
|
176
185
|
]))
|
|
177
186
|
], 16)
|
|
178
187
|
]));
|
|
@@ -25,10 +25,10 @@ function F(u, o) {
|
|
|
25
25
|
function m() {
|
|
26
26
|
i((e.value || 0) + u.step);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function v() {
|
|
29
29
|
i((e.value || 0) - u.step);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function s() {
|
|
32
32
|
e.value = null, o("update:modelValue", null);
|
|
33
33
|
}
|
|
34
34
|
const l = a(!1);
|
|
@@ -47,8 +47,8 @@ function F(u, o) {
|
|
|
47
47
|
inputKey: f,
|
|
48
48
|
updateValue: i,
|
|
49
49
|
onIncrement: m,
|
|
50
|
-
onDecrement:
|
|
51
|
-
onClear:
|
|
50
|
+
onDecrement: v,
|
|
51
|
+
onClear: s,
|
|
52
52
|
focus: l,
|
|
53
53
|
handleFocus: V,
|
|
54
54
|
isActive: I,
|