@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
|
@@ -239,6 +239,10 @@
|
|
|
239
239
|
"type": "string",
|
|
240
240
|
"description": "图片地址 默认值:-"
|
|
241
241
|
},
|
|
242
|
+
"var-card/layout": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"description": "排列方式,可选值为 `row` `column` 默认值:column"
|
|
245
|
+
},
|
|
242
246
|
"var-card/fit": {
|
|
243
247
|
"type": "string",
|
|
244
248
|
"description": "填充模式,可选值为 `fill` `contain` `cover` `none` `scale-down` 默认值:cover"
|
|
@@ -247,14 +251,26 @@
|
|
|
247
251
|
"type": "string",
|
|
248
252
|
"description": "替代文本 默认值:-"
|
|
249
253
|
},
|
|
250
|
-
"var-card/height": {
|
|
254
|
+
"var-card/image-height": {
|
|
251
255
|
"type": "string | number",
|
|
252
256
|
"description": "图片高度 默认值:-"
|
|
253
257
|
},
|
|
258
|
+
"var-card/image-width": {
|
|
259
|
+
"type": "string | number",
|
|
260
|
+
"description": "图片宽度 默认值:-"
|
|
261
|
+
},
|
|
254
262
|
"var-card/ripple": {
|
|
255
263
|
"type": "boolean",
|
|
256
264
|
"description": "是否开启水波 默认值:false"
|
|
257
265
|
},
|
|
266
|
+
"var-card/floating": {
|
|
267
|
+
"type": "boolean",
|
|
268
|
+
"description": "是否开启全屏 默认值:false"
|
|
269
|
+
},
|
|
270
|
+
"var-card/floating-duration": {
|
|
271
|
+
"type": "number",
|
|
272
|
+
"description": "开关全屏所需时间(ms) 默认值:250"
|
|
273
|
+
},
|
|
258
274
|
"var-cell/title": {
|
|
259
275
|
"type": "string | number",
|
|
260
276
|
"description": "单元格标题 默认值:-"
|
|
@@ -800,7 +816,7 @@
|
|
|
800
816
|
"description": "是否开启锚点吸顶 默认值:true"
|
|
801
817
|
},
|
|
802
818
|
"var-index-bar/sticky-offset-top": {
|
|
803
|
-
"type": "number",
|
|
819
|
+
"type": "number | string",
|
|
804
820
|
"description": "锚点吸顶时与顶部的距离 默认值:0"
|
|
805
821
|
},
|
|
806
822
|
"var-index-bar/hide-list": {
|
|
@@ -1253,11 +1269,11 @@
|
|
|
1253
1269
|
},
|
|
1254
1270
|
"var-rate/size": {
|
|
1255
1271
|
"type": "number | string",
|
|
1256
|
-
"description": "图标大小,默认单位为 `px`
|
|
1272
|
+
"description": "图标大小,默认单位为 `px` 默认值:-"
|
|
1257
1273
|
},
|
|
1258
1274
|
"var-rate/gap": {
|
|
1259
1275
|
"type": "number | string",
|
|
1260
|
-
"description": "图标间隔,默认单位为 `px`
|
|
1276
|
+
"description": "图标间隔,默认单位为 `px` 默认值:-"
|
|
1261
1277
|
},
|
|
1262
1278
|
"var-rate/half": {
|
|
1263
1279
|
"type": "boolean",
|
|
@@ -1641,7 +1657,7 @@
|
|
|
1641
1657
|
},
|
|
1642
1658
|
"var-switch/size": {
|
|
1643
1659
|
"type": "string | number",
|
|
1644
|
-
"description": "switch 的大小
|
|
1660
|
+
"description": "switch 的大小 默认值:-"
|
|
1645
1661
|
},
|
|
1646
1662
|
"var-switch/rules": {
|
|
1647
1663
|
"type": "array",
|
package/highlight/tags.json
CHANGED
package/highlight/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
|
-
"version": "1.27.
|
|
4
|
+
"version": "1.27.9",
|
|
5
5
|
"name": "VARLET",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -706,6 +706,15 @@
|
|
|
706
706
|
"kind": "expression"
|
|
707
707
|
}
|
|
708
708
|
},
|
|
709
|
+
{
|
|
710
|
+
"name": "layout",
|
|
711
|
+
"description": "排列方式,可选值为 `row` `column`",
|
|
712
|
+
"default": "column",
|
|
713
|
+
"value": {
|
|
714
|
+
"type": "string",
|
|
715
|
+
"kind": "expression"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
709
718
|
{
|
|
710
719
|
"name": "fit",
|
|
711
720
|
"description": "填充模式,可选值为 `fill` `contain` `cover` `none` `scale-down`",
|
|
@@ -725,7 +734,7 @@
|
|
|
725
734
|
}
|
|
726
735
|
},
|
|
727
736
|
{
|
|
728
|
-
"name": "height",
|
|
737
|
+
"name": "image-height",
|
|
729
738
|
"description": "图片高度",
|
|
730
739
|
"default": "-",
|
|
731
740
|
"value": {
|
|
@@ -733,6 +742,15 @@
|
|
|
733
742
|
"kind": "expression"
|
|
734
743
|
}
|
|
735
744
|
},
|
|
745
|
+
{
|
|
746
|
+
"name": "image-width",
|
|
747
|
+
"description": "图片宽度",
|
|
748
|
+
"default": "-",
|
|
749
|
+
"value": {
|
|
750
|
+
"type": "string | number",
|
|
751
|
+
"kind": "expression"
|
|
752
|
+
}
|
|
753
|
+
},
|
|
736
754
|
{
|
|
737
755
|
"name": "ripple",
|
|
738
756
|
"description": "是否开启水波",
|
|
@@ -741,6 +759,24 @@
|
|
|
741
759
|
"type": "boolean",
|
|
742
760
|
"kind": "expression"
|
|
743
761
|
}
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"name": "floating",
|
|
765
|
+
"description": "是否开启全屏",
|
|
766
|
+
"default": "false",
|
|
767
|
+
"value": {
|
|
768
|
+
"type": "boolean",
|
|
769
|
+
"kind": "expression"
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"name": "floating-duration",
|
|
774
|
+
"description": "开关全屏所需时间(ms)",
|
|
775
|
+
"default": "250",
|
|
776
|
+
"value": {
|
|
777
|
+
"type": "number",
|
|
778
|
+
"kind": "expression"
|
|
779
|
+
}
|
|
744
780
|
}
|
|
745
781
|
],
|
|
746
782
|
"events": [
|
|
@@ -766,9 +802,17 @@
|
|
|
766
802
|
"name": "description",
|
|
767
803
|
"description": "自定义描述"
|
|
768
804
|
},
|
|
805
|
+
{
|
|
806
|
+
"name": "content",
|
|
807
|
+
"description": "自定义正文"
|
|
808
|
+
},
|
|
769
809
|
{
|
|
770
810
|
"name": "extra",
|
|
771
811
|
"description": "自定义底部内容"
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
"name": "close-button",
|
|
815
|
+
"description": "自定义关闭"
|
|
772
816
|
}
|
|
773
817
|
]
|
|
774
818
|
},
|
|
@@ -2403,7 +2447,7 @@
|
|
|
2403
2447
|
"description": "锚点吸顶时与顶部的距离",
|
|
2404
2448
|
"default": "0",
|
|
2405
2449
|
"value": {
|
|
2406
|
-
"type": "number",
|
|
2450
|
+
"type": "number | string",
|
|
2407
2451
|
"kind": "expression"
|
|
2408
2452
|
}
|
|
2409
2453
|
},
|
|
@@ -3744,7 +3788,7 @@
|
|
|
3744
3788
|
{
|
|
3745
3789
|
"name": "size",
|
|
3746
3790
|
"description": "图标大小,默认单位为 `px`",
|
|
3747
|
-
"default": "
|
|
3791
|
+
"default": "-",
|
|
3748
3792
|
"value": {
|
|
3749
3793
|
"type": "number | string",
|
|
3750
3794
|
"kind": "expression"
|
|
@@ -3753,7 +3797,7 @@
|
|
|
3753
3797
|
{
|
|
3754
3798
|
"name": "gap",
|
|
3755
3799
|
"description": "图标间隔,默认单位为 `px`",
|
|
3756
|
-
"default": "
|
|
3800
|
+
"default": "-",
|
|
3757
3801
|
"value": {
|
|
3758
3802
|
"type": "number | string",
|
|
3759
3803
|
"kind": "expression"
|
|
@@ -4866,7 +4910,7 @@
|
|
|
4866
4910
|
{
|
|
4867
4911
|
"name": "size",
|
|
4868
4912
|
"description": "switch 的大小",
|
|
4869
|
-
"default": "
|
|
4913
|
+
"default": "-",
|
|
4870
4914
|
"value": {
|
|
4871
4915
|
"type": "string | number",
|
|
4872
4916
|
"kind": "expression"
|
package/lib/badge/Badge.js
CHANGED
|
@@ -80,7 +80,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
80
80
|
icon
|
|
81
81
|
} = props;
|
|
82
82
|
var positionBasic = slots.default && n('position') + " " + n("--" + position);
|
|
83
|
-
var dotClass = dot
|
|
83
|
+
var dotClass = dot ? n('dot') : null;
|
|
84
84
|
var positionClass = getPositionClass();
|
|
85
85
|
var iconClass = icon ? n('icon') : null;
|
|
86
86
|
return [n("--" + type), positionBasic, dotClass, positionClass, iconClass];
|
|
@@ -112,7 +112,9 @@ var _default = (0, _vue.defineComponent)({
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
var handleClick = () => {
|
|
115
|
-
var
|
|
115
|
+
var _name$value;
|
|
116
|
+
|
|
117
|
+
var active = (_name$value = name.value) != null ? _name$value : index.value;
|
|
116
118
|
(0, _components.call)(props.onClick, active);
|
|
117
119
|
(0, _components.call)(bottomNavigation.onToggle, active);
|
|
118
120
|
};
|
package/lib/card/Card.js
CHANGED
|
@@ -6,6 +6,10 @@ exports.render = render;
|
|
|
6
6
|
|
|
7
7
|
var _ripple = _interopRequireDefault(require("../ripple"));
|
|
8
8
|
|
|
9
|
+
var _icon = _interopRequireDefault(require("../icon"));
|
|
10
|
+
|
|
11
|
+
var _button = _interopRequireDefault(require("../button"));
|
|
12
|
+
|
|
9
13
|
var _vue = require("vue");
|
|
10
14
|
|
|
11
15
|
var _props = require("./props");
|
|
@@ -14,37 +18,73 @@ var _elements = require("../utils/elements");
|
|
|
14
18
|
|
|
15
19
|
var _components = require("../utils/components");
|
|
16
20
|
|
|
21
|
+
var _zIndex = require("../context/zIndex");
|
|
22
|
+
|
|
23
|
+
var _lock = require("../context/lock");
|
|
24
|
+
|
|
17
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
26
|
|
|
27
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
28
|
+
|
|
29
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
30
|
+
|
|
19
31
|
var {
|
|
20
32
|
n,
|
|
21
33
|
classes
|
|
22
34
|
} = (0, _components.createNamespace)('card');
|
|
35
|
+
var RIPPLE_DELAY = 500;
|
|
23
36
|
|
|
24
37
|
var _withScopeId = n => ((0, _vue.pushScopeId)(""), n = n(), (0, _vue.popScopeId)(), n);
|
|
25
38
|
|
|
26
39
|
var _hoisted_1 = ["src", "alt"];
|
|
27
40
|
|
|
28
41
|
function render(_ctx, _cache) {
|
|
42
|
+
var _component_var_icon = (0, _vue.resolveComponent)("var-icon");
|
|
43
|
+
|
|
44
|
+
var _component_var_button = (0, _vue.resolveComponent)("var-button");
|
|
45
|
+
|
|
29
46
|
var _directive_ripple = (0, _vue.resolveDirective)("ripple");
|
|
30
47
|
|
|
31
48
|
return (0, _vue.withDirectives)(((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
32
|
-
|
|
49
|
+
ref: "card",
|
|
50
|
+
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), [_ctx.isRow, _ctx.n('--layout-row')], [_ctx.elevation, "var-elevation--" + _ctx.elevation, 'var-elevation--1'])),
|
|
51
|
+
style: (0, _vue.normalizeStyle)({
|
|
52
|
+
zIndex: _ctx.floated ? _ctx.zIndex : undefined
|
|
53
|
+
}),
|
|
33
54
|
onClick: _cache[0] || (_cache[0] = function () {
|
|
34
55
|
return _ctx.onClick && _ctx.onClick(...arguments);
|
|
35
56
|
})
|
|
36
|
-
}, [(0, _vue.
|
|
37
|
-
|
|
38
|
-
class: (0, _vue.normalizeClass)(_ctx.n('
|
|
57
|
+
}, [(0, _vue.createElementVNode)("div", {
|
|
58
|
+
ref: "cardFloater",
|
|
59
|
+
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('floater'))),
|
|
39
60
|
style: (0, _vue.normalizeStyle)({
|
|
40
|
-
|
|
41
|
-
height: _ctx.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
width: _ctx.floaterWidth,
|
|
62
|
+
height: _ctx.floaterHeight,
|
|
63
|
+
top: _ctx.floaterTop,
|
|
64
|
+
left: _ctx.floaterLeft,
|
|
65
|
+
overflow: _ctx.floaterOverflow,
|
|
66
|
+
position: _ctx.floaterPosition,
|
|
67
|
+
transition: _ctx.floated ? "background-color " + _ctx.floatingDuration + "ms, width " + _ctx.floatingDuration + "ms, height " + _ctx.floatingDuration + "ms, top " + _ctx.floatingDuration + "ms, left " + _ctx.floatingDuration + "ms" : undefined
|
|
68
|
+
})
|
|
69
|
+
}, [(0, _vue.renderSlot)(_ctx.$slots, "image", {}, () => {
|
|
70
|
+
var _ctx$imageHeight;
|
|
71
|
+
|
|
72
|
+
return [_ctx.src ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("img", {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: (0, _vue.normalizeClass)(_ctx.n('image')),
|
|
75
|
+
style: (0, _vue.normalizeStyle)({
|
|
76
|
+
objectFit: _ctx.fit,
|
|
77
|
+
height: _ctx.toSizeUnit((_ctx$imageHeight = _ctx.imageHeight) != null ? _ctx$imageHeight : _ctx.height),
|
|
78
|
+
width: _ctx.toSizeUnit(_ctx.imageWidth)
|
|
79
|
+
}),
|
|
80
|
+
src: _ctx.src,
|
|
81
|
+
alt: _ctx.alt
|
|
82
|
+
}, null, 14
|
|
83
|
+
/* CLASS, STYLE, PROPS */
|
|
84
|
+
, _hoisted_1)) : (0, _vue.createCommentVNode)("v-if", true)];
|
|
85
|
+
}), (0, _vue.createElementVNode)("div", {
|
|
86
|
+
class: (0, _vue.normalizeClass)(_ctx.n('container'))
|
|
87
|
+
}, [(0, _vue.renderSlot)(_ctx.$slots, "title", {}, () => [_ctx.title ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
48
88
|
key: 0,
|
|
49
89
|
class: (0, _vue.normalizeClass)(_ctx.n('title'))
|
|
50
90
|
}, (0, _vue.toDisplayString)(_ctx.title), 3
|
|
@@ -64,10 +104,60 @@ function render(_ctx, _cache) {
|
|
|
64
104
|
class: (0, _vue.normalizeClass)(_ctx.n('footer'))
|
|
65
105
|
}, [(0, _vue.renderSlot)(_ctx.$slots, "extra")], 2
|
|
66
106
|
/* CLASS */
|
|
107
|
+
)) : (0, _vue.createCommentVNode)("v-if", true), _ctx.$slots.content && !_ctx.isRow ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
108
|
+
key: 1,
|
|
109
|
+
class: (0, _vue.normalizeClass)(_ctx.n('content')),
|
|
110
|
+
style: (0, _vue.normalizeStyle)({
|
|
111
|
+
height: _ctx.contentHeight,
|
|
112
|
+
opacity: _ctx.opacity,
|
|
113
|
+
transition: "opacity " + _ctx.floatingDuration * 2 + "ms"
|
|
114
|
+
})
|
|
115
|
+
}, [(0, _vue.renderSlot)(_ctx.$slots, "content")], 6
|
|
116
|
+
/* CLASS, STYLE */
|
|
67
117
|
)) : (0, _vue.createCommentVNode)("v-if", true)], 2
|
|
68
118
|
/* CLASS */
|
|
119
|
+
), _ctx.showFloatingButtons ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
120
|
+
key: 0,
|
|
121
|
+
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('floating-buttons'), 'var--box')),
|
|
122
|
+
style: (0, _vue.normalizeStyle)({
|
|
123
|
+
zIndex: _ctx.zIndex,
|
|
124
|
+
opacity: _ctx.opacity,
|
|
125
|
+
transition: "opacity " + _ctx.floatingDuration * 2 + "ms"
|
|
126
|
+
})
|
|
127
|
+
}, [(0, _vue.renderSlot)(_ctx.$slots, "close-button", {}, () => [(0, _vue.createVNode)(_component_var_button, {
|
|
128
|
+
"var-card-cover": "",
|
|
129
|
+
round: "",
|
|
130
|
+
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('close-button'), 'var-elevation--6')),
|
|
131
|
+
onClick: (0, _vue.withModifiers)(_ctx.close, ["stop"])
|
|
132
|
+
}, {
|
|
133
|
+
default: (0, _vue.withCtx)(() => [(0, _vue.createVNode)(_component_var_icon, {
|
|
134
|
+
"var-card-cover": "",
|
|
135
|
+
name: "window-close",
|
|
136
|
+
class: (0, _vue.normalizeClass)(_ctx.n('close-button-icon'))
|
|
137
|
+
}, null, 8
|
|
138
|
+
/* PROPS */
|
|
139
|
+
, ["class"])]),
|
|
140
|
+
_: 1
|
|
141
|
+
/* STABLE */
|
|
142
|
+
|
|
143
|
+
}, 8
|
|
144
|
+
/* PROPS */
|
|
145
|
+
, ["class", "onClick"])])], 6
|
|
146
|
+
/* CLASS, STYLE */
|
|
147
|
+
)) : (0, _vue.createCommentVNode)("v-if", true)], 6
|
|
148
|
+
/* CLASS, STYLE */
|
|
149
|
+
), (0, _vue.createElementVNode)("div", {
|
|
150
|
+
class: (0, _vue.normalizeClass)(_ctx.n('holder')),
|
|
151
|
+
style: (0, _vue.normalizeStyle)({
|
|
152
|
+
width: _ctx.holderWidth,
|
|
153
|
+
height: _ctx.holderHeight
|
|
154
|
+
})
|
|
155
|
+
}, null, 6
|
|
156
|
+
/* CLASS, STYLE */
|
|
157
|
+
)], 6
|
|
158
|
+
/* CLASS, STYLE */
|
|
69
159
|
)), [[_directive_ripple, {
|
|
70
|
-
disabled: !_ctx.ripple
|
|
160
|
+
disabled: !_ctx.ripple || _ctx.floater
|
|
71
161
|
}]]);
|
|
72
162
|
}
|
|
73
163
|
|
|
@@ -77,13 +167,136 @@ var _default = (0, _vue.defineComponent)({
|
|
|
77
167
|
directives: {
|
|
78
168
|
Ripple: _ripple.default
|
|
79
169
|
},
|
|
170
|
+
components: {
|
|
171
|
+
VarIcon: _icon.default,
|
|
172
|
+
VarButton: _button.default
|
|
173
|
+
},
|
|
80
174
|
props: _props.props,
|
|
81
175
|
|
|
82
|
-
setup() {
|
|
176
|
+
setup(props) {
|
|
177
|
+
var card = (0, _vue.ref)(null);
|
|
178
|
+
var cardFloater = (0, _vue.ref)(null);
|
|
179
|
+
var holderWidth = (0, _vue.ref)('auto');
|
|
180
|
+
var holderHeight = (0, _vue.ref)('auto');
|
|
181
|
+
var floaterWidth = (0, _vue.ref)('100%');
|
|
182
|
+
var floaterHeight = (0, _vue.ref)('100%');
|
|
183
|
+
var floaterTop = (0, _vue.ref)('auto');
|
|
184
|
+
var floaterLeft = (0, _vue.ref)('auto');
|
|
185
|
+
var floaterPosition = (0, _vue.ref)(undefined);
|
|
186
|
+
var floaterOverflow = (0, _vue.ref)('hidden');
|
|
187
|
+
var contentHeight = (0, _vue.ref)('0px');
|
|
188
|
+
var opacity = (0, _vue.ref)('0');
|
|
189
|
+
var {
|
|
190
|
+
zIndex
|
|
191
|
+
} = (0, _zIndex.useZIndex)(() => props.floating, 1);
|
|
192
|
+
var isRow = (0, _vue.computed)(() => props.layout === 'row');
|
|
193
|
+
var showFloatingButtons = (0, _vue.ref)(false);
|
|
194
|
+
var floated = (0, _vue.ref)(false);
|
|
195
|
+
(0, _lock.useLock)(() => props.floating, () => isRow);
|
|
196
|
+
var dropdownFloaterTop = 'auto';
|
|
197
|
+
var dropdownFloaterLeft = 'auto';
|
|
198
|
+
var dropper = null;
|
|
199
|
+
var floater = (0, _vue.ref)(null);
|
|
200
|
+
|
|
201
|
+
var floating = /*#__PURE__*/function () {
|
|
202
|
+
var _ref = _asyncToGenerator(function* () {
|
|
203
|
+
clearTimeout(floater.value);
|
|
204
|
+
clearTimeout(dropper);
|
|
205
|
+
floater.value = null;
|
|
206
|
+
floater.value = setTimeout( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
207
|
+
var {
|
|
208
|
+
width,
|
|
209
|
+
height,
|
|
210
|
+
left,
|
|
211
|
+
top
|
|
212
|
+
} = card.value.getBoundingClientRect();
|
|
213
|
+
holderWidth.value = (0, _elements.toSizeUnit)(width);
|
|
214
|
+
holderHeight.value = (0, _elements.toSizeUnit)(height);
|
|
215
|
+
floaterWidth.value = holderWidth.value;
|
|
216
|
+
floaterHeight.value = holderHeight.value;
|
|
217
|
+
floaterTop.value = (0, _elements.toSizeUnit)(top);
|
|
218
|
+
floaterLeft.value = (0, _elements.toSizeUnit)(left);
|
|
219
|
+
floaterPosition.value = 'fixed';
|
|
220
|
+
dropdownFloaterTop = floaterTop.value;
|
|
221
|
+
dropdownFloaterLeft = floaterLeft.value;
|
|
222
|
+
showFloatingButtons.value = true;
|
|
223
|
+
yield (0, _elements.doubleRaf)();
|
|
224
|
+
floaterTop.value = '0';
|
|
225
|
+
floaterLeft.value = '0';
|
|
226
|
+
floaterWidth.value = '100vw';
|
|
227
|
+
floaterHeight.value = '100vh';
|
|
228
|
+
contentHeight.value = 'auto';
|
|
229
|
+
opacity.value = '1';
|
|
230
|
+
floaterOverflow.value = 'auto';
|
|
231
|
+
floated.value = true;
|
|
232
|
+
}), props.ripple ? RIPPLE_DELAY : 0);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
return function floating() {
|
|
236
|
+
return _ref.apply(this, arguments);
|
|
237
|
+
};
|
|
238
|
+
}();
|
|
239
|
+
|
|
240
|
+
var dropdown = () => {
|
|
241
|
+
clearTimeout(dropper);
|
|
242
|
+
clearTimeout(floater.value);
|
|
243
|
+
floater.value = null;
|
|
244
|
+
floaterWidth.value = holderWidth.value;
|
|
245
|
+
floaterHeight.value = holderHeight.value;
|
|
246
|
+
floaterTop.value = dropdownFloaterTop;
|
|
247
|
+
floaterLeft.value = dropdownFloaterLeft;
|
|
248
|
+
contentHeight.value = '0px';
|
|
249
|
+
opacity.value = '0';
|
|
250
|
+
showFloatingButtons.value = false;
|
|
251
|
+
dropper = setTimeout(() => {
|
|
252
|
+
holderWidth.value = 'auto';
|
|
253
|
+
holderHeight.value = 'auto';
|
|
254
|
+
floaterWidth.value = '100%';
|
|
255
|
+
floaterHeight.value = '100%';
|
|
256
|
+
floaterTop.value = 'auto';
|
|
257
|
+
floaterLeft.value = 'auto';
|
|
258
|
+
dropdownFloaterTop = 'auto';
|
|
259
|
+
dropdownFloaterLeft = 'auto';
|
|
260
|
+
floaterOverflow.value = 'hidden';
|
|
261
|
+
floaterPosition.value = undefined;
|
|
262
|
+
floated.value = false;
|
|
263
|
+
}, props.floatingDuration);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
var close = () => {
|
|
267
|
+
(0, _components.call)(props['onUpdate:floating'], false);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
(0, _vue.watch)(() => props.floating, value => {
|
|
271
|
+
if (isRow.value) return;
|
|
272
|
+
(0, _vue.nextTick)(() => {
|
|
273
|
+
value ? floating() : dropdown();
|
|
274
|
+
});
|
|
275
|
+
}, {
|
|
276
|
+
immediate: true
|
|
277
|
+
});
|
|
83
278
|
return {
|
|
84
279
|
n,
|
|
85
280
|
classes,
|
|
86
|
-
toSizeUnit: _elements.toSizeUnit
|
|
281
|
+
toSizeUnit: _elements.toSizeUnit,
|
|
282
|
+
card,
|
|
283
|
+
cardFloater,
|
|
284
|
+
holderWidth,
|
|
285
|
+
holderHeight,
|
|
286
|
+
floater,
|
|
287
|
+
floaterWidth,
|
|
288
|
+
floaterHeight,
|
|
289
|
+
floaterTop,
|
|
290
|
+
floaterLeft,
|
|
291
|
+
floaterPosition,
|
|
292
|
+
floaterOverflow,
|
|
293
|
+
contentHeight,
|
|
294
|
+
opacity,
|
|
295
|
+
zIndex,
|
|
296
|
+
isRow,
|
|
297
|
+
close,
|
|
298
|
+
showFloatingButtons,
|
|
299
|
+
floated
|
|
87
300
|
};
|
|
88
301
|
}
|
|
89
302
|
|
package/lib/card/card.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --card-padding: 0 0 15px 0; --card-background: #fff; --card-border-radius: 4px; --card-image-width: 100%; --card-image-height: 200px; --card-title-color: #333; --card-title-font-size: 20px; --card-title-padding: 0 12px; --card-title-margin: 15px 0 0 0; --card-subtitle-color: rgba(0, 0, 0, 0.6); --card-subtitle-font-size: 14px; --card-subtitle-padding: 0
|
|
1
|
+
:root { --card-padding: 0 0 15px 0; --card-background: #fff; --card-border-radius: 4px; --card-image-width: 100%; --card-row-image-width: 140px; --card-image-height: 200px; --card-row-height: 140px; --card-title-color: #333; --card-title-font-size: 20px; --card-title-padding: 0 12px; --card-title-margin: 15px 0 0 0; --card-title-row-margin: 12px 0; --card-subtitle-color: rgba(0, 0, 0, 0.6); --card-subtitle-font-size: 14px; --card-subtitle-padding: 0 12px; --card-subtitle-margin: 10px 0 0 0; --card-subtitle-row-margin: -8px 0 0 0; --card-description-color: rgba(0, 0, 0, 0.6); --card-description-font-size: 14px; --card-description-margin: 20px 0 0 0; --card-description-padding: 0 13px; --card-footer-padding: 0 12px; --card-footer-right: 13px; --card-footer-bottom: 9px; --card-footer-margin: 30px 0 0px 0; --card-line-height: 22px; --card-row-line-height: 1.5; --card-floating-buttons-bottom: 16px; --card-floating-buttons-right: 16px; --card-floating-buttons-color: #fff; --card-close-button-icon-size: 24px; --card-close-button-size: 56px; --card-close-button-primary-color: #212121;}.var-card { border-radius: var(--card-border-radius); overflow: hidden;}.var-card__floater { display: flex; flex-direction: column; position: static; line-height: var(--card-line-height); background: var(--card-background); transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__container { padding: var(--card-padding); flex-grow: 1; min-width: 0;}.var-card--layout-row .var-card__floater { min-height: var(--card-row-height); height: 100%; flex-direction: row; position: relative; line-height: var(--card-row-line-height);}.var-card__image { width: var(--card-image-width); height: var(--card-image-height); display: block;}.var-card--layout-row .var-card__image { width: var(--card-row-image-width); height: auto; display: block; flex-shrink: 0;}.var-card__title { font-size: var(--card-title-font-size); padding: var(--card-title-padding); margin: var(--card-title-margin); color: var(--card-title-color); word-break: break-word;}.var-card--layout-row .var-card__title { max-width: 100%; overflow: hidden; margin: var(--card-title-row-margin); text-overflow: ellipsis; white-space: nowrap;}.var-card__subtitle { font-size: var(--card-subtitle-font-size); color: var(--card-subtitle-color); padding: var(--card-subtitle-padding); margin: var(--card-subtitle-margin); word-break: break-word;}.var-card--layout-row .var-card__subtitle { margin: var(--card-subtitle-row-margin); text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;}.var-card__description { font-size: var(--card-description-font-size); color: var(--card-description-color); margin: var(--card-description-margin); padding: var(--card-description-padding); word-break: break-all;}.var-card__footer { display: flex; justify-content: flex-end; padding: var(--card-footer-padding); margin: var(--card-footer-margin);}.var-card--layout-row .var-card__footer { position: absolute; padding: 0; right: var(--card-footer-right); bottom: var(--card-footer-bottom);}.var-card__content { overflow: hidden; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__floating-buttons { position: fixed; bottom: var(--card-floating-buttons-bottom); right: var(--card-floating-buttons-right); color: var(--card-floating-buttons-color);}.var-card__close-button[var-card-cover] { padding: var(--card-close-button-padding); width: var(--card-close-button-size); height: var(--card-close-button-size); background-color: var(--card-close-button-primary-color);}.var-card__close-button-icon[var-card-cover] { font-size: var(--card-close-button-icon-size);}
|