UNPKG

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