@varlet/ui 2.21.0 → 2.22.0-alpha.1705845515578
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/index-bar/IndexBar.mjs +10 -2
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/locale/fa-IR.d.ts +5 -0
- package/es/locale/fa-IR.mjs +108 -0
- package/es/locale/index.mjs +2 -0
- package/es/picker/Picker.mjs +27 -34
- package/es/popup/Popup.mjs +1 -1
- package/es/popup/popup.css +1 -1
- package/es/snackbar/Snackbar.mjs +21 -18
- package/es/snackbar/core.mjs +18 -16
- package/es/snackbar/props.mjs +1 -3
- package/es/snackbar/snackbar.css +1 -1
- package/es/snackbar/style/index.mjs +1 -2
- package/es/style.css +1 -1
- package/es/switch/Switch.mjs +18 -6
- package/es/switch/props.mjs +6 -0
- package/es/varlet.esm.js +4241 -4112
- package/highlight/web-types.en-US.json +39 -8
- package/highlight/web-types.zh-CN.json +40 -9
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +299 -171
- package/package.json +7 -7
- package/types/form.d.ts +1 -1
- package/types/indexBar.d.ts +1 -0
- package/types/rate.d.ts +1 -1
- package/types/styleVars.d.ts +2 -0
- package/types/switch.d.ts +7 -2
- package/umd/varlet.js +5 -5
package/es/switch/Switch.mjs
CHANGED
|
@@ -169,8 +169,11 @@ const __sfc__ = defineComponent({
|
|
|
169
169
|
function validate() {
|
|
170
170
|
return v(props2.rules, props2.modelValue);
|
|
171
171
|
}
|
|
172
|
-
function validateWithTrigger() {
|
|
173
|
-
|
|
172
|
+
function validateWithTrigger(trigger) {
|
|
173
|
+
nextTick(() => {
|
|
174
|
+
const { validateTrigger, rules, modelValue } = props2;
|
|
175
|
+
vt(validateTrigger, trigger, rules, modelValue);
|
|
176
|
+
});
|
|
174
177
|
}
|
|
175
178
|
function switchActive(event) {
|
|
176
179
|
const {
|
|
@@ -182,16 +185,25 @@ const __sfc__ = defineComponent({
|
|
|
182
185
|
modelValue,
|
|
183
186
|
activeValue,
|
|
184
187
|
inactiveValue,
|
|
185
|
-
|
|
188
|
+
lazyChange,
|
|
189
|
+
"onUpdate:modelValue": updateModelValue,
|
|
190
|
+
onBeforeChange
|
|
186
191
|
} = props2;
|
|
187
192
|
call(onClick, event);
|
|
188
193
|
if (disabled || loading || readonly || (form == null ? void 0 : form.disabled.value) || (form == null ? void 0 : form.readonly.value)) {
|
|
189
194
|
return;
|
|
190
195
|
}
|
|
191
196
|
const newValue = modelValue === activeValue ? inactiveValue : activeValue;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
197
|
+
if (lazyChange) {
|
|
198
|
+
call(onBeforeChange, newValue, (value) => {
|
|
199
|
+
call(updateModelValue, value);
|
|
200
|
+
validateWithTrigger("onLazyChange");
|
|
201
|
+
});
|
|
202
|
+
} else {
|
|
203
|
+
call(onChange, newValue);
|
|
204
|
+
call(updateModelValue, newValue);
|
|
205
|
+
validateWithTrigger("onChange");
|
|
206
|
+
}
|
|
195
207
|
}
|
|
196
208
|
function hover(value) {
|
|
197
209
|
if (props2.disabled || (form == null ? void 0 : form.disabled.value)) {
|
package/es/switch/props.mjs
CHANGED
|
@@ -9,6 +9,7 @@ const props = {
|
|
|
9
9
|
inactiveValue: {
|
|
10
10
|
default: false
|
|
11
11
|
},
|
|
12
|
+
lazyChange: Boolean,
|
|
12
13
|
disabled: Boolean,
|
|
13
14
|
readonly: Boolean,
|
|
14
15
|
loading: Boolean,
|
|
@@ -21,7 +22,12 @@ const props = {
|
|
|
21
22
|
type: Boolean,
|
|
22
23
|
default: true
|
|
23
24
|
},
|
|
25
|
+
validateTrigger: {
|
|
26
|
+
type: Array,
|
|
27
|
+
default: () => ["onChange", "onLazyChange"]
|
|
28
|
+
},
|
|
24
29
|
onClick: defineListenerProp(),
|
|
30
|
+
onBeforeChange: defineListenerProp(),
|
|
25
31
|
onChange: defineListenerProp(),
|
|
26
32
|
"onUpdate:modelValue": defineListenerProp()
|
|
27
33
|
};
|