vant 3.5.0 → 3.5.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 (194) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +13 -13
  3. package/changelog.generated.md +67 -0
  4. package/es/action-bar/ActionBar.d.ts +4 -0
  5. package/es/action-bar/ActionBar.mjs +13 -2
  6. package/es/action-bar/index.d.ts +3 -0
  7. package/es/button/index.less +1 -1
  8. package/es/calendar/Calendar.mjs +6 -1
  9. package/es/calendar/types.d.ts +1 -0
  10. package/es/cell/Cell.d.ts +1 -1
  11. package/es/cell/index.d.ts +1 -1
  12. package/es/collapse/Collapse.d.ts +8 -1
  13. package/es/collapse/Collapse.mjs +28 -1
  14. package/es/collapse/index.d.ts +1 -1
  15. package/es/collapse-item/CollapseItem.d.ts +1 -1
  16. package/es/collapse-item/CollapseItem.mjs +3 -1
  17. package/es/collapse-item/index.d.ts +1 -1
  18. package/es/collapse-item/index.less +1 -1
  19. package/es/composables/use-height.d.ts +1 -1
  20. package/es/composables/use-height.mjs +6 -2
  21. package/es/composables/use-placeholder.mjs +1 -1
  22. package/es/dialog/Dialog.d.ts +1 -1
  23. package/es/field/Field.d.ts +4 -2
  24. package/es/field/Field.mjs +7 -1
  25. package/es/field/index.d.ts +4 -2
  26. package/es/field/index.less +1 -1
  27. package/es/grid-item/index.less +1 -1
  28. package/es/index.d.ts +1 -1
  29. package/es/index.mjs +1 -1
  30. package/es/locale/index.d.ts +1 -1
  31. package/es/popover/Popover.mjs +17 -18
  32. package/es/popup/Popup.mjs +1 -1
  33. package/es/pull-refresh/PullRefresh.d.ts +2 -1
  34. package/es/pull-refresh/PullRefresh.mjs +5 -1
  35. package/es/pull-refresh/index.d.ts +2 -1
  36. package/es/sidebar-item/index.less +1 -1
  37. package/es/submit-bar/SubmitBar.d.ts +4 -0
  38. package/es/submit-bar/SubmitBar.mjs +13 -2
  39. package/es/submit-bar/index.d.ts +3 -0
  40. package/es/swipe/index.less +1 -1
  41. package/es/switch/index.less +1 -1
  42. package/es/toast/function-call.d.ts +5 -6
  43. package/es/toast/index.less +1 -1
  44. package/es/toast/types.d.ts +10 -1
  45. package/es/uploader/Uploader.d.ts +3 -3
  46. package/es/uploader/Uploader.mjs +1 -1
  47. package/es/uploader/index.d.ts +2 -2
  48. package/es/utils/basic.d.ts +3 -3
  49. package/es/utils/create.d.ts +1 -1
  50. package/lib/.DS_Store +0 -0
  51. package/lib/action-bar/.DS_Store +0 -0
  52. package/lib/action-bar/ActionBar.d.ts +4 -0
  53. package/lib/action-bar/ActionBar.js +12 -1
  54. package/lib/action-bar/index.d.ts +3 -0
  55. package/lib/action-bar-button/.DS_Store +0 -0
  56. package/lib/action-bar-icon/.DS_Store +0 -0
  57. package/lib/action-sheet/.DS_Store +0 -0
  58. package/lib/address-edit/.DS_Store +0 -0
  59. package/lib/address-list/.DS_Store +0 -0
  60. package/lib/area/.DS_Store +0 -0
  61. package/lib/badge/.DS_Store +0 -0
  62. package/lib/button/.DS_Store +0 -0
  63. package/lib/button/index.less +1 -1
  64. package/lib/calendar/.DS_Store +0 -0
  65. package/lib/calendar/Calendar.js +6 -1
  66. package/lib/calendar/types.d.ts +1 -0
  67. package/lib/card/.DS_Store +0 -0
  68. package/lib/cascader/.DS_Store +0 -0
  69. package/lib/cell/.DS_Store +0 -0
  70. package/lib/cell/Cell.d.ts +1 -1
  71. package/lib/cell/index.d.ts +1 -1
  72. package/lib/cell-group/.DS_Store +0 -0
  73. package/lib/checkbox/.DS_Store +0 -0
  74. package/lib/checkbox-group/.DS_Store +0 -0
  75. package/lib/circle/.DS_Store +0 -0
  76. package/lib/col/.DS_Store +0 -0
  77. package/lib/collapse/.DS_Store +0 -0
  78. package/lib/collapse/Collapse.d.ts +8 -1
  79. package/lib/collapse/Collapse.js +28 -1
  80. package/lib/collapse/index.d.ts +1 -1
  81. package/lib/collapse-item/.DS_Store +0 -0
  82. package/lib/collapse-item/CollapseItem.d.ts +1 -1
  83. package/lib/collapse-item/CollapseItem.js +3 -1
  84. package/lib/collapse-item/index.d.ts +1 -1
  85. package/lib/collapse-item/index.less +1 -1
  86. package/lib/composables/use-height.d.ts +1 -1
  87. package/lib/composables/use-height.js +6 -2
  88. package/lib/composables/use-placeholder.js +1 -1
  89. package/lib/config-provider/.DS_Store +0 -0
  90. package/lib/contact-card/.DS_Store +0 -0
  91. package/lib/contact-edit/.DS_Store +0 -0
  92. package/lib/contact-list/.DS_Store +0 -0
  93. package/lib/count-down/.DS_Store +0 -0
  94. package/lib/coupon/.DS_Store +0 -0
  95. package/lib/coupon-cell/.DS_Store +0 -0
  96. package/lib/coupon-list/.DS_Store +0 -0
  97. package/lib/datetime-picker/.DS_Store +0 -0
  98. package/lib/dialog/.DS_Store +0 -0
  99. package/lib/dialog/Dialog.d.ts +1 -1
  100. package/lib/divider/.DS_Store +0 -0
  101. package/lib/dropdown-item/.DS_Store +0 -0
  102. package/lib/dropdown-menu/.DS_Store +0 -0
  103. package/lib/empty/.DS_Store +0 -0
  104. package/lib/field/.DS_Store +0 -0
  105. package/lib/field/Field.d.ts +4 -2
  106. package/lib/field/Field.js +7 -1
  107. package/lib/field/index.d.ts +4 -2
  108. package/lib/field/index.less +1 -1
  109. package/lib/form/.DS_Store +0 -0
  110. package/lib/grid/.DS_Store +0 -0
  111. package/lib/grid-item/.DS_Store +0 -0
  112. package/lib/grid-item/index.less +1 -1
  113. package/lib/icon/.DS_Store +0 -0
  114. package/lib/image/.DS_Store +0 -0
  115. package/lib/image-preview/.DS_Store +0 -0
  116. package/lib/index-anchor/.DS_Store +0 -0
  117. package/lib/index-bar/.DS_Store +0 -0
  118. package/lib/index.d.ts +1 -1
  119. package/lib/index.js +1 -1
  120. package/lib/lazyload/.DS_Store +0 -0
  121. package/lib/list/.DS_Store +0 -0
  122. package/lib/loading/.DS_Store +0 -0
  123. package/lib/locale/.DS_Store +0 -0
  124. package/lib/locale/index.d.ts +1 -1
  125. package/lib/nav-bar/.DS_Store +0 -0
  126. package/lib/notice-bar/.DS_Store +0 -0
  127. package/lib/notify/.DS_Store +0 -0
  128. package/lib/number-keyboard/.DS_Store +0 -0
  129. package/lib/overlay/.DS_Store +0 -0
  130. package/lib/pagination/.DS_Store +0 -0
  131. package/lib/password-input/.DS_Store +0 -0
  132. package/lib/picker/.DS_Store +0 -0
  133. package/lib/popover/.DS_Store +0 -0
  134. package/lib/popover/Popover.js +17 -18
  135. package/lib/popup/.DS_Store +0 -0
  136. package/lib/popup/Popup.js +1 -1
  137. package/lib/progress/.DS_Store +0 -0
  138. package/lib/pull-refresh/.DS_Store +0 -0
  139. package/lib/pull-refresh/PullRefresh.d.ts +2 -1
  140. package/lib/pull-refresh/PullRefresh.js +5 -1
  141. package/lib/pull-refresh/index.d.ts +2 -1
  142. package/lib/radio/.DS_Store +0 -0
  143. package/lib/radio-group/.DS_Store +0 -0
  144. package/lib/rate/.DS_Store +0 -0
  145. package/lib/row/.DS_Store +0 -0
  146. package/lib/search/.DS_Store +0 -0
  147. package/lib/share-sheet/.DS_Store +0 -0
  148. package/lib/sidebar/.DS_Store +0 -0
  149. package/lib/sidebar-item/.DS_Store +0 -0
  150. package/lib/sidebar-item/index.less +1 -1
  151. package/lib/skeleton/.DS_Store +0 -0
  152. package/lib/slider/.DS_Store +0 -0
  153. package/lib/step/.DS_Store +0 -0
  154. package/lib/stepper/.DS_Store +0 -0
  155. package/lib/steps/.DS_Store +0 -0
  156. package/lib/sticky/.DS_Store +0 -0
  157. package/lib/submit-bar/.DS_Store +0 -0
  158. package/lib/submit-bar/SubmitBar.d.ts +4 -0
  159. package/lib/submit-bar/SubmitBar.js +12 -1
  160. package/lib/submit-bar/index.d.ts +3 -0
  161. package/lib/swipe/.DS_Store +0 -0
  162. package/lib/swipe/index.less +1 -1
  163. package/lib/swipe-cell/.DS_Store +0 -0
  164. package/lib/swipe-item/.DS_Store +0 -0
  165. package/lib/switch/.DS_Store +0 -0
  166. package/lib/switch/index.less +1 -1
  167. package/lib/tab/.DS_Store +0 -0
  168. package/lib/tabbar/.DS_Store +0 -0
  169. package/lib/tabbar-item/.DS_Store +0 -0
  170. package/lib/tabs/.DS_Store +0 -0
  171. package/lib/tag/.DS_Store +0 -0
  172. package/lib/toast/.DS_Store +0 -0
  173. package/lib/toast/function-call.d.ts +5 -6
  174. package/lib/toast/index.less +1 -1
  175. package/lib/toast/types.d.ts +10 -1
  176. package/lib/tree-select/.DS_Store +0 -0
  177. package/lib/uploader/.DS_Store +0 -0
  178. package/lib/uploader/Uploader.d.ts +3 -3
  179. package/lib/uploader/Uploader.js +1 -1
  180. package/lib/uploader/index.d.ts +2 -2
  181. package/lib/utils/basic.d.ts +3 -3
  182. package/lib/utils/create.d.ts +1 -1
  183. package/lib/vant.cjs.js +191 -52
  184. package/lib/vant.es.js +280 -51
  185. package/lib/vant.js +189 -50
  186. package/lib/vant.min.js +1 -1
  187. package/{vetur → lib}/web-types.json +1652 -1609
  188. package/package.json +9 -14
  189. package/lib/ssr.js +0 -7
  190. package/lib/ssr.mjs +0 -1
  191. package/lib/vant.cjs.min.js +0 -1
  192. package/lib/vant.es.min.js +0 -14660
  193. package/vetur/attributes.json +0 -3474
  194. package/vetur/tags.json +0 -1202
