cy-element-ui 1.0.72 → 1.0.73

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.
Files changed (111) hide show
  1. package/lib/alert.js +4 -4
  2. package/lib/aside.js +77 -77
  3. package/lib/autocomplete.js +3940 -159
  4. package/lib/avatar.js +108 -108
  5. package/lib/backtop.js +110 -110
  6. package/lib/badge.js +108 -108
  7. package/lib/breadcrumb-item.js +4 -4
  8. package/lib/breadcrumb.js +4 -4
  9. package/lib/button-group.js +4 -4
  10. package/lib/button.js +4 -4
  11. package/lib/calendar.js +1545 -46
  12. package/lib/card.js +96 -96
  13. package/lib/carousel-item.js +452 -108
  14. package/lib/carousel.js +185 -116
  15. package/lib/cascader-panel.js +2270 -187
  16. package/lib/cascader.js +6452 -275
  17. package/lib/checkbox-button.js +43 -11
  18. package/lib/checkbox-group.js +47 -15
  19. package/lib/checkbox.js +47 -15
  20. package/lib/col.js +2 -2
  21. package/lib/collapse-item.js +815 -110
  22. package/lib/collapse.js +108 -108
  23. package/lib/color-picker.js +3953 -153
  24. package/lib/container.js +88 -88
  25. package/lib/date-picker.js +5231 -420
  26. package/lib/descriptions-item.js +2 -2
  27. package/lib/descriptions.js +63 -8
  28. package/lib/dialog.js +1200 -22
  29. package/lib/directives/repeat-click.js +2 -2
  30. package/lib/divider.js +104 -104
  31. package/lib/drawer.js +875 -105
  32. package/lib/dropdown-item.js +43 -11
  33. package/lib/dropdown-menu.js +2274 -72
  34. package/lib/dropdown.js +1072 -136
  35. package/lib/element-ui.common.js +26229 -13291
  36. package/lib/empty.js +603 -7
  37. package/lib/fileUpload.js +2478 -110
  38. package/lib/footer.js +77 -77
  39. package/lib/form-item.js +418 -28
  40. package/lib/form.js +29 -15
  41. package/lib/header.js +77 -77
  42. package/lib/icon.js +4 -4
  43. package/lib/image.js +1376 -49
  44. package/lib/index.js +1 -1
  45. package/lib/infinite-scroll.js +311 -21
  46. package/lib/input-number.js +1423 -34
  47. package/lib/input.js +507 -37
  48. package/lib/link.js +4 -4
  49. package/lib/loading.js +804 -67
  50. package/lib/locale/format.js +1 -1
  51. package/lib/locale/index.js +1 -1
  52. package/lib/main.js +64 -64
  53. package/lib/menu-item-group.js +4 -4
  54. package/lib/menu-item.js +2925 -41
  55. package/lib/menu.js +745 -54
  56. package/lib/message-box.js +2536 -79
  57. package/lib/message.js +1102 -24
  58. package/lib/mixins/locale.js +1 -1
  59. package/lib/mixins/migrating.js +1 -1
  60. package/lib/notification.js +1102 -25
  61. package/lib/option-group.js +43 -11
  62. package/lib/option.js +394 -18
  63. package/lib/page-header.js +683 -87
  64. package/lib/pagination.js +6078 -139
  65. package/lib/popconfirm.js +3508 -219
  66. package/lib/popover.js +2604 -79
  67. package/lib/progress.js +4 -4
  68. package/lib/radio-button.js +43 -11
  69. package/lib/radio-group.js +43 -11
  70. package/lib/radio.js +47 -15
  71. package/lib/rate.js +756 -113
  72. package/lib/result.js +4 -4
  73. package/lib/row.js +2 -2
  74. package/lib/scrollbar.js +735 -50
  75. package/lib/select.js +4352 -209
  76. package/lib/selectDisplayInput.js +108 -108
  77. package/lib/skeleton-item.js +2 -2
  78. package/lib/skeleton.js +108 -108
  79. package/lib/slider.js +4266 -120
  80. package/lib/spinner.js +4 -4
  81. package/lib/statistic.js +9605 -117
  82. package/lib/step.js +108 -108
  83. package/lib/steps.js +514 -99
  84. package/lib/subTitle.js +91 -91
  85. package/lib/submenu.js +2444 -123
  86. package/lib/switch.js +476 -21
  87. package/lib/tab-pane.js +4 -4
  88. package/lib/tabDialog.js +1544 -18
  89. package/lib/table-column.js +881 -33
  90. package/lib/table.js +4469 -426
  91. package/lib/tabs.js +425 -12
  92. package/lib/tag.js +4 -4
  93. package/lib/time-picker.js +5013 -285
  94. package/lib/time-select.js +4945 -177
  95. package/lib/timeline-item.js +108 -108
  96. package/lib/timeline.js +82 -82
  97. package/lib/tooltip.js +2566 -41
  98. package/lib/transfer.js +2135 -141
  99. package/lib/transitions/collapse-transition.js +1 -1
  100. package/lib/tree.js +1372 -55
  101. package/lib/treeSelect.js +3420 -105
  102. package/lib/upload.js +1047 -28
  103. package/lib/utils/clickoutside.js +1 -1
  104. package/lib/utils/date-util.js +2 -2
  105. package/lib/utils/popup/index.js +2 -2
  106. package/lib/utils/popup/popup-manager.js +1 -1
  107. package/lib/utils/util.js +1 -1
  108. package/lib/utils/vdom.js +1 -1
  109. package/lib/utils/vue-popper.js +1 -1
  110. package/package.json +1 -1
  111. package/src/index.js +1 -1
package/lib/submenu.js CHANGED
@@ -82,137 +82,481 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 139);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 128);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
89
89
 
90
90
  /***/ 0:
91
+ /***/ (function(module, exports) {
92
+
93
+ module.exports = require("vue");
94
+
95
+ /***/ }),
96
+
97
+ /***/ 1:
91
98
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
99
 
93
100
  "use strict";
94
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
95
- /* globals __VUE_SSR_CONTEXT__ */
101
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; });
102
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; });
103
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return once; });
104
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; });
105
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
106
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return removeClass; });
107
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; });
108
+ /* unused harmony export setStyle */
109
+ /* unused harmony export isScroll */
110
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollContainer; });
111
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isInContainer; });
112
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
113
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
114
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
96
115
 
97
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
98
- // This module is a runtime utility for cleaner component module output and will
99
- // be included in the final webpack user bundle.
116
+ /* istanbul ignore next */
100
117
 
101
- function normalizeComponent(
102
- scriptExports,
103
- render,
104
- staticRenderFns,
105
- functionalTemplate,
106
- injectStyles,
107
- scopeId,
108
- moduleIdentifier /* server only */,
109
- shadowMode /* vue-cli only */
110
- ) {
111
- // Vue.extend constructor export interop
112
- var options =
113
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
114
118
 
115
- // render functions
116
- if (render) {
117
- options.render = render
118
- options.staticRenderFns = staticRenderFns
119
- options._compiled = true
120
- }
121
119
 
122
- // functional template
123
- if (functionalTemplate) {
124
- options.functional = true
125
- }
120
+ var isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer;
121
+ var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
122
+ var MOZ_HACK_REGEXP = /^moz([A-Z])/;
123
+ var ieVersion = isServer ? 0 : Number(document.documentMode);
126
124
 
127
- // scopedId
128
- if (scopeId) {
129
- options._scopeId = 'data-v-' + scopeId
130
- }
125
+ /* istanbul ignore next */
126
+ var trim = function trim(string) {
127
+ return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
128
+ };
129
+ /* istanbul ignore next */
130
+ var camelCase = function camelCase(name) {
131
+ return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
132
+ return offset ? letter.toUpperCase() : letter;
133
+ }).replace(MOZ_HACK_REGEXP, 'Moz$1');
134
+ };
131
135
 
132
- var hook
133
- if (moduleIdentifier) {
134
- // server build
135
- hook = function (context) {
136
- // 2.3 injection
137
- context =
138
- context || // cached call
139
- (this.$vnode && this.$vnode.ssrContext) || // stateful
140
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
141
- // 2.2 with runInNewContext: true
142
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
143
- context = __VUE_SSR_CONTEXT__
144
- }
145
- // inject component styles
146
- if (injectStyles) {
147
- injectStyles.call(this, context)
148
- }
149
- // register component module identifier for async chunk inferrence
150
- if (context && context._registeredComponents) {
151
- context._registeredComponents.add(moduleIdentifier)
152
- }
153
- }
154
- // used by ssr in case component is cached and beforeCreate
155
- // never gets called
156
- options._ssrRegister = hook
157
- } else if (injectStyles) {
158
- hook = shadowMode
159
- ? function () {
160
- injectStyles.call(
161
- this,
162
- (options.functional ? this.parent : this).$root.$options.shadowRoot
163
- )
164
- }
165
- : injectStyles
166
- }
136
+ /* istanbul ignore next */
137
+ var on = function () {
138
+ if (!isServer && document.addEventListener) {
139
+ return function (element, event, handler) {
140
+ if (element && event && handler) {
141
+ element.addEventListener(event, handler, false);
142
+ }
143
+ };
144
+ } else {
145
+ return function (element, event, handler) {
146
+ if (element && event && handler) {
147
+ element.attachEvent('on' + event, handler);
148
+ }
149
+ };
150
+ }
151
+ }();
167
152
 
168
- if (hook) {
169
- if (options.functional) {
170
- // for template-only hot-reload because in that case the render fn doesn't
171
- // go through the normalizer
172
- options._injectStyles = hook
173
- // register for functional component in vue file
174
- var originalRender = options.render
175
- options.render = function renderWithStyleInjection(h, context) {
176
- hook.call(context)
177
- return originalRender(h, context)
178
- }
179
- } else {
180
- // inject component registration as beforeCreate hook
181
- var existing = options.beforeCreate
182
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
183
- }
184
- }
153
+ /* istanbul ignore next */
154
+ var off = function () {
155
+ if (!isServer && document.removeEventListener) {
156
+ return function (element, event, handler) {
157
+ if (element && event) {
158
+ element.removeEventListener(event, handler, false);
159
+ }
160
+ };
161
+ } else {
162
+ return function (element, event, handler) {
163
+ if (element && event) {
164
+ element.detachEvent('on' + event, handler);
165
+ }
166
+ };
167
+ }
168
+ }();
185
169
 
