vant 4.2.1 → 4.3.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.
- package/es/date-picker/utils.mjs +3 -4
- package/es/field/index.css +1 -1
- package/es/image/Image.mjs +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/locale/lang/bg-BG.d.ts +2 -1
- package/es/locale/lang/bg-BG.mjs +2 -1
- package/es/locale/lang/bn-BD.d.ts +2 -1
- package/es/locale/lang/bn-BD.mjs +2 -1
- package/es/locale/lang/da-DK.d.ts +2 -1
- package/es/locale/lang/da-DK.mjs +2 -1
- package/es/locale/lang/de-DE-formal.d.ts +2 -1
- package/es/locale/lang/de-DE-formal.mjs +2 -1
- package/es/locale/lang/de-DE.d.ts +2 -1
- package/es/locale/lang/de-DE.mjs +2 -1
- package/es/locale/lang/el-GR.d.ts +2 -1
- package/es/locale/lang/el-GR.mjs +2 -1
- package/es/locale/lang/en-US.d.ts +2 -1
- package/es/locale/lang/en-US.mjs +2 -1
- package/es/locale/lang/eo-EO.d.ts +2 -1
- package/es/locale/lang/eo-EO.mjs +2 -1
- package/es/locale/lang/es-ES.d.ts +2 -1
- package/es/locale/lang/es-ES.mjs +2 -1
- package/es/locale/lang/fa-IR.d.ts +2 -1
- package/es/locale/lang/fa-IR.mjs +2 -1
- package/es/locale/lang/fr-FR.d.ts +2 -1
- package/es/locale/lang/fr-FR.mjs +2 -1
- package/es/locale/lang/he-IL.d.ts +2 -1
- package/es/locale/lang/he-IL.mjs +2 -1
- package/es/locale/lang/hi-IN.d.ts +2 -1
- package/es/locale/lang/hi-IN.mjs +2 -1
- package/es/locale/lang/id-ID.d.ts +2 -1
- package/es/locale/lang/id-ID.mjs +2 -1
- package/es/locale/lang/is-IS.d.ts +2 -1
- package/es/locale/lang/is-IS.mjs +2 -1
- package/es/locale/lang/it-IT.d.ts +2 -1
- package/es/locale/lang/it-IT.mjs +3 -10
- package/es/locale/lang/ja-JP.d.ts +2 -1
- package/es/locale/lang/ja-JP.mjs +2 -1
- package/es/locale/lang/km-KH.d.ts +2 -1
- package/es/locale/lang/km-KH.mjs +2 -1
- package/es/locale/lang/ko-KR.d.ts +2 -1
- package/es/locale/lang/ko-KR.mjs +2 -1
- package/es/locale/lang/la-LA.d.ts +2 -1
- package/es/locale/lang/la-LA.mjs +2 -1
- package/es/locale/lang/mm-MN.d.ts +2 -1
- package/es/locale/lang/mm-MN.mjs +2 -1
- package/es/locale/lang/nb-NO.d.ts +2 -1
- package/es/locale/lang/nb-NO.mjs +2 -1
- package/es/locale/lang/nl-NL.d.ts +2 -1
- package/es/locale/lang/nl-NL.mjs +2 -1
- package/es/locale/lang/pt-BR.d.ts +2 -1
- package/es/locale/lang/pt-BR.mjs +2 -1
- package/es/locale/lang/ro-RO.d.ts +2 -1
- package/es/locale/lang/ro-RO.mjs +2 -1
- package/es/locale/lang/ru-RU.d.ts +2 -1
- package/es/locale/lang/ru-RU.mjs +2 -1
- package/es/locale/lang/sv-SE.d.ts +2 -1
- package/es/locale/lang/sv-SE.mjs +2 -1
- package/es/locale/lang/th-TH.d.ts +2 -1
- package/es/locale/lang/th-TH.mjs +2 -1
- package/es/locale/lang/tr-TR.d.ts +2 -1
- package/es/locale/lang/tr-TR.mjs +2 -1
- package/es/locale/lang/uk-UA.d.ts +2 -1
- package/es/locale/lang/uk-UA.mjs +3 -10
- package/es/locale/lang/vi-VN.d.ts +2 -1
- package/es/locale/lang/vi-VN.mjs +2 -1
- package/es/locale/lang/zh-CN.d.ts +2 -1
- package/es/locale/lang/zh-CN.mjs +2 -1
- package/es/locale/lang/zh-HK.d.ts +2 -1
- package/es/locale/lang/zh-HK.mjs +2 -1
- package/es/locale/lang/zh-TW.d.ts +2 -1
- package/es/locale/lang/zh-TW.mjs +2 -1
- package/es/signature/Signature.d.ts +63 -0
- package/es/signature/Signature.mjs +129 -0
- package/es/signature/index.css +1 -0
- package/es/signature/index.d.ts +50 -0
- package/es/signature/index.mjs +8 -0
- package/es/signature/style/index.d.ts +1 -0
- package/es/signature/style/index.mjs +6 -0
- package/lib/date-picker/utils.js +2 -3
- package/lib/field/index.css +1 -1
- package/lib/image/Image.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/locale/lang/bg-BG.d.ts +2 -1
- package/lib/locale/lang/bg-BG.js +2 -1
- package/lib/locale/lang/bn-BD.d.ts +2 -1
- package/lib/locale/lang/bn-BD.js +2 -1
- package/lib/locale/lang/da-DK.d.ts +2 -1
- package/lib/locale/lang/da-DK.js +2 -1
- package/lib/locale/lang/de-DE-formal.d.ts +2 -1
- package/lib/locale/lang/de-DE-formal.js +2 -1
- package/lib/locale/lang/de-DE.d.ts +2 -1
- package/lib/locale/lang/de-DE.js +2 -1
- package/lib/locale/lang/el-GR.d.ts +2 -1
- package/lib/locale/lang/el-GR.js +2 -1
- package/lib/locale/lang/en-US.d.ts +2 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/eo-EO.d.ts +2 -1
- package/lib/locale/lang/eo-EO.js +2 -1
- package/lib/locale/lang/es-ES.d.ts +2 -1
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/fa-IR.d.ts +2 -1
- package/lib/locale/lang/fa-IR.js +2 -1
- package/lib/locale/lang/fr-FR.d.ts +2 -1
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/he-IL.d.ts +2 -1
- package/lib/locale/lang/he-IL.js +2 -1
- package/lib/locale/lang/hi-IN.d.ts +2 -1
- package/lib/locale/lang/hi-IN.js +2 -1
- package/lib/locale/lang/id-ID.d.ts +2 -1
- package/lib/locale/lang/id-ID.js +2 -1
- package/lib/locale/lang/is-IS.d.ts +2 -1
- package/lib/locale/lang/is-IS.js +2 -1
- package/lib/locale/lang/it-IT.d.ts +2 -1
- package/lib/locale/lang/it-IT.js +3 -10
- package/lib/locale/lang/ja-JP.d.ts +2 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/km-KH.d.ts +2 -1
- package/lib/locale/lang/km-KH.js +2 -1
- package/lib/locale/lang/ko-KR.d.ts +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/la-LA.d.ts +2 -1
- package/lib/locale/lang/la-LA.js +2 -1
- package/lib/locale/lang/mm-MN.d.ts +2 -1
- package/lib/locale/lang/mm-MN.js +2 -1
- package/lib/locale/lang/nb-NO.d.ts +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nl-NL.d.ts +2 -1
- package/lib/locale/lang/nl-NL.js +2 -1
- package/lib/locale/lang/pt-BR.d.ts +2 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/ro-RO.d.ts +2 -1
- package/lib/locale/lang/ro-RO.js +2 -1
- package/lib/locale/lang/ru-RU.d.ts +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/sv-SE.d.ts +2 -1
- package/lib/locale/lang/sv-SE.js +2 -1
- package/lib/locale/lang/th-TH.d.ts +2 -1
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/tr-TR.d.ts +2 -1
- package/lib/locale/lang/tr-TR.js +2 -1
- package/lib/locale/lang/uk-UA.d.ts +2 -1
- package/lib/locale/lang/uk-UA.js +3 -10
- package/lib/locale/lang/vi-VN.d.ts +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/zh-CN.d.ts +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-HK.d.ts +2 -1
- package/lib/locale/lang/zh-HK.js +2 -1
- package/lib/locale/lang/zh-TW.d.ts +2 -1
- package/lib/locale/lang/zh-TW.js +2 -1
- package/lib/signature/Signature.d.ts +63 -0
- package/lib/signature/Signature.js +148 -0
- package/lib/signature/index.css +1 -0
- package/lib/signature/index.d.ts +50 -0
- package/lib/signature/index.js +37 -0
- package/lib/signature/style/index.d.ts +1 -0
- package/lib/signature/style/index.js +6 -0
- package/lib/vant.cjs.js +909 -786
- package/lib/vant.es.js +909 -786
- package/lib/vant.js +909 -786
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +6 -6
package/lib/locale/lang/ro-RO.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "Nume",
|
25
25
|
tel: "Telefon",
|
26
26
|
save: "Salveaz\u0103",
|
27
|
-
|
27
|
+
clear: "Clar",
|
28
28
|
cancel: "Anuleaz\u0103",
|
29
|
+
confirm: "Confirm\u0103",
|
29
30
|
delete: "\u0218terge",
|
30
31
|
loading: "\xCEnc\u0103rcare...",
|
31
32
|
noCoupon: "F\u0103r\u0103 cupoane",
|
package/lib/locale/lang/ru-RU.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "\u0418\u043C\u044F",
|
25
25
|
tel: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D",
|
26
26
|
save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
|
27
|
-
|
27
|
+
clear: "\u041F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u0439",
|
28
28
|
cancel: "\u041E\u0442\u043C\u0435\u043D\u0430",
|
29
|
+
confirm: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C",
|
29
30
|
delete: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
|
30
31
|
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430...",
|
31
32
|
noCoupon: "\u041D\u0435\u0442 \u043A\u0443\u043F\u043E\u043D\u043E\u0432",
|
package/lib/locale/lang/sv-SE.js
CHANGED
package/lib/locale/lang/th-TH.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "\u0E0A\u0E37\u0E48\u0E2D",
|
25
25
|
tel: "\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C",
|
26
26
|
save: "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01",
|
27
|
-
|
27
|
+
clear: "\u0E0A\u0E31\u0E14\u0E40\u0E08\u0E19",
|
28
28
|
cancel: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
|
29
|
+
confirm: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19",
|
29
30
|
delete: "\u0E25\u0E1A",
|
30
31
|
loading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14...",
|
31
32
|
noCoupon: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E39\u0E1B\u0E2D\u0E07",
|
package/lib/locale/lang/tr-TR.js
CHANGED
package/lib/locale/lang/uk-UA.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "\u0406\u043C'\u044F",
|
25
25
|
tel: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D",
|
26
26
|
save: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438",
|
27
|
-
|
27
|
+
clear: "\u044F\u0441\u043D\u043E",
|
28
28
|
cancel: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
|
29
|
+
confirm: "\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438",
|
29
30
|
delete: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
|
30
31
|
loading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F...",
|
31
32
|
noCoupon: "\u0411\u0435\u0437 \u043A\u0443\u043F\u043E\u043D\u0456\u0432",
|
@@ -36,15 +37,7 @@ var stdin_default = {
|
|
36
37
|
end: "\u041A\u0456\u043D\u0435\u0446\u044C",
|
37
38
|
start: "\u041F\u043E\u0447\u0430\u0442\u043E\u043A",
|
38
39
|
title: "\u041A\u0430\u043B\u0435\u043D\u0434\u0430\u0440",
|
39
|
-
weekdays: [
|
40
|
-
"\u041D\u0434",
|
41
|
-
"\u041F\u043D",
|
42
|
-
"\u0412\u0442",
|
43
|
-
"\u0421\u0440",
|
44
|
-
"\u0427\u0442",
|
45
|
-
"\u041F\u0442",
|
46
|
-
"\u0421\u0431"
|
47
|
-
],
|
40
|
+
weekdays: ["\u041D\u0434", "\u041F\u043D", "\u0412\u0442", "\u0421\u0440", "\u0427\u0442", "\u041F\u0442", "\u0421\u0431"],
|
48
41
|
monthTitle: (year, month) => `${year}/${month}`,
|
49
42
|
rangePrompt: (maxRange) => `\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u043D\u0435 \u0431\u0456\u043B\u044C\u0448\u0435 \u043D\u0456\u0436 ${maxRange} \u0434\u043D\u0456\u0432`
|
50
43
|
},
|
package/lib/locale/lang/vi-VN.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "t\xEAn",
|
25
25
|
tel: "\u0110i\u1EC7n tho\u1EA1i",
|
26
26
|
save: "C\u1EE9u",
|
27
|
-
|
27
|
+
clear: "Th\xF4ng tho\xE1ng",
|
28
28
|
cancel: "H\u1EE7y b\u1ECF",
|
29
|
+
confirm: "X\xE1c nh\u1EADn",
|
29
30
|
delete: "X\xF3a",
|
30
31
|
loading: "\u0110ang t\u1EA3i ...",
|
31
32
|
noCoupon: "Kh\xF4ng c\xF3 phi\u1EBFu gi\u1EA3m gi\xE1",
|
package/lib/locale/lang/zh-CN.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "\u59D3\u540D",
|
25
25
|
tel: "\u7535\u8BDD",
|
26
26
|
save: "\u4FDD\u5B58",
|
27
|
-
|
27
|
+
clear: "\u6E05\u7A7A",
|
28
28
|
cancel: "\u53D6\u6D88",
|
29
|
+
confirm: "\u786E\u8BA4",
|
29
30
|
delete: "\u5220\u9664",
|
30
31
|
loading: "\u52A0\u8F7D\u4E2D...",
|
31
32
|
noCoupon: "\u6682\u65E0\u4F18\u60E0\u5238",
|
package/lib/locale/lang/zh-HK.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "\u59D3\u540D",
|
25
25
|
tel: "\u96FB\u8A71",
|
26
26
|
save: "\u4FDD\u5B58",
|
27
|
-
|
27
|
+
clear: "\u6E05\u7A7A",
|
28
28
|
cancel: "\u53D6\u6D88",
|
29
|
+
confirm: "\u78BA\u8A8D",
|
29
30
|
delete: "\u522A\u9664",
|
30
31
|
loading: "\u52A0\u8F09\u4E2D...",
|
31
32
|
noCoupon: "\u66AB\u7121\u512A\u60E0\u5238",
|
package/lib/locale/lang/zh-TW.js
CHANGED
@@ -24,8 +24,9 @@ var stdin_default = {
|
|
24
24
|
name: "\u59D3\u540D",
|
25
25
|
tel: "\u96FB\u8A71",
|
26
26
|
save: "\u5132\u5B58",
|
27
|
-
|
27
|
+
clear: "\u6E05\u7A7A",
|
28
28
|
cancel: "\u53D6\u6D88",
|
29
|
+
confirm: "\u78BA\u8A8D",
|
29
30
|
delete: "\u522A\u9664",
|
30
31
|
loading: "\u8F09\u5165\u4E2D...",
|
31
32
|
noCoupon: "\u66AB\u7121\u512A\u60E0\u5238",
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { type ExtractPropTypes } from 'vue';
|
2
|
+
export declare const signatureProps: {
|
3
|
+
tips: StringConstructor;
|
4
|
+
type: {
|
5
|
+
type: import("vue").PropType<string>;
|
6
|
+
default: string;
|
7
|
+
};
|
8
|
+
penColor: {
|
9
|
+
type: import("vue").PropType<string>;
|
10
|
+
default: string;
|
11
|
+
};
|
12
|
+
lineWidth: {
|
13
|
+
type: NumberConstructor;
|
14
|
+
default: number;
|
15
|
+
};
|
16
|
+
clearButtonText: StringConstructor;
|
17
|
+
confirmButtonText: StringConstructor;
|
18
|
+
};
|
19
|
+
export type SignatureProps = ExtractPropTypes<typeof signatureProps>;
|
20
|
+
declare const _default: import("vue").DefineComponent<{
|
21
|
+
tips: StringConstructor;
|
22
|
+
type: {
|
23
|
+
type: import("vue").PropType<string>;
|
24
|
+
default: string;
|
25
|
+
};
|
26
|
+
penColor: {
|
27
|
+
type: import("vue").PropType<string>;
|
28
|
+
default: string;
|
29
|
+
};
|
30
|
+
lineWidth: {
|
31
|
+
type: NumberConstructor;
|
32
|
+
default: number;
|
33
|
+
};
|
34
|
+
clearButtonText: StringConstructor;
|
35
|
+
confirmButtonText: StringConstructor;
|
36
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "start" | "clear" | "end" | "signing")[], "submit" | "start" | "clear" | "end" | "signing", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
37
|
+
tips: StringConstructor;
|
38
|
+
type: {
|
39
|
+
type: import("vue").PropType<string>;
|
40
|
+
default: string;
|
41
|
+
};
|
42
|
+
penColor: {
|
43
|
+
type: import("vue").PropType<string>;
|
44
|
+
default: string;
|
45
|
+
};
|
46
|
+
lineWidth: {
|
47
|
+
type: NumberConstructor;
|
48
|
+
default: number;
|
49
|
+
};
|
50
|
+
clearButtonText: StringConstructor;
|
51
|
+
confirmButtonText: StringConstructor;
|
52
|
+
}>> & {
|
53
|
+
onSubmit?: ((...args: any[]) => any) | undefined;
|
54
|
+
onClear?: ((...args: any[]) => any) | undefined;
|
55
|
+
onStart?: ((...args: any[]) => any) | undefined;
|
56
|
+
onEnd?: ((...args: any[]) => any) | undefined;
|
57
|
+
onSigning?: ((...args: any[]) => any) | undefined;
|
58
|
+
}, {
|
59
|
+
type: string;
|
60
|
+
lineWidth: number;
|
61
|
+
penColor: string;
|
62
|
+
}>;
|
63
|
+
export default _default;
|
@@ -0,0 +1,148 @@
|
|
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
|
+
signatureProps: () => signatureProps
|
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
|
+
var import_use = require("@vant/use");
|
28
|
+
var import_button = require("../button");
|
29
|
+
const [name, bem, t] = (0, import_utils.createNamespace)("signature");
|
30
|
+
const signatureProps = {
|
31
|
+
tips: String,
|
32
|
+
type: (0, import_utils.makeStringProp)("png"),
|
33
|
+
penColor: (0, import_utils.makeStringProp)("#000"),
|
34
|
+
lineWidth: (0, import_utils.makeNumberProp)(3),
|
35
|
+
clearButtonText: String,
|
36
|
+
confirmButtonText: String
|
37
|
+
};
|
38
|
+
const hasCanvasSupport = () => {
|
39
|
+
var _a;
|
40
|
+
const canvas = document.createElement("canvas");
|
41
|
+
return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
|
42
|
+
};
|
43
|
+
var stdin_default = (0, import_vue2.defineComponent)({
|
44
|
+
name,
|
45
|
+
props: signatureProps,
|
46
|
+
emits: ["submit", "clear", "start", "end", "signing"],
|
47
|
+
setup(props, {
|
48
|
+
emit
|
49
|
+
}) {
|
50
|
+
const canvasRef = (0, import_vue2.ref)();
|
51
|
+
const wrapRef = (0, import_vue2.ref)();
|
52
|
+
const state = (0, import_vue2.reactive)({
|
53
|
+
width: 0,
|
54
|
+
height: 0,
|
55
|
+
ctx: null
|
56
|
+
});
|
57
|
+
let canvasRect;
|
58
|
+
const isRenderCanvas = import_utils.inBrowser ? hasCanvasSupport() : true;
|
59
|
+
const touchStart = () => {
|
60
|
+
if (!state.ctx) {
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
state.ctx.beginPath();
|
64
|
+
state.ctx.lineWidth = props.lineWidth;
|
65
|
+
state.ctx.strokeStyle = props.penColor;
|
66
|
+
canvasRect = (0, import_use.useRect)(canvasRef);
|
67
|
+
emit("start");
|
68
|
+
};
|
69
|
+
const touchMove = (event) => {
|
70
|
+
var _a, _b;
|
71
|
+
if (!state.ctx) {
|
72
|
+
return false;
|
73
|
+
}
|
74
|
+
(0, import_utils.preventDefault)(event);
|
75
|
+
const touch = event.touches[0];
|
76
|
+
const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
|
77
|
+
const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
|
78
|
+
state.ctx.lineCap = "round";
|
79
|
+
state.ctx.lineJoin = "round";
|
80
|
+
(_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
|
81
|
+
(_b = state.ctx) == null ? void 0 : _b.stroke();
|
82
|
+
emit("signing", event);
|
83
|
+
};
|
84
|
+
const touchEnd = (event) => {
|
85
|
+
(0, import_utils.preventDefault)(event);
|
86
|
+
emit("end");
|
87
|
+
};
|
88
|
+
const isCanvasEmpty = (canvas) => {
|
89
|
+
const empty = document.createElement("canvas");
|
90
|
+
empty.width = canvas.width;
|
91
|
+
empty.height = canvas.height;
|
92
|
+
return canvas.toDataURL() === empty.toDataURL();
|
93
|
+
};
|
94
|
+
const submit = () => {
|
95
|
+
const canvas = canvasRef.value;
|
96
|
+
if (!canvas) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
const isEmpty = isCanvasEmpty(canvas);
|
100
|
+
const image = isEmpty ? "" : canvas.toDataURL(`image/${props.type}`, props.type === "jpg" ? 0.9 : null);
|
101
|
+
emit("submit", {
|
102
|
+
image,
|
103
|
+
canvas
|
104
|
+
});
|
105
|
+
};
|
106
|
+
const clear = () => {
|
107
|
+
if (state.ctx) {
|
108
|
+
state.ctx.clearRect(0, 0, state.width, state.height);
|
109
|
+
state.ctx.closePath();
|
110
|
+
}
|
111
|
+
emit("clear");
|
112
|
+
};
|
113
|
+
(0, import_vue2.onMounted)(() => {
|
114
|
+
var _a, _b, _c;
|
115
|
+
if (isRenderCanvas) {
|
116
|
+
state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
|
117
|
+
state.width = ((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0;
|
118
|
+
state.height = ((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0;
|
119
|
+
}
|
120
|
+
});
|
121
|
+
return () => (0, import_vue.createVNode)("div", {
|
122
|
+
"class": bem()
|
123
|
+
}, [(0, import_vue.createVNode)("div", {
|
124
|
+
"class": bem("content"),
|
125
|
+
"ref": wrapRef
|
126
|
+
}, [isRenderCanvas ? (0, import_vue.createVNode)("canvas", {
|
127
|
+
"ref": canvasRef,
|
128
|
+
"width": state.width,
|
129
|
+
"height": state.height,
|
130
|
+
"onTouchstartPassive": touchStart,
|
131
|
+
"onTouchmove": touchMove,
|
132
|
+
"onTouchend": touchEnd
|
133
|
+
}, null) : (0, import_vue.createVNode)("p", null, [props.tips])]), (0, import_vue.createVNode)("div", {
|
134
|
+
"class": bem("footer")
|
135
|
+
}, [(0, import_vue.createVNode)(import_button.Button, {
|
136
|
+
"size": "small",
|
137
|
+
"onClick": clear
|
138
|
+
}, {
|
139
|
+
default: () => [props.clearButtonText || t("clear")]
|
140
|
+
}), (0, import_vue.createVNode)(import_button.Button, {
|
141
|
+
"type": "primary",
|
142
|
+
"size": "small",
|
143
|
+
"onClick": submit
|
144
|
+
}, {
|
145
|
+
default: () => [props.confirmButtonText || t("confirm")]
|
146
|
+
})])]);
|
147
|
+
}
|
148
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--van-signature-padding: var(--van-padding-xs);--van-signature-content-height: 200px;--van-signature-content-background: var(--van-background-2);--van-signature-content-border: 1px dotted #dadada}.van-signature{padding:var(--van-signature-padding)}.van-signature__content{display:flex;justify-content:center;align-items:center;height:var(--van-signature-content-height);background-color:var(--van-signature-content-background);border:var(--van-signature-content-border);border-radius:var(--van-radius-lg);overflow:hidden}.van-signature__footer{display:flex;justify-content:flex-end}.van-signature__footer .van-button{padding:0 var(--van-padding-md);margin-top:var(--van-padding-xs);margin-left:var(--van-padding-xs)}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
export declare const Signature: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
+
tips: StringConstructor;
|
3
|
+
type: {
|
4
|
+
type: import("vue").PropType<string>;
|
5
|
+
default: string;
|
6
|
+
};
|
7
|
+
penColor: {
|
8
|
+
type: import("vue").PropType<string>;
|
9
|
+
default: string;
|
10
|
+
};
|
11
|
+
lineWidth: {
|
12
|
+
type: NumberConstructor;
|
13
|
+
default: number;
|
14
|
+
};
|
15
|
+
clearButtonText: StringConstructor;
|
16
|
+
confirmButtonText: StringConstructor;
|
17
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "start" | "clear" | "end" | "signing")[], "submit" | "start" | "clear" | "end" | "signing", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
18
|
+
tips: StringConstructor;
|
19
|
+
type: {
|
20
|
+
type: import("vue").PropType<string>;
|
21
|
+
default: string;
|
22
|
+
};
|
23
|
+
penColor: {
|
24
|
+
type: import("vue").PropType<string>;
|
25
|
+
default: string;
|
26
|
+
};
|
27
|
+
lineWidth: {
|
28
|
+
type: NumberConstructor;
|
29
|
+
default: number;
|
30
|
+
};
|
31
|
+
clearButtonText: StringConstructor;
|
32
|
+
confirmButtonText: StringConstructor;
|
33
|
+
}>> & {
|
34
|
+
onSubmit?: ((...args: any[]) => any) | undefined;
|
35
|
+
onClear?: ((...args: any[]) => any) | undefined;
|
36
|
+
onStart?: ((...args: any[]) => any) | undefined;
|
37
|
+
onEnd?: ((...args: any[]) => any) | undefined;
|
38
|
+
onSigning?: ((...args: any[]) => any) | undefined;
|
39
|
+
}, {
|
40
|
+
type: string;
|
41
|
+
lineWidth: number;
|
42
|
+
penColor: string;
|
43
|
+
}>>;
|
44
|
+
export default Signature;
|
45
|
+
export type { SignatureProps } from './Signature';
|
46
|
+
declare module 'vue' {
|
47
|
+
interface GlobalComponents {
|
48
|
+
Signature: typeof Signature;
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,37 @@
|
|
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
|
+
Signature: () => Signature,
|
31
|
+
default: () => stdin_default
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(stdin_exports);
|
34
|
+
var import_utils = require("../utils");
|
35
|
+
var import_Signature = __toESM(require("./Signature"));
|
36
|
+
const Signature = (0, import_utils.withInstall)(import_Signature.default);
|
37
|
+
var stdin_default = Signature;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|