@varlet/ui 3.4.0 → 3.5.0-alpha.1726330414687
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 +20 -11
- package/es/auto-complete/props.mjs +1 -1
- package/es/checkbox/props.mjs +1 -1
- package/es/checkbox-group/props.mjs +1 -1
- package/es/counter/props.mjs +2 -2
- package/es/field-decorator/FieldDecorator.mjs +7 -0
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/props.mjs +1 -1
- package/es/menu-select/MenuSelect.mjs +1 -0
- package/es/menu-select/props.mjs +9 -2
- package/es/radio/props.mjs +1 -1
- package/es/radio-group/props.mjs +1 -1
- package/es/select/props.mjs +1 -1
- package/es/slider/props.mjs +1 -1
- package/es/snackbar/style/index.mjs +1 -1
- package/es/swipe/Swipe.mjs +6 -1
- package/es/swipe/provide.mjs +26 -2
- 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 +5521 -5466
- package/highlight/web-types.en-US.json +33 -24
- package/highlight/web-types.zh-CN.json +34 -25
- package/lib/varlet.cjs.js +137 -72
- package/package.json +8 -7
- package/types/autoComplete.d.ts +2 -1
- package/types/checkbox.d.ts +2 -2
- package/types/checkboxGroup.d.ts +2 -1
- package/types/counter.d.ts +4 -4
- package/types/input.d.ts +9 -2
- package/types/radio.d.ts +2 -2
- package/types/radioGroup.d.ts +2 -1
- package/types/rate.d.ts +2 -2
- package/types/select.d.ts +9 -2
- package/types/slider.d.ts +2 -1
- package/types/switch.d.ts +2 -2
- package/types/tooltip.d.ts +1 -0
- package/types/uploader.d.ts +2 -2
- package/types/varComponent.d.ts +4 -0
- package/umd/varlet.js +7 -7
|
@@ -55,7 +55,8 @@ function __render__(_ctx, _cache) {
|
|
|
55
55
|
"popover-class": _ctx.variant === "standard" ? _ctx.n("--standard-menu-margin") : void 0,
|
|
56
56
|
show: _ctx.isShowMenuSelect,
|
|
57
57
|
"onUpdate:show": _cache[1] || (_cache[1] = ($event) => _ctx.isShowMenuSelect = $event),
|
|
58
|
-
"onUpdate:modelValue": _ctx.handleAutoComplete
|
|
58
|
+
"onUpdate:modelValue": _ctx.handleAutoComplete,
|
|
59
|
+
onKeyEscape: _ctx.handleKeyEscape
|
|
59
60
|
}, {
|
|
60
61
|
options: _withCtx(() => [
|
|
61
62
|
_createElementVNode(
|
|
@@ -146,7 +147,7 @@ function __render__(_ctx, _cache) {
|
|
|
146
147
|
]),
|
|
147
148
|
_: 3
|
|
148
149
|
/* FORWARDED */
|
|
149
|
-
}, 8, ["disabled", "class", "popover-class", "show", "onUpdate:modelValue"]),
|
|
150
|
+
}, 8, ["disabled", "class", "popover-class", "show", "onUpdate:modelValue", "onKeyEscape"]),
|
|
150
151
|
_createVNode(_component_var_form_details, {
|
|
151
152
|
"error-message": _ctx.errorMessage,
|
|
152
153
|
"extra-message": _ctx.maxlengthText
|
|
@@ -303,15 +304,22 @@ const __sfc__ = defineComponent({
|
|
|
303
304
|
validateWithTrigger("onChange");
|
|
304
305
|
}
|
|
305
306
|
function handleAutoComplete(newValue) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
return __async(this, null, function* () {
|
|
308
|
+
var _a;
|
|
309
|
+
if (props2.maxlength != null) {
|
|
310
|
+
newValue = newValue.slice(0, toNumber(props2.maxlength));
|
|
311
|
+
}
|
|
312
|
+
if (newValue !== value.value) {
|
|
313
|
+
value.value = newValue;
|
|
314
|
+
call(props2.onChange, newValue);
|
|
315
|
+
validateWithTrigger("onChange");
|
|
316
|
+
}
|
|
317
|
+
yield raf();
|
|
318
|
+
(_a = input.value) == null ? void 0 : _a.focus();
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function handleKeyEscape() {
|
|
322
|
+
input.value.focus();
|
|
315
323
|
}
|
|
316
324
|
function getShowMenuSelect(newValue) {
|
|
317
325
|
if (props2.disabled || props2.readonly || (form == null ? void 0 : form.disabled.value) || (form == null ? void 0 : form.readonly.value)) {
|
|
@@ -336,6 +344,7 @@ const __sfc__ = defineComponent({
|
|
|
336
344
|
handleClick,
|
|
337
345
|
handleChange,
|
|
338
346
|
handleBlur,
|
|
347
|
+
handleKeyEscape,
|
|
339
348
|
handleAutoComplete,
|
|
340
349
|
reset,
|
|
341
350
|
validate,
|
|
@@ -38,7 +38,7 @@ const props = __spreadValues({
|
|
|
38
38
|
default: () => ["onInput", "onClear", "onChange"]
|
|
39
39
|
},
|
|
40
40
|
getShow: Function,
|
|
41
|
-
rules: Array,
|
|
41
|
+
rules: [Array, Function, Object],
|
|
42
42
|
onFocus: defineListenerProp(),
|
|
43
43
|
onBlur: defineListenerProp(),
|
|
44
44
|
onInput: defineListenerProp(),
|
package/es/checkbox/props.mjs
CHANGED
package/es/counter/props.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineListenerProp } from "../utils/components.mjs";
|
|
2
2
|
const props = {
|
|
3
3
|
modelValue: {
|
|
4
|
-
type:
|
|
4
|
+
type: Number,
|
|
5
5
|
default: 0
|
|
6
6
|
},
|
|
7
7
|
min: [String, Number],
|
|
@@ -45,7 +45,7 @@ const props = {
|
|
|
45
45
|
type: Array,
|
|
46
46
|
default: () => ["onInputChange", "onLazyChange", "onIncrement", "onDecrement"]
|
|
47
47
|
},
|
|
48
|
-
rules: Array,
|
|
48
|
+
rules: [Array, Function, Object],
|
|
49
49
|
onBeforeChange: defineListenerProp(),
|
|
50
50
|
onChange: defineListenerProp(),
|
|
51
51
|
onIncrement: defineListenerProp(),
|
|
@@ -25,6 +25,7 @@ import { isEmpty, getStyle, call, doubleRaf } from "@varlet/shared";
|
|
|
25
25
|
import { createNamespace } from "../utils/components.mjs";
|
|
26
26
|
import { onWindowResize, onSmartMounted } from "@varlet/use";
|
|
27
27
|
import { usePopup } from "../popup/provide.mjs";
|
|
28
|
+
import { useSwipeResizeDispatcher } from "../swipe/provide.mjs";
|
|
28
29
|
const { name, n, classes } = createNamespace("field-decorator");
|
|
29
30
|
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, Teleport as _Teleport, createBlock as _createBlock, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
30
31
|
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
@@ -237,6 +238,7 @@ const __sfc__ = defineComponent({
|
|
|
237
238
|
const transitionDisabled = ref(true);
|
|
238
239
|
const isFloating = computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocusing));
|
|
239
240
|
const { popup, bindPopup } = usePopup();
|
|
241
|
+
const { bindSwipeResizeDispatcher } = useSwipeResizeDispatcher();
|
|
240
242
|
const color = computed(
|
|
241
243
|
() => !props2.isError ? props2.isFocusing ? props2.focusColor : props2.blurColor : void 0
|
|
242
244
|
);
|
|
@@ -249,6 +251,11 @@ const __sfc__ = defineComponent({
|
|
|
249
251
|
});
|
|
250
252
|
onUpdated(resize);
|
|
251
253
|
call(bindPopup, null);
|
|
254
|
+
call(bindSwipeResizeDispatcher, {
|
|
255
|
+
onResize() {
|
|
256
|
+
nextTick().then(resize);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
252
259
|
if (popup) {
|
|
253
260
|
watch(
|
|
254
261
|
() => popup.show.value,
|
package/es/index.bundle.mjs
CHANGED
|
@@ -268,7 +268,7 @@ import './tooltip/style/index.mjs'
|
|
|
268
268
|
import './uploader/style/index.mjs'
|
|
269
269
|
import './watermark/style/index.mjs'
|
|
270
270
|
|
|
271
|
-
const version = '3.
|
|
271
|
+
const version = '3.5.0-alpha.1726330414687'
|
|
272
272
|
|
|
273
273
|
function install(app) {
|
|
274
274
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -178,7 +178,7 @@ export * from './tooltip/index.mjs'
|
|
|
178
178
|
export * from './uploader/index.mjs'
|
|
179
179
|
export * from './watermark/index.mjs'
|
|
180
180
|
|
|
181
|
-
const version = '3.
|
|
181
|
+
const version = '3.5.0-alpha.1726330414687'
|
|
182
182
|
|
|
183
183
|
function install(app) {
|
|
184
184
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/input/props.mjs
CHANGED
package/es/menu-select/props.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,9 +16,10 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
import { menuProps } from "../menu/index.mjs";
|
|
18
21
|
import { defineListenerProp, pickProps } from "../utils/components.mjs";
|
|
19
|
-
const props = __spreadValues({
|
|
22
|
+
const props = __spreadProps(__spreadValues({
|
|
20
23
|
modelValue: {
|
|
21
24
|
type: [String, Number, Boolean, Array],
|
|
22
25
|
default: void 0
|
|
@@ -64,7 +67,11 @@ const props = __spreadValues({
|
|
|
64
67
|
"onClosed",
|
|
65
68
|
"onClickOutside",
|
|
66
69
|
"onUpdate:show"
|
|
67
|
-
]))
|
|
70
|
+
])), {
|
|
71
|
+
// internal start
|
|
72
|
+
onKeyEscape: defineListenerProp()
|
|
73
|
+
// internal end
|
|
74
|
+
});
|
|
68
75
|
export {
|
|
69
76
|
props
|
|
70
77
|
};
|
package/es/radio/props.mjs
CHANGED
package/es/radio-group/props.mjs
CHANGED
package/es/select/props.mjs
CHANGED
|
@@ -52,7 +52,7 @@ const props = __spreadValues({
|
|
|
52
52
|
type: Array,
|
|
53
53
|
default: () => ["onChange", "onClear", "onClose"]
|
|
54
54
|
},
|
|
55
|
-
rules: Array,
|
|
55
|
+
rules: [Array, Function, Object],
|
|
56
56
|
onFocus: defineListenerProp(),
|
|
57
57
|
onBlur: defineListenerProp(),
|
|
58
58
|
onClose: defineListenerProp(),
|
package/es/slider/props.mjs
CHANGED
package/es/swipe/Swipe.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import VarButton from "../button/index.mjs";
|
|
|
22
22
|
import VarIcon from "../icon/index.mjs";
|
|
23
23
|
import Hover from "../hover/index.mjs";
|
|
24
24
|
import { defineComponent, ref, computed, watch, onActivated } from "vue";
|
|
25
|
-
import { useSwipeItems } from "./provide.mjs";
|
|
25
|
+
import { useSwipeItems, useSwipeResizeListeners } from "./provide.mjs";
|
|
26
26
|
import { props } from "./props.mjs";
|
|
27
27
|
import { clamp, isNumber, toNumber, doubleRaf, preventDefault, call } from "@varlet/shared";
|
|
28
28
|
import { createNamespace } from "../utils/components.mjs";
|
|
@@ -212,6 +212,7 @@ const __sfc__ = defineComponent({
|
|
|
212
212
|
const index = ref(0);
|
|
213
213
|
const hovering = ref(false);
|
|
214
214
|
const { swipeItems, bindSwipeItems, length } = useSwipeItems();
|
|
215
|
+
const { swipeResizeListeners, bindSwipeResizeListeners } = useSwipeResizeListeners();
|
|
215
216
|
const { popup, bindPopup } = usePopup();
|
|
216
217
|
const {
|
|
217
218
|
deltaX,
|
|
@@ -238,6 +239,7 @@ const __sfc__ = defineComponent({
|
|
|
238
239
|
bindSwipeItems(swipeProvider);
|
|
239
240
|
useEventListener(() => window, "keydown", handleKeydown);
|
|
240
241
|
call(bindPopup, null);
|
|
242
|
+
call(bindSwipeResizeListeners, null);
|
|
241
243
|
watch(
|
|
242
244
|
() => length.value,
|
|
243
245
|
() => __async(this, null, function* () {
|
|
@@ -440,6 +442,9 @@ const __sfc__ = defineComponent({
|
|
|
440
442
|
setTimeout(() => {
|
|
441
443
|
lockDuration.value = false;
|
|
442
444
|
});
|
|
445
|
+
swipeResizeListeners.forEach(({ onResize }) => {
|
|
446
|
+
onResize();
|
|
447
|
+
});
|
|
443
448
|
}
|
|
444
449
|
function next(options) {
|
|
445
450
|
return __async(this, null, function* () {
|
package/es/swipe/provide.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { useChildren } from "@varlet/use";
|
|
1
|
+
import { useChildren, useParent } from "@varlet/use";
|
|
2
2
|
const SWIPE_BIND_SWIPE_ITEM_KEY = Symbol("SWIPE_BIND_SWIPE_ITEM_KEY");
|
|
3
|
+
const SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY = Symbol(
|
|
4
|
+
"SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY"
|
|
5
|
+
);
|
|
3
6
|
function useSwipeItems() {
|
|
4
7
|
const { childProviders, length, bindChildren } = useChildren(
|
|
5
8
|
SWIPE_BIND_SWIPE_ITEM_KEY
|
|
@@ -10,7 +13,28 @@ function useSwipeItems() {
|
|
|
10
13
|
bindSwipeItems: bindChildren
|
|
11
14
|
};
|
|
12
15
|
}
|
|
16
|
+
function useSwipeResizeListeners() {
|
|
17
|
+
const { childProviders, bindChildren } = useChildren(
|
|
18
|
+
SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY
|
|
19
|
+
);
|
|
20
|
+
return {
|
|
21
|
+
swipeResizeListeners: childProviders,
|
|
22
|
+
bindSwipeResizeListeners: bindChildren
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function useSwipeResizeDispatcher() {
|
|
26
|
+
const { parentProvider, bindParent } = useParent(
|
|
27
|
+
SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY
|
|
28
|
+
);
|
|
29
|
+
return {
|
|
30
|
+
swipeResizeDispatcher: parentProvider,
|
|
31
|
+
bindSwipeResizeDispatcher: bindParent
|
|
32
|
+
};
|
|
33
|
+
}
|
|
13
34
|
export {
|
|
14
35
|
SWIPE_BIND_SWIPE_ITEM_KEY,
|
|
15
|
-
|
|
36
|
+
SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY,
|
|
37
|
+
useSwipeItems,
|
|
38
|
+
useSwipeResizeDispatcher,
|
|
39
|
+
useSwipeResizeListeners
|
|
16
40
|
};
|
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,
|