cy-element-ui 1.0.72 → 1.0.74

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 (112) 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 +26236 -13298
  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 +420 -30
  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/packages/form/src/form-item.vue +3 -3
  112. package/src/index.js +1 -1
package/lib/tooltip.js CHANGED
@@ -82,34 +82,2042 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 146);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 37);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
89
89
 
90
- /***/ 146:
90
+ /***/ 0:
91
+ /***/ (function(module, exports) {
92
+
93
+ module.exports = require("vue");
94
+
95
+ /***/ }),
96
+
97
+ /***/ 1:
98
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
99
+
100
+ "use strict";
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; };
115
+
116
+ /* istanbul ignore next */
117
+
118
+
119
+
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);
124
+
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
+ };
135
+
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
+ }();
152
+
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
+ }();
169
+
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
+ }
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
+ });
539
+
540
+ /***/ }),
541
+
542
+ /***/ 22:
543
+ /***/ (function(module, exports) {
544
+
545
+ module.exports = require("throttle-debounce/debounce");
546
+
547
+ /***/ }),
548
+
549
+ /***/ 23:
550
+ /***/ (function(module, exports, __webpack_require__) {
551
+
552
+ 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; };
553
+
554
+ /**
555
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
556
+ * @version {{version}}
557
+ * @license
558
+ * Copyright (c) 2016 Federico Zivolo and contributors
559
+ *
560
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
561
+ * of this software and associated documentation files (the "Software"), to deal
562
+ * in the Software without restriction, including without limitation the rights
563
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
564
+ * copies of the Software, and to permit persons to whom the Software is
565
+ * furnished to do so, subject to the following conditions:
566
+ *
567
+ * The above copyright notice and this permission notice shall be included in all
568
+ * copies or substantial portions of the Software.
569
+ *
570
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
571
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
572
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
573
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
574
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
575
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
576
+ * SOFTWARE.
577
+ */
578
+
579
+ //
580
+ // Cross module loader
581
+ // Supported: Node, AMD, Browser globals
582
+ //
583
+ ;(function (root, factory) {
584
+ if (true) {
585
+ // AMD. Register as an anonymous module.
586
+ !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
587
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
588
+ (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
589
+ __WEBPACK_AMD_DEFINE_FACTORY__),
590
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
591
+ } else {}
592
+ })(this, function () {
593
+
594
+ 'use strict';
595
+
596
+ var root = window;
597
+
598
+ // default options
599
+ var DEFAULTS = {
600
+ // placement of the popper
601
+ placement: 'bottom',
602
+
603
+ gpuAcceleration: true,
604
+
605
+ // shift popper from its origin by the given amount of pixels (can be negative)
606
+ offset: 0,
607
+
608
+ // the element which will act as boundary of the popper
609
+ boundariesElement: 'viewport',
610
+
611
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
612
+ boundariesPadding: 5,
613
+
614
+ // popper will try to prevent overflow following this order,
615
+ // by default, then, it could overflow on the left and on top of the boundariesElement
616
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
617
+
618
+ // the behavior used by flip to change the placement of the popper
619
+ flipBehavior: 'flip',
620
+
621
+ arrowElement: '[x-arrow]',
622
+
623
+ arrowOffset: 0,
624
+
625
+ // list of functions used to modify the offsets before they are applied to the popper
626
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
627
+
628
+ modifiersIgnored: [],
629
+
630
+ forceAbsolute: false
631
+ };
632
+
633
+ /**
634
+ * Create a new Popper.js instance
635
+ * @constructor Popper
636
+ * @param {HTMLElement} reference - The reference element used to position the popper
637
+ * @param {HTMLElement|Object} popper
638
+ * The HTML element used as popper, or a configuration used to generate the popper.
639
+ * @param {String} [popper.tagName='div'] The tag name of the generated popper.
640
+ * @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
641
+ * @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
642
+ * @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
643
+ * @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`.
644
+ * @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
645
+ * @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
646
+ * @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
647
+ * @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
648
+ * @param {Object} options
649
+ * @param {String} [options.placement=bottom]
650
+ * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
651
+ * left(-start, -end)`
652
+ *
653
+ * @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
654
+ * The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
655
+ * its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
656
+ * reference element.
657
+ * By default, it will look for a child node of the popper with the `x-arrow` attribute.
658
+ *
659
+ * @param {Boolean} [options.gpuAcceleration=true]
660
+ * When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
661
+ * browser to use the GPU to accelerate the rendering.
662
+ * If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
663
+ *
664
+ * @param {Number} [options.offset=0]
665
+ * Amount of pixels the popper will be shifted (can be negative).
666
+ *
667
+ * @param {String|Element} [options.boundariesElement='viewport']
668
+ * The element which will define the boundaries of the popper position, the popper will never be placed outside
669
+ * of the defined boundaries (except if `keepTogether` is enabled)
670
+ *
671
+ * @param {Number} [options.boundariesPadding=5]
672
+ * Additional padding for the boundaries
673
+ *
674
+ * @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
675
+ * Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
676
+ * this means that the last ones will never overflow
677
+ *
678
+ * @param {String|Array} [options.flipBehavior='flip']
679
+ * The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
680
+ * overlap its reference element. Defining `flip` as value, the placement will be flipped on
681
+ * its axis (`right - left`, `top - bottom`).
682
+ * You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
683
+ * how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
684
+ * then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
685
+ *
686
+ * @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
687
+ * List of functions used to modify the data before they are applied to the popper, add your custom functions
688
+ * to this array to edit the offsets and placement.
689
+ * The function should reflect the @params and @returns of preventOverflow
690
+ *
691
+ * @param {Array} [options.modifiersIgnored=[]]
692
+ * Put here any built-in modifier name you want to exclude from the modifiers list
693
+ * The function should reflect the @params and @returns of preventOverflow
694
+ *
695
+ * @param {Boolean} [options.removeOnDestroy=false]
696
+ * Set to true if you want to automatically remove the popper when you call the `destroy` method.
697
+ */
698
+ function Popper(reference, popper, options) {
699
+ this._reference = reference.jquery ? reference[0] : reference;
700
+ this.state = {};
701
+
702
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
703
+ // generate a default popper if is not defined
704
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
705
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
706
+ if (isNotDefined || isConfig) {
707
+ this._popper = this.parse(isConfig ? popper : {});
708
+ }
709
+ // otherwise, use the given HTMLElement as popper
710
+ else {
711
+ this._popper = popper.jquery ? popper[0] : popper;
712
+ }
713
+
714
+ // with {} we create a new object with the options inside it
715
+ this._options = Object.assign({}, DEFAULTS, options);
716
+
717
+ // refactoring modifiers' list
718
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
719
+ // remove ignored modifiers
720
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
721
+
722
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
723
+ // margins needs to be calculated to get the correct popper offsets
724
+ if (modifier === 'applyStyle') {
725
+ this._popper.setAttribute('x-placement', this._options.placement);
726
+ }
727
+
728
+ // return predefined modifier identified by string or keep the custom one
729
+ return this.modifiers[modifier] || modifier;
730
+ }.bind(this));
731
+
732
+ // make sure to apply the popper position before any computation
733
+ this.state.position = this._getPosition(this._popper, this._reference);
734
+ setStyle(this._popper, { position: this.state.position, top: 0 });
735
+
736
+ // fire the first update to position the popper in the right place
737
+ this.update();
738
+
739
+ // setup event listeners, they will take care of update the position in specific situations
740
+ this._setupEventListeners();
741
+ return this;
742
+ }
743
+
744
+ //
745
+ // Methods
746
+ //
747
+ /**
748
+ * Destroy the popper
749
+ * @method
750
+ * @memberof Popper
751
+ */
752
+ Popper.prototype.destroy = function () {
753
+ this._popper.removeAttribute('x-placement');
754
+ this._popper.style.left = '';
755
+ this._popper.style.position = '';
756
+ this._popper.style.top = '';
757
+ this._popper.style[getSupportedPropertyName('transform')] = '';
758
+ this._removeEventListeners();
759
+
760
+ // remove the popper if user explicity asked for the deletion on destroy
761
+ if (this._options.removeOnDestroy) {
762
+ this._popper.remove();
763
+ }
764
+ return this;
765
+ };
766
+
767
+ /**
768
+ * Updates the position of the popper, computing the new offsets and applying the new style
769
+ * @method
770
+ * @memberof Popper
771
+ */
772
+ Popper.prototype.update = function () {
773
+ var data = { instance: this, styles: {} };
774
+
775
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
776
+ // and refer to _originalPlacement to know the original value
777
+ data.placement = this._options.placement;
778
+ data._originalPlacement = this._options.placement;
779
+
780
+ // compute the popper and reference offsets and put them inside data.offsets
781
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
782
+
783
+ // get boundaries
784
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
785
+
786
+ data = this.runModifiers(data, this._options.modifiers);
787
+
788
+ if (typeof this.state.updateCallback === 'function') {
789
+ this.state.updateCallback(data);
790
+ }
791
+ };
792
+
793
+ /**
794
+ * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
795
+ * @method
796
+ * @memberof Popper
797
+ * @param {Function} callback
798
+ */
799
+ Popper.prototype.onCreate = function (callback) {
800
+ // the createCallbacks return as first argument the popper instance
801
+ callback(this);
802
+ return this;
803
+ };
804
+
805
+ /**
806
+ * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
807
+ * used to style popper and its arrow.
808
+ * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
809
+ * @method
810
+ * @memberof Popper
811
+ * @param {Function} callback
812
+ */
813
+ Popper.prototype.onUpdate = function (callback) {
814
+ this.state.updateCallback = callback;
815
+ return this;
816
+ };
817
+
818
+ /**
819
+ * Helper used to generate poppers from a configuration file
820
+ * @method
821
+ * @memberof Popper
822
+ * @param config {Object} configuration
823
+ * @returns {HTMLElement} popper
824
+ */
825
+ Popper.prototype.parse = function (config) {
826
+ var defaultConfig = {
827
+ tagName: 'div',
828
+ classNames: ['popper'],
829
+ attributes: [],
830
+ parent: root.document.body,
831
+ content: '',
832
+ contentType: 'text',
833
+ arrowTagName: 'div',
834
+ arrowClassNames: ['popper__arrow'],
835
+ arrowAttributes: ['x-arrow']
836
+ };
837
+ config = Object.assign({}, defaultConfig, config);
838
+
839
+ var d = root.document;
840
+
841
+ var popper = d.createElement(config.tagName);
842
+ addClassNames(popper, config.classNames);
843
+ addAttributes(popper, config.attributes);
844
+ if (config.contentType === 'node') {
845
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
846
+ } else if (config.contentType === 'html') {
847
+ popper.innerHTML = config.content;
848
+ } else {
849
+ popper.textContent = config.content;
850
+ }
851
+
852
+ if (config.arrowTagName) {
853
+ var arrow = d.createElement(config.arrowTagName);
854
+ addClassNames(arrow, config.arrowClassNames);
855
+ addAttributes(arrow, config.arrowAttributes);
856
+ popper.appendChild(arrow);
857
+ }
858
+
859
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
860
+
861
+ // if the given parent is a string, use it to match an element
862
+ // if more than one element is matched, the first one will be used as parent
863
+ // if no elements are matched, the script will throw an error
864
+ if (typeof parent === 'string') {
865
+ parent = d.querySelectorAll(config.parent);
866
+ if (parent.length > 1) {
867
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
868
+ }
869
+ if (parent.length === 0) {
870
+ throw 'ERROR: the given `parent` doesn\'t exists!';
871
+ }
872
+ parent = parent[0];
873
+ }
874
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
875
+ // the first one will be used as parent
876
+ if (parent.length > 1 && parent instanceof Element === false) {
877
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
878
+ parent = parent[0];
879
+ }
880
+
881
+ // append the generated popper to its parent
882
+ parent.appendChild(popper);
883
+
884
+ return popper;
885
+
886
+ /**
887
+ * Adds class names to the given element
888
+ * @function
889
+ * @ignore
890
+ * @param {HTMLElement} target
891
+ * @param {Array} classes
892
+ */
893
+ function addClassNames(element, classNames) {
894
+ classNames.forEach(function (className) {
895
+ element.classList.add(className);
896
+ });
897
+ }
898
+
899
+ /**
900
+ * Adds attributes to the given element
901
+ * @function
902
+ * @ignore
903
+ * @param {HTMLElement} target
904
+ * @param {Array} attributes
905
+ * @example
906
+ * addAttributes(element, [ 'data-info:foobar' ]);
907
+ */
908
+ function addAttributes(element, attributes) {
909
+ attributes.forEach(function (attribute) {
910
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
911
+ });
912
+ }
913
+ };
914
+
915
+ /**
916
+ * Helper used to get the position which will be applied to the popper
917
+ * @method
918
+ * @memberof Popper
919
+ * @param config {HTMLElement} popper element
920
+ * @param reference {HTMLElement} reference element
921
+ * @returns {String} position
922
+ */
923
+ Popper.prototype._getPosition = function (popper, reference) {
924
+ var container = getOffsetParent(reference);
925
+
926
+ if (this._options.forceAbsolute) {
927
+ return 'absolute';
928
+ }
929
+
930
+ // Decide if the popper will be fixed
931
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
932
+ var isParentFixed = isFixed(reference, container);
933
+ return isParentFixed ? 'fixed' : 'absolute';
934
+ };
935
+
936
+ /**
937
+ * Get offsets to the popper
938
+ * @method
939
+ * @memberof Popper
940
+ * @access private
941
+ * @param {Element} popper - the popper element
942
+ * @param {Element} reference - the reference element (the popper will be relative to this)
943
+ * @returns {Object} An object containing the offsets which will be applied to the popper
944
+ */
945
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
946
+ placement = placement.split('-')[0];
947
+ var popperOffsets = {};
948
+
949
+ popperOffsets.position = this.state.position;
950
+ var isParentFixed = popperOffsets.position === 'fixed';
951
+
952
+ //
953
+ // Get reference element position
954
+ //
955
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
956
+
957
+ //
958
+ // Get popper sizes
959
+ //
960
+ var popperRect = getOuterSizes(popper);
961
+
962
+ //
963
+ // Compute offsets of popper
964
+ //
965
+
966
+ // depending by the popper placement we have to compute its offsets slightly differently
967
+ if (['right', 'left'].indexOf(placement) !== -1) {
968
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
969
+ if (placement === 'left') {
970
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
971
+ } else {
972
+ popperOffsets.left = referenceOffsets.right;
973
+ }
974
+ } else {
975
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
976
+ if (placement === 'top') {
977
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
978
+ } else {
979
+ popperOffsets.top = referenceOffsets.bottom;
980
+ }
981
+ }
982
+
983
+ // Add width and height to our offsets object
984
+ popperOffsets.width = popperRect.width;
985
+ popperOffsets.height = popperRect.height;
986
+
987
+ return {
988
+ popper: popperOffsets,
989
+ reference: referenceOffsets
990
+ };
991
+ };
992
+
993
+ /**
994
+ * Setup needed event listeners used to update the popper position
995
+ * @method
996
+ * @memberof Popper
997
+ * @access private
998
+ */
999
+ Popper.prototype._setupEventListeners = function () {
1000
+ // NOTE: 1 DOM access here
1001
+ this.state.updateBound = this.update.bind(this);
1002
+ root.addEventListener('resize', this.state.updateBound);
1003
+ // if the boundariesElement is window we don't need to listen for the scroll event
1004
+ if (this._options.boundariesElement !== 'window') {
1005
+ var target = getScrollParent(this._reference);
1006
+ // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
1007
+ if (target === root.document.body || target === root.document.documentElement) {
1008
+ target = root;
1009
+ }
1010
+ target.addEventListener('scroll', this.state.updateBound);
1011
+ this.state.scrollTarget = target;
1012
+ }
1013
+ };
1014
+
1015
+ /**
1016
+ * Remove event listeners used to update the popper position
1017
+ * @method
1018
+ * @memberof Popper
1019
+ * @access private
1020
+ */
1021
+ Popper.prototype._removeEventListeners = function () {
1022
+ // NOTE: 1 DOM access here
1023
+ root.removeEventListener('resize', this.state.updateBound);
1024
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
1025
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
1026
+ this.state.scrollTarget = null;
1027
+ }
1028
+ this.state.updateBound = null;
1029
+ };
1030
+
1031
+ /**
1032
+ * Computed the boundaries limits and return them
1033
+ * @method
1034
+ * @memberof Popper
1035
+ * @access private
1036
+ * @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
1037
+ * @param {Number} padding - Boundaries padding
1038
+ * @param {Element} boundariesElement - Element used to define the boundaries
1039
+ * @returns {Object} Coordinates of the boundaries
1040
+ */
1041
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
1042
+ // NOTE: 1 DOM access here
1043
+ var boundaries = {};
1044
+ var width, height;
1045
+ if (boundariesElement === 'window') {
1046
+ var body = root.document.body,
1047
+ html = root.document.documentElement;
1048
+
1049
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
1050
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
1051
+
1052
+ boundaries = {
1053
+ top: 0,
1054
+ right: width,
1055
+ bottom: height,
1056
+ left: 0
1057
+ };
1058
+ } else if (boundariesElement === 'viewport') {
1059
+ var offsetParent = getOffsetParent(this._popper);
1060
+ var scrollParent = getScrollParent(this._popper);
1061
+ var offsetParentRect = getOffsetRect(offsetParent);
1062
+
1063
+ // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
1064
+ var getScrollTopValue = function getScrollTopValue(element) {
1065
+ return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
1066
+ };
1067
+ var getScrollLeftValue = function getScrollLeftValue(element) {
1068
+ return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
1069
+ };
1070
+
1071
+ // if the popper is fixed we don't have to substract scrolling from the boundaries
1072
+ var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
1073
+ var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
1074
+
1075
+ boundaries = {
1076
+ top: 0 - (offsetParentRect.top - scrollTop),
1077
+ right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
1078
+ bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
1079
+ left: 0 - (offsetParentRect.left - scrollLeft)
1080
+ };
1081
+ } else {
1082
+ if (getOffsetParent(this._popper) === boundariesElement) {
1083
+ boundaries = {
1084
+ top: 0,
1085
+ left: 0,
1086
+ right: boundariesElement.clientWidth,
1087
+ bottom: boundariesElement.clientHeight
1088
+ };
1089
+ } else {
1090
+ boundaries = getOffsetRect(boundariesElement);
1091
+ }
1092
+ }
1093
+ boundaries.left += padding;
1094
+ boundaries.right -= padding;
1095
+ boundaries.top = boundaries.top + padding;
1096
+ boundaries.bottom = boundaries.bottom - padding;
1097
+ return boundaries;
1098
+ };
1099
+
1100
+ /**
1101
+ * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
1102
+ * @method
1103
+ * @memberof Popper
1104
+ * @access public
1105
+ * @param {Object} data
1106
+ * @param {Array} modifiers
1107
+ * @param {Function} ends
1108
+ */
1109
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
1110
+ var modifiersToRun = modifiers.slice();
1111
+ if (ends !== undefined) {
1112
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
1113
+ }
1114
+
1115
+ modifiersToRun.forEach(function (modifier) {
1116
+ if (isFunction(modifier)) {
1117
+ data = modifier.call(this, data);
1118
+ }
1119
+ }.bind(this));
1120
+
1121
+ return data;
1122
+ };
1123
+
1124
+ /**
1125
+ * Helper used to know if the given modifier depends from another one.
1126
+ * @method
1127
+ * @memberof Popper
1128
+ * @param {String} requesting - name of requesting modifier
1129
+ * @param {String} requested - name of requested modifier
1130
+ * @returns {Boolean}
1131
+ */
1132
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
1133
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
1134
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
1135
+ return modifier === requested;
1136
+ }).length;
1137
+ };
1138
+
1139
+ //
1140
+ // Modifiers
1141
+ //
1142
+
1143
+ /**
1144
+ * Modifiers list
1145
+ * @namespace Popper.modifiers
1146
+ * @memberof Popper
1147
+ * @type {Object}
1148
+ */
1149
+ Popper.prototype.modifiers = {};
1150
+
1151
+ /**
1152
+ * Apply the computed styles to the popper element
1153
+ * @method
1154
+ * @memberof Popper.modifiers
1155
+ * @argument {Object} data - The data object generated by `update` method
1156
+ * @returns {Object} The same data object
1157
+ */
1158
+ Popper.prototype.modifiers.applyStyle = function (data) {
1159
+ // apply the final offsets to the popper
1160
+ // NOTE: 1 DOM access here
1161
+ var styles = {
1162
+ position: data.offsets.popper.position
1163
+ };
1164
+
1165
+ // round top and left to avoid blurry text
1166
+ var left = Math.round(data.offsets.popper.left);
1167
+ var top = Math.round(data.offsets.popper.top);
1168
+
1169
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
1170
+ // we automatically use the supported prefixed version if needed
1171
+ var prefixedProperty;
1172
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
1173
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
1174
+ styles.top = 0;
1175
+ styles.left = 0;
1176
+ }
1177
+ // othwerise, we use the standard `left` and `top` properties
1178
+ else {
1179
+ styles.left = left;
1180
+ styles.top = top;
1181
+ }
1182
+
1183
+ // any property present in `data.styles` will be applied to the popper,
1184
+ // in this way we can make the 3rd party modifiers add custom styles to it
1185
+ // Be aware, modifiers could override the properties defined in the previous
1186
+ // lines of this modifier!
1187
+ Object.assign(styles, data.styles);
1188
+
1189
+ setStyle(this._popper, styles);
1190
+
1191
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
1192
+ // NOTE: 1 DOM access here
1193
+ this._popper.setAttribute('x-placement', data.placement);
1194
+
1195
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
1196
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
1197
+ setStyle(data.arrowElement, data.offsets.arrow);
1198
+ }
1199
+
1200
+ return data;
1201
+ };
1202
+
1203
+ /**
1204
+ * Modifier used to shift the popper on the start or end of its reference element side
1205
+ * @method
1206
+ * @memberof Popper.modifiers
1207
+ * @argument {Object} data - The data object generated by `update` method
1208
+ * @returns {Object} The data object, properly modified
1209
+ */
1210
+ Popper.prototype.modifiers.shift = function (data) {
1211
+ var placement = data.placement;
1212
+ var basePlacement = placement.split('-')[0];
1213
+ var shiftVariation = placement.split('-')[1];
1214
+
1215
+ // if shift shiftVariation is specified, run the modifier
1216
+ if (shiftVariation) {
1217
+ var reference = data.offsets.reference;
1218
+ var popper = getPopperClientRect(data.offsets.popper);
1219
+
1220
+ var shiftOffsets = {
1221
+ y: {
1222
+ start: { top: reference.top },
1223
+ end: { top: reference.top + reference.height - popper.height }
1224
+ },
1225
+ x: {
1226
+ start: { left: reference.left },
1227
+ end: { left: reference.left + reference.width - popper.width }
1228
+ }
1229
+ };
1230
+
1231
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
1232
+
1233
+ data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
1234
+ }
1235
+
1236
+ return data;
1237
+ };
1238
+
1239
+ /**
1240
+ * Modifier used to make sure the popper does not overflows from it's boundaries
1241
+ * @method
1242
+ * @memberof Popper.modifiers
1243
+ * @argument {Object} data - The data object generated by `update` method
1244
+ * @returns {Object} The data object, properly modified
1245
+ */
1246
+ Popper.prototype.modifiers.preventOverflow = function (data) {
1247
+ var order = this._options.preventOverflowOrder;
1248
+ var popper = getPopperClientRect(data.offsets.popper);
1249
+
1250
+ var check = {
1251
+ left: function left() {
1252
+ var left = popper.left;
1253
+ if (popper.left < data.boundaries.left) {
1254
+ left = Math.max(popper.left, data.boundaries.left);
1255
+ }
1256
+ return { left: left };
1257
+ },
1258
+ right: function right() {
1259
+ var left = popper.left;
1260
+ if (popper.right > data.boundaries.right) {
1261
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
1262
+ }
1263
+ return { left: left };
1264
+ },
1265
+ top: function top() {
1266
+ var top = popper.top;
1267
+ if (popper.top < data.boundaries.top) {
1268
+ top = Math.max(popper.top, data.boundaries.top);
1269
+ }
1270
+ return { top: top };
1271
+ },
1272
+ bottom: function bottom() {
1273
+ var top = popper.top;
1274
+ if (popper.bottom > data.boundaries.bottom) {
1275
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
1276
+ }
1277
+ return { top: top };
1278
+ }
1279
+ };
1280
+
1281
+ order.forEach(function (direction) {
1282
+ data.offsets.popper = Object.assign(popper, check[direction]());
1283
+ });
1284
+
1285
+ return data;
1286
+ };
1287
+
1288
+ /**
1289
+ * Modifier used to make sure the popper is always near its reference
1290
+ * @method
1291
+ * @memberof Popper.modifiers
1292
+ * @argument {Object} data - The data object generated by _update method
1293
+ * @returns {Object} The data object, properly modified
1294
+ */
1295
+ Popper.prototype.modifiers.keepTogether = function (data) {
1296
+ var popper = getPopperClientRect(data.offsets.popper);
1297
+ var reference = data.offsets.reference;
1298
+ var f = Math.floor;
1299
+
1300
+ if (popper.right < f(reference.left)) {
1301
+ data.offsets.popper.left = f(reference.left) - popper.width;
1302
+ }
1303
+ if (popper.left > f(reference.right)) {
1304
+ data.offsets.popper.left = f(reference.right);
1305
+ }
1306
+ if (popper.bottom < f(reference.top)) {
1307
+ data.offsets.popper.top = f(reference.top) - popper.height;
1308
+ }
1309
+ if (popper.top > f(reference.bottom)) {
1310
+ data.offsets.popper.top = f(reference.bottom);
1311
+ }
1312
+
1313
+ return data;
1314
+ };
1315
+
1316
+ /**
1317
+ * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
1318
+ * Requires the `preventOverflow` modifier before it in order to work.
1319
+ * **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
1320
+ * @method
1321
+ * @memberof Popper.modifiers
1322
+ * @argument {Object} data - The data object generated by _update method
1323
+ * @returns {Object} The data object, properly modified
1324
+ */
1325
+ Popper.prototype.modifiers.flip = function (data) {
1326
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
1327
+ // otherwise flip would not work as expected.
1328
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
1329
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
1330
+ return data;
1331
+ }
1332
+
1333
+ if (data.flipped && data.placement === data._originalPlacement) {
1334
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
1335
+ return data;
1336
+ }
1337
+
1338
+ var placement = data.placement.split('-')[0];
1339
+ var placementOpposite = getOppositePlacement(placement);
1340
+ var variation = data.placement.split('-')[1] || '';
1341
+
1342
+ var flipOrder = [];
1343
+ if (this._options.flipBehavior === 'flip') {
1344
+ flipOrder = [placement, placementOpposite];
1345
+ } else {
1346
+ flipOrder = this._options.flipBehavior;
1347
+ }
1348
+
1349
+ flipOrder.forEach(function (step, index) {
1350
+ if (placement !== step || flipOrder.length === index + 1) {
1351
+ return;
1352
+ }
1353
+
1354
+ placement = data.placement.split('-')[0];
1355
+ placementOpposite = getOppositePlacement(placement);
1356
+
1357
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
1358
+
1359
+ // this boolean is used to distinguish right and bottom from top and left
1360
+ // they need different computations to get flipped
1361
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
1362
+
1363
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
1364
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
1365
+ // we'll use this boolean to detect any flip loop
1366
+ data.flipped = true;
1367
+ data.placement = flipOrder[index + 1];
1368
+ if (variation) {
1369
+ data.placement += '-' + variation;
1370
+ }
1371
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
1372
+
1373
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
1374
+ }
1375
+ }.bind(this));
1376
+ return data;
1377
+ };
1378
+
1379
+ /**
1380
+ * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
1381
+ * The offsets will shift the popper on the side of its reference element.
1382
+ * @method
1383
+ * @memberof Popper.modifiers
1384
+ * @argument {Object} data - The data object generated by _update method
1385
+ * @returns {Object} The data object, properly modified
1386
+ */
1387
+ Popper.prototype.modifiers.offset = function (data) {
1388
+ var offset = this._options.offset;
1389
+ var popper = data.offsets.popper;
1390
+
1391
+ if (data.placement.indexOf('left') !== -1) {
1392
+ popper.top -= offset;
1393
+ } else if (data.placement.indexOf('right') !== -1) {
1394
+ popper.top += offset;
1395
+ } else if (data.placement.indexOf('top') !== -1) {
1396
+ popper.left -= offset;
1397
+ } else if (data.placement.indexOf('bottom') !== -1) {
1398
+ popper.left += offset;
1399
+ }
1400
+ return data;
1401
+ };
1402
+
1403
+ /**
1404
+ * 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
1405
+ * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
1406
+ * @method
1407
+ * @memberof Popper.modifiers
1408
+ * @argument {Object} data - The data object generated by _update method
1409
+ * @returns {Object} The data object, properly modified
1410
+ */
1411
+ Popper.prototype.modifiers.arrow = function (data) {
1412
+ var arrow = this._options.arrowElement;
1413
+ var arrowOffset = this._options.arrowOffset;
1414
+
1415
+ // if the arrowElement is a string, suppose it's a CSS selector
1416
+ if (typeof arrow === 'string') {
1417
+ arrow = this._popper.querySelector(arrow);
1418
+ }
1419
+
1420
+ // if arrow element is not found, don't run the modifier
1421
+ if (!arrow) {
1422
+ return data;
1423
+ }
1424
+
1425
+ // the arrow element must be child of its popper
1426
+ if (!this._popper.contains(arrow)) {
1427
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
1428
+ return data;
1429
+ }
1430
+
1431
+ // arrow depends on keepTogether in order to work
1432
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
1433
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
1434
+ return data;
1435
+ }
1436
+
1437
+ var arrowStyle = {};
1438
+ var placement = data.placement.split('-')[0];
1439
+ var popper = getPopperClientRect(data.offsets.popper);
1440
+ var reference = data.offsets.reference;
1441
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
1442
+
1443
+ var len = isVertical ? 'height' : 'width';
1444
+ var side = isVertical ? 'top' : 'left';
1445
+ var translate = isVertical ? 'translateY' : 'translateX';
1446
+ var altSide = isVertical ? 'left' : 'top';
1447
+ var opSide = isVertical ? 'bottom' : 'right';
1448
+ var arrowSize = getOuterSizes(arrow)[len];
1449
+
1450
+ //
1451
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
1452
+ //
1453
+
1454
+ // top/left side
1455
+ if (reference[opSide] - arrowSize < popper[side]) {
1456
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
1457
+ }
1458
+ // bottom/right side
1459
+ if (reference[side] + arrowSize > popper[opSide]) {
1460
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
1461
+ }
1462
+
1463
+ // compute center of the popper
1464
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
1465
+
1466
+ var sideValue = center - popper[side];
1467
+
1468
+ // prevent arrow from being placed not contiguously to its popper
1469
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
1470
+ arrowStyle[side] = sideValue;
1471
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
1472
+
1473
+ data.offsets.arrow = arrowStyle;
1474
+ data.arrowElement = arrow;
1475
+
1476
+ return data;
1477
+ };
1478
+
1479
+ //
1480
+ // Helpers
1481
+ //
1482
+
1483
+ /**
1484
+ * Get the outer sizes of the given element (offset size + margins)
1485
+ * @function
1486
+ * @ignore
1487
+ * @argument {Element} element
1488
+ * @returns {Object} object containing width and height properties
1489
+ */
1490
+ function getOuterSizes(element) {
1491
+ // NOTE: 1 DOM access here
1492
+ var _display = element.style.display,
1493
+ _visibility = element.style.visibility;
1494
+ element.style.display = 'block';element.style.visibility = 'hidden';
1495
+ var calcWidthToForceRepaint = element.offsetWidth;
1496
+
1497
+ // original method
1498
+ var styles = root.getComputedStyle(element);
1499
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
1500
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
1501
+ var result = { width: element.offsetWidth + y, height: element.offsetHeight + x };
1502
+
1503
+ // reset element styles
1504
+ element.style.display = _display;element.style.visibility = _visibility;
1505
+ return result;
1506
+ }
1507
+
1508
+ /**
1509
+ * Get the opposite placement of the given one/
1510
+ * @function
1511
+ * @ignore
1512
+ * @argument {String} placement
1513
+ * @returns {String} flipped placement
1514
+ */
1515
+ function getOppositePlacement(placement) {
1516
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
1517
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
1518
+ return hash[matched];
1519
+ });
1520
+ }
1521
+
1522
+ /**
1523
+ * Given the popper offsets, generate an output similar to getBoundingClientRect
1524
+ * @function
1525
+ * @ignore
1526
+ * @argument {Object} popperOffsets
1527
+ * @returns {Object} ClientRect like output
1528
+ */
1529
+ function getPopperClientRect(popperOffsets) {
1530
+ var offsets = Object.assign({}, popperOffsets);
1531
+ offsets.right = offsets.left + offsets.width;
1532
+ offsets.bottom = offsets.top + offsets.height;
1533
+ return offsets;
1534
+ }
1535
+
1536
+ /**
1537
+ * Given an array and the key to find, returns its index
1538
+ * @function
1539
+ * @ignore
1540
+ * @argument {Array} arr
1541
+ * @argument keyToFind
1542
+ * @returns index or null
1543
+ */
1544
+ function getArrayKeyIndex(arr, keyToFind) {
1545
+ var i = 0,
1546
+ key;
1547
+ for (key in arr) {
1548
+ if (arr[key] === keyToFind) {
1549
+ return i;
1550
+ }
1551
+ i++;
1552
+ }
1553
+ return null;
1554
+ }
1555
+
1556
+ /**
1557
+ * Get CSS computed property of the given element
1558
+ * @function
1559
+ * @ignore
1560
+ * @argument {Eement} element
1561
+ * @argument {String} property
1562
+ */
1563
+ function getStyleComputedProperty(element, property) {
1564
+ // NOTE: 1 DOM access here
1565
+ var css = root.getComputedStyle(element, null);
1566
+ return css[property];
1567
+ }
1568
+
1569
+ /**
1570
+ * Returns the offset parent of the given element
1571
+ * @function
1572
+ * @ignore
1573
+ * @argument {Element} element
1574
+ * @returns {Element} offset parent
1575
+ */
1576
+ function getOffsetParent(element) {
1577
+ // NOTE: 1 DOM access here
1578
+ var offsetParent = element.offsetParent;
1579
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
1580
+ }
1581
+
1582
+ /**
1583
+ * Returns the scrolling parent of the given element
1584
+ * @function
1585
+ * @ignore
1586
+ * @argument {Element} element
1587
+ * @returns {Element} offset parent
1588
+ */
1589
+ function getScrollParent(element) {
1590
+ var parent = element.parentNode;
1591
+
1592
+ if (!parent) {
1593
+ return element;
1594
+ }
1595
+
1596
+ if (parent === root.document) {
1597
+ // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
1598
+ // greater than 0 and return the proper element
1599
+ if (root.document.body.scrollTop || root.document.body.scrollLeft) {
1600
+ return root.document.body;
1601
+ } else {
1602
+ return root.document.documentElement;
1603
+ }
1604
+ }
1605
+
1606
+ // Firefox want us to check `-x` and `-y` variations as well
1607
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
1608
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
1609
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
1610
+ // fixes issue #65
1611
+ return parent;
1612
+ }
1613
+ return getScrollParent(element.parentNode);
1614
+ }
1615
+
1616
+ /**
1617
+ * Check if the given element is fixed or is inside a fixed parent
1618
+ * @function
1619
+ * @ignore
1620
+ * @argument {Element} element
1621
+ * @argument {Element} customContainer
1622
+ * @returns {Boolean} answer to "isFixed?"
1623
+ */
1624
+ function isFixed(element) {
1625
+ if (element === root.document.body) {
1626
+ return false;
1627
+ }
1628
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
1629
+ return true;
1630
+ }
1631
+ return element.parentNode ? isFixed(element.parentNode) : element;
1632
+ }
1633
+
1634
+ /**
1635
+ * Set the style to the given popper
1636
+ * @function
1637
+ * @ignore
1638
+ * @argument {Element} element - Element to apply the style to
1639
+ * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
1640
+ */
1641
+ function setStyle(element, styles) {
1642
+ function is_numeric(n) {
1643
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
1644
+ }
1645
+ Object.keys(styles).forEach(function (prop) {
1646
+ var unit = '';
1647
+ // add unit if the value is numeric and is one of the following
1648
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
1649
+ unit = 'px';
1650
+ }
1651
+ element.style[prop] = styles[prop] + unit;
1652
+ });
1653
+ }
1654
+
1655
+ /**
1656
+ * Check if the given variable is a function
1657
+ * @function
1658
+ * @ignore
1659
+ * @argument {*} functionToCheck - variable to check
1660
+ * @returns {Boolean} answer to: is a function?
1661
+ */
1662
+ function isFunction(functionToCheck) {
1663
+ var getType = {};
1664
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
1665
+ }
1666
+
1667
+ /**
1668
+ * Get the position of the given element, relative to its offset parent
1669
+ * @function
1670
+ * @ignore
1671
+ * @param {Element} element
1672
+ * @return {Object} position - Coordinates of the element and its `scrollTop`
1673
+ */
1674
+ function getOffsetRect(element) {
1675
+ var elementRect = {
1676
+ width: element.offsetWidth,
1677
+ height: element.offsetHeight,
1678
+ left: element.offsetLeft,
1679
+ top: element.offsetTop
1680
+ };
1681
+
1682
+ elementRect.right = elementRect.left + elementRect.width;
1683
+ elementRect.bottom = elementRect.top + elementRect.height;
1684
+
1685
+ // position
1686
+ return elementRect;
1687
+ }
1688
+
1689
+ /**
1690
+ * Get bounding client rect of given element
1691
+ * @function
1692
+ * @ignore
1693
+ * @param {HTMLElement} element
1694
+ * @return {Object} client rect
1695
+ */
1696
+ function getBoundingClientRect(element) {
1697
+ var rect = element.getBoundingClientRect();
1698
+
1699
+ // whether the IE version is lower than 11
1700
+ var isIE = navigator.userAgent.indexOf("MSIE") != -1;
1701
+
1702
+ // fix ie document bounding top always 0 bug
1703
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
1704
+
1705
+ return {
1706
+ left: rect.left,
1707
+ top: rectTop,
1708
+ right: rect.right,
1709
+ bottom: rect.bottom,
1710
+ width: rect.right - rect.left,
1711
+ height: rect.bottom - rectTop
1712
+ };
1713
+ }
1714
+
1715
+ /**
1716
+ * Given an element and one of its parents, return the offset
1717
+ * @function
1718
+ * @ignore
1719
+ * @param {HTMLElement} element
1720
+ * @param {HTMLElement} parent
1721
+ * @return {Object} rect
1722
+ */
1723
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
1724
+ var elementRect = getBoundingClientRect(element);
1725
+ var parentRect = getBoundingClientRect(parent);
1726
+
1727
+ if (fixed) {
1728
+ var scrollParent = getScrollParent(parent);
1729
+ parentRect.top += scrollParent.scrollTop;
1730
+ parentRect.bottom += scrollParent.scrollTop;
1731
+ parentRect.left += scrollParent.scrollLeft;
1732
+ parentRect.right += scrollParent.scrollLeft;
1733
+ }
1734
+
1735
+ var rect = {
1736
+ top: elementRect.top - parentRect.top,
1737
+ left: elementRect.left - parentRect.left,
1738
+ bottom: elementRect.top - parentRect.top + elementRect.height,
1739
+ right: elementRect.left - parentRect.left + elementRect.width,
1740
+ width: elementRect.width,
1741
+ height: elementRect.height
1742
+ };
1743
+ return rect;
1744
+ }
1745
+
1746
+ /**
1747
+ * Get the prefixed supported property name
1748
+ * @function
1749
+ * @ignore
1750
+ * @argument {String} property (camelCase)
1751
+ * @returns {String} prefixed property (camelCase)
1752
+ */
1753
+ function getSupportedPropertyName(property) {
1754
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
1755
+
1756
+ for (var i = 0; i < prefixes.length; i++) {
1757
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
1758
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
1759
+ return toCheck;
1760
+ }
1761
+ }
1762
+ return null;
1763
+ }
1764
+
1765
+ /**
1766
+ * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
1767
+ * objects to a target object. It will return the target object.
1768
+ * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
1769
+ * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
1770
+ * @function
1771
+ * @ignore
1772
+ */
1773
+ if (!Object.assign) {
1774
+ Object.defineProperty(Object, 'assign', {
1775
+ enumerable: false,
1776
+ configurable: true,
1777
+ writable: true,
1778
+ value: function value(target) {
1779
+ if (target === undefined || target === null) {
1780
+ throw new TypeError('Cannot convert first argument to object');
1781
+ }
1782
+
1783
+ var to = Object(target);
1784
+ for (var i = 1; i < arguments.length; i++) {
1785
+ var nextSource = arguments[i];
1786
+ if (nextSource === undefined || nextSource === null) {
1787
+ continue;
1788
+ }
1789
+ nextSource = Object(nextSource);
1790
+
1791
+ var keysArray = Object.keys(nextSource);
1792
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
1793
+ var nextKey = keysArray[nextIndex];
1794
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
1795
+ if (desc !== undefined && desc.enumerable) {
1796
+ to[nextKey] = nextSource[nextKey];
1797
+ }
1798
+ }
1799
+ }
1800
+ return to;
1801
+ }
1802
+ });
1803
+ }
1804
+
1805
+ return Popper;
1806
+ });
1807
+
1808
+ /***/ }),
1809
+
1810
+ /***/ 3:
1811
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1812
+
1813
+ "use strict";
1814
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return noop; });
1815
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return hasOwn; });
1816
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toObject; });
1817
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getValueByPath; });
1818
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getPropByPath; });
1819
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return generateId; });
1820
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return valueEquals; });
1821
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return escapeRegexpString; });
1822
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrayFindIndex; });
1823
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayFind; });
1824
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return coerceTruthyValueToArray; });
1825
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return isIE; });
1826
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return isEdge; });
1827
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return isFirefox; });
1828
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return autoprefixer; });
1829
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return kebabCase; });
1830
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return capitalize; });
1831
+ /* unused harmony export looseEqual */
1832
+ /* unused harmony export arrayEquals */
1833
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return isEqual; });
1834
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return isEmpty; });
1835
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return rafThrottle; });
1836
+ /* unused harmony export objToArray */
1837
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return isMac; });
1838
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
1839
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
1840
+ /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
1841
+ 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; };
1842
+
1843
+
1844
+
1845
+
1846
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1847
+
1848
+ function noop() {};
1849
+
1850
+ function hasOwn(obj, key) {
1851
+ return hasOwnProperty.call(obj, key);
1852
+ };
1853
+
1854
+ function extend(to, _from) {
1855
+ for (var key in _from) {
1856
+ to[key] = _from[key];
1857
+ }
1858
+ return to;
1859
+ };
1860
+
1861
+ function toObject(arr) {
1862
+ var res = {};
1863
+ for (var i = 0; i < arr.length; i++) {
1864
+ if (arr[i]) {
1865
+ extend(res, arr[i]);
1866
+ }
1867
+ }
1868
+ return res;
1869
+ };
1870
+
1871
+ var getValueByPath = function getValueByPath(object, prop) {
1872
+ prop = prop || '';
1873
+ var paths = prop.split('.');
1874
+ var current = object;
1875
+ var result = null;
1876
+ for (var i = 0, j = paths.length; i < j; i++) {
1877
+ var path = paths[i];
1878
+ if (!current) break;
1879
+
1880
+ if (i === j - 1) {
1881
+ result = current[path];
1882
+ break;
1883
+ }
1884
+ current = current[path];
1885
+ }
1886
+ return result;
1887
+ };
1888
+
1889
+ function getPropByPath(obj, path, strict) {
1890
+ var tempObj = obj;
1891
+ path = path.replace(/\[(\w+)\]/g, '.$1');
1892
+ path = path.replace(/^\./, '');
1893
+
1894
+ var keyArr = path.split('.');
1895
+ var i = 0;
1896
+ for (var len = keyArr.length; i < len - 1; ++i) {
1897
+ if (!tempObj && !strict) break;
1898
+ var key = keyArr[i];
1899
+ if (key in tempObj) {
1900
+ tempObj = tempObj[key];
1901
+ } else {
1902
+ if (strict) {
1903
+ throw new Error('please transfer a valid prop path to form item!');
1904
+ }
1905
+ break;
1906
+ }
1907
+ }
1908
+ return {
1909
+ o: tempObj,
1910
+ k: keyArr[i],
1911
+ v: tempObj ? tempObj[keyArr[i]] : null
1912
+ };
1913
+ };
1914
+
1915
+ var generateId = function generateId() {
1916
+ return Math.floor(Math.random() * 10000);
1917
+ };
1918
+
1919
+ var valueEquals = function valueEquals(a, b) {
1920
+ // see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
1921
+ if (a === b) return true;
1922
+ if (!(a instanceof Array)) return false;
1923
+ if (!(b instanceof Array)) return false;
1924
+ if (a.length !== b.length) return false;
1925
+ for (var i = 0; i !== a.length; ++i) {
1926
+ if (a[i] !== b[i]) return false;
1927
+ }
1928
+ return true;
1929
+ };
1930
+
1931
+ var escapeRegexpString = function escapeRegexpString() {
1932
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1933
+ return String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
1934
+ };
1935
+
1936
+ // TODO: use native Array.find, Array.findIndex when IE support is dropped
1937
+ var arrayFindIndex = function arrayFindIndex(arr, pred) {
1938
+ for (var i = 0; i !== arr.length; ++i) {
1939
+ if (pred(arr[i])) {
1940
+ return i;
1941
+ }
1942
+ }
1943
+ return -1;
1944
+ };
1945
+
1946
+ var arrayFind = function arrayFind(arr, pred) {
1947
+ var idx = arrayFindIndex(arr, pred);
1948
+ return idx !== -1 ? arr[idx] : undefined;
1949
+ };
1950
+
1951
+ // coerce truthy value to array
1952
+ var coerceTruthyValueToArray = function coerceTruthyValueToArray(val) {
1953
+ if (Array.isArray(val)) {
1954
+ return val;
1955
+ } else if (val) {
1956
+ return [val];
1957
+ } else {
1958
+ return [];
1959
+ }
1960
+ };
1961
+
1962
+ var isIE = function isIE() {
1963
+ return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !isNaN(Number(document.documentMode));
1964
+ };
1965
+
1966
+ var isEdge = function isEdge() {
1967
+ return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
1968
+ };
1969
+
1970
+ var isFirefox = function isFirefox() {
1971
+ return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
1972
+ };
1973
+
1974
+ var autoprefixer = function autoprefixer(style) {
1975
+ if ((typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object') return style;
1976
+ var rules = ['transform', 'transition', 'animation'];
1977
+ var prefixes = ['ms-', 'webkit-'];
1978
+ rules.forEach(function (rule) {
1979
+ var value = style[rule];
1980
+ if (rule && value) {
1981
+ prefixes.forEach(function (prefix) {
1982
+ style[prefix + rule] = value;
1983
+ });
1984
+ }
1985
+ });
1986
+ return style;
1987
+ };
1988
+
1989
+ var kebabCase = function kebabCase(str) {
1990
+ var hyphenateRE = /([^-])([A-Z])/g;
1991
+ return str.replace(hyphenateRE, '$1-$2').replace(hyphenateRE, '$1-$2').toLowerCase();
1992
+ };
1993
+
1994
+ var capitalize = function capitalize(str) {
1995
+ if (!Object(_types__WEBPACK_IMPORTED_MODULE_1__[/* isString */ "e"])(str)) return str;
1996
+ return str.charAt(0).toUpperCase() + str.slice(1);
1997
+ };
1998
+
1999
+ var looseEqual = function looseEqual(a, b) {
2000
+ var isObjectA = Object(_types__WEBPACK_IMPORTED_MODULE_1__[/* isObject */ "d"])(a);
2001
+ var isObjectB = Object(_types__WEBPACK_IMPORTED_MODULE_1__[/* isObject */ "d"])(b);
2002
+ if (isObjectA && isObjectB) {
2003
+ return JSON.stringify(a) === JSON.stringify(b);
2004
+ } else if (!isObjectA && !isObjectB) {
2005
+ return String(a) === String(b);
2006
+ } else {
2007
+ return false;
2008
+ }
2009
+ };
2010
+
2011
+ var arrayEquals = function arrayEquals(arrayA, arrayB) {
2012
+ arrayA = arrayA || [];
2013
+ arrayB = arrayB || [];
2014
+
2015
+ if (arrayA.length !== arrayB.length) {
2016
+ return false;
2017
+ }
2018
+
2019
+ for (var i = 0; i < arrayA.length; i++) {
2020
+ if (!looseEqual(arrayA[i], arrayB[i])) {
2021
+ return false;
2022
+ }
2023
+ }
2024
+
2025
+ return true;
2026
+ };
2027
+
2028
+ var isEqual = function isEqual(value1, value2) {
2029
+ if (Array.isArray(value1) && Array.isArray(value2)) {
2030
+ return arrayEquals(value1, value2);
2031
+ }
2032
+ return looseEqual(value1, value2);
2033
+ };
2034
+
2035
+ var isEmpty = function isEmpty(val) {
2036
+ // null or undefined
2037
+ if (val == null) return true;
2038
+
2039
+ if (typeof val === 'boolean') return false;
2040
+
2041
+ if (typeof val === 'number') return !val;
2042
+
2043
+ if (val instanceof Error) return val.message === '';
2044
+
2045
+ switch (Object.prototype.toString.call(val)) {
2046
+ // String or Array
2047
+ case '[object String]':
2048
+ case '[object Array]':
2049
+ return !val.length;
2050
+
2051
+ // Map or Set or File
2052
+ case '[object File]':
2053
+ case '[object Map]':
2054
+ case '[object Set]':
2055
+ {
2056
+ return !val.size;
2057
+ }
2058
+ // Plain Object
2059
+ case '[object Object]':
2060
+ {
2061
+ return !Object.keys(val).length;
2062
+ }
2063
+ }
2064
+
2065
+ return false;
2066
+ };
2067
+
2068
+ function rafThrottle(fn) {
2069
+ var locked = false;
2070
+ return function () {
2071
+ var _this = this;
2072
+
2073
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
2074
+ args[_key] = arguments[_key];
2075
+ }
2076
+
2077
+ if (locked) return;
2078
+ locked = true;
2079
+ window.requestAnimationFrame(function (_) {
2080
+ fn.apply(_this, args);
2081
+ locked = false;
2082
+ });
2083
+ };
2084
+ }
2085
+
2086
+ function objToArray(obj) {
2087
+ if (Array.isArray(obj)) {
2088
+ return obj;
2089
+ }
2090
+ return isEmpty(obj) ? [] : [obj];
2091
+ }
2092
+
2093
+ var isMac = function isMac() {
2094
+ return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && /macintosh|mac os x/i.test(navigator.userAgent);
2095
+ };
2096
+
2097
+ /***/ }),
2098
+
2099
+ /***/ 37:
91
2100
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
2101
 
