vant 4.7.2 → 4.7.3

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 (72) hide show
  1. package/README.md +1 -0
  2. package/es/address-edit/AddressEdit.mjs +1 -1
  3. package/es/cell/Cell.d.ts +17 -5
  4. package/es/cell/Cell.mjs +5 -2
  5. package/es/cell/index.d.ts +9 -3
  6. package/es/collapse-item/CollapseItem.d.ts +13 -4
  7. package/es/collapse-item/index.d.ts +9 -3
  8. package/es/config-provider/types.d.ts +1 -1
  9. package/es/field/Field.d.ts +30 -21
  10. package/es/field/Field.mjs +11 -3
  11. package/es/field/index.css +1 -1
  12. package/es/field/index.d.ts +18 -12
  13. package/es/field/types.d.ts +1 -1
  14. package/es/form/Form.d.ts +3 -0
  15. package/es/form/Form.mjs +1 -0
  16. package/es/form/index.d.ts +2 -0
  17. package/es/index.d.ts +1 -1
  18. package/es/index.mjs +1 -1
  19. package/es/locale/lang/ar-SA.d.ts +63 -0
  20. package/es/locale/lang/ar-SA.mjs +65 -0
  21. package/es/picker-group/PickerGroup.mjs +3 -3
  22. package/es/progress/types.d.ts +1 -4
  23. package/es/search/Search.d.ts +13 -13
  24. package/es/search/Search.mjs +3 -1
  25. package/es/search/index.css +1 -1
  26. package/es/search/index.d.ts +9 -9
  27. package/es/signature/Signature.mjs +16 -3
  28. package/es/signature/index.d.ts +1 -1
  29. package/es/signature/types.d.ts +6 -0
  30. package/es/tabs/Tabs.d.ts +13 -0
  31. package/es/tabs/Tabs.mjs +3 -2
  32. package/es/tabs/index.d.ts +9 -0
  33. package/es/text-ellipsis/index.css +1 -1
  34. package/lib/address-edit/AddressEdit.js +1 -1
  35. package/lib/cell/Cell.d.ts +17 -5
  36. package/lib/cell/Cell.js +5 -2
  37. package/lib/cell/index.d.ts +9 -3
  38. package/lib/collapse-item/CollapseItem.d.ts +13 -4
  39. package/lib/collapse-item/index.d.ts +9 -3
  40. package/lib/config-provider/types.d.ts +1 -1
  41. package/lib/field/Field.d.ts +30 -21
  42. package/lib/field/Field.js +11 -3
  43. package/lib/field/index.css +1 -1
  44. package/lib/field/index.d.ts +18 -12
  45. package/lib/field/types.d.ts +1 -1
  46. package/lib/form/Form.d.ts +3 -0
  47. package/lib/form/Form.js +1 -0
  48. package/lib/form/index.d.ts +2 -0
  49. package/lib/index.css +1 -1
  50. package/lib/index.d.ts +1 -1
  51. package/lib/index.js +1 -1
  52. package/lib/locale/lang/ar-SA.d.ts +63 -0
  53. package/lib/locale/lang/ar-SA.js +84 -0
  54. package/lib/picker-group/PickerGroup.js +2 -2
  55. package/lib/progress/types.d.ts +1 -4
  56. package/lib/search/Search.d.ts +13 -13
  57. package/lib/search/Search.js +3 -1
  58. package/lib/search/index.css +1 -1
  59. package/lib/search/index.d.ts +9 -9
  60. package/lib/signature/Signature.js +14 -1
  61. package/lib/signature/index.d.ts +1 -1
  62. package/lib/signature/types.d.ts +6 -0
  63. package/lib/tabs/Tabs.d.ts +13 -0
  64. package/lib/tabs/Tabs.js +3 -2
  65. package/lib/tabs/index.d.ts +9 -0
  66. package/lib/text-ellipsis/index.css +1 -1
  67. package/lib/vant.cjs.js +40 -13
  68. package/lib/vant.es.js +41 -14
  69. package/lib/vant.js +40 -13
  70. package/lib/vant.min.js +1 -1
  71. package/lib/web-types.json +1 -1
  72. package/package.json +2 -2
package/lib/vant.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, onActivated, onDeactivated, onBeforeUnmount, provide, watchEffect, mergeProps, Transition, withDirectives, vShow, Teleport, Fragment, onBeforeUpdate, createTextVNode, onUnmounted, createApp, resolveDirective, withKeys, onUpdated, Comment, Text, h } from "vue";
1
+ import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, onActivated, onDeactivated, onBeforeUnmount, provide, watchEffect, mergeProps, Transition, withDirectives, vShow, Teleport, Fragment, onBeforeUpdate, Comment, createTextVNode, onUnmounted, createApp, resolveDirective, withKeys, onUpdated, Text, h } from "vue";
2
2
  import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, cancelRaf, raf, useScrollParent, usePageVisibility, doubleRaf, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, inBrowser as inBrowser$1, useToggle, useCountDown, useClickAway } from "@vant/use";
