automan-cmd 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +56 -0
  3. package/bin/automan +3 -0
  4. package/bin/automan-build +3 -0
  5. package/bin/automan-config +3 -0
  6. package/bin/automan-create +3 -0
  7. package/bin/automan-publish +3 -0
  8. package/lib/automan-build.js +41 -0
  9. package/lib/automan-config.js +82 -0
  10. package/lib/automan-create.js +137 -0
  11. package/lib/automan-publish.js +331 -0
  12. package/lib/index.js +13 -0
  13. package/lib/install.js.tpl +47 -0
  14. package/lib/util.js +174 -0
  15. package/package.json +37 -0
  16. package/tpl/.babelrc +16 -0
  17. package/tpl/.browserslistrc +3 -0
  18. package/tpl/.eslintignore +2 -0
  19. package/tpl/.eslintrc.js +228 -0
  20. package/tpl/.gitignore.ejs +12 -0
  21. package/tpl/.postcssrc.js +12 -0
  22. package/tpl/README.md +1 -0
  23. package/tpl/changelog.md +1 -0
  24. package/tpl/editor/index.vue +45 -0
  25. package/tpl/icon.png +0 -0
  26. package/tpl/jsconfig.json +7 -0
  27. package/tpl/package.json.ejs +66 -0
  28. package/tpl/preview/app.vue +326 -0
  29. package/tpl/preview/attr/Data.vue +69 -0
  30. package/tpl/preview/attr/Resource.vue +79 -0
  31. package/tpl/preview/attr/com.vue +21 -0
  32. package/tpl/preview/attr/index.js +16 -0
  33. package/tpl/preview/components/Attribute.vue +365 -0
  34. package/tpl/preview/components/FitImg.vue +152 -0
  35. package/tpl/preview/components/ImgViewer.vue +80 -0
  36. package/tpl/preview/components/Loading.vue +55 -0
  37. package/tpl/preview/components/Toast.vue +111 -0
  38. package/tpl/preview/index.js +22 -0
  39. package/tpl/preview/index.tpl +13 -0
  40. package/tpl/preview/lib/ESlog.js +46 -0
  41. package/tpl/preview/lib/Util.js +57 -0
  42. package/tpl/preview/lib/fetch.js +139 -0
  43. package/tpl/preview/lib/index.js +15 -0
  44. package/tpl/preview/lib/vue/filters.js +53 -0
  45. package/tpl/preview/lib/vue/index.js +9 -0
  46. package/tpl/preview/lib/vue/mixin.js +166 -0
  47. package/tpl/preview/mint-ui/message-box/index.js +1503 -0
  48. package/tpl/preview/mint-ui/message-box/style.css +159 -0
  49. package/tpl/preview/mint-ui/popup/index.js +1046 -0
  50. package/tpl/preview/mint-ui/popup/style.css +115 -0
  51. package/tpl/preview/mint-ui/spinner/index.js +657 -0
  52. package/tpl/preview/mint-ui/spinner/style.css +227 -0
  53. package/tpl/preview/mint-ui/swipe/index.js +907 -0
  54. package/tpl/preview/mint-ui/swipe/style.css +43 -0
  55. package/tpl/preview/mint-ui/swipe-item/index.js +171 -0
  56. package/tpl/preview/mint-ui/swipe-item/style.css +1 -0
  57. package/tpl/preview/style.css +126 -0
  58. package/tpl/server.config.js +6 -0
  59. package/tpl/src/assets/css/index.scss +29 -0
  60. package/tpl/src/example.vue +165 -0
  61. package/tpl/src/index.vue.ejs +32 -0
  62. package/tpl/webpack.config.js.ejs +267 -0
  63. package/tpl/yarn.lock +6037 -0
