vant 4.6.8 → 4.7.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 (49) hide show
  1. package/es/address-edit/AddressEdit.d.ts +2 -1
  2. package/es/address-edit/AddressEdit.mjs +9 -3
  3. package/es/address-edit/index.d.ts +2 -1
  4. package/es/calendar/Calendar.d.ts +2 -1
  5. package/es/calendar/Calendar.mjs +3 -2
  6. package/es/calendar/CalendarDay.d.ts +2 -1
  7. package/es/calendar/CalendarDay.mjs +3 -1
  8. package/es/calendar/CalendarMonth.d.ts +2 -1
  9. package/es/calendar/CalendarMonth.mjs +3 -2
  10. package/es/calendar/index.d.ts +2 -1
  11. package/es/dialog/function-call.d.ts +3 -3
  12. package/es/dialog/function-call.mjs +1 -1
  13. package/es/floating-panel/FloatingPanel.mjs +1 -1
  14. package/es/icon/index.css +1 -1
  15. package/es/index.d.ts +1 -1
  16. package/es/index.mjs +1 -1
  17. package/es/signature/Signature.mjs +10 -6
  18. package/es/swipe-cell/SwipeCell.mjs +10 -1
  19. package/es/uploader/index.css +1 -1
  20. package/es/utils/interceptor.d.ts +2 -1
  21. package/es/utils/interceptor.mjs +3 -2
  22. package/lib/address-edit/AddressEdit.d.ts +2 -1
  23. package/lib/address-edit/AddressEdit.js +9 -3
  24. package/lib/address-edit/index.d.ts +2 -1
  25. package/lib/calendar/Calendar.d.ts +2 -1
  26. package/lib/calendar/Calendar.js +3 -2
  27. package/lib/calendar/CalendarDay.d.ts +2 -1
  28. package/lib/calendar/CalendarDay.js +3 -1
  29. package/lib/calendar/CalendarMonth.d.ts +2 -1
  30. package/lib/calendar/CalendarMonth.js +3 -2
  31. package/lib/calendar/index.d.ts +2 -1
  32. package/lib/dialog/function-call.d.ts +3 -3
  33. package/lib/dialog/function-call.js +1 -1
  34. package/lib/floating-panel/FloatingPanel.js +1 -1
  35. package/lib/icon/index.css +1 -1
  36. package/lib/index.css +1 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.js +1 -1
  39. package/lib/signature/Signature.js +10 -6
  40. package/lib/swipe-cell/SwipeCell.js +10 -1
  41. package/lib/uploader/index.css +1 -1
  42. package/lib/utils/interceptor.d.ts +2 -1
  43. package/lib/utils/interceptor.js +3 -2
  44. package/lib/vant.cjs.js +44 -20
  45. package/lib/vant.es.js +44 -20
  46. package/lib/vant.js +44 -20
  47. package/lib/vant.min.js +1 -1
  48. package/lib/web-types.json +1 -1
  49. package/package.json +3 -3
