evui 2.1.0 → 2.1.1

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 (189) hide show
  1. package/dist/{adac9fa4f723f9d2cb5b6640517114a9.png → 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/{e8c322de9658cbeb8a774b6624167c2c.woff2 → 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/{0ab54153eeeca0ce03978cc463b257f7.woff2 → 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/{faff92145777a3cbaf8e7367b4807987.woff → 425399f81e4ce7cbd967685402ba0260.woff} +0 -0
  19. package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
  20. package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
  21. package/dist/{ad97afd3337e8cda302d10ff5a4026b8.ttf → 5367103510b27b78482794590e1ce3b0.ttf} +0 -0
  22. package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → 57e963e3d6dd0a9cf05150b40eebf69b.svg} +0 -0
  23. package/dist/{c5ebe0b32dc1b5cc449a76c4204d13bb.ttf → 65a2fb6d9aaa164b41a039302093995b.ttf} +0 -0
  24. package/dist/{cd6c777f1945164224dee082abaea03a.woff2 → 687a4990ea22bb1a49d469a5d9319790.woff2} +0 -0
  25. package/dist/{7583da5c07275cd5eb364507616f998f.ttf → 6c1d906bf5ba48676f65b2d65e935e1a.ttf} +0 -0
  26. package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
  27. package/dist/{701ae6abd4719e9c2ada3535a497b341.eot → 752905fa5edf21fc52a10a0c1ca9c7a4.eot} +0 -0
  28. package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
  29. package/dist/{b551b554a67e86a840bc80cbb8066c30.svg → 7d62eb50e7bb05eedb2a4656f7fe8f3b.svg} +0 -0
  30. package/dist/{8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot → a01e3f2d6c83dc3aee175e2482b3f777.eot} +0 -0
  31. package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → b30fd8419d7e6d5918856c7531d33482.svg} +0 -0
  32. package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
  33. package/dist/{b87b9ba532ace76ae9f6edfe9f72ded2.ttf → c656b8caa454ed19b9a2ef7f4f5b8fea.ttf} +0 -0
  34. package/dist/{a046592bac8f2fd96e994733faf3858c.woff → cac87dc00c87a5d74711d0276713808a.woff} +0 -0
  35. package/dist/{13db00b7a34fee4d819ab7f9838cc428.eot → d68fa3e67dbb653a13cec44b1bcabcfe.eot} +0 -0
  36. package/dist/{ef60a4f6c25ef7f39f2d25a748dbecfe.woff → ddae9b1ba9b0b42f58809904b0b21349.woff} +0 -0
  37. package/dist/evui.min.js +6 -86054
  38. package/dist/evui.min.js.gz +0 -0
  39. package/dist/evui.min.js.map +1 -1
  40. package/dist/main.css +43 -5541
  41. package/dist/main.css.gz +0 -0
  42. package/dist/main.css.map +1 -1
  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 +316 -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 +22 -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 +298 -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/dist/3c9453211570a4ede66a4b4954a32bbb.ttf +0 -0
  164. package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
  165. package/dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot +0 -0
  166. package/dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff +0 -0
  167. package/src/components/chart/charts/chart.bar.js +0 -334
  168. package/src/components/chart/charts/chart.base.js +0 -1075
  169. package/src/components/chart/charts/chart.line.js +0 -262
  170. package/src/components/chart/charts/chart.pie.js +0 -383
  171. package/src/components/chart/charts/chart.scatter.js +0 -349
  172. package/src/components/chart/charts/chart.sunburst.js +0 -193
  173. package/src/components/chart/core/axis/axis.js +0 -217
  174. package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
  175. package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
  176. package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
  177. package/src/components/chart/core/core.constant.js +0 -116
  178. package/src/components/chart/core/core.legend.js +0 -473
  179. package/src/components/chart/core/core.util.js +0 -66
  180. package/src/components/chart/core/data/data.js +0 -412
  181. package/src/components/chart/core/data/data.pie.js +0 -70
  182. package/src/components/chart/core/data/data.stack.js +0 -222
  183. package/src/components/chart/core/data/data.sunburst.js +0 -172
  184. package/src/components/menu/menu.context.children.vue +0 -201
  185. package/src/components/menu/menu.context.vue +0 -144
  186. package/src/components/tabs/jun/tab.vue +0 -123
  187. package/src/components/tabs/jun/tabs.vue +0 -484
  188. package/src/styles/evui.css +0 -386
  189. package/src/styles/icon.css +0 -557
@@ -0,0 +1,298 @@
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
+ // const typeMap = {
77
+ // success: 'success',
78
+ // info: 'info',
79
+ // warning: 'warning',
80
+ // error: 'error',
81
+ // };
82
+
83
+ export default {
84
+ data() {
85
+ return {
86
+ type: 'info',
87
+ visible: false,
88
+ title: '',
89
+ message: '',
90
+ iconClass: '',
91
+ customClass: '',
92
+ showOKButton: true,
93
+ showCancelButton: true,
94
+ buttonAlign: 'right',
95
+ action: '',
96
+ okButtonText: 'OK',
97
+ cancelButtonText: 'Cancel',
98
+ confirmButtonClass: '',
99
+ confirmButtonDisabled: false,
100
+ cancelButtonClass: '',
101
+ callback: null,
102
+ showHeaderIcon: true,
103
+ useHTMLString: false,
104
+ headerTypeIconInfo: {
105
+ cls: '',
106
+ style: '',
107
+ },
108
+ };
109
+ },
110
+ computed: {
111
+ bottomAlign() {
112
+ let result;
113
+ switch (this.buttonAlign) {
114
+ case 'left': result = 'ev-message-box-bottom-left'; break;
115
+ case 'center': result = 'ev-message-box-bottom-center'; break;
116
+ case 'right': result = 'ev-message-box-bottom-right'; break;
117
+ default: break;
118
+ }
119
+ return result;
120
+ },
121
+ fade() {
122
+ return this.visible ? 'ev-message-box-fade-enter-active' : 'ev-message-box-fade-leave-active';
123
+ },
124
+ },
125
+ watch: {
126
+ type: {
127
+ immediate: true,
128
+ handler(value) {
129
+ switch (value) {
130
+ case 'success':
131
+ this.headerTypeIconInfo = {
132
+ cls: '',
133
+ style: '',
134
+ };
135
+ break;
136
+ case 'info':
137
+ this.headerTypeIconInfo = {
138
+ cls: 'ei-info2',
139
+ style: 'color: #4169E1;',
140
+ };
141
+ break;
142
+ case 'warning':
143
+ this.headerTypeIconInfo = {
144
+ cls: 'ei-warning2',
145
+ style: 'color: #FE8A00;',
146
+ };
147
+ break;
148
+ case 'error':
149
+ this.headerTypeIconInfo = {
150
+ cls: 'ei-warning3',
151
+ style: 'color: #FF0000;',
152
+ };
153
+ break;
154
+ default:
155
+ break;
156
+ }
157
+ },
158
+ },
159
+ visible(val) {
160
+ if (val) {
161
+ setTimeout(() => {
162
+ if (this.$refs.confirm) {
163
+ this.$refs.confirm.$el.focus();
164
+ }
165
+ });
166
+ }
167
+ },
168
+ },
169
+ mounted() {
170
+ },
171
+ beforeDestroy() {
172
+ },
173
+ methods: {
174
+ doClose() {
175
+ if (!this.visible) {
176
+ return;
177
+ }
178
+ this.visible = false;
179
+
180
+ if (this.onClosed) {
181
+ this.onClosed(this.action, this);
182
+ }
183
+ },
184
+ handleAction(action) {
185
+ this.action = action;
186
+ this.doClose();
187
+ },
188
+ },
189
+ };
190
+ </script>
191
+ <style lang="scss">
192
+ @import '~@/styles/default';
193
+
194
+ @keyframes ev-message-box-fade-in {
195
+ 0% {
196
+ transform: translate3d(0, -20px, 0);
197
+ opacity: 0;
198
+ }
199
+ 100% {
200
+ transform: translate3d(0, 0, 0);
201
+ opacity: 1;
202
+ }
203
+ }
204
+ @keyframes ev-message-box-fade-out {
205
+ 0% {
206
+ transform: translate3d(0, 0, 0);
207
+ opacity: 1;
208
+ }
209
+ 100% {
210
+ transform: translate3d(0, -20px, 0);
211
+ opacity: 0;
212
+ }
213
+ }
214
+
215
+ .ev-message-box-wrap {
216
+ display: flex;
217
+ justify-content: center;
218
+ align-items: center;
219
+ position: fixed;
220
+ top: 0;
221
+ left: 0;
222
+ width: 100%;
223
+ height: 100%;
224
+ z-index: 1000;
225
+ }
226
+ .ev-message-box-modal {
227
+ position: absolute;
228
+ top: 0;
229
+ left: 0;
230
+ width: 100%;
231
+ height: 100%;
232
+ background-color: #000000;
233
+ opacity: 0.5;
234
+ z-index: -1;
235
+ }
236
+ .ev-message-box {
237
+ width: 420px;
238
+ padding: 10px;
239
+ background-color: #FFFFFF;
240
+ border-radius: 4px;
241
+ border: 1px solid #EBEEF5;
242
+ font-size: 18px;
243
+ box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
244
+ text-align: left;
245
+ overflow: hidden;
246
+ backface-visibility: hidden;
247
+ }
248
+ .ev-message-box-fade-enter-active .ev-message-box {
249
+ animation: ev-message-box-fade-in .3s;
250
+ }
251
+ .ev-message-box-fade-leave-active .ev-message-box {
252
+ animation: ev-message-box-fade-out .3s;
253
+ }
254
+ .ev-message-box-top {
255
+ position: relative;
256
+ padding-right: 20px;
257
+ }
258
+ .ev-message-box-top-title {
259
+ font-size: 18px;
260
+ color: #303133;
261
+ }
262
+ ev-message-box-top-title .ei {
263
+ font-size: 16px;
264
+ }
265
+ .ev-message-box .ei-close {
266
+ position: absolute;
267
+ top: 5px;
268
+ right: 7px;
269
+ font-size: 12px;
270
+ cursor: pointer;
271
+ }
272
+ .ev-message-box .ei-close:hover {
273
+ transition: color $animate-fast;
274
+
275
+ @include evThemify() {
276
+ color: evThemed('color-primary');
277
+ }
278
+ }
279
+ .ev-message-box-center {
280
+ margin: 14px 0;
281
+ padding: 10px 0;
282
+ }
283
+ .ev-message-box-bottom {
284
+ display: flex;
285
+ }
286
+ .ev-message-box-bottom-left {
287
+ justify-content: flex-start;
288
+ }
289
+ .ev-message-box-bottom-right {
290
+ justify-content: flex-end;
291
+ }
292
+ .ev-message-box-bottom-center {
293
+ justify-content: center;
294
+ }
295
+ .ev-message-box-bottom button {
296
+ margin: 0 4px;
297
+ }
298
+ </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
  },