vant 4.9.7 → 4.9.9

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 (57) hide show
  1. package/README.md +1 -0
  2. package/es/calendar/Calendar.mjs +1 -1
  3. package/es/calendar/CalendarDay.mjs +5 -3
  4. package/es/calendar/CalendarHeader.mjs +1 -1
  5. package/es/calendar/CalendarMonth.mjs +1 -1
  6. package/es/calendar/index.css +1 -1
  7. package/es/date-picker/DatePicker.d.ts +3 -3
  8. package/es/date-picker/DatePicker.mjs +9 -8
  9. package/es/date-picker/index.d.ts +2 -2
  10. package/es/date-picker/utils.d.ts +2 -4
  11. package/es/date-picker/utils.mjs +1 -6
  12. package/es/dialog/Dialog.d.ts +13 -0
  13. package/es/dialog/Dialog.mjs +5 -1
  14. package/es/dialog/index.d.ts +9 -0
  15. package/es/field/Field.d.ts +5 -1
  16. package/es/field/Field.mjs +7 -4
  17. package/es/field/index.d.ts +2 -0
  18. package/es/field/utils.d.ts +1 -1
  19. package/es/field/utils.mjs +6 -10
  20. package/es/index.d.ts +1 -1
  21. package/es/index.mjs +1 -1
  22. package/es/search/Search.d.ts +3 -0
  23. package/es/search/index.d.ts +2 -0
  24. package/es/time-picker/TimePicker.d.ts +3 -7
  25. package/es/time-picker/TimePicker.mjs +1 -2
  26. package/es/time-picker/index.d.ts +2 -4
  27. package/lib/calendar/Calendar.js +1 -1
  28. package/lib/calendar/CalendarDay.js +5 -3
  29. package/lib/calendar/CalendarHeader.js +1 -1
  30. package/lib/calendar/CalendarMonth.js +1 -1
  31. package/lib/calendar/index.css +1 -1
  32. package/lib/date-picker/DatePicker.d.ts +3 -3
  33. package/lib/date-picker/DatePicker.js +9 -8
  34. package/lib/date-picker/index.d.ts +2 -2
  35. package/lib/date-picker/utils.d.ts +2 -4
  36. package/lib/dialog/Dialog.d.ts +13 -0
  37. package/lib/dialog/Dialog.js +5 -1
  38. package/lib/dialog/index.d.ts +9 -0
  39. package/lib/field/Field.d.ts +5 -1
  40. package/lib/field/Field.js +7 -4
  41. package/lib/field/index.d.ts +2 -0
  42. package/lib/field/utils.d.ts +1 -1
  43. package/lib/field/utils.js +6 -10
  44. package/lib/index.css +1 -1
  45. package/lib/index.d.ts +1 -1
  46. package/lib/index.js +1 -1
  47. package/lib/search/Search.d.ts +3 -0
  48. package/lib/search/index.d.ts +2 -0
  49. package/lib/time-picker/TimePicker.d.ts +3 -7
  50. package/lib/time-picker/TimePicker.js +1 -2
  51. package/lib/time-picker/index.d.ts +2 -4
  52. package/lib/vant.cjs.js +37 -32
  53. package/lib/vant.es.js +37 -32
  54. package/lib/vant.js +38 -33
  55. package/lib/vant.min.js +3 -3
  56. package/lib/web-types.json +1 -1
  57. package/package.json +17 -17
package/lib/vant.js CHANGED
@@ -2376,7 +2376,7 @@
2376
2376
  return propRef;
2377
2377
  };
2378
2378
  /**
2379
- * @vue/shared v3.5.5
2379
+ * @vue/shared v3.5.12
2380
2380
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2381
2381
  * @license MIT
2382
2382
  **/
@@ -4509,20 +4509,16 @@
4509
4509
  setRootScrollTop(scrollTop);
4510
4510
  }
4511
4511
  }
