evui 3.3.36 → 3.3.39
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/LICENSE +21 -21
- package/README.md +40 -40
- package/dist/evui.common.js +1907 -1832
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +1907 -1832
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/dist/img/{EVUI.7f3588fb.svg → EVUI.b82ee81a.svg} +292 -292
- package/dist/img/{icon_mysql.7ea26d5d.svg → icon_mysql.1085fdc9.svg} +78 -78
- package/dist/img/{icon_oracle.9009b108.svg → icon_oracle.0572d3ee.svg} +13 -13
- package/dist/img/{icon_postgresql.f8fffba9.svg → icon_postgresql.ee12bde8.svg} +58 -58
- package/package.json +61 -61
- package/src/common/emitter.js +20 -20
- package/src/common/utils.debounce.js +223 -223
- package/src/common/utils.js +134 -134
- package/src/common/utils.table.js +78 -78
- package/src/common/utils.throttle.js +83 -83
- package/src/common/utils.tree.js +18 -18
- package/src/components/button/Button.vue +198 -198
- package/src/components/button/index.js +7 -7
- package/src/components/buttonGroup/ButtonGroup.vue +11 -11
- package/src/components/buttonGroup/index.js +7 -7
- package/src/components/calendar/Calendar.vue +661 -661
- package/src/components/calendar/index.js +7 -7
- package/src/components/calendar/uses.js +1272 -1272
- package/src/components/chart/Chart.vue +189 -192
- package/src/components/chart/chart.core.js +870 -870
- package/src/components/chart/element/element.bar.js +524 -524
- package/src/components/chart/element/element.bar.time.js +156 -156
- package/src/components/chart/element/element.heatmap.js +533 -533
- package/src/components/chart/element/element.line.js +339 -339
- package/src/components/chart/element/element.pie.js +197 -197
- package/src/components/chart/element/element.scatter.js +184 -184
- package/src/components/chart/element/element.tip.js +550 -542
- package/src/components/chart/helpers/helpers.canvas.js +265 -265
- package/src/components/chart/helpers/helpers.constant.js +206 -206
- package/src/components/chart/helpers/helpers.util.js +346 -338
- package/src/components/chart/index.js +9 -9
- package/src/components/chart/model/index.js +4 -4
- package/src/components/chart/model/model.series.js +93 -93
- package/src/components/chart/model/model.store.js +977 -967
- package/src/components/chart/plugins/plugins.interaction.js +769 -769
- package/src/components/chart/plugins/plugins.legend.gradient.js +602 -602
- package/src/components/chart/plugins/plugins.legend.js +1155 -1151
- package/src/components/chart/plugins/plugins.pie.js +254 -254
- package/src/components/chart/plugins/plugins.title.js +56 -56
- package/src/components/chart/plugins/plugins.tooltip.js +692 -692
- package/src/components/chart/scale/scale.js +848 -848
- package/src/components/chart/scale/scale.linear.js +38 -38
- package/src/components/chart/scale/scale.logarithmic.js +128 -128
- package/src/components/chart/scale/scale.step.js +336 -336
- package/src/components/chart/scale/scale.time.category.js +277 -277
- package/src/components/chart/scale/scale.time.js +48 -48
- package/src/components/chart/style/chart.scss +312 -312
- package/src/components/chart/uses.js +264 -252
- package/src/components/checkbox/Checkbox.vue +200 -200
- package/src/components/checkbox/index.js +7 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +44 -44
- package/src/components/checkboxGroup/index.js +7 -7
- package/src/components/contextMenu/ContextMenu.vue +80 -80
- package/src/components/contextMenu/MenuList.vue +149 -149
- package/src/components/contextMenu/index.js +7 -7
- package/src/components/contextMenu/uses.js +203 -203
- package/src/components/datePicker/DatePicker.vue +437 -437
- package/src/components/datePicker/index.js +7 -7
- package/src/components/datePicker/uses.js +419 -419
- package/src/components/grid/Grid.vue +827 -827
- package/src/components/grid/grid.filter.window.vue +493 -493
- package/src/components/grid/grid.pagination.vue +75 -75
- package/src/components/grid/grid.summary.vue +265 -265
- package/src/components/grid/grid.toolbar.vue +26 -26
- package/src/components/grid/index.js +11 -11
- package/src/components/grid/style/grid.scss +263 -263
- package/src/components/grid/uses.js +1002 -1007
- package/src/components/icon/Icon.vue +49 -49
- package/src/components/icon/index.js +8 -8
- package/src/components/inputNumber/InputNumber.vue +212 -212
- package/src/components/inputNumber/index.js +7 -7
- package/src/components/inputNumber/uses.js +217 -217
- package/src/components/loading/Loading.vue +125 -125
- package/src/components/loading/index.js +7 -7
- package/src/components/menu/Menu.vue +68 -68
- package/src/components/menu/MenuItem.vue +187 -187
- package/src/components/menu/index.js +7 -7
- package/src/components/message/Message.vue +223 -223
- package/src/components/message/index.js +31 -31
- package/src/components/messageBox/MessageBox.vue +358 -358
- package/src/components/messageBox/index.js +22 -22
- package/src/components/notification/Notification.vue +316 -316
- package/src/components/notification/index.js +49 -49
- package/src/components/pagination/Pagination.vue +271 -271
- package/src/components/pagination/index.js +7 -7
- package/src/components/pagination/pageButton.vue +30 -30
- package/src/components/progress/Progress.vue +139 -139
- package/src/components/progress/index.js +7 -7
- package/src/components/radio/Radio.vue +159 -159
- package/src/components/radio/index.js +7 -7
- package/src/components/radioGroup/RadioGroup.vue +41 -41
- package/src/components/radioGroup/index.js +7 -7
- package/src/components/scheduler/Scheduler.vue +149 -149
- package/src/components/scheduler/index.js +7 -7
- package/src/components/scheduler/uses.js +183 -183
- package/src/components/select/Select.vue +440 -440
- package/src/components/select/index.js +7 -7
- package/src/components/select/uses.js +270 -270
- package/src/components/slider/Slider.vue +505 -505
- package/src/components/slider/index.js +7 -7
- package/src/components/slider/uses.js +390 -390
- package/src/components/tabPanel/TabPanel.vue +74 -74
- package/src/components/tabPanel/index.js +7 -7
- package/src/components/tabs/Tabs.vue +517 -517
- package/src/components/tabs/index.js +7 -7
- package/src/components/textField/TextField.vue +375 -375
- package/src/components/textField/index.js +7 -7
- package/src/components/timePicker/TimePicker.vue +352 -352
- package/src/components/timePicker/index.js +7 -7
- package/src/components/toggle/Toggle.vue +115 -115
- package/src/components/toggle/index.js +7 -7
- package/src/components/tree/Tree.vue +313 -313
- package/src/components/tree/TreeNode.vue +293 -293
- package/src/components/tree/index.js +7 -7
- package/src/components/treeGrid/TreeGrid.vue +758 -758
- package/src/components/treeGrid/TreeGridNode.vue +275 -275
- package/src/components/treeGrid/index.js +9 -9
- package/src/components/treeGrid/style/treeGrid.scss +261 -261
- package/src/components/treeGrid/treeGrid.toolbar.vue +26 -26
- package/src/components/treeGrid/uses.js +867 -867
- package/src/components/window/Window.vue +329 -329
- package/src/components/window/index.js +7 -7
- package/src/components/window/uses.js +899 -899
- package/src/directives/clickoutside.js +90 -90
- package/src/main.js +116 -116
- package/src/style/components/input.scss +108 -108
- package/src/style/functions.scss +3 -3
- package/src/style/index.scss +6 -6
- package/src/style/lib/fonts/EVUI.svg +292 -292
- package/src/style/lib/icon.css +888 -888
- package/src/style/mixins.scss +94 -94
- package/src/style/themes.scss +67 -67
- package/src/style/variables.scss +22 -22
|
@@ -1,375 +1,375 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="ev-text-field"
|
|
4
|
-
:class="{
|
|
5
|
-
disabled,
|
|
6
|
-
clearable,
|
|
7
|
-
readonly,
|
|
8
|
-
error: !!errorMsg,
|
|
9
|
-
'show-password': showPassword,
|
|
10
|
-
'show-maxlength': showMaxLength,
|
|
11
|
-
[`type-${type}`]: !!type,
|
|
12
|
-
'ev-text-field-prefix': $slots['icon-prefix'],
|
|
13
|
-
'ev-text-field-suffix': $slots['icon-suffix'],
|
|
14
|
-
'ev-text-field-prefix-suffix': $slots['icon-prefix'] && $slots['icon-suffix'],
|
|
15
|
-
}"
|
|
16
|
-
>
|
|
17
|
-
<div
|
|
18
|
-
class="ev-text-field-wrapper"
|
|
19
|
-
>
|
|
20
|
-
<template
|
|
21
|
-
v-if="type === 'textarea'"
|
|
22
|
-
>
|
|
23
|
-
<textarea
|
|
24
|
-
v-model="mv"
|
|
25
|
-
class="ev-textarea"
|
|
26
|
-
:placeholder="placeholder"
|
|
27
|
-
:disabled="disabled"
|
|
28
|
-
:readonly="readonly"
|
|
29
|
-
:maxlength="maxLength"
|
|
30
|
-
@focus="focusInput"
|
|
31
|
-
@blur="blurInput"
|
|
32
|
-
@input="inputMv"
|
|
33
|
-
@change="changeMv"
|
|
34
|
-
/>
|
|
35
|
-
</template>
|
|
36
|
-
<template v-else >
|
|
37
|
-
<input
|
|
38
|
-
v-model="mv"
|
|
39
|
-
class="ev-input"
|
|
40
|
-
:type="inputType"
|
|
41
|
-
:placeholder="placeholder"
|
|
42
|
-
:disabled="disabled"
|
|
43
|
-
:readonly="readonly"
|
|
44
|
-
:maxlength="maxLength"
|
|
45
|
-
@focus="focusInput"
|
|
46
|
-
@blur="blurInput"
|
|
47
|
-
@input="inputMv"
|
|
48
|
-
@change="changeMv"
|
|
49
|
-
@keyup="keyupInput"
|
|
50
|
-
/>
|
|
51
|
-
<span
|
|
52
|
-
v-if="type === 'text' && clearable"
|
|
53
|
-
class="ev-text-field-icon icon-clear"
|
|
54
|
-
@click="clearValue"
|
|
55
|
-
>
|
|
56
|
-
<i class="ev-icon-error" />
|
|
57
|
-
</span>
|
|
58
|
-
<span
|
|
59
|
-
v-if="type === 'password' && showPassword"
|
|
60
|
-
class="ev-text-field-icon icon-password"
|
|
61
|
-
:class="{ 'on': isPasswordVisible }"
|
|
62
|
-
@click="changePasswordVisible"
|
|
63
|
-
>
|
|
64
|
-
<i :class="isPasswordVisible ? 'ev-icon-visibility' : 'ev-icon-visibility-off'"/>
|
|
65
|
-
</span>
|
|
66
|
-
<span
|
|
67
|
-
v-if="type === 'search'"
|
|
68
|
-
class="ev-text-field-icon icon-search"
|
|
69
|
-
@click="searchValue"
|
|
70
|
-
>
|
|
71
|
-
<i class="ev-icon-search"/>
|
|
72
|
-
</span>
|
|
73
|
-
<span
|
|
74
|
-
v-if="$slots['icon-suffix']"
|
|
75
|
-
class="ev-text-field-icon icon-suffix"
|
|
76
|
-
>
|
|
77
|
-
<slot name="icon-suffix"/>
|
|
78
|
-
</span>
|
|
79
|
-
<span
|
|
80
|
-
v-if="$slots['icon-prefix']"
|
|
81
|
-
class="ev-text-field-icon icon-prefix"
|
|
82
|
-
>
|
|
83
|
-
<slot name="icon-prefix"/>
|
|
84
|
-
</span>
|
|
85
|
-
</template>
|
|
86
|
-
</div>
|
|
87
|
-
<div
|
|
88
|
-
v-if="errorMsg"
|
|
89
|
-
class="ev-text-field-error"
|
|
90
|
-
>
|
|
91
|
-
{{ errorMsg }}
|
|
92
|
-
</div>
|
|
93
|
-
<div
|
|
94
|
-
v-if="maxLength && showMaxLength"
|
|
95
|
-
class="ev-text-field-maxlength"
|
|
96
|
-
:class="{ max: mv?.length > maxLength }"
|
|
97
|
-
>
|
|
98
|
-
<span class="curr-length">{{ mv ? mv.length : 0 }}</span> / {{ maxLength }}
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</template>
|
|
102
|
-
|
|
103
|
-
<script>
|
|
104
|
-
import { ref, computed, nextTick } from 'vue';
|
|
105
|
-
|
|
106
|
-
export default {
|
|
107
|
-
name: 'EvTextField',
|
|
108
|
-
props: {
|
|
109
|
-
modelValue: {
|
|
110
|
-
type: [String, Number],
|
|
111
|
-
default: null,
|
|
112
|
-
},
|
|
113
|
-
type: {
|
|
114
|
-
type: String,
|
|
115
|
-
default: 'text',
|
|
116
|
-
},
|
|
117
|
-
placeholder: {
|
|
118
|
-
type: String,
|
|
119
|
-
default: '',
|
|
120
|
-
},
|
|
121
|
-
clearable: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
default: false,
|
|
124
|
-
},
|
|
125
|
-
showPassword: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
default: false,
|
|
128
|
-
},
|
|
129
|
-
disabled: {
|
|
130
|
-
type: Boolean,
|
|
131
|
-
default: false,
|
|
132
|
-
},
|
|
133
|
-
readonly: {
|
|
134
|
-
type: Boolean,
|
|
135
|
-
default: false,
|
|
136
|
-
},
|
|
137
|
-
maxLength: {
|
|
138
|
-
type: Number,
|
|
139
|
-
default: null,
|
|
140
|
-
},
|
|
141
|
-
showMaxLength: {
|
|
142
|
-
type: Boolean,
|
|
143
|
-
default: false,
|
|
144
|
-
},
|
|
145
|
-
errorMsg: {
|
|
146
|
-
type: String,
|
|
147
|
-
default: '',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
emits: [
|
|
151
|
-
'update:modelValue',
|
|
152
|
-
'focus',
|
|
153
|
-
'blur',
|
|
154
|
-
'input',
|
|
155
|
-
'change',
|
|
156
|
-
'search',
|
|
157
|
-
],
|
|
158
|
-
setup(props, { emit }) {
|
|
159
|
-
const mv = computed({
|
|
160
|
-
get: () => props.modelValue,
|
|
161
|
-
set: val => emit('update:modelValue', val),
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// password visible on/off
|
|
165
|
-
const isPasswordVisible = ref(false);
|
|
166
|
-
const changePasswordVisible = () => {
|
|
167
|
-
if (props.type === 'password') {
|
|
168
|
-
isPasswordVisible.value = !isPasswordVisible.value;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// input type setting
|
|
173
|
-
const inputType = computed(() => {
|
|
174
|
-
if (props.type === 'password') {
|
|
175
|
-
return isPasswordVisible.value ? 'text' : 'password';
|
|
176
|
-
}
|
|
177
|
-
isPasswordVisible.value = false;
|
|
178
|
-
return props.type === 'search' ? 'text' : props.type;
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// clear input value
|
|
182
|
-
const clearValue = () => { mv.value = ''; };
|
|
183
|
-
|
|
184
|
-
// search input
|
|
185
|
-
const searchValue = () => {
|
|
186
|
-
emit('search', mv.value);
|
|
187
|
-
};
|
|
188
|
-
const keyupInput = (e) => {
|
|
189
|
-
if (props.type === 'search'
|
|
190
|
-
&& (e.key === 'Enter' || e.keyCode === 13)
|
|
191
|
-
) {
|
|
192
|
-
searchValue();
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
// input event
|
|
197
|
-
const focusInput = (e) => {
|
|
198
|
-
emit('focus', e);
|
|
199
|
-
};
|
|
200
|
-
const blurInput = (e) => {
|
|
201
|
-
emit('blur', e);
|
|
202
|
-
};
|
|
203
|
-
const inputMv = (e) => {
|
|
204
|
-
const inputValue = e.target.value;
|
|
205
|
-
if (mv.value !== inputValue) {
|
|
206
|
-
mv.value = inputValue;
|
|
207
|
-
}
|
|
208
|
-
nextTick(() => {
|
|
209
|
-
emit('input', mv.value, e);
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
const changeMv = (e) => {
|
|
213
|
-
emit('change', mv.value, e);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
return {
|
|
217
|
-
mv,
|
|
218
|
-
inputType,
|
|
219
|
-
isPasswordVisible,
|
|
220
|
-
clearValue,
|
|
221
|
-
changePasswordVisible,
|
|
222
|
-
searchValue,
|
|
223
|
-
keyupInput,
|
|
224
|
-
focusInput,
|
|
225
|
-
blurInput,
|
|
226
|
-
inputMv,
|
|
227
|
-
changeMv,
|
|
228
|
-
};
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
</script>
|
|
232
|
-
|
|
233
|
-
<style lang="scss">
|
|
234
|
-
$icon-width: 14px !default;
|
|
235
|
-
|
|
236
|
-
@import '../../style/index.scss';
|
|
237
|
-
|
|
238
|
-
.ev-text-field {
|
|
239
|
-
position: relative;
|
|
240
|
-
box-sizing: border-box;
|
|
241
|
-
|
|
242
|
-
@include clearfix();
|
|
243
|
-
|
|
244
|
-
@import '../../style/components/input.scss';
|
|
245
|
-
&:hover {
|
|
246
|
-
.ev-input,
|
|
247
|
-
.ev-textarea {
|
|
248
|
-
@include evThemify() {
|
|
249
|
-
border: 1px solid evThemed('primary');
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
&-wrapper {
|
|
254
|
-
position: relative;
|
|
255
|
-
}
|
|
256
|
-
.ev-text-field-icon {
|
|
257
|
-
display: flex;
|
|
258
|
-
position: absolute;
|
|
259
|
-
top: 50%;
|
|
260
|
-
right: #{$icon-width / 2};
|
|
261
|
-
width: $icon-width;
|
|
262
|
-
height: $icon-width;
|
|
263
|
-
cursor: pointer;
|
|
264
|
-
justify-content: center;
|
|
265
|
-
align-items: center;
|
|
266
|
-
z-index: 5;
|
|
267
|
-
transform: translateY(-50%);
|
|
268
|
-
box-sizing: border-box;
|
|
269
|
-
|
|
270
|
-
@include evThemify() {
|
|
271
|
-
color: evThemed('border-base');
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
@include state('clearable') {
|
|
277
|
-
.ev-input {
|
|
278
|
-
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
279
|
-
}
|
|
280
|
-
.ev-text-field-icon {
|
|
281
|
-
font-size: 15px;
|
|
282
|
-
&:hover {
|
|
283
|
-
@include evThemify() {
|
|
284
|
-
color: evThemed('primary');
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
@include state('show-password') {
|
|
290
|
-
.ev-input {
|
|
291
|
-
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
292
|
-
}
|
|
293
|
-
.ev-text-field-icon {
|
|
294
|
-
font-size: 15px;
|
|
295
|
-
&:hover,
|
|
296
|
-
&.on {
|
|
297
|
-
@include evThemify() {
|
|
298
|
-
color: evThemed('primary');
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
@include state('type-search') {
|
|
304
|
-
.ev-input {
|
|
305
|
-
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
306
|
-
}
|
|
307
|
-
.ev-text-field-icon {
|
|
308
|
-
font-size: 15px;
|
|
309
|
-
&:hover {
|
|
310
|
-
@include evThemify() {
|
|
311
|
-
color: evThemed('primary');
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
@include state('show-maxlength') {
|
|
317
|
-
.ev-text-field-maxlength {
|
|
318
|
-
float: right;
|
|
319
|
-
padding: 5px 0 3px;
|
|
320
|
-
text-align: right;
|
|
321
|
-
font-size: 12px;
|
|
322
|
-
|
|
323
|
-
@include evThemify() {
|
|
324
|
-
color: evThemed('border-base');
|
|
325
|
-
}
|
|
326
|
-
.curr-length {
|
|
327
|
-
@include evThemify() {
|
|
328
|
-
color: darken(evThemed('border-base'), 10%);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
&.max,
|
|
332
|
-
&.max * {
|
|
333
|
-
@include evThemify() {
|
|
334
|
-
color: evThemed('error') !important;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
@include state('error') {
|
|
340
|
-
.ev-text-field-error {
|
|
341
|
-
float: left;
|
|
342
|
-
padding: 5px 0 3px;
|
|
343
|
-
font-size: 12px;
|
|
344
|
-
word-break: break-all;
|
|
345
|
-
|
|
346
|
-
@include evThemify() {
|
|
347
|
-
color: evThemed('error');
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
@include state('ev-text-field-suffix') {
|
|
352
|
-
.ev-input {
|
|
353
|
-
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
354
|
-
}
|
|
355
|
-
.icon-suffix {
|
|
356
|
-
font-size: 15px;
|
|
357
|
-
cursor: default;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
@include state('ev-text-field-prefix') {
|
|
361
|
-
.ev-input {
|
|
362
|
-
padding: 0 $input-default-padding 0 #{$input-default-padding + $icon-width};
|
|
363
|
-
}
|
|
364
|
-
.icon-prefix {
|
|
365
|
-
left: 7px;
|
|
366
|
-
font-size: 15px;
|
|
367
|
-
cursor: default;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
@include state('ev-text-field-prefix-suffix') {
|
|
371
|
-
.ev-input {
|
|
372
|
-
padding: 0 #{$input-default-padding + $icon-width};
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ev-text-field"
|
|
4
|
+
:class="{
|
|
5
|
+
disabled,
|
|
6
|
+
clearable,
|
|
7
|
+
readonly,
|
|
8
|
+
error: !!errorMsg,
|
|
9
|
+
'show-password': showPassword,
|
|
10
|
+
'show-maxlength': showMaxLength,
|
|
11
|
+
[`type-${type}`]: !!type,
|
|
12
|
+
'ev-text-field-prefix': $slots['icon-prefix'],
|
|
13
|
+
'ev-text-field-suffix': $slots['icon-suffix'],
|
|
14
|
+
'ev-text-field-prefix-suffix': $slots['icon-prefix'] && $slots['icon-suffix'],
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="ev-text-field-wrapper"
|
|
19
|
+
>
|
|
20
|
+
<template
|
|
21
|
+
v-if="type === 'textarea'"
|
|
22
|
+
>
|
|
23
|
+
<textarea
|
|
24
|
+
v-model="mv"
|
|
25
|
+
class="ev-textarea"
|
|
26
|
+
:placeholder="placeholder"
|
|
27
|
+
:disabled="disabled"
|
|
28
|
+
:readonly="readonly"
|
|
29
|
+
:maxlength="maxLength"
|
|
30
|
+
@focus="focusInput"
|
|
31
|
+
@blur="blurInput"
|
|
32
|
+
@input="inputMv"
|
|
33
|
+
@change="changeMv"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
<template v-else >
|
|
37
|
+
<input
|
|
38
|
+
v-model="mv"
|
|
39
|
+
class="ev-input"
|
|
40
|
+
:type="inputType"
|
|
41
|
+
:placeholder="placeholder"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
:readonly="readonly"
|
|
44
|
+
:maxlength="maxLength"
|
|
45
|
+
@focus="focusInput"
|
|
46
|
+
@blur="blurInput"
|
|
47
|
+
@input="inputMv"
|
|
48
|
+
@change="changeMv"
|
|
49
|
+
@keyup="keyupInput"
|
|
50
|
+
/>
|
|
51
|
+
<span
|
|
52
|
+
v-if="type === 'text' && clearable"
|
|
53
|
+
class="ev-text-field-icon icon-clear"
|
|
54
|
+
@click="clearValue"
|
|
55
|
+
>
|
|
56
|
+
<i class="ev-icon-error" />
|
|
57
|
+
</span>
|
|
58
|
+
<span
|
|
59
|
+
v-if="type === 'password' && showPassword"
|
|
60
|
+
class="ev-text-field-icon icon-password"
|
|
61
|
+
:class="{ 'on': isPasswordVisible }"
|
|
62
|
+
@click="changePasswordVisible"
|
|
63
|
+
>
|
|
64
|
+
<i :class="isPasswordVisible ? 'ev-icon-visibility' : 'ev-icon-visibility-off'"/>
|
|
65
|
+
</span>
|
|
66
|
+
<span
|
|
67
|
+
v-if="type === 'search'"
|
|
68
|
+
class="ev-text-field-icon icon-search"
|
|
69
|
+
@click="searchValue"
|
|
70
|
+
>
|
|
71
|
+
<i class="ev-icon-search"/>
|
|
72
|
+
</span>
|
|
73
|
+
<span
|
|
74
|
+
v-if="$slots['icon-suffix']"
|
|
75
|
+
class="ev-text-field-icon icon-suffix"
|
|
76
|
+
>
|
|
77
|
+
<slot name="icon-suffix"/>
|
|
78
|
+
</span>
|
|
79
|
+
<span
|
|
80
|
+
v-if="$slots['icon-prefix']"
|
|
81
|
+
class="ev-text-field-icon icon-prefix"
|
|
82
|
+
>
|
|
83
|
+
<slot name="icon-prefix"/>
|
|
84
|
+
</span>
|
|
85
|
+
</template>
|
|
86
|
+
</div>
|
|
87
|
+
<div
|
|
88
|
+
v-if="errorMsg"
|
|
89
|
+
class="ev-text-field-error"
|
|
90
|
+
>
|
|
91
|
+
{{ errorMsg }}
|
|
92
|
+
</div>
|
|
93
|
+
<div
|
|
94
|
+
v-if="maxLength && showMaxLength"
|
|
95
|
+
class="ev-text-field-maxlength"
|
|
96
|
+
:class="{ max: mv?.length > maxLength }"
|
|
97
|
+
>
|
|
98
|
+
<span class="curr-length">{{ mv ? mv.length : 0 }}</span> / {{ maxLength }}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<script>
|
|
104
|
+
import { ref, computed, nextTick } from 'vue';
|
|
105
|
+
|
|
106
|
+
export default {
|
|
107
|
+
name: 'EvTextField',
|
|
108
|
+
props: {
|
|
109
|
+
modelValue: {
|
|
110
|
+
type: [String, Number],
|
|
111
|
+
default: null,
|
|
112
|
+
},
|
|
113
|
+
type: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: 'text',
|
|
116
|
+
},
|
|
117
|
+
placeholder: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: '',
|
|
120
|
+
},
|
|
121
|
+
clearable: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: false,
|
|
124
|
+
},
|
|
125
|
+
showPassword: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false,
|
|
128
|
+
},
|
|
129
|
+
disabled: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: false,
|
|
132
|
+
},
|
|
133
|
+
readonly: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: false,
|
|
136
|
+
},
|
|
137
|
+
maxLength: {
|
|
138
|
+
type: Number,
|
|
139
|
+
default: null,
|
|
140
|
+
},
|
|
141
|
+
showMaxLength: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: false,
|
|
144
|
+
},
|
|
145
|
+
errorMsg: {
|
|
146
|
+
type: String,
|
|
147
|
+
default: '',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
emits: [
|
|
151
|
+
'update:modelValue',
|
|
152
|
+
'focus',
|
|
153
|
+
'blur',
|
|
154
|
+
'input',
|
|
155
|
+
'change',
|
|
156
|
+
'search',
|
|
157
|
+
],
|
|
158
|
+
setup(props, { emit }) {
|
|
159
|
+
const mv = computed({
|
|
160
|
+
get: () => props.modelValue,
|
|
161
|
+
set: val => emit('update:modelValue', val),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// password visible on/off
|
|
165
|
+
const isPasswordVisible = ref(false);
|
|
166
|
+
const changePasswordVisible = () => {
|
|
167
|
+
if (props.type === 'password') {
|
|
168
|
+
isPasswordVisible.value = !isPasswordVisible.value;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// input type setting
|
|
173
|
+
const inputType = computed(() => {
|
|
174
|
+
if (props.type === 'password') {
|
|
175
|
+
return isPasswordVisible.value ? 'text' : 'password';
|
|
176
|
+
}
|
|
177
|
+
isPasswordVisible.value = false;
|
|
178
|
+
return props.type === 'search' ? 'text' : props.type;
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// clear input value
|
|
182
|
+
const clearValue = () => { mv.value = ''; };
|
|
183
|
+
|
|
184
|
+
// search input
|
|
185
|
+
const searchValue = () => {
|
|
186
|
+
emit('search', mv.value);
|
|
187
|
+
};
|
|
188
|
+
const keyupInput = (e) => {
|
|
189
|
+
if (props.type === 'search'
|
|
190
|
+
&& (e.key === 'Enter' || e.keyCode === 13)
|
|
191
|
+
) {
|
|
192
|
+
searchValue();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// input event
|
|
197
|
+
const focusInput = (e) => {
|
|
198
|
+
emit('focus', e);
|
|
199
|
+
};
|
|
200
|
+
const blurInput = (e) => {
|
|
201
|
+
emit('blur', e);
|
|
202
|
+
};
|
|
203
|
+
const inputMv = (e) => {
|
|
204
|
+
const inputValue = e.target.value;
|
|
205
|
+
if (mv.value !== inputValue) {
|
|
206
|
+
mv.value = inputValue;
|
|
207
|
+
}
|
|
208
|
+
nextTick(() => {
|
|
209
|
+
emit('input', mv.value, e);
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
const changeMv = (e) => {
|
|
213
|
+
emit('change', mv.value, e);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
mv,
|
|
218
|
+
inputType,
|
|
219
|
+
isPasswordVisible,
|
|
220
|
+
clearValue,
|
|
221
|
+
changePasswordVisible,
|
|
222
|
+
searchValue,
|
|
223
|
+
keyupInput,
|
|
224
|
+
focusInput,
|
|
225
|
+
blurInput,
|
|
226
|
+
inputMv,
|
|
227
|
+
changeMv,
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
</script>
|
|
232
|
+
|
|
233
|
+
<style lang="scss">
|
|
234
|
+
$icon-width: 14px !default;
|
|
235
|
+
|
|
236
|
+
@import '../../style/index.scss';
|
|
237
|
+
|
|
238
|
+
.ev-text-field {
|
|
239
|
+
position: relative;
|
|
240
|
+
box-sizing: border-box;
|
|
241
|
+
|
|
242
|
+
@include clearfix();
|
|
243
|
+
|
|
244
|
+
@import '../../style/components/input.scss';
|
|
245
|
+
&:hover {
|
|
246
|
+
.ev-input,
|
|
247
|
+
.ev-textarea {
|
|
248
|
+
@include evThemify() {
|
|
249
|
+
border: 1px solid evThemed('primary');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
&-wrapper {
|
|
254
|
+
position: relative;
|
|
255
|
+
}
|
|
256
|
+
.ev-text-field-icon {
|
|
257
|
+
display: flex;
|
|
258
|
+
position: absolute;
|
|
259
|
+
top: 50%;
|
|
260
|
+
right: #{$icon-width / 2};
|
|
261
|
+
width: $icon-width;
|
|
262
|
+
height: $icon-width;
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
justify-content: center;
|
|
265
|
+
align-items: center;
|
|
266
|
+
z-index: 5;
|
|
267
|
+
transform: translateY(-50%);
|
|
268
|
+
box-sizing: border-box;
|
|
269
|
+
|
|
270
|
+
@include evThemify() {
|
|
271
|
+
color: evThemed('border-base');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@include state('clearable') {
|
|
277
|
+
.ev-input {
|
|
278
|
+
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
279
|
+
}
|
|
280
|
+
.ev-text-field-icon {
|
|
281
|
+
font-size: 15px;
|
|
282
|
+
&:hover {
|
|
283
|
+
@include evThemify() {
|
|
284
|
+
color: evThemed('primary');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
@include state('show-password') {
|
|
290
|
+
.ev-input {
|
|
291
|
+
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
292
|
+
}
|
|
293
|
+
.ev-text-field-icon {
|
|
294
|
+
font-size: 15px;
|
|
295
|
+
&:hover,
|
|
296
|
+
&.on {
|
|
297
|
+
@include evThemify() {
|
|
298
|
+
color: evThemed('primary');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
@include state('type-search') {
|
|
304
|
+
.ev-input {
|
|
305
|
+
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
306
|
+
}
|
|
307
|
+
.ev-text-field-icon {
|
|
308
|
+
font-size: 15px;
|
|
309
|
+
&:hover {
|
|
310
|
+
@include evThemify() {
|
|
311
|
+
color: evThemed('primary');
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
@include state('show-maxlength') {
|
|
317
|
+
.ev-text-field-maxlength {
|
|
318
|
+
float: right;
|
|
319
|
+
padding: 5px 0 3px;
|
|
320
|
+
text-align: right;
|
|
321
|
+
font-size: 12px;
|
|
322
|
+
|
|
323
|
+
@include evThemify() {
|
|
324
|
+
color: evThemed('border-base');
|
|
325
|
+
}
|
|
326
|
+
.curr-length {
|
|
327
|
+
@include evThemify() {
|
|
328
|
+
color: darken(evThemed('border-base'), 10%);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
&.max,
|
|
332
|
+
&.max * {
|
|
333
|
+
@include evThemify() {
|
|
334
|
+
color: evThemed('error') !important;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
@include state('error') {
|
|
340
|
+
.ev-text-field-error {
|
|
341
|
+
float: left;
|
|
342
|
+
padding: 5px 0 3px;
|
|
343
|
+
font-size: 12px;
|
|
344
|
+
word-break: break-all;
|
|
345
|
+
|
|
346
|
+
@include evThemify() {
|
|
347
|
+
color: evThemed('error');
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
@include state('ev-text-field-suffix') {
|
|
352
|
+
.ev-input {
|
|
353
|
+
padding: 0 #{$input-default-padding + $icon-width} 0 $input-default-padding;
|
|
354
|
+
}
|
|
355
|
+
.icon-suffix {
|
|
356
|
+
font-size: 15px;
|
|
357
|
+
cursor: default;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
@include state('ev-text-field-prefix') {
|
|
361
|
+
.ev-input {
|
|
362
|
+
padding: 0 $input-default-padding 0 #{$input-default-padding + $icon-width};
|
|
363
|
+
}
|
|
364
|
+
.icon-prefix {
|
|
365
|
+
left: 7px;
|
|
366
|
+
font-size: 15px;
|
|
367
|
+
cursor: default;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
@include state('ev-text-field-prefix-suffix') {
|
|
371
|
+
.ev-input {
|
|
372
|
+
padding: 0 #{$input-default-padding + $icon-width};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
</style>
|