vant 4.2.0 → 4.3.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/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/pagination/Pagination.d.ts +26 -0
- package/es/pagination/Pagination.mjs +14 -4
- package/es/pagination/index.css +1 -1
- package/es/pagination/index.d.ts +18 -0
- package/es/picker/Picker.d.ts +2 -1
- package/es/picker/Picker.mjs +16 -6
- package/es/picker/PickerColumn.d.ts +2 -1
- package/es/picker/PickerColumn.mjs +10 -4
- package/es/picker/index.d.ts +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/es/sticky/Sticky.mjs +20 -4
- package/es/tab/Tab.mjs +24 -6
- package/es/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
- package/es/{tabs/TabsTitle.mjs → tab/TabTitle.mjs} +2 -2
- package/es/tabs/Tabs.d.ts +1 -1
- package/es/tabs/Tabs.mjs +15 -30
- package/es/tabs/index.d.ts +1 -1
- package/es/tabs/style/index.mjs +0 -1
- package/es/tabs/types.d.ts +3 -1
- package/es/watermark/Watermark.mjs +3 -1
- 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/pagination/Pagination.d.ts +26 -0
- package/lib/pagination/Pagination.js +13 -3
- package/lib/pagination/index.css +1 -1
- package/lib/pagination/index.d.ts +18 -0
- package/lib/picker/Picker.d.ts +2 -1
- package/lib/picker/Picker.js +16 -6
- package/lib/picker/PickerColumn.d.ts +2 -1
- package/lib/picker/PickerColumn.js +9 -3
- package/lib/picker/index.d.ts +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/sticky/Sticky.js +18 -2
- package/lib/tab/Tab.js +21 -3
- package/lib/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
- package/lib/{tabs/TabsTitle.js → tab/TabTitle.js} +2 -2
- package/lib/tabs/Tabs.d.ts +1 -1
- package/lib/tabs/Tabs.js +13 -28
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/style/index.js +0 -1
- package/lib/tabs/types.d.ts +3 -1
- package/lib/vant.cjs.js +1047 -877
- package/lib/vant.es.js +1047 -877
- package/lib/vant.js +1047 -877
- package/lib/vant.min.js +1 -1
- package/lib/watermark/Watermark.js +3 -1
- package/lib/web-types.json +1 -1
- package/package.json +8 -8
@@ -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,129 @@
|
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
2
|
+
import { ref, reactive, onMounted, defineComponent } from "vue";
|
3
|
+
import { inBrowser, makeNumberProp, makeStringProp, createNamespace, preventDefault } from "../utils/index.mjs";
|
4
|
+
import { useRect } from "@vant/use";
|
5
|
+
import { Button } from "../button/index.mjs";
|
6
|
+
const [name, bem, t] = createNamespace("signature");
|
7
|
+
const signatureProps = {
|
8
|
+
tips: String,
|
9
|
+
type: makeStringProp("png"),
|
10
|
+
penColor: makeStringProp("#000"),
|
11
|
+
lineWidth: makeNumberProp(3),
|
12
|
+
clearButtonText: String,
|
13
|
+
confirmButtonText: String
|
14
|
+
};
|
15
|
+
const hasCanvasSupport = () => {
|
16
|
+
var _a;
|
17
|
+
const canvas = document.createElement("canvas");
|
18
|
+
return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
|
19
|
+
};
|
20
|
+
var stdin_default = defineComponent({
|
21
|
+
name,
|
22
|
+
props: signatureProps,
|
23
|
+
emits: ["submit", "clear", "start", "end", "signing"],
|
24
|
+
setup(props, {
|
25
|
+
emit
|
26
|
+
}) {
|
27
|
+
const canvasRef = ref();
|
28
|
+
const wrapRef = ref();
|
29
|
+
const state = reactive({
|
30
|
+
width: 0,
|
31
|
+
height: 0,
|
32
|
+
ctx: null
|
33
|
+
});
|
34
|
+
let canvasRect;
|
35
|
+
const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
|
36
|
+
const touchStart = () => {
|
37
|
+
if (!state.ctx) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
state.ctx.beginPath();
|
41
|
+
state.ctx.lineWidth = props.lineWidth;
|
42
|
+
state.ctx.strokeStyle = props.penColor;
|
43
|
+
canvasRect = useRect(canvasRef);
|
44
|
+
emit("start");
|
45
|
+
};
|
46
|
+
const touchMove = (event) => {
|
47
|
+
var _a, _b;
|
48
|
+
if (!state.ctx) {
|
49
|
+
return false;
|
50
|
+
}
|
51
|
+
preventDefault(event);
|
52
|
+
const touch = event.touches[0];
|
53
|
+
const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
|
54
|
+
const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
|
55
|
+
state.ctx.lineCap = "round";
|
56
|
+
state.ctx.lineJoin = "round";
|
57
|
+
(_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
|
58
|
+
(_b = state.ctx) == null ? void 0 : _b.stroke();
|
59
|
+
emit("signing", event);
|
60
|
+
};
|
61
|
+
const touchEnd = (event) => {
|
62
|
+
preventDefault(event);
|
63
|
+
emit("end");
|
64
|
+
};
|
65
|
+
const isCanvasEmpty = (canvas) => {
|
66
|
+
const empty = document.createElement("canvas");
|
67
|
+
empty.width = canvas.width;
|
68
|
+
empty.height = canvas.height;
|
69
|
+
return canvas.toDataURL() === empty.toDataURL();
|
70
|
+
};
|
71
|
+
const submit = () => {
|
72
|
+
const canvas = canvasRef.value;
|
73
|
+
if (!canvas) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
const isEmpty = isCanvasEmpty(canvas);
|
77
|
+
const image = isEmpty ? "" : canvas.toDataURL(`image/${props.type}`, props.type === "jpg" ? 0.9 : null);
|
78
|
+
emit("submit", {
|
79
|
+
image,
|
80
|
+
canvas
|
81
|
+
});
|
82
|
+
};
|
83
|
+
const clear = () => {
|
84
|
+
if (state.ctx) {
|
85
|
+
state.ctx.clearRect(0, 0, state.width, state.height);
|
86
|
+
state.ctx.closePath();
|
87
|
+
}
|
88
|
+
emit("clear");
|
89
|
+
};
|
90
|
+
onMounted(() => {
|
91
|
+
var _a, _b, _c;
|
92
|
+
if (isRenderCanvas) {
|
93
|
+
state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
|
94
|
+
state.width = ((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0;
|
95
|
+
state.height = ((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0;
|
96
|
+
}
|
97
|
+
});
|
98
|
+
return () => _createVNode("div", {
|
99
|
+
"class": bem()
|
100
|
+
}, [_createVNode("div", {
|
101
|
+
"class": bem("content"),
|
102
|
+
"ref": wrapRef
|
103
|
+
}, [isRenderCanvas ? _createVNode("canvas", {
|
104
|
+
"ref": canvasRef,
|
105
|
+
"width": state.width,
|
106
|
+
"height": state.height,
|
107
|
+
"onTouchstartPassive": touchStart,
|
108
|
+
"onTouchmove": touchMove,
|
109
|
+
"onTouchend": touchEnd
|
110
|
+
}, null) : _createVNode("p", null, [props.tips])]), _createVNode("div", {
|
111
|
+
"class": bem("footer")
|
112
|
+
}, [_createVNode(Button, {
|
113
|
+
"size": "small",
|
114
|
+
"onClick": clear
|
115
|
+
}, {
|
116
|
+
default: () => [props.clearButtonText || t("clear")]
|
117
|
+
}), _createVNode(Button, {
|
118
|
+
"type": "primary",
|
119
|
+
"size": "small",
|
120
|
+
"onClick": submit
|
121
|
+
}, {
|
122
|
+
default: () => [props.confirmButtonText || t("confirm")]
|
123
|
+
})])]);
|
124
|
+
}
|
125
|
+
});
|
126
|
+
export {
|
127
|
+
stdin_default as default,
|
128
|
+
signatureProps
|
129
|
+
};
|
@@ -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 @@
|
|
1
|
+
export {};
|
package/es/sticky/Sticky.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, computed, reactive, defineComponent } from "vue";
|
3
|
-
import { extend, isHidden, unitToPx, numericProp, getScrollTop, getZIndexStyle, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
2
|
+
import { ref, watch, computed, nextTick, reactive, defineComponent } from "vue";
|
3
|
+
import { extend, isHidden, unitToPx, numericProp, windowWidth, windowHeight, getScrollTop, getZIndexStyle, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { useRect, useEventListener, useScrollParent } from "@vant/use";
|
5
5
|
import { useVisibilityChange } from "../composables/use-visibility-change.mjs";
|
6
6
|
const [name, bem] = createNamespace("sticky");
|
@@ -29,8 +29,12 @@ var stdin_default = defineComponent({
|
|
29
29
|
// root height
|
30
30
|
transform: 0
|
31
31
|
});
|
32
|
+
const isReset = ref(false);
|
32
33
|
const offset = computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
|
33
34
|
const rootStyle = computed(() => {
|
35
|
+
if (isReset.value) {
|
36
|
+
return;
|
37
|
+
}
|
34
38
|
const {
|
35
39
|
fixed,
|
36
40
|
height,
|
@@ -44,7 +48,7 @@ var stdin_default = defineComponent({
|
|
44
48
|
}
|
45
49
|
});
|
46
50
|
const stickyStyle = computed(() => {
|
47
|
-
if (!state.fixed) {
|
51
|
+
if (!state.fixed || isReset.value) {
|
48
52
|
return;
|
49
53
|
}
|
50
54
|
const style = extend(getZIndexStyle(props.zIndex), {
|
@@ -103,6 +107,18 @@ var stdin_default = defineComponent({
|
|
103
107
|
passive: true
|
104
108
|
});
|
105
109
|
useVisibilityChange(root, onScroll);
|
110
|
+
watch([windowWidth, windowHeight], () => {
|
111
|
+
if (!root.value || isHidden(root) || !state.fixed) {
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
isReset.value = true;
|
115
|
+
nextTick(() => {
|
116
|
+
const rootRect = useRect(root);
|
117
|
+
state.width = rootRect.width;
|
118
|
+
state.height = rootRect.height;
|
119
|
+
isReset.value = false;
|
120
|
+
});
|
121
|
+
});
|
106
122
|
return () => {
|
107
123
|
var _a;
|
108
124
|
return _createVNode("div", {
|
@@ -110,7 +126,7 @@ var stdin_default = defineComponent({
|
|
110
126
|
"style": rootStyle.value
|
111
127
|
}, [_createVNode("div", {
|
112
128
|
"class": bem({
|
113
|
-
fixed: state.fixed
|
129
|
+
fixed: state.fixed && !isReset.value
|
114
130
|
}),
|
115
131
|
"style": stickyStyle.value
|
116
132
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
package/es/tab/Tab.mjs
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, provide, computed, nextTick, defineComponent } from "vue";
|
3
|
-
import { extend, truthProp, unknownProp, numericProp, createNamespace } from "../utils/index.mjs";
|
1
|
+
import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
2
|
+
import { ref, watch, provide, computed, nextTick, defineComponent, getCurrentInstance } from "vue";
|
3
|
+
import { pick, extend, truthProp, unknownProp, numericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { TABS_KEY } from "../tabs/Tabs.mjs";
|
5
5
|
import { doubleRaf, useParent } from "@vant/use";
|
6
6
|
import { useId } from "../composables/use-id.mjs";
|
7
7
|
import { useExpose } from "../composables/use-expose.mjs";
|
8
8
|
import { routeProps } from "../composables/use-route.mjs";
|
9
9
|
import { TAB_STATUS_KEY } from "../composables/use-tab-status.mjs";
|
10
|
+
import { TabTitle } from "./TabTitle.mjs";
|
10
11
|
import { SwipeItem } from "../swipe-item/index.mjs";
|
11
12
|
const [name, bem] = createNamespace("tab");
|
12
13
|
const tabProps = extend({}, routeProps, {
|
@@ -27,6 +28,7 @@ var stdin_default = defineComponent({
|
|
27
28
|
}) {
|
28
29
|
const id = useId();
|
29
30
|
const inited = ref(false);
|
31
|
+
const instance = getCurrentInstance();
|
30
32
|
const {
|
31
33
|
parent,
|
32
34
|
index
|
@@ -56,6 +58,21 @@ var stdin_default = defineComponent({
|
|
56
58
|
}
|
57
59
|
return isActive;
|
58
60
|
});
|
61
|
+
const renderTitle = (onClickTab) => _createVNode(TabTitle, _mergeProps({
|
62
|
+
"key": id,
|
63
|
+
"id": `${parent.id}-${index.value}`,
|
64
|
+
"ref": parent.setTitleRefs(index.value),
|
65
|
+
"style": props.titleStyle,
|
66
|
+
"class": props.titleClass,
|
67
|
+
"isActive": active.value,
|
68
|
+
"controls": id,
|
69
|
+
"scrollable": parent.scrollable.value,
|
70
|
+
"activeColor": parent.props.titleActiveColor,
|
71
|
+
"inactiveColor": parent.props.titleInactiveColor,
|
72
|
+
"onClick": (event) => onClickTab(instance.proxy, index.value, event)
|
73
|
+
}, pick(parent.props, ["type", "color", "shrink"]), pick(props, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
|
74
|
+
title: slots.title
|
75
|
+
});
|
59
76
|
const hasInactiveClass = ref(!active.value);
|
60
77
|
watch(active, (val) => {
|
61
78
|
if (val) {
|
@@ -71,6 +88,10 @@ var stdin_default = defineComponent({
|
|
71
88
|
parent.scrollIntoView();
|
72
89
|
});
|
73
90
|
provide(TAB_STATUS_KEY, active);
|
91
|
+
useExpose({
|
92
|
+
id,
|
93
|
+
renderTitle
|
94
|
+
});
|
74
95
|
return () => {
|
75
96
|
var _a;
|
76
97
|
const label = `${parent.id}-${index.value}`;
|
@@ -105,9 +126,6 @@ var stdin_default = defineComponent({
|
|
105
126
|
}
|
106
127
|
const shouldRender = inited.value || scrollspy || !lazyRender;
|
107
128
|
const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
|
108
|
-
useExpose({
|
109
|
-
id
|
110
|
-
});
|
111
129
|
return _withDirectives(_createVNode("div", {
|
112
130
|
"id": id,
|
113
131
|
"role": "tabpanel",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
declare const
|
1
|
+
export declare const TabTitle: import("vue").DefineComponent<{
|
2
2
|
id: StringConstructor;
|
3
3
|
dot: BooleanConstructor;
|
4
4
|
type: StringConstructor;
|
@@ -42,4 +42,3 @@ declare const _default: import("vue").DefineComponent<{
|
|
42
42
|
scrollable: boolean;
|
43
43
|
showZeroBadge: boolean;
|
44
44
|
}>;
|
45
|
-
export default _default;
|
@@ -3,7 +3,7 @@ import { computed, defineComponent } from "vue";
|
|
3
3
|
import { isDef, truthProp, numericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { Badge } from "../badge/index.mjs";
|
5
5
|
const [name, bem] = createNamespace("tab");
|
6
|
-
|
6
|
+
const TabTitle = defineComponent({
|
7
7
|
name,
|
8
8
|
props: {
|
9
9
|
id: String,
|
@@ -86,5 +86,5 @@ var stdin_default = defineComponent({
|
|
86
86
|
}
|
87
87
|
});
|
88
88
|
export {
|
89
|
-
|
89
|
+
TabTitle
|
90
90
|
};
|
package/es/tabs/Tabs.d.ts
CHANGED
@@ -145,9 +145,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
145
145
|
duration: string | number;
|
146
146
|
lazyRender: boolean;
|
147
147
|
offsetTop: string | number;
|
148
|
-
shrink: boolean;
|
149
148
|
animated: boolean;
|
150
149
|
swipeable: boolean;
|
150
|
+
shrink: boolean;
|
151
151
|
scrollspy: boolean;
|
152
152
|
swipeThreshold: string | number;
|
153
153
|
}>;
|
package/es/tabs/Tabs.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { createVNode as _createVNode
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { ref, watch, computed, reactive, nextTick, onActivated, defineComponent } from "vue";
|
3
|
-
import {
|
3
|
+
import { isDef, addUnit, isHidden, unitToPx, truthProp, numericProp, windowWidth, getElementTop, makeStringProp, callInterceptor, createNamespace, makeNumericProp, setRootScrollTop, BORDER_TOP_BOTTOM } from "../utils/index.mjs";
|
4
4
|
import { scrollLeftTo, scrollTopTo } from "./utils.mjs";
|
5
5
|
import { useRect, useChildren, useScrollParent, useEventListener, onMountedOrActivated } from "@vant/use";
|
6
6
|
import { useId } from "../composables/use-id.mjs";
|
@@ -10,7 +10,6 @@ import { useExpose } from "../composables/use-expose.mjs";
|
|
10
10
|
import { onPopupReopen } from "../composables/on-popup-reopen.mjs";
|
11
11
|
import { useVisibilityChange } from "../composables/use-visibility-change.mjs";
|
12
12
|
import { Sticky } from "../sticky/index.mjs";
|
13
|
-
import TabsTitle from "./TabsTitle.mjs";
|
14
13
|
import TabsContent from "./TabsContent.mjs";
|
15
14
|
const [name, bem] = createNamespace("tabs");
|
16
15
|
const tabsProps = {
|
@@ -226,24 +225,6 @@ var stdin_default = defineComponent({
|
|
226
225
|
setCurrentIndex(index);
|
227
226
|
}
|
228
227
|
};
|
229
|
-
const renderNav = () => children.map((item, index) => _createVNode(TabsTitle, _mergeProps({
|
230
|
-
"key": item.id,
|
231
|
-
"id": `${id}-${index}`,
|
232
|
-
"ref": setTitleRefs(index),
|
233
|
-
"type": props.type,
|
234
|
-
"color": props.color,
|
235
|
-
"style": item.titleStyle,
|
236
|
-
"class": item.titleClass,
|
237
|
-
"shrink": props.shrink,
|
238
|
-
"isActive": index === state.currentIndex,
|
239
|
-
"controls": item.id,
|
240
|
-
"scrollable": scrollable.value,
|
241
|
-
"activeColor": props.titleActiveColor,
|
242
|
-
"inactiveColor": props.titleInactiveColor,
|
243
|
-
"onClick": (event) => onClickTab(item, index, event)
|
244
|
-
}, pick(item, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
|
245
|
-
title: item.$slots.title
|
246
|
-
}));
|
247
228
|
const renderLine = () => {
|
248
229
|
if (props.type === "line" && children.length) {
|
249
230
|
return _createVNode("div", {
|
@@ -273,7 +254,7 @@ var stdin_default = defineComponent({
|
|
273
254
|
}]),
|
274
255
|
"style": navStyle.value,
|
275
256
|
"aria-orientation": "horizontal"
|
276
|
-
}, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots),
|
257
|
+
}, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
|
277
258
|
if (sticky) {
|
278
259
|
return _createVNode("div", {
|
279
260
|
"ref": wrapRef
|
@@ -281,7 +262,16 @@ var stdin_default = defineComponent({
|
|
281
262
|
}
|
282
263
|
return Header;
|
283
264
|
};
|
284
|
-
|
265
|
+
const resize = () => {
|
266
|
+
setLine();
|
267
|
+
nextTick(() => {
|
268
|
+
var _a, _b;
|
269
|
+
scrollIntoView(true);
|
270
|
+
(_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
|
271
|
+
});
|
272
|
+
};
|
273
|
+
watch(() => [props.color, props.duration, props.lineWidth, props.lineHeight], setLine);
|
274
|
+
watch(windowWidth, resize);
|
285
275
|
watch(() => props.active, (value) => {
|
286
276
|
if (value !== currentName.value) {
|
287
277
|
setCurrentIndexByName(value);
|
@@ -307,13 +297,6 @@ var stdin_default = defineComponent({
|
|
307
297
|
});
|
308
298
|
};
|
309
299
|
const onRendered = (name2, title) => emit("rendered", name2, title);
|
310
|
-
const resize = () => {
|
311
|
-
setLine();
|
312
|
-
nextTick(() => {
|
313
|
-
var _a, _b;
|
314
|
-
return (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
|
315
|
-
});
|
316
|
-
};
|
317
300
|
useExpose({
|
318
301
|
resize,
|
319
302
|
scrollTo
|
@@ -330,8 +313,10 @@ var stdin_default = defineComponent({
|
|
330
313
|
id,
|
331
314
|
props,
|
332
315
|
setLine,
|
316
|
+
scrollable,
|
333
317
|
onRendered,
|
334
318
|
currentName,
|
319
|
+
setTitleRefs,
|
335
320
|
scrollIntoView
|
336
321
|
});
|
337
322
|
return () => _createVNode("div", {
|
package/es/tabs/index.d.ts
CHANGED
@@ -98,9 +98,9 @@ export declare const Tabs: import("../utils").WithInstall<import("vue").DefineCo
|
|
98
98
|
duration: string | number;
|
99
99
|
lazyRender: boolean;
|
100
100
|
offsetTop: string | number;
|
101
|
-
shrink: boolean;
|
102
101
|
animated: boolean;
|
103
102
|
swipeable: boolean;
|
103
|
+
shrink: boolean;
|
104
104
|
scrollspy: boolean;
|
105
105
|
swipeThreshold: string | number;
|
106
106
|
}>>;
|
package/es/tabs/style/index.mjs
CHANGED
package/es/tabs/types.d.ts
CHANGED
@@ -12,9 +12,11 @@ export type TabsProvide = {
|
|
12
12
|
id: string;
|
13
13
|
props: TabsProps;
|
14
14
|
setLine: () => void;
|
15
|
+
scrollable: ComputedRef<boolean>;
|
15
16
|
onRendered: (name: Numeric, title?: string) => void;
|
16
|
-
scrollIntoView: (immediate?: boolean) => void;
|
17
17
|
currentName: ComputedRef<Numeric | undefined>;
|
18
|
+
setTitleRefs: (index: number) => (el: unknown) => void;
|
19
|
+
scrollIntoView: (immediate?: boolean) => void;
|
18
20
|
};
|
19
21
|
export type TabsExpose = {
|
20
22
|
resize: () => void;
|
@@ -33,6 +33,7 @@ var stdin_default = defineComponent({
|
|
33
33
|
if (props.image && !slots.content) {
|
34
34
|
return _createVNode("image", {
|
35
35
|
"href": imageBase64.value,
|
36
|
+
"xlink:href": imageBase64.value,
|
36
37
|
"x": "0",
|
37
38
|
"y": "0",
|
38
39
|
"width": props.width,
|
@@ -61,6 +62,7 @@ var stdin_default = defineComponent({
|
|
61
62
|
"width": svgWidth,
|
62
63
|
"height": svgHeight,
|
63
64
|
"xmlns": "http://www.w3.org/2000/svg",
|
65
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
64
66
|
"style": {
|
65
67
|
padding: `0 ${props.gapX}px ${props.gapY}px 0`,
|
66
68
|
opacity: props.opacity
|
@@ -83,7 +85,7 @@ var stdin_default = defineComponent({
|
|
83
85
|
};
|
84
86
|
const makeSvgToBlobUrl = (svgStr) => {
|
85
87
|
const svgBlob = new Blob([svgStr], {
|
86
|
-
type: "image/svg+xml
|
88
|
+
type: "image/svg+xml"
|
87
89
|
});
|
88
90
|
return URL.createObjectURL(svgBlob);
|
89
91
|
};
|
package/lib/date-picker/utils.js
CHANGED
@@ -61,10 +61,9 @@ const genOptions = (min, max, type, formatter, filter) => {
|
|
61
61
|
const formatValueRange = (values, columns) => values.map((value, index) => {
|
62
62
|
const column = columns[index];
|
63
63
|
if (column.length) {
|
64
|
+
const minValue = +column[0].value;
|
64
65
|
const maxValue = +column[column.length - 1].value;
|
65
|
-
|
66
|
-
return String(maxValue);
|
67
|
-
}
|
66
|
+
return (0, import_utils.padZero)((0, import_utils.clamp)(+value, minValue, maxValue));
|
68
67
|
}
|
69
68
|
return value;
|
70
69
|
});
|
package/lib/field/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size:
|
1
|
+
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 18px;--van-field-clear-icon-size: 18px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{display:flex;width:100%;text-align:left;margin-bottom:var(--van-padding-base);word-break:break-word}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:read-only{cursor:default}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
|
package/lib/image/Image.js
CHANGED
@@ -171,7 +171,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
171
171
|
(0, import_vue2.onMounted)(() => {
|
172
172
|
(0, import_vue2.nextTick)(() => {
|
173
173
|
var _a;
|
174
|
-
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
174
|
+
if (((_a = imageRef.value) == null ? void 0 : _a.complete) && !props.lazyLoad) {
|
175
175
|
triggerLoad();
|
176
176
|
}
|
177
177
|
});
|