186
- return {
187
- exports: scriptExports,
188
- options: options
189
- }
190
- }
170
+ /* istanbul ignore next */
171
+ var once = function once(el, event, fn) {
172
+ var listener = function listener() {
173
+ if (fn) {
174
+ fn.apply(this, arguments);
175
+ }
176
+ off(el, event, listener);
177
+ };
178
+ on(el, event, listener);
179
+ };
180
+
181
+ /* istanbul ignore next */
182
+ function hasClass(el, cls) {
183
+ if (!el || !cls) return false;
184
+ if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
185
+ if (el.classList) {
186
+ return el.classList.contains(cls);
187
+ } else {
188
+ return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
189
+ }
190
+ };
191
+
192
+ /* istanbul ignore next */
193
+ function addClass(el, cls) {
194
+ if (!el) return;
195
+ var curClass = el.className;
196
+ var classes = (cls || '').split(' ');
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.add(clsName);
204
+ } else if (!hasClass(el, clsName)) {
205
+ curClass += ' ' + clsName;
206
+ }
207
+ }
208
+ if (!el.classList) {
209
+ el.setAttribute('class', curClass);
210
+ }
211
+ };
212
+
213
+ /* istanbul ignore next */
214
+ function removeClass(el, cls) {
215
+ if (!el || !cls) return;
216
+ var classes = cls.split(' ');
217
+ var curClass = ' ' + el.className + ' ';
218
+
219
+ for (var i = 0, j = classes.length; i < j; i++) {
220
+ var clsName = classes[i];
221
+ if (!clsName) continue;
222
+
223
+ if (el.classList) {
224
+ el.classList.remove(clsName);
225
+ } else if (hasClass(el, clsName)) {
226
+ curClass = curClass.replace(' ' + clsName + ' ', ' ');
227
+ }
228
+ }
229
+ if (!el.classList) {
230
+ el.setAttribute('class', trim(curClass));
231
+ }
232
+ };
233
+
234
+ /* istanbul ignore next */
235
+ var getStyle = ieVersion < 9 ? function (element, styleName) {
236
+ if (isServer) return;
237
+ if (!element || !styleName) return null;
238
+ styleName = camelCase(styleName);
239
+ if (styleName === 'float') {
240
+ styleName = 'styleFloat';
241
+ }
242
+ try {
243
+ switch (styleName) {
244
+ case 'opacity':
245
+ try {
246
+ return element.filters.item('alpha').opacity / 100;
247
+ } catch (e) {
248
+ return 1.0;
249
+ }
250
+ default:
251
+ return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
252
+ }
253
+ } catch (e) {
254
+ return element.style[styleName];
255
+ }
256
+ } : function (element, styleName) {
257
+ if (isServer) return;
258
+ if (!element || !styleName) return null;
259
+ styleName = camelCase(styleName);
260
+ if (styleName === 'float') {
261
+ styleName = 'cssFloat';
262
+ }
263
+ try {
264
+ var computed = document.defaultView.getComputedStyle(element, '');
265
+ return element.style[styleName] || computed ? computed[styleName] : null;
266
+ } catch (e) {
267
+ return element.style[styleName];
268
+ }
269
+ };
270
+
271
+ /* istanbul ignore next */
272
+ function setStyle(element, styleName, value) {
273
+ if (!element || !styleName) return;
274
+
275
+ if ((typeof styleName === 'undefined' ? 'undefined' : _typeof(styleName)) === 'object') {
276
+ for (var prop in styleName) {
277
+ if (styleName.hasOwnProperty(prop)) {
278
+ setStyle(element, prop, styleName[prop]);
279
+ }
280
+ }
281
+ } else {
282
+ styleName = camelCase(styleName);
283
+ if (styleName === 'opacity' && ieVersion < 9) {
284
+ element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
285
+ } else {
286
+ element.style[styleName] = value;
287
+ }
288
+ }
289
+ };
290
+
291
+ var isScroll = function isScroll(el, vertical) {
292
+ if (isServer) return;
293
+
294
+ var determinedDirection = vertical !== null && vertical !== undefined;
295
+ var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
296
+
297
+ return overflow.match(/(scroll|auto|overlay)/);
298
+ };
299
+
300
+ var getScrollContainer = function getScrollContainer(el, vertical) {
301
+ if (isServer) return;
302
+
303
+ var parent = el;
304
+ while (parent) {
305
+ if ([window, document, document.documentElement].includes(parent)) {
306
+ return window;
307
+ }
308
+ if (isScroll(parent, vertical)) {
309
+ return parent;
310
+ }
311
+ parent = parent.parentNode;
312
+ }
313
+
314
+ return parent;
315
+ };
316
+
317
+ var isInContainer = function isInContainer(el, container) {
318
+ if (isServer || !el || !container) return false;
319
+
320
+ var elRect = el.getBoundingClientRect();
321
+ var containerRect = void 0;
322
+
323
+ if ([window, document, document.documentElement, null, undefined].includes(container)) {
324
+ containerRect = {
325
+ top: 0,
326
+ right: window.innerWidth,
327
+ bottom: window.innerHeight,
328
+ left: 0
329
+ };
330
+ } else {
331
+ containerRect = container.getBoundingClientRect();
332
+ }
333
+
334
+ return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
335
+ };
336
+
337
+ /***/ }),
338
+
339
+ /***/ 10:
340
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
341
+
342
+ "use strict";
343
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
344
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
345
+ /* harmony import */ var _popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
346
+
347
+
348
+
349
+ var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(23);
350
+ var stop = function stop(e) {
351
+ return e.stopPropagation();
352
+ };
353
+
354
+ /**
355
+ * @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
356
+ * @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
357
+ * @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
358
+ * @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
359
+ * @param {Boolean} [visible=false] Visibility of the popup element.
360
+ * @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
361
+ */
362
+ /* harmony default export */ __webpack_exports__["a"] = ({
363
+ props: {
364
+ transformOrigin: {
365
+ type: [Boolean, String],
366
+ default: true
367
+ },
368
+ placement: {
369
+ type: String,
370
+ default: 'bottom'
371
+ },
372
+ boundariesPadding: {
373
+ type: Number,
374
+ default: 5
375
+ },
376
+ reference: {},
377
+ popper: {},
378
+ offset: {
379
+ default: 0
380
+ },
381
+ value: Boolean,
382
+ visibleArrow: Boolean,
383
+ arrowOffset: {
384
+ type: Number,
385
+ default: 35
386
+ },
387
+ appendToBody: {
388
+ type: Boolean,
389
+ default: true
390
+ },
391
+ popperOptions: {
392
+ type: Object,
393
+ default: function _default() {
394
+ return {
395
+ gpuAcceleration: false
396
+ };
397
+ }
398
+ }
399
+ },
400
+
401
+ data: function data() {
402
+ return {
403
+ showPopper: false,
404
+ currentPlacement: ''
405
+ };
406
+ },
407
+
408
+
409
+ watch: {
410
+ value: {
411
+ immediate: true,
412
+ handler: function handler(val) {
413
+ this.showPopper = val;
414
+ this.$emit('input', val);
415
+ }
416
+ },
417
+
418
+ showPopper: function showPopper(val) {
419
+ if (this.disabled) return;
420
+ val ? this.updatePopper() : this.destroyPopper();
421
+ this.$emit('input', val);
422
+ }
423
+ },
424
+
425
+ methods: {
426
+ createPopper: function createPopper() {
427
+ var _this = this;
428
+
429
+ if (this.$isServer) return;
430
+ this.currentPlacement = this.currentPlacement || this.placement;
431
+ if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
432
+ return;
433
+ }
434
+
435
+ var options = this.popperOptions;
436
+ var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
437
+ var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
438
+
439
+ if (!reference && this.$slots.reference && this.$slots.reference[0]) {
440
+ reference = this.referenceElm = this.$slots.reference[0].elm;
441
+ }
442
+
443
+ if (!popper || !reference) return;
444
+ if (this.visibleArrow) this.appendArrow(popper);
445
+ if (this.appendToBody) document.body.appendChild(this.popperElm);
446
+ if (this.popperJS && this.popperJS.destroy) {
447
+ this.popperJS.destroy();
448
+ }
449
+
450
+ options.placement = this.currentPlacement;
451
+ options.offset = this.offset;
452
+ options.arrowOffset = this.arrowOffset;
453
+ this.popperJS = new PopperJS(reference, popper, options);
454
+ this.popperJS.onCreate(function (_) {
455
+ _this.$emit('created', _this);
456
+ _this.resetTransformOrigin();
457
+ _this.$nextTick(_this.updatePopper);
458
+ });
459
+ if (typeof options.onUpdate === 'function') {
460
+ this.popperJS.onUpdate(options.onUpdate);
461
+ }
462
+ this.popperJS._popper.style.zIndex = _popup__WEBPACK_IMPORTED_MODULE_1__[/* PopupManager */ "a"].nextZIndex();
463
+ this.popperElm.addEventListener('click', stop);
464
+ },
465
+ updatePopper: function updatePopper() {
466
+ var popperJS = this.popperJS;
467
+ if (popperJS) {
468
+ popperJS.update();
469
+ if (popperJS._popper) {
470
+ popperJS._popper.style.zIndex = _popup__WEBPACK_IMPORTED_MODULE_1__[/* PopupManager */ "a"].nextZIndex();
471
+ }
472
+ } else {
473
+ this.createPopper();
474
+ }
475
+ },
476
+ doDestroy: function doDestroy(forceDestroy) {
477
+ /* istanbul ignore if */
478
+ if (!this.popperJS || this.showPopper && !forceDestroy) return;
479
+ this.popperJS.destroy();
480
+ this.popperJS = null;
481
+ },
482
+ destroyPopper: function destroyPopper() {
483
+ if (this.popperJS) {
484
+ this.resetTransformOrigin();
485
+ }
486
+ },
487
+ resetTransformOrigin: function resetTransformOrigin() {
488
+ if (!this.transformOrigin) return;
489
+ var placementMap = {
490
+ top: 'bottom',
491
+ bottom: 'top',
492
+ left: 'right',
493
+ right: 'left'
494
+ };
495
+ var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
496
+ var origin = placementMap[placement];
497
+ this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
498
+ },
499
+ appendArrow: function appendArrow(element) {
500
+ var hash = void 0;
501
+ if (this.appended) {
502
+ return;
503
+ }
504
+
505
+ this.appended = true;
506
+
507
+ for (var item in element.attributes) {
508
+ if (/^_v-/.test(element.attributes[item].name)) {
509
+ hash = element.attributes[item].name;
510
+ break;
511
+ }
512
+ }
191
513
 
514
+ var arrow = document.createElement('div');
515
+
516
+ if (hash) {
517
+ arrow.setAttribute(hash, '');
518
+ }
519
+ arrow.setAttribute('x-arrow', '');
520
+ arrow.className = 'popper__arrow';
521
+ element.appendChild(arrow);
522
+ }
523
+ },
524
+
525
+ beforeDestroy: function beforeDestroy() {
526
+ this.doDestroy(true);
527
+ if (this.popperElm && this.popperElm.parentNode === document.body) {
528
+ this.popperElm.removeEventListener('click', stop);
529
+ document.body.removeChild(this.popperElm);
530
+ }
531
+ },
532
+
533
+
534
+ // call destroy in keep-alive mode
535
+ deactivated: function deactivated() {
536
+ this.$options.beforeDestroy[0].call(this);
537
+ }
538
+ });
192
539
 
193
540
  /***/ }),
194
541
 
195
- /***/ 139:
542
+ /***/ 128:
196
543
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
197
544
 
198
545
  "use strict";
199
546
  // ESM COMPAT FLAG
200
547
  __webpack_require__.r(__webpack_exports__);
201
548
 
202
- // EXTERNAL MODULE: external "cy-element-ui/lib/transitions/collapse-transition"
203
- var collapse_transition_ = __webpack_require__(28);
204
- var collapse_transition_default = /*#__PURE__*/__webpack_require__.n(collapse_transition_);
549
+ // EXTERNAL MODULE: ./src/transitions/collapse-transition.js
550
+ var collapse_transition = __webpack_require__(40);
205
551
 
206
552
  // EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
207
- var menu_mixin = __webpack_require__(37);
553
+ var menu_mixin = __webpack_require__(48);
208
554
 
209
- // EXTERNAL MODULE: external "cy-element-ui/lib/mixins/emitter"
210
- var emitter_ = __webpack_require__(4);
211
- var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
555
+ // EXTERNAL MODULE: ./src/mixins/emitter.js
556
+ var emitter = __webpack_require__(6);
212
557
 
213
- // EXTERNAL MODULE: external "cy-element-ui/lib/utils/vue-popper"
214
- var vue_popper_ = __webpack_require__(5);
215
- var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
558
+ // EXTERNAL MODULE: ./src/utils/vue-popper.js
559
+ var vue_popper = __webpack_require__(10);
216
560
 
217
561
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/submenu.vue?vue&type=script&lang=js
218
562
 
