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
@@ -1,50 +1,53 @@
1
1
  import { type ExtractPropTypes } from 'vue';
2
- import { CheckerShape, CheckerLabelPosition } from '../checkbox/Checker';
2
+ import { type CheckerShape, type CheckerLabelPosition } from '../checkbox/Checker';
3
+ export type RadioShape = CheckerShape | 'dot';
3
4
  export declare const radioProps: {
4
5
  name: import("vue").PropType<unknown>;
5
- shape: {
6
- type: import("vue").PropType<CheckerShape>;
7
- default: CheckerShape;
8
- };
9
6
  disabled: BooleanConstructor;
10
7
  iconSize: (NumberConstructor | StringConstructor)[];
11
8
  modelValue: import("vue").PropType<unknown>;
12
9
  checkedColor: StringConstructor;
13
10
  labelPosition: import("vue").PropType<CheckerLabelPosition>;
14
11
  labelDisabled: BooleanConstructor;
12
+ } & {
13
+ shape: {
14
+ type: import("vue").PropType<RadioShape>;
15
+ default: RadioShape;
16
+ };
15
17
  };
16
- export type RadioShape = CheckerShape;
17
18
  export type RadioLabelPosition = CheckerLabelPosition;
18
19
  export type RadioProps = ExtractPropTypes<typeof radioProps>;
19
20
  declare const _default: import("vue").DefineComponent<{
20
21
  name: import("vue").PropType<unknown>;
21
- shape: {
22
- type: import("vue").PropType<CheckerShape>;
23
- default: CheckerShape;
24
- };
25
22
  disabled: BooleanConstructor;
26
23
  iconSize: (NumberConstructor | StringConstructor)[];
27
24
  modelValue: import("vue").PropType<unknown>;
28
25
  checkedColor: StringConstructor;
29
26
  labelPosition: import("vue").PropType<CheckerLabelPosition>;
30
27
  labelDisabled: BooleanConstructor;
31
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
32
- name: import("vue").PropType<unknown>;
28
+ } & {
33
29
  shape: {
34
- type: import("vue").PropType<CheckerShape>;
35
- default: CheckerShape;
30
+ type: import("vue").PropType<RadioShape>;
31
+ default: RadioShape;
36
32
  };
33
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
34
+ name: import("vue").PropType<unknown>;
37
35
  disabled: BooleanConstructor;
38
36
  iconSize: (NumberConstructor | StringConstructor)[];
39
37
  modelValue: import("vue").PropType<unknown>;
40
38
  checkedColor: StringConstructor;
41
39
  labelPosition: import("vue").PropType<CheckerLabelPosition>;
42
40
  labelDisabled: BooleanConstructor;
41
+ } & {
42
+ shape: {
43
+ type: import("vue").PropType<RadioShape>;
44
+ default: RadioShape;
45
+ };
43
46
  }>> & {
44
47
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
45
48
  }, {
46
49
  disabled: boolean;
47
- shape: CheckerShape;
50
+ shape: RadioShape;
48
51
  labelDisabled: boolean;
49
52
  }, {}>;
50
53
  export default _default;
@@ -1,14 +1,16 @@
1
1
  import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { defineComponent } from "vue";
3
- import { pick, createNamespace } from "../utils/index.mjs";
3
+ import { pick, extend, createNamespace, makeStringProp } from "../utils/index.mjs";
4
4
  import { RADIO_KEY } from "../radio-group/RadioGroup.mjs";
5
5
  import { useParent } from "@vant/use";
6
6
  import Checker, { checkerProps } from "../checkbox/Checker.mjs";
7
- const radioProps = checkerProps;
7
+ const radioProps = extend({}, checkerProps, {
8
+ shape: makeStringProp("round")
9
+ });
8
10
  const [name, bem] = createNamespace("radio");
