vant 4.7.0 → 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.
Files changed (58) hide show
  1. package/README.md +4 -1
  2. package/es/cell-group/CellGroup.mjs +2 -1
  3. package/es/composables/use-scope-id.d.ts +3 -0
  4. package/es/composables/use-scope-id.mjs +9 -0
  5. package/es/dialog/function-call.d.ts +15 -0
  6. package/es/floating-panel/FloatingPanel.mjs +2 -2
  7. package/es/floating-panel/index.css +1 -1
  8. package/es/icon/index.css +1 -1
  9. package/es/image-preview/ImagePreview.d.ts +13 -0
  10. package/es/image-preview/ImagePreview.mjs +2 -0
  11. package/es/image-preview/ImagePreviewItem.d.ts +3 -0
  12. package/es/image-preview/ImagePreviewItem.mjs +16 -11
  13. package/es/image-preview/function-call.d.ts +3 -0
  14. package/es/image-preview/function-call.mjs +1 -0
  15. package/es/image-preview/index.d.ts +9 -0
  16. package/es/image-preview/types.d.ts +1 -0
  17. package/es/index.d.ts +1 -1
  18. package/es/index.mjs +1 -1
  19. package/es/notify/function-call.d.ts +12 -0
  20. package/es/popover/Popover.mjs +2 -1
  21. package/es/popup/Popup.mjs +7 -5
  22. package/es/signature/Signature.mjs +34 -36
  23. package/es/swipe/Swipe.mjs +1 -1
  24. package/es/swipe/index.css +1 -1
  25. package/es/toast/function-call.d.ts +26 -0
  26. package/es/uploader/Uploader.mjs +12 -3
  27. package/lib/cell-group/CellGroup.js +2 -1
  28. package/lib/composables/use-scope-id.d.ts +3 -0
  29. package/lib/composables/use-scope-id.js +28 -0
  30. package/lib/dialog/function-call.d.ts +15 -0
  31. package/lib/floating-panel/FloatingPanel.js +2 -2
  32. package/lib/floating-panel/index.css +1 -1
  33. package/lib/icon/index.css +1 -1
  34. package/lib/image-preview/ImagePreview.d.ts +13 -0
  35. package/lib/image-preview/ImagePreview.js +2 -0
  36. package/lib/image-preview/ImagePreviewItem.d.ts +3 -0
  37. package/lib/image-preview/ImagePreviewItem.js +16 -11
  38. package/lib/image-preview/function-call.d.ts +3 -0
  39. package/lib/image-preview/function-call.js +1 -0
  40. package/lib/image-preview/index.d.ts +9 -0
  41. package/lib/image-preview/types.d.ts +1 -0
  42. package/lib/index.css +1 -1
  43. package/lib/index.d.ts +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/notify/function-call.d.ts +12 -0
  46. package/lib/popover/Popover.js +2 -1
  47. package/lib/popup/Popup.js +6 -4
  48. package/lib/signature/Signature.js +33 -35
  49. package/lib/swipe/Swipe.js +1 -1
  50. package/lib/swipe/index.css +1 -1
  51. package/lib/toast/function-call.d.ts +26 -0
  52. package/lib/uploader/Uploader.js +11 -2
  53. package/lib/vant.cjs.js +79 -58
  54. package/lib/vant.es.js +79 -58
  55. package/lib/vant.js +79 -58
  56. package/lib/vant.min.js +1 -1
  57. package/lib/web-types.json +1 -1
  58. package/package.json +2 -2
package/lib/vant.es.js CHANGED
@@ -1248,6 +1248,11 @@ function useLazyRender(show) {
1248
1248
  );
1249
1249
  return (render) => () => inited.value ? render() : null;
1250
1250
  }