@@ -227,14 +571,14 @@ var poperMixins = {
227
571
  type: [Boolean, String],
228
572
  default: false
229
573
  },
230
- offset: vue_popper_default.a.props.offset,
231
- boundariesPadding: vue_popper_default.a.props.boundariesPadding,
232
- popperOptions: vue_popper_default.a.props.popperOptions
574
+ offset: vue_popper["a" /* default */].props.offset,
575
+ boundariesPadding: vue_popper["a" /* default */].props.boundariesPadding,
576
+ popperOptions: vue_popper["a" /* default */].props.popperOptions
233
577
  },
234
- data: vue_popper_default.a.data,
235
- methods: vue_popper_default.a.methods,
236
- beforeDestroy: vue_popper_default.a.beforeDestroy,
237
- deactivated: vue_popper_default.a.deactivated
578
+ data: vue_popper["a" /* default */].data,
579
+ methods: vue_popper["a" /* default */].methods,
580
+ beforeDestroy: vue_popper["a" /* default */].beforeDestroy,
581
+ deactivated: vue_popper["a" /* default */].deactivated
238
582
  };
239
583
 
240
584
  /* harmony default export */ var submenuvue_type_script_lang_js = ({
@@ -242,9 +586,9 @@ var poperMixins = {
242
586
 
243
587
  componentName: 'ElSubmenu',
244
588
 
245
- mixins: [menu_mixin["a" /* default */], emitter_default.a, poperMixins],
589
+ mixins: [menu_mixin["a" /* default */], emitter["a" /* default */], poperMixins],
246
590
 
247
- components: { ElCollapseTransition: collapse_transition_default.a },
591
+ components: { ElCollapseTransition: collapse_transition["a" /* default */] },
248
592
 
249
593
  props: {
250
594
  index: {
@@ -594,7 +938,7 @@ var poperMixins = {
594
938
  // CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=script&lang=js
595
939
  /* harmony default export */ var src_submenuvue_type_script_lang_js = (submenuvue_type_script_lang_js);
596
940
  // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
597
- var componentNormalizer = __webpack_require__(0);
941
+ var componentNormalizer = __webpack_require__(2);
598
942
 
599
943
  // CONCATENATED MODULE: ./packages/menu/src/submenu.vue
600
944
  var render, staticRenderFns
@@ -628,14 +972,1468 @@ submenu.install = function (Vue) {
628
972
 
629
973
  /***/ }),
630
974
 
631
- /***/ 28:
632
- /***/ (function(module, exports) {
633
-
634
- module.exports = require("cy-element-ui/lib/transitions/collapse-transition");
975
+ /***/ 2:
976
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
635
977
 
636
- /***/ }),
978
+ "use strict";
979
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
980
+ /* globals __VUE_SSR_CONTEXT__ */
981
+
982
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
983
+ // This module is a runtime utility for cleaner component module output and will
984
+ // be included in the final webpack user bundle.
985
+
986
+ function normalizeComponent(
987
+ scriptExports,
988
+ render,
989
+ staticRenderFns,
990
+ functionalTemplate,
991
+ injectStyles,
992
+ scopeId,
993
+ moduleIdentifier /* server only */,
994
+ shadowMode /* vue-cli only */
995
+ ) {
996
+ // Vue.extend constructor export interop
997
+ var options =
998
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
999
+
1000
+ // render functions
1001
+ if (render) {
1002
+ options.render = render
1003
+ options.staticRenderFns = staticRenderFns
1004
+ options._compiled = true
1005
+ }
1006
+
1007
+ // functional template
1008
+ if (functionalTemplate) {
1009
+ options.functional = true
1010
+ }
1011
+
1012
+ // scopedId
1013
+ if (scopeId) {
1014
+ options._scopeId = 'data-v-' + scopeId
1015
+ }
1016
+
1017
+ var hook
1018
+ if (moduleIdentifier) {
1019
+ // server build
1020
+ hook = function (context) {
1021
+ // 2.3 injection
1022
+ context =
1023
+ context || // cached call
1024
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
1025
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
1026
+ // 2.2 with runInNewContext: true
1027
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
1028
+ context = __VUE_SSR_CONTEXT__
1029
+ }
1030
+ // inject component styles
1031
+ if (injectStyles) {
1032
+ injectStyles.call(this, context)
1033
+ }
1034
+ // register component module identifier for async chunk inferrence
1035
+ if (context && context._registeredComponents) {
1036
+ context._registeredComponents.add(moduleIdentifier)
1037
+ }
1038
+ }
1039
+ // used by ssr in case component is cached and beforeCreate
1040
+ // never gets called
1041
+ options._ssrRegister = hook
1042
+ } else if (injectStyles) {
1043
+ hook = shadowMode
1044
+ ? function () {
1045
+ injectStyles.call(
1046
+ this,
1047
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
1048
+ )
1049
+ }
1050
+ : injectStyles
1051
+ }
1052
+
1053
+ if (hook) {
1054
+ if (options.functional) {
1055
+ // for template-only hot-reload because in that case the render fn doesn't
1056
+ // go through the normalizer
1057
+ options._injectStyles = hook
1058
+ // register for functional component in vue file
1059
+ var originalRender = options.render
1060
+ options.render = function renderWithStyleInjection(h, context) {
1061
+ hook.call(context)
1062
+ return originalRender(h, context)
1063
+ }
1064
+ } else {
1065
+ // inject component registration as beforeCreate hook
1066
+ var existing = options.beforeCreate
1067
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
1068
+ }
1069
+ }
1070
+
1071
+ return {
1072
+ exports: scriptExports,
1073
+ options: options
1074
+ }
1075
+ }
1076
+
1077
+
1078
+ /***/ }),
1079
+
1080
+ /***/ 23:
1081
+ /***/ (function(module, exports, __webpack_require__) {
1082
+
1083
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1084
+
1085
+ /**
1086
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
1087
+ * @version {{version}}
1088
+ * @license
1089
+ * Copyright (c) 2016 Federico Zivolo and contributors
1090
+ *
1091
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1092
+ * of this software and associated documentation files (the "Software"), to deal
1093
+ * in the Software without restriction, including without limitation the rights
1094
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1095
+ * copies of the Software, and to permit persons to whom the Software is
1096
+ * furnished to do so, subject to the following conditions:
1097
+ *
1098
+ * The above copyright notice and this permission notice shall be included in all
1099
+ * copies or substantial portions of the Software.
1100
+ *
1101
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1102
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1103
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1104
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1105
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1106
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1107
+ * SOFTWARE.
1108
+ */
1109
+
1110
+ //
1111
+ // Cross module loader
1112
+ // Supported: Node, AMD, Browser globals
1113
+ //
1114
+ ;(function (root, factory) {
1115
+ if (true) {
1116
+ // AMD. Register as an anonymous module.
1117
+ !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
1118
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
1119
+ (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
1120
+ __WEBPACK_AMD_DEFINE_FACTORY__),
1121
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1122
+ } else {}
1123
+ })(this, function () {
1124
+
1125
+ 'use strict';
1126
+
1127
+ var root = window;
1128
+
1129
+ // default options
1130
+ var DEFAULTS = {
1131
+ // placement of the popper
1132
+ placement: 'bottom',
1133
+
1134
+ gpuAcceleration: true,
1135
+
1136
+ // shift popper from its origin by the given amount of pixels (can be negative)
1137
+ offset: 0,
1138
+
1139
+ // the element which will act as boundary of the popper
1140
+ boundariesElement: 'viewport',
1141
+
1142
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
1143
+ boundariesPadding: 5,
1144
+
1145
+ // popper will try to prevent overflow following this order,
1146
+ // by default, then, it could overflow on the left and on top of the boundariesElement
1147
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
1148
+
1149
+ // the behavior used by flip to change the placement of the popper
1150
+ flipBehavior: 'flip',
1151
+
1152
+ arrowElement: '[x-arrow]',
1153
+
1154
+ arrowOffset: 0,
1155
+
1156
+ // list of functions used to modify the offsets before they are applied to the popper
1157
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
1158
+
1159
+ modifiersIgnored: [],
1160
+
1161
+ forceAbsolute: false
1162
+ };
1163
+
1164
+ /**
1165
+ * Create a new Popper.js instance
1166
+ * @constructor Popper
1167
+ * @param {HTMLElement} reference - The reference element used to position the popper
1168
+ * @param {HTMLElement|Object} popper
1169
+ * The HTML element used as popper, or a configuration used to generate the popper.
1170
+ * @param {String} [popper.tagName='div'] The tag name of the generated popper.
1171
+ * @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
1172
+ * @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
1173
+ * @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
1174
+ * @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
1175
+ * @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
1176
+ * @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
1177
+ * @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
1178
+ * @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
1179
+ * @param {Object} options
1180
+ * @param {String} [options.placement=bottom]
1181
+ * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
1182
+ * left(-start, -end)`
1183
+ *
1184
+ * @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
1185
+ * The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
1186
+ * its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
1187
+ * reference element.
1188
+ * By default, it will look for a child node of the popper with the `x-arrow` attribute.
1189
+ *
1190
+ * @param {Boolean} [options.gpuAcceleration=true]
1191
+ * When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
1192
+ * browser to use the GPU to accelerate the rendering.
1193
+ * If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
1194
+ *
1195
+ * @param {Number} [options.offset=0]
1196
+ * Amount of pixels the popper will be shifted (can be negative).
1197
+ *
1198
+ * @param {String|Element} [options.boundariesElement='viewport']
1199
+ * The element which will define the boundaries of the popper position, the popper will never be placed outside
1200
+ * of the defined boundaries (except if `keepTogether` is enabled)
1201
+ *
1202
+ * @param {Number} [options.boundariesPadding=5]
1203
+ * Additional padding for the boundaries
1204
+ *
1205
+ * @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
1206
+ * Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
1207
+ * this means that the last ones will never overflow
1208
+ *
1209
+ * @param {String|Array} [options.flipBehavior='flip']
1210
+ * The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
1211
+ * overlap its reference element. Defining `flip` as value, the placement will be flipped on
1212
+ * its axis (`right - left`, `top - bottom`).
1213
+ * You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
1214
+ * how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
1215
+ * then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
1216
+ *
1217
+ * @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
1218
+ * List of functions used to modify the data before they are applied to the popper, add your custom functions
1219
+ * to this array to edit the offsets and placement.
1220
+ * The function should reflect the @params and @returns of preventOverflow
1221
+ *
1222
+ * @param {Array} [options.modifiersIgnored=[]]
1223
+ * Put here any built-in modifier name you want to exclude from the modifiers list
1224
+ * The function should reflect the @params and @returns of preventOverflow
1225
+ *
1226
+ * @param {Boolean} [options.removeOnDestroy=false]
1227
+ * Set to true if you want to automatically remove the popper when you call the `destroy` method.
1228
+ */
1229
+ function Popper(reference, popper, options) {
1230
+ this._reference = reference.jquery ? reference[0] : reference;
1231
+ this.state = {};
1232
+
1233
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
1234
+ // generate a default popper if is not defined
1235
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
1236
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
1237
+ if (isNotDefined || isConfig) {
1238
+ this._popper = this.parse(isConfig ? popper : {});
1239
+ }
1240
+ // otherwise, use the given HTMLElement as popper
1241
+ else {
1242
+ this._popper = popper.jquery ? popper[0] : popper;
1243
+ }
1244
+
1245
+ // with {} we create a new object with the options inside it
1246
+ this._options = Object.assign({}, DEFAULTS, options);
1247
+
1248
+ // refactoring modifiers' list
1249
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
1250
+ // remove ignored modifiers
1251
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
1252
+
1253
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
1254
+ // margins needs to be calculated to get the correct popper offsets
1255
+ if (modifier === 'applyStyle') {
1256
+ this._popper.setAttribute('x-placement', this._options.placement);
1257
+ }
1258
+
1259
+ // return predefined modifier identified by string or keep the custom one
1260
+ return this.modifiers[modifier] || modifier;
1261
+ }.bind(this));
1262
+
1263
+ // make sure to apply the popper position before any computation
1264
+ this.state.position = this._getPosition(this._popper, this._reference);
1265
+ setStyle(this._popper, { position: this.state.position, top: 0 });
1266
+
1267
+ // fire the first update to position the popper in the right place
1268
+ this.update();
1269
+
1270
+ // setup event listeners, they will take care of update the position in specific situations
1271
+ this._setupEventListeners();
1272
+ return this;
1273
+ }
1274
+
1275
+ //
1276
+ // Methods
1277
+ //
1278
+ /**
1279
+ * Destroy the popper
1280
+ * @method
1281
+ * @memberof Popper
1282
+ */
1283
+ Popper.prototype.destroy = function () {
1284
+ this._popper.removeAttribute('x-placement');
1285
+ this._popper.style.left = '';
1286
+ this._popper.style.position = '';
1287
+ this._popper.style.top = '';
1288
+ this._popper.style[getSupportedPropertyName('transform')] = '';
1289
+ this._removeEventListeners();
1290
+
1291
+ // remove the popper if user explicity asked for the deletion on destroy
1292
+ if (this._options.removeOnDestroy) {
1293
+ this._popper.remove();
1294
+ }
1295
+ return this;
1296
+ };
1297
+
1298
+ /**
1299
+ * Updates the position of the popper, computing the new offsets and applying the new style
1300
+ * @method
1301
+ * @memberof Popper
1302
+ */
1303
+ Popper.prototype.update = function () {
1304
+ var data = { instance: this, styles: {} };
1305
+
1306
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
1307
+ // and refer to _originalPlacement to know the original value
1308
+ data.placement = this._options.placement;
1309
+ data._originalPlacement = this._options.placement;
1310
+
1311
+ // compute the popper and reference offsets and put them inside data.offsets
1312
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
1313
+
1314
+ // get boundaries
1315
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
1316
+
1317
+ data = this.runModifiers(data, this._options.modifiers);
1318
+
1319
+ if (typeof this.state.updateCallback === 'function') {
1320
+ this.state.updateCallback(data);
1321
+ }
1322
+ };
1323
+
1324
+ /**
1325
+ * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
1326
+ * @method
1327
+ * @memberof Popper
1328
+ * @param {Function} callback
1329
+ */
1330
+ Popper.prototype.onCreate = function (callback) {
1331
+ // the createCallbacks return as first argument the popper instance
1332
+ callback(this);
1333
+ return this;
1334
+ };
1335
+
1336
+ /**
1337
+ * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
1338
+ * used to style popper and its arrow.
1339
+ * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
1340
+ * @method
1341
+ * @memberof Popper
1342
+ * @param {Function} callback
1343
+ */
1344
+ Popper.prototype.onUpdate = function (callback) {
1345
+ this.state.updateCallback = callback;
1346
+ return this;
1347
+ };
1348
+
1349
+ /**
1350
+ * Helper used to generate poppers from a configuration file
1351
+ * @method
1352
+ * @memberof Popper
1353
+ * @param config {Object} configuration
1354
+ * @returns {HTMLElement} popper
1355
+ */
1356
+ Popper.prototype.parse = function (config) {
1357
+ var defaultConfig = {
1358
+ tagName: 'div',
1359
+ classNames: ['popper'],
1360
+ attributes: [],
1361
+ parent: root.document.body,
1362
+ content: '',
1363
+ contentType: 'text',
1364
+ arrowTagName: 'div',
1365
+ arrowClassNames: ['popper__arrow'],
1366
+ arrowAttributes: ['x-arrow']
1367
+ };
1368
+ config = Object.assign({}, defaultConfig, config);
1369
+
1370
+ var d = root.document;
1371
+
1372
+ var popper = d.createElement(config.tagName);
1373
+ addClassNames(popper, config.classNames);
1374
+ addAttributes(popper, config.attributes);
1375
+ if (config.contentType === 'node') {
1376
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
1377
+ } else if (config.contentType === 'html') {
1378
+ popper.innerHTML = config.content;
1379
+ } else {
1380
+ popper.textContent = config.content;
1381
+ }
1382
+
1383
+ if (config.arrowTagName) {
1384
+ var arrow = d.createElement(config.arrowTagName);
1385
+ addClassNames(arrow, config.arrowClassNames);
1386
+ addAttributes(arrow, config.arrowAttributes);
1387
+ popper.appendChild(arrow);
1388
+ }
1389
+
1390
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
1391
+
1392
+ // if the given parent is a string, use it to match an element
1393
+ // if more than one element is matched, the first one will be used as parent
1394
+ // if no elements are matched, the script will throw an error
1395
+ if (typeof parent === 'string') {
1396
+ parent = d.querySelectorAll(config.parent);
1397
+ if (parent.length > 1) {
1398
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
1399
+ }
1400
+ if (parent.length === 0) {
1401
+ throw 'ERROR: the given `parent` doesn\'t exists!';
1402
+ }
1403
+ parent = parent[0];
1404
+ }
1405
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
1406
+ // the first one will be used as parent
1407
+ if (parent.length > 1 && parent instanceof Element === false) {
1408
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
1409
+ parent = parent[0];
1410
+ }
1411
+
1412
+ // append the generated popper to its parent
1413
+ parent.appendChild(popper);
1414
+
1415
+ return popper;
1416
+
1417
+ /**
1418
+ * Adds class names to the given element
1419
+ * @function
1420
+ * @ignore
1421
+ * @param {HTMLElement} target
1422
+ * @param {Array} classes
1423
+ */
1424
+ function addClassNames(element, classNames) {
1425
+ classNames.forEach(function (className) {
1426
+ element.classList.add(className);
1427
+ });
1428
+ }
1429
+
1430
+ /**
1431
+ * Adds attributes to the given element
1432
+ * @function
1433
+ * @ignore
1434
+ * @param {HTMLElement} target
1435
+ * @param {Array} attributes
1436
+ * @example
1437
+ * addAttributes(element, [ 'data-info:foobar' ]);
1438
+ */
1439
+ function addAttributes(element, attributes) {
1440
+ attributes.forEach(function (attribute) {
1441
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
1442
+ });
1443
+ }
1444
+ };
1445
+
1446
+ /**
1447
+ * Helper used to get the position which will be applied to the popper
1448
+ * @method
1449
+ * @memberof Popper
1450
+ * @param config {HTMLElement} popper element
1451
+ * @param reference {HTMLElement} reference element
1452
+ * @returns {String} position
1453
+ */
1454
+ Popper.prototype._getPosition = function (popper, reference) {
1455
+ var container = getOffsetParent(reference);
1456
+
1457
+ if (this._options.forceAbsolute) {
1458
+ return 'absolute';
1459
+ }
1460
+
1461
+ // Decide if the popper will be fixed
1462
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
1463
+ var isParentFixed = isFixed(reference, container);
1464
+ return isParentFixed ? 'fixed' : 'absolute';
1465
+ };
1466
+
1467
+ /**
1468
+ * Get offsets to the popper
1469
+ * @method
1470
+ * @memberof Popper
1471
+ * @access private
1472
+ * @param {Element} popper - the popper element
1473
+ * @param {Element} reference - the reference element (the popper will be relative to this)
1474
+ * @returns {Object} An object containing the offsets which will be applied to the popper
1475
+ */
1476
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
1477
+ placement = placement.split('-')[0];
1478
+ var popperOffsets = {};
1479
+
1480
+ popperOffsets.position = this.state.position;
1481
+ var isParentFixed = popperOffsets.position === 'fixed';
1482
+
1483
+ //
1484
+ // Get reference element position
1485
+ //
1486
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
1487
+
1488
+ //
1489
+ // Get popper sizes
1490
+ //
1491
+ var popperRect = getOuterSizes(popper);
1492
+
1493
+ //
1494
+ // Compute offsets of popper
1495
+ //
1496
+
1497
+ // depending by the popper placement we have to compute its offsets slightly differently
1498
+ if (['right', 'left'].indexOf(placement) !== -1) {
1499
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
1500
+ if (placement === 'left') {
1501
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
1502
+ } else {
1503
+ popperOffsets.left = referenceOffsets.right;
1504
+ }
1505
+ } else {
1506
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
1507
+ if (placement === 'top') {
1508
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
1509
+ } else {
1510
+ popperOffsets.top = referenceOffsets.bottom;
1511
+ }
1512
+ }
1513
+
1514
+ // Add width and height to our offsets object
1515
+ popperOffsets.width = popperRect.width;
1516
+ popperOffsets.height = popperRect.height;
1517
+
1518
+ return {
1519
+ popper: popperOffsets,
1520
+ reference: referenceOffsets
1521
+ };
1522
+ };
1523
+
1524
+ /**
1525
+ * Setup needed event listeners used to update the popper position
1526
+ * @method
1527
+ * @memberof Popper
1528
+ * @access private
1529
+ */
1530
+ Popper.prototype._setupEventListeners = function () {
1531
+ // NOTE: 1 DOM access here
1532
+ this.state.updateBound = this.update.bind(this);
1533
+ root.addEventListener('resize', this.state.updateBound);
1534
+ // if the boundariesElement is window we don't need to listen for the scroll event
1535
+ if (this._options.boundariesElement !== 'window') {
1536
+ var target = getScrollParent(this._reference);
1537
+ // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
1538
+ if (target === root.document.body || target === root.document.documentElement) {
1539
+ target = root;
1540
+ }
1541
+ target.addEventListener('scroll', this.state.updateBound);
1542
+ this.state.scrollTarget = target;
1543
+ }
1544
+ };
1545
+
1546
+ /**
1547
+ * Remove event listeners used to update the popper position
1548
+ * @method
1549
+ * @memberof Popper
1550
+ * @access private
1551
+ */
1552
+ Popper.prototype._removeEventListeners = function () {
1553
+ // NOTE: 1 DOM access here
1554
+ root.removeEventListener('resize', this.state.updateBound);
1555
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
1556
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
1557
+ this.state.scrollTarget = null;
1558
+ }
1559
+ this.state.updateBound = null;
1560
+ };
1561
+
1562
+ /**
1563
+ * Computed the boundaries limits and return them
1564
+ * @method
1565
+ * @memberof Popper
1566
+ * @access private
1567
+ * @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
1568
+ * @param {Number} padding - Boundaries padding
1569
+ * @param {Element} boundariesElement - Element used to define the boundaries
1570
+ * @returns {Object} Coordinates of the boundaries
1571
+ */
1572
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
1573
+ // NOTE: 1 DOM access here
1574
+ var boundaries = {};
1575
+ var width, height;
1576
+ if (boundariesElement === 'window') {
1577
+ var body = root.document.body,
1578
+ html = root.document.documentElement;
1579
+
1580
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
1581
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
1582
+
1583
+ boundaries = {
1584
+ top: 0,
1585
+ right: width,
1586
+ bottom: height,
1587
+ left: 0
1588
+ };
1589
+ } else if (boundariesElement === 'viewport') {
1590
+ var offsetParent = getOffsetParent(this._popper);
1591
+ var scrollParent = getScrollParent(this._popper);
1592
+ var offsetParentRect = getOffsetRect(offsetParent);
1593
+
1594
+ // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
1595
+ var getScrollTopValue = function getScrollTopValue(element) {
1596
+ return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
1597
+ };
1598
+ var getScrollLeftValue = function getScrollLeftValue(element) {
1599
+ return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
1600
+ };
1601
+
1602
+ // if the popper is fixed we don't have to substract scrolling from the boundaries
1603
+ var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
1604
+ var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
1605
+
1606
+ boundaries = {
1607
+ top: 0 - (offsetParentRect.top - scrollTop),
1608
+ right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
1609
+ bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
1610
+ left: 0 - (offsetParentRect.left - scrollLeft)
1611
+ };
1612
+ } else {
1613
+ if (getOffsetParent(this._popper) === boundariesElement) {
1614
+ boundaries = {
1615
+ top: 0,
1616
+ left: 0,
1617
+ right: boundariesElement.clientWidth,
1618
+ bottom: boundariesElement.clientHeight
1619
+ };
1620
+ } else {
1621
+ boundaries = getOffsetRect(boundariesElement);
1622
+ }
1623
+ }
1624
+ boundaries.left += padding;
1625
+ boundaries.right -= padding;
1626
+ boundaries.top = boundaries.top + padding;
1627
+ boundaries.bottom = boundaries.bottom - padding;
1628
+ return boundaries;
1629
+ };
1630
+
1631
+ /**
1632
+ * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
1633
+ * @method
1634
+ * @memberof Popper
1635
+ * @access public
1636
+ * @param {Object} data
1637
+ * @param {Array} modifiers
1638
+ * @param {Function} ends
1639
+ */
1640
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
1641
+ var modifiersToRun = modifiers.slice();
1642
+ if (ends !== undefined) {
1643
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
1644
+ }
1645
+
1646
+ modifiersToRun.forEach(function (modifier) {
1647
+ if (isFunction(modifier)) {
1648
+ data = modifier.call(this, data);
1649
+ }
1650
+ }.bind(this));
1651
+
1652
+ return data;
1653
+ };
1654
+
1655
+ /**
1656
+ * Helper used to know if the given modifier depends from another one.
1657
+ * @method
1658
+ * @memberof Popper
1659
+ * @param {String} requesting - name of requesting modifier
1660
+ * @param {String} requested - name of requested modifier
1661
+ * @returns {Boolean}
1662
+ */
1663
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
1664
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
1665
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
1666
+ return modifier === requested;
1667
+ }).length;
1668
+ };
1669
+
1670
+ //
1671
+ // Modifiers
1672
+ //
1673
+
1674
+ /**
1675
+ * Modifiers list
1676
+ * @namespace Popper.modifiers
1677
+ * @memberof Popper
1678
+ * @type {Object}
1679
+ */
1680
+ Popper.prototype.modifiers = {};
1681
+
1682
+ /**
1683
+ * Apply the computed styles to the popper element
1684
+ * @method
1685
+ * @memberof Popper.modifiers
1686
+ * @argument {Object} data - The data object generated by `update` method
1687
+ * @returns {Object} The same data object
1688
+ */
1689
+ Popper.prototype.modifiers.applyStyle = function (data) {
1690
+ // apply the final offsets to the popper
1691
+ // NOTE: 1 DOM access here
1692
+ var styles = {
1693
+ position: data.offsets.popper.position
1694
+ };
1695
+
1696
+ // round top and left to avoid blurry text
1697
+ var left = Math.round(data.offsets.popper.left);
1698
+ var top = Math.round(data.offsets.popper.top);
1699
+
1700
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
1701
+ // we automatically use the supported prefixed version if needed
1702
+ var prefixedProperty;
1703
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
1704
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
1705
+ styles.top = 0;
1706
+ styles.left = 0;
1707
+ }
1708
+ // othwerise, we use the standard `left` and `top` properties
1709
+ else {
1710
+ styles.left = left;
1711
+ styles.top = top;
1712
+ }
1713
+
1714
+ // any property present in `data.styles` will be applied to the popper,
1715
+ // in this way we can make the 3rd party modifiers add custom styles to it
1716
+ // Be aware, modifiers could override the properties defined in the previous
1717
+ // lines of this modifier!
1718
+ Object.assign(styles, data.styles);
1719
+
1720
+ setStyle(this._popper, styles);
1721
+
1722
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
1723
+ // NOTE: 1 DOM access here
1724
+ this._popper.setAttribute('x-placement', data.placement);
1725
+
1726
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
1727
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
1728
+ setStyle(data.arrowElement, data.offsets.arrow);
1729
+ }
1730
+
1731
+ return data;
1732
+ };
1733
+
1734
+ /**
1735
+ * Modifier used to shift the popper on the start or end of its reference element side
1736
+ * @method
1737
+ * @memberof Popper.modifiers
1738
+ * @argument {Object} data - The data object generated by `update` method
1739
+ * @returns {Object} The data object, properly modified
1740
+ */
1741
+ Popper.prototype.modifiers.shift = function (data) {
1742
+ var placement = data.placement;
1743
+ var basePlacement = placement.split('-')[0];
1744
+ var shiftVariation = placement.split('-')[1];
1745
+
1746
+ // if shift shiftVariation is specified, run the modifier
1747
+ if (shiftVariation) {
1748
+ var reference = data.offsets.reference;
1749
+ var popper = getPopperClientRect(data.offsets.popper);
1750
+
1751
+ var shiftOffsets = {
1752
+ y: {
1753
+ start: { top: reference.top },
1754
+ end: { top: reference.top + reference.height - popper.height }
1755
+ },
1756
+ x: {
1757
+ start: { left: reference.left },
1758
+ end: { left: reference.left + reference.width - popper.width }
1759
+ }
1760
+ };
1761
+
1762
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
1763
+
1764
+ data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
1765
+ }
1766
+
1767
+ return data;
1768
+ };
1769
+
1770
+ /**
1771
+ * Modifier used to make sure the popper does not overflows from it's boundaries
1772
+ * @method
1773
+ * @memberof Popper.modifiers
1774
+ * @argument {Object} data - The data object generated by `update` method
1775
+ * @returns {Object} The data object, properly modified
1776
+ */
1777
+ Popper.prototype.modifiers.preventOverflow = function (data) {
1778
+ var order = this._options.preventOverflowOrder;
1779
+ var popper = getPopperClientRect(data.offsets.popper);
1780
+
1781
+ var check = {
1782
+ left: function left() {
1783
+ var left = popper.left;
1784
+ if (popper.left < data.boundaries.left) {
1785
+ left = Math.max(popper.left, data.boundaries.left);
1786
+ }
1787
+ return { left: left };
1788
+ },
1789
+ right: function right() {
1790
+ var left = popper.left;
1791
+ if (popper.right > data.boundaries.right) {
1792
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
1793
+ }
1794
+ return { left: left };
1795
+ },
1796
+ top: function top() {
1797
+ var top = popper.top;
1798
+ if (popper.top < data.boundaries.top) {
1799
+ top = Math.max(popper.top, data.boundaries.top);
1800
+ }
1801
+ return { top: top };
1802
+ },
1803
+ bottom: function bottom() {
1804
+ var top = popper.top;
1805
+ if (popper.bottom > data.boundaries.bottom) {
1806
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
1807
+ }
1808
+ return { top: top };
1809
+ }
1810
+ };
1811
+
1812
+ order.forEach(function (direction) {
1813
+ data.offsets.popper = Object.assign(popper, check[direction]());
1814
+ });
1815
+
1816
+ return data;
1817
+ };
1818
+
1819
+ /**
1820
+ * Modifier used to make sure the popper is always near its reference
1821
+ * @method
1822
+ * @memberof Popper.modifiers
1823
+ * @argument {Object} data - The data object generated by _update method
1824
+ * @returns {Object} The data object, properly modified
1825
+ */
1826
+ Popper.prototype.modifiers.keepTogether = function (data) {
1827
+ var popper = getPopperClientRect(data.offsets.popper);
1828
+ var reference = data.offsets.reference;
1829
+ var f = Math.floor;
1830
+
1831
+ if (popper.right < f(reference.left)) {
1832
+ data.offsets.popper.left = f(reference.left) - popper.width;
1833
+ }
1834
+ if (popper.left > f(reference.right)) {
1835
+ data.offsets.popper.left = f(reference.right);
1836
+ }
1837
+ if (popper.bottom < f(reference.top)) {
1838
+ data.offsets.popper.top = f(reference.top) - popper.height;
1839
+ }
1840
+ if (popper.top > f(reference.bottom)) {
1841
+ data.offsets.popper.top = f(reference.bottom);
1842
+ }
1843
+
1844
+ return data;
1845
+ };
1846
+
1847
+ /**
1848
+ * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
1849
+ * Requires the `preventOverflow` modifier before it in order to work.
1850
+ * **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
1851
+ * @method
1852
+ * @memberof Popper.modifiers
1853
+ * @argument {Object} data - The data object generated by _update method
1854
+ * @returns {Object} The data object, properly modified
1855
+ */
1856
+ Popper.prototype.modifiers.flip = function (data) {
1857
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
1858
+ // otherwise flip would not work as expected.
1859
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
1860
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
1861
+ return data;
1862
+ }
1863
+
1864
+ if (data.flipped && data.placement === data._originalPlacement) {
1865
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
1866
+ return data;
1867
+ }
1868
+
1869
+ var placement = data.placement.split('-')[0];
1870
+ var placementOpposite = getOppositePlacement(placement);
1871
+ var variation = data.placement.split('-')[1] || '';
1872
+
1873
+ var flipOrder = [];
1874
+ if (this._options.flipBehavior === 'flip') {
1875
+ flipOrder = [placement, placementOpposite];
1876
+ } else {
1877
+ flipOrder = this._options.flipBehavior;
1878
+ }
1879
+
1880
+ flipOrder.forEach(function (step, index) {
1881
+ if (placement !== step || flipOrder.length === index + 1) {
1882
+ return;
1883
+ }
1884
+
1885
+ placement = data.placement.split('-')[0];
1886
+ placementOpposite = getOppositePlacement(placement);
1887
+
1888
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
1889
+
1890
+ // this boolean is used to distinguish right and bottom from top and left
1891
+ // they need different computations to get flipped
1892
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
1893
+
1894
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
1895
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
1896
+ // we'll use this boolean to detect any flip loop
1897
+ data.flipped = true;
1898
+ data.placement = flipOrder[index + 1];
1899
+ if (variation) {
1900
+ data.placement += '-' + variation;
1901
+ }
1902
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
1903
+
1904
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
1905
+ }
1906
+ }.bind(this));
1907
+ return data;
1908
+ };
1909
+
1910
+ /**
1911
+ * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
1912
+ * The offsets will shift the popper on the side of its reference element.
1913
+ * @method
1914
+ * @memberof Popper.modifiers
1915
+ * @argument {Object} data - The data object generated by _update method
1916
+ * @returns {Object} The data object, properly modified
1917
+ */
1918
+ Popper.prototype.modifiers.offset = function (data) {
1919
+ var offset = this._options.offset;
1920
+ var popper = data.offsets.popper;
1921
+
1922
+ if (data.placement.indexOf('left') !== -1) {
1923
+ popper.top -= offset;
1924
+ } else if (data.placement.indexOf('right') !== -1) {
1925
+ popper.top += offset;
1926
+ } else if (data.placement.indexOf('top') !== -1) {
1927
+ popper.left -= offset;
1928
+ } else if (data.placement.indexOf('bottom') !== -1) {
1929
+ popper.left += offset;
1930
+ }
1931
+ return data;
1932
+ };
1933
+
1934
+ /**
1935
+ * Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
1936
+ * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
1937
+ * @method
1938
+ * @memberof Popper.modifiers
1939
+ * @argument {Object} data - The data object generated by _update method
1940
+ * @returns {Object} The data object, properly modified
1941
+ */
1942
+ Popper.prototype.modifiers.arrow = function (data) {
1943
+ var arrow = this._options.arrowElement;
1944
+ var arrowOffset = this._options.arrowOffset;
1945
+
1946
+ // if the arrowElement is a string, suppose it's a CSS selector
1947
+ if (typeof arrow === 'string') {
1948
+ arrow = this._popper.querySelector(arrow);
1949
+ }
1950
+
1951
+ // if arrow element is not found, don't run the modifier
1952
+ if (!arrow) {
1953
+ return data;
1954
+ }
1955
+
1956
+ // the arrow element must be child of its popper
1957
+ if (!this._popper.contains(arrow)) {
1958
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
1959
+ return data;
1960
+ }
1961
+
1962
+ // arrow depends on keepTogether in order to work
1963
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
1964
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
1965
+ return data;
1966
+ }
1967
+
1968
+ var arrowStyle = {};
1969
+ var placement = data.placement.split('-')[0];
1970
+ var popper = getPopperClientRect(data.offsets.popper);
1971
+ var reference = data.offsets.reference;
1972
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
1973
+
1974
+ var len = isVertical ? 'height' : 'width';
1975
+ var side = isVertical ? 'top' : 'left';
1976
+ var translate = isVertical ? 'translateY' : 'translateX';
1977
+ var altSide = isVertical ? 'left' : 'top';
1978
+ var opSide = isVertical ? 'bottom' : 'right';
1979
+ var arrowSize = getOuterSizes(arrow)[len];
1980
+
1981
+ //
1982
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
1983
+ //
1984
+
1985
+ // top/left side
1986
+ if (reference[opSide] - arrowSize < popper[side]) {
1987
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
1988
+ }
1989
+ // bottom/right side
1990
+ if (reference[side] + arrowSize > popper[opSide]) {
1991
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
1992
+ }
1993
+
1994
+ // compute center of the popper
1995
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
1996
+
1997
+ var sideValue = center - popper[side];
1998
+
1999
+ // prevent arrow from being placed not contiguously to its popper
2000
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
2001
+ arrowStyle[side] = sideValue;
2002
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
2003
+
2004
+ data.offsets.arrow = arrowStyle;
2005
+ data.arrowElement = arrow;
2006
+
2007
+ return data;
2008
+ };
2009
+
2010
+ //
2011
+ // Helpers
2012
+ //
2013
+
2014
+ /**
2015
+ * Get the outer sizes of the given element (offset size + margins)
2016
+ * @function
2017
+ * @ignore
2018
+ * @argument {Element} element
2019
+ * @returns {Object} object containing width and height properties
2020
+ */
2021
+ function getOuterSizes(element) {
2022
+ // NOTE: 1 DOM access here
2023
+ var _display = element.style.display,
2024
+ _visibility = element.style.visibility;
2025
+ element.style.display = 'block';element.style.visibility = 'hidden';
2026
+ var calcWidthToForceRepaint = element.offsetWidth;
2027
+
2028
+ // original method
2029
+ var styles = root.getComputedStyle(element);
2030
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
2031
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
2032
+ var result = { width: element.offsetWidth + y, height: element.offsetHeight + x };
2033
+
2034
+ // reset element styles
2035
+ element.style.display = _display;element.style.visibility = _visibility;
2036
+ return result;
2037
+ }
2038
+
2039
+ /**
2040
+ * Get the opposite placement of the given one/
2041
+ * @function
2042
+ * @ignore
2043
+ * @argument {String} placement
2044
+ * @returns {String} flipped placement
2045
+ */
2046
+ function getOppositePlacement(placement) {
2047
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
2048
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
2049
+ return hash[matched];
2050
+ });
2051
+ }
2052
+
2053
+ /**
2054
+ * Given the popper offsets, generate an output similar to getBoundingClientRect
2055
+ * @function
2056
+ * @ignore
2057
+ * @argument {Object} popperOffsets
2058
+ * @returns {Object} ClientRect like output
2059
+ */
2060
+ function getPopperClientRect(popperOffsets) {
2061
+ var offsets = Object.assign({}, popperOffsets);
2062
+ offsets.right = offsets.left + offsets.width;
2063
+ offsets.bottom = offsets.top + offsets.height;
2064
+ return offsets;
2065
+ }
2066
+
2067
+ /**
2068
+ * Given an array and the key to find, returns its index
2069
+ * @function
2070
+ * @ignore
2071
+ * @argument {Array} arr
2072
+ * @argument keyToFind
2073
+ * @returns index or null
2074
+ */
2075
+ function getArrayKeyIndex(arr, keyToFind) {
2076
+ var i = 0,
2077
+ key;
2078
+ for (key in arr) {
2079
+ if (arr[key] === keyToFind) {
2080
+ return i;
2081
+ }
2082
+ i++;
2083
+ }
2084
+ return null;
2085
+ }
2086
+
2087
+ /**
2088
+ * Get CSS computed property of the given element
2089
+ * @function
2090
+ * @ignore
2091
+ * @argument {Eement} element
2092
+ * @argument {String} property
2093
+ */
2094
+ function getStyleComputedProperty(element, property) {
2095
+ // NOTE: 1 DOM access here
2096
+ var css = root.getComputedStyle(element, null);
2097
+ return css[property];
2098
+ }
2099
+
2100
+ /**
2101
+ * Returns the offset parent of the given element
2102
+ * @function
2103
+ * @ignore
2104
+ * @argument {Element} element
2105
+ * @returns {Element} offset parent
2106
+ */
2107
+ function getOffsetParent(element) {
2108
+ // NOTE: 1 DOM access here
2109
+ var offsetParent = element.offsetParent;
2110
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
2111
+ }
2112
+
2113
+ /**
2114
+ * Returns the scrolling parent of the given element
2115
+ * @function
2116
+ * @ignore
2117
+ * @argument {Element} element
2118
+ * @returns {Element} offset parent
2119
+ */
2120
+ function getScrollParent(element) {
2121
+ var parent = element.parentNode;
2122
+
2123
+ if (!parent) {
2124
+ return element;
2125
+ }
2126
+
2127
+ if (parent === root.document) {
2128
+ // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
2129
+ // greater than 0 and return the proper element
2130
+ if (root.document.body.scrollTop || root.document.body.scrollLeft) {
2131
+ return root.document.body;
2132
+ } else {
2133
+ return root.document.documentElement;
2134
+ }
2135
+ }
2136
+
2137
+ // Firefox want us to check `-x` and `-y` variations as well
2138
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
2139
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
2140
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
2141
+ // fixes issue #65
2142
+ return parent;
2143
+ }
2144
+ return getScrollParent(element.parentNode);
2145
+ }
2146
+
2147
+ /**
2148
+ * Check if the given element is fixed or is inside a fixed parent
2149
+ * @function
2150
+ * @ignore
2151
+ * @argument {Element} element
2152
+ * @argument {Element} customContainer
2153
+ * @returns {Boolean} answer to "isFixed?"
2154
+ */
2155
+ function isFixed(element) {
2156
+ if (element === root.document.body) {
2157
+ return false;
2158
+ }
2159
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
2160
+ return true;
2161
+ }
2162
+ return element.parentNode ? isFixed(element.parentNode) : element;
2163
+ }
2164
+
2165
+ /**
2166
+ * Set the style to the given popper
2167
+ * @function
2168
+ * @ignore
2169
+ * @argument {Element} element - Element to apply the style to
2170
+ * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
2171
+ */
2172
+ function setStyle(element, styles) {
2173
+ function is_numeric(n) {
2174
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
2175
+ }
2176
+ Object.keys(styles).forEach(function (prop) {
2177
+ var unit = '';
2178
+ // add unit if the value is numeric and is one of the following
2179
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
2180
+ unit = 'px';
2181
+ }
2182
+ element.style[prop] = styles[prop] + unit;
2183
+ });
2184
+ }
2185
+
2186
+ /**
2187
+ * Check if the given variable is a function
2188
+ * @function
2189
+ * @ignore
2190
+ * @argument {*} functionToCheck - variable to check
2191
+ * @returns {Boolean} answer to: is a function?
2192
+ */
2193
+ function isFunction(functionToCheck) {
2194
+ var getType = {};
2195
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
2196
+ }
2197
+
2198
+ /**
2199
+ * Get the position of the given element, relative to its offset parent
2200
+ * @function
2201
+ * @ignore
2202
+ * @param {Element} element
2203
+ * @return {Object} position - Coordinates of the element and its `scrollTop`
2204
+ */
2205
+ function getOffsetRect(element) {
2206
+ var elementRect = {
2207
+ width: element.offsetWidth,
2208
+ height: element.offsetHeight,
2209
+ left: element.offsetLeft,
2210
+ top: element.offsetTop
2211
+ };
2212
+
2213
+ elementRect.right = elementRect.left + elementRect.width;
2214
+ elementRect.bottom = elementRect.top + elementRect.height;
2215
+
2216
+ // position
2217
+ return elementRect;
2218
+ }
2219
+
2220
+ /**
2221
+ * Get bounding client rect of given element
2222
+ * @function
2223
+ * @ignore
2224
+ * @param {HTMLElement} element
2225
+ * @return {Object} client rect
2226
+ */
2227
+ function getBoundingClientRect(element) {
2228
+ var rect = element.getBoundingClientRect();
2229
+
2230
+ // whether the IE version is lower than 11
2231
+ var isIE = navigator.userAgent.indexOf("MSIE") != -1;
2232
+
2233
+ // fix ie document bounding top always 0 bug
2234
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
2235
+
2236
+ return {
2237
+ left: rect.left,
2238
+ top: rectTop,
2239
+ right: rect.right,
2240
+ bottom: rect.bottom,
2241
+ width: rect.right - rect.left,
2242
+ height: rect.bottom - rectTop
2243
+ };
2244
+ }
2245
+
2246
+ /**
2247
+ * Given an element and one of its parents, return the offset
2248
+ * @function
2249
+ * @ignore
2250
+ * @param {HTMLElement} element
2251
+ * @param {HTMLElement} parent
2252
+ * @return {Object} rect
2253
+ */
2254
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
2255
+ var elementRect = getBoundingClientRect(element);
2256
+ var parentRect = getBoundingClientRect(parent);
2257
+
2258
+ if (fixed) {
2259
+ var scrollParent = getScrollParent(parent);
2260
+ parentRect.top += scrollParent.scrollTop;
2261
+ parentRect.bottom += scrollParent.scrollTop;
2262
+ parentRect.left += scrollParent.scrollLeft;
2263
+ parentRect.right += scrollParent.scrollLeft;
2264
+ }
2265
+
2266
+ var rect = {
2267
+ top: elementRect.top - parentRect.top,
2268
+ left: elementRect.left - parentRect.left,
2269
+ bottom: elementRect.top - parentRect.top + elementRect.height,
2270
+ right: elementRect.left - parentRect.left + elementRect.width,
2271
+ width: elementRect.width,
2272
+ height: elementRect.height
2273
+ };
2274
+ return rect;
2275
+ }
2276
+
2277
+ /**
2278
+ * Get the prefixed supported property name
2279
+ * @function
2280
+ * @ignore
2281
+ * @argument {String} property (camelCase)
2282
+ * @returns {String} prefixed property (camelCase)
2283
+ */
2284
+ function getSupportedPropertyName(property) {
2285
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
2286
+
2287
+ for (var i = 0; i < prefixes.length; i++) {
2288
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
2289
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
2290
+ return toCheck;
2291
+ }
2292
+ }
2293
+ return null;
2294
+ }
2295
+
2296
+ /**
2297
+ * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
2298
+ * objects to a target object. It will return the target object.
2299
+ * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
2300
+ * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
2301
+ * @function
2302
+ * @ignore
2303
+ */
2304
+ if (!Object.assign) {
2305
+ Object.defineProperty(Object, 'assign', {
2306
+ enumerable: false,
2307
+ configurable: true,
2308
+ writable: true,
2309
+ value: function value(target) {
2310
+ if (target === undefined || target === null) {
2311
+ throw new TypeError('Cannot convert first argument to object');
2312
+ }
2313
+
2314
+ var to = Object(target);
2315
+ for (var i = 1; i < arguments.length; i++) {
2316
+ var nextSource = arguments[i];
2317
+ if (nextSource === undefined || nextSource === null) {
2318
+ continue;
2319
+ }
2320
+ nextSource = Object(nextSource);
2321
+
2322
+ var keysArray = Object.keys(nextSource);
2323
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
2324
+ var nextKey = keysArray[nextIndex];
2325
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
2326
+ if (desc !== undefined && desc.enumerable) {
2327
+ to[nextKey] = nextSource[nextKey];
2328
+ }
2329
+ }
2330
+ }
2331
+ return to;
2332
+ }
2333
+ });
2334
+ }
2335
+
2336
+ return Popper;
2337
+ });
2338
+
2339
+ /***/ }),
2340
+
2341
+ /***/ 40:
2342
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2343
+
2344
+ "use strict";
2345
+ /* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
2346
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2347
+
2348
+
2349
+
2350
+ var Transition = function () {
2351
+ function Transition() {
2352
+ _classCallCheck(this, Transition);
2353
+ }
2354
+
2355
+ Transition.prototype.beforeEnter = function beforeEnter(el) {
2356
+ Object(_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
2357
+ if (!el.dataset) el.dataset = {};
2358
+
2359
+ el.dataset.oldPaddingTop = el.style.paddingTop;
2360
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
2361
+
2362
+ el.style.height = '0';
2363
+ el.style.paddingTop = 0;
2364
+ el.style.paddingBottom = 0;
2365
+ };
2366
+
2367
+ Transition.prototype.enter = function enter(el) {
2368
+ el.dataset.oldOverflow = el.style.overflow;
2369
+ if (el.scrollHeight !== 0) {
2370
+ el.style.height = el.scrollHeight + 'px';
2371
+ el.style.paddingTop = el.dataset.oldPaddingTop;
2372
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
2373
+ } else {
2374
+ el.style.height = '';
2375
+ el.style.paddingTop = el.dataset.oldPaddingTop;
2376
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
2377
+ }
2378
+
2379
+ el.style.overflow = 'hidden';
2380
+ };
2381
+
2382
+ Transition.prototype.afterEnter = function afterEnter(el) {
2383
+ // for safari: remove class then reset height is necessary
2384
+ Object(_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
2385
+ el.style.height = '';
2386
+ el.style.overflow = el.dataset.oldOverflow;
2387
+ };
2388
+
2389
+ Transition.prototype.beforeLeave = function beforeLeave(el) {
2390
+ if (!el.dataset) el.dataset = {};
2391
+ el.dataset.oldPaddingTop = el.style.paddingTop;
2392
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
2393
+ el.dataset.oldOverflow = el.style.overflow;
2394
+
2395
+ el.style.height = el.scrollHeight + 'px';
2396
+ el.style.overflow = 'hidden';
2397
+ };
2398
+
2399
+ Transition.prototype.leave = function leave(el) {
2400
+ if (el.scrollHeight !== 0) {
2401
+ // for safari: add class after set height, or it will jump to zero height suddenly, weired
2402
+ Object(_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
2403
+ el.style.height = 0;
2404
+ el.style.paddingTop = 0;
2405
+ el.style.paddingBottom = 0;
2406
+ }
2407
+ };
2408
+
2409
+ Transition.prototype.afterLeave = function afterLeave(el) {
2410
+ Object(_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
2411
+ el.style.height = '';
2412
+ el.style.overflow = el.dataset.oldOverflow;
2413
+ el.style.paddingTop = el.dataset.oldPaddingTop;
2414
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
2415
+ };
2416
+
2417
+ return Transition;
2418
+ }();
2419
+
2420
+ /* harmony default export */ __webpack_exports__["a"] = ({
2421
+ name: 'ElCollapseTransition',
2422
+ functional: true,
2423
+ render: function render(h, _ref) {
2424
+ var children = _ref.children;
2425
+
2426
+ var data = {
2427
+ on: new Transition()
2428
+ };
2429
+
2430
+ return h('transition', data, children);
2431
+ }
2432
+ });
637
2433
 
