vant 4.0.8 → 4.0.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/README.md +1 -1
- package/es/back-top/BackTop.d.ts +4 -0
- package/es/back-top/BackTop.mjs +2 -1
- package/es/back-top/index.d.ts +3 -0
- package/es/calendar/Calendar.mjs +1 -1
- package/es/calendar/CalendarMonth.mjs +4 -1
- package/es/image-preview/ImagePreview.mjs +13 -3
- package/es/image-preview/ImagePreviewItem.d.ts +3 -0
- package/es/image-preview/ImagePreviewItem.mjs +21 -9
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/locale/index.d.ts +1 -0
- package/es/locale/index.mjs +3 -1
- package/es/locale/lang/eo-EO.d.ts +62 -0
- package/es/locale/lang/eo-EO.mjs +64 -0
- package/es/locale/lang/it-IT.mjs +12 -12
- package/es/picker/Picker.mjs +5 -3
- package/es/slider/Slider.d.ts +2 -2
- package/es/slider/Slider.mjs +6 -4
- package/es/slider/index.d.ts +2 -2
- package/es/swipe/Swipe.d.ts +3 -1
- package/es/swipe/Swipe.mjs +10 -2
- package/es/swipe/index.d.ts +3 -1
- package/lib/back-top/BackTop.d.ts +4 -0
- package/lib/back-top/BackTop.js +2 -1
- package/lib/back-top/index.d.ts +3 -0
- package/lib/calendar/Calendar.js +1 -1
- package/lib/calendar/CalendarMonth.js +4 -1
- package/lib/image-preview/ImagePreview.js +13 -3
- package/lib/image-preview/ImagePreviewItem.d.ts +3 -0
- package/lib/image-preview/ImagePreviewItem.js +21 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/index.d.ts +1 -0
- package/lib/locale/index.js +3 -1
- package/lib/locale/lang/eo-EO.d.ts +62 -0
- package/lib/locale/lang/eo-EO.js +83 -0
- package/lib/locale/lang/it-IT.js +12 -12
- package/lib/picker/Picker.js +5 -3
- package/lib/slider/Slider.d.ts +2 -2
- package/lib/slider/Slider.js +6 -4
- package/lib/slider/index.d.ts +2 -2
- package/lib/swipe/Swipe.d.ts +3 -1
- package/lib/swipe/Swipe.js +10 -2
- package/lib/swipe/index.d.ts +3 -1
- package/lib/vant.cjs.js +65 -25
- package/lib/vant.es.js +65 -25
- package/lib/vant.js +65 -25
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/lib/vant.js
CHANGED
@@ -690,6 +690,7 @@
|
|
690
690
|
deepAssign(messages, newMessages);
|
691
691
|
}
|
692
692
|
};
|
693
|
+
const useCurrentLang = () => lang;
|
693
694
|
var stdin_default$1M = Locale;
|
694
695
|
function createTranslate(name2) {
|
695
696
|
const prefix = camelize(name2) + ".";
|
@@ -2511,7 +2512,7 @@
|
|
2511
2512
|
var stdin_default$1w = vue.defineComponent({
|
2512
2513
|
name: name$1l,
|
2513
2514
|
props: swipeProps,
|
2514
|
-
emits: ["change"],
|
2515
|
+
emits: ["change", "dragStart", "dragEnd"],
|
2515
2516
|
setup(props, {
|
2516
2517
|
emit,
|
2517
2518
|
slots
|
@@ -2526,6 +2527,7 @@
|
|
2526
2527
|
active: 0,
|
2527
2528
|
swiping: false
|
2528
2529
|
});
|
2530
|
+
let dragging = false;
|
2529
2531
|
const touch = useTouch();
|
2530
2532
|
const {
|
2531
2533
|
children,
|
@@ -2696,9 +2698,10 @@
|
|
2696
2698
|
const resize = () => initialize(state.active);
|
2697
2699
|
let touchStartTime;
|
2698
2700
|
const onTouchStart = (event) => {
|
2699
|
-
if (!props.touchable)
|
2701
|
+
if (!props.touchable || event.touches.length > 1)
|
2700
2702
|
return;
|
2701
2703
|
touch.start(event);
|
2704
|
+
dragging = false;
|
2702
2705
|
touchStartTime = Date.now();
|
2703
2706
|
stopAutoplay();
|
2704
2707
|
correctPosition();
|
@@ -2713,6 +2716,10 @@
|
|
2713
2716
|
move({
|
2714
2717
|
offset: delta.value
|
2715
2718
|
});
|
2719
|
+
if (!dragging) {
|
2720
|
+
emit("dragStart");
|
2721
|
+
dragging = true;
|
2722
|
+
}
|
2716
2723
|
}
|
2717
2724
|
}
|
2718
2725
|
}
|
@@ -2741,7 +2748,9 @@
|
|
2741
2748
|
pace: 0
|
2742
2749
|
});
|
2743
2750
|
}
|
2751
|
+
dragging = false;
|
2744
2752
|
state.swiping = false;
|
2753
|
+
emit("dragEnd");
|
2745
2754
|
autoplay();
|
2746
2755
|
};
|
2747
2756
|
const swipeTo = (index, options = {}) => {
|
@@ -3567,9 +3576,11 @@
|
|
3567
3576
|
}
|
3568
3577
|
});
|
3569
3578
|
}
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3579
|
+
vue.nextTick(() => {
|
3580
|
+
emit("change", extend({
|
3581
|
+
columnIndex
|
3582
|
+
}, getEventParams()));
|
3583
|
+
});
|
3573
3584
|
};
|
3574
3585
|
const onClickOption = (currentOption, columnIndex) => emit("clickOption", extend({
|
3575
3586
|
columnIndex,
|
@@ -5956,6 +5967,7 @@
|
|
5956
5967
|
bottom: numericProp,
|
5957
5968
|
target: [String, Object],
|
5958
5969
|
offset: makeNumericProp(200),
|
5970
|
+
immediate: Boolean,
|
5959
5971
|
teleport: {
|
5960
5972
|
type: [String, Object],
|
5961
5973
|
default: "body"
|
@@ -5983,7 +5995,7 @@
|
|
5983
5995
|
emit("click", event);
|
5984
5996
|
(_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
|
5985
5997
|
top: 0,
|
5986
|
-
behavior: "smooth"
|
5998
|
+
behavior: props.immediate ? "auto" : "smooth"
|
5987
5999
|
});
|
5988
6000
|
};
|
5989
6001
|
const scroll = () => {
|
@@ -6366,7 +6378,10 @@
|
|
6366
6378
|
if (props.showMonthTitle) {
|
6367
6379
|
return vue.createVNode("div", {
|
6368
6380
|
"class": bem$Z("month-title")
|
6369
|
-
}, [title
|
6381
|
+
}, [slots["month-title"] ? slots["month-title"]({
|
6382
|
+
date: props.date,
|
6383
|
+
text: title.value
|
6384
|
+
}) : title.value]);
|
6370
6385
|
}
|
6371
6386
|
};
|
6372
6387
|
const renderMark = () => {
|
@@ -6812,7 +6827,7 @@
|
|
6812
6827
|
"firstDayOfWeek": dayOffset.value
|
6813
6828
|
}, pick(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
|
6814
6829
|
"onClick": onClickDay
|
6815
|
-
}), pick(slots, ["top-info", "bottom-info"]));
|
6830
|
+
}), pick(slots, ["top-info", "bottom-info", "month-title"]));
|
6816
6831
|
};
|
6817
6832
|
const renderFooterButton = () => {
|
6818
6833
|
if (slots.footer) {
|
@@ -9873,7 +9888,8 @@
|
|
9873
9888
|
minZoom: makeRequiredProp(numericProp),
|
9874
9889
|
maxZoom: makeRequiredProp(numericProp),
|
9875
9890
|
rootWidth: makeRequiredProp(Number),
|
9876
|
-
rootHeight: makeRequiredProp(Number)
|
9891
|
+
rootHeight: makeRequiredProp(Number),
|
9892
|
+
disableZoom: Boolean
|
9877
9893
|
},
|
9878
9894
|
emits: ["scale", "close", "longPress"],
|
9879
9895
|
setup(props, {
|
@@ -9968,18 +9984,23 @@
|
|
9968
9984
|
let startDistance;
|
9969
9985
|
let doubleTapTimer;
|
9970
9986
|
let touchStartTime;
|
9987
|
+
let isImageMoved = false;
|
9971
9988
|
const onTouchStart = (event) => {
|
9972
9989
|
const {
|
9973
9990
|
touches
|
9974
9991
|
} = event;
|
9992
|
+
fingerNum = touches.length;
|
9993
|
+
if (fingerNum === 2 && props.disableZoom) {
|
9994
|
+
return;
|
9995
|
+
}
|
9975
9996
|
const {
|
9976
9997
|
offsetX
|
9977
9998
|
} = touch;
|
9978
9999
|
touch.start(event);
|
9979
|
-
fingerNum = touches.length;
|
9980
10000
|
startMoveX = state.moveX;
|
9981
10001
|
startMoveY = state.moveY;
|
9982
10002
|
touchStartTime = Date.now();
|
10003
|
+
isImageMoved = false;
|
9983
10004
|
state.moving = fingerNum === 1 && state.scale !== 1;
|
9984
10005
|
state.zooming = fingerNum === 2 && !offsetX.value;
|
9985
10006
|
if (state.zooming) {
|
@@ -9992,9 +10013,6 @@
|
|
9992
10013
|
touches
|
9993
10014
|
} = event;
|
9994
10015
|
touch.move(event);
|
9995
|
-
if (state.moving || state.zooming) {
|
9996
|
-
preventDefault(event, true);
|
9997
|
-
}
|
9998
10016
|
if (state.moving) {
|
9999
10017
|
const {
|
10000
10018
|
deltaX,
|
@@ -10002,13 +10020,22 @@
|
|
10002
10020
|
} = touch;
|
10003
10021
|
const moveX = deltaX.value + startMoveX;
|
10004
10022
|
const moveY = deltaY.value + startMoveY;
|
10023
|
+
if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
|
10024
|
+
state.moving = false;
|
10025
|
+
return;
|
10026
|
+
}
|
10027
|
+
isImageMoved = true;
|
10028
|
+
preventDefault(event, true);
|
10005
10029
|
state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
|
10006
10030
|
state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
|
10007
10031
|
}
|
10008
|
-
if (state.zooming
|
10009
|
-
|
10010
|
-
|
10011
|
-
|
10032
|
+
if (state.zooming) {
|
10033
|
+
preventDefault(event, true);
|
10034
|
+
if (touches.length === 2) {
|
10035
|
+
const distance = getDistance(touches);
|
10036
|
+
const scale = startScale * distance / startDistance;
|
10037
|
+
setScale(scale);
|
10038
|
+
}
|
10012
10039
|
}
|
10013
10040
|
};
|
10014
10041
|
const checkTap = () => {
|
@@ -10118,7 +10145,7 @@
|
|
10118
10145
|
}
|
10119
10146
|
});
|
10120
10147
|
const [name$z, bem$y] = createNamespace("image-preview");
|
10121
|
-
const popupProps$1 = ["show", "
|
10148
|
+
const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
|
10122
10149
|
const imagePreviewProps = {
|
10123
10150
|
show: Boolean,
|
10124
10151
|
loop: truthProp,
|
@@ -10153,7 +10180,8 @@
|
|
10153
10180
|
const state = vue.reactive({
|
10154
10181
|
active: 0,
|
10155
10182
|
rootWidth: 0,
|
10156
|
-
rootHeight: 0
|
10183
|
+
rootHeight: 0,
|
10184
|
+
disableZoom: false
|
10157
10185
|
});
|
10158
10186
|
const resize = () => {
|
10159
10187
|
if (swipeRef.value) {
|
@@ -10193,6 +10221,12 @@
|
|
10193
10221
|
}, [slots.cover()]);
|
10194
10222
|
}
|
10195
10223
|
};
|
10224
|
+
const onDragStart = () => {
|
10225
|
+
state.disableZoom = true;
|
10226
|
+
};
|
10227
|
+
const onDragEnd = () => {
|
10228
|
+
state.disableZoom = false;
|
10229
|
+
};
|
10196
10230
|
const renderImages = () => vue.createVNode(Swipe, {
|
10197
10231
|
"ref": swipeRef,
|
10198
10232
|
"lazyRender": true,
|
@@ -10202,7 +10236,9 @@
|
|
10202
10236
|
"initialSwipe": props.startPosition,
|
10203
10237
|
"showIndicators": props.showIndicators,
|
10204
10238
|
"indicatorColor": "white",
|
10205
|
-
"onChange": setActive
|
10239
|
+
"onChange": setActive,
|
10240
|
+
"onDragEnd": onDragEnd,
|
10241
|
+
"onDragStart": onDragStart
|
10206
10242
|
}, {
|
10207
10243
|
default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$I, {
|
10208
10244
|
"src": image,
|
@@ -10212,6 +10248,7 @@
|
|
10212
10248
|
"minZoom": props.minZoom,
|
10213
10249
|
"rootWidth": state.rootWidth,
|
10214
10250
|
"rootHeight": state.rootHeight,
|
10251
|
+
"disableZoom": state.disableZoom,
|
10215
10252
|
"onScale": emitScale,
|
10216
10253
|
"onClose": emitClose,
|
10217
10254
|
"onLongPress": () => emit("longPress", {
|
@@ -13688,7 +13725,7 @@
|
|
13688
13725
|
let current2;
|
13689
13726
|
let startValue;
|
13690
13727
|
const root = vue.ref();
|
13691
|
-
const slider = vue.ref();
|
13728
|
+
const slider = [vue.ref(), vue.ref()];
|
13692
13729
|
const dragStatus = vue.ref();
|
13693
13730
|
const touch = useTouch();
|
13694
13731
|
const scope = vue.computed(() => Number(props.max) - Number(props.min));
|
@@ -13880,7 +13917,7 @@
|
|
13880
13917
|
const renderButton = (index) => {
|
13881
13918
|
const current22 = typeof index === "number" ? props.modelValue[index] : props.modelValue;
|
13882
13919
|
return vue.createVNode("div", {
|
13883
|
-
"ref": slider,
|
13920
|
+
"ref": slider[index != null ? index : 0],
|
13884
13921
|
"role": "slider",
|
13885
13922
|
"class": getButtonClassName(index),
|
13886
13923
|
"tabindex": props.disabled ? void 0 : 0,
|
@@ -13903,8 +13940,10 @@
|
|
13903
13940
|
};
|
13904
13941
|
updateValue(props.modelValue);
|
13905
13942
|
useCustomFieldValue(() => props.modelValue);
|
13906
|
-
|
13907
|
-
|
13943
|
+
slider.forEach((item) => {
|
13944
|
+
useEventListener("touchmove", onTouchMove, {
|
13945
|
+
target: item
|
13946
|
+
});
|
13908
13947
|
});
|
13909
13948
|
return () => vue.createVNode("div", {
|
13910
13949
|
"ref": root,
|
@@ -16134,7 +16173,7 @@
|
|
16134
16173
|
});
|
16135
16174
|
}
|
16136
16175
|
};
|
16137
|
-
const version = "4.0.
|
16176
|
+
const version = "4.0.10";
|
16138
16177
|
function install(app) {
|
16139
16178
|
const components = [
|
16140
16179
|
ActionBar,
|
@@ -16447,6 +16486,7 @@
|
|
16447
16486
|
exports2.toastProps = toastProps;
|
16448
16487
|
exports2.treeSelectProps = treeSelectProps;
|
16449
16488
|
exports2.uploaderProps = uploaderProps;
|
16489
|
+
exports2.useCurrentLang = useCurrentLang;
|
16450
16490
|
exports2.version = version;
|
16451
16491
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
16452
16492
|
});
|