93
2102
  "use strict";
94
2103
  // ESM COMPAT FLAG
95
2104
  __webpack_require__.r(__webpack_exports__);
96
2105
 
97
- // EXTERNAL MODULE: external "cy-element-ui/lib/utils/vue-popper"
98
- var vue_popper_ = __webpack_require__(5);
99
- var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
2106
+ // EXTERNAL MODULE: ./src/utils/vue-popper.js
2107
+ var vue_popper = __webpack_require__(10);
100
2108
 
101
2109
  // EXTERNAL MODULE: external "throttle-debounce/debounce"
102
- var debounce_ = __webpack_require__(19);
2110
+ var debounce_ = __webpack_require__(22);
103
2111
  var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
104
2112
 
105
- // EXTERNAL MODULE: external "cy-element-ui/lib/utils/dom"
106
- var dom_ = __webpack_require__(2);
2113
+ // EXTERNAL MODULE: ./src/utils/dom.js
2114
+ var dom = __webpack_require__(1);
107
2115
 
108
- // EXTERNAL MODULE: external "cy-element-ui/lib/utils/util"
109
- var util_ = __webpack_require__(3);
2116
+ // EXTERNAL MODULE: ./src/utils/util.js
2117
+ var util = __webpack_require__(3);
110
2118
 
