vant 4.3.2 → 4.4.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 (89) hide show
  1. package/es/address-edit/AddressEdit.mjs +1 -0
  2. package/es/area/Area.d.ts +6 -8
  3. package/es/area/Area.mjs +1 -1
  4. package/es/area/index.d.ts +4 -6
  5. package/es/back-top/BackTop.d.ts +1 -1
  6. package/es/back-top/BackTop.mjs +6 -3
  7. package/es/back-top/index.css +1 -1
  8. package/es/back-top/index.d.ts +1 -1
  9. package/es/barrage/Barrage.d.ts +93 -0
  10. package/es/barrage/Barrage.mjs +134 -0
  11. package/es/barrage/index.css +1 -0
  12. package/es/barrage/index.d.ts +69 -0
  13. package/es/barrage/index.mjs +10 -0
  14. package/es/barrage/style/index.d.ts +1 -0
  15. package/es/barrage/style/index.mjs +2 -0
  16. package/es/barrage/types.d.ts +7 -0
  17. package/es/barrage/types.mjs +0 -0
  18. package/es/cascader/Cascader.mjs +14 -0
  19. package/es/contact-list/ContactList.mjs +1 -1
  20. package/es/contact-list/index.css +1 -1
  21. package/es/date-picker/DatePicker.mjs +5 -2
  22. package/es/dialog/index.css +1 -1
  23. package/es/divider/Divider.d.ts +4 -0
  24. package/es/divider/Divider.mjs +4 -2
  25. package/es/divider/index.css +1 -1
  26. package/es/divider/index.d.ts +3 -0
  27. package/es/image-preview/ImagePreviewItem.mjs +28 -15
  28. package/es/index.d.ts +2 -1
  29. package/es/index.mjs +4 -1
  30. package/es/notice-bar/NoticeBar.d.ts +1 -1
  31. package/es/notice-bar/index.d.ts +1 -1
  32. package/es/signature/Signature.d.ts +13 -0
  33. package/es/signature/Signature.mjs +24 -8
  34. package/es/signature/index.css +1 -1
  35. package/es/signature/index.d.ts +9 -0
  36. package/es/uploader/Uploader.d.ts +6 -1
  37. package/es/uploader/Uploader.mjs +25 -10
  38. package/es/uploader/UploaderPreviewItem.d.ts +5 -1
  39. package/es/uploader/UploaderPreviewItem.mjs +6 -3
  40. package/es/uploader/index.d.ts +5 -1
  41. package/es/uploader/types.d.ts +1 -0
  42. package/lib/address-edit/AddressEdit.js +1 -0
  43. package/lib/area/Area.d.ts +6 -8
  44. package/lib/area/Area.js +1 -1
  45. package/lib/area/index.d.ts +4 -6
  46. package/lib/back-top/BackTop.d.ts +1 -1
  47. package/lib/back-top/BackTop.js +6 -3
  48. package/lib/back-top/index.css +1 -1
  49. package/lib/back-top/index.d.ts +1 -1
  50. package/lib/barrage/Barrage.d.ts +93 -0
  51. package/lib/barrage/Barrage.js +153 -0
  52. package/lib/barrage/index.css +1 -0
  53. package/lib/barrage/index.d.ts +69 -0
  54. package/lib/barrage/index.js +39 -0
  55. package/lib/barrage/style/index.d.ts +1 -0
  56. package/lib/barrage/style/index.js +2 -0
  57. package/lib/barrage/types.d.ts +7 -0
  58. package/lib/barrage/types.js +15 -0
  59. package/lib/cascader/Cascader.js +14 -0
  60. package/lib/contact-list/ContactList.js +1 -1
  61. package/lib/contact-list/index.css +1 -1
  62. package/lib/date-picker/DatePicker.js +5 -2
  63. package/lib/dialog/index.css +1 -1
  64. package/lib/divider/Divider.d.ts +4 -0
  65. package/lib/divider/Divider.js +4 -2
  66. package/lib/divider/index.css +1 -1
  67. package/lib/divider/index.d.ts +3 -0
  68. package/lib/image-preview/ImagePreviewItem.js +28 -15
  69. package/lib/index.css +1 -1
  70. package/lib/index.d.ts +2 -1
  71. package/lib/index.js +4 -1
  72. package/lib/notice-bar/NoticeBar.d.ts +1 -1
  73. package/lib/notice-bar/index.d.ts +1 -1
  74. package/lib/signature/Signature.d.ts +13 -0
  75. package/lib/signature/Signature.js +23 -7
  76. package/lib/signature/index.css +1 -1
  77. package/lib/signature/index.d.ts +9 -0
  78. package/lib/uploader/Uploader.d.ts +6 -1
  79. package/lib/uploader/Uploader.js +25 -10
  80. package/lib/uploader/UploaderPreviewItem.d.ts +5 -1
  81. package/lib/uploader/UploaderPreviewItem.js +6 -3
  82. package/lib/uploader/index.d.ts +5 -1
  83. package/lib/uploader/types.d.ts +1 -0
  84. package/lib/vant.cjs.js +523 -324
  85. package/lib/vant.es.js +523 -324
  86. package/lib/vant.js +523 -324
  87. package/lib/vant.min.js +1 -1
  88. package/lib/web-types.json +1 -1
  89. package/package.json +1 -1
