vant 4.6.5 → 4.6.7

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 (132) hide show
  1. package/README.md +1 -1
  2. package/es/action-sheet/ActionSheet.d.ts +1 -1
  3. package/es/action-sheet/index.d.ts +1 -1
  4. package/es/address-edit/AddressEditDetail.d.ts +1 -1
  5. package/es/address-list/AddressList.d.ts +1 -1
  6. package/es/address-list/index.d.ts +1 -1
  7. package/es/button/Button.d.ts +2 -2
  8. package/es/button/index.d.ts +2 -2
  9. package/es/calendar/Calendar.d.ts +1 -1
  10. package/es/calendar/index.d.ts +1 -1
  11. package/es/cell/Cell.d.ts +1 -1
  12. package/es/cell/index.d.ts +1 -1
  13. package/es/cell-group/CellGroup.d.ts +1 -1
  14. package/es/cell-group/index.d.ts +1 -1
  15. package/es/checkbox/Checkbox.d.ts +13 -0
  16. package/es/checkbox/Checkbox.mjs +11 -2
  17. package/es/checkbox/Checker.d.ts +9 -0
  18. package/es/checkbox/Checker.mjs +10 -4
  19. package/es/checkbox/index.css +1 -1
  20. package/es/checkbox/index.d.ts +9 -0
  21. package/es/collapse-item/CollapseItem.d.ts +1 -1
  22. package/es/collapse-item/index.d.ts +1 -1
  23. package/es/config-provider/ConfigProvider.d.ts +14 -0
  24. package/es/config-provider/ConfigProvider.mjs +30 -1
  25. package/es/config-provider/index.d.ts +10 -1
  26. package/es/contact-list/ContactList.d.ts +1 -1
  27. package/es/contact-list/index.d.ts +1 -1
  28. package/es/divider/Divider.d.ts +1 -1
  29. package/es/divider/index.d.ts +1 -1
  30. package/es/dropdown-item/DropdownItem.mjs +1 -1
  31. package/es/dropdown-item/types.d.ts +2 -1
  32. package/es/field/Field.d.ts +1 -1
  33. package/es/field/index.d.ts +1 -1
  34. package/es/floating-bubble/FloatingBubble.mjs +5 -1
  35. package/es/grid/Grid.d.ts +1 -1
  36. package/es/grid/index.d.ts +1 -1
  37. package/es/image/Image.d.ts +1 -1
  38. package/es/image/index.d.ts +1 -1
  39. package/es/index.d.ts +1 -1
  40. package/es/index.mjs +1 -1
  41. package/es/number-keyboard/NumberKeyboard.d.ts +2 -2
  42. package/es/number-keyboard/index.d.ts +2 -2
  43. package/es/popup/Popup.d.ts +1 -1
  44. package/es/popup/index.d.ts +1 -1
  45. package/es/share-sheet/ShareSheet.d.ts +1 -1
  46. package/es/share-sheet/index.d.ts +1 -1
  47. package/es/signature/Signature.d.ts +1 -1
  48. package/es/signature/index.d.ts +1 -1
  49. package/es/skeleton/Skeleton.d.ts +1 -1
  50. package/es/skeleton/index.d.ts +1 -1
  51. package/es/slider/Slider.d.ts +1 -1
  52. package/es/slider/index.d.ts +1 -1
  53. package/es/space/Space.d.ts +4 -4
  54. package/es/space/index.d.ts +3 -3
  55. package/es/stepper/Stepper.d.ts +2 -2
  56. package/es/stepper/index.d.ts +2 -2
  57. package/es/tabs/Tabs.d.ts +1 -1
  58. package/es/tabs/index.d.ts +1 -1
  59. package/es/tag/Tag.d.ts +1 -1
  60. package/es/tag/index.d.ts +1 -1
  61. package/es/uploader/Uploader.d.ts +1 -1
  62. package/es/uploader/index.d.ts +1 -1
  63. package/es/vue-tsx-shim.d.ts +1 -0
  64. package/lib/action-sheet/ActionSheet.d.ts +1 -1
  65. package/lib/action-sheet/index.d.ts +1 -1
  66. package/lib/address-edit/AddressEditDetail.d.ts +1 -1
  67. package/lib/address-list/AddressList.d.ts +1 -1
  68. package/lib/address-list/index.d.ts +1 -1
  69. package/lib/button/Button.d.ts +2 -2
  70. package/lib/button/index.d.ts +2 -2
  71. package/lib/calendar/Calendar.d.ts +1 -1
  72. package/lib/calendar/index.d.ts +1 -1
  73. package/lib/cell/Cell.d.ts +1 -1
  74. package/lib/cell/index.d.ts +1 -1
  75. package/lib/cell-group/CellGroup.d.ts +1 -1
  76. package/lib/cell-group/index.d.ts +1 -1
  77. package/lib/checkbox/Checkbox.d.ts +13 -0
  78. package/lib/checkbox/Checkbox.js +11 -2
  79. package/lib/checkbox/Checker.d.ts +9 -0
  80. package/lib/checkbox/Checker.js +10 -4
  81. package/lib/checkbox/index.css +1 -1
  82. package/lib/checkbox/index.d.ts +9 -0
  83. package/lib/collapse-item/CollapseItem.d.ts +1 -1
  84. package/lib/collapse-item/index.d.ts +1 -1
  85. package/lib/config-provider/ConfigProvider.d.ts +14 -0
  86. package/lib/config-provider/ConfigProvider.js +30 -1
  87. package/lib/config-provider/index.d.ts +10 -1
  88. package/lib/contact-list/ContactList.d.ts +1 -1
  89. package/lib/contact-list/index.d.ts +1 -1
  90. package/lib/divider/Divider.d.ts +1 -1
  91. package/lib/divider/index.d.ts +1 -1
  92. package/lib/dropdown-item/DropdownItem.js +1 -1
  93. package/lib/dropdown-item/types.d.ts +2 -1
  94. package/lib/field/Field.d.ts +1 -1
  95. package/lib/field/index.d.ts +1 -1
  96. package/lib/floating-bubble/FloatingBubble.js +5 -1
  97. package/lib/grid/Grid.d.ts +1 -1
  98. package/lib/grid/index.d.ts +1 -1
  99. package/lib/image/Image.d.ts +1 -1
  100. package/lib/image/index.d.ts +1 -1
  101. package/lib/index.css +1 -1
  102. package/lib/index.d.ts +1 -1
  103. package/lib/index.js +1 -1
  104. package/lib/number-keyboard/NumberKeyboard.d.ts +2 -2
  105. package/lib/number-keyboard/index.d.ts +2 -2
  106. package/lib/popup/Popup.d.ts +1 -1
  107. package/lib/popup/index.d.ts +1 -1
  108. package/lib/share-sheet/ShareSheet.d.ts +1 -1
  109. package/lib/share-sheet/index.d.ts +1 -1
  110. package/lib/signature/Signature.d.ts +1 -1
  111. package/lib/signature/index.d.ts +1 -1
  112. package/lib/skeleton/Skeleton.d.ts +1 -1
  113. package/lib/skeleton/index.d.ts +1 -1
  114. package/lib/slider/Slider.d.ts +1 -1
  115. package/lib/slider/index.d.ts +1 -1
  116. package/lib/space/Space.d.ts +4 -4
  117. package/lib/space/index.d.ts +3 -3
  118. package/lib/stepper/Stepper.d.ts +2 -2
  119. package/lib/stepper/index.d.ts +2 -2
  120. package/lib/tabs/Tabs.d.ts +1 -1
  121. package/lib/tabs/index.d.ts +1 -1
  122. package/lib/tag/Tag.d.ts +1 -1
  123. package/lib/tag/index.d.ts +1 -1
  124. package/lib/uploader/Uploader.d.ts +1 -1
  125. package/lib/uploader/index.d.ts +1 -1
  126. package/lib/vant.cjs.js +58 -10
  127. package/lib/vant.es.js +58 -10
  128. package/lib/vant.js +58 -10
  129. package/lib/vant.min.js +1 -1
  130. package/lib/vue-tsx-shim.d.ts +1 -0
  131. package/lib/web-types.json +1 -1
  132. package/package.json +17 -9