111
2119
  // EXTERNAL MODULE: external "vue"
112
- var external_vue_ = __webpack_require__(7);
2120
+ var external_vue_ = __webpack_require__(0);
113
2121
  var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
114
2122
 
115
2123
  // CONCATENATED MODULE: ./packages/tooltip/src/main.js
@@ -122,7 +2130,7 @@ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
122
2130
  /* harmony default export */ var main = ({
123
2131
  name: 'ElTooltip',
124
2132
 
125
- mixins: [vue_popper_default.a],
2133
+ mixins: [vue_popper["a" /* default */]],
126
2134
 
127
2135
  props: {
128
2136
  openDelay: {
@@ -172,7 +2180,7 @@ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
172
2180
 
173
2181
  data: function data() {
174
2182
  return {
175
- tooltipId: 'el-tooltip-' + Object(util_["generateId"])(),
2183
+ tooltipId: 'el-tooltip-' + Object(util["g" /* generateId */])(),
176
2184
  timeoutPending: null,
177
2185
  focusing: false
178
2186
  };
@@ -250,9 +2258,9 @@ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
250
2258
  if (this.$el.nodeType === 1) {
251
2259
  this.$el.setAttribute('aria-describedby', this.tooltipId);
252
2260
  this.$el.setAttribute('tabindex', this.tabindex);
253
- Object(dom_["on"])(this.referenceElm, 'mouseenter', this.show);
254
- Object(dom_["on"])(this.referenceElm, 'mouseleave', this.hide);
255
- Object(dom_["on"])(this.referenceElm, 'focus', function () {
2261
+ Object(dom["g" /* on */])(this.referenceElm, 'mouseenter', this.show);
2262
+ Object(dom["g" /* on */])(this.referenceElm, 'mouseleave', this.hide);
2263
+ Object(dom["g" /* on */])(this.referenceElm, 'focus', function () {
256
2264
  if (!_this3.$slots.default || !_this3.$slots.default.length) {
257
2265
  _this3.handleFocus();
258
2266
  return;
@@ -264,8 +2272,8 @@ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
264
2272
  _this3.handleFocus();
265
2273
  }
266
2274
  });
267
- Object(dom_["on"])(this.referenceElm, 'blur', this.handleBlur);
268
- Object(dom_["on"])(this.referenceElm, 'click', this.removeFocusing);
2275
+ Object(dom["g" /* on */])(this.referenceElm, 'blur', this.handleBlur);
2276
+ Object(dom["g" /* on */])(this.referenceElm, 'click', this.removeFocusing);
269
2277
  }
270
2278
  // fix issue https://github.com/ElemeFE/element/issues/14424
271
2279
  if (this.value && this.popperVM) {
@@ -280,9 +2288,9 @@ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
280
2288
  watch: {
281
2289
  focusing: function focusing(val) {
282
2290
  if (val) {
283
- Object(dom_["addClass"])(this.referenceElm, 'focusing');
2291
+ Object(dom["a" /* addClass */])(this.referenceElm, 'focusing');
284
2292
  } else {
285
- Object(dom_["removeClass"])(this.referenceElm, 'focusing');
2293
+ Object(dom["i" /* removeClass */])(this.referenceElm, 'focusing');
286
2294
  }
287
2295
  }
288
2296
  },
@@ -367,11 +2375,11 @@ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
367
2375
  destroyed: function destroyed() {
368
2376
  var reference = this.referenceElm;
369
2377
  if (reference.nodeType === 1) {
370
- Object(dom_["off"])(reference, 'mouseenter', this.show);
371
- Object(dom_["off"])(reference, 'mouseleave', this.hide);
372
- Object(dom_["off"])(reference, 'focus', this.handleFocus);
373
- Object(dom_["off"])(reference, 'blur', this.handleBlur);
374
- Object(dom_["off"])(reference, 'click', this.removeFocusing);
2378
+ Object(dom["f" /* off */])(reference, 'mouseenter', this.show);
2379
+ Object(dom["f" /* off */])(reference, 'mouseleave', this.hide);
2380
+ Object(dom["f" /* off */])(reference, 'focus', this.handleFocus);
2381
+ Object(dom["f" /* off */])(reference, 'blur', this.handleBlur);
2382
+ Object(dom["f" /* off */])(reference, 'click', this.removeFocusing);
375
2383
  }
376
2384
  }
377
2385
  });
@@ -387,38 +2395,555 @@ main.install = function (Vue) {
387
2395
 
388
2396
  /***/ }),
389
2397
 
390
- /***/ 19:
391
- /***/ (function(module, exports) {
2398
+ /***/ 4:
2399
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
392
2400
 
393
- module.exports = require("throttle-debounce/debounce");
2401
+ "use strict";
2402
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isString; });
2403
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isObject; });
2404
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isHtmlElement; });
2405
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isFunction; });
2406
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isUndefined; });
2407
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isDefined; });
2408
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
2409
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
2410
+ 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; };
394
2411
 
