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.
Files changed (205) hide show
  1. package/es/date-picker/utils.mjs +3 -4
  2. package/es/field/index.css +1 -1
  3. package/es/image/Image.mjs +1 -1
  4. package/es/index.d.ts +2 -1
  5. package/es/index.mjs +4 -1
  6. package/es/locale/lang/bg-BG.d.ts +2 -1
  7. package/es/locale/lang/bg-BG.mjs +2 -1
  8. package/es/locale/lang/bn-BD.d.ts +2 -1
  9. package/es/locale/lang/bn-BD.mjs +2 -1
  10. package/es/locale/lang/da-DK.d.ts +2 -1
  11. package/es/locale/lang/da-DK.mjs +2 -1
  12. package/es/locale/lang/de-DE-formal.d.ts +2 -1
  13. package/es/locale/lang/de-DE-formal.mjs +2 -1
  14. package/es/locale/lang/de-DE.d.ts +2 -1
  15. package/es/locale/lang/de-DE.mjs +2 -1
  16. package/es/locale/lang/el-GR.d.ts +2 -1
  17. package/es/locale/lang/el-GR.mjs +2 -1
  18. package/es/locale/lang/en-US.d.ts +2 -1
  19. package/es/locale/lang/en-US.mjs +2 -1
  20. package/es/locale/lang/eo-EO.d.ts +2 -1
  21. package/es/locale/lang/eo-EO.mjs +2 -1
  22. package/es/locale/lang/es-ES.d.ts +2 -1
  23. package/es/locale/lang/es-ES.mjs +2 -1
  24. package/es/locale/lang/fa-IR.d.ts +2 -1
  25. package/es/locale/lang/fa-IR.mjs +2 -1
  26. package/es/locale/lang/fr-FR.d.ts +2 -1
  27. package/es/locale/lang/fr-FR.mjs +2 -1
  28. package/es/locale/lang/he-IL.d.ts +2 -1
  29. package/es/locale/lang/he-IL.mjs +2 -1
  30. package/es/locale/lang/hi-IN.d.ts +2 -1
  31. package/es/locale/lang/hi-IN.mjs +2 -1
  32. package/es/locale/lang/id-ID.d.ts +2 -1
  33. package/es/locale/lang/id-ID.mjs +2 -1
  34. package/es/locale/lang/is-IS.d.ts +2 -1
  35. package/es/locale/lang/is-IS.mjs +2 -1
  36. package/es/locale/lang/it-IT.d.ts +2 -1
  37. package/es/locale/lang/it-IT.mjs +3 -10
  38. package/es/locale/lang/ja-JP.d.ts +2 -1
  39. package/es/locale/lang/ja-JP.mjs +2 -1
  40. package/es/locale/lang/km-KH.d.ts +2 -1
  41. package/es/locale/lang/km-KH.mjs +2 -1
  42. package/es/locale/lang/ko-KR.d.ts +2 -1
  43. package/es/locale/lang/ko-KR.mjs +2 -1
  44. package/es/locale/lang/la-LA.d.ts +2 -1
  45. package/es/locale/lang/la-LA.mjs +2 -1
  46. package/es/locale/lang/mm-MN.d.ts +2 -1
  47. package/es/locale/lang/mm-MN.mjs +2 -1
  48. package/es/locale/lang/nb-NO.d.ts +2 -1
  49. package/es/locale/lang/nb-NO.mjs +2 -1
  50. package/es/locale/lang/nl-NL.d.ts +2 -1
  51. package/es/locale/lang/nl-NL.mjs +2 -1
  52. package/es/locale/lang/pt-BR.d.ts +2 -1
  53. package/es/locale/lang/pt-BR.mjs +2 -1
  54. package/es/locale/lang/ro-RO.d.ts +2 -1
  55. package/es/locale/lang/ro-RO.mjs +2 -1
  56. package/es/locale/lang/ru-RU.d.ts +2 -1
  57. package/es/locale/lang/ru-RU.mjs +2 -1
  58. package/es/locale/lang/sv-SE.d.ts +2 -1
  59. package/es/locale/lang/sv-SE.mjs +2 -1
  60. package/es/locale/lang/th-TH.d.ts +2 -1
  61. package/es/locale/lang/th-TH.mjs +2 -1
  62. package/es/locale/lang/tr-TR.d.ts +2 -1
  63. package/es/locale/lang/tr-TR.mjs +2 -1
  64. package/es/locale/lang/uk-UA.d.ts +2 -1
  65. package/es/locale/lang/uk-UA.mjs +3 -10
  66. package/es/locale/lang/vi-VN.d.ts +2 -1
  67. package/es/locale/lang/vi-VN.mjs +2 -1
  68. package/es/locale/lang/zh-CN.d.ts +2 -1
  69. package/es/locale/lang/zh-CN.mjs +2 -1
  70. package/es/locale/lang/zh-HK.d.ts +2 -1
  71. package/es/locale/lang/zh-HK.mjs +2 -1
  72. package/es/locale/lang/zh-TW.d.ts +2 -1
  73. package/es/locale/lang/zh-TW.mjs +2 -1
  74. package/es/pagination/Pagination.d.ts +26 -0
  75. package/es/pagination/Pagination.mjs +14 -4
  76. package/es/pagination/index.css +1 -1
  77. package/es/pagination/index.d.ts +18 -0
  78. package/es/picker/Picker.d.ts +2 -1
  79. package/es/picker/Picker.mjs +16 -6
  80. package/es/picker/PickerColumn.d.ts +2 -1
  81. package/es/picker/PickerColumn.mjs +10 -4
  82. package/es/picker/index.d.ts +2 -1
  83. package/es/signature/Signature.d.ts +63 -0
  84. package/es/signature/Signature.mjs +129 -0
  85. package/es/signature/index.css +1 -0
  86. package/es/signature/index.d.ts +50 -0
  87. package/es/signature/index.mjs +8 -0
  88. package/es/signature/style/index.d.ts +1 -0
  89. package/es/signature/style/index.mjs +6 -0
  90. package/es/sticky/Sticky.mjs +20 -4
  91. package/es/tab/Tab.mjs +24 -6
  92. package/es/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
  93. package/es/{tabs/TabsTitle.mjs → tab/TabTitle.mjs} +2 -2
  94. package/es/tabs/Tabs.d.ts +1 -1
  95. package/es/tabs/Tabs.mjs +15 -30
  96. package/es/tabs/index.d.ts +1 -1
  97. package/es/tabs/style/index.mjs +0 -1
  98. package/es/tabs/types.d.ts +3 -1
  99. package/es/watermark/Watermark.mjs +3 -1
  100. package/lib/date-picker/utils.js +2 -3
  101. package/lib/field/index.css +1 -1
  102. package/lib/image/Image.js +1 -1
  103. package/lib/index.css +1 -1
  104. package/lib/index.d.ts +2 -1
  105. package/lib/index.js +4 -1
  106. package/lib/locale/lang/bg-BG.d.ts +2 -1
  107. package/lib/locale/lang/bg-BG.js +2 -1
  108. package/lib/locale/lang/bn-BD.d.ts +2 -1
  109. package/lib/locale/lang/bn-BD.js +2 -1
  110. package/lib/locale/lang/da-DK.d.ts +2 -1
  111. package/lib/locale/lang/da-DK.js +2 -1
  112. package/lib/locale/lang/de-DE-formal.d.ts +2 -1
  113. package/lib/locale/lang/de-DE-formal.js +2 -1
  114. package/lib/locale/lang/de-DE.d.ts +2 -1
  115. package/lib/locale/lang/de-DE.js +2 -1
  116. package/lib/locale/lang/el-GR.d.ts +2 -1
  117. package/lib/locale/lang/el-GR.js +2 -1
  118. package/lib/locale/lang/en-US.d.ts +2 -1
  119. package/lib/locale/lang/en-US.js +2 -1
  120. package/lib/locale/lang/eo-EO.d.ts +2 -1
  121. package/lib/locale/lang/eo-EO.js +2 -1
  122. package/lib/locale/lang/es-ES.d.ts +2 -1
  123. package/lib/locale/lang/es-ES.js +2 -1
  124. package/lib/locale/lang/fa-IR.d.ts +2 -1
  125. package/lib/locale/lang/fa-IR.js +2 -1
  126. package/lib/locale/lang/fr-FR.d.ts +2 -1
  127. package/lib/locale/lang/fr-FR.js +2 -1
  128. package/lib/locale/lang/he-IL.d.ts +2 -1
  129. package/lib/locale/lang/he-IL.js +2 -1
  130. package/lib/locale/lang/hi-IN.d.ts +2 -1
  131. package/lib/locale/lang/hi-IN.js +2 -1
  132. package/lib/locale/lang/id-ID.d.ts +2 -1
  133. package/lib/locale/lang/id-ID.js +2 -1
  134. package/lib/locale/lang/is-IS.d.ts +2 -1
  135. package/lib/locale/lang/is-IS.js +2 -1
  136. package/lib/locale/lang/it-IT.d.ts +2 -1
  137. package/lib/locale/lang/it-IT.js +3 -10
  138. package/lib/locale/lang/ja-JP.d.ts +2 -1
  139. package/lib/locale/lang/ja-JP.js +2 -1
  140. package/lib/locale/lang/km-KH.d.ts +2 -1
  141. package/lib/locale/lang/km-KH.js +2 -1
  142. package/lib/locale/lang/ko-KR.d.ts +2 -1
  143. package/lib/locale/lang/ko-KR.js +2 -1
  144. package/lib/locale/lang/la-LA.d.ts +2 -1
  145. package/lib/locale/lang/la-LA.js +2 -1
  146. package/lib/locale/lang/mm-MN.d.ts +2 -1
  147. package/lib/locale/lang/mm-MN.js +2 -1
  148. package/lib/locale/lang/nb-NO.d.ts +2 -1
  149. package/lib/locale/lang/nb-NO.js +2 -1
  150. package/lib/locale/lang/nl-NL.d.ts +2 -1
  151. package/lib/locale/lang/nl-NL.js +2 -1
  152. package/lib/locale/lang/pt-BR.d.ts +2 -1
  153. package/lib/locale/lang/pt-BR.js +2 -1
  154. package/lib/locale/lang/ro-RO.d.ts +2 -1
  155. package/lib/locale/lang/ro-RO.js +2 -1
  156. package/lib/locale/lang/ru-RU.d.ts +2 -1
  157. package/lib/locale/lang/ru-RU.js +2 -1
  158. package/lib/locale/lang/sv-SE.d.ts +2 -1
  159. package/lib/locale/lang/sv-SE.js +2 -1
  160. package/lib/locale/lang/th-TH.d.ts +2 -1
  161. package/lib/locale/lang/th-TH.js +2 -1
  162. package/lib/locale/lang/tr-TR.d.ts +2 -1
  163. package/lib/locale/lang/tr-TR.js +2 -1
  164. package/lib/locale/lang/uk-UA.d.ts +2 -1
  165. package/lib/locale/lang/uk-UA.js +3 -10
  166. package/lib/locale/lang/vi-VN.d.ts +2 -1
  167. package/lib/locale/lang/vi-VN.js +2 -1
  168. package/lib/locale/lang/zh-CN.d.ts +2 -1
  169. package/lib/locale/lang/zh-CN.js +2 -1
  170. package/lib/locale/lang/zh-HK.d.ts +2 -1
  171. package/lib/locale/lang/zh-HK.js +2 -1
  172. package/lib/locale/lang/zh-TW.d.ts +2 -1
  173. package/lib/locale/lang/zh-TW.js +2 -1
  174. package/lib/pagination/Pagination.d.ts +26 -0
  175. package/lib/pagination/Pagination.js +13 -3
  176. package/lib/pagination/index.css +1 -1
  177. package/lib/pagination/index.d.ts +18 -0
  178. package/lib/picker/Picker.d.ts +2 -1
  179. package/lib/picker/Picker.js +16 -6
  180. package/lib/picker/PickerColumn.d.ts +2 -1
  181. package/lib/picker/PickerColumn.js +9 -3
  182. package/lib/picker/index.d.ts +2 -1
  183. package/lib/signature/Signature.d.ts +63 -0
  184. package/lib/signature/Signature.js +148 -0
  185. package/lib/signature/index.css +1 -0
  186. package/lib/signature/index.d.ts +50 -0
  187. package/lib/signature/index.js +37 -0
  188. package/lib/signature/style/index.d.ts +1 -0
  189. package/lib/signature/style/index.js +6 -0
  190. package/lib/sticky/Sticky.js +18 -2
  191. package/lib/tab/Tab.js +21 -3
  192. package/lib/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
  193. package/lib/{tabs/TabsTitle.js → tab/TabTitle.js} +2 -2
  194. package/lib/tabs/Tabs.d.ts +1 -1
  195. package/lib/tabs/Tabs.js +13 -28
  196. package/lib/tabs/index.d.ts +1 -1
  197. package/lib/tabs/style/index.js +0 -1
  198. package/lib/tabs/types.d.ts +3 -1
  199. package/lib/vant.cjs.js +1047 -877
  200. package/lib/vant.es.js +1047 -877
  201. package/lib/vant.js +1047 -877
  202. package/lib/vant.min.js +1 -1
  203. package/lib/watermark/Watermark.js +3 -1
  204. package/lib/web-types.json +1 -1
  205. package/package.json +8 -8
