vant 4.7.2 → 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 (110) hide show
  1. package/README.md +1 -0
  2. package/es/address-edit/AddressEdit.mjs +1 -1
  3. package/es/calendar/Calendar.mjs +20 -17
  4. package/es/cell/Cell.d.ts +17 -5
  5. package/es/cell/Cell.mjs +5 -2
  6. package/es/cell/index.d.ts +9 -3
  7. package/es/checkbox/Checker.mjs +7 -1
  8. package/es/col/Col.mjs +11 -3
  9. package/es/collapse-item/CollapseItem.d.ts +13 -4
  10. package/es/collapse-item/index.d.ts +9 -3
  11. package/es/config-provider/types.d.ts +1 -1
  12. package/es/field/Field.d.ts +30 -21
  13. package/es/field/Field.mjs +11 -3
  14. package/es/field/index.css +1 -1
  15. package/es/field/index.d.ts +18 -12
  16. package/es/field/types.d.ts +1 -1
  17. package/es/form/Form.d.ts +3 -0
  18. package/es/form/Form.mjs +1 -0
  19. package/es/form/index.d.ts +2 -0
  20. package/es/highlight/Highlight.d.ts +96 -0
  21. package/es/highlight/Highlight.mjs +122 -0
  22. package/es/highlight/index.css +1 -0
  23. package/es/highlight/index.d.ts +73 -0
  24. package/es/highlight/index.mjs +10 -0
  25. package/es/highlight/style/index.d.ts +1 -0
  26. package/es/highlight/style/index.mjs +2 -0
  27. package/es/highlight/types.d.ts +3 -0
  28. package/es/highlight/types.mjs +0 -0
  29. package/es/image-preview/ImagePreview.mjs +10 -0
  30. package/es/image-preview/ImagePreviewItem.d.ts +27 -1
  31. package/es/image-preview/ImagePreviewItem.mjs +17 -12
  32. package/es/image-preview/types.d.ts +7 -0
  33. package/es/index.d.ts +2 -1
  34. package/es/index.mjs +4 -1
  35. package/es/locale/lang/ar-SA.d.ts +63 -0
  36. package/es/locale/lang/ar-SA.mjs +65 -0
  37. package/es/picker-group/PickerGroup.mjs +3 -3
  38. package/es/progress/types.d.ts +1 -4
  39. package/es/row/Row.d.ts +8 -4
  40. package/es/row/Row.mjs +35 -4
  41. package/es/row/index.d.ts +3 -3
  42. package/es/search/Search.d.ts +13 -13
  43. package/es/search/Search.mjs +3 -1
  44. package/es/search/index.css +1 -1
  45. package/es/search/index.d.ts +9 -9
  46. package/es/signature/Signature.mjs +16 -3
  47. package/es/signature/index.d.ts +1 -1
  48. package/es/signature/types.d.ts +6 -0
  49. package/es/tabs/Tabs.d.ts +13 -0
  50. package/es/tabs/Tabs.mjs +3 -2
  51. package/es/tabs/index.d.ts +9 -0
  52. package/es/text-ellipsis/index.css +1 -1
  53. package/lib/address-edit/AddressEdit.js +1 -1
  54. package/lib/calendar/Calendar.js +20 -17
  55. package/lib/cell/Cell.d.ts +17 -5
  56. package/lib/cell/Cell.js +5 -2
  57. package/lib/cell/index.d.ts +9 -3
  58. package/lib/checkbox/Checker.js +7 -1
  59. package/lib/col/Col.js +10 -2
  60. package/lib/collapse-item/CollapseItem.d.ts +13 -4
  61. package/lib/collapse-item/index.d.ts +9 -3
  62. package/lib/config-provider/types.d.ts +1 -1
  63. package/lib/field/Field.d.ts +30 -21
  64. package/lib/field/Field.js +11 -3
  65. package/lib/field/index.css +1 -1
  66. package/lib/field/index.d.ts +18 -12
  67. package/lib/field/types.d.ts +1 -1
  68. package/lib/form/Form.d.ts +3 -0
  69. package/lib/form/Form.js +1 -0
  70. package/lib/form/index.d.ts +2 -0
  71. package/lib/highlight/Highlight.d.ts +96 -0
  72. package/lib/highlight/Highlight.js +141 -0
  73. package/lib/highlight/index.css +1 -0
  74. package/lib/highlight/index.d.ts +73 -0
  75. package/lib/highlight/index.js +39 -0
  76. package/lib/highlight/style/index.d.ts +1 -0
  77. package/lib/highlight/style/index.js +2 -0
  78. package/lib/highlight/types.d.ts +3 -0
  79. package/lib/highlight/types.js +15 -0
  80. package/lib/image-preview/ImagePreview.js +10 -0
  81. package/lib/image-preview/ImagePreviewItem.d.ts +27 -1
  82. package/lib/image-preview/ImagePreviewItem.js +17 -12
  83. package/lib/image-preview/types.d.ts +7 -0
  84. package/lib/index.css +1 -1
  85. package/lib/index.d.ts +2 -1
  86. package/lib/index.js +4 -1
  87. package/lib/locale/lang/ar-SA.d.ts +63 -0
  88. package/lib/locale/lang/ar-SA.js +84 -0
  89. package/lib/picker-group/PickerGroup.js +2 -2
  90. package/lib/progress/types.d.ts +1 -4
  91. package/lib/row/Row.d.ts +8 -4
  92. package/lib/row/Row.js +34 -3
  93. package/lib/row/index.d.ts +3 -3
  94. package/lib/search/Search.d.ts +13 -13
  95. package/lib/search/Search.js +3 -1
  96. package/lib/search/index.css +1 -1
  97. package/lib/search/index.d.ts +9 -9
  98. package/lib/signature/Signature.js +14 -1
  99. package/lib/signature/index.d.ts +1 -1
  100. package/lib/signature/types.d.ts +6 -0
  101. package/lib/tabs/Tabs.d.ts +13 -0
  102. package/lib/tabs/Tabs.js +3 -2
  103. package/lib/tabs/index.d.ts +9 -0
  104. package/lib/text-ellipsis/index.css +1 -1
  105. package/lib/vant.cjs.js +813 -605
  106. package/lib/vant.es.js +814 -606
  107. package/lib/vant.js +813 -605
  108. package/lib/vant.min.js +1 -1
  109. package/lib/web-types.json +1 -1
  110. package/package.json +2 -2