@@ -0,0 +1,1046 @@
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 = 241);
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
+ /***/ 118:
276
+ /***/ function(module, exports) {
277
+
278
+ // removed by extract-text-webpack-plugin
279
+
280
+ /***/ },
281
+
282
+ /***/ 14:
283
+ /***/ function(module, exports) {
284
+
285
+ // removed by extract-text-webpack-plugin
286
+
287
+ /***/ },
288
+
289
+ /***/ 158:
290
+ /***/ function(module, exports, __webpack_require__) {
291
+
292
+ var __vue_exports__, __vue_options__
293
+ var __vue_styles__ = {}
294
+
295
+ /* styles */
296
+ __webpack_require__(118)
297
+
298
+ /* script */
299
+ __vue_exports__ = __webpack_require__(76)
300
+
301
+ /* template */
302
+ var __vue_template__ = __webpack_require__(190)
303
+ __vue_options__ = __vue_exports__ = __vue_exports__ || {}
304
+ if (
305
+ typeof __vue_exports__.default === "object" ||
306
+ typeof __vue_exports__.default === "function"
307
+ ) {
308
+ __vue_options__ = __vue_exports__ = __vue_exports__.default
309
+ }
310
+ if (typeof __vue_options__ === "function") {
311
+ __vue_options__ = __vue_options__.options
312
+ }
313
+
314
+ __vue_options__.render = __vue_template__.render
315
+ __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
316
+
317
+ module.exports = __vue_exports__
318
+
319
+
320
+ /***/ },
321
+
322
+ /***/ 190:
323
+ /***/ function(module, exports) {
324
+
325
+ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
326
+ return _c('transition', {
327
+ attrs: {
328
+ "name": _vm.currentTransition
329
+ }
330
+ }, [_c('div', {
331
+ directives: [{
332
+ name: "show",
333
+ rawName: "v-show",
334
+ value: (_vm.currentValue),
335
+ expression: "currentValue"
336
+ }],
337
+ staticClass: "mint-popup",
338
+ class: [_vm.position ? 'mint-popup-' + _vm.position : '']
339
+ }, [_vm._t("default")], 2)])
340
+ },staticRenderFns: []}
341
+
342
+ /***/ },
343
+
344
+ /***/ 241:
345
+ /***/ function(module, exports, __webpack_require__) {
346
+
347
+ module.exports = __webpack_require__(41);
348
+
349
+
350
+ /***/ },
351
+
352
+ /***/ 41:
353
+ /***/ function(module, exports, __webpack_require__) {
354
+
355
+ "use strict";
356
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_popup_vue__ = __webpack_require__(158);
357
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_popup_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_popup_vue__);
358
+ Object.defineProperty(exports, "__esModule", { value: true });
359
+ /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_popup_vue___default.a; });
360
+
361
+
362
+
363
+ /***/ },
364
+
365
+ /***/ 6:
366
+ /***/ function(module, exports, __webpack_require__) {
367
+
368
+ "use strict";
369
+ /* harmony default export */ exports["a"] = function(target) {
370
+ var arguments$1 = arguments;
371
+
372
+ for (var i = 1, j = arguments.length; i < j; i++) {
373
+ var source = arguments$1[i] || {};
374
+ for (var prop in source) {
375
+ if (source.hasOwnProperty(prop)) {
376
+ var value = source[prop];
377
+ if (value !== undefined) {
378
+ target[prop] = value;
379
+ }
380
+ }
381
+ }
382
+ }
383
+
384
+ return target;
385
+ };;
386
+
387
+
388
+ /***/ },
389
+
390
+ /***/ 7:
391
+ /***/ function(module, exports, __webpack_require__) {
392
+
393
+ "use strict";
394
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(0);
395
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
396
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_merge__ = __webpack_require__(6);
397
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__ = __webpack_require__(8);
398
+ /* unused harmony reexport PopupManager */
399
+
400
+
401
+
402
+
403
+ var idSeed = 1;
404
+ var transitions = [];
405
+
406
+ var hookTransition = function (transition) {
407
+ if (transitions.indexOf(transition) !== -1) return;
408
+
409
+ var getVueInstance = function (element) {
410
+ var instance = element.__vue__;
411
+ if (!instance) {
412
+ var textNode = element.previousSibling;
413
+ if (textNode.__vue__) {
414
+ instance = textNode.__vue__;
415
+ }
416
+ }
417
+ return instance;
418
+ };
419
+
420
+ __WEBPACK_IMPORTED_MODULE_0_vue___default.a.transition(transition, {
421
+ afterEnter: function afterEnter(el) {
422
+ var instance = getVueInstance(el);
423
+
424
+ if (instance) {
425
+ instance.doAfterOpen && instance.doAfterOpen();
426
+ }
427
+ },
428
+ afterLeave: function afterLeave(el) {
429
+ var instance = getVueInstance(el);
430
+
431
+ if (instance) {
432
+ instance.doAfterClose && instance.doAfterClose();
433
+ }
434
+ }
435
+ });
436
+ };
437
+
438
+ var scrollBarWidth;
439
+ var getScrollBarWidth = function () {
440
+ if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
441
+ if (scrollBarWidth !== undefined) return scrollBarWidth;
442
+
443
+ var outer = document.createElement('div');
444
+ outer.style.visibility = 'hidden';
445
+ outer.style.width = '100px';
446
+ outer.style.position = 'absolute';
447
+ outer.style.top = '-9999px';
448
+ document.body.appendChild(outer);
449
+
450
+ var widthNoScroll = outer.offsetWidth;
451
+ outer.style.overflow = 'scroll';
452
+
453
+ var inner = document.createElement('div');
454
+ inner.style.width = '100%';
455
+ outer.appendChild(inner);
456
+
457
+ var widthWithScroll = inner.offsetWidth;
458
+ outer.parentNode.removeChild(outer);
459
+
460
+ return widthNoScroll - widthWithScroll;
461
+ };
462
+
463
+ var getDOM = function(dom) {
464
+ if (dom.nodeType === 3) {
465
+ dom = dom.nextElementSibling || dom.nextSibling;
466
+ getDOM(dom);
467
+ }
468
+ return dom;
469
+ };
470
+
471
+ /* harmony default export */ exports["a"] = {
472
+ props: {
473
+ value: {
474
+ type: Boolean,
475
+ default: false
476
+ },
477
+ transition: {
478
+ type: String,
479
+ default: ''
480
+ },
481
+ openDelay: {},
482
+ closeDelay: {},
483
+ zIndex: {},
484
+ modal: {
485
+ type: Boolean,
486
+ default: false
487
+ },
488
+ modalFade: {
489
+ type: Boolean,
490
+ default: true
491
+ },
492
+ modalClass: {
493
+ },
494
+ lockScroll: {
495
+ type: Boolean,
496
+ default: true
497
+ },
498
+ closeOnPressEscape: {
499
+ type: Boolean,
500
+ default: false
501
+ },
502
+ closeOnClickModal: {
503
+ type: Boolean,
504
+ default: false
505
+ }
506
+ },
507
+
508
+ created: function created() {
509
+ if (this.transition) {
510
+ hookTransition(this.transition);
511
+ }
512
+ },
513
+
514
+ beforeMount: function beforeMount() {
515
+ this._popupId = 'popup-' + idSeed++;
516
+ __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].register(this._popupId, this);
517
+ },
518
+
519
+ beforeDestroy: function beforeDestroy() {
520
+ __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].deregister(this._popupId);
521
+ __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
522
+ if (this.modal && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
523
+ document.body.style.overflow = this.bodyOverflow;
524
+ document.body.style.paddingRight = this.bodyPaddingRight;
525
+ }
526
+ this.bodyOverflow = null;
527
+ this.bodyPaddingRight = null;
528
+ },
529
+
530
+ data: function data() {
531
+ return {
532
+ opened: false,
533
+ bodyOverflow: null,
534
+ bodyPaddingRight: null,
535
+ rendered: false
536
+ };
537
+ },
538
+
539
+ watch: {
540
+ value: function value(val) {
541
+ var this$1 = this;
542
+
543
+ if (val) {
544
+ if (this._opening) return;
545
+ if (!this.rendered) {
546
+ this.rendered = true;
547
+ __WEBPACK_IMPORTED_MODULE_0_vue___default.a.nextTick(function () {
548
+ this$1.open();
549
+ });
550
+ } else {
551
+ this.open();
552
+ }
553
+ } else {
554
+ this.close();
555
+ }
556
+ }
557
+ },
558
+
559
+ methods: {
560
+ open: function open(options) {
561
+ var this$1 = this;
562
+
563
+ if (!this.rendered) {
564
+ this.rendered = true;
565
+ this.$emit('input', true);
566
+ }
567
+
568
+ var props = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_merge__["a" /* default */])({}, this, options, this.$props);
569
+
570
+ if (this._closeTimer) {
571
+ clearTimeout(this._closeTimer);
572
+ this._closeTimer = null;
573
+ }
574
+ clearTimeout(this._openTimer);
575
+
576
+ var openDelay = Number(props.openDelay);
577
+ if (openDelay > 0) {
578
+ this._openTimer = setTimeout(function () {
579
+ this$1._openTimer = null;
580
+ this$1.doOpen(props);
581
+ }, openDelay);
582
+ } else {
583
+ this.doOpen(props);
584
+ }
585
+ },
586
+
587
+ doOpen: function doOpen(props) {
588
+ if (this.$isServer) return;
589
+ if (this.willOpen && !this.willOpen()) return;
590
+ if (this.opened) return;
591
+
592
+ this._opening = true;
593
+
594
+ // 使用 vue-popup 的组件,如果需要和父组件通信显示的状态,应该使用 value,它是一个 prop,
595
+ // 这样在父组件中用 v-model 即可;否则可以使用 visible,它是一个 data
596
+ this.visible = true;
597
+ this.$emit('input', true);
598
+
599
+ var dom = getDOM(this.$el);
600
+
601
+ var modal = props.modal;
602
+
603
+ var zIndex = props.zIndex;
604
+ if (zIndex) {
605
+ __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].zIndex = zIndex;
606
+ }
607
+
608
+ if (modal) {
609
+ if (this._closing) {
610
+ __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
611
+ this._closing = false;
612
+ }
613
+ __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);
614
+ if (props.lockScroll) {
615
+ if (!this.bodyOverflow) {
616
+ this.bodyPaddingRight = document.body.style.paddingRight;
617
+ this.bodyOverflow = document.body.style.overflow;
618
+ }
619
+ scrollBarWidth = getScrollBarWidth();
620
+ var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
621
+ if (scrollBarWidth > 0 && bodyHasOverflow) {
622
+ document.body.style.paddingRight = scrollBarWidth + 'px';
623
+ }
624
+ document.body.style.overflow = 'hidden';
625
+ }
626
+ }
627
+
628
+ if (getComputedStyle(dom).position === 'static') {
629
+ dom.style.position = 'absolute';
630
+ }
631
+
632
+ dom.style.zIndex = __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].nextZIndex();
633
+ this.opened = true;
634
+
635
+ this.onOpen && this.onOpen();
636
+
637
+ if (!this.transition) {
638
+ this.doAfterOpen();
639
+ }
640
+ },
641
+
642
+ doAfterOpen: function doAfterOpen() {
643
+ this._opening = false;
644
+ },
645
+
646
+ close: function close() {
647
+ var this$1 = this;
648
+
649
+ if (this.willClose && !this.willClose()) return;
650
+
651
+ if (this._openTimer !== null) {
652
+ clearTimeout(this._openTimer);
653
+ this._openTimer = null;
654
+ }
655
+ clearTimeout(this._closeTimer);
656
+
657
+ var closeDelay = Number(this.closeDelay);
658
+
659
+ if (closeDelay > 0) {
660
+ this._closeTimer = setTimeout(function () {
661
+ this$1._closeTimer = null;
662
+ this$1.doClose();
663
+ }, closeDelay);
664
+ } else {
665
+ this.doClose();
666
+ }
667
+ },
668
+
669
+ doClose: function doClose() {
670
+ var this$1 = this;
671
+
672
+ this.visible = false;
673
+ this.$emit('input', false);
674
+ this._closing = true;
675
+
676
+ this.onClose && this.onClose();
677
+
678
+ if (this.lockScroll) {
679
+ setTimeout(function () {
680
+ if (this$1.modal && this$1.bodyOverflow !== 'hidden') {
681
+ document.body.style.overflow = this$1.bodyOverflow;
682
+ document.body.style.paddingRight = this$1.bodyPaddingRight;
683
+ }
684
+ this$1.bodyOverflow = null;
685
+ this$1.bodyPaddingRight = null;
686
+ }, 200);
687
+ }
688
+
689
+ this.opened = false;
690
+
691
+ if (!this.transition) {
692
+ this.doAfterClose();
693
+ }
694
+ },
695
+
696
+ doAfterClose: function doAfterClose() {
697
+ __WEBPACK_IMPORTED_MODULE_2_truck_mint_ui_src_utils_popup_popup_manager__["a" /* default */].closeModal(this._popupId);
698
+ this._closing = false;
699
+ }
700
+ }
701
+ };
702
+
703
+
704
+
705
+
706
+ /***/ },
707
+
708
+ /***/ 76:
709
+ /***/ function(module, exports, __webpack_require__) {
710
+
711
+ "use strict";
712
+ Object.defineProperty(exports, "__esModule", { value: true });
713
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_popup__ = __webpack_require__(7);
714
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue__ = __webpack_require__(0);
715
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_vue__);
716
+ //
717
+ //
718
+ //
719
+ //
720
+ //
721
+ //
722
+ //
723
+ //
724
+ //
725
+ //
726
+ //
727
+ //
728
+ //
729
+ //
730
+ //
731
+ //
732
+ //
733
+ //
734
+ //
735
+ //
736
+ //
737
+ //
738
+ //
739
+ //
740
+ //
741
+ //
742
+ //
743
+ //
744
+ //
745
+ //
746
+ //
747
+ //
748
+ //
749
+ //
750
+ //
751
+ //
752
+ //
753
+ //
754
+ //
755
+ //
756
+ //
757
+ //
758
+ //
759
+ //
760
+ //
761
+ //
762
+ //
763
+ //
764
+ //
765
+ //
766
+ //
767
+ //
768
+ //
769
+ //
770
+ //
771
+ //
772
+ //
773
+ //
774
+ //
775
+ //
776
+ //
777
+ //
778
+ //
779
+ //
780
+ //
781
+ //
782
+ //
783
+ //
784
+ //
785
+ //
786
+ //
787
+ //
788
+ //
789
+ //
790
+ //
791
+ //
792
+ //
793
+ //
794
+ //
795
+
796
+
797
+
798
+ if (!__WEBPACK_IMPORTED_MODULE_1_vue___default.a.prototype.$isServer) {
799
+ __webpack_require__(14);
800
+ }
801
+
802
+ /* harmony default export */ exports["default"] = {
803
+ name: 'mt-popup',
804
+
805
+ mixins: [__WEBPACK_IMPORTED_MODULE_0_truck_mint_ui_src_utils_popup__["a" /* default */]],
806
+
807
+ props: {
808
+ modal: {
809
+ default: true
810
+ },
811
+
812
+ modalFade: {
813
+ default: false
814
+ },
815
+
816
+ lockScroll: {
817
+ default: false
818
+ },
819
+
820
+ closeOnClickModal: {
821
+ default: true
822
+ },
823
+
824
+ popupTransition: {
825
+ type: String,
826
+ default: 'popup-slide'
827
+ },
828
+
829
+ position: {
830
+ type: String,
831
+ default: ''
832
+ }
833
+ },
834
+
835
+ data: function data() {
836
+ return {
837
+ currentValue: false,
838
+ currentTransition: this.popupTransition
839
+ };
840
+ },
841
+
842
+ watch: {
843
+ currentValue: function currentValue(val) {
844
+ this.$emit('input', val);
845
+ },
846
+
847
+ value: function value(val) {
848
+ this.currentValue = val;
849
+ }
850
+ },
851
+
852
+ beforeMount: function beforeMount() {
853
+ if (this.popupTransition !== 'popup-fade') {
854
+ this.currentTransition = "popup-slide-" + (this.position);
855
+ }
856
+ },
857
+
858
+ mounted: function mounted() {
859
+ if (this.value) {
860
+ this.rendered = true;
861
+ this.currentValue = true;
862
+ this.open();
863
+ }
864
+ }
865
+ };
866
+
867
+
868
+ /***/ },
869
+
870
+ /***/ 8:
871
+ /***/ function(module, exports, __webpack_require__) {
872
+
873
+ "use strict";
874
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(0);
875
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
876
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__ = __webpack_require__(1);
877
+
878
+
879
+
880
+ var hasModal = false;
881
+
882
+ var getModal = function() {
883
+ if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
884
+ var modalDom = PopupManager.modalDom;
885
+ if (modalDom) {
886
+ hasModal = true;
887
+ } else {
888
+ hasModal = false;
889
+ modalDom = document.createElement('div');
890
+ PopupManager.modalDom = modalDom;
891
+
892
+ modalDom.addEventListener('touchmove', function(event) {
893
+ event.preventDefault();
894
+ event.stopPropagation();
895
+ });
896
+
897
+ modalDom.addEventListener('click', function() {
898
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
899
+ });
900
+ }
901
+
902
+ return modalDom;
903
+ };
904
+
905
+ var instances = {};
906
+
907
+ var PopupManager = {
908
+ zIndex: 2000,
909
+
910
+ modalFade: true,
911
+
912
+ getInstance: function(id) {
913
+ return instances[id];
914
+ },
915
+
916
+ register: function(id, instance) {
917
+ if (id && instance) {
918
+ instances[id] = instance;
919
+ }
920
+ },
921
+
922
+ deregister: function(id) {
923
+ if (id) {
924
+ instances[id] = null;
925
+ delete instances[id];
926
+ }
927
+ },
928
+
929
+ nextZIndex: function() {
930
+ return PopupManager.zIndex++;
931
+ },
932
+
933
+ modalStack: [],
934
+
935
+ doOnModalClick: function() {
936
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
937
+ if (!topItem) return;
938
+
939
+ var instance = PopupManager.getInstance(topItem.id);
940
+ if (instance && instance.closeOnClickModal) {
941
+ instance.close();
942
+ }
943
+ },
944
+
945
+ openModal: function(id, zIndex, dom, modalClass, modalFade) {
946
+ if (__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer) return;
947
+ if (!id || zIndex === undefined) return;
948
+ this.modalFade = modalFade;
949
+
950
+ var modalStack = this.modalStack;
951
+
952
+ for (var i = 0, j = modalStack.length; i < j; i++) {
953
+ var item = modalStack[i];
954
+ if (item.id === id) {
955
+ return;
956
+ }
957
+ }
958
+
959
+ var modalDom = getModal();
960
+
961
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal');
962
+ if (this.modalFade && !hasModal) {
963
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal-enter');
964
+ }
965
+ if (modalClass) {
966
+ var classArr = modalClass.trim().split(/\s+/);
967
+ classArr.forEach(function (item) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, item); });
968
+ }
969
+ setTimeout(function () {
970
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, 'v-modal-enter');
971
+ }, 200);
972
+
973
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
974
+ dom.parentNode.appendChild(modalDom);
975
+ } else {
976
+ document.body.appendChild(modalDom);
977
+ }
978
+
979
+ if (zIndex) {
980
+ modalDom.style.zIndex = zIndex;
981
+ }
982
+ modalDom.style.display = '';
983
+
984
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
985
+ },
986
+
987
+ closeModal: function(id) {
988
+ var modalStack = this.modalStack;
989
+ var modalDom = getModal();
990
+
991
+ if (modalStack.length > 0) {
992
+ var topItem = modalStack[modalStack.length - 1];
993
+ if (topItem.id === id) {
994
+ if (topItem.modalClass) {
995
+ var classArr = topItem.modalClass.trim().split(/\s+/);
996
+ classArr.forEach(function (item) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, item); });
997
+ }
998
+
999
+ modalStack.pop();
1000
+ if (modalStack.length > 0) {
1001
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
1002
+ }
1003
+ } else {
1004
+ for (var i = modalStack.length - 1; i >= 0; i--) {
1005
+ if (modalStack[i].id === id) {
1006
+ modalStack.splice(i, 1);
1007
+ break;
1008
+ }
1009
+ }
1010
+ }
1011
+ }
1012
+
1013
+ if (modalStack.length === 0) {
1014
+ if (this.modalFade) {
1015
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["a" /* addClass */])(modalDom, 'v-modal-leave');
1016
+ }
1017
+ setTimeout(function () {
1018
+ if (modalStack.length === 0) {
1019
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
1020
+ modalDom.style.display = 'none';
1021
+ PopupManager.modalDom = undefined;
1022
+ }
1023
+ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_truck_mint_ui_src_utils_dom__["b" /* removeClass */])(modalDom, 'v-modal-leave');
1024
+ }, 200);
1025
+ }
1026
+ }
1027
+ };
1028
+ !__WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer && window.addEventListener('keydown', function(event) {
1029
+ if (event.keyCode === 27) { // ESC
1030
+ if (PopupManager.modalStack.length > 0) {
1031
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
1032
+ if (!topItem) return;
1033
+ var instance = PopupManager.getInstance(topItem.id);
1034
+ if (instance.closeOnPressEscape) {
1035
+ instance.close();
1036
+ }
1037
+ }
1038
+ }
1039
+ });
1040
+
1041
+ /* harmony default export */ exports["a"] = PopupManager;
1042
+
1043
+
1044
+ /***/ }
1045
+
1046
+ /******/ });