@varlet/ui 2.16.1 → 2.16.3-alpha.1694267513697
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 +21 -16
- 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 +20 -18
- package/es/row/props.mjs +1 -1
- 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 +99 -90
- 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 +9605 -8923
- package/es/watermark/Watermark.mjs +29 -26
- package/highlight/web-types.en-US.json +3 -3
- package/highlight/web-types.zh-CN.json +3 -3
- package/lib/varlet.cjs.js +2388 -2118
- package/package.json +12 -14
- package/types/row.d.ts +1 -1
- package/types/swipe.d.ts +12 -3
- package/umd/varlet.js +4 -4
|
@@ -3,6 +3,7 @@ import { useButtons } from './provide.mjs';
|
|
|
3
3
|
import { createNamespace, formatElevation } from '../utils/components.mjs';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
8
9
|
} = createNamespace('button-group');
|
|
@@ -14,7 +15,7 @@ function __render__(_ctx, _cache) {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
var __sfc__ = defineComponent({
|
|
17
|
-
name
|
|
18
|
+
name,
|
|
18
19
|
props,
|
|
19
20
|
setup(props) {
|
|
20
21
|
var {
|
package/es/card/Card.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { call, createNamespace, formatElevation } from '../utils/components.mjs'
|
|
|
11
11
|
import { useZIndex } from '../context/zIndex.mjs';
|
|
12
12
|
import { useLock } from '../context/lock.mjs';
|
|
13
13
|
var {
|
|
14
|
+
name,
|
|
14
15
|
n,
|
|
15
16
|
classes
|
|
16
17
|
} = createNamespace('card');
|
|
@@ -106,7 +107,7 @@ function __render__(_ctx, _cache) {
|
|
|
106
107
|
}]]);
|
|
107
108
|
}
|
|
108
109
|
var __sfc__ = defineComponent({
|
|
109
|
-
name
|
|
110
|
+
name,
|
|
110
111
|
directives: {
|
|
111
112
|
Ripple
|
|
112
113
|
},
|
|
@@ -134,13 +135,24 @@ var __sfc__ = defineComponent({
|
|
|
134
135
|
var {
|
|
135
136
|
zIndex
|
|
136
137
|
} = useZIndex(() => props.floating, 1);
|
|
137
|
-
useLock(() => props.floating, () => !isRow.value);
|
|
138
138
|
var dropdownFloaterTop = 'auto';
|
|
139
139
|
var dropdownFloaterLeft = 'auto';
|
|
140
140
|
var dropper = null;
|
|
141
141
|
var floater = ref(null);
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
useLock(() => props.floating, () => !isRow.value);
|
|
143
|
+
watch(() => props.floating, value => {
|
|
144
|
+
if (isRow.value) return;
|
|
145
|
+
nextTick(() => {
|
|
146
|
+
value ? floating() : dropdown();
|
|
147
|
+
});
|
|
148
|
+
}, {
|
|
149
|
+
immediate: true
|
|
150
|
+
});
|
|
151
|
+
function floating() {
|
|
152
|
+
return _floating.apply(this, arguments);
|
|
153
|
+
}
|
|
154
|
+
function _floating() {
|
|
155
|
+
_floating = _asyncToGenerator(function* () {
|
|
144
156
|
clearTimeout(floater.value);
|
|
145
157
|
clearTimeout(dropper);
|
|
146
158
|
floater.value = null;
|
|
@@ -172,11 +184,9 @@ var __sfc__ = defineComponent({
|
|
|
172
184
|
floated.value = true;
|
|
173
185
|
}), props.ripple ? RIPPLE_DELAY : 0);
|
|
174
186
|
});
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}();
|
|
179
|
-
var dropdown = () => {
|
|
187
|
+
return _floating.apply(this, arguments);
|
|
188
|
+
}
|
|
189
|
+
function dropdown() {
|
|
180
190
|
clearTimeout(dropper);
|
|
181
191
|
clearTimeout(floater.value);
|
|
182
192
|
floater.value = null;
|
|
@@ -200,25 +210,14 @@ var __sfc__ = defineComponent({
|
|
|
200
210
|
floaterPosition.value = undefined;
|
|
201
211
|
floated.value = false;
|
|
202
212
|
}, props.floatingDuration);
|
|
203
|
-
}
|
|
204
|
-
|
|
213
|
+
}
|
|
214
|
+
function close() {
|
|
205
215
|
call(props['onUpdate:floating'], false);
|
|
206
|
-
}
|
|
207
|
-
|
|
216
|
+
}
|
|
217
|
+
function handleClick(e) {
|
|
208
218
|
call(props.onClick, e);
|
|
209
|
-
}
|
|
210
|
-
watch(() => props.floating, value => {
|
|
211
|
-
if (isRow.value) return;
|
|
212
|
-
nextTick(() => {
|
|
213
|
-
value ? floating() : dropdown();
|
|
214
|
-
});
|
|
215
|
-
}, {
|
|
216
|
-
immediate: true
|
|
217
|
-
});
|
|
219
|
+
}
|
|
218
220
|
return {
|
|
219
|
-
n,
|
|
220
|
-
classes,
|
|
221
|
-
toSizeUnit,
|
|
222
221
|
card,
|
|
223
222
|
cardFloater,
|
|
224
223
|
holderWidth,
|
|
@@ -234,9 +233,12 @@ var __sfc__ = defineComponent({
|
|
|
234
233
|
opacity,
|
|
235
234
|
zIndex,
|
|
236
235
|
isRow,
|
|
237
|
-
close,
|
|
238
236
|
showFloatingButtons,
|
|
239
237
|
floated,
|
|
238
|
+
n,
|
|
239
|
+
classes,
|
|
240
|
+
toSizeUnit,
|
|
241
|
+
close,
|
|
240
242
|
formatElevation,
|
|
241
243
|
handleClick
|
|
242
244
|
};
|
package/es/cell/Cell.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { props } from './props.mjs';
|
|
|
5
5
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
6
6
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
7
7
|
var {
|
|
8
|
+
name,
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
10
11
|
} = createNamespace('cell');
|
|
@@ -39,7 +40,7 @@ function __render__(_ctx, _cache) {
|
|
|
39
40
|
}]]);
|
|
40
41
|
}
|
|
41
42
|
var __sfc__ = defineComponent({
|
|
42
|
-
name
|
|
43
|
+
name,
|
|
43
44
|
components: {
|
|
44
45
|
VarIcon
|
|
45
46
|
},
|
|
@@ -57,14 +58,14 @@ var __sfc__ = defineComponent({
|
|
|
57
58
|
'--cell-border-right': toSizeUnit(props.borderOffset)
|
|
58
59
|
};
|
|
59
60
|
});
|
|
60
|
-
|
|
61
|
+
function handleClick(e) {
|
|
61
62
|
call(props.onClick, e);
|
|
62
|
-
}
|
|
63
|
+
}
|
|
63
64
|
return {
|
|
65
|
+
borderOffsetStyles,
|
|
64
66
|
n,
|
|
65
67
|
classes,
|
|
66
68
|
toSizeUnit,
|
|
67
|
-
borderOffsetStyles,
|
|
68
69
|
handleClick
|
|
69
70
|
};
|
|
70
71
|
}
|
package/es/checkbox/Checkbox.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { useValidation, createNamespace, call, useVModel } from '../utils/compon
|
|
|
9
9
|
import { useCheckboxGroup } 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('checkbox');
|
|
@@ -64,7 +65,7 @@ function __render__(_ctx, _cache) {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
var __sfc__ = defineComponent({
|
|
67
|
-
name
|
|
68
|
+
name,
|
|
68
69
|
directives: {
|
|
69
70
|
Ripple,
|
|
70
71
|
Hover
|
|
@@ -77,6 +78,7 @@ var __sfc__ = defineComponent({
|
|
|
77
78
|
props,
|
|
78
79
|
setup(props) {
|
|
79
80
|
var value = useVModel(props, 'modelValue');
|
|
81
|
+
var isIndeterminate = useVModel(props, 'indeterminate');
|
|
80
82
|
var checked = computed(() => value.value === props.checkedValue);
|
|
81
83
|
var checkedValue = computed(() => props.checkedValue);
|
|
82
84
|
var withAnimation = ref(false);
|
|
@@ -99,8 +101,18 @@ var __sfc__ = defineComponent({
|
|
|
99
101
|
// expose
|
|
100
102
|
resetValidation
|
|
101
103
|
} = useValidation();
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
+
var checkboxProvider = {
|
|
105
|
+
checkedValue,
|
|
106
|
+
checked,
|
|
107
|
+
sync,
|
|
108
|
+
validate,
|
|
109
|
+
resetValidation,
|
|
110
|
+
reset,
|
|
111
|
+
resetWithAnimation
|
|
112
|
+
};
|
|
113
|
+
call(bindCheckboxGroup, checkboxProvider);
|
|
114
|
+
call(bindForm, checkboxProvider);
|
|
115
|
+
function validateWithTrigger(trigger) {
|
|
104
116
|
nextTick(() => {
|
|
105
117
|
var {
|
|
106
118
|
validateTrigger,
|
|
@@ -109,8 +121,8 @@ var __sfc__ = defineComponent({
|
|
|
109
121
|
} = props;
|
|
110
122
|
vt(validateTrigger, trigger, rules, modelValue);
|
|
111
123
|
});
|
|
112
|
-
}
|
|
113
|
-
|
|
124
|
+
}
|
|
125
|
+
function change(changedValue) {
|
|
114
126
|
var {
|
|
115
127
|
checkedValue,
|
|
116
128
|
onChange
|
|
@@ -120,8 +132,8 @@ var __sfc__ = defineComponent({
|
|
|
120
132
|
call(onChange, value.value);
|
|
121
133
|
validateWithTrigger('onChange');
|
|
122
134
|
changedValue === checkedValue ? checkboxGroup == null ? void 0 : checkboxGroup.onChecked(checkedValue) : checkboxGroup == null ? void 0 : checkboxGroup.onUnchecked(checkedValue);
|
|
123
|
-
}
|
|
124
|
-
|
|
135
|
+
}
|
|
136
|
+
function handleClick(e) {
|
|
125
137
|
var {
|
|
126
138
|
disabled,
|
|
127
139
|
readonly,
|
|
@@ -142,26 +154,26 @@ var __sfc__ = defineComponent({
|
|
|
142
154
|
return;
|
|
143
155
|
}
|
|
144
156
|
change(checked.value ? uncheckedValue : checkedValue);
|
|
145
|
-
}
|
|
146
|
-
|
|
157
|
+
}
|
|
158
|
+
function sync(values) {
|
|
147
159
|
var {
|
|
148
160
|
checkedValue,
|
|
149
161
|
uncheckedValue
|
|
150
162
|
} = props;
|
|
151
163
|
value.value = values.includes(checkedValue) ? checkedValue : uncheckedValue;
|
|
152
|
-
}
|
|
153
|
-
|
|
164
|
+
}
|
|
165
|
+
function resetWithAnimation() {
|
|
154
166
|
withAnimation.value = false;
|
|
155
|
-
}
|
|
167
|
+
}
|
|
156
168
|
|
|
157
169
|
// expose
|
|
158
|
-
|
|
170
|
+
function reset() {
|
|
159
171
|
value.value = props.uncheckedValue;
|
|
160
172
|
resetValidation();
|
|
161
|
-
}
|
|
173
|
+
}
|
|
162
174
|
|
|
163
175
|
// expose
|
|
164
|
-
|
|
176
|
+
function toggle(changedValue) {
|
|
165
177
|
var {
|
|
166
178
|
checkedValue,
|
|
167
179
|
uncheckedValue
|
|
@@ -171,21 +183,12 @@ var __sfc__ = defineComponent({
|
|
|
171
183
|
changedValue = checked.value ? uncheckedValue : checkedValue;
|
|
172
184
|
}
|
|
173
185
|
change(changedValue);
|
|
174
|
-
}
|
|
186
|
+
}
|
|
175
187
|
|
|
176
188
|
// expose
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
checked,
|
|
181
|
-
sync,
|
|
182
|
-
validate,
|
|
183
|
-
resetValidation,
|
|
184
|
-
reset,
|
|
185
|
-
resetWithAnimation
|
|
186
|
-
};
|
|
187
|
-
call(bindCheckboxGroup, checkboxProvider);
|
|
188
|
-
call(bindForm, checkboxProvider);
|
|
189
|
+
function validate() {
|
|
190
|
+
return v(props.rules, props.modelValue);
|
|
191
|
+
}
|
|
189
192
|
return {
|
|
190
193
|
isIndeterminate,
|
|
191
194
|
withAnimation,
|
|
@@ -195,9 +198,9 @@ var __sfc__ = defineComponent({
|
|
|
195
198
|
formDisabled: form == null ? void 0 : form.disabled,
|
|
196
199
|
formReadonly: form == null ? void 0 : form.readonly,
|
|
197
200
|
hovering,
|
|
198
|
-
handleHovering,
|
|
199
201
|
n,
|
|
200
202
|
classes,
|
|
203
|
+
handleHovering,
|
|
201
204
|
handleClick,
|
|
202
205
|
toggle,
|
|
203
206
|
reset,
|
|
@@ -6,6 +6,7 @@ import { useCheckboxes } from './provide.mjs';
|
|
|
6
6
|
import { useForm } from '../form/provide.mjs';
|
|
7
7
|
import { uniq } from '@varlet/shared';
|
|
8
8
|
var {
|
|
9
|
+
name,
|
|
9
10
|
n,
|
|
10
11
|
classes
|
|
11
12
|
} = createNamespace('checkbox-group');
|
|
@@ -22,7 +23,7 @@ function __render__(_ctx, _cache) {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
var __sfc__ = defineComponent({
|
|
25
|
-
name
|
|
26
|
+
name,
|
|
26
27
|
components: {
|
|
27
28
|
VarFormDetails
|
|
28
29
|
},
|
|
@@ -46,7 +47,23 @@ var __sfc__ = defineComponent({
|
|
|
46
47
|
resetValidation
|
|
47
48
|
} = useValidation();
|
|
48
49
|
var checkboxGroupErrorMessage = computed(() => errorMessage.value);
|
|
49
|
-
var
|
|
50
|
+
var checkboxGroupProvider = {
|
|
51
|
+
max,
|
|
52
|
+
checkedCount,
|
|
53
|
+
onChecked,
|
|
54
|
+
onUnchecked,
|
|
55
|
+
validate,
|
|
56
|
+
resetValidation,
|
|
57
|
+
reset,
|
|
58
|
+
errorMessage: checkboxGroupErrorMessage
|
|
59
|
+
};
|
|
60
|
+
watch(() => props.modelValue, syncCheckboxes, {
|
|
61
|
+
deep: true
|
|
62
|
+
});
|
|
63
|
+
watch(() => length.value, syncCheckboxes);
|
|
64
|
+
bindCheckboxes(checkboxGroupProvider);
|
|
65
|
+
call(bindForm, checkboxGroupProvider);
|
|
66
|
+
function validateWithTrigger(trigger) {
|
|
50
67
|
nextTick(() => {
|
|
51
68
|
var {
|
|
52
69
|
validateTrigger,
|
|
@@ -55,21 +72,21 @@ var __sfc__ = defineComponent({
|
|
|
55
72
|
} = props;
|
|
56
73
|
vt(validateTrigger, trigger, rules, modelValue);
|
|
57
74
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
75
|
+
}
|
|
76
|
+
function change(changedModelValue) {
|
|
60
77
|
call(props['onUpdate:modelValue'], changedModelValue);
|
|
61
78
|
call(props.onChange, changedModelValue);
|
|
62
79
|
validateWithTrigger('onChange');
|
|
63
|
-
}
|
|
64
|
-
|
|
80
|
+
}
|
|
81
|
+
function onChecked(changedValue) {
|
|
65
82
|
var {
|
|
66
83
|
modelValue
|
|
67
84
|
} = props;
|
|
68
85
|
if (!modelValue.includes(changedValue)) {
|
|
69
86
|
change([...modelValue, changedValue]);
|
|
70
87
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
88
|
+
}
|
|
89
|
+
function onUnchecked(changedValue) {
|
|
73
90
|
var {
|
|
74
91
|
modelValue
|
|
75
92
|
} = props;
|
|
@@ -77,19 +94,21 @@ var __sfc__ = defineComponent({
|
|
|
77
94
|
return;
|
|
78
95
|
}
|
|
79
96
|
change(modelValue.filter(value => value !== changedValue));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
}
|
|
98
|
+
function syncCheckboxes() {
|
|
99
|
+
return checkboxes.forEach(_ref => {
|
|
100
|
+
var {
|
|
101
|
+
sync
|
|
102
|
+
} = _ref;
|
|
103
|
+
return sync(props.modelValue);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function resetWithAnimation() {
|
|
88
107
|
checkboxes.forEach(checkbox => checkbox.resetWithAnimation());
|
|
89
|
-
}
|
|
108
|
+
}
|
|
90
109
|
|
|
91
110
|
// expose
|
|
92
|
-
|
|
111
|
+
function checkAll() {
|
|
93
112
|
var checkedValues = checkboxes.map(_ref2 => {
|
|
94
113
|
var {
|
|
95
114
|
checkedValue
|
|
@@ -100,10 +119,10 @@ var __sfc__ = defineComponent({
|
|
|
100
119
|
resetWithAnimation();
|
|
101
120
|
call(props['onUpdate:modelValue'], changedModelValue);
|
|
102
121
|
return changedModelValue;
|
|
103
|
-
}
|
|
122
|
+
}
|
|
104
123
|
|
|
105
124
|
// expose
|
|
106
|
-
|
|
125
|
+
function inverseAll() {
|
|
107
126
|
var checkedValues = checkboxes.filter(_ref3 => {
|
|
108
127
|
var {
|
|
109
128
|
checked
|
|
@@ -119,32 +138,18 @@ var __sfc__ = defineComponent({
|
|
|
119
138
|
resetWithAnimation();
|
|
120
139
|
call(props['onUpdate:modelValue'], changedModelValue);
|
|
121
140
|
return changedModelValue;
|
|
122
|
-
}
|
|
141
|
+
}
|
|
123
142
|
|
|
124
143
|
// expose
|
|
125
|
-
|
|
144
|
+
function reset() {
|
|
126
145
|
call(props['onUpdate:modelValue'], []);
|
|
127
146
|
resetValidation();
|
|
128
|
-
}
|
|
147
|
+
}
|
|
129
148
|
|
|
130
149
|
// expose
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
watch(() => length.value, syncCheckboxes);
|
|
136
|
-
var checkboxGroupProvider = {
|
|
137
|
-
max,
|
|
138
|
-
checkedCount,
|
|
139
|
-
onChecked,
|
|
140
|
-
onUnchecked,
|
|
141
|
-
validate,
|
|
142
|
-
resetValidation,
|
|
143
|
-
reset,
|
|
144
|
-
errorMessage: checkboxGroupErrorMessage
|
|
145
|
-
};
|
|
146
|
-
bindCheckboxes(checkboxGroupProvider);
|
|
147
|
-
call(bindForm, checkboxGroupProvider);
|
|
150
|
+
function validate() {
|
|
151
|
+
return v(props.rules, props.modelValue);
|
|
152
|
+
}
|
|
148
153
|
return {
|
|
149
154
|
errorMessage,
|
|
150
155
|
n,
|
package/es/chip/Chip.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { defineComponent, computed } from 'vue';
|
|
|
3
3
|
import { props } from './props.mjs';
|
|
4
4
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
8
9
|
} = createNamespace('chip');
|
|
@@ -31,7 +32,7 @@ function __render__(_ctx, _cache) {
|
|
|
31
32
|
}, 8 /* PROPS */, ["name"]);
|
|
32
33
|
}
|
|
33
34
|
var __sfc__ = defineComponent({
|
|
34
|
-
name
|
|
35
|
+
name,
|
|
35
36
|
components: {
|
|
36
37
|
VarIcon
|
|
37
38
|
},
|
|
@@ -68,14 +69,14 @@ var __sfc__ = defineComponent({
|
|
|
68
69
|
var roundClass = round ? n('--round') : null;
|
|
69
70
|
return [n("--" + size), blockClass, plainTypeClass, roundClass];
|
|
70
71
|
});
|
|
71
|
-
|
|
72
|
+
function handleClose(e) {
|
|
72
73
|
call(props.onClose, e);
|
|
73
|
-
}
|
|
74
|
+
}
|
|
74
75
|
return {
|
|
75
|
-
n,
|
|
76
|
-
classes,
|
|
77
76
|
chipStyles,
|
|
78
77
|
contentClass,
|
|
78
|
+
n,
|
|
79
|
+
classes,
|
|
79
80
|
handleClose
|
|
80
81
|
};
|
|
81
82
|
}
|
package/es/col/Col.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { useRow } from './provide.mjs';
|
|
|
5
5
|
import { padStartFlex, toSizeUnit } from '../utils/elements.mjs';
|
|
6
6
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
7
7
|
var {
|
|
8
|
+
name,
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
10
11
|
} = createNamespace('col');
|
|
@@ -17,7 +18,9 @@ function __render__(_ctx, _cache) {
|
|
|
17
18
|
justifyContent: _ctx.padStartFlex(_ctx.justify),
|
|
18
19
|
alignItems: _ctx.padStartFlex(_ctx.align),
|
|
19
20
|
paddingLeft: _ctx.toSizeUnit(_ctx.padding.left),
|
|
20
|
-
paddingRight: _ctx.toSizeUnit(_ctx.padding.right)
|
|
21
|
+
paddingRight: _ctx.toSizeUnit(_ctx.padding.right),
|
|
22
|
+
paddingTop: _ctx.toSizeUnit(_ctx.padding.top),
|
|
23
|
+
paddingBottom: _ctx.toSizeUnit(_ctx.padding.bottom)
|
|
21
24
|
}),
|
|
22
25
|
onClick: _cache[0] || (_cache[0] = function () {
|
|
23
26
|
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
@@ -26,15 +29,17 @@ function __render__(_ctx, _cache) {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
var __sfc__ = defineComponent({
|
|
29
|
-
name
|
|
32
|
+
name,
|
|
30
33
|
props,
|
|
31
34
|
setup(props) {
|
|
35
|
+
var span = computed(() => toNumber(props.span));
|
|
36
|
+
var offset = computed(() => toNumber(props.offset));
|
|
32
37
|
var padding = ref({
|
|
33
38
|
left: 0,
|
|
34
|
-
right: 0
|
|
39
|
+
right: 0,
|
|
40
|
+
top: 0,
|
|
41
|
+
bottom: 0
|
|
35
42
|
});
|
|
36
|
-
var span = computed(() => toNumber(props.span));
|
|
37
|
-
var offset = computed(() => toNumber(props.offset));
|
|
38
43
|
var {
|
|
39
44
|
row,
|
|
40
45
|
bindRow
|
|
@@ -44,7 +49,11 @@ var __sfc__ = defineComponent({
|
|
|
44
49
|
padding.value = pad;
|
|
45
50
|
}
|
|
46
51
|
};
|
|
47
|
-
|
|
52
|
+
watch([() => props.span, () => props.offset], () => {
|
|
53
|
+
row == null ? void 0 : row.computePadding();
|
|
54
|
+
});
|
|
55
|
+
call(bindRow, colProvider);
|
|
56
|
+
function getSize(mode, size) {
|
|
48
57
|
var classes = [];
|
|
49
58
|
if (size == null) {
|
|
50
59
|
return classes;
|
|
@@ -60,23 +69,19 @@ var __sfc__ = defineComponent({
|
|
|
60
69
|
Number(size) >= 0 && classes.push(n("--span-" + mode + "-" + size));
|
|
61
70
|
}
|
|
62
71
|
return classes;
|
|
63
|
-
}
|
|
64
|
-
|
|
72
|
+
}
|
|
73
|
+
function handleClick(e) {
|
|
65
74
|
call(props.onClick, e);
|
|
66
|
-
}
|
|
67
|
-
watch([() => props.span, () => props.offset], () => {
|
|
68
|
-
row == null ? void 0 : row.computePadding();
|
|
69
|
-
});
|
|
70
|
-
call(bindRow, colProvider);
|
|
75
|
+
}
|
|
71
76
|
return {
|
|
77
|
+
span,
|
|
78
|
+
offset,
|
|
79
|
+
padding,
|
|
72
80
|
n,
|
|
73
81
|
classes,
|
|
74
|
-
padding,
|
|
75
82
|
toNumber,
|
|
76
83
|
toSizeUnit,
|
|
77
84
|
getSize,
|
|
78
|
-
span,
|
|
79
|
-
offset,
|
|
80
85
|
handleClick,
|
|
81
86
|
padStartFlex
|
|
82
87
|
};
|
package/es/collapse/Collapse.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { props } from './props.mjs';
|
|
|
4
4
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
5
5
|
import { isArray } from '@varlet/shared';
|
|
6
6
|
var {
|
|
7
|
+
name,
|
|
7
8
|
n
|
|
8
9
|
} = createNamespace('collapse');
|
|
9
10
|
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
@@ -14,19 +15,29 @@ function __render__(_ctx, _cache) {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
var __sfc__ = defineComponent({
|
|
17
|
-
name
|
|
18
|
+
name,
|
|
18
19
|
props,
|
|
19
20
|
setup(props) {
|
|
21
|
+
var active = computed(() => props.modelValue);
|
|
22
|
+
var offset = computed(() => props.offset);
|
|
23
|
+
var divider = computed(() => props.divider);
|
|
24
|
+
var elevation = computed(() => props.elevation);
|
|
20
25
|
var {
|
|
21
26
|
length,
|
|
22
27
|
collapseItem,
|
|
23
28
|
bindCollapseItem
|
|
24
29
|
} = useCollapseItem();
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
var collapseProvider = {
|
|
31
|
+
active,
|
|
32
|
+
offset,
|
|
33
|
+
divider,
|
|
34
|
+
elevation,
|
|
35
|
+
updateItem
|
|
36
|
+
};
|
|
37
|
+
watch(() => length.value, () => nextTick().then(resize));
|
|
38
|
+
watch(() => props.modelValue, () => nextTick().then(resize));
|
|
39
|
+
bindCollapseItem(collapseProvider);
|
|
40
|
+
function checkValue() {
|
|
30
41
|
if (!props.accordion && !isArray(props.modelValue)) {
|
|
31
42
|
console.error('[Varlet] Collapse: type of prop "modelValue" should be an Array');
|
|
32
43
|
return false;
|
|
@@ -36,18 +47,18 @@ var __sfc__ = defineComponent({
|
|
|
36
47
|
return false;
|
|
37
48
|
}
|
|
38
49
|
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
50
|
+
}
|
|
51
|
+
function getValue(value, isExpand) {
|
|
41
52
|
if (!checkValue()) return null;
|
|
42
53
|
if (isExpand) return props.accordion ? value : [...props.modelValue, value];
|
|
43
54
|
return props.accordion ? null : props.modelValue.filter(name => name !== value);
|
|
44
|
-
}
|
|
45
|
-
|
|
55
|
+
}
|
|
56
|
+
function updateItem(value, isExpand) {
|
|
46
57
|
var modelValue = getValue(value, isExpand);
|
|
47
58
|
call(props['onUpdate:modelValue'], modelValue);
|
|
48
59
|
call(props.onChange, modelValue);
|
|
49
|
-
}
|
|
50
|
-
|
|
60
|
+
}
|
|
61
|
+
function matchName() {
|
|
51
62
|
if (props.accordion) {
|
|
52
63
|
return collapseItem.find(_ref => {
|
|
53
64
|
var {
|
|
@@ -64,8 +75,8 @@ var __sfc__ = defineComponent({
|
|
|
64
75
|
return props.modelValue.includes(name.value);
|
|
65
76
|
});
|
|
66
77
|
return filterItem.length ? filterItem : undefined;
|
|
67
|
-
}
|
|
68
|
-
|
|
78
|
+
}
|
|
79
|
+
function matchIndex() {
|
|
69
80
|
if (props.accordion) {
|
|
70
81
|
return collapseItem.find(_ref3 => {
|
|
71
82
|
var {
|
|
@@ -82,8 +93,8 @@ var __sfc__ = defineComponent({
|
|
|
82
93
|
} = _ref4;
|
|
83
94
|
return name.value === undefined && props.modelValue.includes(index.value);
|
|
84
95
|
});
|
|
85
|
-
}
|
|
86
|
-
|
|
96
|
+
}
|
|
97
|
+
function resize() {
|
|
87
98
|
if (!checkValue()) return;
|
|
88
99
|
var matchProviders = matchName() || matchIndex();
|
|
89
100
|
if (props.accordion && !matchProviders || !props.accordion && !matchProviders.length) {
|
|
@@ -96,20 +107,10 @@ var __sfc__ = defineComponent({
|
|
|
96
107
|
var isShow = props.accordion ? matchProviders === provider : matchProviders.includes(provider);
|
|
97
108
|
provider.init(props.accordion, isShow);
|
|
98
109
|
});
|
|
99
|
-
}
|
|
100
|
-
var collapseProvider = {
|
|
101
|
-
active,
|
|
102
|
-
offset,
|
|
103
|
-
divider,
|
|
104
|
-
elevation,
|
|
105
|
-
updateItem
|
|
106
|
-
};
|
|
107
|
-
bindCollapseItem(collapseProvider);
|
|
108
|
-
watch(() => length.value, () => nextTick().then(resize));
|
|
109
|
-
watch(() => props.modelValue, () => nextTick().then(resize));
|
|
110
|
+
}
|
|
110
111
|
return {
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
divider,
|
|
113
|
+
n
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
116
|
});
|