vant 4.6.4 → 4.6.5

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/lib/index.d.ts CHANGED
@@ -105,4 +105,4 @@ declare namespace _default {
105
105
  }
106
106
  export default _default;
107
107
  export function install(app: any): void;
108
- export const version: "4.6.4";
108
+ export const version: "4.6.5";
package/lib/index.js CHANGED
@@ -224,7 +224,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
224
224
  __reExport(stdin_exports, require("./tree-select"), module.exports);
225
225
  __reExport(stdin_exports, require("./uploader"), module.exports);
226
226
  __reExport(stdin_exports, require("./watermark"), module.exports);
227
- const version = "4.6.4";
227
+ const version = "4.6.5";
228
228
  function install(app) {
229
229
  const components = [
230
230
  import_action_bar.ActionBar,
@@ -79,7 +79,7 @@ export default Toast;
79
79
  export { toastProps } from './Toast';
80
80
  export { showToast, closeToast, showFailToast, showLoadingToast, showSuccessToast, allowMultipleToast, setToastDefaultOptions, resetToastDefaultOptions, } from './function-call';
81
81
  export type { ToastProps } from './Toast';
82
- export type { ToastType, ToastOptions, ToastPosition, ToastThemeVars, ToastWordBreak, } from './types';
82
+ export type { ToastType, ToastOptions, ToastPosition, ToastThemeVars, ToastWordBreak, ToastWrapperInstance, } from './types';
83
83
  declare module 'vue' {
84
84
  interface GlobalComponents {
85
85
  VanToast: typeof Toast;
package/lib/vant.cjs.js CHANGED
@@ -9418,7 +9418,8 @@ const dropdownMenuProps = {
9418
9418
  direction: makeStringProp("down"),
9419
9419
  activeColor: String,
9420
9420
  closeOnClickOutside: truthProp,
9421
- closeOnClickOverlay: truthProp
9421
+ closeOnClickOverlay: truthProp,
9422
+ swipeThreshold: numericProp
9422
9423
  };
9423
9424
  const DROPDOWN_KEY = Symbol(name$K);
9424
9425
  var stdin_default$T = vue.defineComponent({
@@ -9437,6 +9438,7 @@ var stdin_default$T = vue.defineComponent({
9437
9438
  } = use.useChildren(DROPDOWN_KEY);
9438
9439
  const scrollParent = use.useScrollParent(root);
9439
9440
  const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
9441
+ const scrollable = vue.computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
9440
9442
  const barStyle = vue.computed(() => {
9441
9443
  if (opened.value && isDef(props2.zIndex)) {
9442
9444
  return {
@@ -9493,7 +9495,8 @@ var stdin_default$T = vue.defineComponent({
9493
9495
  "role": "button",
9494
9496
  "tabindex": disabled ? void 0 : 0,
9495
9497
  "class": [bem$K("item", {
9496
- disabled
9498
+ disabled,
9499
+ grow: scrollable.value
9497
9500
  }), {
9498
9501
  [HAPTICS_FEEDBACK]: !disabled
9499
9502
  }],
@@ -9537,7 +9540,8 @@ var stdin_default$T = vue.defineComponent({
9537
9540
  "ref": barRef,
9538
9541
  "style": barStyle.value,
9539
9542
  "class": bem$K("bar", {
9540
- opened: opened.value
9543
+ opened: opened.value,
9544
+ scrollable: scrollable.value
9541
9545
  })
9542
9546
  }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
9543
9547
  };
@@ -9736,11 +9740,13 @@ const floatingBubbleProps = {
9736
9740
  const [name$I, bem$I] = createNamespace("floating-bubble");
9737
9741
  var stdin_default$R = vue.defineComponent({
9738
9742
  name: name$I,
9743
+ inheritAttrs: false,
9739
9744
  props: floatingBubbleProps,
9740
9745
  emits: ["click", "update:offset", "offsetChange"],
9741
9746
  setup(props2, {
9742
9747
  slots,
9743
- emit
9748
+ emit,
9749
+ attrs
9744
9750
  }) {
9745
9751
  const rootRef = vue.ref();
9746
9752
  const state = vue.ref({
@@ -9861,7 +9867,7 @@ var stdin_default$R = vue.defineComponent({
9861
9867
  }
9862
9868
  });
9863
9869
  return () => {
9864
- const Content = vue.withDirectives(vue.createVNode("div", {
9870
+ const Content = vue.withDirectives(vue.createVNode("div", vue.mergeProps({
9865
9871
  "class": bem$I(),
9866
9872
  "ref": rootRef,
9867
9873
  "onTouchstartPassive": onTouchStart,
@@ -9869,7 +9875,7 @@ var stdin_default$R = vue.defineComponent({
9869
9875
  "onTouchcancel": onTouchEnd,
9870
9876
  "onClick": onClick,
9871
9877
  "style": rootStyle.value
9872
- }, [slots.default ? slots.default() : vue.createVNode(stdin_default$1P, {
9878
+ }, attrs), [slots.default ? slots.default() : vue.createVNode(stdin_default$1P, {
9873
9879
  "name": props2.icon,
9874
9880
  "class": bem$I("icon")
9875
9881
  }, null)]), [[vue.vShow, show.value]]);
@@ -9887,11 +9893,10 @@ const floatingPanelProps = {
9887
9893
  anchors: makeArrayProp(),
9888
9894
  duration: makeNumericProp(0.2),
9889
9895
  contentDraggable: truthProp,
9890
- lockScroll: truthProp,
9896
+ lockScroll: Boolean,
9891
9897
  safeAreaInsetBottom: truthProp
9892
9898
  };
9893
9899
  const [name$H, bem$H] = createNamespace("floating-panel");
9894
- const DAMP = 0.2;
9895
9900
  var stdin_default$Q = vue.defineComponent({
9896
9901
  name: name$H,
9897
9902
  props: floatingPanelProps,
@@ -9900,6 +9905,7 @@ var stdin_default$Q = vue.defineComponent({
9900
9905
  emit,
9901
9906
  slots
9902
9907
  }) {
9908
+ const DAMP = 0.2;
9903
9909
  const rootRef = vue.ref();
9904
9910
  const contentRef = vue.ref();
9905
9911
  const height = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
@@ -9932,24 +9938,28 @@ var stdin_default$Q = vue.defineComponent({
9932
9938
  return moveY;
9933
9939
  };
9934
9940
  let startY;
9941
+ let maxScroll = -1;
9935
9942
  const touch = useTouch();
9936
9943
  const onTouchstart = (e) => {
9937
9944
  touch.start(e);
9938
9945
  dragging.value = true;
9939
9946
  startY = -height.value;
9947
+ maxScroll = -1;
9940
9948
  };
9941
9949
  const onTouchmove = (e) => {
9942
9950
  var _a;
9943
9951
  touch.move(e);
9944
9952
  const target = e.target;
9945
9953
  if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
9954
+ const {
9955
+ scrollTop
9956
+ } = contentRef.value;
9957
+ maxScroll = Math.max(maxScroll, scrollTop);
9946
9958
  if (!props2.contentDraggable)
9947
9959
  return;
9948
9960
  if (-startY < boundary.value.max) {
9949
- if (e.cancelable)
9950
- e.preventDefault();
9951
- e.stopPropagation();
9952
- } else if (!(contentRef.value.scrollTop <= 0 && touch.deltaY.value > 0)) {
9961
+ preventDefault(e, true);
9962
+ } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
9953
9963
  return;
9954
9964
  }
9955
9965
  }
@@ -9957,6 +9967,7 @@ var stdin_default$Q = vue.defineComponent({
9957
9967
  height.value = -ease(moveY);
9958
9968
  };
9959
9969
  const onTouchend = () => {
9970
+ maxScroll = -1;
9960
9971
  dragging.value = false;
9961
9972
  height.value = closest(anchors.value, height.value);
9962
9973
  if (height.value !== -startY) {
@@ -16398,7 +16409,7 @@ const Lazyload = {
16398
16409
  });
16399
16410
  }
16400
16411
  };
16401
- const version = "4.6.4";
16412
+ const version = "4.6.5";
16402
16413
  function install(app) {
16403
16414
  const components = [
16404
16415
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -9416,7 +9416,8 @@ const dropdownMenuProps = {
9416
9416
  direction: makeStringProp("down"),
9417
9417
  activeColor: String,
9418
9418
  closeOnClickOutside: truthProp,
9419
- closeOnClickOverlay: truthProp
9419
+ closeOnClickOverlay: truthProp,
9420
+ swipeThreshold: numericProp
9420
9421
  };
9421
9422
  const DROPDOWN_KEY = Symbol(name$K);
9422
9423
  var stdin_default$T = defineComponent({
@@ -9435,6 +9436,7 @@ var stdin_default$T = defineComponent({
9435
9436
  } = useChildren(DROPDOWN_KEY);
9436
9437
  const scrollParent = useScrollParent(root);
9437
9438
  const opened = computed(() => children.some((item) => item.state.showWrapper));
9439
+ const scrollable = computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
9438
9440
  const barStyle = computed(() => {
9439
9441
  if (opened.value && isDef(props2.zIndex)) {
9440
9442
  return {
@@ -9491,7 +9493,8 @@ var stdin_default$T = defineComponent({
9491
9493
  "role": "button",
9492
9494
  "tabindex": disabled ? void 0 : 0,
9493
9495
  "class": [bem$K("item", {
9494
- disabled
9496
+ disabled,
9497
+ grow: scrollable.value
9495
9498
  }), {
9496
9499
  [HAPTICS_FEEDBACK]: !disabled
9497
9500
  }],
@@ -9535,7 +9538,8 @@ var stdin_default$T = defineComponent({
9535
9538
  "ref": barRef,
9536
9539
  "style": barStyle.value,
9537
9540
  "class": bem$K("bar", {
9538
- opened: opened.value
9541
+ opened: opened.value,
9542
+ scrollable: scrollable.value
9539
9543
  })
9540
9544
  }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
9541
9545
  };
@@ -9734,11 +9738,13 @@ const floatingBubbleProps = {
9734
9738
  const [name$I, bem$I] = createNamespace("floating-bubble");
9735
9739
  var stdin_default$R = defineComponent({
9736
9740
  name: name$I,
9741
+ inheritAttrs: false,
9737
9742
  props: floatingBubbleProps,
9738
9743
  emits: ["click", "update:offset", "offsetChange"],
9739
9744
  setup(props2, {
9740
9745
  slots,
9741
- emit
9746
+ emit,
9747
+ attrs
9742
9748
  }) {
9743
9749
  const rootRef = ref();
9744
9750
  const state = ref({
@@ -9859,7 +9865,7 @@ var stdin_default$R = defineComponent({
9859
9865
  }
9860
9866
  });
9861
9867
  return () => {
9862
- const Content = withDirectives(createVNode("div", {
9868
+ const Content = withDirectives(createVNode("div", mergeProps({
9863
9869
  "class": bem$I(),
9864
9870
  "ref": rootRef,
9865
9871
  "onTouchstartPassive": onTouchStart,
@@ -9867,7 +9873,7 @@ var stdin_default$R = defineComponent({
9867
9873
  "onTouchcancel": onTouchEnd,
9868
9874
  "onClick": onClick,
9869
9875
  "style": rootStyle.value
9870
- }, [slots.default ? slots.default() : createVNode(stdin_default$1P, {
9876
+ }, attrs), [slots.default ? slots.default() : createVNode(stdin_default$1P, {
9871
9877
  "name": props2.icon,
9872
9878
  "class": bem$I("icon")
9873
9879
  }, null)]), [[vShow, show.value]]);
@@ -9885,11 +9891,10 @@ const floatingPanelProps = {
9885
9891
  anchors: makeArrayProp(),
9886
9892
  duration: makeNumericProp(0.2),
9887
9893
  contentDraggable: truthProp,
9888
- lockScroll: truthProp,
9894
+ lockScroll: Boolean,
9889
9895
  safeAreaInsetBottom: truthProp
9890
9896
  };
9891
9897
  const [name$H, bem$H] = createNamespace("floating-panel");
9892
- const DAMP = 0.2;
9893
9898
  var stdin_default$Q = defineComponent({
9894
9899
  name: name$H,
9895
9900
  props: floatingPanelProps,
@@ -9898,6 +9903,7 @@ var stdin_default$Q = defineComponent({
9898
9903
  emit,
9899
9904
  slots
9900
9905
  }) {
9906
+ const DAMP = 0.2;
9901
9907
  const rootRef = ref();
9902
9908
  const contentRef = ref();
9903
9909
  const height = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
@@ -9930,24 +9936,28 @@ var stdin_default$Q = defineComponent({
9930
9936
  return moveY;
9931
9937
  };
9932
9938
  let startY;
9939
+ let maxScroll = -1;
9933
9940
  const touch = useTouch();
9934
9941
  const onTouchstart = (e) => {
9935
9942
  touch.start(e);
9936
9943
  dragging.value = true;
9937
9944
  startY = -height.value;
9945
+ maxScroll = -1;
9938
9946
  };
9939
9947
  const onTouchmove = (e) => {
9940
9948
  var _a;
9941
9949
  touch.move(e);
9942
9950
  const target = e.target;
9943
9951
  if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
9952
+ const {
9953
+ scrollTop
9954
+ } = contentRef.value;
9955
+ maxScroll = Math.max(maxScroll, scrollTop);
9944
9956
  if (!props2.contentDraggable)
9945
9957
  return;
9946
9958
  if (-startY < boundary.value.max) {
9947
- if (e.cancelable)
9948
- e.preventDefault();
9949
- e.stopPropagation();
9950
- } else if (!(contentRef.value.scrollTop <= 0 && touch.deltaY.value > 0)) {
9959
+ preventDefault(e, true);
9960
+ } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
9951
9961
  return;
9952
9962
  }
9953
9963
  }
@@ -9955,6 +9965,7 @@ var stdin_default$Q = defineComponent({
9955
9965
  height.value = -ease(moveY);
9956
9966
  };
9957
9967
  const onTouchend = () => {
9968
+ maxScroll = -1;
9958
9969
  dragging.value = false;
9959
9970
  height.value = closest(anchors.value, height.value);
9960
9971
  if (height.value !== -startY) {
@@ -16396,7 +16407,7 @@ const Lazyload = {
16396
16407
  });
16397
16408
  }
16398
16409
  };
16399
- const version = "4.6.4";
16410
+ const version = "4.6.5";
16400
16411
  function install(app) {
16401
16412
  const components = [
16402
16413
  ActionBar,
package/lib/vant.js CHANGED
@@ -9854,7 +9854,8 @@
9854
9854
  direction: makeStringProp("down"),
9855
9855
  activeColor: String,
9856
9856
  closeOnClickOutside: truthProp,
9857
- closeOnClickOverlay: truthProp
9857
+ closeOnClickOverlay: truthProp,
9858
+ swipeThreshold: numericProp
9858
9859
  };
9859
9860
  const DROPDOWN_KEY = Symbol(name$K);
9860
9861
  var stdin_default$T = vue.defineComponent({
@@ -9873,6 +9874,7 @@
9873
9874
  } = useChildren(DROPDOWN_KEY);
9874
9875
  const scrollParent = useScrollParent(root);
9875
9876
  const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
9877
+ const scrollable = vue.computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
9876
9878
  const barStyle = vue.computed(() => {
9877
9879
  if (opened.value && isDef(props2.zIndex)) {
9878
9880
  return {
@@ -9929,7 +9931,8 @@
9929
9931
  "role": "button",
9930
9932
  "tabindex": disabled ? void 0 : 0,
9931
9933
  "class": [bem$K("item", {
9932
- disabled
9934
+ disabled,
9935
+ grow: scrollable.value
9933
9936
  }), {
9934
9937
  [HAPTICS_FEEDBACK]: !disabled
9935
9938
  }],
@@ -9973,7 +9976,8 @@
9973
9976
  "ref": barRef,
9974
9977
  "style": barStyle.value,
9975
9978
  "class": bem$K("bar", {
9976
- opened: opened.value
9979
+ opened: opened.value,
9980
+ scrollable: scrollable.value
9977
9981
  })
9978
9982
  }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
9979
9983
  };
@@ -10169,11 +10173,13 @@
10169
10173
  const [name$I, bem$I] = createNamespace("floating-bubble");
10170
10174
  var stdin_default$R = vue.defineComponent({
10171
10175
  name: name$I,
10176
+ inheritAttrs: false,
10172
10177
  props: floatingBubbleProps,
10173
10178
  emits: ["click", "update:offset", "offsetChange"],
10174
10179
  setup(props2, {
10175
10180
  slots,
10176
- emit
10181
+ emit,
10182
+ attrs
10177
10183
  }) {
10178
10184
  const rootRef = vue.ref();
10179
10185
  const state = vue.ref({
@@ -10294,7 +10300,7 @@
10294
10300
  }
10295
10301
  });
10296
10302
  return () => {
10297
- const Content = vue.withDirectives(vue.createVNode("div", {
10303
+ const Content = vue.withDirectives(vue.createVNode("div", vue.mergeProps({
10298
10304
  "class": bem$I(),
10299
10305
  "ref": rootRef,
10300
10306
  "onTouchstartPassive": onTouchStart,
@@ -10302,7 +10308,7 @@
10302
10308
  "onTouchcancel": onTouchEnd,
10303
10309
  "onClick": onClick,
10304
10310
  "style": rootStyle.value
10305
- }, [slots.default ? slots.default() : vue.createVNode(stdin_default$1P, {
10311
+ }, attrs), [slots.default ? slots.default() : vue.createVNode(stdin_default$1P, {
10306
10312
  "name": props2.icon,
10307
10313
  "class": bem$I("icon")
10308
10314
  }, null)]), [[vue.vShow, show.value]]);
@@ -10320,11 +10326,10 @@
10320
10326
  anchors: makeArrayProp(),
10321
10327
  duration: makeNumericProp(0.2),
10322
10328
  contentDraggable: truthProp,
10323
- lockScroll: truthProp,
10329
+ lockScroll: Boolean,
10324
10330
  safeAreaInsetBottom: truthProp
10325
10331
  };
10326
10332
  const [name$H, bem$H] = createNamespace("floating-panel");
10327
- const DAMP = 0.2;
10328
10333
  var stdin_default$Q = vue.defineComponent({
10329
10334
  name: name$H,
10330
10335
  props: floatingPanelProps,
@@ -10333,6 +10338,7 @@
10333
10338
  emit,
10334
10339
  slots
10335
10340
  }) {
10341
+ const DAMP = 0.2;
10336
10342
  const rootRef = vue.ref();
10337
10343
  const contentRef = vue.ref();
10338
10344
  const height2 = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
@@ -10365,24 +10371,28 @@
10365
10371
  return moveY;
10366
10372
  };
10367
10373
  let startY;
10374
+ let maxScroll = -1;
10368
10375
  const touch = useTouch();
10369
10376
  const onTouchstart = (e) => {
10370
10377
  touch.start(e);
10371
10378
  dragging.value = true;
10372
10379
  startY = -height2.value;
10380
+ maxScroll = -1;
10373
10381
  };
10374
10382
  const onTouchmove = (e) => {
10375
10383
  var _a;
10376
10384
  touch.move(e);
10377
10385
  const target = e.target;
10378
10386
  if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
10387
+ const {
10388
+ scrollTop
10389
+ } = contentRef.value;
10390
+ maxScroll = Math.max(maxScroll, scrollTop);
10379
10391
  if (!props2.contentDraggable)
10380
10392
  return;
10381
10393
  if (-startY < boundary.value.max) {
10382
- if (e.cancelable)
10383
- e.preventDefault();
10384
- e.stopPropagation();
10385
- } else if (!(contentRef.value.scrollTop <= 0 && touch.deltaY.value > 0)) {
10394
+ preventDefault(e, true);
10395
+ } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
10386
10396
  return;
10387
10397
  }
10388
10398
  }
@@ -10390,6 +10400,7 @@
10390
10400
  height2.value = -ease(moveY);
10391
10401
  };
10392
10402
  const onTouchend = () => {
10403
+ maxScroll = -1;
10393
10404
  dragging.value = false;
10394
10405
  height2.value = closest(anchors.value, height2.value);
10395
10406
  if (height2.value !== -startY) {
@@ -17608,7 +17619,7 @@
17608
17619
  });
17609
17620
  }
17610
17621
  };
17611
- const version = "4.6.4";
17622
+ const version = "4.6.5";
17612
17623
  function install(app) {
17613
17624
  const components = [
17614
17625
  ActionBar,