4512
- function mapInputType(type) {
4512
+ function mapInputType(type, inputmode) {
4513
4513
  if (type === "number") {
4514
- return {
4515
- type: "text",
4516
- inputmode: "decimal"
4517
- };
4514
+ type = "text";
4515
+ inputmode != null ? inputmode : inputmode = "decimal";
4518
4516
  }
4519
4517
  if (type === "digit") {
4520
- return {
4521
- type: "tel",
4522
- inputmode: "numeric"
4523
- };
4518
+ type = "tel";
4519
+ inputmode != null ? inputmode : inputmode = "numeric";
4524
4520
  }
4525
- return { type };
4521
+ return { type, inputmode };
4526
4522
  }
4527
4523
  function getStringLength(str) {
4528
4524
  return [...str].length;
@@ -4568,7 +4564,8 @@
4568
4564
  readonly: {
4569
4565
  type: Boolean,
4570
4566
  default: null
4571
- }
4567
+ },
4568
+ inputmode: String
4572
4569
  };
4573
4570
  const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
4574
4571
  rows: numericProp,
@@ -4745,7 +4742,7 @@
4745
4742
  if (props2.type === "number" || props2.type === "digit") {
4746
4743
  const isNumber = props2.type === "number";
4747
4744
  value = formatNumber(value, isNumber, isNumber);
4748
- if (trigger === "onBlur" && value !== "") {
4745
+ if (trigger === "onBlur" && value !== "" && (props2.min !== void 0 || props2.max !== void 0)) {
4749
4746
  const adjustedValue = clamp(+value, (_a = props2.min) != null ? _a : -Infinity, (_b = props2.max) != null ? _b : Infinity);
4750
4747
  value = adjustedValue.toString();
4751
4748
  }
@@ -4911,9 +4908,11 @@
4911
4908
  onCompositionstart: startComposing
4912
4909
  };
4913
4910
  if (props2.type === "textarea") {
4914
- return vue.createVNode("textarea", inputAttrs, null);
4911
+ return vue.createVNode("textarea", vue.mergeProps(inputAttrs, {
4912
+ "inputmode": props2.inputmode
4913
+ }), null);
4915
4914
  }
4916
- return vue.createVNode("input", vue.mergeProps(mapInputType(props2.type), inputAttrs), null);
4915
+ return vue.createVNode("input", vue.mergeProps(mapInputType(props2.type, props2.inputmode), inputAttrs), null);
4917
4916
  };
4918
4917
  const renderLeftIcon = () => {
4919
4918
  const leftIconSlot = slots["left-icon"];
@@ -6956,6 +6955,9 @@
6956
6955
  }, [slots["bottom-info"] ? slots["bottom-info"](props2.item) : bottomInfo]);
6957
6956
  }
6958
6957
  };
6958
+ const renderText = () => {
6959
+ return slots.text ? slots.text(props2.item) : props2.item.text;
6960
+ };
6959
6961
  const renderContent = () => {
6960
6962
  const {
6961
6963
  item,
@@ -6963,10 +6965,9 @@
6963
6965
  rowHeight
6964
6966
  } = props2;
6965
6967
  const {
6966
- type,
6967
- text
6968
+ type
6968
6969
  } = item;
6969
- const Nodes = [renderTopInfo(), text, renderBottomInfo()];
6970
+ const Nodes = [renderTopInfo(), renderText(), renderBottomInfo()];
6970
6971
  if (type === "selected") {
6971
6972
  return vue.createVNode("div", {
6972
6973
  "class": bem$13("selected-day"),
@@ -7183,7 +7184,7 @@
7183
7184
  "rowHeight": rowHeight.value,
7184
7185
  "onClick": (item2) => emit("click", item2),
7185
7186
  "onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
7186
- }, pick(slots, ["top-info", "bottom-info"]));
7187
+ }, pick(slots, ["top-info", "bottom-info", "text"]));
7187
7188
  const renderDays = () => vue.createVNode("div", {
7188
7189
  "ref": daysRef,
7189
7190
  "role": "grid",
@@ -7283,7 +7284,7 @@
7283
7284
  const canSwitch = props2.switchMode !== "none";
7284
7285
  return vue.createVNode("div", {
7285
7286
  "class": bem$13("header-subtitle", {
7286
- "with-swicth": canSwitch
7287
+ "with-switch": canSwitch
7287
7288
  }),
7288
7289
  "onClick": onClickSubtitle
7289
7290
  }, [canSwitch ? [renderAction(), vue.createVNode("div", {
@@ -7657,7 +7658,7 @@
7657
7658
  }, pick(props2, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
7658
7659
  "onClick": onClickDay,
7659
7660
  "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
7660
- }), pick(slots, ["top-info", "bottom-info", "month-title"]));
7661
+ }), pick(slots, ["top-info", "bottom-info", "month-title", "text"]));
7661
7662
  };
