vant 4.9.22 → 4.9.23

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 (202) hide show
  1. package/README.md +0 -2
  2. package/es/action-bar-icon/ActionBarIcon.d.ts +4 -0
  3. package/es/action-bar-icon/ActionBarIcon.mjs +12 -4
  4. package/es/action-bar-icon/index.css +1 -1
  5. package/es/action-bar-icon/index.d.ts +3 -0
  6. package/es/field/Field.mjs +2 -1
  7. package/es/floating-panel/FloatingPanel.d.ts +13 -0
  8. package/es/floating-panel/FloatingPanel.mjs +12 -0
  9. package/es/floating-panel/index.css +1 -1
  10. package/es/floating-panel/index.d.ts +9 -0
  11. package/es/index.d.ts +1 -1
  12. package/es/index.mjs +1 -1
  13. package/es/locale/lang/ar-SA.d.ts +1 -0
  14. package/es/locale/lang/ar-SA.mjs +10 -1
  15. package/es/locale/lang/bg-BG.d.ts +1 -0
  16. package/es/locale/lang/bg-BG.mjs +1 -0
  17. package/es/locale/lang/bn-BD.d.ts +1 -0
  18. package/es/locale/lang/bn-BD.mjs +1 -0
  19. package/es/locale/lang/da-DK.d.ts +1 -0
  20. package/es/locale/lang/da-DK.mjs +1 -0
  21. package/es/locale/lang/de-DE-formal.d.ts +1 -0
  22. package/es/locale/lang/de-DE-formal.mjs +1 -0
  23. package/es/locale/lang/de-DE.d.ts +1 -0
  24. package/es/locale/lang/de-DE.mjs +1 -0
  25. package/es/locale/lang/el-GR.d.ts +1 -0
  26. package/es/locale/lang/el-GR.mjs +1 -0
  27. package/es/locale/lang/en-US.d.ts +1 -0
  28. package/es/locale/lang/en-US.mjs +1 -0
  29. package/es/locale/lang/eo-EO.d.ts +1 -0
  30. package/es/locale/lang/eo-EO.mjs +1 -0
  31. package/es/locale/lang/es-ES.d.ts +1 -0
  32. package/es/locale/lang/es-ES.mjs +1 -0
  33. package/es/locale/lang/fa-IR.d.ts +1 -0
  34. package/es/locale/lang/fa-IR.mjs +1 -0
  35. package/es/locale/lang/fr-FR.d.ts +1 -0
  36. package/es/locale/lang/fr-FR.mjs +1 -0
  37. package/es/locale/lang/he-IL.d.ts +1 -0
  38. package/es/locale/lang/he-IL.mjs +1 -0
  39. package/es/locale/lang/hi-IN.d.ts +1 -0
  40. package/es/locale/lang/hi-IN.mjs +1 -0
  41. package/es/locale/lang/id-ID.d.ts +1 -0
  42. package/es/locale/lang/id-ID.mjs +1 -0
  43. package/es/locale/lang/is-IS.d.ts +1 -0
  44. package/es/locale/lang/is-IS.mjs +1 -0
  45. package/es/locale/lang/it-IT.d.ts +1 -0
  46. package/es/locale/lang/it-IT.mjs +1 -0
  47. package/es/locale/lang/ja-JP.d.ts +1 -0
  48. package/es/locale/lang/ja-JP.mjs +1 -0
  49. package/es/locale/lang/kk-KZ.d.ts +1 -0
  50. package/es/locale/lang/kk-KZ.mjs +1 -0
  51. package/es/locale/lang/km-KH.d.ts +1 -0
  52. package/es/locale/lang/km-KH.mjs +1 -0
  53. package/es/locale/lang/ko-KR.d.ts +1 -0
  54. package/es/locale/lang/ko-KR.mjs +1 -0
  55. package/es/locale/lang/la-LA.d.ts +1 -0
  56. package/es/locale/lang/la-LA.mjs +1 -0
  57. package/es/locale/lang/mm-MN.d.ts +1 -0
  58. package/es/locale/lang/mm-MN.mjs +1 -0
  59. package/es/locale/lang/nb-NO.d.ts +1 -0
  60. package/es/locale/lang/nb-NO.mjs +1 -0
  61. package/es/locale/lang/nl-NL.d.ts +1 -0
  62. package/es/locale/lang/nl-NL.mjs +1 -0
  63. package/es/locale/lang/pl-PL.d.ts +1 -0
  64. package/es/locale/lang/pl-PL.mjs +1 -0
  65. package/es/locale/lang/pt-BR.d.ts +1 -0
  66. package/es/locale/lang/pt-BR.mjs +1 -0
  67. package/es/locale/lang/ro-RO.d.ts +1 -0
  68. package/es/locale/lang/ro-RO.mjs +1 -0
  69. package/es/locale/lang/ru-RU.d.ts +1 -0
  70. package/es/locale/lang/ru-RU.mjs +1 -0
  71. package/es/locale/lang/sr-RS.d.ts +1 -0
  72. package/es/locale/lang/sr-RS.mjs +1 -0
  73. package/es/locale/lang/sv-SE.d.ts +1 -0
  74. package/es/locale/lang/sv-SE.mjs +1 -0
  75. package/es/locale/lang/th-TH.d.ts +1 -0
  76. package/es/locale/lang/th-TH.mjs +1 -0
  77. package/es/locale/lang/tr-TR.d.ts +1 -0
  78. package/es/locale/lang/tr-TR.mjs +1 -0
  79. package/es/locale/lang/uk-UA.d.ts +1 -0
  80. package/es/locale/lang/uk-UA.mjs +1 -0
  81. package/es/locale/lang/vi-VN.d.ts +1 -0
  82. package/es/locale/lang/vi-VN.mjs +1 -0
  83. package/es/locale/lang/zh-CN.d.ts +1 -0
  84. package/es/locale/lang/zh-CN.mjs +1 -0
  85. package/es/locale/lang/zh-HK.d.ts +1 -0
  86. package/es/locale/lang/zh-HK.mjs +1 -0
  87. package/es/locale/lang/zh-TW.d.ts +1 -0
  88. package/es/locale/lang/zh-TW.mjs +1 -0
  89. package/es/popup/index.d.ts +1 -0
  90. package/es/popup/index.mjs +7 -1
  91. package/es/progress/Progress.mjs +8 -4
  92. package/es/signature/Signature.d.ts +16 -0
  93. package/es/signature/Signature.mjs +32 -1
  94. package/es/signature/index.d.ts +11 -0
  95. package/es/signature/types.d.ts +1 -0
  96. package/es/swipe-cell/SwipeCell.d.ts +16 -0
  97. package/es/swipe-cell/SwipeCell.mjs +7 -2
  98. package/es/swipe-cell/index.d.ts +11 -0
  99. package/lib/action-bar-icon/ActionBarIcon.d.ts +4 -0
  100. package/lib/action-bar-icon/ActionBarIcon.js +12 -4
  101. package/lib/action-bar-icon/index.css +1 -1
  102. package/lib/action-bar-icon/index.d.ts +3 -0
  103. package/lib/field/Field.js +2 -1
  104. package/lib/floating-panel/FloatingPanel.d.ts +13 -0
  105. package/lib/floating-panel/FloatingPanel.js +12 -0
  106. package/lib/floating-panel/index.css +1 -1
  107. package/lib/floating-panel/index.d.ts +9 -0
  108. package/lib/index.css +1 -1
  109. package/lib/index.d.ts +1 -1
  110. package/lib/index.js +1 -1
  111. package/lib/locale/lang/ar-SA.d.ts +1 -0
  112. package/lib/locale/lang/ar-SA.js +10 -1
  113. package/lib/locale/lang/bg-BG.d.ts +1 -0
  114. package/lib/locale/lang/bg-BG.js +1 -0
  115. package/lib/locale/lang/bn-BD.d.ts +1 -0
  116. package/lib/locale/lang/bn-BD.js +1 -0
  117. package/lib/locale/lang/da-DK.d.ts +1 -0
  118. package/lib/locale/lang/da-DK.js +1 -0
  119. package/lib/locale/lang/de-DE-formal.d.ts +1 -0
  120. package/lib/locale/lang/de-DE-formal.js +1 -0
  121. package/lib/locale/lang/de-DE.d.ts +1 -0
  122. package/lib/locale/lang/de-DE.js +1 -0
  123. package/lib/locale/lang/el-GR.d.ts +1 -0
  124. package/lib/locale/lang/el-GR.js +1 -0
  125. package/lib/locale/lang/en-US.d.ts +1 -0
  126. package/lib/locale/lang/en-US.js +1 -0
  127. package/lib/locale/lang/eo-EO.d.ts +1 -0
  128. package/lib/locale/lang/eo-EO.js +1 -0
  129. package/lib/locale/lang/es-ES.d.ts +1 -0
  130. package/lib/locale/lang/es-ES.js +1 -0
  131. package/lib/locale/lang/fa-IR.d.ts +1 -0
  132. package/lib/locale/lang/fa-IR.js +1 -0
  133. package/lib/locale/lang/fr-FR.d.ts +1 -0
  134. package/lib/locale/lang/fr-FR.js +1 -0
  135. package/lib/locale/lang/he-IL.d.ts +1 -0
  136. package/lib/locale/lang/he-IL.js +1 -0
  137. package/lib/locale/lang/hi-IN.d.ts +1 -0
  138. package/lib/locale/lang/hi-IN.js +1 -0
  139. package/lib/locale/lang/id-ID.d.ts +1 -0
  140. package/lib/locale/lang/id-ID.js +1 -0
  141. package/lib/locale/lang/is-IS.d.ts +1 -0
  142. package/lib/locale/lang/is-IS.js +1 -0
  143. package/lib/locale/lang/it-IT.d.ts +1 -0
  144. package/lib/locale/lang/it-IT.js +1 -0
  145. package/lib/locale/lang/ja-JP.d.ts +1 -0
  146. package/lib/locale/lang/ja-JP.js +1 -0
  147. package/lib/locale/lang/kk-KZ.d.ts +1 -0
  148. package/lib/locale/lang/kk-KZ.js +1 -0
  149. package/lib/locale/lang/km-KH.d.ts +1 -0
  150. package/lib/locale/lang/km-KH.js +1 -0
  151. package/lib/locale/lang/ko-KR.d.ts +1 -0
  152. package/lib/locale/lang/ko-KR.js +1 -0
  153. package/lib/locale/lang/la-LA.d.ts +1 -0
  154. package/lib/locale/lang/la-LA.js +1 -0
  155. package/lib/locale/lang/mm-MN.d.ts +1 -0
  156. package/lib/locale/lang/mm-MN.js +1 -0
  157. package/lib/locale/lang/nb-NO.d.ts +1 -0
  158. package/lib/locale/lang/nb-NO.js +1 -0
  159. package/lib/locale/lang/nl-NL.d.ts +1 -0
  160. package/lib/locale/lang/nl-NL.js +1 -0
  161. package/lib/locale/lang/pl-PL.d.ts +1 -0
  162. package/lib/locale/lang/pl-PL.js +1 -0
  163. package/lib/locale/lang/pt-BR.d.ts +1 -0
  164. package/lib/locale/lang/pt-BR.js +1 -0
  165. package/lib/locale/lang/ro-RO.d.ts +1 -0
  166. package/lib/locale/lang/ro-RO.js +1 -0
  167. package/lib/locale/lang/ru-RU.d.ts +1 -0
  168. package/lib/locale/lang/ru-RU.js +1 -0
  169. package/lib/locale/lang/sr-RS.d.ts +1 -0
  170. package/lib/locale/lang/sr-RS.js +1 -0
  171. package/lib/locale/lang/sv-SE.d.ts +1 -0
  172. package/lib/locale/lang/sv-SE.js +1 -0
  173. package/lib/locale/lang/th-TH.d.ts +1 -0
  174. package/lib/locale/lang/th-TH.js +1 -0
  175. package/lib/locale/lang/tr-TR.d.ts +1 -0
  176. package/lib/locale/lang/tr-TR.js +1 -0
  177. package/lib/locale/lang/uk-UA.d.ts +1 -0
  178. package/lib/locale/lang/uk-UA.js +1 -0
  179. package/lib/locale/lang/vi-VN.d.ts +1 -0
  180. package/lib/locale/lang/vi-VN.js +1 -0
  181. package/lib/locale/lang/zh-CN.d.ts +1 -0
  182. package/lib/locale/lang/zh-CN.js +1 -0
  183. package/lib/locale/lang/zh-HK.d.ts +1 -0
  184. package/lib/locale/lang/zh-HK.js +1 -0
  185. package/lib/locale/lang/zh-TW.d.ts +1 -0
  186. package/lib/locale/lang/zh-TW.js +1 -0
  187. package/lib/popup/index.d.ts +1 -0
  188. package/lib/popup/index.js +4 -1
  189. package/lib/progress/Progress.js +8 -4
  190. package/lib/signature/Signature.d.ts +16 -0
  191. package/lib/signature/Signature.js +32 -1
  192. package/lib/signature/index.d.ts +11 -0
  193. package/lib/signature/types.d.ts +1 -0
  194. package/lib/swipe-cell/SwipeCell.d.ts +16 -0
  195. package/lib/swipe-cell/SwipeCell.js +7 -2
  196. package/lib/swipe-cell/index.d.ts +11 -0
  197. package/lib/vant.cjs.js +77 -13
  198. package/lib/vant.es.js +77 -13
  199. package/lib/vant.js +80 -16
  200. package/lib/vant.min.js +3 -3
  201. package/lib/web-types.json +1 -1
  202. package/package.json +33 -33
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  tel: string;
4
4
  save: string;