9
11
  var stdin_default = defineComponent({
10
12
  name,
11
- props: checkerProps,
13
+ props: radioProps,
12
14
  emits: ["update:modelValue"],
13
15
  setup(props, {
14
16
  emit,
@@ -1 +1 @@
1
- :root{--van-radio-size: 20px;--van-radio-border-color: var(--van-gray-5);--van-radio-duration: var(--van-duration-fast);--van-radio-label-margin: var(--van-padding-xs);--van-radio-label-color: var(--van-text-color);--van-radio-checked-icon-color: var(--van-primary-color);--van-radio-disabled-icon-color: var(--van-gray-5);--van-radio-disabled-label-color: var(--van-text-color-3);--van-radio-disabled-background: var(--van-border-color)}.van-radio{display:flex;align-items:center;overflow:hidden;cursor:pointer;-webkit-user-select:none;user-select:none}.van-radio--disabled{cursor:not-allowed}.van-radio--label-disabled{cursor:default}.van-radio--horizontal{margin-right:var(--van-padding-sm)}.van-radio__icon{flex:none;height:1em;font-size:var(--van-radio-size);line-height:1em;cursor:pointer}.van-radio__icon .van-icon{display:block;box-sizing:border-box;width:1.25em;height:1.25em;color:transparent;font-size:.8em;line-height:1.25;text-align:center;border:1px solid var(--van-radio-border-color);transition-duration:var(--van-radio-duration);transition-property:color,border-color,background-color}.van-radio__icon--round .van-icon{border-radius:100%}.van-radio__icon--checked .van-icon{color:var(--van-white);background-color:var(--van-radio-checked-icon-color);border-color:var(--van-radio-checked-icon-color)}.van-radio__icon--disabled{cursor:not-allowed}.van-radio__icon--disabled .van-icon{background-color:var(--van-radio-disabled-background);border-color:var(--van-radio-disabled-icon-color)}.van-radio__icon--disabled.van-radio__icon--checked .van-icon{color:var(--van-radio-disabled-icon-color)}.van-radio__label{margin-left:var(--van-radio-label-margin);color:var(--van-radio-label-color);line-height:var(--van-radio-size)}.van-radio__label--left{margin:0 var(--van-radio-label-margin) 0 0}.van-radio__label--disabled{color:var(--van-radio-disabled-label-color)}
1
+ :root{--van-radio-size: 20px;--van-radio-dot-size: 8px;--van-radio-border-color: var(--van-gray-5);--van-radio-duration: var(--van-duration-fast);--van-radio-label-margin: var(--van-padding-xs);--van-radio-label-color: var(--van-text-color);--van-radio-checked-icon-color: var(--van-primary-color);--van-radio-disabled-icon-color: var(--van-gray-5);--van-radio-disabled-label-color: var(--van-text-color-3);--van-radio-disabled-background: var(--van-border-color)}.van-radio{display:flex;align-items:center;overflow:hidden;cursor:pointer;-webkit-user-select:none;user-select:none}.van-radio--disabled{cursor:not-allowed}.van-radio--label-disabled{cursor:default}.van-radio--horizontal{margin-right:var(--van-padding-sm)}.van-radio__icon{flex:none;height:1em;font-size:var(--van-radio-size);line-height:1em;cursor:pointer}.van-radio__icon .van-icon{display:block;box-sizing:border-box;width:1.25em;height:1.25em;color:transparent;font-size:.8em;line-height:1.25;text-align:center;border:1px solid var(--van-radio-border-color);transition-duration:var(--van-radio-duration);transition-property:color,border-color,background-color}.van-radio__icon--round .van-icon{border-radius:100%}.van-radio__icon--dot{position:relative;border-radius:100%;box-sizing:border-box;width:var(--van-radio-size);height:var(--van-radio-size);border:1px solid var(--van-radio-border-color);transition-duration:var(--van-radio-duration);transition-property:border-color}.van-radio__icon--dot__icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:100%;height:calc(100% - var(--van-radio-dot-size));width:calc(100% - var(--van-radio-dot-size));transition-duration:var(--van-radio-duration);transition-property:border-color,background-color}.van-radio__icon--checked .van-icon{color:var(--van-white);background-color:var(--van-radio-checked-icon-color);border-color:var(--van-radio-checked-icon-color)}.van-radio__icon--checked.van-radio__icon--dot{border-color:var(--van-radio-checked-icon-color)}.van-radio__icon--checked.van-radio__icon--dot .van-radio__icon--dot__icon{background:var(--van-radio-checked-icon-color)}.van-radio__icon--disabled{cursor:not-allowed}.van-radio__icon--disabled .van-icon{background-color:var(--van-radio-disabled-background);border-color:var(--van-radio-disabled-icon-color)}.van-radio__icon--disabled.van-radio__icon--checked .van-icon{color:var(--van-radio-disabled-icon-color)}.van-radio__label{margin-left:var(--van-radio-label-margin);color:var(--van-radio-label-color);line-height:var(--van-radio-size)}.van-radio__label--left{margin:0 var(--van-radio-label-margin) 0 0}.van-radio__label--disabled{color:var(--van-radio-disabled-label-color)}
@@ -1,32 +1,34 @@
1
1
  export declare const Radio: import("../utils").WithInstall<import("vue").DefineComponent<{
2
2
  name: import("vue").PropType<unknown>;
3
- shape: {
4
- type: import("vue").PropType<import("../checkbox/Checker").CheckerShape>;
5
- default: import("../checkbox/Checker").CheckerShape;
6
- };
7
3
  disabled: BooleanConstructor;
8
4
  iconSize: (NumberConstructor | StringConstructor)[];
9
5
  modelValue: import("vue").PropType<unknown>;
10
6
  checkedColor: StringConstructor;
11
7
  labelPosition: import("vue").PropType<import("../checkbox/Checker").CheckerLabelPosition>;
12
8
  labelDisabled: BooleanConstructor;
13
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
14
- name: import("vue").PropType<unknown>;
9
+ } & {
15
10
  shape: {
16
- type: import("vue").PropType<import("../checkbox/Checker").CheckerShape>;
17
- default: import("../checkbox/Checker").CheckerShape;
11
+ type: import("vue").PropType<import("./Radio").RadioShape>;
12
+ default: import("./Radio").RadioShape;
18
13
  };
14
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
+ name: import("vue").PropType<unknown>;
19
16
  disabled: BooleanConstructor;
20
17
  iconSize: (NumberConstructor | StringConstructor)[];
21
18
  modelValue: import("vue").PropType<unknown>;
22
19
  checkedColor: StringConstructor;
23
20
  labelPosition: import("vue").PropType<import("../checkbox/Checker").CheckerLabelPosition>;
24
21
  labelDisabled: BooleanConstructor;
22
+ } & {
23
+ shape: {
24
+ type: import("vue").PropType<import("./Radio").RadioShape>;
25
+ default: import("./Radio").RadioShape;
26
+ };
25
27
  }>> & {
26
28
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
27
29
  }, {
28
30
  disabled: boolean;
29
- shape: import("../checkbox/Checker").CheckerShape;
31
+ shape: import("./Radio").RadioShape;
30
32
  labelDisabled: boolean;
31
33
  }, {}>>;
32
34
  export default Radio;
@@ -1,5 +1,6 @@
1
1
  export type RadioThemeVars = {
2
2
  radioSize?: string;
3
+ radioDotSize?: string;
3
4
  radioBorderColor?: string;
4
5
  radioDuration?: string;
5
6
  radioLabelMargin?: string;
@@ -20,8 +20,14 @@ export declare const searchProps: {
20
20
  inputAlign: import("vue").PropType<import("../field").FieldTextAlign>;
21
21
  placeholder: StringConstructor;
22
22
  autocomplete: StringConstructor;
23
+ autocapitalize: StringConstructor;
24
+ autocorrect: StringConstructor;
23
25
  errorMessage: StringConstructor;
24
26
  enterkeyhint: StringConstructor;
27
+ spellcheck: {
28
+ type: BooleanConstructor;
29
+ default: null;
30
+ };
25
31
  clearTrigger: {
26
32
  type: import("vue").PropType<import("../field").FieldClearTrigger>;
27
33
  default: import("../field").FieldClearTrigger;
@@ -81,8 +87,14 @@ declare const _default: import("vue").DefineComponent<{
81
87
  inputAlign: import("vue").PropType<import("../field").FieldTextAlign>;
82
88
  placeholder: StringConstructor;
83
89
  autocomplete: StringConstructor;
90
+ autocapitalize: StringConstructor;
91
+ autocorrect: StringConstructor;
84
92
  errorMessage: StringConstructor;
85
93
  enterkeyhint: StringConstructor;
94
+ spellcheck: {
95
+ type: BooleanConstructor;
96
+ default: null;
97
+ };
86
98
  clearTrigger: {
87
99
  type: import("vue").PropType<import("../field").FieldClearTrigger>;
88
100
  default: import("../field").FieldClearTrigger;
@@ -140,8 +152,14 @@ declare const _default: import("vue").DefineComponent<{
140
152
  inputAlign: import("vue").PropType<import("../field").FieldTextAlign>;
141
153
  placeholder: StringConstructor;
142
154
  autocomplete: StringConstructor;
155
+ autocapitalize: StringConstructor;
156
+ autocorrect: StringConstructor;
143
157
  errorMessage: StringConstructor;
144
158
  enterkeyhint: StringConstructor;
159
+ spellcheck: {
160
+ type: BooleanConstructor;
161
+ default: null;
162
+ };
145
163
  clearTrigger: {
146
164
  type: import("vue").PropType<import("../field").FieldClearTrigger>;
147
165
  default: import("../field").FieldClearTrigger;
@@ -197,6 +215,7 @@ declare const _default: import("vue").DefineComponent<{
197
215
  clearable: boolean;
198
216
  clearIcon: string;
199
217
  modelValue: string | number;
218
+ spellcheck: boolean;
200
219
  clearTrigger: import("../field").FieldClearTrigger;
201
220
  formatTrigger: import("../field").FieldFormatTrigger;
202
221
  error: boolean;
@@ -19,8 +19,14 @@ export declare const Search: import("../utils").WithInstall<import("vue").Define
19
19
  inputAlign: import("vue").PropType<import("..").FieldTextAlign>;
20
20
  placeholder: StringConstructor;
21
21
  autocomplete: StringConstructor;
22
+ autocapitalize: StringConstructor;
23
+ autocorrect: StringConstructor;
22
24
  errorMessage: StringConstructor;
23
25
  enterkeyhint: StringConstructor;
26
+ spellcheck: {
27
+ type: BooleanConstructor;
28
+ default: null;
29
+ };
24
30
  clearTrigger: {
25
31
  type: import("vue").PropType<import("..").FieldClearTrigger>;
26
32
  default: import("..").FieldClearTrigger;
@@ -78,8 +84,14 @@ export declare const Search: import("../utils").WithInstall<import("vue").Define
78
84
  inputAlign: import("vue").PropType<import("..").FieldTextAlign>;
79
85
  placeholder: StringConstructor;
80
86
  autocomplete: StringConstructor;
87
+ autocapitalize: StringConstructor;
88
+ autocorrect: StringConstructor;
81
89
  errorMessage: StringConstructor;
82
90
  enterkeyhint: StringConstructor;
91
+ spellcheck: {
92
+ type: BooleanConstructor;
93
+ default: null;
94
+ };
83
95
  clearTrigger: {
84
96
  type: import("vue").PropType<import("..").FieldClearTrigger>;
85
97
  default: import("..").FieldClearTrigger;
@@ -135,6 +147,7 @@ export declare const Search: import("../utils").WithInstall<import("vue").Define
135
147
  clearable: boolean;
136
148
  clearIcon: string;
137
149
  modelValue: string | number;
150
+ spellcheck: boolean;
138
151
  clearTrigger: import("..").FieldClearTrigger;
139
152
  formatTrigger: import("..").FieldFormatTrigger;
140
153
  error: boolean;
@@ -20,6 +20,10 @@ export declare const textEllipsisProps: {
20
20
  type: import("vue").PropType<string>;
21
21
  default: string;
22
22
  };
23
+ position: {
24
+ type: import("vue").PropType<string>;
25
+ default: string;
26
+ };
23
27
  };
24
28
  export type TextEllipsisProps = ExtractPropTypes<typeof textEllipsisProps>;
25
29
  declare const _default: import("vue").DefineComponent<{
@@ -43,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
43
47
  type: import("vue").PropType<string>;
44
48
  default: string;
45
49
  };
50
+ position: {
51
+ type: import("vue").PropType<string>;
52
+ default: string;
53
+ };
46
54
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
47
55
  rows: {
48
56
  type: (NumberConstructor | StringConstructor)[];
@@ -64,10 +72,15 @@ declare const _default: import("vue").DefineComponent<{
64
72
  type: import("vue").PropType<string>;
65
73
  default: string;
66
74
  };
75
+ position: {
76
+ type: import("vue").PropType<string>;
77
+ default: string;
78
+ };
67
79
  }>> & {
68
80
  onClickAction?: ((...args: any[]) => any) | undefined;
69
81
  }, {
70
82
  content: string;
83
+ position: string;
71
84
  rows: string | number;
72
85
  dots: string;
73
86
  expandText: string;
@@ -1,5 +1,5 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { ref, watch, onMounted, defineComponent } from "vue";
2
+ import { ref, watch, computed, onMounted, defineComponent } from "vue";
3
3
  import { useEventListener } from "@vant/use";
4
4
  import { makeNumericProp, makeStringProp, createNamespace } from "../utils/index.mjs";
5
5
  const [name, bem] = createNamespace("text-ellipsis");
@@ -8,7 +8,8 @@ const textEllipsisProps = {
8
8
  dots: makeStringProp("..."),
9
9
  content: makeStringProp(""),
10
10
  expandText: makeStringProp(""),
11
- collapseText: makeStringProp("")
11
+ collapseText: makeStringProp(""),
12
+ position: makeStringProp("end")
12
13
  };
13
14
  var stdin_default = defineComponent({
14
15
  name,
@@ -21,6 +22,7 @@ var stdin_default = defineComponent({
21
22
  const expanded = ref(false);
22
23
  const hasAction = ref(false);
23
24
  const root = ref();
25
+ const actionText = computed(() => expanded.value ? props.expandText : props.collapseText);
24
26
  const pxToNum = (value) => {
25
27
  if (!value)
26
28
  return 0;
@@ -49,24 +51,53 @@ var stdin_default = defineComponent({
49
51
  };
50
52
  const calcEllipsisText = (container2, maxHeight2) => {
51
53
  const {
52
- dots,
53
54
  content,
54
- expandText
55
+ position,
56
+ dots
55
57
  } = props;
56
- let left = 0;
57
- let right = content.length;
58
- let res = -1;
59
- while (left <= right) {
60
- const mid = Math.floor((left + right) / 2);
61
- container2.innerText = content.slice(0, mid) + dots + expandText;
62
- if (container2.offsetHeight <= maxHeight2) {
63
- left = mid + 1;
64
- res = mid;
65
- } else {
66
- right = mid - 1;
58
+ const end = content.length;
59
+ const calcEllipse = () => {
60
+ const tail = (left, right) => {
61
+ if (right - left <= 1) {
62
+ if (position === "end") {
63
+ return content.slice(0, left) + dots;
64
+ }
65
+ return dots + content.slice(right, end);
66
+ }
67
+ const middle2 = Math.round(left + right >> 1);
68
+ if (position === "end") {
69
+ container2.innerText = content.slice(0, middle2) + dots + actionText.value;
70
+ } else {
71
+ container2.innerText = dots + content.slice(middle2, end) + actionText.value;
72
+ }
73
+ if (container2.offsetHeight > maxHeight2) {
74
+ if (position === "end") {
75
+ return tail(left, middle2);
76
+ }
77
+ return tail(middle2, right);
78
+ }
79
+ if (position === "end") {
80
+ return tail(middle2, right);
81
+ }
82
+ return tail(left, middle2);
83
+ };
84
+ container2.innerText = tail(0, end);
85
+ };
86
+ const middleTail = (leftPart, rightPart) => {
87
+ if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
88
+ return content.slice(0, leftPart[1]) + dots + dots + content.slice(rightPart[1], end);
67
89
  }
68
- }
69
- return content.slice(0, res) + dots;
90
+ const leftMiddle = Math.floor(leftPart[0] + leftPart[1] >> 1);
91
+ const rightMiddle = Math.ceil(rightPart[0] + rightPart[1] >> 1);
92
+ container2.innerText = props.content.slice(0, leftMiddle) + props.dots + actionText.value + props.dots + props.content.slice(rightMiddle, end);
93
+ if (container2.offsetHeight >= maxHeight2) {
94
+ return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
95
+ }
96
+ return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
97
+ };
98
+ const middle = 0 + end >> 1;
99
+ props.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end]) : calcEllipse();
100
+ return container2.innerText;
70
101
  };
71
102
  const container = cloneContainer();
72
103
  if (!container)
@@ -76,7 +107,7 @@ var stdin_default = defineComponent({
76
107
  paddingTop,
77
108
  lineHeight
78
109
  } = container.style;
79
- const maxHeight = (Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
110
+ const maxHeight = Math.ceil((Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
80
111
  if (maxHeight < container.offsetHeight) {
81
112
  hasAction.value = true;
82
113
  text.value = calcEllipsisText(container, maxHeight);
@@ -95,7 +126,7 @@ var stdin_default = defineComponent({
95
126
  "onClick": onClickAction
96
127
  }, [expanded.value ? props.collapseText : props.expandText]);
97
128
  onMounted(calcEllipsised);
98
- watch(() => [props.content, props.rows], calcEllipsised);
129
+ watch(() => [props.content, props.rows, props.position], calcEllipsised);
99
130
  useEventListener("resize", calcEllipsised);
100
131
  return () => _createVNode("div", {
101
132
  "ref": root,
@@ -19,6 +19,10 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
19
19
  type: import("vue").PropType<string>;
20
20
  default: string;
21
21
  };
22
+ position: {
23
+ type: import("vue").PropType<string>;
24
+ default: string;
25
+ };
22
26
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
27
  rows: {
24
28
  type: (NumberConstructor | StringConstructor)[];
@@ -40,10 +44,15 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
40
44
  type: import("vue").PropType<string>;
41
45
  default: string;
42
46
  };
47
+ position: {
48
+ type: import("vue").PropType<string>;
49
+ default: string;
50
+ };
43
51
  }>> & {
44
52
  onClickAction?: ((...args: any[]) => any) | undefined;
45
53
  }, {
46
54
  content: string;
55
+ position: string;
47
56
  rows: string | number;
48
57
  dots: string;
49
58
  expandText: string;
@@ -1,10 +1,7 @@
1
1
  import { type ExtractPropTypes } from 'vue';
2
+ import { type CheckerShape } from './Checker';
2
3
  export declare const checkboxProps: {
3
4
  name: import("vue").PropType<unknown>;
4
- shape: {
5
- type: import("vue").PropType<import("./Checker").CheckerShape>;
6
- default: import("./Checker").CheckerShape;
7
- };
8
5
  disabled: BooleanConstructor;
9
6
  iconSize: (NumberConstructor | StringConstructor)[];
10
7
  modelValue: import("vue").PropType<unknown>;
@@ -12,6 +9,10 @@ export declare const checkboxProps: {
12
9
  labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
13
10
  labelDisabled: BooleanConstructor;
14
11
  } & {
12
+ shape: {
13
+ type: import("vue").PropType<CheckerShape>;
14
+ default: CheckerShape;
15
+ };
15
16
  bindGroup: {
16
17
  type: BooleanConstructor;
17
18
  default: true;
@@ -20,10 +21,6 @@ export declare const checkboxProps: {
20
21
  export type CheckboxProps = ExtractPropTypes<typeof checkboxProps>;
21
22
  declare const _default: import("vue").DefineComponent<{
22
23
  name: import("vue").PropType<unknown>;
23
- shape: {
24
- type: import("vue").PropType<import("./Checker").CheckerShape>;
25
- default: import("./Checker").CheckerShape;
26
- };
27
24
  disabled: BooleanConstructor;
28
25
  iconSize: (NumberConstructor | StringConstructor)[];
29
26
  modelValue: import("vue").PropType<unknown>;
@@ -31,16 +28,16 @@ declare const _default: import("vue").DefineComponent<{
31
28
  labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
32
29
  labelDisabled: BooleanConstructor;
33
30
  } & {
31
+ shape: {
32
+ type: import("vue").PropType<CheckerShape>;
33
+ default: CheckerShape;
34
+ };
34
35
  bindGroup: {
35
36
  type: BooleanConstructor;
36
37
  default: true;
37
38
  };
38
39
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
39
40
  name: import("vue").PropType<unknown>;
40
- shape: {
41
- type: import("vue").PropType<import("./Checker").CheckerShape>;
42
- default: import("./Checker").CheckerShape;
43
- };
44
41
  disabled: BooleanConstructor;
45
42
  iconSize: (NumberConstructor | StringConstructor)[];
46
43
  modelValue: import("vue").PropType<unknown>;
@@ -48,6 +45,10 @@ declare const _default: import("vue").DefineComponent<{
48
45
  labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
49
46
  labelDisabled: BooleanConstructor;
50
47
  } & {
48
+ shape: {
49
+ type: import("vue").PropType<CheckerShape>;
50
+ default: CheckerShape;
51
+ };
51
52
  bindGroup: {
52
53
  type: BooleanConstructor;
53
54
  default: true;
@@ -57,7 +58,7 @@ declare const _default: import("vue").DefineComponent<{
57
58
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
58
59
  }, {
59
60
  disabled: boolean;
60
- shape: import("./Checker").CheckerShape;
61
+ shape: CheckerShape;
61
62
  labelDisabled: boolean;
62
63
  bindGroup: boolean;
63
64
  }, {}>;
@@ -40,6 +40,7 @@ var import_use_expose = require("../composables/use-expose");
40
40
  var import_Checker = __toESM(require("./Checker"));
41
41
  const [name, bem] = (0, import_utils.createNamespace)("checkbox");
42
42
  const checkboxProps = (0, import_utils.extend)({}, import_Checker.checkerProps, {
43
+ shape: (0, import_utils.makeStringProp)("round"),
43
44
  bindGroup: import_utils.truthProp
44
45
  });
45
46
  var stdin_default = (0, import_vue2.defineComponent)({
@@ -15,10 +15,6 @@ export type CheckerParent = {
15
15
  };
16
16
  export declare const checkerProps: {
17
17
  name: PropType<unknown>;
18
- shape: {
19
- type: PropType<CheckerShape>;
20
- default: CheckerShape;
21
- };
22
18
  disabled: BooleanConstructor;
23
19
  iconSize: (NumberConstructor | StringConstructor)[];
24
20
  modelValue: PropType<unknown>;
@@ -28,10 +24,6 @@ export declare const checkerProps: {
28
24
  };
29
25
  declare const _default: import("vue").DefineComponent<{
30
26
  name: PropType<unknown>;
31
- shape: {
32
- type: PropType<CheckerShape>;
33
- default: CheckerShape;
34
- };
35
27
  disabled: BooleanConstructor;
36
28
  iconSize: (NumberConstructor | StringConstructor)[];
37
29
  modelValue: PropType<unknown>;
@@ -44,6 +36,10 @@ declare const _default: import("vue").DefineComponent<{
44
36
  required: true;
45
37
  };
46
38
  role: StringConstructor;
39
+ shape: {
40
+ type: PropType<"dot" | "round" | "square">;
41
+ default: "dot" | "round" | "square";
42
+ };
47
43
  parent: PropType<CheckerParent | null>;
48
44
  checked: BooleanConstructor;
49
45
  bindGroup: {
@@ -52,10 +48,6 @@ declare const _default: import("vue").DefineComponent<{
52
48
  };
53
49
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "toggle")[], "click" | "toggle", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
54
50
  name: PropType<unknown>;
55
- shape: {
56
- type: PropType<CheckerShape>;
57
- default: CheckerShape;
58
- };
59
51
  disabled: BooleanConstructor;
60
52
  iconSize: (NumberConstructor | StringConstructor)[];
61
53
  modelValue: PropType<unknown>;
@@ -68,6 +60,10 @@ declare const _default: import("vue").DefineComponent<{
68
60
  required: true;
69
61
  };
70
62
  role: StringConstructor;
63
+ shape: {
64
+ type: PropType<"dot" | "round" | "square">;
65
+ default: "dot" | "round" | "square";
66
+ };
71
67
  parent: PropType<CheckerParent | null>;
72
68
  checked: BooleanConstructor;
73
69
  bindGroup: {
@@ -80,7 +76,7 @@ declare const _default: import("vue").DefineComponent<{
80
76
  }, {
81
77
  checked: boolean;
82
78
  disabled: boolean;
83
- shape: CheckerShape;
79
+ shape: "dot" | "round" | "square";
84
80
  labelDisabled: boolean;
85
81
  bindGroup: boolean;
86
82
  }, {}>;
@@ -27,7 +27,6 @@ var import_utils = require("../utils");
27
27
  var import_icon = require("../icon");
28
28
  const checkerProps = {
29
29
  name: import_utils.unknownProp,
30
- shape: (0, import_utils.makeStringProp)("round"),
31
30
  disabled: Boolean,
32
31
  iconSize: import_utils.numericProp,
33
32
  modelValue: import_utils.unknownProp,
@@ -39,6 +38,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
39
38
  props: (0, import_utils.extend)({}, checkerProps, {
40
39
  bem: (0, import_utils.makeRequiredProp)(Function),
41
40
  role: String,
41
+ shape: (0, import_utils.makeStringProp)("round"),
42
42
  parent: Object,
43
43
  checked: Boolean,
44
44
  bindGroup: import_utils.truthProp
@@ -89,6 +89,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
89
89
  emit("click", event);
90
90
  };
91
91
  const renderIcon = () => {
92
+ var _a, _b;
92
93
  const {
93
94
  bem,
94
95
  shape,
@@ -101,15 +102,24 @@ var stdin_default = (0, import_vue2.defineComponent)({
101
102
  disabled: disabled.value,
102
103
  checked
103
104
  }]),
104
- "style": {
105
+ "style": shape !== "dot" ? {
105
106
  fontSize: (0, import_utils.addUnit)(iconSize)
107
+ } : {
108
+ width: (0, import_utils.addUnit)(iconSize),
109
+ height: (0, import_utils.addUnit)(iconSize),
110
+ borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
106
111
  }
107
112
  }, [slots.icon ? slots.icon({
108
113
  checked,
109
114
  disabled: disabled.value
110
- }) : (0, import_vue.createVNode)(import_icon.Icon, {
115
+ }) : shape !== "dot" ? (0, import_vue.createVNode)(import_icon.Icon, {
111
116
  "name": "success",
112
117
  "style": iconStyle.value
118
+ }, null) : (0, import_vue.createVNode)("div", {
119
+ "class": bem("icon--dot__icon"),
120
+ "style": {
121
+ backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
122
+ }
113
123
  }, null)]);
114
124
  };
115
125
  const renderLabel = () => {
@@ -1,9 +1,5 @@
1
1
  export declare const Checkbox: import("../utils").WithInstall<import("vue").DefineComponent<{
2
2
  name: import("vue").PropType<unknown>;
3
- shape: {
4
- type: import("vue").PropType<import("./Checker").CheckerShape>;
5
- default: import("./Checker").CheckerShape;
6
- };
7
3
  disabled: BooleanConstructor;
8
4
  iconSize: (NumberConstructor | StringConstructor)[];
9
5
  modelValue: import("vue").PropType<unknown>;
@@ -11,16 +7,16 @@ export declare const Checkbox: import("../utils").WithInstall<import("vue").Defi
11
7
  labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
12
8
  labelDisabled: BooleanConstructor;
13
9
  } & {
10
+ shape: {
11
+ type: import("vue").PropType<import("./Checker").CheckerShape>;
12
+ default: import("./Checker").CheckerShape;
13
+ };
14
14
  bindGroup: {
15
15
  type: BooleanConstructor;
16
16
  default: true;
17
17
  };
18
18
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
19
  name: import("vue").PropType<unknown>;
20
- shape: {
21
- type: import("vue").PropType<import("./Checker").CheckerShape>;
22
- default: import("./Checker").CheckerShape;
23
- };
24
20
  disabled: BooleanConstructor;
25
21
  iconSize: (NumberConstructor | StringConstructor)[];
26
22
  modelValue: import("vue").PropType<unknown>;
@@ -28,6 +24,10 @@ export declare const Checkbox: import("../utils").WithInstall<import("vue").Defi
28
24
  labelPosition: import("vue").PropType<import("./Checker").CheckerLabelPosition>;
29
25
  labelDisabled: BooleanConstructor;
30
26
  } & {
27
+ shape: {
28
+ type: import("vue").PropType<import("./Checker").CheckerShape>;
29
+ default: import("./Checker").CheckerShape;
30
+ };
31
31
  bindGroup: {
32
32
  type: BooleanConstructor;
33
33
  default: true;