638
- /***/ 37:
2434
+ /***/ }),
2435
+
2436
+ /***/ 48:
639
2437
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
640
2438
 
641
2439
  "use strict";
@@ -683,17 +2481,540 @@ module.exports = require("cy-element-ui/lib/transitions/collapse-transition");
683
2481
 
684
2482
  /***/ }),
685
2483
 
686
- /***/ 4:
687
- /***/ (function(module, exports) {
2484
+ /***/ 6:
2485
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
688
2486
 
689
- module.exports = require("cy-element-ui/lib/mixins/emitter");
2487
+ "use strict";
2488
+ function _broadcast(componentName, eventName, params) {
2489
+ this.$children.forEach(function (child) {
2490
+ var name = child.$options.componentName;
2491
+
2492
+ if (name === componentName) {
2493
+ child.$emit.apply(child, [eventName].concat(params));
2494
+ } else {
2495
+ _broadcast.apply(child, [componentName, eventName].concat([params]));
2496
+ }
2497
+ });
2498
+ }
2499
+ /* harmony default export */ __webpack_exports__["a"] = ({
2500
+ methods: {
2501
+ dispatch: function dispatch(componentName, eventName, params) {
2502
+ var parent = this.$parent || this.$root;
2503
+ var name = parent.$options.componentName;
2504
+
2505
+ while (parent && (!name || name !== componentName)) {
2506
+ parent = parent.$parent;
2507
+
2508
+ if (parent) {
2509
+ name = parent.$options.componentName;
2510
+ }
2511
+ }
2512
+ if (parent) {
2513
+ parent.$emit.apply(parent, [eventName].concat(params));
2514
+ }
2515
+ },
2516
+ broadcast: function broadcast(componentName, eventName, params) {
2517
+ _broadcast.call(this, componentName, eventName, params);
2518
+ }
2519
+ }
2520
+ });
690
2521
 
691
2522
  /***/ }),
