vant 4.0.11 → 4.1.0
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/README.md +7 -3
- package/es/dropdown-item/DropdownItem.mjs +1 -0
- package/es/dropdown-menu/DropdownMenu.mjs +2 -2
- package/es/dropdown-menu/types.d.ts +1 -0
- package/es/field/index.css +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/locale/lang/uk-UA.mjs +15 -15
- package/es/swipe/Swipe.mjs +6 -2
- package/es/text-ellipsis/TextEllipsis.d.ts +63 -0
- package/es/text-ellipsis/TextEllipsis.mjs +108 -0
- package/es/text-ellipsis/index.css +1 -0
- package/es/text-ellipsis/index.d.ts +51 -0
- package/es/text-ellipsis/index.mjs +10 -0
- package/es/text-ellipsis/style/index.d.ts +1 -0
- package/es/text-ellipsis/style/index.mjs +2 -0
- package/es/text-ellipsis/types.d.ts +3 -0
- package/es/text-ellipsis/types.mjs +0 -0
- package/es/tree-select/TreeSelect.mjs +3 -2
- package/lib/dropdown-item/DropdownItem.js +1 -0
- package/lib/dropdown-menu/DropdownMenu.js +2 -2
- package/lib/dropdown-menu/types.d.ts +1 -0
- package/lib/field/index.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/locale/lang/uk-UA.js +15 -15
- package/lib/swipe/Swipe.js +6 -2
- package/lib/text-ellipsis/TextEllipsis.d.ts +63 -0
- package/lib/text-ellipsis/TextEllipsis.js +127 -0
- package/lib/text-ellipsis/index.css +1 -0
- package/lib/text-ellipsis/index.d.ts +51 -0
- package/lib/text-ellipsis/index.js +35 -0
- package/lib/text-ellipsis/style/index.d.ts +1 -0
- package/lib/text-ellipsis/style/index.js +2 -0
- package/lib/text-ellipsis/types.d.ts +3 -0
- package/lib/text-ellipsis/types.js +15 -0
- package/lib/tree-select/TreeSelect.js +3 -2
- package/lib/vant.cjs.js +949 -839
- package/lib/vant.es.js +949 -839
- package/lib/vant.js +949 -839
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -124,9 +124,13 @@ You can scan the following QR code to access the demo:
|
|
124
124
|
|
125
125
|
Core contributors of Vant and Vant Weapp:
|
126
126
|
|
127
|
-
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) |
|
128
|
-
| :-: | :-: | :-: | :-: | :-: |
|
129
|
-
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) |
|
127
|
+
| [](https://github.com/chenjiahan/) | [](https://github.com/cookfront/) | [](https://github.com/w91/) | [](https://github.com/pangxie1991/) | [](https://github.com/rex-zsd/) |
|
128
|
+
| :-: | :-: | :-: | :-: | :-: |
|
129
|
+
| [chenjiahan](https://github.com/chenjiahan/) | [cookfront](https://github.com/cookfront/) | [wangnaiyi](https://github.com/w91/) | [pangxie](https://github.com/pangxie1991/) | [rex-zsd](https://github.com/rex-zsd/) |
|
130
|
+
|
131
|
+
| [](https://github.com/nemo-shen/) | [](https://github.com/Lindysen/) | [](https://github.com/JakeLaoyu/) | [](https://github.com/landluck/) | [](https://github.com/wjw-gavin/) |
|
132
|
+
| :-: | :-: | :-: | :-: | :-: |
|
133
|
+
| [nemo-shen](https://github.com/nemo-shen/) | [Lindysen](https://github.com/Lindysen/) | [JakeLaoyu](https://github.com/JakeLaoyu/) | [landluck](https://github.com/landluck/) | [wjw-gavin](https://github.com/wjw-gavin/) |
|
130
134
|
|
131
135
|
## All Contributors
|
132
136
|
|
@@ -62,7 +62,6 @@ var stdin_default = defineComponent({
|
|
62
62
|
const toggleItem = (active) => {
|
63
63
|
children.forEach((item, index) => {
|
64
64
|
if (index === active) {
|
65
|
-
updateOffset();
|
66
65
|
item.toggle();
|
67
66
|
} else if (item.state.showPopup) {
|
68
67
|
item.toggle(false, {
|
@@ -108,7 +107,8 @@ var stdin_default = defineComponent({
|
|
108
107
|
linkChildren({
|
109
108
|
id,
|
110
109
|
props,
|
111
|
-
offset
|
110
|
+
offset,
|
111
|
+
updateOffset
|
112
112
|
});
|
113
113
|
useClickAway(root, onClickAway);
|
114
114
|
useEventListener("scroll", onScroll, {
|
package/es/field/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{
|
1
|
+
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field--label-top .van-field__value{flex:none;width:100%}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{margin-bottom:var(--van-padding-base)}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
|
package/es/index.d.ts
CHANGED
@@ -88,6 +88,7 @@ export * from "./tabbar";
|
|
88
88
|
export * from "./tabbar-item";
|
89
89
|
export * from "./tabs";
|
90
90
|
export * from "./tag";
|
91
|
+
export * from "./text-ellipsis";
|
91
92
|
export * from "./time-picker";
|
92
93
|
export * from "./toast";
|
93
94
|
export * from "./tree-select";
|
@@ -98,4 +99,4 @@ declare namespace _default {
|
|
98
99
|
}
|
99
100
|
export default _default;
|
100
101
|
export function install(app: any): void;
|
101
|
-
export const version: "4.0
|
102
|
+
export const version: "4.1.0";
|
package/es/index.mjs
CHANGED
@@ -87,11 +87,12 @@ import { Tabbar } from "./tabbar/index.mjs";
|
|
87
87
|
import { TabbarItem } from "./tabbar-item/index.mjs";
|
88
88
|
import { Tabs } from "./tabs/index.mjs";
|
89
89
|
import { Tag } from "./tag/index.mjs";
|
90
|
+
import { TextEllipsis } from "./text-ellipsis/index.mjs";
|
90
91
|
import { TimePicker } from "./time-picker/index.mjs";
|
91
92
|
import { Toast } from "./toast/index.mjs";
|
92
93
|
import { TreeSelect } from "./tree-select/index.mjs";
|
93
94
|
import { Uploader } from "./uploader/index.mjs";
|
94
|
-
const version = "4.0
|
95
|
+
const version = "4.1.0";
|
95
96
|
function install(app) {
|
96
97
|
const components = [
|
97
98
|
ActionBar,
|
@@ -183,6 +184,7 @@ function install(app) {
|
|
183
184
|
TabbarItem,
|
184
185
|
Tabs,
|
185
186
|
Tag,
|
187
|
+
TextEllipsis,
|
186
188
|
TimePicker,
|
187
189
|
Toast,
|
188
190
|
TreeSelect,
|
@@ -286,6 +288,7 @@ export * from "./tabbar/index.mjs";
|
|
286
288
|
export * from "./tabbar-item/index.mjs";
|
287
289
|
export * from "./tabs/index.mjs";
|
288
290
|
export * from "./tag/index.mjs";
|
291
|
+
export * from "./text-ellipsis/index.mjs";
|
289
292
|
export * from "./time-picker/index.mjs";
|
290
293
|
export * from "./toast/index.mjs";
|
291
294
|
export * from "./tree-select/index.mjs";
|
package/es/locale/lang/uk-UA.mjs
CHANGED
@@ -2,7 +2,7 @@ var stdin_default = {
|
|
2
2
|
name: "\u0406\u043C'\u044F",
|
3
3
|
tel: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D",
|
4
4
|
save: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438",
|
5
|
-
confirm: "\
|
5
|
+
confirm: "\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438",
|
6
6
|
cancel: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
|
7
7
|
delete: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
|
8
8
|
loading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F...",
|
@@ -12,30 +12,30 @@ var stdin_default = {
|
|
12
12
|
telInvalid: "\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443",
|
13
13
|
vanCalendar: {
|
14
14
|
end: "\u041A\u0456\u043D\u0435\u0446\u044C",
|
15
|
-
start: "\u041F\u043E\u0447\u0430\u0442\
|
15
|
+
start: "\u041F\u043E\u0447\u0430\u0442\u043E\u043A",
|
16
16
|
title: "\u041A\u0430\u043B\u0435\u043D\u0434\u0430\u0440",
|
17
17
|
weekdays: [
|
18
|
-
"\
|
19
|
-
"\
|
20
|
-
"\
|
21
|
-
"\
|
22
|
-
"\
|
23
|
-
"\
|
24
|
-
"\
|
18
|
+
"\u041D\u0434",
|
19
|
+
"\u041F\u043D",
|
20
|
+
"\u0412\u0442",
|
21
|
+
"\u0421\u0440",
|
22
|
+
"\u0427\u0442",
|
23
|
+
"\u041F\u0442",
|
24
|
+
"\u0421\u0431"
|
25
25
|
],
|
26
26
|
monthTitle: (year, month) => `${year}/${month}`,
|
27
|
-
rangePrompt: (maxRange) => `\
|
27
|
+
rangePrompt: (maxRange) => `\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u043D\u0435 \u0431\u0456\u043B\u044C\u0448\u0435 \u043D\u0456\u0436 ${maxRange} \u0434\u043D\u0456\u0432`
|
28
28
|
},
|
29
29
|
vanCascader: {
|
30
|
-
select: "\
|
30
|
+
select: "\u041E\u0431\u0440\u0430\u0442\u0438"
|
31
31
|
},
|
32
32
|
vanPagination: {
|
33
|
-
prev: "\u041F\u043E\
|
33
|
+
prev: "\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438\u0441\u044F",
|
34
34
|
next: "\u0414\u0430\u043B\u0456"
|
35
35
|
},
|
36
36
|
vanPullRefresh: {
|
37
37
|
pulling: "\u041F\u043E\u0442\u044F\u0433\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u043E\u043D\u043E\u0432\u0438\u0442\u0438...",
|
38
|
-
loosing: "\
|
38
|
+
loosing: "\u0412\u0456\u0434\u043F\u0443\u0441\u0442\u0456\u0442\u044C, \u0449\u043E\u0431 \u043E\u043D\u043E\u0432\u0438\u0442\u0438..."
|
39
39
|
},
|
40
40
|
vanSubmitBar: {
|
41
41
|
label: "\u0423\u0441\u044C\u043E\u0433\u043E:"
|
@@ -54,11 +54,11 @@ var stdin_default = {
|
|
54
54
|
close: "\u0417\u0430\u043A\u0440\u0438\u0442\u0438",
|
55
55
|
enable: "\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E",
|
56
56
|
disabled: "\u041D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E",
|
57
|
-
placeholder: "\u041A\u043E\u0434 \u043A\u0443\u043F\u043E\u043D\
|
57
|
+
placeholder: "\u041A\u043E\u0434 \u043A\u0443\u043F\u043E\u043D\u0443"
|
58
58
|
},
|
59
59
|
vanAddressEdit: {
|
60
60
|
area: "\u041E\u0431\u043B\u0430\u0441\u0442\u044C",
|
61
|
-
areaEmpty: "\u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \
|
61
|
+
areaEmpty: "\u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u043E\u0431\u0435\u0440\u0456\u0442\u044C \u0437\u043E\u043D\u0443 \u043F\u0440\u0438\u0439\u043E\u043C\u0443",
|
62
62
|
addressEmpty: "\u0410\u0434\u0440\u0435\u0441\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0431\u0443\u0442\u0438 \u043F\u043E\u0440\u043E\u0436\u043D\u044C\u043E\u044E",
|
63
63
|
addressDetail: "\u0410\u0434\u0440\u0435\u0441\u0430",
|
64
64
|
defaultAddress: "\u0412\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438 \u044F\u043A \u0430\u0434\u0440\u0435\u0441\u0443 \u0437\u0430 \u0437\u0430\u043C\u043E\u0432\u0447\u0443\u0432\u0430\u043D\u043D\u044F\u043C"
|
package/es/swipe/Swipe.mjs
CHANGED
@@ -229,7 +229,9 @@ var stdin_default = defineComponent({
|
|
229
229
|
offset: delta.value
|
230
230
|
});
|
231
231
|
if (!dragging) {
|
232
|
-
emit("dragStart"
|
232
|
+
emit("dragStart", {
|
233
|
+
index: activeIndicator.value
|
234
|
+
});
|
233
235
|
dragging = true;
|
234
236
|
}
|
235
237
|
}
|
@@ -262,7 +264,9 @@ var stdin_default = defineComponent({
|
|
262
264
|
}
|
263
265
|
dragging = false;
|
264
266
|
state.swiping = false;
|
265
|
-
emit("dragEnd"
|
267
|
+
emit("dragEnd", {
|
268
|
+
index: activeIndicator.value
|
269
|
+
});
|
266
270
|
autoplay();
|
267
271
|
};
|
268
272
|
const swipeTo = (index, options = {}) => {
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { type ExtractPropTypes } from 'vue';
|
2
|
+
export declare const textEllipsisProps: {
|
3
|
+
rows: {
|
4
|
+
type: (NumberConstructor | StringConstructor)[];
|
5
|
+
default: number;
|
6
|
+
};
|
7
|
+
content: {
|
8
|
+
type: import("vue").PropType<string>;
|
9
|
+
default: string;
|
10
|
+
};
|
11
|
+
expandText: {
|
12
|
+
type: import("vue").PropType<string>;
|
13
|
+
default: string;
|
14
|
+
};
|
15
|
+
collapseText: {
|
16
|
+
type: import("vue").PropType<string>;
|
17
|
+
default: string;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
export type TextEllipsisProps = ExtractPropTypes<typeof textEllipsisProps>;
|
21
|
+
declare const _default: import("vue").DefineComponent<{
|
22
|
+
rows: {
|
23
|
+
type: (NumberConstructor | StringConstructor)[];
|
24
|
+
default: number;
|
25
|
+
};
|
26
|
+
content: {
|
27
|
+
type: import("vue").PropType<string>;
|
28
|
+
default: string;
|
29
|
+
};
|
30
|
+
expandText: {
|
31
|
+
type: import("vue").PropType<string>;
|
32
|
+
default: string;
|
33
|
+
};
|
34
|
+
collapseText: {
|
35
|
+
type: import("vue").PropType<string>;
|
36
|
+
default: string;
|
37
|
+
};
|
38
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
39
|
+
rows: {
|
40
|
+
type: (NumberConstructor | StringConstructor)[];
|
41
|
+
default: number;
|
42
|
+
};
|
43
|
+
content: {
|
44
|
+
type: import("vue").PropType<string>;
|
45
|
+
default: string;
|
46
|
+
};
|
47
|
+
expandText: {
|
48
|
+
type: import("vue").PropType<string>;
|
49
|
+
default: string;
|
50
|
+
};
|
51
|
+
collapseText: {
|
52
|
+
type: import("vue").PropType<string>;
|
53
|
+
default: string;
|
54
|
+
};
|
55
|
+
}>> & {
|
56
|
+
onClickAction?: ((...args: any[]) => any) | undefined;
|
57
|
+
}, {
|
58
|
+
content: string;
|
59
|
+
rows: string | number;
|
60
|
+
expandText: string;
|
61
|
+
collapseText: string;
|
62
|
+
}>;
|
63
|
+
export default _default;
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
2
|
+
import { ref, watch, onMounted, defineComponent } from "vue";
|
3
|
+
import { useEventListener } from "@vant/use";
|
4
|
+
import { makeNumericProp, makeStringProp, createNamespace } from "../utils/index.mjs";
|
5
|
+
const [name, bem] = createNamespace("text-ellipsis");
|
6
|
+
const textEllipsisProps = {
|
7
|
+
rows: makeNumericProp(1),
|
8
|
+
content: makeStringProp(""),
|
9
|
+
expandText: makeStringProp(""),
|
10
|
+
collapseText: makeStringProp("")
|
11
|
+
};
|
12
|
+
var stdin_default = defineComponent({
|
13
|
+
name,
|
14
|
+
props: textEllipsisProps,
|
15
|
+
emits: ["clickAction"],
|
16
|
+
setup(props, {
|
17
|
+
emit
|
18
|
+
}) {
|
19
|
+
const text = ref("");
|
20
|
+
const expanded = ref(false);
|
21
|
+
const hasAction = ref(false);
|
22
|
+
const root = ref();
|
23
|
+
const pxToNum = (value) => {
|
24
|
+
if (!value)
|
25
|
+
return 0;
|
26
|
+
const match = value.match(/^\d*(\.\d*)?/);
|
27
|
+
return match ? Number(match[0]) : 0;
|
28
|
+
};
|
29
|
+
const calcEllipsised = () => {
|
30
|
+
const cloneContainer = () => {
|
31
|
+
if (!root.value)
|
32
|
+
return;
|
33
|
+
const originStyle = window.getComputedStyle(root.value);
|
34
|
+
const container2 = document.createElement("div");
|
35
|
+
const styleNames = Array.prototype.slice.apply(originStyle);
|
36
|
+
styleNames.forEach((name2) => {
|
37
|
+
container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
|
38
|
+
});
|
39
|
+
container2.style.position = "fixed";
|
40
|
+
container2.style.zIndex = "-9999";
|
41
|
+
container2.style.top = "-9999px";
|
42
|
+
container2.style.height = "auto";
|
43
|
+
container2.style.minHeight = "auto";
|
44
|
+
container2.style.maxHeight = "auto";
|
45
|
+
container2.innerText = props.content;
|
46
|
+
document.body.appendChild(container2);
|
47
|
+
return container2;
|
48
|
+
};
|
49
|
+
const calcEllipsisText = (container2, maxHeight2) => {
|
50
|
+
const {
|
51
|
+
content,
|
52
|
+
expandText
|
53
|
+
} = props;
|
54
|
+
const dot = "...";
|
55
|
+
let left = 0;
|
56
|
+
let right = content.length;
|
57
|
+
let res = -1;
|
58
|
+
while (left <= right) {
|
59
|
+
const mid = Math.floor((left + right) / 2);
|
60
|
+
container2.innerText = content.slice(0, mid) + dot + expandText;
|
61
|
+
if (container2.offsetHeight <= maxHeight2) {
|
62
|
+
left = mid + 1;
|
63
|
+
res = mid;
|
64
|
+
} else {
|
65
|
+
right = mid - 1;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return content.slice(0, res) + dot;
|
69
|
+
};
|
70
|
+
const container = cloneContainer();
|
71
|
+
if (!container)
|
72
|
+
return;
|
73
|
+
const {
|
74
|
+
paddingBottom,
|
75
|
+
paddingTop,
|
76
|
+
lineHeight
|
77
|
+
} = container.style;
|
78
|
+
const maxHeight = (Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
|
79
|
+
if (maxHeight < container.offsetHeight) {
|
80
|
+
hasAction.value = true;
|
81
|
+
text.value = calcEllipsisText(container, maxHeight);
|
82
|
+
} else {
|
83
|
+
hasAction.value = false;
|
84
|
+
text.value = props.content;
|
85
|
+
}
|
86
|
+
document.body.removeChild(container);
|
87
|
+
};
|
88
|
+
const onClickAction = (event) => {
|
89
|
+
expanded.value = !expanded.value;
|
90
|
+
emit("clickAction", event);
|
91
|
+
};
|
92
|
+
const renderAction = () => _createVNode("span", {
|
93
|
+
"class": bem("action"),
|
94
|
+
"onClick": onClickAction
|
95
|
+
}, [expanded.value ? props.collapseText : props.expandText]);
|
96
|
+
onMounted(calcEllipsised);
|
97
|
+
watch(() => [props.content, props.rows], calcEllipsised);
|
98
|
+
useEventListener("resize", calcEllipsised);
|
99
|
+
return () => _createVNode("div", {
|
100
|
+
"ref": root,
|
101
|
+
"class": bem()
|
102
|
+
}, [expanded.value ? props.content : text.value, hasAction.value ? renderAction() : null]);
|
103
|
+
}
|
104
|
+
});
|
105
|
+
export {
|
106
|
+
stdin_default as default,
|
107
|
+
textEllipsisProps
|
108
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--van-text-ellipsis-line-height: 1.6;--van-text-ellipsis-action-color: var(--van-blue)}.van-text-ellipsis{line-height:var(--van-text-ellipsis-line-height);white-space:pre-wrap}.van-text-ellipsis__action{cursor:pointer;color:var(--van-text-ellipsis-action-color)}.van-text-ellipsis__action:active{opacity:var(--van-active-opacity)}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
export declare const TextEllipsis: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
+
rows: {
|
3
|
+
type: (NumberConstructor | StringConstructor)[];
|
4
|
+
default: number;
|
5
|
+
};
|
6
|
+
content: {
|
7
|
+
type: import("vue").PropType<string>;
|
8
|
+
default: string;
|
9
|
+
};
|
10
|
+
expandText: {
|
11
|
+
type: import("vue").PropType<string>;
|
12
|
+
default: string;
|
13
|
+
};
|
14
|
+
collapseText: {
|
15
|
+
type: import("vue").PropType<string>;
|
16
|
+
default: string;
|
17
|
+
};
|
18
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
19
|
+
rows: {
|
20
|
+
type: (NumberConstructor | StringConstructor)[];
|
21
|
+
default: number;
|
22
|
+
};
|
23
|
+
content: {
|
24
|
+
type: import("vue").PropType<string>;
|
25
|
+
default: string;
|
26
|
+
};
|
27
|
+
expandText: {
|
28
|
+
type: import("vue").PropType<string>;
|
29
|
+
default: string;
|
30
|
+
};
|
31
|
+
collapseText: {
|
32
|
+
type: import("vue").PropType<string>;
|
33
|
+
default: string;
|
34
|
+
};
|
35
|
+
}>> & {
|
36
|
+
onClickAction?: ((...args: any[]) => any) | undefined;
|
37
|
+
}, {
|
38
|
+
content: string;
|
39
|
+
rows: string | number;
|
40
|
+
expandText: string;
|
41
|
+
collapseText: string;
|
42
|
+
}>>;
|
43
|
+
export default TextEllipsis;
|
44
|
+
export { textEllipsisProps } from './TextEllipsis';
|
45
|
+
export type { TextEllipsisProps } from './TextEllipsis';
|
46
|
+
export type { TextEllipsisThemeVars } from './types';
|
47
|
+
declare module 'vue' {
|
48
|
+
interface GlobalComponents {
|
49
|
+
VanTextEllipsis: typeof TextEllipsis;
|
50
|
+
}
|
51
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { withInstall } from "../utils/index.mjs";
|
2
|
+
import _TextEllipsis from "./TextEllipsis.mjs";
|
3
|
+
const TextEllipsis = withInstall(_TextEllipsis);
|
4
|
+
var stdin_default = TextEllipsis;
|
5
|
+
import { textEllipsisProps } from "./TextEllipsis.mjs";
|
6
|
+
export {
|
7
|
+
TextEllipsis,
|
8
|
+
stdin_default as default,
|
9
|
+
textEllipsisProps
|
10
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
File without changes
|
@@ -64,12 +64,13 @@ var stdin_default = defineComponent({
|
|
64
64
|
const renderSidebar = () => {
|
65
65
|
const Items = props.items.map((item) => _createVNode(SidebarItem, {
|
66
66
|
"dot": item.dot,
|
67
|
-
"title": item.text,
|
68
67
|
"badge": item.badge,
|
69
68
|
"class": [bem("nav-item"), item.className],
|
70
69
|
"disabled": item.disabled,
|
71
70
|
"onClick": onClickSidebarItem
|
72
|
-
},
|
71
|
+
}, {
|
72
|
+
title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
|
73
|
+
}));
|
73
74
|
return _createVNode(Sidebar, {
|
74
75
|
"class": bem("nav"),
|
75
76
|
"modelValue": props.mainActiveIndex,
|
@@ -86,7 +86,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
86
86
|
const toggleItem = (active) => {
|
87
87
|
children.forEach((item, index) => {
|
88
88
|
if (index === active) {
|
89
|
-
updateOffset();
|
90
89
|
item.toggle();
|
91
90
|
} else if (item.state.showPopup) {
|
92
91
|
item.toggle(false, {
|
@@ -132,7 +131,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
132
131
|
linkChildren({
|
133
132
|
id,
|
134
133
|
props,
|
135
|
-
offset
|
134
|
+
offset,
|
135
|
+
updateOffset
|
136
136
|
});
|
137
137
|
(0, import_use.useClickAway)(root, onClickAway);
|
138
138
|
(0, import_use.useEventListener)("scroll", onScroll, {
|
package/lib/field/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{
|
1
|
+
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field--label-top .van-field__value{flex:none;width:100%}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{margin-bottom:var(--van-padding-base)}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
|