vant 4.0.8 → 4.0.9

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 (46) hide show
  1. package/es/back-top/BackTop.d.ts +4 -0
  2. package/es/back-top/BackTop.mjs +2 -1
  3. package/es/back-top/index.d.ts +3 -0
  4. package/es/calendar/Calendar.mjs +1 -1
  5. package/es/calendar/CalendarMonth.mjs +4 -1
  6. package/es/image-preview/ImagePreview.mjs +13 -3
  7. package/es/image-preview/ImagePreviewItem.d.ts +3 -0
  8. package/es/image-preview/ImagePreviewItem.mjs +21 -9
  9. package/es/index.d.ts +1 -1
  10. package/es/index.mjs +1 -1
  11. package/es/locale/index.d.ts +1 -0
  12. package/es/locale/index.mjs +3 -1
  13. package/es/locale/lang/eo-EO.d.ts +62 -0
  14. package/es/locale/lang/eo-EO.mjs +64 -0
  15. package/es/locale/lang/it-IT.mjs +12 -12
  16. package/es/slider/Slider.d.ts +2 -2
  17. package/es/slider/index.d.ts +2 -2
  18. package/es/swipe/Swipe.d.ts +3 -1
  19. package/es/swipe/Swipe.mjs +10 -2
  20. package/es/swipe/index.d.ts +3 -1
  21. package/lib/back-top/BackTop.d.ts +4 -0
  22. package/lib/back-top/BackTop.js +2 -1
  23. package/lib/back-top/index.d.ts +3 -0
  24. package/lib/calendar/Calendar.js +1 -1
  25. package/lib/calendar/CalendarMonth.js +4 -1
  26. package/lib/image-preview/ImagePreview.js +13 -3
  27. package/lib/image-preview/ImagePreviewItem.d.ts +3 -0
  28. package/lib/image-preview/ImagePreviewItem.js +21 -9
  29. package/lib/index.d.ts +1 -1
  30. package/lib/index.js +1 -1
  31. package/lib/locale/index.d.ts +1 -0
  32. package/lib/locale/index.js +3 -1
  33. package/lib/locale/lang/eo-EO.d.ts +62 -0
  34. package/lib/locale/lang/eo-EO.js +83 -0
  35. package/lib/locale/lang/it-IT.js +12 -12
  36. package/lib/slider/Slider.d.ts +2 -2
  37. package/lib/slider/index.d.ts +2 -2
  38. package/lib/swipe/Swipe.d.ts +3 -1
  39. package/lib/swipe/Swipe.js +10 -2
  40. package/lib/swipe/index.d.ts +3 -1
  41. package/lib/vant.cjs.js +54 -18
  42. package/lib/vant.es.js +54 -18
  43. package/lib/vant.js +54 -18
  44. package/lib/vant.min.js +1 -1
  45. package/lib/web-types.json +1 -1
  46. package/package.json +1 -1
package/lib/vant.cjs.js CHANGED
@@ -314,6 +314,7 @@ const Locale = {
314
314
  deepAssign(messages, newMessages);
315
315
  }
316
316
  };
317
+ const useCurrentLang = () => lang;
317
318
  var stdin_default$1M = Locale;