@@ -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 {};
@@ -0,0 +1,6 @@
1
+ require("../../style/base.css");
2
+ require("../../badge/index.css");
3
+ require("../../icon/index.css");
4
+ require("../../loading/index.css");
5
+ require("../../button/index.css");
6
+ require("../index.css");
@@ -52,8 +52,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
52
52
  // root height
53
53
  transform: 0
54
54
  });
55
+ const isReset = (0, import_vue2.ref)(false);
55
56
  const offset = (0, import_vue2.computed)(() => (0, import_utils.unitToPx)(props.position === "top" ? props.offsetTop : props.offsetBottom));
56
57
  const rootStyle = (0, import_vue2.computed)(() => {
58
+ if (isReset.value) {
59
+ return;
60
+ }
57
61
  const {
58
62
  fixed,
59
63
  height,
@@ -67,7 +71,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
67
71
  }
68
72
  });
69
73
  const stickyStyle = (0, import_vue2.computed)(() => {
70
- if (!state.fixed) {
74
+ if (!state.fixed || isReset.value) {
71
75
  return;
72
76
  }
73
77
  const style = (0, import_utils.extend)((0, import_utils.getZIndexStyle)(props.zIndex), {
@@ -126,6 +130,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
126
130
  passive: true
127
131
  });
128
132
  (0, import_use_visibility_change.useVisibilityChange)(root, onScroll);
133
+ (0, import_vue2.watch)([import_utils.windowWidth, import_utils.windowHeight], () => {
134
+ if (!root.value || (0, import_utils.isHidden)(root) || !state.fixed) {
135
+ return;
136
+ }
137
+ isReset.value = true;
138
+ (0, import_vue2.nextTick)(() => {
139
+ const rootRect = (0, import_use.useRect)(root);
140
+ state.width = rootRect.width;
141
+ state.height = rootRect.height;
142
+ isReset.value = false;
143
+ });
144
+ });
129
145
  return () => {
130
146
  var _a;
131
147
  return (0, import_vue.createVNode)("div", {
@@ -133,7 +149,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
133
149
  "style": rootStyle.value
134
150
  }, [(0, import_vue.createVNode)("div", {
135
151
  "class": bem({
136
- fixed: state.fixed
152
+ fixed: state.fixed && !isReset.value
137
153
  }),
138
154
  "style": stickyStyle.value
139
155
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
package/lib/tab/Tab.js CHANGED
@@ -30,6 +30,7 @@ var import_use_id = require("../composables/use-id");
30
30
  var import_use_expose = require("../composables/use-expose");
31
31
  var import_use_route = require("../composables/use-route");
32
32
  var import_use_tab_status = require("../composables/use-tab-status");
33
+ var import_TabTitle = require("./TabTitle");
33
34
  var import_swipe_item = require("../swipe-item");
34
35
  const [name, bem] = (0, import_utils.createNamespace)("tab");
35
36
  const tabProps = (0, import_utils.extend)({}, import_use_route.routeProps, {
@@ -50,6 +51,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
50
51
  }) {
51
52
  const id = (0, import_use_id.useId)();
52
53
  const inited = (0, import_vue2.ref)(false);
54
+ const instance = (0, import_vue2.getCurrentInstance)();
53
55
  const {
54
56
  parent,
55
57
  index
@@ -79,6 +81,21 @@ var stdin_default = (0, import_vue2.defineComponent)({
79
81
  }
80
82
  return isActive;
81
83
  });
84
+ const renderTitle = (onClickTab) => (0, import_vue.createVNode)(import_TabTitle.TabTitle, (0, import_vue.mergeProps)({
85
+ "key": id,
86
+ "id": `${parent.id}-${index.value}`,
87
+ "ref": parent.setTitleRefs(index.value),
88
+ "style": props.titleStyle,
89
+ "class": props.titleClass,
90
+ "isActive": active.value,
91
+ "controls": id,
92
+ "scrollable": parent.scrollable.value,
93
+ "activeColor": parent.props.titleActiveColor,
94
+ "inactiveColor": parent.props.titleInactiveColor,
95
+ "onClick": (event) => onClickTab(instance.proxy, index.value, event)
96
+ }, (0, import_utils.pick)(parent.props, ["type", "color", "shrink"]), (0, import_utils.pick)(props, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
97
+ title: slots.title
98
+ });
82
99
  const hasInactiveClass = (0, import_vue2.ref)(!active.value);
83
100
  (0, import_vue2.watch)(active, (val) => {
84
101
  if (val) {
@@ -94,6 +111,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
94
111
  parent.scrollIntoView();
95
112
  });
96
113
  (0, import_vue2.provide)(import_use_tab_status.TAB_STATUS_KEY, active);
114
+ (0, import_use_expose.useExpose)({
115
+ id,
116
+ renderTitle
117
+ });
97
118
  return () => {
98
119
  var _a;
99
120
  const label = `${parent.id}-${index.value}`;
@@ -128,9 +149,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
128
149
  }
129
150
  const shouldRender = inited.value || scrollspy || !lazyRender;
130
151
  const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
131
- (0, import_use_expose.useExpose)({
132
- id
133
- });
134
152
  return (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", {
135
153
  "id": id,
136
154
  "role": "tabpanel",
@@ -1,4 +1,4 @@
1
- declare const _default: import("vue").DefineComponent<{
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;
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var stdin_exports = {};
19
19
  __export(stdin_exports, {
20
- default: () => stdin_default
20
+ TabTitle: () => TabTitle
21
21
  });
22
22
  module.exports = __toCommonJS(stdin_exports);
23
23
  var import_vue = require("vue");
@@ -25,7 +25,7 @@ var import_vue2 = require("vue");
25
25
  var import_utils = require("../utils");
26
26
  var import_badge = require("../badge");
27
27
  const [name, bem] = (0, import_utils.createNamespace)("tab");
28
- var stdin_default = (0, import_vue2.defineComponent)({
28
+ const TabTitle = (0, import_vue2.defineComponent)({
29
29
  name,
30
30
  props: {
31
31
  id: String,
@@ -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/lib/tabs/Tabs.js CHANGED
@@ -44,7 +44,6 @@ var import_use_expose = require("../composables/use-expose");
44
44
  var import_on_popup_reopen = require("../composables/on-popup-reopen");
45
45
  var import_use_visibility_change = require("../composables/use-visibility-change");
46
46
  var import_sticky = require("../sticky");
47
- var import_TabsTitle = __toESM(require("./TabsTitle"));
48
47
  var import_TabsContent = __toESM(require("./TabsContent"));
49
48
  const [name, bem] = (0, import_utils.createNamespace)("tabs");
50
49
  const tabsProps = {
@@ -260,24 +259,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
260
259
  setCurrentIndex(index);
261
260
  }
262
261
  };
263
- const renderNav = () => children.map((item, index) => (0, import_vue.createVNode)(import_TabsTitle.default, (0, import_vue.mergeProps)({
264
- "key": item.id,
265
- "id": `${id}-${index}`,
266
- "ref": setTitleRefs(index),
267
- "type": props.type,
268
- "color": props.color,
269
- "style": item.titleStyle,
270
- "class": item.titleClass,
271
- "shrink": props.shrink,
272
- "isActive": index === state.currentIndex,
273
- "controls": item.id,
274
- "scrollable": scrollable.value,
275
- "activeColor": props.titleActiveColor,
276
- "inactiveColor": props.titleInactiveColor,
277
- "onClick": (event) => onClickTab(item, index, event)
278
- }, (0, import_utils.pick)(item, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
279
- title: item.$slots.title
280
- }));
281
262
  const renderLine = () => {
282
263
  if (props.type === "line" && children.length) {
283
264
  return (0, import_vue.createVNode)("div", {
@@ -307,7 +288,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
307
288
  }]),
308
289
  "style": navStyle.value,
309
290
  "aria-orientation": "horizontal"
310
- }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), renderNav(), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
291
+ }, [(_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)];
311
292
  if (sticky) {
312
293
  return (0, import_vue.createVNode)("div", {
313
294
  "ref": wrapRef
@@ -315,7 +296,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
315
296
  }
316
297
  return Header;
317
298
  };
318
- (0, import_vue2.watch)([() => props.color, import_utils.windowWidth], setLine);
299
+ const resize = () => {
300
+ setLine();
301
+ (0, import_vue2.nextTick)(() => {
302
+ var _a, _b;
303
+ scrollIntoView(true);
304
+ (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
305
+ });
306
+ };
307
+ (0, import_vue2.watch)(() => [props.color, props.duration, props.lineWidth, props.lineHeight], setLine);
308
+ (0, import_vue2.watch)(import_utils.windowWidth, resize);
319
309
  (0, import_vue2.watch)(() => props.active, (value) => {
320
310
  if (value !== currentName.value) {
321
311
  setCurrentIndexByName(value);
@@ -341,13 +331,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
341
331
  });
342
332
  };
343
333
  const onRendered = (name2, title) => emit("rendered", name2, title);
344
- const resize = () => {
345
- setLine();
346
- (0, import_vue2.nextTick)(() => {
347
- var _a, _b;
348
- return (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
349
- });
350
- };
351
334
  (0, import_use_expose.useExpose)({
352
335
  resize,
353
336
  scrollTo
@@ -364,8 +347,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
364
347
  id,
365
348
  props,
366
349
  setLine,
350
+ scrollable,
367
351
  onRendered,
368
352
  currentName,
353
+ setTitleRefs,
369
354
  scrollIntoView
370
355
  });
371
356
  return () => (0, import_vue.createVNode)("div", {
@@ -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
  }>>;
@@ -1,5 +1,4 @@
1
1
  require("../../style/base.css");
2
- require("../../badge/index.css");
3
2
  require("../../sticky/index.css");
4
3
  require("../../swipe/index.css");
5
4
  require("../index.css");
@@ -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;