@varlet/ui 2.14.2 → 2.15.0-alpha.1692990022445
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/props.mjs +2 -7
- package/es/app-bar/props.mjs +8 -29
- package/es/avatar/Avatar.mjs +6 -6
- package/es/avatar/props.mjs +8 -36
- package/es/avatar-group/props.mjs +2 -7
- package/es/back-top/props.mjs +3 -9
- package/es/badge/props.mjs +7 -27
- package/es/bottom-navigation/props.mjs +7 -22
- package/es/bottom-navigation-item/props.mjs +3 -9
- package/es/breadcrumb/props.mjs +1 -3
- package/es/button/props.mjs +14 -57
- package/es/button-group/props.mjs +6 -25
- package/es/cell/props.mjs +10 -32
- package/es/checkbox/Checkbox.mjs +23 -19
- package/es/checkbox/props.mjs +10 -22
- package/es/checkbox-group/props.mjs +4 -12
- package/es/chip/props.mjs +7 -28
- package/es/col/props.mjs +9 -35
- package/es/collapse/props.mjs +2 -7
- package/es/collapse-item/CollapseItem.mjs +15 -5
- package/es/collapse-item/props.mjs +3 -10
- package/es/counter/props.mjs +14 -48
- package/es/date-picker/props.mjs +10 -35
- package/es/dialog/props.mjs +13 -42
- package/es/divider/props.mjs +5 -18
- package/es/drag/Drag.mjs +20 -27
- package/es/drag/props.mjs +2 -7
- package/es/ellipsis/props.mjs +2 -10
- package/es/fab/props.mjs +14 -51
- package/es/field-decorator/props.mjs +13 -46
- package/es/form/props.mjs +3 -15
- package/es/icon/props.mjs +4 -12
- package/es/image/props.mjs +9 -33
- package/es/image-preview/ImagePreview.mjs +49 -66
- package/es/image-preview/props.mjs +4 -15
- package/es/index-anchor/props.mjs +1 -3
- package/es/index-bar/props.mjs +4 -15
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +12 -29
- package/es/input/props.mjs +9 -33
- package/es/link/props.mjs +9 -33
- package/es/list/props.mjs +6 -21
- package/es/loading/props.mjs +6 -23
- package/es/loading-bar/props.mjs +5 -16
- package/es/menu/props.mjs +9 -37
- package/es/option/Option.mjs +18 -4
- package/es/overlay/props.mjs +2 -7
- package/es/pagination/props.mjs +4 -14
- package/es/paper/props.mjs +6 -21
- package/es/picker/props.mjs +7 -23
- package/es/popup/props.mjs +7 -26
- package/es/progress/props.mjs +8 -31
- package/es/pull-refresh/props.mjs +7 -29
- package/es/radio/Radio.mjs +5 -11
- package/es/radio/props.mjs +6 -20
- package/es/radio-group/props.mjs +2 -8
- package/es/rate/Rate.mjs +12 -9
- package/es/rate/props.mjs +11 -37
- package/es/result/props.mjs +4 -14
- package/es/row/props.mjs +2 -10
- package/es/select/props.mjs +5 -20
- package/es/skeleton/props.mjs +7 -25
- package/es/slider/props.mjs +13 -46
- package/es/snackbar/props.mjs +8 -36
- package/es/space/Space.mjs +3 -3
- package/es/space/props.mjs +4 -17
- package/es/step/props.mjs +2 -6
- package/es/steps/props.mjs +3 -11
- package/es/sticky/props.mjs +2 -8
- package/es/swipe/Swipe.mjs +51 -65
- package/es/swipe/props.mjs +3 -10
- package/es/switch/Switch.mjs +11 -7
- package/es/switch/props.mjs +8 -27
- package/es/tab/props.mjs +2 -7
- package/es/tab-item/props.mjs +1 -3
- package/es/tabs/props.mjs +14 -48
- package/es/tabs-items/props.mjs +1 -4
- package/es/time-picker/props.mjs +9 -31
- package/es/tooltip/props.mjs +11 -45
- package/es/uploader/props.mjs +7 -25
- package/es/utils/{jest.mjs → test.mjs} +19 -14
- package/es/varlet.esm.js +6687 -7777
- package/es/watermark/props.mjs +3 -10
- package/highlight/web-types.en-US.json +17 -4
- package/highlight/web-types.zh-CN.json +15 -2
- package/lib/varlet.cjs.js +710 -1742
- package/package.json +13 -12
- package/types/checkbox.d.ts +3 -0
- package/types/col.d.ts +7 -5
- package/umd/varlet.js +4 -4
|
@@ -2,17 +2,12 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { defineListenerProp, pickProps } from '../utils/components.mjs';
|
|
3
3
|
import { props as popupProps } from '../popup/props.mjs';
|
|
4
4
|
export var props = _extends({
|
|
5
|
-
show:
|
|
6
|
-
|
|
7
|
-
default: false
|
|
8
|
-
},
|
|
5
|
+
show: Boolean,
|
|
6
|
+
title: String,
|
|
9
7
|
actions: {
|
|
10
8
|
type: Array,
|
|
11
9
|
default: () => []
|
|
12
10
|
},
|
|
13
|
-
title: {
|
|
14
|
-
type: String
|
|
15
|
-
},
|
|
16
11
|
closeOnClickAction: {
|
|
17
12
|
type: Boolean,
|
|
18
13
|
default: true
|
package/es/app-bar/props.mjs
CHANGED
|
@@ -1,38 +1,17 @@
|
|
|
1
|
-
export function positionValidator(position) {
|
|
2
|
-
var validPositions = ['left', 'center', 'right'];
|
|
3
|
-
return validPositions.includes(position);
|
|
4
|
-
}
|
|
5
1
|
export var props = {
|
|
6
|
-
color:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
textColor: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
title: {
|
|
13
|
-
type: String
|
|
14
|
-
},
|
|
2
|
+
color: String,
|
|
3
|
+
textColor: String,
|
|
4
|
+
title: String,
|
|
15
5
|
titlePosition: {
|
|
16
6
|
type: String,
|
|
17
|
-
default: 'left'
|
|
18
|
-
validator: positionValidator
|
|
7
|
+
default: 'left'
|
|
19
8
|
},
|
|
20
9
|
elevation: {
|
|
21
10
|
type: [Boolean, String, Number],
|
|
22
11
|
default: true
|
|
23
12
|
},
|
|
24
|
-
round:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
image: {
|
|
29
|
-
type: String
|
|
30
|
-
},
|
|
31
|
-
imageLinearGradient: {
|
|
32
|
-
type: String
|
|
33
|
-
},
|
|
34
|
-
safeAreaTop: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
}
|
|
13
|
+
round: Boolean,
|
|
14
|
+
image: String,
|
|
15
|
+
imageLinearGradient: String,
|
|
16
|
+
safeAreaTop: Boolean
|
|
38
17
|
};
|
package/es/avatar/Avatar.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Lazy from '../lazy/index.mjs';
|
|
2
2
|
import { defineComponent, ref, onUpdated } from 'vue';
|
|
3
|
-
import { props
|
|
3
|
+
import { props } from './props.mjs';
|
|
4
4
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
5
5
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
6
6
|
import { onSmartMounted } from '@varlet/use';
|
|
7
|
+
var isInternalSize = size => ['mini', 'small', 'normal', 'large'].includes(size);
|
|
7
8
|
var {
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
@@ -16,10 +17,10 @@ function __render__(_ctx, _cache) {
|
|
|
16
17
|
var _directive_lazy = _resolveDirective("lazy");
|
|
17
18
|
return _openBlock(), _createElementBlock("div", {
|
|
18
19
|
ref: "avatarElement",
|
|
19
|
-
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.
|
|
20
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.isInternalSize(_ctx.size), _ctx.n("--" + _ctx.size)], [_ctx.round, _ctx.n('--round')], [_ctx.bordered, _ctx.n('--bordered')])),
|
|
20
21
|
style: _normalizeStyle({
|
|
21
|
-
width: !_ctx.
|
|
22
|
-
height: !_ctx.
|
|
22
|
+
width: !_ctx.isInternalSize(_ctx.size) ? _ctx.toSizeUnit(_ctx.size) : undefined,
|
|
23
|
+
height: !_ctx.isInternalSize(_ctx.size) ? _ctx.toSizeUnit(_ctx.size) : undefined,
|
|
23
24
|
borderColor: _ctx.borderColor,
|
|
24
25
|
backgroundColor: _ctx.color
|
|
25
26
|
}),
|
|
@@ -111,8 +112,7 @@ var __sfc__ = defineComponent({
|
|
|
111
112
|
onSmartMounted(getScale);
|
|
112
113
|
onUpdated(getScale);
|
|
113
114
|
return {
|
|
114
|
-
|
|
115
|
-
sizeValidator,
|
|
115
|
+
isInternalSize,
|
|
116
116
|
toSizeUnit,
|
|
117
117
|
n,
|
|
118
118
|
classes,
|
package/es/avatar/props.mjs
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { defineListenerProp } from '../utils/components.mjs';
|
|
2
|
-
import { isNumber, isString } from '@varlet/shared';
|
|
3
|
-
function fitValidator(fit) {
|
|
4
|
-
return ['fill', 'contain', 'cover', 'none', 'scale-down'].includes(fit);
|
|
5
|
-
}
|
|
6
|
-
export var internalSizeValidator = size => ['mini', 'small', 'normal', 'large'].includes(size);
|
|
7
|
-
export function sizeValidator(size) {
|
|
8
|
-
return internalSizeValidator(size) || isNumber(size) || isString(size);
|
|
9
|
-
}
|
|
10
2
|
export var props = {
|
|
11
3
|
round: {
|
|
12
4
|
type: Boolean,
|
|
@@ -14,40 +6,20 @@ export var props = {
|
|
|
14
6
|
},
|
|
15
7
|
size: {
|
|
16
8
|
type: [String, Number],
|
|
17
|
-
validator: sizeValidator,
|
|
18
9
|
default: 'normal'
|
|
19
10
|
},
|
|
20
|
-
alt:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
color: {
|
|
24
|
-
type: String
|
|
25
|
-
},
|
|
26
|
-
src: {
|
|
27
|
-
type: String
|
|
28
|
-
},
|
|
11
|
+
alt: String,
|
|
12
|
+
color: String,
|
|
13
|
+
src: String,
|
|
29
14
|
fit: {
|
|
30
15
|
type: String,
|
|
31
|
-
validator: fitValidator,
|
|
32
16
|
default: 'cover'
|
|
33
17
|
},
|
|
34
|
-
bordered:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type: String
|
|
40
|
-
},
|
|
41
|
-
loading: {
|
|
42
|
-
type: String
|
|
43
|
-
},
|
|
44
|
-
error: {
|
|
45
|
-
type: String
|
|
46
|
-
},
|
|
47
|
-
lazy: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
18
|
+
bordered: Boolean,
|
|
19
|
+
borderColor: String,
|
|
20
|
+
loading: String,
|
|
21
|
+
error: String,
|
|
22
|
+
lazy: Boolean,
|
|
51
23
|
onClick: defineListenerProp(),
|
|
52
24
|
onLoad: defineListenerProp(),
|
|
53
25
|
onError: defineListenerProp()
|
package/es/back-top/props.mjs
CHANGED
|
@@ -8,18 +8,12 @@ export var props = {
|
|
|
8
8
|
type: Number,
|
|
9
9
|
default: 300
|
|
10
10
|
},
|
|
11
|
-
right:
|
|
12
|
-
type: [Number, String]
|
|
13
|
-
},
|
|
11
|
+
right: [Number, String],
|
|
14
12
|
elevation: {
|
|
15
13
|
type: [Boolean, Number, String],
|
|
16
14
|
default: true
|
|
17
15
|
},
|
|
18
|
-
bottom:
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
target: {
|
|
22
|
-
type: [String, Object]
|
|
23
|
-
},
|
|
16
|
+
bottom: [Number, String],
|
|
17
|
+
target: [String, Object],
|
|
24
18
|
onClick: defineListenerProp()
|
|
25
19
|
};
|
package/es/badge/props.mjs
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
|
-
function typeValidator(type) {
|
|
2
|
-
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
|
|
3
|
-
}
|
|
4
|
-
function positionValidator(position) {
|
|
5
|
-
return ['right-top', 'right-bottom', 'left-top', 'left-bottom'].includes(position);
|
|
6
|
-
}
|
|
7
1
|
export var props = {
|
|
8
2
|
type: {
|
|
9
3
|
type: String,
|
|
10
|
-
default: 'default'
|
|
11
|
-
validator: typeValidator
|
|
4
|
+
default: 'default'
|
|
12
5
|
},
|
|
13
6
|
position: {
|
|
14
7
|
type: String,
|
|
15
|
-
default: 'right-top'
|
|
16
|
-
validator: positionValidator
|
|
17
|
-
},
|
|
18
|
-
hidden: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false
|
|
8
|
+
default: 'right-top'
|
|
21
9
|
},
|
|
10
|
+
hidden: Boolean,
|
|
22
11
|
value: {
|
|
23
12
|
type: [String, Number],
|
|
24
13
|
default: 0
|
|
25
14
|
},
|
|
26
|
-
maxValue:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false
|
|
32
|
-
},
|
|
33
|
-
icon: {
|
|
34
|
-
type: String
|
|
35
|
-
},
|
|
36
|
-
color: {
|
|
37
|
-
type: String
|
|
38
|
-
}
|
|
15
|
+
maxValue: [String, Number],
|
|
16
|
+
dot: Boolean,
|
|
17
|
+
icon: String,
|
|
18
|
+
color: String
|
|
39
19
|
};
|
|
@@ -4,33 +4,18 @@ export var props = {
|
|
|
4
4
|
type: [Number, String],
|
|
5
5
|
default: 0
|
|
6
6
|
},
|
|
7
|
-
fixed: {
|
|
8
|
-
type: Boolean,
|
|
9
|
-
default: false
|
|
10
|
-
},
|
|
11
|
-
border: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: false
|
|
14
|
-
},
|
|
15
|
-
safeArea: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
default: false
|
|
18
|
-
},
|
|
19
7
|
zIndex: {
|
|
20
8
|
type: [Number, String],
|
|
21
9
|
default: 1
|
|
22
10
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
fixed: Boolean,
|
|
12
|
+
border: Boolean,
|
|
13
|
+
safeArea: Boolean,
|
|
14
|
+
activeColor: String,
|
|
15
|
+
inactiveColor: String,
|
|
16
|
+
fabProps: Object,
|
|
29
17
|
onChange: defineListenerProp(),
|
|
30
|
-
'onUpdate:active': defineListenerProp(),
|
|
31
18
|
onBeforeChange: defineListenerProp(),
|
|
32
19
|
onFabClick: defineListenerProp(),
|
|
33
|
-
|
|
34
|
-
type: Object
|
|
35
|
-
}
|
|
20
|
+
'onUpdate:active': defineListenerProp()
|
|
36
21
|
};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { defineListenerProp } from '../utils/components.mjs';
|
|
2
2
|
export var props = {
|
|
3
|
-
name:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
icon: {
|
|
7
|
-
type: String
|
|
8
|
-
},
|
|
9
|
-
label: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
3
|
+
name: String,
|
|
4
|
+
icon: String,
|
|
5
|
+
label: String,
|
|
12
6
|
namespace: {
|
|
13
7
|
type: String,
|
|
14
8
|
default: 'var-icon'
|
package/es/breadcrumb/props.mjs
CHANGED
package/es/button/props.mjs
CHANGED
|
@@ -1,74 +1,31 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import { props as loadingProps } from '../loading/props.mjs';
|
|
3
3
|
import { defineListenerProp, pickProps } from '../utils/components.mjs';
|
|
4
|
-
export function typeValidator(type) {
|
|
5
|
-
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
|
|
6
|
-
}
|
|
7
|
-
export function sizeValidator(size) {
|
|
8
|
-
return ['normal', 'mini', 'small', 'large'].includes(size);
|
|
9
|
-
}
|
|
10
|
-
export function nativeTypeValidator(nativeType) {
|
|
11
|
-
return ['button', 'reset', 'submit'].includes(nativeType);
|
|
12
|
-
}
|
|
13
4
|
export var props = {
|
|
14
|
-
type:
|
|
15
|
-
type: String,
|
|
16
|
-
validator: typeValidator
|
|
17
|
-
},
|
|
5
|
+
type: String,
|
|
18
6
|
nativeType: {
|
|
19
7
|
type: String,
|
|
20
|
-
default: 'button'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
round: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false
|
|
34
|
-
},
|
|
35
|
-
block: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false
|
|
38
|
-
},
|
|
39
|
-
text: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false
|
|
42
|
-
},
|
|
43
|
-
outline: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false
|
|
46
|
-
},
|
|
47
|
-
disabled: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
8
|
+
default: 'button'
|
|
9
|
+
},
|
|
10
|
+
size: String,
|
|
11
|
+
loading: Boolean,
|
|
12
|
+
round: Boolean,
|
|
13
|
+
block: Boolean,
|
|
14
|
+
text: Boolean,
|
|
15
|
+
outline: Boolean,
|
|
16
|
+
disabled: Boolean,
|
|
17
|
+
autoLoading: Boolean,
|
|
51
18
|
ripple: {
|
|
52
19
|
type: Boolean,
|
|
53
20
|
default: true
|
|
54
21
|
},
|
|
55
|
-
color:
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
textColor: {
|
|
59
|
-
type: String
|
|
60
|
-
},
|
|
22
|
+
color: String,
|
|
23
|
+
textColor: String,
|
|
61
24
|
elevation: {
|
|
62
25
|
type: [Boolean, Number, String],
|
|
63
26
|
default: true
|
|
64
27
|
},
|
|
65
|
-
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: false
|
|
68
|
-
},
|
|
69
|
-
loadingRadius: {
|
|
70
|
-
type: [Number, String]
|
|
71
|
-
},
|
|
28
|
+
loadingRadius: [Number, String],
|
|
72
29
|
loadingType: pickProps(loadingProps, 'type'),
|
|
73
30
|
loadingSize: pickProps(loadingProps, 'size'),
|
|
74
31
|
loadingColor: _extends({}, pickProps(loadingProps, 'color'), {
|
|
@@ -1,40 +1,21 @@
|
|
|
1
|
-
function typeValidator(type) {
|
|
2
|
-
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
|
|
3
|
-
}
|
|
4
|
-
function sizeValidator(size) {
|
|
5
|
-
return ['normal', 'mini', 'small', 'large'].includes(size);
|
|
6
|
-
}
|
|
7
|
-
function modeValidator(mode) {
|
|
8
|
-
return ['normal', 'text', 'outline'].includes(mode);
|
|
9
|
-
}
|
|
10
1
|
export var props = {
|
|
11
2
|
type: {
|
|
12
3
|
type: String,
|
|
13
|
-
default: 'default'
|
|
14
|
-
validator: typeValidator
|
|
4
|
+
default: 'default'
|
|
15
5
|
},
|
|
16
6
|
size: {
|
|
17
7
|
type: String,
|
|
18
|
-
default: 'normal'
|
|
19
|
-
validator: sizeValidator
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
type: String
|
|
23
|
-
},
|
|
24
|
-
textColor: {
|
|
25
|
-
type: String
|
|
8
|
+
default: 'normal'
|
|
26
9
|
},
|
|
10
|
+
color: String,
|
|
11
|
+
textColor: String,
|
|
27
12
|
mode: {
|
|
28
13
|
type: String,
|
|
29
|
-
default: 'normal'
|
|
30
|
-
validator: modeValidator
|
|
14
|
+
default: 'normal'
|
|
31
15
|
},
|
|
32
16
|
elevation: {
|
|
33
17
|
type: [Boolean, Number, String],
|
|
34
18
|
default: true
|
|
35
19
|
},
|
|
36
|
-
vertical:
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false
|
|
39
|
-
}
|
|
20
|
+
vertical: Boolean
|
|
40
21
|
};
|
package/es/cell/props.mjs
CHANGED
|
@@ -1,36 +1,14 @@
|
|
|
1
1
|
import { defineListenerProp } from '../utils/components.mjs';
|
|
2
2
|
export var props = {
|
|
3
|
-
title:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type: Boolean,
|
|
14
|
-
default: false
|
|
15
|
-
},
|
|
16
|
-
borderOffset: {
|
|
17
|
-
type: [Number, String]
|
|
18
|
-
},
|
|
19
|
-
iconClass: {
|
|
20
|
-
type: String
|
|
21
|
-
},
|
|
22
|
-
titleClass: {
|
|
23
|
-
type: String
|
|
24
|
-
},
|
|
25
|
-
descriptionClass: {
|
|
26
|
-
type: String
|
|
27
|
-
},
|
|
28
|
-
extraClass: {
|
|
29
|
-
type: String
|
|
30
|
-
},
|
|
31
|
-
ripple: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false
|
|
34
|
-
},
|
|
3
|
+
title: [Number, String],
|
|
4
|
+
icon: String,
|
|
5
|
+
description: String,
|
|
6
|
+
border: Boolean,
|
|
7
|
+
borderOffset: [Number, String],
|
|
8
|
+
iconClass: String,
|
|
9
|
+
titleClass: String,
|
|
10
|
+
descriptionClass: String,
|
|
11
|
+
extraClass: String,
|
|
12
|
+
ripple: Boolean,
|
|
35
13
|
onClick: defineListenerProp()
|
|
36
14
|
};
|
package/es/checkbox/Checkbox.mjs
CHANGED
|
@@ -2,17 +2,17 @@ import VarIcon from '../icon/index.mjs';
|
|
|
2
2
|
import VarFormDetails from '../form-details/index.mjs';
|
|
3
3
|
import Ripple from '../ripple/index.mjs';
|
|
4
4
|
import Hover from '../hover/index.mjs';
|
|
5
|
-
import
|
|
5
|
+
import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
|
|
6
|
+
import { defineComponent, ref, computed, nextTick } from 'vue';
|
|
6
7
|
import { props } from './props.mjs';
|
|
7
|
-
import { useValidation, createNamespace, call } from '../utils/components.mjs';
|
|
8
|
+
import { useValidation, createNamespace, call, useVModel } from '../utils/components.mjs';
|
|
8
9
|
import { useCheckboxGroup } from './provide.mjs';
|
|
9
10
|
import { useForm } from '../form/provide.mjs';
|
|
10
|
-
import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
|
|
11
11
|
var {
|
|
12
12
|
n,
|
|
13
13
|
classes
|
|
14
14
|
} = createNamespace('checkbox');
|
|
15
|
-
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, createVNode as _createVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createElementVNode as _createElementVNode } from "vue";
|
|
15
|
+
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, createVNode as _createVNode, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createElementVNode as _createElementVNode } from "vue";
|
|
16
16
|
function __render__(_ctx, _cache) {
|
|
17
17
|
var _component_var_icon = _resolveComponent("var-icon");
|
|
18
18
|
var _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
|
|
@@ -27,25 +27,32 @@ function __render__(_ctx, _cache) {
|
|
|
27
27
|
}, [_createElementVNode("div", {
|
|
28
28
|
class: _normalizeClass(_ctx.n())
|
|
29
29
|
}, [_withDirectives((_openBlock(), _createElementBlock("div", {
|
|
30
|
-
class: _normalizeClass(_ctx.classes(_ctx.n('action'), [_ctx.checked, _ctx.n('--checked'), _ctx.n('--unchecked')], [_ctx.errorMessage || _ctx.checkboxGroupErrorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
|
|
30
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('action'), [_ctx.checked || _ctx.isIndeterminate, _ctx.n('--checked'), _ctx.n('--unchecked')], [_ctx.errorMessage || _ctx.checkboxGroupErrorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
|
|
31
31
|
style: _normalizeStyle({
|
|
32
|
-
color: _ctx.checked ? _ctx.checkedColor : _ctx.uncheckedColor
|
|
32
|
+
color: _ctx.checked || _ctx.isIndeterminate ? _ctx.checkedColor : _ctx.uncheckedColor
|
|
33
33
|
})
|
|
34
|
-
}, [_ctx.
|
|
34
|
+
}, [_ctx.isIndeterminate ? _renderSlot(_ctx.$slots, "indeterminate-icon", {
|
|
35
35
|
key: 0
|
|
36
36
|
}, () => [_createVNode(_component_var_icon, {
|
|
37
37
|
class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.withAnimation, _ctx.n('--with-animation')])),
|
|
38
|
-
name: "
|
|
38
|
+
name: "minus-box",
|
|
39
39
|
size: _ctx.iconSize,
|
|
40
40
|
"var-checkbox-cover": ""
|
|
41
|
-
}, null, 8 /* PROPS */, ["class", "size"])]) : _renderSlot(_ctx.$slots, "
|
|
41
|
+
}, null, 8 /* PROPS */, ["class", "size"])]) : _createCommentVNode("v-if", true), _ctx.checked && !_ctx.isIndeterminate ? _renderSlot(_ctx.$slots, "checked-icon", {
|
|
42
42
|
key: 1
|
|
43
|
+
}, () => [_createVNode(_component_var_icon, {
|
|
44
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.withAnimation, _ctx.n('--with-animation')])),
|
|
45
|
+
name: "checkbox-marked",
|
|
46
|
+
size: _ctx.iconSize,
|
|
47
|
+
"var-checkbox-cover": ""
|
|
48
|
+
}, null, 8 /* PROPS */, ["class", "size"])]) : _createCommentVNode("v-if", true), !_ctx.checked && !_ctx.isIndeterminate ? _renderSlot(_ctx.$slots, "unchecked-icon", {
|
|
49
|
+
key: 2
|
|
43
50
|
}, () => [_createVNode(_component_var_icon, {
|
|
44
51
|
class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.withAnimation, _ctx.n('--with-animation')])),
|
|
45
52
|
name: "checkbox-blank-outline",
|
|
46
53
|
size: _ctx.iconSize,
|
|
47
54
|
"var-checkbox-cover": ""
|
|
48
|
-
}, null, 8 /* PROPS */, ["class", "size"])]), _createVNode(_component_var_hover_overlay, {
|
|
55
|
+
}, null, 8 /* PROPS */, ["class", "size"])]) : _createCommentVNode("v-if", true), _createVNode(_component_var_hover_overlay, {
|
|
49
56
|
hovering: !_ctx.disabled && !_ctx.formDisabled && _ctx.hovering
|
|
50
57
|
}, null, 8 /* PROPS */, ["hovering"])], 6 /* CLASS, STYLE */)), [[_directive_hover, _ctx.handleHovering, "desktop"], [_directive_ripple, {
|
|
51
58
|
disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled || !_ctx.ripple
|
|
@@ -69,7 +76,7 @@ var __sfc__ = defineComponent({
|
|
|
69
76
|
},
|
|
70
77
|
props,
|
|
71
78
|
setup(props) {
|
|
72
|
-
var value =
|
|
79
|
+
var value = useVModel(props, 'modelValue');
|
|
73
80
|
var checked = computed(() => value.value === props.checkedValue);
|
|
74
81
|
var checkedValue = computed(() => props.checkedValue);
|
|
75
82
|
var withAnimation = ref(false);
|
|
@@ -92,6 +99,7 @@ var __sfc__ = defineComponent({
|
|
|
92
99
|
// expose
|
|
93
100
|
resetValidation
|
|
94
101
|
} = useValidation();
|
|
102
|
+
var isIndeterminate = useVModel(props, 'indeterminate');
|
|
95
103
|
var validateWithTrigger = trigger => {
|
|
96
104
|
nextTick(() => {
|
|
97
105
|
var {
|
|
@@ -103,12 +111,12 @@ var __sfc__ = defineComponent({
|
|
|
103
111
|
});
|
|
104
112
|
};
|
|
105
113
|
var change = changedValue => {
|
|
106
|
-
value.value = changedValue;
|
|
107
114
|
var {
|
|
108
115
|
checkedValue,
|
|
109
116
|
onChange
|
|
110
117
|
} = props;
|
|
111
|
-
|
|
118
|
+
value.value = changedValue;
|
|
119
|
+
isIndeterminate.value = false;
|
|
112
120
|
call(onChange, value.value);
|
|
113
121
|
validateWithTrigger('onChange');
|
|
114
122
|
changedValue === checkedValue ? checkboxGroup == null ? void 0 : checkboxGroup.onChecked(checkedValue) : checkboxGroup == null ? void 0 : checkboxGroup.onUnchecked(checkedValue);
|
|
@@ -148,7 +156,7 @@ var __sfc__ = defineComponent({
|
|
|
148
156
|
|
|
149
157
|
// expose
|
|
150
158
|
var reset = () => {
|
|
151
|
-
|
|
159
|
+
value.value = props.uncheckedValue;
|
|
152
160
|
resetValidation();
|
|
153
161
|
};
|
|
154
162
|
|
|
@@ -167,11 +175,6 @@ var __sfc__ = defineComponent({
|
|
|
167
175
|
|
|
168
176
|
// expose
|
|
169
177
|
var validate = () => v(props.rules, props.modelValue);
|
|
170
|
-
watch(() => props.modelValue, newValue => {
|
|
171
|
-
value.value = newValue;
|
|
172
|
-
}, {
|
|
173
|
-
immediate: true
|
|
174
|
-
});
|
|
175
178
|
var checkboxProvider = {
|
|
176
179
|
checkedValue,
|
|
177
180
|
checked,
|
|
@@ -184,6 +187,7 @@ var __sfc__ = defineComponent({
|
|
|
184
187
|
call(bindCheckboxGroup, checkboxProvider);
|
|
185
188
|
call(bindForm, checkboxProvider);
|
|
186
189
|
return {
|
|
190
|
+
isIndeterminate,
|
|
187
191
|
withAnimation,
|
|
188
192
|
checked,
|
|
189
193
|
errorMessage,
|
package/es/checkbox/props.mjs
CHANGED
|
@@ -12,35 +12,23 @@ export var props = {
|
|
|
12
12
|
type: [String, Number, Boolean, Object, Array],
|
|
13
13
|
default: false
|
|
14
14
|
},
|
|
15
|
-
checkedColor:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
disabled: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false
|
|
24
|
-
},
|
|
25
|
-
readonly: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: false
|
|
28
|
-
},
|
|
29
|
-
iconSize: {
|
|
30
|
-
type: [String, Number]
|
|
31
|
-
},
|
|
15
|
+
checkedColor: String,
|
|
16
|
+
uncheckedColor: String,
|
|
17
|
+
disabled: Boolean,
|
|
18
|
+
readonly: Boolean,
|
|
19
|
+
indeterminate: Boolean,
|
|
20
|
+
iconSize: [String, Number],
|
|
32
21
|
ripple: {
|
|
33
22
|
type: Boolean,
|
|
34
23
|
default: true
|
|
35
24
|
},
|
|
36
25
|
validateTrigger: {
|
|
37
26
|
type: Array,
|
|
38
|
-
default: ['onChange']
|
|
39
|
-
},
|
|
40
|
-
rules: {
|
|
41
|
-
type: Array
|
|
27
|
+
default: () => ['onChange']
|
|
42
28
|
},
|
|
29
|
+
rules: Array,
|
|
43
30
|
onClick: defineListenerProp(),
|
|
44
31
|
onChange: defineListenerProp(),
|
|
45
|
-
'onUpdate:modelValue': defineListenerProp()
|
|
32
|
+
'onUpdate:modelValue': defineListenerProp(),
|
|
33
|
+
'onUpdate:indeterminate': defineListenerProp()
|
|
46
34
|
};
|