692
2523
 
693
- /***/ 5:
694
- /***/ (function(module, exports) {
2524
+ /***/ 7:
2525
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2526
+
2527
+ "use strict";
2528
+ /* harmony default export */ __webpack_exports__["a"] = (function (target) {
2529
+ for (var i = 1, j = arguments.length; i < j; i++) {
2530
+ var source = arguments[i] || {};
2531
+ for (var prop in source) {
2532
+ if (source.hasOwnProperty(prop)) {
2533
+ var value = source[prop];
2534
+ if (value !== undefined) {
2535
+ target[prop] = value;
2536
+ }
2537
+ }
2538
+ }
2539
+ }
2540
+
2541
+ return target;
2542
+ });;
2543
+
2544
+ /***/ }),
2545
+
2546
+ /***/ 8:
2547
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2548
+
2549
+ "use strict";
2550
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
2551
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
2552
+
2553
+
2554
+ var scrollBarWidth = void 0;
2555
+
2556
+ /* harmony default export */ __webpack_exports__["a"] = (function () {
2557
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return 0;
2558
+ if (scrollBarWidth !== undefined) return scrollBarWidth;
2559
+
2560
+ var outer = document.createElement('div');
2561
+ outer.className = 'el-scrollbar__wrap';
2562
+ outer.style.visibility = 'hidden';
2563
+ outer.style.width = '100px';
2564
+ outer.style.position = 'absolute';
2565
+ outer.style.top = '-9999px';
2566
+ document.body.appendChild(outer);
2567
+
2568
+ var widthNoScroll = outer.offsetWidth;
2569
+ outer.style.overflow = 'scroll';
2570
+
2571
+ var inner = document.createElement('div');
2572
+ inner.style.width = '100%';
2573
+ outer.appendChild(inner);
2574
+
2575
+ var widthWithScroll = inner.offsetWidth;
2576
+ outer.parentNode.removeChild(outer);
2577
+ scrollBarWidth = widthNoScroll - widthWithScroll;
2578
+
2579
+ return scrollBarWidth;
2580
+ });;
2581
+
2582
+ /***/ }),
2583
+
2584
+ /***/ 9:
2585
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2586
+
2587
+ "use strict";
2588
+
2589
+ // EXPORTS
2590
+ __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ popup_manager; });
2591
+
2592
+ // EXTERNAL MODULE: external "vue"
2593
+ var external_vue_ = __webpack_require__(0);
2594
+ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
2595
+
2596
+ // EXTERNAL MODULE: ./src/utils/merge.js
2597
+ var merge = __webpack_require__(7);
2598
+
2599
+ // EXTERNAL MODULE: ./src/utils/dom.js
2600
+ var utils_dom = __webpack_require__(1);
2601
+
2602
+ // CONCATENATED MODULE: ./src/utils/popup/popup-manager.js
2603
+
2604
+
2605
+
2606
+ var hasModal = false;
2607
+ var hasInitZIndex = false;
2608
+ var popup_manager_zIndex = void 0;
2609
+
2610
+ var popup_manager_getModal = function getModal() {
2611
+ if (external_vue_default.a.prototype.$isServer) return;
2612
+ var modalDom = PopupManager.modalDom;
2613
+ if (modalDom) {
2614
+ hasModal = true;
2615
+ } else {
2616
+ hasModal = false;
2617
+ modalDom = document.createElement('div');
2618
+ PopupManager.modalDom = modalDom;
2619
+
2620
+ modalDom.addEventListener('touchmove', function (event) {
2621
+ event.preventDefault();
2622
+ event.stopPropagation();
2623
+ });
2624
+
2625
+ modalDom.addEventListener('click', function () {
2626
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
2627
+ });
2628
+ }
2629
+
2630
+ return modalDom;
2631
+ };
2632
+
2633
+ var instances = {};
2634
+
2635
+ var PopupManager = {
2636
+ modalFade: true,
2637
+
2638
+ getInstance: function getInstance(id) {
2639
+ return instances[id];
2640
+ },
2641
+
2642
+ register: function register(id, instance) {
2643
+ if (id && instance) {
2644
+ instances[id] = instance;
2645
+ }
2646
+ },
2647
+
2648
+ deregister: function deregister(id) {
2649
+ if (id) {
2650
+ instances[id] = null;
2651
+ delete instances[id];
2652
+ }
2653
+ },
2654
+
2655
+ nextZIndex: function nextZIndex() {
2656
+ return PopupManager.zIndex++;
2657
+ },
2658
+
2659
+ modalStack: [],
2660
+
2661
+ doOnModalClick: function doOnModalClick() {
2662
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
2663
+ if (!topItem) return;
2664
+
2665
+ var instance = PopupManager.getInstance(topItem.id);
2666
+ if (instance && instance.closeOnClickModal) {
2667
+ instance.close();
2668
+ }
2669
+ },
2670
+
2671
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
2672
+ if (external_vue_default.a.prototype.$isServer) return;
2673
+ if (!id || zIndex === undefined) return;
2674
+ this.modalFade = modalFade;
2675
+
2676
+ var modalStack = this.modalStack;
2677
+
2678
+ for (var i = 0, j = modalStack.length; i < j; i++) {
2679
+ var item = modalStack[i];
2680
+ if (item.id === id) {
2681
+ return;
2682
+ }
2683
+ }
2684
+
2685
+ var modalDom = popup_manager_getModal();
2686
+
2687
+ Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal');
2688
+ if (this.modalFade && !hasModal) {
2689
+ Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal-enter');
2690
+ }
2691
+ if (modalClass) {
2692
+ var classArr = modalClass.trim().split(/\s+/);
2693
+ classArr.forEach(function (item) {
2694
+ return Object(utils_dom["a" /* addClass */])(modalDom, item);
2695
+ });
2696
+ }
2697
+ setTimeout(function () {
2698
+ Object(utils_dom["i" /* removeClass */])(modalDom, 'v-modal-enter');
2699
+ }, 200);
2700
+
2701
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
2702
+ dom.parentNode.appendChild(modalDom);
2703
+ } else {
2704
+ document.body.appendChild(modalDom);
2705
+ }
2706
+
2707
+ if (zIndex) {
2708
+ modalDom.style.zIndex = zIndex;
2709
+ }
2710
+ modalDom.tabIndex = 0;
2711
+ modalDom.style.display = '';
2712
+
2713
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
2714
+ },
2715
+
2716
+ closeModal: function closeModal(id) {
2717
+ var modalStack = this.modalStack;
2718
+ var modalDom = popup_manager_getModal();
2719
+
2720
+ if (modalStack.length > 0) {
2721
+ var topItem = modalStack[modalStack.length - 1];
2722
+ if (topItem.id === id) {
2723
+ if (topItem.modalClass) {
2724
+ var classArr = topItem.modalClass.trim().split(/\s+/);
2725
+ classArr.forEach(function (item) {
2726
+ return Object(utils_dom["i" /* removeClass */])(modalDom, item);
2727
+ });
2728
+ }
2729
+
2730
+ modalStack.pop();
2731
+ if (modalStack.length > 0) {
2732
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
2733
+ }
2734
+ } else {
2735
+ for (var i = modalStack.length - 1; i >= 0; i--) {
2736
+ if (modalStack[i].id === id) {
2737
+ modalStack.splice(i, 1);
2738
+ break;
2739
+ }
2740
+ }
2741
+ }
2742
+ }
2743
+
2744
+ if (modalStack.length === 0) {
2745
+ if (this.modalFade) {
2746
+ Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal-leave');
2747
+ }
2748
+ setTimeout(function () {
2749
+ if (modalStack.length === 0) {
2750
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
2751
+ modalDom.style.display = 'none';
2752
+ PopupManager.modalDom = undefined;
2753
+ }
2754
+ Object(utils_dom["i" /* removeClass */])(modalDom, 'v-modal-leave');
2755
+ }, 200);
2756
+ }
2757
+ }
2758
+ };
2759
+
2760
+ Object.defineProperty(PopupManager, 'zIndex', {
2761
+ configurable: true,
2762
+ get: function get() {
2763
+ if (!hasInitZIndex) {
2764
+ popup_manager_zIndex = popup_manager_zIndex || (external_vue_default.a.prototype.$ELEMENT || {}).zIndex || 2000;
2765
+ hasInitZIndex = true;
2766
+ }
2767
+ return popup_manager_zIndex;
2768
+ },
2769
+ set: function set(value) {
2770
+ popup_manager_zIndex = value;
2771
+ }
2772
+ });
2773
+
2774
+ var popup_manager_getTopPopup = function getTopPopup() {
2775
+ if (external_vue_default.a.prototype.$isServer) return;
2776
+ if (PopupManager.modalStack.length > 0) {
2777
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
2778
+ if (!topPopup) return;
2779
+ var instance = PopupManager.getInstance(topPopup.id);
2780
+
2781
+ return instance;
2782
+ }
2783
+ };
2784
+
2785
+ if (!external_vue_default.a.prototype.$isServer) {
2786
+ // handle `esc` key when the popup is shown
2787
+ window.addEventListener('keydown', function (event) {
2788
+ if (event.keyCode === 27) {
2789
+ var topPopup = popup_manager_getTopPopup();
2790
+
2791
+ if (topPopup && topPopup.closeOnPressEscape) {
2792
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
2793
+ }
2794
+ }
2795
+ });
2796
+ }
2797
+
2798
+ /* harmony default export */ var popup_manager = (PopupManager);
2799
+ // EXTERNAL MODULE: ./src/utils/scrollbar-width.js
2800
+ var scrollbar_width = __webpack_require__(8);
2801
+
2802
+ // CONCATENATED MODULE: ./src/utils/popup/index.js
2803
+
2804
+
2805
+
2806
+
2807
+
2808
+
2809
+ var idSeed = 1;
2810
+
2811
+ var scrollBarWidth = void 0;
2812
+
2813
+ /* harmony default export */ var popup = __webpack_exports__["b"] = ({
2814
+ props: {
2815
+ visible: {
2816
+ type: Boolean,
2817
+ default: false
2818
+ },
2819
+ openDelay: {},
2820
+ closeDelay: {},
2821
+ zIndex: {},
2822
+ modal: {
2823
+ type: Boolean,
2824
+ default: false
2825
+ },
2826
+ modalFade: {
2827
+ type: Boolean,
2828
+ default: true
2829
+ },
2830
+ modalClass: {},
2831
+ modalAppendToBody: {
2832
+ type: Boolean,
2833
+ default: false
2834
+ },
2835
+ lockScroll: {
2836
+ type: Boolean,
2837
+ default: true
2838
+ },
2839
+ closeOnPressEscape: {
2840
+ type: Boolean,
2841
+ default: false
2842
+ },
2843
+ closeOnClickModal: {
2844
+ type: Boolean,
2845
+ default: false
2846
+ }
2847
+ },
2848
+
2849
+ beforeMount: function beforeMount() {
2850
+ this._popupId = 'popup-' + idSeed++;
2851
+ popup_manager.register(this._popupId, this);
2852
+ },
2853
+ beforeDestroy: function beforeDestroy() {
2854
+ popup_manager.deregister(this._popupId);
2855
+ popup_manager.closeModal(this._popupId);
2856
+
2857
+ this.restoreBodyStyle();
2858
+ },
2859
+ data: function data() {
2860
+ return {
2861
+ opened: false,
2862
+ bodyPaddingRight: null,
2863
+ computedBodyPaddingRight: 0,
2864
+ withoutHiddenClass: true,
2865
+ rendered: false
2866
+ };
2867
+ },
2868
+
2869
+
2870
+ watch: {
2871
+ visible: function visible(val) {
2872
+ var _this = this;
2873
+
2874
+ if (val) {
2875
+ if (this._opening) return;
2876
+ if (!this.rendered) {
2877
+ this.rendered = true;
2878
+ external_vue_default.a.nextTick(function () {
2879
+ _this.open();
2880
+ });
2881
+ } else {
2882
+ this.open();
2883
+ }
2884
+ } else {
2885
+ this.close();
2886
+ }
2887
+ }
2888
+ },
2889
+
2890
+ methods: {
2891
+ open: function open(options) {
2892
+ var _this2 = this;
2893
+
2894
+ if (!this.rendered) {
2895
+ this.rendered = true;
2896
+ }
2897
+
2898
+ var props = Object(merge["a" /* default */])({}, this.$props || this, options);
2899
+
2900
+ if (this._closeTimer) {
2901
+ clearTimeout(this._closeTimer);
2902
+ this._closeTimer = null;
2903
+ }
2904
+ clearTimeout(this._openTimer);
2905
+
2906
+ var openDelay = Number(props.openDelay);
2907
+ if (openDelay > 0) {
2908
+ this._openTimer = setTimeout(function () {
2909
+ _this2._openTimer = null;
2910
+ _this2.doOpen(props);
2911
+ }, openDelay);
2912
+ } else {
2913
+ this.doOpen(props);
2914
+ }
2915
+ },
2916
+ doOpen: function doOpen(props) {
2917
+ if (this.$isServer) return;
2918
+ if (this.willOpen && !this.willOpen()) return;
2919
+ if (this.opened) return;
2920
+
2921
+ this._opening = true;
2922
+
2923
+ var dom = this.$el;
2924
+
2925
+ var modal = props.modal;
2926
+
2927
+ var zIndex = props.zIndex;
2928
+ if (zIndex) {
2929
+ popup_manager.zIndex = zIndex;
2930
+ }
2931
+
2932
+ if (modal) {
2933
+ if (this._closing) {
2934
+ popup_manager.closeModal(this._popupId);
2935
+ this._closing = false;
2936
+ }
2937
+ popup_manager.openModal(this._popupId, popup_manager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
2938
+ if (props.lockScroll) {
2939
+ this.withoutHiddenClass = !Object(utils_dom["d" /* hasClass */])(document.body, 'el-popup-parent--hidden');
2940
+ if (this.withoutHiddenClass) {
2941
+ this.bodyPaddingRight = document.body.style.paddingRight;
2942
+ this.computedBodyPaddingRight = parseInt(Object(utils_dom["c" /* getStyle */])(document.body, 'paddingRight'), 10);
2943
+ }
2944
+ scrollBarWidth = Object(scrollbar_width["a" /* default */])();
2945
+ var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
2946
+ var bodyOverflowY = Object(utils_dom["c" /* getStyle */])(document.body, 'overflowY');
2947
+ if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
2948
+ document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
2949
+ }
2950
+ Object(utils_dom["a" /* addClass */])(document.body, 'el-popup-parent--hidden');
2951
+ }
2952
+ }
2953
+
2954
+ if (getComputedStyle(dom).position === 'static') {
2955
+ dom.style.position = 'absolute';
2956
+ }
2957
+
2958
+ dom.style.zIndex = popup_manager.nextZIndex();
2959
+ this.opened = true;
2960
+
2961
+ this.onOpen && this.onOpen();
2962
+
2963
+ this.doAfterOpen();
2964
+ },
2965
+ doAfterOpen: function doAfterOpen() {
2966
+ this._opening = false;
2967
+ },
2968
+ close: function close() {
2969
+ var _this3 = this;
2970
+
2971
+ if (this.willClose && !this.willClose()) return;
2972
+
2973
+ if (this._openTimer !== null) {
2974
+ clearTimeout(this._openTimer);
2975
+ this._openTimer = null;
2976
+ }
2977
+ clearTimeout(this._closeTimer);
2978
+
2979
+ var closeDelay = Number(this.closeDelay);
2980
+
2981
+ if (closeDelay > 0) {
2982
+ this._closeTimer = setTimeout(function () {
2983
+ _this3._closeTimer = null;
2984
+ _this3.doClose();
2985
+ }, closeDelay);
2986
+ } else {
2987
+ this.doClose();
2988
+ }
2989
+ },
2990
+ doClose: function doClose() {
2991
+ this._closing = true;
2992
+
2993
+ this.onClose && this.onClose();
2994
+
2995
+ if (this.lockScroll) {
2996
+ setTimeout(this.restoreBodyStyle, 200);
2997
+ }
2998
+
2999
+ this.opened = false;
3000
+
3001
+ this.doAfterClose();
3002
+ },
3003
+ doAfterClose: function doAfterClose() {
3004
+ popup_manager.closeModal(this._popupId);
3005
+ this._closing = false;
3006
+ },
3007
+ restoreBodyStyle: function restoreBodyStyle() {
3008
+ if (this.modal && this.withoutHiddenClass) {
3009
+ document.body.style.paddingRight = this.bodyPaddingRight;
3010
+ Object(utils_dom["i" /* removeClass */])(document.body, 'el-popup-parent--hidden');
3011
+ }
3012
+ this.withoutHiddenClass = true;
3013
+ }
3014
+ }
3015
+ });
3016
+
695
3017
 
696
- module.exports = require("cy-element-ui/lib/utils/vue-popper");
697
3018
 
698
3019
  /***/ })
699
3020