395
- /***/ }),
396
2412
 
397
- /***/ 2:
398
- /***/ (function(module, exports) {
399
2413
 
400
- module.exports = require("cy-element-ui/lib/utils/dom");
2414
+ function isString(obj) {
2415
+ return Object.prototype.toString.call(obj) === '[object String]';
2416
+ }
2417
+
2418
+ function isObject(obj) {
2419
+ return Object.prototype.toString.call(obj) === '[object Object]';
2420
+ }
2421
+
2422
+ function isHtmlElement(node) {
2423
+ return node && node.nodeType === Node.ELEMENT_NODE;
2424
+ }
2425
+
2426
+ /**
2427
+ * - Inspired:
2428
+ * https://github.com/jashkenas/underscore/blob/master/modules/isFunction.js
2429
+ */
2430
+ var isFunction = function isFunction(functionToCheck) {
2431
+ var getType = {};
2432
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
2433
+ };
2434
+
2435
+ if ( true && (typeof Int8Array === 'undefined' ? 'undefined' : _typeof(Int8Array)) !== 'object' && (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer || typeof document.childNodes !== 'function')) {
2436
+ isFunction = function isFunction(obj) {
2437
+ return typeof obj === 'function' || false;
2438
+ };
2439
+ }
2440
+
2441
+
2442
+
2443
+ var isUndefined = function isUndefined(val) {
2444
+ return val === void 0;
2445
+ };
2446
+
2447
+ var isDefined = function isDefined(val) {
2448
+ return val !== undefined && val !== null;
2449
+ };
401
2450
 
402
2451
  /***/ }),
