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,358 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<teleport to="body">
|
|
3
|
-
<transition
|
|
4
|
-
name="ev-message-box-fade"
|
|
5
|
-
appear
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
v-show="isShow"
|
|
9
|
-
id="ev-message-box-modal"
|
|
10
|
-
@click.self="closeMsg('modal')"
|
|
11
|
-
@wheel.stop.prevent="() => {}"
|
|
12
|
-
>
|
|
13
|
-
<div
|
|
14
|
-
ref="msgRef"
|
|
15
|
-
class="ev-message-box"
|
|
16
|
-
:class="{
|
|
17
|
-
[`type-${type}`]: !!type,
|
|
18
|
-
'show-close': showClose,
|
|
19
|
-
'has-icon': !!iconClass,
|
|
20
|
-
'has-title': !!title,
|
|
21
|
-
}"
|
|
22
|
-
tabindex="-1"
|
|
23
|
-
>
|
|
24
|
-
<span
|
|
25
|
-
v-if="iconClass"
|
|
26
|
-
class="ev-message-box-icon"
|
|
27
|
-
>
|
|
28
|
-
<i
|
|
29
|
-
:class="iconClass"
|
|
30
|
-
/>
|
|
31
|
-
</span>
|
|
32
|
-
<div class="ev-message-box-content">
|
|
33
|
-
<p
|
|
34
|
-
v-if="title"
|
|
35
|
-
class="ev-message-box-title"
|
|
36
|
-
>
|
|
37
|
-
{{ title }}
|
|
38
|
-
</p>
|
|
39
|
-
<p
|
|
40
|
-
v-if="useHTML"
|
|
41
|
-
class="ev-message-box-message"
|
|
42
|
-
v-html="message"
|
|
43
|
-
/>
|
|
44
|
-
<p
|
|
45
|
-
v-else
|
|
46
|
-
class="ev-message-box-message"
|
|
47
|
-
>
|
|
48
|
-
{{ message }}
|
|
49
|
-
</p>
|
|
50
|
-
</div>
|
|
51
|
-
<div class="ev-message-box-btn">
|
|
52
|
-
<ev-button
|
|
53
|
-
v-if="showCancelBtn"
|
|
54
|
-
size="small"
|
|
55
|
-
class="ev-message-box-cancel"
|
|
56
|
-
:auto-focus="hasFocus('cancelBtn')"
|
|
57
|
-
@click="closeMsg('cancel')"
|
|
58
|
-
>
|
|
59
|
-
{{ cancelBtnText }}
|
|
60
|
-
</ev-button>
|
|
61
|
-
<ev-button
|
|
62
|
-
v-if="showConfirmBtn"
|
|
63
|
-
type="primary"
|
|
64
|
-
size="small"
|
|
65
|
-
class="ev-message-box-confirm"
|
|
66
|
-
:auto-focus="hasFocus('confirmBtn')"
|
|
67
|
-
@click="closeMsg('ok')"
|
|
68
|
-
>
|
|
69
|
-
{{ confirmBtnText }}
|
|
70
|
-
</ev-button>
|
|
71
|
-
</div>
|
|
72
|
-
<span
|
|
73
|
-
v-if="showClose"
|
|
74
|
-
class="ev-message-box-close"
|
|
75
|
-
@click="closeMsg('cancel')"
|
|
76
|
-
>
|
|
77
|
-
<i class="ev-icon-close" />
|
|
78
|
-
</span>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</transition>
|
|
82
|
-
</teleport>
|
|
83
|
-
</template>
|
|
84
|
-
|
|
85
|
-
<script>
|
|
86
|
-
import { reactive, toRefs, watch, onMounted, ref, onBeforeUnmount } from 'vue';
|
|
87
|
-
import EvButton from '@/components/button/Button.vue';
|
|
88
|
-
|
|
89
|
-
export default {
|
|
90
|
-
name: 'EvMessageBox',
|
|
91
|
-
components: {
|
|
92
|
-
EvButton,
|
|
93
|
-
},
|
|
94
|
-
props: {
|
|
95
|
-
type: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: '',
|
|
98
|
-
validator: val => ['', 'info', 'success', 'warning', 'error'].includes(val),
|
|
99
|
-
},
|
|
100
|
-
title: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: '',
|
|
103
|
-
},
|
|
104
|
-
message: {
|
|
105
|
-
type: [String, Array],
|
|
106
|
-
default: '',
|
|
107
|
-
},
|
|
108
|
-
iconClass: {
|
|
109
|
-
type: String,
|
|
110
|
-
default: '',
|
|
111
|
-
},
|
|
112
|
-
onClose: {
|
|
113
|
-
type: Function,
|
|
114
|
-
default: null,
|
|
115
|
-
},
|
|
116
|
-
showClose: {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
default: true,
|
|
119
|
-
},
|
|
120
|
-
showConfirmBtn: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
default: true,
|
|
123
|
-
},
|
|
124
|
-
showCancelBtn: {
|
|
125
|
-
type: Boolean,
|
|
126
|
-
default: true,
|
|
127
|
-
},
|
|
128
|
-
confirmBtnText: {
|
|
129
|
-
type: String,
|
|
130
|
-
default: 'OK',
|
|
131
|
-
},
|
|
132
|
-
cancelBtnText: {
|
|
133
|
-
type: String,
|
|
134
|
-
default: 'Cancel',
|
|
135
|
-
},
|
|
136
|
-
closeOnClickModal: {
|
|
137
|
-
type: Boolean,
|
|
138
|
-
default: true,
|
|
139
|
-
},
|
|
140
|
-
useHTML: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
default: false,
|
|
143
|
-
},
|
|
144
|
-
unmount: {
|
|
145
|
-
type: Function,
|
|
146
|
-
default: null,
|
|
147
|
-
},
|
|
148
|
-
focusable: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
default: false,
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
setup(props) {
|
|
154
|
-
const msgRef = ref(null);
|
|
155
|
-
|
|
156
|
-
const state = reactive({
|
|
157
|
-
isShow: true,
|
|
158
|
-
iconClass: '',
|
|
159
|
-
});
|
|
160
|
-
const closeMsg = (btnType) => {
|
|
161
|
-
if (!props.closeOnClickModal && btnType === 'modal') {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const type = btnType === 'modal' ? 'cancel' : btnType;
|
|
166
|
-
state.isShow = false;
|
|
167
|
-
|
|
168
|
-
if (props.onClose) {
|
|
169
|
-
props.onClose(type);
|
|
170
|
-
}
|
|
171
|
-
if (props.unmount) {
|
|
172
|
-
setTimeout(props.unmount, 1000);
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
const keydown = (e) => {
|
|
176
|
-
if (e.keyCode === 27 && state.isShow) {
|
|
177
|
-
closeMsg();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const getIconClassName = (type) => {
|
|
182
|
-
switch (type) {
|
|
183
|
-
case 'success':
|
|
184
|
-
return 'ev-icon-arrow-check';
|
|
185
|
-
case 'warning':
|
|
186
|
-
return 'ev-icon-warning2';
|
|
187
|
-
case 'error':
|
|
188
|
-
return 'ev-icon-warning3';
|
|
189
|
-
case 'info':
|
|
190
|
-
default:
|
|
191
|
-
return 'ev-icon-info2';
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
const setState = () => {
|
|
195
|
-
if (props.iconClass) {
|
|
196
|
-
state.iconClass = props.iconClass;
|
|
197
|
-
} else if (props.type) {
|
|
198
|
-
state.iconClass = getIconClassName(props.type);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const hasFocus = (type) => {
|
|
203
|
-
if (!props.focusable) return false;
|
|
204
|
-
|
|
205
|
-
switch (type) {
|
|
206
|
-
case 'confirmBtn':
|
|
207
|
-
return props.showConfirmBtn;
|
|
208
|
-
case 'cancelBtn':
|
|
209
|
-
return !props.showConfirmBtn && props.showCancelBtn;
|
|
210
|
-
case 'messagebox':
|
|
211
|
-
return !props.showConfirmBtn && !props.showCancelBtn;
|
|
212
|
-
default:
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
onMounted(() => {
|
|
218
|
-
setState();
|
|
219
|
-
document.addEventListener('keydown', keydown);
|
|
220
|
-
if (hasFocus('messagebox')) {
|
|
221
|
-
msgRef.value.focus();
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
watch(() => state.isShow, (val) => {
|
|
225
|
-
if (!val) {
|
|
226
|
-
document.removeEventListener('keydown', keydown);
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
onBeforeUnmount(() => {
|
|
230
|
-
document.removeEventListener('keydown', keydown);
|
|
231
|
-
});
|
|
232
|
-
return {
|
|
233
|
-
closeMsg,
|
|
234
|
-
...toRefs(state),
|
|
235
|
-
msgRef,
|
|
236
|
-
hasFocus,
|
|
237
|
-
};
|
|
238
|
-
},
|
|
239
|
-
};
|
|
240
|
-
</script>
|
|
241
|
-
|
|
242
|
-
<style lang="scss">
|
|
243
|
-
@import '../../style/index.scss';
|
|
244
|
-
|
|
245
|
-
#ev-message-box-modal {
|
|
246
|
-
display: flex;
|
|
247
|
-
position: fixed;
|
|
248
|
-
top: 0;
|
|
249
|
-
left: 0;
|
|
250
|
-
z-index: 901;
|
|
251
|
-
width: 100vw;
|
|
252
|
-
height: 100vh;
|
|
253
|
-
justify-content: center;
|
|
254
|
-
align-items: center;
|
|
255
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
256
|
-
transition: opacity .2s ease-in-out;
|
|
257
|
-
}
|
|
258
|
-
.ev-message-box {
|
|
259
|
-
$padding-vertical: 20px;
|
|
260
|
-
$padding-horizontal: 17px;
|
|
261
|
-
|
|
262
|
-
position: relative;
|
|
263
|
-
width: 400px;
|
|
264
|
-
padding: $padding-vertical $padding-horizontal $padding-vertical - 5px;
|
|
265
|
-
margin-bottom: 10px;
|
|
266
|
-
box-sizing: border-box;
|
|
267
|
-
border-radius: $default-radius;
|
|
268
|
-
background-color: #FDFDFD;
|
|
269
|
-
border: 1px solid #E3E3E3;
|
|
270
|
-
transition: opacity .2s ease-in-out, transform .3s ease-in-out;
|
|
271
|
-
font-size: $font-size-medium;
|
|
272
|
-
line-height: 1.5em;
|
|
273
|
-
|
|
274
|
-
&-fade-enter-active,
|
|
275
|
-
&-fade-leave-active {
|
|
276
|
-
.ev-message-box-layer {
|
|
277
|
-
opacity: 0;
|
|
278
|
-
}
|
|
279
|
-
.ev-message-box {
|
|
280
|
-
opacity: 0;
|
|
281
|
-
transform: translateY(-10%);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
&-title {
|
|
285
|
-
margin-bottom: 17px;
|
|
286
|
-
font-size: $font-size-large;
|
|
287
|
-
font-weight: 700;
|
|
288
|
-
}
|
|
289
|
-
&-icon {
|
|
290
|
-
position: absolute;
|
|
291
|
-
top: $padding-vertical;
|
|
292
|
-
left: $padding-horizontal;
|
|
293
|
-
font-size: $font-size-large + 2px;
|
|
294
|
-
}
|
|
295
|
-
&-close {
|
|
296
|
-
position: absolute;
|
|
297
|
-
top: $padding-vertical;
|
|
298
|
-
right: $padding-horizontal;
|
|
299
|
-
font-size: $font-size-small;
|
|
300
|
-
cursor: pointer;
|
|
301
|
-
transition: opacity $animate-base;
|
|
302
|
-
|
|
303
|
-
&:hover {
|
|
304
|
-
opacity: 0.5;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
&-btn {
|
|
308
|
-
margin-top: 23px;
|
|
309
|
-
text-align: right;
|
|
310
|
-
.ev-button {
|
|
311
|
-
min-width: 70px;
|
|
312
|
-
margin-left: 5px;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
@include state('show-close') {
|
|
317
|
-
.ev-message-box-message {
|
|
318
|
-
margin-right: 20px;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
@include state('has-icon') {
|
|
322
|
-
.ev-message-box-message {
|
|
323
|
-
margin-left: 23px;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
@include state('has-title') {
|
|
327
|
-
.ev-message-box-message {
|
|
328
|
-
margin: 0 5px;
|
|
329
|
-
}
|
|
330
|
-
&.show-close {
|
|
331
|
-
.ev-message-box-title {
|
|
332
|
-
margin-right: 20px;
|
|
333
|
-
}
|
|
334
|
-
.ev-message-box-message {
|
|
335
|
-
margin-right: 5px;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
&.has-icon {
|
|
339
|
-
.ev-message-box-title {
|
|
340
|
-
margin-left: 23px;
|
|
341
|
-
}
|
|
342
|
-
.ev-message-box-message {
|
|
343
|
-
margin-left: 5px;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
@each $type in ('info', 'success', 'warning', 'error') {
|
|
349
|
-
&.type-#{$type} {
|
|
350
|
-
.ev-message-box-icon {
|
|
351
|
-
@include evThemify() {
|
|
352
|
-
color: evThemed($type);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
</style>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, render } from 'vue';
|
|
2
|
-
import Component from './MessageBox.vue';
|
|
3
|
-
|
|
4
|
-
const componentObj = defineComponent(Component);
|
|
5
|
-
|
|
6
|
-
const messageBox = (options = {}) => {
|
|
7
|
-
const container = document.createElement('div');
|
|
8
|
-
const unmount = () => render(null, container);
|
|
9
|
-
const msgOption = (typeof options === 'string') ? { message: options, unmount } : { ...options, unmount };
|
|
10
|
-
const instance = h(
|
|
11
|
-
componentObj,
|
|
12
|
-
msgOption,
|
|
13
|
-
);
|
|
14
|
-
render(instance, container);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
messageBox.install = (app) => {
|
|
18
|
-
const global = app.config.globalProperties;
|
|
19
|
-
global.$messagebox = messageBox;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default messageBox;
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<transition
|
|
3
|
-
name="ev-notification-fade"
|
|
4
|
-
appear
|
|
5
|
-
>
|
|
6
|
-
<div
|
|
7
|
-
v-show="isShow"
|
|
8
|
-
class="ev-notification"
|
|
9
|
-
:class="{
|
|
10
|
-
[`type-${type}`]: !!type,
|
|
11
|
-
'show-close': showClose,
|
|
12
|
-
'has-icon': !!iconClass,
|
|
13
|
-
'has-click': !!onClick,
|
|
14
|
-
}"
|
|
15
|
-
@mouseenter="clearTimer"
|
|
16
|
-
@mouseleave="startTimer"
|
|
17
|
-
@click="clickMsg"
|
|
18
|
-
>
|
|
19
|
-
<span
|
|
20
|
-
v-if="iconClass"
|
|
21
|
-
class="ev-notification-icon"
|
|
22
|
-
>
|
|
23
|
-
<i
|
|
24
|
-
:class="iconClass"
|
|
25
|
-
/>
|
|
26
|
-
</span>
|
|
27
|
-
<div class="ev-notification-content">
|
|
28
|
-
<p
|
|
29
|
-
v-if="title"
|
|
30
|
-
class="title"
|
|
31
|
-
>
|
|
32
|
-
{{ title }}
|
|
33
|
-
</p>
|
|
34
|
-
<p
|
|
35
|
-
v-if="useHTML"
|
|
36
|
-
class="message"
|
|
37
|
-
v-html="message"
|
|
38
|
-
/>
|
|
39
|
-
<p
|
|
40
|
-
v-else
|
|
41
|
-
class="message"
|
|
42
|
-
>
|
|
43
|
-
{{ message }}
|
|
44
|
-
</p>
|
|
45
|
-
</div>
|
|
46
|
-
<span
|
|
47
|
-
v-if="showClose"
|
|
48
|
-
class="ev-notification-close"
|
|
49
|
-
@click="closeMsg"
|
|
50
|
-
>
|
|
51
|
-
<i class="ev-icon-close" />
|
|
52
|
-
</span>
|
|
53
|
-
</div>
|
|
54
|
-
</transition>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<script>
|
|
58
|
-
import { reactive, toRefs, onMounted, onBeforeUnmount } from 'vue';
|
|
59
|
-
|
|
60
|
-
export default {
|
|
61
|
-
name: 'EvNotification',
|
|
62
|
-
props: {
|
|
63
|
-
type: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: 'info',
|
|
66
|
-
validator: val => ['info', 'success', 'warning', 'error'].includes(val),
|
|
67
|
-
},
|
|
68
|
-
title: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: '',
|
|
71
|
-
},
|
|
72
|
-
message: {
|
|
73
|
-
type: String,
|
|
74
|
-
default: '',
|
|
75
|
-
},
|
|
76
|
-
position: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: 'top-right',
|
|
79
|
-
validator: val => ['top-left', 'top-right', 'bottom-left', 'bottom-right'].includes(val),
|
|
80
|
-
},
|
|
81
|
-
duration: {
|
|
82
|
-
type: Number,
|
|
83
|
-
default: 3000,
|
|
84
|
-
},
|
|
85
|
-
showClose: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: true,
|
|
88
|
-
},
|
|
89
|
-
iconClass: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: '',
|
|
92
|
-
},
|
|
93
|
-
onClose: {
|
|
94
|
-
type: Function,
|
|
95
|
-
default: null,
|
|
96
|
-
},
|
|
97
|
-
onClick: {
|
|
98
|
-
type: Function,
|
|
99
|
-
default: null,
|
|
100
|
-
},
|
|
101
|
-
useHTML: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: false,
|
|
104
|
-
},
|
|
105
|
-
unmount: {
|
|
106
|
-
type: Function,
|
|
107
|
-
default: null,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
setup(props) {
|
|
111
|
-
const state = reactive({
|
|
112
|
-
timer: null,
|
|
113
|
-
isShow: true,
|
|
114
|
-
});
|
|
115
|
-
const clearTimer = () => {
|
|
116
|
-
clearTimeout(state.timer);
|
|
117
|
-
state.timer = null;
|
|
118
|
-
};
|
|
119
|
-
const clickMsg = (e) => {
|
|
120
|
-
if (e.target.className === 'ev-notification-close') {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (props.onClick) {
|
|
124
|
-
props.onClick();
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const closeMsg = () => {
|
|
128
|
-
state.isShow = false;
|
|
129
|
-
if (props.onClose) {
|
|
130
|
-
props.onClose();
|
|
131
|
-
}
|
|
132
|
-
clearTimer();
|
|
133
|
-
if (props.unmount) {
|
|
134
|
-
setTimeout(props.unmount, 1000);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const startTimer = () => {
|
|
138
|
-
if (props.duration > 0) {
|
|
139
|
-
state.timer = setTimeout(() => {
|
|
140
|
-
if (state.isShow) {
|
|
141
|
-
closeMsg();
|
|
142
|
-
}
|
|
143
|
-
}, props.duration);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
const keydown = (e) => {
|
|
147
|
-
if (e.keyCode === 27 && state.isShow) {
|
|
148
|
-
closeMsg();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
onMounted(() => {
|
|
153
|
-
startTimer();
|
|
154
|
-
document.addEventListener('keydown', keydown);
|
|
155
|
-
});
|
|
156
|
-
onBeforeUnmount(() => {
|
|
157
|
-
document.removeEventListener('keydown', keydown);
|
|
158
|
-
clearTimer();
|
|
159
|
-
});
|
|
160
|
-
return {
|
|
161
|
-
startTimer,
|
|
162
|
-
clearTimer,
|
|
163
|
-
clickMsg,
|
|
164
|
-
closeMsg,
|
|
165
|
-
...toRefs(state),
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
</script>
|
|
170
|
-
|
|
171
|
-
<style lang="scss">
|
|
172
|
-
@import '../../style/index.scss';
|
|
173
|
-
|
|
174
|
-
#ev-notification-modal {
|
|
175
|
-
max-height: 100vh;
|
|
176
|
-
overflow: hidden;
|
|
177
|
-
|
|
178
|
-
@each $position in ('top-left', 'top-right', 'bottom-left', 'bottom-right') {
|
|
179
|
-
.modal-#{$position} {
|
|
180
|
-
position: fixed;
|
|
181
|
-
z-index: 900;
|
|
182
|
-
padding: 10px;
|
|
183
|
-
|
|
184
|
-
@if $position == 'top-left' {
|
|
185
|
-
top: 0;
|
|
186
|
-
left: 0;
|
|
187
|
-
|
|
188
|
-
.ev-notification-fade-enter-active {
|
|
189
|
-
opacity: 0;
|
|
190
|
-
transform: translateY(-10%);
|
|
191
|
-
}
|
|
192
|
-
.ev-notification-fade-leave-active {
|
|
193
|
-
opacity: 0;
|
|
194
|
-
transform: translateX(-100%);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@else if $position == 'top-right' {
|
|
199
|
-
top: 0;
|
|
200
|
-
right: 0;
|
|
201
|
-
|
|
202
|
-
.ev-notification-fade-enter-active {
|
|
203
|
-
opacity: 0;
|
|
204
|
-
transform: translateY(-10%);
|
|
205
|
-
}
|
|
206
|
-
.ev-notification-fade-leave-active {
|
|
207
|
-
opacity: 0;
|
|
208
|
-
transform: translateX(100%);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
@else if $position == 'bottom-left' {
|
|
212
|
-
left: 0;
|
|
213
|
-
bottom: 0;
|
|
214
|
-
|
|
215
|
-
.ev-notification-fade-enter-active {
|
|
216
|
-
opacity: 0;
|
|
217
|
-
transform: translateY(10%);
|
|
218
|
-
}
|
|
219
|
-
.ev-notification-fade-leave-active {
|
|
220
|
-
opacity: 0;
|
|
221
|
-
transform: translateX(-100%);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
@else if $position == 'bottom-right' {
|
|
225
|
-
bottom: 0;
|
|
226
|
-
right: 0;
|
|
227
|
-
|
|
228
|
-
.ev-notification-fade-enter-active {
|
|
229
|
-
opacity: 0;
|
|
230
|
-
transform: translateY(10%);
|
|
231
|
-
}
|
|
232
|
-
.ev-notification-fade-leave-active {
|
|
233
|
-
opacity: 0;
|
|
234
|
-
transform: translateX(100%);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
.ev-notification {
|
|
241
|
-
$padding-vertical: 20px;
|
|
242
|
-
$padding-horizontal: 17px;
|
|
243
|
-
|
|
244
|
-
display: flex;
|
|
245
|
-
position: relative;
|
|
246
|
-
width: 400px;
|
|
247
|
-
padding: $padding-vertical $padding-horizontal;
|
|
248
|
-
margin-bottom: 10px;
|
|
249
|
-
align-items: center;
|
|
250
|
-
box-sizing: border-box;
|
|
251
|
-
border-radius: $default-radius;
|
|
252
|
-
transition: opacity .3s ease-in-out, transform .2s ease-in-out;
|
|
253
|
-
font-size: $font-size-medium;
|
|
254
|
-
line-height: 1.5em;
|
|
255
|
-
|
|
256
|
-
@include evThemify() {
|
|
257
|
-
box-shadow: 3px 3px 12px 3px evThemed('background-lighten');
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
&-content .title {
|
|
261
|
-
margin-bottom: 7px;
|
|
262
|
-
font-size: $font-size-large;
|
|
263
|
-
font-weight: 700;
|
|
264
|
-
}
|
|
265
|
-
&-icon {
|
|
266
|
-
position: absolute;
|
|
267
|
-
top: $padding-vertical;
|
|
268
|
-
left: $padding-horizontal;
|
|
269
|
-
}
|
|
270
|
-
&-close {
|
|
271
|
-
position: absolute;
|
|
272
|
-
top: $padding-vertical;
|
|
273
|
-
right: $padding-horizontal;
|
|
274
|
-
font-size: $font-size-small;
|
|
275
|
-
cursor: pointer;
|
|
276
|
-
transition: opacity $animate-base;
|
|
277
|
-
|
|
278
|
-
&:hover {
|
|
279
|
-
opacity: 0.5;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
@include state('show-close') {
|
|
284
|
-
.ev-notification-content {
|
|
285
|
-
margin-right: 20px;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
@include state('has-icon') {
|
|
289
|
-
.ev-notification-content {
|
|
290
|
-
margin-left: 23px;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
@include state('has-click') {
|
|
294
|
-
cursor: pointer;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
@each $type in ('info', 'success', 'warning', 'error') {
|
|
298
|
-
&.type-#{$type} {
|
|
299
|
-
@if $type == 'info' {
|
|
300
|
-
background-color: #FDFDFD;
|
|
301
|
-
border: 1px solid #E3E3E3;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
@else {
|
|
305
|
-
@include evThemify() {
|
|
306
|
-
background-color: evThemed($type);
|
|
307
|
-
}
|
|
308
|
-
.ev-notification-icon,
|
|
309
|
-
.ev-notification-content {
|
|
310
|
-
color: $color-white;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
</style>
|