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,22 +1,22 @@
|
|
|
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
|
+
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 +1,316 @@
|
|
|
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>
|
|
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>
|