vant 4.9.17 → 4.9.19

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 (48) hide show
  1. package/README.md +2 -0
  2. package/es/button/index.css +1 -1
  3. package/es/dialog/Dialog.d.ts +4 -0
  4. package/es/dialog/Dialog.mjs +3 -2
  5. package/es/dialog/function-call.mjs +2 -1
  6. package/es/dialog/index.d.ts +3 -0
  7. package/es/dialog/types.d.ts +2 -0
  8. package/es/floating-bubble/FloatingBubble.d.ts +5 -5
  9. package/es/floating-bubble/FloatingBubble.mjs +14 -9
  10. package/es/floating-bubble/index.d.ts +3 -3
  11. package/es/floating-bubble/types.d.ts +4 -0
  12. package/es/index.d.ts +1 -1
  13. package/es/index.mjs +1 -1
  14. package/es/overlay/Overlay.mjs +5 -3
  15. package/es/picker/Picker.mjs +2 -1
  16. package/es/picker/utils.mjs +1 -1
  17. package/es/signature/Signature.mjs +3 -2
  18. package/es/swipe-cell/SwipeCell.mjs +4 -4
  19. package/es/tabbar-item/TabbarItem.mjs +1 -1
  20. package/es/tabs/Tabs.mjs +2 -3
  21. package/es/watermark/Watermark.mjs +15 -18
  22. package/lib/button/index.css +1 -1
  23. package/lib/dialog/Dialog.d.ts +4 -0
  24. package/lib/dialog/Dialog.js +3 -2
  25. package/lib/dialog/function-call.js +2 -1
  26. package/lib/dialog/index.d.ts +3 -0
  27. package/lib/dialog/types.d.ts +2 -0
  28. package/lib/floating-bubble/FloatingBubble.d.ts +5 -5
  29. package/lib/floating-bubble/FloatingBubble.js +13 -8
  30. package/lib/floating-bubble/index.d.ts +3 -3
  31. package/lib/floating-bubble/types.d.ts +4 -0
  32. package/lib/index.css +1 -1
  33. package/lib/index.d.ts +1 -1
  34. package/lib/index.js +1 -1
  35. package/lib/overlay/Overlay.js +4 -2
  36. package/lib/picker/Picker.js +2 -1
  37. package/lib/picker/utils.js +1 -1
  38. package/lib/signature/Signature.js +3 -2
  39. package/lib/swipe-cell/SwipeCell.js +4 -4
  40. package/lib/tabbar-item/TabbarItem.js +1 -1
  41. package/lib/tabs/Tabs.js +2 -3
  42. package/lib/vant.cjs.js +51 -44
  43. package/lib/vant.es.js +53 -46
  44. package/lib/vant.js +68 -62
  45. package/lib/vant.min.js +2 -2
  46. package/lib/watermark/Watermark.js +14 -17
  47. package/lib/web-types.json +1 -1
  48. package/package.json +9 -9
