@varlet/ui 2.5.1 → 2.5.3
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/menu/Menu.js +4 -1
- package/es/menu/props.js +4 -0
- package/es/menu/usePopover.js +13 -13
- package/es/tooltip/Tooltip.js +0 -2
- package/es/varlet.esm.js +522 -518
- package/highlight/attributes.json +4 -0
- package/highlight/tags.json +1 -0
- package/highlight/web-types.json +10 -1
- package/lib/menu/Menu.js +5 -1
- package/lib/menu/props.js +4 -0
- package/lib/menu/usePopover.js +13 -13
- package/lib/tooltip/Tooltip.js +0 -2
- package/package.json +5 -5
- package/types/menu.d.ts +1 -0
- package/umd/varlet.js +3 -3
|
@@ -1071,6 +1071,10 @@
|
|
|
1071
1071
|
"type": "string",
|
|
1072
1072
|
"description": "菜单触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发 默认值:click"
|
|
1073
1073
|
},
|
|
1074
|
+
"var-menu/same-width": {
|
|
1075
|
+
"type": "boolean",
|
|
1076
|
+
"description": "是否与触发元素同宽 默认值:false"
|
|
1077
|
+
},
|
|
1074
1078
|
"var-menu/default-style": {
|
|
1075
1079
|
"type": "boolean",
|
|
1076
1080
|
"description": "是否启用默认样式 默认值:true"
|
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": "2.5.
|
|
4
|
+
"version": "2.5.2",
|
|
5
5
|
"name": "VARLET",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -3198,6 +3198,15 @@
|
|
|
3198
3198
|
"kind": "expression"
|
|
3199
3199
|
}
|
|
3200
3200
|
},
|
|
3201
|
+
{
|
|
3202
|
+
"name": "same-width",
|
|
3203
|
+
"description": "是否与触发元素同宽",
|
|
3204
|
+
"default": "false",
|
|
3205
|
+
"value": {
|
|
3206
|
+
"type": "boolean",
|
|
3207
|
+
"kind": "expression"
|
|
3208
|
+
}
|
|
3209
|
+
},
|
|
3201
3210
|
{
|
|
3202
3211
|
"name": "default-style",
|
|
3203
3212
|
"description": "是否启用默认样式",
|
package/lib/menu/Menu.js
CHANGED
|
@@ -12,6 +12,8 @@ var _props = require("./props");
|
|
|
12
12
|
|
|
13
13
|
var _usePopover = require("./usePopover");
|
|
14
14
|
|
|
15
|
+
var _elements = require("../utils/elements");
|
|
16
|
+
|
|
15
17
|
var {
|
|
16
18
|
n,
|
|
17
19
|
classes
|
|
@@ -40,7 +42,8 @@ function render(_ctx, _cache) {
|
|
|
40
42
|
default: (0, _vue.withCtx)(() => [(0, _vue.withDirectives)((0, _vue.createElementVNode)("div", {
|
|
41
43
|
ref: "popover",
|
|
42
44
|
style: (0, _vue.normalizeStyle)({
|
|
43
|
-
zIndex: _ctx.zIndex
|
|
45
|
+
zIndex: _ctx.zIndex,
|
|
46
|
+
width: _ctx.sameWidth ? _ctx.toSizeUnit(Math.ceil(_ctx.hostSize.width)) : undefined
|
|
44
47
|
}),
|
|
45
48
|
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('menu'), [_ctx.defaultStyle, _ctx.n('--menu-background-color') + " " + _ctx.n('$-elevation--3')])),
|
|
46
49
|
onClick: _cache[0] || (_cache[0] = (0, _vue.withModifiers)(() => {}, ["stop"])),
|
|
@@ -96,6 +99,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
96
99
|
hostSize,
|
|
97
100
|
show,
|
|
98
101
|
zIndex,
|
|
102
|
+
toSizeUnit: _elements.toSizeUnit,
|
|
99
103
|
n,
|
|
100
104
|
classes,
|
|
101
105
|
handleHostClick,
|
package/lib/menu/props.js
CHANGED
package/lib/menu/usePopover.js
CHANGED
|
@@ -29,6 +29,10 @@ function usePopover(options) {
|
|
|
29
29
|
var host = (0, _vue.ref)(null);
|
|
30
30
|
var popover = (0, _vue.ref)(null);
|
|
31
31
|
var show = (0, _vue.ref)(false);
|
|
32
|
+
var hostSize = (0, _vue.ref)({
|
|
33
|
+
width: 0,
|
|
34
|
+
height: 0
|
|
35
|
+
});
|
|
32
36
|
var {
|
|
33
37
|
zIndex
|
|
34
38
|
} = (0, _zIndex.useZIndex)(() => show.value, 1);
|
|
@@ -36,17 +40,13 @@ function usePopover(options) {
|
|
|
36
40
|
var clickSelf = false;
|
|
37
41
|
var enterPopover = false;
|
|
38
42
|
var enterHost = false;
|
|
39
|
-
var hostSize = {
|
|
40
|
-
width: 0,
|
|
41
|
-
height: 0
|
|
42
|
-
};
|
|
43
43
|
|
|
44
44
|
var computeHostSize = () => {
|
|
45
45
|
var {
|
|
46
46
|
width,
|
|
47
47
|
height
|
|
48
48
|
} = window.getComputedStyle(host.value);
|
|
49
|
-
hostSize = {
|
|
49
|
+
hostSize.value = {
|
|
50
50
|
width: (0, _elements.toPxNum)(width),
|
|
51
51
|
height: (0, _elements.toPxNum)(height)
|
|
52
52
|
};
|
|
@@ -138,56 +138,56 @@ function usePopover(options) {
|
|
|
138
138
|
return {
|
|
139
139
|
placement: 'bottom',
|
|
140
140
|
skidding: offset.x,
|
|
141
|
-
distance: offset.y - hostSize.height
|
|
141
|
+
distance: offset.y - hostSize.value.height
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
case 'cover-top-start':
|
|
145
145
|
return {
|
|
146
146
|
placement: 'bottom-start',
|
|
147
147
|
skidding: offset.x,
|
|
148
|
-
distance: offset.y - hostSize.height
|
|
148
|
+
distance: offset.y - hostSize.value.height
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
case 'cover-top-end':
|
|
152
152
|
return {
|
|
153
153
|
placement: 'bottom-end',
|
|
154
154
|
skidding: offset.x,
|
|
155
|
-
distance: offset.y - hostSize.height
|
|
155
|
+
distance: offset.y - hostSize.value.height
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
case 'cover-bottom':
|
|
159
159
|
return {
|
|
160
160
|
placement: 'top',
|
|
161
161
|
skidding: offset.x,
|
|
162
|
-
distance: -offset.y - hostSize.height
|
|
162
|
+
distance: -offset.y - hostSize.value.height
|
|
163
163
|
};
|
|
164
164
|
|
|
165
165
|
case 'cover-bottom-start':
|
|
166
166
|
return {
|
|
167
167
|
placement: 'top-start',
|
|
168
168
|
skidding: offset.x,
|
|
169
|
-
distance: -offset.y - hostSize.height
|
|
169
|
+
distance: -offset.y - hostSize.value.height
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
case 'cover-bottom-end':
|
|
173
173
|
return {
|
|
174
174
|
placement: 'top-end',
|
|
175
175
|
skidding: offset.x,
|
|
176
|
-
distance: -offset.y - hostSize.height
|
|
176
|
+
distance: -offset.y - hostSize.value.height
|
|
177
177
|
};
|
|
178
178
|
|
|
179
179
|
case 'cover-left':
|
|
180
180
|
return {
|
|
181
181
|
placement: 'right',
|
|
182
182
|
skidding: offset.y,
|
|
183
|
-
distance: offset.x - hostSize.width
|
|
183
|
+
distance: offset.x - hostSize.value.width
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
case 'cover-right':
|
|
187
187
|
return {
|
|
188
188
|
placement: 'left',
|
|
189
189
|
skidding: offset.y,
|
|
190
|
-
distance: -offset.x - hostSize.width
|
|
190
|
+
distance: -offset.x - hostSize.value.width
|
|
191
191
|
};
|
|
192
192
|
|
|
193
193
|
case 'left':
|
package/lib/tooltip/Tooltip.js
CHANGED
|
@@ -83,7 +83,6 @@ var _default = (0, _vue.defineComponent)({
|
|
|
83
83
|
var {
|
|
84
84
|
popover,
|
|
85
85
|
host,
|
|
86
|
-
hostSize,
|
|
87
86
|
show,
|
|
88
87
|
zIndex,
|
|
89
88
|
handleHostClick,
|
|
@@ -102,7 +101,6 @@ var _default = (0, _vue.defineComponent)({
|
|
|
102
101
|
return {
|
|
103
102
|
popover,
|
|
104
103
|
host,
|
|
105
|
-
hostSize,
|
|
106
104
|
show,
|
|
107
105
|
zIndex,
|
|
108
106
|
n,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.3",
|
|
4
4
|
"description": "A material like components library",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@popperjs/core": "^2.11.6",
|
|
48
48
|
"dayjs": "^1.10.4",
|
|
49
49
|
"decimal.js": "^10.2.1",
|
|
50
|
-
"@varlet/icons": "2.5.
|
|
51
|
-
"@varlet/shared": "2.5.
|
|
50
|
+
"@varlet/icons": "2.5.3",
|
|
51
|
+
"@varlet/shared": "2.5.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/jest": "^26.0.15",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"typescript": "^4.4.4",
|
|
64
64
|
"vue": "3.2.25",
|
|
65
65
|
"vue-router": "4.0.12",
|
|
66
|
-
"@varlet/touch-emulator": "2.5.
|
|
67
|
-
"@varlet/cli": "2.5.
|
|
66
|
+
"@varlet/touch-emulator": "2.5.3",
|
|
67
|
+
"@varlet/cli": "2.5.3"
|
|
68
68
|
},
|
|
69
69
|
"browserslist": [
|
|
70
70
|
"Chrome >= 54",
|
package/types/menu.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface MenuProps extends BasicAttributes {
|
|
|
25
25
|
offsetX?: string | number
|
|
26
26
|
offsetY?: string | number
|
|
27
27
|
teleport?: TeleportProps['to']
|
|
28
|
+
sameWidth?: boolean
|
|
28
29
|
defaultStyle?: boolean
|
|
29
30
|
onOpen?: ListenerProp<() => void>
|
|
30
31
|
onOpened?: ListenerProp<() => void>
|