@@ -5,6 +5,7 @@ const [name, bem] = createNamespace("divider");
5
5
  const dividerProps = {
6
6
  dashed: Boolean,
7
7
  hairline: truthProp,
8
+ vertical: Boolean,
8
9
  contentPosition: makeStringProp("center")
9
10
  };
10
11
  var stdin_default = defineComponent({
@@ -20,9 +21,10 @@ var stdin_default = defineComponent({
20
21
  "class": bem({
21
22
  dashed: props.dashed,
22
23
  hairline: props.hairline,
23
- [`content-${props.contentPosition}`]: !!slots.default
24
+ vertical: props.vertical,
25
+ [`content-${props.contentPosition}`]: !!slots.default && !props.vertical
24
26
  })
25
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
27
+ }, [!props.vertical && ((_a = slots.default) == null ? void 0 : _a.call(slots))]);
26
28
  };
27
29
  }
28
30
  });
@@ -1 +1 @@
1
- :root{--van-divider-margin: var(--van-padding-md) 0;--van-divider-text-color: var(--van-text-color-2);--van-divider-font-size: var(--van-font-size-md);--van-divider-line-height: 24px;--van-divider-border-color: var(--van-border-color);--van-divider-content-padding: var(--van-padding-md);--van-divider-content-left-width: 10%;--van-divider-content-right-width: 10%}.van-divider{display:flex;align-items:center;margin:var(--van-divider-margin);color:var(--van-divider-text-color);font-size:var(--van-divider-font-size);line-height:var(--van-divider-line-height);border-color:var(--van-divider-border-color);border-style:solid;border-width:0}.van-divider:before,.van-divider:after{display:block;flex:1;box-sizing:border-box;height:1px;border-color:inherit;border-style:inherit;border-width:var(--van-border-width) 0 0}.van-divider:before{content:""}.van-divider--hairline:before,.van-divider--hairline:after{transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--content-center:before,.van-divider--content-left:before,.van-divider--content-right:before{margin-right:var(--van-divider-content-padding)}.van-divider--content-center:after,.van-divider--content-left:after,.van-divider--content-right:after{margin-left:var(--van-divider-content-padding);content:""}.van-divider--content-left:before{max-width:var(--van-divider-content-left-width)}.van-divider--content-right:after{max-width:var(--van-divider-content-right-width)}
1
+ :root{--van-divider-margin: var(--van-padding-md) 0;--van-divider-vertical-margin: 0 var(--van-padding-xs);--van-divider-text-color: var(--van-text-color-2);--van-divider-font-size: var(--van-font-size-md);--van-divider-line-height: 24px;--van-divider-border-color: var(--van-border-color);--van-divider-content-padding: var(--van-padding-md);--van-divider-content-left-width: 10%;--van-divider-content-right-width: 10%}.van-divider{display:flex;align-items:center;margin:var(--van-divider-margin);color:var(--van-divider-text-color);font-size:var(--van-divider-font-size);line-height:var(--van-divider-line-height);border-color:var(--van-divider-border-color);border-style:solid;border-width:0}.van-divider:before,.van-divider:after{display:block;flex:1;box-sizing:border-box;height:1px;border-color:inherit;border-style:inherit;border-width:var(--van-border-width) 0 0}.van-divider:before{content:""}.van-divider--hairline:before,.van-divider--hairline:after{transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--content-center:before,.van-divider--content-left:before,.van-divider--content-right:before{margin-right:var(--van-divider-content-padding)}.van-divider--content-center:after,.van-divider--content-left:after,.van-divider--content-right:after{margin-left:var(--van-divider-content-padding);content:""}.van-divider--content-left:before{max-width:var(--van-divider-content-left-width)}.van-divider--content-right:after{max-width:var(--van-divider-content-right-width)}.van-divider--vertical{display:inline-block;width:var(--van-border-width);height:1em;margin:var(--van-divider-vertical-margin);vertical-align:middle}.van-divider--vertical:before{height:100%;border-width:0 0 0 var(--van-border-width)}.van-divider--vertical:after{display:none}.van-divider--vertical.van-divider--hairline:before{transform:scaleX(.5)}
@@ -4,6 +4,7 @@ export declare const Divider: import("../utils").WithInstall<import("vue").Defin
4
4
  type: BooleanConstructor;
5
5
  default: true;
6
6
  };
7
+ vertical: BooleanConstructor;
7
8
  contentPosition: {
8
9
  type: import("vue").PropType<import("./Divider").DividerContentPosition>;
9
10
  default: import("./Divider").DividerContentPosition;
@@ -14,11 +15,13 @@ export declare const Divider: import("../utils").WithInstall<import("vue").Defin
14
15
  type: BooleanConstructor;
15
16
  default: true;
16
17
  };
18
+ vertical: BooleanConstructor;
17
19
  contentPosition: {
18
20
  type: import("vue").PropType<import("./Divider").DividerContentPosition>;
19
21
  default: import("./Divider").DividerContentPosition;
20
22
  };
21
23
  }>>, {
24
+ vertical: boolean;
22
25
  hairline: boolean;
23
26
  dashed: boolean;
24
27
  contentPosition: import("./Divider").DividerContentPosition;
@@ -12,6 +12,7 @@ const getCenter = (touches) => ({
12
12
  y: (touches[0].clientY + touches[1].clientY) / 2
13
13
  });
14
14
  const bem = createNamespace("image-preview")[1];
15
+ const longImageRatio = 2.6;
15
16
  var stdin_default = defineComponent({
16
17
  props: {
17
18
  src: String,
@@ -34,21 +35,14 @@ var stdin_default = defineComponent({
34
35
  moveY: 0,
35
36
  moving: false,
36
37
  zooming: false,
37
- imageRatio: 0,
38
- displayWidth: 0,
39
- displayHeight: 0
38
+ imageRatio: 0
40
39
  });
41
40
  const touch = useTouch();
42
41
  const imageRef = ref();
43
42
  const swipeItem = ref();
44
- const vertical = computed(() => {
45
- const {
46
- rootWidth,
47
- rootHeight
48
- } = props;
49
- const rootRatio = rootHeight / rootWidth;
50
- return state.imageRatio > rootRatio;
51
- });
43
+ const vertical = ref(false);
44
+ const isLongImage = ref(false);
45
+ let initialMoveY = 0;
52
46
  const imageStyle = computed(() => {
53
47
  const {
54
48
  scale,
@@ -60,7 +54,7 @@ var stdin_default = defineComponent({
60
54
  const style = {
61
55
  transitionDuration: zooming || moving ? "0s" : ".3s"
62
56
  };
63
- if (scale !== 1) {
57
+ if (scale !== 1 || isLongImage.value) {
64
58
  style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
65
59
  }
66
60
  return style;
@@ -105,7 +99,7 @@ var stdin_default = defineComponent({
105
99
  state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
106
100
  } else {
107
101
  state.moveX = 0;
108
- state.moveY = 0;
102
+ state.moveY = isLongImage.value ? initialMoveY : 0;
109
103
  }
110
104
  emit("scale", {
111
105
  scale,
@@ -118,7 +112,7 @@ var stdin_default = defineComponent({
118
112
  };
119
113
  const toggleScale = () => {
120
114
  const scale = state.scale > 1 ? 1 : 2;
121
- setScale(scale, scale === 2 ? {
115
+ setScale(scale, scale === 2 || isLongImage.value ? {
122
116
  x: touch.startX.value,
123
117
  y: touch.startY.value
124
118
  } : void 0);
@@ -148,7 +142,7 @@ var stdin_default = defineComponent({
148
142
  startMoveY = state.moveY;
149
143
  touchStartTime = Date.now();
150
144
  isImageMoved = false;
151
- state.moving = fingerNum === 1 && state.scale !== 1;
145
+ state.moving = fingerNum === 1 && (state.scale !== 1 || isLongImage.value);
152
146
  state.zooming = fingerNum === 2 && !offsetX.value;
153
147
  if (state.zooming) {
154
148
  startScale = state.scale;
@@ -244,12 +238,30 @@ var stdin_default = defineComponent({
244
238
  checkTap();
245
239
  touch.reset();
246
240
  };
241
+ const resize = () => {
242
+ const {
243
+ rootWidth,
244
+ rootHeight
245
+ } = props;
246
+ const rootRatio = rootHeight / rootWidth;
247
+ const {
248
+ imageRatio
249
+ } = state;
250
+ vertical.value = state.imageRatio > rootRatio && imageRatio < longImageRatio;
251
+ isLongImage.value = state.imageRatio > rootRatio && imageRatio >= longImageRatio;
252
+ if (isLongImage.value) {
253
+ initialMoveY = (imageRatio * rootWidth - rootHeight) / 2;
254
+ state.moveY = initialMoveY;
255
+ }
256
+ resetScale();
257
+ };
247
258
  const onLoad = (event) => {
248
259
  const {
249
260
  naturalWidth,
250
261
  naturalHeight
251
262
  } = event.target;
252
263
  state.imageRatio = naturalHeight / naturalWidth;
264
+ resize();
253
265
  };
254
266
  watch(() => props.active, resetScale);
255
267
  watch(() => props.show, (value) => {
@@ -257,6 +269,7 @@ var stdin_default = defineComponent({
257
269
  resetScale();
258
270
  }
259
271
  });
272
+ watch(() => [props.rootWidth, props.rootHeight], resize);
260
273
  useEventListener("touchmove", onTouchMove, {
261
274
  target: computed(() => {
262
275
  var _a;
package/es/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./address-list";
7
7
  export * from "./area";
8
8
  export * from "./back-top";
9
9
  export * from "./badge";
10
+ export * from "./barrage";
10
11
  export * from "./button";
11
12
  export * from "./calendar";
12
13
  export * from "./card";
@@ -101,4 +102,4 @@ declare namespace _default {
101
102
  }
102
103
  export default _default;
103
104
  export function install(app: any): void;
104
- export const version: "4.3.2";
105
+ export const version: "4.4.0";
package/es/index.mjs CHANGED
@@ -7,6 +7,7 @@ import { AddressList } from "./address-list/index.mjs";
7
7
  import { Area } from "./area/index.mjs";
8
8
  import { BackTop } from "./back-top/index.mjs";
9
9
  import { Badge } from "./badge/index.mjs";
10
+ import { Barrage } from "./barrage/index.mjs";
10
11
  import { Button } from "./button/index.mjs";
11
12
  import { Calendar } from "./calendar/index.mjs";
12
13
  import { Card } from "./card/index.mjs";
@@ -94,7 +95,7 @@ import { Toast } from "./toast/index.mjs";
94
95
  import { TreeSelect } from "./tree-select/index.mjs";
95
96
  import { Uploader } from "./uploader/index.mjs";
96
97
  import { Watermark } from "./watermark/index.mjs";
97
- const version = "4.3.2";
98
+ const version = "4.4.0";
98
99
  function install(app) {
99
100
  const components = [
100
101
  ActionBar,
@@ -106,6 +107,7 @@ function install(app) {
106
107
  Area,
107
108
  BackTop,
108
109
  Badge,
110
+ Barrage,
109
111
  Button,
110
112
  Calendar,
111
113
  Card,
@@ -211,6 +213,7 @@ export * from "./address-list/index.mjs";
211
213
  export * from "./area/index.mjs";
212
214
  export * from "./back-top/index.mjs";
213
215
  export * from "./badge/index.mjs";
216
+ export * from "./barrage/index.mjs";
214
217
  export * from "./button/index.mjs";
215
218
  export * from "./calendar/index.mjs";
216
219
  export * from "./card/index.mjs";
@@ -64,8 +64,8 @@ declare const _default: import("vue").DefineComponent<{
64
64
  onReplay?: ((...args: any[]) => any) | undefined;
65
65
  }, {
66
66
  scrollable: boolean | null;
67
- speed: string | number;
68
67
  delay: string | number;
68
+ speed: string | number;
69
69
  wrapable: boolean;
70
70
  }>;
71
71
  export default _default;
@@ -42,8 +42,8 @@ export declare const NoticeBar: import("../utils").WithInstall<import("vue").Def
42
42
  onReplay?: ((...args: any[]) => any) | undefined;
43
43
  }, {
44
44
  scrollable: boolean | null;
45
- speed: string | number;
46
45
  delay: string | number;
46
+ speed: string | number;
47
47
  wrapable: boolean;
48
48
  }>>;
49
49
  export default NoticeBar;
@@ -14,6 +14,10 @@ export declare const signatureProps: {
14
14
  default: number;
15
15
  };
16
16
  clearButtonText: StringConstructor;
17
+ backgroundColor: {
18
+ type: import("vue").PropType<string>;
19
+ default: string;
20
+ };
17
21
  confirmButtonText: StringConstructor;
18
22
  };
19
23
  export type SignatureProps = ExtractPropTypes<typeof signatureProps>;
@@ -32,6 +36,10 @@ declare const _default: import("vue").DefineComponent<{
32
36
  default: number;
33
37
  };
34
38
  clearButtonText: StringConstructor;
39
+ backgroundColor: {
40
+ type: import("vue").PropType<string>;
41
+ default: string;
42
+ };
35
43
  confirmButtonText: StringConstructor;
36
44
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "start" | "clear" | "end" | "signing")[], "submit" | "start" | "clear" | "end" | "signing", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
37
45
  tips: StringConstructor;
@@ -48,6 +56,10 @@ declare const _default: import("vue").DefineComponent<{
48
56
  default: number;
49
57
  };
50
58
  clearButtonText: StringConstructor;
59
+ backgroundColor: {
60
+ type: import("vue").PropType<string>;
61
+ default: string;
62
+ };
51
63
  confirmButtonText: StringConstructor;
52
64
  }>> & {
53
65
  onSubmit?: ((...args: any[]) => any) | undefined;
@@ -57,6 +69,7 @@ declare const _default: import("vue").DefineComponent<{
57
69
  onSigning?: ((...args: any[]) => any) | undefined;
58
70
  }, {
59
71
  type: string;
72
+ backgroundColor: string;
60
73
  lineWidth: number;
61
74
  penColor: string;
62
75
  }>;
@@ -1,5 +1,5 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { ref, reactive, onMounted, defineComponent } from "vue";
2
+ import { ref, reactive, onMounted, nextTick, defineComponent } from "vue";
3
3
  import { inBrowser, makeNumberProp, makeStringProp, createNamespace, preventDefault } from "../utils/index.mjs";
4
4
  import { useRect } from "@vant/use";
5
5
  import { Button } from "../button/index.mjs";
@@ -10,6 +10,7 @@ const signatureProps = {
10
10
  penColor: makeStringProp("#000"),
11
11
  lineWidth: makeNumberProp(3),
12
12
  clearButtonText: String,
13
+ backgroundColor: makeStringProp(""),
13
14
  confirmButtonText: String
14
15
  };
15
16
  const hasCanvasSupport = () => {
@@ -29,7 +30,8 @@ var stdin_default = defineComponent({
29
30
  const state = reactive({
30
31
  width: 0,
31
32
  height: 0,
32
- ctx: null
33
+ ctx: null,
34
+ ratio: inBrowser ? window.devicePixelRatio : 1
33
35
  });
34
36
  let canvasRect;
35
37
  const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
@@ -38,7 +40,7 @@ var stdin_default = defineComponent({
38
40
  return false;
39
41
  }
40
42
  state.ctx.beginPath();
41
- state.ctx.lineWidth = props.lineWidth;
43
+ state.ctx.lineWidth = props.lineWidth * state.ratio;
42
44
  state.ctx.strokeStyle = props.penColor;
43
45
  canvasRect = useRect(canvasRef);
44
46
  emit("start");
@@ -50,8 +52,8 @@ var stdin_default = defineComponent({
50
52
  }
51
53
  preventDefault(event);
52
54
  const touch = event.touches[0];
53
- const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
54
- const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
55
+ const mouseX = (touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0)) * state.ratio;
56
+ const mouseY = (touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0)) * state.ratio;
55
57
  state.ctx.lineCap = "round";
56
58
  state.ctx.lineJoin = "round";
57
59
  (_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
@@ -68,13 +70,23 @@ var stdin_default = defineComponent({
68
70
  empty.height = canvas.height;
69
71
  return canvas.toDataURL() === empty.toDataURL();
70
72
  };
73
+ const setCanvasBgColor = () => {
74
+ if (state.ctx && props.backgroundColor) {
75
+ state.ctx.fillStyle = props.backgroundColor;
76
+ state.ctx.fillRect(0, 0, state.width, state.height);
77
+ }
78
+ };
71
79
  const submit = () => {
80
+ var _a, _b;
72
81
  const canvas = canvasRef.value;
73
82
  if (!canvas) {
74
83
  return;
75
84
  }
76
85
  const isEmpty = isCanvasEmpty(canvas);
77
- const image = isEmpty ? "" : canvas.toDataURL(`image/${props.type}`, props.type === "jpg" ? 0.9 : null);
86
+ const image = isEmpty ? "" : ((_b = (_a = {
87
+ jpg: () => canvas.toDataURL("image/jpeg", 0.8),
88
+ jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
89
+ })[props.type]) == null ? void 0 : _b.call(_a)) || canvas.toDataURL(`image/${props.type}`);
78
90
  emit("submit", {
79
91
  image,
80
92
  canvas
@@ -84,6 +96,7 @@ var stdin_default = defineComponent({
84
96
  if (state.ctx) {
85
97
  state.ctx.clearRect(0, 0, state.width, state.height);
86
98
  state.ctx.closePath();
99
+ setCanvasBgColor();
87
100
  }
88
101
  emit("clear");
89
102
  };
@@ -91,8 +104,11 @@ var stdin_default = defineComponent({
91
104
  var _a, _b, _c;
92
105
  if (isRenderCanvas) {
93
106
  state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
94
- state.width = ((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0;
95
- state.height = ((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0;
107
+ state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
108
+ state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
109
+ nextTick(() => {
110
+ setCanvasBgColor();
111
+ });
96
112
  }
97
113
  });
98
114
  return () => _createVNode("div", {
@@ -1 +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)}
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__content canvas{width:100%;height:100%}.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)}
@@ -13,6 +13,10 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
13
13
  default: number;
14
14
  };
15
15
  clearButtonText: StringConstructor;
16
+ backgroundColor: {
17
+ type: import("vue").PropType<string>;
18
+ default: string;
19
+ };
16
20
  confirmButtonText: StringConstructor;
17
21
  }, () => 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
22
  tips: StringConstructor;
@@ -29,6 +33,10 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
29
33
  default: number;
30
34
  };
31
35
  clearButtonText: StringConstructor;
36
+ backgroundColor: {
37
+ type: import("vue").PropType<string>;
38
+ default: string;
39
+ };
32
40
  confirmButtonText: StringConstructor;
33
41
  }>> & {
34
42
  onSubmit?: ((...args: any[]) => any) | undefined;
@@ -38,6 +46,7 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
38
46
  onSigning?: ((...args: any[]) => any) | undefined;
39
47
  }, {
40
48
  type: string;
49
+ backgroundColor: string;
41
50
  lineWidth: number;
42
51
  penColor: string;
43
52
  }>>;
@@ -38,6 +38,7 @@ export declare const uploaderProps: {
38
38
  type: BooleanConstructor;
39
39
  default: true;
40
40
  };
41
+ reupload: BooleanConstructor;
41
42
  afterRead: PropType<UploaderAfterRead>;
42
43
  showUpload: {
43
44
  type: BooleanConstructor;
@@ -100,6 +101,7 @@ declare const _default: import("vue").DefineComponent<{
100
101
  type: BooleanConstructor;
101
102
  default: true;
102
103
  };
104
+ reupload: BooleanConstructor;
103
105
  afterRead: PropType<UploaderAfterRead>;
104
106
  showUpload: {
105
107
  type: BooleanConstructor;
@@ -125,7 +127,7 @@ declare const _default: import("vue").DefineComponent<{
125
127
  type: PropType<UploaderMaxSize>;
126
128
  default: number;
127
129
  };
128
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview")[], "update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
130
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview" | "clickReupload")[], "update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview" | "clickReupload", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
129
131
  name: {
130
132
  type: (NumberConstructor | StringConstructor)[];
131
133
  default: string;
@@ -160,6 +162,7 @@ declare const _default: import("vue").DefineComponent<{
160
162
  type: BooleanConstructor;
161
163
  default: true;
162
164
  };
165
+ reupload: BooleanConstructor;
163
166
  afterRead: PropType<UploaderAfterRead>;
164
167
  showUpload: {
165
168
  type: BooleanConstructor;
@@ -192,6 +195,7 @@ declare const _default: import("vue").DefineComponent<{
192
195
  onClickUpload?: ((...args: any[]) => any) | undefined;
193
196
  onClosePreview?: ((...args: any[]) => any) | undefined;
194
197
  onClickPreview?: ((...args: any[]) => any) | undefined;
198
+ onClickReupload?: ((...args: any[]) => any) | undefined;
195
199
  }, {
196
200
  name: string | number;
197
201
  accept: string;
@@ -205,6 +209,7 @@ declare const _default: import("vue").DefineComponent<{
205
209
  resultType: UploaderResultType;
206
210
  uploadIcon: string;
207
211
  deletable: boolean;
212
+ reupload: boolean;
208
213
  showUpload: boolean;
209
214
  previewImage: boolean;
210
215
  previewFullImage: boolean;
@@ -21,6 +21,7 @@ const uploaderProps = {
21
21
  uploadIcon: makeStringProp("photograph"),
22
22
  uploadText: String,
23
23
  deletable: truthProp,
24
+ reupload: Boolean,
24
25
  afterRead: Function,
25
26
  showUpload: truthProp,
26
27
  modelValue: makeArrayProp(),
@@ -38,13 +39,14 @@ const uploaderProps = {
38
39
  var stdin_default = defineComponent({
39
40
  name,
40
41
  props: uploaderProps,
41
- emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "update:modelValue"],
42
+ emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "clickReupload", "update:modelValue"],
42
43
  setup(props, {
43
44
  emit,
44
45
  slots
45
46
  }) {
46
47
  const inputRef = ref();
47
48
  const urls = [];
49
+ const reuploadIndex = ref(-1);
48
50
  const getDetail = (index = props.modelValue.length) => ({
49
51
  name: props.name,
50
52
  index
@@ -70,7 +72,14 @@ var stdin_default = defineComponent({
70
72
  }
71
73
  }
72
74
  items = reactive(items);
73
- emit("update:modelValue", [...props.modelValue, ...toArray(items)]);
75
+ if (reuploadIndex.value > -1) {
76
+ const arr = [...props.modelValue];
77
+ arr.splice(reuploadIndex.value, 1, items);
78
+ emit("update:modelValue", arr);
79
+ reuploadIndex.value = -1;
80
+ } else {
81
+ emit("update:modelValue", [...props.modelValue, ...toArray(items)]);
82
+ }
74
83
  if (props.afterRead) {
75
84
  props.afterRead(items, getDetail());
76
85
  }
@@ -171,15 +180,20 @@ var stdin_default = defineComponent({
171
180
  emit("update:modelValue", fileList);
172
181
  emit("delete", item, getDetail(index));
173
182
  };
183
+ const reuploadImage = (index) => {
184
+ chooseFile();
185
+ reuploadIndex.value = index;
186
+ };
174
187
  const renderPreviewItem = (item, index) => {
175
- const needPickData = ["imageFit", "deletable", "previewSize", "beforeDelete"];
188
+ const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
176
189
  const previewData = extend(pick(props, needPickData), pick(item, needPickData, true));
177
190
  return _createVNode(UploaderPreviewItem, _mergeProps({
178
191
  "item": item,
179
192
  "index": index,
180
- "onClick": () => emit("clickPreview", item, getDetail(index)),
193
+ "onClick": () => emit(props.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
181
194
  "onDelete": () => deleteFile(item, index),
182
- "onPreview": () => previewImage(item)
195
+ "onPreview": () => previewImage(item),
196
+ "onReupload": () => reuploadImage(index)
183
197
  }, pick(props, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
184
198
  };
185
199
  const renderPreviewList = () => {
@@ -189,24 +203,25 @@ var stdin_default = defineComponent({
189
203
  };
190
204
  const onClickUpload = (event) => emit("clickUpload", event);
191
205
  const renderUpload = () => {
192
- if (props.modelValue.length >= +props.maxCount) {
206
+ if (props.modelValue.length >= +props.maxCount && !props.reupload) {
193
207
  return;
194
208
  }
209
+ const hideUploader = props.modelValue.length >= +props.maxCount && props.reupload;
195
210
  const Input = props.readonly ? null : _createVNode("input", {
196
211
  "ref": inputRef,
197
212
  "type": "file",
198
213
  "class": bem("input"),
199
214
  "accept": props.accept,
200
215
  "capture": props.capture,
201
- "multiple": props.multiple,
216
+ "multiple": props.multiple && reuploadIndex.value === -1,
202
217
  "disabled": props.disabled,
203
218
  "onChange": onChange
204
219
  }, null);
205
220
  if (slots.default) {
206
- return _createVNode("div", {
221
+ return _withDirectives(_createVNode("div", {
207
222
  "class": bem("input-wrapper"),
208
223
  "onClick": onClickUpload
209
- }, [slots.default(), Input]);
224
+ }, [slots.default(), Input]), [[_vShow, !hideUploader]]);
210
225
  }
211
226
  return _withDirectives(_createVNode("div", {
212
227
  "class": bem("upload", {
@@ -219,7 +234,7 @@ var stdin_default = defineComponent({
219
234
  "class": bem("upload-icon")
220
235
  }, null), props.uploadText && _createVNode("span", {
221
236
  "class": bem("upload-text")
222
- }, [props.uploadText]), Input]), [[_vShow, props.showUpload]]);
237
+ }, [props.uploadText]), Input]), [[_vShow, props.showUpload && !hideUploader]]);
223
238
  };
224
239
  const chooseFile = () => {
225
240
  if (inputRef.value && !props.disabled) {
@@ -12,9 +12,10 @@ declare const _default: import("vue").DefineComponent<{
12
12
  imageFit: PropType<ImageFit>;
13
13
  lazyLoad: BooleanConstructor;
14
14
  deletable: BooleanConstructor;
15
+ reupload: BooleanConstructor;
15
16
  previewSize: PropType<Numeric | [Numeric, Numeric]>;
16
17
  beforeDelete: PropType<Interceptor>;
17
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "preview")[], "delete" | "preview", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
18
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "reupload" | "preview")[], "delete" | "reupload" | "preview", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
18
19
  name: (NumberConstructor | StringConstructor)[];
19
20
  item: {
20
21
  type: PropType<UploaderFileListItem>;
@@ -24,13 +25,16 @@ declare const _default: import("vue").DefineComponent<{
24
25
  imageFit: PropType<ImageFit>;
25
26
  lazyLoad: BooleanConstructor;
26
27
  deletable: BooleanConstructor;
28
+ reupload: BooleanConstructor;
27
29
  previewSize: PropType<Numeric | [Numeric, Numeric]>;
28
30
  beforeDelete: PropType<Interceptor>;
29
31
  }>> & {
30
32
  onDelete?: ((...args: any[]) => any) | undefined;
33
+ onReupload?: ((...args: any[]) => any) | undefined;
31
34
  onPreview?: ((...args: any[]) => any) | undefined;
32
35
  }, {
33
36
  lazyLoad: boolean;
34
37
  deletable: boolean;
38
+ reupload: boolean;
35
39
  }>;
36
40
  export default _default;
@@ -13,10 +13,11 @@ var stdin_default = defineComponent({
13
13
  imageFit: String,
14
14
  lazyLoad: Boolean,
15
15
  deletable: Boolean,
16
+ reupload: Boolean,
16
17
  previewSize: [Number, String, Array],
17
18
  beforeDelete: Function
18
19
  },
19
- emits: ["delete", "preview"],
20
+ emits: ["delete", "preview", "reupload"],
20
21
  setup(props, {
21
22
  emit,
22
23
  slots
@@ -58,6 +59,7 @@ var stdin_default = defineComponent({
58
59
  });
59
60
  };
60
61
  const onPreview = () => emit("preview");
62
+ const onReupload = () => emit("reupload");
61
63
  const renderDeleteIcon = () => {
62
64
  if (props.deletable && props.item.status !== "uploading") {
63
65
  const slot = slots["preview-delete"];
@@ -93,7 +95,8 @@ var stdin_default = defineComponent({
93
95
  item,
94
96
  lazyLoad,
95
97
  imageFit,
96
- previewSize
98
+ previewSize,
99
+ reupload
97
100
  } = props;
98
101
  if (isImageFile(item)) {
99
102
  return _createVNode(Image, {
@@ -103,7 +106,7 @@ var stdin_default = defineComponent({
103
106
  "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
104
107
  "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
105
108
  "lazyLoad": lazyLoad,
106
- "onClick": onPreview
109
+ "onClick": reupload ? onReupload : onPreview
107
110
  }, {
108
111
  default: renderCover
109
112
  });
@@ -34,6 +34,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
34
34
  type: BooleanConstructor;
35
35
  default: true;
36
36
  };
37
+ reupload: BooleanConstructor;
37
38
  afterRead: import("vue").PropType<import("./types").UploaderAfterRead>;
38
39
  showUpload: {
39
40
  type: BooleanConstructor;
@@ -59,7 +60,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
59
60
  type: import("vue").PropType<import("./types").UploaderMaxSize>;
60
61
  default: number;
61
62
  };
62
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview")[], "update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
63
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview" | "clickReupload")[], "update:modelValue" | "delete" | "oversize" | "clickUpload" | "closePreview" | "clickPreview" | "clickReupload", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
63
64
  name: {
64
65
  type: (NumberConstructor | StringConstructor)[];
65
66
  default: string;
@@ -94,6 +95,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
94
95
  type: BooleanConstructor;
95
96
  default: true;
96
97
  };
98
+ reupload: BooleanConstructor;
97
99
  afterRead: import("vue").PropType<import("./types").UploaderAfterRead>;
98
100
  showUpload: {
99
101
  type: BooleanConstructor;
@@ -126,6 +128,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
126
128
  onClickUpload?: ((...args: any[]) => any) | undefined;
127
129
  onClosePreview?: ((...args: any[]) => any) | undefined;
128
130
  onClickPreview?: ((...args: any[]) => any) | undefined;
131
+ onClickReupload?: ((...args: any[]) => any) | undefined;
129
132
  }, {
130
133
  name: string | number;
131
134
  accept: string;
@@ -139,6 +142,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
139
142
  resultType: import("./types").UploaderResultType;
140
143
  uploadIcon: string;
141
144
  deletable: boolean;
145
+ reupload: boolean;
142
146
  showUpload: boolean;
143
147
  previewImage: boolean;
144
148
  previewFullImage: boolean;