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
package/lib/vant.es.js CHANGED
@@ -261,6 +261,7 @@ var stdin_default$1W = {
261
261
  tel: "电话",
262
262
  save: "保存",
263
263
  clear: "清空",
264
+ undo: "撤销",
264
265
  cancel: "取消",
265
266
  confirm: "确认",
266
267
  delete: "删除",
@@ -1060,7 +1061,8 @@ const actionBarIconProps = extend({}, routeProps, {
1060
1061
  badge: numericProp,
1061
1062
  iconClass: unknownProp,
1062
1063
  badgeProps: Object,
1063
- iconPrefix: String
1064
+ iconPrefix: String,
1065
+ disabled: Boolean
1064
1066
  });
1065
1067
  var stdin_default$1M = defineComponent({
1066
1068
  name: name$1D,
@@ -1100,11 +1102,18 @@ var stdin_default$1M = defineComponent({
1100
1102
  "classPrefix": iconPrefix
1101
1103
  }, null);
1102
1104
  };
1105
+ const onClick = () => {
1106
+ if (!props2.disabled) {
1107
+ route2();
1108
+ }
1109
+ };
1103
1110
  return () => createVNode("div", {
1104
1111
  "role": "button",
1105
- "class": bem$1y(),
1106
- "tabindex": 0,
1107
- "onClick": route2
1112
+ "class": bem$1y({
1113
+ disabled: props2.disabled
1114
+ }),
1115
+ "tabindex": props2.disabled ? -1 : 0,
1116
+ "onClick": onClick
1108
1117
  }, [renderIcon(), slots.default ? slots.default() : props2.text]);
1109
1118
  }
1110
1119
  });
