vant 4.7.3 → 4.8.0

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 (51) hide show
  1. package/es/calendar/Calendar.mjs +20 -17
  2. package/es/checkbox/Checker.mjs +7 -1
  3. package/es/col/Col.mjs +11 -3
  4. package/es/config-provider/types.d.ts +1 -1
  5. package/es/highlight/Highlight.d.ts +96 -0
  6. package/es/highlight/Highlight.mjs +122 -0
  7. package/es/highlight/index.css +1 -0
  8. package/es/highlight/index.d.ts +73 -0
  9. package/es/highlight/index.mjs +10 -0
  10. package/es/highlight/style/index.d.ts +1 -0
  11. package/es/highlight/style/index.mjs +2 -0
  12. package/es/highlight/types.d.ts +3 -0
  13. package/es/highlight/types.mjs +0 -0
  14. package/es/image-preview/ImagePreview.mjs +10 -0
  15. package/es/image-preview/ImagePreviewItem.d.ts +27 -1
  16. package/es/image-preview/ImagePreviewItem.mjs +17 -12
  17. package/es/image-preview/types.d.ts +7 -0
  18. package/es/index.d.ts +2 -1
  19. package/es/index.mjs +4 -1
  20. package/es/row/Row.d.ts +8 -4
  21. package/es/row/Row.mjs +35 -4
  22. package/es/row/index.d.ts +3 -3
  23. package/lib/calendar/Calendar.js +20 -17
  24. package/lib/checkbox/Checker.js +7 -1
  25. package/lib/col/Col.js +10 -2
  26. package/lib/config-provider/types.d.ts +1 -1
  27. package/lib/highlight/Highlight.d.ts +96 -0
  28. package/lib/highlight/Highlight.js +141 -0
  29. package/lib/highlight/index.css +1 -0
  30. package/lib/highlight/index.d.ts +73 -0
  31. package/lib/highlight/index.js +39 -0
  32. package/lib/highlight/style/index.d.ts +1 -0
  33. package/lib/highlight/style/index.js +2 -0
  34. package/lib/highlight/types.d.ts +3 -0
  35. package/lib/highlight/types.js +15 -0
  36. package/lib/image-preview/ImagePreview.js +10 -0
  37. package/lib/image-preview/ImagePreviewItem.d.ts +27 -1
  38. package/lib/image-preview/ImagePreviewItem.js +17 -12
  39. package/lib/image-preview/types.d.ts +7 -0
  40. package/lib/index.css +1 -1
  41. package/lib/index.d.ts +2 -1
  42. package/lib/index.js +4 -1
  43. package/lib/row/Row.d.ts +8 -4
  44. package/lib/row/Row.js +34 -3
  45. package/lib/row/index.d.ts +3 -3
  46. package/lib/vant.cjs.js +775 -594
  47. package/lib/vant.es.js +775 -594
  48. package/lib/vant.js +775 -594
  49. package/lib/vant.min.js +1 -1
  50. package/lib/web-types.json +1 -1
  51. package/package.json +2 -2
@@ -75,6 +75,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
75
75
  slots
