@varlet/ui 2.16.2 → 2.16.3-alpha.1694361535255
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/action-sheet/ActionSheet.mjs +20 -16
- package/es/app-bar/AppBar.mjs +10 -9
- package/es/avatar/Avatar.mjs +16 -15
- package/es/avatar-group/AvatarGroup.mjs +4 -3
- package/es/back-top/BackTop.mjs +20 -19
- package/es/badge/Badge.mjs +4 -3
- package/es/bottom-navigation/BottomNavigation.mjs +70 -63
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +13 -10
- package/es/breadcrumb/Breadcrumb.mjs +5 -4
- package/es/breadcrumbs/Breadcrumbs.mjs +2 -1
- package/es/button/Button.mjs +10 -9
- package/es/button-group/ButtonGroup.mjs +2 -1
- package/es/card/Card.mjs +28 -26
- package/es/cell/Cell.mjs +5 -4
- package/es/checkbox/Checkbox.mjs +32 -29
- package/es/checkbox-group/CheckboxGroup.mjs +45 -40
- package/es/chip/Chip.mjs +6 -5
- package/es/col/Col.mjs +15 -14
- package/es/collapse/Collapse.mjs +30 -29
- package/es/collapse-item/CollapseItem.mjs +52 -47
- package/es/countdown/Countdown.mjs +36 -35
- package/es/counter/Counter.mjs +63 -60
- package/es/date-picker/DatePicker.mjs +67 -63
- package/es/dialog/Dialog.mjs +39 -29
- package/es/divider/Divider.mjs +6 -9
- package/es/drag/Drag.mjs +47 -45
- package/es/ellipsis/Ellipsis.mjs +6 -5
- package/es/fab/Fab.mjs +21 -20
- package/es/field-decorator/FieldDecorator.mjs +14 -13
- package/es/form/Form.mjs +41 -36
- package/es/form-details/FormDetails.mjs +2 -1
- package/es/hover-overlay/HoverOverlay.mjs +6 -7
- package/es/icon/Icon.mjs +14 -12
- package/es/image/Image.mjs +14 -12
- package/es/image-preview/ImagePreview.mjs +51 -50
- package/es/index-anchor/IndexAnchor.mjs +15 -12
- package/es/index-bar/IndexBar.mjs +68 -65
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +63 -56
- package/es/link/Link.mjs +6 -5
- package/es/list/List.mjs +55 -46
- package/es/loading/Loading.mjs +11 -8
- package/es/loading-bar/LoadingBar.mjs +2 -1
- package/es/menu/Menu.mjs +2 -1
- package/es/option/Option.mjs +14 -11
- package/es/overlay/Overlay.mjs +18 -18
- package/es/pagination/Pagination.mjs +67 -64
- package/es/paper/Paper.mjs +4 -3
- package/es/picker/Picker.mjs +95 -85
- package/es/popup/Popup.mjs +26 -23
- package/es/progress/Progress.mjs +9 -8
- package/es/pull-refresh/PullRefresh.mjs +54 -51
- package/es/radio/Radio.mjs +25 -22
- package/es/radio-group/RadioGroup.mjs +30 -25
- package/es/rate/Rate.mjs +35 -28
- package/es/result/Result.mjs +6 -5
- package/es/row/Row.mjs +14 -13
- package/es/select/Select.mjs +57 -54
- package/es/skeleton/Skeleton.mjs +8 -9
- package/es/slider/Slider.mjs +86 -79
- package/es/snackbar/Snackbar.mjs +4 -3
- package/es/snackbar/style/index.mjs +1 -1
- package/es/space/Space.mjs +5 -2
- package/es/step/Step.mjs +7 -4
- package/es/steps/Steps.mjs +5 -4
- package/es/sticky/Sticky.mjs +30 -27
- package/es/style-provider/StyleProvider.mjs +2 -1
- package/es/swipe/Swipe.mjs +95 -89
- package/es/swipe-item/SwipeItem.mjs +5 -4
- package/es/switch/Switch.mjs +22 -17
- package/es/tab/Tab.mjs +16 -12
- package/es/tab-item/TabItem.mjs +7 -6
- package/es/table/Table.mjs +8 -9
- package/es/tabs/Tabs.mjs +57 -52
- package/es/tabs-items/TabsItems.mjs +38 -29
- package/es/time-picker/TimePicker.mjs +63 -60
- package/es/tooltip/Tooltip.mjs +3 -2
- package/es/uploader/Uploader.mjs +100 -85
- package/es/utils/components.mjs +2 -1
- package/es/utils/shared.mjs +0 -1
- package/es/varlet.esm.js +9589 -8914
- package/es/watermark/Watermark.mjs +29 -26
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +2365 -2102
- package/package.json +12 -14
- package/umd/varlet.js +4 -4
package/es/radio/Radio.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { useValidation, createNamespace, call, useVModel } from '../utils/compon
|
|
|
9
9
|
import { useRadioGroup } from './provide.mjs';
|
|
10
10
|
import { useForm } from '../form/provide.mjs';
|
|
11
11
|
var {
|
|
12
|
+
name,
|
|
12
13
|
n,
|
|
13
14
|
classes
|
|
14
15
|
} = createNamespace('radio');
|
|
@@ -57,7 +58,7 @@ function __render__(_ctx, _cache) {
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
var __sfc__ = defineComponent({
|
|
60
|
-
name
|
|
61
|
+
name,
|
|
61
62
|
directives: {
|
|
62
63
|
Ripple,
|
|
63
64
|
Hover
|
|
@@ -92,7 +93,15 @@ var __sfc__ = defineComponent({
|
|
|
92
93
|
// expose
|
|
93
94
|
resetValidation
|
|
94
95
|
} = useValidation();
|
|
95
|
-
var
|
|
96
|
+
var radioProvider = {
|
|
97
|
+
sync,
|
|
98
|
+
validate,
|
|
99
|
+
resetValidation,
|
|
100
|
+
reset
|
|
101
|
+
};
|
|
102
|
+
call(bindRadioGroup, radioProvider);
|
|
103
|
+
call(bindForm, radioProvider);
|
|
104
|
+
function validateWithTrigger(trigger) {
|
|
96
105
|
nextTick(() => {
|
|
97
106
|
var {
|
|
98
107
|
validateTrigger,
|
|
@@ -101,8 +110,8 @@ var __sfc__ = defineComponent({
|
|
|
101
110
|
} = props;
|
|
102
111
|
vt(validateTrigger, trigger, rules, modelValue);
|
|
103
112
|
});
|
|
104
|
-
}
|
|
105
|
-
|
|
113
|
+
}
|
|
114
|
+
function change(changedValue) {
|
|
106
115
|
var {
|
|
107
116
|
checkedValue,
|
|
108
117
|
onChange
|
|
@@ -114,8 +123,8 @@ var __sfc__ = defineComponent({
|
|
|
114
123
|
call(onChange, value.value);
|
|
115
124
|
radioGroup == null ? void 0 : radioGroup.onToggle(checkedValue);
|
|
116
125
|
validateWithTrigger('onChange');
|
|
117
|
-
}
|
|
118
|
-
|
|
126
|
+
}
|
|
127
|
+
function handleClick(e) {
|
|
119
128
|
var {
|
|
120
129
|
disabled,
|
|
121
130
|
readonly,
|
|
@@ -132,26 +141,28 @@ var __sfc__ = defineComponent({
|
|
|
132
141
|
}
|
|
133
142
|
withAnimation.value = true;
|
|
134
143
|
change(checked.value ? uncheckedValue : checkedValue);
|
|
135
|
-
}
|
|
136
|
-
|
|
144
|
+
}
|
|
145
|
+
function sync(v) {
|
|
137
146
|
var {
|
|
138
147
|
checkedValue,
|
|
139
148
|
uncheckedValue
|
|
140
149
|
} = props;
|
|
141
150
|
value.value = v === checkedValue ? checkedValue : uncheckedValue;
|
|
142
|
-
}
|
|
151
|
+
}
|
|
143
152
|
|
|
144
153
|
// expose
|
|
145
|
-
|
|
154
|
+
function reset() {
|
|
146
155
|
value.value = props.uncheckedValue;
|
|
147
156
|
resetValidation();
|
|
148
|
-
}
|
|
157
|
+
}
|
|
149
158
|
|
|
150
159
|
// expose
|
|
151
|
-
|
|
160
|
+
function validate() {
|
|
161
|
+
return v(props.rules, props.modelValue);
|
|
162
|
+
}
|
|
152
163
|
|
|
153
164
|
// expose
|
|
154
|
-
|
|
165
|
+
function toggle(changedValue) {
|
|
155
166
|
var {
|
|
156
167
|
uncheckedValue,
|
|
157
168
|
checkedValue
|
|
@@ -161,15 +172,7 @@ var __sfc__ = defineComponent({
|
|
|
161
172
|
changedValue = checked.value ? uncheckedValue : checkedValue;
|
|
162
173
|
}
|
|
163
174
|
change(changedValue);
|
|
164
|
-
}
|
|
165
|
-
var radioProvider = {
|
|
166
|
-
sync,
|
|
167
|
-
validate,
|
|
168
|
-
resetValidation,
|
|
169
|
-
reset
|
|
170
|
-
};
|
|
171
|
-
call(bindRadioGroup, radioProvider);
|
|
172
|
-
call(bindForm, radioProvider);
|
|
175
|
+
}
|
|
173
176
|
return {
|
|
174
177
|
withAnimation,
|
|
175
178
|
checked,
|
|
@@ -5,6 +5,7 @@ import { useValidation, createNamespace, call } from '../utils/components.mjs';
|
|
|
5
5
|
import { useRadios } from './provide.mjs';
|
|
6
6
|
import { useForm } from '../form/provide.mjs';
|
|
7
7
|
var {
|
|
8
|
+
name,
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
10
11
|
} = createNamespace('radio-group');
|
|
@@ -21,7 +22,7 @@ function __render__(_ctx, _cache) {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
var __sfc__ = defineComponent({
|
|
24
|
-
name
|
|
25
|
+
name,
|
|
25
26
|
components: {
|
|
26
27
|
VarFormDetails
|
|
27
28
|
},
|
|
@@ -43,7 +44,18 @@ var __sfc__ = defineComponent({
|
|
|
43
44
|
resetValidation
|
|
44
45
|
} = useValidation();
|
|
45
46
|
var radioGroupErrorMessage = computed(() => errorMessage.value);
|
|
46
|
-
var
|
|
47
|
+
var radioGroupProvider = {
|
|
48
|
+
onToggle,
|
|
49
|
+
validate,
|
|
50
|
+
reset,
|
|
51
|
+
resetValidation,
|
|
52
|
+
errorMessage: radioGroupErrorMessage
|
|
53
|
+
};
|
|
54
|
+
watch(() => props.modelValue, syncRadios);
|
|
55
|
+
watch(() => length.value, syncRadios);
|
|
56
|
+
call(bindForm, radioGroupProvider);
|
|
57
|
+
bindRadios(radioGroupProvider);
|
|
58
|
+
function validateWithTrigger(trigger) {
|
|
47
59
|
nextTick(() => {
|
|
48
60
|
var {
|
|
49
61
|
validateTrigger,
|
|
@@ -52,38 +64,31 @@ var __sfc__ = defineComponent({
|
|
|
52
64
|
} = props;
|
|
53
65
|
vt(validateTrigger, trigger, rules, modelValue);
|
|
54
66
|
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
}
|
|
68
|
+
function syncRadios() {
|
|
69
|
+
return radios.forEach(_ref => {
|
|
70
|
+
var {
|
|
71
|
+
sync
|
|
72
|
+
} = _ref;
|
|
73
|
+
return sync(props.modelValue);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function onToggle(changedValue) {
|
|
63
77
|
call(props['onUpdate:modelValue'], changedValue);
|
|
64
78
|
call(props.onChange, changedValue);
|
|
65
79
|
validateWithTrigger('onChange');
|
|
66
|
-
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
// expose
|
|
69
|
-
|
|
83
|
+
function validate() {
|
|
84
|
+
return v(props.rules, props.modelValue);
|
|
85
|
+
}
|
|
70
86
|
|
|
71
87
|
// expose
|
|
72
|
-
|
|
88
|
+
function reset() {
|
|
73
89
|
call(props['onUpdate:modelValue'], undefined);
|
|
74
90
|
resetValidation();
|
|
75
|
-
}
|
|
76
|
-
watch(() => props.modelValue, syncRadios);
|
|
77
|
-
watch(() => length.value, syncRadios);
|
|
78
|
-
var radioGroupProvider = {
|
|
79
|
-
onToggle,
|
|
80
|
-
validate,
|
|
81
|
-
reset,
|
|
82
|
-
resetValidation,
|
|
83
|
-
errorMessage: radioGroupErrorMessage
|
|
84
|
-
};
|
|
85
|
-
call(bindForm, radioGroupProvider);
|
|
86
|
-
bindRadios(radioGroupProvider);
|
|
91
|
+
}
|
|
87
92
|
return {
|
|
88
93
|
errorMessage,
|
|
89
94
|
n,
|
package/es/rate/Rate.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { toSizeUnit } from '../utils/elements.mjs';
|
|
|
10
10
|
import { toNumber } from '@varlet/shared';
|
|
11
11
|
import { props } from './props.mjs';
|
|
12
12
|
var {
|
|
13
|
+
name,
|
|
13
14
|
n
|
|
14
15
|
} = createNamespace('rate');
|
|
15
16
|
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createVNode as _createVNode, resolveDirective as _resolveDirective, withDirectives as _withDirectives, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
@@ -51,7 +52,7 @@ function __render__(_ctx, _cache) {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
var __sfc__ = defineComponent({
|
|
54
|
-
name
|
|
55
|
+
name,
|
|
55
56
|
components: {
|
|
56
57
|
VarIcon,
|
|
57
58
|
VarFormDetails,
|
|
@@ -63,6 +64,7 @@ var __sfc__ = defineComponent({
|
|
|
63
64
|
},
|
|
64
65
|
props,
|
|
65
66
|
setup(props) {
|
|
67
|
+
var currentHoveringValue = ref(-1);
|
|
66
68
|
var {
|
|
67
69
|
form,
|
|
68
70
|
bindForm
|
|
@@ -76,9 +78,14 @@ var __sfc__ = defineComponent({
|
|
|
76
78
|
var {
|
|
77
79
|
hovering
|
|
78
80
|
} = useHoverOverlay();
|
|
79
|
-
var currentHoveringValue = ref(-1);
|
|
80
81
|
var lastScore = Number(props.modelValue);
|
|
81
|
-
var
|
|
82
|
+
var rateProvider = {
|
|
83
|
+
reset,
|
|
84
|
+
validate,
|
|
85
|
+
resetValidation
|
|
86
|
+
};
|
|
87
|
+
call(bindForm, rateProvider);
|
|
88
|
+
function getStyle(val) {
|
|
82
89
|
var {
|
|
83
90
|
count,
|
|
84
91
|
gap
|
|
@@ -87,8 +94,8 @@ var __sfc__ = defineComponent({
|
|
|
87
94
|
color: getCurrentState(val).color,
|
|
88
95
|
marginRight: val !== toNumber(count) ? toSizeUnit(gap) : 0
|
|
89
96
|
};
|
|
90
|
-
}
|
|
91
|
-
|
|
97
|
+
}
|
|
98
|
+
function getClass(val) {
|
|
92
99
|
var {
|
|
93
100
|
name,
|
|
94
101
|
color
|
|
@@ -99,8 +106,8 @@ var __sfc__ = defineComponent({
|
|
|
99
106
|
[n('--error')]: errorMessage.value,
|
|
100
107
|
[n('--primary')]: name !== props.emptyIcon && !color
|
|
101
108
|
};
|
|
102
|
-
}
|
|
103
|
-
|
|
109
|
+
}
|
|
110
|
+
function getCurrentState(index) {
|
|
104
111
|
var {
|
|
105
112
|
modelValue,
|
|
106
113
|
disabled,
|
|
@@ -132,8 +139,8 @@ var __sfc__ = defineComponent({
|
|
|
132
139
|
color: disabled || form != null && form.disabled.value ? disabledColor : emptyColor,
|
|
133
140
|
name: emptyIcon
|
|
134
141
|
};
|
|
135
|
-
}
|
|
136
|
-
|
|
142
|
+
}
|
|
143
|
+
function changeValue(score, event) {
|
|
137
144
|
var {
|
|
138
145
|
half,
|
|
139
146
|
clearable
|
|
@@ -153,10 +160,14 @@ var __sfc__ = defineComponent({
|
|
|
153
160
|
// update last score
|
|
154
161
|
lastScore = score;
|
|
155
162
|
call(props['onUpdate:modelValue'], score);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
}
|
|
164
|
+
function validate() {
|
|
165
|
+
return v(props.rules, toNumber(props.modelValue));
|
|
166
|
+
}
|
|
167
|
+
function validateWithTrigger() {
|
|
168
|
+
return nextTick(() => vt(['onChange'], 'onChange', props.rules, props.modelValue));
|
|
169
|
+
}
|
|
170
|
+
function handleClick(score, event) {
|
|
160
171
|
var {
|
|
161
172
|
readonly,
|
|
162
173
|
disabled,
|
|
@@ -168,31 +179,27 @@ var __sfc__ = defineComponent({
|
|
|
168
179
|
changeValue(score, event);
|
|
169
180
|
call(onChange, score);
|
|
170
181
|
validateWithTrigger();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
182
|
+
}
|
|
183
|
+
function createHoverHandler(value) {
|
|
184
|
+
return isHover => {
|
|
185
|
+
currentHoveringValue.value = value;
|
|
186
|
+
hovering.value = isHover;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function reset() {
|
|
177
190
|
call(props['onUpdate:modelValue'], 0);
|
|
178
191
|
resetValidation();
|
|
179
|
-
}
|
|
180
|
-
var rateProvider = {
|
|
181
|
-
reset,
|
|
182
|
-
validate,
|
|
183
|
-
resetValidation
|
|
184
|
-
};
|
|
185
|
-
call(bindForm, rateProvider);
|
|
192
|
+
}
|
|
186
193
|
return {
|
|
187
194
|
errorMessage,
|
|
188
195
|
formDisabled: form == null ? void 0 : form.disabled,
|
|
189
196
|
formReadonly: form == null ? void 0 : form.readonly,
|
|
197
|
+
hovering,
|
|
198
|
+
currentHoveringValue,
|
|
190
199
|
getStyle,
|
|
191
200
|
getClass,
|
|
192
201
|
getCurrentState,
|
|
193
202
|
handleClick,
|
|
194
|
-
hovering,
|
|
195
|
-
currentHoveringValue,
|
|
196
203
|
createHoverHandler,
|
|
197
204
|
reset,
|
|
198
205
|
validate,
|
package/es/result/Result.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { props } from './props.mjs';
|
|
|
10
10
|
import { createNamespace } from '../utils/components.mjs';
|
|
11
11
|
import { toPxNum, toSizeUnit } from '../utils/elements.mjs';
|
|
12
12
|
var {
|
|
13
|
+
name,
|
|
13
14
|
n,
|
|
14
15
|
classes
|
|
15
16
|
} = createNamespace('result');
|
|
@@ -43,7 +44,7 @@ function __render__(_ctx, _cache) {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
var __sfc__ = defineComponent({
|
|
46
|
-
name
|
|
47
|
+
name,
|
|
47
48
|
components: {
|
|
48
49
|
Info,
|
|
49
50
|
Success,
|
|
@@ -67,13 +68,13 @@ var __sfc__ = defineComponent({
|
|
|
67
68
|
return "calc(" + (imageSize ? toSizeUnit(props.imageSize) : 'var(--result-image-size)') + " * 0.05)";
|
|
68
69
|
});
|
|
69
70
|
return {
|
|
71
|
+
circleSize,
|
|
72
|
+
borderSize,
|
|
73
|
+
toSizeUnit,
|
|
70
74
|
n,
|
|
71
75
|
classes,
|
|
72
76
|
toNumber,
|
|
73
|
-
toPxNum
|
|
74
|
-
toSizeUnit,
|
|
75
|
-
circleSize,
|
|
76
|
-
borderSize
|
|
77
|
+
toPxNum
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
});
|
package/es/row/Row.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { useCols } from './provide.mjs';
|
|
|
5
5
|
import { toPxNum, padStartFlex } from '../utils/elements.mjs';
|
|
6
6
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
7
7
|
var {
|
|
8
|
+
name,
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
10
11
|
} = createNamespace('row');
|
|
@@ -24,16 +25,22 @@ function __render__(_ctx, _cache) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
var __sfc__ = defineComponent({
|
|
27
|
-
name
|
|
28
|
+
name,
|
|
28
29
|
props,
|
|
29
30
|
setup(props) {
|
|
31
|
+
var average = computed(() => isArray(props.gutter) ? props.gutter.map(numeric => toPxNum(numeric) / 2) : [0, toPxNum(props.gutter) / 2]);
|
|
30
32
|
var {
|
|
31
33
|
cols,
|
|
32
34
|
bindCols,
|
|
33
35
|
length
|
|
34
36
|
} = useCols();
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
+
var rowProvider = {
|
|
38
|
+
computePadding
|
|
39
|
+
};
|
|
40
|
+
watch(() => length.value, computePadding);
|
|
41
|
+
watch(() => props.gutter, computePadding);
|
|
42
|
+
bindCols(rowProvider);
|
|
43
|
+
function computePadding() {
|
|
37
44
|
cols.forEach(col => {
|
|
38
45
|
var [y, x] = average.value;
|
|
39
46
|
col.setPadding({
|
|
@@ -43,20 +50,14 @@ var __sfc__ = defineComponent({
|
|
|
43
50
|
bottom: y
|
|
44
51
|
});
|
|
45
52
|
});
|
|
46
|
-
}
|
|
47
|
-
|
|
53
|
+
}
|
|
54
|
+
function handleClick(e) {
|
|
48
55
|
call(props.onClick, e);
|
|
49
|
-
}
|
|
50
|
-
var rowProvider = {
|
|
51
|
-
computePadding
|
|
52
|
-
};
|
|
53
|
-
watch(() => length.value, computePadding);
|
|
54
|
-
watch(() => props.gutter, computePadding);
|
|
55
|
-
bindCols(rowProvider);
|
|
56
|
+
}
|
|
56
57
|
return {
|
|
58
|
+
average,
|
|
57
59
|
n,
|
|
58
60
|
classes,
|
|
59
|
-
average,
|
|
60
61
|
handleClick,
|
|
61
62
|
padStartFlex
|
|
62
63
|
};
|
package/es/select/Select.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { useForm } from '../form/provide.mjs';
|
|
|
12
12
|
import { toPxNum } from '../utils/elements.mjs';
|
|
13
13
|
import { error } from '../utils/logger.mjs';
|
|
14
14
|
var {
|
|
15
|
+
name,
|
|
15
16
|
n,
|
|
16
17
|
classes
|
|
17
18
|
} = createNamespace('select');
|
|
@@ -133,7 +134,7 @@ function __render__(_ctx, _cache) {
|
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
var __sfc__ = defineComponent({
|
|
136
|
-
name
|
|
137
|
+
name,
|
|
137
138
|
components: {
|
|
138
139
|
VarIcon,
|
|
139
140
|
VarMenu,
|
|
@@ -188,7 +189,31 @@ var __sfc__ = defineComponent({
|
|
|
188
189
|
return blurColor || 'var(--field-decorator-blur-color)';
|
|
189
190
|
});
|
|
190
191
|
var enableCustomPlaceholder = computed(() => !props.hint && isEmpty(props.modelValue));
|
|
191
|
-
var
|
|
192
|
+
var selectProvider = {
|
|
193
|
+
multiple,
|
|
194
|
+
focusColor,
|
|
195
|
+
computeLabel,
|
|
196
|
+
onSelect,
|
|
197
|
+
reset,
|
|
198
|
+
validate,
|
|
199
|
+
resetValidation
|
|
200
|
+
};
|
|
201
|
+
watch(() => props.multiple, () => {
|
|
202
|
+
var {
|
|
203
|
+
multiple,
|
|
204
|
+
modelValue
|
|
205
|
+
} = props;
|
|
206
|
+
if (multiple && !isArray(modelValue)) {
|
|
207
|
+
error('Select', 'The modelValue must be an array when multiple is true');
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
watch(() => props.modelValue, syncOptions, {
|
|
211
|
+
deep: true
|
|
212
|
+
});
|
|
213
|
+
watch(() => length.value, syncOptions);
|
|
214
|
+
bindOptions(selectProvider);
|
|
215
|
+
call(bindForm, selectProvider);
|
|
216
|
+
function computeLabel() {
|
|
192
217
|
var {
|
|
193
218
|
multiple,
|
|
194
219
|
modelValue
|
|
@@ -203,8 +228,8 @@ var __sfc__ = defineComponent({
|
|
|
203
228
|
if (!multiple && isEmpty(modelValue)) {
|
|
204
229
|
label.value = '';
|
|
205
230
|
}
|
|
206
|
-
}
|
|
207
|
-
|
|
231
|
+
}
|
|
232
|
+
function validateWithTrigger(trigger) {
|
|
208
233
|
nextTick(() => {
|
|
209
234
|
var {
|
|
210
235
|
validateTrigger,
|
|
@@ -213,8 +238,8 @@ var __sfc__ = defineComponent({
|
|
|
213
238
|
} = props;
|
|
214
239
|
vt(validateTrigger, trigger, rules, modelValue);
|
|
215
240
|
});
|
|
216
|
-
}
|
|
217
|
-
|
|
241
|
+
}
|
|
242
|
+
function findValueOrLabel(_ref) {
|
|
218
243
|
var {
|
|
219
244
|
value,
|
|
220
245
|
label
|
|
@@ -223,8 +248,8 @@ var __sfc__ = defineComponent({
|
|
|
223
248
|
return value.value;
|
|
224
249
|
}
|
|
225
250
|
return label.value;
|
|
226
|
-
}
|
|
227
|
-
|
|
251
|
+
}
|
|
252
|
+
function findLabel(modelValue) {
|
|
228
253
|
var _option$label$value, _option;
|
|
229
254
|
var option = options.find(_ref2 => {
|
|
230
255
|
var {
|
|
@@ -241,8 +266,8 @@ var __sfc__ = defineComponent({
|
|
|
241
266
|
});
|
|
242
267
|
}
|
|
243
268
|
return (_option$label$value = (_option = option) == null ? void 0 : _option.label.value) != null ? _option$label$value : '';
|
|
244
|
-
}
|
|
245
|
-
|
|
269
|
+
}
|
|
270
|
+
function handleFocus() {
|
|
246
271
|
var {
|
|
247
272
|
disabled,
|
|
248
273
|
readonly,
|
|
@@ -255,8 +280,8 @@ var __sfc__ = defineComponent({
|
|
|
255
280
|
isFocus.value = true;
|
|
256
281
|
call(onFocus);
|
|
257
282
|
validateWithTrigger('onFocus');
|
|
258
|
-
}
|
|
259
|
-
|
|
283
|
+
}
|
|
284
|
+
function handleBlur() {
|
|
260
285
|
var {
|
|
261
286
|
disabled,
|
|
262
287
|
readonly,
|
|
@@ -268,8 +293,8 @@ var __sfc__ = defineComponent({
|
|
|
268
293
|
blur();
|
|
269
294
|
call(onBlur);
|
|
270
295
|
validateWithTrigger('onBlur');
|
|
271
|
-
}
|
|
272
|
-
|
|
296
|
+
}
|
|
297
|
+
function onSelect(option) {
|
|
273
298
|
var {
|
|
274
299
|
disabled,
|
|
275
300
|
readonly,
|
|
@@ -291,8 +316,8 @@ var __sfc__ = defineComponent({
|
|
|
291
316
|
if (!multiple) {
|
|
292
317
|
blur();
|
|
293
318
|
}
|
|
294
|
-
}
|
|
295
|
-
|
|
319
|
+
}
|
|
320
|
+
function handleClear() {
|
|
296
321
|
var {
|
|
297
322
|
disabled,
|
|
298
323
|
readonly,
|
|
@@ -307,8 +332,8 @@ var __sfc__ = defineComponent({
|
|
|
307
332
|
call(props['onUpdate:modelValue'], changedModelValue);
|
|
308
333
|
call(onClear, changedModelValue);
|
|
309
334
|
validateWithTrigger('onClear');
|
|
310
|
-
}
|
|
311
|
-
|
|
335
|
+
}
|
|
336
|
+
function handleClick(e) {
|
|
312
337
|
var {
|
|
313
338
|
disabled,
|
|
314
339
|
onClick
|
|
@@ -318,8 +343,8 @@ var __sfc__ = defineComponent({
|
|
|
318
343
|
}
|
|
319
344
|
call(onClick, e);
|
|
320
345
|
validateWithTrigger('onClick');
|
|
321
|
-
}
|
|
322
|
-
|
|
346
|
+
}
|
|
347
|
+
function handleClose(text) {
|
|
323
348
|
var {
|
|
324
349
|
disabled,
|
|
325
350
|
readonly,
|
|
@@ -343,8 +368,8 @@ var __sfc__ = defineComponent({
|
|
|
343
368
|
call(props['onUpdate:modelValue'], currentModelValue);
|
|
344
369
|
call(onClose, currentModelValue);
|
|
345
370
|
validateWithTrigger('onClose');
|
|
346
|
-
}
|
|
347
|
-
|
|
371
|
+
}
|
|
372
|
+
function syncOptions() {
|
|
348
373
|
var {
|
|
349
374
|
multiple,
|
|
350
375
|
modelValue
|
|
@@ -356,53 +381,31 @@ var __sfc__ = defineComponent({
|
|
|
356
381
|
options.forEach(option => option.sync(modelValue === findValueOrLabel(option)));
|
|
357
382
|
}
|
|
358
383
|
computeLabel();
|
|
359
|
-
}
|
|
384
|
+
}
|
|
360
385
|
|
|
361
386
|
// expose
|
|
362
|
-
|
|
387
|
+
function focus() {
|
|
363
388
|
offsetY.value = toPxNum(props.offsetY);
|
|
364
389
|
isFocus.value = true;
|
|
365
390
|
showMenu.value = true;
|
|
366
|
-
}
|
|
391
|
+
}
|
|
367
392
|
|
|
368
393
|
// expose
|
|
369
|
-
|
|
394
|
+
function blur() {
|
|
370
395
|
isFocus.value = false;
|
|
371
396
|
showMenu.value = false;
|
|
372
|
-
}
|
|
397
|
+
}
|
|
373
398
|
|
|
374
399
|
// expose
|
|
375
|
-
|
|
400
|
+
function validate() {
|
|
401
|
+
return v(props.rules, props.modelValue);
|
|
402
|
+
}
|
|
376
403
|
|
|
377
404
|
// expose
|
|
378
|
-
|
|
405
|
+
function reset() {
|
|
379
406
|
call(props['onUpdate:modelValue'], props.multiple ? [] : undefined);
|
|
380
407
|
resetValidation();
|
|
381
|
-
}
|
|
382
|
-
watch(() => props.multiple, () => {
|
|
383
|
-
var {
|
|
384
|
-
multiple,
|
|
385
|
-
modelValue
|
|
386
|
-
} = props;
|
|
387
|
-
if (multiple && !isArray(modelValue)) {
|
|
388
|
-
error('Select', 'The modelValue must be an array when multiple is true');
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
watch(() => props.modelValue, syncOptions, {
|
|
392
|
-
deep: true
|
|
393
|
-
});
|
|
394
|
-
watch(() => length.value, syncOptions);
|
|
395
|
-
var selectProvider = {
|
|
396
|
-
multiple,
|
|
397
|
-
focusColor,
|
|
398
|
-
computeLabel,
|
|
399
|
-
onSelect,
|
|
400
|
-
reset,
|
|
401
|
-
validate,
|
|
402
|
-
resetValidation
|
|
403
|
-
};
|
|
404
|
-
bindOptions(selectProvider);
|
|
405
|
-
call(bindForm, selectProvider);
|
|
408
|
+
}
|
|
406
409
|
return {
|
|
407
410
|
offsetY,
|
|
408
411
|
isFocus,
|
package/es/skeleton/Skeleton.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { toSizeUnit } from '../utils/elements.mjs';
|
|
|
4
4
|
import { toNumber } from '@varlet/shared';
|
|
5
5
|
import { createNamespace } from '../utils/components.mjs';
|
|
6
6
|
var {
|
|
7
|
+
name,
|
|
7
8
|
n,
|
|
8
9
|
classes
|
|
9
10
|
} = createNamespace('skeleton');
|
|
@@ -70,16 +71,14 @@ function __render__(_ctx, _cache) {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
var __sfc__ = defineComponent({
|
|
73
|
-
name
|
|
74
|
+
name,
|
|
74
75
|
props,
|
|
75
|
-
setup() {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
}
|
|
76
|
+
setup: () => ({
|
|
77
|
+
n,
|
|
78
|
+
classes,
|
|
79
|
+
toSizeUnit,
|
|
80
|
+
toNumber
|
|
81
|
+
})
|
|
83
82
|
});
|
|
84
83
|
__sfc__.render = __render__;
|
|
85
84
|
export default __sfc__;
|