package/lib/vant.js CHANGED
@@ -147,7 +147,7 @@
147
147
  if ((0, __WEBPACK_EXTERNAL_MODULE_vue____namespace.isVNode)(child)) {
148
148
  var _child_component;
149
149
  result.push(child);
150
- if (null === (_child_component = child.component) || void 0 === _child_component ? void 0 : _child_component.subTree) {
150
+ if (null == (_child_component = child.component) ? void 0 : _child_component.subTree) {
151
151
  result.push(child.component.subTree);
152
152
  traverse(child.component.subTree.children);
153
153
  }
@@ -239,11 +239,11 @@
239
239
  const setRemain = (value) => {
240
240
  var _options_onChange;
241
241
  remain.value = value;
242
- null === (_options_onChange = options.onChange) || void 0 === _options_onChange || _options_onChange.call(options, current2.value);
242
+ null == (_options_onChange = options.onChange) || _options_onChange.call(options, current2.value);
243
243
  if (0 === value) {
244
244
  var _options_onFinish;
245
245
  pause();
246
- null === (_options_onFinish = options.onFinish) || void 0 === _options_onFinish || _options_onFinish.call(options);
246
+ null == (_options_onFinish = options.onFinish) || _options_onFinish.call(options);
247
247
  }
248
248
  };
249
249
  const microTick = () => {
@@ -1656,8 +1656,10 @@
1656
1656
  };
1657
1657
  var stdin_default$1L = __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent({
1658
1658
  name: name$1C,
1659
+ inheritAttrs: false,
1659
1660
  props: overlayProps,
1660
1661
  setup(props2, {
1662
+ attrs,
1661
1663
  slots
1662
1664
  }) {
1663
1665
  const root = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
@@ -1673,11 +1675,11 @@
1673
1675
  if (isDef(props2.duration)) {
1674
1676
  style.animationDuration = `${props2.duration}s`;
1675
1677
  }
1676
- return __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives(__WEBPACK_EXTERNAL_MODULE_vue__.createVNode("div", {
1678
+ return __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives(__WEBPACK_EXTERNAL_MODULE_vue__.createVNode("div", __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps({
1677
1679
  "ref": root,
1678
1680
  "style": style,
1679
1681
  "class": [bem$1x(), props2.className]
1680
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[__WEBPACK_EXTERNAL_MODULE_vue__.vShow, props2.show]]);
1682
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[__WEBPACK_EXTERNAL_MODULE_vue__.vShow, props2.show]]);
1681
1683
  });
1682
1684
  useEventListener("touchmove", onTouchMove, {
1683
1685
  target: root
@@ -2060,7 +2062,7 @@
2060
2062
  }
2061
2063
  return 0;
2062
2064
  }
2063
- const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
2065
+ const isOptionExist = (options, value, fields) => value !== void 0 && options.some((option) => option[fields.value] === value);
2064
2066
  function findOptionByValue(options, value, fields) {
2065
2067
  const index = options.findIndex((option) => option[fields.value] === value);
2066
2068
  const enabledIndex = findIndexOfEnabledOption(options, index);
@@ -2482,7 +2484,7 @@
2482
2484
  setScrollTop(scroller, current2);
2483
2485
  if (isDown && current2 < to || !isDown && current2 > to) {
2484
2486
  rafId = raf(animate);
2485
- } else {
2487
+ } else if (callback) {
2486
2488
  rafId = raf(callback);
2487
2489
  }
2488
2490
  }
@@ -3243,9 +3245,8 @@
3243
3245
  }
3244
3246
  };
3245
3247
  const setCurrentIndexByName = (name2, skipScrollIntoView) => {
3246
- const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
3247
- const index = matched ? children.indexOf(matched) : 0;
3248
- setCurrentIndex(index, skipScrollIntoView);
3248
+ const index = children.findIndex((tab, index2) => getTabName(tab, index2) === name2);
3249
+ setCurrentIndex(index === -1 ? 0 : index, skipScrollIntoView);
3249
3250
  };
3250
3251
  const scrollToCurrentContent = (immediate = false) => {
3251
3252
  if (props2.scrollspy) {
@@ -3887,7 +3888,8 @@
3887
3888
  children.forEach((child) => child.stopMomentum());
3888
3889
  const params = getEventParams();
3889
3890
  __WEBPACK_EXTERNAL_MODULE_vue__.nextTick(() => {
3890
- emit("confirm", params);
3891
+ const params2 = getEventParams();
3892
+ emit("confirm", params2);
3891
3893
  });
3892
3894
  return params;
3893
3895
  };
@@ -9942,9 +9944,10 @@
9942
9944
  confirmButtonDisabled: Boolean,
9943
9945
  showConfirmButton: truthProp,
9944
9946
  closeOnClickOverlay: Boolean,
9945
- keyboardEnabled: truthProp
9947
+ keyboardEnabled: truthProp,
9948
+ destroyOnClose: Boolean
9946
9949
  });
9947
- const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
9950
+ const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate", "destroyOnClose"];
9948
9951
  var stdin_default$W = __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent({
9949
9952
  name: name$N,
9950
9953
  props: dialogProps,
@@ -10157,7 +10160,8 @@
10157
10160
  showConfirmButton: true,
10158
10161
  showCancelButton: false,
10159
10162
  closeOnPopstate: true,
10160
- closeOnClickOverlay: false
10163
+ closeOnClickOverlay: false,
10164
+ destroyOnClose: false
10161
10165
  };
10162
10166
  let currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
10163
10167
  function initInstance$2() {
@@ -10562,7 +10566,10 @@
10562
10566
  const DropdownItem = withInstall(stdin_default$T);
10563
10567
  const DropdownMenu = withInstall(stdin_default$U);
10564
10568
  const floatingBubbleProps = {
10565
- gap: makeNumberProp(24),
10569
+ gap: {
10570
+ type: [Number, Object],
10571
+ default: 24
10572
+ },
10566
10573
  icon: String,
10567
10574
  axis: makeStringProp("y"),
10568
10575
  magnetic: String,
@@ -10596,11 +10603,13 @@
10596
10603
  width: 0,
10597
10604
  height: 0
10598
10605
  });
10606
+ const gapX = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => isObject$1(props2.gap) ? props2.gap.x : props2.gap);
10607
+ const gapY = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => isObject$1(props2.gap) ? props2.gap.y : props2.gap);
10599
10608
  const boundary = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => ({
10600
- top: props2.gap,
10601
- right: windowWidth.value - state.value.width - props2.gap,
10602
- bottom: windowHeight.value - state.value.height - props2.gap,
10603
- left: props2.gap
10609
+ top: gapY.value,
10610
+ right: windowWidth.value - state.value.width - gapX.value,
10611
+ bottom: windowHeight.value - state.value.height - gapY.value,
10612
+ left: gapX.value
10604
10613
  }));
10605
10614
  const dragging = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
10606
10615
  let initialized = false;
@@ -10624,8 +10633,8 @@
10624
10633
  offset
10625
10634
  } = props2;
