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