package/lib/vant.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, useToggle, raf, useScrollParent, usePageVisibility, doubleRaf, cancelRaf, useCountDown, useClickAway, inBrowser as inBrowser$1 } from "@vant/use";
2
- import { unref, ref, reactive, defineComponent, createVNode, getCurrentInstance, computed, provide, inject, mergeProps, onDeactivated, onBeforeUnmount, watch, Transition, withDirectives, vShow, nextTick, onMounted, onActivated, Teleport, Fragment, createTextVNode, createApp, onUnmounted, onBeforeUpdate, resolveDirective, withKeys, onUpdated, watchEffect, h } from "vue";
3
- import { createPopper, offsetModifier } from "@vant/popperjs";
2
+ import { unref, ref, reactive, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, provide, inject, mergeProps, onDeactivated, onBeforeUnmount, watch, Transition, withDirectives, vShow, onActivated, Teleport, Fragment, createTextVNode, createApp, onUnmounted, onBeforeUpdate, resolveDirective, withKeys, onUpdated, watchEffect, h } from "vue";
3
+ import { offsetModifier, createPopper } from "@vant/popperjs";
4
4
  function noop() {
5
5
  }
6
6
  const extend = Object.assign;
@@ -393,9 +393,34 @@ function withInstall(options) {
393
393
  };
