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.
- package/README.md +1 -0
- package/es/address-edit/AddressEdit.mjs +1 -1
- package/es/calendar/Calendar.mjs +20 -17
- package/es/cell/Cell.d.ts +17 -5
- package/es/cell/Cell.mjs +5 -2
- package/es/cell/index.d.ts +9 -3
- package/es/checkbox/Checker.mjs +7 -1
- package/es/col/Col.mjs +11 -3
- package/es/collapse-item/CollapseItem.d.ts +13 -4
- package/es/collapse-item/index.d.ts +9 -3
- package/es/config-provider/types.d.ts +1 -1
- package/es/field/Field.d.ts +30 -21
- package/es/field/Field.mjs +11 -3
- package/es/field/index.css +1 -1
- package/es/field/index.d.ts +18 -12
- package/es/field/types.d.ts +1 -1
- package/es/form/Form.d.ts +3 -0
- package/es/form/Form.mjs +1 -0
- package/es/form/index.d.ts +2 -0
- package/es/highlight/Highlight.d.ts +96 -0
- package/es/highlight/Highlight.mjs +122 -0
- package/es/highlight/index.css +1 -0
- package/es/highlight/index.d.ts +73 -0
- package/es/highlight/index.mjs +10 -0
- package/es/highlight/style/index.d.ts +1 -0
- package/es/highlight/style/index.mjs +2 -0
- package/es/highlight/types.d.ts +3 -0
- package/es/highlight/types.mjs +0 -0
- package/es/image-preview/ImagePreview.mjs +10 -0
- package/es/image-preview/ImagePreviewItem.d.ts +27 -1
- package/es/image-preview/ImagePreviewItem.mjs +17 -12
- package/es/image-preview/types.d.ts +7 -0
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/locale/lang/ar-SA.d.ts +63 -0
- package/es/locale/lang/ar-SA.mjs +65 -0
- package/es/picker-group/PickerGroup.mjs +3 -3
- package/es/progress/types.d.ts +1 -4
- package/es/row/Row.d.ts +8 -4
- package/es/row/Row.mjs +35 -4
- package/es/row/index.d.ts +3 -3
- package/es/search/Search.d.ts +13 -13
- package/es/search/Search.mjs +3 -1
- package/es/search/index.css +1 -1
- package/es/search/index.d.ts +9 -9
- package/es/signature/Signature.mjs +16 -3
- package/es/signature/index.d.ts +1 -1
- package/es/signature/types.d.ts +6 -0
- package/es/tabs/Tabs.d.ts +13 -0
- package/es/tabs/Tabs.mjs +3 -2
- package/es/tabs/index.d.ts +9 -0
- package/es/text-ellipsis/index.css +1 -1
- package/lib/address-edit/AddressEdit.js +1 -1
- package/lib/calendar/Calendar.js +20 -17
- package/lib/cell/Cell.d.ts +17 -5
- package/lib/cell/Cell.js +5 -2
- package/lib/cell/index.d.ts +9 -3
- package/lib/checkbox/Checker.js +7 -1
- package/lib/col/Col.js +10 -2
- package/lib/collapse-item/CollapseItem.d.ts +13 -4
- package/lib/collapse-item/index.d.ts +9 -3
- package/lib/config-provider/types.d.ts +1 -1
- package/lib/field/Field.d.ts +30 -21
- package/lib/field/Field.js +11 -3
- package/lib/field/index.css +1 -1
- package/lib/field/index.d.ts +18 -12
- package/lib/field/types.d.ts +1 -1
- package/lib/form/Form.d.ts +3 -0
- package/lib/form/Form.js +1 -0
- package/lib/form/index.d.ts +2 -0
- package/lib/highlight/Highlight.d.ts +96 -0
- package/lib/highlight/Highlight.js +141 -0
- package/lib/highlight/index.css +1 -0
- package/lib/highlight/index.d.ts +73 -0
- package/lib/highlight/index.js +39 -0
- package/lib/highlight/style/index.d.ts +1 -0
- package/lib/highlight/style/index.js +2 -0
- package/lib/highlight/types.d.ts +3 -0
- package/lib/highlight/types.js +15 -0
- package/lib/image-preview/ImagePreview.js +10 -0
- package/lib/image-preview/ImagePreviewItem.d.ts +27 -1
- package/lib/image-preview/ImagePreviewItem.js +17 -12
- package/lib/image-preview/types.d.ts +7 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/locale/lang/ar-SA.d.ts +63 -0
- package/lib/locale/lang/ar-SA.js +84 -0
- package/lib/picker-group/PickerGroup.js +2 -2
- package/lib/progress/types.d.ts +1 -4
- package/lib/row/Row.d.ts +8 -4
- package/lib/row/Row.js +34 -3
- package/lib/row/index.d.ts +3 -3
- package/lib/search/Search.d.ts +13 -13
- package/lib/search/Search.js +3 -1
- package/lib/search/index.css +1 -1
- package/lib/search/index.d.ts +9 -9
- package/lib/signature/Signature.js +14 -1
- package/lib/signature/index.d.ts +1 -1
- package/lib/signature/types.d.ts +6 -0
- package/lib/tabs/Tabs.d.ts +13 -0
- package/lib/tabs/Tabs.js +3 -2
- package/lib/tabs/index.d.ts +9 -0
- package/lib/text-ellipsis/index.css +1 -1
- package/lib/vant.cjs.js +813 -605
- package/lib/vant.es.js +814 -606
- package/lib/vant.js +813 -605
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +2 -2
package/lib/field/index.d.ts
CHANGED
@@ -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;
|
package/lib/field/types.d.ts
CHANGED
@@ -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/lib/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/lib/form/Form.js
CHANGED
package/lib/form/index.d.ts
CHANGED
@@ -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,141 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name2 in all)
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
default: () => stdin_default,
|
21
|
+
highlightProps: () => highlightProps
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
24
|
+
var import_vue = require("vue");
|
25
|
+
var import_vue2 = require("vue");
|
26
|
+
var import_utils = require("../utils");
|
27
|
+
const [name, bem] = (0, import_utils.createNamespace)("highlight");
|
28
|
+
const highlightProps = {
|
29
|
+
autoEscape: import_utils.truthProp,
|
30
|
+
caseSensitive: Boolean,
|
31
|
+
highlightClass: String,
|
32
|
+
highlightTag: (0, import_utils.makeStringProp)("span"),
|
33
|
+
keywords: (0, import_utils.makeRequiredProp)([String, Array]),
|
34
|
+
sourceString: (0, import_utils.makeStringProp)(""),
|
35
|
+
tag: (0, import_utils.makeStringProp)("div"),
|
36
|
+
unhighlightClass: String,
|
37
|
+
unhighlightTag: (0, import_utils.makeStringProp)("span")
|
38
|
+
};
|
39
|
+
var stdin_default = (0, import_vue2.defineComponent)({
|
40
|
+
name,
|
41
|
+
props: highlightProps,
|
42
|
+
setup(props) {
|
43
|
+
const highlightChunks = (0, import_vue2.computed)(() => {
|
44
|
+
const {
|
45
|
+
autoEscape,
|
46
|
+
caseSensitive,
|
47
|
+
keywords,
|
48
|
+
sourceString
|
49
|
+
} = props;
|
50
|
+
const flags = caseSensitive ? "g" : "gi";
|
51
|
+
const _keywords = Array.isArray(keywords) ? keywords : [keywords];
|
52
|
+
let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
|
53
|
+
if (autoEscape) {
|
54
|
+
keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
55
|
+
}
|
56
|
+
const regex = new RegExp(keyword, flags);
|
57
|
+
let match;
|
58
|
+
while (match = regex.exec(sourceString)) {
|
59
|
+
const start = match.index;
|
60
|
+
const end = regex.lastIndex;
|
61
|
+
if (start >= end) {
|
62
|
+
regex.lastIndex++;
|
63
|
+
continue;
|
64
|
+
}
|
65
|
+
chunks2.push({
|
66
|
+
start,
|
67
|
+
end,
|
68
|
+
highlight: true
|
69
|
+
});
|
70
|
+
}
|
71
|
+
return chunks2;
|
72
|
+
}, []);
|
73
|
+
chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
|
74
|
+
const prevChunk = chunks2[chunks2.length - 1];
|
75
|
+
if (!prevChunk || currentChunk.start > prevChunk.end) {
|
76
|
+
const unhighlightStart = prevChunk ? prevChunk.end : 0;
|
77
|
+
const unhighlightEnd = currentChunk.start;
|
78
|
+
if (unhighlightStart !== unhighlightEnd) {
|
79
|
+
chunks2.push({
|
80
|
+
start: unhighlightStart,
|
81
|
+
end: unhighlightEnd,
|
82
|
+
highlight: false
|
83
|
+
});
|
84
|
+
}
|
85
|
+
chunks2.push(currentChunk);
|
86
|
+
} else {
|
87
|
+
prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
|
88
|
+
}
|
89
|
+
return chunks2;
|
90
|
+
}, []);
|
91
|
+
const lastChunk = chunks[chunks.length - 1];
|
92
|
+
if (lastChunk && lastChunk.end < sourceString.length) {
|
93
|
+
chunks.push({
|
94
|
+
start: lastChunk.end,
|
95
|
+
end: sourceString.length,
|
96
|
+
highlight: false
|
97
|
+
});
|
98
|
+
}
|
99
|
+
return chunks;
|
100
|
+
});
|
101
|
+
const renderContent = () => {
|
102
|
+
const {
|
103
|
+
sourceString,
|
104
|
+
highlightClass,
|
105
|
+
unhighlightClass,
|
106
|
+
highlightTag,
|
107
|
+
unhighlightTag
|
108
|
+
} = props;
|
109
|
+
return highlightChunks.value.map((chunk) => {
|
110
|
+
const {
|
111
|
+
start,
|
112
|
+
end,
|
113
|
+
highlight
|
114
|
+
} = chunk;
|
115
|
+
const text = sourceString.slice(start, end);
|
116
|
+
if (highlight) {
|
117
|
+
return (0, import_vue.createVNode)(highlightTag, {
|
118
|
+
"class": [bem("tag"), highlightClass]
|
119
|
+
}, {
|
120
|
+
default: () => [text]
|
121
|
+
});
|
122
|
+
}
|
123
|
+
return (0, import_vue.createVNode)(unhighlightTag, {
|
124
|
+
"class": unhighlightClass
|
125
|
+
}, {
|
126
|
+
default: () => [text]
|
127
|
+
});
|
128
|
+
});
|
129
|
+
};
|
130
|
+
return () => {
|
131
|
+
const {
|
132
|
+
tag
|
133
|
+
} = props;
|
134
|
+
return (0, import_vue.createVNode)(tag, {
|
135
|
+
"class": bem()
|
136
|
+
}, {
|
137
|
+
default: () => [renderContent()]
|
138
|
+
});
|
139
|
+
};
|
140
|
+
}
|
141
|
+
});
|
@@ -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,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,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<
|
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, {
|