403
2452
 
404
- /***/ 3:
405
- /***/ (function(module, exports) {
2453
+ /***/ 7:
2454
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
406
2455
 
407
- module.exports = require("cy-element-ui/lib/utils/util");
2456
+ "use strict";
2457
+ /* harmony default export */ __webpack_exports__["a"] = (function (target) {
2458
+ for (var i = 1, j = arguments.length; i < j; i++) {
2459
+ var source = arguments[i] || {};
2460
+ for (var prop in source) {
2461
+ if (source.hasOwnProperty(prop)) {
2462
+ var value = source[prop];
2463
+ if (value !== undefined) {
2464
+ target[prop] = value;
2465
+ }
2466
+ }
2467
+ }
2468
+ }
2469
+
2470
+ return target;
2471
+ });;
408
2472
 
409
2473
  /***/ }),
410
2474
 
411
- /***/ 5:
412
- /***/ (function(module, exports) {
2475
+ /***/ 8:
2476
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
413
2477
 
414
- module.exports = require("cy-element-ui/lib/utils/vue-popper");
2478
+ "use strict";
2479
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
2480
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
2481
+
2482
+
2483
+ var scrollBarWidth = void 0;
2484
+
2485
+ /* harmony default export */ __webpack_exports__["a"] = (function () {
2486
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return 0;
2487
+ if (scrollBarWidth !== undefined) return scrollBarWidth;
2488
+
2489
+ var outer = document.createElement('div');
2490
+ outer.className = 'el-scrollbar__wrap';
2491
+ outer.style.visibility = 'hidden';
2492
+ outer.style.width = '100px';
2493
+ outer.style.position = 'absolute';
2494
+ outer.style.top = '-9999px';
2495
+ document.body.appendChild(outer);
2496
+
2497
+ var widthNoScroll = outer.offsetWidth;
2498
+ outer.style.overflow = 'scroll';
2499
+
2500
+ var inner = document.createElement('div');
2501
+ inner.style.width = '100%';
2502
+ outer.appendChild(inner);
2503
+
2504
+ var widthWithScroll = inner.offsetWidth;
2505
+ outer.parentNode.removeChild(outer);
2506
+ scrollBarWidth = widthNoScroll - widthWithScroll;
2507
+
2508
+ return scrollBarWidth;
2509
+ });;
415
2510
 
416
2511
  /***/ }),
