@varlet/ui 2.13.2 → 2.13.4-alpha.1690279122540
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/drag/Drag.mjs +13 -0
- package/es/fab/Fab.mjs +55 -54
- package/es/fab/props.mjs +5 -1
- package/es/fab/style/index.mjs +1 -0
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/switch/Switch.mjs +7 -7
- package/es/utils/elements.mjs +1 -1
- package/es/varlet.esm.js +3692 -3689
- package/highlight/web-types.en-US.json +11 -2
- package/highlight/web-types.zh-CN.json +11 -2
- package/lib/varlet.cjs.js +72 -57
- package/package.json +6 -6
- package/types/fab.d.ts +1 -0
- package/umd/varlet.js +4 -4
package/es/drag/Drag.mjs
CHANGED
|
@@ -54,13 +54,16 @@ var __sfc__ = defineComponent({
|
|
|
54
54
|
});
|
|
55
55
|
var dragged = ref(false);
|
|
56
56
|
var enableTransition = ref(false);
|
|
57
|
+
var dragging = ref(false);
|
|
57
58
|
var touching = false;
|
|
58
59
|
var prevX = 0;
|
|
59
60
|
var prevY = 0;
|
|
61
|
+
var draggingRunner = null;
|
|
60
62
|
var handleTouchstart = event => {
|
|
61
63
|
if (props.disabled) {
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
66
|
+
draggingRunner && window.clearTimeout(draggingRunner);
|
|
64
67
|
var {
|
|
65
68
|
clientX,
|
|
66
69
|
clientY
|
|
@@ -69,6 +72,7 @@ var __sfc__ = defineComponent({
|
|
|
69
72
|
prevX = clientX;
|
|
70
73
|
prevY = clientY;
|
|
71
74
|
touching = true;
|
|
75
|
+
dragging.value = false;
|
|
72
76
|
};
|
|
73
77
|
var handleTouchmove = /*#__PURE__*/function () {
|
|
74
78
|
var _ref2 = _asyncToGenerator(function* (event) {
|
|
@@ -78,6 +82,7 @@ var __sfc__ = defineComponent({
|
|
|
78
82
|
event.preventDefault();
|
|
79
83
|
enableTransition.value = false;
|
|
80
84
|
dragged.value = true;
|
|
85
|
+
dragging.value = true;
|
|
81
86
|
var {
|
|
82
87
|
clientX,
|
|
83
88
|
clientY
|
|
@@ -105,6 +110,9 @@ var __sfc__ = defineComponent({
|
|
|
105
110
|
touching = false;
|
|
106
111
|
enableTransition.value = true;
|
|
107
112
|
attract();
|
|
113
|
+
draggingRunner = window.setTimeout(() => {
|
|
114
|
+
dragging.value = false;
|
|
115
|
+
});
|
|
108
116
|
};
|
|
109
117
|
var saveXY = () => {
|
|
110
118
|
var {
|
|
@@ -237,8 +245,12 @@ var __sfc__ = defineComponent({
|
|
|
237
245
|
var reset = () => {
|
|
238
246
|
enableTransition.value = false;
|
|
239
247
|
dragged.value = false;
|
|
248
|
+
dragging.value = false;
|
|
240
249
|
x.value = 0;
|
|
241
250
|
y.value = 0;
|
|
251
|
+
touching = false;
|
|
252
|
+
prevX = 0;
|
|
253
|
+
prevY = 0;
|
|
242
254
|
};
|
|
243
255
|
watch(() => props.boundary, toPxBoundary);
|
|
244
256
|
onWindowResize(resize);
|
|
@@ -251,6 +263,7 @@ var __sfc__ = defineComponent({
|
|
|
251
263
|
x,
|
|
252
264
|
y,
|
|
253
265
|
enableTransition,
|
|
266
|
+
dragging,
|
|
254
267
|
n,
|
|
255
268
|
classes,
|
|
256
269
|
getAttrs,
|
package/es/fab/Fab.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mergeProps as _mergeProps, isVNode as _isVNode, withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
|
|
2
2
|
import Button from '../button/index.mjs';
|
|
3
3
|
import Icon from '../icon/index.mjs';
|
|
4
|
-
import
|
|
4
|
+
import Drag from '../drag/index.mjs';
|
|
5
|
+
import { defineComponent, ref, Transition, watch } from 'vue';
|
|
5
6
|
import { useClickOutside } from '@varlet/use';
|
|
6
|
-
import { call, createNamespace, flatFragment,
|
|
7
|
+
import { call, createNamespace, flatFragment, useVModel } from '../utils/components.mjs';
|
|
7
8
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
8
|
-
import { toNumber } from '@varlet/shared';
|
|
9
9
|
import { props } from './props.mjs';
|
|
10
10
|
|
|
11
11
|
|
|
@@ -14,6 +14,7 @@ import { props } from './props.mjs';
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
function _isSlot(s) {
|
|
18
19
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
|
|
19
20
|
}
|
|
@@ -32,10 +33,9 @@ export default defineComponent({
|
|
|
32
33
|
} = _ref;
|
|
33
34
|
var isActive = useVModel(props, 'active');
|
|
34
35
|
var host = ref(null);
|
|
35
|
-
var
|
|
36
|
-
disabled
|
|
37
|
-
} = useTeleport();
|
|
36
|
+
var dragRef = ref(null);
|
|
38
37
|
var handleClick = (e, value, childrenLength) => {
|
|
38
|
+
var _dragRef$value;
|
|
39
39
|
e.stopPropagation();
|
|
40
40
|
if (props.trigger !== 'click' || props.disabled) {
|
|
41
41
|
return;
|
|
@@ -44,6 +44,11 @@ export default defineComponent({
|
|
|
44
44
|
call(props.onClick, isActive.value, e);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
// avoid trigger open function after dragging
|
|
49
|
+
if ((_dragRef$value = dragRef.value) != null && _dragRef$value.dragging) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
47
52
|
isActive.value = value;
|
|
48
53
|
call(props.onClick, isActive.value, e);
|
|
49
54
|
call(isActive.value ? props.onOpen : props.onClose);
|
|
@@ -76,8 +81,8 @@ export default defineComponent({
|
|
|
76
81
|
"type": props.type,
|
|
77
82
|
"color": props.color,
|
|
78
83
|
"disabled": props.disabled,
|
|
79
|
-
"
|
|
80
|
-
"
|
|
84
|
+
"elevation": props.elevation,
|
|
85
|
+
"round": true
|
|
81
86
|
}, {
|
|
82
87
|
default: () => [_createVNode(Icon, {
|
|
83
88
|
"var-fab-cover": true,
|
|
@@ -89,61 +94,57 @@ export default defineComponent({
|
|
|
89
94
|
}, null)]
|
|
90
95
|
}), [[_vShow, props.show]]);
|
|
91
96
|
};
|
|
92
|
-
|
|
97
|
+
watch(() => props.trigger, () => {
|
|
98
|
+
isActive.value = false;
|
|
99
|
+
});
|
|
100
|
+
watch(() => props.disabled, () => {
|
|
101
|
+
isActive.value = false;
|
|
102
|
+
});
|
|
103
|
+
watch(() => [props.position, props.fixed, props.top, props.bottom, props.left, props.right], () => {
|
|
104
|
+
var _dragRef$value2;
|
|
105
|
+
(_dragRef$value2 = dragRef.value) == null ? void 0 : _dragRef$value2.reset();
|
|
106
|
+
});
|
|
107
|
+
useClickOutside(host, 'click', handleClickOutside);
|
|
108
|
+
return () => {
|
|
93
109
|
var _slot;
|
|
94
110
|
var _call;
|
|
95
111
|
var children = flatFragment((_call = call(slots.default)) != null ? _call : []);
|
|
96
|
-
return _createVNode(
|
|
97
|
-
"
|
|
112
|
+
return _createVNode(Drag, _mergeProps({
|
|
113
|
+
"ref": dragRef,
|
|
114
|
+
"class": classes(n("--position-" + props.position), [!props.fixed, n('--absolute')]),
|
|
98
115
|
"style": {
|
|
99
|
-
zIndex: toNumber(props.zIndex),
|
|
100
116
|
top: toSizeUnit(props.top),
|
|
101
117
|
bottom: toSizeUnit(props.bottom),
|
|
102
118
|
left: toSizeUnit(props.left),
|
|
103
119
|
right: toSizeUnit(props.right)
|
|
104
120
|
},
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
"
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
useClickOutside(host, 'click', handleClickOutside);
|
|
133
|
-
return () => {
|
|
134
|
-
var {
|
|
135
|
-
teleport
|
|
136
|
-
} = props;
|
|
137
|
-
if (teleport) {
|
|
138
|
-
var _slot2;
|
|
139
|
-
return _createVNode(Teleport, {
|
|
140
|
-
"to": teleport,
|
|
141
|
-
"disabled": disabled.value
|
|
142
|
-
}, _isSlot(_slot2 = renderFab()) ? _slot2 : {
|
|
143
|
-
default: () => [_slot2]
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
return renderFab();
|
|
121
|
+
"zIndex": props.zIndex,
|
|
122
|
+
"teleport": props.teleport,
|
|
123
|
+
"disabled": props.disabled || !props.drag || !props.fixed
|
|
124
|
+
}, attrs), {
|
|
125
|
+
default: () => [_createVNode("div", {
|
|
126
|
+
"class": classes(n(), n("--direction-" + props.direction), [props.safeArea, n('--safe-area')]),
|
|
127
|
+
"ref": host,
|
|
128
|
+
"onClick": e => handleClick(e, !isActive.value, children.length),
|
|
129
|
+
"onMouseleave": () => handleMouse(false, children.length),
|
|
130
|
+
"onMouseenter": () => handleMouse(true, children.length)
|
|
131
|
+
}, [_createVNode(Transition, {
|
|
132
|
+
"name": n("--active-transition")
|
|
133
|
+
}, _isSlot(_slot = renderTrigger()) ? _slot : {
|
|
134
|
+
default: () => [_slot]
|
|
135
|
+
}), _createVNode(Transition, {
|
|
136
|
+
"name": n("--actions-transition-" + props.direction),
|
|
137
|
+
"onAfterEnter": props.onOpened,
|
|
138
|
+
"onAfterLeave": props.onClosed
|
|
139
|
+
}, {
|
|
140
|
+
default: () => [_withDirectives(_createVNode("div", {
|
|
141
|
+
"class": n('actions'),
|
|
142
|
+
"onClick": e => e.stopPropagation()
|
|
143
|
+
}, [children.map(child => _createVNode("div", {
|
|
144
|
+
"class": n('action')
|
|
145
|
+
}, [child]))]), [[_vShow, props.show && isActive.value && children.length]])]
|
|
146
|
+
})])]
|
|
147
|
+
});
|
|
147
148
|
};
|
|
148
149
|
}
|
|
149
150
|
});
|
package/es/fab/props.mjs
CHANGED
|
@@ -18,6 +18,10 @@ export var props = {
|
|
|
18
18
|
type: Boolean,
|
|
19
19
|
default: true
|
|
20
20
|
},
|
|
21
|
+
drag: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
21
25
|
type: {
|
|
22
26
|
type: String,
|
|
23
27
|
default: 'primary',
|
|
@@ -88,7 +92,7 @@ export var props = {
|
|
|
88
92
|
default: false
|
|
89
93
|
},
|
|
90
94
|
teleport: {
|
|
91
|
-
type: String
|
|
95
|
+
type: [String, Object]
|
|
92
96
|
},
|
|
93
97
|
onClick: defineListenerProp(),
|
|
94
98
|
onOpen: defineListenerProp(),
|
package/es/fab/style/index.mjs
CHANGED
package/es/index.bundle.mjs
CHANGED
|
@@ -244,7 +244,7 @@ import './time-picker/style/index.mjs'
|
|
|
244
244
|
import './tooltip/style/index.mjs'
|
|
245
245
|
import './uploader/style/index.mjs'
|
|
246
246
|
|
|
247
|
-
const version = '2.13.
|
|
247
|
+
const version = '2.13.4-alpha.1690279122540'
|
|
248
248
|
|
|
249
249
|
function install(app) {
|
|
250
250
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -162,7 +162,7 @@ export * from './time-picker/index.mjs'
|
|
|
162
162
|
export * from './tooltip/index.mjs'
|
|
163
163
|
export * from './uploader/index.mjs'
|
|
164
164
|
|
|
165
|
-
const version = '2.13.
|
|
165
|
+
const version = '2.13.4-alpha.1690279122540'
|
|
166
166
|
|
|
167
167
|
function install(app) {
|
|
168
168
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/switch/Switch.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import VarFormDetails from '../form-details/index.mjs';
|
|
2
|
+
import Ripple from '../ripple/index.mjs';
|
|
3
|
+
import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
|
|
4
|
+
import Hover from '../hover/index.mjs';
|
|
1
5
|
import { defineComponent, computed, nextTick } from 'vue';
|
|
2
6
|
import { useValidation, createNamespace, call } from '../utils/components.mjs';
|
|
3
7
|
import { multiplySizeUnit } from '../utils/elements.mjs';
|
|
4
8
|
import { useForm } from '../form/provide.mjs';
|
|
5
|
-
import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
|
|
6
|
-
import Hover from '../hover/index.mjs';
|
|
7
9
|
import { props } from './props.mjs';
|
|
8
|
-
import VarFormDetails from '../form-details/index.mjs';
|
|
9
|
-
import Ripple from '../ripple/index.mjs';
|
|
10
10
|
var {
|
|
11
11
|
n,
|
|
12
12
|
classes
|
|
@@ -48,8 +48,8 @@ function __render__(_ctx, _cache) {
|
|
|
48
48
|
key: 0,
|
|
49
49
|
class: _normalizeClass(_ctx.n('loading')),
|
|
50
50
|
style: _normalizeStyle({
|
|
51
|
-
width: _ctx.
|
|
52
|
-
height: _ctx.
|
|
51
|
+
width: _ctx.radius,
|
|
52
|
+
height: _ctx.radius
|
|
53
53
|
})
|
|
54
54
|
}, _hoisted_2, 6 /* CLASS, STYLE */)) : _createCommentVNode("v-if", true)], 6 /* CLASS, STYLE */), _createVNode(_component_var_hover_overlay, {
|
|
55
55
|
hovering: _ctx.hovering
|
|
@@ -122,7 +122,7 @@ var __sfc__ = defineComponent({
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
});
|
|
125
|
-
var radius = computed(() => multiplySizeUnit(props.size, 0.
|
|
125
|
+
var radius = computed(() => multiplySizeUnit(props.size, 0.8));
|
|
126
126
|
var switchActive = event => {
|
|
127
127
|
var {
|
|
128
128
|
onClick,
|
package/es/utils/elements.mjs
CHANGED
|
@@ -213,7 +213,7 @@ export var multiplySizeUnit = function (value, quantity) {
|
|
|
213
213
|
return undefined;
|
|
214
214
|
}
|
|
215
215
|
var legalSize = toSizeUnit(value);
|
|
216
|
-
var unit = legalSize.match(/(vh|%|
|
|
216
|
+
var unit = legalSize.match(/(vh|%|r?em|px|vw|vmin|vmax)$/)[0];
|
|
217
217
|
return "" + parseFloat(legalSize) * quantity + unit;
|
|
218
218
|
};
|
|
219
219
|
export function requestAnimationFrame(fn) {
|