vant 4.6.1 → 4.6.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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/es/checkbox/Checkbox.d.ts +14 -13
  3. package/es/checkbox/Checkbox.mjs +2 -1
  4. package/es/checkbox/Checker.d.ts +9 -13
  5. package/es/checkbox/Checker.mjs +13 -3
  6. package/es/checkbox/index.d.ts +8 -8
  7. package/es/field/Field.d.ts +25 -0
  8. package/es/field/Field.mjs +9 -0
  9. package/es/field/index.d.ts +13 -0
  10. package/es/floating-bubble/FloatingBubble.d.ts +16 -21
  11. package/es/floating-bubble/FloatingBubble.mjs +6 -8
  12. package/es/floating-bubble/index.css +1 -1
  13. package/es/floating-bubble/index.d.ts +18 -18
  14. package/es/floating-bubble/types.d.ts +12 -0
  15. package/es/index.d.ts +1 -1
  16. package/es/index.mjs +1 -1
  17. package/es/pagination/index.css +1 -1
  18. package/es/radio/Radio.d.ts +18 -15
  19. package/es/radio/Radio.mjs +5 -3
  20. package/es/radio/index.css +1 -1
  21. package/es/radio/index.d.ts +11 -9
  22. package/es/radio/types.d.ts +1 -0
  23. package/es/search/Search.d.ts +19 -0
  24. package/es/search/index.d.ts +13 -0
  25. package/es/text-ellipsis/TextEllipsis.d.ts +13 -0
  26. package/es/text-ellipsis/TextEllipsis.mjs +50 -19
  27. package/es/text-ellipsis/index.d.ts +9 -0
  28. package/lib/checkbox/Checkbox.d.ts +14 -13
  29. package/lib/checkbox/Checkbox.js +1 -0
  30. package/lib/checkbox/Checker.d.ts +9 -13
  31. package/lib/checkbox/Checker.js +13 -3
  32. package/lib/checkbox/index.d.ts +8 -8
  33. package/lib/field/Field.d.ts +25 -0
  34. package/lib/field/Field.js +9 -0
  35. package/lib/field/index.d.ts +13 -0
  36. package/lib/floating-bubble/FloatingBubble.d.ts +16 -21
  37. package/lib/floating-bubble/FloatingBubble.js +6 -8
  38. package/lib/floating-bubble/index.css +1 -1
  39. package/lib/floating-bubble/index.d.ts +18 -18
  40. package/lib/floating-bubble/types.d.ts +12 -0
  41. package/lib/index.css +1 -1
  42. package/lib/index.d.ts +1 -1
  43. package/lib/index.js +1 -1
  44. package/lib/pagination/index.css +1 -1
  45. package/lib/radio/Radio.d.ts +18 -15
  46. package/lib/radio/Radio.js +4 -2
  47. package/lib/radio/index.css +1 -1
  48. package/lib/radio/index.d.ts +11 -9
  49. package/lib/radio/types.d.ts +1 -0
  50. package/lib/search/Search.d.ts +19 -0
  51. package/lib/search/index.d.ts +13 -0
  52. package/lib/text-ellipsis/TextEllipsis.d.ts +13 -0
  53. package/lib/text-ellipsis/TextEllipsis.js +49 -18
  54. package/lib/text-ellipsis/index.d.ts +9 -0
  55. package/lib/vant.cjs.js +82 -31
  56. package/lib/vant.es.js +82 -31
  57. package/lib/vant.js +82 -31
  58. package/lib/vant.min.js +1 -1
  59. package/lib/web-types.json +1 -1
  60. package/package.json +1 -1
package/lib/vant.js CHANGED
@@ -4382,8 +4382,14 @@
4382
4382
  inputAlign: String,
4383
4383
  placeholder: String,
4384
4384
  autocomplete: String,
4385
+ autocapitalize: String,
4386
+ autocorrect: String,
4385
4387
  errorMessage: String,
4386
4388
  enterkeyhint: String,
4389
+ spellcheck: {
4390
+ type: Boolean,
4391
+ default: null
4392
+ },
4387
4393
  clearTrigger: makeStringProp("focus"),
4388
4394
  formatTrigger: makeStringProp("onChange"),
