vant 4.7.1 → 4.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -105,4 +105,4 @@ declare namespace _default {
105
105
  }
106
106
  export default _default;
107
107
  export function install(app: any): void;
108
- export const version: "4.7.1";
108
+ export const version: "4.7.2";
package/lib/index.js CHANGED
@@ -224,7 +224,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
224
224
  __reExport(stdin_exports, require("./tree-select"), module.exports);
225
225
  __reExport(stdin_exports, require("./uploader"), module.exports);
226
226
  __reExport(stdin_exports, require("./watermark"), module.exports);
227
- const version = "4.7.1";
227
+ const version = "4.7.2";
228
228
  function install(app) {
229
229
  const components = [
230
230
  import_action_bar.ActionBar,
@@ -50,37 +50,37 @@ var stdin_default = (0, import_vue2.defineComponent)({
50
50
  }) {
51
51
  const canvasRef = (0, import_vue2.ref)();
52
52
  const wrapRef = (0, import_vue2.ref)();
53
- const state = (0, import_vue2.reactive)({
54
- width: 0,
55
- height: 0,
56
- ctx: null,
57
- ratio: import_utils.inBrowser ? window.devicePixelRatio : 1
53
+ const ctx = (0, import_vue2.computed)(() => {
54
+ if (!canvasRef.value)
55
+ return null;
56
+ return canvasRef.value.getContext("2d");
58
57
  });
59
- let canvasRect;
60
58
  const isRenderCanvas = import_utils.inBrowser ? hasCanvasSupport() : true;
59
+ let canvasWidth = 0;
60
+ let canvasHeight = 0;
61
+ let canvasRect;
61
62
  const touchStart = () => {
62
- if (!state.ctx) {
63
+ if (!ctx.value) {
63
64
  return false;
64
65
  }
65
- state.ctx.beginPath();
66
- state.ctx.lineWidth = props.lineWidth * state.ratio;
67
- state.ctx.strokeStyle = props.penColor;
66
+ ctx.value.beginPath();
67
+ ctx.value.lineWidth = props.lineWidth;
68
+ ctx.value.strokeStyle = props.penColor;
68
69
  canvasRect = (0, import_use.useRect)(canvasRef);
69
70
  emit("start");
70
71
  };
71
72
  const touchMove = (event) => {
72
- var _a, _b;
73
- if (!state.ctx) {
73
+ if (!ctx.value) {
74
74
  return false;
75
75
  }
76
76
  (0, import_utils.preventDefault)(event);
77
77
  const touch = event.touches[0];
78
- const mouseX = (touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0)) * state.ratio;
79
- const mouseY = (touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0)) * state.ratio;
80
- state.ctx.lineCap = "round";
81
- state.ctx.lineJoin = "round";
82
- (_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
83
- (_b = state.ctx) == null ? void 0 : _b.stroke();
78
+ const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
79
+ const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
80
+ ctx.value.lineCap = "round";
81
+ ctx.value.lineJoin = "round";
82
+ ctx.value.lineTo(mouseX, mouseY);
83
+ ctx.value.stroke();
84
84
  emit("signing", event);
85
85
  };
86
86
  const touchEnd = (event) => {
@@ -97,10 +97,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
97
97
  }
98
98
  return canvas.toDataURL() === empty.toDataURL();
99
99
  };
100
- const setCanvasBgColor = (ctx) => {
101
- if (ctx && props.backgroundColor) {
102
- ctx.fillStyle = props.backgroundColor;
103
- ctx.fillRect(0, 0, state.width, state.height);
100
+ const setCanvasBgColor = (ctx2) => {
101
+ if (ctx2 && props.backgroundColor) {
102
+ ctx2.fillStyle = props.backgroundColor;
103
+ ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
104
104
  }
105
105
  };
106
106
  const submit = () => {
@@ -120,22 +120,22 @@ var stdin_default = (0, import_vue2.defineComponent)({
120
120
  });
121
121
  };
122
122
  const clear = () => {
123
- if (state.ctx) {
124
- state.ctx.clearRect(0, 0, state.width, state.height);
125
- state.ctx.closePath();
126
- setCanvasBgColor(state.ctx);
123
+ if (ctx.value) {
124
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
125
+ ctx.value.closePath();
126
+ setCanvasBgColor(ctx.value);
127
127
  }
128
128
  emit("clear");
129
129
  };
130
130
  (0, import_vue2.onMounted)(() => {
131
131
  var _a, _b, _c;
132
- if (isRenderCanvas) {
133
- state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
134
- state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
135
- state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
136
- (0, import_vue2.nextTick)(() => {
137
- setCanvasBgColor(state.ctx);
138
- });
132
+ if (isRenderCanvas && canvasRef.value) {
133
+ const canvas = canvasRef.value;
134
+ const dpr = import_utils.inBrowser ? window.devicePixelRatio : 1;
135
+ canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
136
+ canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
137
+ (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
138
+ setCanvasBgColor(ctx.value);
139
139
  }
140
140
  });
141
141
  return () => (0, import_vue.createVNode)("div", {
@@ -145,8 +145,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
145
145
  "ref": wrapRef
146
146
  }, [isRenderCanvas ? (0, import_vue.createVNode)("canvas", {
147
147
  "ref": canvasRef,
148
- "width": state.width,
149
- "height": state.height,
150
148
  "onTouchstartPassive": touchStart,
151
149
  "onTouchmove": touchMove,
152
150
  "onTouchend": touchEnd
@@ -80,6 +80,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
80
80
  const inputRef = (0, import_vue2.ref)();
81
81
  const urls = [];
82
82
  const reuploadIndex = (0, import_vue2.ref)(-1);
83
+ const isReuploading = (0, import_vue2.ref)(false);
83
84
  const getDetail = (index = props.modelValue.length) => ({
84
85
  name: props.name,
85
86
  index
@@ -216,8 +217,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
216
217
  emit("delete", item, getDetail(index));
217
218
  };
218
219
  const reuploadImage = (index) => {
219
- chooseFile();
220
+ isReuploading.value = true;
220
221
  reuploadIndex.value = index;
222
+ (0, import_vue2.nextTick)(() => chooseFile());
223
+ };
224
+ const onInputClick = () => {
225
+ if (!isReuploading.value) {
226
+ reuploadIndex.value = -1;
227
+ }
228
+ isReuploading.value = false;
221
229
  };
222
230
  const renderPreviewItem = (item, index) => {
223
231
  const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
@@ -250,7 +258,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
250
258
  "capture": props.capture,
251
259
  "multiple": props.multiple && reuploadIndex.value === -1,
252
260
  "disabled": props.disabled,
253
- "onChange": onChange
261
+ "onChange": onChange,
262
+ "onClick": onInputClick
254
263
  }, null);
255
264
  if (slots.default) {
256
265
  return (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", {
package/lib/vant.cjs.js CHANGED
@@ -10268,6 +10268,7 @@ var stdin_default$N = vue.defineComponent({
10268
10268
  rootWidth: makeRequiredProp(Number),
10269
10269
  rootHeight: makeRequiredProp(Number),
10270
10270
  disableZoom: Boolean,
10271
+ doubleScale: Boolean,
10271
10272
  closeOnClickOverlay: Boolean
10272
10273
  },
10273
10274
  emits: ["scale", "close", "longPress"],
@@ -10441,18 +10442,22 @@ var stdin_default$N = vue.defineComponent({
10441
10442
  const TAP_TIME = 250;
10442
10443
  if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
10443
10444
  if (deltaTime < TAP_TIME) {
10444
- if (doubleTapTimer) {
10445
- clearTimeout(doubleTapTimer);
10446
- doubleTapTimer = null;
10447
- toggleScale();
10448
- } else {
10449
- if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
10450
- return;
10451
- }
10452
- doubleTapTimer = setTimeout(() => {
10453
- emit("close");
10445
+ if (props2.doubleScale) {
10446
+ if (doubleTapTimer) {
10447
+ clearTimeout(doubleTapTimer);
10454
10448
  doubleTapTimer = null;
10455
- }, TAP_TIME);
10449
+ toggleScale();
10450
+ } else {
10451
+ if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
10452
+ return;
10453
+ }
10454
+ doubleTapTimer = setTimeout(() => {
10455
+ emit("close");
10456
+ doubleTapTimer = null;
10457
+ }, TAP_TIME);
10458
+ }
10459
+ } else {
10460
+ emit("close");
10456
10461
  }
10457
10462
  } else if (deltaTime > LONG_PRESS_START_TIME) {
10458
10463
  emit("longPress");
@@ -10577,6 +10582,7 @@ const imagePreviewProps = {
10577
10582
  closeIcon: makeStringProp("clear"),
10578
10583
  transition: String,
10579
10584
  beforeClose: Function,
10585
+ doubleScale: truthProp,
10580
10586
  overlayClass: unknownProp,
10581
10587
  overlayStyle: Object,
10582
10588
  swipeDuration: makeNumericProp(300),
@@ -10668,6 +10674,7 @@ var stdin_default$M = vue.defineComponent({
10668
10674
  "rootWidth": state.rootWidth,
10669
10675
  "rootHeight": state.rootHeight,
10670
10676
  "disableZoom": state.disableZoom,
10677
+ "doubleScale": props2.doubleScale,
10671
10678
  "closeOnClickOverlay": props2.closeOnClickOverlay,
10672
10679
  "onScale": emitScale,
10673
10680
  "onClose": emitClose,
@@ -10745,6 +10752,7 @@ const defaultConfig = {
10745
10752
  closeIcon: "clear",
10746
10753
  transition: void 0,
10747
10754
  beforeClose: void 0,
10755
+ doubleScale: true,
10748
10756
  overlayStyle: void 0,
10749
10757
  overlayClass: void 0,
10750
10758
  startPosition: 0,
@@ -13235,37 +13243,37 @@ var stdin_default$r = vue.defineComponent({
13235
13243
  }) {
13236
13244
  const canvasRef = vue.ref();
13237
13245
  const wrapRef = vue.ref();
13238
- const state = vue.reactive({
13239
- width: 0,
13240
- height: 0,
13241
- ctx: null,
13242
- ratio: inBrowser ? window.devicePixelRatio : 1
13246
+ const ctx = vue.computed(() => {
13247
+ if (!canvasRef.value)
13248
+ return null;
13249
+ return canvasRef.value.getContext("2d");
13243
13250
  });
13244
- let canvasRect;
13245
13251
  const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
13252
+ let canvasWidth = 0;
13253
+ let canvasHeight = 0;
13254
+ let canvasRect;
13246
13255
  const touchStart = () => {
13247
- if (!state.ctx) {
13256
+ if (!ctx.value) {
13248
13257
  return false;
13249
13258
  }
13250
- state.ctx.beginPath();
13251
- state.ctx.lineWidth = props2.lineWidth * state.ratio;
13252
- state.ctx.strokeStyle = props2.penColor;
13259
+ ctx.value.beginPath();
13260
+ ctx.value.lineWidth = props2.lineWidth;
13261
+ ctx.value.strokeStyle = props2.penColor;
13253
13262
  canvasRect = use.useRect(canvasRef);
13254
13263
  emit("start");
13255
13264
  };
13256
13265
  const touchMove = (event) => {
13257
- var _a, _b;
13258
- if (!state.ctx) {
13266
+ if (!ctx.value) {
13259
13267
  return false;
13260
13268
  }
13261
13269
  preventDefault(event);
13262
13270
  const touch = event.touches[0];
13263
- const mouseX = (touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0)) * state.ratio;
13264
- const mouseY = (touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0)) * state.ratio;
13265
- state.ctx.lineCap = "round";
13266
- state.ctx.lineJoin = "round";
13267
- (_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
13268
- (_b = state.ctx) == null ? void 0 : _b.stroke();
13271
+ const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
13272
+ const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
13273
+ ctx.value.lineCap = "round";
13274
+ ctx.value.lineJoin = "round";
13275
+ ctx.value.lineTo(mouseX, mouseY);
13276
+ ctx.value.stroke();
13269
13277
  emit("signing", event);
13270
13278
  };
13271
13279
  const touchEnd = (event) => {
@@ -13282,10 +13290,10 @@ var stdin_default$r = vue.defineComponent({
13282
13290
  }
13283
13291
  return canvas.toDataURL() === empty.toDataURL();
13284
13292
  };
13285
- const setCanvasBgColor = (ctx) => {
13286
- if (ctx && props2.backgroundColor) {
13287
- ctx.fillStyle = props2.backgroundColor;
13288
- ctx.fillRect(0, 0, state.width, state.height);
13293
+ const setCanvasBgColor = (ctx2) => {
13294
+ if (ctx2 && props2.backgroundColor) {
13295
+ ctx2.fillStyle = props2.backgroundColor;
13296
+ ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
13289
13297
  }
13290
13298
  };
13291
13299
  const submit = () => {
@@ -13305,22 +13313,22 @@ var stdin_default$r = vue.defineComponent({
13305
13313
  });
13306
13314
  };
13307
13315
  const clear = () => {
13308
- if (state.ctx) {
13309
- state.ctx.clearRect(0, 0, state.width, state.height);
13310
- state.ctx.closePath();
13311
- setCanvasBgColor(state.ctx);
13316
+ if (ctx.value) {
13317
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13318
+ ctx.value.closePath();
13319
+ setCanvasBgColor(ctx.value);
13312
13320
  }
13313
13321
  emit("clear");
13314
13322
  };
13315
13323
  vue.onMounted(() => {
13316
13324
  var _a, _b, _c;
13317
- if (isRenderCanvas) {
13318
- state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
13319
- state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
13320
- state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
13321
- vue.nextTick(() => {
13322
- setCanvasBgColor(state.ctx);
13323
- });
13325
+ if (isRenderCanvas && canvasRef.value) {
13326
+ const canvas = canvasRef.value;
13327
+ const dpr = inBrowser ? window.devicePixelRatio : 1;
13328
+ canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
13329
+ canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
13330
+ (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
13331
+ setCanvasBgColor(ctx.value);
13324
13332
  }
13325
13333
  });
13326
13334
  return () => vue.createVNode("div", {
@@ -13330,8 +13338,6 @@ var stdin_default$r = vue.defineComponent({
13330
13338
  "ref": wrapRef
13331
13339
  }, [isRenderCanvas ? vue.createVNode("canvas", {
13332
13340
  "ref": canvasRef,
13333
- "width": state.width,
13334
- "height": state.height,
13335
13341
  "onTouchstartPassive": touchStart,
13336
13342
  "onTouchmove": touchMove,
13337
13343
  "onTouchend": touchEnd
@@ -15289,6 +15295,7 @@ var stdin_default$5 = vue.defineComponent({
15289
15295
  const inputRef = vue.ref();
15290
15296
  const urls = [];
15291
15297
  const reuploadIndex = vue.ref(-1);
15298
+ const isReuploading = vue.ref(false);
15292
15299
  const getDetail = (index = props2.modelValue.length) => ({
15293
15300
  name: props2.name,
15294
15301
  index
@@ -15425,8 +15432,15 @@ var stdin_default$5 = vue.defineComponent({
15425
15432
  emit("delete", item, getDetail(index));
15426
15433
  };
15427
15434
  const reuploadImage = (index) => {
15428
- chooseFile();
15435
+ isReuploading.value = true;
15429
15436
  reuploadIndex.value = index;
15437
+ vue.nextTick(() => chooseFile());
15438
+ };
15439
+ const onInputClick = () => {
15440
+ if (!isReuploading.value) {
15441
+ reuploadIndex.value = -1;
15442
+ }
15443
+ isReuploading.value = false;
15430
15444
  };
15431
15445
  const renderPreviewItem = (item, index) => {
15432
15446
  const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
@@ -15459,7 +15473,8 @@ var stdin_default$5 = vue.defineComponent({
15459
15473
  "capture": props2.capture,
15460
15474
  "multiple": props2.multiple && reuploadIndex.value === -1,
15461
15475
  "disabled": props2.disabled,
15462
- "onChange": onChange
15476
+ "onChange": onChange,
15477
+ "onClick": onInputClick
15463
15478
  }, null);
15464
15479
  if (slots.default) {
15465
15480
  return vue.withDirectives(vue.createVNode("div", {
@@ -16505,7 +16520,7 @@ const Lazyload = {
16505
16520
  });
16506
16521
  }
16507
16522
  };
16508
- const version = "4.7.1";
16523
+ const version = "4.7.2";
16509
16524
  function install(app) {
16510
16525
  const components = [
16511
16526
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -10266,6 +10266,7 @@ var stdin_default$N = defineComponent({
10266
10266
  rootWidth: makeRequiredProp(Number),
10267
10267
  rootHeight: makeRequiredProp(Number),
10268
10268
  disableZoom: Boolean,
10269
+ doubleScale: Boolean,
10269
10270
  closeOnClickOverlay: Boolean
10270
10271
  },
10271
10272
  emits: ["scale", "close", "longPress"],
@@ -10439,18 +10440,22 @@ var stdin_default$N = defineComponent({
10439
10440
  const TAP_TIME = 250;
10440
10441
  if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
10441
10442
  if (deltaTime < TAP_TIME) {
10442
- if (doubleTapTimer) {
10443
- clearTimeout(doubleTapTimer);
10444
- doubleTapTimer = null;
10445
- toggleScale();
10446
- } else {
10447
- if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
10448
- return;
10449
- }
10450
- doubleTapTimer = setTimeout(() => {
10451
- emit("close");
10443
+ if (props2.doubleScale) {
10444
+ if (doubleTapTimer) {
10445
+ clearTimeout(doubleTapTimer);
10452
10446
  doubleTapTimer = null;
10453
- }, TAP_TIME);
10447
+ toggleScale();
10448
+ } else {
10449
+ if (!props2.closeOnClickOverlay && event.target === ((_a = swipeItem.value) == null ? void 0 : _a.$el)) {
10450
+ return;
10451
+ }
10452
+ doubleTapTimer = setTimeout(() => {
10453
+ emit("close");
10454
+ doubleTapTimer = null;
10455
+ }, TAP_TIME);
10456
+ }
10457
+ } else {
10458
+ emit("close");
10454
10459
  }
10455
10460
  } else if (deltaTime > LONG_PRESS_START_TIME) {
10456
10461
  emit("longPress");
@@ -10575,6 +10580,7 @@ const imagePreviewProps = {
10575
10580
  closeIcon: makeStringProp("clear"),
10576
10581
  transition: String,
10577
10582
  beforeClose: Function,
10583
+ doubleScale: truthProp,
10578
10584
  overlayClass: unknownProp,
10579
10585
  overlayStyle: Object,
10580
10586
  swipeDuration: makeNumericProp(300),
@@ -10666,6 +10672,7 @@ var stdin_default$M = defineComponent({
10666
10672
  "rootWidth": state.rootWidth,
10667
10673
  "rootHeight": state.rootHeight,
10668
10674
  "disableZoom": state.disableZoom,
10675
+ "doubleScale": props2.doubleScale,
10669
10676
  "closeOnClickOverlay": props2.closeOnClickOverlay,
10670
10677
  "onScale": emitScale,
10671
10678
  "onClose": emitClose,
@@ -10743,6 +10750,7 @@ const defaultConfig = {
10743
10750
  closeIcon: "clear",
10744
10751
  transition: void 0,
10745
10752
  beforeClose: void 0,
10753
+ doubleScale: true,
10746
10754
  overlayStyle: void 0,
10747
10755
  overlayClass: void 0,
10748
10756
  startPosition: 0,
@@ -13233,37 +13241,37 @@ var stdin_default$r = defineComponent({
13233
13241
  }) {
13234
13242
  const canvasRef = ref();
13235
13243
  const wrapRef = ref();
13236
- const state = reactive({
13237
- width: 0,
13238
- height: 0,
13239
- ctx: null,
13240
- ratio: inBrowser ? window.devicePixelRatio : 1
13244
+ const ctx = computed(() => {
13245
+ if (!canvasRef.value)
13246
+ return null;
13247
+ return canvasRef.value.getContext("2d");
13241
13248
  });
13242
- let canvasRect;
13243
13249
  const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
13250
+ let canvasWidth = 0;
13251
+ let canvasHeight = 0;
13252
+ let canvasRect;
13244
13253
  const touchStart = () => {
13245
- if (!state.ctx) {
13254
+ if (!ctx.value) {
13246
13255
  return false;
13247
13256
  }
13248
- state.ctx.beginPath();
13249
- state.ctx.lineWidth = props2.lineWidth * state.ratio;
13250
- state.ctx.strokeStyle = props2.penColor;
13257
+ ctx.value.beginPath();
13258
+ ctx.value.lineWidth = props2.lineWidth;
13259
+ ctx.value.strokeStyle = props2.penColor;
13251
13260
  canvasRect = useRect(canvasRef);
13252
13261
  emit("start");
13253
13262
  };
13254
13263
  const touchMove = (event) => {
13255
- var _a, _b;
13256
- if (!state.ctx) {
13264
+ if (!ctx.value) {
13257
13265
  return false;
13258
13266
  }
13259
13267
  preventDefault(event);
13260
13268
  const touch = event.touches[0];
13261
- const mouseX = (touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0)) * state.ratio;
13262
- const mouseY = (touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0)) * state.ratio;
13263
- state.ctx.lineCap = "round";
13264
- state.ctx.lineJoin = "round";
13265
- (_a = state.ctx) == null ? void 0 : _a.lineTo(mouseX, mouseY);
13266
- (_b = state.ctx) == null ? void 0 : _b.stroke();
13269
+ const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
13270
+ const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
13271
+ ctx.value.lineCap = "round";
13272
+ ctx.value.lineJoin = "round";
13273
+ ctx.value.lineTo(mouseX, mouseY);
13274
+ ctx.value.stroke();
13267
13275
  emit("signing", event);
13268
13276
  };
13269
13277
  const touchEnd = (event) => {
@@ -13280,10 +13288,10 @@ var stdin_default$r = defineComponent({
13280
13288
  }
13281
13289
  return canvas.toDataURL() === empty.toDataURL();
13282
13290
  };
13283
- const setCanvasBgColor = (ctx) => {
13284
- if (ctx && props2.backgroundColor) {
13285
- ctx.fillStyle = props2.backgroundColor;
13286
- ctx.fillRect(0, 0, state.width, state.height);
13291
+ const setCanvasBgColor = (ctx2) => {
13292
+ if (ctx2 && props2.backgroundColor) {
13293
+ ctx2.fillStyle = props2.backgroundColor;
13294
+ ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
13287
13295
  }
13288
13296
  };
13289
13297
  const submit = () => {
@@ -13303,22 +13311,22 @@ var stdin_default$r = defineComponent({
13303
13311
  });
13304
13312
  };
13305
13313
  const clear = () => {
13306
- if (state.ctx) {
13307
- state.ctx.clearRect(0, 0, state.width, state.height);
13308
- state.ctx.closePath();
13309
- setCanvasBgColor(state.ctx);
13314
+ if (ctx.value) {
13315
+ ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13316
+ ctx.value.closePath();
13317
+ setCanvasBgColor(ctx.value);
13310
13318
  }
13311
13319
  emit("clear");
13312
13320
  };
13313
13321
  onMounted(() => {
13314
13322
  var _a, _b, _c;
13315
- if (isRenderCanvas) {
13316
- state.ctx = (_a = canvasRef.value) == null ? void 0 : _a.getContext("2d");
13317
- state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
13318
- state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
13319
- nextTick(() => {
13320
- setCanvasBgColor(state.ctx);
13321
- });
13323
+ if (isRenderCanvas && canvasRef.value) {
13324
+ const canvas = canvasRef.value;
13325
+ const dpr = inBrowser ? window.devicePixelRatio : 1;
13326
+ canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
13327
+ canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
13328
+ (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
13329
+ setCanvasBgColor(ctx.value);
13322
13330
  }
13323
13331
  });
13324
13332
  return () => createVNode("div", {
@@ -13328,8 +13336,6 @@ var stdin_default$r = defineComponent({
13328
13336
  "ref": wrapRef
13329
13337
  }, [isRenderCanvas ? createVNode("canvas", {
13330
13338
  "ref": canvasRef,
13331
- "width": state.width,
13332
- "height": state.height,
13333
13339
  "onTouchstartPassive": touchStart,
13334
13340
  "onTouchmove": touchMove,
13335
13341
  "onTouchend": touchEnd
@@ -15287,6 +15293,7 @@ var stdin_default$5 = defineComponent({
15287
15293
  const inputRef = ref();
15288
15294
  const urls = [];
15289
15295
  const reuploadIndex = ref(-1);
15296
+ const isReuploading = ref(false);
15290
15297
  const getDetail = (index = props2.modelValue.length) => ({
15291
15298
  name: props2.name,
15292
15299
  index
@@ -15423,8 +15430,15 @@ var stdin_default$5 = defineComponent({
15423
15430
  emit("delete", item, getDetail(index));
15424
15431
  };
15425
15432
  const reuploadImage = (index) => {
15426
- chooseFile();
15433
+ isReuploading.value = true;
15427
15434
  reuploadIndex.value = index;
15435
+ nextTick(() => chooseFile());
15436
+ };
15437
+ const onInputClick = () => {
15438
+ if (!isReuploading.value) {
15439
+ reuploadIndex.value = -1;
15440
+ }
15441
+ isReuploading.value = false;
15428
15442
  };
15429
15443
  const renderPreviewItem = (item, index) => {
15430
15444
  const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
@@ -15457,7 +15471,8 @@ var stdin_default$5 = defineComponent({
15457
15471
  "capture": props2.capture,
15458
15472
  "multiple": props2.multiple && reuploadIndex.value === -1,
15459
15473
  "disabled": props2.disabled,
15460
- "onChange": onChange
15474
+ "onChange": onChange,
15475
+ "onClick": onInputClick
15461
15476
  }, null);
15462
15477
  if (slots.default) {
15463
15478
  return withDirectives(createVNode("div", {
@@ -16503,7 +16518,7 @@ const Lazyload = {
16503
16518
  });
16504
16519
  }
16505
16520
  };
16506
- const version = "4.7.1";
16521
+ const version = "4.7.2";
16507
16522
  function install(app) {
16508
16523
  const components = [
16509
16524
  ActionBar,