1251
+ const useScopeId = () => {
1252
+ var _a;
1253
+ const { scopeId } = ((_a = getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
1254
+ return scopeId ? { [scopeId]: "" } : null;
1255
+ };
1251
1256
  const [name$1B, bem$1w] = createNamespace("overlay");
1252
1257
  const overlayProps = {
1253
1258
  show: Boolean,
@@ -1359,16 +1364,17 @@ var stdin_default$1J = defineComponent({
1359
1364
  };
1360
1365
  const renderOverlay = () => {
1361
1366
  if (props2.overlay) {
1362
- return createVNode(Overlay, {
1367
+ return createVNode(Overlay, mergeProps({
1363
1368
  "show": props2.show,
1364
1369
  "class": props2.overlayClass,
1365
1370
  "zIndex": zIndex.value,
1366
1371
  "duration": props2.duration,
1367
1372
  "customStyle": props2.overlayStyle,
1368
1373
  "role": props2.closeOnClickOverlay ? "button" : void 0,
1369
- "tabindex": props2.closeOnClickOverlay ? 0 : void 0,
1374
+ "tabindex": props2.closeOnClickOverlay ? 0 : void 0
1375
+ }, useScopeId(), {
1370
1376
  "onClick": onClickOverlay
1371
- }, {
1377
+ }), {
1372
1378
  default: slots["overlay-content"]
1373
1379
  });
1374
1380
  }
@@ -1420,7 +1426,7 @@ var stdin_default$1J = defineComponent({
1420
1426
  "van-safe-area-bottom": safeAreaInsetBottom
1421
1427
  }],
1422
1428
  "onKeydown": onKeydown
1423
- }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vShow, props2.show]]);
1429
+ }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vShow, props2.show]]);
1424
1430
  });