318
319
  function createTranslate(name2) {
319
320
  const prefix = camelize(name2) + ".";
@@ -2138,7 +2139,7 @@ const SWIPE_KEY = Symbol(name$1l);
2138
2139
  var stdin_default$1w = vue.defineComponent({
2139
2140
  name: name$1l,
2140
2141
  props: swipeProps,
2141
- emits: ["change"],
2142
+ emits: ["change", "dragStart", "dragEnd"],
2142
2143
  setup(props, {
2143
2144
  emit,
2144
2145
  slots
@@ -2153,6 +2154,7 @@ var stdin_default$1w = vue.defineComponent({
2153
2154
  active: 0,
2154
2155
  swiping: false
2155
2156
  });
2157
+ let dragging = false;
2156
2158
  const touch = useTouch();
2157
2159
  const {
2158
2160
  children,
@@ -2323,9 +2325,10 @@ var stdin_default$1w = vue.defineComponent({
2323
2325
  const resize = () => initialize(state.active);
2324
2326
  let touchStartTime;
2325
2327
  const onTouchStart = (event) => {
2326
- if (!props.touchable)
2328
+ if (!props.touchable || event.touches.length > 1)
2327
2329
  return;
2328
2330
  touch.start(event);
2331
+ dragging = false;
2329
2332
  touchStartTime = Date.now();
2330
2333
  stopAutoplay();
2331
2334
  correctPosition();
@@ -2340,6 +2343,10 @@ var stdin_default$1w = vue.defineComponent({
2340
2343
  move({
2341
2344
  offset: delta.value
2342
2345
  });
2346
+ if (!dragging) {
2347
+ emit("dragStart");
2348
+ dragging = true;
2349
+ }
2343
2350
  }
2344
2351
  }
2345
2352
  }
@@ -2368,7 +2375,9 @@ var stdin_default$1w = vue.defineComponent({
2368
2375
  pace: 0
2369
2376
  });
2370
2377
  }
2378
+ dragging = false;
2371
2379
  state.swiping = false;
2380
+ emit("dragEnd");
2372
2381
  autoplay();
2373
2382
  };
2374
2383
  const swipeTo = (index, options = {}) => {
@@ -5589,6 +5598,7 @@ const backTopProps = {
5589
5598
  bottom: numericProp,
5590
5599
  target: [String, Object],
5591
5600
  offset: makeNumericProp(200),
5601
+ immediate: Boolean,
5592
5602
  teleport: {
5593
5603
  type: [String, Object],
5594
5604
  default: "body"
@@ -5616,7 +5626,7 @@ var stdin_default$1b = vue.defineComponent({
5616
5626
  emit("click", event);
5617
5627
  (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5618
5628
  top: 0,
5619
- behavior: "smooth"
5629
+ behavior: props.immediate ? "auto" : "smooth"
5620
5630
  });
5621
5631
  };
5622
5632
  const scroll = () => {
@@ -6002,7 +6012,10 @@ var stdin_default$19 = vue.defineComponent({
6002
6012
  if (props.showMonthTitle) {
6003
6013
  return vue.createVNode("div", {
6004
6014
  "class": bem$Z("month-title")
6005
- }, [title.value]);
6015
+ }, [slots["month-title"] ? slots["month-title"]({
6016
+ date: props.date,
6017
+ text: title.value
6018
+ }) : title.value]);
6006
6019
  }
6007
6020
  };
6008
6021
  const renderMark = () => {
@@ -6448,7 +6461,7 @@ var stdin_default$17 = vue.defineComponent({
6448
6461
  "firstDayOfWeek": dayOffset.value
6449
6462
  }, pick(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
6450
6463
  "onClick": onClickDay
6451
- }), pick(slots, ["top-info", "bottom-info"]));
6464
+ }), pick(slots, ["top-info", "bottom-info", "month-title"]));
6452
6465
  };
6453
6466
  const renderFooterButton = () => {
6454
6467
  if (slots.footer) {
@@ -9535,7 +9548,8 @@ var stdin_default$I = vue.defineComponent({
9535
9548
  minZoom: makeRequiredProp(numericProp),
9536
9549
  maxZoom: makeRequiredProp(numericProp),
9537
9550
  rootWidth: makeRequiredProp(Number),
9538
- rootHeight: makeRequiredProp(Number)
9551
+ rootHeight: makeRequiredProp(Number),
9552
+ disableZoom: Boolean
9539
9553
  },
9540
9554
  emits: ["scale", "close", "longPress"],
9541
9555
  setup(props, {
@@ -9630,18 +9644,23 @@ var stdin_default$I = vue.defineComponent({
9630
9644
  let startDistance;
9631
9645
  let doubleTapTimer;
9632
9646
  let touchStartTime;
9647
+ let isImageMoved = false;
9633
9648
  const onTouchStart = (event) => {
9634
9649
  const {
9635
9650
  touches
9636
9651
  } = event;
9652
+ fingerNum = touches.length;
9653
+ if (fingerNum === 2 && props.disableZoom) {
9654
+ return;
9655
+ }
9637
9656
  const {
9638
9657
  offsetX
9639
9658
  } = touch;
9640
9659
  touch.start(event);
9641
- fingerNum = touches.length;
9642
9660
  startMoveX = state.moveX;
9643
9661
  startMoveY = state.moveY;
9644
9662
  touchStartTime = Date.now();
9663
+ isImageMoved = false;
9645
9664
  state.moving = fingerNum === 1 && state.scale !== 1;
9646
9665
  state.zooming = fingerNum === 2 && !offsetX.value;
9647
9666
  if (state.zooming) {
@@ -9654,9 +9673,6 @@ var stdin_default$I = vue.defineComponent({
9654
9673
  touches
9655
9674
  } = event;
9656
9675
  touch.move(event);
9657
- if (state.moving || state.zooming) {
9658
- preventDefault(event, true);
9659
- }
9660
9676
  if (state.moving) {
9661
9677
  const {
9662
9678
  deltaX,
@@ -9664,13 +9680,22 @@ var stdin_default$I = vue.defineComponent({
9664
9680
  } = touch;
9665
9681
  const moveX = deltaX.value + startMoveX;
9666
9682
  const moveY = deltaY.value + startMoveY;
9683
+ if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
9684
+ state.moving = false;
9685
+ return;
9686
+ }
9687
+ isImageMoved = true;
9688
+ preventDefault(event, true);
9667
9689
  state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
9668
9690
  state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
9669
9691
  }
9670
- if (state.zooming && touches.length === 2) {
9671
- const distance = getDistance(touches);
9672
- const scale = startScale * distance / startDistance;
9673
- setScale(scale);
9692
+ if (state.zooming) {
9693
+ preventDefault(event, true);
9694
+ if (touches.length === 2) {
9695
+ const distance = getDistance(touches);
9696
+ const scale = startScale * distance / startDistance;
9697
+ setScale(scale);
9698
+ }
9674
9699
  }
9675
9700
  };
9676
9701
  const checkTap = () => {
@@ -9780,7 +9805,7 @@ var stdin_default$I = vue.defineComponent({
9780
9805
  }
9781
9806
  });
9782
9807
  const [name$z, bem$y] = createNamespace("image-preview");
9783
- const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
9808
+ const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
9784
9809
  const imagePreviewProps = {
9785
9810
  show: Boolean,
9786
9811
  loop: truthProp,
@@ -9815,7 +9840,8 @@ var stdin_default$H = vue.defineComponent({
9815
9840
  const state = vue.reactive({
9816
9841
  active: 0,
9817
9842
  rootWidth: 0,
9818
- rootHeight: 0
9843
+ rootHeight: 0,
9844
+ disableZoom: false
9819
9845
  });
9820
9846
  const resize = () => {
9821
9847
  if (swipeRef.value) {
@@ -9855,6 +9881,12 @@ var stdin_default$H = vue.defineComponent({
9855
9881
  }, [slots.cover()]);
9856
9882
  }
9857
9883
  };
9884
+ const onDragStart = () => {
9885
+ state.disableZoom = true;
9886
+ };
9887
+ const onDragEnd = () => {
9888
+ state.disableZoom = false;
9889
+ };
9858
9890
  const renderImages = () => vue.createVNode(Swipe, {
9859
9891
  "ref": swipeRef,
9860
9892
  "lazyRender": true,
@@ -9864,7 +9896,9 @@ var stdin_default$H = vue.defineComponent({
9864
9896
  "initialSwipe": props.startPosition,
9865
9897
  "showIndicators": props.showIndicators,
9866
9898
  "indicatorColor": "white",
9867
- "onChange": setActive
9899
+ "onChange": setActive,
9900
+ "onDragEnd": onDragEnd,
9901
+ "onDragStart": onDragStart
9868
9902
  }, {
9869
9903
  default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$I, {
9870
9904
  "src": image,
@@ -9874,6 +9908,7 @@ var stdin_default$H = vue.defineComponent({
9874
9908
  "minZoom": props.minZoom,
9875
9909
  "rootWidth": state.rootWidth,
9876
9910
  "rootHeight": state.rootHeight,
9911
+ "disableZoom": state.disableZoom,
9877
9912
  "onScale": emitScale,
9878
9913
  "onClose": emitClose,
9879
9914
  "onLongPress": () => emit("longPress", {
@@ -14919,7 +14954,7 @@ const Lazyload = {
14919
14954
  });
14920
14955
  }
14921
14956
  };
14922
- const version = "4.0.8";
14957
+ const version = "4.0.9";
14923
14958
  function install(app) {
14924
14959
  const components = [
14925
14960
  ActionBar,
@@ -15232,4 +15267,5 @@ exports.timePickerProps = timePickerProps;
15232
15267
  exports.toastProps = toastProps;
15233
15268
  exports.treeSelectProps = treeSelectProps;
15234
15269
  exports.uploaderProps = uploaderProps;
15270
+ exports.useCurrentLang = useCurrentLang;
15235
15271
  exports.version = version;
package/lib/vant.es.js CHANGED
@@ -312,6 +312,7 @@ const Locale = {
312
312
  deepAssign(messages, newMessages);
313
313
  }
314
314
  };
315
+ const useCurrentLang = () => lang;
315
316
  var stdin_default$1M = Locale;
316
317
  function createTranslate(name2) {
317
318
  const prefix = camelize(name2) + ".";
@@ -2136,7 +2137,7 @@ const SWIPE_KEY = Symbol(name$1l);
2136
2137
  var stdin_default$1w = defineComponent({
2137
2138
  name: name$1l,
2138
2139
  props: swipeProps,
2139
- emits: ["change"],
2140
+ emits: ["change", "dragStart", "dragEnd"],
2140
2141
  setup(props, {
2141
2142
  emit,
2142
2143
  slots
@@ -2151,6 +2152,7 @@ var stdin_default$1w = defineComponent({
2151
2152
  active: 0,
2152
2153
  swiping: false
2153
2154
  });
2155
+ let dragging = false;
2154
2156
  const touch = useTouch();
2155
2157
  const {
2156
2158
  children,
@@ -2321,9 +2323,10 @@ var stdin_default$1w = defineComponent({
2321
2323
  const resize = () => initialize(state.active);
2322
2324
  let touchStartTime;
2323
2325
  const onTouchStart = (event) => {
2324
- if (!props.touchable)
2326
+ if (!props.touchable || event.touches.length > 1)
2325
2327
  return;
2326
2328
  touch.start(event);
2329
+ dragging = false;
2327
2330
  touchStartTime = Date.now();
2328
2331
  stopAutoplay();
2329
2332
  correctPosition();
@@ -2338,6 +2341,10 @@ var stdin_default$1w = defineComponent({
2338
2341
  move({
2339
2342
  offset: delta.value
2340
2343
  });
2344
+ if (!dragging) {
2345
+ emit("dragStart");
2346
+ dragging = true;
2347
+ }
2341
2348
  }
2342
2349
  }
2343
2350
  }
@@ -2366,7 +2373,9 @@ var stdin_default$1w = defineComponent({
2366
2373
  pace: 0
2367
2374
  });
2368
2375
  }
2376
+ dragging = false;
2369
2377
  state.swiping = false;
2378
+ emit("dragEnd");
2370
2379
  autoplay();
2371
2380
  };
2372
2381
  const swipeTo = (index, options = {}) => {
@@ -5587,6 +5596,7 @@ const backTopProps = {
5587
5596
  bottom: numericProp,
5588
5597
  target: [String, Object],
5589
5598
  offset: makeNumericProp(200),
5599
+ immediate: Boolean,
5590
5600
  teleport: {
5591
5601
  type: [String, Object],
5592
5602
  default: "body"
@@ -5614,7 +5624,7 @@ var stdin_default$1b = defineComponent({
5614
5624
  emit("click", event);
5615
5625
  (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5616
5626
  top: 0,
5617
- behavior: "smooth"
5627
+ behavior: props.immediate ? "auto" : "smooth"
5618
5628
  });
5619
5629
  };
5620
5630
  const scroll = () => {
@@ -6000,7 +6010,10 @@ var stdin_default$19 = defineComponent({
6000
6010
  if (props.showMonthTitle) {
6001
6011
  return createVNode("div", {
6002
6012
  "class": bem$Z("month-title")
6003
- }, [title.value]);
6013
+ }, [slots["month-title"] ? slots["month-title"]({
6014
+ date: props.date,
6015
+ text: title.value
6016
+ }) : title.value]);
6004
6017
  }
6005
6018
  };
6006
6019
  const renderMark = () => {
@@ -6446,7 +6459,7 @@ var stdin_default$17 = defineComponent({
6446
6459
  "firstDayOfWeek": dayOffset.value
6447
6460
  }, pick(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
6448
6461
  "onClick": onClickDay
6449
- }), pick(slots, ["top-info", "bottom-info"]));
6462
+ }), pick(slots, ["top-info", "bottom-info", "month-title"]));
6450
6463
  };
6451
6464
  const renderFooterButton = () => {
6452
6465
  if (slots.footer) {
@@ -9533,7 +9546,8 @@ var stdin_default$I = defineComponent({
9533
9546
  minZoom: makeRequiredProp(numericProp),
9534
9547
  maxZoom: makeRequiredProp(numericProp),
9535
9548
  rootWidth: makeRequiredProp(Number),
9536
- rootHeight: makeRequiredProp(Number)
9549
+ rootHeight: makeRequiredProp(Number),
9550
+ disableZoom: Boolean
9537
9551
  },
9538
9552
  emits: ["scale", "close", "longPress"],
9539
9553
  setup(props, {
@@ -9628,18 +9642,23 @@ var stdin_default$I = defineComponent({
9628
9642
  let startDistance;
9629
9643
  let doubleTapTimer;
9630
9644
  let touchStartTime;
9645
+ let isImageMoved = false;
9631
9646
  const onTouchStart = (event) => {
9632
9647
  const {
9633
9648
  touches
9634
9649
  } = event;
9650
+ fingerNum = touches.length;
9651
+ if (fingerNum === 2 && props.disableZoom) {
9652
+ return;
9653
+ }
9635
9654
  const {
9636
9655
  offsetX
9637
9656
  } = touch;
9638
9657
  touch.start(event);
9639
- fingerNum = touches.length;
9640
9658
  startMoveX = state.moveX;
9641
9659
  startMoveY = state.moveY;
9642
9660
  touchStartTime = Date.now();
9661
+ isImageMoved = false;
9643
9662
  state.moving = fingerNum === 1 && state.scale !== 1;
9644
9663
  state.zooming = fingerNum === 2 && !offsetX.value;
9645
9664
  if (state.zooming) {
@@ -9652,9 +9671,6 @@ var stdin_default$I = defineComponent({
9652
9671
  touches
9653
9672
  } = event;
9654
9673
  touch.move(event);
9655
- if (state.moving || state.zooming) {
9656
- preventDefault(event, true);
9657
- }
9658
9674
  if (state.moving) {
9659
9675
  const {
9660
9676
  deltaX,
@@ -9662,13 +9678,22 @@ var stdin_default$I = defineComponent({
9662
9678
  } = touch;
9663
9679
  const moveX = deltaX.value + startMoveX;
9664
9680
  const moveY = deltaY.value + startMoveY;
9681
+ if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
9682
+ state.moving = false;
9683
+ return;
9684
+ }
9685
+ isImageMoved = true;
9686
+ preventDefault(event, true);
9665
9687
  state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
9666
9688
  state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
9667
9689
  }
9668
- if (state.zooming && touches.length === 2) {
9669
- const distance = getDistance(touches);
9670
- const scale = startScale * distance / startDistance;
9671
- setScale(scale);
9690
+ if (state.zooming) {
9691
+ preventDefault(event, true);
9692
+ if (touches.length === 2) {
9693
+ const distance = getDistance(touches);
9694
+ const scale = startScale * distance / startDistance;
9695
+ setScale(scale);
9696
+ }
9672
9697
  }
9673
9698
  };
9674
9699
  const checkTap = () => {
@@ -9778,7 +9803,7 @@ var stdin_default$I = defineComponent({
9778
9803
  }
9779
9804
  });
9780
9805
  const [name$z, bem$y] = createNamespace("image-preview");
9781
- const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
9806
+ const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
9782
9807
  const imagePreviewProps = {
9783
9808
  show: Boolean,
9784
9809
  loop: truthProp,
@@ -9813,7 +9838,8 @@ var stdin_default$H = defineComponent({
9813
9838
  const state = reactive({
9814
9839
  active: 0,
9815
9840
  rootWidth: 0,
9816
- rootHeight: 0
9841
+ rootHeight: 0,
9842
+ disableZoom: false
9817
9843
  });
9818
9844
  const resize = () => {
9819
9845
  if (swipeRef.value) {
@@ -9853,6 +9879,12 @@ var stdin_default$H = defineComponent({
9853
9879
  }, [slots.cover()]);
9854
9880
  }
9855
9881
  };
9882
+ const onDragStart = () => {
9883
+ state.disableZoom = true;
9884
+ };
9885
+ const onDragEnd = () => {
9886
+ state.disableZoom = false;
9887
+ };
9856
9888
  const renderImages = () => createVNode(Swipe, {
9857
9889
  "ref": swipeRef,
9858
9890
  "lazyRender": true,
@@ -9862,7 +9894,9 @@ var stdin_default$H = defineComponent({
9862
9894
  "initialSwipe": props.startPosition,
9863
9895
  "showIndicators": props.showIndicators,
9864
9896
  "indicatorColor": "white",
9865
- "onChange": setActive
9897
+ "onChange": setActive,
9898
+ "onDragEnd": onDragEnd,
9899
+ "onDragStart": onDragStart
9866
9900
  }, {
9867
9901
  default: () => [props.images.map((image, index) => createVNode(stdin_default$I, {
9868
9902
  "src": image,
@@ -9872,6 +9906,7 @@ var stdin_default$H = defineComponent({
9872
9906
  "minZoom": props.minZoom,
9873
9907
  "rootWidth": state.rootWidth,
9874
9908
  "rootHeight": state.rootHeight,
9909
+ "disableZoom": state.disableZoom,
9875
9910
  "onScale": emitScale,
9876
9911
  "onClose": emitClose,
9877
9912
  "onLongPress": () => emit("longPress", {
@@ -14917,7 +14952,7 @@ const Lazyload = {
14917
14952
  });
14918
14953
  }
14919
14954
  };
14920
- const version = "4.0.8";
14955
+ const version = "4.0.9";
14921
14956
  function install(app) {
14922
14957
  const components = [
14923
14958
  ActionBar,
@@ -15231,5 +15266,6 @@ export {
15231
15266
  toastProps,
15232
15267
  treeSelectProps,
15233
15268
  uploaderProps,
15269
+ useCurrentLang,
15234
15270
  version
15235
15271
  };
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 = {}) => {
@@ -5956,6 +5965,7 @@
5956
5965
  bottom: numericProp,
5957
5966
  target: [String, Object],
5958
5967
  offset: makeNumericProp(200),
5968
+ immediate: Boolean,
5959
5969
  teleport: {
5960
5970
  type: [String, Object],
5961
5971
  default: "body"
@@ -5983,7 +5993,7 @@
5983
5993
  emit("click", event);
5984
5994
  (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5985
5995
  top: 0,
5986
- behavior: "smooth"
5996
+ behavior: props.immediate ? "auto" : "smooth"
5987
5997
  });
5988
5998
  };
5989
5999
  const scroll = () => {
@@ -6366,7 +6376,10 @@
6366
6376
  if (props.showMonthTitle) {
6367
6377
  return vue.createVNode("div", {
6368
6378
  "class": bem$Z("month-title")
6369
- }, [title.value]);
6379
+ }, [slots["month-title"] ? slots["month-title"]({
6380
+ date: props.date,
6381
+ text: title.value
6382
+ }) : title.value]);
6370
6383
  }
6371
6384
  };
6372
6385
  const renderMark = () => {
@@ -6812,7 +6825,7 @@
6812
6825
  "firstDayOfWeek": dayOffset.value
6813
6826
  }, pick(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
6814
6827
  "onClick": onClickDay
6815
- }), pick(slots, ["top-info", "bottom-info"]));
6828
+ }), pick(slots, ["top-info", "bottom-info", "month-title"]));
6816
6829
  };
6817
6830
  const renderFooterButton = () => {
6818
6831
  if (slots.footer) {
@@ -9873,7 +9886,8 @@
9873
9886
  minZoom: makeRequiredProp(numericProp),
9874
9887
  maxZoom: makeRequiredProp(numericProp),
9875
9888
  rootWidth: makeRequiredProp(Number),
9876
- rootHeight: makeRequiredProp(Number)
9889
+ rootHeight: makeRequiredProp(Number),
9890
+ disableZoom: Boolean
9877
9891
  },
9878
9892
  emits: ["scale", "close", "longPress"],
9879
9893
  setup(props, {
@@ -9968,18 +9982,23 @@
9968
9982
  let startDistance;
9969
9983
  let doubleTapTimer;
9970
9984
  let touchStartTime;
9985
+ let isImageMoved = false;
9971
9986
  const onTouchStart = (event) => {
9972
9987
  const {
9973
9988
  touches
9974
9989
  } = event;
9990
+ fingerNum = touches.length;
9991
+ if (fingerNum === 2 && props.disableZoom) {
9992
+ return;
9993
+ }
9975
9994
  const {
9976
9995
  offsetX
9977
9996
  } = touch;
9978
9997
  touch.start(event);
9979
- fingerNum = touches.length;
9980
9998
  startMoveX = state.moveX;
9981
9999
  startMoveY = state.moveY;
9982
10000
  touchStartTime = Date.now();
10001
+ isImageMoved = false;
9983
10002
  state.moving = fingerNum === 1 && state.scale !== 1;
9984
10003
  state.zooming = fingerNum === 2 && !offsetX.value;
9985
10004
  if (state.zooming) {
@@ -9992,9 +10011,6 @@
9992
10011
  touches
9993
10012
  } = event;
9994
10013
  touch.move(event);
9995
- if (state.moving || state.zooming) {
9996
- preventDefault(event, true);
9997
- }
9998
10014
  if (state.moving) {
9999
10015
  const {
10000
10016
  deltaX,
@@ -10002,13 +10018,22 @@
10002
10018
  } = touch;
10003
10019
  const moveX = deltaX.value + startMoveX;
10004
10020
  const moveY = deltaY.value + startMoveY;
10021
+ if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
10022
+ state.moving = false;
10023
+ return;
10024
+ }
10025
+ isImageMoved = true;
10026
+ preventDefault(event, true);
10005
10027
  state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
10006
10028
  state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
10007
10029
  }
10008
- if (state.zooming && touches.length === 2) {
10009
- const distance = getDistance(touches);
10010
- const scale = startScale * distance / startDistance;
10011
- setScale(scale);
10030
+ if (state.zooming) {
10031
+ preventDefault(event, true);
10032
+ if (touches.length === 2) {
10033
+ const distance = getDistance(touches);
10034
+ const scale = startScale * distance / startDistance;
10035
+ setScale(scale);
10036
+ }
10012
10037
  }
10013
10038
  };
10014
10039
  const checkTap = () => {
@@ -10118,7 +10143,7 @@
10118
10143
  }
10119
10144
  });
10120
10145
  const [name$z, bem$y] = createNamespace("image-preview");
10121
- const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
10146
+ const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
10122
10147
  const imagePreviewProps = {
10123
10148
  show: Boolean,
10124
10149
  loop: truthProp,
@@ -10153,7 +10178,8 @@
10153
10178
  const state = vue.reactive({
10154
10179
  active: 0,
10155
10180
  rootWidth: 0,
10156
- rootHeight: 0
10181
+ rootHeight: 0,
10182
+ disableZoom: false
10157
10183
  });
10158
10184
  const resize = () => {
10159
10185
  if (swipeRef.value) {
@@ -10193,6 +10219,12 @@
10193
10219
  }, [slots.cover()]);
10194
10220
  }
10195
10221
  };
10222
+ const onDragStart = () => {
10223
+ state.disableZoom = true;
10224
+ };
10225
+ const onDragEnd = () => {
10226
+ state.disableZoom = false;
10227
+ };
10196
10228
  const renderImages = () => vue.createVNode(Swipe, {
10197
10229
  "ref": swipeRef,
10198
10230
  "lazyRender": true,
@@ -10202,7 +10234,9 @@
10202
10234
  "initialSwipe": props.startPosition,
10203
10235
  "showIndicators": props.showIndicators,
10204
10236
  "indicatorColor": "white",
10205
- "onChange": setActive
10237
+ "onChange": setActive,
10238
+ "onDragEnd": onDragEnd,
10239
+ "onDragStart": onDragStart
10206
10240
  }, {
10207
10241
  default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$I, {
10208
10242
  "src": image,
@@ -10212,6 +10246,7 @@
10212
10246
  "minZoom": props.minZoom,
10213
10247
  "rootWidth": state.rootWidth,
10214
10248
  "rootHeight": state.rootHeight,
10249
+ "disableZoom": state.disableZoom,
10215
10250
  "onScale": emitScale,
10216
10251
  "onClose": emitClose,
10217
10252
  "onLongPress": () => emit("longPress", {
@@ -16134,7 +16169,7 @@
16134
16169
  });
16135
16170
  }
16136
16171
  };
16137
- const version = "4.0.8";
16172
+ const version = "4.0.9";
16138
16173
  function install(app) {
16139
16174
  const components = [
16140
16175
  ActionBar,
@@ -16447,6 +16482,7 @@
16447
16482
  exports2.toastProps = toastProps;
16448
16483
  exports2.treeSelectProps = treeSelectProps;
16449
16484
  exports2.uploaderProps = uploaderProps;
16485
+ exports2.useCurrentLang = useCurrentLang;
16450
16486
  exports2.version = version;
16451
16487
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
16452
16488
  });