UNPKG

19.6 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 = 68);
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/***/ 15:
193/***/ (function(module, exports) {
194
195module.exports = require("element-ui/lib/utils/popup");
196
197/***/ }),
198
199/***/ 2:
200/***/ (function(module, exports) {
201
202module.exports = require("element-ui/lib/utils/dom");
203
204/***/ }),
205
206/***/ 41:
207/***/ (function(module, exports) {
208
209module.exports = require("element-ui/lib/utils/after-leave");
210
211/***/ }),
212
213/***/ 68:
214/***/ (function(module, __webpack_exports__, __webpack_require__) {
215
216"use strict";
217__webpack_require__.r(__webpack_exports__);
218
219// EXTERNAL MODULE: external "vue"
220var external_vue_ = __webpack_require__(7);
221var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
222
223// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/loading/src/loading.vue?vue&type=template&id=eee0a7ac&
224var render = function() {
225 var _vm = this
226 var _h = _vm.$createElement
227 var _c = _vm._self._c || _h
228 return _c(
229 "transition",
230 {
231 attrs: { name: "el-loading-fade" },
232 on: { "after-leave": _vm.handleAfterLeave }
233 },
234 [
235 _c(
236 "div",
237 {
238 directives: [
239 {
240 name: "show",
241 rawName: "v-show",
242 value: _vm.visible,
243 expression: "visible"
244 }
245 ],
246 staticClass: "el-loading-mask",
247 class: [_vm.customClass, { "is-fullscreen": _vm.fullscreen }],
248 style: { backgroundColor: _vm.background || "" }
249 },
250 [
251 _c("div", { staticClass: "el-loading-spinner" }, [
252 !_vm.spinner
253 ? _c(
254 "svg",
255 {
256 staticClass: "circular",
257 attrs: { viewBox: "25 25 50 50" }
258 },
259 [
260 _c("circle", {
261 staticClass: "path",
262 attrs: { cx: "50", cy: "50", r: "20", fill: "none" }
263 })
264 ]
265 )
266 : _c("i", { class: _vm.spinner }),
267 _vm.text
268 ? _c("p", { staticClass: "el-loading-text" }, [
269 _vm._v(_vm._s(_vm.text))
270 ])
271 : _vm._e()
272 ])
273 ]
274 )
275 ]
276 )
277}
278var staticRenderFns = []
279render._withStripped = true
280
281
282// CONCATENATED MODULE: ./packages/loading/src/loading.vue?vue&type=template&id=eee0a7ac&
283
284// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/loading/src/loading.vue?vue&type=script&lang=js&
285//
286//
287//
288//
289//
290//
291//
292//
293//
294//
295//
296//
297//
298//
299//
300//
301//
302//
303
304/* harmony default export */ var loadingvue_type_script_lang_js_ = ({
305 data: function data() {
306 return {
307 text: null,
308 spinner: null,
309 background: null,
310 fullscreen: true,
311 visible: false,
312 customClass: ''
313 };
314 },
315
316
317 methods: {
318 handleAfterLeave: function handleAfterLeave() {
319 this.$emit('after-leave');
320 },
321 setText: function setText(text) {
322 this.text = text;
323 }
324 }
325});
326// CONCATENATED MODULE: ./packages/loading/src/loading.vue?vue&type=script&lang=js&
327 /* harmony default export */ var src_loadingvue_type_script_lang_js_ = (loadingvue_type_script_lang_js_);
328// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
329var componentNormalizer = __webpack_require__(0);
330
331// CONCATENATED MODULE: ./packages/loading/src/loading.vue
332
333
334
335
336
337/* normalize component */
338
339var component = Object(componentNormalizer["a" /* default */])(
340 src_loadingvue_type_script_lang_js_,
341 render,
342 staticRenderFns,
343 false,
344 null,
345 null,
346 null
347
348)
349
350/* hot reload */
351if (false) { var api; }
352component.options.__file = "packages/loading/src/loading.vue"
353/* harmony default export */ var loading = (component.exports);
354// EXTERNAL MODULE: external "element-ui/lib/utils/dom"
355var dom_ = __webpack_require__(2);
356
357// EXTERNAL MODULE: external "element-ui/lib/utils/popup"
358var popup_ = __webpack_require__(15);
359
360// EXTERNAL MODULE: external "element-ui/lib/utils/after-leave"
361var after_leave_ = __webpack_require__(41);
362var after_leave_default = /*#__PURE__*/__webpack_require__.n(after_leave_);
363
364// CONCATENATED MODULE: ./packages/loading/src/directive.js
365
366
367
368
369
370var Mask = external_vue_default.a.extend(loading);
371
372var loadingDirective = {};
373loadingDirective.install = function (Vue) {
374 if (Vue.prototype.$isServer) return;
375 var toggleLoading = function toggleLoading(el, binding) {
376 if (binding.value) {
377 Vue.nextTick(function () {
378 if (binding.modifiers.fullscreen) {
379 el.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
380 el.originalOverflow = Object(dom_["getStyle"])(document.body, 'overflow');
381 el.maskStyle.zIndex = popup_["PopupManager"].nextZIndex();
382
383 Object(dom_["addClass"])(el.mask, 'is-fullscreen');
384 insertDom(document.body, el, binding);
385 } else {
386 Object(dom_["removeClass"])(el.mask, 'is-fullscreen');
387
388 if (binding.modifiers.body) {
389 el.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
390
391 ['top', 'left'].forEach(function (property) {
392 var scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
393 el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - parseInt(Object(dom_["getStyle"])(document.body, 'margin-' + property), 10) + 'px';
394 });
395 ['height', 'width'].forEach(function (property) {
396 el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px';
397 });
398
399 insertDom(document.body, el, binding);
400 } else {
401 el.originalPosition = Object(dom_["getStyle"])(el, 'position');
402 insertDom(el, el, binding);
403 }
404 }
405 });
406 } else {
407 after_leave_default()(el.instance, function (_) {
408 if (!el.instance.hiding) return;
409 el.domVisible = false;
410 var target = binding.modifiers.fullscreen || binding.modifiers.body ? document.body : el;
411 Object(dom_["removeClass"])(target, 'el-loading-parent--relative');
412 Object(dom_["removeClass"])(target, 'el-loading-parent--hidden');
413 el.instance.hiding = false;
414 }, 300, true);
415 el.instance.visible = false;
416 el.instance.hiding = true;
417 }
418 };
419 var insertDom = function insertDom(parent, el, binding) {
420 if (!el.domVisible && Object(dom_["getStyle"])(el, 'display') !== 'none' && Object(dom_["getStyle"])(el, 'visibility') !== 'hidden') {
421 Object.keys(el.maskStyle).forEach(function (property) {
422 el.mask.style[property] = el.maskStyle[property];
423 });
424
425 if (el.originalPosition !== 'absolute' && el.originalPosition !== 'fixed') {
426 Object(dom_["addClass"])(parent, 'el-loading-parent--relative');
427 }
428 if (binding.modifiers.fullscreen && binding.modifiers.lock) {
429 Object(dom_["addClass"])(parent, 'el-loading-parent--hidden');
430 }
431 el.domVisible = true;
432
433 parent.appendChild(el.mask);
434 Vue.nextTick(function () {
435 if (el.instance.hiding) {
436 el.instance.$emit('after-leave');
437 } else {
438 el.instance.visible = true;
439 }
440 });
441 el.domInserted = true;
442 } else if (el.domVisible && el.instance.hiding === true) {
443 el.instance.visible = true;
444 el.instance.hiding = false;
445 }
446 };
447
448 Vue.directive('loading', {
449 bind: function bind(el, binding, vnode) {
450 var textExr = el.getAttribute('element-loading-text');
451 var spinnerExr = el.getAttribute('element-loading-spinner');
452 var backgroundExr = el.getAttribute('element-loading-background');
453 var customClassExr = el.getAttribute('element-loading-custom-class');
454 var vm = vnode.context;
455 var mask = new Mask({
456 el: document.createElement('div'),
457 data: {
458 text: vm && vm[textExr] || textExr,
459 spinner: vm && vm[spinnerExr] || spinnerExr,
460 background: vm && vm[backgroundExr] || backgroundExr,
461 customClass: vm && vm[customClassExr] || customClassExr,
462 fullscreen: !!binding.modifiers.fullscreen
463 }
464 });
465 el.instance = mask;
466 el.mask = mask.$el;
467 el.maskStyle = {};
468
469 binding.value && toggleLoading(el, binding);
470 },
471
472 update: function update(el, binding) {
473 el.instance.setText(el.getAttribute('element-loading-text'));
474 if (binding.oldValue !== binding.value) {
475 toggleLoading(el, binding);
476 }
477 },
478
479 unbind: function unbind(el, binding) {
480 if (el.domInserted) {
481 el.mask && el.mask.parentNode && el.mask.parentNode.removeChild(el.mask);
482 toggleLoading(el, { value: false, modifiers: binding.modifiers });
483 }
484 el.instance && el.instance.$destroy();
485 }
486 });
487};
488
489/* harmony default export */ var directive = (loadingDirective);
490// EXTERNAL MODULE: external "element-ui/lib/utils/merge"
491var merge_ = __webpack_require__(9);
492var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
493
494// CONCATENATED MODULE: ./packages/loading/src/index.js
495
496
497
498
499
500
501
502var LoadingConstructor = external_vue_default.a.extend(loading);
503
504var defaults = {
505 text: null,
506 fullscreen: true,
507 body: false,
508 lock: false,
509 customClass: ''
510};
511
512var fullscreenLoading = void 0;
513
514LoadingConstructor.prototype.originalPosition = '';
515LoadingConstructor.prototype.originalOverflow = '';
516
517LoadingConstructor.prototype.close = function () {
518 var _this = this;
519
520 if (this.fullscreen) {
521 fullscreenLoading = undefined;
522 }
523 after_leave_default()(this, function (_) {
524 var target = _this.fullscreen || _this.body ? document.body : _this.target;
525 Object(dom_["removeClass"])(target, 'el-loading-parent--relative');
526 Object(dom_["removeClass"])(target, 'el-loading-parent--hidden');
527 if (_this.$el && _this.$el.parentNode) {
528 _this.$el.parentNode.removeChild(_this.$el);
529 }
530 _this.$destroy();
531 }, 300);
532 this.visible = false;
533};
534
535var src_addStyle = function addStyle(options, parent, instance) {
536 var maskStyle = {};
537 if (options.fullscreen) {
538 instance.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
539 instance.originalOverflow = Object(dom_["getStyle"])(document.body, 'overflow');
540 maskStyle.zIndex = popup_["PopupManager"].nextZIndex();
541 } else if (options.body) {
542 instance.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
543 ['top', 'left'].forEach(function (property) {
544 var scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
545 maskStyle[property] = options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
546 });
547 ['height', 'width'].forEach(function (property) {
548 maskStyle[property] = options.target.getBoundingClientRect()[property] + 'px';
549 });
550 } else {
551 instance.originalPosition = Object(dom_["getStyle"])(parent, 'position');
552 }
553 Object.keys(maskStyle).forEach(function (property) {
554 instance.$el.style[property] = maskStyle[property];
555 });
556};
557
558var src_Loading = function Loading() {
559 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
560
561 if (external_vue_default.a.prototype.$isServer) return;
562 options = merge_default()({}, defaults, options);
563 if (typeof options.target === 'string') {
564 options.target = document.querySelector(options.target);
565 }
566 options.target = options.target || document.body;
567 if (options.target !== document.body) {
568 options.fullscreen = false;
569 } else {
570 options.body = true;
571 }
572 if (options.fullscreen && fullscreenLoading) {
573 return fullscreenLoading;
574 }
575
576 var parent = options.body ? document.body : options.target;
577 var instance = new LoadingConstructor({
578 el: document.createElement('div'),
579 data: options
580 });
581
582 src_addStyle(options, parent, instance);
583 if (instance.originalPosition !== 'absolute' && instance.originalPosition !== 'fixed') {
584 Object(dom_["addClass"])(parent, 'el-loading-parent--relative');
585 }
586 if (options.fullscreen && options.lock) {
587 Object(dom_["addClass"])(parent, 'el-loading-parent--hidden');
588 }
589 parent.appendChild(instance.$el);
590 external_vue_default.a.nextTick(function () {
591 instance.visible = true;
592 });
593 if (options.fullscreen) {
594 fullscreenLoading = instance;
595 }
596 return instance;
597};
598
599/* harmony default export */ var src = (src_Loading);
600// CONCATENATED MODULE: ./packages/loading/index.js
601
602
603
604/* harmony default export */ var packages_loading = __webpack_exports__["default"] = ({
605 install: function install(Vue) {
606 Vue.use(directive);
607 Vue.prototype.$loading = src;
608 },
609
610 directive: directive,
611 service: src
612});
613
614/***/ }),
615
616/***/ 7:
617/***/ (function(module, exports) {
618
619module.exports = require("vue");
620
621/***/ }),
622
623/***/ 9:
624/***/ (function(module, exports) {
625
626module.exports = require("element-ui/lib/utils/merge");
627
628/***/ })
629
630/******/ });
\No newline at end of file