vant 4.7.1 → 4.7.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/icon/index.css +1 -1
- package/es/image-preview/ImagePreview.d.ts +13 -0
- package/es/image-preview/ImagePreview.mjs +2 -0
- package/es/image-preview/ImagePreviewItem.d.ts +3 -0
- package/es/image-preview/ImagePreviewItem.mjs +16 -11
- package/es/image-preview/function-call.mjs +1 -0
- package/es/image-preview/index.d.ts +9 -0
- package/es/image-preview/types.d.ts +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/signature/Signature.mjs +34 -36
- package/es/uploader/Uploader.mjs +12 -3
- package/lib/icon/index.css +1 -1
- package/lib/image-preview/ImagePreview.d.ts +13 -0
- package/lib/image-preview/ImagePreview.js +2 -0
- package/lib/image-preview/ImagePreviewItem.d.ts +3 -0
- package/lib/image-preview/ImagePreviewItem.js +16 -11
- package/lib/image-preview/function-call.js +1 -0
- package/lib/image-preview/index.d.ts +9 -0
- package/lib/image-preview/types.d.ts +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/signature/Signature.js +33 -35
- package/lib/uploader/Uploader.js +11 -2
- package/lib/vant.cjs.js +64 -49
- package/lib/vant.es.js +64 -49
- package/lib/vant.js +64 -49
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +4 -4
package/lib/vant.js
CHANGED
@@ -10698,6 +10698,7 @@
|
|
10698
10698
|
rootWidth: makeRequiredProp(Number),
|
10699
10699
|
rootHeight: makeRequiredProp(Number),
|
10700
10700
|
disableZoom: Boolean,
|
10701
|
+
doubleScale: Boolean,
|
10701
10702
|
closeOnClickOverlay: Boolean
|
10702
10703
|
},
|
10703
10704
|
emits: ["scale", "close", "longPress"],
|
@@ -10871,18 +10872,22 @@
|
|
10871
10872
|
const TAP_TIME = 250;
|
10872
10873
|
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
|
10873
10874
|
if (deltaTime < TAP_TIME) {
|
10874
|
-
if (
|
10875
|
-
|
10876
|
-
|
10877
|
-
toggleScale();
|
10878
|
-
} else {
|
10879
|
-
if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
|
10880
|
-
return;
|
10881
|
-
}
|
10882
|
-
doubleTapTimer = setTimeout(() => {
|
10883
|
-
emit("close");
|
10875
|
+
if (props2.doubleScale) {
|
10876
|
+
if (doubleTapTimer) {
|
10877
|
+
clearTimeout(doubleTapTimer);
|
10884
10878
|
doubleTapTimer = null;
|
10885
|
-
|
10879
|
+
toggleScale();
|
10880
|
+
} else {
|
10881
|
+
if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
|
10882
|
+
return;
|
10883
|
+
}
|
10884
|
+
doubleTapTimer = setTimeout(() => {
|
10885
|
+
emit("close");
|
10886
|
+
doubleTapTimer = null;
|
10887
|
+
}, TAP_TIME);
|
10888
|
+
}
|
10889
|
+
} else {
|
10890
|
+
emit("close");
|
10886
10891
|
}
|
10887
10892
|
} else if (deltaTime > LONG_PRESS_START_TIME) {
|
10888
10893
|
emit("longPress");
|
@@ -11007,6 +11012,7 @@
|
|
11007
11012
|
closeIcon: makeStringProp("clear"),
|
11008
11013
|
transition: String,
|
11009
11014
|
beforeClose: Function,
|
11015
|
+
doubleScale: truthProp,
|
11010
11016
|
overlayClass: unknownProp,
|
11011
11017
|
overlayStyle: Object,
|
11012
11018
|
swipeDuration: makeNumericProp(300),
|
@@ -11098,6 +11104,7 @@
|
|
11098
11104
|
"rootWidth": state.rootWidth,
|
11099
11105
|
"rootHeight": state.rootHeight,
|
11100
11106
|
"disableZoom": state.disableZoom,
|
11107
|
+
"doubleScale": props2.doubleScale,
|
11101
11108
|
"closeOnClickOverlay": props2.closeOnClickOverlay,
|
11102
11109
|
"onScale": emitScale,
|
11103
11110
|
"onClose": emitClose,
|
@@ -11175,6 +11182,7 @@
|
|
11175
11182
|
closeIcon: "clear",
|
11176
11183
|
transition: void 0,
|
11177
11184
|
beforeClose: void 0,
|
11185
|
+
doubleScale: true,
|
11178
11186
|
overlayStyle: void 0,
|
11179
11187
|
overlayClass: void 0,
|
11180
11188
|
startPosition: 0,
|
@@ -14471,37 +14479,37 @@
|
|
14471
14479
|
}) {
|
14472
14480
|
const canvasRef = vue.ref();
|
14473
14481
|
const wrapRef = vue.ref();
|
14474
|
-
const
|
14475
|
-
|
14476
|
-
|
14477
|
-
|
14478
|
-
ratio: inBrowser$1 ? window.devicePixelRatio : 1
|
14482
|
+
const ctx = vue.computed(() => {
|
14483
|
+
if (!canvasRef.value)
|
14484
|
+
return null;
|
14485
|
+
return canvasRef.value.getContext("2d");
|
14479
14486
|
});
|
14480
|
-
let canvasRect;
|
14481
14487
|
const isRenderCanvas = inBrowser$1 ? hasCanvasSupport() : true;
|
14488
|
+
let canvasWidth = 0;
|
14489
|
+
let canvasHeight = 0;
|
14490
|
+
let canvasRect;
|
14482
14491
|
const touchStart = () => {
|
14483
|
-
if (!
|
14492
|
+
if (!ctx.value) {
|
14484
14493
|
return false;
|
14485
14494
|
}
|
14486
|
-
|
14487
|
-
|
14488
|
-
|
14495
|
+
ctx.value.beginPath();
|
14496
|
+
ctx.value.lineWidth = props2.lineWidth;
|
14497
|
+
ctx.value.strokeStyle = props2.penColor;
|
14489
14498
|
canvasRect = useRect(canvasRef);
|
14490
14499
|
emit("start");
|
14491
14500
|
};
|
14492
14501
|
const touchMove = (event) => {
|
14493
|
-
|
14494
|
-
if (!state.ctx) {
|
14502
|
+
if (!ctx.value) {
|
14495
14503
|
return false;
|
14496
14504
|
}
|
14497
14505
|
preventDefault(event);
|
14498
14506
|
const touch = event.touches[0];
|
14499
|
-
const mouseX =
|
14500
|
-
const mouseY =
|
14501
|
-
|
14502
|
-
|
14503
|
-
|
14504
|
-
|
14507
|
+
const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
|
14508
|
+
const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
|
14509
|
+
ctx.value.lineCap = "round";
|
14510
|
+
ctx.value.lineJoin = "round";
|
14511
|
+
ctx.value.lineTo(mouseX, mouseY);
|
14512
|
+
ctx.value.stroke();
|
14505
14513
|
emit("signing", event);
|
14506
14514
|
};
|
14507
14515
|
const touchEnd = (event) => {
|
@@ -14518,10 +14526,10 @@
|
|
14518
14526
|
}
|
14519
14527
|
return canvas.toDataURL() === empty.toDataURL();
|
14520
14528
|
};
|
14521
|
-
const setCanvasBgColor = (
|
14522
|
-
if (
|
14523
|
-
|
14524
|
-
|
14529
|
+
const setCanvasBgColor = (ctx2) => {
|
14530
|
+
if (ctx2 && props2.backgroundColor) {
|
14531
|
+
ctx2.fillStyle = props2.backgroundColor;
|
14532
|
+
ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
|
14525
14533
|
}
|
14526
14534
|
};
|
14527
14535
|
const submit = () => {
|
@@ -14541,22 +14549,22 @@
|
|
14541
14549
|
});
|
14542
14550
|
};
|
14543
14551
|
const clear = () => {
|
14544
|
-
if (
|
14545
|
-
|
14546
|
-
|
14547
|
-
setCanvasBgColor(
|
14552
|
+
if (ctx.value) {
|
14553
|
+
ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
|
14554
|
+
ctx.value.closePath();
|
14555
|
+
setCanvasBgColor(ctx.value);
|
14548
14556
|
}
|
14549
14557
|
emit("clear");
|
14550
14558
|
};
|
14551
14559
|
vue.onMounted(() => {
|
14552
14560
|
var _a, _b, _c;
|
14553
|
-
if (isRenderCanvas) {
|
14554
|
-
|
14555
|
-
|
14556
|
-
|
14557
|
-
|
14558
|
-
|
14559
|
-
|
14561
|
+
if (isRenderCanvas && canvasRef.value) {
|
14562
|
+
const canvas = canvasRef.value;
|
14563
|
+
const dpr = inBrowser$1 ? window.devicePixelRatio : 1;
|
14564
|
+
canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
|
14565
|
+
canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
|
14566
|
+
(_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
|
14567
|
+
setCanvasBgColor(ctx.value);
|
14560
14568
|
}
|
14561
14569
|
});
|
14562
14570
|
return () => vue.createVNode("div", {
|
@@ -14566,8 +14574,6 @@
|
|
14566
14574
|
"ref": wrapRef
|
14567
14575
|
}, [isRenderCanvas ? vue.createVNode("canvas", {
|
14568
14576
|
"ref": canvasRef,
|
14569
|
-
"width": state.width,
|
14570
|
-
"height": state.height,
|
14571
14577
|
"onTouchstartPassive": touchStart,
|
14572
14578
|
"onTouchmove": touchMove,
|
14573
14579
|
"onTouchend": touchEnd
|
@@ -16516,6 +16522,7 @@
|
|
16516
16522
|
const inputRef = vue.ref();
|
16517
16523
|
const urls = [];
|
16518
16524
|
const reuploadIndex = vue.ref(-1);
|
16525
|
+
const isReuploading = vue.ref(false);
|
16519
16526
|
const getDetail = (index = props2.modelValue.length) => ({
|
16520
16527
|
name: props2.name,
|
16521
16528
|
index
|
@@ -16652,8 +16659,15 @@
|
|
16652
16659
|
emit("delete", item, getDetail(index));
|
16653
16660
|
};
|
16654
16661
|
const reuploadImage = (index) => {
|
16655
|
-
|
16662
|
+
isReuploading.value = true;
|
16656
16663
|
reuploadIndex.value = index;
|
16664
|
+
vue.nextTick(() => chooseFile());
|
16665
|
+
};
|
16666
|
+
const onInputClick = () => {
|
16667
|
+
if (!isReuploading.value) {
|
16668
|
+
reuploadIndex.value = -1;
|
16669
|
+
}
|
16670
|
+
isReuploading.value = false;
|
16657
16671
|
};
|
16658
16672
|
const renderPreviewItem = (item, index) => {
|
16659
16673
|
const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
|
@@ -16686,7 +16700,8 @@
|
|
16686
16700
|
"capture": props2.capture,
|
16687
16701
|
"multiple": props2.multiple && reuploadIndex.value === -1,
|
16688
16702
|
"disabled": props2.disabled,
|
16689
|
-
"onChange": onChange
|
16703
|
+
"onChange": onChange,
|
16704
|
+
"onClick": onInputClick
|
16690
16705
|
}, null);
|
16691
16706
|
if (slots.default) {
|
16692
16707
|
return vue.withDirectives(vue.createVNode("div", {
|
@@ -17715,7 +17730,7 @@
|
|
17715
17730
|
});
|
17716
17731
|
}
|
17717
17732
|
};
|
17718
|
-
const version = "4.7.
|
17733
|
+
const version = "4.7.2";
|
17719
17734
|
function install(app) {
|
17720
17735
|
const components = [
|
17721
17736
|
ActionBar,
|