vant 4.8.2 → 4.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/es/icon/index.css +1 -1
  2. package/es/image/Image.d.ts +6 -8
  3. package/es/image/index.d.ts +6 -6
  4. package/es/image/types.d.ts +3 -0
  5. package/es/image-preview/ImagePreview.d.ts +13 -0
  6. package/es/image-preview/ImagePreview.mjs +2 -0
  7. package/es/image-preview/ImagePreviewItem.d.ts +4 -0
  8. package/es/image-preview/ImagePreviewItem.mjs +7 -1
  9. package/es/image-preview/index.d.ts +9 -0
  10. package/es/image-preview/types.d.ts +1 -0
  11. package/es/index.d.ts +1 -1
  12. package/es/index.mjs +1 -1
  13. package/es/notify/Notify.mjs +5 -8
  14. package/es/sticky/Sticky.mjs +1 -1
  15. package/es/tab/TabTitle.d.ts +1 -1
  16. package/es/tabs/index.css +1 -1
  17. package/es/text-ellipsis/TextEllipsis.mjs +11 -5
  18. package/es/toast/Toast.d.ts +3 -0
  19. package/es/toast/Toast.mjs +3 -2
  20. package/es/toast/index.d.ts +2 -0
  21. package/es/toast/types.d.ts +3 -2
  22. package/es/uploader/Uploader.d.ts +7 -8
  23. package/es/uploader/UploaderPreviewItem.d.ts +2 -3
  24. package/es/uploader/index.d.ts +5 -5
  25. package/es/utils/constant.d.ts +7 -7
  26. package/lib/icon/index.css +1 -1
  27. package/lib/image/Image.d.ts +6 -8
  28. package/lib/image/index.d.ts +6 -6
  29. package/lib/image/types.d.ts +3 -0
  30. package/lib/image-preview/ImagePreview.d.ts +13 -0
  31. package/lib/image-preview/ImagePreview.js +2 -0
  32. package/lib/image-preview/ImagePreviewItem.d.ts +4 -0
  33. package/lib/image-preview/ImagePreviewItem.js +7 -1
  34. package/lib/image-preview/index.d.ts +9 -0
  35. package/lib/image-preview/types.d.ts +1 -0
  36. package/lib/index.css +1 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.js +1 -1
  39. package/lib/notify/Notify.js +3 -6
  40. package/lib/sticky/Sticky.js +1 -1
  41. package/lib/tab/TabTitle.d.ts +1 -1
  42. package/lib/tabs/index.css +1 -1
  43. package/lib/text-ellipsis/TextEllipsis.js +11 -5
  44. package/lib/toast/Toast.d.ts +3 -0
  45. package/lib/toast/Toast.js +3 -2
  46. package/lib/toast/index.d.ts +2 -0
  47. package/lib/toast/types.d.ts +3 -2
  48. package/lib/uploader/Uploader.d.ts +7 -8
  49. package/lib/uploader/UploaderPreviewItem.d.ts +2 -3
  50. package/lib/uploader/index.d.ts +5 -5
  51. package/lib/utils/constant.d.ts +7 -7
  52. package/lib/vant.cjs.js +29 -17
  53. package/lib/vant.es.js +29 -17
  54. package/lib/vant.js +35 -20
  55. package/lib/vant.min.js +6 -1
  56. package/lib/web-types.json +1 -1
  57. package/package.json +11 -10
package/lib/vant.js CHANGED
@@ -2351,6 +2351,11 @@
2351
2351
  });
2352
2352
  return propRef;
2353
2353
  };
2354
+ /**
2355
+ * @vue/shared v3.4.12
2356
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
2357
+ * @license MIT
2358
+ **/
2354
2359
  const isArray = Array.isArray;
2355
2360
  const isString = (val) => typeof val === "string";
2356
2361
  const isObject = (val) => val !== null && typeof val === "object";
@@ -2378,9 +2383,7 @@
2378
2383
  }
2379
2384
  }
2380
2385
  return res;
2381
- } else if (isString(value)) {
2382
- return value;
2383
- } else if (isObject(value)) {
2386
+ } else if (isString(value) || isObject(value)) {
2384
2387
  return value;
2385
2388
  }
2386
2389
  }
@@ -2596,7 +2599,7 @@
2596
2599
  if (container) {
2597
2600
  const containerRect = useRect(container);
2598
2601
  const difference = containerRect.bottom - offset2.value - state.height;
2599
- state.fixed = offset2.value > rootRect.top && containerRect.bottom > 0;
2602
+ state.fixed = offset2.value >= rootRect.top && containerRect.bottom > 0;
2600
2603
  state.transform = difference < 0 ? difference : 0;
2601
2604
  } else {
2602
2605
  state.fixed = offset2.value > rootRect.top;
@@ -5023,7 +5026,7 @@
5023
5026
  }
5024
5027
  }
5025
5028
  const [name$1k, bem$1g] = createNamespace("toast");
5026
- const popupInheritProps = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay"];
5029
+ const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
5027
5030
  const toastProps = {
5028
5031
  icon: String,
5029
5032
  show: Boolean,
@@ -5043,7 +5046,8 @@
5043
5046
  overlayClass: unknownProp,
5044
5047
  overlayStyle: Object,
5045
5048
  closeOnClick: Boolean,
5046
- closeOnClickOverlay: Boolean
5049
+ closeOnClickOverlay: Boolean,
5050
+ zIndex: numericProp
5047
5051
  };