3
3
  import { normalizeClass, stringifyStyle, normalizeStyle } from "@vue/shared";
4
4
  import { offsetModifier, createPopper } from "@vant/popperjs";
@@ -2608,6 +2608,7 @@ const tabsProps = {
2608
2608
  offsetTop: makeNumericProp(0),
2609
2609
  background: String,
2610
2610
  lazyRender: truthProp,
2611
+ showHeader: truthProp,
2611
2612
  lineWidth: numericProp,
2612
2613
  lineHeight: numericProp,
2613
2614
  beforeChange: Function,
@@ -2909,13 +2910,13 @@ var stdin_default$1C = defineComponent({
2909
2910
  return () => createVNode("div", {
2910
2911
  "ref": root,
2911
2912
  "class": bem$1o([props2.type])
2912
- }, [props2.sticky ? createVNode(Sticky, {
2913
+ }, [props2.showHeader ? props2.sticky ? createVNode(Sticky, {
2913
2914
  "container": root.value,
2914
2915
  "offsetTop": offsetTopPx.value,
2915
2916
  "onScroll": onStickyScroll
2916
2917
  }, {
2917
2918
  default: () => [renderHeader()]
2918
- }) : renderHeader(), createVNode(stdin_default$1D, {
2919
+ }) : renderHeader() : null, createVNode(stdin_default$1D, {
2919
2920
  "ref": contentRef,
2920
2921
  "count": children.length,
2921
2922
  "inited": state.inited,
@@ -3262,8 +3263,8 @@ var stdin_default$1z = defineComponent({
3262
3263
  };
3263
3264
  const onCancel = () => emit("cancel");
3264
3265
  return () => {
3265
- var _a;
3266
- const childNodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
3266
+ var _a, _b;
3267
+ const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== Comment);
3267
3268
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3268
3269
  return createVNode("div", {
3269
3270
  "class": bem$1k()
@@ -3653,13 +3654,16 @@ const cellSharedProps = {
3653
3654
  center: Boolean,
3654
3655
  isLink: Boolean,
3655
3656
  border: truthProp,
3656
- required: Boolean,
3657
3657
  iconPrefix: String,
3658
3658
  valueClass: unknownProp,
3659
3659
  labelClass: unknownProp,
3660
3660
  titleClass: unknownProp,
3661
3661
  titleStyle: null,
3662
3662
  arrowDirection: String,
3663
+ required: {
3664
+ type: [Boolean, String],
3665
+ default: null
3666
+ },
3663
3667
  clickable: {
3664
3668
  type: Boolean,
3665
3669
  default: null
@@ -3740,7 +3744,7 @@ var stdin_default$1w = defineComponent({
3740
3744
  const clickable = (_a = props2.clickable) != null ? _a : isLink;
3741
3745
  const classes = {
3742
3746
  center,
3743
- required,
3747
+ required: !!required,
3744
3748
  clickable,
3745
3749
  borderless: !border
3746
3750
  };
@@ -3767,6 +3771,7 @@ const formProps = {
3767
3771
  colon: Boolean,
3768
3772
  disabled: Boolean,
3769
3773
  readonly: Boolean,
3774
+ required: [Boolean, String],
3770
3775
  showError: Boolean,
3771
3776
  labelWidth: numericProp,
3772
3777
  labelAlign: String,
@@ -4022,12 +4027,12 @@ const fieldSharedProps = {
4022
4027
  autocorrect: String,
4023
4028
  errorMessage: String,
4024
4029
  enterkeyhint: String,
4030
+ clearTrigger: makeStringProp("focus"),
4031
+ formatTrigger: makeStringProp("onChange"),
4025
4032
  spellcheck: {
4026
4033
  type: Boolean,
4027
4034
  default: null
4028
4035
  },
4029
- clearTrigger: makeStringProp("focus"),
4030
- formatTrigger: makeStringProp("onChange"),
4031
4036
  error: {
4032
4037
  type: Boolean,
4033
4038
  default: null
@@ -4103,6 +4108,14 @@ var stdin_default$1u = defineComponent({
4103
4108
  }
4104
4109
  return props2.modelValue;
4105
4110
  });
4111
+ const showRequiredMark = computed(() => {
4112
+ var _a;
4113
+ const required = getProp("required");
4114
+ if (required === "auto") {
4115
+ return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
4116
+ }
4117
+ return required;
4118
+ });
4106
4119
  const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
4107
4120
  if (state.status === "failed") {
4108
4121
  return;
@@ -4505,7 +4518,7 @@ var stdin_default$1u = defineComponent({
4505
4518
  "titleStyle": labelStyle.value,
4506
4519
  "valueClass": bem$1g("value"),
4507
4520
  "titleClass": [bem$1g("label", [labelAlign, {
4508
- required: props2.required
4521
+ required: showRequiredMark.value
4509
4522
  }]), props2.labelClass],
4510
4523
  "arrowDirection": props2.arrowDirection
4511
4524
  }, {
@@ -5169,7 +5182,7 @@ var stdin_default$1q = defineComponent({
5169
5182
  "label": t$i("area"),
5170
5183
  "is-link": !disableArea,
5171
5184
  "modelValue": areaText.value,
5172
- "rules": rules.value.areaCode,
5185
+ "rules": props2.showArea ? rules.value.areaCode : void 0,
5173
5186
  "placeholder": props2.areaPlaceholder || t$i("area"),
5174
5187
  "onFocus": () => onFocus("areaCode"),
5175
5188
  "onClick": () => {
@@ -12970,7 +12983,9 @@ var stdin_default$v = defineComponent({
12970
12983
  return createVNode(Field, mergeProps({
12971
12984
  "ref": fieldRef,
12972
12985
  "type": "search",
12973
- "class": bem$m("field"),
12986
+ "class": bem$m("field", {
12987
+ "with-message": fieldAttrs.errorMessage
12988
+ }),
12974
12989
  "border": false,
12975
12990
  "onBlur": onBlur,
12976
12991
  "onFocus": onFocus,
@@ -13318,7 +13333,7 @@ var stdin_default$r = defineComponent({
13318
13333
  }
13319
13334
  emit("clear");
13320
13335
  };
13321
- onMounted(() => {
13336
+ const initialize = () => {
13322
13337
  var _a, _b, _c;
13323
13338
  if (isRenderCanvas && canvasRef.value) {
13324
13339
  const canvas = canvasRef.value;
@@ -13328,6 +13343,18 @@ var stdin_default$r = defineComponent({
13328
13343
  (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
13329
13344
  setCanvasBgColor(ctx.value);
13330
13345
  }
13346
+ };
13347
+ const resize = () => {
13348
+ if (ctx.value) {
13349
+ const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
13350
+ initialize();
13351
+ ctx.value.putImageData(data, 0, 0);
13352
+ }
13353
+ };
13354
+ watch(windowWidth, resize);
13355
+ onMounted(initialize);
13356
+ useExpose({
13357
+ resize
13331
13358
  });
13332
13359
  return () => createVNode("div", {
13333
13360
  "class": bem$i()
@@ -16518,7 +16545,7 @@ const Lazyload = {
16518
16545
  });
16519
16546
  }
16520
16547
  };
16521
- const version = "4.7.2";
16548
+ const version = "4.7.3";
16522
16549
  function install(app) {
16523
16550
  const components = [
16524
16551
  ActionBar,
package/lib/vant.js CHANGED
@@ -3075,6 +3075,7 @@
3075
3075
  offsetTop: makeNumericProp(0),
3076
3076
  background: String,
3077
3077
  lazyRender: truthProp,
3078
+ showHeader: truthProp,
3078
3079
  lineWidth: numericProp,
3079
3080
  lineHeight: numericProp,
3080
3081
  beforeChange: Function,
@@ -3376,13 +3377,13 @@
3376
3377
  return () => vue.createVNode("div", {
3377
3378
  "ref": root,
3378
3379
  "class": bem$1o([props2.type])
3379
- }, [props2.sticky ? vue.createVNode(Sticky, {
3380
+ }, [props2.showHeader ? props2.sticky ? vue.createVNode(Sticky, {
3380
3381
  "container": root.value,
3381
3382
  "offsetTop": offsetTopPx.value,
3382
3383
  "onScroll": onStickyScroll
3383
3384
  }, {
3384
3385
  default: () => [renderHeader()]
3385
- }) : renderHeader(), vue.createVNode(stdin_default$1D, {
3386
+ }) : renderHeader() : null, vue.createVNode(stdin_default$1D, {
3386
3387
  "ref": contentRef,
3387
3388
  "count": children.length,
3388
3389
  "inited": state.inited,
@@ -3723,8 +3724,8 @@
3723
3724
  };
3724
3725
  const onCancel = () => emit("cancel");
3725
3726
  return () => {
3726
- var _a;
3727
- const childNodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
3727
+ var _a, _b;
3728
+ const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
3728
3729
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3729
3730
  return vue.createVNode("div", {
3730
3731
  "class": bem$1k()
@@ -4114,13 +4115,16 @@
4114
4115
  center: Boolean,
4115
4116
  isLink: Boolean,
4116
4117
  border: truthProp,
4117
- required: Boolean,
4118
4118
  iconPrefix: String,
4119
4119
  valueClass: unknownProp,
4120
4120
  labelClass: unknownProp,
4121
4121
  titleClass: unknownProp,
4122
4122
  titleStyle: null,
4123
4123
  arrowDirection: String,
4124
+ required: {
4125
+ type: [Boolean, String],
4126
+ default: null
4127
+ },
4124
4128
  clickable: {
4125
4129
  type: Boolean,
4126
4130
  default: null
@@ -4201,7 +4205,7 @@
4201
4205
  const clickable = (_a = props2.clickable) != null ? _a : isLink;
4202
4206
  const classes = {
4203
4207
  center,
4204
- required,
4208
+ required: !!required,
4205
4209
  clickable,
4206
4210
  borderless: !border
4207
4211
  };
@@ -4228,6 +4232,7 @@
4228
4232
  colon: Boolean,
4229
4233
  disabled: Boolean,
4230
4234
  readonly: Boolean,
4235
+ required: [Boolean, String],
4231
4236
  showError: Boolean,
4232
4237
  labelWidth: numericProp,
4233
4238
  labelAlign: String,
@@ -4483,12 +4488,12 @@
4483
4488
  autocorrect: String,
4484
4489
  errorMessage: String,
4485
4490
  enterkeyhint: String,
4491
+ clearTrigger: makeStringProp("focus"),
4492
+ formatTrigger: makeStringProp("onChange"),
4486
4493
  spellcheck: {
4487
4494
  type: Boolean,
4488
4495
  default: null
4489
4496
  },
4490
- clearTrigger: makeStringProp("focus"),
4491
- formatTrigger: makeStringProp("onChange"),
4492
4497
  error: {
4493
4498
  type: Boolean,
4494
4499
  default: null
@@ -4564,6 +4569,14 @@
4564
4569
  }
4565
4570
  return props2.modelValue;
4566
4571
  });
4572
+ const showRequiredMark = vue.computed(() => {
4573
+ var _a;
4574
+ const required = getProp("required");
4575
+ if (required === "auto") {
4576
+ return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
4577
+ }
4578
+ return required;
4579
+ });
4567
4580
  const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
4568
4581
  if (state.status === "failed") {
4569
4582
  return;
@@ -4966,7 +4979,7 @@
4966
4979
  "titleStyle": labelStyle.value,
4967
4980
  "valueClass": bem$1g("value"),
4968
4981
  "titleClass": [bem$1g("label", [labelAlign, {
4969
- required: props2.required
4982
+ required: showRequiredMark.value
4970
4983
  }]), props2.labelClass],
4971
4984
  "arrowDirection": props2.arrowDirection
4972
4985
  }, {
@@ -5630,7 +5643,7 @@
5630
5643
  "label": t$i("area"),
5631
5644
  "is-link": !disableArea,
5632
5645
  "modelValue": areaText.value,
5633
- "rules": rules.value.areaCode,
5646
+ "rules": props2.showArea ? rules.value.areaCode : void 0,
5634
5647
  "placeholder": props2.areaPlaceholder || t$i("area"),
5635
5648
  "onFocus": () => onFocus("areaCode"),
5636
5649
  "onClick": () => {
@@ -14211,7 +14224,9 @@
14211
14224
  return vue.createVNode(Field, vue.mergeProps({
14212
14225
  "ref": fieldRef,
14213
14226
  "type": "search",
14214
- "class": bem$m("field"),
14227
+ "class": bem$m("field", {
14228
+ "with-message": fieldAttrs.errorMessage
14229
+ }),
14215
14230
  "border": false,
14216
14231
  "onBlur": onBlur,
14217
14232
  "onFocus": onFocus,
@@ -14556,7 +14571,7 @@
14556
14571
  }
14557
14572
  emit("clear");
14558
14573
  };
14559
- vue.onMounted(() => {
14574
+ const initialize = () => {
14560
14575
  var _a, _b, _c;
14561
14576
  if (isRenderCanvas && canvasRef.value) {
14562
14577
  const canvas = canvasRef.value;
@@ -14566,6 +14581,18 @@
14566
14581
  (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
14567
14582
  setCanvasBgColor(ctx.value);
14568
14583
  }
14584
+ };
14585
+ const resize = () => {
14586
+ if (ctx.value) {
14587
+ const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
14588
+ initialize();
14589
+ ctx.value.putImageData(data, 0, 0);
14590
+ }
14591
+ };
14592
+ vue.watch(windowWidth, resize);
14593
+ vue.onMounted(initialize);
14594
+ useExpose({
14595
+ resize
14569
14596
  });
14570
14597
  return () => vue.createVNode("div", {
14571
14598
  "class": bem$i()
@@ -17730,7 +17757,7 @@
17730
17757
  });
17731
17758
  }
17732
17759
  };
17733
- const version = "4.7.2";
17760
+ const version = "4.7.3";
17734
17761
  function install(app) {
17735
17762
  const components = [
17736
17763
  ActionBar,