394
394
  return options;
395
395
  }
396
+ const useHeight = (element, withSafeArea) => {
397
+ const height = ref();
398
+ const setHeight = () => {
399
+ height.value = useRect(element).height;
400
+ };
401
+ onMounted(() => {
402
+ nextTick(setHeight);
403
+ if (withSafeArea) {
404
+ for (let i = 1; i <= 3; i++) {
405
+ setTimeout(setHeight, 100 * i);
406
+ }
407
+ }
408
+ });
409
+ return height;
410
+ };
411
+ function usePlaceholder(contentRef, bem2) {
412
+ const height = useHeight(contentRef, true);
413
+ return (renderContent) => createVNode("div", {
414
+ "class": bem2("placeholder"),
415
+ "style": {
416
+ height: height.value ? `${height.value}px` : void 0
417
+ }
418
+ }, [renderContent()]);
419
+ }
396
420
  const [name$1u, bem$1q] = createNamespace("action-bar");
397
421
  const ACTION_BAR_KEY = Symbol(name$1u);
398
422
  const actionBarProps = {
423
+ placeholder: Boolean,
399
424
  safeAreaInsetBottom: truthProp
400
425
  };
401
426
  var stdin_default$1B = defineComponent({
@@ -404,18 +429,27 @@ var stdin_default$1B = defineComponent({
404
429
  setup(props, {
405
430
  slots
406
431
  }) {
432
+ const root = ref();
433
+ const renderPlaceholder = usePlaceholder(root, bem$1q);
407
434
  const {
408
435
  linkChildren
409
436
  } = useChildren(ACTION_BAR_KEY);
410
437
  linkChildren();
411
- return () => {
438
+ const renderActionBar = () => {
412
439
  var _a;
413
440
  return createVNode("div", {
441
+ "ref": root,
414
442
  "class": [bem$1q(), {
415
443
  "van-safe-area-bottom": props.safeAreaInsetBottom
416
444
  }]
417
445
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
418
446
  };
447
+ return () => {
448
+ if (props.placeholder) {
449
+ return renderPlaceholder(renderActionBar);
450
+ }
451
+ return renderActionBar();
452
+ };
419
453
  }
420
454
  });
421
455
  const ActionBar = withInstall(stdin_default$1B);
@@ -1299,7 +1333,7 @@ var stdin_default$1s = defineComponent({
1299
1333
  }
1300
1334
  });
1301
1335
  onDeactivated(() => {
1302
- if (props.show) {
1336
+ if (props.show && props.teleport) {
1303
1337
  close();
1304
1338
  shouldReopen = true;
1305
1339
  }
@@ -1713,6 +1747,14 @@ var stdin_default$1p = defineComponent({
1713
1747
  emit,
1714
1748
  slots
1715
1749
  }) {
1750
+ if (process.env.NODE_ENV !== "production") {
1751
+ if (slots.default) {
1752
+ console.warn('[Vant] Picker: "default" slot is deprecated, please use "toolbar" slot instead.');
1753
+ }
1754
+ if (props.valueKey) {
1755
+ console.warn('[Vant] Picker: "valueKey" prop is deprecated, please use "columnsFieldNames" prop instead.');
1756
+ }
1757
+ }
1716
1758
  const hasOptions = ref(false);
1717
1759
  const formattedColumns = ref([]);
1718
1760
  const columnsFieldNames = computed(() => {
@@ -2563,6 +2605,9 @@ let current = 0;
2563
2605
  function useId$1() {
2564
2606
  const vm = getCurrentInstance();
2565
2607
  const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
2608
+ if (process.env.NODE_ENV === "test") {
2609
+ return name2;
2610
+ }
2566
2611
  return `${name2}-${++current}`;
2567
2612
  }
2568
2613
  const [name$1e, bem$1a] = createNamespace("field");
@@ -2615,7 +2660,7 @@ const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
2615
2660
  var stdin_default$1l = defineComponent({
2616
2661
  name: name$1e,
2617
2662
  props: fieldProps,
2618
- emits: ["blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon", "update:modelValue"],
2663
+ emits: ["blur", "focus", "clear", "keypress", "click-input", "end-validate", "start-validate", "click-left-icon", "click-right-icon", "update:modelValue"],
2619
2664
  setup(props, {
2620
2665
  emit,
2621
2666
  slots
@@ -2689,18 +2734,24 @@ var stdin_default$1l = defineComponent({
2689
2734
  state.status = "unvalidated";
2690
2735
  state.validateMessage = "";
2691
2736
  };
2737
+ const endValidate = () => emit("end-validate", {
2738
+ status: state.status
2739
+ });
2692
2740
  const validate = (rules = props.rules) => new Promise((resolve) => {
2693
2741
  resetValidation();
2694
2742
  if (rules) {
2743
+ emit("start-validate");
2695
2744
  runRules(rules).then(() => {
2696
2745
  if (state.status === "failed") {
2697
2746
  resolve({
2698
2747
  name: props.name,
2699
2748
  message: state.validateMessage
2700
2749
  });
2750
+ endValidate();
2701
2751
  } else {
2702
2752
  state.status = "passed";
2703
2753
  resolve();
2754
+ endValidate();
2704
2755
  }
2705
2756
  });
2706
2757
  } else {
@@ -4245,17 +4296,6 @@ const proxyPickerMethods = (picker, callback) => {
4245
4296
  }
4246
4297
  });
4247
4298
  };
4248
- const useHeight = (element) => {
4249
- const height = ref();
4250
- const setHeight = () => {
4251
- height.value = useRect(element).height;
4252
- };
4253
- onMounted(() => {
4254
- nextTick(setHeight);
4255
- setTimeout(setHeight, 100);
4256
- });
4257
- return height;
4258
- };
4259
4299
  const [name$13] = createNamespace("calendar-day");
4260
4300
  var stdin_default$1a = defineComponent({
4261
4301
  name: name$13,
@@ -4727,6 +4767,9 @@ var stdin_default$17 = defineComponent({
4727
4767
  const months = computed(() => {
4728
4768
  const months2 = [];
4729
4769
  const cursor = new Date(props.minDate);
4770
+ if (props.lazyRender && !props.show && props.poppable) {
4771
+ return months2;
4772
+ }
4730
4773
  cursor.setDate(1);
4731
4774
  do {
4732
4775
  months2.push(new Date(cursor));
@@ -4745,6 +4788,7 @@ var stdin_default$17 = defineComponent({
4745
4788
  }
4746
4789
  return !currentDate.value;
4747
4790
  });
4791
+ const getSelectedDate = () => currentDate.value;
4748
4792
  const onScroll = () => {
4749
4793
  const top = getScrollTop(bodyRef.value);
4750
4794
  const bottom = top + bodyHeight;
@@ -4987,7 +5031,8 @@ var stdin_default$17 = defineComponent({
4987
5031
  });
4988
5032
  useExpose({
4989
5033
  reset,
4990
- scrollToDate
5034
+ scrollToDate,
5035
+ getSelectedDate
4991
5036
  });
4992
5037
  onMountedOrActivated(init);
4993
5038
  return () => {
@@ -5953,6 +5998,16 @@ var stdin_default$10 = defineComponent({
5953
5998
  emit,
5954
5999
  slots
5955
6000
  }) {
6001
+ var _a, _b;
6002
+ if (process.env.NODE_ENV !== "production") {
6003
+ const props2 = (_b = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode) == null ? void 0 : _b.props;
6004
+ if (props2 && "onClick" in props2) {
6005
+ console.warn('[Vant] Tabs: "click" event is deprecated, using "click-tab" instead.');
6006
+ }
6007
+ if (props2 && "onDisabled" in props2) {
6008
+ console.warn('[Vant] Tabs: "disabled" event is deprecated, using "click-tab" instead.');
6009
+ }
6010
+ }
5956
6011
  let tabHeight;
5957
6012
  let lockScroll;
5958
6013
  let stickyFixed;
@@ -6278,6 +6333,9 @@ var stdin_default$$ = defineComponent({
6278
6333
  index
6279
6334
  } = useParent(SWIPE_KEY);
6280
6335
  if (!parent) {
6336
+ if (process.env.NODE_ENV !== "production") {
6337
+ console.error("[Vant] <SwipeItem> must be a child component of <Swipe>.");
6338
+ }
6281
6339
  return;
6282
6340
  }
6283
6341
  const style = computed(() => {
@@ -6356,6 +6414,9 @@ var stdin_default$_ = defineComponent({
6356
6414
  index
6357
6415
  } = useParent(TABS_KEY);
6358
6416
  if (!parent) {
6417
+ if (process.env.NODE_ENV !== "production") {
6418
+ console.error("[Vant] <Tab> must be a child component of <Tabs>.");
6419
+ }
6359
6420
  return;
6360
6421
  }
6361
6422
  const getName = () => {
@@ -7118,6 +7179,17 @@ const collapseProps = {
7118
7179
  default: ""
7119
7180
  }
7120
7181
  };
7182
+ function validateModelValue(modelValue, accordion) {
7183
+ if (accordion && Array.isArray(modelValue)) {
7184
+ console.error('[Vant] Collapse: "v-model" should not be Array in accordion mode');
7185
+ return false;
7186
+ }
7187
+ if (!accordion && !Array.isArray(modelValue)) {
7188
+ console.error('[Vant] Collapse: "v-model" should be Array in non-accordion mode');
7189
+ return false;
7190
+ }
7191
+ return true;
7192
+ }
7121
7193
  var stdin_default$S = defineComponent({
7122
7194
  name: name$M,
7123
7195
  props: collapseProps,
@@ -7127,7 +7199,8 @@ var stdin_default$S = defineComponent({
7127
7199
  slots
7128
7200
  }) {
7129
7201
  const {
7130
- linkChildren
7202
+ linkChildren,
7203
+ children
7131
7204
  } = useChildren(COLLAPSE_KEY);
7132
7205
  const updateName = (name2) => {
7133
7206
  emit("change", name2);
@@ -7146,13 +7219,41 @@ var stdin_default$S = defineComponent({
7146
7219
  updateName(modelValue.filter((activeName) => activeName !== name2));
7147
7220
  }
7148
7221
  };
7222
+ const toggleAll = (options = {}) => {
7223
+ if (props.accordion) {
7224
+ return;
7225
+ }
7226
+ if (typeof options === "boolean") {
7227
+ options = {
7228
+ expanded: options
7229
+ };
7230
+ }
7231
+ const {
7232
+ expanded,
7233
+ skipDisabled
7234
+ } = options;
7235
+ const expandedChildren = children.filter((item) => {
7236
+ if (item.disabled && skipDisabled) {
7237
+ return item.expanded.value;
7238
+ }
7239
+ return expanded != null ? expanded : !item.expanded.value;
7240
+ });
7241
+ const names = expandedChildren.map((item) => item.itemName.value);
7242
+ updateName(names);
7243
+ };
7149
7244
  const isExpanded = (name2) => {
7150
7245
  const {
7151
7246
  accordion,
7152
7247
  modelValue
7153
7248
  } = props;
7249
+ if (process.env.NODE_ENV !== "production" && !validateModelValue(modelValue, accordion)) {
7250
+ return false;
7251
+ }
7154
7252
  return accordion ? modelValue === name2 : modelValue.includes(name2);
7155
7253
  };
7254
+ useExpose({
7255
+ toggleAll
7256
+ });
7156
7257
  linkChildren({
7157
7258
  toggle,
7158
7259
  isExpanded
@@ -7190,6 +7291,9 @@ var stdin_default$R = defineComponent({
7190
7291
  index
7191
7292
  } = useParent(COLLAPSE_KEY);
7192
7293
  if (!parent) {
7294
+ if (process.env.NODE_ENV !== "production") {
7295
+ console.error("[Vant] <CollapseItem> must be a child component of <Collapse>.");
7296
+ }
7193
7297
  return;
7194
7298
  }
7195
7299
  const name2 = computed(() => {
@@ -7278,7 +7382,9 @@ var stdin_default$R = defineComponent({
7278
7382
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vShow, show.value]]);
7279
7383
  });
7280
7384
  useExpose({
7281
- toggle
7385
+ toggle,
7386
+ expanded,
7387
+ itemName: name2
7282
7388
  });
7283
7389
  return () => createVNode("div", {
7284
7390
  "class": [bem$K({
@@ -9055,6 +9161,9 @@ var stdin_default$C = defineComponent({
9055
9161
  index
9056
9162
  } = useParent(DROPDOWN_KEY);
9057
9163
  if (!parent) {
9164
+ if (process.env.NODE_ENV !== "production") {
9165
+ console.error("[Vant] <DropdownItem> must be a child component of <DropdownMenu>.");
9166
+ }
9058
9167
  return;
9059
9168
  }
9060
9169
  const getEmitter = (name2) => () => emit(name2);
@@ -9255,6 +9364,9 @@ var stdin_default$A = defineComponent({
9255
9364
  } = useParent(GRID_KEY);
9256
9365
  const route2 = useRoute();
9257
9366
  if (!parent) {
9367
+ if (process.env.NODE_ENV !== "production") {
9368
+ console.error("[Vant] <GridItem> must be a child component of <Grid>.");
9369
+ }
9258
9370
  return;
9259
9371
  }
9260
9372
  const rootStyle = computed(() => {
@@ -10049,6 +10161,9 @@ var stdin_default$w = defineComponent({
10049
10161
  parent
10050
10162
  } = useParent(INDEX_BAR_KEY);
10051
10163
  if (!parent) {
10164
+ if (process.env.NODE_ENV !== "production") {
10165
+ console.error("[Vant] <IndexAnchor> must be a child component of <IndexBar>.");
10166
+ }
10052
10167
  return;
10053
10168
  }
10054
10169
  const isSticky = () => state.active && parent.props.sticky;
@@ -10229,15 +10344,6 @@ var stdin_default$v = defineComponent({
10229
10344
  }
10230
10345
  });
10231
10346
  const List = withInstall(stdin_default$v);
10232
- function usePlaceholder(contentRef, bem2) {
10233
- const height = useHeight(contentRef);
10234
- return (renderContent) => createVNode("div", {
10235
- "class": bem2("placeholder"),
10236
- "style": {
10237
- height: height.value ? `${height.value}px` : void 0
10238
- }
10239
- }, [renderContent()]);
10240
- }
10241
10347
  const [name$p, bem$p] = createNamespace("nav-bar");
10242
10348
  const navBarProps = {
10243
10349
  title: String,
@@ -11136,22 +11242,23 @@ var stdin_default$n = defineComponent({
11136
11242
  let popper;
11137
11243
  const wrapperRef = ref();
11138
11244
  const popoverRef = ref();
11245
+ const getPopoverOptions = () => ({
11246
+ placement: props.placement,
11247
+ modifiers: [{
11248
+ name: "computeStyles",
11249
+ options: {
11250
+ adaptive: false,
11251
+ gpuAcceleration: false
11252
+ }
11253
+ }, extend({}, offsetModifier, {
11254
+ options: {
11255
+ offset: props.offset
11256
+ }
11257
+ })]
11258
+ });
11139
11259
  const createPopperInstance = () => {
11140
11260
  if (wrapperRef.value && popoverRef.value) {
11141
- return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, {
11142
- placement: props.placement,
11143
- modifiers: [{
11144
- name: "computeStyles",
11145
- options: {
11146
- adaptive: false,
11147
- gpuAcceleration: false
11148
- }
11149
- }, extend({}, offsetModifier, {
11150
- options: {
11151
- offset: props.offset
11152
- }
11153
- })]
11154
- });
11261
+ return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
11155
11262
  }
11156
11263
  return null;
11157
11264
  };
@@ -11163,9 +11270,7 @@ var stdin_default$n = defineComponent({
11163
11270
  if (!popper) {
11164
11271
  popper = createPopperInstance();
11165
11272
  } else {
11166
- popper.setOptions({
11167
- placement: props.placement
11168
- });
11273
+ popper.setOptions(getPopoverOptions());
11169
11274
  }
11170
11275
  });
11171
11276
  };
@@ -11236,7 +11341,7 @@ var stdin_default$n = defineComponent({
11236
11341
  popper = null;
11237
11342
  }
11238
11343
  });
11239
- watch(() => [props.show, props.placement], updateLocation);
11344
+ watch(() => [props.show, props.offset, props.placement], updateLocation);
11240
11345
  useClickAway(wrapperRef, onClickAway, {
11241
11346
  eventName: "touchstart"
11242
11347
  });
@@ -11355,7 +11460,7 @@ const pullRefreshProps = {
11355
11460
  var stdin_default$l = defineComponent({
11356
11461
  name: name$g,
11357
11462
  props: pullRefreshProps,
11358
- emits: ["refresh", "update:modelValue"],
11463
+ emits: ["change", "refresh", "update:modelValue"],
11359
11464
  setup(props, {
11360
11465
  emit,
11361
11466
  slots
@@ -11400,6 +11505,10 @@ var stdin_default$l = defineComponent({
11400
11505
  } else {
11401
11506
  state.status = "loosing";
11402
11507
  }
11508
+ emit("change", {
11509
+ status: state.status,
11510
+ distance
11511
+ });
11403
11512
  };
11404
11513
  const getStatusText = () => {
11405
11514
  const {
@@ -12005,6 +12114,9 @@ var stdin_default$g = defineComponent({
12005
12114
  index
12006
12115
  } = useParent(SIDEBAR_KEY);
12007
12116
  if (!parent) {
12117
+ if (process.env.NODE_ENV !== "production") {
12118
+ console.error("[Vant] <SidebarItem> must be a child component of <Sidebar>.");
12119
+ }
12008
12120
  return;
12009
12121
  }
12010
12122
  const onClick = () => {
@@ -12432,6 +12544,9 @@ var stdin_default$c = defineComponent({
12432
12544
  index
12433
12545
  } = useParent(STEPS_KEY);
12434
12546
  if (!parent) {
12547
+ if (process.env.NODE_ENV !== "production") {
12548
+ console.error("[Vant] <Step> must be a child component of <Steps>.");
12549
+ }
12435
12550
  return;
12436
12551
  }
12437
12552
  const parentProps = parent.props;
@@ -12784,6 +12899,7 @@ const submitBarProps = {
12784
12899
  buttonType: makeStringProp("danger"),
12785
12900
  buttonColor: String,
12786
12901
  suffixLabel: String,
12902
+ placeholder: Boolean,
12787
12903
  decimalLength: makeNumericProp(2),
12788
12904
  safeAreaInsetBottom: truthProp
12789
12905
  };
@@ -12795,6 +12911,8 @@ var stdin_default$a = defineComponent({
12795
12911
  emit,
12796
12912
  slots
12797
12913
  }) {
12914
+ const root = ref();
12915
+ const renderPlaceholder = usePlaceholder(root, bem$5);
12798
12916
  const renderText = () => {
12799
12917
  const {
12800
12918
  price,
@@ -12854,9 +12972,10 @@ var stdin_default$a = defineComponent({
12854
12972
  "onClick": onClickButton
12855
12973
  }, null);
12856
12974
  };
12857
- return () => {
12975
+ const renderSubmitBar = () => {
12858
12976
  var _a, _b;
12859
12977
  return createVNode("div", {
12978
+ "ref": root,
12860
12979
  "class": [bem$5(), {
12861
12980
  "van-safe-area-bottom": props.safeAreaInsetBottom
12862
12981
  }]
@@ -12864,6 +12983,12 @@ var stdin_default$a = defineComponent({
12864
12983
  "class": bem$5("bar")
12865
12984
  }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
12866
12985
  };
12986
+ return () => {
12987
+ if (props.placeholder) {
12988
+ return renderPlaceholder(renderSubmitBar);
12989
+ }
12990
+ return renderSubmitBar();
12991
+ };
12867
12992
  }
12868
12993
  });
12869
12994
  const SubmitBar = withInstall(stdin_default$a);
@@ -13119,6 +13244,9 @@ var stdin_default$7 = defineComponent({
13119
13244
  index
13120
13245
  } = useParent(TABBAR_KEY);
13121
13246
  if (!parent) {
13247
+ if (process.env.NODE_ENV !== "production") {
13248
+ console.error("[Vant] <TabbarItem> must be a child component of <Tabbar>.");
13249
+ }
13122
13250
  return;
13123
13251
  }
13124
13252
  const active = computed(() => {
@@ -13612,7 +13740,7 @@ var stdin_default$4 = defineComponent({
13612
13740
  if (props.previewFullImage) {
13613
13741
  const imageFiles = props.modelValue.filter(isImageFile);
13614
13742
  const images = imageFiles.map((item2) => {
13615
- if (item2.file && !item2.url) {
13743
+ if (item2.file && !item2.url && item2.status !== "failed") {
13616
13744
  item2.url = URL.createObjectURL(item2.file);
13617
13745
  urls.push(item2.url);
13618
13746
  }
@@ -13940,10 +14068,15 @@ class ReactiveListener {
13940
14068
  }, () => {
13941
14069
  cb();
13942
14070
  this.state.loading = false;
14071
+ if (process.env.NODE_ENV !== "production" && !this.options.silent)
14072
+ console.warn(`[@vant/lazyload] load failed with loading image(${this.loading})`);
13943
14073
  });
13944
14074
  }
13945
14075
  load(onFinish = noop) {
13946
14076
  if (this.attempt > this.options.attempt - 1 && this.state.error) {
14077
+ if (process.env.NODE_ENV !== "production" && !this.options.silent) {
14078
+ console.log(`[@vant/lazyload] ${this.src} tried too more than ${this.options.attempt} times`);
14079
+ }
13947
14080
  onFinish();
13948
14081
  return;
13949
14082
  }
@@ -14330,6 +14463,9 @@ function stdin_default$3() {
14330
14463
  let src = value;
14331
14464
  let { loading, error } = this.options;
14332
14465
  if (isObject(value)) {
14466
+ if (process.env.NODE_ENV !== "production" && !value.src && !this.options.silent) {
14467
+ console.error("[@vant/lazyload] miss src with " + value);
14468
+ }
14333
14469
  ({ src } = value);
14334
14470
  loading = value.loading || this.options.loading;
14335
14471
  error = value.error || this.options.error;
@@ -14517,6 +14653,9 @@ var stdin_default$1 = (lazyManager) => ({
14517
14653
  },
14518
14654
  load(onFinish = noop) {
14519
14655
  if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
14656
+ if (process.env.NODE_ENV !== "production" && !lazyManager.options.silent) {
14657
+ console.log(`[@vant/lazyload] ${this.options.src} tried too more than ${this.options.attempt} times`);
14658
+ }
14520
14659
  onFinish();
14521
14660
  return;
14522
14661
  }
@@ -14556,7 +14695,7 @@ const Lazyload = {
14556
14695
  });
14557
14696
  }
14558
14697
  };
14559
- const version = "3.5.0";
14698
+ const version = "3.5.3";
14560
14699
  function install(app) {
14561
14700
  const components = [
14562
14701
  ActionBar,
@@ -14657,4 +14796,94 @@ var stdin_default = {
14657
14796
  install,
14658
14797
  version
14659
14798
  };
14660
- export { ActionBar, ActionBarButton, ActionBarIcon, ActionSheet, AddressEdit, AddressList, Area, Badge, Button, Calendar, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, ConfigProvider, ContactCard, ContactEdit, ContactList, CountDown, Coupon, CouponCell, CouponList, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, Grid, GridItem, Icon, Image$1 as Image, ImagePreview, IndexAnchor, IndexBar, Lazyload, List, Loading, Locale, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, PasswordInput, Picker, Popover, Popup, Progress, PullRefresh, Radio, RadioGroup, Rate, Row, Search, ShareSheet, Sidebar, SidebarItem, Skeleton, Slider, Step, Stepper, Steps, Sticky, SubmitBar, Swipe, SwipeCell, SwipeItem, Switch, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, TreeSelect, Uploader, stdin_default as default, install, version };
14799
+ export {
14800
+ ActionBar,
14801
+ ActionBarButton,
14802
+ ActionBarIcon,
14803
+ ActionSheet,
14804
+ AddressEdit,
14805
+ AddressList,
14806
+ Area,
14807
+ Badge,
14808
+ Button,
14809
+ Calendar,
14810
+ Card,
14811
+ Cascader,
14812
+ Cell,
14813
+ CellGroup,
14814
+ Checkbox,
14815
+ CheckboxGroup,
14816
+ Circle,
14817
+ Col,
14818
+ Collapse,
14819
+ CollapseItem,
14820
+ ConfigProvider,
14821
+ ContactCard,
14822
+ ContactEdit,
14823
+ ContactList,
14824
+ CountDown,
14825
+ Coupon,
14826
+ CouponCell,
14827
+ CouponList,
14828
+ DatetimePicker,
14829
+ Dialog,
14830
+ Divider,
14831
+ DropdownItem,
14832
+ DropdownMenu,
14833
+ Empty,
14834
+ Field,
14835
+ Form,
14836
+ Grid,
14837
+ GridItem,
14838
+ Icon,
14839
+ Image$1 as Image,
14840
+ ImagePreview,
14841
+ IndexAnchor,
14842
+ IndexBar,
14843
+ Lazyload,
14844
+ List,
14845
+ Loading,
14846
+ Locale,
14847
+ NavBar,
14848
+ NoticeBar,
14849
+ Notify,
14850
+ NumberKeyboard,
14851
+ Overlay,
14852
+ Pagination,
14853
+ PasswordInput,
14854
+ Picker,
14855
+ Popover,
14856
+ Popup,
14857
+ Progress,
14858
+ PullRefresh,
14859
+ Radio,
14860
+ RadioGroup,
14861
+ Rate,
14862
+ Row,
14863
+ Search,
14864
+ ShareSheet,
14865
+ Sidebar,
14866
+ SidebarItem,
14867
+ Skeleton,
14868
+ Slider,
14869
+ Step,
14870
+ Stepper,
14871
+ Steps,
14872
+ Sticky,
14873
+ SubmitBar,
14874
+ Swipe,
14875
+ SwipeCell,
14876
+ SwipeItem,
14877
+ Switch,
14878
+ Tab,
14879
+ Tabbar,
14880
+ TabbarItem,
14881
+ Tabs,
14882
+ Tag,
14883
+ Toast,
14884
+ TreeSelect,
14885
+ Uploader,
14886
+ stdin_default as default,
14887
+ install,
14888
+ version
14889
+ };