| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592 |
- module.exports =
- /******/ (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;
- /******/ // identity function for calling harmony imports with the correct context
- /******/ __webpack_require__.i = function(value) { return value; };
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/ // 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 = "";
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 225);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ function(module, exports) {
- /* globals __VUE_SSR_CONTEXT__ */
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
- // scopedId
- if (scopeId) {
- options._scopeId = 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 = injectStyles
- }
- if (hook) {
- var functional = options.functional
- var existing = functional
- ? options.render
- : options.beforeCreate
- if (!functional) {
- // inject component registration as beforeCreate hook
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- } else {
- // register for functioal component in vue file
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return existing(h, context)
- }
- }
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ },
- /***/ 1:
- /***/ function(module, exports) {
- module.exports = require("vue");
- /***/ },
- /***/ 117:
- /***/ function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ },
- /***/ 118:
- /***/ function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ },
- /***/ 143:
- /***/ function(module, exports, __webpack_require__) {
- function injectStyle (ssrContext) {
- __webpack_require__(117)
- __webpack_require__(118)
- }
- var Component = __webpack_require__(0)(
- /* script */
- __webpack_require__(65),
- /* template */
- __webpack_require__(187),
- /* styles */
- injectStyle,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
- module.exports = Component.exports
- /***/ },
- /***/ 187:
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('div', {
- staticClass: "mint-msgbox-wrapper"
- }, [_c('transition', {
- attrs: {
- "name": "msgbox-bounce"
- }
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.value),
- expression: "value"
- }],
- staticClass: "mint-msgbox"
- }, [(_vm.title !== '') ? _c('div', {
- staticClass: "mint-msgbox-header"
- }, [_c('div', {
- staticClass: "mint-msgbox-title"
- }, [_vm._v(_vm._s(_vm.title))])]) : _vm._e(), _vm._v(" "), (_vm.message !== '') ? _c('div', {
- staticClass: "mint-msgbox-content"
- }, [_c('div', {
- staticClass: "mint-msgbox-message",
- domProps: {
- "innerHTML": _vm._s(_vm.message)
- }
- }), _vm._v(" "), _c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.showInput),
- expression: "showInput"
- }],
- staticClass: "mint-msgbox-input"
- }, [_c('input', {
- directives: [{
- name: "model",
- rawName: "v-model",
- value: (_vm.inputValue),
- expression: "inputValue"
- }],
- ref: "input",
- attrs: {
- "placeholder": _vm.inputPlaceholder
- },
- domProps: {
- "value": (_vm.inputValue)
- },
- on: {
- "input": function($event) {
- if ($event.target.composing) { return; }
- _vm.inputValue = $event.target.value
- }
- }
- }), _vm._v(" "), _c('div', {
- staticClass: "mint-msgbox-errormsg",
- style: ({
- visibility: !!_vm.editorErrorMessage ? 'visible' : 'hidden'
- })
- }, [_vm._v(_vm._s(_vm.editorErrorMessage))])])]) : _vm._e(), _vm._v(" "), _c('div', {
- staticClass: "mint-msgbox-btns"
- }, [_c('button', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.showCancelButton),
- expression: "showCancelButton"
- }],
- class: [_vm.cancelButtonClasses],
- on: {
- "click": function($event) {
- _vm.handleAction('cancel')
- }
- }
- }, [_vm._v(_vm._s(_vm.cancelButtonText))]), _vm._v(" "), _c('button', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.showConfirmButton),
- expression: "showConfirmButton"
- }],
- class: [_vm.confirmButtonClasses],
- on: {
- "click": function($event) {
- _vm.handleAction('confirm')
- }
- }
- }, [_vm._v(_vm._s(_vm.confirmButtonText))])])])])], 1)
- },staticRenderFns: []}
- /***/ },
- /***/ 2:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
- /* unused harmony export on */
- /* unused harmony export off */
- /* harmony export (binding) */ __webpack_require__.d(exports, "c", function() { return once; });
- /* unused harmony export hasClass */
- /* harmony export (immutable) */ exports["a"] = addClass;
- /* harmony export (immutable) */ exports["b"] = removeClass;
- /* unused harmony export getStyle */
- /* unused harmony export setStyle */
- /* istanbul ignore next */
- var isServer = __WEBPACK_IMPORTED_MODULE_0_vue___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(string) {
- return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
- };
- /* istanbul ignore next */
- var camelCase = function(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(el, event, fn) {
- var listener = function() {
- 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.className = 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.className = 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 === '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;
- }
- }
- };
- /***/ },
- /***/ 225:
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(33);
- /***/ },
- /***/ 33:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_message_box_js__ = __webpack_require__(90);
- Object.defineProperty(exports, "__esModule", { value: true });
- /* harmony reexport (binding) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_message_box_js__["a"]; });
- /***/ },
- /***/ 65:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_popup__ = __webpack_require__(8);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- var CONFIRM_TEXT = '确定';
- var CANCEL_TEXT = '取消';
- /* harmony default export */ exports["default"] = {
- mixins: [ __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_popup__["a" /* default */] ],
- props: {
- modal: {
- default: true
- },
- showClose: {
- type: Boolean,
- default: true
- },
- lockScroll: {
- type: Boolean,
- default: false
- },
- closeOnClickModal: {
- default: true
- },
- closeOnPressEscape: {
- default: true
- },
- inputType: {
- type: String,
- default: 'text'
- }
- },
- computed: {
- confirmButtonClasses: function confirmButtonClasses() {
- var classes = 'mint-msgbox-btn mint-msgbox-confirm ' + this.confirmButtonClass;
- if (this.confirmButtonHighlight) {
- classes += ' mint-msgbox-confirm-highlight';
- }
- return classes;
- },
- cancelButtonClasses: function cancelButtonClasses() {
- var classes = 'mint-msgbox-btn mint-msgbox-cancel ' + this.cancelButtonClass;
- if (this.cancelButtonHighlight) {
- classes += ' mint-msgbox-cancel-highlight';
- }
- return classes;
- }
- },
- methods: {
- doClose: function doClose() {
- var this$1 = this;
- this.value = false;
- this._closing = true;
- this.onClose && this.onClose();
- setTimeout(function () {
- if (this$1.modal && this$1.bodyOverflow !== 'hidden') {
- document.body.style.overflow = this$1.bodyOverflow;
- document.body.style.paddingRight = this$1.bodyPaddingRight;
- }
- this$1.bodyOverflow = null;
- this$1.bodyPaddingRight = null;
- }, 200);
- this.opened = false;
- if (!this.transition) {
- this.doAfterClose();
- }
- },
- handleAction: function handleAction(action) {
- if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) {
- return;
- }
- var callback = this.callback;
- this.value = false;
- callback(action);
- },
- validate: function validate() {
- if (this.$type === 'prompt') {
- var inputPattern = this.inputPattern;
- if (inputPattern && !inputPattern.test(this.inputValue || '')) {
- this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
- this.$refs.input.classList.add('invalid');
- return false;
- }
- var inputValidator = this.inputValidator;
- if (typeof inputValidator === 'function') {
- var validateResult = inputValidator(this.inputValue);
- if (validateResult === false) {
- this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
- this.$refs.input.classList.add('invalid');
- return false;
- }
- if (typeof validateResult === 'string') {
- this.editorErrorMessage = validateResult;
- return false;
- }
- }
- }
- this.editorErrorMessage = '';
- this.$refs.input.classList.remove('invalid');
- return true;
- },
- handleInputType: function handleInputType(val) {
- if (val === 'range' || !this.$refs.input) return;
- this.$refs.input.type = val;
- }
- },
- watch: {
- inputValue: function inputValue() {
- if (this.$type === 'prompt') {
- this.validate();
- }
- },
- value: function value(val) {
- var this$1 = this;
- this.handleInputType(this.inputType);
- if (val && this.$type === 'prompt') {
- setTimeout(function () {
- if (this$1.$refs.input) {
- this$1.$refs.input.focus();
- }
- }, 500);
- }
- },
- inputType: function inputType(val) {
- this.handleInputType(val);
- }
- },
- data: function data() {
- return {
- title: '',
- message: '',
- type: '',
- showInput: false,
- inputValue: null,
- inputPlaceholder: '',
- inputPattern: null,
- inputValidator: null,
- inputErrorMessage: '',
- showConfirmButton: true,
- showCancelButton: false,
- confirmButtonText: CONFIRM_TEXT,
- cancelButtonText: CANCEL_TEXT,
- confirmButtonClass: '',
- confirmButtonDisabled: false,
- cancelButtonClass: '',
- editorErrorMessage: null,
- callback: null
- };
- }
- };
- /***/ },
- /***/ 7:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony default export */ exports["a"] = function(target) {
- var arguments$1 = arguments;
- for (var i = 1, j = arguments.length; i < j; i++) {
- var source = arguments$1[i] || {};
- for (var prop in source) {
- if (source.hasOwnProperty(prop)) {
- var value = source[prop];
- if (value !== undefined) {
- target[prop] = value;
- }
- }
- }
- }
- return target;
- };;
- /***/ },
- /***/ 8:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_merge__ = __webpack_require__(7);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__ = __webpack_require__(9);
- /* unused harmony reexport PopupManager */
- var idSeed = 1;
- var transitions = [];
- var hookTransition = function (transition) {
- if (transitions.indexOf(transition) !== -1) return;
- var getVueInstance = function (element) {
- var instance = element.__vue__;
- if (!instance) {
- var textNode = element.previousSibling;
- if (textNode.__vue__) {
- instance = textNode.__vue__;
- }
- }
- return instance;
- };
- __WEBPACK_IMPORTED_MODULE_0_vue___default.a.transition(transition, {
- afterEnter: function afterEnter(el) {
- var instance = getVueInstance(el);
- if (instance) {
- instance.doAfterOpen && instance.doAfterOpen();
- }
- },
- afterLeave: function afterLeave(el) {
- var instance = getVueInstance(el);
- if (instance) {
- instance.doAfterClose && instance.doAfterClose();
- }
- }
- });
- };
- var scrollBarWidth;
- var getScrollBarWidth = function () {
- if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
- if (scrollBarWidth !== undefined) return scrollBarWidth;
- var outer = document.createElement('div');
- 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);
- return widthNoScroll - widthWithScroll;
- };
- var getDOM = function(dom) {
- if (dom.nodeType === 3) {
- dom = dom.nextElementSibling || dom.nextSibling;
- getDOM(dom);
- }
- return dom;
- };
- /* harmony default export */ exports["a"] = {
- props: {
- value: {
- type: Boolean,
- default: false
- },
- transition: {
- type: String,
- default: ''
- },
- openDelay: {},
- closeDelay: {},
- zIndex: {},
- modal: {
- type: Boolean,
- default: false
- },
- modalFade: {
- type: Boolean,
- default: true
- },
- modalClass: {
- },
- lockScroll: {
- type: Boolean,
- default: true
- },
- closeOnPressEscape: {
- type: Boolean,
- default: false
- },
- closeOnClickModal: {
- type: Boolean,
- default: false
- }
- },
- created: function created() {
- if (this.transition) {
- hookTransition(this.transition);
- }
- },
- beforeMount: function beforeMount() {
- this._popupId = 'popup-' + idSeed++;
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].register(this._popupId, this);
- },
- beforeDestroy: function beforeDestroy() {
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].deregister(this._popupId);
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
- if (this.modal && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
- document.body.style.overflow = this.bodyOverflow;
- document.body.style.paddingRight = this.bodyPaddingRight;
- }
- this.bodyOverflow = null;
- this.bodyPaddingRight = null;
- },
- data: function data() {
- return {
- opened: false,
- bodyOverflow: null,
- bodyPaddingRight: null,
- rendered: false
- };
- },
- watch: {
- value: function value(val) {
- var this$1 = this;
- if (val) {
- if (this._opening) return;
- if (!this.rendered) {
- this.rendered = true;
- __WEBPACK_IMPORTED_MODULE_0_vue___default.a.nextTick(function () {
- this$1.open();
- });
- } else {
- this.open();
- }
- } else {
- this.close();
- }
- }
- },
- methods: {
- open: function open(options) {
- var this$1 = this;
- if (!this.rendered) {
- this.rendered = true;
- this.$emit('input', true);
- }
- var props = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_merge__["a" /* default */])({}, this, options, this.$props);
- if (this._closeTimer) {
- clearTimeout(this._closeTimer);
- this._closeTimer = null;
- }
- clearTimeout(this._openTimer);
- var openDelay = Number(props.openDelay);
- if (openDelay > 0) {
- this._openTimer = setTimeout(function () {
- this$1._openTimer = null;
- this$1.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;
- // 使用 vue-popup 的组件,如果需要和父组件通信显示的状态,应该使用 value,它是一个 prop,
- // 这样在父组件中用 v-model 即可;否则可以使用 visible,它是一个 data
- this.visible = true;
- this.$emit('input', true);
- var dom = getDOM(this.$el);
- var modal = props.modal;
- var zIndex = props.zIndex;
- if (zIndex) {
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].zIndex = zIndex;
- }
- if (modal) {
- if (this._closing) {
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
- this._closing = false;
- }
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].openModal(this._popupId, __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].nextZIndex(), dom, props.modalClass, props.modalFade);
- if (props.lockScroll) {
- if (!this.bodyOverflow) {
- this.bodyPaddingRight = document.body.style.paddingRight;
- this.bodyOverflow = document.body.style.overflow;
- }
- scrollBarWidth = getScrollBarWidth();
- var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
- if (scrollBarWidth > 0 && bodyHasOverflow) {
- document.body.style.paddingRight = scrollBarWidth + 'px';
- }
- document.body.style.overflow = 'hidden';
- }
- }
- if (getComputedStyle(dom).position === 'static') {
- dom.style.position = 'absolute';
- }
- dom.style.zIndex = __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].nextZIndex();
- this.opened = true;
- this.onOpen && this.onOpen();
- if (!this.transition) {
- this.doAfterOpen();
- }
- },
- doAfterOpen: function doAfterOpen() {
- this._opening = false;
- },
- close: function close() {
- var this$1 = 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 () {
- this$1._closeTimer = null;
- this$1.doClose();
- }, closeDelay);
- } else {
- this.doClose();
- }
- },
- doClose: function doClose() {
- var this$1 = this;
- this.visible = false;
- this.$emit('input', false);
- this._closing = true;
- this.onClose && this.onClose();
- if (this.lockScroll) {
- setTimeout(function () {
- if (this$1.modal && this$1.bodyOverflow !== 'hidden') {
- document.body.style.overflow = this$1.bodyOverflow;
- document.body.style.paddingRight = this$1.bodyPaddingRight;
- }
- this$1.bodyOverflow = null;
- this$1.bodyPaddingRight = null;
- }, 200);
- }
- this.opened = false;
- if (!this.transition) {
- this.doAfterClose();
- }
- },
- doAfterClose: function doAfterClose() {
- __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
- this._closing = false;
- }
- }
- };
- /***/ },
- /***/ 9:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__ = __webpack_require__(2);
- var hasModal = false;
- var getModal = function() {
- if (__WEBPACK_IMPORTED_MODULE_0_vue___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 = {
- zIndex: 2000,
- modalFade: true,
- getInstance: function(id) {
- return instances[id];
- },
- register: function(id, instance) {
- if (id && instance) {
- instances[id] = instance;
- }
- },
- deregister: function(id) {
- if (id) {
- instances[id] = null;
- delete instances[id];
- }
- },
- nextZIndex: function() {
- return PopupManager.zIndex++;
- },
- modalStack: [],
- doOnModalClick: function() {
- 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(id, zIndex, dom, modalClass, modalFade) {
- if (__WEBPACK_IMPORTED_MODULE_0_vue___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();
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal');
- if (this.modalFade && !hasModal) {
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal-enter');
- }
- if (modalClass) {
- var classArr = modalClass.trim().split(/\s+/);
- classArr.forEach(function (item) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, item); });
- }
- setTimeout(function () {
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["b" /* removeClass */])(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.style.display = '';
- this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
- },
- closeModal: function(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 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["b" /* removeClass */])(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) {
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal-leave');
- }
- setTimeout(function () {
- if (modalStack.length === 0) {
- if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
- modalDom.style.display = 'none';
- PopupManager.modalDom = undefined;
- }
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, 'v-modal-leave');
- }, 200);
- }
- }
- };
- !__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer && window.addEventListener('keydown', function(event) {
- if (event.keyCode === 27) { // ESC
- if (PopupManager.modalStack.length > 0) {
- var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
- if (!topItem) return;
- var instance = PopupManager.getInstance(topItem.id);
- if (instance.closeOnPressEscape) {
- instance.close();
- }
- }
- }
- });
- /* harmony default export */ exports["a"] = PopupManager;
- /***/ },
- /***/ 90:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__message_box_vue__ = __webpack_require__(143);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__message_box_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__message_box_vue__);
- /* unused harmony export MessageBox */
- var CONFIRM_TEXT = '确定';
- var CANCEL_TEXT = '取消';
- var defaults = {
- title: '提示',
- message: '',
- type: '',
- showInput: false,
- showClose: true,
- modalFade: false,
- lockScroll: false,
- closeOnClickModal: true,
- inputValue: null,
- inputPlaceholder: '',
- inputPattern: null,
- inputValidator: null,
- inputErrorMessage: '',
- showConfirmButton: true,
- showCancelButton: false,
- confirmButtonPosition: 'right',
- confirmButtonHighlight: false,
- cancelButtonHighlight: false,
- confirmButtonText: CONFIRM_TEXT,
- cancelButtonText: CANCEL_TEXT,
- confirmButtonClass: '',
- cancelButtonClass: ''
- };
- var merge = function(target) {
- var arguments$1 = arguments;
- for (var i = 1, j = arguments.length; i < j; i++) {
- var source = arguments$1[i];
- for (var prop in source) {
- if (source.hasOwnProperty(prop)) {
- var value = source[prop];
- if (value !== undefined) {
- target[prop] = value;
- }
- }
- }
- }
- return target;
- };
- var MessageBoxConstructor = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.extend(__WEBPACK_IMPORTED_MODULE_1__message_box_vue___default.a);
- var currentMsg, instance;
- var msgQueue = [];
- var defaultCallback = function (action) {
- if (currentMsg) {
- var callback = currentMsg.callback;
- if (typeof callback === 'function') {
- if (instance.showInput) {
- callback(instance.inputValue, action);
- } else {
- callback(action);
- }
- }
- if (currentMsg.resolve) {
- var $type = currentMsg.options.$type;
- if ($type === 'confirm' || $type === 'prompt') {
- if (action === 'confirm') {
- if (instance.showInput) {
- currentMsg.resolve({ value: instance.inputValue, action: action });
- } else {
- currentMsg.resolve(action);
- }
- } else if (action === 'cancel' && currentMsg.reject) {
- currentMsg.reject(action);
- }
- } else {
- currentMsg.resolve(action);
- }
- }
- }
- };
- var initInstance = function() {
- instance = new MessageBoxConstructor({
- el: document.createElement('div')
- });
- instance.callback = defaultCallback;
- };
- var showNextMsg = function() {
- if (!instance) {
- initInstance();
- }
- if (!instance.value || instance.closeTimer) {
- if (msgQueue.length > 0) {
- currentMsg = msgQueue.shift();
- var options = currentMsg.options;
- for (var prop in options) {
- if (options.hasOwnProperty(prop)) {
- instance[prop] = options[prop];
- }
- }
- if (options.callback === undefined) {
- instance.callback = defaultCallback;
- }
- ['modal', 'showClose', 'closeOnClickModal', 'closeOnPressEscape'].forEach(function (prop) {
- if (instance[prop] === undefined) {
- instance[prop] = true;
- }
- });
- document.body.appendChild(instance.$el);
- __WEBPACK_IMPORTED_MODULE_0_vue___default.a.nextTick(function () {
- instance.value = true;
- });
- }
- }
- };
- var MessageBox = function(options, callback) {
- if (typeof options === 'string') {
- options = {
- title: options
- };
- if (arguments[1]) {
- options.message = arguments[1];
- }
- if (arguments[2]) {
- options.type = arguments[2];
- }
- } else if (options.callback && !callback) {
- callback = options.callback;
- }
- if (typeof Promise !== 'undefined') {
- return new Promise(function(resolve, reject) { // eslint-disable-line
- msgQueue.push({
- options: merge({}, defaults, MessageBox.defaults || {}, options),
- callback: callback,
- resolve: resolve,
- reject: reject
- });
- showNextMsg();
- });
- } else {
- msgQueue.push({
- options: merge({}, defaults, MessageBox.defaults || {}, options),
- callback: callback
- });
- showNextMsg();
- }
- };
- MessageBox.setDefaults = function(defaults) {
- MessageBox.defaults = defaults;
- };
- MessageBox.alert = function(message, title, options) {
- if (typeof title === 'object') {
- options = title;
- title = '';
- }
- return MessageBox(merge({
- title: title,
- message: message,
- $type: 'alert',
- closeOnPressEscape: false,
- closeOnClickModal: false
- }, options));
- };
- MessageBox.confirm = function(message, title, options) {
- if (typeof title === 'object') {
- options = title;
- title = '';
- }
- return MessageBox(merge({
- title: title,
- message: message,
- $type: 'confirm',
- showCancelButton: true
- }, options));
- };
- MessageBox.prompt = function(message, title, options) {
- if (typeof title === 'object') {
- options = title;
- title = '';
- }
- return MessageBox(merge({
- title: title,
- message: message,
- showCancelButton: true,
- showInput: true,
- $type: 'prompt'
- }, options));
- };
- MessageBox.close = function() {
- if (!instance) return;
- instance.value = false;
- msgQueue = [];
- currentMsg = null;
- };
- /* harmony default export */ exports["a"] = MessageBox;
- /***/ }
- /******/ });
|