UNPKG

15.3 kBJavaScriptView Raw
1module.exports =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId]) {
11/******/ return installedModules[moduleId].exports;
12/******/ }
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // define getter function for harmony exports
38/******/ __webpack_require__.d = function(exports, name, getter) {
39/******/ if(!__webpack_require__.o(exports, name)) {
40/******/ Object.defineProperty(exports, name, {
41/******/ configurable: false,
42/******/ enumerable: true,
43/******/ get: getter
44/******/ });
45/******/ }
46/******/ };
47/******/
48/******/ // getDefaultExport function for compatibility with non-harmony modules
49/******/ __webpack_require__.n = function(module) {
50/******/ var getter = module && module.__esModule ?
51/******/ function getDefault() { return module['default']; } :
52/******/ function getModuleExports() { return module; };
53/******/ __webpack_require__.d(getter, 'a', getter);
54/******/ return getter;
55/******/ };
56/******/
57/******/ // Object.prototype.hasOwnProperty.call
58/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
59/******/
60/******/ // __webpack_public_path__
61/******/ __webpack_require__.p = "/dist/";
62/******/
63/******/ // Load entry module and return exports
64/******/ return __webpack_require__(__webpack_require__.s = 261);
65/******/ })
66/************************************************************************/
67/******/ ({
68
69/***/ 0:
70/***/ (function(module, exports) {
71
72/* globals __VUE_SSR_CONTEXT__ */
73
74// IMPORTANT: Do NOT use ES2015 features in this file.
75// This module is a runtime utility for cleaner component module output and will
76// be included in the final webpack user bundle.
77
78module.exports = function normalizeComponent (
79 rawScriptExports,
80 compiledTemplate,
81 functionalTemplate,
82 injectStyles,
83 scopeId,
84 moduleIdentifier /* server only */
85) {
86 var esModule
87 var scriptExports = rawScriptExports = rawScriptExports || {}
88
89 // ES6 modules interop
90 var type = typeof rawScriptExports.default
91 if (type === 'object' || type === 'function') {
92 esModule = rawScriptExports
93 scriptExports = rawScriptExports.default
94 }
95
96 // Vue.extend constructor export interop
97 var options = typeof scriptExports === 'function'
98 ? scriptExports.options
99 : scriptExports
100
101 // render functions
102 if (compiledTemplate) {
103 options.render = compiledTemplate.render
104 options.staticRenderFns = compiledTemplate.staticRenderFns
105 options._compiled = true
106 }
107
108 // functional template
109 if (functionalTemplate) {
110 options.functional = true
111 }
112
113 // scopedId
114 if (scopeId) {
115 options._scopeId = scopeId
116 }
117
118 var hook
119 if (moduleIdentifier) { // server build
120 hook = function (context) {
121 // 2.3 injection
122 context =
123 context || // cached call
124 (this.$vnode && this.$vnode.ssrContext) || // stateful
125 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
126 // 2.2 with runInNewContext: true
127 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
128 context = __VUE_SSR_CONTEXT__
129 }
130 // inject component styles
131 if (injectStyles) {
132 injectStyles.call(this, context)
133 }
134 // register component module identifier for async chunk inferrence
135 if (context && context._registeredComponents) {
136 context._registeredComponents.add(moduleIdentifier)
137 }
138 }
139 // used by ssr in case component is cached and beforeCreate
140 // never gets called
141 options._ssrRegister = hook
142 } else if (injectStyles) {
143 hook = injectStyles
144 }
145
146 if (hook) {
147 var functional = options.functional
148 var existing = functional
149 ? options.render
150 : options.beforeCreate
151
152 if (!functional) {
153 // inject component registration as beforeCreate hook
154 options.beforeCreate = existing
155 ? [].concat(existing, hook)
156 : [hook]
157 } else {
158 // for template-only hot-reload because in that case the render fn doesn't
159 // go through the normalizer
160 options._injectStyles = hook
161 // register for functioal component in vue file
162 options.render = function renderWithStyleInjection (h, context) {
163 hook.call(context)
164 return existing(h, context)
165 }
166 }
167 }
168
169 return {
170 esModule: esModule,
171 exports: scriptExports,
172 options: options
173 }
174}
175
176
177/***/ }),
178
179/***/ 13:
180/***/ (function(module, exports) {
181
182module.exports = require("element-ui/lib/utils/popup");
183
184/***/ }),
185
186/***/ 20:
187/***/ (function(module, exports) {
188
189module.exports = require("element-ui/lib/utils/vdom");
190
191/***/ }),
192
193/***/ 261:
194/***/ (function(module, exports, __webpack_require__) {
195
196"use strict";
197
198
199exports.__esModule = true;
200
201var _main = __webpack_require__(262);
202
203var _main2 = _interopRequireDefault(_main);
204
205function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
206
207exports.default = _main2.default;
208
209/***/ }),
210
211/***/ 262:
212/***/ (function(module, exports, __webpack_require__) {
213
214"use strict";
215
216
217exports.__esModule = true;
218
219var _vue = __webpack_require__(4);
220
221var _vue2 = _interopRequireDefault(_vue);
222
223var _main = __webpack_require__(263);
224
225var _main2 = _interopRequireDefault(_main);
226
227var _popup = __webpack_require__(13);
228
229var _vdom = __webpack_require__(20);
230
231function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
232
233var NotificationConstructor = _vue2.default.extend(_main2.default);
234
235var instance = void 0;
236var instances = [];
237var seed = 1;
238
239var Notification = function Notification(options) {
240 if (_vue2.default.prototype.$isServer) return;
241 options = options || {};
242 var userOnClose = options.onClose;
243 var id = 'notification_' + seed++;
244 var position = options.position || 'top-right';
245
246 options.onClose = function () {
247 Notification.close(id, userOnClose);
248 };
249
250 instance = new NotificationConstructor({
251 data: options
252 });
253
254 if ((0, _vdom.isVNode)(options.message)) {
255 instance.$slots.default = [options.message];
256 options.message = 'REPLACED_BY_VNODE';
257 }
258 instance.id = id;
259 instance.$mount();
260 document.body.appendChild(instance.$el);
261 instance.visible = true;
262 instance.dom = instance.$el;
263 instance.dom.style.zIndex = _popup.PopupManager.nextZIndex();
264
265 var verticalOffset = options.offset || 0;
266 instances.filter(function (item) {
267 return item.position === position;
268 }).forEach(function (item) {
269 verticalOffset += item.$el.offsetHeight + 16;
270 });
271 verticalOffset += 16;
272 instance.verticalOffset = verticalOffset;
273 instances.push(instance);
274 return instance;
275};
276
277['success', 'warning', 'info', 'error'].forEach(function (type) {
278 Notification[type] = function (options) {
279 if (typeof options === 'string' || (0, _vdom.isVNode)(options)) {
280 options = {
281 message: options
282 };
283 }
284 options.type = type;
285 return Notification(options);
286 };
287});
288
289Notification.close = function (id, userOnClose) {
290 var index = -1;
291 var len = instances.length;
292 var instance = instances.filter(function (instance, i) {
293 if (instance.id === id) {
294 index = i;
295 return true;
296 }
297 return false;
298 })[0];
299 if (!instance) return;
300
301 if (typeof userOnClose === 'function') {
302 userOnClose(instance);
303 }
304 instances.splice(index, 1);
305
306 if (len <= 1) return;
307 var position = instance.position;
308 var removedHeight = instance.dom.offsetHeight;
309 for (var i = index; i < len - 1; i++) {
310 if (instances[i].position === position) {
311 instances[i].dom.style[instance.verticalProperty] = parseInt(instances[i].dom.style[instance.verticalProperty], 10) - removedHeight - 16 + 'px';
312 }
313 }
314};
315
316Notification.closeAll = function () {
317 for (var i = instances.length - 1; i >= 0; i--) {
318 instances[i].close();
319 }
320};
321
322exports.default = Notification;
323
324/***/ }),
325
326/***/ 263:
327/***/ (function(module, __webpack_exports__, __webpack_require__) {
328
329"use strict";
330Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
331/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(264);
332/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__);
333/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e9766d52_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(265);
334var normalizeComponent = __webpack_require__(0)
335/* script */
336
337/* template */
338
339/* template functional */
340 var __vue_template_functional__ = false
341/* styles */
342var __vue_styles__ = null
343/* scopeId */
344var __vue_scopeId__ = null
345/* moduleIdentifier (server only) */
346var __vue_module_identifier__ = null
347var Component = normalizeComponent(
348 __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a,
349 __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e9766d52_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */],
350 __vue_template_functional__,
351 __vue_styles__,
352 __vue_scopeId__,
353 __vue_module_identifier__
354)
355
356/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
357
358
359/***/ }),
360
361/***/ 264:
362/***/ (function(module, exports, __webpack_require__) {
363
364"use strict";
365
366
367exports.__esModule = true;
368//
369//
370//
371//
372//
373//
374//
375//
376//
377//
378//
379//
380//
381//
382//
383//
384//
385//
386//
387//
388//
389//
390//
391//
392//
393//
394//
395//
396//
397//
398//
399//
400//
401
402var typeMap = {
403 success: 'success',
404 info: 'info',
405 warning: 'warning',
406 error: 'error'
407};
408
409exports.default = {
410 data: function data() {
411 return {
412 visible: false,
413 title: '',
414 message: '',
415 duration: 4500,
416 type: '',
417 showClose: true,
418 customClass: '',
419 iconClass: '',
420 onClose: null,
421 onClick: null,
422 closed: false,
423 verticalOffset: 0,
424 timer: null,
425 dangerouslyUseHTMLString: false,
426 position: 'top-right'
427 };
428 },
429
430
431 computed: {
432 typeClass: function typeClass() {
433 return this.type && typeMap[this.type] ? 'el-icon-' + typeMap[this.type] : '';
434 },
435 horizontalClass: function horizontalClass() {
436 return this.position.indexOf('right') > -1 ? 'right' : 'left';
437 },
438 verticalProperty: function verticalProperty() {
439 return (/^top-/.test(this.position) ? 'top' : 'bottom'
440 );
441 },
442 positionStyle: function positionStyle() {
443 var _ref;
444
445 return _ref = {}, _ref[this.verticalProperty] = this.verticalOffset + 'px', _ref;
446 }
447 },
448
449 watch: {
450 closed: function closed(newVal) {
451 if (newVal) {
452 this.visible = false;
453 this.$el.addEventListener('transitionend', this.destroyElement);
454 }
455 }
456 },
457
458 methods: {
459 destroyElement: function destroyElement() {
460 this.$el.removeEventListener('transitionend', this.destroyElement);
461 this.$destroy(true);
462 this.$el.parentNode.removeChild(this.$el);
463 },
464 click: function click() {
465 if (typeof this.onClick === 'function') {
466 this.onClick();
467 }
468 },
469 close: function close() {
470 this.closed = true;
471 if (typeof this.onClose === 'function') {
472 this.onClose();
473 }
474 },
475 clearTimer: function clearTimer() {
476 clearTimeout(this.timer);
477 },
478 startTimer: function startTimer() {
479 var _this = this;
480
481 if (this.duration > 0) {
482 this.timer = setTimeout(function () {
483 if (!_this.closed) {
484 _this.close();
485 }
486 }, this.duration);
487 }
488 },
489 keydown: function keydown(e) {
490 if (e.keyCode === 46 || e.keyCode === 8) {
491 this.clearTimer(); // detele 取消倒计时
492 } else if (e.keyCode === 27) {
493 // esc关闭消息
494 if (!this.closed) {
495 this.close();
496 }
497 } else {
498 this.startTimer(); // 恢复倒计时
499 }
500 }
501 },
502 mounted: function mounted() {
503 var _this2 = this;
504
505 if (this.duration > 0) {
506 this.timer = setTimeout(function () {
507 if (!_this2.closed) {
508 _this2.close();
509 }
510 }, this.duration);
511 }
512 document.addEventListener('keydown', this.keydown);
513 },
514 beforeDestroy: function beforeDestroy() {
515 document.removeEventListener('keydown', this.keydown);
516 }
517};
518
519/***/ }),
520
521/***/ 265:
522/***/ (function(module, __webpack_exports__, __webpack_require__) {
523
524"use strict";
525var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":"el-notification-fade"}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.visible),expression:"visible"}],class:['el-notification', _vm.customClass, _vm.horizontalClass],style:(_vm.positionStyle),attrs:{"role":"alert"},on:{"mouseenter":function($event){_vm.clearTimer()},"mouseleave":function($event){_vm.startTimer()},"click":_vm.click}},[(_vm.type || _vm.iconClass)?_c('i',{staticClass:"el-notification__icon",class:[ _vm.typeClass, _vm.iconClass ]}):_vm._e(),_c('div',{staticClass:"el-notification__group",class:{ 'is-with-icon': _vm.typeClass || _vm.iconClass }},[_c('h2',{staticClass:"el-notification__title",domProps:{"textContent":_vm._s(_vm.title)}}),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.message),expression:"message"}],staticClass:"el-notification__content"},[_vm._t("default",[(!_vm.dangerouslyUseHTMLString)?_c('p',[_vm._v(_vm._s(_vm.message))]):_c('p',{domProps:{"innerHTML":_vm._s(_vm.message)}})])],2),(_vm.showClose)?_c('div',{staticClass:"el-notification__closeBtn el-icon-close",on:{"click":function($event){$event.stopPropagation();_vm.close($event)}}}):_vm._e()])])])}
526var staticRenderFns = []
527var esExports = { render: render, staticRenderFns: staticRenderFns }
528/* harmony default export */ __webpack_exports__["a"] = (esExports);
529
530/***/ }),
531
532/***/ 4:
533/***/ (function(module, exports) {
534
535module.exports = require("vue");
536
537/***/ })
538
539/******/ });
\No newline at end of file