417
2512
 
418
- /***/ 7:
419
- /***/ (function(module, exports) {
2513
+ /***/ 9:
2514
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2515
+
2516
+ "use strict";
2517
+
2518
+ // EXPORTS
2519
+ __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ popup_manager; });
2520
+
2521
+ // EXTERNAL MODULE: external "vue"
2522
+ var external_vue_ = __webpack_require__(0);
2523
+ var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
2524
+
2525
+ // EXTERNAL MODULE: ./src/utils/merge.js
2526
+ var merge = __webpack_require__(7);
2527
+
2528
+ // EXTERNAL MODULE: ./src/utils/dom.js
2529
+ var utils_dom = __webpack_require__(1);
2530
+
2531
+ // CONCATENATED MODULE: ./src/utils/popup/popup-manager.js
2532
+
2533
+
2534
+
2535
+ var hasModal = false;
2536
+ var hasInitZIndex = false;
2537
+ var popup_manager_zIndex = void 0;
2538
+
2539
+ var popup_manager_getModal = function getModal() {
2540
+ if (external_vue_default.a.prototype.$isServer) return;
2541
+ var modalDom = PopupManager.modalDom;
2542
+ if (modalDom) {
2543
+ hasModal = true;
2544
+ } else {
2545
+ hasModal = false;
2546
+ modalDom = document.createElement('div');
2547
+ PopupManager.modalDom = modalDom;
2548
+
2549
+ modalDom.addEventListener('touchmove', function (event) {
2550
+ event.preventDefault();
2551
+ event.stopPropagation();
2552
+ });
2553
+
2554
+ modalDom.addEventListener('click', function () {
2555
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
2556
+ });
2557
+ }
2558
+
2559
+ return modalDom;
2560
+ };
2561
+
2562
+ var instances = {};
2563
+
2564
+ var PopupManager = {
2565
+ modalFade: true,
2566
+
2567
+ getInstance: function getInstance(id) {
2568
+ return instances[id];
2569
+ },
2570
+
2571
+ register: function register(id, instance) {
2572
+ if (id && instance) {
2573
+ instances[id] = instance;
2574
+ }
2575
+ },
2576
+
2577
+ deregister: function deregister(id) {
2578
+ if (id) {
2579
+ instances[id] = null;
2580
+ delete instances[id];
2581
+ }
2582
+ },
2583
+
2584
+ nextZIndex: function nextZIndex() {
2585
+ return PopupManager.zIndex++;
2586
+ },
2587
+
2588
+ modalStack: [],
2589
+
2590
+ doOnModalClick: function doOnModalClick() {
2591
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
2592
+ if (!topItem) return;
2593
+
2594
+ var instance = PopupManager.getInstance(topItem.id);
2595
+ if (instance && instance.closeOnClickModal) {
2596
+ instance.close();
2597
+ }
2598
+ },
2599
+
2600
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
2601
+ if (external_vue_default.a.prototype.$isServer) return;
2602
+ if (!id || zIndex === undefined) return;
2603
+ this.modalFade = modalFade;
2604
+
2605
+ var modalStack = this.modalStack;
2606
+
2607
+ for (var i = 0, j = modalStack.length; i < j; i++) {
2608
+ var item = modalStack[i];
2609
+ if (item.id === id) {
2610
+ return;
2611
+ }
2612
+ }
2613
+
2614
+ var modalDom = popup_manager_getModal();
2615
+
2616
+ Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal');
2617
+ if (this.modalFade && !hasModal) {
2618
+ Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal-enter');
2619
+ }
2620
+ if (modalClass) {
2621
+ var classArr = modalClass.trim().split(/\s+/);
2622
+ classArr.forEach(function (item) {
2623
+ return Object(utils_dom["a" /* addClass */])(modalDom, item);
2624
+ });
2625
+ }
2626
+ setTimeout(function () {
2627
+ Object(utils_dom["i" /* removeClass */])(modalDom, 'v-modal-enter');
2628
+ }, 200);
2629
+
2630
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
2631
+ dom.parentNode.appendChild(modalDom);
2632
+ } else {
2633
+ document.body.appendChild(modalDom);
2634
+ }
2635
+
2636
+ if (zIndex) {
2637
+ modalDom.style.zIndex = zIndex;
2638
+ }
2639
+ modalDom.tabIndex = 0;
2640
+ modalDom.style.display = '';
2641
+
2642
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
2643
+ },
2644
+
2645
+ closeModal: function closeModal(id) {
2646
+ var modalStack = this.modalStack;
2647
+ var modalDom = popup_manager_getModal();
2648
+
2649
+ if (modalStack.length > 0) {
2650
+ var topItem = modalStack[modalStack.length - 1];
2651
+ if (topItem.id === id) {
2652
+ if (topItem.modalClass) {
2653
+ var classArr = topItem.modalClass.trim().split(/\s+/);
2654
+ classArr.forEach(function (item) {
2655
+ return Object(utils_dom["i" /* removeClass */])(modalDom, item);
2656
+ });
2657
+ }
2658
+
2659
+ modalStack.pop();
2660
+ if (modalStack.length > 0) {
2661
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
2662
+ }
2663
+ } else {
2664
+ for (var i = modalStack.length - 1; i >= 0; i--) {
2665
+ if (modalStack[i].id === id) {
2666
+ modalStack.splice(i, 1);
2667
+ break;
2668
+ }
2669
+ }
2670
+ }
2671
+ }
2672
+
2673
+ if (modalStack.length === 0) {
2674
+ if (this.modalFade) {
2675
+ Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal-leave');
2676
+ }
2677
+ setTimeout(function () {
2678
+ if (modalStack.length === 0) {
2679
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
2680
+ modalDom.style.display = 'none';
2681
+ PopupManager.modalDom = undefined;
2682
+ }
2683
+ Object(utils_dom["i" /* removeClass */])(modalDom, 'v-modal-leave');
2684
+ }, 200);
2685
+ }
2686
+ }
2687
+ };
2688
+
2689
+ Object.defineProperty(PopupManager, 'zIndex', {
2690
+ configurable: true,
2691
+ get: function get() {
2692
+ if (!hasInitZIndex) {
2693
+ popup_manager_zIndex = popup_manager_zIndex || (external_vue_default.a.prototype.$ELEMENT || {}).zIndex || 2000;
2694
+ hasInitZIndex = true;
2695
+ }
2696
+ return popup_manager_zIndex;
2697
+ },
2698
+ set: function set(value) {
2699
+ popup_manager_zIndex = value;
2700
+ }
2701
+ });
2702
+
2703
+ var popup_manager_getTopPopup = function getTopPopup() {
2704
+ if (external_vue_default.a.prototype.$isServer) return;
2705
+ if (PopupManager.modalStack.length > 0) {
2706
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
2707
+ if (!topPopup) return;
2708
+ var instance = PopupManager.getInstance(topPopup.id);
2709
+
2710
+ return instance;
2711
+ }
2712
+ };
2713
+
2714
+ if (!external_vue_default.a.prototype.$isServer) {
2715
+ // handle `esc` key when the popup is shown
2716
+ window.addEventListener('keydown', function (event) {
2717
+ if (event.keyCode === 27) {
2718
+ var topPopup = popup_manager_getTopPopup();
2719
+
2720
+ if (topPopup && topPopup.closeOnPressEscape) {
2721
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
2722
+ }
2723
+ }
2724
+ });
2725
+ }
2726
+
2727
+ /* harmony default export */ var popup_manager = (PopupManager);
2728
+ // EXTERNAL MODULE: ./src/utils/scrollbar-width.js
2729
+ var scrollbar_width = __webpack_require__(8);
2730
+
2731
+ // CONCATENATED MODULE: ./src/utils/popup/index.js
2732
+
2733
+
2734
+
2735
+
2736
+
2737
+
2738
+ var idSeed = 1;
2739
+
2740
+ var scrollBarWidth = void 0;
2741
+
2742
+ /* harmony default export */ var popup = __webpack_exports__["b"] = ({
2743
+ props: {
2744
+ visible: {
2745
+ type: Boolean,
2746
+ default: false
2747
+ },
2748
+ openDelay: {},
2749
+ closeDelay: {},
2750
+ zIndex: {},
2751
+ modal: {
2752
+ type: Boolean,
2753
+ default: false
2754
+ },
2755
+ modalFade: {
2756
+ type: Boolean,
2757
+ default: true
2758
+ },
2759
+ modalClass: {},
2760
+ modalAppendToBody: {
2761
+ type: Boolean,
2762
+ default: false
2763
+ },
2764
+ lockScroll: {
2765
+ type: Boolean,
2766
+ default: true
2767
+ },
2768
+ closeOnPressEscape: {
2769
+ type: Boolean,
2770
+ default: false
2771
+ },
2772
+ closeOnClickModal: {
2773
+ type: Boolean,
2774
+ default: false
2775
+ }
2776
+ },
2777
+
2778
+ beforeMount: function beforeMount() {
2779
+ this._popupId = 'popup-' + idSeed++;
2780
+ popup_manager.register(this._popupId, this);
2781
+ },
2782
+ beforeDestroy: function beforeDestroy() {
2783
+ popup_manager.deregister(this._popupId);
2784
+ popup_manager.closeModal(this._popupId);
2785
+
2786
+ this.restoreBodyStyle();
2787
+ },
2788
+ data: function data() {
2789
+ return {
2790
+ opened: false,
2791
+ bodyPaddingRight: null,
2792
+ computedBodyPaddingRight: 0,
2793
+ withoutHiddenClass: true,
2794
+ rendered: false
2795
+ };
2796
+ },
2797
+
2798
+
2799
+ watch: {
2800
+ visible: function visible(val) {
2801
+ var _this = this;
2802
+
2803
+ if (val) {
2804
+ if (this._opening) return;
2805
+ if (!this.rendered) {
2806
+ this.rendered = true;
2807
+ external_vue_default.a.nextTick(function () {
2808
+ _this.open();
2809
+ });
2810
+ } else {
2811
+ this.open();
2812
+ }
2813
+ } else {
2814
+ this.close();
2815
+ }
2816
+ }
2817
+ },
2818
+
2819
+ methods: {
2820
+ open: function open(options) {
2821
+ var _this2 = this;
2822
+
2823
+ if (!this.rendered) {
2824
+ this.rendered = true;
2825
+ }
2826
+
2827
+ var props = Object(merge["a" /* default */])({}, this.$props || this, options);
2828
+
2829
+ if (this._closeTimer) {
2830
+ clearTimeout(this._closeTimer);
2831
+ this._closeTimer = null;
2832
+ }
2833
+ clearTimeout(this._openTimer);
2834
+
2835
+ var openDelay = Number(props.openDelay);
2836
+ if (openDelay > 0) {
2837
+ this._openTimer = setTimeout(function () {
2838
+ _this2._openTimer = null;
2839
+ _this2.doOpen(props);
2840
+ }, openDelay);
2841
+ } else {
2842
+ this.doOpen(props);
2843
+ }
2844
+ },
2845
+ doOpen: function doOpen(props) {
2846
+ if (this.$isServer) return;
2847
+ if (this.willOpen && !this.willOpen()) return;
2848
+ if (this.opened) return;
2849
+
2850
+ this._opening = true;
2851
+
2852
+ var dom = this.$el;
2853
+
2854
+ var modal = props.modal;
2855
+
2856
+ var zIndex = props.zIndex;
2857
+ if (zIndex) {
2858
+ popup_manager.zIndex = zIndex;
2859
+ }
2860
+
2861
+ if (modal) {
2862
+ if (this._closing) {
2863
+ popup_manager.closeModal(this._popupId);
2864
+ this._closing = false;
2865
+ }
2866
+ popup_manager.openModal(this._popupId, popup_manager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
2867
+ if (props.lockScroll) {
2868
+ this.withoutHiddenClass = !Object(utils_dom["d" /* hasClass */])(document.body, 'el-popup-parent--hidden');
2869
+ if (this.withoutHiddenClass) {
2870
+ this.bodyPaddingRight = document.body.style.paddingRight;
2871
+ this.computedBodyPaddingRight = parseInt(Object(utils_dom["c" /* getStyle */])(document.body, 'paddingRight'), 10);
2872
+ }
2873
+ scrollBarWidth = Object(scrollbar_width["a" /* default */])();
2874
+ var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
2875
+ var bodyOverflowY = Object(utils_dom["c" /* getStyle */])(document.body, 'overflowY');
2876
+ if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
2877
+ document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
2878
+ }
2879
+ Object(utils_dom["a" /* addClass */])(document.body, 'el-popup-parent--hidden');
2880
+ }
2881
+ }
2882
+
2883
+ if (getComputedStyle(dom).position === 'static') {
2884
+ dom.style.position = 'absolute';
2885
+ }
2886
+
2887
+ dom.style.zIndex = popup_manager.nextZIndex();
2888
+ this.opened = true;
2889
+
2890
+ this.onOpen && this.onOpen();
2891
+
2892
+ this.doAfterOpen();
2893
+ },
2894
+ doAfterOpen: function doAfterOpen() {
2895
+ this._opening = false;
2896
+ },
2897
+ close: function close() {
2898
+ var _this3 = this;
2899
+
2900
+ if (this.willClose && !this.willClose()) return;
2901
+
2902
+ if (this._openTimer !== null) {
2903
+ clearTimeout(this._openTimer);
2904
+ this._openTimer = null;
2905
+ }
2906
+ clearTimeout(this._closeTimer);
2907
+
2908
+ var closeDelay = Number(this.closeDelay);
2909
+
2910
+ if (closeDelay > 0) {
2911
+ this._closeTimer = setTimeout(function () {
2912
+ _this3._closeTimer = null;
2913
+ _this3.doClose();
2914
+ }, closeDelay);
2915
+ } else {
2916
+ this.doClose();
2917
+ }
2918
+ },
2919
+ doClose: function doClose() {
2920
+ this._closing = true;
2921
+
2922
+ this.onClose && this.onClose();
2923
+
2924
+ if (this.lockScroll) {
2925
+ setTimeout(this.restoreBodyStyle, 200);
2926
+ }
2927
+
2928
+ this.opened = false;
2929
+
2930
+ this.doAfterClose();
2931
+ },
2932
+ doAfterClose: function doAfterClose() {
2933
+ popup_manager.closeModal(this._popupId);
2934
+ this._closing = false;
2935
+ },
2936
+ restoreBodyStyle: function restoreBodyStyle() {
2937
+ if (this.modal && this.withoutHiddenClass) {
2938
+ document.body.style.paddingRight = this.bodyPaddingRight;
2939
+ Object(utils_dom["i" /* removeClass */])(document.body, 'el-popup-parent--hidden');
2940
+ }
2941
+ this.withoutHiddenClass = true;
2942
+ }
2943
+ }
2944
+ });
2945
+
420
2946
 
421
- module.exports = require("vue");
422
2947
 
423
2948
  /***/ })
424
2949