7662
7663
  const renderFooterButton = () => {
7663
7664
  if (slots.footer) {
@@ -9828,11 +9829,7 @@
9828
9829
  const currentValues = vue.ref(props2.modelValue);
9829
9830
  const updatedByExternalSources = vue.ref(false);
9830
9831
  const pickerRef = vue.ref();
9831
- const genYearOptions = () => {
9832
- const minYear = props2.minDate.getFullYear();
9833
- const maxYear = props2.maxDate.getFullYear();
9834
- return genOptions(minYear, maxYear, "year", props2.formatter, props2.filter);
9835
- };
9832
+ const computedValues = vue.computed(() => updatedByExternalSources.value ? props2.modelValue : currentValues.value);
9836
9833
  const isMinYear = (year) => year === props2.minDate.getFullYear();
9837
9834
  const isMaxYear = (year) => year === props2.maxDate.getFullYear();
9838
9835
  const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
@@ -9843,7 +9840,7 @@
9843
9840
  columnsType
9844
9841
  } = props2;
9845
9842
  const index = columnsType.indexOf(type);
9846
- const value = updatedByExternalSources.value ? props2.modelValue[index] : currentValues.value[index];
9843
+ const value = computedValues.value[index];
9847
9844
  if (value) {
9848
9845
  return +value;
9849
9846
  }
@@ -9856,18 +9853,23 @@
9856
9853
  return minDate.getDate();
9857
9854
  }
9858
9855
  };
9856
+ const genYearOptions = () => {
9857
+ const minYear = props2.minDate.getFullYear();
9858
+ const maxYear = props2.maxDate.getFullYear();
9859
+ return genOptions(minYear, maxYear, "year", props2.formatter, props2.filter, computedValues.value);
9860
+ };
9859
9861
  const genMonthOptions = () => {
9860
9862
  const year = getValue2("year");
9861
9863
  const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
9862
9864
  const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
9863
- return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter);
9865
+ return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter, computedValues.value);
9864
9866
  };
9865
9867
  const genDayOptions = () => {
9866
9868
  const year = getValue2("year");
9867
9869
  const month = getValue2("month");
9868
9870
  const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
9869
9871
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9870
- return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9872
+ return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter, computedValues.value);
9871
9873
  };
9872
9874
  const confirm = () => {
9873
9875
  var _a;
@@ -9940,7 +9942,8 @@
9940
9942
  confirmButtonColor: String,
9941
9943
  confirmButtonDisabled: Boolean,
9942
9944
  showConfirmButton: truthProp,
9943
- closeOnClickOverlay: Boolean
9945
+ closeOnClickOverlay: Boolean,
9946
+ keyboardEnabled: truthProp
9944
9947
  });
9945
9948
  const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
9946
9949
  var stdin_default$W = vue.defineComponent({
@@ -9987,6 +9990,9 @@
9987
9990
  const onConfirm = getActionHandler("confirm");
9988
9991
  const onKeydown = vue.withKeys((event) => {
9989
9992
  var _a, _b;
9993
+ if (!props2.keyboardEnabled) {
9994
+ return;
9995
+ }
9990
9996
  if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
9991
9997
  return;
9992
9998
  }
@@ -16653,8 +16659,7 @@
16653
16659
  columnsType: {
16654
16660
  type: Array,
16655
16661
  default: () => ["hour", "minute"]
16656
- },
16657
- filter: Function
16662
+ }
16658
16663
  });
16659
16664
  var stdin_default$8 = vue.defineComponent({
16660
16665
  name: name$3,
@@ -18268,7 +18273,7 @@
18268
18273
  });
18269
18274
  }
18270
18275
  };
18271
- const version = "4.9.7";
18276
+ const version = "4.9.9";
18272
18277
  function install(app) {
18273
18278
  const components = [
18274
18279
  ActionBar,