@varlet/ui 2.14.2 → 2.14.3-alpha.1692871861882
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/checkbox/Checkbox.mjs +23 -19
- package/es/checkbox/props.mjs +6 -1
- package/es/drag/Drag.mjs +20 -27
- package/es/image-preview/ImagePreview.mjs +49 -66
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/option/Option.mjs +18 -4
- package/es/radio/Radio.mjs +5 -11
- package/es/swipe/Swipe.mjs +51 -65
- package/es/varlet.esm.js +6421 -6383
- package/highlight/web-types.en-US.json +17 -4
- package/highlight/web-types.zh-CN.json +15 -2
- package/lib/varlet.cjs.js +250 -184
- package/package.json +6 -6
- package/types/checkbox.d.ts +3 -0
- package/umd/varlet.js +4 -4
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
|
@@ -26,6 +26,10 @@ export var props = {
|
|
|
26
26
|
type: Boolean,
|
|
27
27
|
default: false
|
|
28
28
|
},
|
|
29
|
+
indeterminate: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
29
33
|
iconSize: {
|
|
30
34
|
type: [String, Number]
|
|
31
35
|
},
|
|
@@ -42,5 +46,6 @@ export var props = {
|
|
|
42
46
|
},
|
|
43
47
|
onClick: defineListenerProp(),
|
|
44
48
|
onChange: defineListenerProp(),
|
|
45
|
-
'onUpdate:modelValue': defineListenerProp()
|
|
49
|
+
'onUpdate:modelValue': defineListenerProp(),
|
|
50
|
+
'onUpdate:indeterminate': defineListenerProp()
|
|
46
51
|
};
|
package/es/drag/Drag.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { defineComponent, ref, reactive, watch } from 'vue';
|
|
|
5
5
|
import { props } from './props.mjs';
|
|
6
6
|
import { createNamespace, useTeleport, call } from '../utils/components.mjs';
|
|
7
7
|
import { getRect, toPxNum } from '../utils/elements.mjs';
|
|
8
|
-
import { onSmartMounted, onWindowResize } from '@varlet/use';
|
|
8
|
+
import { onSmartMounted, onWindowResize, useTouch } from '@varlet/use';
|
|
9
9
|
import { clamp } from '@varlet/shared';
|
|
10
10
|
var {
|
|
11
11
|
n,
|
|
@@ -59,50 +59,45 @@ var __sfc__ = defineComponent({
|
|
|
59
59
|
var dragged = ref(false);
|
|
60
60
|
var enableTransition = ref(false);
|
|
61
61
|
var dragging = ref(false);
|
|
62
|
+
var {
|
|
63
|
+
touching,
|
|
64
|
+
moveX,
|
|
65
|
+
moveY,
|
|
66
|
+
startTouch,
|
|
67
|
+
moveTouch,
|
|
68
|
+
endTouch,
|
|
69
|
+
resetTouch
|
|
70
|
+
} = useTouch();
|
|
62
71
|
var {
|
|
63
72
|
disabled: teleportDisabled
|
|
64
73
|
} = useTeleport();
|
|
65
|
-
var touching = false;
|
|
66
|
-
var prevX = 0;
|
|
67
|
-
var prevY = 0;
|
|
68
74
|
var draggingRunner = null;
|
|
69
75
|
var handleTouchstart = event => {
|
|
70
76
|
if (props.disabled) {
|
|
71
77
|
return;
|
|
72
78
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
clientY
|
|
77
|
-
} = event.touches[0];
|
|
79
|
+
if (draggingRunner) {
|
|
80
|
+
window.clearTimeout(draggingRunner);
|
|
81
|
+
}
|
|
78
82
|
saveXY();
|
|
79
|
-
|
|
80
|
-
prevY = clientY;
|
|
81
|
-
touching = true;
|
|
83
|
+
startTouch(event);
|
|
82
84
|
dragging.value = false;
|
|
83
85
|
};
|
|
84
86
|
var handleTouchmove = /*#__PURE__*/function () {
|
|
85
87
|
var _ref2 = _asyncToGenerator(function* (event) {
|
|
86
|
-
if (!touching || props.disabled) {
|
|
88
|
+
if (!touching.value || props.disabled) {
|
|
87
89
|
return;
|
|
88
90
|
}
|
|
89
91
|
event.preventDefault();
|
|
90
92
|
enableTransition.value = false;
|
|
91
93
|
dragged.value = true;
|
|
92
94
|
dragging.value = true;
|
|
93
|
-
|
|
94
|
-
clientX,
|
|
95
|
-
clientY
|
|
96
|
-
} = event.touches[0];
|
|
97
|
-
var deltaX = clientX - prevX;
|
|
98
|
-
var deltaY = clientY - prevY;
|
|
99
|
-
prevX = clientX;
|
|
100
|
-
prevY = clientY;
|
|
95
|
+
moveTouch(event);
|
|
101
96
|
if (props.direction.includes('x')) {
|
|
102
|
-
x.value +=
|
|
97
|
+
x.value += moveX.value;
|
|
103
98
|
}
|
|
104
99
|
if (props.direction.includes('y')) {
|
|
105
|
-
y.value +=
|
|
100
|
+
y.value += moveY.value;
|
|
106
101
|
}
|
|
107
102
|
clampToBoundary();
|
|
108
103
|
});
|
|
@@ -114,7 +109,7 @@ var __sfc__ = defineComponent({
|
|
|
114
109
|
if (props.disabled) {
|
|
115
110
|
return;
|
|
116
111
|
}
|
|
117
|
-
|
|
112
|
+
endTouch();
|
|
118
113
|
enableTransition.value = true;
|
|
119
114
|
attract();
|
|
120
115
|
draggingRunner = window.setTimeout(() => {
|
|
@@ -261,9 +256,7 @@ var __sfc__ = defineComponent({
|
|
|
261
256
|
dragging.value = false;
|
|
262
257
|
x.value = 0;
|
|
263
258
|
y.value = 0;
|
|
264
|
-
|
|
265
|
-
prevX = 0;
|
|
266
|
-
prevY = 0;
|
|
259
|
+
resetTouch();
|
|
267
260
|
};
|
|
268
261
|
watch(() => props.boundary, toPxBoundary);
|
|
269
262
|
onWindowResize(resize);
|
|
@@ -3,9 +3,9 @@ import VarSwipeItem from '../swipe-item/index.mjs';
|
|
|
3
3
|
import VarIcon from '../icon/index.mjs';
|
|
4
4
|
import VarPopup from '../popup/index.mjs';
|
|
5
5
|
import { defineComponent, ref, computed, watch } from 'vue';
|
|
6
|
+
import { toNumber, clamp } from '@varlet/shared';
|
|
7
|
+
import { useEventListener, useTouch } from '@varlet/use';
|
|
6
8
|
import { props } from './props.mjs';
|
|
7
|
-
import { toNumber } from '@varlet/shared';
|
|
8
|
-
import { useEventListener } from '@varlet/use';
|
|
9
9
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
10
10
|
var {
|
|
11
11
|
n,
|
|
@@ -121,6 +121,29 @@ var __sfc__ = defineComponent({
|
|
|
121
121
|
props,
|
|
122
122
|
setup(props) {
|
|
123
123
|
var popupShow = ref(false);
|
|
124
|
+
var scale = ref(1);
|
|
125
|
+
var translateX = ref(0);
|
|
126
|
+
var translateY = ref(0);
|
|
127
|
+
var transitionTimingFunction = ref(undefined);
|
|
128
|
+
var transitionDuration = ref(undefined);
|
|
129
|
+
var canSwipe = ref(true);
|
|
130
|
+
var swipeRef = ref(null);
|
|
131
|
+
var {
|
|
132
|
+
moveX,
|
|
133
|
+
moveY,
|
|
134
|
+
distance,
|
|
135
|
+
startTime,
|
|
136
|
+
startTouch,
|
|
137
|
+
moveTouch,
|
|
138
|
+
endTouch
|
|
139
|
+
} = useTouch();
|
|
140
|
+
var targets = {
|
|
141
|
+
start: null,
|
|
142
|
+
prev: null
|
|
143
|
+
};
|
|
144
|
+
var closeRunner = null;
|
|
145
|
+
var longPressRunner = null;
|
|
146
|
+
var isLongPress = false;
|
|
124
147
|
var initialIndex = computed(() => {
|
|
125
148
|
// For compatibility with current, temporarily keep this computed method
|
|
126
149
|
// Current will be replaced by initialIndex in the future
|
|
@@ -133,20 +156,8 @@ var __sfc__ = defineComponent({
|
|
|
133
156
|
return toNumber(initialIndex);
|
|
134
157
|
}
|
|
135
158
|
var index = images.findIndex(image => image === current);
|
|
136
|
-
return index
|
|
159
|
+
return Math.max(index, 0);
|
|
137
160
|
});
|
|
138
|
-
var scale = ref(1);
|
|
139
|
-
var translateX = ref(0);
|
|
140
|
-
var translateY = ref(0);
|
|
141
|
-
var transitionTimingFunction = ref(undefined);
|
|
142
|
-
var transitionDuration = ref(undefined);
|
|
143
|
-
var canSwipe = ref(true);
|
|
144
|
-
var swipeRef = ref(null);
|
|
145
|
-
var startTouch = null;
|
|
146
|
-
var prevTouch = null;
|
|
147
|
-
var closeRunner = null;
|
|
148
|
-
var longPressRunner = null;
|
|
149
|
-
var isLongPress = false;
|
|
150
161
|
var isPreventDefault = computed(() => {
|
|
151
162
|
var {
|
|
152
163
|
imagePreventDefault,
|
|
@@ -154,27 +165,10 @@ var __sfc__ = defineComponent({
|
|
|
154
165
|
} = props;
|
|
155
166
|
return show && imagePreventDefault;
|
|
156
167
|
});
|
|
157
|
-
var getDistance = (touch, target) => {
|
|
158
|
-
var {
|
|
159
|
-
clientX: touchX,
|
|
160
|
-
clientY: touchY
|
|
161
|
-
} = touch;
|
|
162
|
-
var {
|
|
163
|
-
clientX: targetX,
|
|
164
|
-
clientY: targetY
|
|
165
|
-
} = target;
|
|
166
|
-
return Math.abs(Math.sqrt(Math.pow(targetX - touchX, 2) + Math.pow(targetY - touchY, 2)));
|
|
167
|
-
};
|
|
168
|
-
var createVarTouch = (touch, target) => ({
|
|
169
|
-
clientX: touch.clientX,
|
|
170
|
-
clientY: touch.clientY,
|
|
171
|
-
timestamp: performance.now(),
|
|
172
|
-
target
|
|
173
|
-
});
|
|
174
168
|
var zoomIn = () => {
|
|
175
169
|
scale.value = toNumber(props.zoom);
|
|
176
170
|
canSwipe.value = false;
|
|
177
|
-
|
|
171
|
+
targets.prev = null;
|
|
178
172
|
window.setTimeout(() => {
|
|
179
173
|
transitionTimingFunction.value = 'linear';
|
|
180
174
|
transitionDuration.value = '0s';
|
|
@@ -185,28 +179,30 @@ var __sfc__ = defineComponent({
|
|
|
185
179
|
translateX.value = 0;
|
|
186
180
|
translateY.value = 0;
|
|
187
181
|
canSwipe.value = true;
|
|
188
|
-
|
|
182
|
+
targets.prev = null;
|
|
189
183
|
transitionTimingFunction.value = undefined;
|
|
190
184
|
transitionDuration.value = undefined;
|
|
191
185
|
};
|
|
192
|
-
var isDoubleTouch =
|
|
193
|
-
if (!
|
|
186
|
+
var isDoubleTouch = target => {
|
|
187
|
+
if (!targets.prev) {
|
|
194
188
|
return false;
|
|
195
189
|
}
|
|
196
|
-
return
|
|
190
|
+
return distance.value <= DISTANCE_OFFSET && performance.now() - startTime.value <= EVENT_DELAY && targets.prev === target;
|
|
197
191
|
};
|
|
198
192
|
var isTapTouch = target => {
|
|
199
|
-
if (!target || !
|
|
193
|
+
if (!target || !targets.start || !targets.prev) {
|
|
200
194
|
return false;
|
|
201
195
|
}
|
|
202
|
-
return
|
|
196
|
+
return distance.value <= DISTANCE_OFFSET && performance.now() - startTime.value < TAP_DELAY && (target === targets.start || target.parentNode === targets.start);
|
|
203
197
|
};
|
|
204
198
|
var handleTouchcancel = () => {
|
|
199
|
+
endTouch();
|
|
205
200
|
window.clearTimeout(longPressRunner);
|
|
206
201
|
isLongPress = false;
|
|
207
|
-
|
|
202
|
+
targets.start = null;
|
|
208
203
|
};
|
|
209
204
|
var handleTouchend = event => {
|
|
205
|
+
endTouch();
|
|
210
206
|
window.clearTimeout(longPressRunner);
|
|
211
207
|
|
|
212
208
|
// avoid triggering tap event sometimes
|
|
@@ -217,26 +213,24 @@ var __sfc__ = defineComponent({
|
|
|
217
213
|
var isTap = isTapTouch(event.target);
|
|
218
214
|
closeRunner = window.setTimeout(() => {
|
|
219
215
|
isTap && close();
|
|
220
|
-
|
|
216
|
+
targets.start = null;
|
|
221
217
|
}, EVENT_DELAY);
|
|
222
218
|
};
|
|
223
219
|
var handleTouchstart = (event, idx) => {
|
|
224
220
|
window.clearTimeout(closeRunner);
|
|
225
221
|
window.clearTimeout(longPressRunner);
|
|
226
|
-
var
|
|
227
|
-
|
|
222
|
+
var target = event.currentTarget;
|
|
223
|
+
targets.start = target;
|
|
228
224
|
longPressRunner = window.setTimeout(() => {
|
|
229
|
-
var {
|
|
230
|
-
onLongPress
|
|
231
|
-
} = props;
|
|
232
225
|
isLongPress = true;
|
|
233
|
-
call(onLongPress, idx);
|
|
226
|
+
call(props.onLongPress, idx);
|
|
234
227
|
}, LONG_PRESS_DELAY);
|
|
235
|
-
if (isDoubleTouch(
|
|
228
|
+
if (isDoubleTouch(target)) {
|
|
236
229
|
scale.value > 1 ? zoomOut() : zoomIn();
|
|
237
230
|
return;
|
|
238
231
|
}
|
|
239
|
-
|
|
232
|
+
startTouch(event);
|
|
233
|
+
targets.prev = target;
|
|
240
234
|
};
|
|
241
235
|
var getZoom = target => {
|
|
242
236
|
var {
|
|
@@ -283,33 +277,22 @@ var __sfc__ = defineComponent({
|
|
|
283
277
|
var displayHeight = imageRadio > rootRadio ? height : width * imageRadio;
|
|
284
278
|
return Math.max(0, (zoom * displayHeight - height) / 2) / zoom;
|
|
285
279
|
};
|
|
286
|
-
var getMoveTranslate = (current, move, limit) => {
|
|
287
|
-
if (current + move >= limit) {
|
|
288
|
-
return limit;
|
|
289
|
-
}
|
|
290
|
-
if (current + move <= -limit) {
|
|
291
|
-
return -limit;
|
|
292
|
-
}
|
|
293
|
-
return current + move;
|
|
294
|
-
};
|
|
295
280
|
var handleTouchmove = event => {
|
|
296
|
-
if (!
|
|
281
|
+
if (!targets.prev) {
|
|
297
282
|
return;
|
|
298
283
|
}
|
|
284
|
+
moveTouch(event);
|
|
299
285
|
var target = event.currentTarget;
|
|
300
|
-
|
|
301
|
-
if (getDistance(currentTouch, prevTouch) > DISTANCE_OFFSET) {
|
|
286
|
+
if (distance.value > DISTANCE_OFFSET) {
|
|
302
287
|
window.clearTimeout(longPressRunner);
|
|
303
288
|
}
|
|
304
289
|
if (scale.value > 1) {
|
|
305
|
-
var moveX = currentTouch.clientX - prevTouch.clientX;
|
|
306
|
-
var moveY = currentTouch.clientY - prevTouch.clientY;
|
|
307
290
|
var limitX = getLimitX(target);
|
|
308
291
|
var limitY = getLimitY(target);
|
|
309
|
-
translateX.value =
|
|
310
|
-
translateY.value =
|
|
292
|
+
translateX.value = clamp(translateX.value + moveX.value, -limitX, limitX);
|
|
293
|
+
translateY.value = clamp(translateY.value + moveY.value, -limitY, limitY);
|
|
311
294
|
}
|
|
312
|
-
|
|
295
|
+
targets.prev = target;
|
|
313
296
|
};
|
|
314
297
|
var close = () => {
|
|
315
298
|
if (scale.value > 1) {
|
package/es/index.bundle.mjs
CHANGED
|
@@ -247,7 +247,7 @@ import './tooltip/style/index.mjs'
|
|
|
247
247
|
import './uploader/style/index.mjs'
|
|
248
248
|
import './watermark/style/index.mjs'
|
|
249
249
|
|
|
250
|
-
const version = '2.14.
|
|
250
|
+
const version = '2.14.3-alpha.1692871861882'
|
|
251
251
|
|
|
252
252
|
function install(app) {
|
|
253
253
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -164,7 +164,7 @@ export * from './tooltip/index.mjs'
|
|
|
164
164
|
export * from './uploader/index.mjs'
|
|
165
165
|
export * from './watermark/index.mjs'
|
|
166
166
|
|
|
167
|
-
const version = '2.14.
|
|
167
|
+
const version = '2.14.3-alpha.1692871861882'
|
|
168
168
|
|
|
169
169
|
function install(app) {
|
|
170
170
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/option/Option.mjs
CHANGED
|
@@ -4,14 +4,18 @@ import { defineComponent, computed, ref, watch } from 'vue';
|
|
|
4
4
|
import { useSelect } from './provide.mjs';
|
|
5
5
|
import { createNamespace } from '../utils/components.mjs';
|
|
6
6
|
import { props } from './props.mjs';
|
|
7
|
+
import Hover from '../hover/index.mjs';
|
|
8
|
+
import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
|
|
7
9
|
var {
|
|
8
10
|
n,
|
|
9
11
|
classes
|
|
10
12
|
} = createNamespace('option');
|
|
11
|
-
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
|
|
13
|
+
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createVNode as _createVNode, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
|
|
12
14
|
function __render__(_ctx, _cache) {
|
|
13
15
|
var _component_var_checkbox = _resolveComponent("var-checkbox");
|
|
16
|
+
var _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
|
|
14
17
|
var _directive_ripple = _resolveDirective("ripple");
|
|
18
|
+
var _directive_hover = _resolveDirective("hover");
|
|
15
19
|
return _withDirectives((_openBlock(), _createElementBlock("div", {
|
|
16
20
|
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.optionSelected, _ctx.n('--selected-color')])),
|
|
17
21
|
style: _normalizeStyle({
|
|
@@ -35,15 +39,19 @@ function __render__(_ctx, _cache) {
|
|
|
35
39
|
onChange: _ctx.handleSelect
|
|
36
40
|
}, null, 8 /* PROPS */, ["checked-color", "modelValue", "onChange"])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
|
|
37
41
|
class: _normalizeClass(_ctx.classes(_ctx.n('text'), _ctx.n('$--ellipsis')))
|
|
38
|
-
}, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.label), 1 /* TEXT */)])], 2 /* CLASS */)
|
|
42
|
+
}, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.label), 1 /* TEXT */)])], 2 /* CLASS */), _createVNode(_component_var_hover_overlay, {
|
|
43
|
+
hovering: _ctx.hovering
|
|
44
|
+
}, null, 8 /* PROPS */, ["hovering"])], 6 /* CLASS, STYLE */)), [[_directive_ripple], [_directive_hover, _ctx.handleHovering, "desktop"]]);
|
|
39
45
|
}
|
|
40
46
|
var __sfc__ = defineComponent({
|
|
41
47
|
name: 'VarOption',
|
|
42
48
|
directives: {
|
|
43
|
-
Ripple
|
|
49
|
+
Ripple,
|
|
50
|
+
Hover
|
|
44
51
|
},
|
|
45
52
|
components: {
|
|
46
|
-
VarCheckbox
|
|
53
|
+
VarCheckbox,
|
|
54
|
+
VarHoverOverlay
|
|
47
55
|
},
|
|
48
56
|
props,
|
|
49
57
|
setup(props) {
|
|
@@ -61,6 +69,10 @@ var __sfc__ = defineComponent({
|
|
|
61
69
|
onSelect,
|
|
62
70
|
computeLabel
|
|
63
71
|
} = select;
|
|
72
|
+
var {
|
|
73
|
+
hovering,
|
|
74
|
+
handleHovering
|
|
75
|
+
} = useHoverOverlay();
|
|
64
76
|
var handleClick = () => {
|
|
65
77
|
if (multiple.value) {
|
|
66
78
|
optionSelected.value = !optionSelected.value;
|
|
@@ -85,6 +97,8 @@ var __sfc__ = defineComponent({
|
|
|
85
97
|
optionSelected,
|
|
86
98
|
multiple,
|
|
87
99
|
focusColor,
|
|
100
|
+
hovering,
|
|
101
|
+
handleHovering,
|
|
88
102
|
handleClick,
|
|
89
103
|
handleSelect
|
|
90
104
|
};
|
package/es/radio/Radio.mjs
CHANGED
|
@@ -2,12 +2,12 @@ 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 { computed, defineComponent, nextTick, ref } 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 { useRadioGroup } 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
|
|
@@ -70,7 +70,7 @@ var __sfc__ = defineComponent({
|
|
|
70
70
|
inheritAttrs: false,
|
|
71
71
|
props,
|
|
72
72
|
setup(props) {
|
|
73
|
-
var value =
|
|
73
|
+
var value = useVModel(props, 'modelValue');
|
|
74
74
|
var checked = computed(() => value.value === props.checkedValue);
|
|
75
75
|
var withAnimation = ref(false);
|
|
76
76
|
var {
|
|
@@ -111,7 +111,6 @@ var __sfc__ = defineComponent({
|
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
value.value = changedValue;
|
|
114
|
-
call(props['onUpdate:modelValue'], value.value);
|
|
115
114
|
call(onChange, value.value);
|
|
116
115
|
radioGroup == null ? void 0 : radioGroup.onToggle(checkedValue);
|
|
117
116
|
validateWithTrigger('onChange');
|
|
@@ -144,7 +143,7 @@ var __sfc__ = defineComponent({
|
|
|
144
143
|
|
|
145
144
|
// expose
|
|
146
145
|
var reset = () => {
|
|
147
|
-
|
|
146
|
+
value.value = props.uncheckedValue;
|
|
148
147
|
resetValidation();
|
|
149
148
|
};
|
|
150
149
|
|
|
@@ -163,11 +162,6 @@ var __sfc__ = defineComponent({
|
|
|
163
162
|
}
|
|
164
163
|
change(changedValue);
|
|
165
164
|
};
|
|
166
|
-
watch(() => props.modelValue, newValue => {
|
|
167
|
-
value.value = newValue;
|
|
168
|
-
}, {
|
|
169
|
-
immediate: true
|
|
170
|
-
});
|
|
171
165
|
var radioProvider = {
|
|
172
166
|
sync,
|
|
173
167
|
validate,
|