adverich-kun-ui 0.1.265 → 0.1.266
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,11 +1,8 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { KunNumberFieldProps as
|
|
3
|
-
import { useKunNumberField as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
class: "w-full flex flex-col relative",
|
|
7
|
-
ref: "rootRef"
|
|
8
|
-
}, G = {
|
|
1
|
+
import { getCurrentInstance as E, useSlots as P, computed as R, createElementBlock as l, openBlock as s, createCommentVNode as n, createElementVNode as i, normalizeClass as p, unref as o, toDisplayString as u, mergeProps as U, createBlock as I, renderSlot as V, Fragment as j, renderList as H } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as L } from "../composables/KunNumberFieldProps.js";
|
|
3
|
+
import { useKunNumberField as q } from "../composables/useKunNumberFieldComposable.js";
|
|
4
|
+
import x from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
5
|
+
const G = {
|
|
9
6
|
key: 0,
|
|
10
7
|
class: "h-full"
|
|
11
8
|
}, J = ["disabled"], O = {
|
|
@@ -38,9 +35,9 @@ const q = {
|
|
|
38
35
|
}, de = { key: 0 }, ae = { key: 1 }, ue = {
|
|
39
36
|
key: 1,
|
|
40
37
|
class: "text-xs text-center"
|
|
41
|
-
},
|
|
38
|
+
}, ke = {
|
|
42
39
|
__name: "KunNumberField",
|
|
43
|
-
props:
|
|
40
|
+
props: L,
|
|
44
41
|
emits: [
|
|
45
42
|
"update:modelValue",
|
|
46
43
|
"focusInput",
|
|
@@ -49,41 +46,46 @@ const q = {
|
|
|
49
46
|
"keyDown",
|
|
50
47
|
"keyUp"
|
|
51
48
|
],
|
|
52
|
-
setup(
|
|
53
|
-
const b =
|
|
54
|
-
inputValue:
|
|
49
|
+
setup(A, { expose: D, emit: F }) {
|
|
50
|
+
const b = A, y = F, f = `number-input-${E().uid}`, k = P(), K = !!k["prepend-icon"], B = !!k["append-icon"], {
|
|
51
|
+
inputValue: c,
|
|
55
52
|
numberInput: m,
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
rootRef: h,
|
|
54
|
+
inputKey: M,
|
|
55
|
+
updateValue: N,
|
|
58
56
|
onIncrement: d,
|
|
59
57
|
onDecrement: a,
|
|
60
|
-
onClear:
|
|
61
|
-
focus:
|
|
62
|
-
handleFocus:
|
|
63
|
-
isActive:
|
|
64
|
-
handleBlur:
|
|
65
|
-
} =
|
|
66
|
-
|
|
58
|
+
onClear: v,
|
|
59
|
+
focus: w,
|
|
60
|
+
handleFocus: g,
|
|
61
|
+
isActive: S,
|
|
62
|
+
handleBlur: C
|
|
63
|
+
} = q(b, y);
|
|
64
|
+
D({
|
|
67
65
|
numberInput: m,
|
|
68
|
-
rootRef
|
|
66
|
+
rootRef: h
|
|
69
67
|
});
|
|
70
|
-
const
|
|
71
|
-
return (e, r) => (s(), l("div",
|
|
68
|
+
const $ = R(() => b.density === "compact" ? "p-1" : b.density === "comfortable" ? "p-2" : "p-3");
|
|
69
|
+
return (e, r) => (s(), l("div", {
|
|
70
|
+
class: "w-full flex flex-col relative",
|
|
71
|
+
ref_key: "rootRef",
|
|
72
|
+
ref: h
|
|
73
|
+
}, [
|
|
72
74
|
e.label ? (s(), l("label", {
|
|
73
75
|
key: 0,
|
|
74
|
-
for:
|
|
76
|
+
for: f,
|
|
75
77
|
class: p([
|
|
76
78
|
e.labelColor,
|
|
77
79
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
78
|
-
o(
|
|
80
|
+
o(S) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
79
81
|
])
|
|
80
82
|
}, u(e.label), 3)) : n("", !0),
|
|
81
|
-
i("div",
|
|
83
|
+
i("div", U({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
82
84
|
i("div", {
|
|
83
85
|
class: p(["flex items-center w-full h-full border", [
|
|
84
86
|
e.bgInput,
|
|
85
87
|
e.rounded,
|
|
86
|
-
o(
|
|
88
|
+
o(w) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
87
89
|
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
88
90
|
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
89
91
|
]])
|
|
@@ -97,40 +99,40 @@ const q = {
|
|
|
97
99
|
}, "−", 8, J)
|
|
98
100
|
])) : n("", !0),
|
|
99
101
|
e.prefix ? (s(), l("div", O, u(e.prefix), 1)) : n("", !0),
|
|
100
|
-
e.prependIcon ||
|
|
101
|
-
e.prependIcon ? (s(),
|
|
102
|
+
e.prependIcon || K ? (s(), l("div", Q, [
|
|
103
|
+
e.prependIcon ? (s(), I(x, {
|
|
102
104
|
key: 0,
|
|
103
105
|
icon: e.prependIcon
|
|
104
|
-
}, null, 8, ["icon"])) :
|
|
106
|
+
}, null, 8, ["icon"])) : V(e.$slots, "prepend-icon", { key: 1 })
|
|
105
107
|
])) : n("", !0),
|
|
106
108
|
(s(), l("input", {
|
|
107
|
-
id:
|
|
109
|
+
id: f,
|
|
108
110
|
ref_key: "numberInput",
|
|
109
111
|
ref: m,
|
|
110
|
-
key: o(
|
|
112
|
+
key: o(M),
|
|
111
113
|
type: "text",
|
|
112
|
-
value: o(
|
|
114
|
+
value: o(c),
|
|
113
115
|
placeholder: e.placeholder,
|
|
114
116
|
readonly: e.readonly,
|
|
115
117
|
disabled: e.disabled,
|
|
116
118
|
maxlength: e.maxlength,
|
|
117
119
|
autocomplete: "off",
|
|
118
|
-
class: p(["w-full h-full bg-transparent rounded focus:outline-none", [
|
|
120
|
+
class: p(["w-full h-full bg-transparent rounded focus:outline-none", [$.value, e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
119
121
|
"aria-invalid": e.error ? "true" : "false",
|
|
120
|
-
onInput: r[1] || (r[1] = (t) => o(
|
|
121
|
-
onBlur: r[2] || (r[2] = (...t) => o(
|
|
122
|
-
onFocus: r[3] || (r[3] = (...t) => o(
|
|
122
|
+
onInput: r[1] || (r[1] = (t) => o(N)(t.target.value)),
|
|
123
|
+
onBlur: r[2] || (r[2] = (...t) => o(C) && o(C)(...t)),
|
|
124
|
+
onFocus: r[3] || (r[3] = (...t) => o(g) && o(g)(...t)),
|
|
123
125
|
onKeydown: r[4] || (r[4] = (t) => y("keyDown", t)),
|
|
124
126
|
onKeyup: r[5] || (r[5] = (t) => y("keyUp", t))
|
|
125
127
|
}, null, 42, T)),
|
|
126
|
-
e.clearable && o(
|
|
128
|
+
e.clearable && o(c) != null ? (s(), l("button", {
|
|
127
129
|
key: 3,
|
|
128
130
|
type: "button",
|
|
129
|
-
onClick: r[6] || (r[6] = (...t) => o(
|
|
131
|
+
onClick: r[6] || (r[6] = (...t) => o(v) && o(v)(...t)),
|
|
130
132
|
class: p(["ml-2", e.textColor]),
|
|
131
133
|
disabled: e.disabled || e.readonly
|
|
132
134
|
}, " × ", 10, W)) : n("", !0),
|
|
133
|
-
e.noArrows ? n("", !0) : (s(), l(
|
|
135
|
+
e.noArrows ? n("", !0) : (s(), l(j, { key: 4 }, [
|
|
134
136
|
e.controlVariant === "default" ? (s(), l("div", X, [
|
|
135
137
|
i("button", {
|
|
136
138
|
type: "button",
|
|
@@ -168,11 +170,11 @@ const q = {
|
|
|
168
170
|
])
|
|
169
171
|
])) : n("", !0)
|
|
170
172
|
], 64)),
|
|
171
|
-
e.appendIcon ||
|
|
172
|
-
e.appendIcon ? (s(),
|
|
173
|
+
e.appendIcon || B ? (s(), l("div", oe, [
|
|
174
|
+
e.appendIcon ? (s(), I(x, {
|
|
173
175
|
key: 0,
|
|
174
176
|
icon: e.appendIcon
|
|
175
|
-
}, null, 8, ["icon"])) :
|
|
177
|
+
}, null, 8, ["icon"])) : V(e.$slots, "append-icon", { key: 1 })
|
|
176
178
|
])) : n("", !0),
|
|
177
179
|
!e.noArrows && e.controlVariant === "split" ? (s(), l("div", re, [
|
|
178
180
|
i("button", {
|
|
@@ -187,14 +189,14 @@ const q = {
|
|
|
187
189
|
e.hideDetails ? n("", !0) : (s(), l("div", ne, [
|
|
188
190
|
e.error || e.errorMessages ? (s(), l("div", ie, [
|
|
189
191
|
Array.isArray(e.errorMessages) ? (s(), l("div", de, [
|
|
190
|
-
(s(!0), l(
|
|
192
|
+
(s(!0), l(j, null, H(e.errorMessages, (t, z) => (s(), l("div", { key: z }, u(t), 1))), 128))
|
|
191
193
|
])) : typeof e.errorMessages == "string" ? (s(), l("div", ae, u(e.errorMessages), 1)) : n("", !0)
|
|
192
|
-
])) : e.hint && (e.persistentHint || o(
|
|
194
|
+
])) : e.hint && (e.persistentHint || o(w)) ? (s(), l("div", ue, u(e.hint), 1)) : n("", !0)
|
|
193
195
|
]))
|
|
194
196
|
], 16)
|
|
195
197
|
], 512));
|
|
196
198
|
}
|
|
197
199
|
};
|
|
198
200
|
export {
|
|
199
|
-
|
|
201
|
+
ke as default
|
|
200
202
|
};
|