@@ -4289,10 +4298,11 @@ var stdin_default$1v = defineComponent({
4289
4298
  if (modelValue && getStringLength(modelValue) === +maxlength) {
4290
4299
  return modelValue;
4291
4300
  }
4292
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4301
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4293
4302
  if (state.focused && selectionEnd) {
4294
4303
  const valueArr = [...value];
4295
4304
  const exceededLength = valueArr.length - +maxlength;
4305
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
4296
4306
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
4297
4307
  return valueArr.join("");
4298
4308
  }
@@ -10341,6 +10351,7 @@ const floatingPanelProps = {
10341
10351
  anchors: makeArrayProp(),
10342
10352
  duration: makeNumericProp(0.3),
10343
10353
  magnetic: truthProp,
10354
+ draggable: truthProp,
10344
10355
  contentDraggable: truthProp,
10345
10356
  lockScroll: Boolean,
10346
10357
  safeAreaInsetBottom: truthProp
@@ -10390,6 +10401,7 @@ var stdin_default$R = defineComponent({
10390
10401
  let maxScroll = -1;
10391
10402
  const touch = useTouch();
10392
10403
  const onTouchstart = (e) => {
10404
+ if (!props2.draggable) return;
10393
10405
  touch.start(e);
10394
10406
  dragging.value = true;
10395
10407
  startY = -height.value;
@@ -10397,6 +10409,7 @@ var stdin_default$R = defineComponent({
10397
10409
  };
10398
10410
  const onTouchmove = (e) => {
10399
10411
  var _a;
10412
+ if (!props2.draggable) return;
10400
10413
  touch.move(e);
10401
10414
  const target = e.target;
10402
10415
  if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
@@ -10416,7 +10429,13 @@ var stdin_default$R = defineComponent({
10416
10429
  };
10417
10430
  const onTouchend = () => {
10418
10431
  maxScroll = -1;
10432
+ if (!dragging.value) {
10433
+ return;
10434
+ }
10419
10435
  dragging.value = false;
10436
+ if (!props2.draggable) {
10437
+ return;
10438
+ }
10420
10439
  if (props2.magnetic) {
10421
10440
  height.value = closest(anchors.value, height.value);
10422
10441
  } else {
@@ -10445,6 +10464,9 @@ var stdin_default$R = defineComponent({
10445
10464
  if (slots.header) {
10446
10465
  return slots.header();
10447
10466
  }
10467
+ if (!props2.draggable) {
10468
+ return null;
10469
+ }
10448
10470
  return createVNode("div", {
10449
10471
  "class": bem$I("header")
10450
10472
  }, [createVNode("div", {
@@ -12871,7 +12893,9 @@ const progressProps = {
12871
12893
  var stdin_default$A = defineComponent({
12872
12894
  name: name$s,
12873
12895
  props: progressProps,
12874
- setup(props2) {
12896
+ setup(props2, {
12897
+ slots
12898
+ }) {
12875
12899
  const background = computed(() => props2.inactive ? void 0 : props2.color);
12876
12900
  const format2 = (rate) => Math.min(Math.max(+rate, 0), 100);
12877
12901
  const renderPivot = () => {
@@ -12882,8 +12906,8 @@ var stdin_default$A = defineComponent({
12882
12906
  percentage
12883
12907
  } = props2;
12884
12908
  const safePercentage = format2(percentage);
12885
- const text = pivotText != null ? pivotText : `${percentage}%`;
12886
- if (props2.showPivot && text) {
12909
+ const text = pivotText != null ? pivotText : `${safePercentage}%`;
12910
+ if (props2.showPivot && (slots.pivot || text)) {
12887
12911
  const style = {
12888
12912
  color: textColor,
12889
12913
  left: `${safePercentage}%`,
@@ -12895,7 +12919,9 @@ var stdin_default$A = defineComponent({
12895
12919
  "class": bem$r("pivot", {
12896
12920
  inactive: props2.inactive
12897
12921
  })
12898
- }, [text]);
12922
+ }, [slots.pivot ? slots.pivot({
12923
+ percentage: safePercentage
12924
+ }) : text]);
12899
12925
  }
12900
12926
  };
12901
12927
  return () => {
@@ -13787,6 +13813,8 @@ const signatureProps = {
13787
13813
  type: makeStringProp("png"),
13788
13814
  penColor: makeStringProp("#000"),
13789
13815
  lineWidth: makeNumberProp(3),
13816
+ historySize: makeNumberProp(20),
13817
+ undoButtonText: String,
13790
13818
  clearButtonText: String,
13791
13819
  backgroundColor: makeStringProp(""),
13792
13820
  confirmButtonText: String
@@ -13814,6 +13842,15 @@ var stdin_default$r = defineComponent({
13814
13842
  let canvasWidth = 0;
13815
13843
  let canvasHeight = 0;
13816
13844
  let canvasRect;
13845
+ const history = ref([]);
13846
+ const saveState = () => {
13847
+ if (ctx.value && canvasWidth && canvasHeight) {
13848
+ if (history.value.length >= props2.historySize) {
13849
+ history.value.shift();
13850
+ }
13851
+ history.value.push(ctx.value.getImageData(0, 0, canvasWidth, canvasHeight));
13852
+ }
13853
+ };
13817
13854
  const touchStart = () => {
13818
13855
  if (!ctx.value) {
13819
13856
  return false;
@@ -13840,6 +13877,7 @@ var stdin_default$r = defineComponent({
13840
13877
  };
13841
13878
  const touchEnd = (event) => {
13842
13879
  preventDefault(event);
13880
+ saveState();
13843
13881
  emit("end");
13844
13882
  };
13845
13883
  const isCanvasEmpty = (canvas) => {
@@ -13880,8 +13918,21 @@ var stdin_default$r = defineComponent({
13880
13918
  ctx.value.closePath();
13881
13919
  setCanvasBgColor(ctx.value);
13882
13920
  }
13921
+ history.value = [];
13883
13922
  emit("clear");
13884
13923
  };
13924
+ const undo = () => {
13925
+ if (history.value.length) {
13926
+ history.value.pop();
13927
+ if (ctx.value) {
13928
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13929
+ setCanvasBgColor(ctx.value);
13930
+ if (history.value.length) {
13931
+ ctx.value.putImageData(history.value[history.value.length - 1], 0, 0);
13932
+ }
13933
+ }
13934
+ }
13935
+ };
13885
13936
  const initialize = () => {
13886
13937
  var _a, _b, _c;
13887
13938
  if (isRenderCanvas && canvasRef.value) {
@@ -13905,7 +13956,8 @@ var stdin_default$r = defineComponent({
13905
13956
  useExpose({
13906
13957
  resize,
13907
13958
  clear,
13908
- submit
13959
+ submit,
13960
+ undo
13909
13961
  });
13910
13962
  return () => createVNode("div", {
13911
13963
  "class": bem$i()
@@ -13924,6 +13976,11 @@ var stdin_default$r = defineComponent({
13924
13976
  "onClick": clear
13925
13977
  }, {
13926
13978
  default: () => [props2.clearButtonText || t$2("clear")]
13979
+ }), createVNode(Button, {
13980
+ "size": "small",
13981
+ "onClick": undo
13982
+ }, {
13983
+ default: () => [props2.undoButtonText || t$2("undo")]
13927
13984
  }), createVNode(Button, {
13928
13985
  "type": "primary",
13929
13986
  "size": "small",
@@ -14965,6 +15022,11 @@ const swipeCellProps = {
14965
15022
  disabled: Boolean,
14966
15023
  leftWidth: numericProp,
14967
15024
  rightWidth: numericProp,
15025
+ threshold: {
15026
+ type: numericProp,
15027
+ default: 0.15,
15028
+ validator: (value) => +value >= 0 && +value <= 1
15029
+ },
14968
15030
  beforeClose: Function,
14969
15031
  stopPropagation: Boolean
14970
15032
  };
@@ -15013,8 +15075,8 @@ var stdin_default$c = defineComponent({
15013
15075
  };
15014
15076
  const toggle = (side) => {
15015
15077
  const offset = Math.abs(state.offset);
15016
- const THRESHOLD = 0.15;
15017
- const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
15078
+ const thresholdValue = +props2.threshold;
15079
+ const threshold = opened ? 1 - thresholdValue : thresholdValue;
15018
15080
  const width = side === "left" ? leftWidth.value : rightWidth.value;
15019
15081
  if (width && offset > width * threshold) {
15020
15082
  open(side);
@@ -17127,7 +17189,7 @@ const Lazyload = {
17127
17189
  });
17128
17190
  }
17129
17191
  };
17130
- const version = "4.9.22";
17192
+ const version = "4.9.23";
17131
17193
  function install(app) {
17132
17194
  const components = [
17133
17195
  ActionBar,
@@ -17426,6 +17488,7 @@ export {
17426
17488
  rowProps,
17427
17489
  searchProps,
17428
17490
  setDialogDefaultOptions,
17491
+ setGlobalZIndex,
17429
17492
  setNotifyDefaultOptions,
17430
17493
  setToastDefaultOptions,
17431
17494
  shareSheetProps,
@@ -17465,6 +17528,7 @@ export {
17465
17528
  uploaderProps,
17466
17529
  useAllTabStatus,
17467
17530
  useCurrentLang,
17531
+ useGlobalZIndex,
17468
17532
  useTabStatus,
17469
17533
  version,
17470
17534
  watermarkProps
package/lib/vant.js CHANGED
@@ -66,7 +66,7 @@
66
66
  type: String,
67
67
  default: defaultVal
68
68
  });
69
- const inBrowser = "undefined" != typeof window;
69
+ const inBrowser = "u" > typeof window;
70
70
  function raf(fn) {
71
71
  return inBrowser ? requestAnimationFrame(fn) : -1;
72
72
  }
@@ -617,6 +617,7 @@
617
617
  tel: "电话",
618
618
  save: "保存",
619
619
  clear: "清空",
620
+ undo: "撤销",
620
621
  cancel: "取消",
621
622
  confirm: "确认",
622
623
  delete: "删除",
@@ -1416,7 +1417,8 @@
1416
1417
  badge: numericProp,
1417
1418
  iconClass: unknownProp,
1418
1419
  badgeProps: Object,
1419
- iconPrefix: String
1420
+ iconPrefix: String,
1421
+ disabled: Boolean
1420
1422
  });
1421
1423
  var stdin_default$1M = vue.defineComponent({
1422
1424
  name: name$1D,
@@ -1456,11 +1458,18 @@
1456
1458
  "classPrefix": iconPrefix
1457
1459
  }, null);
1458
1460
  };
1461
+ const onClick = () => {
1462
+ if (!props2.disabled) {
1463
+ route2();
1464
+ }
1465
+ };
1459
1466
  return () => vue.createVNode("div", {
1460
1467
  "role": "button",
1461
- "class": bem$1y(),
1462
- "tabindex": 0,
1463
- "onClick": route2
1468
+ "class": bem$1y({
1469
+ disabled: props2.disabled
1470
+ }),
1471
+ "tabindex": props2.disabled ? -1 : 0,
1472
+ "onClick": onClick
1464
1473
  }, [renderIcon(), slots.default ? slots.default() : props2.text]);
1465
1474
  }
1466
1475
  });
@@ -2353,7 +2362,7 @@
2353
2362
  return propRef;
2354
2363
  };
2355
2364
  /**
2356
- * @vue/shared v3.5.25
2365
+ * @vue/shared v3.5.31
2357
2366
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2358
2367
  * @license MIT
2359
2368
  **/
@@ -4718,10 +4727,11 @@
4718
4727
  if (modelValue && getStringLength(modelValue) === +maxlength) {
4719
4728
  return modelValue;
4720
4729
  }
4721
- const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4730
+ let selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4722
4731
  if (state.focused && selectionEnd) {
4723
4732
  const valueArr = [...value];
4724
4733
  const exceededLength = valueArr.length - +maxlength;
4734
+ selectionEnd = getStringLength(value.slice(0, selectionEnd));
4725
4735
  valueArr.splice(selectionEnd - exceededLength, exceededLength);
4726
4736
  return valueArr.join("");
4727
4737
  }
@@ -10744,6 +10754,7 @@
10744
10754
  anchors: makeArrayProp(),
10745
10755
  duration: makeNumericProp(0.3),
10746
10756
  magnetic: truthProp,
10757
+ draggable: truthProp,
10747
10758
  contentDraggable: truthProp,
10748
10759
  lockScroll: Boolean,
10749
10760
  safeAreaInsetBottom: truthProp
@@ -10793,6 +10804,7 @@
10793
10804
  let maxScroll = -1;
10794
10805
  const touch = useTouch();
10795
10806
  const onTouchstart = (e) => {
10807
+ if (!props2.draggable) return;
10796
10808
  touch.start(e);
10797
10809
  dragging.value = true;
10798
10810
  startY = -height.value;
@@ -10800,6 +10812,7 @@
10800
10812
  };
10801
10813
  const onTouchmove = (e) => {
10802
10814
  var _a;
10815
+ if (!props2.draggable) return;
10803
10816
  touch.move(e);
10804
10817
  const target = e.target;
10805
10818
  if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
@@ -10819,7 +10832,13 @@
10819
10832
  };
10820
10833
  const onTouchend = () => {
10821
10834
  maxScroll = -1;
10835
+ if (!dragging.value) {
10836
+ return;
10837
+ }
10822
10838
  dragging.value = false;
10839
+ if (!props2.draggable) {
10840
+ return;
10841
+ }
10823
10842
  if (props2.magnetic) {
10824
10843
  height.value = closest(anchors.value, height.value);
10825
10844
  } else {
@@ -10848,6 +10867,9 @@
10848
10867
  if (slots.header) {
10849
10868
  return slots.header();
10850
10869
  }
10870
+ if (!props2.draggable) {
10871
+ return null;
10872
+ }
10851
10873
  return vue.createVNode("div", {
10852
10874
  "class": bem$I("header")
10853
10875
  }, [vue.createVNode("div", {
@@ -13080,7 +13102,7 @@
13080
13102
  return node instanceof OwnElement || node instanceof HTMLElement;
13081
13103
  }
13082
13104
  function isShadowRoot(node) {
13083
- if ("undefined" == typeof ShadowRoot) return false;
13105
+ if ("u" < typeof ShadowRoot) return false;
13084
13106
  var OwnElement = getWindow(node).ShadowRoot;
13085
13107
  return node instanceof OwnElement || node instanceof ShadowRoot;
13086
13108
  }
@@ -14019,7 +14041,9 @@
14019
14041
  var stdin_default$A = vue.defineComponent({
14020
14042
  name: name$s,
14021
14043
  props: progressProps,
14022
- setup(props2) {
14044
+ setup(props2, {
14045
+ slots
14046
+ }) {
14023
14047
  const background = vue.computed(() => props2.inactive ? void 0 : props2.color);
14024
14048
  const format2 = (rate) => Math.min(Math.max(+rate, 0), 100);
14025
14049
  const renderPivot = () => {
@@ -14030,8 +14054,8 @@
14030
14054
  percentage
14031
14055
  } = props2;
14032
14056
  const safePercentage = format2(percentage);
14033
- const text = pivotText != null ? pivotText : `${percentage}%`;
14034
- if (props2.showPivot && text) {
14057
+ const text = pivotText != null ? pivotText : `${safePercentage}%`;
14058
+ if (props2.showPivot && (slots.pivot || text)) {
14035
14059
  const style = {
14036
14060
  color: textColor,
14037
14061
  left: `${safePercentage}%`,
@@ -14043,7 +14067,9 @@
14043
14067
  "class": bem$r("pivot", {
14044
14068
  inactive: props2.inactive
14045
14069
  })
14046
- }, [text]);
14070
+ }, [slots.pivot ? slots.pivot({
14071
+ percentage: safePercentage
14072
+ }) : text]);
14047
14073
  }
14048
14074
  };
14049
14075
  return () => {
@@ -14932,6 +14958,8 @@
14932
14958
  type: makeStringProp("png"),
14933
14959
  penColor: makeStringProp("#000"),
14934
14960
  lineWidth: makeNumberProp(3),
14961
+ historySize: makeNumberProp(20),
14962
+ undoButtonText: String,
14935
14963
  clearButtonText: String,
14936
14964
  backgroundColor: makeStringProp(""),
14937
14965
  confirmButtonText: String
@@ -14959,6 +14987,15 @@
14959
14987
  let canvasWidth = 0;
14960
14988
  let canvasHeight = 0;
14961
14989
  let canvasRect;
14990
+ const history = vue.ref([]);
14991
+ const saveState = () => {
14992
+ if (ctx.value && canvasWidth && canvasHeight) {
14993
+ if (history.value.length >= props2.historySize) {
14994
+ history.value.shift();
14995
+ }
14996
+ history.value.push(ctx.value.getImageData(0, 0, canvasWidth, canvasHeight));
14997
+ }
14998
+ };
14962
14999
  const touchStart = () => {
14963
15000
  if (!ctx.value) {
14964
15001
  return false;
@@ -14985,6 +15022,7 @@
14985
15022
  };
14986
15023
  const touchEnd = (event) => {
14987
15024
  preventDefault(event);
15025
+ saveState();
14988
15026
  emit("end");
14989
15027
  };
14990
15028
  const isCanvasEmpty = (canvas) => {
@@ -15025,8 +15063,21 @@
15025
15063
  ctx.value.closePath();
15026
15064
  setCanvasBgColor(ctx.value);
15027
15065
  }
15066
+ history.value = [];
15028
15067
  emit("clear");
15029
15068
  };
15069
+ const undo = () => {
15070
+ if (history.value.length) {
15071
+ history.value.pop();
15072
+ if (ctx.value) {
15073
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
15074
+ setCanvasBgColor(ctx.value);
15075
+ if (history.value.length) {
15076
+ ctx.value.putImageData(history.value[history.value.length - 1], 0, 0);
15077
+ }
15078
+ }
15079
+ }
15080
+ };
15030
15081
  const initialize = () => {
15031
15082
  var _a, _b, _c;
15032
15083
  if (isRenderCanvas && canvasRef.value) {
@@ -15050,7 +15101,8 @@
15050
15101
  useExpose({
15051
15102
  resize,
15052
15103
  clear,
15053
- submit
15104
+ submit,
15105
+ undo
15054
15106
  });
15055
15107
  return () => vue.createVNode("div", {
15056
15108
  "class": bem$i()
@@ -15069,6 +15121,11 @@
15069
15121
  "onClick": clear
15070
15122
  }, {
15071
15123
  default: () => [props2.clearButtonText || t$2("clear")]
15124
+ }), vue.createVNode(Button, {
15125
+ "size": "small",
15126
+ "onClick": undo
15127
+ }, {
15128
+ default: () => [props2.undoButtonText || t$2("undo")]
15072
15129
  }), vue.createVNode(Button, {
15073
15130
  "type": "primary",
15074
15131
  "size": "small",
@@ -16107,6 +16164,11 @@
16107
16164
  disabled: Boolean,
16108
16165
  leftWidth: numericProp,
16109
16166
  rightWidth: numericProp,
16167
+ threshold: {
16168
+ type: numericProp,
16169
+ default: 0.15,
16170
+ validator: (value) => +value >= 0 && +value <= 1
16171
+ },
16110
16172
  beforeClose: Function,
16111
16173
  stopPropagation: Boolean
16112
16174
  };
@@ -16155,8 +16217,8 @@
16155
16217
  };
16156
16218
  const toggle = (side) => {
16157
16219
  const offset = Math.abs(state.offset);
16158
- const THRESHOLD = 0.15;
16159
- const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
16220
+ const thresholdValue = +props2.threshold;
16221
+ const threshold = opened ? 1 - thresholdValue : thresholdValue;
16160
16222
  const width = side === "left" ? leftWidth.value : rightWidth.value;
16161
16223
  if (width && offset > width * threshold) {
16162
16224
  open(side);
@@ -18246,7 +18308,7 @@
18246
18308
  });
18247
18309
  }
18248
18310
  };
18249
- const version = "4.9.22";
18311
+ const version = "4.9.23";
18250
18312
  function install(app) {
18251
18313
  const components = [
18252
18314
  ActionBar,
@@ -18544,6 +18606,7 @@
18544
18606
  exports2.rowProps = rowProps;
18545
18607
  exports2.searchProps = searchProps;
18546
18608
  exports2.setDialogDefaultOptions = setDialogDefaultOptions;
18609
+ exports2.setGlobalZIndex = setGlobalZIndex;
18547
18610
  exports2.setNotifyDefaultOptions = setNotifyDefaultOptions;
18548
18611
  exports2.setToastDefaultOptions = setToastDefaultOptions;
18549
18612
  exports2.shareSheetProps = shareSheetProps;
@@ -18583,6 +18646,7 @@
18583
18646
  exports2.uploaderProps = uploaderProps;
18584
18647
  exports2.useAllTabStatus = useAllTabStatus;
18585
18648
  exports2.useCurrentLang = useCurrentLang;
18649
+ exports2.useGlobalZIndex = useGlobalZIndex;
18586
18650
  exports2.useTabStatus = useTabStatus;
18587
18651
  exports2.version = version;
18588
18652
  exports2.watermarkProps = watermarkProps;