evui 2.0.9 → 2.1.2

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.
Files changed (185) hide show
  1. package/dist/0b8d1200e71cae8d747dce4e69c4efb6.png +0 -0
  2. package/dist/1.css +4 -0
  3. package/dist/1.css.map +1 -0
  4. package/dist/1.evui.min.js +2 -0
  5. package/dist/1.evui.min.js.map +1 -0
  6. package/dist/1ba679c05036b34bf359aa2e6c450faa.ttf +0 -0
  7. package/dist/2.css +4 -0
  8. package/dist/2.css.map +1 -0
  9. package/dist/2.evui.min.js +2 -0
  10. package/dist/2.evui.min.js.map +1 -0
  11. package/dist/278156e41e0ad908cf7f841b17130502.woff2 +0 -0
  12. package/dist/3.evui.min.js +2 -0
  13. package/dist/3.evui.min.js.map +1 -0
  14. package/dist/32be89b11725274cd3e801192ba88361.ttf +0 -0
  15. package/dist/38c6d8bab26db77d8c806813e1497763.woff2 +0 -0
  16. package/dist/4.evui.min.js +2 -0
  17. package/dist/4.evui.min.js.map +1 -0
  18. package/dist/425399f81e4ce7cbd967685402ba0260.woff +0 -0
  19. package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
  20. package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
  21. package/dist/5367103510b27b78482794590e1ce3b0.ttf +0 -0
  22. package/dist/57e963e3d6dd0a9cf05150b40eebf69b.svg +1008 -0
  23. package/dist/65a2fb6d9aaa164b41a039302093995b.ttf +0 -0
  24. package/dist/687a4990ea22bb1a49d469a5d9319790.woff2 +0 -0
  25. package/dist/6c1d906bf5ba48676f65b2d65e935e1a.ttf +0 -0
  26. package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
  27. package/dist/752905fa5edf21fc52a10a0c1ca9c7a4.eot +0 -0
  28. package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
  29. package/dist/7d62eb50e7bb05eedb2a4656f7fe8f3b.svg +366 -0
  30. package/dist/a01e3f2d6c83dc3aee175e2482b3f777.eot +0 -0
  31. package/dist/b30fd8419d7e6d5918856c7531d33482.svg +1518 -0
  32. package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
  33. package/dist/c656b8caa454ed19b9a2ef7f4f5b8fea.ttf +0 -0
  34. package/dist/cac87dc00c87a5d74711d0276713808a.woff +0 -0
  35. package/dist/d68fa3e67dbb653a13cec44b1bcabcfe.eot +0 -0
  36. package/dist/ddae9b1ba9b0b42f58809904b0b21349.woff +0 -0
  37. package/dist/evui.min.js +19 -0
  38. package/dist/evui.min.js.gz +0 -0
  39. package/dist/evui.min.js.map +1 -0
  40. package/dist/main.css +85 -0
  41. package/dist/main.css.gz +0 -0
  42. package/dist/main.css.map +1 -0
  43. package/package.json +56 -76
  44. package/src/common/emitter.js +20 -0
  45. package/src/common/utils.debounce.js +223 -0
  46. package/src/common/utils.js +51 -17
  47. package/src/common/utils.throttle.js +83 -0
  48. package/src/common/utils.tree.js +18 -0
  49. package/src/components/button/button.vue +317 -241
  50. package/src/components/chart/chart.core.js +378 -85
  51. package/src/components/chart/chart.vue +133 -115
  52. package/src/components/chart/element/element.bar.js +219 -25
  53. package/src/components/chart/element/element.bar.time.js +115 -0
  54. package/src/components/chart/element/element.line.js +172 -21
  55. package/src/components/chart/element/element.pie.js +86 -0
  56. package/src/components/chart/element/element.scatter.js +9 -2
  57. package/src/components/chart/element/element.tip.js +356 -0
  58. package/src/components/chart/helpers/helpers.canvas.js +94 -0
  59. package/src/components/chart/helpers/helpers.constant.js +25 -6
  60. package/src/components/chart/helpers/helpers.util.js +83 -38
  61. package/src/components/chart/index.js +0 -1
  62. package/src/components/chart/model/model.series.js +43 -14
  63. package/src/components/chart/model/model.store.js +440 -46
  64. package/src/components/chart/plugins/plugins.interaction.js +324 -0
  65. package/src/components/chart/plugins/plugins.legend.js +233 -91
  66. package/src/components/chart/plugins/plugins.pie.js +179 -0
  67. package/src/components/chart/plugins/plugins.title.js +25 -2
  68. package/src/components/chart/plugins/plugins.tooltip.js +384 -0
  69. package/src/components/chart/scale/scale.js +91 -29
  70. package/src/components/chart/scale/scale.linear.js +12 -0
  71. package/src/components/chart/scale/scale.logarithmic.js +25 -0
  72. package/src/components/chart/scale/scale.step.js +89 -52
  73. package/src/components/chart/scale/scale.time.category.js +204 -0
  74. package/src/components/chart/scale/scale.time.js +19 -1
  75. package/src/components/checkbox/checkbox-group.vue +15 -11
  76. package/src/components/checkbox/checkbox.vue +210 -138
  77. package/src/components/codeview/code.vue +42 -29
  78. package/src/components/contextmenu/contextmenu.child.vue +79 -0
  79. package/src/components/contextmenu/contextmenu.vue +276 -0
  80. package/src/components/contextmenu/contextmenu.wrap.vue +189 -0
  81. package/src/components/contextmenu/index.js +3 -0
  82. package/src/components/datepicker/calendar.core.js +588 -492
  83. package/src/components/datepicker/calendar.vue +0 -3
  84. package/src/components/datepicker/datepicker.vue +43 -15
  85. package/src/components/datepicker/index.js +5 -1
  86. package/src/components/grid/grid.filter.vue +290 -0
  87. package/src/components/grid/grid.filter.window.vue +411 -0
  88. package/src/components/grid/grid.render.vue +45 -0
  89. package/src/components/grid/grid.vue +1338 -0
  90. package/src/components/icon/icon.vue +23 -7
  91. package/src/components/input/input.number.vue +309 -277
  92. package/src/components/label/label.vue +2 -2
  93. package/src/components/loadingmask/loadingmask.vue +6 -13
  94. package/src/components/loginfield/loginfield.vue +46 -37
  95. package/src/components/markdown/index.js +3 -0
  96. package/src/components/markdown/markdown.vue +1001 -0
  97. package/src/components/menu/index.js +1 -3
  98. package/src/components/menu/menu.nav.item.vue +115 -0
  99. package/src/components/menu/menu.nav.sub.vue +42 -0
  100. package/src/components/menu/menu.nav.vue +71 -98
  101. package/src/components/message/index.js +3 -0
  102. package/src/components/message/message.js +63 -0
  103. package/src/components/message/message.vue +191 -0
  104. package/src/components/message-box/index.js +3 -0
  105. package/src/components/message-box/message-box.js +31 -0
  106. package/src/components/message-box/message-box.vue +299 -0
  107. package/src/components/notification/index.js +3 -0
  108. package/src/components/notification/notification.js +75 -0
  109. package/src/components/notification/notification.vue +242 -0
  110. package/src/components/radio/radio-group.vue +6 -2
  111. package/src/components/radio/radio.vue +156 -76
  112. package/src/components/selectbox/dropdown.vue +86 -40
  113. package/src/components/selectbox/listbox.vue +47 -18
  114. package/src/components/selectbox/option.vue +1 -1
  115. package/src/components/selectbox/selectbox.vue +304 -316
  116. package/src/components/slider/slider-tooltip.vue +7 -7
  117. package/src/components/slider/slider.vue +20 -25
  118. package/src/components/splitter/splitter.vue +104 -94
  119. package/src/components/table/table.black.css +1 -1
  120. package/src/components/table/table.filter.lite.vue +7 -7
  121. package/src/components/table/table.filter.vue +1 -1
  122. package/src/components/table/table.grey.css +5 -6
  123. package/src/components/table/table.navy.css +1 -1
  124. package/src/components/table/table.vue +55 -48
  125. package/src/components/tabs/tab-panel.vue +19 -5
  126. package/src/components/tabs/tabs.vue +182 -87
  127. package/src/components/textfield/textfield.vue +110 -87
  128. package/src/components/timepicker/index.js +2 -2
  129. package/src/components/timepicker/spinner.vue +15 -17
  130. package/src/components/timepicker/timepicker.vue +98 -53
  131. package/src/components/toggle/toggle.vue +148 -109
  132. package/src/components/tree/index.js +2 -6
  133. package/src/components/tree/render.js +17 -0
  134. package/src/components/tree/tree-node.vue +214 -0
  135. package/src/components/tree/tree.vue +296 -0
  136. package/src/components/tree-table/index.js +7 -0
  137. package/src/components/{tree → tree-table}/tree.table.black.css +0 -0
  138. package/src/components/{tree → tree-table}/tree.table.grey.css +0 -0
  139. package/src/components/{tree → tree-table}/tree.table.vue +36 -41
  140. package/src/components/{tree → tree-table}/tree.util.js +0 -0
  141. package/src/components/window/window.vue +238 -191
  142. package/src/index.js +25 -12
  143. package/src/styles/base/base.scss +50 -0
  144. package/src/styles/base/index.scss +1 -0
  145. package/src/styles/default.scss +5 -0
  146. package/src/styles/{codemirror.css → lib/codemirror.css} +0 -0
  147. package/src/styles/{all.css → lib/fontawesome.css} +1 -1
  148. package/src/styles/lib/icon.css +792 -0
  149. package/src/styles/themes/index.scss +2 -0
  150. package/src/styles/themes/mixin.scss +33 -0
  151. package/src/styles/themes/variables.scss +206 -0
  152. package/src/styles/utils/colors.scss +222 -0
  153. package/src/styles/utils/index.scss +2 -0
  154. package/src/styles/utils/mixins.scss +34 -0
  155. package/src/styles/utils/variables.scss +27 -0
  156. package/src/webfonts/EVUI.eot +0 -0
  157. package/src/webfonts/EVUI.svg +251 -173
  158. package/src/webfonts/EVUI.ttf +0 -0
  159. package/src/webfonts/EVUI.woff +0 -0
  160. package/src/webfonts/Roboto-Bold.ttf +0 -0
  161. package/src/webfonts/Roboto-Medium.ttf +0 -0
  162. package/src/webfonts/Roboto-Regular.ttf +0 -0
  163. package/src/components/chart/charts/chart.bar.js +0 -334
  164. package/src/components/chart/charts/chart.base.js +0 -1075
  165. package/src/components/chart/charts/chart.line.js +0 -262
  166. package/src/components/chart/charts/chart.pie.js +0 -383
  167. package/src/components/chart/charts/chart.scatter.js +0 -349
  168. package/src/components/chart/charts/chart.sunburst.js +0 -193
  169. package/src/components/chart/core/axis/axis.js +0 -217
  170. package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
  171. package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
  172. package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
  173. package/src/components/chart/core/core.constant.js +0 -116
  174. package/src/components/chart/core/core.legend.js +0 -473
  175. package/src/components/chart/core/core.util.js +0 -66
  176. package/src/components/chart/core/data/data.js +0 -412
  177. package/src/components/chart/core/data/data.pie.js +0 -70
  178. package/src/components/chart/core/data/data.stack.js +0 -222
  179. package/src/components/chart/core/data/data.sunburst.js +0 -172
  180. package/src/components/menu/menu.context.children.vue +0 -201
  181. package/src/components/menu/menu.context.vue +0 -144
  182. package/src/components/tabs/jun/tab.vue +0 -123
  183. package/src/components/tabs/jun/tabs.vue +0 -484
  184. package/src/styles/evui.css +0 -386
  185. package/src/styles/icon.css +0 -557
