@wikicasa-dev/components 1.7.29 → 1.7.30
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/BaseInput.js +38 -36
- package/dist/assets/BaseInput.css +1 -1
- package/package.json +1 -1
package/dist/BaseInput.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as N, mergeModels as M, useModel as O, ref as p, watch as $, useAttrs as j, openBlock as
|
|
1
|
+
import { defineComponent as N, mergeModels as M, useModel as O, ref as p, watch as $, useAttrs as j, openBlock as s, createElementBlock as d, normalizeClass as m, unref as o, renderSlot as v, createElementVNode as h, withModifiers as g, withKeys as D, createBlock as G, createCommentVNode as w, Fragment as C, renderList as B } from "vue";
|
|
2
2
|
import J from "./BaseFloatingLabel.js";
|
|
3
3
|
import { useFloatingLabel as Q } from "./useFloatingLabel.js";
|
|
4
4
|
import { _ as R } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
@@ -21,34 +21,36 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
21
21
|
}),
|
|
22
22
|
emits: /* @__PURE__ */ M(["click", "keydownEnterPressed", "focusin", "focusout", "keydown"], ["update:modelValue"]),
|
|
23
23
|
setup(y, { expose: E, emit: H }) {
|
|
24
|
-
const t = y,
|
|
25
|
-
labelState:
|
|
24
|
+
const t = y, r = O(y, "modelValue"), l = p(""), f = H, {
|
|
25
|
+
labelState: u,
|
|
26
26
|
handleFocusIn: P,
|
|
27
27
|
handleFocusOut: V,
|
|
28
28
|
setInlineLabel: F,
|
|
29
29
|
setFloatingLabel: L
|
|
30
|
-
} = Q(f),
|
|
30
|
+
} = Q(f), n = p("text"), k = p({}), b = p(null), q = () => {
|
|
31
31
|
t.feedback && (k.value = t.feedback, t.feedback.valid && typeof t.feedback.valid == "string" && (k.value.valid = [t.feedback.valid]), t.feedback.invalid && typeof t.feedback.invalid == "string" && (k.value.invalid = [t.feedback.invalid]));
|
|
32
32
|
}, T = (e, i) => {
|
|
33
33
|
if (!t.formatter || !t.formatter.formatFn)
|
|
34
|
-
return n.value = e, "";
|
|
35
|
-
const a = e.length ? t.formatter.formatFn(e) : e;
|
|
36
|
-
return i && (i.value = a), n.value = a, a;
|
|
37
|
-
}, I = (e) => {
|
|
38
|
-
if (!t.formatter || !t.formatter.unFormatFn)
|
|
39
34
|
return l.value = e, "";
|
|
40
|
-
const
|
|
41
|
-
return
|
|
35
|
+
const a = e.length ? t.formatter.formatFn(e) : e;
|
|
36
|
+
return i && (i.value = a), l.value = a, a;
|
|
37
|
+
}, I = (e, i = !0) => {
|
|
38
|
+
if (i && (!t.formatter || !t.formatter.unFormatFn))
|
|
39
|
+
return r.value = e, "";
|
|
40
|
+
if (!i || !t.formatter || !t.formatter.unFormatFn)
|
|
41
|
+
return;
|
|
42
|
+
const a = t.formatter.unFormatFn(e);
|
|
43
|
+
return r.value = a ?? "", a;
|
|
42
44
|
}, z = ({ target: e }) => {
|
|
43
45
|
const i = e, a = I(i.value);
|
|
44
|
-
|
|
46
|
+
T(
|
|
45
47
|
`${a}`,
|
|
46
|
-
a ===
|
|
48
|
+
a === r.value ? i : void 0
|
|
47
49
|
);
|
|
48
50
|
}, S = () => {
|
|
49
|
-
|
|
51
|
+
r.value = "", F();
|
|
50
52
|
}, A = () => {
|
|
51
|
-
|
|
53
|
+
n.value === "password" ? n.value = "text" : n.value === "text" && (n.value = "password");
|
|
52
54
|
};
|
|
53
55
|
$(
|
|
54
56
|
() => t.feedback,
|
|
@@ -59,12 +61,12 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
59
61
|
immediate: !0
|
|
60
62
|
}
|
|
61
63
|
), $(
|
|
62
|
-
|
|
64
|
+
r,
|
|
63
65
|
(e) => {
|
|
64
66
|
T(
|
|
65
67
|
`${e}`,
|
|
66
|
-
I(`${e}
|
|
67
|
-
),
|
|
68
|
+
I(`${e}`, !1) === e ? b.value : void 0
|
|
69
|
+
), l.value != null && l.value.length > 0 && u.value !== "floating-label" ? L() : !l.value && document && document.activeElement !== b.value && F();
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
immediate: !0
|
|
@@ -72,20 +74,20 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
72
74
|
), $(
|
|
73
75
|
() => t.keepFloatingLabel,
|
|
74
76
|
(e) => {
|
|
75
|
-
e ? L() : V(
|
|
77
|
+
e ? L() : V(r.value);
|
|
76
78
|
}
|
|
77
79
|
);
|
|
78
80
|
const K = j();
|
|
79
|
-
return
|
|
81
|
+
return n.value = K.type || "text", E({
|
|
80
82
|
select: () => {
|
|
81
83
|
b.value?.select();
|
|
82
84
|
}
|
|
83
|
-
}), (e, i) => (
|
|
85
|
+
}), (e, i) => (s(), d("div", {
|
|
84
86
|
class: m(["input-wrapper uikit-relative uikit-inline-block uikit-w-full [&.has-right-icon.is-invalid_.text-input-icon]:uikit-mr-25px [&.has-right-icon.is-valid_.text-input-icon]:uikit-mr-25px", [
|
|
85
87
|
e.$attrs.class,
|
|
86
88
|
{ "uikit-h-12": e.labelText },
|
|
87
89
|
{ "floating-label": e.labelText },
|
|
88
|
-
u
|
|
90
|
+
o(u) === "floating-label" ? "floating-state" : "inline-state",
|
|
89
91
|
{
|
|
90
92
|
"has-right-icon": e.$attrs["with-right-icon"] !== void 0 ? e.$attrs["with-right-icon"] : !!e.$slots.righticon
|
|
91
93
|
},
|
|
@@ -99,7 +101,7 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
99
101
|
v(e.$slots, "righticon", {
|
|
100
102
|
handleClean: S,
|
|
101
103
|
handleShowPasswd: A,
|
|
102
|
-
curType:
|
|
104
|
+
curType: n.value
|
|
103
105
|
}, void 0, !0),
|
|
104
106
|
h("input", {
|
|
105
107
|
id: e.$attrs.id,
|
|
@@ -125,7 +127,7 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
125
127
|
disabled: e.$attrs.disabled,
|
|
126
128
|
"aria-labelledby": e.$attrs.id,
|
|
127
129
|
readonly: e.$attrs.readonly,
|
|
128
|
-
type:
|
|
130
|
+
type: n.value,
|
|
129
131
|
pattern: e.$attrs.pattern,
|
|
130
132
|
min: e.$attrs.min,
|
|
131
133
|
max: e.$attrs.max,
|
|
@@ -133,10 +135,10 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
133
135
|
inputmode: e.$attrs.inputmode,
|
|
134
136
|
placeholder: e.$attrs.placeholder,
|
|
135
137
|
onClick: i[0] || (i[0] = (a) => f("click", a)),
|
|
136
|
-
onFocusin: i[1] || (i[1] = g(() => e.labelText &&
|
|
137
|
-
onFocusout: i[2] || (i[2] = g((a) => e.labelText && !e.keepFloatingLabel &&
|
|
138
|
+
onFocusin: i[1] || (i[1] = g(() => e.labelText && o(P)(), ["stop"])),
|
|
139
|
+
onFocusout: i[2] || (i[2] = g((a) => e.labelText && !e.keepFloatingLabel && o(V)(l.value), ["stop"])),
|
|
138
140
|
onInput: g(z, ["stop"]),
|
|
139
|
-
value:
|
|
141
|
+
value: l.value,
|
|
140
142
|
onKeydown: [
|
|
141
143
|
i[3] || (i[3] = D(() => f("keydownEnterPressed"), ["enter"])),
|
|
142
144
|
i[4] || (i[4] = (a) => f("keydown", a))
|
|
@@ -159,46 +161,46 @@ import './assets/BaseInput.css';const W = ["id", "data-cy", "name", "autocomplet
|
|
|
159
161
|
class: m(["visible-label uikit-opacity-0", [
|
|
160
162
|
{ "uikit-mx-5px": e.labelText },
|
|
161
163
|
{
|
|
162
|
-
"uikit-visible uikit-inline-block": u
|
|
164
|
+
"uikit-visible uikit-inline-block": o(u) === "floating-label"
|
|
163
165
|
},
|
|
164
166
|
{
|
|
165
|
-
"uikit-invisible uikit-hidden": u
|
|
167
|
+
"uikit-invisible uikit-hidden": o(u) === "inline-label"
|
|
166
168
|
}
|
|
167
169
|
]]),
|
|
168
170
|
innerHTML: e.labelText
|
|
169
171
|
}, null, 10, Y)
|
|
170
172
|
])
|
|
171
173
|
], 2),
|
|
172
|
-
e.labelText ? (
|
|
174
|
+
e.labelText ? (s(), G(J, {
|
|
173
175
|
key: 0,
|
|
174
176
|
for: e.$attrs.id,
|
|
175
177
|
"label-text": e.labelText,
|
|
176
|
-
"label-state": u
|
|
178
|
+
"label-state": o(u),
|
|
177
179
|
"is-valid": e.isValid,
|
|
178
180
|
required: e.$attrs.required,
|
|
179
181
|
disabled: e.$attrs.disabled,
|
|
180
182
|
"label-classes": [
|
|
181
|
-
u
|
|
183
|
+
o(u) === "floating-label" ? "!-uikit-top-1" : "!uikit-top-4",
|
|
182
184
|
e.$attrs["label-classes"]
|
|
183
185
|
]
|
|
184
186
|
}, null, 8, ["for", "label-text", "label-state", "is-valid", "required", "disabled", "label-classes"])) : w("", !0),
|
|
185
187
|
v(e.$slots, "feedback", {}, () => [
|
|
186
|
-
e.isValid === !1 ? (
|
|
188
|
+
e.isValid === !1 ? (s(!0), d(C, { key: 0 }, B(k.value.invalid, (a, c) => (s(), d("div", {
|
|
187
189
|
key: `${e.$attrs.id}_invalid_${c}`,
|
|
188
190
|
class: "uikit-mt-1 uikit-text-12 uikit-text-w-danger",
|
|
189
191
|
innerHTML: a
|
|
190
|
-
}, null, 8, Z))), 128)) : e.isValid === !0 ? (
|
|
192
|
+
}, null, 8, Z))), 128)) : e.isValid === !0 ? (s(!0), d(C, { key: 1 }, B(k.value.valid, (a, c) => (s(), d("div", {
|
|
191
193
|
key: `${e.$attrs.id}_valid_${c}`,
|
|
192
194
|
class: "uikit-mt-1 uikit-text-12 uikit-text-w-primary",
|
|
193
195
|
innerHTML: a
|
|
194
196
|
}, null, 8, U))), 128)) : w("", !0)
|
|
195
197
|
], !0),
|
|
196
|
-
e.$slots["under-label"] ? (
|
|
198
|
+
e.$slots["under-label"] ? (s(), d("div", x, [
|
|
197
199
|
v(e.$slots, "under-label", {}, void 0, !0)
|
|
198
200
|
])) : w("", !0)
|
|
199
201
|
], 2));
|
|
200
202
|
}
|
|
201
|
-
}), ne = /* @__PURE__ */ R(_, [["__scopeId", "data-v-
|
|
203
|
+
}), ne = /* @__PURE__ */ R(_, [["__scopeId", "data-v-3ecaf466"]]);
|
|
202
204
|
export {
|
|
203
205
|
ne as default
|
|
204
206
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.input-wrapper[data-v-
|
|
1
|
+
.input-wrapper[data-v-3ecaf466]{--icon-default-size: 44px}.invalid-bg[data-v-3ecaf466]{--invalid-img: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMicgaGVpZ2h0PScxMicgZmlsbD0nbm9uZScgc3Ryb2tlPScjRkE0RjY0Jz48Y2lyY2xlIGN4PSc2JyBjeT0nNicgcj0nNC41Jy8+PHBhdGggc3Ryb2tlLWxpbmVqb2luPSdyb3VuZCcgZD0nTTUuOCAzLjZoLjRMNiA2LjV6Jy8+PGNpcmNsZSBjeD0nNicgY3k9JzguMicgcj0nLjYnIGZpbGw9JyNGQTRGNjQnIHN0cm9rZT0nbm9uZScvPjwvc3ZnPg==);background-image:var(--invalid-img)}.valid-bg[data-v-3ecaf466]{--valid-img: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA4IDgnPjxwYXRoIGZpbGw9JyMyQjVERkYnIGQ9J00yLjMgNi43My42IDQuNTNjLS40LTEuMDQuNDYtMS40IDEuMS0uOGwxLjEgMS40IDMuNC0zLjhjLjYtLjYzIDEuNi0uMjcgMS4yLjdsLTQgNC42Yy0uNDMuNS0uOC40LTEuMS4xeicvPjwvc3ZnPg==);background-image:var(--valid-img)}.invalid-bg[data-v-3ecaf466],.valid-bg[data-v-3ecaf466]{background-position:top 17px right 12px;background-size:20px}.has-right-icon[data-v-3ecaf466]>label.inline-label{right:var(--icon-default-size)}.has-left-icon[data-v-3ecaf466]>label.inline-label{left:var(--icon-default-size)}[data-v-3ecaf466] .text-input-icon{position:absolute;z-index:20;box-sizing:border-box;--icon-size-sm: 16px;--icon-size-md: 20px;--icon-size-lg: 25px}[data-v-3ecaf466] .text-input-icon.left{left:5px}[data-v-3ecaf466] .text-input-icon.right{right:5px}[data-v-3ecaf466] .text-input-icon{--icon-top: 5px;--icon-size: var(--icon-size-sm);width:var(--icon-default-size);height:var(--icon-default-size);padding:calc((var(--icon-default-size) - var(--icon-size)) / 2);top:var(--icon-top)}[data-v-3ecaf466] .text-input-icon.md{--icon-size: var(--icon-size-md)}[data-v-3ecaf466] .text-input-icon.lg{--icon-top: 0;--icon-size: var(--icon-size-lg)}.under-label[data-v-3ecaf466]{left:4px;font-style:italic}
|