4389
4395
  error: {
@@ -4711,7 +4717,10 @@
4711
4717
  autofocus: props2.autofocus,
4712
4718
  placeholder: props2.placeholder,
4713
4719
  autocomplete: props2.autocomplete,
4720
+ autocapitalize: props2.autocapitalize,
4721
+ autocorrect: props2.autocorrect,
4714
4722
  enterkeyhint: props2.enterkeyhint,
4723
+ spellcheck: props2.spellcheck,
4715
4724
  "aria-labelledby": props2.label ? `${id}-label` : void 0,
4716
4725
  onBlur,
4717
4726
  onFocus,
@@ -5693,7 +5702,6 @@
5693
5702
  const Tag = withInstall(stdin_default$1o);
5694
5703
  const checkerProps = {
5695
5704
  name: unknownProp,
5696
- shape: makeStringProp("round"),
5697
5705
  disabled: Boolean,
5698
5706
  iconSize: numericProp,
5699
5707
  modelValue: unknownProp,
@@ -5705,6 +5713,7 @@
5705
5713
  props: extend({}, checkerProps, {
5706
5714
  bem: makeRequiredProp(Function),
5707
5715
  role: String,
5716
+ shape: makeStringProp("round"),
5708
5717
  parent: Object,
5709
5718
  checked: Boolean,
5710
5719
  bindGroup: truthProp
@@ -5755,6 +5764,7 @@
5755
5764
  emit("click", event);
5756
5765
  };
5757
5766
  const renderIcon = () => {
5767
+ var _a, _b;
5758
5768
  const {
5759
5769
  bem: bem2,
5760
5770
  shape,
@@ -5767,15 +5777,24 @@
5767
5777
  disabled: disabled.value,
5768
5778
  checked
5769
5779
  }]),
5770
- "style": {
5780
+ "style": shape !== "dot" ? {
5771
5781
  fontSize: addUnit(iconSize)
5782
+ } : {
5783
+ width: addUnit(iconSize),
5784
+ height: addUnit(iconSize),
5785
+ borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
5772
5786
  }
5773
5787
  }, [slots.icon ? slots.icon({
5774
5788
  checked,
5775
5789
  disabled: disabled.value
5776
- }) : vue.createVNode(Icon, {
5790
+ }) : shape !== "dot" ? vue.createVNode(Icon, {
5777
5791
  "name": "success",
5778
5792
  "style": iconStyle.value
5793
+ }, null) : vue.createVNode("div", {
5794
+ "class": bem2("icon--dot__icon"),
5795
+ "style": {
5796
+ backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
5797
+ }
5779
5798
  }, null)]);
5780
5799
  };
5781
5800
  const renderLabel = () => {
@@ -5802,11 +5821,13 @@
5802
5821
  };
5803
5822
  }
5804
5823
  });
5805
- const radioProps = checkerProps;
5824
+ const radioProps = extend({}, checkerProps, {
5825
+ shape: makeStringProp("round")
5826
+ });
5806
5827
  const [name$1d, bem$19] = createNamespace("radio");
5807
5828
  var stdin_default$1m = vue.defineComponent({
5808
5829
  name: name$1d,
5809
- props: checkerProps,
5830
+ props: radioProps,
5810
5831
  emits: ["update:modelValue"],
5811
5832
  setup(props2, {
5812
5833
  emit,
@@ -7857,6 +7878,7 @@
7857
7878
  });
7858
7879
  const [name$$, bem$_] = createNamespace("checkbox");
7859
7880
  const checkboxProps = extend({}, checkerProps, {
7881
+ shape: makeStringProp("round"),
7860
7882
  bindGroup: truthProp
7861
7883
  });
7862
7884
  var stdin_default$18 = vue.defineComponent({
@@ -10066,10 +10088,10 @@
10066
10088
  const DropdownItem = withInstall(stdin_default$S);
10067
10089
  const DropdownMenu = withInstall(stdin_default$T);
10068
10090
  const floatingBubbleProps = {
10091
+ gap: makeNumberProp(24),
10092
+ icon: String,
10069
10093
  axis: makeStringProp("y"),
10070
10094
  magnetic: String,
10071
- icon: String,
10072
- gap: makeNumberProp(24),
10073
10095
  offset: {
10074
10096
  type: Object,
10075
10097
  default: () => ({
@@ -10100,8 +10122,8 @@
10100
10122
  });
10101
10123
  const boundary = vue.computed(() => ({
10102
10124
  top: props2.gap,
10103
- right: windowWidth.value - state.value.height - props2.gap,
10104
- bottom: windowHeight.value - state.value.width - props2.gap,
10125
+ right: windowWidth.value - state.value.width - props2.gap,
10126
+ bottom: windowHeight.value - state.value.height - props2.gap,
10105
10127
  left: props2.gap
10106
10128
  }));
10107
10129
  const dragging = vue.ref(false);
@@ -10199,9 +10221,7 @@
10199
10221
  initialized = true;
10200
10222
  });
10201
10223
  });
10202
- vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], () => updateState(), {
10203
- deep: true
10204
- });
10224
+ vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
10205
10225
  const show = vue.ref(true);