@@ -0,0 +1,299 @@
1
+ <template>
2
+ <div
3
+ v-show="visible"
4
+ :aria-label="title || 'dialog'"
5
+ :class="['ev-message-box-wrap', fade]"
6
+ tabindex="-1"
7
+ role="dialog"
8
+ aria-modal="true"
9
+ >
10
+ <div class="ev-message-box-modal" />
11
+ <div
12
+ :class="['ev-message-box', customClass]"
13
+ >
14
+ <div
15
+ class="ev-message-box-top"
16
+ >
17
+ <div class="ev-message-box-top-title">
18
+ <ev-icon
19
+ v-if="showHeaderIcon"
20
+ :cls="headerTypeIconInfo.cls"
21
+ :style="headerTypeIconInfo.style"
22
+ />
23
+ <span>{{ title }}</span>
24
+ </div>
25
+ <ev-icon
26
+ :cls="'ei-close'"
27
+ @click="handleAction('cancel')"
28
+ @keydown.enter="handleAction('cancel')"
29
+ />
30
+ </div>
31
+ <div class="ev-message-box-center">
32
+ <div class="ev-message-box-container">
33
+ <div
34
+ v-if="message !== ''"
35
+ class="ev-message-box-message"
36
+ >
37
+ <slot>
38
+ <p v-if="!useHTMLString">
39
+ {{ message }}
40
+ </p>
41
+ <p
42
+ v-else
43
+ v-html="message"
44
+ />
45
+ </slot>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <div
50
+ :class="['ev-message-box-bottom', bottomAlign]"
51
+ >
52
+ <ev-button
53
+ v-if="showCancelButton"
54
+ size="small"
55
+ @click.native="handleAction('cancel')"
56
+ @keydown.enter="handleAction('cancel')"
57
+ >
58
+ {{ cancelButtonText }}
59
+ </ev-button>
60
+ <ev-button
61
+ v-show="showOKButton"
62
+ ref="confirm"
63
+ :type="'primary'"
64
+ size="small"
65
+ @click.native="handleAction('ok')"
66
+ @keydown.enter="handleAction('ok')"
67
+ >
68
+ {{ okButtonText }}
69
+ </ev-button>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ </template>
74
+
75
+ <script type="text/babel">
76
+ import EvButton from '@/components/button/button';
77
+ import EvIcon from '@/components/icon/icon';
78
+
79
+ export default {
80
+ name: 'EvMessageBox',
81
+ components: {
82
+ EvButton,
83
+ EvIcon,
84
+ },
85
+ data() {
86
+ return {
87
+ type: 'info',
88
+ visible: false,
89
+ title: '',
90
+ message: '',
91
+ iconClass: '',
92
+ customClass: '',
93
+ showOKButton: true,
94
+ showCancelButton: true,
95
+ buttonAlign: 'right',
96
+ action: '',
97
+ okButtonText: 'OK',
98
+ cancelButtonText: 'Cancel',
99
+ confirmButtonClass: '',
100
+ confirmButtonDisabled: false,
101
+ cancelButtonClass: '',
102
+ callback: null,
103
+ showHeaderIcon: true,
104
+ useHTMLString: false,
105
+ headerTypeIconInfo: {
106
+ cls: '',
107
+ style: '',
108
+ },
109
+ };
110
+ },
111
+ computed: {
112
+ bottomAlign() {
113
+ let result;
114
+ switch (this.buttonAlign) {
115
+ case 'left': result = 'ev-message-box-bottom-left'; break;
116
+ case 'center': result = 'ev-message-box-bottom-center'; break;
117
+ case 'right': result = 'ev-message-box-bottom-right'; break;
118
+ default: break;
119
+ }
120
+ return result;
121
+ },
122
+ fade() {
123
+ return this.visible ? 'ev-message-box-fade-enter-active' : 'ev-message-box-fade-leave-active';
124
+ },
125
+ },
126
+ watch: {
127
+ type: {
128
+ immediate: true,
129
+ handler(value) {
130
+ switch (value) {
131
+ case 'success':
132
+ this.headerTypeIconInfo = {
133
+ cls: '',
134
+ style: '',
135
+ };
136
+ break;
137
+ case 'info':
138
+ this.headerTypeIconInfo = {
139
+ cls: 'ei-info2',
140
+ style: 'color: #4169E1;',
141
+ };
142
+ break;
143
+ case 'warning':
144
+ this.headerTypeIconInfo = {
145
+ cls: 'ei-warning2',
146
+ style: 'color: #FE8A00;',
147
+ };
148
+ break;
149
+ case 'error':
150
+ this.headerTypeIconInfo = {
151
+ cls: 'ei-warning3',
152
+ style: 'color: #FF0000;',
153
+ };
154
+ break;
155
+ default:
156
+ break;
157
+ }
158
+ },
159
+ },
160
+ visible(val) {
161
+ if (val) {
162
+ setTimeout(() => {
163
+ if (this.$refs.confirm) {
164
+ this.$refs.confirm.$el.focus();
165
+ }
166
+ });
167
+ }
168
+ },
169
+ },
170
+ mounted() {
171
+ },
172
+ beforeDestroy() {
173
+ },
174
+ methods: {
175
+ doClose() {
176
+ if (!this.visible) {
177
+ return;
178
+ }
179
+ this.visible = false;
180
+
181
+ if (this.onClosed) {
182
+ this.onClosed(this.action, this);
183
+ }
184
+ },
185
+ handleAction(action) {
186
+ this.action = action;
187
+ this.doClose();
188
+ },
189
+ },
190
+ };
191
+ </script>
192
+ <style lang="scss">
193
+ @import '~@/styles/default';
194
+
195
+ @keyframes ev-message-box-fade-in {
196
+ 0% {
197
+ transform: translate3d(0, -20px, 0);
198
+ opacity: 0;
199
+ }
200
+ 100% {
201
+ transform: translate3d(0, 0, 0);
202
+ opacity: 1;
203
+ }
204
+ }
205
+ @keyframes ev-message-box-fade-out {
206
+ 0% {
207
+ transform: translate3d(0, 0, 0);
208
+ opacity: 1;
209
+ }
210
+ 100% {
211
+ transform: translate3d(0, -20px, 0);
212
+ opacity: 0;
213
+ }
214
+ }
215
+
216
+ .ev-message-box-wrap {
217
+ display: flex;
218
+ justify-content: center;
219
+ align-items: center;
220
+ position: fixed;
221
+ top: 0;
222
+ left: 0;
223
+ width: 100%;
224
+ height: 100%;
225
+ z-index: 1000;
226
+ }
227
+ .ev-message-box-modal {
228
+ position: absolute;
229
+ top: 0;
230
+ left: 0;
231
+ width: 100%;
232
+ height: 100%;
233
+ background-color: #000000;
234
+ opacity: 0.5;
235
+ z-index: -1;
236
+ }
237
+ .ev-message-box {
238
+ width: 420px;
239
+ padding: 10px;
240
+ background-color: #FFFFFF;
241
+ border-radius: 4px;
242
+ border: 1px solid #EBEEF5;
243
+ font-size: 18px;
244
+ box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
245
+ text-align: left;
246
+ overflow: hidden;
247
+ backface-visibility: hidden;
248
+ }
249
+ .ev-message-box-fade-enter-active .ev-message-box {
250
+ animation: ev-message-box-fade-in .3s;
251
+ }
252
+ .ev-message-box-fade-leave-active .ev-message-box {
253
+ animation: ev-message-box-fade-out .3s;
254
+ }
255
+ .ev-message-box-top {
256
+ position: relative;
257
+ padding-right: 20px;
258
+ }
259
+ .ev-message-box-top-title {
260
+ font-size: 18px;
261
+ color: #303133;
262
+ }
263
+ ev-message-box-top-title .ei {
264
+ font-size: 16px;
265
+ }
266
+ .ev-message-box .ei-close {
267
+ position: absolute;
268
+ top: 5px;
269
+ right: 7px;
270
+ font-size: 12px;
271
+ cursor: pointer;
272
+ }
273
+ .ev-message-box .ei-close:hover {
274
+ transition: color $animate-fast;
275
+
276
+ @include evThemify() {
277
+ color: evThemed('color-primary');
278
+ }
279
+ }
280
+ .ev-message-box-center {
281
+ margin: 14px 0;
282
+ padding: 10px 0;
283
+ }
284
+ .ev-message-box-bottom {
285
+ display: flex;
286
+ }
287
+ .ev-message-box-bottom-left {
288
+ justify-content: flex-start;
289
+ }
290
+ .ev-message-box-bottom-right {
291
+ justify-content: flex-end;
292
+ }
293
+ .ev-message-box-bottom-center {
294
+ justify-content: center;
295
+ }
296
+ .ev-message-box-bottom button {
297
+ margin: 0 4px;
298
+ }
299
+ </style>
@@ -0,0 +1,3 @@
1
+ import Notification from './notification';
2
+
3
+ export default Notification;
@@ -0,0 +1,75 @@
1
+ import Vue from 'vue';
2
+ import NotiVue from './notification.vue';
3
+
4
+ const NotiConstructor = Vue.extend(NotiVue);
5
+
6
+ let seq = 1;
7
+ const root = document.createElement('div');
8
+ root.classList.add('ev-notification-root');
9
+ document.body.appendChild(root);
10
+
11
+ const notificationManager = {
12
+ items: {
13
+ 'top-right': [],
14
+ 'bottom-right': [],
15
+ 'bottom-left': [],
16
+ 'top-left': [],
17
+ },
18
+ increaseOffsetVal: 10,
19
+ getNextOffset(position) {
20
+ const list = this.items[position];
21
+ let result = 0;
22
+ if (!list) {
23
+ return result;
24
+ }
25
+ for (let ix = 0; ix < list.length - 1; ix++) {
26
+ result += (list[ix].height || 0) + this.increaseOffsetVal;
27
+ }
28
+ return result;
29
+ },
30
+ pushItem(item) {
31
+ if (!item.position || !this.items[item.position]) {
32
+ return;
33
+ }
34
+ this.items[item.position].push(item);
35
+ },
36
+ removeItem(notiList, id) {
37
+ const index = notiList.findIndex(v => id === v.id);
38
+ if (index !== -1) {
39
+ notiList.splice(index, 1);
40
+ }
41
+ },
42
+ onBeforeClosed(instance) {
43
+ const notiList = this.items[instance.position];
44
+ if (!notiList) {
45
+ return;
46
+ }
47
+ this.removeItem(notiList, instance.id);
48
+ let el;
49
+ const positionStyle = instance.position.split('-')[0];
50
+ for (let ix = 0; ix < notiList.length; ix++) {
51
+ el = notiList[ix].$el;
52
+ el.style[positionStyle] = `${parseInt(el.style[positionStyle], 10) - notiList[ix].height - this.increaseOffsetVal}px`;
53
+ }
54
+ },
55
+ closeAll() {
56
+ for (let ix = 0; ix < this.items.length; ix++) {
57
+ this.items[ix].close();
58
+ }
59
+ },
60
+ };
61
+
62
+ export default function notification(options = {}) {
63
+ const instance = new NotiConstructor({
64
+ data: options,
65
+ methods: {
66
+ onBeforeClosed: notificationManager.onBeforeClosed.bind(notificationManager),
67
+ },
68
+ });
69
+ instance.id = `ev-notification-${seq++}`;
70
+ instance.$mount();
71
+ root.appendChild(instance.$el);
72
+ instance.visible = true;
73
+ notificationManager.pushItem(instance);
74
+ instance.offsetY = notificationManager.getNextOffset(options.position);
75
+ }
@@ -0,0 +1,242 @@
1
+ <template>
2
+ <transition name="ev-notification-fade">
3
+ <div
4
+ v-show="visible"
5
+ :class="['ev-notification', `ev-notification-${type}`, customClass, hClass]"
6
+ :style="positionStyle"
7
+ role="alert"
8
+ @mouseenter="clearTimer()"
9
+ @mouseleave="startTimer()"
10
+ @click="click"
11
+ >
12
+ <i
13
+ v-if="type || iconClass"
14
+ :class="[ iconClass === '' ? `ei-${type}` : iconClass ]"
15
+ class="ev-notification-icon"
16
+ />
17
+ <div
18
+ :class="{ 'is-with-icon': typeClass || iconClass }"
19
+ class="ev-notification-wrap"
20
+ >
21
+ <h3
22
+ class="ev-notification-title"
23
+ v-text="title"
24
+ />
25
+ <div
26
+ v-show="message"
27
+ class="ev-notification-content"
28
+ >
29
+ <slot>
30
+ <p v-if="!useHTMLString">
31
+ {{ message }}
32
+ </p>
33
+ <p
34
+ v-else
35
+ v-html="message"
36
+ />
37
+ </slot>
38
+ </div>
39
+ <i
40
+ v-if="showClose"
41
+ class="ev-notification-close-btn ei ei-close"
42
+ @click.stop="close"
43
+ />
44
+ </div>
45
+ </div>
46
+ </transition>
47
+ </template>
48
+
49
+ <script type="text/babel">
50
+ const typeMap = {
51
+ success: 'success',
52
+ info: 'info',
53
+ warning: 'warning',
54
+ error: 'error',
55
+ };
56
+
57
+ export default {
58
+ data() {
59
+ return {
60
+ visible: false,
61
+ title: '',
62
+ message: '',
63
+ height: 80,
64
+ duration: 4500,
65
+ type: 'info',
66
+ showClose: true,
67
+ customClass: '',
68
+ iconClass: '',
69
+ onClose: null,
70
+ onClick: null,
71
+ closed: false,
72
+ offsetY: 0,
73
+ timer: null,
74
+ useHTMLString: false,
75
+ position: 'top-right',
76
+ };
77
+ },
78
+ computed: {
79
+ typeClass() {
80
+ return this.type && typeMap[this.type] ? `ei-${typeMap[this.type]}` : '';
81
+ },
82
+ hClass() {
83
+ return this.position.indexOf('right') > -1 ? 'right' : 'left';
84
+ },
85
+ positionStyle() {
86
+ return {
87
+ [this.position.indexOf('top') > -1 ? 'top' : 'bottom']: `${this.offsetY}px`,
88
+ };
89
+ },
90
+ },
91
+ watch: {
92
+ closed(newVal) {
93
+ if (newVal) {
94
+ this.visible = false;
95
+ this.$el.addEventListener('transitionend', this.destroyElement);
96
+ }
97
+ },
98
+ },
99
+ mounted() {
100
+ if (this.duration > 0) {
101
+ this.timer = setTimeout(() => {
102
+ if (!this.closed) {
103
+ this.close();
104
+ }
105
+ }, this.duration);
106
+ }
107
+ document.addEventListener('keydown', this.keydown);
108
+ },
109
+ beforeDestroy() {
110
+ document.removeEventListener('keydown', this.keydown);
111
+ },
112
+ methods: {
113
+ destroyElement() {
114
+ this.$el.removeEventListener('transitionend', this.destroyElement);
115
+ this.$destroy(true);
116
+ this.$el.parentNode.removeChild(this.$el);
117
+ },
118
+ click() {
119
+ if (typeof this.onClick === 'function') {
120
+ this.onClick();
121
+ }
122
+ },
123
+ close() {
124
+ this.closed = true;
125
+ if (typeof this.onClose === 'function') {
126
+ this.onClose();
127
+ }
128
+ if (this.onBeforeClosed) {
129
+ this.onBeforeClosed(this);
130
+ }
131
+ },
132
+ clearTimer() {
133
+ clearTimeout(this.timer);
134
+ },
135
+ startTimer() {
136
+ if (this.duration > 0) {
137
+ this.timer = setTimeout(() => {
138
+ if (!this.closed) {
139
+ this.close();
140
+ }
141
+ }, this.duration);
142
+ }
143
+ },
144
+ keydown(e) {
145
+ if (e.keyCode === 46 || e.keyCode === 8) {
146
+ this.clearTimer();
147
+ } else if (e.keyCode === 27) {
148
+ if (!this.closed) {
149
+ this.close();
150
+ }
151
+ } else {
152
+ this.startTimer();
153
+ }
154
+ },
155
+ },
156
+ };
157
+ </script>
158
+ <style>
159
+ .ev-notification {
160
+ display: flex;
161
+ width: 330px;
162
+ box-sizing: border-box;
163
+ position: fixed;
164
+ background-color: rgb(255, 255, 255);
165
+ box-shadow: rgba(0, 0, 0, 0.1) 0 2px 12px 0;
166
+ padding: 14px 26px 14px 13px;
167
+ border-radius: 8px;
168
+ border-width: 1px;
169
+ border-style: solid;
170
+ border-color: rgb(235, 238, 245);
171
+ border-image: initial;
172
+ overflow: hidden;
173
+ transition-property: opacity, transform, left, right, top, bottom;
174
+ transition-duration: 0.3s;
175
+ transition-timing-function: ease;
176
+ transition-delay: 0s;
177
+ }
178
+ .ev-notification-fade-leave-active {
179
+ opacity: 0;
180
+ }
181
+ .ev-notification-fade-enter.right {
182
+ right: 0;
183
+ transform: translateX(100%);
184
+ }
185
+ .ev-notification-fade-enter.left {
186
+ left: 0;
187
+ transform: translateX(-100%);
188
+ }
189
+ .ev-notification.top {
190
+ top: 16px;
191
+ }
192
+ .ev-notification.right {
193
+ right: 16px;
194
+ }
195
+ .ev-notification-title {
196
+ margin: 0;
197
+ font-weight: 700;
198
+ font-size: 16px;
199
+ color: rgb(48, 49, 51);
200
+ }
201
+ .ev-notification-close-btn {
202
+ position: absolute;
203
+ top: 18px;
204
+ right: 15px;
205
+ cursor: pointer;
206
+ font-size: 16px;
207
+ }
208
+ .ev-notification-info {
209
+ background-color: #FDFDFD;
210
+ border-color: #EEEEEE;
211
+ }
212
+ .ev-notification-success {
213
+ background-color: #F0F9EB;
214
+ border-color: #E1F3D8;
215
+ }
216
+ .ev-notification-warning {
217
+ background-color: #FDF6EC;
218
+ border-color: #FAECD8;
219
+ }
220
+ .ev-notification-error {
221
+ background-color: #FEF0F0;
222
+ border-color: #FDE2E2;
223
+ }
224
+ .ev-notification-info .ev-notification-wrap {
225
+ color: #111111;
226
+ }
227
+ .ev-notification-success .ev-notification-wrap {
228
+ color: #67C23A;
229
+ }
230
+ .ev-notification-warning .ev-notification-wrap {
231
+ color: #E6A23C;
232
+ }
233
+ .ev-notification-error .ev-notification-wrap {
234
+ color: #F56C6C;
235
+ }
236
+ .ev-notification-wrap {
237
+ width: 100%;
238
+ }
239
+ .ev-notification-success .ev-notification-title {
240
+ color: #F56C6C;
241
+ }
242
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <slot/>
3
+ <slot />
4
4
  </div>
5
5
  </template>
6
6
  <script>
@@ -10,10 +10,14 @@ export default {
10
10
  },
11
11
  props: {
12
12
  value: {
13
+ type: [String, Number],
14
+ default: null,
15
+ },
16
+ size: {
13
17
  type: String,
14
18
  default: '',
15
19
  },
16
- size: {
20
+ type: {
17
21
  type: String,
18
22
  default: '',
19
23
  },