vant 4.7.3 → 4.8.1

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 (58) hide show
  1. package/README.md +14 -0
  2. package/es/calendar/Calendar.mjs +20 -17
  3. package/es/checkbox/Checker.mjs +7 -1
  4. package/es/col/Col.mjs +11 -3
  5. package/es/config-provider/types.d.ts +1 -1
  6. package/es/highlight/Highlight.d.ts +96 -0
  7. package/es/highlight/Highlight.mjs +122 -0
  8. package/es/highlight/index.css +1 -0
  9. package/es/highlight/index.d.ts +73 -0
  10. package/es/highlight/index.mjs +10 -0
  11. package/es/highlight/style/index.d.ts +1 -0
  12. package/es/highlight/style/index.mjs +2 -0
  13. package/es/highlight/types.d.ts +3 -0
  14. package/es/highlight/types.mjs +0 -0
  15. package/es/image-preview/ImagePreview.mjs +10 -0
  16. package/es/image-preview/ImagePreviewItem.d.ts +27 -1
  17. package/es/image-preview/ImagePreviewItem.mjs +17 -12
  18. package/es/image-preview/types.d.ts +7 -0
  19. package/es/index.d.ts +2 -1
  20. package/es/index.mjs +4 -1
  21. package/es/row/Row.d.ts +8 -4
  22. package/es/row/Row.mjs +35 -4
  23. package/es/row/index.d.ts +3 -3
  24. package/es/text-ellipsis/TextEllipsis.mjs +10 -5
  25. package/es/text-ellipsis/index.d.ts +1 -1
  26. package/es/text-ellipsis/types.d.ts +6 -0
  27. package/lib/calendar/Calendar.js +20 -17
  28. package/lib/checkbox/Checker.js +7 -1
  29. package/lib/col/Col.js +10 -2
  30. package/lib/config-provider/types.d.ts +1 -1
  31. package/lib/highlight/Highlight.d.ts +96 -0
  32. package/lib/highlight/Highlight.js +141 -0
  33. package/lib/highlight/index.css +1 -0
  34. package/lib/highlight/index.d.ts +73 -0
  35. package/lib/highlight/index.js +39 -0
  36. package/lib/highlight/style/index.d.ts +1 -0
  37. package/lib/highlight/style/index.js +2 -0
  38. package/lib/highlight/types.d.ts +3 -0
  39. package/lib/highlight/types.js +15 -0
  40. package/lib/image-preview/ImagePreview.js +10 -0
  41. package/lib/image-preview/ImagePreviewItem.d.ts +27 -1
  42. package/lib/image-preview/ImagePreviewItem.js +17 -12
  43. package/lib/image-preview/types.d.ts +7 -0
  44. package/lib/index.css +1 -1
  45. package/lib/index.d.ts +2 -1
  46. package/lib/index.js +4 -1
  47. package/lib/row/Row.d.ts +8 -4
  48. package/lib/row/Row.js +34 -3
  49. package/lib/row/index.d.ts +3 -3
  50. package/lib/text-ellipsis/TextEllipsis.js +9 -4
  51. package/lib/text-ellipsis/index.d.ts +1 -1
  52. package/lib/text-ellipsis/types.d.ts +6 -0
  53. package/lib/vant.cjs.js +783 -597
  54. package/lib/vant.es.js +783 -597
  55. package/lib/vant.js +783 -597
  56. package/lib/vant.min.js +1 -1
  57. package/lib/web-types.json +1 -1
  58. package/package.json +3 -3
@@ -0,0 +1,73 @@
1
+ export declare const Highlight: import("../utils").WithInstall<import("vue").DefineComponent<{
2
+ autoEscape: {
3
+ type: BooleanConstructor;
4
+ default: true;
5
+ };
6
+ caseSensitive: BooleanConstructor;
7
+ highlightClass: StringConstructor;
8
+ highlightTag: {
9
+ type: import("vue").PropType<keyof HTMLElementTagNameMap>;
10
+ default: keyof HTMLElementTagNameMap;
11
+ };
12
+ keywords: {
13
+ type: import("vue").PropType<string | string[]>;
14
+ required: true;
15
+ };
16
+ sourceString: {
17
+ type: import("vue").PropType<string>;
18
+ default: string;
19
+ };
20
+ tag: {
21
+ type: import("vue").PropType<keyof HTMLElementTagNameMap>;
22
+ default: keyof HTMLElementTagNameMap;
23
+ };
24
+ unhighlightClass: StringConstructor;
25
+ unhighlightTag: {
26
+ type: import("vue").PropType<keyof HTMLElementTagNameMap>;
27
+ default: keyof HTMLElementTagNameMap;
28
+ };
29
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
30
+ autoEscape: {
31
+ type: BooleanConstructor;
32
+ default: true;
33
+ };
34
+ caseSensitive: BooleanConstructor;
35
+ highlightClass: StringConstructor;
36
+ highlightTag: {
37
+ type: import("vue").PropType<keyof HTMLElementTagNameMap>;
38
+ default: keyof HTMLElementTagNameMap;
39
+ };
40
+ keywords: {
41
+ type: import("vue").PropType<string | string[]>;
42
+ required: true;
43
+ };
44
+ sourceString: {
45
+ type: import("vue").PropType<string>;
46
+ default: string;
47
+ };
48
+ tag: {
49
+ type: import("vue").PropType<keyof HTMLElementTagNameMap>;
50
+ default: keyof HTMLElementTagNameMap;
51
+ };
52
+ unhighlightClass: StringConstructor;
53
+ unhighlightTag: {
54
+ type: import("vue").PropType<keyof HTMLElementTagNameMap>;
55
+ default: keyof HTMLElementTagNameMap;
56
+ };
57
+ }>>, {
58
+ tag: keyof HTMLElementTagNameMap;
59
+ autoEscape: boolean;
60
+ caseSensitive: boolean;
61
+ highlightTag: keyof HTMLElementTagNameMap;
62
+ sourceString: string;
63
+ unhighlightTag: keyof HTMLElementTagNameMap;
64
+ }, {}>>;
65
+ export default Highlight;
66
+ export { highlightProps } from './Highlight';
67
+ export type { HighlightProps } from './Highlight';
68
+ export type { HighlightThemeVars } from './types';
69
+ declare module 'vue' {
70
+ interface GlobalComponents {
71
+ vanHighlight: typeof Highlight;
72
+ }
73
+ }
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var stdin_exports = {};
29
+ __export(stdin_exports, {
30
+ Highlight: () => Highlight,
31
+ default: () => stdin_default,
32
+ highlightProps: () => import_Highlight2.highlightProps
33
+ });
34
+ module.exports = __toCommonJS(stdin_exports);
35
+ var import_utils = require("../utils");
36
+ var import_Highlight = __toESM(require("./Highlight"));
37
+ var import_Highlight2 = require("./Highlight");
38
+ const Highlight = (0, import_utils.withInstall)(import_Highlight.default);
39
+ var stdin_default = Highlight;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ require("../../style/base.css");
2
+ require("../index.css");
@@ -0,0 +1,3 @@
1
+ export type HighlightThemeVars = {
2
+ highlightTagColor?: string;
3
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var stdin_exports = {};
15
+ module.exports = __toCommonJS(stdin_exports);
@@ -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 {};