vant 4.3.1 → 4.3.2
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/Checker.d.ts +2 -0
- package/es/checkbox/Checker.mjs +13 -1
- package/es/date-picker/utils.d.ts +1 -1
- package/es/field/Field.mjs +4 -0
- package/es/image-preview/ImagePreviewItem.mjs +34 -13
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/picker-group/PickerGroup.d.ts +15 -1
- package/es/picker-group/PickerGroup.mjs +8 -6
- package/es/picker-group/index.d.ts +11 -1
- package/es/step/index.css +1 -1
- package/es/submit-bar/index.css +1 -1
- package/es/tabs/Tabs.mjs +8 -2
- package/es/tabs/utils.d.ts +2 -2
- package/es/tabs/utils.mjs +14 -4
- package/lib/checkbox/Checker.d.ts +2 -0
- package/lib/checkbox/Checker.js +13 -1
- package/lib/date-picker/utils.d.ts +1 -1
- package/lib/field/Field.js +4 -0
- package/lib/image-preview/ImagePreviewItem.js +33 -12
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/picker-group/PickerGroup.d.ts +15 -1
- package/lib/picker-group/PickerGroup.js +6 -4
- package/lib/picker-group/index.d.ts +11 -1
- package/lib/step/index.css +1 -1
- package/lib/submit-bar/index.css +1 -1
- package/lib/tabs/Tabs.js +8 -2
- package/lib/tabs/utils.d.ts +2 -2
- package/lib/tabs/utils.js +13 -3
- package/lib/vant.cjs.js +91 -37
- package/lib/vant.es.js +92 -38
- package/lib/vant.js +91 -37
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/es/checkbox/Checker.d.ts
CHANGED
package/es/checkbox/Checker.mjs
CHANGED
@@ -31,7 +31,19 @@ var stdin_default = defineComponent({
|
|
31
31
|
return props.parent.props[name];
|
32
32
|
}
|
33
33
|
};
|
34
|
-
const disabled = computed(() =>
|
34
|
+
const disabled = computed(() => {
|
35
|
+
if (props.parent && props.bindGroup) {
|
36
|
+
const disabled2 = getParentProp("disabled") || props.disabled;
|
37
|
+
if (props.role === "checkbox") {
|
38
|
+
const checkedCount = getParentProp("modelValue").length;
|
39
|
+
const max = getParentProp("max");
|
40
|
+
const overlimit = max && checkedCount >= +max;
|
41
|
+
return disabled2 || overlimit && !props.checked;
|
42
|
+
}
|
43
|
+
return disabled2;
|
44
|
+
}
|
45
|
+
return props.disabled;
|
46
|
+
});
|
35
47
|
const direction = computed(() => getParentProp("direction"));
|
36
48
|
const iconStyle = computed(() => {
|
37
49
|
const checkedColor = props.checkedColor || getParentProp("checkedColor");
|
@@ -41,5 +41,5 @@ export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "all
|
|
41
41
|
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
42
42
|
export declare const getMonthEndDay: (year: number, month: number) => number;
|
43
43
|
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter) => PickerOption[];
|
44
|
-
export declare const formatValueRange: (values: string[], columns: PickerOption[]) => string[];
|
44
|
+
export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
|
45
45
|
export {};
|
package/es/field/Field.mjs
CHANGED
@@ -428,6 +428,10 @@ var stdin_default = defineComponent({
|
|
428
428
|
return _createVNode("label", {
|
429
429
|
"id": `${id}-label`,
|
430
430
|
"for": getInputId(),
|
431
|
+
"onClick": (event) => {
|
432
|
+
preventDefault(event);
|
433
|
+
focus();
|
434
|
+
},
|
431
435
|
"style": labelAlign === "top" && labelWidth ? {
|
432
436
|
width: addUnit(labelWidth)
|
433
437
|
} : void 0
|
@@ -2,11 +2,15 @@ import { createVNode as _createVNode } from "vue";
|
|
2
2
|
import { ref, watch, computed, reactive, defineComponent } from "vue";
|
3
3
|
import { clamp, numericProp, preventDefault, createNamespace, makeRequiredProp, LONG_PRESS_START_TIME } from "../utils/index.mjs";
|
4
4
|
import { useTouch } from "../composables/use-touch.mjs";
|
5
|
-
import { useEventListener } from "@vant/use";
|
5
|
+
import { useEventListener, useRect } from "@vant/use";
|
6
6
|
import { Image } from "../image/index.mjs";
|
7
7
|
import { Loading } from "../loading/index.mjs";
|
8
8
|
import { SwipeItem } from "../swipe-item/index.mjs";
|
9
9
|
const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
|
10
|
+
const getCenter = (touches) => ({
|
11
|
+
x: (touches[0].clientX + touches[1].clientX) / 2,
|
12
|
+
y: (touches[0].clientY + touches[1].clientY) / 2
|
13
|
+
});
|
10
14
|
const bem = createNamespace("image-preview")[1];
|
11
15
|
var stdin_default = defineComponent({
|
12
16
|
props: {
|
@@ -35,6 +39,7 @@ var stdin_default = defineComponent({
|
|
35
39
|
displayHeight: 0
|
36
40
|
});
|
37
41
|
const touch = useTouch();
|
42
|
+
const imageRef = ref();
|
38
43
|
const swipeItem = ref();
|
39
44
|
const vertical = computed(() => {
|
40
45
|
const {
|
@@ -56,9 +61,7 @@ var stdin_default = defineComponent({
|
|
56
61
|
transitionDuration: zooming || moving ? "0s" : ".3s"
|
57
62
|
};
|
58
63
|
if (scale !== 1) {
|
59
|
-
|
60
|
-
const offsetY = moveY / scale;
|
61
|
-
style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
|
64
|
+
style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
|
62
65
|
}
|
63
66
|
return style;
|
64
67
|
});
|
@@ -84,10 +87,26 @@ var stdin_default = defineComponent({
|
|
84
87
|
}
|
85
88
|
return 0;
|
86
89
|
});
|
87
|
-
const setScale = (scale) => {
|
90
|
+
const setScale = (scale, center) => {
|
91
|
+
var _a;
|
88
92
|
scale = clamp(scale, +props.minZoom, +props.maxZoom + 1);
|
89
93
|
if (scale !== state.scale) {
|
94
|
+
const ratio = scale / state.scale;
|
90
95
|
state.scale = scale;
|
96
|
+
if (center) {
|
97
|
+
const imageRect = useRect((_a = imageRef.value) == null ? void 0 : _a.$el);
|
98
|
+
const origin = {
|
99
|
+
x: imageRect.width * 0.5,
|
100
|
+
y: imageRect.height * 0.5
|
101
|
+
};
|
102
|
+
const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
|
103
|
+
const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
|
104
|
+
state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
|
105
|
+
state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
|
106
|
+
} else {
|
107
|
+
state.moveX = 0;
|
108
|
+
state.moveY = 0;
|
109
|
+
}
|
91
110
|
emit("scale", {
|
92
111
|
scale,
|
93
112
|
index: props.active
|
@@ -96,20 +115,20 @@ var stdin_default = defineComponent({
|
|
96
115
|
};
|
97
116
|
const resetScale = () => {
|
98
117
|
setScale(1);
|
99
|
-
state.moveX = 0;
|
100
|
-
state.moveY = 0;
|
101
118
|
};
|
102
119
|
const toggleScale = () => {
|
103
120
|
const scale = state.scale > 1 ? 1 : 2;
|
104
|
-
setScale(scale
|
105
|
-
|
106
|
-
|
121
|
+
setScale(scale, scale === 2 ? {
|
122
|
+
x: touch.startX.value,
|
123
|
+
y: touch.startY.value
|
124
|
+
} : void 0);
|
107
125
|
};
|
108
126
|
let fingerNum;
|
109
127
|
let startMoveX;
|
110
128
|
let startMoveY;
|
111
129
|
let startScale;
|
112
130
|
let startDistance;
|
131
|
+
let lastCenter;
|
113
132
|
let doubleTapTimer;
|
114
133
|
let touchStartTime;
|
115
134
|
let isImageMoved = false;
|
@@ -133,7 +152,7 @@ var stdin_default = defineComponent({
|
|
133
152
|
state.zooming = fingerNum === 2 && !offsetX.value;
|
134
153
|
if (state.zooming) {
|
135
154
|
startScale = state.scale;
|
136
|
-
startDistance = getDistance(
|
155
|
+
startDistance = getDistance(touches);
|
137
156
|
}
|
138
157
|
};
|
139
158
|
const onTouchMove = (event) => {
|
@@ -162,7 +181,8 @@ var stdin_default = defineComponent({
|
|
162
181
|
if (touches.length === 2) {
|
163
182
|
const distance = getDistance(touches);
|
164
183
|
const scale = startScale * distance / startDistance;
|
165
|
-
|
184
|
+
lastCenter = getCenter(touches);
|
185
|
+
setScale(scale, lastCenter);
|
166
186
|
}
|
167
187
|
}
|
168
188
|
};
|
@@ -216,7 +236,7 @@ var stdin_default = defineComponent({
|
|
216
236
|
}
|
217
237
|
const maxZoom = +props.maxZoom;
|
218
238
|
if (state.scale > maxZoom) {
|
219
|
-
|
239
|
+
setScale(maxZoom, lastCenter);
|
220
240
|
}
|
221
241
|
}
|
222
242
|
}
|
@@ -261,6 +281,7 @@ var stdin_default = defineComponent({
|
|
261
281
|
}, [slots.image({
|
262
282
|
src: props.src
|
263
283
|
})]) : _createVNode(Image, {
|
284
|
+
"ref": imageRef,
|
264
285
|
"src": props.src,
|
265
286
|
"fit": "contain",
|
266
287
|
"class": bem("image", {
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -94,7 +94,7 @@ import { Toast } from "./toast/index.mjs";
|
|
94
94
|
import { TreeSelect } from "./tree-select/index.mjs";
|
95
95
|
import { Uploader } from "./uploader/index.mjs";
|
96
96
|
import { Watermark } from "./watermark/index.mjs";
|
97
|
-
const version = "4.3.
|
97
|
+
const version = "4.3.2";
|
98
98
|
function install(app) {
|
99
99
|
const components = [
|
100
100
|
ActionBar,
|
@@ -6,6 +6,10 @@ export declare const pickerGroupProps: {
|
|
6
6
|
type: import("vue").PropType<string[]>;
|
7
7
|
default: () => never[];
|
8
8
|
};
|
9
|
+
activeTab: {
|
10
|
+
type: (NumberConstructor | StringConstructor)[];
|
11
|
+
default: number;
|
12
|
+
};
|
9
13
|
nextStepText: StringConstructor;
|
10
14
|
} & {
|
11
15
|
title: StringConstructor;
|
@@ -18,16 +22,24 @@ declare const _default: import("vue").DefineComponent<{
|
|
18
22
|
type: import("vue").PropType<string[]>;
|
19
23
|
default: () => never[];
|
20
24
|
};
|
25
|
+
activeTab: {
|
26
|
+
type: (NumberConstructor | StringConstructor)[];
|
27
|
+
default: number;
|
28
|
+
};
|
21
29
|
nextStepText: StringConstructor;
|
22
30
|
} & {
|
23
31
|
title: StringConstructor;
|
24
32
|
cancelButtonText: StringConstructor;
|
25
33
|
confirmButtonText: StringConstructor;
|
26
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm")[], "cancel" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
34
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm" | "update:activeTab")[], "cancel" | "confirm" | "update:activeTab", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
27
35
|
tabs: {
|
28
36
|
type: import("vue").PropType<string[]>;
|
29
37
|
default: () => never[];
|
30
38
|
};
|
39
|
+
activeTab: {
|
40
|
+
type: (NumberConstructor | StringConstructor)[];
|
41
|
+
default: number;
|
42
|
+
};
|
31
43
|
nextStepText: StringConstructor;
|
32
44
|
} & {
|
33
45
|
title: StringConstructor;
|
@@ -36,7 +48,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
36
48
|
}>> & {
|
37
49
|
onCancel?: ((...args: any[]) => any) | undefined;
|
38
50
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
51
|
+
"onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
|
39
52
|
}, {
|
40
53
|
tabs: string[];
|
54
|
+
activeTab: string | number;
|
41
55
|
}>;
|
42
56
|
export default _default;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { defineComponent } from "vue";
|
3
|
+
import { pick, extend, makeArrayProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { useChildren } from "@vant/use";
|
5
|
+
import { useSyncPropRef } from "../composables/use-sync-prop-ref.mjs";
|
5
6
|
import { Tab } from "../tab/index.mjs";
|
6
7
|
import { Tabs } from "../tabs/index.mjs";
|
7
8
|
import Toolbar, { pickerToolbarProps, pickerToolbarSlots } from "../picker/PickerToolbar.mjs";
|
@@ -9,26 +10,27 @@ const [name, bem] = createNamespace("picker-group");
|
|
9
10
|
const PICKER_GROUP_KEY = Symbol(name);
|
10
11
|
const pickerGroupProps = extend({
|
11
12
|
tabs: makeArrayProp(),
|
13
|
+
activeTab: makeNumericProp(0),
|
12
14
|
nextStepText: String
|
13
15
|
}, pickerToolbarProps);
|
14
16
|
var stdin_default = defineComponent({
|
15
17
|
name,
|
16
18
|
props: pickerGroupProps,
|
17
|
-
emits: ["confirm", "cancel"],
|
19
|
+
emits: ["confirm", "cancel", "update:activeTab"],
|
18
20
|
setup(props, {
|
19
21
|
emit,
|
20
22
|
slots
|
21
23
|
}) {
|
22
|
-
const activeTab =
|
24
|
+
const activeTab = useSyncPropRef(() => props.activeTab, (value) => emit("update:activeTab", value));
|
23
25
|
const {
|
24
26
|
children,
|
25
27
|
linkChildren
|
26
28
|
} = useChildren(PICKER_GROUP_KEY);
|
27
29
|
linkChildren();
|
28
|
-
const showNextButton = () => activeTab.value < props.tabs.length - 1 && props.nextStepText;
|
30
|
+
const showNextButton = () => +activeTab.value < props.tabs.length - 1 && props.nextStepText;
|
29
31
|
const onConfirm = () => {
|
30
32
|
if (showNextButton()) {
|
31
|
-
activeTab.value
|
33
|
+
activeTab.value = +activeTab.value + 1;
|
32
34
|
} else {
|
33
35
|
emit("confirm", children.map((item) => item.confirm()));
|
34
36
|
}
|
@@ -4,16 +4,24 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
|
|
4
4
|
type: import("vue").PropType<string[]>;
|
5
5
|
default: () => never[];
|
6
6
|
};
|
7
|
+
activeTab: {
|
8
|
+
type: (NumberConstructor | StringConstructor)[];
|
9
|
+
default: number;
|
10
|
+
};
|
7
11
|
nextStepText: StringConstructor;
|
8
12
|
} & {
|
9
13
|
title: StringConstructor;
|
10
14
|
cancelButtonText: StringConstructor;
|
11
15
|
confirmButtonText: StringConstructor;
|
12
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm")[], "cancel" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
16
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm" | "update:activeTab")[], "cancel" | "confirm" | "update:activeTab", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
13
17
|
tabs: {
|
14
18
|
type: import("vue").PropType<string[]>;
|
15
19
|
default: () => never[];
|
16
20
|
};
|
21
|
+
activeTab: {
|
22
|
+
type: (NumberConstructor | StringConstructor)[];
|
23
|
+
default: number;
|
24
|
+
};
|
17
25
|
nextStepText: StringConstructor;
|
18
26
|
} & {
|
19
27
|
title: StringConstructor;
|
@@ -22,8 +30,10 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
|
|
22
30
|
}>> & {
|
23
31
|
onCancel?: ((...args: any[]) => any) | undefined;
|
24
32
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
33
|
+
"onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
|
25
34
|
}, {
|
26
35
|
tabs: string[];
|
36
|
+
activeTab: string | number;
|
27
37
|
}>>;
|
28
38
|
export default PickerGroup;
|
29
39
|
export { pickerGroupProps } from './PickerGroup';
|
package/es/step/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-step-text-color: var(--van-text-color-2);--van-step-active-color: var(--van-primary-color);--van-step-process-text-color: var(--van-text-color);--van-step-font-size: var(--van-font-size-md);--van-step-line-color: var(--van-border-color);--van-step-finish-line-color: var(--van-primary-color);--van-step-finish-text-color: var(--van-text-color);--van-step-icon-size: 12px;--van-step-circle-size: 5px;--van-step-circle-color: var(--van-gray-6);--van-step-horizontal-title-font-size: var(--van-font-size-sm)}.van-step{position:relative;flex:1;color:var(--van-step-text-color);font-size:var(--van-step-font-size)}.van-step__circle{display:block;width:var(--van-step-circle-size);height:var(--van-step-circle-size);background-color:var(--van-step-circle-color);border-radius:50%}.van-step__line{position:absolute;background-color:var(--van-step-line-color);transition:background-color var(--van-duration-base)}.van-step--horizontal{float:left}.van-step--horizontal:first-child .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child{position:absolute;right:1px;width:auto}.van-step--horizontal:last-child .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child .van-step__circle-container{right:-9px;left:auto}.van-step--horizontal .van-step__circle-container{position:absolute;top:30px;left:calc(var(--van-padding-xs) * -1);z-index:1;padding:0 var(--van-padding-xs);background-color:var(--van-background-2);transform:translateY(-50%)}.van-step--horizontal .van-step__title{display:inline-block;margin-left:3px;font-size:var(--van-step-horizontal-title-font-size);transform:translate(-50%)}.van-step--horizontal .van-step__line{top:30px;left:0;width:100%;height:1px}.van-step--horizontal .van-step__icon{display:block;font-size:var(--van-step-icon-size)}.van-step--horizontal .van-step--process{color:var(--van-step-process-text-color)}.van-step--vertical{display:block;float:none;padding:10px 10px 10px 0;line-height:var(--van-line-height-sm)}.van-step--vertical:not(:last-child):after{border-bottom-width:1px}.van-step--vertical .van-step__circle-container{position:absolute;top:19px;left:-15px;z-index:1;font-size:var(--van-step-icon-size);line-height:1;transform:translate(-50%,-50%)}.van-step--vertical .van-step__line{top:16px;left:-15px;width:1px;height:100%}.van-step:last-child .van-step__line{width:0}.van-step--finish{color:var(--van-step-finish-text-color)}.van-step--finish .van-step__circle,.van-step--finish .van-step__line{background-color:var(--van-step-finish-line-color)}.van-step__icon,.van-step__title{transition:color var(--van-duration-base)}.van-step__icon--active,.van-step__title--active,.van-step__icon--finish,.van-step__title--finish{color:var(--van-step-active-color)}
|
1
|
+
:root{--van-step-text-color: var(--van-text-color-2);--van-step-active-color: var(--van-primary-color);--van-step-process-text-color: var(--van-text-color);--van-step-font-size: var(--van-font-size-md);--van-step-line-color: var(--van-border-color);--van-step-finish-line-color: var(--van-primary-color);--van-step-finish-text-color: var(--van-text-color);--van-step-icon-size: 12px;--van-step-circle-size: 5px;--van-step-circle-color: var(--van-gray-6);--van-step-horizontal-title-font-size: var(--van-font-size-sm)}.van-step{position:relative;flex:1;color:var(--van-step-text-color);font-size:var(--van-step-font-size)}.van-step__circle{display:block;width:var(--van-step-circle-size);height:var(--van-step-circle-size);background-color:var(--van-step-circle-color);border-radius:50%}.van-step__line{position:absolute;background-color:var(--van-step-line-color);transition:background-color var(--van-duration-base)}.van-step--horizontal{float:left}.van-step--horizontal:first-child .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child:not(:first-child){position:absolute;right:1px;width:auto}.van-step--horizontal:last-child:not(:first-child) .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child:not(:first-child) .van-step__circle-container{right:-9px;left:auto}.van-step--horizontal .van-step__circle-container{position:absolute;top:30px;left:calc(var(--van-padding-xs) * -1);z-index:1;padding:0 var(--van-padding-xs);background-color:var(--van-background-2);transform:translateY(-50%)}.van-step--horizontal .van-step__title{display:inline-block;margin-left:3px;font-size:var(--van-step-horizontal-title-font-size);transform:translate(-50%)}.van-step--horizontal .van-step__line{top:30px;left:0;width:100%;height:1px}.van-step--horizontal .van-step__icon{display:block;font-size:var(--van-step-icon-size)}.van-step--horizontal .van-step--process{color:var(--van-step-process-text-color)}.van-step--vertical{display:block;float:none;padding:10px 10px 10px 0;line-height:var(--van-line-height-sm)}.van-step--vertical:not(:last-child):after{border-bottom-width:1px}.van-step--vertical .van-step__circle-container{position:absolute;top:19px;left:-15px;z-index:1;font-size:var(--van-step-icon-size);line-height:1;transform:translate(-50%,-50%)}.van-step--vertical .van-step__line{top:16px;left:-15px;width:1px;height:100%}.van-step:last-child .van-step__line{width:0}.van-step--finish{color:var(--van-step-finish-text-color)}.van-step--finish .van-step__circle,.van-step--finish .van-step__line{background-color:var(--van-step-finish-line-color)}.van-step__icon,.van-step__title{transition:color var(--van-duration-base)}.van-step__icon--active,.van-step__title--active,.van-step__icon--finish,.van-step__title--finish{color:var(--van-step-active-color)}
|
package/es/submit-bar/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-submit-bar-height: 50px;--van-submit-bar-z-index: 100;--van-submit-bar-background: var(--van-background-2);--van-submit-bar-button-width: 110px;--van-submit-bar-price-color: var(--van-danger-color);--van-submit-bar-price-font-size: var(--van-font-size-sm);--van-submit-bar-price-integer-font-size: 20px;--van-submit-bar-price-font: var(--van-price-font);--van-submit-bar-
|
1
|
+
:root{--van-submit-bar-height: 50px;--van-submit-bar-z-index: 100;--van-submit-bar-background: var(--van-background-2);--van-submit-bar-button-width: 110px;--van-submit-bar-price-color: var(--van-danger-color);--van-submit-bar-price-font-size: var(--van-font-size-sm);--van-submit-bar-price-integer-font-size: 20px;--van-submit-bar-price-font: var(--van-price-font);--van-submit-bar-text-color: var(--van-text-color);--van-submit-bar-text-font-size: var(--van-font-size-md);--van-submit-bar-tip-padding: var(--van-padding-xs) var(--van-padding-sm);--van-submit-bar-tip-font-size: var(--van-font-size-sm);--van-submit-bar-tip-line-height: 1.5;--van-submit-bar-tip-color: var(--van-orange-dark);--van-submit-bar-tip-background: var(--van-orange-light);--van-submit-bar-tip-icon-size: 12px;--van-submit-bar-button-height: 40px;--van-submit-bar-padding: 0 var(--van-padding-md)}.van-submit-bar{position:fixed;bottom:0;left:0;z-index:var(--van-submit-bar-z-index);width:100%;background:var(--van-submit-bar-background);-webkit-user-select:none;user-select:none}.van-submit-bar__tip{padding:var(--van-submit-bar-tip-padding);color:var(--van-submit-bar-tip-color);font-size:var(--van-submit-bar-tip-font-size);line-height:var(--van-submit-bar-tip-line-height);background:var(--van-submit-bar-tip-background)}.van-submit-bar__tip-icon{margin-right:var(--van-padding-base);font-size:var(--van-submit-bar-tip-icon-size);vertical-align:middle}.van-submit-bar__tip-text{vertical-align:middle}.van-submit-bar__bar{display:flex;align-items:center;justify-content:flex-end;height:var(--van-submit-bar-height);padding:var(--van-submit-bar-padding);font-size:var(--van-submit-bar-text-font-size)}.van-submit-bar__text{flex:1;padding-right:var(--van-padding-sm);color:var(--van-submit-bar-text-color);text-align:right}.van-submit-bar__text span{display:inline-block}.van-submit-bar__suffix-label{margin-left:var(--van-padding-base);font-weight:var(--van-font-bold)}.van-submit-bar__price{color:var(--van-submit-bar-price-color);font-weight:var(--van-font-bold);font-size:var(--van-submit-bar-price-font-size);margin-left:var(--van-padding-base)}.van-submit-bar__price-integer{font-size:var(--van-submit-bar-price-integer-font-size);font-family:var(--van-submit-bar-price-font)}.van-submit-bar__button{width:var(--van-submit-bar-button-width);height:var(--van-submit-bar-button-height);font-weight:var(--van-font-bold);border:none}.van-submit-bar__button--danger{background:var(--van-gradient-red)}
|
package/es/tabs/Tabs.mjs
CHANGED
@@ -46,6 +46,8 @@ var stdin_default = defineComponent({
|
|
46
46
|
let tabHeight;
|
47
47
|
let lockScroll;
|
48
48
|
let stickyFixed;
|
49
|
+
let cancelScrollLeftToRaf;
|
50
|
+
let cancelScrollTopToRaf;
|
49
51
|
const root = ref();
|
50
52
|
const navRef = ref();
|
51
53
|
const wrapRef = ref();
|
@@ -93,7 +95,9 @@ var stdin_default = defineComponent({
|
|
93
95
|
}
|
94
96
|
const title = titles[state.currentIndex].$el;
|
95
97
|
const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
|
96
|
-
|
98
|
+
if (cancelScrollLeftToRaf)
|
99
|
+
cancelScrollLeftToRaf();
|
100
|
+
cancelScrollLeftToRaf = scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
|
97
101
|
};
|
98
102
|
const setLine = () => {
|
99
103
|
const shouldAnimate = state.inited;
|
@@ -169,7 +173,9 @@ var stdin_default = defineComponent({
|
|
169
173
|
if (target && scroller.value) {
|
170
174
|
const to = getElementTop(target, scroller.value) - scrollOffset.value;
|
171
175
|
lockScroll = true;
|
172
|
-
|
176
|
+
if (cancelScrollTopToRaf)
|
177
|
+
cancelScrollTopToRaf();
|
178
|
+
cancelScrollTopToRaf = scrollTopTo(scroller.value, to, immediate ? 0 : +props.duration, () => {
|
173
179
|
lockScroll = false;
|
174
180
|
});
|
175
181
|
}
|
package/es/tabs/utils.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import { ScrollElement } from '../utils';
|
2
|
-
export declare function scrollLeftTo(scroller: HTMLElement, to: number, duration: number): void;
|
3
|
-
export declare function scrollTopTo(scroller: ScrollElement, to: number, duration: number, callback: () => void): void;
|
2
|
+
export declare function scrollLeftTo(scroller: HTMLElement, to: number, duration: number): () => void;
|
3
|
+
export declare function scrollTopTo(scroller: ScrollElement, to: number, duration: number, callback: () => void): () => void;
|
package/es/tabs/utils.mjs
CHANGED
@@ -1,22 +1,31 @@
|
|
1
|
-
import { raf } from "@vant/use";
|
1
|
+
import { raf, cancelRaf } from "@vant/use";
|
2
2
|
import { getScrollTop, setScrollTop } from "../utils/index.mjs";
|
3
3
|
function scrollLeftTo(scroller, to, duration) {
|
4
|
+
let rafId;
|
4
5
|
let count = 0;
|
5
6
|
const from = scroller.scrollLeft;
|
6
7
|
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
8
|
+
function cancel() {
|
9
|
+
cancelRaf(rafId);
|
10
|
+
}
|
7
11
|
function animate() {
|
8
12
|
scroller.scrollLeft += (to - from) / frames;
|
9
13
|
if (++count < frames) {
|
10
|
-
raf(animate);
|
14
|
+
rafId = raf(animate);
|
11
15
|
}
|
12
16
|
}
|
13
17
|
animate();
|
18
|
+
return cancel;
|
14
19
|
}
|
15
20
|
function scrollTopTo(scroller, to, duration, callback) {
|
21
|
+
let rafId;
|
16
22
|
let current = getScrollTop(scroller);
|
17
23
|
const isDown = current < to;
|
18
24
|
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
19
25
|
const step = (to - current) / frames;
|
26
|
+
function cancel() {
|
27
|
+
cancelRaf(rafId);
|
28
|
+
}
|
20
29
|
function animate() {
|
21
30
|
current += step;
|
22
31
|
if (isDown && current > to || !isDown && current < to) {
|
@@ -24,12 +33,13 @@ function scrollTopTo(scroller, to, duration, callback) {
|
|
24
33
|
}
|
25
34
|
setScrollTop(scroller, current);
|
26
35
|
if (isDown && current < to || !isDown && current > to) {
|
27
|
-
raf(animate);
|
36
|
+
rafId = raf(animate);
|
28
37
|
} else if (callback) {
|
29
|
-
raf(callback);
|
38
|
+
rafId = raf(callback);
|
30
39
|
}
|
31
40
|
}
|
32
41
|
animate();
|
42
|
+
return cancel;
|
33
43
|
}
|
34
44
|
export {
|
35
45
|
scrollLeftTo,
|
package/lib/checkbox/Checker.js
CHANGED
@@ -54,7 +54,19 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
54
54
|
return props.parent.props[name];
|
55
55
|
}
|
56
56
|
};
|
57
|
-
const disabled = (0, import_vue2.computed)(() =>
|
57
|
+
const disabled = (0, import_vue2.computed)(() => {
|
58
|
+
if (props.parent && props.bindGroup) {
|
59
|
+
const disabled2 = getParentProp("disabled") || props.disabled;
|
60
|
+
if (props.role === "checkbox") {
|
61
|
+
const checkedCount = getParentProp("modelValue").length;
|
62
|
+
const max = getParentProp("max");
|
63
|
+
const overlimit = max && checkedCount >= +max;
|
64
|
+
return disabled2 || overlimit && !props.checked;
|
65
|
+
}
|
66
|
+
return disabled2;
|
67
|
+
}
|
68
|
+
return props.disabled;
|
69
|
+
});
|
58
70
|
const direction = (0, import_vue2.computed)(() => getParentProp("direction"));
|
59
71
|
const iconStyle = (0, import_vue2.computed)(() => {
|
60
72
|
const checkedColor = props.checkedColor || getParentProp("checkedColor");
|
@@ -41,5 +41,5 @@ export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "all
|
|
41
41
|
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
42
42
|
export declare const getMonthEndDay: (year: number, month: number) => number;
|
43
43
|
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter) => PickerOption[];
|
44
|
-
export declare const formatValueRange: (values: string[], columns: PickerOption[]) => string[];
|
44
|
+
export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
|
45
45
|
export {};
|
package/lib/field/Field.js
CHANGED
@@ -452,6 +452,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
452
452
|
return (0, import_vue.createVNode)("label", {
|
453
453
|
"id": `${id}-label`,
|
454
454
|
"for": getInputId(),
|
455
|
+
"onClick": (event) => {
|
456
|
+
(0, import_utils.preventDefault)(event);
|
457
|
+
focus();
|
458
|
+
},
|
455
459
|
"style": labelAlign === "top" && labelWidth ? {
|
456
460
|
width: (0, import_utils.addUnit)(labelWidth)
|
457
461
|
} : void 0
|
@@ -29,6 +29,10 @@ var import_image = require("../image");
|
|
29
29
|
var import_loading = require("../loading");
|
30
30
|
var import_swipe_item = require("../swipe-item");
|
31
31
|
const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
|
32
|
+
const getCenter = (touches) => ({
|
33
|
+
x: (touches[0].clientX + touches[1].clientX) / 2,
|
34
|
+
y: (touches[0].clientY + touches[1].clientY) / 2
|
35
|
+
});
|
32
36
|
const bem = (0, import_utils.createNamespace)("image-preview")[1];
|
33
37
|
var stdin_default = (0, import_vue2.defineComponent)({
|
34
38
|
props: {
|
@@ -57,6 +61,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
57
61
|
displayHeight: 0
|
58
62
|
});
|
59
63
|
const touch = (0, import_use_touch.useTouch)();
|
64
|
+
const imageRef = (0, import_vue2.ref)();
|
60
65
|
const swipeItem = (0, import_vue2.ref)();
|
61
66
|
const vertical = (0, import_vue2.computed)(() => {
|
62
67
|
const {
|
@@ -78,9 +83,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
78
83
|
transitionDuration: zooming || moving ? "0s" : ".3s"
|
79
84
|
};
|
80
85
|
if (scale !== 1) {
|
81
|
-
|
82
|
-
const offsetY = moveY / scale;
|
83
|
-
style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
|
86
|
+
style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
|
84
87
|
}
|
85
88
|
return style;
|
86
89
|
});
|
@@ -106,10 +109,26 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
106
109
|
}
|
107
110
|
return 0;
|
108
111
|
});
|
109
|
-
const setScale = (scale) => {
|
112
|
+
const setScale = (scale, center) => {
|
113
|
+
var _a;
|
110
114
|
scale = (0, import_utils.clamp)(scale, +props.minZoom, +props.maxZoom + 1);
|
111
115
|
if (scale !== state.scale) {
|
116
|
+
const ratio = scale / state.scale;
|
112
117
|
state.scale = scale;
|
118
|
+
if (center) {
|
119
|
+
const imageRect = (0, import_use.useRect)((_a = imageRef.value) == null ? void 0 : _a.$el);
|
120
|
+
const origin = {
|
121
|
+
x: imageRect.width * 0.5,
|
122
|
+
y: imageRect.height * 0.5
|
123
|
+
};
|
124
|
+
const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
|
125
|
+
const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
|
126
|
+
state.moveX = (0, import_utils.clamp)(moveX, -maxMoveX.value, maxMoveX.value);
|
127
|
+
state.moveY = (0, import_utils.clamp)(moveY, -maxMoveY.value, maxMoveY.value);
|
128
|
+
} else {
|
129
|
+
state.moveX = 0;
|
130
|
+
state.moveY = 0;
|
131
|
+
}
|
113
132
|
emit("scale", {
|
114
133
|
scale,
|
115
134
|
index: props.active
|
@@ -118,20 +137,20 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
118
137
|
};
|
119
138
|
const resetScale = () => {
|
120
139
|
setScale(1);
|
121
|
-
state.moveX = 0;
|
122
|
-
state.moveY = 0;
|
123
140
|
};
|
124
141
|
const toggleScale = () => {
|
125
142
|
const scale = state.scale > 1 ? 1 : 2;
|
126
|
-
setScale(scale
|
127
|
-
|
128
|
-
|
143
|
+
setScale(scale, scale === 2 ? {
|
144
|
+
x: touch.startX.value,
|
145
|
+
y: touch.startY.value
|
146
|
+
} : void 0);
|
129
147
|
};
|
130
148
|
let fingerNum;
|
131
149
|
let startMoveX;
|
132
150
|
let startMoveY;
|
133
151
|
let startScale;
|
134
152
|
let startDistance;
|
153
|
+
let lastCenter;
|
135
154
|
let doubleTapTimer;
|
136
155
|
let touchStartTime;
|
137
156
|
let isImageMoved = false;
|
@@ -155,7 +174,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
155
174
|
state.zooming = fingerNum === 2 && !offsetX.value;
|
156
175
|
if (state.zooming) {
|
157
176
|
startScale = state.scale;
|
158
|
-
startDistance = getDistance(
|
177
|
+
startDistance = getDistance(touches);
|
159
178
|
}
|
160
179
|
};
|
161
180
|
const onTouchMove = (event) => {
|
@@ -184,7 +203,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
184
203
|
if (touches.length === 2) {
|
185
204
|
const distance = getDistance(touches);
|
186
205
|
const scale = startScale * distance / startDistance;
|
187
|
-
|
206
|
+
lastCenter = getCenter(touches);
|
207
|
+
setScale(scale, lastCenter);
|
188
208
|
}
|
189
209
|
}
|
190
210
|
};
|
@@ -238,7 +258,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
238
258
|
}
|
239
259
|
const maxZoom = +props.maxZoom;
|
240
260
|
if (state.scale > maxZoom) {
|
241
|
-
|
261
|
+
setScale(maxZoom, lastCenter);
|
242
262
|
}
|
243
263
|
}
|
244
264
|
}
|
@@ -283,6 +303,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
283
303
|
}, [slots.image({
|
284
304
|
src: props.src
|
285
305
|
})]) : (0, import_vue.createVNode)(import_image.Image, {
|
306
|
+
"ref": imageRef,
|
286
307
|
"src": props.src,
|
287
308
|
"fit": "contain",
|
288
309
|
"class": bem("image", {
|