5048
5052
  var stdin_default$1u = vue.defineComponent({
5049
5053
  name: name$1k,
@@ -5133,7 +5137,7 @@
5133
5137
  "onClick": onClick,
5134
5138
  "onClosed": clearTimer,
5135
5139
  "onUpdate:show": updateShow
5136
- }, pick(props2, popupInheritProps)), {
5140
+ }, pick(props2, popupInheritProps$1)), {
5137
5141
  default: () => [renderIcon(), renderMessage()]
5138
5142
  });
5139
5143
  }
@@ -10902,6 +10906,7 @@
10902
10906
  rootHeight: makeRequiredProp(Number),
10903
10907
  disableZoom: Boolean,
10904
10908
  doubleScale: Boolean,
10909
+ closeOnClickImage: Boolean,
10905
10910
  closeOnClickOverlay: Boolean
10906
10911
  };
10907
10912
  var stdin_default$N = vue.defineComponent({
@@ -11066,7 +11071,12 @@
11066
11071
  };
11067
11072
  const checkClose = (event) => {
11068
11073
  var _a;
11069
- const isClickOverlay = event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el);
11074
+ const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
11075
+ const imageEl = swipeItemEl.firstElementChild;
11076
+ const isClickOverlay = event.target === swipeItemEl;
11077
+ const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
11078
+ if (!props2.closeOnClickImage && isClickImage)
11079
+ return;
11070
11080
  if (!props2.closeOnClickOverlay && isClickOverlay)
11071
11081
  return;
11072
11082
  emit("close");
@@ -11226,6 +11236,7 @@
11226
11236
  startPosition: makeNumericProp(0),
11227
11237
  showIndicators: Boolean,
11228
11238
  closeOnPopstate: truthProp,
11239
+ closeOnClickImage: truthProp,
11229
11240
  closeOnClickOverlay: truthProp,
11230
11241
  closeIconPosition: makeStringProp("top-right"),
11231
11242
  teleport: [String, Object]
@@ -11318,6 +11329,7 @@
11318
11329
  "rootHeight": state.rootHeight,
11319
11330
  "disableZoom": state.disableZoom,
11320
11331
  "doubleScale": props2.doubleScale,
11332
+ "closeOnClickImage": props2.closeOnClickImage,
11321
11333
  "closeOnClickOverlay": props2.closeOnClickOverlay,
11322
11334
  "onScale": emitScale,
11323
11335
  "onClose": emitClose,
@@ -12124,6 +12136,7 @@
12124
12136
  });
12125
12137
  const NoticeBar = withInstall(stdin_default$H);
12126
12138
  const [name$y, bem$x] = createNamespace("notify");
12139
+ const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
12127
12140
  const notifyProps = extend({}, popupSharedProps, {
12128
12141
  type: makeStringProp("danger"),
12129
12142
  color: String,
@@ -12142,20 +12155,16 @@
12142
12155
  slots
12143
12156
  }) {
12144
12157
  const updateShow = (show) => emit("update:show", show);
12145
- return () => vue.createVNode(Popup, {
12146
- "show": props2.show,
12158
+ return () => vue.createVNode(Popup, vue.mergeProps({
12147
12159
  "class": [bem$x([props2.type]), props2.className],
12148
12160
  "style": {
12149
12161
  color: props2.color,
12150
12162
  background: props2.background
12151
12163
  },
12152
12164
  "overlay": false,
12153
- "zIndex": props2.zIndex,
12154
- "position": props2.position,
12155
12165
  "duration": 0.2,
12156
- "lockScroll": props2.lockScroll,
12157
12166
  "onUpdate:show": updateShow
12158
- }, {
12167
+ }, pick(props2, popupInheritProps)), {
12159
12168
  default: () => [slots.default ? slots.default() : props2.message]
12160
12169
  });
12161
12170
  }
@@ -16203,7 +16212,8 @@
16203
16212
  props: textEllipsisProps,
16204
16213
  emits: ["clickAction"],
16205
16214
  setup(props2, {
16206
- emit
16215
+ emit,
16216
+ slots
16207
16217
  }) {
16208
16218
  const text = vue.ref("");
16209
16219
  const expanded = vue.ref(false);
@@ -16311,10 +16321,15 @@
16311
16321
  toggle();
16312
16322
  emit("clickAction", event);
16313
16323
  };
16314
- const renderAction = () => vue.createVNode("span", {
16315
- "class": bem$3("action"),
16316
- "onClick": onClickAction
16317
- }, [actionText.value]);
16324
+ const renderAction = () => {
16325
+ const action = slots.action ? slots.action({
16326
+ expanded: expanded.value
16327
+ }) : actionText.value;
16328
+ return vue.createVNode("span", {
16329
+ "class": bem$3("action"),
16330
+ "onClick": onClickAction
16331
+ }, [action]);
16332
+ };
16318
16333
  vue.onMounted(calcEllipsised);
16319
16334
  vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
16320
16335
  useExpose({
@@ -17966,7 +17981,7 @@
17966
17981
  });
17967
17982
  }
17968
17983
  };
17969
- const version = "4.8.2";
17984
+ const version = "4.8.3";
17970
17985
  function install(app) {
17971
17986
  const components = [
17972
17987
  ActionBar,