package/lib/vant.js CHANGED
@@ -768,7 +768,8 @@
768
768
  function callInterceptor(interceptor, {
769
769
  args = [],
770
770
  done,
771
- canceled
771
+ canceled,
772
+ error
772
773
  }) {
773
774
  if (interceptor) {
774
775
  const returnVal = interceptor.apply(null, args);
@@ -779,7 +780,7 @@
779
780
  } else if (canceled) {
780
781
  canceled();
781
782
  }
782
- }).catch(noop);
783
+ }).catch(error || noop);
783
784
  } else if (returnVal) {
784
785
  done();
785
786
  } else if (canceled) {
@@ -5451,7 +5452,7 @@
5451
5452
  var stdin_default$1q = vue.defineComponent({
5452
5453
  name: name$1g,
5453
5454
  props: addressEditProps,
5454
- emits: ["save", "focus", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
5455
+ emits: ["save", "focus", "change", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
5455
5456
  setup(props2, {
5456
5457
  emit,
5457
5458
  slots
@@ -5485,6 +5486,12 @@
5485
5486
  detailFocused.value = key === "addressDetail";
5486
5487
  emit("focus", key);
5487
5488
  };
5489
+ const onChange = (key, value) => {
5490
+ emit("change", {
5491
+ key,
5492
+ value
5493
+ });
5494
+ };
5488
5495
  const rules = vue.computed(() => {
5489
5496
  const {
5490
5497
  validator,
@@ -5596,7 +5603,7 @@
5596
5603
  "class": bem$1c("fields")
5597
5604
  }, [vue.createVNode(Field, {
5598
5605
  "modelValue": data.name,
5599
- "onUpdate:modelValue": ($event) => data.name = $event,
5606
+ "onUpdate:modelValue": [($event) => data.name = $event, (val) => onChange("name", val)],
5600
5607
  "clearable": true,
5601
5608
  "label": t$i("name"),
5602
5609
  "rules": rules.value.name,
@@ -5604,7 +5611,7 @@
5604
5611
  "onFocus": () => onFocus("name")
5605
5612
  }, null), vue.createVNode(Field, {
5606
5613
  "modelValue": data.tel,
5607
- "onUpdate:modelValue": ($event) => data.tel = $event,
5614
+ "onUpdate:modelValue": [($event) => data.tel = $event, (val) => onChange("tel", val)],
5608
5615
  "clearable": true,
5609
5616
  "type": "tel",
5610
5617
  "label": t$i("tel"),
@@ -6596,7 +6603,7 @@
6596
6603
  offset: makeNumberProp(0),
6597
6604
  rowHeight: String
6598
6605
  },
6599
- emits: ["click"],
6606
+ emits: ["click", "clickDisabledDate"],
6600
6607
  setup(props2, {
6601
6608
  emit,
6602
6609
  slots
@@ -6642,6 +6649,8 @@
6642
6649
  const onClick = () => {
6643
6650
  if (props2.item.type !== "disabled") {
6644
6651
  emit("click", props2.item);
6652
+ } else {
6653
+ emit("clickDisabledDate", props2.item);
6645
6654
  }
6646
6655
  };
6647
6656
  const renderTopInfo = () => {
@@ -6728,7 +6737,7 @@
6728
6737
  var stdin_default$1g = vue.defineComponent({
6729
6738
  name: name$16,
6730
6739
  props: calendarMonthProps,
6731
- emits: ["click"],
6740
+ emits: ["click", "clickDisabledDate"],
6732
6741
  setup(props2, {
6733
6742
  emit,
6734
6743
  slots
@@ -6887,7 +6896,8 @@
6887
6896
  "color": props2.color,
6888
6897
  "offset": offset2.value,
6889
6898
  "rowHeight": rowHeight.value,
6890
- "onClick": (item2) => emit("click", item2)
6899
+ "onClick": (item2) => emit("click", item2),
6900
+ "onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
6891
6901
  }, pick(slots, ["top-info", "bottom-info"]));
6892
6902
  const renderDays = () => vue.createVNode("div", {
6893
6903
  "ref": daysRef,
@@ -7012,7 +7022,7 @@
7012
7022
  var stdin_default$1e = vue.defineComponent({
7013
7023
  name: name$18,
7014
7024
  props: calendarProps,
7015
- emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle"],
7025
+ emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
7016
7026
  setup(props2, {
7017
7027
  emit,
7018
7028
  slots
@@ -7280,7 +7290,8 @@
7280
7290
  "showMonthTitle": showMonthTitle,
7281
7291
  "firstDayOfWeek": dayOffset.value
7282
7292
  }, pick(props2, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
7283
- "onClick": onClickDay
7293
+ "onClick": onClickDay,
7294
+ "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
7284
7295
  }), pick(slots, ["top-info", "bottom-info", "month-title"]));
7285
7296
  };
7286
7297
  const renderFooterButton = () => {
@@ -9838,7 +9849,7 @@
9838
9849
  }
9839
9850
  function showDialog(options) {
9840
9851
  if (!inBrowser$1) {
9841
- return Promise.resolve();
9852
+ return Promise.resolve(void 0);
9842
9853
  }
9843
9854
  return new Promise((resolve, reject) => {
9844
9855
  if (!instance$2) {
@@ -10466,7 +10477,7 @@
10466
10477
  }, {
10467
10478
  immediate: true
10468
10479
  });
10469
- useLockScroll(rootRef, () => props2.lockScroll);
10480
+ useLockScroll(rootRef, () => props2.lockScroll || dragging.value);
10470
10481
  useEventListener("touchmove", onTouchmove, {
10471
10482
  target: rootRef
10472
10483
  });
@@ -14495,12 +14506,16 @@
14495
14506
  const empty = document.createElement("canvas");
14496
14507
  empty.width = canvas.width;
14497
14508
  empty.height = canvas.height;
14509
+ if (props2.backgroundColor) {
14510
+ const emptyCtx = empty.getContext("2d");
14511
+ setCanvasBgColor(emptyCtx);
14512
+ }
14498
14513
  return canvas.toDataURL() === empty.toDataURL();
14499
14514
  };
14500
- const setCanvasBgColor = () => {
14501
- if (state.ctx && props2.backgroundColor) {
14502
- state.ctx.fillStyle = props2.backgroundColor;
14503
- state.ctx.fillRect(0, 0, state.width, state.height);
14515
+ const setCanvasBgColor = (ctx) => {
14516
+ if (ctx && props2.backgroundColor) {
14517
+ ctx.fillStyle = props2.backgroundColor;
14518
+ ctx.fillRect(0, 0, state.width, state.height);
14504
14519
  }
14505
14520
  };
14506
14521
  const submit = () => {
@@ -14523,7 +14538,7 @@
14523
14538
  if (state.ctx) {
14524
14539
  state.ctx.clearRect(0, 0, state.width, state.height);
14525
14540
  state.ctx.closePath();
14526
- setCanvasBgColor();
14541
+ setCanvasBgColor(state.ctx);
14527
14542
  }
14528
14543
  emit("clear");
14529
14544
  };
@@ -14534,7 +14549,7 @@
14534
14549
  state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
14535
14550
  state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
14536
14551
  vue.nextTick(() => {
14537
- setCanvasBgColor();
14552
+ setCanvasBgColor(state.ctx);
14538
14553
  });
14539
14554
  }
14540
14555
  });
@@ -15605,6 +15620,7 @@
15605
15620
  let opened;
15606
15621
  let lockClick2;
15607
15622
  let startOffset;
15623
+ let isInBeforeClosing;
15608
15624
  const root = vue.ref();
15609
15625
  const leftRef = vue.ref();
15610
15626
  const rightRef = vue.ref();
@@ -15681,14 +15697,22 @@
15681
15697
  }
15682
15698
  };
15683
15699
  const onClick = (position = "outside") => {
15700
+ if (isInBeforeClosing)
15701
+ return;
15684
15702
  emit("click", position);
15685
15703
  if (opened && !lockClick2) {
15704
+ isInBeforeClosing = true;
15686
15705
  callInterceptor(props2.beforeClose, {
15687
15706
  args: [{
15688
15707
  name: props2.name,
15689
15708
  position
15690
15709
  }],
15691
- done: () => close(position)
15710
+ done: () => {
15711
+ isInBeforeClosing = false;
15712
+ close(position);
15713
+ },
15714
+ canceled: () => isInBeforeClosing = false,
15715
+ error: () => isInBeforeClosing = false
15692
15716
  });
15693
15717
  }
15694
15718
  };
@@ -17685,7 +17709,7 @@
17685
17709
  });
17686
17710
  }
17687
17711
  };
17688
- const version = "4.6.8";
17712
+ const version = "4.7.0";
17689
17713
  function install(app) {
17690
17714
  const components = [
17691
17715
  ActionBar,