10626
10635
  state.value = {
10627
- x: offset.x > -1 ? offset.x : windowWidth.value - width - props2.gap,
10628
- y: offset.y > -1 ? offset.y : windowHeight.value - height - props2.gap,
10636
+ x: offset.x > -1 ? offset.x : windowWidth.value - width - gapX.value,
10637
+ y: offset.y > -1 ? offset.y : windowHeight.value - height - gapY.value,
10629
10638
  width,
10630
10639
  height
10631
10640
  };
@@ -10693,7 +10702,7 @@
10693
10702
  initialized = true;
10694
10703
  });
10695
10704
  });
10696
- __WEBPACK_EXTERNAL_MODULE_vue__.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
10705
+ __WEBPACK_EXTERNAL_MODULE_vue__.watch([windowWidth, windowHeight, gapX, gapY, () => props2.offset], updateState, {
10697
10706
  deep: true
10698
10707
  });
10699
10708
  const show = __WEBPACK_EXTERNAL_MODULE_vue__.ref(true);
@@ -13461,7 +13470,7 @@
13461
13470
  };
13462
13471
  function eventListeners_effect(_ref) {
13463
13472
  var state = _ref.state, instance2 = _ref.instance, options = _ref.options;
13464
- var _options$scroll = options.scroll, scroll = void 0 === _options$scroll || _options$scroll, _options$resize = options.resize, resize = void 0 === _options$resize || _options$resize;
13473
+ var _options$scroll = options.scroll, scroll = void 0 === _options$scroll ? true : _options$scroll, _options$resize = options.resize, resize = void 0 === _options$resize ? true : _options$resize;
13465
13474
  var window1 = getWindow(state.elements.popper);
13466
13475
  var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
13467
13476
  if (scroll) scrollParents.forEach(function(scrollParent) {
@@ -13548,20 +13557,19 @@
13548
13557
  }
13549
13558
  return offsets;
13550
13559
  }
13551
- function popperOffsets(_ref) {
13560
+ function popperOffsets_popperOffsets(_ref) {
13552
13561
  var state = _ref.state, name2 = _ref.name;
13553
13562
  state.modifiersData[name2] = computeOffsets({
13554
13563
  reference: state.rects.reference,
13555
13564
  element: state.rects.popper,
13556
- strategy: "absolute",
13557
13565
  placement: state.placement
13558
13566
  });
13559
13567
  }
13560
- const modifiers_popperOffsets = {
13568
+ const popperOffsets = {
13561
13569
  name: "popperOffsets",
13562
13570
  enabled: true,
13563
13571
  phase: "read",
13564
- fn: popperOffsets,
13572
+ fn: popperOffsets_popperOffsets,
13565
13573
  data: {}
13566
13574
  };
13567
13575
  var unsetSides = {
@@ -13638,9 +13646,9 @@
13638
13646
  }
13639
13647
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
13640
13648
  }
13641
- function computeStyles(_ref5) {
13649
+ function computeStyles_computeStyles(_ref5) {
13642
13650
  var state = _ref5.state, options = _ref5.options;
13643
- var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = void 0 === _options$gpuAccelerat || _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = void 0 === _options$adaptive || _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = void 0 === _options$roundOffsets || _options$roundOffsets;
13651
+ var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = void 0 === _options$gpuAccelerat ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = void 0 === _options$adaptive ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = void 0 === _options$roundOffsets ? true : _options$roundOffsets;
13644
13652
  var commonStyles = {
13645
13653
  placement: getBasePlacement(state.placement),
13646
13654
  variation: getVariation(state.placement),
@@ -13665,14 +13673,14 @@
13665
13673
  "data-popper-placement": state.placement
13666
13674
  });
13667
13675
  }
13668
- const modifiers_computeStyles = {
13676
+ const computeStyles = {
13669
13677
  name: "computeStyles",
13670
13678
  enabled: true,
13671
13679
  phase: "beforeWrite",
13672
- fn: computeStyles,
13680
+ fn: computeStyles_computeStyles,
13673
13681
  data: {}
13674
13682
  };
13675
- function applyStyles(_ref) {
13683
+ function applyStyles_applyStyles(_ref) {
13676
13684
  var state = _ref.state;
13677
13685
  Object.keys(state.elements).forEach(function(name2) {
13678
13686
  var style = state.styles[name2] || {};
@@ -13721,11 +13729,11 @@
13721
13729
  });
13722
13730
  };
13723
13731
  }
13724
- const modifiers_applyStyles = {
13732
+ const applyStyles = {
13725
13733
  name: "applyStyles",
13726
13734
  enabled: true,
13727
13735
  phase: "write",
13728
- fn: applyStyles,
13736
+ fn: applyStyles_applyStyles,
13729
13737
  effect: applyStyles_effect,
13730
13738
  requires: [
13731
13739
  "computeStyles"
@@ -13733,9 +13741,9 @@
13733
13741
  };
13734
13742
  var popper_lite_defaultModifiers = [
13735
13743
  eventListeners,
13736
- modifiers_popperOffsets,
13737
- modifiers_computeStyles,
13738
- modifiers_applyStyles
13744
+ popperOffsets,
13745
+ computeStyles,
13746
+ applyStyles
13739
13747
  ];
13740
13748
  var popper_lite_createPopper = /* @__PURE__ */ popperGenerator({
13741
13749
  defaultModifiers: popper_lite_defaultModifiers
@@ -14916,7 +14924,8 @@
14916
14924
  props: signatureProps,
14917
14925
  emits: ["submit", "clear", "start", "end", "signing"],
14918
14926
  setup(props2, {
14919
- emit
14927
+ emit,
14928
+ slots
14920
14929
  }) {
14921
14930
  const canvasRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
14922
14931
  const wrapRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
@@ -15031,7 +15040,7 @@
15031
15040
  "onTouchstartPassive": touchStart,
15032
15041
  "onTouchmove": touchMove,
15033
15042
  "onTouchend": touchEnd
15034
- }, null) : __WEBPACK_EXTERNAL_MODULE_vue__.createVNode("p", null, [props2.tips])]), __WEBPACK_EXTERNAL_MODULE_vue__.createVNode("div", {
15043
+ }, null) : slots.tips ? slots.tips() : __WEBPACK_EXTERNAL_MODULE_vue__.createVNode("p", null, [props2.tips])]), __WEBPACK_EXTERNAL_MODULE_vue__.createVNode("div", {
15035
15044
  "class": bem$i("footer")
15036
15045
  }, [__WEBPACK_EXTERNAL_MODULE_vue__.createVNode(Button, {
15037
15046
  "size": "small",
@@ -16183,8 +16192,8 @@
16183
16192
  });
16184
16193
  }
16185
16194
  };
16186
- const getClickHandler = (position, stop) => (event) => {
16187
- if (stop) {
16195
+ const getClickHandler = (position) => (event) => {
16196
+ if (lockClick2 || opened) {
16188
16197
  event.stopPropagation();
16189
16198
  }
16190
16199
  if (lockClick2) {
@@ -16198,7 +16207,7 @@
16198
16207
  return __WEBPACK_EXTERNAL_MODULE_vue__.createVNode("div", {
16199
16208
  "ref": ref2,
16200
16209
  "class": bem$6(side),
16201
- "onClick": getClickHandler(side, true)
16210
+ "onClick": getClickHandler(side)
16202
16211
  }, [contentSlot()]);
16203
16212
  }
16204
16213
  };
@@ -16221,7 +16230,7 @@
16221
16230
  return __WEBPACK_EXTERNAL_MODULE_vue__.createVNode("div", {
16222
16231
  "ref": root,
16223
16232
  "class": bem$6(),
16224
- "onClick": getClickHandler("cell", lockClick2),
16233
+ "onClick": getClickHandler("cell"),
16225
16234
  "onTouchstartPassive": onTouchStart,
16226
16235
  "onTouchend": onTouchEnd,
16227
16236
  "onTouchcancel": onTouchEnd
@@ -16351,7 +16360,7 @@
16351
16360
  const config = isObject$1(to) ? to : {
16352
16361
  path: to
16353
16362
  };
16354
- return !!$route.matched.find((val) => {
16363
+ return $route.matched.some((val) => {
16355
16364
  const pathMatched = "path" in config && config.path === val.path;
16356
16365
  const nameMatched = "name" in config && config.name === val.name;
16357
16366
  return pathMatched || nameMatched;
@@ -17327,28 +17336,25 @@
17327
17336
  });
17328
17337
  return URL.createObjectURL(svgBlob);
17329
17338
  };
17339
+ const revokeWatermarkUrl = () => {
17340
+ if (watermarkUrl.value) {
17341
+ URL.revokeObjectURL(watermarkUrl.value);
17342
+ }
17343
+ };
17344
+ const generateWatermarkUrl = () => {
17345
+ if (svgElRef.value) {
17346
+ revokeWatermarkUrl();
17347
+ watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
17348
+ }
17349
+ };
17330
17350
  __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect(() => {
17331
17351
  if (props2.image) {
17332
17352
  makeImageToBase64(props2.image);
17333
17353
  }
17334
17354
  });
17335
- __WEBPACK_EXTERNAL_MODULE_vue__.watch(() => [imageBase64.value, props2.content, props2.textColor, props2.height, props2.width, props2.rotate, props2.gapX, props2.gapY], () => {
17336
- __WEBPACK_EXTERNAL_MODULE_vue__.nextTick(() => {
17337
- if (svgElRef.value) {
17338
- if (watermarkUrl.value) {
17339
- URL.revokeObjectURL(watermarkUrl.value);
17340
- }
17341
- watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
17342
- }
17343
- });
17344
- }, {
17345
- immediate: true
17346
- });
17347
- __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted(() => {
17348
- if (watermarkUrl.value) {
17349
- URL.revokeObjectURL(watermarkUrl.value);
17350
- }
17351
- });
17355
+ __WEBPACK_EXTERNAL_MODULE_vue__.watch(() => [imageBase64.value, props2.content, props2.textColor, props2.height, props2.width, props2.rotate, props2.gapX, props2.gapY], generateWatermarkUrl);
17356
+ __WEBPACK_EXTERNAL_MODULE_vue__.onMounted(generateWatermarkUrl);
17357
+ __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted(revokeWatermarkUrl);
17352
17358
  return () => {
17353
17359
  const style = extend({
17354
17360
  backgroundImage: `url(${watermarkUrl.value})`
@@ -18212,7 +18218,7 @@
18212
18218
  });
18213
18219
  }
18214
18220
  };
18215
- const version = "4.9.17";
18221
+ const version = "4.9.19";
18216
18222
  function install(app) {
18217
18223
  const components = [
18218
18224
  ActionBar,