5
5
  clear: string;
6
+ undo: string;
6
7
  cancel: string;
7
8
  confirm: string;
8
9
  delete: string;
@@ -25,6 +25,7 @@ var stdin_default = {
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
+ undo: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
28
29
  cancel: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
29
30
  confirm: "\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438",
30
31
  delete: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  tel: string;
4
4
  save: string;
5
5
  clear: string;
6
+ undo: string;
6
7
  cancel: string;
7
8
  confirm: string;
8
9
  delete: string;
@@ -25,6 +25,7 @@ var stdin_default = {
25
25
  tel: "\u0110i\u1EC7n tho\u1EA1i",
26
26
  save: "C\u1EE9u",
27
27
  clear: "Th\xF4ng tho\xE1ng",
28
+ undo: "Ho\xE0n t\xE1c",
28
29
  cancel: "H\u1EE7y b\u1ECF",
29
30
  confirm: "X\xE1c nh\u1EADn",
30
31
  delete: "X\xF3a",
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  tel: string;
4
4
  save: string;
5
5
  clear: string;
6
+ undo: string;
6
7
  cancel: string;
7
8
  confirm: string;
8
9
  delete: string;
@@ -25,6 +25,7 @@ var stdin_default = {
25
25
  tel: "\u7535\u8BDD",
26
26
  save: "\u4FDD\u5B58",
27
27
  clear: "\u6E05\u7A7A",
28
+ undo: "\u64A4\u9500",
28
29
  cancel: "\u53D6\u6D88",
29
30
  confirm: "\u786E\u8BA4",
30
31
  delete: "\u5220\u9664",
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  tel: string;
4
4
  save: string;
5
5
  clear: string;
6
+ undo: string;
6
7
  cancel: string;
7
8
  confirm: string;
8
9
  delete: string;
@@ -25,6 +25,7 @@ var stdin_default = {
25
25
  tel: "\u96FB\u8A71",
26
26
  save: "\u4FDD\u5B58",
27
27
  clear: "\u6E05\u7A7A",
28
+ undo: "\u64A4\u92B7",
28
29
  cancel: "\u53D6\u6D88",
29
30
  confirm: "\u78BA\u8A8D",
30
31
  delete: "\u522A\u9664",
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  tel: string;
4
4
  save: string;
5
5
  clear: string;
6
+ undo: string;
6
7
  cancel: string;
7
8
  confirm: string;
8
9
  delete: string;
@@ -25,6 +25,7 @@ var stdin_default = {
25
25
  tel: "\u96FB\u8A71",
26
26
  save: "\u5132\u5B58",
27
27
  clear: "\u6E05\u7A7A",
28
+ undo: "\u5FA9\u539F",
28
29
  cancel: "\u53D6\u6D88",
29
30
  confirm: "\u78BA\u8A8D",
30
31
  delete: "\u522A\u9664",
@@ -120,6 +120,7 @@ export declare const Popup: import("../utils").WithInstall<import("vue").DefineC
120
120
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
121
121
  export default Popup;
122
122
  export { popupProps } from './Popup';
123
+ export { useGlobalZIndex, setGlobalZIndex, } from '../composables/use-global-z-index';
123
124
  export type { PopupProps } from './Popup';
124
125
  export type { PopupPosition, PopupInstance, PopupThemeVars, PopupCloseIconPosition, } from './types';
125
126
  declare module 'vue' {
@@ -29,11 +29,14 @@ var stdin_exports = {};
29
29
  __export(stdin_exports, {
30
30
  Popup: () => Popup,
31
31
  default: () => stdin_default,
32
- popupProps: () => import_Popup2.popupProps
32
+ popupProps: () => import_Popup2.popupProps,
33
+ setGlobalZIndex: () => import_use_global_z_index.setGlobalZIndex,
34
+ useGlobalZIndex: () => import_use_global_z_index.useGlobalZIndex
33
35
  });
34
36
  module.exports = __toCommonJS(stdin_exports);
35
37
  var import_utils = require("../utils");
36
38
  var import_Popup = __toESM(require("./Popup"));
37
39
  var import_Popup2 = require("./Popup");
40
+ var import_use_global_z_index = require("../composables/use-global-z-index");
38
41
  const Popup = (0, import_utils.withInstall)(import_Popup.default);
39
42
  var stdin_default = Popup;
@@ -42,7 +42,9 @@ const progressProps = {
42
42
  var stdin_default = (0, import_vue.defineComponent)({
43
43
  name,
44
44
  props: progressProps,
45
- setup(props) {
45
+ setup(props, {
46
+ slots
47
+ }) {
46
48
  const background = (0, import_vue.computed)(() => props.inactive ? void 0 : props.color);
47
49
  const format = (rate) => Math.min(Math.max(+rate, 0), 100);
48
50
  const renderPivot = () => {
@@ -53,8 +55,8 @@ var stdin_default = (0, import_vue.defineComponent)({
53
55
  percentage
54
56
  } = props;
55
57
  const safePercentage = format(percentage);
56
- const text = pivotText != null ? pivotText : `${percentage}%`;
57
- if (props.showPivot && text) {
58
+ const text = pivotText != null ? pivotText : `${safePercentage}%`;
59
+ if (props.showPivot && (slots.pivot || text)) {
58
60
  const style = {
59
61
  color: textColor,
60
62
  left: `${safePercentage}%`,
@@ -66,7 +68,9 @@ var stdin_default = (0, import_vue.defineComponent)({
66
68
  "class": bem("pivot", {
67
69
  inactive: props.inactive
68
70
  })
69
- }, [text]);
71
+ }, [slots.pivot ? slots.pivot({
72
+ percentage: safePercentage
73
+ }) : text]);
70
74
  }
71
75
  };
72
76
  return () => {
@@ -13,6 +13,11 @@ export declare const signatureProps: {
13
13
  type: NumberConstructor;
14
14
  default: number;
15
15
  };
16
+ historySize: {
17
+ type: NumberConstructor;
18
+ default: number;
19
+ };
20
+ undoButtonText: StringConstructor;
16
21
  clearButtonText: StringConstructor;
17
22
  backgroundColor: {
18
23
  type: import("vue").PropType<string>;
@@ -35,6 +40,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
35
40
  type: NumberConstructor;
36
41
  default: number;
37
42
  };
43
+ historySize: {
44
+ type: NumberConstructor;
45
+ default: number;
46
+ };
47
+ undoButtonText: StringConstructor;
38
48
  clearButtonText: StringConstructor;
39
49
  backgroundColor: {
40
50
  type: import("vue").PropType<string>;
@@ -55,6 +65,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
55
65
  type: NumberConstructor;
56
66
  default: number;
57
67
  };
68
+ historySize: {
69
+ type: NumberConstructor;
70
+ default: number;
71
+ };
72
+ undoButtonText: StringConstructor;
58
73
  clearButtonText: StringConstructor;
59
74
  backgroundColor: {
60
75
  type: import("vue").PropType<string>;
@@ -72,5 +87,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
72
87
  backgroundColor: string;
73
88
  lineWidth: number;
74
89
  penColor: string;
90
+ historySize: number;
75
91
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
76
92
  export default _default;
@@ -32,6 +32,8 @@ const signatureProps = {
32
32
  type: (0, import_utils.makeStringProp)("png"),
33
33
  penColor: (0, import_utils.makeStringProp)("#000"),
34
34
  lineWidth: (0, import_utils.makeNumberProp)(3),
35
+ historySize: (0, import_utils.makeNumberProp)(20),
36
+ undoButtonText: String,
35
37
  clearButtonText: String,
36
38
  backgroundColor: (0, import_utils.makeStringProp)(""),
37
39
  confirmButtonText: String
@@ -59,6 +61,15 @@ var stdin_default = (0, import_vue.defineComponent)({
59
61
  let canvasWidth = 0;
60
62
  let canvasHeight = 0;
61
63
  let canvasRect;
64
+ const history = (0, import_vue.ref)([]);
65
+ const saveState = () => {
66
+ if (ctx.value && canvasWidth && canvasHeight) {
67
+ if (history.value.length >= props.historySize) {
68
+ history.value.shift();
69
+ }
70
+ history.value.push(ctx.value.getImageData(0, 0, canvasWidth, canvasHeight));
71
+ }
72
+ };
62
73
  const touchStart = () => {
63
74
  if (!ctx.value) {
64
75
  return false;
@@ -85,6 +96,7 @@ var stdin_default = (0, import_vue.defineComponent)({
85
96
  };
86
97
  const touchEnd = (event) => {
87
98
  (0, import_utils.preventDefault)(event);
99
+ saveState();
88
100
  emit("end");
89
101
  };
90
102
  const isCanvasEmpty = (canvas) => {
@@ -125,8 +137,21 @@ var stdin_default = (0, import_vue.defineComponent)({
125
137
  ctx.value.closePath();
126
138
  setCanvasBgColor(ctx.value);
127
139
  }
140
+ history.value = [];
128
141
  emit("clear");
129
142
  };
143
+ const undo = () => {
144
+ if (history.value.length) {
145
+ history.value.pop();
146
+ if (ctx.value) {
147
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
148
+ setCanvasBgColor(ctx.value);
149
+ if (history.value.length) {
150
+ ctx.value.putImageData(history.value[history.value.length - 1], 0, 0);
151
+ }
152
+ }
153
+ }
154
+ };
130
155
  const initialize = () => {
131
156
  var _a, _b, _c;
132
157
  if (isRenderCanvas && canvasRef.value) {
@@ -150,7 +175,8 @@ var stdin_default = (0, import_vue.defineComponent)({
150
175
  (0, import_use_expose.useExpose)({
151
176
  resize,
152
177
  clear,
153
- submit
178
+ submit,
179
+ undo
154
180
  });
155
181
  return () => (0, import_vue.createVNode)("div", {
156
182
  "class": bem()
@@ -169,6 +195,11 @@ var stdin_default = (0, import_vue.defineComponent)({
169
195
  "onClick": clear
170
196
  }, {
171
197
  default: () => [props.clearButtonText || t("clear")]
198
+ }), (0, import_vue.createVNode)(import_button.Button, {
199
+ "size": "small",
200
+ "onClick": undo
201
+ }, {
202
+ default: () => [props.undoButtonText || t("undo")]
172
203
  }), (0, import_vue.createVNode)(import_button.Button, {
173
204
  "type": "primary",
174
205
  "size": "small",
@@ -12,6 +12,11 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
12
12
  type: NumberConstructor;
13
13
  default: number;
14
14
  };
15
+ historySize: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ };
19
+ undoButtonText: StringConstructor;
15
20
  clearButtonText: StringConstructor;
16
21
  backgroundColor: {
17
22
  type: import("vue").PropType<string>;
@@ -32,6 +37,11 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
32
37
  type: NumberConstructor;
33
38
  default: number;
34
39
  };
40
+ historySize: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
44
+ undoButtonText: StringConstructor;
35
45
  clearButtonText: StringConstructor;
36
46
  backgroundColor: {
37
47
  type: import("vue").PropType<string>;
@@ -49,6 +59,7 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
49
59
  backgroundColor: string;
50
60
  lineWidth: number;
51
61
  penColor: string;
62
+ historySize: number;
52
63
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
53
64
  export default Signature;
54
65
  export type { SignatureProps } from './Signature';
@@ -4,6 +4,7 @@ export type SignatureExpose = {
4
4
  resize: () => void;
5
5
  clear: () => void;
6
6
  submit: () => void;
7
+ undo: () => void;
7
8
  };
8
9
  export type SignatureInstance = ComponentPublicInstance<SignatureProps, SignatureExpose>;
9
10
  export type SignatureThemeVars = {
@@ -8,6 +8,11 @@ export declare const swipeCellProps: {
8
8
  disabled: BooleanConstructor;
9
9
  leftWidth: (NumberConstructor | StringConstructor)[];
10
10
  rightWidth: (NumberConstructor | StringConstructor)[];
11
+ threshold: {
12
+ type: (NumberConstructor | StringConstructor)[];
13
+ default: number;
14
+ validator: (value: number | string) => boolean;
15
+ };
11
16
  beforeClose: PropType<Interceptor>;
12
17
  stopPropagation: BooleanConstructor;
13
18
  };
@@ -20,6 +25,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
20
25
  disabled: BooleanConstructor;
21
26
  leftWidth: (NumberConstructor | StringConstructor)[];
22
27
  rightWidth: (NumberConstructor | StringConstructor)[];
28
+ threshold: {
29
+ type: (NumberConstructor | StringConstructor)[];
30
+ default: number;
31
+ validator: (value: number | string) => boolean;
32
+ };
23
33
  beforeClose: PropType<Interceptor>;
24
34
  stopPropagation: BooleanConstructor;
25
35
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "click" | "close")[], "open" | "click" | "close", import("vue").PublicProps, Readonly<ExtractPropTypes<{
@@ -30,6 +40,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
30
40
  disabled: BooleanConstructor;
31
41
  leftWidth: (NumberConstructor | StringConstructor)[];
32
42
  rightWidth: (NumberConstructor | StringConstructor)[];
43
+ threshold: {
44
+ type: (NumberConstructor | StringConstructor)[];
45
+ default: number;
46
+ validator: (value: number | string) => boolean;
47
+ };
33
48
  beforeClose: PropType<Interceptor>;
34
49
  stopPropagation: BooleanConstructor;
35
50
  }>> & Readonly<{
@@ -40,5 +55,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
40
55
  name: string | number;
41
56
  disabled: boolean;
42
57
  stopPropagation: boolean;
58
+ threshold: string | number;
43
59
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
44
60
  export default _default;
@@ -32,6 +32,11 @@ const swipeCellProps = {
32
32
  disabled: Boolean,
33
33
  leftWidth: import_utils.numericProp,
34
34
  rightWidth: import_utils.numericProp,
35
+ threshold: {
36
+ type: import_utils.numericProp,
37
+ default: 0.15,
38
+ validator: (value) => +value >= 0 && +value <= 1
39
+ },
35
40
  beforeClose: Function,
36
41
  stopPropagation: Boolean
37
42
  };
@@ -80,8 +85,8 @@ var stdin_default = (0, import_vue.defineComponent)({
80
85
  };
81
86
  const toggle = (side) => {
82
87
  const offset = Math.abs(state.offset);
83
- const THRESHOLD = 0.15;
84
- const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
88
+ const thresholdValue = +props.threshold;
89
+ const threshold = opened ? 1 - thresholdValue : thresholdValue;
85
90
  const width = side === "left" ? leftWidth.value : rightWidth.value;
86
91
  if (width && offset > width * threshold) {
87
92
  open(side);
@@ -7,6 +7,11 @@ export declare const SwipeCell: import("../utils").WithInstall<import("vue").Def
7
7
  disabled: BooleanConstructor;
8
8
  leftWidth: (NumberConstructor | StringConstructor)[];
9
9
  rightWidth: (NumberConstructor | StringConstructor)[];
10
+ threshold: {
11
+ type: (NumberConstructor | StringConstructor)[];
12
+ default: number;
13
+ validator: (value: number | string) => boolean;
14
+ };
10
15
  beforeClose: import("vue").PropType<import("../utils").Interceptor>;
11
16
  stopPropagation: BooleanConstructor;
12
17
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "click" | "close")[], "open" | "click" | "close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -17,6 +22,11 @@ export declare const SwipeCell: import("../utils").WithInstall<import("vue").Def
17
22
  disabled: BooleanConstructor;
18
23
  leftWidth: (NumberConstructor | StringConstructor)[];
19
24
  rightWidth: (NumberConstructor | StringConstructor)[];
25
+ threshold: {
26
+ type: (NumberConstructor | StringConstructor)[];
27
+ default: number;
28
+ validator: (value: number | string) => boolean;
29
+ };
20
30
  beforeClose: import("vue").PropType<import("../utils").Interceptor>;
21
31
  stopPropagation: BooleanConstructor;
22
32
  }>> & Readonly<{
@@ -27,6 +37,7 @@ export declare const SwipeCell: import("../utils").WithInstall<import("vue").Def
27
37
  name: string | number;
28
38
  disabled: boolean;
29
39
  stopPropagation: boolean;
40
+ threshold: string | number;
30
41
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
31
42
  export default SwipeCell;
32
43
  export { swipeCellProps } from './SwipeCell';
package/lib/vant.cjs.js CHANGED
@@ -263,6 +263,7 @@ var stdin_default$1W = {
263
263
  tel: "电话",
264
264
  save: "保存",
265
265
  clear: "清空",
266
+ undo: "撤销",
266
267
  cancel: "取消",
267
268
  confirm: "确认",
268
269
  delete: "删除",
@@ -1062,7 +1063,8 @@ const actionBarIconProps = extend({}, routeProps, {
1062
1063
  badge: numericProp,
1063
1064
  iconClass: unknownProp,
1064
1065
  badgeProps: Object,
1065
- iconPrefix: String
1066
+ iconPrefix: String,
1067
+ disabled: Boolean
1066
1068
  });
1067
1069
  var stdin_default$1M = vue.defineComponent({
1068
1070
  name: name$1D,
@@ -1102,11 +1104,18 @@ var stdin_default$1M = vue.defineComponent({
1102
1104
  "classPrefix": iconPrefix
1103
1105
  }, null);
1104
1106
  };
1107
+ const onClick = () => {
1108
+ if (!props2.disabled) {
1109
+ route2();
1110
+ }
1111
+ };
1105
1112
  return () => vue.createVNode("div", {
1106
1113
  "role": "button",
1107
- "class": bem$1y(),
1108
- "tabindex": 0,
1109
- "onClick": route2
1114
+ "class": bem$1y({
1115
+ disabled: props2.disabled
1116
+ }),
1117
+ "tabindex": props2.disabled ? -1 : 0,
1118
+ "onClick": onClick
1110
1119
  }, [renderIcon(), slots.default ? slots.default() : props2.text]);
1111
1120
  }
1112
1121
  });
@@ -4291,10 +4300,11 @@ var stdin_default$1v = vue.defineComponent({
4291
4300
  if (modelValue && getStringLength(modelValue) === +maxlength) {
4292
4301
  return modelValue;
4293
4302
  }
4294
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4303
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4295
4304
  if (state.focused && selectionEnd) {
4296
4305
  const valueArr = [...value];
4297
4306
  const exceededLength = valueArr.length - +maxlength;
4307
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
4298
4308
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
4299
4309
  return valueArr.join("");
4300
4310
  }
@@ -10343,6 +10353,7 @@ const floatingPanelProps = {
10343
10353
  anchors: makeArrayProp(),
10344
10354
  duration: makeNumericProp(0.3),
10345
10355
  magnetic: truthProp,
10356
+ draggable: truthProp,
10346
10357
  contentDraggable: truthProp,
10347
10358
  lockScroll: Boolean,
10348
10359
  safeAreaInsetBottom: truthProp
@@ -10392,6 +10403,7 @@ var stdin_default$R = vue.defineComponent({
10392
10403
  let maxScroll = -1;
10393
10404
  const touch = useTouch();
10394
10405
  const onTouchstart = (e) => {
10406
+ if (!props2.draggable) return;
10395
10407
  touch.start(e);
10396
10408
  dragging.value = true;
10397
10409
  startY = -height.value;
@@ -10399,6 +10411,7 @@ var stdin_default$R = vue.defineComponent({
10399
10411
  };
10400
10412
  const onTouchmove = (e) => {
10401
10413
  var _a;
10414
+ if (!props2.draggable) return;
10402
10415
  touch.move(e);
10403
10416
  const target = e.target;
10404
10417
  if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
@@ -10418,7 +10431,13 @@ var stdin_default$R = vue.defineComponent({
10418
10431
  };
10419
10432
  const onTouchend = () => {
10420
10433
  maxScroll = -1;
10434
+ if (!dragging.value) {
10435
+ return;
10436
+ }
10421
10437
  dragging.value = false;
10438
+ if (!props2.draggable) {
10439
+ return;
10440
+ }
10422
10441
  if (props2.magnetic) {
10423
10442
  height.value = closest(anchors.value, height.value);
10424
10443
  } else {
@@ -10447,6 +10466,9 @@ var stdin_default$R = vue.defineComponent({
10447
10466
  if (slots.header) {
10448
10467
  return slots.header();
10449
10468
  }
10469
+ if (!props2.draggable) {
10470
+ return null;
10471
+ }
10450
10472
  return vue.createVNode("div", {
10451
10473
  "class": bem$I("header")
10452
10474
  }, [vue.createVNode("div", {
@@ -12873,7 +12895,9 @@ const progressProps = {
12873
12895
  var stdin_default$A = vue.defineComponent({
12874
12896
  name: name$s,
12875
12897
  props: progressProps,
12876
- setup(props2) {
12898
+ setup(props2, {
12899
+ slots
12900
+ }) {
12877
12901
  const background = vue.computed(() => props2.inactive ? void 0 : props2.color);
12878
12902
  const format2 = (rate) => Math.min(Math.max(+rate, 0), 100);
12879
12903
  const renderPivot = () => {
@@ -12884,8 +12908,8 @@ var stdin_default$A = vue.defineComponent({
12884
12908
  percentage
12885
12909
  } = props2;
12886
12910
  const safePercentage = format2(percentage);
12887
- const text = pivotText != null ? pivotText : `${percentage}%`;
12888
- if (props2.showPivot && text) {
12911
+ const text = pivotText != null ? pivotText : `${safePercentage}%`;
12912
+ if (props2.showPivot && (slots.pivot || text)) {
12889
12913
  const style = {
12890
12914
  color: textColor,
12891
12915
  left: `${safePercentage}%`,
@@ -12897,7 +12921,9 @@ var stdin_default$A = vue.defineComponent({
12897
12921
  "class": bem$r("pivot", {
12898
12922
  inactive: props2.inactive
12899
12923
  })
12900
- }, [text]);
12924
+ }, [slots.pivot ? slots.pivot({
12925
+ percentage: safePercentage
12926
+ }) : text]);
12901
12927
  }
12902
12928
  };
12903
12929
  return () => {
@@ -13789,6 +13815,8 @@ const signatureProps = {
13789
13815
  type: makeStringProp("png"),
13790
13816
  penColor: makeStringProp("#000"),
13791
13817
  lineWidth: makeNumberProp(3),
13818
+ historySize: makeNumberProp(20),
13819
+ undoButtonText: String,
13792
13820
  clearButtonText: String,
13793
13821
  backgroundColor: makeStringProp(""),
13794
13822
  confirmButtonText: String
@@ -13816,6 +13844,15 @@ var stdin_default$r = vue.defineComponent({
13816
13844
  let canvasWidth = 0;
13817
13845
  let canvasHeight = 0;
13818
13846
  let canvasRect;
13847
+ const history = vue.ref([]);
13848
+ const saveState = () => {
13849
+ if (ctx.value && canvasWidth && canvasHeight) {
13850
+ if (history.value.length >= props2.historySize) {
13851
+ history.value.shift();
13852
+ }
13853
+ history.value.push(ctx.value.getImageData(0, 0, canvasWidth, canvasHeight));
13854
+ }
13855
+ };
13819
13856
  const touchStart = () => {
13820
13857
  if (!ctx.value) {
13821
13858
  return false;
@@ -13842,6 +13879,7 @@ var stdin_default$r = vue.defineComponent({
13842
13879
  };
13843
13880
  const touchEnd = (event) => {
13844
13881
  preventDefault(event);
13882
+ saveState();
13845
13883
  emit("end");
13846
13884
  };
13847
13885
  const isCanvasEmpty = (canvas) => {
@@ -13882,8 +13920,21 @@ var stdin_default$r = vue.defineComponent({
13882
13920
  ctx.value.closePath();
13883
13921
  setCanvasBgColor(ctx.value);
13884
13922
  }
13923
+ history.value = [];
13885
13924
  emit("clear");
13886
13925
  };
13926
+ const undo = () => {
13927
+ if (history.value.length) {
13928
+ history.value.pop();
13929
+ if (ctx.value) {
13930
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13931
+ setCanvasBgColor(ctx.value);
13932
+ if (history.value.length) {
13933
+ ctx.value.putImageData(history.value[history.value.length - 1], 0, 0);
13934
+ }
13935
+ }
13936
+ }
13937
+ };
13887
13938
  const initialize = () => {
13888
13939
  var _a, _b, _c;
13889
13940
  if (isRenderCanvas && canvasRef.value) {
@@ -13907,7 +13958,8 @@ var stdin_default$r = vue.defineComponent({
13907
13958
  useExpose({
13908
13959
  resize,
13909
13960
  clear,
13910
- submit
13961
+ submit,
13962
+ undo
13911
13963
  });
13912
13964
  return () => vue.createVNode("div", {
13913
13965
  "class": bem$i()
@@ -13926,6 +13978,11 @@ var stdin_default$r = vue.defineComponent({
13926
13978
  "onClick": clear
13927
13979
  }, {
13928
13980
  default: () => [props2.clearButtonText || t$2("clear")]
13981
+ }), vue.createVNode(Button, {
13982
+ "size": "small",
13983
+ "onClick": undo
13984
+ }, {
13985
+ default: () => [props2.undoButtonText || t$2("undo")]
13929
13986
  }), vue.createVNode(Button, {
13930
13987
  "type": "primary",
13931
13988
  "size": "small",
@@ -14967,6 +15024,11 @@ const swipeCellProps = {
14967
15024
  disabled: Boolean,
14968
15025
  leftWidth: numericProp,
14969
15026
  rightWidth: numericProp,
15027
+ threshold: {
15028
+ type: numericProp,
15029
+ default: 0.15,
15030
+ validator: (value) => +value >= 0 && +value <= 1
15031
+ },
14970
15032
  beforeClose: Function,
14971
15033
  stopPropagation: Boolean
14972
15034
  };
@@ -15015,8 +15077,8 @@ var stdin_default$c = vue.defineComponent({
15015
15077
  };
15016
15078
  const toggle = (side) => {
15017
15079
  const offset = Math.abs(state.offset);
15018
- const THRESHOLD = 0.15;
15019
- const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
15080
+ const thresholdValue = +props2.threshold;
15081
+ const threshold = opened ? 1 - thresholdValue : thresholdValue;
15020
15082
  const width = side === "left" ? leftWidth.value : rightWidth.value;
15021
15083
  if (width && offset > width * threshold) {
15022
15084
  open(side);
@@ -17129,7 +17191,7 @@ const Lazyload = {
17129
17191
  });
17130
17192
  }
17131
17193
  };
17132
- const version = "4.9.22";
17194
+ const version = "4.9.23";
17133
17195
  function install(app) {
17134
17196
  const components = [
17135
17197
  ActionBar,
@@ -17427,6 +17489,7 @@ exports.rollingTextProps = rollingTextProps;
17427
17489
  exports.rowProps = rowProps;
17428
17490
  exports.searchProps = searchProps;
17429
17491
  exports.setDialogDefaultOptions = setDialogDefaultOptions;
17492
+ exports.setGlobalZIndex = setGlobalZIndex;
17430
17493
  exports.setNotifyDefaultOptions = setNotifyDefaultOptions;
17431
17494
  exports.setToastDefaultOptions = setToastDefaultOptions;
17432
17495
  exports.shareSheetProps = shareSheetProps;
@@ -17466,6 +17529,7 @@ exports.treeSelectProps = treeSelectProps;
17466
17529
  exports.uploaderProps = uploaderProps;
17467
17530
  exports.useAllTabStatus = useAllTabStatus;
17468
17531
  exports.useCurrentLang = useCurrentLang;
17532
+ exports.useGlobalZIndex = useGlobalZIndex;
17469
17533
  exports.useTabStatus = useTabStatus;
17470
17534
  exports.version = version;
17471
17535
  exports.watermarkProps = watermarkProps;