vant 3.5.1 → 3.5.2

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.
package/lib/vant.cjs.js CHANGED
@@ -395,9 +395,30 @@ function withInstall(options) {
395
395
  };
396
396
  return options;
397
397
  }
398
+ const useHeight = (element) => {
399
+ const height = vue.ref();
400
+ const setHeight = () => {
401
+ height.value = use.useRect(element).height;
402
+ };
403
+ vue.onMounted(() => {
404
+ vue.nextTick(setHeight);
405
+ setTimeout(setHeight, 100);
406
+ });
407
+ return height;
408
+ };
409
+ function usePlaceholder(contentRef, bem2) {
410
+ const height = useHeight(contentRef);
411
+ return (renderContent) => vue.createVNode("div", {
412
+ "class": bem2("placeholder"),
413
+ "style": {
414
+ height: height.value ? `${height.value}px` : void 0
415
+ }
416
+ }, [renderContent()]);
417
+ }
398
418
  const [name$1u, bem$1q] = createNamespace("action-bar");
399
419
  const ACTION_BAR_KEY = Symbol(name$1u);
400
420
  const actionBarProps = {
421
+ placeholder: Boolean,
401
422
  safeAreaInsetBottom: truthProp
402
423
  };
403
424
  var stdin_default$1B = vue.defineComponent({
@@ -406,18 +427,27 @@ var stdin_default$1B = vue.defineComponent({
406
427
  setup(props, {
407
428
  slots
408
429
  }) {
430
+ const root = vue.ref();
431
+ const renderPlaceholder = usePlaceholder(root, bem$1q);
409
432
  const {
410
433
  linkChildren
411
434
  } = use.useChildren(ACTION_BAR_KEY);
412
435
  linkChildren();
413
- return () => {
436
+ const renderActionBar = () => {
414
437
  var _a;
415
438
  return vue.createVNode("div", {
439
+ "ref": root,
416
440
  "class": [bem$1q(), {
417
441
  "van-safe-area-bottom": props.safeAreaInsetBottom
418
442
  }]
419
443
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
420
444
  };
445
+ return () => {
446
+ if (props.placeholder) {
447
+ return renderPlaceholder(renderActionBar);
448
+ }
449
+ return renderActionBar();
450
+ };
421
451
  }
422
452
  });
423
453
  const ActionBar = withInstall(stdin_default$1B);
@@ -2617,7 +2647,7 @@ const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
2617
2647
  var stdin_default$1l = vue.defineComponent({
2618
2648
  name: name$1e,
2619
2649
  props: fieldProps,
2620
- emits: ["blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon", "update:modelValue"],
2650
+ emits: ["blur", "focus", "clear", "keypress", "click-input", "end-validate", "start-validate", "click-left-icon", "click-right-icon", "update:modelValue"],
2621
2651
  setup(props, {
2622
2652
  emit,
2623
2653
  slots
@@ -2691,18 +2721,24 @@ var stdin_default$1l = vue.defineComponent({
2691
2721
  state.status = "unvalidated";
2692
2722
  state.validateMessage = "";
2693
2723
  };
2724
+ const endValidate = () => emit("end-validate", {
2725
+ status: state.status
2726
+ });
2694
2727
  const validate = (rules = props.rules) => new Promise((resolve) => {
2695
2728
  resetValidation();
2696
2729
  if (rules) {
2730
+ emit("start-validate");
2697
2731
  runRules(rules).then(() => {
2698
2732
  if (state.status === "failed") {
2699
2733
  resolve({
2700
2734
  name: props.name,
2701
2735
  message: state.validateMessage
2702
2736
  });
2737
+ endValidate();
2703
2738
  } else {
2704
2739
  state.status = "passed";
2705
2740
  resolve();
2741
+ endValidate();
2706
2742
  }
2707
2743
  });
2708
2744
  } else {
@@ -4247,17 +4283,6 @@ const proxyPickerMethods = (picker, callback) => {
4247
4283
  }
4248
4284
  });
4249
4285
  };
4250
- const useHeight = (element) => {
4251
- const height = vue.ref();
4252
- const setHeight = () => {
4253
- height.value = use.useRect(element).height;
4254
- };
4255
- vue.onMounted(() => {
4256
- vue.nextTick(setHeight);
4257
- setTimeout(setHeight, 100);
4258
- });
4259
- return height;
4260
- };
4261
4286
  const [name$13] = createNamespace("calendar-day");
4262
4287
  var stdin_default$1a = vue.defineComponent({
4263
4288
  name: name$13,
@@ -10234,15 +10259,6 @@ var stdin_default$v = vue.defineComponent({
10234
10259
  }
10235
10260
  });
10236
10261
  const List = withInstall(stdin_default$v);
10237
- function usePlaceholder(contentRef, bem2) {
10238
- const height = useHeight(contentRef);
10239
- return (renderContent) => vue.createVNode("div", {
10240
- "class": bem2("placeholder"),
10241
- "style": {
10242
- height: height.value ? `${height.value}px` : void 0
10243
- }
10244
- }, [renderContent()]);
10245
- }
10246
10262
  const [name$p, bem$p] = createNamespace("nav-bar");
10247
10263
  const navBarProps = {
10248
10264
  title: String,
@@ -12793,6 +12809,7 @@ const submitBarProps = {
12793
12809
  buttonType: makeStringProp("danger"),
12794
12810
  buttonColor: String,
12795
12811
  suffixLabel: String,
12812
+ placeholder: Boolean,
12796
12813
  decimalLength: makeNumericProp(2),
12797
12814
  safeAreaInsetBottom: truthProp
12798
12815
  };
@@ -12804,6 +12821,8 @@ var stdin_default$a = vue.defineComponent({
12804
12821
  emit,
12805
12822
  slots
12806
12823
  }) {
12824
+ const root = vue.ref();
12825
+ const renderPlaceholder = usePlaceholder(root, bem$5);
12807
12826
  const renderText = () => {
12808
12827
  const {
12809
12828
  price,
@@ -12863,9 +12882,10 @@ var stdin_default$a = vue.defineComponent({
12863
12882
  "onClick": onClickButton
12864
12883
  }, null);
12865
12884
  };
12866
- return () => {
12885
+ const renderSubmitBar = () => {
12867
12886
  var _a, _b;
12868
12887
  return vue.createVNode("div", {
12888
+ "ref": root,
12869
12889
  "class": [bem$5(), {
12870
12890
  "van-safe-area-bottom": props.safeAreaInsetBottom
12871
12891
  }]
@@ -12873,6 +12893,12 @@ var stdin_default$a = vue.defineComponent({
12873
12893
  "class": bem$5("bar")
12874
12894
  }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
12875
12895
  };
12896
+ return () => {
12897
+ if (props.placeholder) {
12898
+ return renderPlaceholder(renderSubmitBar);
12899
+ }
12900
+ return renderSubmitBar();
12901
+ };
12876
12902
  }
12877
12903
  });
12878
12904
  const SubmitBar = withInstall(stdin_default$a);
@@ -14565,7 +14591,7 @@ const Lazyload = {
14565
14591
  });
14566
14592
  }
14567
14593
  };
14568
- const version = "3.5.1";
14594
+ const version = "3.5.2";
14569
14595
  function install(app) {
14570
14596
  const components = [
14571
14597
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -1,5 +1,5 @@
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";
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
3
  import { createPopper, offsetModifier } from "@vant/popperjs";
4
4
  function noop() {
5
5
  }
@@ -393,9 +393,30 @@ function withInstall(options) {
393
393
  };
394
394
  return options;
395
395
  }
396
+ const useHeight = (element) => {
397
+ const height = ref();
398
+ const setHeight = () => {
399
+ height.value = useRect(element).height;
400
+ };
401
+ onMounted(() => {
402
+ nextTick(setHeight);
403
+ setTimeout(setHeight, 100);
404
+ });
405
+ return height;
406
+ };
407
+ function usePlaceholder(contentRef, bem2) {
408
+ const height = useHeight(contentRef);
409
+ return (renderContent) => createVNode("div", {
410
+ "class": bem2("placeholder"),
411
+ "style": {
412
+ height: height.value ? `${height.value}px` : void 0
413
+ }
414
+ }, [renderContent()]);
415
+ }
396
416
  const [name$1u, bem$1q] = createNamespace("action-bar");
397
417
  const ACTION_BAR_KEY = Symbol(name$1u);
398
418
  const actionBarProps = {
419
+ placeholder: Boolean,
399
420
  safeAreaInsetBottom: truthProp
400
421
  };
401
422
  var stdin_default$1B = defineComponent({
@@ -404,18 +425,27 @@ var stdin_default$1B = defineComponent({
404
425
  setup(props, {
405
426
  slots
406
427
  }) {
428
+ const root = ref();
429
+ const renderPlaceholder = usePlaceholder(root, bem$1q);
407
430
  const {
408
431
  linkChildren
409
432
  } = useChildren(ACTION_BAR_KEY);
410
433
  linkChildren();
411
- return () => {
434
+ const renderActionBar = () => {
412
435
  var _a;
413
436
  return createVNode("div", {
437
+ "ref": root,
414
438
  "class": [bem$1q(), {
415
439
  "van-safe-area-bottom": props.safeAreaInsetBottom
416
440
  }]
417
441
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
418
442
  };
443
+ return () => {
444
+ if (props.placeholder) {
445
+ return renderPlaceholder(renderActionBar);
446
+ }
447
+ return renderActionBar();
448
+ };
419
449
  }
420
450
  });
421
451
  const ActionBar = withInstall(stdin_default$1B);
@@ -2615,7 +2645,7 @@ const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
2615
2645
  var stdin_default$1l = defineComponent({
2616
2646
  name: name$1e,
2617
2647
  props: fieldProps,
2618
- emits: ["blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon", "update:modelValue"],
2648
+ emits: ["blur", "focus", "clear", "keypress", "click-input", "end-validate", "start-validate", "click-left-icon", "click-right-icon", "update:modelValue"],
2619
2649
  setup(props, {
2620
2650
  emit,
2621
2651
  slots
@@ -2689,18 +2719,24 @@ var stdin_default$1l = defineComponent({
2689
2719
  state.status = "unvalidated";
2690
2720
  state.validateMessage = "";
2691
2721
  };
2722
+ const endValidate = () => emit("end-validate", {
2723
+ status: state.status
2724
+ });
2692
2725
  const validate = (rules = props.rules) => new Promise((resolve) => {
2693
2726
  resetValidation();
2694
2727
  if (rules) {
2728
+ emit("start-validate");
2695
2729
  runRules(rules).then(() => {
2696
2730
  if (state.status === "failed") {
2697
2731
  resolve({
2698
2732
  name: props.name,
2699
2733
  message: state.validateMessage
2700
2734
  });
2735
+ endValidate();
2701
2736
  } else {
2702
2737
  state.status = "passed";
2703
2738
  resolve();
2739
+ endValidate();
2704
2740
  }
2705
2741
  });
2706
2742
  } else {
@@ -4245,17 +4281,6 @@ const proxyPickerMethods = (picker, callback) => {
4245
4281
  }
4246
4282
  });
4247
4283
  };
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
4284
  const [name$13] = createNamespace("calendar-day");
4260
4285
  var stdin_default$1a = defineComponent({
4261
4286
  name: name$13,
@@ -10232,15 +10257,6 @@ var stdin_default$v = defineComponent({
10232
10257
  }
10233
10258
  });
10234
10259
  const List = withInstall(stdin_default$v);
10235
- function usePlaceholder(contentRef, bem2) {
10236
- const height = useHeight(contentRef);
10237
- return (renderContent) => createVNode("div", {
10238
- "class": bem2("placeholder"),
10239
- "style": {
10240
- height: height.value ? `${height.value}px` : void 0
10241
- }
10242
- }, [renderContent()]);
10243
- }
10244
10260
  const [name$p, bem$p] = createNamespace("nav-bar");
10245
10261
  const navBarProps = {
10246
10262
  title: String,
@@ -12791,6 +12807,7 @@ const submitBarProps = {
12791
12807
  buttonType: makeStringProp("danger"),
12792
12808
  buttonColor: String,
12793
12809
  suffixLabel: String,
12810
+ placeholder: Boolean,
12794
12811
  decimalLength: makeNumericProp(2),
12795
12812
  safeAreaInsetBottom: truthProp
12796
12813
  };
@@ -12802,6 +12819,8 @@ var stdin_default$a = defineComponent({
12802
12819
  emit,
12803
12820
  slots
12804
12821
  }) {
12822
+ const root = ref();
12823
+ const renderPlaceholder = usePlaceholder(root, bem$5);
12805
12824
  const renderText = () => {
12806
12825
  const {
12807
12826
  price,
@@ -12861,9 +12880,10 @@ var stdin_default$a = defineComponent({
12861
12880
  "onClick": onClickButton
12862
12881
  }, null);
12863
12882
  };
12864
- return () => {
12883
+ const renderSubmitBar = () => {
12865
12884
  var _a, _b;
12866
12885
  return createVNode("div", {
12886
+ "ref": root,
12867
12887
  "class": [bem$5(), {
12868
12888
  "van-safe-area-bottom": props.safeAreaInsetBottom
12869
12889
  }]
@@ -12871,6 +12891,12 @@ var stdin_default$a = defineComponent({
12871
12891
  "class": bem$5("bar")
12872
12892
  }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
12873
12893
  };
12894
+ return () => {
12895
+ if (props.placeholder) {
12896
+ return renderPlaceholder(renderSubmitBar);
12897
+ }
12898
+ return renderSubmitBar();
12899
+ };
12874
12900
  }
12875
12901
  });
12876
12902
  const SubmitBar = withInstall(stdin_default$a);
@@ -14563,7 +14589,7 @@ const Lazyload = {
14563
14589
  });
14564
14590
  }
14565
14591
  };
14566
- const version = "3.5.1";
14592
+ const version = "3.5.2";
14567
14593
  function install(app) {
14568
14594
  const components = [
14569
14595
  ActionBar,
package/lib/vant.js CHANGED
@@ -352,7 +352,7 @@
352
352
  }
353
353
  return { width, height };
354
354
  }
355
- var overflowScrollReg = /scroll|auto/i;
355
+ var overflowScrollReg = /scroll|auto|overlay/i;
356
356
  var defaultRoot = inBrowser ? window : void 0;
357
357
  function isElement$1(node) {
358
358
  const ELEMENT_NODE_TYPE = 1;
@@ -747,9 +747,30 @@
747
747
  };
748
748
  return options;
749
749
  }
750
+ const useHeight = (element) => {
751
+ const height2 = vue.ref();
752
+ const setHeight = () => {
753
+ height2.value = useRect(element).height;
754
+ };
755
+ vue.onMounted(() => {
756
+ vue.nextTick(setHeight);
757
+ setTimeout(setHeight, 100);
758
+ });
759
+ return height2;
760
+ };
761
+ function usePlaceholder(contentRef, bem2) {
762
+ const height2 = useHeight(contentRef);
763
+ return (renderContent) => vue.createVNode("div", {
764
+ "class": bem2("placeholder"),
765
+ "style": {
766
+ height: height2.value ? `${height2.value}px` : void 0
767
+ }
768
+ }, [renderContent()]);
769
+ }
750
770
  const [name$1u, bem$1q] = createNamespace("action-bar");
751
771
  const ACTION_BAR_KEY = Symbol(name$1u);
752
772
  const actionBarProps = {
773
+ placeholder: Boolean,
753
774
  safeAreaInsetBottom: truthProp
754
775
  };
755
776
  var stdin_default$1B = vue.defineComponent({
@@ -758,18 +779,27 @@
758
779
  setup(props, {
759
780
  slots
760
781
  }) {
782
+ const root = vue.ref();
783
+ const renderPlaceholder = usePlaceholder(root, bem$1q);
761
784
  const {
762
785
  linkChildren
763
786
  } = useChildren(ACTION_BAR_KEY);
764
787
  linkChildren();
765
- return () => {
788
+ const renderActionBar = () => {
766
789
  var _a;
767
790
  return vue.createVNode("div", {
791
+ "ref": root,
768
792
  "class": [bem$1q(), {
769
793
  "van-safe-area-bottom": props.safeAreaInsetBottom
770
794
  }]
771
795
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
772
796
  };
797
+ return () => {
798
+ if (props.placeholder) {
799
+ return renderPlaceholder(renderActionBar);
800
+ }
801
+ return renderActionBar();
802
+ };
773
803
  }
774
804
  });
775
805
  const ActionBar = withInstall(stdin_default$1B);
@@ -2969,7 +2999,7 @@
2969
2999
  var stdin_default$1l = vue.defineComponent({
2970
3000
  name: name$1e,
2971
3001
  props: fieldProps,
2972
- emits: ["blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon", "update:modelValue"],
3002
+ emits: ["blur", "focus", "clear", "keypress", "click-input", "end-validate", "start-validate", "click-left-icon", "click-right-icon", "update:modelValue"],
2973
3003
  setup(props, {
2974
3004
  emit,
2975
3005
  slots
@@ -3043,18 +3073,24 @@
3043
3073
  state.status = "unvalidated";
3044
3074
  state.validateMessage = "";
3045
3075
  };
3076
+ const endValidate = () => emit("end-validate", {
3077
+ status: state.status
3078
+ });
3046
3079
  const validate = (rules = props.rules) => new Promise((resolve) => {
3047
3080
  resetValidation();
3048
3081
  if (rules) {
3082
+ emit("start-validate");
3049
3083
  runRules(rules).then(() => {
3050
3084
  if (state.status === "failed") {
3051
3085
  resolve({
3052
3086
  name: props.name,
3053
3087
  message: state.validateMessage
3054
3088
  });
3089
+ endValidate();
3055
3090
  } else {
3056
3091
  state.status = "passed";
3057
3092
  resolve();
3093
+ endValidate();
3058
3094
  }
3059
3095
  });
3060
3096
  } else {
@@ -4599,17 +4635,6 @@
4599
4635
  }
4600
4636
  });
4601
4637
  };
4602
- const useHeight = (element) => {
4603
- const height2 = vue.ref();
4604
- const setHeight = () => {
4605
- height2.value = useRect(element).height;
4606
- };
4607
- vue.onMounted(() => {
4608
- vue.nextTick(setHeight);
4609
- setTimeout(setHeight, 100);
4610
- });
4611
- return height2;
4612
- };
4613
4638
  const [name$13] = createNamespace("calendar-day");
4614
4639
  var stdin_default$1a = vue.defineComponent({
4615
4640
  name: name$13,
@@ -10586,15 +10611,6 @@
10586
10611
  }
10587
10612
  });
10588
10613
  const List = withInstall(stdin_default$v);
10589
- function usePlaceholder(contentRef, bem2) {
10590
- const height2 = useHeight(contentRef);
10591
- return (renderContent) => vue.createVNode("div", {
10592
- "class": bem2("placeholder"),
10593
- "style": {
10594
- height: height2.value ? `${height2.value}px` : void 0
10595
- }
10596
- }, [renderContent()]);
10597
- }
10598
10614
  const [name$p, bem$p] = createNamespace("nav-bar");
10599
10615
  const navBarProps = {
10600
10616
  title: String,
@@ -14039,6 +14055,7 @@
14039
14055
  buttonType: makeStringProp("danger"),
14040
14056
  buttonColor: String,
14041
14057
  suffixLabel: String,
14058
+ placeholder: Boolean,
14042
14059
  decimalLength: makeNumericProp(2),
14043
14060
  safeAreaInsetBottom: truthProp
14044
14061
  };
@@ -14050,6 +14067,8 @@
14050
14067
  emit,
14051
14068
  slots
14052
14069
  }) {
14070
+ const root = vue.ref();
14071
+ const renderPlaceholder = usePlaceholder(root, bem$5);
14053
14072
  const renderText = () => {
14054
14073
  const {
14055
14074
  price,
@@ -14109,9 +14128,10 @@
14109
14128
  "onClick": onClickButton
14110
14129
  }, null);
14111
14130
  };
14112
- return () => {
14131
+ const renderSubmitBar = () => {
14113
14132
  var _a, _b;
14114
14133
  return vue.createVNode("div", {
14134
+ "ref": root,
14115
14135
  "class": [bem$5(), {
14116
14136
  "van-safe-area-bottom": props.safeAreaInsetBottom
14117
14137
  }]
@@ -14119,6 +14139,12 @@
14119
14139
  "class": bem$5("bar")
14120
14140
  }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
14121
14141
  };
14142
+ return () => {
14143
+ if (props.placeholder) {
14144
+ return renderPlaceholder(renderSubmitBar);
14145
+ }
14146
+ return renderSubmitBar();
14147
+ };
14122
14148
  }
14123
14149
  });
14124
14150
  const SubmitBar = withInstall(stdin_default$a);
@@ -15811,7 +15837,7 @@
15811
15837
  });
15812
15838
  }
15813
15839
  };
15814
- const version = "3.5.1";
15840
+ const version = "3.5.2";
15815
15841
  function install(app) {
15816
15842
  const components = [
15817
15843
  ActionBar,