vant 4.7.1 → 4.7.3
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 -0
- package/es/address-edit/AddressEdit.mjs +1 -1
- package/es/cell/Cell.d.ts +17 -5
- package/es/cell/Cell.mjs +5 -2
- package/es/cell/index.d.ts +9 -3
- package/es/collapse-item/CollapseItem.d.ts +13 -4
- package/es/collapse-item/index.d.ts +9 -3
- package/es/config-provider/types.d.ts +1 -1
- package/es/field/Field.d.ts +30 -21
- package/es/field/Field.mjs +11 -3
- package/es/field/index.css +1 -1
- package/es/field/index.d.ts +18 -12
- package/es/field/types.d.ts +1 -1
- package/es/form/Form.d.ts +3 -0
- package/es/form/Form.mjs +1 -0
- package/es/form/index.d.ts +2 -0
- 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/locale/lang/ar-SA.d.ts +63 -0
- package/es/locale/lang/ar-SA.mjs +65 -0
- package/es/picker-group/PickerGroup.mjs +3 -3
- package/es/progress/types.d.ts +1 -4
- package/es/search/Search.d.ts +13 -13
- package/es/search/Search.mjs +3 -1
- package/es/search/index.css +1 -1
- package/es/search/index.d.ts +9 -9
- package/es/signature/Signature.mjs +49 -38
- package/es/signature/index.d.ts +1 -1
- package/es/signature/types.d.ts +6 -0
- package/es/tabs/Tabs.d.ts +13 -0
- package/es/tabs/Tabs.mjs +3 -2
- package/es/tabs/index.d.ts +9 -0
- package/es/text-ellipsis/index.css +1 -1
- package/es/uploader/Uploader.mjs +12 -3
- package/lib/address-edit/AddressEdit.js +1 -1
- package/lib/cell/Cell.d.ts +17 -5
- package/lib/cell/Cell.js +5 -2
- package/lib/cell/index.d.ts +9 -3
- package/lib/collapse-item/CollapseItem.d.ts +13 -4
- package/lib/collapse-item/index.d.ts +9 -3
- package/lib/config-provider/types.d.ts +1 -1
- package/lib/field/Field.d.ts +30 -21
- package/lib/field/Field.js +11 -3
- package/lib/field/index.css +1 -1
- package/lib/field/index.d.ts +18 -12
- package/lib/field/types.d.ts +1 -1
- package/lib/form/Form.d.ts +3 -0
- package/lib/form/Form.js +1 -0
- package/lib/form/index.d.ts +2 -0
- 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/locale/lang/ar-SA.d.ts +63 -0
- package/lib/locale/lang/ar-SA.js +84 -0
- package/lib/picker-group/PickerGroup.js +2 -2
- package/lib/progress/types.d.ts +1 -4
- package/lib/search/Search.d.ts +13 -13
- package/lib/search/Search.js +3 -1
- package/lib/search/index.css +1 -1
- package/lib/search/index.d.ts +9 -9
- package/lib/signature/Signature.js +47 -36
- package/lib/signature/index.d.ts +1 -1
- package/lib/signature/types.d.ts +6 -0
- package/lib/tabs/Tabs.d.ts +13 -0
- package/lib/tabs/Tabs.js +3 -2
- package/lib/tabs/index.d.ts +9 -0
- package/lib/text-ellipsis/index.css +1 -1
- package/lib/uploader/Uploader.js +11 -2
- package/lib/vant.cjs.js +103 -61
- package/lib/vant.es.js +104 -62
- package/lib/vant.js +103 -61
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +4 -4
package/lib/vant.js
CHANGED
@@ -3075,6 +3075,7 @@
|
|
3075
3075
|
offsetTop: makeNumericProp(0),
|
3076
3076
|
background: String,
|
3077
3077
|
lazyRender: truthProp,
|
3078
|
+
showHeader: truthProp,
|
3078
3079
|
lineWidth: numericProp,
|
3079
3080
|
lineHeight: numericProp,
|
3080
3081
|
beforeChange: Function,
|
@@ -3376,13 +3377,13 @@
|
|
3376
3377
|
return () => vue.createVNode("div", {
|
3377
3378
|
"ref": root,
|
3378
3379
|
"class": bem$1o([props2.type])
|
3379
|
-
}, [props2.sticky ? vue.createVNode(Sticky, {
|
3380
|
+
}, [props2.showHeader ? props2.sticky ? vue.createVNode(Sticky, {
|
3380
3381
|
"container": root.value,
|
3381
3382
|
"offsetTop": offsetTopPx.value,
|
3382
3383
|
"onScroll": onStickyScroll
|
3383
3384
|
}, {
|
3384
3385
|
default: () => [renderHeader()]
|
3385
|
-
}) : renderHeader(), vue.createVNode(stdin_default$1D, {
|
3386
|
+
}) : renderHeader() : null, vue.createVNode(stdin_default$1D, {
|
3386
3387
|
"ref": contentRef,
|
3387
3388
|
"count": children.length,
|
3388
3389
|
"inited": state.inited,
|
@@ -3723,8 +3724,8 @@
|
|
3723
3724
|
};
|
3724
3725
|
const onCancel = () => emit("cancel");
|
3725
3726
|
return () => {
|
3726
|
-
var _a;
|
3727
|
-
const childNodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
3727
|
+
var _a, _b;
|
3728
|
+
const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
|
3728
3729
|
const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
|
3729
3730
|
return vue.createVNode("div", {
|
3730
3731
|
"class": bem$1k()
|
@@ -4114,13 +4115,16 @@
|
|
4114
4115
|
center: Boolean,
|
4115
4116
|
isLink: Boolean,
|
4116
4117
|
border: truthProp,
|
4117
|
-
required: Boolean,
|
4118
4118
|
iconPrefix: String,
|
4119
4119
|
valueClass: unknownProp,
|
4120
4120
|
labelClass: unknownProp,
|
4121
4121
|
titleClass: unknownProp,
|
4122
4122
|
titleStyle: null,
|
4123
4123
|
arrowDirection: String,
|
4124
|
+
required: {
|
4125
|
+
type: [Boolean, String],
|
4126
|
+
default: null
|
4127
|
+
},
|
4124
4128
|
clickable: {
|
4125
4129
|
type: Boolean,
|
4126
4130
|
default: null
|
@@ -4201,7 +4205,7 @@
|
|
4201
4205
|
const clickable = (_a = props2.clickable) != null ? _a : isLink;
|
4202
4206
|
const classes = {
|
4203
4207
|
center,
|
4204
|
-
required,
|
4208
|
+
required: !!required,
|
4205
4209
|
clickable,
|
4206
4210
|
borderless: !border
|
4207
4211
|
};
|
@@ -4228,6 +4232,7 @@
|
|
4228
4232
|
colon: Boolean,
|
4229
4233
|
disabled: Boolean,
|
4230
4234
|
readonly: Boolean,
|
4235
|
+
required: [Boolean, String],
|
4231
4236
|
showError: Boolean,
|
4232
4237
|
labelWidth: numericProp,
|
4233
4238
|
labelAlign: String,
|
@@ -4483,12 +4488,12 @@
|
|
4483
4488
|
autocorrect: String,
|
4484
4489
|
errorMessage: String,
|
4485
4490
|
enterkeyhint: String,
|
4491
|
+
clearTrigger: makeStringProp("focus"),
|
4492
|
+
formatTrigger: makeStringProp("onChange"),
|
4486
4493
|
spellcheck: {
|
4487
4494
|
type: Boolean,
|
4488
4495
|
default: null
|
4489
4496
|
},
|
4490
|
-
clearTrigger: makeStringProp("focus"),
|
4491
|
-
formatTrigger: makeStringProp("onChange"),
|
4492
4497
|
error: {
|
4493
4498
|
type: Boolean,
|
4494
4499
|
default: null
|
@@ -4564,6 +4569,14 @@
|
|
4564
4569
|
}
|
4565
4570
|
return props2.modelValue;
|
4566
4571
|
});
|
4572
|
+
const showRequiredMark = vue.computed(() => {
|
4573
|
+
var _a;
|
4574
|
+
const required = getProp("required");
|
4575
|
+
if (required === "auto") {
|
4576
|
+
return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
|
4577
|
+
}
|
4578
|
+
return required;
|
4579
|
+
});
|
4567
4580
|
const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
|
4568
4581
|
if (state.status === "failed") {
|
4569
4582
|
return;
|
@@ -4966,7 +4979,7 @@
|
|
4966
4979
|
"titleStyle": labelStyle.value,
|
4967
4980
|
"valueClass": bem$1g("value"),
|
4968
4981
|
"titleClass": [bem$1g("label", [labelAlign, {
|
4969
|
-
required:
|
4982
|
+
required: showRequiredMark.value
|
4970
4983
|
}]), props2.labelClass],
|
4971
4984
|
"arrowDirection": props2.arrowDirection
|
4972
4985
|
}, {
|
@@ -5630,7 +5643,7 @@
|
|
5630
5643
|
"label": t$i("area"),
|
5631
5644
|
"is-link": !disableArea,
|
5632
5645
|
"modelValue": areaText.value,
|
5633
|
-
"rules": rules.value.areaCode,
|
5646
|
+
"rules": props2.showArea ? rules.value.areaCode : void 0,
|
5634
5647
|
"placeholder": props2.areaPlaceholder || t$i("area"),
|
5635
5648
|
"onFocus": () => onFocus("areaCode"),
|
5636
5649
|
"onClick": () => {
|
@@ -10698,6 +10711,7 @@
|
|
10698
10711
|
rootWidth: makeRequiredProp(Number),
|
10699
10712
|
rootHeight: makeRequiredProp(Number),
|
10700
10713
|
disableZoom: Boolean,
|
10714
|
+
doubleScale: Boolean,
|
10701
10715
|
closeOnClickOverlay: Boolean
|
10702
10716
|
},
|
10703
10717
|
emits: ["scale", "close", "longPress"],
|
@@ -10871,18 +10885,22 @@
|
|
10871
10885
|
const TAP_TIME = 250;
|
10872
10886
|
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
|
10873
10887
|
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");
|
10888
|
+
if (props2.doubleScale) {
|
10889
|
+
if (doubleTapTimer) {
|
10890
|
+
clearTimeout(doubleTapTimer);
|
10884
10891
|
doubleTapTimer = null;
|
10885
|
-
|
10892
|
+
toggleScale();
|
10893
|
+
} else {
|
10894
|
+
if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
|
10895
|
+
return;
|
10896
|
+
}
|
10897
|
+
doubleTapTimer = setTimeout(() => {
|
10898
|
+
emit("close");
|
10899
|
+
doubleTapTimer = null;
|
10900
|
+
}, TAP_TIME);
|
10901
|
+
}
|
10902
|
+
} else {
|
10903
|
+
emit("close");
|
10886
10904
|
}
|
10887
10905
|
} else if (deltaTime > LONG_PRESS_START_TIME) {
|
10888
10906
|
emit("longPress");
|
@@ -11007,6 +11025,7 @@
|
|
11007
11025
|
closeIcon: makeStringProp("clear"),
|
11008
11026
|
transition: String,
|
11009
11027
|
beforeClose: Function,
|
11028
|
+
doubleScale: truthProp,
|
11010
11029
|
overlayClass: unknownProp,
|
11011
11030
|
overlayStyle: Object,
|
11012
11031
|
swipeDuration: makeNumericProp(300),
|
@@ -11098,6 +11117,7 @@
|
|
11098
11117
|
"rootWidth": state.rootWidth,
|
11099
11118
|
"rootHeight": state.rootHeight,
|
11100
11119
|
"disableZoom": state.disableZoom,
|
11120
|
+
"doubleScale": props2.doubleScale,
|
11101
11121
|
"closeOnClickOverlay": props2.closeOnClickOverlay,
|
11102
11122
|
"onScale": emitScale,
|
11103
11123
|
"onClose": emitClose,
|
@@ -11175,6 +11195,7 @@
|
|
11175
11195
|
closeIcon: "clear",
|
11176
11196
|
transition: void 0,
|
11177
11197
|
beforeClose: void 0,
|
11198
|
+
doubleScale: true,
|
11178
11199
|
overlayStyle: void 0,
|
11179
11200
|
overlayClass: void 0,
|
11180
11201
|
startPosition: 0,
|
@@ -14203,7 +14224,9 @@
|
|
14203
14224
|
return vue.createVNode(Field, vue.mergeProps({
|
14204
14225
|
"ref": fieldRef,
|
14205
14226
|
"type": "search",
|
14206
|
-
"class": bem$m("field"
|
14227
|
+
"class": bem$m("field", {
|
14228
|
+
"with-message": fieldAttrs.errorMessage
|
14229
|
+
}),
|
14207
14230
|
"border": false,
|
14208
14231
|
"onBlur": onBlur,
|
14209
14232
|
"onFocus": onFocus,
|
@@ -14471,37 +14494,37 @@
|
|
14471
14494
|
}) {
|
14472
14495
|
const canvasRef = vue.ref();
|
14473
14496
|
const wrapRef = vue.ref();
|
14474
|
-
const
|
14475
|
-
|
14476
|
-
|
14477
|
-
|
14478
|
-
ratio: inBrowser$1 ? window.devicePixelRatio : 1
|
14497
|
+
const ctx = vue.computed(() => {
|
14498
|
+
if (!canvasRef.value)
|
14499
|
+
return null;
|
14500
|
+
return canvasRef.value.getContext("2d");
|
14479
14501
|
});
|
14480
|
-
let canvasRect;
|
14481
14502
|
const isRenderCanvas = inBrowser$1 ? hasCanvasSupport() : true;
|
14503
|
+
let canvasWidth = 0;
|
14504
|
+
let canvasHeight = 0;
|
14505
|
+
let canvasRect;
|
14482
14506
|
const touchStart = () => {
|
14483
|
-
if (!
|
14507
|
+
if (!ctx.value) {
|
14484
14508
|
return false;
|
14485
14509
|
}
|
14486
|
-
|
14487
|
-
|
14488
|
-
|
14510
|
+
ctx.value.beginPath();
|
14511
|
+
ctx.value.lineWidth = props2.lineWidth;
|
14512
|
+
ctx.value.strokeStyle = props2.penColor;
|
14489
14513
|
canvasRect = useRect(canvasRef);
|
14490
14514
|
emit("start");
|
14491
14515
|
};
|
14492
14516
|
const touchMove = (event) => {
|
14493
|
-
|
14494
|
-
if (!state.ctx) {
|
14517
|
+
if (!ctx.value) {
|
14495
14518
|
return false;
|
14496
14519
|
}
|
14497
14520
|
preventDefault(event);
|
14498
14521
|
const touch = event.touches[0];
|
14499
|
-
const mouseX =
|
14500
|
-
const mouseY =
|
14501
|
-
|
14502
|
-
|
14503
|
-
|
14504
|
-
|
14522
|
+
const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
|
14523
|
+
const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
|
14524
|
+
ctx.value.lineCap = "round";
|
14525
|
+
ctx.value.lineJoin = "round";
|
14526
|
+
ctx.value.lineTo(mouseX, mouseY);
|
14527
|
+
ctx.value.stroke();
|
14505
14528
|
emit("signing", event);
|
14506
14529
|
};
|
14507
14530
|
const touchEnd = (event) => {
|
@@ -14518,10 +14541,10 @@
|
|
14518
14541
|
}
|
14519
14542
|
return canvas.toDataURL() === empty.toDataURL();
|
14520
14543
|
};
|
14521
|
-
const setCanvasBgColor = (
|
14522
|
-
if (
|
14523
|
-
|
14524
|
-
|
14544
|
+
const setCanvasBgColor = (ctx2) => {
|
14545
|
+
if (ctx2 && props2.backgroundColor) {
|
14546
|
+
ctx2.fillStyle = props2.backgroundColor;
|
14547
|
+
ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
|
14525
14548
|
}
|
14526
14549
|
};
|
14527
14550
|
const submit = () => {
|
@@ -14541,23 +14564,35 @@
|
|
14541
14564
|
});
|
14542
14565
|
};
|
14543
14566
|
const clear = () => {
|
14544
|
-
if (
|
14545
|
-
|
14546
|
-
|
14547
|
-
setCanvasBgColor(
|
14567
|
+
if (ctx.value) {
|
14568
|
+
ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
|
14569
|
+
ctx.value.closePath();
|
14570
|
+
setCanvasBgColor(ctx.value);
|
14548
14571
|
}
|
14549
14572
|
emit("clear");
|
14550
14573
|
};
|
14551
|
-
|
14574
|
+
const initialize = () => {
|
14552
14575
|
var _a, _b, _c;
|
14553
|
-
if (isRenderCanvas) {
|
14554
|
-
|
14555
|
-
|
14556
|
-
|
14557
|
-
|
14558
|
-
|
14559
|
-
|
14576
|
+
if (isRenderCanvas && canvasRef.value) {
|
14577
|
+
const canvas = canvasRef.value;
|
14578
|
+
const dpr = inBrowser$1 ? window.devicePixelRatio : 1;
|
14579
|
+
canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
|
14580
|
+
canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
|
14581
|
+
(_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
|
14582
|
+
setCanvasBgColor(ctx.value);
|
14560
14583
|
}
|
14584
|
+
};
|
14585
|
+
const resize = () => {
|
14586
|
+
if (ctx.value) {
|
14587
|
+
const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
|
14588
|
+
initialize();
|
14589
|
+
ctx.value.putImageData(data, 0, 0);
|
14590
|
+
}
|
14591
|
+
};
|
14592
|
+
vue.watch(windowWidth, resize);
|
14593
|
+
vue.onMounted(initialize);
|
14594
|
+
useExpose({
|
14595
|
+
resize
|
14561
14596
|
});
|
14562
14597
|
return () => vue.createVNode("div", {
|
14563
14598
|
"class": bem$i()
|
@@ -14566,8 +14601,6 @@
|
|
14566
14601
|
"ref": wrapRef
|
14567
14602
|
}, [isRenderCanvas ? vue.createVNode("canvas", {
|
14568
14603
|
"ref": canvasRef,
|
14569
|
-
"width": state.width,
|
14570
|
-
"height": state.height,
|
14571
14604
|
"onTouchstartPassive": touchStart,
|
14572
14605
|
"onTouchmove": touchMove,
|
14573
14606
|
"onTouchend": touchEnd
|
@@ -16516,6 +16549,7 @@
|
|
16516
16549
|
const inputRef = vue.ref();
|
16517
16550
|
const urls = [];
|
16518
16551
|
const reuploadIndex = vue.ref(-1);
|
16552
|
+
const isReuploading = vue.ref(false);
|
16519
16553
|
const getDetail = (index = props2.modelValue.length) => ({
|
16520
16554
|
name: props2.name,
|
16521
16555
|
index
|
@@ -16652,8 +16686,15 @@
|
|
16652
16686
|
emit("delete", item, getDetail(index));
|
16653
16687
|
};
|
16654
16688
|
const reuploadImage = (index) => {
|
16655
|
-
|
16689
|
+
isReuploading.value = true;
|
16656
16690
|
reuploadIndex.value = index;
|
16691
|
+
vue.nextTick(() => chooseFile());
|
16692
|
+
};
|
16693
|
+
const onInputClick = () => {
|
16694
|
+
if (!isReuploading.value) {
|
16695
|
+
reuploadIndex.value = -1;
|
16696
|
+
}
|
16697
|
+
isReuploading.value = false;
|
16657
16698
|
};
|
16658
16699
|
const renderPreviewItem = (item, index) => {
|
16659
16700
|
const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
|
@@ -16686,7 +16727,8 @@
|
|
16686
16727
|
"capture": props2.capture,
|
16687
16728
|
"multiple": props2.multiple && reuploadIndex.value === -1,
|
16688
16729
|
"disabled": props2.disabled,
|
16689
|
-
"onChange": onChange
|
16730
|
+
"onChange": onChange,
|
16731
|
+
"onClick": onInputClick
|
16690
16732
|
}, null);
|
16691
16733
|
if (slots.default) {
|
16692
16734
|
return vue.withDirectives(vue.createVNode("div", {
|
@@ -17715,7 +17757,7 @@
|
|
17715
17757
|
});
|
17716
17758
|
}
|
17717
17759
|
};
|
17718
|
-
const version = "4.7.
|
17760
|
+
const version = "4.7.3";
|
17719
17761
|
function install(app) {
|
17720
17762
|
const components = [
|
17721
17763
|
ActionBar,
|