@varlet/ui 3.3.16 → 3.5.0-alpha.1726249557629
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/es/auto-complete/AutoComplete.mjs +361 -0
- package/es/auto-complete/AutoCompleteSfc.css +0 -0
- package/es/auto-complete/autoComplete.css +1 -0
- package/es/auto-complete/index.mjs +11 -0
- package/es/auto-complete/props.mjs +63 -0
- package/es/auto-complete/provide.mjs +0 -0
- package/es/auto-complete/style/index.mjs +11 -0
- package/es/checkbox/props.mjs +1 -1
- package/es/checkbox-group/CheckboxGroup.mjs +3 -5
- package/es/checkbox-group/props.mjs +5 -2
- package/es/counter/props.mjs +1 -1
- package/es/field-decorator/FieldDecorator.mjs +8 -8
- package/es/field-decorator/props.mjs +1 -1
- package/es/index.bundle.mjs +7 -1
- package/es/index.mjs +6 -1
- package/es/input/Input.mjs +12 -13
- package/es/input/props.mjs +22 -3
- package/es/menu-option/MenuOption.mjs +5 -2
- package/es/menu-option/menuOption.css +1 -1
- package/es/menu-select/MenuSelect.mjs +4 -5
- package/es/menu-select/props.mjs +13 -3
- package/es/radio/props.mjs +1 -1
- package/es/radio-group/RadioGroup.mjs +4 -6
- package/es/radio-group/props.mjs +5 -2
- package/es/select/Select.mjs +3 -5
- package/es/select/props.mjs +5 -2
- package/es/slider/props.mjs +1 -1
- package/es/style.css +1 -1
- package/es/style.mjs +1 -0
- package/es/switch/props.mjs +1 -1
- package/es/tooltip/Tooltip.mjs +5 -1
- package/es/tooltip/props.mjs +1 -0
- package/es/uploader/props.mjs +1 -1
- package/es/utils/components.mjs +30 -9
- package/es/varlet.esm.js +14219 -13843
- package/highlight/web-types.en-US.json +268 -30
- package/highlight/web-types.zh-CN.json +270 -32
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +15305 -14844
- package/package.json +9 -8
- package/types/autoComplete.d.ts +84 -0
- package/types/checkbox.d.ts +3 -3
- package/types/checkboxGroup.d.ts +1 -1
- package/types/counter.d.ts +1 -1
- package/types/index.d.ts +2 -0
- package/types/input.d.ts +2 -1
- package/types/radio.d.ts +1 -1
- package/types/radioGroup.d.ts +1 -1
- package/types/rate.d.ts +1 -1
- package/types/select.d.ts +1 -1
- package/types/slider.d.ts +1 -1
- package/types/styleVars.d.ts +1 -0
- package/types/switch.d.ts +1 -1
- package/types/tooltip.d.ts +1 -0
- package/types/uploader.d.ts +1 -1
- package/umd/varlet.js +8 -8
package/es/style.mjs
CHANGED
package/es/switch/props.mjs
CHANGED
package/es/tooltip/Tooltip.mjs
CHANGED
|
@@ -43,7 +43,11 @@ function __render__(_ctx, _cache) {
|
|
|
43
43
|
_createElementVNode(
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
|
-
style: _normalizeStyle({
|
|
46
|
+
style: _normalizeStyle({
|
|
47
|
+
background: _ctx.color,
|
|
48
|
+
color: _ctx.textColor,
|
|
49
|
+
width: _ctx.sameWidth ? _ctx.toSizeUnit(Math.ceil(_ctx.hostSize.width)) : void 0
|
|
50
|
+
}),
|
|
47
51
|
class: _normalizeClass(_ctx.classes(_ctx.n("content-container"), _ctx.n(`--${_ctx.type}`))),
|
|
48
52
|
role: "tooltip"
|
|
49
53
|
},
|
package/es/tooltip/props.mjs
CHANGED
package/es/uploader/props.mjs
CHANGED
package/es/utils/components.mjs
CHANGED
|
@@ -48,7 +48,15 @@ import {
|
|
|
48
48
|
Fragment,
|
|
49
49
|
defineComponent
|
|
50
50
|
} from "vue";
|
|
51
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
createNamespaceFn,
|
|
53
|
+
hasOwn,
|
|
54
|
+
isArray,
|
|
55
|
+
isFunction,
|
|
56
|
+
isPlainObject,
|
|
57
|
+
isString,
|
|
58
|
+
normalizeToArray
|
|
59
|
+
} from "@varlet/shared";
|
|
52
60
|
function pickProps(props, propsKey) {
|
|
53
61
|
return isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
|
|
54
62
|
pickedProps[key] = props[key];
|
|
@@ -124,17 +132,28 @@ function flatFragment(vNodes) {
|
|
|
124
132
|
});
|
|
125
133
|
return result;
|
|
126
134
|
}
|
|
135
|
+
function isZodRule(rule) {
|
|
136
|
+
return isPlainObject(rule) && isFunction(rule.safeParseAsync);
|
|
137
|
+
}
|
|
138
|
+
function isZodResult(result) {
|
|
139
|
+
return isPlainObject(result) && hasOwn(result, "success");
|
|
140
|
+
}
|
|
127
141
|
function useValidation() {
|
|
128
142
|
const errorMessage = ref("");
|
|
129
|
-
const validate = (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
const validate = (ruleOrRules, value, apis) => __async(this, null, function* () {
|
|
144
|
+
const rules = normalizeToArray(ruleOrRules).filter((rule) => isZodRule(rule) || isFunction(rule));
|
|
145
|
+
const results = yield Promise.all(
|
|
146
|
+
rules.map((rule) => isZodRule(rule) ? rule.safeParseAsync(value) : rule(value, apis))
|
|
147
|
+
);
|
|
134
148
|
resetValidation();
|
|
135
|
-
return !
|
|
136
|
-
if (
|
|
137
|
-
|
|
149
|
+
return !results.some((result) => {
|
|
150
|
+
if (isZodResult(result)) {
|
|
151
|
+
if (result.success === false) {
|
|
152
|
+
errorMessage.value = result.error.issues[0].message;
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
} else if (result !== true) {
|
|
156
|
+
errorMessage.value = String(result);
|
|
138
157
|
return true;
|
|
139
158
|
}
|
|
140
159
|
return false;
|
|
@@ -208,6 +227,8 @@ export {
|
|
|
208
227
|
defineListenerProp,
|
|
209
228
|
flatFragment,
|
|
210
229
|
formatElevation,
|
|
230
|
+
isZodResult,
|
|
231
|
+
isZodRule,
|
|
211
232
|
mount,
|
|
212
233
|
mountInstance,
|
|
213
234
|
pickProps,
|