1425
1431
  const renderTransition = () => {
1426
1432
  const {
@@ -2220,7 +2226,7 @@ var stdin_default$1E = defineComponent({
2220
2226
  const trackStyle = computed(() => {
2221
2227
  const style = {
2222
2228
  transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
2223
- transform: `translate${props2.vertical ? "Y" : "X"}(${state.offset}px)`
2229
+ transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
2224
2230
  };
2225
2231
  if (size.value) {
2226
2232
  const mainAxis = props2.vertical ? "height" : "width";
@@ -7451,7 +7457,7 @@ var stdin_default$1a = defineComponent({
7451
7457
  }), {
7452
7458
  [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
7453
7459
  }]
7454
- }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7460
+ }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7455
7461
  };
7456
7462
  const renderTitle = () => createVNode("div", {
7457
7463
  "class": bem$10("title", {
@@ -9952,7 +9958,7 @@ const FloatingBubble = withInstall(stdin_default$R);
9952
9958
  const floatingPanelProps = {
9953
9959
  height: makeNumericProp(0),
9954
9960
  anchors: makeArrayProp(),
9955
- duration: makeNumericProp(0.2),
9961
+ duration: makeNumericProp(0.3),
9956
9962
  contentDraggable: truthProp,
9957
9963
  lockScroll: Boolean,
9958
9964
  safeAreaInsetBottom: truthProp
@@ -9982,7 +9988,7 @@ var stdin_default$Q = defineComponent({
9982
9988
  const rootStyle = computed(() => ({
9983
9989
  height: addUnit(boundary.value.max),
9984
9990
  transform: `translateY(calc(100% + ${addUnit(-height.value)}))`,
9985
- transition: !dragging.value ? `transform ${props2.duration}s` : "none"
9991
+ transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
9986
9992
  }));
9987
9993
  const ease = (moveY) => {
9988
9994
  const absDistance = Math.abs(moveY);
@@ -10260,6 +10266,7 @@ var stdin_default$N = defineComponent({
10260
10266
  rootWidth: makeRequiredProp(Number),
10261
10267
  rootHeight: makeRequiredProp(Number),
10262
10268
  disableZoom: Boolean,
10269
+ doubleScale: Boolean,
10263
10270
  closeOnClickOverlay: Boolean
10264
10271
  },
10265
10272
  emits: ["scale", "close", "longPress"],
@@ -10433,18 +10440,22 @@ var stdin_default$N = defineComponent({
10433
10440
  const TAP_TIME = 250;
10434
10441
  if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
10435
10442
  if (deltaTime < TAP_TIME) {
10436
- if (doubleTapTimer) {
10437
- clearTimeout(doubleTapTimer);
10438
- doubleTapTimer = null;
10439
- toggleScale();
10440
- } else {
10441
- if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
10442
- return;
10443
- }
10444
- doubleTapTimer = setTimeout(() => {
10445
- emit("close");
10443
+ if (props2.doubleScale) {
10444
+ if (doubleTapTimer) {
10445
+ clearTimeout(doubleTapTimer);
10446
10446
  doubleTapTimer = null;
10447
- }, TAP_TIME);
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");
10454
+ doubleTapTimer = null;
10455
+ }, TAP_TIME);
10456
+ }
10457
+ } else {
10458
+ emit("close");
10448
10459
  }
10449
10460
  } else if (deltaTime > LONG_PRESS_START_TIME) {
10450
10461
  emit("longPress");
@@ -10569,6 +10580,7 @@ const imagePreviewProps = {
10569
10580
  closeIcon: makeStringProp("clear"),
10570
10581
  transition: String,
10571
10582
  beforeClose: Function,
10583
+ doubleScale: truthProp,
10572
10584
  overlayClass: unknownProp,
10573
10585
  overlayStyle: Object,
10574
10586
  swipeDuration: makeNumericProp(300),
@@ -10660,6 +10672,7 @@ var stdin_default$M = defineComponent({
10660
10672
  "rootWidth": state.rootWidth,
10661
10673
  "rootHeight": state.rootHeight,
10662
10674
  "disableZoom": state.disableZoom,
10675
+ "doubleScale": props2.doubleScale,
10663
10676
  "closeOnClickOverlay": props2.closeOnClickOverlay,
10664
10677
  "onScale": emitScale,
10665
10678
  "onClose": emitClose,
@@ -10737,6 +10750,7 @@ const defaultConfig = {
10737
10750
  closeIcon: "clear",
10738
10751
  transition: void 0,
10739
10752
  beforeClose: void 0,
10753
+ doubleScale: true,
10740
10754
  overlayStyle: void 0,
10741
10755
  overlayClass: void 0,
10742
10756
  startPosition: 0,
@@ -12265,7 +12279,7 @@ var stdin_default$B = defineComponent({
12265
12279
  "transition": "van-popover-zoom",
12266
12280
  "lockScroll": false,
12267
12281
  "onUpdate:show": updateShow
12268
- }, attrs, pick(props2, popupProps)), {
12282
+ }, attrs, useScopeId(), pick(props2, popupProps)), {
12269
12283
  default: () => [props2.showArrow && createVNode("div", {
12270
12284
  "class": bem$s("arrow")
12271
12285
  }, null), createVNode("div", {
@@ -13227,37 +13241,37 @@ var stdin_default$r = defineComponent({
13227
13241
  }) {
13228
13242
  const canvasRef = ref();
13229
13243
  const wrapRef = ref();
13230
- const state = reactive({
13231
- width: 0,
13232
- height: 0,
13233
- ctx: null,
13234
- ratio: inBrowser ? window.devicePixelRatio : 1
13244
+ const ctx = computed(() => {
13245
+ if (!canvasRef.value)
13246
+ return null;
13247
+ return canvasRef.value.getContext("2d");
13235
13248
  });
13236
- let canvasRect;
13237
13249
  const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
13250
+ let canvasWidth = 0;
13251
+ let canvasHeight = 0;
13252
+ let canvasRect;
13238
13253
  const touchStart = () => {
13239
- if (!state.ctx) {
13254
+ if (!ctx.value) {
13240
13255
  return false;
13241
13256
  }
13242
- state.ctx.beginPath();
13243
- state.ctx.lineWidth = props2.lineWidth * state.ratio;
13244
- state.ctx.strokeStyle = props2.penColor;
13257
+ ctx.value.beginPath();
13258
+ ctx.value.lineWidth = props2.lineWidth;
13259
+ ctx.value.strokeStyle = props2.penColor;
13245
13260
  canvasRect = useRect(canvasRef);
13246
13261
  emit("start");
13247
13262
  };
13248
13263
  const touchMove = (event) => {
13249
- var _a, _b;
13250
- if (!state.ctx) {
13264
+ if (!ctx.value) {
13251
13265
  return false;
13252
13266
  }
13253
13267
  preventDefault(event);
13254
13268
  const touch = event.touches[0];
13255
- const mouseX = (touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0)) * state.ratio;
13256
- const mouseY = (touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0)) * state.ratio;
13257
- state.ctx.lineCap = "round";
13258
- state.ctx.lineJoin = "round";
13259
- (_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
13260
- (_b = state.ctx) == null ? void 0 : _b.stroke();
13269
+ const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
13270
+ const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
13271
+ ctx.value.lineCap = "round";
13272
+ ctx.value.lineJoin = "round";
13273
+ ctx.value.lineTo(mouseX, mouseY);
13274
+ ctx.value.stroke();
13261
13275
  emit("signing", event);
13262
13276
  };
13263
13277
  const touchEnd = (event) => {
@@ -13274,10 +13288,10 @@ var stdin_default$r = defineComponent({
13274
13288
  }
13275
13289
  return canvas.toDataURL() === empty.toDataURL();
13276
13290
  };
13277
- const setCanvasBgColor = (ctx) => {
13278
- if (ctx && props2.backgroundColor) {
13279
- ctx.fillStyle = props2.backgroundColor;
13280
- ctx.fillRect(0, 0, state.width, state.height);
13291
+ const setCanvasBgColor = (ctx2) => {
13292
+ if (ctx2 && props2.backgroundColor) {
13293
+ ctx2.fillStyle = props2.backgroundColor;
13294
+ ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
13281
13295
  }
13282
13296
  };
13283
13297
  const submit = () => {
@@ -13297,22 +13311,22 @@ var stdin_default$r = defineComponent({
13297
13311
  });
13298
13312
  };
13299
13313
  const clear = () => {
13300
- if (state.ctx) {
13301
- state.ctx.clearRect(0, 0, state.width, state.height);
13302
- state.ctx.closePath();
13303
- setCanvasBgColor(state.ctx);
13314
+ if (ctx.value) {
13315
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13316
+ ctx.value.closePath();
13317
+ setCanvasBgColor(ctx.value);
13304
13318
  }
13305
13319
  emit("clear");
13306
13320
  };
13307
13321
  onMounted(() => {
13308
13322
  var _a, _b, _c;
13309
- if (isRenderCanvas) {
13310
- state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
13311
- state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
13312
- state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
13313
- nextTick(() => {
13314
- setCanvasBgColor(state.ctx);
13315
- });
13323
+ if (isRenderCanvas && canvasRef.value) {
13324
+ const canvas = canvasRef.value;
13325
+ const dpr = inBrowser ? window.devicePixelRatio : 1;
13326
+ canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
13327
+ canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
13328
+ (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
13329
+ setCanvasBgColor(ctx.value);
13316
13330
  }
13317
13331
  });
13318
13332
  return () => createVNode("div", {
@@ -13322,8 +13336,6 @@ var stdin_default$r = defineComponent({
13322
13336
  "ref": wrapRef
13323
13337
  }, [isRenderCanvas ? createVNode("canvas", {
13324
13338
  "ref": canvasRef,
13325
- "width": state.width,
13326
- "height": state.height,
13327
13339
  "onTouchstartPassive": touchStart,
13328
13340
  "onTouchmove": touchMove,
13329
13341
  "onTouchend": touchEnd
@@ -15281,6 +15293,7 @@ var stdin_default$5 = defineComponent({
15281
15293
  const inputRef = ref();
15282
15294
  const urls = [];
15283
15295
  const reuploadIndex = ref(-1);
15296
+ const isReuploading = ref(false);
15284
15297
  const getDetail = (index = props2.modelValue.length) => ({
15285
15298
  name: props2.name,
15286
15299
  index
@@ -15417,8 +15430,15 @@ var stdin_default$5 = defineComponent({
15417
15430
  emit("delete", item, getDetail(index));
15418
15431
  };
15419
15432
  const reuploadImage = (index) => {
15420
- chooseFile();
15433
+ isReuploading.value = true;
15421
15434
  reuploadIndex.value = index;
15435
+ nextTick(() => chooseFile());
15436
+ };
15437
+ const onInputClick = () => {
15438
+ if (!isReuploading.value) {
15439
+ reuploadIndex.value = -1;
15440
+ }
15441
+ isReuploading.value = false;
15422
15442
  };
15423
15443
  const renderPreviewItem = (item, index) => {
15424
15444
  const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
@@ -15451,7 +15471,8 @@ var stdin_default$5 = defineComponent({
15451
15471
  "capture": props2.capture,
15452
15472
  "multiple": props2.multiple && reuploadIndex.value === -1,
15453
15473
  "disabled": props2.disabled,
15454
- "onChange": onChange
15474
+ "onChange": onChange,
15475
+ "onClick": onInputClick
15455
15476
  }, null);
15456
15477
  if (slots.default) {
15457
15478
  return withDirectives(createVNode("div", {
@@ -16497,7 +16518,7 @@ const Lazyload = {
16497
16518
  });
16498
16519
  }
16499
16520
  };
16500
- const version = "4.7.0";
16521
+ const version = "4.7.2";
16501
16522
  function install(app) {
16502
16523
  const components = [
16503
16524
  ActionBar,
package/lib/vant.js CHANGED
@@ -1638,6 +1638,11 @@
1638
1638
  );
1639
1639
  return (render) => () => inited.value ? render() : null;
1640
1640
  }
1641
+ const useScopeId = () => {
1642
+ var _a;
1643
+ const { scopeId } = ((_a = vue.getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
1644
+ return scopeId ? { [scopeId]: "" } : null;
1645
+ };
1641
1646
  const [name$1B, bem$1w] = createNamespace("overlay");
1642
1647
  const overlayProps = {
1643
1648
  show: Boolean,
@@ -1749,16 +1754,17 @@
1749
1754
  };
1750
1755
  const renderOverlay = () => {
1751
1756
  if (props2.overlay) {
1752
- return vue.createVNode(Overlay, {
1757
+ return vue.createVNode(Overlay, vue.mergeProps({
1753
1758
  "show": props2.show,
1754
1759
  "class": props2.overlayClass,
1755
1760
  "zIndex": zIndex.value,
1756
1761
  "duration": props2.duration,
1757
1762
  "customStyle": props2.overlayStyle,
1758
1763
  "role": props2.closeOnClickOverlay ? "button" : void 0,
1759
- "tabindex": props2.closeOnClickOverlay ? 0 : void 0,
1764
+ "tabindex": props2.closeOnClickOverlay ? 0 : void 0
1765
+ }, useScopeId(), {
1760
1766
  "onClick": onClickOverlay
1761
- }, {
1767
+ }), {
1762
1768
  default: slots["overlay-content"]
1763
1769
  });
1764
1770
  }
@@ -1810,7 +1816,7 @@
1810
1816
  "van-safe-area-bottom": safeAreaInsetBottom
1811
1817
  }],
1812
1818
  "onKeydown": onKeydown
1813
- }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
1819
+ }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
1814
1820
  });
1815
1821
  const renderTransition = () => {
1816
1822
  const {
@@ -2687,7 +2693,7 @@
2687
2693
  const trackStyle = vue.computed(() => {
2688
2694
  const style = {
2689
2695
  transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
2690
- transform: `translate${props2.vertical ? "Y" : "X"}(${state.offset}px)`
2696
+ transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
2691
2697
  };
2692
2698
  if (size.value) {
2693
2699
  const mainAxis = props2.vertical ? "height" : "width";
@@ -7909,7 +7915,7 @@
7909
7915
  }), {
7910
7916
  [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
7911
7917
  }]
7912
- }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7918
+ }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7913
7919
  };
7914
7920
  const renderTitle = () => vue.createVNode("div", {
7915
7921
  "class": bem$10("title", {
@@ -10387,7 +10393,7 @@
10387
10393
  const floatingPanelProps = {
10388
10394
  height: makeNumericProp(0),
10389
10395
  anchors: makeArrayProp(),
10390
- duration: makeNumericProp(0.2),
10396
+ duration: makeNumericProp(0.3),
10391
10397
  contentDraggable: truthProp,
10392
10398
  lockScroll: Boolean,
10393
10399
  safeAreaInsetBottom: truthProp
@@ -10417,7 +10423,7 @@
10417
10423
  const rootStyle = vue.computed(() => ({
10418
10424
  height: addUnit(boundary.value.max),
10419
10425
  transform: `translateY(calc(100% + ${addUnit(-height2.value)}))`,
10420
- transition: !dragging.value ? `transform ${props2.duration}s` : "none"
10426
+ transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
10421
10427
  }));
10422
10428
  const ease = (moveY) => {
10423
10429
  const absDistance = Math.abs(moveY);
@@ -10692,6 +10698,7 @@
10692
10698
  rootWidth: makeRequiredProp(Number),
10693
10699
  rootHeight: makeRequiredProp(Number),
10694
10700
  disableZoom: Boolean,
10701
+ doubleScale: Boolean,
10695
10702
  closeOnClickOverlay: Boolean
10696
10703
  },
10697
10704
  emits: ["scale", "close", "longPress"],
@@ -10865,18 +10872,22 @@
10865
10872
  const TAP_TIME = 250;
10866
10873
  if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
10867
10874
  if (deltaTime < TAP_TIME) {
10868
- if (doubleTapTimer) {
10869
- clearTimeout(doubleTapTimer);
10870
- doubleTapTimer = null;
10871
- toggleScale();
10872
- } else {
10873
- if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
10874
- return;
10875
- }
10876
- doubleTapTimer = setTimeout(() => {
10877
- emit("close");
10875
+ if (props2.doubleScale) {
10876
+ if (doubleTapTimer) {
10877
+ clearTimeout(doubleTapTimer);
10878
10878
  doubleTapTimer = null;
10879
- }, TAP_TIME);
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");
10880
10891
  }
10881
10892
  } else if (deltaTime > LONG_PRESS_START_TIME) {
10882
10893
  emit("longPress");
@@ -11001,6 +11012,7 @@
11001
11012
  closeIcon: makeStringProp("clear"),
11002
11013
  transition: String,
11003
11014
  beforeClose: Function,
11015
+ doubleScale: truthProp,
11004
11016
  overlayClass: unknownProp,
11005
11017
  overlayStyle: Object,
11006
11018
  swipeDuration: makeNumericProp(300),
@@ -11092,6 +11104,7 @@
11092
11104
  "rootWidth": state.rootWidth,
11093
11105
  "rootHeight": state.rootHeight,
11094
11106
  "disableZoom": state.disableZoom,
11107
+ "doubleScale": props2.doubleScale,
11095
11108
  "closeOnClickOverlay": props2.closeOnClickOverlay,
11096
11109
  "onScale": emitScale,
11097
11110
  "onClose": emitClose,
@@ -11169,6 +11182,7 @@
11169
11182
  closeIcon: "clear",
11170
11183
  transition: void 0,
11171
11184
  beforeClose: void 0,
11185
+ doubleScale: true,
11172
11186
  overlayStyle: void 0,
11173
11187
  overlayClass: void 0,
11174
11188
  startPosition: 0,
@@ -13506,7 +13520,7 @@
13506
13520
  "transition": "van-popover-zoom",
13507
13521
  "lockScroll": false,
13508
13522
  "onUpdate:show": updateShow
13509
- }, attrs, pick(props2, popupProps)), {
13523
+ }, attrs, useScopeId(), pick(props2, popupProps)), {
13510
13524
  default: () => [props2.showArrow && vue.createVNode("div", {
13511
13525
  "class": bem$s("arrow")
13512
13526
  }, null), vue.createVNode("div", {
@@ -14465,37 +14479,37 @@
14465
14479
  }) {
14466
14480
  const canvasRef = vue.ref();
14467
14481
  const wrapRef = vue.ref();
14468
- const state = vue.reactive({
14469
- width: 0,
14470
- height: 0,
14471
- ctx: null,
14472
- ratio: inBrowser$1 ? window.devicePixelRatio : 1
14482
+ const ctx = vue.computed(() => {
14483
+ if (!canvasRef.value)
14484
+ return null;
14485
+ return canvasRef.value.getContext("2d");
14473
14486
  });
14474
- let canvasRect;
14475
14487
  const isRenderCanvas = inBrowser$1 ? hasCanvasSupport() : true;
14488
+ let canvasWidth = 0;
14489
+ let canvasHeight = 0;
14490
+ let canvasRect;
14476
14491
  const touchStart = () => {
14477
- if (!state.ctx) {
14492
+ if (!ctx.value) {
14478
14493
  return false;
14479
14494
  }
14480
- state.ctx.beginPath();
14481
- state.ctx.lineWidth = props2.lineWidth * state.ratio;
14482
- state.ctx.strokeStyle = props2.penColor;
14495
+ ctx.value.beginPath();
14496
+ ctx.value.lineWidth = props2.lineWidth;
14497
+ ctx.value.strokeStyle = props2.penColor;
14483
14498
  canvasRect = useRect(canvasRef);
14484
14499
  emit("start");
14485
14500
  };
14486
14501
  const touchMove = (event) => {
14487
- var _a, _b;
14488
- if (!state.ctx) {
14502
+ if (!ctx.value) {
14489
14503
  return false;
14490
14504
  }
14491
14505
  preventDefault(event);
14492
14506
  const touch = event.touches[0];
14493
- const mouseX = (touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0)) * state.ratio;
14494
- const mouseY = (touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0)) * state.ratio;
14495
- state.ctx.lineCap = "round";
14496
- state.ctx.lineJoin = "round";
14497
- (_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
14498
- (_b = state.ctx) == null ? void 0 : _b.stroke();
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();
14499
14513
  emit("signing", event);
14500
14514
  };
14501
14515
  const touchEnd = (event) => {
@@ -14512,10 +14526,10 @@
14512
14526
  }
14513
14527
  return canvas.toDataURL() === empty.toDataURL();
14514
14528
  };
14515
- const setCanvasBgColor = (ctx) => {
14516
- if (ctx && props2.backgroundColor) {
14517
- ctx.fillStyle = props2.backgroundColor;
14518
- ctx.fillRect(0, 0, state.width, state.height);
14529
+ const setCanvasBgColor = (ctx2) => {
14530
+ if (ctx2 && props2.backgroundColor) {
14531
+ ctx2.fillStyle = props2.backgroundColor;
14532
+ ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
14519
14533
  }
14520
14534
  };
14521
14535
  const submit = () => {
@@ -14535,22 +14549,22 @@
14535
14549
  });
14536
14550
  };
14537
14551
  const clear = () => {
14538
- if (state.ctx) {
14539
- state.ctx.clearRect(0, 0, state.width, state.height);
14540
- state.ctx.closePath();
14541
- setCanvasBgColor(state.ctx);
14552
+ if (ctx.value) {
14553
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
14554
+ ctx.value.closePath();
14555
+ setCanvasBgColor(ctx.value);
14542
14556
  }
14543
14557
  emit("clear");
14544
14558
  };
14545
14559
  vue.onMounted(() => {
14546
14560
  var _a, _b, _c;
14547
- if (isRenderCanvas) {
14548
- state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
14549
- state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
14550
- state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
14551
- vue.nextTick(() => {
14552
- setCanvasBgColor(state.ctx);
14553
- });
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);
14554
14568
  }
14555
14569
  });
14556
14570
  return () => vue.createVNode("div", {
@@ -14560,8 +14574,6 @@
14560
14574
  "ref": wrapRef
14561
14575
  }, [isRenderCanvas ? vue.createVNode("canvas", {
14562
14576
  "ref": canvasRef,
14563
- "width": state.width,
14564
- "height": state.height,
14565
14577
  "onTouchstartPassive": touchStart,
14566
14578
  "onTouchmove": touchMove,
14567
14579
  "onTouchend": touchEnd
@@ -16510,6 +16522,7 @@
16510
16522
  const inputRef = vue.ref();
16511
16523
  const urls = [];
16512
16524
  const reuploadIndex = vue.ref(-1);
16525
+ const isReuploading = vue.ref(false);
16513
16526
  const getDetail = (index = props2.modelValue.length) => ({
16514
16527
  name: props2.name,
16515
16528
  index
@@ -16646,8 +16659,15 @@
16646
16659
  emit("delete", item, getDetail(index));
16647
16660
  };
16648
16661
  const reuploadImage = (index) => {
16649
- chooseFile();
16662
+ isReuploading.value = true;
16650
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;
16651
16671
  };
16652
16672
  const renderPreviewItem = (item, index) => {
16653
16673
  const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
@@ -16680,7 +16700,8 @@
16680
16700
  "capture": props2.capture,
16681
16701
  "multiple": props2.multiple && reuploadIndex.value === -1,
16682
16702
  "disabled": props2.disabled,
16683
- "onChange": onChange
16703
+ "onChange": onChange,
16704
+ "onClick": onInputClick
16684
16705
  }, null);
16685
16706
  if (slots.default) {
16686
16707
  return vue.withDirectives(vue.createVNode("div", {
@@ -17709,7 +17730,7 @@
17709
17730
  });
17710
17731
  }
17711
17732
  };
17712
- const version = "4.7.0";
17733
+ const version = "4.7.2";
17713
17734
  function install(app) {
17714
17735
  const components = [
17715
17736
  ActionBar,