index.js 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/ // Check if module is in cache
  8. /******/ if(installedModules[moduleId])
  9. /******/ return installedModules[moduleId].exports;
  10. /******/ // Create a new module (and put it into the cache)
  11. /******/ var module = installedModules[moduleId] = {
  12. /******/ i: moduleId,
  13. /******/ l: false,
  14. /******/ exports: {}
  15. /******/ };
  16. /******/ // Execute the module function
  17. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  18. /******/ // Flag the module as loaded
  19. /******/ module.l = true;
  20. /******/ // Return the exports of the module
  21. /******/ return module.exports;
  22. /******/ }
  23. /******/ // expose the modules object (__webpack_modules__)
  24. /******/ __webpack_require__.m = modules;
  25. /******/ // expose the module cache
  26. /******/ __webpack_require__.c = installedModules;
  27. /******/ // identity function for calling harmony imports with the correct context
  28. /******/ __webpack_require__.i = function(value) { return value; };
  29. /******/ // define getter function for harmony exports
  30. /******/ __webpack_require__.d = function(exports, name, getter) {
  31. /******/ if(!__webpack_require__.o(exports, name)) {
  32. /******/ Object.defineProperty(exports, name, {
  33. /******/ configurable: false,
  34. /******/ enumerable: true,
  35. /******/ get: getter
  36. /******/ });
  37. /******/ }
  38. /******/ };
  39. /******/ // getDefaultExport function for compatibility with non-harmony modules
  40. /******/ __webpack_require__.n = function(module) {
  41. /******/ var getter = module && module.__esModule ?
  42. /******/ function getDefault() { return module['default']; } :
  43. /******/ function getModuleExports() { return module; };
  44. /******/ __webpack_require__.d(getter, 'a', getter);
  45. /******/ return getter;
  46. /******/ };
  47. /******/ // Object.prototype.hasOwnProperty.call
  48. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  49. /******/ // __webpack_public_path__
  50. /******/ __webpack_require__.p = "";
  51. /******/ // Load entry module and return exports
  52. /******/ return __webpack_require__(__webpack_require__.s = 225);
  53. /******/ })
  54. /************************************************************************/
  55. /******/ ({
  56. /***/ 0:
  57. /***/ function(module, exports) {
  58. /* globals __VUE_SSR_CONTEXT__ */
  59. // this module is a runtime utility for cleaner component module output and will
  60. // be included in the final webpack user bundle
  61. module.exports = function normalizeComponent (
  62. rawScriptExports,
  63. compiledTemplate,
  64. injectStyles,
  65. scopeId,
  66. moduleIdentifier /* server only */
  67. ) {
  68. var esModule
  69. var scriptExports = rawScriptExports = rawScriptExports || {}
  70. // ES6 modules interop
  71. var type = typeof rawScriptExports.default
  72. if (type === 'object' || type === 'function') {
  73. esModule = rawScriptExports
  74. scriptExports = rawScriptExports.default
  75. }
  76. // Vue.extend constructor export interop
  77. var options = typeof scriptExports === 'function'
  78. ? scriptExports.options
  79. : scriptExports
  80. // render functions
  81. if (compiledTemplate) {
  82. options.render = compiledTemplate.render
  83. options.staticRenderFns = compiledTemplate.staticRenderFns
  84. }
  85. // scopedId
  86. if (scopeId) {
  87. options._scopeId = scopeId
  88. }
  89. var hook
  90. if (moduleIdentifier) { // server build
  91. hook = function (context) {
  92. // 2.3 injection
  93. context =
  94. context || // cached call
  95. (this.$vnode && this.$vnode.ssrContext) || // stateful
  96. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  97. // 2.2 with runInNewContext: true
  98. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  99. context = __VUE_SSR_CONTEXT__
  100. }
  101. // inject component styles
  102. if (injectStyles) {
  103. injectStyles.call(this, context)
  104. }
  105. // register component module identifier for async chunk inferrence
  106. if (context && context._registeredComponents) {
  107. context._registeredComponents.add(moduleIdentifier)
  108. }
  109. }
  110. // used by ssr in case component is cached and beforeCreate
  111. // never gets called
  112. options._ssrRegister = hook
  113. } else if (injectStyles) {
  114. hook = injectStyles
  115. }
  116. if (hook) {
  117. var functional = options.functional
  118. var existing = functional
  119. ? options.render
  120. : options.beforeCreate
  121. if (!functional) {
  122. // inject component registration as beforeCreate hook
  123. options.beforeCreate = existing
  124. ? [].concat(existing, hook)
  125. : [hook]
  126. } else {
  127. // register for functioal component in vue file
  128. options.render = function renderWithStyleInjection (h, context) {
  129. hook.call(context)
  130. return existing(h, context)
  131. }
  132. }
  133. }
  134. return {
  135. esModule: esModule,
  136. exports: scriptExports,
  137. options: options
  138. }
  139. }
  140. /***/ },
  141. /***/ 1:
  142. /***/ function(module, exports) {
  143. module.exports = require("vue");
  144. /***/ },
  145. /***/ 117:
  146. /***/ function(module, exports) {
  147. // removed by extract-text-webpack-plugin
  148. /***/ },
  149. /***/ 118:
  150. /***/ function(module, exports) {
  151. // removed by extract-text-webpack-plugin
  152. /***/ },
  153. /***/ 143:
  154. /***/ function(module, exports, __webpack_require__) {
  155. function injectStyle (ssrContext) {
  156. __webpack_require__(117)
  157. __webpack_require__(118)
  158. }
  159. var Component = __webpack_require__(0)(
  160. /* script */
  161. __webpack_require__(65),
  162. /* template */
  163. __webpack_require__(187),
  164. /* styles */
  165. injectStyle,
  166. /* scopeId */
  167. null,
  168. /* moduleIdentifier (server only) */
  169. null
  170. )
  171. module.exports = Component.exports
  172. /***/ },
  173. /***/ 187:
  174. /***/ function(module, exports) {
  175. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  176. return _c('div', {
  177. staticClass: "mint-msgbox-wrapper"
  178. }, [_c('transition', {
  179. attrs: {
  180. "name": "msgbox-bounce"
  181. }
  182. }, [_c('div', {
  183. directives: [{
  184. name: "show",
  185. rawName: "v-show",
  186. value: (_vm.value),
  187. expression: "value"
  188. }],
  189. staticClass: "mint-msgbox"
  190. }, [(_vm.title !== '') ? _c('div', {
  191. staticClass: "mint-msgbox-header"
  192. }, [_c('div', {
  193. staticClass: "mint-msgbox-title"
  194. }, [_vm._v(_vm._s(_vm.title))])]) : _vm._e(), _vm._v(" "), (_vm.message !== '') ? _c('div', {
  195. staticClass: "mint-msgbox-content"
  196. }, [_c('div', {
  197. staticClass: "mint-msgbox-message",
  198. domProps: {
  199. "innerHTML": _vm._s(_vm.message)
  200. }
  201. }), _vm._v(" "), _c('div', {
  202. directives: [{
  203. name: "show",
  204. rawName: "v-show",
  205. value: (_vm.showInput),
  206. expression: "showInput"
  207. }],
  208. staticClass: "mint-msgbox-input"
  209. }, [_c('input', {
  210. directives: [{
  211. name: "model",
  212. rawName: "v-model",
  213. value: (_vm.inputValue),
  214. expression: "inputValue"
  215. }],
  216. ref: "input",
  217. attrs: {
  218. "placeholder": _vm.inputPlaceholder
  219. },
  220. domProps: {
  221. "value": (_vm.inputValue)
  222. },
  223. on: {
  224. "input": function($event) {
  225. if ($event.target.composing) { return; }
  226. _vm.inputValue = $event.target.value
  227. }
  228. }
  229. }), _vm._v(" "), _c('div', {
  230. staticClass: "mint-msgbox-errormsg",
  231. style: ({
  232. visibility: !!_vm.editorErrorMessage ? 'visible' : 'hidden'
  233. })
  234. }, [_vm._v(_vm._s(_vm.editorErrorMessage))])])]) : _vm._e(), _vm._v(" "), _c('div', {
  235. staticClass: "mint-msgbox-btns"
  236. }, [_c('button', {
  237. directives: [{
  238. name: "show",
  239. rawName: "v-show",
  240. value: (_vm.showCancelButton),
  241. expression: "showCancelButton"
  242. }],
  243. class: [_vm.cancelButtonClasses],
  244. on: {
  245. "click": function($event) {
  246. _vm.handleAction('cancel')
  247. }
  248. }
  249. }, [_vm._v(_vm._s(_vm.cancelButtonText))]), _vm._v(" "), _c('button', {
  250. directives: [{
  251. name: "show",
  252. rawName: "v-show",
  253. value: (_vm.showConfirmButton),
  254. expression: "showConfirmButton"
  255. }],
  256. class: [_vm.confirmButtonClasses],
  257. on: {
  258. "click": function($event) {
  259. _vm.handleAction('confirm')
  260. }
  261. }
  262. }, [_vm._v(_vm._s(_vm.confirmButtonText))])])])])], 1)
  263. },staticRenderFns: []}
  264. /***/ },
  265. /***/ 2:
  266. /***/ function(module, exports, __webpack_require__) {
  267. "use strict";
  268. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
  269. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
  270. /* unused harmony export on */
  271. /* unused harmony export off */
  272. /* harmony export (binding) */ __webpack_require__.d(exports, "c", function() { return once; });
  273. /* unused harmony export hasClass */
  274. /* harmony export (immutable) */ exports["a"] = addClass;
  275. /* harmony export (immutable) */ exports["b"] = removeClass;
  276. /* unused harmony export getStyle */
  277. /* unused harmony export setStyle */
  278. /* istanbul ignore next */
  279. var isServer = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer;
  280. var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
  281. var MOZ_HACK_REGEXP = /^moz([A-Z])/;
  282. var ieVersion = isServer ? 0 : Number(document.documentMode);
  283. /* istanbul ignore next */
  284. var trim = function(string) {
  285. return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
  286. };
  287. /* istanbul ignore next */
  288. var camelCase = function(name) {
  289. return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
  290. return offset ? letter.toUpperCase() : letter;
  291. }).replace(MOZ_HACK_REGEXP, 'Moz$1');
  292. };
  293. /* istanbul ignore next */
  294. var on = (function() {
  295. if (!isServer && document.addEventListener) {
  296. return function(element, event, handler) {
  297. if (element && event && handler) {
  298. element.addEventListener(event, handler, false);
  299. }
  300. };
  301. } else {
  302. return function(element, event, handler) {
  303. if (element && event && handler) {
  304. element.attachEvent('on' + event, handler);
  305. }
  306. };
  307. }
  308. })();
  309. /* istanbul ignore next */
  310. var off = (function() {
  311. if (!isServer && document.removeEventListener) {
  312. return function(element, event, handler) {
  313. if (element && event) {
  314. element.removeEventListener(event, handler, false);
  315. }
  316. };
  317. } else {
  318. return function(element, event, handler) {
  319. if (element && event) {
  320. element.detachEvent('on' + event, handler);
  321. }
  322. };
  323. }
  324. })();
  325. /* istanbul ignore next */
  326. var once = function(el, event, fn) {
  327. var listener = function() {
  328. if (fn) {
  329. fn.apply(this, arguments);
  330. }
  331. off(el, event, listener);
  332. };
  333. on(el, event, listener);
  334. };
  335. /* istanbul ignore next */
  336. function hasClass(el, cls) {
  337. if (!el || !cls) return false;
  338. if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
  339. if (el.classList) {
  340. return el.classList.contains(cls);
  341. } else {
  342. return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
  343. }
  344. };
  345. /* istanbul ignore next */
  346. function addClass(el, cls) {
  347. if (!el) return;
  348. var curClass = el.className;
  349. var classes = (cls || '').split(' ');
  350. for (var i = 0, j = classes.length; i < j; i++) {
  351. var clsName = classes[i];
  352. if (!clsName) continue;
  353. if (el.classList) {
  354. el.classList.add(clsName);
  355. } else {
  356. if (!hasClass(el, clsName)) {
  357. curClass += ' ' + clsName;
  358. }
  359. }
  360. }
  361. if (!el.classList) {
  362. el.className = curClass;
  363. }
  364. };
  365. /* istanbul ignore next */
  366. function removeClass(el, cls) {
  367. if (!el || !cls) return;
  368. var classes = cls.split(' ');
  369. var curClass = ' ' + el.className + ' ';
  370. for (var i = 0, j = classes.length; i < j; i++) {
  371. var clsName = classes[i];
  372. if (!clsName) continue;
  373. if (el.classList) {
  374. el.classList.remove(clsName);
  375. } else {
  376. if (hasClass(el, clsName)) {
  377. curClass = curClass.replace(' ' + clsName + ' ', ' ');
  378. }
  379. }
  380. }
  381. if (!el.classList) {
  382. el.className = trim(curClass);
  383. }
  384. };
  385. /* istanbul ignore next */
  386. var getStyle = ieVersion < 9 ? function(element, styleName) {
  387. if (isServer) return;
  388. if (!element || !styleName) return null;
  389. styleName = camelCase(styleName);
  390. if (styleName === 'float') {
  391. styleName = 'styleFloat';
  392. }
  393. try {
  394. switch (styleName) {
  395. case 'opacity':
  396. try {
  397. return element.filters.item('alpha').opacity / 100;
  398. } catch (e) {
  399. return 1.0;
  400. }
  401. default:
  402. return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
  403. }
  404. } catch (e) {
  405. return element.style[styleName];
  406. }
  407. } : function(element, styleName) {
  408. if (isServer) return;
  409. if (!element || !styleName) return null;
  410. styleName = camelCase(styleName);
  411. if (styleName === 'float') {
  412. styleName = 'cssFloat';
  413. }
  414. try {
  415. var computed = document.defaultView.getComputedStyle(element, '');
  416. return element.style[styleName] || computed ? computed[styleName] : null;
  417. } catch (e) {
  418. return element.style[styleName];
  419. }
  420. };
  421. /* istanbul ignore next */
  422. function setStyle(element, styleName, value) {
  423. if (!element || !styleName) return;
  424. if (typeof styleName === 'object') {
  425. for (var prop in styleName) {
  426. if (styleName.hasOwnProperty(prop)) {
  427. setStyle(element, prop, styleName[prop]);
  428. }
  429. }
  430. } else {
  431. styleName = camelCase(styleName);
  432. if (styleName === 'opacity' && ieVersion < 9) {
  433. element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
  434. } else {
  435. element.style[styleName] = value;
  436. }
  437. }
  438. };
  439. /***/ },
  440. /***/ 225:
  441. /***/ function(module, exports, __webpack_require__) {
  442. module.exports = __webpack_require__(33);
  443. /***/ },
  444. /***/ 33:
  445. /***/ function(module, exports, __webpack_require__) {
  446. "use strict";
  447. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_message_box_js__ = __webpack_require__(90);
  448. Object.defineProperty(exports, "__esModule", { value: true });
  449. /* harmony reexport (binding) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_message_box_js__["a"]; });
  450. /***/ },
  451. /***/ 65:
  452. /***/ function(module, exports, __webpack_require__) {
  453. "use strict";
  454. Object.defineProperty(exports, "__esModule", { value: true });
  455. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_popup__ = __webpack_require__(8);
  456. //
  457. //
  458. //
  459. //
  460. //
  461. //
  462. //
  463. //
  464. //
  465. //
  466. //
  467. //
  468. //
  469. //
  470. //
  471. //
  472. //
  473. //
  474. //
  475. //
  476. //
  477. //
  478. //
  479. //
  480. //
  481. //
  482. //
  483. //
  484. //
  485. //
  486. //
  487. //
  488. //
  489. //
  490. //
  491. //
  492. //
  493. //
  494. //
  495. //
  496. //
  497. //
  498. //
  499. //
  500. //
  501. //
  502. //
  503. //
  504. //
  505. //
  506. //
  507. //
  508. //
  509. //
  510. //
  511. //
  512. //
  513. //
  514. //
  515. //
  516. //
  517. //
  518. //
  519. //
  520. //
  521. //
  522. //
  523. //
  524. //
  525. //
  526. //
  527. //
  528. //
  529. //
  530. //
  531. //
  532. //
  533. //
  534. //
  535. //
  536. //
  537. //
  538. //
  539. //
  540. //
  541. //
  542. //
  543. //
  544. //
  545. //
  546. //
  547. //
  548. //
  549. //
  550. //
  551. //
  552. //
  553. //
  554. //
  555. //
  556. //
  557. //
  558. //
  559. //
  560. //
  561. //
  562. //
  563. //
  564. //
  565. //
  566. //
  567. //
  568. //
  569. //
  570. //
  571. //
  572. //
  573. //
  574. //
  575. //
  576. //
  577. //
  578. //
  579. //
  580. //
  581. //
  582. //
  583. //
  584. //
  585. //
  586. //
  587. //
  588. //
  589. //
  590. //
  591. //
  592. //
  593. //
  594. //
  595. //
  596. //
  597. //
  598. //
  599. //
  600. //
  601. //
  602. var CONFIRM_TEXT = '确定';
  603. var CANCEL_TEXT = '取消';
  604. /* harmony default export */ exports["default"] = {
  605. mixins: [ __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_popup__["a" /* default */] ],
  606. props: {
  607. modal: {
  608. default: true
  609. },
  610. showClose: {
  611. type: Boolean,
  612. default: true
  613. },
  614. lockScroll: {
  615. type: Boolean,
  616. default: false
  617. },
  618. closeOnClickModal: {
  619. default: true
  620. },
  621. closeOnPressEscape: {
  622. default: true
  623. },
  624. inputType: {
  625. type: String,
  626. default: 'text'
  627. }
  628. },
  629. computed: {
  630. confirmButtonClasses: function confirmButtonClasses() {
  631. var classes = 'mint-msgbox-btn mint-msgbox-confirm ' + this.confirmButtonClass;
  632. if (this.confirmButtonHighlight) {
  633. classes += ' mint-msgbox-confirm-highlight';
  634. }
  635. return classes;
  636. },
  637. cancelButtonClasses: function cancelButtonClasses() {
  638. var classes = 'mint-msgbox-btn mint-msgbox-cancel ' + this.cancelButtonClass;
  639. if (this.cancelButtonHighlight) {
  640. classes += ' mint-msgbox-cancel-highlight';
  641. }
  642. return classes;
  643. }
  644. },
  645. methods: {
  646. doClose: function doClose() {
  647. var this$1 = this;
  648. this.value = false;
  649. this._closing = true;
  650. this.onClose && this.onClose();
  651. setTimeout(function () {
  652. if (this$1.modal && this$1.bodyOverflow !== 'hidden') {
  653. document.body.style.overflow = this$1.bodyOverflow;
  654. document.body.style.paddingRight = this$1.bodyPaddingRight;
  655. }
  656. this$1.bodyOverflow = null;
  657. this$1.bodyPaddingRight = null;
  658. }, 200);
  659. this.opened = false;
  660. if (!this.transition) {
  661. this.doAfterClose();
  662. }
  663. },
  664. handleAction: function handleAction(action) {
  665. if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) {
  666. return;
  667. }
  668. var callback = this.callback;
  669. this.value = false;
  670. callback(action);
  671. },
  672. validate: function validate() {
  673. if (this.$type === 'prompt') {
  674. var inputPattern = this.inputPattern;
  675. if (inputPattern && !inputPattern.test(this.inputValue || '')) {
  676. this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
  677. this.$refs.input.classList.add('invalid');
  678. return false;
  679. }
  680. var inputValidator = this.inputValidator;
  681. if (typeof inputValidator === 'function') {
  682. var validateResult = inputValidator(this.inputValue);
  683. if (validateResult === false) {
  684. this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
  685. this.$refs.input.classList.add('invalid');
  686. return false;
  687. }
  688. if (typeof validateResult === 'string') {
  689. this.editorErrorMessage = validateResult;
  690. return false;
  691. }
  692. }
  693. }
  694. this.editorErrorMessage = '';
  695. this.$refs.input.classList.remove('invalid');
  696. return true;
  697. },
  698. handleInputType: function handleInputType(val) {
  699. if (val === 'range' || !this.$refs.input) return;
  700. this.$refs.input.type = val;
  701. }
  702. },
  703. watch: {
  704. inputValue: function inputValue() {
  705. if (this.$type === 'prompt') {
  706. this.validate();
  707. }
  708. },
  709. value: function value(val) {
  710. var this$1 = this;
  711. this.handleInputType(this.inputType);
  712. if (val && this.$type === 'prompt') {
  713. setTimeout(function () {
  714. if (this$1.$refs.input) {
  715. this$1.$refs.input.focus();
  716. }
  717. }, 500);
  718. }
  719. },
  720. inputType: function inputType(val) {
  721. this.handleInputType(val);
  722. }
  723. },
  724. data: function data() {
  725. return {
  726. title: '',
  727. message: '',
  728. type: '',
  729. showInput: false,
  730. inputValue: null,
  731. inputPlaceholder: '',
  732. inputPattern: null,
  733. inputValidator: null,
  734. inputErrorMessage: '',
  735. showConfirmButton: true,
  736. showCancelButton: false,
  737. confirmButtonText: CONFIRM_TEXT,
  738. cancelButtonText: CANCEL_TEXT,
  739. confirmButtonClass: '',
  740. confirmButtonDisabled: false,
  741. cancelButtonClass: '',
  742. editorErrorMessage: null,
  743. callback: null
  744. };
  745. }
  746. };
  747. /***/ },
  748. /***/ 7:
  749. /***/ function(module, exports, __webpack_require__) {
  750. "use strict";
  751. /* harmony default export */ exports["a"] = function(target) {
  752. var arguments$1 = arguments;
  753. for (var i = 1, j = arguments.length; i < j; i++) {
  754. var source = arguments$1[i] || {};
  755. for (var prop in source) {
  756. if (source.hasOwnProperty(prop)) {
  757. var value = source[prop];
  758. if (value !== undefined) {
  759. target[prop] = value;
  760. }
  761. }
  762. }
  763. }
  764. return target;
  765. };;
  766. /***/ },
  767. /***/ 8:
  768. /***/ function(module, exports, __webpack_require__) {
  769. "use strict";
  770. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
  771. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
  772. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_merge__ = __webpack_require__(7);
  773. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__ = __webpack_require__(9);
  774. /* unused harmony reexport PopupManager */
  775. var idSeed = 1;
  776. var transitions = [];
  777. var hookTransition = function (transition) {
  778. if (transitions.indexOf(transition) !== -1) return;
  779. var getVueInstance = function (element) {
  780. var instance = element.__vue__;
  781. if (!instance) {
  782. var textNode = element.previousSibling;
  783. if (textNode.__vue__) {
  784. instance = textNode.__vue__;
  785. }
  786. }
  787. return instance;
  788. };
  789. __WEBPACK_IMPORTED_MODULE_0_vue___default.a.transition(transition, {
  790. afterEnter: function afterEnter(el) {
  791. var instance = getVueInstance(el);
  792. if (instance) {
  793. instance.doAfterOpen && instance.doAfterOpen();
  794. }
  795. },
  796. afterLeave: function afterLeave(el) {
  797. var instance = getVueInstance(el);
  798. if (instance) {
  799. instance.doAfterClose && instance.doAfterClose();
  800. }
  801. }
  802. });
  803. };
  804. var scrollBarWidth;
  805. var getScrollBarWidth = function () {
  806. if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
  807. if (scrollBarWidth !== undefined) return scrollBarWidth;
  808. var outer = document.createElement('div');
  809. outer.style.visibility = 'hidden';
  810. outer.style.width = '100px';
  811. outer.style.position = 'absolute';
  812. outer.style.top = '-9999px';
  813. document.body.appendChild(outer);
  814. var widthNoScroll = outer.offsetWidth;
  815. outer.style.overflow = 'scroll';
  816. var inner = document.createElement('div');
  817. inner.style.width = '100%';
  818. outer.appendChild(inner);
  819. var widthWithScroll = inner.offsetWidth;
  820. outer.parentNode.removeChild(outer);
  821. return widthNoScroll - widthWithScroll;
  822. };
  823. var getDOM = function(dom) {
  824. if (dom.nodeType === 3) {
  825. dom = dom.nextElementSibling || dom.nextSibling;
  826. getDOM(dom);
  827. }
  828. return dom;
  829. };
  830. /* harmony default export */ exports["a"] = {
  831. props: {
  832. value: {
  833. type: Boolean,
  834. default: false
  835. },
  836. transition: {
  837. type: String,
  838. default: ''
  839. },
  840. openDelay: {},
  841. closeDelay: {},
  842. zIndex: {},
  843. modal: {
  844. type: Boolean,
  845. default: false
  846. },
  847. modalFade: {
  848. type: Boolean,
  849. default: true
  850. },
  851. modalClass: {
  852. },
  853. lockScroll: {
  854. type: Boolean,
  855. default: true
  856. },
  857. closeOnPressEscape: {
  858. type: Boolean,
  859. default: false
  860. },
  861. closeOnClickModal: {
  862. type: Boolean,
  863. default: false
  864. }
  865. },
  866. created: function created() {
  867. if (this.transition) {
  868. hookTransition(this.transition);
  869. }
  870. },
  871. beforeMount: function beforeMount() {
  872. this._popupId = 'popup-' + idSeed++;
  873. __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].register(this._popupId, this);
  874. },
  875. beforeDestroy: function beforeDestroy() {
  876. __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].deregister(this._popupId);
  877. __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
  878. if (this.modal && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
  879. document.body.style.overflow = this.bodyOverflow;
  880. document.body.style.paddingRight = this.bodyPaddingRight;
  881. }
  882. this.bodyOverflow = null;
  883. this.bodyPaddingRight = null;
  884. },
  885. data: function data() {
  886. return {
  887. opened: false,
  888. bodyOverflow: null,
  889. bodyPaddingRight: null,
  890. rendered: false
  891. };
  892. },
  893. watch: {
  894. value: function value(val) {
  895. var this$1 = this;
  896. if (val) {
  897. if (this._opening) return;
  898. if (!this.rendered) {
  899. this.rendered = true;
  900. __WEBPACK_IMPORTED_MODULE_0_vue___default.a.nextTick(function () {
  901. this$1.open();
  902. });
  903. } else {
  904. this.open();
  905. }
  906. } else {
  907. this.close();
  908. }
  909. }
  910. },
  911. methods: {
  912. open: function open(options) {
  913. var this$1 = this;
  914. if (!this.rendered) {
  915. this.rendered = true;
  916. this.$emit('input', true);
  917. }
  918. var props = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_merge__["a" /* default */])({}, this, options, this.$props);
  919. if (this._closeTimer) {
  920. clearTimeout(this._closeTimer);
  921. this._closeTimer = null;
  922. }
  923. clearTimeout(this._openTimer);
  924. var openDelay = Number(props.openDelay);
  925. if (openDelay > 0) {
  926. this._openTimer = setTimeout(function () {
  927. this$1._openTimer = null;
  928. this$1.doOpen(props);
  929. }, openDelay);
  930. } else {
  931. this.doOpen(props);
  932. }
  933. },
  934. doOpen: function doOpen(props) {
  935. if (this.$isServer) return;
  936. if (this.willOpen && !this.willOpen()) return;
  937. if (this.opened) return;
  938. this._opening = true;
  939. // 使用 vue-popup 的组件,如果需要和父组件通信显示的状态,应该使用 value,它是一个 prop,
  940. // 这样在父组件中用 v-model 即可;否则可以使用 visible,它是一个 data
  941. this.visible = true;
  942. this.$emit('input', true);
  943. var dom = getDOM(this.$el);
  944. var modal = props.modal;
  945. var zIndex = props.zIndex;
  946. if (zIndex) {
  947. __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].zIndex = zIndex;
  948. }
  949. if (modal) {
  950. if (this._closing) {
  951. __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
  952. this._closing = false;
  953. }
  954. __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);
  955. if (props.lockScroll) {
  956. if (!this.bodyOverflow) {
  957. this.bodyPaddingRight = document.body.style.paddingRight;
  958. this.bodyOverflow = document.body.style.overflow;
  959. }
  960. scrollBarWidth = getScrollBarWidth();
  961. var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  962. if (scrollBarWidth > 0 && bodyHasOverflow) {
  963. document.body.style.paddingRight = scrollBarWidth + 'px';
  964. }
  965. document.body.style.overflow = 'hidden';
  966. }
  967. }
  968. if (getComputedStyle(dom).position === 'static') {
  969. dom.style.position = 'absolute';
  970. }
  971. dom.style.zIndex = __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].nextZIndex();
  972. this.opened = true;
  973. this.onOpen && this.onOpen();
  974. if (!this.transition) {
  975. this.doAfterOpen();
  976. }
  977. },
  978. doAfterOpen: function doAfterOpen() {
  979. this._opening = false;
  980. },
  981. close: function close() {
  982. var this$1 = this;
  983. if (this.willClose && !this.willClose()) return;
  984. if (this._openTimer !== null) {
  985. clearTimeout(this._openTimer);
  986. this._openTimer = null;
  987. }
  988. clearTimeout(this._closeTimer);
  989. var closeDelay = Number(this.closeDelay);
  990. if (closeDelay > 0) {
  991. this._closeTimer = setTimeout(function () {
  992. this$1._closeTimer = null;
  993. this$1.doClose();
  994. }, closeDelay);
  995. } else {
  996. this.doClose();
  997. }
  998. },
  999. doClose: function doClose() {
  1000. var this$1 = this;
  1001. this.visible = false;
  1002. this.$emit('input', false);
  1003. this._closing = true;
  1004. this.onClose && this.onClose();
  1005. if (this.lockScroll) {
  1006. setTimeout(function () {
  1007. if (this$1.modal && this$1.bodyOverflow !== 'hidden') {
  1008. document.body.style.overflow = this$1.bodyOverflow;
  1009. document.body.style.paddingRight = this$1.bodyPaddingRight;
  1010. }
  1011. this$1.bodyOverflow = null;
  1012. this$1.bodyPaddingRight = null;
  1013. }, 200);
  1014. }
  1015. this.opened = false;
  1016. if (!this.transition) {
  1017. this.doAfterClose();
  1018. }
  1019. },
  1020. doAfterClose: function doAfterClose() {
  1021. __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
  1022. this._closing = false;
  1023. }
  1024. }
  1025. };
  1026. /***/ },
  1027. /***/ 9:
  1028. /***/ function(module, exports, __webpack_require__) {
  1029. "use strict";
  1030. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
  1031. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
  1032. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__ = __webpack_require__(2);
  1033. var hasModal = false;
  1034. var getModal = function() {
  1035. if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
  1036. var modalDom = PopupManager.modalDom;
  1037. if (modalDom) {
  1038. hasModal = true;
  1039. } else {
  1040. hasModal = false;
  1041. modalDom = document.createElement('div');
  1042. PopupManager.modalDom = modalDom;
  1043. modalDom.addEventListener('touchmove', function(event) {
  1044. event.preventDefault();
  1045. event.stopPropagation();
  1046. });
  1047. modalDom.addEventListener('click', function() {
  1048. PopupManager.doOnModalClick && PopupManager.doOnModalClick();
  1049. });
  1050. }
  1051. return modalDom;
  1052. };
  1053. var instances = {};
  1054. var PopupManager = {
  1055. zIndex: 2000,
  1056. modalFade: true,
  1057. getInstance: function(id) {
  1058. return instances[id];
  1059. },
  1060. register: function(id, instance) {
  1061. if (id && instance) {
  1062. instances[id] = instance;
  1063. }
  1064. },
  1065. deregister: function(id) {
  1066. if (id) {
  1067. instances[id] = null;
  1068. delete instances[id];
  1069. }
  1070. },
  1071. nextZIndex: function() {
  1072. return PopupManager.zIndex++;
  1073. },
  1074. modalStack: [],
  1075. doOnModalClick: function() {
  1076. var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
  1077. if (!topItem) return;
  1078. var instance = PopupManager.getInstance(topItem.id);
  1079. if (instance && instance.closeOnClickModal) {
  1080. instance.close();
  1081. }
  1082. },
  1083. openModal: function(id, zIndex, dom, modalClass, modalFade) {
  1084. if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
  1085. if (!id || zIndex === undefined) return;
  1086. this.modalFade = modalFade;
  1087. var modalStack = this.modalStack;
  1088. for (var i = 0, j = modalStack.length; i < j; i++) {
  1089. var item = modalStack[i];
  1090. if (item.id === id) {
  1091. return;
  1092. }
  1093. }
  1094. var modalDom = getModal();
  1095. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal');
  1096. if (this.modalFade && !hasModal) {
  1097. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal-enter');
  1098. }
  1099. if (modalClass) {
  1100. var classArr = modalClass.trim().split(/\s+/);
  1101. classArr.forEach(function (item) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, item); });
  1102. }
  1103. setTimeout(function () {
  1104. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, 'v-modal-enter');
  1105. }, 200);
  1106. if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
  1107. dom.parentNode.appendChild(modalDom);
  1108. } else {
  1109. document.body.appendChild(modalDom);
  1110. }
  1111. if (zIndex) {
  1112. modalDom.style.zIndex = zIndex;
  1113. }
  1114. modalDom.style.display = '';
  1115. this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
  1116. },
  1117. closeModal: function(id) {
  1118. var modalStack = this.modalStack;
  1119. var modalDom = getModal();
  1120. if (modalStack.length > 0) {
  1121. var topItem = modalStack[modalStack.length - 1];
  1122. if (topItem.id === id) {
  1123. if (topItem.modalClass) {
  1124. var classArr = topItem.modalClass.trim().split(/\s+/);
  1125. classArr.forEach(function (item) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, item); });
  1126. }
  1127. modalStack.pop();
  1128. if (modalStack.length > 0) {
  1129. modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
  1130. }
  1131. } else {
  1132. for (var i = modalStack.length - 1; i >= 0; i--) {
  1133. if (modalStack[i].id === id) {
  1134. modalStack.splice(i, 1);
  1135. break;
  1136. }
  1137. }
  1138. }
  1139. }
  1140. if (modalStack.length === 0) {
  1141. if (this.modalFade) {
  1142. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal-leave');
  1143. }
  1144. setTimeout(function () {
  1145. if (modalStack.length === 0) {
  1146. if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
  1147. modalDom.style.display = 'none';
  1148. PopupManager.modalDom = undefined;
  1149. }
  1150. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, 'v-modal-leave');
  1151. }, 200);
  1152. }
  1153. }
  1154. };
  1155. !__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer && window.addEventListener('keydown', function(event) {
  1156. if (event.keyCode === 27) { // ESC
  1157. if (PopupManager.modalStack.length > 0) {
  1158. var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
  1159. if (!topItem) return;
  1160. var instance = PopupManager.getInstance(topItem.id);
  1161. if (instance.closeOnPressEscape) {
  1162. instance.close();
  1163. }
  1164. }
  1165. }
  1166. });
  1167. /* harmony default export */ exports["a"] = PopupManager;
  1168. /***/ },
  1169. /***/ 90:
  1170. /***/ function(module, exports, __webpack_require__) {
  1171. "use strict";
  1172. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
  1173. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
  1174. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__message_box_vue__ = __webpack_require__(143);
  1175. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__message_box_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__message_box_vue__);
  1176. /* unused harmony export MessageBox */
  1177. var CONFIRM_TEXT = '确定';
  1178. var CANCEL_TEXT = '取消';
  1179. var defaults = {
  1180. title: '提示',
  1181. message: '',
  1182. type: '',
  1183. showInput: false,
  1184. showClose: true,
  1185. modalFade: false,
  1186. lockScroll: false,
  1187. closeOnClickModal: true,
  1188. inputValue: null,
  1189. inputPlaceholder: '',
  1190. inputPattern: null,
  1191. inputValidator: null,
  1192. inputErrorMessage: '',
  1193. showConfirmButton: true,
  1194. showCancelButton: false,
  1195. confirmButtonPosition: 'right',
  1196. confirmButtonHighlight: false,
  1197. cancelButtonHighlight: false,
  1198. confirmButtonText: CONFIRM_TEXT,
  1199. cancelButtonText: CANCEL_TEXT,
  1200. confirmButtonClass: '',
  1201. cancelButtonClass: ''
  1202. };
  1203. var merge = function(target) {
  1204. var arguments$1 = arguments;
  1205. for (var i = 1, j = arguments.length; i < j; i++) {
  1206. var source = arguments$1[i];
  1207. for (var prop in source) {
  1208. if (source.hasOwnProperty(prop)) {
  1209. var value = source[prop];
  1210. if (value !== undefined) {
  1211. target[prop] = value;
  1212. }
  1213. }
  1214. }
  1215. }
  1216. return target;
  1217. };
  1218. var MessageBoxConstructor = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.extend(__WEBPACK_IMPORTED_MODULE_1__message_box_vue___default.a);
  1219. var currentMsg, instance;
  1220. var msgQueue = [];
  1221. var defaultCallback = function (action) {
  1222. if (currentMsg) {
  1223. var callback = currentMsg.callback;
  1224. if (typeof callback === 'function') {
  1225. if (instance.showInput) {
  1226. callback(instance.inputValue, action);
  1227. } else {
  1228. callback(action);
  1229. }
  1230. }
  1231. if (currentMsg.resolve) {
  1232. var $type = currentMsg.options.$type;
  1233. if ($type === 'confirm' || $type === 'prompt') {
  1234. if (action === 'confirm') {
  1235. if (instance.showInput) {
  1236. currentMsg.resolve({ value: instance.inputValue, action: action });
  1237. } else {
  1238. currentMsg.resolve(action);
  1239. }
  1240. } else if (action === 'cancel' && currentMsg.reject) {
  1241. currentMsg.reject(action);
  1242. }
  1243. } else {
  1244. currentMsg.resolve(action);
  1245. }
  1246. }
  1247. }
  1248. };
  1249. var initInstance = function() {
  1250. instance = new MessageBoxConstructor({
  1251. el: document.createElement('div')
  1252. });
  1253. instance.callback = defaultCallback;
  1254. };
  1255. var showNextMsg = function() {
  1256. if (!instance) {
  1257. initInstance();
  1258. }
  1259. if (!instance.value || instance.closeTimer) {
  1260. if (msgQueue.length > 0) {
  1261. currentMsg = msgQueue.shift();
  1262. var options = currentMsg.options;
  1263. for (var prop in options) {
  1264. if (options.hasOwnProperty(prop)) {
  1265. instance[prop] = options[prop];
  1266. }
  1267. }
  1268. if (options.callback === undefined) {
  1269. instance.callback = defaultCallback;
  1270. }
  1271. ['modal', 'showClose', 'closeOnClickModal', 'closeOnPressEscape'].forEach(function (prop) {
  1272. if (instance[prop] === undefined) {
  1273. instance[prop] = true;
  1274. }
  1275. });
  1276. document.body.appendChild(instance.$el);
  1277. __WEBPACK_IMPORTED_MODULE_0_vue___default.a.nextTick(function () {
  1278. instance.value = true;
  1279. });
  1280. }
  1281. }
  1282. };
  1283. var MessageBox = function(options, callback) {
  1284. if (typeof options === 'string') {
  1285. options = {
  1286. title: options
  1287. };
  1288. if (arguments[1]) {
  1289. options.message = arguments[1];
  1290. }
  1291. if (arguments[2]) {
  1292. options.type = arguments[2];
  1293. }
  1294. } else if (options.callback && !callback) {
  1295. callback = options.callback;
  1296. }
  1297. if (typeof Promise !== 'undefined') {
  1298. return new Promise(function(resolve, reject) { // eslint-disable-line
  1299. msgQueue.push({
  1300. options: merge({}, defaults, MessageBox.defaults || {}, options),
  1301. callback: callback,
  1302. resolve: resolve,
  1303. reject: reject
  1304. });
  1305. showNextMsg();
  1306. });
  1307. } else {
  1308. msgQueue.push({
  1309. options: merge({}, defaults, MessageBox.defaults || {}, options),
  1310. callback: callback
  1311. });
  1312. showNextMsg();
  1313. }
  1314. };
  1315. MessageBox.setDefaults = function(defaults) {
  1316. MessageBox.defaults = defaults;
  1317. };
  1318. MessageBox.alert = function(message, title, options) {
  1319. if (typeof title === 'object') {
  1320. options = title;
  1321. title = '';
  1322. }
  1323. return MessageBox(merge({
  1324. title: title,
  1325. message: message,
  1326. $type: 'alert',
  1327. closeOnPressEscape: false,
  1328. closeOnClickModal: false
  1329. }, options));
  1330. };
  1331. MessageBox.confirm = function(message, title, options) {
  1332. if (typeof title === 'object') {
  1333. options = title;
  1334. title = '';
  1335. }
  1336. return MessageBox(merge({
  1337. title: title,
  1338. message: message,
  1339. $type: 'confirm',
  1340. showCancelButton: true
  1341. }, options));
  1342. };
  1343. MessageBox.prompt = function(message, title, options) {
  1344. if (typeof title === 'object') {
  1345. options = title;
  1346. title = '';
  1347. }
  1348. return MessageBox(merge({
  1349. title: title,
  1350. message: message,
  1351. showCancelButton: true,
  1352. showInput: true,
  1353. $type: 'prompt'
  1354. }, options));
  1355. };
  1356. MessageBox.close = function() {
  1357. if (!instance) return;
  1358. instance.value = false;
  1359. msgQueue = [];
  1360. currentMsg = null;
  1361. };
  1362. /* harmony default export */ exports["a"] = MessageBox;
  1363. /***/ }
  1364. /******/ });