@@ -15,13 +15,16 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
15
15
  type: BooleanConstructor;
16
16
  default: true;
17
17
  };
18
- required: BooleanConstructor;
19
18
  iconPrefix: StringConstructor;
20
19
  valueClass: import("vue").PropType<unknown>;
21
20
  labelClass: import("vue").PropType<unknown>;
22
21
  titleClass: import("vue").PropType<unknown>;
23
22
  titleStyle: import("vue").PropType<string | import("vue").CSSProperties>;
24
23
  arrowDirection: import("vue").PropType<import("..").CellArrowDirection>;
24
+ required: {
25
+ type: import("vue").PropType<boolean | "auto">;
26
+ default: null;
27
+ };
25
28
  clickable: {
26
29
  type: import("vue").PropType<boolean | null>;
27
30
  default: null;
@@ -50,10 +53,6 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
50
53
  autocorrect: StringConstructor;
51
54
  errorMessage: StringConstructor;
52
55
  enterkeyhint: StringConstructor;
53
- spellcheck: {
54
- type: BooleanConstructor;
55
- default: null;
56
- };
57
56
  clearTrigger: {
58
57
  type: import("vue").PropType<import("./types").FieldClearTrigger>;
59
58
  default: import("./types").FieldClearTrigger;
@@ -62,6 +61,10 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
62
61
  type: import("vue").PropType<import("./types").FieldFormatTrigger>;
63
62
  default: import("./types").FieldFormatTrigger;
64
63
  };
64
+ spellcheck: {
65
+ type: BooleanConstructor;
66
+ default: null;
67
+ };
65
68
  error: {
66
69
  type: BooleanConstructor;
67
70
  default: null;
@@ -107,13 +110,16 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
107
110
  type: BooleanConstructor;
108
111
  default: true;
109
112
  };
110
- required: BooleanConstructor;
111
113
  iconPrefix: StringConstructor;
112
114
  valueClass: import("vue").PropType<unknown>;
113
115
  labelClass: import("vue").PropType<unknown>;
114
116
  titleClass: import("vue").PropType<unknown>;
115
117
  titleStyle: import("vue").PropType<string | import("vue").CSSProperties>;
116
118
  arrowDirection: import("vue").PropType<import("..").CellArrowDirection>;
119
+ required: {
120
+ type: import("vue").PropType<boolean | "auto">;
121
+ default: null;
122
+ };
117
123
  clickable: {
118
124
  type: import("vue").PropType<boolean | null>;
119
125
  default: null;
@@ -142,10 +148,6 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
142
148
  autocorrect: StringConstructor;
143
149
  errorMessage: StringConstructor;
144
150
  enterkeyhint: StringConstructor;
145
- spellcheck: {
146
- type: BooleanConstructor;
147
- default: null;
148
- };
149
151
  clearTrigger: {
150
152
  type: import("vue").PropType<import("./types").FieldClearTrigger>;
151
153
  default: import("./types").FieldClearTrigger;
@@ -154,6 +156,10 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
154
156
  type: import("vue").PropType<import("./types").FieldFormatTrigger>;
155
157
  default: import("./types").FieldFormatTrigger;
156
158
  };
159
+ spellcheck: {
160
+ type: BooleanConstructor;
161
+ default: null;
162
+ };
157
163
  error: {
158
164
  type: BooleanConstructor;
159
165
  default: null;
@@ -202,14 +208,14 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
202
208
  disabled: boolean;
203
209
  border: boolean;
204
210
  isLink: boolean;
205
- required: boolean;
211
+ required: boolean | "auto";
206
212
  clickable: boolean | null;
207
213
  clearable: boolean;
208
214
  clearIcon: string;
209
215
  modelValue: string | number;
210
- spellcheck: boolean;
211
216
  clearTrigger: import("./types").FieldClearTrigger;
212
217
  formatTrigger: import("./types").FieldFormatTrigger;
218
+ spellcheck: boolean;
213
219
  error: boolean;
214
220
  readonly: boolean;
215
221
  showWordLimit: boolean;
@@ -26,7 +26,7 @@ export type FieldRule = {
26
26
  validateEmpty?: boolean;
27
27
  };
28
28
  export type FieldValidationStatus = 'passed' | 'failed' | 'unvalidated';
29
- export type FieldFormSharedProps = 'colon' | 'disabled' | 'readonly' | 'labelWidth' | 'labelAlign' | 'inputAlign' | 'errorMessageAlign';
29
+ export type FieldFormSharedProps = 'colon' | 'required' | 'disabled' | 'readonly' | 'labelWidth' | 'labelAlign' | 'inputAlign' | 'errorMessageAlign';
30
30
  export type FieldExpose = {
31
31
  blur: () => void | undefined;
32
32
  focus: () => void | undefined;
package/es/form/Form.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare const formProps: {
4
4
  colon: BooleanConstructor;
5
5
  disabled: BooleanConstructor;
6
6
  readonly: BooleanConstructor;
7
+ required: PropType<boolean | "auto">;
7
8
  showError: BooleanConstructor;
8
9
  labelWidth: (NumberConstructor | StringConstructor)[];
9
10
  labelAlign: PropType<FieldTextAlign>;
@@ -29,6 +30,7 @@ declare const _default: import("vue").DefineComponent<{
29
30
  colon: BooleanConstructor;
30
31
  disabled: BooleanConstructor;
31
32
  readonly: BooleanConstructor;
33
+ required: PropType<boolean | "auto">;
32
34
  showError: BooleanConstructor;
33
35
  labelWidth: (NumberConstructor | StringConstructor)[];
34
36
  labelAlign: PropType<FieldTextAlign>;
@@ -52,6 +54,7 @@ declare const _default: import("vue").DefineComponent<{
52
54
  colon: BooleanConstructor;
53
55
  disabled: BooleanConstructor;
54
56
  readonly: BooleanConstructor;
57
+ required: PropType<boolean | "auto">;
55
58
  showError: BooleanConstructor;
56
59
  labelWidth: (NumberConstructor | StringConstructor)[];
57
60
  labelAlign: PropType<FieldTextAlign>;
package/es/form/Form.mjs CHANGED
@@ -8,6 +8,7 @@ const formProps = {
8
8
  colon: Boolean,
9
9
  disabled: Boolean,
10
10
  readonly: Boolean,
11
+ required: [Boolean, String],
11
12
  showError: Boolean,
12
13
  labelWidth: numericProp,
13
14
  labelAlign: String,
@@ -3,6 +3,7 @@ export declare const Form: import("../utils").WithInstall<import("vue").DefineCo
3
3
  colon: BooleanConstructor;
4
4
  disabled: BooleanConstructor;
5
5
  readonly: BooleanConstructor;
6
+ required: import("vue").PropType<boolean | "auto">;
6
7
  showError: BooleanConstructor;
7
8
  labelWidth: (NumberConstructor | StringConstructor)[];
8
9
  labelAlign: import("vue").PropType<import("..").FieldTextAlign>;
@@ -26,6 +27,7 @@ export declare const Form: import("../utils").WithInstall<import("vue").DefineCo
26
27
  colon: BooleanConstructor;
27
28
  disabled: BooleanConstructor;
28
29
  readonly: BooleanConstructor;
30
+ required: import("vue").PropType<boolean | "auto">;
29
31
  showError: BooleanConstructor;
30
32
  labelWidth: (NumberConstructor | StringConstructor)[];
31
33
  labelAlign: import("vue").PropType<import("..").FieldTextAlign>;
@@ -0,0 +1,96 @@
1
+ import { type ExtractPropTypes, type PropType } from 'vue';
2
+ export declare const highlightProps: {
3
+ autoEscape: {
4
+ type: BooleanConstructor;
5
+ default: true;
6
+ };
7
+ caseSensitive: BooleanConstructor;
8
+ highlightClass: StringConstructor;
9
+ highlightTag: {
10
+ type: PropType<keyof HTMLElementTagNameMap>;
11
+ default: keyof HTMLElementTagNameMap;
12
+ };
13
+ keywords: {
14
+ type: PropType<string | string[]>;
15
+ required: true;
16
+ };
17
+ sourceString: {
18
+ type: PropType<string>;
19
+ default: string;
20
+ };
21
+ tag: {
22
+ type: PropType<keyof HTMLElementTagNameMap>;
23
+ default: keyof HTMLElementTagNameMap;
24
+ };
25
+ unhighlightClass: StringConstructor;
26
+ unhighlightTag: {
27
+ type: PropType<keyof HTMLElementTagNameMap>;
28
+ default: keyof HTMLElementTagNameMap;
29
+ };
30
+ };
31
+ export type HighlightProps = ExtractPropTypes<typeof highlightProps>;
32
+ declare const _default: import("vue").DefineComponent<{
33
+ autoEscape: {
34
+ type: BooleanConstructor;
35
+ default: true;
36
+ };
37
+ caseSensitive: BooleanConstructor;
38
+ highlightClass: StringConstructor;
39
+ highlightTag: {
40
+ type: PropType<keyof HTMLElementTagNameMap>;
41
+ default: keyof HTMLElementTagNameMap;
42
+ };
43
+ keywords: {
44
+ type: PropType<string | string[]>;
45
+ required: true;
46
+ };
47
+ sourceString: {
48
+ type: PropType<string>;
49
+ default: string;
50
+ };
51
+ tag: {
52
+ type: PropType<keyof HTMLElementTagNameMap>;
53
+ default: keyof HTMLElementTagNameMap;
54
+ };
55
+ unhighlightClass: StringConstructor;
56
+ unhighlightTag: {
57
+ type: PropType<keyof HTMLElementTagNameMap>;
58
+ default: keyof HTMLElementTagNameMap;
59
+ };
60
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
61
+ autoEscape: {
62
+ type: BooleanConstructor;
63
+ default: true;
64
+ };
65
+ caseSensitive: BooleanConstructor;
66
+ highlightClass: StringConstructor;
67
+ highlightTag: {
68
+ type: PropType<keyof HTMLElementTagNameMap>;
69
+ default: keyof HTMLElementTagNameMap;
70
+ };
71
+ keywords: {
72
+ type: PropType<string | string[]>;
73
+ required: true;
74
+ };
75
+ sourceString: {
76
+ type: PropType<string>;
77
+ default: string;
78
+ };
79
+ tag: {
80
+ type: PropType<keyof HTMLElementTagNameMap>;
81
+ default: keyof HTMLElementTagNameMap;
82
+ };
83
+ unhighlightClass: StringConstructor;
84
+ unhighlightTag: {
85
+ type: PropType<keyof HTMLElementTagNameMap>;
86
+ default: keyof HTMLElementTagNameMap;
87
+ };
88
+ }>>, {
89
+ tag: keyof HTMLElementTagNameMap;
90
+ autoEscape: boolean;
91
+ caseSensitive: boolean;
92
+ highlightTag: keyof HTMLElementTagNameMap;
93
+ sourceString: string;
94
+ unhighlightTag: keyof HTMLElementTagNameMap;
95
+ }, {}>;
96
+ export default _default;
@@ -0,0 +1,122 @@
1
+ import { createVNode as _createVNode } from "vue";
2
+ import { defineComponent, computed } from "vue";
3
+ import { createNamespace, makeRequiredProp, makeStringProp, truthProp } from "../utils/index.mjs";
4
+ const [name, bem] = createNamespace("highlight");
5
+ const highlightProps = {
6
+ autoEscape: truthProp,
7
+ caseSensitive: Boolean,
8
+ highlightClass: String,
9
+ highlightTag: makeStringProp("span"),
10
+ keywords: makeRequiredProp([String, Array]),
11
+ sourceString: makeStringProp(""),
12
+ tag: makeStringProp("div"),
13
+ unhighlightClass: String,
14
+ unhighlightTag: makeStringProp("span")
15
+ };
16
+ var stdin_default = defineComponent({
17
+ name,
18
+ props: highlightProps,
19
+ setup(props) {
20
+ const highlightChunks = computed(() => {
21
+ const {
22
+ autoEscape,
23
+ caseSensitive,
24
+ keywords,
25
+ sourceString
26
+ } = props;
27
+ const flags = caseSensitive ? "g" : "gi";
28
+ const _keywords = Array.isArray(keywords) ? keywords : [keywords];
29
+ let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
30
+ if (autoEscape) {
31
+ keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
32
+ }
33
+ const regex = new RegExp(keyword, flags);
34
+ let match;
35
+ while (match = regex.exec(sourceString)) {
36
+ const start = match.index;
37
+ const end = regex.lastIndex;
38
+ if (start >= end) {
39
+ regex.lastIndex++;
40
+ continue;
41
+ }
42
+ chunks2.push({
43
+ start,
44
+ end,
45
+ highlight: true
46
+ });
47
+ }
48
+ return chunks2;
49
+ }, []);
50
+ chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
51
+ const prevChunk = chunks2[chunks2.length - 1];
52
+ if (!prevChunk || currentChunk.start > prevChunk.end) {
53
+ const unhighlightStart = prevChunk ? prevChunk.end : 0;
54
+ const unhighlightEnd = currentChunk.start;
55
+ if (unhighlightStart !== unhighlightEnd) {
56
+ chunks2.push({
57
+ start: unhighlightStart,
58
+ end: unhighlightEnd,
59
+ highlight: false
60
+ });
61
+ }
62
+ chunks2.push(currentChunk);
63
+ } else {
64
+ prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
65
+ }
66
+ return chunks2;
67
+ }, []);
68
+ const lastChunk = chunks[chunks.length - 1];
69
+ if (lastChunk && lastChunk.end < sourceString.length) {
70
+ chunks.push({
71
+ start: lastChunk.end,
72
+ end: sourceString.length,
73
+ highlight: false
74
+ });
75
+ }
76
+ return chunks;
77
+ });
78
+ const renderContent = () => {
79
+ const {
80
+ sourceString,
81
+ highlightClass,
82
+ unhighlightClass,
83
+ highlightTag,
84
+ unhighlightTag
85
+ } = props;
86
+ return highlightChunks.value.map((chunk) => {
87
+ const {
88
+ start,
89
+ end,
90
+ highlight
91
+ } = chunk;
92
+ const text = sourceString.slice(start, end);
93
+ if (highlight) {
94
+ return _createVNode(highlightTag, {
95
+ "class": [bem("tag"), highlightClass]
96
+ }, {
97
+ default: () => [text]
98
+ });
99
+ }
100
+ return _createVNode(unhighlightTag, {
101
+ "class": unhighlightClass
102
+ }, {
103
+ default: () => [text]
104
+ });
105
+ });
106
+ };
107
+ return () => {
108
+ const {
109
+ tag
110
+ } = props;
111
+ return _createVNode(tag, {
112
+ "class": bem()
113
+ }, {
114
+ default: () => [renderContent()]
115
+ });
116
+ };
117
+ }
118
+ });
119
+ export {
120
+ stdin_default as default,
121
+ highlightProps
122
+ };
@@ -0,0 +1 @@
1
+ :root{--van-highlight-tag-color: var(--van-primary-color)}.van-highlight__tag{color:var(--van-highlight-tag-color)}
@@ -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,10 @@
1
+ import { withInstall } from "../utils/index.mjs";
2
+ import _Highlight from "./Highlight.mjs";
3
+ const Highlight = withInstall(_Highlight);
4
+ var stdin_default = Highlight;
5
+ import { highlightProps } from "./Highlight.mjs";
6
+ export {
7
+ Highlight,
8
+ stdin_default as default,
9
+ highlightProps
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import "../../style/base.css";
2
+ import "../index.css";
@@ -0,0 +1,3 @@
1
+ export type HighlightThemeVars = {
2
+ highlightTagColor?: string;
3
+ };
File without changes
@@ -42,6 +42,7 @@ var stdin_default = defineComponent({
42
42
  slots
43
43
  }) {
44
44
  const swipeRef = ref();
45
+ const activedPreviewItemRef = ref();
45
46
  const state = reactive({
46
47
  active: 0,
47
48
  rootWidth: 0,
@@ -106,6 +107,11 @@ var stdin_default = defineComponent({
106
107
  "onDragStart": onDragStart
107
108
  }, {
108
109
  default: () => [props.images.map((image, index) => _createVNode(ImagePreviewItem, {
110
+ "ref": (item) => {
111
+ if (index === state.active) {
112
+ activedPreviewItemRef.value = item;
113
+ }
114
+ },
109
115
  "src": image,
110
116
  "show": props.show,
111
117
  "active": state.active,
@@ -141,6 +147,10 @@ var stdin_default = defineComponent({
141
147
  return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
142
148
  };
143
149
  useExpose({
150
+ resetScale: () => {
151
+ var _a;
152
+ (_a = activedPreviewItemRef.value) == null ? void 0 : _a.resetScale();
153
+ },
144
154
  swipeTo
145
155
  });
146
156
  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;
@@ -1,6 +1,7 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { ref, watch, computed, reactive, defineComponent } from "vue";
3
3
  import { clamp, numericProp, preventDefault, createNamespace, makeRequiredProp, LONG_PRESS_START_TIME, TAP_OFFSET } from "../utils/index.mjs";
4
+ import { useExpose } from "../composables/use-expose.mjs";
4
5
  import { useTouch } from "../composables/use-touch.mjs";
5
6
  import { raf, useEventListener, useRect } from "@vant/use";
6
7
  import { Image } from "../image/index.mjs";
@@ -13,19 +14,20 @@ const getCenter = (touches) => ({
13
14
  });
14
15
  const bem = createNamespace("image-preview")[1];
15
16
  const longImageRatio = 2.6;
17
+ const imagePreviewItemProps = {
18
+ src: String,
19
+ show: Boolean,
20
+ active: Number,
21
+ minZoom: makeRequiredProp(numericProp),
22
+ maxZoom: makeRequiredProp(numericProp),
23
+ rootWidth: makeRequiredProp(Number),
24
+ rootHeight: makeRequiredProp(Number),
25
+ disableZoom: Boolean,
26
+ doubleScale: Boolean,
27
+ closeOnClickOverlay: Boolean
28
+ };
16
29
  var stdin_default = defineComponent({
17
- props: {
18
- src: String,
19
- show: Boolean,
20
- active: Number,
21
- minZoom: makeRequiredProp(numericProp),
22
- maxZoom: makeRequiredProp(numericProp),
23
- rootWidth: makeRequiredProp(Number),
24
- rootHeight: makeRequiredProp(Number),
25
- disableZoom: Boolean,
26
- doubleScale: Boolean,
27
- closeOnClickOverlay: Boolean
28
- },
30
+ props: imagePreviewItemProps,
29
31
  emits: ["scale", "close", "longPress"],
30
32
  setup(props, {
31
33
  emit,
@@ -291,6 +293,9 @@ var stdin_default = defineComponent({
291
293
  return (_a = swipeItem.value) == null ? void 0 : _a.$el;
292
294
  })
293
295
  });
296
+ useExpose({
297
+ resetScale
298
+ });
294
299
  return () => {
295
300
  const imageSlots = {
296
301
  loading: () => _createVNode(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 {};
package/es/index.d.ts CHANGED
@@ -40,6 +40,7 @@ export * from "./floating-panel";
40
40
  export * from "./form";
41
41
  export * from "./grid";
42
42
  export * from "./grid-item";
43
+ export * from "./highlight";
43
44
  export * from "./icon";
44
45
  export * from "./image";
45
46
  export * from "./image-preview";
@@ -105,4 +106,4 @@ declare namespace _default {
105
106
  }
106
107
  export default _default;
107
108
  export function install(app: any): void;
108
- export const version: "4.7.2";
109
+ export const version: "4.8.0";
package/es/index.mjs CHANGED
@@ -40,6 +40,7 @@ import { FloatingPanel } from "./floating-panel/index.mjs";
40
40
  import { Form } from "./form/index.mjs";
41
41
  import { Grid } from "./grid/index.mjs";
42
42
  import { GridItem } from "./grid-item/index.mjs";
43
+ import { Highlight } from "./highlight/index.mjs";
43
44
  import { Icon } from "./icon/index.mjs";
44
45
  import { Image } from "./image/index.mjs";
45
46
  import { ImagePreview } from "./image-preview/index.mjs";
@@ -98,7 +99,7 @@ import { Toast } from "./toast/index.mjs";
98
99
  import { TreeSelect } from "./tree-select/index.mjs";
99
100
  import { Uploader } from "./uploader/index.mjs";
100
101
  import { Watermark } from "./watermark/index.mjs";
101
- const version = "4.7.2";
102
+ const version = "4.8.0";
102
103
  function install(app) {
103
104
  const components = [
104
105
  ActionBar,
@@ -143,6 +144,7 @@ function install(app) {
143
144
  Form,
144
145
  Grid,
145
146
  GridItem,
147
+ Highlight,
146
148
  Icon,
147
149
  Image,
148
150
  ImagePreview,
@@ -252,6 +254,7 @@ export * from "./floating-panel/index.mjs";
252
254
  export * from "./form/index.mjs";
253
255
  export * from "./grid/index.mjs";
254
256
  export * from "./grid-item/index.mjs";
257
+ export * from "./highlight/index.mjs";
255
258
  export * from "./icon/index.mjs";
256
259
  export * from "./image/index.mjs";
257
260
  export * from "./image-preview/index.mjs";