evui 3.4.206 → 3.4.208
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 +18 -33
- package/dist/404.html +44 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.js +22645 -0
- package/dist/index.umd.cjs +28 -0
- package/dist/style.css +1 -0
- package/package.json +46 -43
- package/dist/evui.common.js +0 -63678
- package/dist/evui.common.js.map +0 -1
- package/dist/evui.umd.js +0 -63688
- package/dist/evui.umd.js.map +0 -1
- package/dist/evui.umd.min.js +0 -2
- package/dist/evui.umd.min.js.map +0 -1
- package/dist/img/EVUI.b82ee81a.svg +0 -293
- package/src/assets/logo.png +0 -0
- package/src/common/emitter.js +0 -20
- package/src/common/utils.bignumber.js +0 -67
- package/src/common/utils.debounce.js +0 -223
- package/src/common/utils.js +0 -151
- package/src/common/utils.table.js +0 -78
- package/src/common/utils.throttle.js +0 -83
- package/src/common/utils.tree.js +0 -18
- package/src/components/button/Button.vue +0 -195
- package/src/components/button/index.js +0 -7
- package/src/components/buttonGroup/ButtonGroup.vue +0 -11
- package/src/components/buttonGroup/index.js +0 -7
- package/src/components/calendar/Calendar.vue +0 -725
- package/src/components/calendar/index.js +0 -7
- package/src/components/calendar/uses.js +0 -1410
- package/src/components/chart/Chart.vue +0 -363
- package/src/components/chart/ChartToolbar.vue +0 -52
- package/src/components/chart/chart.core.js +0 -1170
- package/src/components/chart/chartZoom.core.js +0 -540
- package/src/components/chart/element/element.bar.js +0 -672
- package/src/components/chart/element/element.bar.time.js +0 -166
- package/src/components/chart/element/element.heatmap.js +0 -743
- package/src/components/chart/element/element.line.js +0 -611
- package/src/components/chart/element/element.pie.js +0 -197
- package/src/components/chart/element/element.scatter.js +0 -320
- package/src/components/chart/element/element.tip.js +0 -717
- package/src/components/chart/helpers/helpers.canvas.js +0 -265
- package/src/components/chart/helpers/helpers.constant.js +0 -235
- package/src/components/chart/helpers/helpers.util.js +0 -400
- package/src/components/chart/index.js +0 -9
- package/src/components/chart/model/index.js +0 -50
- package/src/components/chart/model/model.series.js +0 -125
- package/src/components/chart/model/model.store.js +0 -1427
- package/src/components/chart/plugins/plugins.interaction.js +0 -1655
- package/src/components/chart/plugins/plugins.legend.gradient.js +0 -606
- package/src/components/chart/plugins/plugins.legend.js +0 -1543
- package/src/components/chart/plugins/plugins.pie.js +0 -254
- package/src/components/chart/plugins/plugins.scrollbar.js +0 -732
- package/src/components/chart/plugins/plugins.title.js +0 -61
- package/src/components/chart/plugins/plugins.tooltip.js +0 -1041
- package/src/components/chart/scale/scale.js +0 -951
- package/src/components/chart/scale/scale.linear.js +0 -268
- package/src/components/chart/scale/scale.logarithmic.js +0 -135
- package/src/components/chart/scale/scale.step.js +0 -430
- package/src/components/chart/scale/scale.time.category.js +0 -338
- package/src/components/chart/scale/scale.time.js +0 -49
- package/src/components/chart/style/chart.scss +0 -405
- package/src/components/chart/uses.js +0 -721
- package/src/components/chartBrush/ChartBrush.vue +0 -323
- package/src/components/chartBrush/chartBrush.core.js +0 -691
- package/src/components/chartBrush/index.js +0 -9
- package/src/components/chartBrush/uses.js +0 -23
- package/src/components/chartGroup/ChartGroup.vue +0 -144
- package/src/components/chartGroup/index.js +0 -9
- package/src/components/chartGroup/style/chartGroup.scss +0 -5
- package/src/components/chartGroup/uses.js +0 -53
- package/src/components/checkbox/Checkbox.vue +0 -229
- package/src/components/checkbox/index.js +0 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +0 -44
- package/src/components/checkboxGroup/index.js +0 -7
- package/src/components/contextMenu/ContextMenu.vue +0 -95
- package/src/components/contextMenu/MenuList.vue +0 -182
- package/src/components/contextMenu/index.js +0 -7
- package/src/components/contextMenu/uses.js +0 -223
- package/src/components/datePicker/DatePicker.vue +0 -504
- package/src/components/datePicker/index.js +0 -7
- package/src/components/datePicker/uses.js +0 -460
- package/src/components/grid/Grid.vue +0 -1535
- package/src/components/grid/GridColumnSetting.vue +0 -358
- package/src/components/grid/GridFilterSetting.vue +0 -323
- package/src/components/grid/GridPagination.vue +0 -75
- package/src/components/grid/GridSummary.vue +0 -314
- package/src/components/grid/GridToolbar.vue +0 -35
- package/src/components/grid/icon/icon-option-button.vue +0 -17
- package/src/components/grid/icon/icon-sort-button.vue +0 -67
- package/src/components/grid/index.js +0 -11
- package/src/components/grid/style/grid.scss +0 -417
- package/src/components/grid/uses.js +0 -1629
- package/src/components/icon/Icon.vue +0 -53
- package/src/components/icon/index.js +0 -8
- package/src/components/inputNumber/InputNumber.vue +0 -212
- package/src/components/inputNumber/index.js +0 -7
- package/src/components/inputNumber/uses.js +0 -217
- package/src/components/loading/Loading.vue +0 -125
- package/src/components/loading/index.js +0 -7
- package/src/components/menu/Menu.vue +0 -79
- package/src/components/menu/MenuItem.vue +0 -201
- package/src/components/menu/index.js +0 -7
- package/src/components/message/Message.vue +0 -229
- package/src/components/message/index.js +0 -34
- package/src/components/messageBox/MessageBox.vue +0 -358
- package/src/components/messageBox/index.js +0 -22
- package/src/components/notification/Notification.vue +0 -316
- package/src/components/notification/index.js +0 -49
- package/src/components/pagination/Pagination.vue +0 -317
- package/src/components/pagination/index.js +0 -7
- package/src/components/pagination/pageButton.vue +0 -31
- package/src/components/progress/Progress.vue +0 -139
- package/src/components/progress/index.js +0 -7
- package/src/components/radio/Radio.vue +0 -159
- package/src/components/radio/index.js +0 -7
- package/src/components/radioGroup/RadioGroup.vue +0 -41
- package/src/components/radioGroup/index.js +0 -7
- package/src/components/scheduler/Scheduler.vue +0 -149
- package/src/components/scheduler/index.js +0 -7
- package/src/components/scheduler/uses.js +0 -183
- package/src/components/select/Select.vue +0 -556
- package/src/components/select/index.js +0 -7
- package/src/components/select/uses.js +0 -379
- package/src/components/slider/Slider.vue +0 -505
- package/src/components/slider/index.js +0 -7
- package/src/components/slider/uses.js +0 -391
- package/src/components/tabPanel/TabPanel.vue +0 -74
- package/src/components/tabPanel/index.js +0 -7
- package/src/components/tabs/Tabs.vue +0 -517
- package/src/components/tabs/index.js +0 -7
- package/src/components/textField/TextField.vue +0 -399
- package/src/components/textField/index.js +0 -7
- package/src/components/timePicker/TimePicker.vue +0 -364
- package/src/components/timePicker/index.js +0 -7
- package/src/components/toggle/Toggle.vue +0 -115
- package/src/components/toggle/index.js +0 -7
- package/src/components/tree/Tree.vue +0 -338
- package/src/components/tree/TreeNode.vue +0 -293
- package/src/components/tree/index.js +0 -7
- package/src/components/treeGrid/TreeGrid.vue +0 -1074
- package/src/components/treeGrid/TreeGridNode.vue +0 -349
- package/src/components/treeGrid/TreeGridToolbar.vue +0 -35
- package/src/components/treeGrid/icon/icon-tree.png +0 -0
- package/src/components/treeGrid/index.js +0 -9
- package/src/components/treeGrid/style/treeGrid.scss +0 -277
- package/src/components/treeGrid/uses.js +0 -1178
- package/src/components/window/Window.vue +0 -329
- package/src/components/window/index.js +0 -7
- package/src/components/window/uses.js +0 -908
- package/src/directives/clickoutside.js +0 -90
- package/src/main.js +0 -120
- package/src/style/components/input.scss +0 -108
- package/src/style/functions.scss +0 -3
- package/src/style/index.scss +0 -6
- package/src/style/lib/fonts/EVUI.eot +0 -0
- package/src/style/lib/fonts/EVUI.svg +0 -293
- package/src/style/lib/fonts/EVUI.ttf +0 -0
- package/src/style/lib/fonts/EVUI.woff +0 -0
- package/src/style/lib/icon.css +0 -888
- package/src/style/mixins.scss +0 -94
- package/src/style/themes.scss +0 -69
- package/src/style/variables.scss +0 -22
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ev-time-picker">
|
|
3
|
-
<div
|
|
4
|
-
v-if="type==='range'"
|
|
5
|
-
class="ev-time-picker-range"
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
:class="{
|
|
9
|
-
error: isWrongType.rangeStart,
|
|
10
|
-
clearable,
|
|
11
|
-
disabled,
|
|
12
|
-
readonly,
|
|
13
|
-
}"
|
|
14
|
-
class="ev-time-picker-wrapper"
|
|
15
|
-
>
|
|
16
|
-
<input
|
|
17
|
-
v-model="time[0]"
|
|
18
|
-
class="ev-input"
|
|
19
|
-
:disabled="disabled"
|
|
20
|
-
:readonly="readonly"
|
|
21
|
-
:placeholder="placeholders[0]"
|
|
22
|
-
@focus="focusInputStartTime"
|
|
23
|
-
@blur="blurInputStartTime"
|
|
24
|
-
@change="changeStartTime"
|
|
25
|
-
/>
|
|
26
|
-
<ev-icon
|
|
27
|
-
icon="ev-icon-time"
|
|
28
|
-
class="ev-input-prefix"
|
|
29
|
-
/>
|
|
30
|
-
<ev-icon
|
|
31
|
-
v-if="clearable"
|
|
32
|
-
icon="ev-icon-error"
|
|
33
|
-
class="ev-input-suffix"
|
|
34
|
-
@click="clearStartTime"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
<p class="tilde">~</p>
|
|
38
|
-
<div
|
|
39
|
-
:class="{
|
|
40
|
-
error: isWrongType.rangeEnd,
|
|
41
|
-
clearable,
|
|
42
|
-
disabled,
|
|
43
|
-
readonly,
|
|
44
|
-
}"
|
|
45
|
-
class="ev-time-picker-wrapper"
|
|
46
|
-
>
|
|
47
|
-
<input
|
|
48
|
-
v-model="time[1]"
|
|
49
|
-
class="ev-input"
|
|
50
|
-
:disabled="disabled"
|
|
51
|
-
:readonly="readonly"
|
|
52
|
-
:placeholder="placeholders[1]"
|
|
53
|
-
@focus="focusInputEndTime"
|
|
54
|
-
@blur="blurInputEndTime"
|
|
55
|
-
@change="changeEndTime"
|
|
56
|
-
/>
|
|
57
|
-
<ev-icon
|
|
58
|
-
icon="ev-icon-time"
|
|
59
|
-
class="ev-input-prefix"
|
|
60
|
-
/>
|
|
61
|
-
<ev-icon
|
|
62
|
-
v-if="clearable"
|
|
63
|
-
icon="ev-icon-error"
|
|
64
|
-
class="ev-input-suffix"
|
|
65
|
-
@click="clearEndTime"
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
<div
|
|
70
|
-
v-else
|
|
71
|
-
class="ev-time-picker-single"
|
|
72
|
-
>
|
|
73
|
-
<div
|
|
74
|
-
:class="{
|
|
75
|
-
error: isWrongType.single,
|
|
76
|
-
clearable,
|
|
77
|
-
disabled,
|
|
78
|
-
readonly,
|
|
79
|
-
}"
|
|
80
|
-
class="ev-time-picker-wrapper"
|
|
81
|
-
>
|
|
82
|
-
<input
|
|
83
|
-
v-model="time"
|
|
84
|
-
class="ev-input"
|
|
85
|
-
:disabled="disabled"
|
|
86
|
-
:readonly="readonly"
|
|
87
|
-
:placeholder="typeof placeholder === 'string' ? placeholder : 'Enter time'"
|
|
88
|
-
@focus="focusInputTime"
|
|
89
|
-
@blur="blurInputTime"
|
|
90
|
-
@change="changeTime"
|
|
91
|
-
/>
|
|
92
|
-
<ev-icon
|
|
93
|
-
icon="ev-icon-time"
|
|
94
|
-
class="ev-input-prefix"
|
|
95
|
-
/>
|
|
96
|
-
<ev-icon
|
|
97
|
-
v-if="clearable"
|
|
98
|
-
icon="ev-icon-error"
|
|
99
|
-
class="ev-input-suffix"
|
|
100
|
-
@click="clearContents"
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</template>
|
|
106
|
-
|
|
107
|
-
<script>
|
|
108
|
-
import { ref, reactive, computed } from 'vue';
|
|
109
|
-
|
|
110
|
-
export default {
|
|
111
|
-
name: 'EvTimePicker',
|
|
112
|
-
props: {
|
|
113
|
-
modelValue: {
|
|
114
|
-
type: [Array, String],
|
|
115
|
-
default: '',
|
|
116
|
-
validator: (time) => {
|
|
117
|
-
const timeRegexExp = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;
|
|
118
|
-
if (Array.isArray(time) && (!timeRegexExp.test(time[0]) || !timeRegexExp.test(time[1]))) {
|
|
119
|
-
// range mode
|
|
120
|
-
console.warn('Please check the time format in the Timepicker.');
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
if (!Array.isArray(time) && !timeRegexExp.test(time)) {
|
|
124
|
-
// single mode
|
|
125
|
-
console.warn('Please check the time format in the Timepicker.');
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return true;
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
type: {
|
|
132
|
-
type: String,
|
|
133
|
-
default: 'range',
|
|
134
|
-
},
|
|
135
|
-
clearable: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
default: false,
|
|
138
|
-
},
|
|
139
|
-
disabled: {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: false,
|
|
142
|
-
},
|
|
143
|
-
readonly: {
|
|
144
|
-
type: Boolean,
|
|
145
|
-
default: false,
|
|
146
|
-
},
|
|
147
|
-
placeholder: {
|
|
148
|
-
type: [String, Array],
|
|
149
|
-
required: false,
|
|
150
|
-
default: undefined,
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
emits: {
|
|
154
|
-
'update:modelValue': null,
|
|
155
|
-
focus: null,
|
|
156
|
-
blur: null,
|
|
157
|
-
change: null,
|
|
158
|
-
},
|
|
159
|
-
setup(props, { emit }) {
|
|
160
|
-
const time = computed({
|
|
161
|
-
get: () => props.modelValue,
|
|
162
|
-
set: (value) => {
|
|
163
|
-
if (props.type === 'range') {
|
|
164
|
-
if (Array.isArray(value)) {
|
|
165
|
-
const startTime = (value[0] > value[1] ? '00:00' : value[0]);
|
|
166
|
-
const endTime = (startTime.value > value[1] ? '23:59' : value[1]);
|
|
167
|
-
|
|
168
|
-
emit('update:modelValue', [startTime, endTime]);
|
|
169
|
-
}
|
|
170
|
-
} else {
|
|
171
|
-
emit('update:modelValue', value);
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
}); // <string | string[]>
|
|
175
|
-
|
|
176
|
-
const placeholders = computed(() => {
|
|
177
|
-
const defaultValue = ['start time', 'end time'];
|
|
178
|
-
if (Array.isArray(props.placeholder)) {
|
|
179
|
-
return [
|
|
180
|
-
typeof props.placeholder[0] === 'string' ? props.placeholder[0] : defaultValue[0],
|
|
181
|
-
typeof props.placeholder[1] === 'string' ? props.placeholder[1] : defaultValue[1],
|
|
182
|
-
];
|
|
183
|
-
}
|
|
184
|
-
if (typeof props.placeholder === 'string') return [props.placeholder, props.placeholder];
|
|
185
|
-
return defaultValue;
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
const previousValue = ref(
|
|
189
|
-
Array.isArray(time.value) ? [`${time.value[0]}`, `${time.value[1]}`] : `${time.value}`,
|
|
190
|
-
); // <string | string[]>
|
|
191
|
-
|
|
192
|
-
const isWrongType = reactive({
|
|
193
|
-
single: false,
|
|
194
|
-
rangeStart: false,
|
|
195
|
-
rangeEnd: false,
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
const validTimeExp = (timeExp) => {
|
|
199
|
-
const timeRegexExp = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;
|
|
200
|
-
return timeRegexExp.test(timeExp);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const setValidStartTime = () => {
|
|
204
|
-
if (!Array.isArray(time.value)) return;
|
|
205
|
-
if (!validTimeExp(time.value[0])) {
|
|
206
|
-
time.value[0] = previousValue.value[0];
|
|
207
|
-
}
|
|
208
|
-
if (time.value[1] && (time.value[0] > time.value[1])) {
|
|
209
|
-
time.value[0] = time.value[1];
|
|
210
|
-
}
|
|
211
|
-
previousValue.value[0] = time.value[0];
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const setValidEndTime = () => {
|
|
215
|
-
if (!Array.isArray(time.value)) return;
|
|
216
|
-
if (!validTimeExp(time.value[1])) {
|
|
217
|
-
time.value[1] = previousValue.value[1];
|
|
218
|
-
}
|
|
219
|
-
if (time.value[0] && (time.value[0] > time.value[1])) {
|
|
220
|
-
time.value[1] = previousValue.value[1];
|
|
221
|
-
if (time.value[0] > previousValue.value[1]) {
|
|
222
|
-
time.value[1] = time.value[0];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
previousValue.value[1] = time.value[1];
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
// startTime event for range type
|
|
229
|
-
const focusInputStartTime = (e) => {
|
|
230
|
-
emit('focus', e);
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
const blurInputStartTime = (e) => {
|
|
234
|
-
emit('blur', e);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const changeStartTime = (e) => {
|
|
238
|
-
setValidStartTime();
|
|
239
|
-
isWrongType.rangeStart = false;
|
|
240
|
-
emit('change', e, time.value);
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const clearStartTime = () => {
|
|
244
|
-
time.value[0] = '';
|
|
245
|
-
isWrongType.rangeStart = true;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// endTime event for range type
|
|
249
|
-
const focusInputEndTime = (e) => {
|
|
250
|
-
emit('focus', e);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const blurInputEndTime = (e) => {
|
|
254
|
-
emit('blur', e);
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
const changeEndTime = (e) => {
|
|
258
|
-
setValidEndTime();
|
|
259
|
-
isWrongType.rangeEnd = false;
|
|
260
|
-
emit('change', e, time.value);
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
const clearEndTime = () => {
|
|
264
|
-
time.value[1] = '';
|
|
265
|
-
isWrongType.rangeEnd = true;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// event for single type
|
|
269
|
-
const focusInputTime = (e) => {
|
|
270
|
-
emit('focus', e);
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const blurInputTime = (e) => {
|
|
274
|
-
emit('blur', e);
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const changeTime = (e) => {
|
|
278
|
-
if (!validTimeExp(time.value)) {
|
|
279
|
-
time.value = previousValue.value;
|
|
280
|
-
} else {
|
|
281
|
-
previousValue.value = time.value;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
isWrongType.single = !validTimeExp(time.value);
|
|
285
|
-
|
|
286
|
-
emit('change', e, time.value);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const clearContents = () => {
|
|
290
|
-
time.value = '';
|
|
291
|
-
isWrongType.single = true;
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
return {
|
|
295
|
-
time,
|
|
296
|
-
isWrongType,
|
|
297
|
-
previousValue,
|
|
298
|
-
clearContents,
|
|
299
|
-
clearStartTime,
|
|
300
|
-
clearEndTime,
|
|
301
|
-
focusInputTime,
|
|
302
|
-
blurInputTime,
|
|
303
|
-
changeTime,
|
|
304
|
-
focusInputStartTime,
|
|
305
|
-
blurInputStartTime,
|
|
306
|
-
changeStartTime,
|
|
307
|
-
focusInputEndTime,
|
|
308
|
-
blurInputEndTime,
|
|
309
|
-
changeEndTime,
|
|
310
|
-
placeholders,
|
|
311
|
-
};
|
|
312
|
-
},
|
|
313
|
-
};
|
|
314
|
-
</script>
|
|
315
|
-
|
|
316
|
-
<style lang="scss">
|
|
317
|
-
@import '../../style/index.scss';
|
|
318
|
-
@import '../../style/components/input.scss';
|
|
319
|
-
|
|
320
|
-
.ev-time-picker {
|
|
321
|
-
width: 100%;
|
|
322
|
-
height: 35px;
|
|
323
|
-
|
|
324
|
-
.ev-time-picker-range {
|
|
325
|
-
display: flex;
|
|
326
|
-
height: 100%;
|
|
327
|
-
align-items: center;
|
|
328
|
-
|
|
329
|
-
.tilde {
|
|
330
|
-
padding: 0 10px;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.ev-time-picker-single {
|
|
335
|
-
height: 100%;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.ev-time-picker-wrapper {
|
|
339
|
-
position: relative;
|
|
340
|
-
width: 150px;
|
|
341
|
-
height: 100%;
|
|
342
|
-
|
|
343
|
-
.ev-input {
|
|
344
|
-
padding: 0 30px;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.ev-input-prefix {
|
|
349
|
-
position: absolute;
|
|
350
|
-
left: 0;
|
|
351
|
-
padding: 10px;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.ev-input-suffix {
|
|
355
|
-
position: absolute;
|
|
356
|
-
right: 0;
|
|
357
|
-
padding: 10px;
|
|
358
|
-
|
|
359
|
-
&:hover {
|
|
360
|
-
cursor: pointer;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
</style>
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="ev-toggle"
|
|
4
|
-
:class="{
|
|
5
|
-
checked: modelValue,
|
|
6
|
-
disabled,
|
|
7
|
-
readonly,
|
|
8
|
-
}"
|
|
9
|
-
:style="{
|
|
10
|
-
width: `${width}px`,
|
|
11
|
-
border: `1px solid ${ modelValue ? activeColor : inactiveColor }`,
|
|
12
|
-
'background-color': `${ modelValue ? activeColor : inactiveColor }`,
|
|
13
|
-
}"
|
|
14
|
-
@click="clickMv"
|
|
15
|
-
/>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
import { computed } from 'vue';
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
name: 'EvToggle',
|
|
23
|
-
props: {
|
|
24
|
-
modelValue: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
readonly: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false,
|
|
31
|
-
},
|
|
32
|
-
disabled: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
width: {
|
|
37
|
-
type: Number,
|
|
38
|
-
default: 40,
|
|
39
|
-
},
|
|
40
|
-
activeColor: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: '#409EFF',
|
|
43
|
-
},
|
|
44
|
-
inactiveColor: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: '#DCDFE6',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
emits: ['update:modelValue', 'change'],
|
|
50
|
-
setup(props, { emit }) {
|
|
51
|
-
const mv = computed({
|
|
52
|
-
get: () => props.modelValue,
|
|
53
|
-
set: (val) => {
|
|
54
|
-
emit('update:modelValue', val);
|
|
55
|
-
emit('change', val);
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
const clickMv = () => {
|
|
59
|
-
if (!props.disabled && !props.readonly) {
|
|
60
|
-
mv.value = !mv.value;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
mv,
|
|
66
|
-
clickMv,
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<style lang="scss">
|
|
73
|
-
@import '../../style/index.scss';
|
|
74
|
-
|
|
75
|
-
.ev-toggle {
|
|
76
|
-
display: inline-block;
|
|
77
|
-
position: relative;
|
|
78
|
-
width: 40px;
|
|
79
|
-
height: 20px;
|
|
80
|
-
margin: 0;
|
|
81
|
-
border-radius: 10px;
|
|
82
|
-
box-sizing: border-box;
|
|
83
|
-
transition: border-color .3s, background-color .3s;
|
|
84
|
-
outline: none;
|
|
85
|
-
cursor: pointer;
|
|
86
|
-
|
|
87
|
-
&:after {
|
|
88
|
-
position: absolute;
|
|
89
|
-
top: 1px;
|
|
90
|
-
left: 1px;
|
|
91
|
-
border-radius: 100%;
|
|
92
|
-
transition: all .3s;
|
|
93
|
-
width: 16px;
|
|
94
|
-
height: 16px;
|
|
95
|
-
background-color: $color-white;
|
|
96
|
-
content: '';
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&.checked:after {
|
|
100
|
-
left: calc(100% - 17px);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&.readonly {
|
|
104
|
-
opacity: .6;
|
|
105
|
-
cursor: default;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&.disabled {
|
|
109
|
-
opacity: .6;
|
|
110
|
-
cursor: not-allowed;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</style>
|