package/lib/vant.es.js CHANGED
@@ -627,6 +627,7 @@ const configProviderProps = {
627
627
  themeVars: Object,
628
628
  themeVarsDark: Object,
629
629
  themeVarsLight: Object,
630
+ themeVarsScope: makeStringProp("local"),
630
631
  iconPrefix: String
631
632
  };
632
633
  function mapThemeVarsToCSSVars(themeVars) {
@@ -636,6 +637,18 @@ function mapThemeVarsToCSSVars(themeVars) {
636
637
  });
637
638
  return cssVars;
638
639
  }
640
+ function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
641
+ Object.keys(newStyle).forEach((key) => {
642
+ if (newStyle[key] !== oldStyle[key]) {
643
+ document.documentElement.style.setProperty(key, newStyle[key]);
644
+ }
645
+ });
646
+ Object.keys(oldStyle).forEach((key) => {
647
+ if (!newStyle[key]) {
648
+ document.documentElement.style.removeProperty(key);
649
+ }
650
+ });
651
+ }
639
652
  var stdin_default$1R = defineComponent({
640
653
  name: name$1H,
641
654
  props: configProviderProps,
@@ -661,6 +674,22 @@ var stdin_default$1R = defineComponent({
661
674
  onActivated(addTheme);
662
675
  onDeactivated(removeTheme);
663
676
  onBeforeUnmount(removeTheme);
677
+ watch(style, (newStyle, oldStyle) => {
678
+ if (props2.themeVarsScope === "global") {
679
+ syncThemeVarsOnRoot(newStyle, oldStyle);
680
+ }
681
+ });
682
+ watch(() => props2.themeVarsScope, (newScope, oldScope) => {
683
+ if (oldScope === "global") {
684
+ syncThemeVarsOnRoot({}, style.value);
685
+ }
686
+ if (newScope === "global") {
687
+ syncThemeVarsOnRoot(style.value, {});
688
+ }
689
+ });
690
+ if (props2.themeVarsScope === "global") {
691
+ syncThemeVarsOnRoot(style.value, {});
692
+ }
664
693
  }
665
694
  provide(CONFIG_PROVIDER_KEY, props2);
666
695
  watchEffect(() => {
@@ -670,7 +699,7 @@ var stdin_default$1R = defineComponent({
670
699
  });
671
700
  return () => createVNode(props2.tag, {
672
701
  "class": bem$1C(),
673
- "style": style.value
702
+ "style": props2.themeVarsScope === "local" ? style.value : void 0
674
703
  }, {
675
704
  default: () => {
676
705
  var _a;
@@ -5313,7 +5342,11 @@ var stdin_default$1n = defineComponent({
5313
5342
  shape: String,
5314
5343
  parent: Object,
5315
5344
  checked: Boolean,
5316
- bindGroup: truthProp
5345
+ bindGroup: truthProp,
5346
+ indeterminate: {
5347
+ type: Boolean,
5348
+ default: null
5349
+ }
5317
5350
  }),
5318
5351
  emits: ["click", "toggle"],
5319
5352
  setup(props2, {
@@ -5367,14 +5400,16 @@ var stdin_default$1n = defineComponent({
5367
5400
  var _a, _b;
5368
5401
  const {
5369
5402
  bem: bem2,
5370
- checked
5403
+ checked,
5404
+ indeterminate
5371
5405
  } = props2;
5372
5406
  const iconSize = props2.iconSize || getParentProp("iconSize");
5373
5407
  return createVNode("div", {
5374
5408
  "ref": iconRef,
5375
5409
  "class": bem2("icon", [shape.value, {
5376
5410
  disabled: disabled.value,
5377
- checked
5411
+ checked,
5412
+ indeterminate
5378
5413
  }]),
5379
5414
  "style": shape.value !== "dot" ? {
5380
5415
  fontSize: addUnit(iconSize)
@@ -5387,7 +5422,7 @@ var stdin_default$1n = defineComponent({
5387
5422
  checked,
5388
5423
  disabled: disabled.value
5389
5424
  }) : shape.value !== "dot" ? createVNode(Icon, {
5390
- "name": "success",
5425
+ "name": indeterminate ? "minus" : "success",
5391
5426
  "style": iconStyle.value
5392
5427
  }, null) : createVNode("div", {
5393
5428
  "class": bem2("icon--dot__icon"),
@@ -7483,7 +7518,11 @@ var stdin_default$19 = defineComponent({
7483
7518
  const [name$$, bem$_] = createNamespace("checkbox");
7484
7519
  const checkboxProps = extend({}, checkerProps, {
7485
7520
  shape: String,
7486
- bindGroup: truthProp
7521
+ bindGroup: truthProp,
7522
+ indeterminate: {
7523
+ type: Boolean,
7524
+ default: null
7525
+ }
7487
7526
  });
7488
7527
  var stdin_default$18 = defineComponent({
7489
7528
  name: name$$,
@@ -7535,8 +7574,13 @@ var stdin_default$18 = defineComponent({
7535
7574
  } else {
7536
7575
  emit("update:modelValue", newValue);
7537
7576
  }
7577
+ if (props2.indeterminate !== null)
7578
+ emit("change", newValue);
7538
7579
  };
7539
- watch(() => props2.modelValue, (value) => emit("change", value));
7580
+ watch(() => props2.modelValue, (value) => {
7581
+ if (props2.indeterminate === null)
7582
+ emit("change", value);
7583
+ });
7540
7584
  useExpose({
7541
7585
  toggle,
7542
7586
  props: props2,
@@ -9637,7 +9681,7 @@ var stdin_default$S = defineComponent({
9637
9681
  };
9638
9682
  return createVNode(Cell, {
9639
9683
  "role": "menuitem",
9640
- "key": option.value,
9684
+ "key": String(option.value),
9641
9685
  "icon": option.icon,
9642
9686
  "title": option.text,
9643
9687
  "class": bem$J("option", {
@@ -9772,6 +9816,8 @@ var stdin_default$R = defineComponent({
9772
9816
  return style;
9773
9817
  });
9774
9818
  const updateState = () => {
9819
+ if (!show.value)
9820
+ return;
9775
9821
  const {
9776
9822
  width,
9777
9823
  height
@@ -9847,6 +9893,8 @@ var stdin_default$R = defineComponent({
9847
9893
  const onClick = (e) => {
9848
9894
  if (touch.isTap.value)
9849
9895
  emit("click", e);
9896
+ else
9897
+ e.stopPropagation();
9850
9898
  };
9851
9899
  onMounted(() => {
9852
9900
  updateState();
@@ -9871,7 +9919,7 @@ var stdin_default$R = defineComponent({
9871
9919
  "onTouchstartPassive": onTouchStart,
9872
9920
  "onTouchend": onTouchEnd,
9873
9921
  "onTouchcancel": onTouchEnd,
9874
- "onClick": onClick,
9922
+ "onClickCapture": onClick,
9875
9923
  "style": rootStyle.value
9876
9924
  }, attrs), [slots.default ? slots.default() : createVNode(stdin_default$1P, {
9877
9925
  "name": props2.icon,
@@ -16407,7 +16455,7 @@ const Lazyload = {
16407
16455
  });
16408
16456
  }
16409
16457
  };
16410
- const version = "4.6.5";
16458
+ const version = "4.6.7";
16411
16459
  function install(app) {
16412
16460
  const components = [
16413
16461
  ActionBar,
package/lib/vant.js CHANGED
@@ -1017,6 +1017,7 @@
1017
1017
  themeVars: Object,
1018
1018
  themeVarsDark: Object,
1019
1019
  themeVarsLight: Object,
1020
+ themeVarsScope: makeStringProp("local"),
1020
1021
  iconPrefix: String
1021
1022
  };
1022
1023
  function mapThemeVarsToCSSVars(themeVars) {
@@ -1026,6 +1027,18 @@
1026
1027
  });
1027
1028
  return cssVars;
1028
1029
  }
1030
+ function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
1031
+ Object.keys(newStyle).forEach((key) => {
1032
+ if (newStyle[key] !== oldStyle[key]) {
1033
+ document.documentElement.style.setProperty(key, newStyle[key]);
1034
+ }
1035
+ });
1036
+ Object.keys(oldStyle).forEach((key) => {
1037
+ if (!newStyle[key]) {
1038
+ document.documentElement.style.removeProperty(key);
1039
+ }
1040
+ });
1041
+ }
1029
1042
  var stdin_default$1R = vue.defineComponent({
1030
1043
  name: name$1H,
1031
1044
  props: configProviderProps,
@@ -1051,6 +1064,22 @@
1051
1064
  vue.onActivated(addTheme);
1052
1065
  vue.onDeactivated(removeTheme);
1053
1066
  vue.onBeforeUnmount(removeTheme);
1067
+ vue.watch(style, (newStyle, oldStyle) => {
1068
+ if (props2.themeVarsScope === "global") {
1069
+ syncThemeVarsOnRoot(newStyle, oldStyle);
1070
+ }
1071
+ });
1072
+ vue.watch(() => props2.themeVarsScope, (newScope, oldScope) => {
1073
+ if (oldScope === "global") {
1074
+ syncThemeVarsOnRoot({}, style.value);
1075
+ }
1076
+ if (newScope === "global") {
1077
+ syncThemeVarsOnRoot(style.value, {});
1078
+ }
1079
+ });
1080
+ if (props2.themeVarsScope === "global") {
1081
+ syncThemeVarsOnRoot(style.value, {});
1082
+ }
1054
1083
  }
1055
1084
  vue.provide(CONFIG_PROVIDER_KEY, props2);
1056
1085
  vue.watchEffect(() => {
@@ -1060,7 +1089,7 @@
1060
1089
  });
1061
1090
  return () => vue.createVNode(props2.tag, {
1062
1091
  "class": bem$1C(),
1063
- "style": style.value
1092
+ "style": props2.themeVarsScope === "local" ? style.value : void 0
1064
1093
  }, {
1065
1094
  default: () => {
1066
1095
  var _a;
@@ -5774,7 +5803,11 @@
5774
5803
  shape: String,
5775
5804
  parent: Object,
5776
5805
  checked: Boolean,
5777
- bindGroup: truthProp
5806
+ bindGroup: truthProp,
5807
+ indeterminate: {
5808
+ type: Boolean,
5809
+ default: null
5810
+ }
5778
5811
  }),
5779
5812
  emits: ["click", "toggle"],
5780
5813
  setup(props2, {
@@ -5828,14 +5861,16 @@
5828
5861
  var _a, _b;
5829
5862
  const {
5830
5863
  bem: bem2,
5831
- checked
5864
+ checked,
5865
+ indeterminate
5832
5866
  } = props2;
5833
5867
  const iconSize = props2.iconSize || getParentProp("iconSize");
5834
5868
  return vue.createVNode("div", {
5835
5869
  "ref": iconRef,
5836
5870
  "class": bem2("icon", [shape.value, {
5837
5871
  disabled: disabled.value,
5838
- checked
5872
+ checked,
5873
+ indeterminate
5839
5874
  }]),
5840
5875
  "style": shape.value !== "dot" ? {
5841
5876
  fontSize: addUnit(iconSize)
@@ -5848,7 +5883,7 @@
5848
5883
  checked,
5849
5884
  disabled: disabled.value
5850
5885
  }) : shape.value !== "dot" ? vue.createVNode(Icon, {
5851
- "name": "success",
5886
+ "name": indeterminate ? "minus" : "success",
5852
5887
  "style": iconStyle.value
5853
5888
  }, null) : vue.createVNode("div", {
5854
5889
  "class": bem2("icon--dot__icon"),
@@ -7941,7 +7976,11 @@
7941
7976
  const [name$$, bem$_] = createNamespace("checkbox");
7942
7977
  const checkboxProps = extend({}, checkerProps, {
7943
7978
  shape: String,
7944
- bindGroup: truthProp
7979
+ bindGroup: truthProp,
7980
+ indeterminate: {
7981
+ type: Boolean,
7982
+ default: null
7983
+ }
7945
7984
  });
7946
7985
  var stdin_default$18 = vue.defineComponent({
7947
7986
  name: name$$,
@@ -7993,8 +8032,13 @@
7993
8032
  } else {
7994
8033
  emit("update:modelValue", newValue);
7995
8034
  }
8035
+ if (props2.indeterminate !== null)
8036
+ emit("change", newValue);
7996
8037
  };
7997
- vue.watch(() => props2.modelValue, (value) => emit("change", value));
8038
+ vue.watch(() => props2.modelValue, (value) => {
8039
+ if (props2.indeterminate === null)
8040
+ emit("change", value);
8041
+ });
7998
8042
  useExpose({
7999
8043
  toggle,
8000
8044
  props: props2,
@@ -10072,7 +10116,7 @@
10072
10116
  };
10073
10117
  return vue.createVNode(Cell, {
10074
10118
  "role": "menuitem",
10075
- "key": option.value,
10119
+ "key": String(option.value),
10076
10120
  "icon": option.icon,
10077
10121
  "title": option.text,
10078
10122
  "class": bem$J("option", {
@@ -10207,6 +10251,8 @@
10207
10251
  return style;
10208
10252
  });
10209
10253
  const updateState = () => {
10254
+ if (!show.value)
10255
+ return;
10210
10256
  const {
10211
10257
  width: width2,
10212
10258
  height: height2
@@ -10282,6 +10328,8 @@
10282
10328
  const onClick = (e) => {
10283
10329
  if (touch.isTap.value)
10284
10330
  emit("click", e);
10331
+ else
10332
+ e.stopPropagation();
10285
10333
  };
10286
10334
  vue.onMounted(() => {
10287
10335
  updateState();
@@ -10306,7 +10354,7 @@
10306
10354
  "onTouchstartPassive": onTouchStart,
10307
10355
  "onTouchend": onTouchEnd,
10308
10356
  "onTouchcancel": onTouchEnd,
10309
- "onClick": onClick,
10357
+ "onClickCapture": onClick,
10310
10358
  "style": rootStyle.value
10311
10359
  }, attrs), [slots.default ? slots.default() : vue.createVNode(stdin_default$1P, {
10312
10360
  "name": props2.icon,
@@ -17619,7 +17667,7 @@
17619
17667
  });
17620
17668
  }
17621
17669
  };
17622
- const version = "4.6.5";
17670
+ const version = "4.6.7";
17623
17671
  function install(app) {
17624
17672
  const components = [
17625
17673
  ActionBar,