76
76
  }) {
77
77
  const swipeRef = (0, import_vue2.ref)();
78
+ const activedPreviewItemRef = (0, import_vue2.ref)();
78
79
  const state = (0, import_vue2.reactive)({
79
80
  active: 0,
80
81
  rootWidth: 0,
@@ -139,6 +140,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
139
140
  "onDragStart": onDragStart
140
141
  }, {
141
142
  default: () => [props.images.map((image, index) => (0, import_vue.createVNode)(import_ImagePreviewItem.default, {
143
+ "ref": (item) => {
144
+ if (index === state.active) {
145
+ activedPreviewItemRef.value = item;
146
+ }
147
+ },
142
148
  "src": image,
143
149
  "show": props.show,
144
150
  "active": state.active,
@@ -174,6 +180,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
174
180
  return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
175
181
  };
176
182
  (0, import_use_expose.useExpose)({
183
+ resetScale: () => {
184
+ var _a;
185
+ (_a = activedPreviewItemRef.value) == null ? void 0 : _a.resetScale();
186
+ },
177
187
  swipeTo
178
188
  });
179
189
  (0, import_vue2.onMounted)(resize);
@@ -1,3 +1,29 @@
1
+ import { type ExtractPropTypes } from 'vue';
2
+ declare const imagePreviewItemProps: {
3
+ src: StringConstructor;
4
+ show: BooleanConstructor;
5
+ active: NumberConstructor;
6
+ minZoom: {
7
+ type: (NumberConstructor | StringConstructor)[];
8
+ required: true;
9
+ };
10
+ maxZoom: {
11
+ type: (NumberConstructor | StringConstructor)[];
12
+ required: true;
13
+ };
14
+ rootWidth: {
15
+ type: NumberConstructor;
16
+ required: true;
17
+ };
18
+ rootHeight: {
19
+ type: NumberConstructor;
20
+ required: true;
21
+ };
22
+ disableZoom: BooleanConstructor;
23
+ doubleScale: BooleanConstructor;
24
+ closeOnClickOverlay: BooleanConstructor;
25
+ };
26
+ export type ImagePreviewItemProps = ExtractPropTypes<typeof imagePreviewItemProps>;
1
27
  declare const _default: import("vue").DefineComponent<{
2
28
  src: StringConstructor;
3
29
  show: BooleanConstructor;
@@ -21,7 +47,7 @@ declare const _default: import("vue").DefineComponent<{
21
47
  disableZoom: BooleanConstructor;
22
48
  doubleScale: BooleanConstructor;
23
49
  closeOnClickOverlay: BooleanConstructor;
24
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "scale" | "longPress")[], "close" | "scale" | "longPress", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
50
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "scale" | "longPress")[], "close" | "scale" | "longPress", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
25
51
  src: StringConstructor;
26
52
  show: BooleanConstructor;
27
53
  active: NumberConstructor;
@@ -23,6 +23,7 @@ module.exports = __toCommonJS(stdin_exports);
23
23
  var import_vue = require("vue");
24
24
  var import_vue2 = require("vue");
25
25
  var import_utils = require("../utils");
26
+ var import_use_expose = require("../composables/use-expose");
26
27
  var import_use_touch = require("../composables/use-touch");
27
28
  var import_use = require("@vant/use");
28
29
  var import_image = require("../image");
@@ -35,19 +36,20 @@ const getCenter = (touches) => ({
35
36
  });
36
37
  const bem = (0, import_utils.createNamespace)("image-preview")[1];
37
38
  const longImageRatio = 2.6;
39
+ const imagePreviewItemProps = {
40
+ src: String,
41
+ show: Boolean,
42
+ active: Number,
43
+ minZoom: (0, import_utils.makeRequiredProp)(import_utils.numericProp),
44
+ maxZoom: (0, import_utils.makeRequiredProp)(import_utils.numericProp),
45
+ rootWidth: (0, import_utils.makeRequiredProp)(Number),
46
+ rootHeight: (0, import_utils.makeRequiredProp)(Number),
47
+ disableZoom: Boolean,
48
+ doubleScale: Boolean,
49
+ closeOnClickOverlay: Boolean
50
+ };
38
51
  var stdin_default = (0, import_vue2.defineComponent)({
39
- props: {
40
- src: String,
41
- show: Boolean,
42
- active: Number,
43
- minZoom: (0, import_utils.makeRequiredProp)(import_utils.numericProp),
44
- maxZoom: (0, import_utils.makeRequiredProp)(import_utils.numericProp),
45
- rootWidth: (0, import_utils.makeRequiredProp)(Number),
46
- rootHeight: (0, import_utils.makeRequiredProp)(Number),
47
- disableZoom: Boolean,
48
- doubleScale: Boolean,
49
- closeOnClickOverlay: Boolean
50
- },
52
+ props: imagePreviewItemProps,
51
53
  emits: ["scale", "close", "longPress"],
52
54
  setup(props, {
53
55
  emit,
@@ -313,6 +315,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
313
315
  return (_a = swipeItem.value) == null ? void 0 : _a.$el;
314
316
  })
315
317
  });
318
+ (0, import_use_expose.useExpose)({
319
+ resetScale
320
+ });
316
321
  return () => {
317
322
  const imageSlots = {
318
323
  loading: () => (0, import_vue.createVNode)(import_loading.Loading, {
@@ -3,6 +3,7 @@ import type { Interceptor } from '../utils';
3
3
  import type { SwipeToOptions } from '../swipe';
4
4
  import type { PopupCloseIconPosition } from '../popup';
5
5
  import type { ImagePreviewProps } from './ImagePreview';
6
+ import type { ImagePreviewItemProps } from './ImagePreviewItem';
6
7
  export type ImagePreviewOptions = {
7
8
  loop?: boolean;
8
9
  images: string[];
@@ -35,7 +36,12 @@ export type ImagePreviewScaleEventParams = {
35
36
  scale: number;
36
37
  index: number;
37
38
  };
39
+ type ImagePreviewItemExpose = {
40
+ resetScale: () => void;
41
+ };
42
+ export type ImagePreviewItemInstance = ComponentPublicInstance<ImagePreviewItemProps, ImagePreviewItemExpose>;
38
43
  export type ImagePreviewExpose = {
44
+ resetScale: () => void;
39
45
  swipeTo: (index: number, options?: SwipeToOptions) => void;
40
46
  };
41
47
  export type ImagePreviewInstance = ComponentPublicInstance<ImagePreviewProps, ImagePreviewExpose>;
@@ -50,3 +56,4 @@ export type ImagePreviewThemeVars = {
50
56
  imagePreviewCloseIconMargin?: string;
51
57
  imagePreviewCloseIconZIndex?: number | string;
52
58
  };
59
+ export {};