@varlet/ui 1.27.8 → 1.27.10
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/badge/Badge.js +1 -1
- package/es/bottom-navigation-item/BottomNavigationItem.js +3 -1
- package/es/card/Card.js +228 -19
- package/es/card/card.css +1 -1
- package/es/card/card.less +108 -5
- package/es/card/props.js +25 -0
- package/es/index-bar/IndexBar.js +4 -4
- package/es/index-bar/props.js +1 -1
- package/es/loading/Loading.js +5 -14
- package/es/loading/loading.css +1 -1
- package/es/loading/loading.less +20 -0
- package/es/picker/Picker.js +2 -1
- package/es/progress/Progress.js +14 -11
- package/es/progress/progress.css +1 -1
- package/es/progress/progress.less +3 -0
- package/es/progress/props.js +1 -1
- package/es/rate/Rate.js +4 -2
- package/es/rate/props.js +2 -4
- package/es/rate/rate.css +1 -1
- package/es/rate/rate.less +7 -0
- package/es/select/Select.js +3 -1
- package/es/slider/Slider.js +10 -9
- package/es/style.css +1 -1
- package/es/switch/Switch.js +22 -19
- package/es/switch/props.js +1 -2
- package/es/switch/switch.css +1 -1
- package/es/switch/switch.less +18 -4
- package/es/utils/elements.js +13 -0
- package/es/utils/jest.js +19 -0
- package/es/varlet.esm.js +334 -96
- package/highlight/attributes.json +21 -5
- package/highlight/tags.json +6 -2
- package/highlight/web-types.json +50 -6
- package/lib/badge/Badge.js +1 -1
- package/lib/bottom-navigation-item/BottomNavigationItem.js +3 -1
- package/lib/card/Card.js +228 -15
- package/lib/card/card.css +1 -1
- package/lib/card/card.less +108 -5
- package/lib/card/props.js +25 -0
- package/lib/index-bar/IndexBar.js +3 -3
- package/lib/index-bar/props.js +1 -1
- package/lib/loading/Loading.js +6 -15
- package/lib/loading/loading.css +1 -1
- package/lib/loading/loading.less +20 -0
- package/lib/picker/Picker.js +2 -1
- package/lib/progress/Progress.js +15 -11
- package/lib/progress/progress.css +1 -1
- package/lib/progress/progress.less +3 -0
- package/lib/progress/props.js +1 -1
- package/lib/rate/Rate.js +3 -1
- package/lib/rate/props.js +2 -4
- package/lib/rate/rate.css +1 -1
- package/lib/rate/rate.less +7 -0
- package/lib/select/Select.js +3 -1
- package/lib/slider/Slider.js +9 -8
- package/lib/style.css +1 -1
- package/lib/switch/Switch.js +22 -19
- package/lib/switch/props.js +1 -2
- package/lib/switch/switch.css +1 -1
- package/lib/switch/switch.less +18 -4
- package/lib/utils/elements.js +17 -1
- package/lib/utils/jest.js +21 -0
- package/package.json +10 -9
- package/types/card.d.ts +9 -0
- package/types/indexBar.d.ts +1 -1
- package/umd/varlet.js +4 -4
package/es/loading/loading.less
CHANGED
|
@@ -84,6 +84,26 @@
|
|
|
84
84
|
display: inline-block;
|
|
85
85
|
animation: circle 1.8s linear infinite;
|
|
86
86
|
|
|
87
|
+
&--large {
|
|
88
|
+
width: 36px;
|
|
89
|
+
height: 36px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&--normal {
|
|
93
|
+
width: 30px;
|
|
94
|
+
height: 30px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&--small {
|
|
98
|
+
width: 24px;
|
|
99
|
+
height: 24px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&--mini {
|
|
103
|
+
width: 18px;
|
|
104
|
+
height: 18px;
|
|
105
|
+
}
|
|
106
|
+
|
|
87
107
|
svg {
|
|
88
108
|
display: block;
|
|
89
109
|
width: 100%;
|
package/es/picker/Picker.js
CHANGED
package/es/progress/Progress.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed } from 'vue';
|
|
2
2
|
import { props } from './props';
|
|
3
3
|
import { toNumber } from '../utils/shared';
|
|
4
|
+
import { toSizeUnit, multiplySizeUnit, toPxNum } from '../utils/elements';
|
|
4
5
|
import { createNamespace } from '../utils/components';
|
|
5
6
|
var {
|
|
6
7
|
n,
|
|
@@ -22,7 +23,7 @@ export function render(_ctx, _cache) {
|
|
|
22
23
|
}, [_createElementVNode("div", _mergeProps({
|
|
23
24
|
class: _ctx.n('linear-block'),
|
|
24
25
|
style: {
|
|
25
|
-
height: _ctx.lineWidth
|
|
26
|
+
height: _ctx.toSizeUnit(_ctx.lineWidth)
|
|
26
27
|
}
|
|
27
28
|
}, _ctx.$attrs), [_ctx.track ? (_openBlock(), _createElementBlock("div", {
|
|
28
29
|
key: 0,
|
|
@@ -55,8 +56,8 @@ export function render(_ctx, _cache) {
|
|
|
55
56
|
key: 1,
|
|
56
57
|
class: _normalizeClass(_ctx.n('circle')),
|
|
57
58
|
style: _normalizeStyle({
|
|
58
|
-
width: _ctx.size
|
|
59
|
-
height: _ctx.size
|
|
59
|
+
width: _ctx.toSizeUnit(_ctx.size),
|
|
60
|
+
height: _ctx.toSizeUnit(_ctx.size)
|
|
60
61
|
})
|
|
61
62
|
}, [(_openBlock(), _createElementBlock("svg", {
|
|
62
63
|
class: _normalizeClass(_ctx.n('circle-svg')),
|
|
@@ -67,11 +68,11 @@ export function render(_ctx, _cache) {
|
|
|
67
68
|
}, [_ctx.track ? (_openBlock(), _createElementBlock("circle", {
|
|
68
69
|
key: 0,
|
|
69
70
|
class: _normalizeClass(_ctx.n('circle-background')),
|
|
70
|
-
cx: _ctx.size
|
|
71
|
-
cy: _ctx.size
|
|
71
|
+
cx: _ctx.multiplySizeUnit(_ctx.size, 0.5),
|
|
72
|
+
cy: _ctx.multiplySizeUnit(_ctx.size, 0.5),
|
|
72
73
|
r: _ctx.circleProps.radius,
|
|
73
74
|
fill: "transparent",
|
|
74
|
-
"stroke-width": _ctx.lineWidth,
|
|
75
|
+
"stroke-width": _ctx.toSizeUnit(_ctx.lineWidth),
|
|
75
76
|
style: _normalizeStyle({
|
|
76
77
|
strokeDasharray: _ctx.circleProps.perimeter,
|
|
77
78
|
stroke: _ctx.trackColor
|
|
@@ -80,11 +81,11 @@ export function render(_ctx, _cache) {
|
|
|
80
81
|
/* CLASS, STYLE, PROPS */
|
|
81
82
|
, _hoisted_2)) : _createCommentVNode("v-if", true), _createElementVNode("circle", {
|
|
82
83
|
class: _normalizeClass(_ctx.n('circle-certain')),
|
|
83
|
-
cx: _ctx.size
|
|
84
|
-
cy: _ctx.size
|
|
84
|
+
cx: _ctx.multiplySizeUnit(_ctx.size, 0.5),
|
|
85
|
+
cy: _ctx.multiplySizeUnit(_ctx.size, 0.5),
|
|
85
86
|
r: _ctx.circleProps.radius,
|
|
86
87
|
fill: "transparent",
|
|
87
|
-
"stroke-width": _ctx.lineWidth,
|
|
88
|
+
"stroke-width": _ctx.toSizeUnit(_ctx.lineWidth),
|
|
88
89
|
style: _normalizeStyle({
|
|
89
90
|
strokeDasharray: _ctx.circleProps.strokeDasharray,
|
|
90
91
|
stroke: _ctx.color
|
|
@@ -128,9 +129,9 @@ export default defineComponent({
|
|
|
128
129
|
lineWidth,
|
|
129
130
|
value
|
|
130
131
|
} = props;
|
|
131
|
-
var viewBox = "0 0 " + size + " " + size;
|
|
132
|
+
var viewBox = "0 0 " + toPxNum(size) + " " + toPxNum(size);
|
|
132
133
|
var roundValue = toNumber(value) > 100 ? 100 : Math.round(toNumber(value));
|
|
133
|
-
var radius = (size -
|
|
134
|
+
var radius = (toPxNum(size) - toPxNum(lineWidth)) / 2;
|
|
134
135
|
var perimeter = 2 * Math.PI * radius;
|
|
135
136
|
var strokeDasharray = roundValue / 100 * perimeter + ", " + perimeter;
|
|
136
137
|
return {
|
|
@@ -144,6 +145,8 @@ export default defineComponent({
|
|
|
144
145
|
return {
|
|
145
146
|
n,
|
|
146
147
|
classes,
|
|
148
|
+
toSizeUnit,
|
|
149
|
+
multiplySizeUnit,
|
|
147
150
|
linearProps,
|
|
148
151
|
circleProps
|
|
149
152
|
};
|
package/es/progress/progress.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --progress-font-size: var(--font-size-sm); --progress-ripple-color: #fff; --progress-track-color: #d8d8d8; --progress-background: var(--color-primary);}.var-progress { position: relative; font-size: var(--progress-font-size);}.var-progress__linear { display: flex; align-items: center;}.var-progress__linear-block { flex: 1; position: relative; overflow: hidden;}.var-progress__linear-background,.var-progress__linear-certain { width: 100%; height: 100%;}.var-progress__linear-ripple::after { position: absolute; width: 0; background-color: var(--progress-ripple-color); height: 100%; opacity: 0; animation: ripple 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; content: '';}.var-progress__linear-background { background-color: var(--progress-track-color);}.var-progress__linear-certain { position: absolute; background-color: var(--progress-background); top: 0; left: 0; transition: all 0.2s, background-color 0.8s;}.var-progress__linear-label { margin-left: 8px; flex: 0;}@keyframes ripple { 0% { width: 0; opacity: 0.1; } 20% { width: 0; opacity: 0.5; } 80% { width: 100%; opacity: 0; }}.var-progress__circle { position: relative;}.var-progress__circle-background { stroke: var(--progress-track-color);}.var-progress__circle-certain { transition: all 0.2s; stroke: var(--progress-background); position: absolute;}.var-progress__circle-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);}
|
|
1
|
+
:root { --progress-font-size: var(--font-size-sm); --progress-ripple-color: #fff; --progress-track-color: #d8d8d8; --progress-background: var(--color-primary);}.var-progress { position: relative; font-size: var(--progress-font-size);}.var-progress__linear { display: flex; align-items: center;}.var-progress__linear-block { flex: 1; position: relative; overflow: hidden; height: 4px;}.var-progress__linear-background,.var-progress__linear-certain { width: 100%; height: 100%;}.var-progress__linear-ripple::after { position: absolute; width: 0; background-color: var(--progress-ripple-color); height: 100%; opacity: 0; animation: ripple 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; content: '';}.var-progress__linear-background { background-color: var(--progress-track-color);}.var-progress__linear-certain { position: absolute; background-color: var(--progress-background); top: 0; left: 0; transition: all 0.2s, background-color 0.8s;}.var-progress__linear-label { margin-left: 8px; flex: 0;}@keyframes ripple { 0% { width: 0; opacity: 0.1; } 20% { width: 0; opacity: 0.5; } 80% { width: 100%; opacity: 0; }}.var-progress__circle { position: relative; width: 40px; height: 40px;}.var-progress__circle-background { stroke: var(--progress-track-color);}.var-progress__circle-certain { transition: all 0.2s; stroke: var(--progress-background); position: absolute;}.var-progress__circle-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
flex: 1;
|
|
23
23
|
position: relative;
|
|
24
24
|
overflow: hidden;
|
|
25
|
+
height: 4px;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
&-background,
|
|
@@ -77,6 +78,8 @@
|
|
|
77
78
|
|
|
78
79
|
&__circle {
|
|
79
80
|
position: relative;
|
|
81
|
+
width: 40px;
|
|
82
|
+
height: 40px;
|
|
80
83
|
|
|
81
84
|
&-background {
|
|
82
85
|
stroke: var(--progress-track-color);
|
package/es/progress/props.js
CHANGED
package/es/rate/Rate.js
CHANGED
|
@@ -10,7 +10,7 @@ import { props } from './props';
|
|
|
10
10
|
var {
|
|
11
11
|
n
|
|
12
12
|
} = createNamespace('rate');
|
|
13
|
-
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent,
|
|
13
|
+
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";
|
|
14
14
|
|
|
15
15
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
|
16
16
|
|
|
@@ -33,6 +33,8 @@ export function render(_ctx, _cache) {
|
|
|
33
33
|
class: _normalizeClass(_ctx.getClass(val)),
|
|
34
34
|
onClick: $event => _ctx.handleClick(val, $event)
|
|
35
35
|
}, [_createVNode(_component_var_icon, {
|
|
36
|
+
class: _normalizeClass(_ctx.n('content-icon')),
|
|
37
|
+
"var-rate-cover": "",
|
|
36
38
|
transition: 0,
|
|
37
39
|
namespace: _ctx.namespace,
|
|
38
40
|
name: _ctx.getIconName(val),
|
|
@@ -41,7 +43,7 @@ export function render(_ctx, _cache) {
|
|
|
41
43
|
})
|
|
42
44
|
}, null, 8
|
|
43
45
|
/* PROPS */
|
|
44
|
-
, ["namespace", "name", "style"])], 14
|
|
46
|
+
, ["class", "namespace", "name", "style"])], 14
|
|
45
47
|
/* CLASS, STYLE, PROPS */
|
|
46
48
|
, _hoisted_1)), [[_directive_ripple, {
|
|
47
49
|
disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled || !_ctx.ripple
|
package/es/rate/props.js
CHANGED
|
@@ -22,12 +22,10 @@ export var props = {
|
|
|
22
22
|
default: 'star-outline'
|
|
23
23
|
},
|
|
24
24
|
size: {
|
|
25
|
-
type: [String, Number]
|
|
26
|
-
default: '24'
|
|
25
|
+
type: [String, Number]
|
|
27
26
|
},
|
|
28
27
|
gap: {
|
|
29
|
-
type: [String, Number]
|
|
30
|
-
default: '2'
|
|
28
|
+
type: [String, Number]
|
|
31
29
|
},
|
|
32
30
|
namespace: {
|
|
33
31
|
type: String
|
package/es/rate/rate.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --rate-disabled-color: var(--color-text-disabled); --rate-error-color: var(--color-danger); --rate-action-padding: 4px; --rate-primary-color: var(--color-primary);}.var-rate { display: flex; transform: translateX(calc(-1 * var(--rate-action-padding)));}.var-rate__content { padding: var(--rate-action-padding); box-sizing: unset; cursor: pointer; display: flex; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-rate--primary { color: var(--rate-primary-color);}.var-rate--disabled { color: var(--rate-disabled-color); cursor: not-allowed;}.var-rate--error { color: var(--rate-error-color);}
|
|
1
|
+
:root { --rate-disabled-color: var(--color-text-disabled); --rate-error-color: var(--color-danger); --rate-action-padding: 4px; --rate-primary-color: var(--color-primary);}.var-rate { display: flex; transform: translateX(calc(-1 * var(--rate-action-padding)));}.var-rate__content { padding: var(--rate-action-padding); box-sizing: unset; cursor: pointer; display: flex; width: 24px; height: 24px; margin-right: 2px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-rate__content-icon[var-rate-cover] { font-size: 24px;}.var-rate--primary { color: var(--rate-primary-color);}.var-rate--disabled { color: var(--rate-disabled-color); cursor: not-allowed;}.var-rate--error { color: var(--rate-error-color);}
|
package/es/rate/rate.less
CHANGED
package/es/select/Select.js
CHANGED
|
@@ -248,6 +248,8 @@ export default defineComponent({
|
|
|
248
248
|
};
|
|
249
249
|
|
|
250
250
|
var findLabel = modelValue => {
|
|
251
|
+
var _option$label$value, _option;
|
|
252
|
+
|
|
251
253
|
var option = options.find(_ref2 => {
|
|
252
254
|
var {
|
|
253
255
|
value
|
|
@@ -264,7 +266,7 @@ export default defineComponent({
|
|
|
264
266
|
});
|
|
265
267
|
}
|
|
266
268
|
|
|
267
|
-
return option.label.value;
|
|
269
|
+
return (_option$label$value = (_option = option) == null ? void 0 : _option.label.value) != null ? _option$label$value : '';
|
|
268
270
|
};
|
|
269
271
|
|
|
270
272
|
var computePlaceholderState = () => {
|
package/es/slider/Slider.js
CHANGED
|
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import { defineComponent, ref, onMounted, computed, reactive, nextTick, watch } from 'vue';
|
|
4
4
|
import { useValidation, createNamespace, call } from '../utils/components';
|
|
5
5
|
import { useForm } from '../form/provide';
|
|
6
|
-
import { getLeft } from '../utils/elements';
|
|
6
|
+
import { getLeft, multiplySizeUnit } from '../utils/elements';
|
|
7
7
|
import { isArray, isNumber, toNumber } from '../utils/shared';
|
|
8
8
|
import { props } from './props';
|
|
9
9
|
import VarFormDetails from '../form-details';
|
|
@@ -31,8 +31,8 @@ export function render(_ctx, _cache) {
|
|
|
31
31
|
}, [_createElementVNode("div", {
|
|
32
32
|
class: _normalizeClass(_ctx.classes(_ctx.n('block'), [_ctx.isDisabled, _ctx.n('--disabled')], [_ctx.errorMessage, _ctx.n('--error')])),
|
|
33
33
|
style: _normalizeStyle({
|
|
34
|
-
height: _ctx.thumbSize === undefined ? _ctx.thumbSize :
|
|
35
|
-
margin: _ctx.thumbSize === undefined ? _ctx.thumbSize : "0 " + _ctx.
|
|
34
|
+
height: _ctx.thumbSize === undefined ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 3),
|
|
35
|
+
margin: _ctx.thumbSize === undefined ? _ctx.thumbSize : "0 " + _ctx.multiplySizeUnit(_ctx.thumbSize, 0.5)
|
|
36
36
|
}),
|
|
37
37
|
ref: "sliderEl",
|
|
38
38
|
onClick: _cache[0] || (_cache[0] = function () {
|
|
@@ -44,7 +44,7 @@ export function render(_ctx, _cache) {
|
|
|
44
44
|
class: _normalizeClass(_ctx.n('track-background')),
|
|
45
45
|
style: _normalizeStyle({
|
|
46
46
|
background: _ctx.trackColor,
|
|
47
|
-
height: _ctx.trackHeight
|
|
47
|
+
height: _ctx.multiplySizeUnit(_ctx.trackHeight)
|
|
48
48
|
})
|
|
49
49
|
}, null, 6
|
|
50
50
|
/* CLASS, STYLE */
|
|
@@ -73,8 +73,8 @@ export function render(_ctx, _cache) {
|
|
|
73
73
|
class: _normalizeClass(_ctx.n('thumb-block')),
|
|
74
74
|
style: _normalizeStyle({
|
|
75
75
|
background: _ctx.thumbColor,
|
|
76
|
-
height: _ctx.thumbSize
|
|
77
|
-
width: _ctx.thumbSize
|
|
76
|
+
height: _ctx.multiplySizeUnit(_ctx.thumbSize),
|
|
77
|
+
width: _ctx.multiplySizeUnit(_ctx.thumbSize)
|
|
78
78
|
})
|
|
79
79
|
}, null, 6
|
|
80
80
|
/* CLASS, STYLE */
|
|
@@ -90,8 +90,8 @@ export function render(_ctx, _cache) {
|
|
|
90
90
|
style: _normalizeStyle({
|
|
91
91
|
background: _ctx.labelColor,
|
|
92
92
|
color: _ctx.labelTextColor,
|
|
93
|
-
height: _ctx.thumbSize === undefined ? _ctx.thumbSize :
|
|
94
|
-
width: _ctx.thumbSize === undefined ? _ctx.thumbSize :
|
|
93
|
+
height: _ctx.thumbSize === undefined ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2),
|
|
94
|
+
width: _ctx.thumbSize === undefined ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2)
|
|
95
95
|
})
|
|
96
96
|
}, [_createElementVNode("span", null, _toDisplayString(item.value), 1
|
|
97
97
|
/* TEXT */
|
|
@@ -176,7 +176,7 @@ export default defineComponent({
|
|
|
176
176
|
var size;
|
|
177
177
|
|
|
178
178
|
if (props.thumbSize !== undefined) {
|
|
179
|
-
size = thumbsProps[item.enumValue].active ?
|
|
179
|
+
size = thumbsProps[item.enumValue].active ? multiplySizeUnit(props.thumbSize, 3) : '0px';
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
return {
|
|
@@ -385,6 +385,7 @@ export default defineComponent({
|
|
|
385
385
|
errorMessage,
|
|
386
386
|
thumbsProps,
|
|
387
387
|
thumbList,
|
|
388
|
+
multiplySizeUnit,
|
|
388
389
|
toNumber,
|
|
389
390
|
getRippleSize,
|
|
390
391
|
showLabel,
|