10206
10226
  vue.onActivated(() => {
10207
10227
  show.value = true;
@@ -15758,7 +15778,8 @@
15758
15778
  dots: makeStringProp("..."),
15759
15779
  content: makeStringProp(""),
15760
15780
  expandText: makeStringProp(""),
15761
- collapseText: makeStringProp("")
15781
+ collapseText: makeStringProp(""),
15782
+ position: makeStringProp("end")
15762
15783
  };
15763
15784
  var stdin_default$9 = vue.defineComponent({
15764
15785
  name: name$4,
@@ -15771,6 +15792,7 @@
15771
15792
  const expanded = vue.ref(false);
15772
15793
  const hasAction = vue.ref(false);
15773
15794
  const root = vue.ref();
15795
+ const actionText = vue.computed(() => expanded.value ? props2.expandText : props2.collapseText);
15774
15796
  const pxToNum = (value) => {
15775
15797
  if (!value)
15776
15798
  return 0;
@@ -15799,24 +15821,53 @@
15799
15821
  };
15800
15822
  const calcEllipsisText = (container2, maxHeight2) => {
15801
15823
  const {
15802
- dots,
15803
15824
  content,
15804
- expandText
15825
+ position,
15826
+ dots
15805
15827
  } = props2;
15806
- let left2 = 0;
15807
- let right2 = content.length;
15808
- let res = -1;
15809
- while (left2 <= right2) {
15810
- const mid = Math.floor((left2 + right2) / 2);
15811
- container2.innerText = content.slice(0, mid) + dots + expandText;
15812
- if (container2.offsetHeight <= maxHeight2) {
15813
- left2 = mid + 1;
15814
- res = mid;
15815
- } else {
15816
- right2 = mid - 1;
15828
+ const end2 = content.length;
15829
+ const calcEllipse = () => {
15830
+ const tail = (left2, right2) => {
15831
+ if (right2 - left2 <= 1) {
15832
+ if (position === "end") {
15833
+ return content.slice(0, left2) + dots;
15834
+ }
15835
+ return dots + content.slice(right2, end2);
15836
+ }
15837
+ const middle2 = Math.round(left2 + right2 >> 1);
15838
+ if (position === "end") {
15839
+ container2.innerText = content.slice(0, middle2) + dots + actionText.value;
15840
+ } else {
15841
+ container2.innerText = dots + content.slice(middle2, end2) + actionText.value;
15842
+ }
15843
+ if (container2.offsetHeight > maxHeight2) {
15844
+ if (position === "end") {
15845
+ return tail(left2, middle2);
15846
+ }
15847
+ return tail(middle2, right2);
15848
+ }
15849
+ if (position === "end") {
15850
+ return tail(middle2, right2);
15851
+ }
15852
+ return tail(left2, middle2);
15853
+ };
15854
+ container2.innerText = tail(0, end2);
15855
+ };
15856
+ const middleTail = (leftPart, rightPart) => {
15857
+ if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
15858
+ return content.slice(0, leftPart[1]) + dots + dots + content.slice(rightPart[1], end2);
15817
15859
  }
15818
- }
15819
- return content.slice(0, res) + dots;
15860
+ const leftMiddle = Math.floor(leftPart[0] + leftPart[1] >> 1);
15861
+ const rightMiddle = Math.ceil(rightPart[0] + rightPart[1] >> 1);
15862
+ container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + actionText.value + props2.dots + props2.content.slice(rightMiddle, end2);
15863
+ if (container2.offsetHeight >= maxHeight2) {
15864
+ return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
15865
+ }
15866
+ return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
15867
+ };
15868
+ const middle = 0 + end2 >> 1;
15869
+ props2.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end2]) : calcEllipse();
15870
+ return container2.innerText;
15820
15871
  };
15821
15872
  const container = cloneContainer();
15822
15873
  if (!container)
@@ -15826,7 +15877,7 @@
15826
15877
  paddingTop,
15827
15878
  lineHeight
15828
15879
  } = container.style;
15829
- const maxHeight = (Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
15880
+ const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
15830
15881
  if (maxHeight < container.offsetHeight) {
15831
15882
  hasAction.value = true;
15832
15883
  text.value = calcEllipsisText(container, maxHeight);
@@ -15845,7 +15896,7 @@
15845
15896
  "onClick": onClickAction
15846
15897
  }, [expanded.value ? props2.collapseText : props2.expandText]);
15847
15898
  vue.onMounted(calcEllipsised);
15848
- vue.watch(() => [props2.content, props2.rows], calcEllipsised);
15899
+ vue.watch(() => [props2.content, props2.rows, props2.position], calcEllipsised);
15849
15900
  useEventListener("resize", calcEllipsised);
15850
15901
  return () => vue.createVNode("div", {
15851
15902
  "ref": root,
@@ -17484,7 +17535,7 @@
17484
17535
  });
17485
17536
  }
17486
17537
  };
17487
- const version = "4.6.1";
17538
+ const version = "4.6.2";
17488
17539
  function install(app) {
17489
17540
  const components = [
17490
17541
  ActionBar,