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.cjs.js
CHANGED
@@ -2610,6 +2610,7 @@ const tabsProps = {
|
|
2610
2610
|
offsetTop: makeNumericProp(0),
|
2611
2611
|
background: String,
|
2612
2612
|
lazyRender: truthProp,
|
2613
|
+
showHeader: truthProp,
|
2613
2614
|
lineWidth: numericProp,
|
2614
2615
|
lineHeight: numericProp,
|
2615
2616
|
beforeChange: Function,
|
@@ -2911,13 +2912,13 @@ var stdin_default$1C = vue.defineComponent({
|
|
2911
2912
|
return () => vue.createVNode("div", {
|
2912
2913
|
"ref": root,
|
2913
2914
|
"class": bem$1o([props2.type])
|
2914
|
-
}, [props2.sticky ? vue.createVNode(Sticky, {
|
2915
|
+
}, [props2.showHeader ? props2.sticky ? vue.createVNode(Sticky, {
|
2915
2916
|
"container": root.value,
|
2916
2917
|
"offsetTop": offsetTopPx.value,
|
2917
2918
|
"onScroll": onStickyScroll
|
2918
2919
|
}, {
|
2919
2920
|
default: () => [renderHeader()]
|
2920
|
-
}) : renderHeader(), vue.createVNode(stdin_default$1D, {
|
2921
|
+
}) : renderHeader() : null, vue.createVNode(stdin_default$1D, {
|
2921
2922
|
"ref": contentRef,
|
2922
2923
|
"count": children.length,
|
2923
2924
|
"inited": state.inited,
|
@@ -3264,8 +3265,8 @@ var stdin_default$1z = vue.defineComponent({
|
|
3264
3265
|
};
|
3265
3266
|
const onCancel = () => emit("cancel");
|
3266
3267
|
return () => {
|
3267
|
-
var _a;
|
3268
|
-
const childNodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
3268
|
+
var _a, _b;
|
3269
|
+
const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
|
3269
3270
|
const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
|
3270
3271
|
return vue.createVNode("div", {
|
3271
3272
|
"class": bem$1k()
|
@@ -3655,13 +3656,16 @@ const cellSharedProps = {
|
|
3655
3656
|
center: Boolean,
|
3656
3657
|
isLink: Boolean,
|
3657
3658
|
border: truthProp,
|
3658
|
-
required: Boolean,
|
3659
3659
|
iconPrefix: String,
|
3660
3660
|
valueClass: unknownProp,
|
3661
3661
|
labelClass: unknownProp,
|
3662
3662
|
titleClass: unknownProp,
|
3663
3663
|
titleStyle: null,
|
3664
3664
|
arrowDirection: String,
|
3665
|
+
required: {
|
3666
|
+
type: [Boolean, String],
|
3667
|
+
default: null
|
3668
|
+
},
|
3665
3669
|
clickable: {
|
3666
3670
|
type: Boolean,
|
3667
3671
|
default: null
|
@@ -3742,7 +3746,7 @@ var stdin_default$1w = vue.defineComponent({
|
|
3742
3746
|
const clickable = (_a = props2.clickable) != null ? _a : isLink;
|
3743
3747
|
const classes = {
|
3744
3748
|
center,
|
3745
|
-
required,
|
3749
|
+
required: !!required,
|
3746
3750
|
clickable,
|
3747
3751
|
borderless: !border
|
3748
3752
|
};
|
@@ -3769,6 +3773,7 @@ const formProps = {
|
|
3769
3773
|
colon: Boolean,
|
3770
3774
|
disabled: Boolean,
|
3771
3775
|
readonly: Boolean,
|
3776
|
+
required: [Boolean, String],
|
3772
3777
|
showError: Boolean,
|
3773
3778
|
labelWidth: numericProp,
|
3774
3779
|
labelAlign: String,
|
@@ -4024,12 +4029,12 @@ const fieldSharedProps = {
|
|
4024
4029
|
autocorrect: String,
|
4025
4030
|
errorMessage: String,
|
4026
4031
|
enterkeyhint: String,
|
4032
|
+
clearTrigger: makeStringProp("focus"),
|
4033
|
+
formatTrigger: makeStringProp("onChange"),
|
4027
4034
|
spellcheck: {
|
4028
4035
|
type: Boolean,
|
4029
4036
|
default: null
|
4030
4037
|
},
|
4031
|
-
clearTrigger: makeStringProp("focus"),
|
4032
|
-
formatTrigger: makeStringProp("onChange"),
|
4033
4038
|
error: {
|
4034
4039
|
type: Boolean,
|
4035
4040
|
default: null
|
@@ -4105,6 +4110,14 @@ var stdin_default$1u = vue.defineComponent({
|
|
4105
4110
|
}
|
4106
4111
|
return props2.modelValue;
|
4107
4112
|
});
|
4113
|
+
const showRequiredMark = vue.computed(() => {
|
4114
|
+
var _a;
|
4115
|
+
const required = getProp("required");
|
4116
|
+
if (required === "auto") {
|
4117
|
+
return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
|
4118
|
+
}
|
4119
|
+
return required;
|
4120
|
+
});
|
4108
4121
|
const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
|
4109
4122
|
if (state.status === "failed") {
|
4110
4123
|
return;
|
@@ -4507,7 +4520,7 @@ var stdin_default$1u = vue.defineComponent({
|
|
4507
4520
|
"titleStyle": labelStyle.value,
|
4508
4521
|
"valueClass": bem$1g("value"),
|
4509
4522
|
"titleClass": [bem$1g("label", [labelAlign, {
|
4510
|
-
required:
|
4523
|
+
required: showRequiredMark.value
|
4511
4524
|
}]), props2.labelClass],
|
4512
4525
|
"arrowDirection": props2.arrowDirection
|
4513
4526
|
}, {
|
@@ -5171,7 +5184,7 @@ var stdin_default$1q = vue.defineComponent({
|
|
5171
5184
|
"label": t$i("area"),
|
5172
5185
|
"is-link": !disableArea,
|
5173
5186
|
"modelValue": areaText.value,
|
5174
|
-
"rules": rules.value.areaCode,
|
5187
|
+
"rules": props2.showArea ? rules.value.areaCode : void 0,
|
5175
5188
|
"placeholder": props2.areaPlaceholder || t$i("area"),
|
5176
5189
|
"onFocus": () => onFocus("areaCode"),
|
5177
5190
|
"onClick": () => {
|
@@ -10268,6 +10281,7 @@ var stdin_default$N = vue.defineComponent({
|
|
10268
10281
|
rootWidth: makeRequiredProp(Number),
|
10269
10282
|
rootHeight: makeRequiredProp(Number),
|
10270
10283
|
disableZoom: Boolean,
|
10284
|
+
doubleScale: Boolean,
|
10271
10285
|
closeOnClickOverlay: Boolean
|
10272
10286
|
},
|
10273
10287
|
emits: ["scale", "close", "longPress"],
|
@@ -10441,18 +10455,22 @@ var stdin_default$N = vue.defineComponent({
|
|
10441
10455
|
const TAP_TIME = 250;
|
10442
10456
|
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
|
10443
10457
|
if (deltaTime < TAP_TIME) {
|
10444
|
-
if (
|
10445
|
-
|
10446
|
-
|
10447
|
-
toggleScale();
|
10448
|
-
} else {
|
10449
|
-
if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
|
10450
|
-
return;
|
10451
|
-
}
|
10452
|
-
doubleTapTimer = setTimeout(() => {
|
10453
|
-
emit("close");
|
10458
|
+
if (props2.doubleScale) {
|
10459
|
+
if (doubleTapTimer) {
|
10460
|
+
clearTimeout(doubleTapTimer);
|
10454
10461
|
doubleTapTimer = null;
|
10455
|
-
|
10462
|
+
toggleScale();
|
10463
|
+
} else {
|
10464
|
+
if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
|
10465
|
+
return;
|
10466
|
+
}
|
10467
|
+
doubleTapTimer = setTimeout(() => {
|
10468
|
+
emit("close");
|
10469
|
+
doubleTapTimer = null;
|
10470
|
+
}, TAP_TIME);
|
10471
|
+
}
|
10472
|
+
} else {
|
10473
|
+
emit("close");
|
10456
10474
|
}
|
10457
10475
|
} else if (deltaTime > LONG_PRESS_START_TIME) {
|
10458
10476
|
emit("longPress");
|
@@ -10577,6 +10595,7 @@ const imagePreviewProps = {
|
|
10577
10595
|
closeIcon: makeStringProp("clear"),
|
10578
10596
|
transition: String,
|
10579
10597
|
beforeClose: Function,
|
10598
|
+
doubleScale: truthProp,
|
10580
10599
|
overlayClass: unknownProp,
|
10581
10600
|
overlayStyle: Object,
|
10582
10601
|
swipeDuration: makeNumericProp(300),
|
@@ -10668,6 +10687,7 @@ var stdin_default$M = vue.defineComponent({
|
|
10668
10687
|
"rootWidth": state.rootWidth,
|
10669
10688
|
"rootHeight": state.rootHeight,
|
10670
10689
|
"disableZoom": state.disableZoom,
|
10690
|
+
"doubleScale": props2.doubleScale,
|
10671
10691
|
"closeOnClickOverlay": props2.closeOnClickOverlay,
|
10672
10692
|
"onScale": emitScale,
|
10673
10693
|
"onClose": emitClose,
|
@@ -10745,6 +10765,7 @@ const defaultConfig = {
|
|
10745
10765
|
closeIcon: "clear",
|
10746
10766
|
transition: void 0,
|
10747
10767
|
beforeClose: void 0,
|
10768
|
+
doubleScale: true,
|
10748
10769
|
overlayStyle: void 0,
|
10749
10770
|
overlayClass: void 0,
|
10750
10771
|
startPosition: 0,
|
@@ -12964,7 +12985,9 @@ var stdin_default$v = vue.defineComponent({
|
|
12964
12985
|
return vue.createVNode(Field, vue.mergeProps({
|
12965
12986
|
"ref": fieldRef,
|
12966
12987
|
"type": "search",
|
12967
|
-
"class": bem$m("field"
|
12988
|
+
"class": bem$m("field", {
|
12989
|
+
"with-message": fieldAttrs.errorMessage
|
12990
|
+
}),
|
12968
12991
|
"border": false,
|
12969
12992
|
"onBlur": onBlur,
|
12970
12993
|
"onFocus": onFocus,
|
@@ -13235,37 +13258,37 @@ var stdin_default$r = vue.defineComponent({
|
|
13235
13258
|
}) {
|
13236
13259
|
const canvasRef = vue.ref();
|
13237
13260
|
const wrapRef = vue.ref();
|
13238
|
-
const
|
13239
|
-
|
13240
|
-
|
13241
|
-
|
13242
|
-
ratio: inBrowser ? window.devicePixelRatio : 1
|
13261
|
+
const ctx = vue.computed(() => {
|
13262
|
+
if (!canvasRef.value)
|
13263
|
+
return null;
|
13264
|
+
return canvasRef.value.getContext("2d");
|
13243
13265
|
});
|
13244
|
-
let canvasRect;
|
13245
13266
|
const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
|
13267
|
+
let canvasWidth = 0;
|
13268
|
+
let canvasHeight = 0;
|
13269
|
+
let canvasRect;
|
13246
13270
|
const touchStart = () => {
|
13247
|
-
if (!
|
13271
|
+
if (!ctx.value) {
|
13248
13272
|
return false;
|
13249
13273
|
}
|
13250
|
-
|
13251
|
-
|
13252
|
-
|
13274
|
+
ctx.value.beginPath();
|
13275
|
+
ctx.value.lineWidth = props2.lineWidth;
|
13276
|
+
ctx.value.strokeStyle = props2.penColor;
|
13253
13277
|
canvasRect = use.useRect(canvasRef);
|
13254
13278
|
emit("start");
|
13255
13279
|
};
|
13256
13280
|
const touchMove = (event) => {
|
13257
|
-
|
13258
|
-
if (!state.ctx) {
|
13281
|
+
if (!ctx.value) {
|
13259
13282
|
return false;
|
13260
13283
|
}
|
13261
13284
|
preventDefault(event);
|
13262
13285
|
const touch = event.touches[0];
|
13263
|
-
const mouseX =
|
13264
|
-
const mouseY =
|
13265
|
-
|
13266
|
-
|
13267
|
-
|
13268
|
-
|
13286
|
+
const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
|
13287
|
+
const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
|
13288
|
+
ctx.value.lineCap = "round";
|
13289
|
+
ctx.value.lineJoin = "round";
|
13290
|
+
ctx.value.lineTo(mouseX, mouseY);
|
13291
|
+
ctx.value.stroke();
|
13269
13292
|
emit("signing", event);
|
13270
13293
|
};
|
13271
13294
|
const touchEnd = (event) => {
|
@@ -13282,10 +13305,10 @@ var stdin_default$r = vue.defineComponent({
|
|
13282
13305
|
}
|
13283
13306
|
return canvas.toDataURL() === empty.toDataURL();
|
13284
13307
|
};
|
13285
|
-
const setCanvasBgColor = (
|
13286
|
-
if (
|
13287
|
-
|
13288
|
-
|
13308
|
+
const setCanvasBgColor = (ctx2) => {
|
13309
|
+
if (ctx2 && props2.backgroundColor) {
|
13310
|
+
ctx2.fillStyle = props2.backgroundColor;
|
13311
|
+
ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
|
13289
13312
|
}
|
13290
13313
|
};
|
13291
13314
|
const submit = () => {
|
@@ -13305,23 +13328,35 @@ var stdin_default$r = vue.defineComponent({
|
|
13305
13328
|
});
|
13306
13329
|
};
|
13307
13330
|
const clear = () => {
|
13308
|
-
if (
|
13309
|
-
|
13310
|
-
|
13311
|
-
setCanvasBgColor(
|
13331
|
+
if (ctx.value) {
|
13332
|
+
ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
|
13333
|
+
ctx.value.closePath();
|
13334
|
+
setCanvasBgColor(ctx.value);
|
13312
13335
|
}
|
13313
13336
|
emit("clear");
|
13314
13337
|
};
|
13315
|
-
|
13338
|
+
const initialize = () => {
|
13316
13339
|
var _a, _b, _c;
|
13317
|
-
if (isRenderCanvas) {
|
13318
|
-
|
13319
|
-
|
13320
|
-
|
13321
|
-
|
13322
|
-
|
13323
|
-
|
13340
|
+
if (isRenderCanvas && canvasRef.value) {
|
13341
|
+
const canvas = canvasRef.value;
|
13342
|
+
const dpr = inBrowser ? window.devicePixelRatio : 1;
|
13343
|
+
canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
|
13344
|
+
canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
|
13345
|
+
(_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
|
13346
|
+
setCanvasBgColor(ctx.value);
|
13324
13347
|
}
|
13348
|
+
};
|
13349
|
+
const resize = () => {
|
13350
|
+
if (ctx.value) {
|
13351
|
+
const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
|
13352
|
+
initialize();
|
13353
|
+
ctx.value.putImageData(data, 0, 0);
|
13354
|
+
}
|
13355
|
+
};
|
13356
|
+
vue.watch(windowWidth, resize);
|
13357
|
+
vue.onMounted(initialize);
|
13358
|
+
useExpose({
|
13359
|
+
resize
|
13325
13360
|
});
|
13326
13361
|
return () => vue.createVNode("div", {
|
13327
13362
|
"class": bem$i()
|
@@ -13330,8 +13365,6 @@ var stdin_default$r = vue.defineComponent({
|
|
13330
13365
|
"ref": wrapRef
|
13331
13366
|
}, [isRenderCanvas ? vue.createVNode("canvas", {
|
13332
13367
|
"ref": canvasRef,
|
13333
|
-
"width": state.width,
|
13334
|
-
"height": state.height,
|
13335
13368
|
"onTouchstartPassive": touchStart,
|
13336
13369
|
"onTouchmove": touchMove,
|
13337
13370
|
"onTouchend": touchEnd
|
@@ -15289,6 +15322,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
15289
15322
|
const inputRef = vue.ref();
|
15290
15323
|
const urls = [];
|
15291
15324
|
const reuploadIndex = vue.ref(-1);
|
15325
|
+
const isReuploading = vue.ref(false);
|
15292
15326
|
const getDetail = (index = props2.modelValue.length) => ({
|
15293
15327
|
name: props2.name,
|
15294
15328
|
index
|
@@ -15425,8 +15459,15 @@ var stdin_default$5 = vue.defineComponent({
|
|
15425
15459
|
emit("delete", item, getDetail(index));
|
15426
15460
|
};
|
15427
15461
|
const reuploadImage = (index) => {
|
15428
|
-
|
15462
|
+
isReuploading.value = true;
|
15429
15463
|
reuploadIndex.value = index;
|
15464
|
+
vue.nextTick(() => chooseFile());
|
15465
|
+
};
|
15466
|
+
const onInputClick = () => {
|
15467
|
+
if (!isReuploading.value) {
|
15468
|
+
reuploadIndex.value = -1;
|
15469
|
+
}
|
15470
|
+
isReuploading.value = false;
|
15430
15471
|
};
|
15431
15472
|
const renderPreviewItem = (item, index) => {
|
15432
15473
|
const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
|
@@ -15459,7 +15500,8 @@ var stdin_default$5 = vue.defineComponent({
|
|
15459
15500
|
"capture": props2.capture,
|
15460
15501
|
"multiple": props2.multiple && reuploadIndex.value === -1,
|
15461
15502
|
"disabled": props2.disabled,
|
15462
|
-
"onChange": onChange
|
15503
|
+
"onChange": onChange,
|
15504
|
+
"onClick": onInputClick
|
15463
15505
|
}, null);
|
15464
15506
|
if (slots.default) {
|
15465
15507
|
return vue.withDirectives(vue.createVNode("div", {
|
@@ -16505,7 +16547,7 @@ const Lazyload = {
|
|
16505
16547
|
});
|
16506
16548
|
}
|
16507
16549
|
};
|
16508
|
-
const version = "4.7.
|
16550
|
+
const version = "4.7.3";
|
16509
16551
|
function install(app) {
|
16510
16552
|
const components = [
|
16511
16553
|
ActionBar,
|