UNPKG

@mdsfe/mds-ui

Version:

A set of enterprise-class Vue UI components.

1,702 lines (1,504 loc) 51.5 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("vue"), require("./icon"), require("./_mixin/locale"), require("./transition"), require("./button")); else if(typeof define === 'function' && define.amd) define(["vue", "./icon", "./_mixin/locale", "./transition", "./button"], factory); else { var a = typeof exports === 'object' ? factory(require("vue"), require("./icon"), require("./_mixin/locale"), require("./transition"), require("./button")) : factory(root["Vue"], root["./icon"], root["./_mixin/locale"], root["./transition"], root["./button"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__13__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 129); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /***/ 1: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; }); /* unused harmony export once */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return removeClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; }); /* unused harmony export setStyle */ /* unused harmony export isScroll */ /* unused harmony export getScrollContainer */ /* unused harmony export isInContainer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return merge; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollBarWidth; }); /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10); /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__); /* eslint-disable */ var isServer = vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer; var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; var MOZ_HACK_REGEXP = /^moz([A-Z])/; var ieVersion = isServer ? 0 : Number(document.documentMode); /* istanbul ignore next */ var trim = function trim(string) { return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ''); }; /* istanbul ignore next */ var camelCase = function camelCase(name) { return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }).replace(MOZ_HACK_REGEXP, 'Moz$1'); }; /* istanbul ignore next */ var on = function () { if (!isServer && document.addEventListener) { return function (element, event, handler) { if (element && event && handler) { element.addEventListener(event, handler, false); } }; } else { return function (element, event, handler) { if (element && event && handler) { element.attachEvent('on' + event, handler); } }; } }(); /* istanbul ignore next */ var off = function () { if (!isServer && document.removeEventListener) { return function (element, event, handler) { if (element && event) { element.removeEventListener(event, handler, false); } }; } else { return function (element, event, handler) { if (element && event) { element.detachEvent('on' + event, handler); } }; } }(); /* istanbul ignore next */ var once = function once(el, event, fn) { var listener = function listener() { if (fn) { fn.apply(this, arguments); } off(el, event, listener); }; on(el, event, listener); }; /* istanbul ignore next */ function hasClass(el, cls) { if (!el || !cls) return false; if (cls.indexOf(' ') !== -1) { throw new Error('className should not contain space.'); } if (el.classList) { return el.classList.contains(cls); } else { return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1; } } /* istanbul ignore next */ function addClass(el, cls) { if (!el) return; var curClass = el.className; var classes = (cls || '').split(' '); for (var i = 0, j = classes.length; i < j; i++) { var clsName = classes[i]; if (!clsName) continue; if (el.classList) { el.classList.add(clsName); } else if (!hasClass(el, clsName)) { curClass += ' ' + clsName; } } if (!el.classList) { el.setAttribute('class', curClass); } } /* istanbul ignore next */ function removeClass(el, cls) { if (!el || !cls) return; var classes = cls.split(' '); var curClass = ' ' + el.className + ' '; for (var i = 0, j = classes.length; i < j; i++) { var clsName = classes[i]; if (!clsName) continue; if (el.classList) { el.classList.remove(clsName); } else if (hasClass(el, clsName)) { curClass = curClass.replace(' ' + clsName + ' ', ' '); } } if (!el.classList) { el.setAttribute('class', trim(curClass)); } } /* istanbul ignore next */ var getStyle = ieVersion < 9 ? function (element, styleName) { if (isServer) return; if (!element || !styleName) return null; styleName = camelCase(styleName); if (styleName === 'float') { styleName = 'styleFloat'; } try { switch (styleName) { case 'opacity': try { return element.filters.item('alpha').opacity / 100; } catch (e) { return 1.0; } default: return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null; } } catch (e) { return element.style[styleName]; } } : function (element, styleName) { if (isServer) return; if (!element || !styleName) return null; styleName = camelCase(styleName); if (styleName === 'float') { styleName = 'cssFloat'; } try { var computed = document.defaultView.getComputedStyle(element, ''); return element.style[styleName] || computed ? computed[styleName] : null; } catch (e) { return element.style[styleName]; } }; /* istanbul ignore next */ function setStyle(element, styleName, value) { if (!element || !styleName) return; if ((typeof styleName === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(styleName)) === 'object') { for (var prop in styleName) { if (styleName.hasOwnProperty(prop)) { setStyle(element, prop, styleName[prop]); } } } else { styleName = camelCase(styleName); if (styleName === 'opacity' && ieVersion < 9) { element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')'; } else { element.style[styleName] = value; } } } var isScroll = function isScroll(el, vertical) { if (isServer) return; var determinedDirection = vertical !== null && vertical !== undefined; var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow'); return overflow.match(/(scroll|auto|overlay)/); }; var getScrollContainer = function getScrollContainer(el, vertical) { if (isServer) return; var parent = el; while (parent) { if ([window, document, document.documentElement].includes(parent)) { return window; } if (isScroll(parent, vertical)) { return parent; } parent = parent.parentNode; } return parent; }; var isInContainer = function isInContainer(el, container) { if (isServer || !el || !container) return false; var elRect = el.getBoundingClientRect(); var containerRect = void 0; if ([window, document, document.documentElement, null, undefined].includes(container)) { containerRect = { top: 0, right: window.innerWidth, bottom: window.innerHeight, left: 0 }; } else { containerRect = container.getBoundingClientRect(); } return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right; }; function merge(target) { for (var i = 1, j = arguments.length; i < j; i++) { var source = arguments[i] || {}; for (var prop in source) { if (source.hasOwnProperty(prop)) { var value = source[prop]; if (value !== undefined) { target[prop] = value; } } } } return target; } var scrollBarWidth = void 0; function getScrollBarWidth() { if (vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer) return 0; if (scrollBarWidth !== undefined) return scrollBarWidth; var outer = document.createElement('div'); outer.className = 'el-scrollbar__wrap'; outer.style.visibility = 'hidden'; outer.style.width = '100px'; outer.style.position = 'absolute'; outer.style.top = '-9999px'; document.body.appendChild(outer); var widthNoScroll = outer.offsetWidth; outer.style.overflow = 'scroll'; var inner = document.createElement('div'); inner.style.width = '100%'; outer.appendChild(inner); var widthWithScroll = inner.offsetWidth; outer.parentNode.removeChild(outer); scrollBarWidth = widthNoScroll - widthWithScroll; return scrollBarWidth; } /***/ }), /***/ 10: /***/ (function(module, exports) { module.exports = require("babel-runtime/helpers/typeof"); /***/ }), /***/ 12: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__12__; /***/ }), /***/ 129: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./components/style/index.less var style = __webpack_require__(142); // EXTERNAL MODULE: ./components/modal/style/index.less var modal_style = __webpack_require__(198); // CONCATENATED MODULE: ./components/modal/style/index.js // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/modal/modal.vue?vue&type=template&id=64c3d160& var render = function () { var _obj var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c("mds-transition", { attrs: { type: "fade" } }, [ _c( "div", { directives: [ { name: "show", rawName: "v-show", value: _vm.visibility, expression: "visibility", }, ], ref: "root", class: ["mds-modal-container", _vm.customClass], }, [ _c("div", { directives: [ { name: "show", rawName: "v-show", value: _vm.mask, expression: "mask", }, ], class: _vm.prefixClsMask, on: { click: _vm.handleCancel }, }), _c( "div", { class: _vm.prefixClsWrap, on: { click: function (e) { return _vm.onMaskClick(e) }, }, }, [ _c("div", { class: _vm.prefixCls, style: _vm.styles }, [ _c( "div", { class: [_vm.prefixClsContent, _vm.customContentClass] }, [ _c( "div", { directives: [ { name: "show", rawName: "v-show", value: _vm.showClose, expression: "showClose", }, ], class: _vm.prefixClsClose, on: { click: _vm.handleCancel }, }, [ _vm.modalType === "base" ? _c("mds-icon", { attrs: { type: "line-close" } }) : _vm._e(), ], 1 ), _c( "div", { class: [ _vm.prefixClsHeader, _vm.modalType === "base" ? _vm.prefixClsBottom : "", ], }, [ _vm.modalType !== "base" ? _c( "div", { class: _vm.prefixClsIcon }, [ _c("mds-icon", { style: _vm.iconStyle, attrs: { type: _vm.iconType }, }), ], 1 ) : _vm._e(), _vm.renderSlot ? _c( "div", { class: ((_obj = {}), (_obj["" + _vm.prefixClsTitle] = true), (_obj.center = _vm.modalType !== "base"), _obj), }, [ _vm._t("title", [ _vm._v( "\n " + _vm._s(_vm.title) + "\n " ), ]), ], 2 ) : _vm._e(), ] ), _vm.renderSlot ? _c( "div", { class: [ _vm.prefixClsBody, _vm.modalType === "base" ? _vm.prefixClsBottom : "", ], }, [_vm._t("default")], 2 ) : _vm._e(), _vm.footer && _vm.renderSlot ? _c("div", { class: _vm.prefixClsFooter }, [ _vm.$slots.footer ? _c("div", [_vm._t("footer")], 2) : _c( "div", { class: _vm.prefixClsFooterDefault }, [ _vm.modalType !== "success" ? _c( "mds-button", { class: _vm.prefixClsButton, on: { click: _vm.handleCancel }, }, [_vm._v(_vm._s(_vm.dispatchCancelText))] ) : _vm._e(), _c( "mds-button", { style: _vm.okButtonStyle, attrs: { type: "primary" }, on: { click: _vm.handleOk }, }, [_vm._v(_vm._s(_vm.dispatchConfirmText))] ), ], 1 ), ]) : _vm._e(), ] ), ]), ] ), ] ), ]) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./components/modal/modal.vue?vue&type=template&id=64c3d160& // EXTERNAL MODULE: external "babel-runtime/core-js/number/is-finite" var is_finite_ = __webpack_require__(71); var is_finite_default = /*#__PURE__*/__webpack_require__.n(is_finite_); // EXTERNAL MODULE: external "./icon" var external_icon_ = __webpack_require__(7); var external_icon_default = /*#__PURE__*/__webpack_require__.n(external_icon_); // EXTERNAL MODULE: external "./button" var external_button_ = __webpack_require__(13); var external_button_default = /*#__PURE__*/__webpack_require__.n(external_button_); // EXTERNAL MODULE: ./components/_util/util.js var util = __webpack_require__(16); // EXTERNAL MODULE: ./components/_util/_popper/popup/popup-main.js var popup_main = __webpack_require__(15); // EXTERNAL MODULE: external "./transition" var external_transition_ = __webpack_require__(12); var external_transition_default = /*#__PURE__*/__webpack_require__.n(external_transition_); // EXTERNAL MODULE: external "./_mixin/locale" var locale_ = __webpack_require__(9); var locale_default = /*#__PURE__*/__webpack_require__.n(locale_); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/modal/modal.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // var PREFIXCLS = 'mds-modal'; /* harmony default export */ var modalvue_type_script_lang_js_ = ({ name: 'MdsModal', components: { MdsIcon: external_icon_default.a, MdsButton: external_button_default.a, mdsTransition: external_transition_default.a }, mixins: [popup_main["b" /* default */], locale_default.a], props: { width: { type: [String, Number], default: 400 }, title: { type: String }, modalType: { type: String, default: 'base', validator: function validator(value) { return ['base', 'success', 'info', 'warning', 'error'].indexOf(value) !== -1; } }, modalIcon: { type: String }, modalIconColor: { type: String }, okText: { type: String }, cancelText: { type: String }, mask: { type: Boolean, default: true }, visibility: { type: Boolean, default: false }, showClose: { type: Boolean, default: true }, footer: { type: Boolean, default: true }, top: { type: String, default: '15vh' }, maskClosable: { type: Boolean, default: true }, customClass: String, customContentClass: String, destroyOnClose: Boolean, beforeClose: Function, disabledScroll: { type: Boolean, default: true } }, data: function data() { return { prefixCls: PREFIXCLS, prefixClsMask: PREFIXCLS + '-mask', prefixClsWrap: PREFIXCLS + '-wrap', prefixClsContent: PREFIXCLS + '-content', prefixClsClose: PREFIXCLS + '-close', prefixClsHeader: PREFIXCLS + '-header', prefixClsBottom: PREFIXCLS + '-bottom', prefixClsIcon: PREFIXCLS + '-icon', prefixClsTitle: PREFIXCLS + '-title', prefixClsBody: PREFIXCLS + '-body', prefixClsFooter: PREFIXCLS + '-footer', prefixClsFooterDefault: PREFIXCLS + '-footer-default', prefixClsButton: PREFIXCLS + '-button', renderSlot: false }; }, computed: { styles: function styles() { var width = is_finite_default()(this.width) ? this.width + 'px' : this.width; return { width: width, top: this.top }; }, iconType: function iconType() { var icon = void 0; var typeSelect = { base: '', info: 'line-info-circle', success: 'fill-solid-right-circle', error: 'fill-solid-wrong-circle', warning: 'fill-solid-exclamation-circle' }; this.modalIcon ? icon = this.modalIcon : icon = typeSelect[this.modalType]; return icon; }, iconStyle: function iconStyle() { var color = void 0; var typeSelect = { base: '', success: '#00AA00', info: '#0364FF', warning: '#FF6600', error: '#ee3333' }; this.modalIconColor ? color = this.modalIconColor : color = typeSelect[this.modalType]; return { color: color }; }, okButtonStyle: function okButtonStyle() { var color = ''; var colorSelect = { base: '', success: '#00AA00', info: '#0364FF', warning: '#FF6600', error: '#ee3333' }; this.modalIconColor ? color = this.modalIconColor : color = colorSelect[this.modalType]; return { 'border-color': color, background: color }; }, dispatchConfirmText: function dispatchConfirmText() { return this.okText || this.t('mds.modal.confirmText'); }, dispatchCancelText: function dispatchCancelText() { return this.cancelText || this.t('mds.modal.cancelText'); } }, watch: { visibility: function visibility(newVal, oldVal) { if (newVal === oldVal) { return; } if (this.disabledScroll) { Object(util["d" /* fixBodyScroll */])(newVal); } if (newVal) { this.renderSlot = newVal; } else { if (this.destroyOnClose) { this.renderSlot = newVal; } } } }, methods: { handleCancel: function handleCancel() { var _this = this; var done = function done() { _this.$emit('close'); _this.$emit('update:visibility', false); }; if (Object(util["h" /* isFunction */])(this.beforeClose)) { this.beforeClose(done); } else { done(); } }, handleOk: function handleOk() { this.$emit('ok'); }, onMaskClick: function onMaskClick(e) { if (e.target === e.currentTarget && this.maskClosable) { this.handleCancel(); } }, initZindex: function initZindex() { var _this2 = this; if (this._opening) return; if (!this.rendered) { this.rendered = true; this.$nextTick(function () { _this2.open(); }); } else { this.open(); } } }, mounted: function mounted() { if (this.visibility) { this.renderSlot = true; this.initZindex(); } document.body.appendChild(this.$refs.root); } }); // CONCATENATED MODULE: ./components/modal/modal.vue?vue&type=script&lang=js& /* harmony default export */ var modal_modalvue_type_script_lang_js_ = (modalvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/modal/modal.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( modal_modalvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "components/modal/modal.vue" /* harmony default export */ var modal = (component.exports); // CONCATENATED MODULE: ./components/modal/index.js /* istanbul ignore next */ modal.install = function (Vue) { Vue.component(modal.name, modal); }; /* harmony default export */ var components_modal = __webpack_exports__["default"] = (modal); /***/ }), /***/ 13: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__13__; /***/ }), /***/ 142: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 15: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); /* harmony import */ var _popup_manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _popup_manager__WEBPACK_IMPORTED_MODULE_2__["a"]; }); var idSeed = 1; var scrollBarWidth = void 0; /* harmony default export */ __webpack_exports__["b"] = ({ props: { visibility: { type: Boolean, default: false }, openDelay: {}, closeDelay: {}, zIndex: {}, modal: { type: Boolean, default: false }, modalFade: { type: Boolean, default: true }, modalClass: {}, modalAppendToBody: { type: Boolean, default: false }, lockScroll: { type: Boolean, default: true }, closeOnPressEscape: { type: Boolean, default: false }, closeOnClickModal: { type: Boolean, default: false } }, beforeMount: function beforeMount() { this._popupId = 'popup-' + idSeed++; _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].register(this._popupId, this); }, beforeDestroy: function beforeDestroy() { _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].deregister(this._popupId); _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId); this.restoreBodyStyle(); }, data: function data() { return { opened: false, bodyPaddingRight: null, computedBodyPaddingRight: 0, withoutHiddenClass: true, rendered: false }; }, watch: { visibility: function visibility(val) { var _this = this; if (val) { if (this._opening) return; if (!this.rendered) { this.rendered = true; vue__WEBPACK_IMPORTED_MODULE_0___default.a.nextTick(function () { _this.open(); }); } else { this.open(); } } else { this.close(); } } }, methods: { open: function open(options) { var _this2 = this; if (!this.rendered) { this.rendered = true; } var props = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* merge */ "e"])({}, this.$props || this, options); if (this._closeTimer) { clearTimeout(this._closeTimer); this._closeTimer = null; } clearTimeout(this._openTimer); var openDelay = Number(props.openDelay); if (openDelay > 0) { this._openTimer = setTimeout(function () { _this2._openTimer = null; _this2.doOpen(props); }, openDelay); } else { this.doOpen(props); } }, doOpen: function doOpen(props) { if (this.$isServer) return; if (this.willOpen && !this.willOpen()) return; if (this.opened) return; this._opening = true; var dom = this.$el; var modal = props.modal; var zIndex = props.zIndex; if (zIndex) { _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].zIndex = zIndex; } if (modal) { if (this._closing) { _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId); this._closing = false; } _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].openModal(this._popupId, _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade); if (props.lockScroll) { this.withoutHiddenClass = !Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* hasClass */ "d"])(document.body, 'mds-popup-parent--hidden'); if (this.withoutHiddenClass) { this.bodyPaddingRight = document.body.style.paddingRight; this.computedBodyPaddingRight = parseInt(Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'paddingRight'), 10); } scrollBarWidth = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getScrollBarWidth */ "b"])(); var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight; var bodyOverflowY = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'overflowY'); if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) { document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px'; } Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(document.body, 'mds-popup-parent--hidden'); } } if (getComputedStyle(dom).position === 'static') { dom.style.position = 'absolute'; } dom.style.zIndex = _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex(); this.opened = true; this.onOpen && this.onOpen(); this.doAfterOpen(); }, doAfterOpen: function doAfterOpen() { this._opening = false; }, close: function close() { var _this3 = this; if (this.willClose && !this.willClose()) return; if (this._openTimer !== null) { clearTimeout(this._openTimer); this._openTimer = null; } clearTimeout(this._closeTimer); var closeDelay = Number(this.closeDelay); if (closeDelay > 0) { this._closeTimer = setTimeout(function () { _this3._closeTimer = null; _this3.doClose(); }, closeDelay); } else { this.doClose(); } }, doClose: function doClose() { this._closing = true; this.onClose && this.onClose(); if (this.lockScroll) { setTimeout(this.restoreBodyStyle, 200); } this.opened = false; this.doAfterClose(); }, doAfterClose: function doAfterClose() { _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId); this._closing = false; }, restoreBodyStyle: function restoreBodyStyle() { if (this.modal && this.withoutHiddenClass) { document.body.style.paddingRight = this.bodyPaddingRight; Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(document.body, 'mds-popup-parent--hidden'); } this.withoutHiddenClass = true; } } }); /***/ }), /***/ 16: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export noop */ /* unused harmony export getOffsetLeft */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getValueByPath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return valueEquals; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrayFindIndex; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayFind; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return coerceTruthyValueToArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isIE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isEdge; }); /* unused harmony export isFirefox */ /* unused harmony export assert */ /* unused harmony export escapeRegexpString */ /* unused harmony export getOffsetWidth */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isFunction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return fixBodyScroll; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return hasOwn; }); /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__); // import { getScrollBarWidth } from './_popper/dom-helper' var currentBodyOverflow = ''; // let currentBodyPaddingRight = '' var noop = function noop() {}; var getScroll = function getScroll(w, top) { var ret = top ? w.pageYOffset : w.pageXOffset; var method = top ? 'scrollTop' : 'scrollLeft'; if (typeof ret !== 'number') { var d = w.document; // ie6,7,8 standard mode ret = d.documentElement[method]; if (typeof ret !== 'number') { // quirks mode ret = d.body[method]; } } return ret; }; var getClientPosition = function getClientPosition(elem) { var box = void 0; var x = void 0; var y = void 0; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; box = elem.getBoundingClientRect(); x = box.left; y = box.top; x -= docElem.clientLeft || body.clientLeft || 0; y -= docElem.clientTop || body.clientTop || 0; return { left: x, top: y }; }; var getOffsetLeft = function getOffsetLeft(el) { var pos = getClientPosition(el); var doc = el.ownerDocument; var w = doc.defaultView || doc.parentWindow; pos.left += getScroll(w); return pos.left; }; /** * 获取对象深层级的对象,避免循环 * @export * @param {*} sourceObj 源对象 {a:{b:{d:1}}} * @param {*} pathName path组成的数组 例如:'a.b.c' * @param {*} defaultValue 如果没有值默认的值 [] */ function getValueByPath(sourceObj, pathName, defaultValue) { var getValue = function getValue(sourceObj, pathNameArray) { var key = pathNameArray.shift(); var value = sourceObj[key]; if (value === undefined || value === null) { return defaultValue; } else if (pathNameArray.length === 0) { return value; } else if (pathNameArray.length > 0) { return getValue(value, pathNameArray); } }; var pathNameArray = pathName.split('.'); return getValue(sourceObj, pathNameArray); } /** * * 判断两个数是否相等 * @param {*} a * @param {*} b * @returns */ var valueEquals = function valueEquals(a, b) { // see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript if (a === b) return true; if (!(a instanceof Array)) return false; if (!(b instanceof Array)) return false; if (a.length !== b.length) return false; for (var i = 0; i !== a.length; ++i) { if (a[i] !== b[i]) return false; } return true; }; // TODO: use native Array.find, Array.findIndex when IE support is dropped var arrayFindIndex = function arrayFindIndex(arr, pred) { for (var i = 0; i !== arr.length; ++i) { if (pred(arr[i])) { return i; } } return -1; }; var arrayFind = function arrayFind(arr, pred) { var idx = arrayFindIndex(arr, pred); return idx !== -1 ? arr[idx] : undefined; }; // coerce truthy value to array var coerceTruthyValueToArray = function coerceTruthyValueToArray(val) { if (Array.isArray(val)) { return val; } else if (val) { return [val]; } else { return []; } }; var isIE = function isIE() { return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !isNaN(Number(document.documentMode)); }; var isEdge = function isEdge() { return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1; }; var isFirefox = function isFirefox() { return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i); }; var assert = function assert(condition, msg) { if (!condition) throw new Error('[mds-ui] ' + msg); }; /** * * 特殊字符转译 * @param {string} [value=''] */ var escapeRegexpString = function escapeRegexpString() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; return String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'); }; /** * Get element offset width * @param {*} node HTMLDOMElemment * @return {Number} width */ /** * Get element offset width * @param {*} node HTMLDOMElemment * @return {Number} width */ var getOffsetWidth = function getOffsetWidth(node) { return node ? node.offsetWidth : 0; }; /** 判断是否为函数 * @param {*} functionToCheck * @returns */ var isFunction = function isFunction(functionToCheck) { var getType = {}; return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; }; /** * 弹窗类组件显现时修正body滚动 * @param {Boolean} visible 弹窗显现状态 */ function fixBodyScroll(visible) { var bodyStyle = document.body.style; if (visible) { currentBodyOverflow = bodyStyle.overflow; // currentBodyPaddingRight = bodyStyle.paddingRight bodyStyle.overflow = 'hidden'; // const basePaddingRight = parseInt(currentBodyPaddingRight || 0) // const baseScrollWidth = parseInt(getScrollBarWidth()) // 防止页面抖动,后续需要自定义滚动条解决 // bodyStyle.paddingRight = basePaddingRight + baseScrollWidth + 'px' } else { var timer = setTimeout(function () { clearTimeout(timer); bodyStyle.overflow = currentBodyOverflow; // bodyStyle.paddingRight = currentBodyPaddingRight // currentBodyPaddingRight = '' }, 180); } } var hasOwnProperty = Object.prototype.hasOwnProperty; function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); } /***/ }), /***/ 198: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 2: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__2__; /***/ }), /***/ 5: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); var hasModal = false; var hasInitZIndex = false; var zIndex = void 0; var getModal = function getModal() { if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return; var modalDom = PopupManager.modalDom; if (modalDom) { hasModal = true; } else { hasModal = false; modalDom = document.createElement('div'); PopupManager.modalDom = modalDom; modalDom.addEventListener('touchmove', function (event) { event.preventDefault(); event.stopPropagation(); }); modalDom.addEventListener('click', function () { PopupManager.doOnModalClick && PopupManager.doOnModalClick(); }); } return modalDom; }; var instances = {}; var PopupManager = { modalFade: true, getInstance: function getInstance(id) { return instances[id]; }, register: function register(id, instance) { if (id && instance) { instances[id] = instance; } }, deregister: function deregister(id) { if (id) { instances[id] = null; delete instances[id]; } }, nextZIndex: function nextZIndex() { return PopupManager.zIndex++; }, modalStack: [], doOnModalClick: function doOnModalClick() { var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1]; if (!topItem) return; var instance = PopupManager.getInstance(topItem.id); if (instance && instance.closeOnClickModal) { instance.close(); } }, openModal: function openModal(id, zIndex, dom, modalClass, modalFade) { if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return; if (!id || zIndex === undefined) return; this.modalFade = modalFade; var modalStack = this.modalStack; for (var i = 0, j = modalStack.length; i < j; i++) { var item = modalStack[i]; if (item.id === id) { return; } } var modalDom = getModal(); Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal'); if (this.modalFade && !hasModal) { Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter'); } if (modalClass) { var classArr = modalClass.trim().split(/\s+/); classArr.forEach(function (item) { return Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item); }); } setTimeout(function () { Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, 'v-modal-enter'); }, 200); if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) { dom.parentNode.appendChild(modalDom); } else { document.body.appendChild(modalDom); } if (zIndex) { modalDom.style.zIndex = zIndex; } modalDom.tabIndex = 0; modalDom.style.display = ''; this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass }); }, closeModal: function closeModal(id) { var modalStack = this.modalStack; var modalDom = getModal(); if (modalStack.length > 0) { var topItem = modalStack[modalStack.length - 1]; if (topItem.id === id) { if (topItem.modalClass) { var classArr = topItem.modalClass.trim().split(/\s+/); classArr.forEach(function (item) { return Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, item); }); } modalStack.pop(); if (modalStack.length > 0) { modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex; } } else { for (var i = modalStack.length - 1; i >= 0; i--) { if (modalStack[i].id === id) { modalStack.splice(i, 1); break; } } } } if (modalStack.length === 0) { if (this.modalFade) { Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave'); } setTimeout(function () { if (modalStack.length === 0) { if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom); modalDom.style.display = 'none'; PopupManager.modalDom = undefined; } Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, 'v-modal-leave'); }, 200); } } }; Object.defineProperty(PopupManager, 'zIndex', { configurable: true, get: function get() { if (!hasInitZIndex) { zIndex = zIndex || (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$ELEMENT || {}).zIndex || 2000; hasInitZIndex = true; } return zIndex; }, set: function set(value) { zIndex =