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