vdesign-ui 0.1.17 → 0.1.19
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/dist/css/chunk-1952c402.04c2303e.css +1 -0
- package/dist/css/chunk-6a5c6104.38021b56.css +1 -0
- package/dist/css/chunk-vendors.4ecfba63.css +1 -0
- package/dist/css/sites.395ce21f.css +1 -0
- package/dist/img/404-dark.775df5bb.png +0 -0
- package/dist/img/bg_mobile.5909f667.png +0 -0
- package/dist/img/completed-dark.4183a8a8.png +0 -0
- package/dist/img/error-dark.b80857da.png +0 -0
- package/dist/img/icon.a67073c3.svg +7 -0
- package/dist/img/iphoneX.38c8778e.png +0 -0
- package/dist/img/logo-white.fad4f907.png +0 -0
- package/dist/img/logo.1eda11d6.png +0 -0
- package/dist/img/network-dark.11a147bb.png +0 -0
- package/dist/img/nodata-dark.b0ea0e39.png +0 -0
- package/dist/img/qrcode2.0a9d9044.png +0 -0
- package/dist/img/wait-dark.6aa28731.png +0 -0
- package/dist/index.html +1 -0
- package/dist/js/chunk-1952c402.c58ecfb5.js +1 -0
- package/dist/js/chunk-2d2183be.2a64419d.js +1 -0
- package/dist/js/chunk-6a5c6104.c8fa5635.js +1 -0
- package/dist/js/chunk-vendors.490b7673.js +37 -0
- package/dist/js/sites.5a217467.js +1 -0
- package/package.json +3 -3
- package/dist/components/actionbar/actionbar-cell/index.vue +0 -34
- package/dist/components/actionbar/index.js +0 -8
- package/dist/components/actionbar/index.vue +0 -39
- package/dist/components/actionbar/style.less +0 -48
- package/dist/components/actions-cell/actions/index.js +0 -7
- package/dist/components/actions-cell/actions/index.vue +0 -68
- package/dist/components/actions-cell/actions/style.less +0 -94
- package/dist/components/actions-cell/index.js +0 -7
- package/dist/components/actions-cell/index.vue +0 -94
- package/dist/components/actions-cell/style.less +0 -39
- package/dist/components/activityviews/index.js +0 -8
- package/dist/components/activityviews/index.vue +0 -107
- package/dist/components/activityviews/style.less +0 -152
- package/dist/components/badge/index.js +0 -8
- package/dist/components/badge/index.vue +0 -49
- package/dist/components/badge/style.less +0 -66
- package/dist/components/button/index.js +0 -8
- package/dist/components/button/index.vue +0 -89
- package/dist/components/button/style.less +0 -563
- package/dist/components/calendar/end.png +0 -0
- package/dist/components/calendar/index-element.vue +0 -84
- package/dist/components/calendar/index.js +0 -8
- package/dist/components/calendar/index.vue +0 -52
- package/dist/components/calendar/start.png +0 -0
- package/dist/components/calendar/style.less +0 -167
- package/dist/components/checkbox/assist.js +0 -34
- package/dist/components/checkbox/checkbox-group/index.js +0 -8
- package/dist/components/checkbox/checkbox-group/index.vue +0 -69
- package/dist/components/checkbox/index.js +0 -8
- package/dist/components/checkbox/index.vue +0 -184
- package/dist/components/checkbox/style.less +0 -289
- package/dist/components/common/state/index.vue +0 -80
- package/dist/components/data-list/index.js +0 -10
- package/dist/components/data-list/index.vue +0 -19
- package/dist/components/data-list/style.less +0 -624
- package/dist/components/datetime-picker/index.js +0 -8
- package/dist/components/datetime-picker/index.vue +0 -37
- package/dist/components/datetime-picker/style.less +0 -24
- package/dist/components/dialog/index copy.vue +0 -112
- package/dist/components/dialog/index.js +0 -8
- package/dist/components/dialog/index.vue +0 -112
- package/dist/components/dialog/style.less +0 -122
- package/dist/components/divider/index.js +0 -8
- package/dist/components/divider/index.vue +0 -54
- package/dist/components/divider/style.less +0 -92
- package/dist/components/dropdown/index.js +0 -8
- package/dist/components/dropdown/index.vue +0 -210
- package/dist/components/dropdown/style.less +0 -402
- package/dist/components/empty/empty-404.png +0 -0
- package/dist/components/empty/empty-img.png +0 -0
- package/dist/components/empty/empty-network.png +0 -0
- package/dist/components/empty/index.js +0 -8
- package/dist/components/empty/index.vue +0 -65
- package/dist/components/empty/style.less +0 -53
- package/dist/components/footer/index.js +0 -7
- package/dist/components/footer/index.vue +0 -29
- package/dist/components/footer/style.less +0 -22
- package/dist/components/footnav/footnav-item/index.js +0 -7
- package/dist/components/footnav/footnav-item/index.vue +0 -75
- package/dist/components/footnav/footnav-item/style.less +0 -39
- package/dist/components/footnav/index.js +0 -7
- package/dist/components/footnav/index.vue +0 -82
- package/dist/components/footnav/style.less +0 -22
- package/dist/components/form/index.js +0 -7
- package/dist/components/form/index.vue +0 -12
- package/dist/components/headnav/index.js +0 -7
- package/dist/components/headnav/index.vue +0 -139
- package/dist/components/headnav/style.less +0 -232
- package/dist/components/icon/font/iconfont.css +0 -817
- package/dist/components/icon/font/iconfont.js +0 -2
- package/dist/components/icon/index.js +0 -9
- package/dist/components/icon/index.vue +0 -46
- package/dist/components/icon/style.less +0 -44
- package/dist/components/input/calcTextareaHeight.js +0 -266
- package/dist/components/input/index.js +0 -8
- package/dist/components/input/index.vue +0 -343
- package/dist/components/input/password/index.js +0 -8
- package/dist/components/input/password/index.vue +0 -60
- package/dist/components/input/search/index.js +0 -8
- package/dist/components/input/search/index.vue +0 -66
- package/dist/components/input/stepper/index.js +0 -8
- package/dist/components/input/stepper/index.vue +0 -136
- package/dist/components/input/style.less +0 -496
- package/dist/components/list/index.js +0 -8
- package/dist/components/list/index.vue +0 -159
- package/dist/components/list/style.less +0 -292
- package/dist/components/loading/index.js +0 -7
- package/dist/components/loading/index.vue +0 -53
- package/dist/components/loading/loading.png +0 -0
- package/dist/components/loading/refresh.png +0 -0
- package/dist/components/loading/style.less +0 -48
- package/dist/components/mixins/clickoutside.js +0 -81
- package/dist/components/mixins/dom.js +0 -41
- package/dist/components/mixins/languageMixin.js +0 -38
- package/dist/components/mixins/outlineConfigPlugin.js +0 -40
- package/dist/components/mixins/router-link.js +0 -23
- package/dist/components/noticebar/index.js +0 -8
- package/dist/components/noticebar/index.vue +0 -246
- package/dist/components/noticebar/style.less +0 -309
- package/dist/components/overlay/index.js +0 -8
- package/dist/components/overlay/index.vue +0 -161
- package/dist/components/overlay/style.less +0 -23
- package/dist/components/pagebreak/index.js +0 -7
- package/dist/components/pagebreak/index.vue +0 -60
- package/dist/components/pagebreak/style.less +0 -43
- package/dist/components/popover/index.js +0 -8
- package/dist/components/popover/index.vue +0 -99
- package/dist/components/popover/style.less +0 -349
- package/dist/components/popover/vue-popover.vue +0 -314
- package/dist/components/radio/assist.js +0 -34
- package/dist/components/radio/index.js +0 -8
- package/dist/components/radio/index.vue +0 -159
- package/dist/components/radio/radio-group/index.vue +0 -70
- package/dist/components/radio/style.less +0 -297
- package/dist/components/result/completed.png +0 -0
- package/dist/components/result/error.png +0 -0
- package/dist/components/result/index.js +0 -8
- package/dist/components/result/index.vue +0 -47
- package/dist/components/result/style.less +0 -42
- package/dist/components/result/wait.png +0 -0
- package/dist/components/selector/index.js +0 -8
- package/dist/components/selector/index.vue +0 -124
- package/dist/components/selector/style.less +0 -474
- package/dist/components/skeleton/index.js +0 -7
- package/dist/components/skeleton/index.vue +0 -142
- package/dist/components/skeleton/style.less +0 -192
- package/dist/components/slider/draggable.js +0 -49
- package/dist/components/slider/index.js +0 -7
- package/dist/components/slider/index.vue +0 -173
- package/dist/components/slider/style.less +0 -95
- package/dist/components/slider/utils.js +0 -60
- package/dist/components/step/index.js +0 -7
- package/dist/components/step/index.vue +0 -48
- package/dist/components/step/style.less +0 -59
- package/dist/components/step-item/index.js +0 -7
- package/dist/components/step-item/index.vue +0 -89
- package/dist/components/step-item/style.less +0 -361
- package/dist/components/style/index.vue +0 -42
- package/dist/components/switch/index.js +0 -8
- package/dist/components/switch/index.vue +0 -72
- package/dist/components/switch/style.less +0 -54
- package/dist/components/tabs/index.js +0 -8
- package/dist/components/tabs/index.vue +0 -145
- package/dist/components/tabs/style.less +0 -383
- package/dist/components/tabs/tab/index.vue +0 -56
- package/dist/components/tag/index.js +0 -7
- package/dist/components/tag/index.vue +0 -50
- package/dist/components/tag/style.less +0 -211
- package/dist/components/title/index.js +0 -8
- package/dist/components/title/index.vue +0 -92
- package/dist/components/title/style.less +0 -188
- package/dist/components/toast/index.js +0 -80
- package/dist/components/toast/index.vue +0 -44
- package/dist/components/toast/style.less +0 -55
- package/dist/components/transition/index.js +0 -8
- package/dist/components/transition/index.vue +0 -13
- package/dist/components/transition/style.less +0 -208
- package/dist/components/upload/index.js +0 -7
- package/dist/components/upload/index.vue +0 -224
- package/dist/components/upload/style.less +0 -156
- package/dist/demo.html +0 -10
- package/dist/locale/ar.js +0 -98
- package/dist/locale/en.js +0 -98
- package/dist/locale/zh.js +0 -98
- package/dist/token.css +0 -2973
- package/dist/vdesign-ui.common.js +0 -26919
- package/dist/vdesign-ui.css +0 -1
- package/dist/vdesign-ui.umd.js +0 -26929
- package/dist/vdesign-ui.umd.min.js +0 -32
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
.vd-iconfont {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
background-size: contain;
|
|
4
|
-
fill: currentColor;
|
|
5
|
-
backface-visibility: hidden;
|
|
6
|
-
transform: translateZ(0) scale(1, 1);
|
|
7
|
-
// font-family: "Icon" !important;
|
|
8
|
-
font-size: calc(var(--icon-medium) * 1px);
|
|
9
|
-
font-style: normal;
|
|
10
|
-
font-weight: normal;
|
|
11
|
-
font-variant: normal;
|
|
12
|
-
text-transform: none;
|
|
13
|
-
line-height: 1;
|
|
14
|
-
letter-spacing: 0;
|
|
15
|
-
-webkit-font-smoothing: antialiased;
|
|
16
|
-
-moz-osx-font-smoothing: grayscale;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.vd-svg-icon {
|
|
20
|
-
width: 1em;
|
|
21
|
-
height: 1em;
|
|
22
|
-
vertical-align: -0.15em;
|
|
23
|
-
fill: currentColor;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.vd-img-icon {
|
|
28
|
-
display: block;
|
|
29
|
-
width: 1em;
|
|
30
|
-
height: 1em;
|
|
31
|
-
object-fit: contain;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.vd-icon-small {
|
|
35
|
-
font-size: calc(var(--icon-small) * 1px);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.vd-icon-medium {
|
|
39
|
-
font-size: calc(var(--icon-medium) * 1px);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.vd-icon-large {
|
|
43
|
-
font-size: calc(var(--icon-large) * 1px);
|
|
44
|
-
}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
// Thanks to
|
|
2
|
-
// https://github.com/andreypopp/react-textarea-autosize/
|
|
3
|
-
|
|
4
|
-
// let hiddenTextarea;
|
|
5
|
-
//
|
|
6
|
-
// const HIDDEN_STYLE = `
|
|
7
|
-
// height:0 !important;
|
|
8
|
-
// min-height:0 !important;
|
|
9
|
-
// max-height:none !important;
|
|
10
|
-
// visibility:hidden !important;
|
|
11
|
-
// overflow:hidden !important;
|
|
12
|
-
// position:absolute !important;
|
|
13
|
-
// z-index:-1000 !important;
|
|
14
|
-
// top:0 !important;
|
|
15
|
-
// right:0 !important
|
|
16
|
-
// `;
|
|
17
|
-
//
|
|
18
|
-
// const CONTEXT_STYLE = [
|
|
19
|
-
// 'letter-spacing',
|
|
20
|
-
// 'line-height',
|
|
21
|
-
// 'padding-top',
|
|
22
|
-
// 'padding-bottom',
|
|
23
|
-
// 'font-family',
|
|
24
|
-
// 'font-weight',
|
|
25
|
-
// 'font-size',
|
|
26
|
-
// 'text-rendering',
|
|
27
|
-
// 'text-transform',
|
|
28
|
-
// 'width',
|
|
29
|
-
// 'text-indent',
|
|
30
|
-
// 'padding-left',
|
|
31
|
-
// 'padding-right',
|
|
32
|
-
// 'border-width',
|
|
33
|
-
// 'box-sizing'
|
|
34
|
-
// ];
|
|
35
|
-
//
|
|
36
|
-
// function calculateNodeStyling(node) {
|
|
37
|
-
// const style = window.getComputedStyle(node);
|
|
38
|
-
//
|
|
39
|
-
// const boxSizing = style.getPropertyValue('box-sizing');
|
|
40
|
-
//
|
|
41
|
-
// const paddingSize = (
|
|
42
|
-
// parseFloat(style.getPropertyValue('padding-bottom')) +
|
|
43
|
-
// parseFloat(style.getPropertyValue('padding-top'))
|
|
44
|
-
// );
|
|
45
|
-
//
|
|
46
|
-
// const borderSize = (
|
|
47
|
-
// parseFloat(style.getPropertyValue('border-bottom-width')) +
|
|
48
|
-
// parseFloat(style.getPropertyValue('border-top-width'))
|
|
49
|
-
// );
|
|
50
|
-
//
|
|
51
|
-
// const contextStyle = CONTEXT_STYLE
|
|
52
|
-
// .map(name => `${name}:${style.getPropertyValue(name)}`)
|
|
53
|
-
// .join(';');
|
|
54
|
-
//
|
|
55
|
-
// return {contextStyle, paddingSize, borderSize, boxSizing};
|
|
56
|
-
// }
|
|
57
|
-
//
|
|
58
|
-
// export default function calcTextareaHeight(targetNode, minRows = null, maxRows = null) {
|
|
59
|
-
// if (!hiddenTextarea) {
|
|
60
|
-
// hiddenTextarea = document.createElement('textarea');
|
|
61
|
-
// document.body.appendChild(hiddenTextarea);
|
|
62
|
-
// }
|
|
63
|
-
//
|
|
64
|
-
// let {
|
|
65
|
-
// paddingSize,
|
|
66
|
-
// borderSize,
|
|
67
|
-
// boxSizing,
|
|
68
|
-
// contextStyle
|
|
69
|
-
// } = calculateNodeStyling(targetNode);
|
|
70
|
-
//
|
|
71
|
-
// hiddenTextarea.setAttribute('style', `${contextStyle};${HIDDEN_STYLE}`);
|
|
72
|
-
// hiddenTextarea.value = targetNode.value || targetNode.placeholder || '';
|
|
73
|
-
//
|
|
74
|
-
// let height = hiddenTextarea.scrollHeight;
|
|
75
|
-
// let minHeight = -Infinity;
|
|
76
|
-
// let maxHeight = Infinity;
|
|
77
|
-
// let overflowY;
|
|
78
|
-
//
|
|
79
|
-
// if (boxSizing === 'border-box') {
|
|
80
|
-
// height = height + borderSize;
|
|
81
|
-
// } else if (boxSizing === 'content-box') {
|
|
82
|
-
// height = height - paddingSize;
|
|
83
|
-
// }
|
|
84
|
-
//
|
|
85
|
-
// hiddenTextarea.value = '';
|
|
86
|
-
// let singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
87
|
-
//
|
|
88
|
-
// if (minRows !== null) {
|
|
89
|
-
// minHeight = singleRowHeight * minRows;
|
|
90
|
-
// if (boxSizing === 'border-box') {
|
|
91
|
-
// minHeight = minHeight + paddingSize + borderSize;
|
|
92
|
-
// }
|
|
93
|
-
// height = Math.max(minHeight, height);
|
|
94
|
-
// }
|
|
95
|
-
// if (maxRows !== null) {
|
|
96
|
-
// maxHeight = singleRowHeight * maxRows;
|
|
97
|
-
// if (boxSizing === 'border-box') {
|
|
98
|
-
// maxHeight = maxHeight + paddingSize + borderSize;
|
|
99
|
-
// }
|
|
100
|
-
// overflowY = height > maxHeight ? '' : 'hidden';
|
|
101
|
-
// height = Math.min(maxHeight, height);
|
|
102
|
-
// }
|
|
103
|
-
//
|
|
104
|
-
// if (!maxRows) {
|
|
105
|
-
// overflowY = 'hidden';
|
|
106
|
-
// }
|
|
107
|
-
//
|
|
108
|
-
// return {
|
|
109
|
-
// height: `${height}px`,
|
|
110
|
-
// minHeight: `${minHeight}px`,
|
|
111
|
-
// maxHeight: `${maxHeight}px`,
|
|
112
|
-
// overflowY
|
|
113
|
-
// };
|
|
114
|
-
// }
|
|
115
|
-
|
|
116
|
-
const HIDDEN_TEXTAREA_STYLE = `
|
|
117
|
-
min-height:0 !important;
|
|
118
|
-
max-height:none !important;
|
|
119
|
-
height:0 !important;
|
|
120
|
-
visibility:hidden !important;
|
|
121
|
-
overflow:hidden !important;
|
|
122
|
-
position:absolute !important;
|
|
123
|
-
z-index:-1000 !important;
|
|
124
|
-
top:0 !important;
|
|
125
|
-
right:0 !important
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
|
-
const SIZING_STYLE = [
|
|
129
|
-
'letter-spacing',
|
|
130
|
-
'line-height',
|
|
131
|
-
'padding-top',
|
|
132
|
-
'padding-bottom',
|
|
133
|
-
'font-family',
|
|
134
|
-
'font-weight',
|
|
135
|
-
'font-size',
|
|
136
|
-
'text-rendering',
|
|
137
|
-
'text-transform',
|
|
138
|
-
'width',
|
|
139
|
-
'text-indent',
|
|
140
|
-
'padding-left',
|
|
141
|
-
'padding-right',
|
|
142
|
-
'border-width',
|
|
143
|
-
'box-sizing',
|
|
144
|
-
];
|
|
145
|
-
|
|
146
|
-
let computedStyleCache = {};
|
|
147
|
-
let hiddenTextarea;
|
|
148
|
-
|
|
149
|
-
function calculateNodeStyling(node, useCache = false) {
|
|
150
|
-
const nodeRef = (
|
|
151
|
-
node.getAttribute('id') ||
|
|
152
|
-
node.getAttribute('data-reactid') ||
|
|
153
|
-
node.getAttribute('name'));
|
|
154
|
-
|
|
155
|
-
if (useCache && computedStyleCache[nodeRef]) {
|
|
156
|
-
return computedStyleCache[nodeRef];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const style = window.getComputedStyle(node);
|
|
160
|
-
|
|
161
|
-
const boxSizing = (
|
|
162
|
-
style.getPropertyValue('box-sizing') ||
|
|
163
|
-
style.getPropertyValue('-moz-box-sizing') ||
|
|
164
|
-
style.getPropertyValue('-webkit-box-sizing')
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const paddingSize = (
|
|
168
|
-
parseFloat(style.getPropertyValue('padding-bottom')) +
|
|
169
|
-
parseFloat(style.getPropertyValue('padding-top'))
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
const borderSize = (
|
|
173
|
-
parseFloat(style.getPropertyValue('border-bottom-width')) +
|
|
174
|
-
parseFloat(style.getPropertyValue('border-top-width'))
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const sizingStyle = SIZING_STYLE
|
|
178
|
-
.map(name => `${name}:${style.getPropertyValue(name)}`)
|
|
179
|
-
.join(';');
|
|
180
|
-
|
|
181
|
-
const nodeInfo = {
|
|
182
|
-
sizingStyle,
|
|
183
|
-
paddingSize,
|
|
184
|
-
borderSize,
|
|
185
|
-
boxSizing,
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
if (useCache && nodeRef) {
|
|
189
|
-
computedStyleCache[nodeRef] = nodeInfo;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return nodeInfo;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export default function calcTextareaHeight(uiTextNode, minRows = null, maxRows = null, useCache = false) {
|
|
196
|
-
if (!hiddenTextarea) {
|
|
197
|
-
hiddenTextarea = document.createElement('textarea');
|
|
198
|
-
document.body.appendChild(hiddenTextarea);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Fix wrap="off" issue
|
|
202
|
-
// https://github.com/ant-design/ant-design/issues/6577
|
|
203
|
-
if (uiTextNode.getAttribute('wrap')) {
|
|
204
|
-
hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));
|
|
205
|
-
} else {
|
|
206
|
-
hiddenTextarea.removeAttribute('wrap');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Copy all CSS properties that have an impact on the height of the content in
|
|
210
|
-
// the textbox
|
|
211
|
-
let {
|
|
212
|
-
paddingSize, borderSize,
|
|
213
|
-
boxSizing, sizingStyle,
|
|
214
|
-
} = calculateNodeStyling(uiTextNode, useCache);
|
|
215
|
-
|
|
216
|
-
// Need to have the overflow attribute to hide the scrollbar otherwise
|
|
217
|
-
// text-lines will not calculated properly as the shadow will technically be
|
|
218
|
-
// narrower for content
|
|
219
|
-
hiddenTextarea.setAttribute('style', `${sizingStyle};${HIDDEN_TEXTAREA_STYLE}`);
|
|
220
|
-
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';
|
|
221
|
-
|
|
222
|
-
let minHeight = Number.MIN_SAFE_INTEGER;
|
|
223
|
-
let maxHeight = Number.MAX_SAFE_INTEGER;
|
|
224
|
-
let height = hiddenTextarea.scrollHeight;
|
|
225
|
-
let overflowY;
|
|
226
|
-
|
|
227
|
-
if (boxSizing === 'border-box') {
|
|
228
|
-
// border-box: add border, since height = content + padding + border
|
|
229
|
-
height = height + borderSize;
|
|
230
|
-
} else if (boxSizing === 'content-box') {
|
|
231
|
-
// remove padding, since height = content
|
|
232
|
-
height = height - paddingSize;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (minRows !== null || maxRows !== null) {
|
|
236
|
-
// measure height of a textarea with a single row
|
|
237
|
-
hiddenTextarea.value = ' ';
|
|
238
|
-
let singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
239
|
-
if (minRows !== null) {
|
|
240
|
-
minHeight = singleRowHeight * minRows;
|
|
241
|
-
if (boxSizing === 'border-box') {
|
|
242
|
-
minHeight = minHeight + paddingSize + borderSize;
|
|
243
|
-
}
|
|
244
|
-
height = Math.max(minHeight, height);
|
|
245
|
-
}
|
|
246
|
-
if (maxRows !== null) {
|
|
247
|
-
maxHeight = singleRowHeight * maxRows;
|
|
248
|
-
if (boxSizing === 'border-box') {
|
|
249
|
-
maxHeight = maxHeight + paddingSize + borderSize;
|
|
250
|
-
}
|
|
251
|
-
overflowY = height > maxHeight ? '' : 'hidden';
|
|
252
|
-
height = Math.min(maxHeight, height);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
// Remove scroll bar flash when autosize without maxRows
|
|
256
|
-
if (!maxRows) {
|
|
257
|
-
overflowY = 'hidden';
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return {
|
|
261
|
-
height: `${height}px`,
|
|
262
|
-
minHeight: `${minHeight}px`,
|
|
263
|
-
maxHeight: `${maxHeight}px`,
|
|
264
|
-
overflowY
|
|
265
|
-
};
|
|
266
|
-
}
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="wrapClasses" class="vd-input">
|
|
3
|
-
<template v-if="inputTextArea || type !== 'textarea'">
|
|
4
|
-
<span v-if="prefix || $slots.prefix" class="vd-input-form__prefix" :class="borderRightClasses">
|
|
5
|
-
<slot name="prefix">{{ prefix }}</slot>
|
|
6
|
-
</span>
|
|
7
|
-
<input
|
|
8
|
-
v-if="!inputTextArea"
|
|
9
|
-
ref="input"
|
|
10
|
-
v-bind="$attrs"
|
|
11
|
-
:type="passwordIcon ? (passwordVisible ? 'text' : 'password') : type"
|
|
12
|
-
:class="inputClasses"
|
|
13
|
-
:disabled="disabled"
|
|
14
|
-
:placeholder="placeholder"
|
|
15
|
-
:value="currentValue"
|
|
16
|
-
@input="handleInput"
|
|
17
|
-
@focus="handleFocus"
|
|
18
|
-
@blur="handleBlur"
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<textarea
|
|
22
|
-
v-else
|
|
23
|
-
ref="textarea"
|
|
24
|
-
v-bind="$attrs"
|
|
25
|
-
:id="elementId"
|
|
26
|
-
:wrap="wrap"
|
|
27
|
-
:type="type"
|
|
28
|
-
:rows="rows"
|
|
29
|
-
:class="inputClasses"
|
|
30
|
-
:disabled="disabled"
|
|
31
|
-
:placeholder="placeholder"
|
|
32
|
-
:value="currentValue"
|
|
33
|
-
@focus="handleFocus"
|
|
34
|
-
@blur="handleBlur"
|
|
35
|
-
@input="handleInput"
|
|
36
|
-
:style="textareaStyles"
|
|
37
|
-
>
|
|
38
|
-
</textarea>
|
|
39
|
-
<div
|
|
40
|
-
v-if="suffix || $slots.suffix || append || $slots.append || isWordLimitVisible"
|
|
41
|
-
class="vd-input-form__right"
|
|
42
|
-
>
|
|
43
|
-
<span v-if="suffix || $slots.suffix" class="vd-input-form__suffix">
|
|
44
|
-
<slot name="suffix">
|
|
45
|
-
<vd-icon name="icon_btn_clean" @click="handleClear"></vd-icon>
|
|
46
|
-
</slot>
|
|
47
|
-
</span>
|
|
48
|
-
<span v-if="append || $slots.append" class="vd-input-form__append">
|
|
49
|
-
<slot name="append">{{ append }}</slot>
|
|
50
|
-
</span>
|
|
51
|
-
<div
|
|
52
|
-
v-if="isWordLimitVisible"
|
|
53
|
-
:class="[
|
|
54
|
-
'vd-input__word-limit',
|
|
55
|
-
{ 'vd-input__word-limit--error': isOverLimit },
|
|
56
|
-
]"
|
|
57
|
-
>
|
|
58
|
-
<span>{{ textLength }}</span
|
|
59
|
-
>/<span>{{ upperLimit }}</span>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
<span
|
|
63
|
-
v-if="passwordClose || passwordIcon"
|
|
64
|
-
class="vd-input-form__password"
|
|
65
|
-
>
|
|
66
|
-
<span v-if="passwordClose" class="vd-input-form__password--close">
|
|
67
|
-
<vd-icon name="icon_btn_close" @click="handleClear"></vd-icon>
|
|
68
|
-
</span>
|
|
69
|
-
<span v-if="passwordIcon" class="vd-input-form__password--password">
|
|
70
|
-
<vd-icon
|
|
71
|
-
:name="passwordVisible ? 'icon_btn_eye' : 'icon_btn_eye_close'"
|
|
72
|
-
@click="handlePasswordVisible"
|
|
73
|
-
></vd-icon>
|
|
74
|
-
</span>
|
|
75
|
-
</span>
|
|
76
|
-
</template>
|
|
77
|
-
<template v-else>
|
|
78
|
-
<textarea
|
|
79
|
-
ref="textarea"
|
|
80
|
-
:type="type"
|
|
81
|
-
v-bind="$attrs"
|
|
82
|
-
:wrap="wrap"
|
|
83
|
-
:class="inputClasses"
|
|
84
|
-
:disabled="disabled"
|
|
85
|
-
:placeholder="placeholder"
|
|
86
|
-
:value="currentValue"
|
|
87
|
-
:rows="rows"
|
|
88
|
-
:name="name"
|
|
89
|
-
@input="handleInput"
|
|
90
|
-
:style="textareaStyles"
|
|
91
|
-
>
|
|
92
|
-
</textarea>
|
|
93
|
-
<div
|
|
94
|
-
v-if="isWordLimitVisible"
|
|
95
|
-
:class="[
|
|
96
|
-
'vd-input__word-limit',
|
|
97
|
-
{ 'vd-input__word-limit--error': isOverLimit },
|
|
98
|
-
]"
|
|
99
|
-
>
|
|
100
|
-
<span>{{ textLength }}</span
|
|
101
|
-
>/<span>{{ upperLimit }}</span>
|
|
102
|
-
</div>
|
|
103
|
-
</template>
|
|
104
|
-
</div>
|
|
105
|
-
</template>
|
|
106
|
-
|
|
107
|
-
<script>
|
|
108
|
-
import calcTextareaHeight from "./calcTextareaHeight";
|
|
109
|
-
const prefixCls = "vd-input";
|
|
110
|
-
|
|
111
|
-
export default {
|
|
112
|
-
name: "vd-input",
|
|
113
|
-
props: {
|
|
114
|
-
type: {
|
|
115
|
-
type: String,
|
|
116
|
-
default: "text",
|
|
117
|
-
},
|
|
118
|
-
prefix: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
},
|
|
121
|
-
borderRight: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
default: true
|
|
124
|
-
},
|
|
125
|
-
suffix: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
},
|
|
128
|
-
// 设计如此,单独的文字
|
|
129
|
-
append: {
|
|
130
|
-
type: Boolean,
|
|
131
|
-
},
|
|
132
|
-
placeholder: {
|
|
133
|
-
type: String,
|
|
134
|
-
},
|
|
135
|
-
error: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
},
|
|
138
|
-
bigSize: {
|
|
139
|
-
type: Boolean,
|
|
140
|
-
},
|
|
141
|
-
passwordIcon: {
|
|
142
|
-
type: Boolean,
|
|
143
|
-
},
|
|
144
|
-
passwordClose: {
|
|
145
|
-
type: Boolean,
|
|
146
|
-
},
|
|
147
|
-
passwordType: {
|
|
148
|
-
type: String,
|
|
149
|
-
default: "icon_btn_eye_close",
|
|
150
|
-
},
|
|
151
|
-
form: {
|
|
152
|
-
type: String,
|
|
153
|
-
},
|
|
154
|
-
disabled: {
|
|
155
|
-
type: Boolean,
|
|
156
|
-
},
|
|
157
|
-
value: {
|
|
158
|
-
type: [String, Number],
|
|
159
|
-
default: "",
|
|
160
|
-
},
|
|
161
|
-
rows: {
|
|
162
|
-
type: Number,
|
|
163
|
-
default: 2,
|
|
164
|
-
},
|
|
165
|
-
name: {
|
|
166
|
-
type: String,
|
|
167
|
-
},
|
|
168
|
-
// 设计如此多行textarea,跟input属性一样
|
|
169
|
-
inputTextArea: {
|
|
170
|
-
type: Boolean,
|
|
171
|
-
},
|
|
172
|
-
warning: {
|
|
173
|
-
type: Boolean,
|
|
174
|
-
},
|
|
175
|
-
hairline: {
|
|
176
|
-
type: Boolean,
|
|
177
|
-
default: true,
|
|
178
|
-
},
|
|
179
|
-
autosize: {
|
|
180
|
-
type: [Boolean, Object],
|
|
181
|
-
default: false,
|
|
182
|
-
},
|
|
183
|
-
elementId: {
|
|
184
|
-
type: String,
|
|
185
|
-
},
|
|
186
|
-
wrap: {
|
|
187
|
-
type: String,
|
|
188
|
-
default: "soft",
|
|
189
|
-
},
|
|
190
|
-
// 新增0118
|
|
191
|
-
showWordLimit: {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
default: false,
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
data() {
|
|
197
|
-
return {
|
|
198
|
-
focusClass: false,
|
|
199
|
-
currentValue: this.value,
|
|
200
|
-
isOnComposition: false,
|
|
201
|
-
textareaStyles: {},
|
|
202
|
-
passwordVisible: false,
|
|
203
|
-
};
|
|
204
|
-
},
|
|
205
|
-
computed: {
|
|
206
|
-
wrapClasses() {
|
|
207
|
-
return [
|
|
208
|
-
{
|
|
209
|
-
[`${prefixCls}-${this.form}`]: this.form,
|
|
210
|
-
[`${prefixCls}--disabled`]: this.disabled,
|
|
211
|
-
[`${prefixCls}-${this.type}`]: this.type,
|
|
212
|
-
[`${prefixCls}-${this.type}--warning`]: this.warning,
|
|
213
|
-
[`${prefixCls}--bigsize`]: this.bigSize,
|
|
214
|
-
[`${prefixCls}--error`]: this.error,
|
|
215
|
-
[`${prefixCls}--active`]: this.focusClass,
|
|
216
|
-
[`${prefixCls}-inputarea`]: this.inputTextArea,
|
|
217
|
-
"vd-hairline--bottom": this.hairline,
|
|
218
|
-
"vd-textarea-auto": this.inputTextArea,
|
|
219
|
-
},
|
|
220
|
-
];
|
|
221
|
-
},
|
|
222
|
-
borderRightClasses(){
|
|
223
|
-
return [
|
|
224
|
-
"vd-hairline--right",
|
|
225
|
-
{
|
|
226
|
-
[`${prefixCls}--border`]: this.borderRight,
|
|
227
|
-
}
|
|
228
|
-
]
|
|
229
|
-
},
|
|
230
|
-
inputClasses() {
|
|
231
|
-
return [
|
|
232
|
-
`${prefixCls}__control`,
|
|
233
|
-
{
|
|
234
|
-
[`${prefixCls}-${this.type}__control`]: this.type,
|
|
235
|
-
},
|
|
236
|
-
];
|
|
237
|
-
},
|
|
238
|
-
textLength() {
|
|
239
|
-
if (typeof this.value === "number") {
|
|
240
|
-
return String(this.value).length;
|
|
241
|
-
}
|
|
242
|
-
return (this.value || "").length;
|
|
243
|
-
},
|
|
244
|
-
upperLimit() {
|
|
245
|
-
return this.$attrs.maxlength;
|
|
246
|
-
},
|
|
247
|
-
isWordLimitVisible() {
|
|
248
|
-
return (
|
|
249
|
-
this.showWordLimit &&
|
|
250
|
-
this.$attrs.maxlength &&
|
|
251
|
-
(this.type === "text" || this.type === "textarea")
|
|
252
|
-
);
|
|
253
|
-
},
|
|
254
|
-
isOverLimit() {
|
|
255
|
-
return this.textLength >= this.upperLimit;
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
methods: {
|
|
259
|
-
handleFocus(event) {
|
|
260
|
-
if (this.form) {
|
|
261
|
-
this.focusClass = true;
|
|
262
|
-
}
|
|
263
|
-
this.$emit("focus", event);
|
|
264
|
-
},
|
|
265
|
-
handleBlur(event) {
|
|
266
|
-
if (this.form) {
|
|
267
|
-
this.focusClass = false;
|
|
268
|
-
}
|
|
269
|
-
this.$emit("blur", event);
|
|
270
|
-
},
|
|
271
|
-
focus() {
|
|
272
|
-
if (this.type === "textarea") {
|
|
273
|
-
this.$refs.textarea.focus();
|
|
274
|
-
} else {
|
|
275
|
-
this.$refs.input.focus();
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
blur() {
|
|
279
|
-
if (this.type === "textarea") {
|
|
280
|
-
this.$refs.textarea.blur();
|
|
281
|
-
} else {
|
|
282
|
-
this.$refs.input.blur();
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
handleInput(event) {
|
|
287
|
-
if (this.isOnComposition) return;
|
|
288
|
-
let value = event.target.value;
|
|
289
|
-
if (this.number && value !== "")
|
|
290
|
-
value = Number.isNaN(Number(value)) ? value : Number(value);
|
|
291
|
-
this.$emit("input", value);
|
|
292
|
-
this.setCurrentValue(value);
|
|
293
|
-
this.$emit("change", event);
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
setCurrentValue(value) {
|
|
297
|
-
if (value === this.currentValue) return;
|
|
298
|
-
this.$nextTick(() => {
|
|
299
|
-
this.resizeTextarea();
|
|
300
|
-
});
|
|
301
|
-
this.currentValue = value;
|
|
302
|
-
},
|
|
303
|
-
resizeTextarea() {
|
|
304
|
-
const autosize = this.autosize;
|
|
305
|
-
if (!autosize || this.type !== "textarea") {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
const minRows = autosize.minRows;
|
|
309
|
-
const maxRows = autosize.maxRows;
|
|
310
|
-
this.textareaStyles = calcTextareaHeight(
|
|
311
|
-
this.$refs.textarea,
|
|
312
|
-
minRows,
|
|
313
|
-
maxRows
|
|
314
|
-
);
|
|
315
|
-
},
|
|
316
|
-
handleClear() {
|
|
317
|
-
const e = { target: { value: "" } };
|
|
318
|
-
this.$emit("input", "");
|
|
319
|
-
this.setCurrentValue("");
|
|
320
|
-
this.$emit("change", e);
|
|
321
|
-
this.$emit("clear");
|
|
322
|
-
},
|
|
323
|
-
handlePasswordVisible() {
|
|
324
|
-
this.passwordVisible = !this.passwordVisible;
|
|
325
|
-
this.$nextTick(() => {
|
|
326
|
-
this.focus();
|
|
327
|
-
});
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
watch: {
|
|
331
|
-
value(val) {
|
|
332
|
-
this.setCurrentValue(val);
|
|
333
|
-
},
|
|
334
|
-
},
|
|
335
|
-
mounted() {
|
|
336
|
-
this.resizeTextarea();
|
|
337
|
-
},
|
|
338
|
-
};
|
|
339
|
-
</script>
|
|
340
|
-
|
|
341
|
-
<style lang="less">
|
|
342
|
-
@import "./style.less";
|
|
343
|
-
</style>
|