@mdsfe/mds-ui
Version:
A set of enterprise-class Vue UI components.
1,431 lines (1,239 loc) • 335 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"), require("./_util/dateUtil"), require("./icon"), require("./_util/proptype"), require("./_mixin/locale"), require("./button"), require("./_mixin/emitter"), require("./input"), require("./_util/util"), require("./_util/clickoutside"), require("./_util/merge"), require("./_util/repeatClick"), require("./_util/dom"));
else if(typeof define === 'function' && define.amd)
define(["vue", "./_util/dateUtil", "./icon", "./_util/proptype", "./_mixin/locale", "./button", "./_mixin/emitter", "./input", "./_util/util", "./_util/clickoutside", "./_util/merge", "./_util/repeatClick", "./_util/dom"], factory);
else {
var a = typeof exports === 'object' ? factory(require("vue"), require("./_util/dateUtil"), require("./icon"), require("./_util/proptype"), require("./_mixin/locale"), require("./button"), require("./_mixin/emitter"), require("./input"), require("./_util/util"), require("./_util/clickoutside"), require("./_util/merge"), require("./_util/repeatClick"), require("./_util/dom")) : factory(root["Vue"], root["./_util/dateUtil"], root["./icon"], root["./_util/proptype"], root["./_mixin/locale"], root["./button"], root["./_mixin/emitter"], root["./input"], root["./_util/util"], root["./_util/clickoutside"], root["./_util/merge"], root["./_util/repeatClick"], root["./_util/dom"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__17__, __WEBPACK_EXTERNAL_MODULE__22__, __WEBPACK_EXTERNAL_MODULE__33__, __WEBPACK_EXTERNAL_MODULE__48__, __WEBPACK_EXTERNAL_MODULE__67__, __WEBPACK_EXTERNAL_MODULE__68__) {
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 = 88);
/******/ })
/************************************************************************/
/******/ ({
/***/ 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");
/***/ }),
/***/ 11:
/***/ (function(module, exports) {
module.exports = require("babel-runtime/core-js/object/keys");
/***/ }),
/***/ 13:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__13__;
/***/ }),
/***/ 14:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__14__;
/***/ }),
/***/ 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);
}
/***/ }),
/***/ 17:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__17__;
/***/ }),
/***/ 176:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 178:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 18:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./components/_util/_popper/popup/popup-main.js
var popup_main = __webpack_require__(15);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/get-own-property-descriptor"
var get_own_property_descriptor_ = __webpack_require__(20);
var get_own_property_descriptor_default = /*#__PURE__*/__webpack_require__.n(get_own_property_descriptor_);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
var keys_ = __webpack_require__(11);
var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/assign"
var assign_ = __webpack_require__(6);
var assign_default = /*#__PURE__*/__webpack_require__.n(assign_);
// CONCATENATED MODULE: ./components/_util/_popper/popper.js
/**
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version {{version}}
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* eslint-disable */
// Cross module loader
// Supported: Node, AMD, Browser globals
//
function popper_createPopper() {
'use strict';
var root = window;
// default options
var DEFAULTS = {
// placement of the popper
placement: 'bottom',
gpuAcceleration: false,
// shift popper from its origin by the given amount of pixels (can be negative)
offset: 0,
// the element which will act as boundary of the popper
boundariesElement: 'viewport',
// amount of pixel used to define a minimum distance between the boundaries and the popper
boundariesPadding: 5,
// popper will try to prevent overflow following this order,
// by default, then, it could overflow on the left and on top of the boundariesElement
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
// the behavior used by flip to change the placement of the popper
flipBehavior: 'flip',
arrowElement: '[x-arrow]',
arrowOffset: 0,
// list of functions used to modify the offsets before they are applied to the popper
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
modifiersIgnored: [],
forceAbsolute: false
/**
* Create a new Popper.js instance
* @constructor Popper
* @param {HTMLElement} reference - The reference element used to position the popper
* @param {HTMLElement|Object} popper
* The HTML element used as popper, or a configuration used to generate the popper.
* @param {String} [popper.tagName='div'] The tag name of the generated popper.
* @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
* @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
* @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
* @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
* @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
* @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
* @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
* @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
* @param {Object} options
* @param {String} [options.placement=bottom]
* Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
* left(-start, -end)`
*
* @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
* The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
* its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
* reference element.
* By default, it will look for a child node of the popper with the `x-arrow` attribute.
*
* @param {Boolean} [options.gpuAcceleration=true]
* When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
* browser to use the GPU to accelerate the rendering.
* If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
*
* @param {Number} [options.offset=0]
* Amount of pixels the popper will be shifted (can be negative).
*
* @param {String|Element} [options.boundariesElement='viewport']
* The element which will define the boundaries of the popper position, the popper will never be placed outside
* of the defined boundaries (except if `keepTogether` is enabled)
*
* @param {Number} [options.boundariesPadding=5]
* Additional padding for the boundaries
*
* @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
* Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
* this means that the last ones will never overflow
*
* @param {String|Array} [options.flipBehavior='flip']
* The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
* overlap its reference element. Defining `flip` as value, the placement will be flipped on
* its axis (`right - left`, `top - bottom`).
* You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
* how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
* then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
*
* @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
* List of functions used to modify the data before they are applied to the popper, add your custom functions
* to this array to edit the offsets and placement.
* The function should reflect the @params and @returns of preventOverflow
*
* @param {Array} [options.modifiersIgnored=[]]
* Put here any built-in modifier name you want to exclude from the modifiers list
* The function should reflect the @params and @returns of preventOverflow
*
* @param {Boolean} [options.removeOnDestroy=false]
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
*/
};function Popper(reference, popper, options) {
this._reference = reference.jquery ? reference[0] : reference;
this.state = {};
// if the popper variable is a configuration object, parse it to generate an HTMLElement
// generate a default popper if is not defined
var isNotDefined = typeof popper === 'undefined' || popper === null;
var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
if (isNotDefined || isConfig) {
this._popper = this.parse(isConfig ? popper : {});
}
// otherwise, use the given HTMLElement as popper
else {
this._popper = popper.jquery ? popper[0] : popper;
}
// with {} we create a new object with the options inside it
this._options = assign_default()({}, DEFAULTS, options);
// refactoring modifiers' list
this._options.modifiers = this._options.modifiers.map(function (modifier) {
// remove ignored modifiers
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
// set the x-placement attribute before everything else because it could be used to add margins to the popper
// margins needs to be calculated to get the correct popper offsets
if (modifier === 'applyStyle') {
this._popper.setAttribute('x-placement', this._options.placement);
}
// return predefined modifier identified by string or keep the custom one
return this.modifiers[modifier] || modifier;
}.bind(this));
// make sure to apply the popper position before any computation
this.state.position = this._getPosition(this._popper, this._reference);
setStyle(this._popper, { position: this.state.position, top: 0 });
// fire the first update to position the popper in the right place
this.update();
// setup event listeners, they will take care of update the position in specific situations
this._setupEventListeners();
return this;
}
//
// Methods
//
/**
* Destroy the popper
* @method
* @memberof Popper
*/
Popper.prototype.destroy = function () {
this._popper.removeAttribute('x-placement');
this._popper.style.left = '';
this._popper.style.position = '';
this._popper.style.top = '';
this._popper.style[getSupportedPropertyName('transform')] = '';
this._removeEventListeners();
// remove the popper if user explicity asked for the deletion on destroy
if (this._options.removeOnDestroy) {
this._popper.remove();
}
return this;
};
/**
* Updates the position of the popper, computing the new offsets and applying the new style
* @method
* @memberof Popper
*/
Popper.prototype.update = function () {
var data = { instance: this, styles: {}
// store placement inside the data object, modifiers will be able to edit `placement` if needed
// and refer to _originalPlacement to know the original value
};data.placement = this._options.placement;
data._originalPlacement = this._options.placement;
// compute the popper and reference offsets and put them inside data.offsets
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
// get boundaries
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
data = this.runModifiers(data, this._options.modifiers);
if (typeof this.state.updateCallback === 'function') {
this.state.updateCallback(data);
}
};
/**
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
* @method
* @memberof Popper
* @param {Function} callback
*/
Popper.prototype.onCreate = function (callback) {
// the createCallbacks return as first argument the popper instance
callback(this);
return this;
};
/**
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
* used to style popper and its arrow.
* NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
* @method
* @memberof Popper
* @param {Function} callback
*/
Popper.prototype.onUpdate = function (callback) {
this.state.updateCallback = callback;
return this;
};
/**
* Helper used to generate poppers from a configuration file
* @method
* @memberof Popper
* @param config {Object} configuration
* @returns {HTMLElement} popper
*/
Popper.prototype.parse = function (config) {
var defaultConfig = {
tagName: 'div',
classNames: ['popper'],
attributes: [],
parent: root.document.body,
content: '',
contentType: 'text',
arrowTagName: 'div',
arrowClassNames: ['popper__arrow'],
arrowAttributes: ['x-arrow']
};
config = assign_default()({}, defaultConfig, config);
var d = root.document;
var popper = d.createElement(config.tagName);
addClassNames(popper, config.classNames);
addAttributes(popper, config.attributes);
if (config.contentType === 'node') {
popper.appendChild(config.content.jquery ? config.content[0] : config.content);
} else if (config.contentType === 'html') {
popper.innerHTML = config.content;
} else {
popper.textContent = config.content;
}
if (config.arrowTagName) {
var arrow = d.createElement(config.arrowTagName);
addClassNames(arrow, config.arrowClassNames);
addAttributes(arrow, config.arrowAttributes);
popper.appendChild(arrow);
}
var parent = config.parent.jquery ? config.parent[0] : config.parent;
// if the given parent is a string, use it to match an element
// if more than one element is matched, the first one will be used as parent
// if no elements are matched, the script will throw an error
if (typeof parent === 'string') {
parent = d.querySelectorAll(config.parent);
if (parent.length > 1) {
console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
}
if (parent.length === 0) {
throw "ERROR: the given `parent` doesn't exists!";
}
parent = parent[0];
}
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
// the first one will be used as parent
if (parent.length > 1 && parent instanceof Element === false) {
console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
parent = parent[0];
}
// append the generated popper to its parent
parent.appendChild(popper);
return popper;
/**
* Adds class names to the given element
* @function
* @ignore
* @param {HTMLElement} target
* @param {Array} classes
*/
function addClassNames(element, classNames) {
classNames.forEach(function (className) {
element.classList.add(className);
});
}
/**
* Adds attributes to the given element
* @function
* @ignore
* @param {HTMLElement} target
* @param {Array} attributes
* @example
* addAttributes(element, [ 'data-info:foobar' ]);
*/
function addAttributes(element, attributes) {
attributes.forEach(function (attribute) {
element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
});
}
};
/**
* Helper used to get the position which will be applied to the popper
* @method
* @memberof Popper
* @param config {HTMLElement} popper element
* @param reference {HTMLElement} reference element
* @returns {String} position
*/
Popper.prototype._getPosition = function (popper, reference) {
var container = getOffsetParent(reference);
if (this._options.forceAbsolute) {
return 'absolute';
}
// Decide if the popper will be fixed
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
var isParentFixed = isFixed(reference, container);
return isParentFixed ? 'fixed' : 'absolute';
};
/**
* Get offsets to the popper
* @method
* @memberof Popper
* @access private
* @param {Element} popper - the popper element
* @param {Element} reference - the reference element (the popper will be relative to this)
* @returns {Object} An object containing the offsets which will be applied to the popper
*/
Popper.prototype._getOffsets = function (popper, reference, placement) {
placement = placement.split('-')[0];
var popperOffsets = {};
popperOffsets.position = this.state.position;
var isParentFixed = popperOffsets.position === 'fixed';
//
// Get reference element position
//
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
//
// Get popper sizes
//
var popperRect = getOuterSizes(popper);
//
// Compute offsets of popper
//
// depending by the popper placement we have to compute its offsets slightly differently
if (['right', 'left'].indexOf(placement) !== -1) {
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
if (placement === 'left') {
popperOffsets.left = referenceOffsets.left - popperRect.width;
} else {
popperOffsets.left = referenceOffsets.right;
}
} else {
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
if (placement === 'top') {
popperOffsets.top = referenceOffsets.top - popperRect.height;
} else {
popperOffsets.top = referenceOffsets.bottom;
}
}
// Add