@mdsfe/mds-ui 0.2.0 → 0.2.9-rc.1

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 (131) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/README.md +9 -9
  3. package/dist/_mixin/popper.js +1 -0
  4. package/dist/_util/_popper/dom-helper.js +284 -0
  5. package/dist/_util/_popper/popper-mixin.js +35 -0
  6. package/dist/_util/_popper/popper.js +1267 -0
  7. package/dist/_util/_popper/popup/popup-main.js +224 -0
  8. package/dist/_util/_popper/popup/popup-manager.js +205 -0
  9. package/dist/_util/_popper/vue-popper.js +204 -0
  10. package/dist/_util/popup/index.js +1 -1
  11. package/dist/_util/tree/node.js +2 -0
  12. package/dist/_util/tree/tree.js +65 -21
  13. package/dist/_util/util.js +29 -1
  14. package/dist/affix.js +18 -18
  15. package/dist/anchor.js +18 -18
  16. package/dist/avatar.js +17 -17
  17. package/dist/backtop.js +19 -19
  18. package/dist/badge.js +21 -21
  19. package/dist/bordershadow.js +20 -9
  20. package/dist/breadcrumb.js +18 -18
  21. package/dist/button.js +21 -21
  22. package/dist/card.js +18 -18
  23. package/dist/carousel.js +76 -76
  24. package/dist/cascader.js +4980 -0
  25. package/dist/cascaderpanel.js +645 -603
  26. package/dist/checkbox.js +23 -23
  27. package/dist/col.js +14 -14
  28. package/dist/collapse.js +6 -6
  29. package/dist/color.js +6 -6
  30. package/dist/datepicker.js +2487 -266
  31. package/dist/divider.js +19 -19
  32. package/dist/drawer.js +787 -37
  33. package/dist/dropdown.js +150 -104
  34. package/dist/empty.js +19 -19
  35. package/dist/font/iconfont.28359fa.ttf +0 -0
  36. package/dist/font/iconfont.486e3d3.woff2 +0 -0
  37. package/dist/font/iconfont.675049e.woff +0 -0
  38. package/dist/font.js +6 -6
  39. package/dist/form.js +28 -26
  40. package/dist/icon.js +55 -47
  41. package/dist/index.js +1 -1
  42. package/dist/input.js +65 -49
  43. package/dist/inputnumber.js +59 -39
  44. package/dist/layout.js +25 -25
  45. package/dist/list.js +17 -17
  46. package/dist/loading.js +21 -8
  47. package/dist/mds-ui.min.css +3 -3
  48. package/dist/mds-ui.min.js +19183 -15407
  49. package/dist/menu.js +31 -31
  50. package/dist/message.js +773 -24
  51. package/dist/modal.js +1146 -307
  52. package/dist/notification.js +27 -27
  53. package/dist/pagination.js +78 -55
  54. package/dist/popconfirm.js +36 -36
  55. package/dist/popover.js +2778 -48
  56. package/dist/progress.js +107 -65
  57. package/dist/radio.js +56 -54
  58. package/dist/rate.js +67 -59
  59. package/dist/row.js +14 -14
  60. package/dist/select.js +847 -503
  61. package/dist/slider.js +25 -25
  62. package/dist/slottable.js +2663 -129
  63. package/dist/steps.js +18 -18
  64. package/dist/style/affix.css +224 -2
  65. package/dist/style/anchor.css +224 -2
  66. package/dist/style/avatar.css +224 -2
  67. package/dist/style/badge.css +224 -2
  68. package/dist/style/bordershadow.css +236 -59
  69. package/dist/style/breadcrumb.css +224 -2
  70. package/dist/style/button.css +234 -5
  71. package/dist/style/card.css +224 -2
  72. package/dist/style/carousel.css +224 -2
  73. package/dist/style/cascader.css +214 -0
  74. package/dist/style/cascaderpanel.css +13 -16
  75. package/dist/style/checkbox.css +230 -8
  76. package/dist/style/col.css +225 -3
  77. package/dist/style/collapse.css +224 -2
  78. package/dist/style/color.css +224 -2
  79. package/dist/style/datepicker.css +236 -2
  80. package/dist/style/divider.css +227 -2
  81. package/dist/style/drawer.css +224 -2
  82. package/dist/style/dropdown.css +234 -5
  83. package/dist/style/empty.css +224 -2
  84. package/dist/style/font.css +226 -4
  85. package/dist/style/form.css +224 -2
  86. package/dist/style/icon.css +226 -3
  87. package/dist/style/input.css +231 -5
  88. package/dist/style/inputnumber.css +224 -2
  89. package/dist/style/layout.css +224 -2
  90. package/dist/style/list.css +224 -2
  91. package/dist/style/loading.css +2527 -2
  92. package/dist/style/menu.css +340 -129
  93. package/dist/style/message.css +1 -4
  94. package/dist/style/modal.css +247 -25
  95. package/dist/style/notification.css +224 -2
  96. package/dist/style/pagination.css +236 -7
  97. package/dist/style/popconfirm.css +334 -180
  98. package/dist/style/popover.css +324 -177
  99. package/dist/style/progress.css +226 -3
  100. package/dist/style/radio.css +225 -3
  101. package/dist/style/rate.css +226 -3
  102. package/dist/style/row.css +225 -3
  103. package/dist/style/select.css +240 -12
  104. package/dist/style/slider.css +224 -2
  105. package/dist/style/slottable.css +350 -149
  106. package/dist/style/steps.css +224 -2
  107. package/dist/style/switch.css +224 -2
  108. package/dist/style/table.css +458 -314
  109. package/dist/style/tabs.css +225 -18
  110. package/dist/style/tag.css +224 -2
  111. package/dist/style/text.css +224 -2
  112. package/dist/style/timeline.css +224 -2
  113. package/dist/style/timepicker.css +231 -6
  114. package/dist/style/tooltip.css +340 -129
  115. package/dist/style/tree.css +228 -6
  116. package/dist/style/typography.css +224 -2
  117. package/dist/style/upload.css +224 -2
  118. package/dist/switch.js +20 -20
  119. package/dist/table.js +3071 -201
  120. package/dist/tabs.js +24 -22
  121. package/dist/tag.js +17 -23
  122. package/dist/text.js +38 -22
  123. package/dist/timeline.js +14 -14
  124. package/dist/timepicker.js +3063 -172
  125. package/dist/tooltip.js +2550 -27
  126. package/dist/transfer.js +28 -28
  127. package/dist/transition.js +6 -6
  128. package/dist/tree.js +316 -171
  129. package/dist/typography.js +6 -6
  130. package/dist/upload.js +46 -38
  131. package/package.json +9 -5
package/dist/tooltip.js CHANGED
@@ -1,13 +1,13 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("./_mixin/tooltip"));
3
+ module.exports = factory(require("vue"), require("./transition"));
4
4
  else if(typeof define === 'function' && define.amd)
5
- define(["./_mixin/tooltip"], factory);
5
+ define(["vue", "./transition"], factory);
6
6
  else {
7
- var a = typeof exports === 'object' ? factory(require("./_mixin/tooltip")) : factory(root["./_mixin/tooltip"]);
7
+ var a = typeof exports === 'object' ? factory(require("vue"), require("./transition")) : factory(root["Vue"], root["./transition"]);
8
8
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
9
  }
10
- })(window, function(__WEBPACK_EXTERNAL_MODULE__16__) {
10
+ })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__11__) {
11
11
  return /******/ (function(modules) { // webpackBootstrap
12
12
  /******/ // The module cache
13
13
  /******/ var installedModules = {};
@@ -91,46 +91,2096 @@ return /******/ (function(modules) { // webpackBootstrap
91
91
  /******/
92
92
  /******/
93
93
  /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = 36);
94
+ /******/ return __webpack_require__(__webpack_require__.s = 44);
95
95
  /******/ })
96
96
  /************************************************************************/
97
97
  /******/ ({
98
98
 
99
- /***/ 131:
99
+ /***/ 1:
100
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
101
+
102
+ "use strict";
103
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; });
104
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; });
105
+ /* unused harmony export once */
106
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; });
107
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
108
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return removeClass; });
109
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; });
110
+ /* unused harmony export setStyle */
111
+ /* unused harmony export isScroll */
112
+ /* unused harmony export getScrollContainer */
113
+ /* unused harmony export isInContainer */
114
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return merge; });
115
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollBarWidth; });
116
+ /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
117
+ /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
118
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
119
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__);
120
+
121
+
122
+
123
+ /* eslint-disable */
124
+ var isServer = vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer;
125
+ var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
126
+ var MOZ_HACK_REGEXP = /^moz([A-Z])/;
127
+ var ieVersion = isServer ? 0 : Number(document.documentMode);
128
+
129
+ /* istanbul ignore next */
130
+ var trim = function trim(string) {
131
+ return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
132
+ };
133
+ /* istanbul ignore next */
134
+ var camelCase = function camelCase(name) {
135
+ return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
136
+ return offset ? letter.toUpperCase() : letter;
137
+ }).replace(MOZ_HACK_REGEXP, 'Moz$1');
138
+ };
139
+
140
+ /* istanbul ignore next */
141
+ var on = function () {
142
+ if (!isServer && document.addEventListener) {
143
+ return function (element, event, handler) {
144
+ if (element && event && handler) {
145
+ element.addEventListener(event, handler, false);
146
+ }
147
+ };
148
+ } else {
149
+ return function (element, event, handler) {
150
+ if (element && event && handler) {
151
+ element.attachEvent('on' + event, handler);
152
+ }
153
+ };
154
+ }
155
+ }();
156
+
157
+ /* istanbul ignore next */
158
+ var off = function () {
159
+ if (!isServer && document.removeEventListener) {
160
+ return function (element, event, handler) {
161
+ if (element && event) {
162
+ element.removeEventListener(event, handler, false);
163
+ }
164
+ };
165
+ } else {
166
+ return function (element, event, handler) {
167
+ if (element && event) {
168
+ element.detachEvent('on' + event, handler);
169
+ }
170
+ };
171
+ }
172
+ }();
173
+
174
+ /* istanbul ignore next */
175
+ var once = function once(el, event, fn) {
176
+ var listener = function listener() {
177
+ if (fn) {
178
+ fn.apply(this, arguments);
179
+ }
180
+ off(el, event, listener);
181
+ };
182
+ on(el, event, listener);
183
+ };
184
+
185
+ /* istanbul ignore next */
186
+ function hasClass(el, cls) {
187
+ if (!el || !cls) return false;
188
+ if (cls.indexOf(' ') !== -1) {
189
+ throw new Error('className should not contain space.');
190
+ }
191
+ if (el.classList) {
192
+ return el.classList.contains(cls);
193
+ } else {
194
+ return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
195
+ }
196
+ }
197
+
198
+ /* istanbul ignore next */
199
+ function addClass(el, cls) {
200
+ if (!el) return;
201
+ var curClass = el.className;
202
+ var classes = (cls || '').split(' ');
203
+
204
+ for (var i = 0, j = classes.length; i < j; i++) {
205
+ var clsName = classes[i];
206
+ if (!clsName) continue;
207
+
208
+ if (el.classList) {
209
+ el.classList.add(clsName);
210
+ } else if (!hasClass(el, clsName)) {
211
+ curClass += ' ' + clsName;
212
+ }
213
+ }
214
+ if (!el.classList) {
215
+ el.setAttribute('class', curClass);
216
+ }
217
+ }
218
+
219
+ /* istanbul ignore next */
220
+ function removeClass(el, cls) {
221
+ if (!el || !cls) return;
222
+ var classes = cls.split(' ');
223
+ var curClass = ' ' + el.className + ' ';
224
+
225
+ for (var i = 0, j = classes.length; i < j; i++) {
226
+ var clsName = classes[i];
227
+ if (!clsName) continue;
228
+
229
+ if (el.classList) {
230
+ el.classList.remove(clsName);
231
+ } else if (hasClass(el, clsName)) {
232
+ curClass = curClass.replace(' ' + clsName + ' ', ' ');
233
+ }
234
+ }
235
+ if (!el.classList) {
236
+ el.setAttribute('class', trim(curClass));
237
+ }
238
+ }
239
+
240
+ /* istanbul ignore next */
241
+ var getStyle = ieVersion < 9 ? function (element, styleName) {
242
+ if (isServer) return;
243
+ if (!element || !styleName) return null;
244
+ styleName = camelCase(styleName);
245
+ if (styleName === 'float') {
246
+ styleName = 'styleFloat';
247
+ }
248
+ try {
249
+ switch (styleName) {
250
+ case 'opacity':
251
+ try {
252
+ return element.filters.item('alpha').opacity / 100;
253
+ } catch (e) {
254
+ return 1.0;
255
+ }
256
+ default:
257
+ return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
258
+ }
259
+ } catch (e) {
260
+ return element.style[styleName];
261
+ }
262
+ } : function (element, styleName) {
263
+ if (isServer) return;
264
+ if (!element || !styleName) return null;
265
+ styleName = camelCase(styleName);
266
+ if (styleName === 'float') {
267
+ styleName = 'cssFloat';
268
+ }
269
+ try {
270
+ var computed = document.defaultView.getComputedStyle(element, '');
271
+ return element.style[styleName] || computed ? computed[styleName] : null;
272
+ } catch (e) {
273
+ return element.style[styleName];
274
+ }
275
+ };
276
+
277
+ /* istanbul ignore next */
278
+ function setStyle(element, styleName, value) {
279
+ if (!element || !styleName) return;
280
+
281
+ if ((typeof styleName === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(styleName)) === 'object') {
282
+ for (var prop in styleName) {
283
+ if (styleName.hasOwnProperty(prop)) {
284
+ setStyle(element, prop, styleName[prop]);
285
+ }
286
+ }
287
+ } else {
288
+ styleName = camelCase(styleName);
289
+ if (styleName === 'opacity' && ieVersion < 9) {
290
+ element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
291
+ } else {
292
+ element.style[styleName] = value;
293
+ }
294
+ }
295
+ }
296
+
297
+ var isScroll = function isScroll(el, vertical) {
298
+ if (isServer) return;
299
+
300
+ var determinedDirection = vertical !== null && vertical !== undefined;
301
+ var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
302
+
303
+ return overflow.match(/(scroll|auto|overlay)/);
304
+ };
305
+
306
+ var getScrollContainer = function getScrollContainer(el, vertical) {
307
+ if (isServer) return;
308
+
309
+ var parent = el;
310
+ while (parent) {
311
+ if ([window, document, document.documentElement].includes(parent)) {
312
+ return window;
313
+ }
314
+ if (isScroll(parent, vertical)) {
315
+ return parent;
316
+ }
317
+ parent = parent.parentNode;
318
+ }
319
+
320
+ return parent;
321
+ };
322
+
323
+ var isInContainer = function isInContainer(el, container) {
324
+ if (isServer || !el || !container) return false;
325
+
326
+ var elRect = el.getBoundingClientRect();
327
+ var containerRect = void 0;
328
+
329
+ if ([window, document, document.documentElement, null, undefined].includes(container)) {
330
+ containerRect = {
331
+ top: 0,
332
+ right: window.innerWidth,
333
+ bottom: window.innerHeight,
334
+ left: 0
335
+ };
336
+ } else {
337
+ containerRect = container.getBoundingClientRect();
338
+ }
339
+
340
+ return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
341
+ };
342
+
343
+ function merge(target) {
344
+ for (var i = 1, j = arguments.length; i < j; i++) {
345
+ var source = arguments[i] || {};
346
+ for (var prop in source) {
347
+ if (source.hasOwnProperty(prop)) {
348
+ var value = source[prop];
349
+ if (value !== undefined) {
350
+ target[prop] = value;
351
+ }
352
+ }
353
+ }
354
+ }
355
+
356
+ return target;
357
+ }
358
+
359
+ var scrollBarWidth = void 0;
360
+ function getScrollBarWidth() {
361
+ if (vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer) return 0;
362
+ if (scrollBarWidth !== undefined) return scrollBarWidth;
363
+
364
+ var outer = document.createElement('div');
365
+ outer.className = 'el-scrollbar__wrap';
366
+ outer.style.visibility = 'hidden';
367
+ outer.style.width = '100px';
368
+ outer.style.position = 'absolute';
369
+ outer.style.top = '-9999px';
370
+ document.body.appendChild(outer);
371
+
372
+ var widthNoScroll = outer.offsetWidth;
373
+ outer.style.overflow = 'scroll';
374
+
375
+ var inner = document.createElement('div');
376
+ inner.style.width = '100%';
377
+ outer.appendChild(inner);
378
+
379
+ var widthWithScroll = inner.offsetWidth;
380
+ outer.parentNode.removeChild(outer);
381
+ scrollBarWidth = widthNoScroll - widthWithScroll;
382
+
383
+ return scrollBarWidth;
384
+ }
385
+
386
+ /***/ }),
387
+
388
+ /***/ 10:
389
+ /***/ (function(module, exports) {
390
+
391
+ module.exports = require("babel-runtime/core-js/object/keys");
392
+
393
+ /***/ }),
394
+
395
+ /***/ 11:
396
+ /***/ (function(module, exports) {
397
+
398
+ module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
399
+
400
+ /***/ }),
401
+
402
+ /***/ 139:
403
+ /***/ (function(module, exports) {
404
+
405
+ // removed by extract-text-webpack-plugin
406
+
407
+ /***/ }),
408
+
409
+ /***/ 14:
410
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
411
+
412
+ "use strict";
413
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
414
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
415
+ /* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
416
+ /* harmony import */ var _popup_manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
417
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _popup_manager__WEBPACK_IMPORTED_MODULE_2__["a"]; });
418
+
419
+
420
+
421
+
422
+
423
+ var idSeed = 1;
424
+
425
+ var scrollBarWidth = void 0;
426
+
427
+ /* harmony default export */ __webpack_exports__["b"] = ({
428
+ props: {
429
+ visibility: {
430
+ type: Boolean,
431
+ default: false
432
+ },
433
+ openDelay: {},
434
+ closeDelay: {},
435
+ zIndex: {},
436
+ modal: {
437
+ type: Boolean,
438
+ default: false
439
+ },
440
+ modalFade: {
441
+ type: Boolean,
442
+ default: true
443
+ },
444
+ modalClass: {},
445
+ modalAppendToBody: {
446
+ type: Boolean,
447
+ default: false
448
+ },
449
+ lockScroll: {
450
+ type: Boolean,
451
+ default: true
452
+ },
453
+ closeOnPressEscape: {
454
+ type: Boolean,
455
+ default: false
456
+ },
457
+ closeOnClickModal: {
458
+ type: Boolean,
459
+ default: false
460
+ }
461
+ },
462
+
463
+ beforeMount: function beforeMount() {
464
+ this._popupId = 'popup-' + idSeed++;
465
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].register(this._popupId, this);
466
+ },
467
+ beforeDestroy: function beforeDestroy() {
468
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].deregister(this._popupId);
469
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
470
+
471
+ this.restoreBodyStyle();
472
+ },
473
+ data: function data() {
474
+ return {
475
+ opened: false,
476
+ bodyPaddingRight: null,
477
+ computedBodyPaddingRight: 0,
478
+ withoutHiddenClass: true,
479
+ rendered: false
480
+ };
481
+ },
482
+
483
+
484
+ watch: {
485
+ visibility: function visibility(val) {
486
+ var _this = this;
487
+
488
+ if (val) {
489
+ if (this._opening) return;
490
+ if (!this.rendered) {
491
+ this.rendered = true;
492
+ vue__WEBPACK_IMPORTED_MODULE_0___default.a.nextTick(function () {
493
+ _this.open();
494
+ });
495
+ } else {
496
+ this.open();
497
+ }
498
+ } else {
499
+ this.close();
500
+ }
501
+ }
502
+ },
503
+
504
+ methods: {
505
+ open: function open(options) {
506
+ var _this2 = this;
507
+
508
+ if (!this.rendered) {
509
+ this.rendered = true;
510
+ }
511
+ var props = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* merge */ "e"])({}, this.$props || this, options);
512
+
513
+ if (this._closeTimer) {
514
+ clearTimeout(this._closeTimer);
515
+ this._closeTimer = null;
516
+ }
517
+ clearTimeout(this._openTimer);
518
+
519
+ var openDelay = Number(props.openDelay);
520
+ if (openDelay > 0) {
521
+ this._openTimer = setTimeout(function () {
522
+ _this2._openTimer = null;
523
+ _this2.doOpen(props);
524
+ }, openDelay);
525
+ } else {
526
+ this.doOpen(props);
527
+ }
528
+ },
529
+ doOpen: function doOpen(props) {
530
+ if (this.$isServer) return;
531
+ if (this.willOpen && !this.willOpen()) return;
532
+ if (this.opened) return;
533
+
534
+ this._opening = true;
535
+
536
+ var dom = this.$el;
537
+
538
+ var modal = props.modal;
539
+
540
+ var zIndex = props.zIndex;
541
+ if (zIndex) {
542
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].zIndex = zIndex;
543
+ }
544
+
545
+ if (modal) {
546
+ if (this._closing) {
547
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
548
+ this._closing = false;
549
+ }
550
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].openModal(this._popupId, _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
551
+ if (props.lockScroll) {
552
+ this.withoutHiddenClass = !Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* hasClass */ "d"])(document.body, 'mds-popup-parent--hidden');
553
+ if (this.withoutHiddenClass) {
554
+ this.bodyPaddingRight = document.body.style.paddingRight;
555
+ this.computedBodyPaddingRight = parseInt(Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'paddingRight'), 10);
556
+ }
557
+ scrollBarWidth = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getScrollBarWidth */ "b"])();
558
+ var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
559
+ var bodyOverflowY = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'overflowY');
560
+ if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
561
+ document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
562
+ }
563
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(document.body, 'mds-popup-parent--hidden');
564
+ }
565
+ }
566
+
567
+ if (getComputedStyle(dom).position === 'static') {
568
+ dom.style.position = 'absolute';
569
+ }
570
+
571
+ dom.style.zIndex = _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex();
572
+ this.opened = true;
573
+
574
+ this.onOpen && this.onOpen();
575
+
576
+ this.doAfterOpen();
577
+ },
578
+ doAfterOpen: function doAfterOpen() {
579
+ this._opening = false;
580
+ },
581
+ close: function close() {
582
+ var _this3 = this;
583
+
584
+ if (this.willClose && !this.willClose()) return;
585
+
586
+ if (this._openTimer !== null) {
587
+ clearTimeout(this._openTimer);
588
+ this._openTimer = null;
589
+ }
590
+ clearTimeout(this._closeTimer);
591
+
592
+ var closeDelay = Number(this.closeDelay);
593
+
594
+ if (closeDelay > 0) {
595
+ this._closeTimer = setTimeout(function () {
596
+ _this3._closeTimer = null;
597
+ _this3.doClose();
598
+ }, closeDelay);
599
+ } else {
600
+ this.doClose();
601
+ }
602
+ },
603
+ doClose: function doClose() {
604
+ this._closing = true;
605
+
606
+ this.onClose && this.onClose();
607
+
608
+ if (this.lockScroll) {
609
+ setTimeout(this.restoreBodyStyle, 200);
610
+ }
611
+
612
+ this.opened = false;
613
+
614
+ this.doAfterClose();
615
+ },
616
+ doAfterClose: function doAfterClose() {
617
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
618
+ this._closing = false;
619
+ },
620
+ restoreBodyStyle: function restoreBodyStyle() {
621
+ if (this.modal && this.withoutHiddenClass) {
622
+ document.body.style.paddingRight = this.bodyPaddingRight;
623
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(document.body, 'mds-popup-parent--hidden');
624
+ }
625
+ this.withoutHiddenClass = true;
626
+ }
627
+ }
628
+ });
629
+
630
+
631
+
632
+ /***/ }),
633
+
634
+ /***/ 17:
635
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
636
+
637
+ "use strict";
638
+
639
+ // EXTERNAL MODULE: ./components/_util/_popper/popup/popup-main.js
640
+ var popup_main = __webpack_require__(14);
641
+
642
+ // EXTERNAL MODULE: external "babel-runtime/core-js/object/get-own-property-descriptor"
643
+ var get_own_property_descriptor_ = __webpack_require__(18);
644
+ var get_own_property_descriptor_default = /*#__PURE__*/__webpack_require__.n(get_own_property_descriptor_);
645
+
646
+ // EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
647
+ var keys_ = __webpack_require__(10);
648
+ var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
649
+
650
+ // EXTERNAL MODULE: external "babel-runtime/core-js/object/assign"
651
+ var assign_ = __webpack_require__(6);
652
+ var assign_default = /*#__PURE__*/__webpack_require__.n(assign_);
653
+
654
+ // CONCATENATED MODULE: ./components/_util/_popper/popper.js
655
+
656
+
657
+
658
+ /**
659
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
660
+ * @version {{version}}
661
+ * @license
662
+ * Copyright (c) 2016 Federico Zivolo and contributors
663
+ *
664
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
665
+ * of this software and associated documentation files (the "Software"), to deal
666
+ * in the Software without restriction, including without limitation the rights
667
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
668
+ * copies of the Software, and to permit persons to whom the Software is
669
+ * furnished to do so, subject to the following conditions:
670
+ *
671
+ * The above copyright notice and this permission notice shall be included in all
672
+ * copies or substantial portions of the Software.
673
+ *
674
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
675
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
676
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
677
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
678
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
679
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
680
+ * SOFTWARE.
681
+ */
682
+ /* eslint-disable */
683
+ // Cross module loader
684
+ // Supported: Node, AMD, Browser globals
685
+ //
686
+ function popper_createPopper() {
687
+ 'use strict';
688
+
689
+ var root = window;
690
+
691
+ // default options
692
+ var DEFAULTS = {
693
+ // placement of the popper
694
+ placement: 'bottom',
695
+
696
+ gpuAcceleration: false,
697
+
698
+ // shift popper from its origin by the given amount of pixels (can be negative)
699
+ offset: 0,
700
+
701
+ // the element which will act as boundary of the popper
702
+ boundariesElement: 'viewport',
703
+
704
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
705
+ boundariesPadding: 5,
706
+
707
+ // popper will try to prevent overflow following this order,
708
+ // by default, then, it could overflow on the left and on top of the boundariesElement
709
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
710
+
711
+ // the behavior used by flip to change the placement of the popper
712
+ flipBehavior: 'flip',
713
+
714
+ arrowElement: '[x-arrow]',
715
+
716
+ arrowOffset: 0,
717
+
718
+ // list of functions used to modify the offsets before they are applied to the popper
719
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
720
+
721
+ modifiersIgnored: [],
722
+
723
+ forceAbsolute: false
724
+
725
+ /**
726
+ * Create a new Popper.js instance
727
+ * @constructor Popper
728
+ * @param {HTMLElement} reference - The reference element used to position the popper
729
+ * @param {HTMLElement|Object} popper
730
+ * The HTML element used as popper, or a configuration used to generate the popper.
731
+ * @param {String} [popper.tagName='div'] The tag name of the generated popper.
732
+ * @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
733
+ * @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
734
+ * @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
735
+ * @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`.
736
+ * @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
737
+ * @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
738
+ * @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
739
+ * @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
740
+ * @param {Object} options
741
+ * @param {String} [options.placement=bottom]
742
+ * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
743
+ * left(-start, -end)`
744
+ *
745
+ * @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
746
+ * The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
747
+ * its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
748
+ * reference element.
749
+ * By default, it will look for a child node of the popper with the `x-arrow` attribute.
750
+ *
751
+ * @param {Boolean} [options.gpuAcceleration=true]
752
+ * When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
753
+ * browser to use the GPU to accelerate the rendering.
754
+ * If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
755
+ *
756
+ * @param {Number} [options.offset=0]
757
+ * Amount of pixels the popper will be shifted (can be negative).
758
+ *
759
+ * @param {String|Element} [options.boundariesElement='viewport']
760
+ * The element which will define the boundaries of the popper position, the popper will never be placed outside
761
+ * of the defined boundaries (except if `keepTogether` is enabled)
762
+ *
763
+ * @param {Number} [options.boundariesPadding=5]
764
+ * Additional padding for the boundaries
765
+ *
766
+ * @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
767
+ * Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
768
+ * this means that the last ones will never overflow
769
+ *
770
+ * @param {String|Array} [options.flipBehavior='flip']
771
+ * The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
772
+ * overlap its reference element. Defining `flip` as value, the placement will be flipped on
773
+ * its axis (`right - left`, `top - bottom`).
774
+ * You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
775
+ * how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
776
+ * then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
777
+ *
778
+ * @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
779
+ * List of functions used to modify the data before they are applied to the popper, add your custom functions
780
+ * to this array to edit the offsets and placement.
781
+ * The function should reflect the @params and @returns of preventOverflow
782
+ *
783
+ * @param {Array} [options.modifiersIgnored=[]]
784
+ * Put here any built-in modifier name you want to exclude from the modifiers list
785
+ * The function should reflect the @params and @returns of preventOverflow
786
+ *
787
+ * @param {Boolean} [options.removeOnDestroy=false]
788
+ * Set to true if you want to automatically remove the popper when you call the `destroy` method.
789
+ */
790
+ };function Popper(reference, popper, options) {
791
+ this._reference = reference.jquery ? reference[0] : reference;
792
+ this.state = {};
793
+
794
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
795
+ // generate a default popper if is not defined
796
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
797
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
798
+ if (isNotDefined || isConfig) {
799
+ this._popper = this.parse(isConfig ? popper : {});
800
+ }
801
+ // otherwise, use the given HTMLElement as popper
802
+ else {
803
+ this._popper = popper.jquery ? popper[0] : popper;
804
+ }
805
+
806
+ // with {} we create a new object with the options inside it
807
+ this._options = assign_default()({}, DEFAULTS, options);
808
+
809
+ // refactoring modifiers' list
810
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
811
+ // remove ignored modifiers
812
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
813
+
814
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
815
+ // margins needs to be calculated to get the correct popper offsets
816
+ if (modifier === 'applyStyle') {
817
+ this._popper.setAttribute('x-placement', this._options.placement);
818
+ }
819
+
820
+ // return predefined modifier identified by string or keep the custom one
821
+ return this.modifiers[modifier] || modifier;
822
+ }.bind(this));
823
+
824
+ // make sure to apply the popper position before any computation
825
+ this.state.position = this._getPosition(this._popper, this._reference);
826
+ setStyle(this._popper, { position: this.state.position, top: 0 });
827
+
828
+ // fire the first update to position the popper in the right place
829
+ this.update();
830
+
831
+ // setup event listeners, they will take care of update the position in specific situations
832
+ this._setupEventListeners();
833
+ return this;
834
+ }
835
+
836
+ //
837
+ // Methods
838
+ //
839
+ /**
840
+ * Destroy the popper
841
+ * @method
842
+ * @memberof Popper
843
+ */
844
+ Popper.prototype.destroy = function () {
845
+ this._popper.removeAttribute('x-placement');
846
+ this._popper.style.left = '';
847
+ this._popper.style.position = '';
848
+ this._popper.style.top = '';
849
+ this._popper.style[getSupportedPropertyName('transform')] = '';
850
+ this._removeEventListeners();
851
+
852
+ // remove the popper if user explicity asked for the deletion on destroy
853
+ if (this._options.removeOnDestroy) {
854
+ this._popper.remove();
855
+ }
856
+ return this;
857
+ };
858
+
859
+ /**
860
+ * Updates the position of the popper, computing the new offsets and applying the new style
861
+ * @method
862
+ * @memberof Popper
863
+ */
864
+ Popper.prototype.update = function () {
865
+ var data = { instance: this, styles: {}
866
+
867
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
868
+ // and refer to _originalPlacement to know the original value
869
+ };data.placement = this._options.placement;
870
+ data._originalPlacement = this._options.placement;
871
+
872
+ // compute the popper and reference offsets and put them inside data.offsets
873
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
874
+
875
+ // get boundaries
876
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
877
+
878
+ data = this.runModifiers(data, this._options.modifiers);
879
+
880
+ if (typeof this.state.updateCallback === 'function') {
881
+ this.state.updateCallback(data);
882
+ }
883
+ };
884
+
885
+ /**
886
+ * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
887
+ * @method
888
+ * @memberof Popper
889
+ * @param {Function} callback
890
+ */
891
+ Popper.prototype.onCreate = function (callback) {
892
+ // the createCallbacks return as first argument the popper instance
893
+ callback(this);
894
+ return this;
895
+ };
896
+
897
+ /**
898
+ * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
899
+ * used to style popper and its arrow.
900
+ * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
901
+ * @method
902
+ * @memberof Popper
903
+ * @param {Function} callback
904
+ */
905
+ Popper.prototype.onUpdate = function (callback) {
906
+ this.state.updateCallback = callback;
907
+ return this;
908
+ };
909
+
910
+ /**
911
+ * Helper used to generate poppers from a configuration file
912
+ * @method
913
+ * @memberof Popper
914
+ * @param config {Object} configuration
915
+ * @returns {HTMLElement} popper
916
+ */
917
+ Popper.prototype.parse = function (config) {
918
+ var defaultConfig = {
919
+ tagName: 'div',
920
+ classNames: ['popper'],
921
+ attributes: [],
922
+ parent: root.document.body,
923
+ content: '',
924
+ contentType: 'text',
925
+ arrowTagName: 'div',
926
+ arrowClassNames: ['popper__arrow'],
927
+ arrowAttributes: ['x-arrow']
928
+ };
929
+ config = assign_default()({}, defaultConfig, config);
930
+
931
+ var d = root.document;
932
+
933
+ var popper = d.createElement(config.tagName);
934
+ addClassNames(popper, config.classNames);
935
+ addAttributes(popper, config.attributes);
936
+ if (config.contentType === 'node') {
937
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
938
+ } else if (config.contentType === 'html') {
939
+ popper.innerHTML = config.content;
940
+ } else {
941
+ popper.textContent = config.content;
942
+ }
943
+
944
+ if (config.arrowTagName) {
945
+ var arrow = d.createElement(config.arrowTagName);
946
+ addClassNames(arrow, config.arrowClassNames);
947
+ addAttributes(arrow, config.arrowAttributes);
948
+ popper.appendChild(arrow);
949
+ }
950
+
951
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
952
+
953
+ // if the given parent is a string, use it to match an element
954
+ // if more than one element is matched, the first one will be used as parent
955
+ // if no elements are matched, the script will throw an error
956
+ if (typeof parent === 'string') {
957
+ parent = d.querySelectorAll(config.parent);
958
+ if (parent.length > 1) {
959
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
960
+ }
961
+ if (parent.length === 0) {
962
+ throw "ERROR: the given `parent` doesn't exists!";
963
+ }
964
+ parent = parent[0];
965
+ }
966
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
967
+ // the first one will be used as parent
968
+ if (parent.length > 1 && parent instanceof Element === false) {
969
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
970
+ parent = parent[0];
971
+ }
972
+
973
+ // append the generated popper to its parent
974
+ parent.appendChild(popper);
975
+
976
+ return popper;
977
+
978
+ /**
979
+ * Adds class names to the given element
980
+ * @function
981
+ * @ignore
982
+ * @param {HTMLElement} target
983
+ * @param {Array} classes
984
+ */
985
+ function addClassNames(element, classNames) {
986
+ classNames.forEach(function (className) {
987
+ element.classList.add(className);
988
+ });
989
+ }
990
+
991
+ /**
992
+ * Adds attributes to the given element
993
+ * @function
994
+ * @ignore
995
+ * @param {HTMLElement} target
996
+ * @param {Array} attributes
997
+ * @example
998
+ * addAttributes(element, [ 'data-info:foobar' ]);
999
+ */
1000
+ function addAttributes(element, attributes) {
1001
+ attributes.forEach(function (attribute) {
1002
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
1003
+ });
1004
+ }
1005
+ };
1006
+
1007
+ /**
1008
+ * Helper used to get the position which will be applied to the popper
1009
+ * @method
1010
+ * @memberof Popper
1011
+ * @param config {HTMLElement} popper element
1012
+ * @param reference {HTMLElement} reference element
1013
+ * @returns {String} position
1014
+ */
1015
+ Popper.prototype._getPosition = function (popper, reference) {
1016
+ var container = getOffsetParent(reference);
1017
+
1018
+ if (this._options.forceAbsolute) {
1019
+ return 'absolute';
1020
+ }
1021
+
1022
+ // Decide if the popper will be fixed
1023
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
1024
+ var isParentFixed = isFixed(reference, container);
1025
+ return isParentFixed ? 'fixed' : 'absolute';
1026
+ };
1027
+
1028
+ /**
1029
+ * Get offsets to the popper
1030
+ * @method
1031
+ * @memberof Popper
1032
+ * @access private
1033
+ * @param {Element} popper - the popper element
1034
+ * @param {Element} reference - the reference element (the popper will be relative to this)
1035
+ * @returns {Object} An object containing the offsets which will be applied to the popper
1036
+ */
1037
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
1038
+ placement = placement.split('-')[0];
1039
+ var popperOffsets = {};
1040
+
1041
+ popperOffsets.position = this.state.position;
1042
+ var isParentFixed = popperOffsets.position === 'fixed';
1043
+
1044
+ //
1045
+ // Get reference element position
1046
+ //
1047
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
1048
+
1049
+ //
1050
+ // Get popper sizes
1051
+ //
1052
+ var popperRect = getOuterSizes(popper);
1053
+
1054
+ //
1055
+ // Compute offsets of popper
1056
+ //
1057
+
1058
+ // depending by the popper placement we have to compute its offsets slightly differently
1059
+ if (['right', 'left'].indexOf(placement) !== -1) {
1060
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
1061
+ if (placement === 'left') {
1062
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
1063
+ } else {
1064
+ popperOffsets.left = referenceOffsets.right;
1065
+ }
1066
+ } else {
1067
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
1068
+ if (placement === 'top') {
1069
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
1070
+ } else {
1071
+ popperOffsets.top = referenceOffsets.bottom;
1072
+ }
1073
+ }
1074
+
1075
+ // Add width and height to our offsets object
1076
+ popperOffsets.width = popperRect.width;
1077
+ popperOffsets.height = popperRect.height;
1078
+
1079
+ return {
1080
+ popper: popperOffsets,
1081
+ reference: referenceOffsets
1082
+ };
1083
+ };
1084
+
1085
+ /**
1086
+ * Setup needed event listeners used to update the popper position
1087
+ * @method
1088
+ * @memberof Popper
1089
+ * @access private
1090
+ */
1091
+ Popper.prototype._setupEventListeners = function () {
1092
+ // NOTE: 1 DOM access here
1093
+ this.state.updateBound = this.update.bind(this);
1094
+ root.addEventListener('resize', this.state.updateBound);
1095
+ // if the boundariesElement is window we don't need to listen for the scroll event
1096
+ if (this._options.boundariesElement !== 'window') {
1097
+ var target = getScrollParent(this._reference);
1098
+ // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
1099
+ if (target === root.document.body || target === root.document.documentElement) {
1100
+ target = root;
1101
+ }
1102
+ target.addEventListener('scroll', this.state.updateBound);
1103
+ this.state.scrollTarget = target;
1104
+ }
1105
+ };
1106
+
1107
+ /**
1108
+ * Remove event listeners used to update the popper position
1109
+ * @method
1110
+ * @memberof Popper
1111
+ * @access private
1112
+ */
1113
+ Popper.prototype._removeEventListeners = function () {
1114
+ // NOTE: 1 DOM access here
1115
+ root.removeEventListener('resize', this.state.updateBound);
1116
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
1117
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
1118
+ this.state.scrollTarget = null;
1119
+ }
1120
+ this.state.updateBound = null;
1121
+ };
1122
+
1123
+ /**
1124
+ * Computed the boundaries limits and return them
1125
+ * @method
1126
+ * @memberof Popper
1127
+ * @access private
1128
+ * @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
1129
+ * @param {Number} padding - Boundaries padding
1130
+ * @param {Element} boundariesElement - Element used to define the boundaries
1131
+ * @returns {Object} Coordinates of the boundaries
1132
+ */
1133
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
1134
+ // NOTE: 1 DOM access here
1135
+ var boundaries = {};
1136
+ var width, height;
1137
+ if (boundariesElement === 'window') {
1138
+ var body = root.document.body,
1139
+ html = root.document.documentElement;
1140
+
1141
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
1142
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
1143
+
1144
+ boundaries = {
1145
+ top: 0,
1146
+ right: width,
1147
+ bottom: height,
1148
+ left: 0
1149
+ };
1150
+ } else if (boundariesElement === 'viewport') {
1151
+ var offsetParent = getOffsetParent(this._popper);
1152
+ var scrollParent = getScrollParent(this._popper);
1153
+ var offsetParentRect = getOffsetRect(offsetParent);
1154
+
1155
+ // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
1156
+ var getScrollTopValue = function getScrollTopValue(element) {
1157
+ return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
1158
+ };
1159
+ var getScrollLeftValue = function getScrollLeftValue(element) {
1160
+ return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
1161
+ };
1162
+
1163
+ // if the popper is fixed we don't have to substract scrolling from the boundaries
1164
+ var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
1165
+ var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
1166
+
1167
+ boundaries = {
1168
+ top: 0 - (offsetParentRect.top - scrollTop),
1169
+ right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
1170
+ bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
1171
+ left: 0 - (offsetParentRect.left - scrollLeft)
1172
+ };
1173
+ } else {
1174
+ if (getOffsetParent(this._popper) === boundariesElement) {
1175
+ boundaries = {
1176
+ top: 0,
1177
+ left: 0,
1178
+ right: boundariesElement.clientWidth,
1179
+ bottom: boundariesElement.clientHeight
1180
+ };
1181
+ } else {
1182
+ boundaries = getOffsetRect(boundariesElement);
1183
+ }
1184
+ }
1185
+ boundaries.left += padding;
1186
+ boundaries.right -= padding;
1187
+ boundaries.top = boundaries.top + padding;
1188
+ boundaries.bottom = boundaries.bottom - padding;
1189
+ return boundaries;
1190
+ };
1191
+
1192
+ /**
1193
+ * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
1194
+ * @method
1195
+ * @memberof Popper
1196
+ * @access public
1197
+ * @param {Object} data
1198
+ * @param {Array} modifiers
1199
+ * @param {Function} ends
1200
+ */
1201
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
1202
+ var modifiersToRun = modifiers.slice();
1203
+ if (ends !== undefined) {
1204
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
1205
+ }
1206
+
1207
+ modifiersToRun.forEach(function (modifier) {
1208
+ if (isFunction(modifier)) {
1209
+ data = modifier.call(this, data);
1210
+ }
1211
+ }.bind(this));
1212
+
1213
+ return data;
1214
+ };
1215
+
1216
+ /**
1217
+ * Helper used to know if the given modifier depends from another one.
1218
+ * @method
1219
+ * @memberof Popper
1220
+ * @param {String} requesting - name of requesting modifier
1221
+ * @param {String} requested - name of requested modifier
1222
+ * @returns {Boolean}
1223
+ */
1224
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
1225
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
1226
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
1227
+ return modifier === requested;
1228
+ }).length;
1229
+ };
1230
+
1231
+ //
1232
+ // Modifiers
1233
+ //
1234
+
1235
+ /**
1236
+ * Modifiers list
1237
+ * @namespace Popper.modifiers
1238
+ * @memberof Popper
1239
+ * @type {Object}
1240
+ */
1241
+ Popper.prototype.modifiers = {};
1242
+
1243
+ /**
1244
+ * Apply the computed styles to the popper element
1245
+ * @method
1246
+ * @memberof Popper.modifiers
1247
+ * @argument {Object} data - The data object generated by `update` method
1248
+ * @returns {Object} The same data object
1249
+ */
1250
+ Popper.prototype.modifiers.applyStyle = function (data) {
1251
+ // apply the final offsets to the popper
1252
+ // NOTE: 1 DOM access here
1253
+ var styles = {
1254
+ position: data.offsets.popper.position
1255
+
1256
+ // round top and left to avoid blurry text
1257
+ };var left = Math.round(data.offsets.popper.left);
1258
+ var top = Math.round(data.offsets.popper.top);
1259
+
1260
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
1261
+ // we automatically use the supported prefixed version if needed
1262
+ var prefixedProperty;
1263
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
1264
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
1265
+ styles.top = 0;
1266
+ styles.left = 0;
1267
+ }
1268
+ // othwerise, we use the standard `left` and `top` properties
1269
+ else {
1270
+ styles.left = left;
1271
+ styles.top = top;
1272
+ }
1273
+
1274
+ // any property present in `data.styles` will be applied to the popper,
1275
+ // in this way we can make the 3rd party modifiers add custom styles to it
1276
+ // Be aware, modifiers could override the properties defined in the previous
1277
+ // lines of this modifier!
1278
+ assign_default()(styles, data.styles);
1279
+
1280
+ setStyle(this._popper, styles);
1281
+
1282
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
1283
+ // NOTE: 1 DOM access here
1284
+ if (!this._popper._prevClass.includes('mds-date-picker')) {
1285
+ this._popper.setAttribute('x-placement', data.placement);
1286
+ var popper = this._popper;
1287
+ var instanceType = popper.classList[0];
1288
+ popper.classList.replace(popper.classList[1], instanceType + '-placement-' + data.placement);
1289
+ }
1290
+
1291
+ // console.log(data.placement)
1292
+
1293
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
1294
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
1295
+ setStyle(data.arrowElement, data.offsets.arrow);
1296
+ }
1297
+
1298
+ return data;
1299
+ };
1300
+
1301
+ /**
1302
+ * Modifier used to shift the popper on the start or end of its reference element side
1303
+ * @method
1304
+ * @memberof Popper.modifiers
1305
+ * @argument {Object} data - The data object generated by `update` method
1306
+ * @returns {Object} The data object, properly modified
1307
+ */
1308
+ Popper.prototype.modifiers.shift = function (data) {
1309
+ var placement = data.placement;
1310
+ var basePlacement = placement.split('-')[0];
1311
+ var shiftVariation = placement.split('-')[1];
1312
+
1313
+ // if shift shiftVariation is specified, run the modifier
1314
+ if (shiftVariation) {
1315
+ var reference = data.offsets.reference;
1316
+ var popper = getPopperClientRect(data.offsets.popper);
1317
+
1318
+ var shiftOffsets = {
1319
+ y: {
1320
+ start: { top: reference.top },
1321
+ end: { top: reference.top + reference.height - popper.height }
1322
+ },
1323
+ x: {
1324
+ start: { left: reference.left },
1325
+ end: { left: reference.left + reference.width - popper.width }
1326
+ }
1327
+ };
1328
+
1329
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
1330
+
1331
+ data.offsets.popper = assign_default()(popper, shiftOffsets[axis][shiftVariation]);
1332
+ }
1333
+ return data;
1334
+ };
1335
+
1336
+ /**
1337
+ * Modifier used to make sure the popper does not overflows from it's boundaries
1338
+ * @method
1339
+ * @memberof Popper.modifiers
1340
+ * @argument {Object} data - The data object generated by `update` method
1341
+ * @returns {Object} The data object, properly modified
1342
+ */
1343
+ Popper.prototype.modifiers.preventOverflow = function (data) {
1344
+ var order = this._options.preventOverflowOrder;
1345
+ var popper = getPopperClientRect(data.offsets.popper);
1346
+
1347
+ var check = {
1348
+ left: function left() {
1349
+ var left = popper.left;
1350
+ if (popper.left < data.boundaries.left) {
1351
+ left = Math.max(popper.left, data.boundaries.left);
1352
+ }
1353
+ return { left: left };
1354
+ },
1355
+ right: function right() {
1356
+ var left = popper.left;
1357
+ if (popper.right > data.boundaries.right) {
1358
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
1359
+ }
1360
+ return { left: left };
1361
+ },
1362
+ top: function top() {
1363
+ var top = popper.top;
1364
+ if (popper.top < data.boundaries.top) {
1365
+ top = Math.max(popper.top, data.boundaries.top);
1366
+ }
1367
+ return { top: top };
1368
+ },
1369
+ bottom: function bottom() {
1370
+ var top = popper.top;
1371
+ if (popper.bottom > data.boundaries.bottom) {
1372
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
1373
+ }
1374
+ return { top: top };
1375
+ }
1376
+ };
1377
+
1378
+ order.forEach(function (direction) {
1379
+ data.offsets.popper = assign_default()(popper, check[direction]());
1380
+ });
1381
+
1382
+ return data;
1383
+ };
1384
+
1385
+ /**
1386
+ * Modifier used to make sure the popper is always near its reference
1387
+ * @method
1388
+ * @memberof Popper.modifiers
1389
+ * @argument {Object} data - The data object generated by _update method
1390
+ * @returns {Object} The data object, properly modified
1391
+ */
1392
+ Popper.prototype.modifiers.keepTogether = function (data) {
1393
+ var popper = getPopperClientRect(data.offsets.popper);
1394
+ var reference = data.offsets.reference;
1395
+ var f = Math.floor;
1396
+
1397
+ if (popper.right < f(reference.left)) {
1398
+ data.offsets.popper.left = f(reference.left) - popper.width;
1399
+ }
1400
+ if (popper.left > f(reference.right)) {
1401
+ data.offsets.popper.left = f(reference.right);
1402
+ }
1403
+ if (popper.bottom < f(reference.top)) {
1404
+ data.offsets.popper.top = f(reference.top) - popper.height;
1405
+ }
1406
+ if (popper.top > f(reference.bottom)) {
1407
+ data.offsets.popper.top = f(reference.bottom);
1408
+ }
1409
+
1410
+ return data;
1411
+ };
1412
+
1413
+ /**
1414
+ * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
1415
+ * Requires the `preventOverflow` modifier before it in order to work.
1416
+ * **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
1417
+ * @method
1418
+ * @memberof Popper.modifiers
1419
+ * @argument {Object} data - The data object generated by _update method
1420
+ * @returns {Object} The data object, properly modified
1421
+ */
1422
+ Popper.prototype.modifiers.flip = function (data) {
1423
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
1424
+ // otherwise flip would not work as expected.
1425
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
1426
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
1427
+ return data;
1428
+ }
1429
+
1430
+ if (data.flipped && data.placement === data._originalPlacement) {
1431
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
1432
+ return data;
1433
+ }
1434
+
1435
+ var placement = data.placement.split('-')[0];
1436
+ var placementOpposite = getOppositePlacement(placement);
1437
+ var variation = data.placement.split('-')[1] || '';
1438
+ var flipOrder = [];
1439
+ if (this._options.flipBehavior === 'flip') {
1440
+ flipOrder = [placement, placementOpposite];
1441
+ } else {
1442
+ flipOrder = this._options.flipBehavior;
1443
+ }
1444
+
1445
+ flipOrder.forEach(function (step, index) {
1446
+ if (placement !== step || flipOrder.length === index + 1) {
1447
+ return;
1448
+ }
1449
+
1450
+ placement = data.placement.split('-')[0];
1451
+ placementOpposite = getOppositePlacement(placement);
1452
+
1453
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
1454
+
1455
+ // this boolean is used to distinguish right and bottom from top and left
1456
+ // they need different computations to get flipped
1457
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
1458
+
1459
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
1460
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
1461
+ // we'll use this boolean to detect any flip loop
1462
+ data.flipped = true;
1463
+ data.placement = flipOrder[index + 1];
1464
+ if (variation) {
1465
+ data.placement += '-' + variation;
1466
+ }
1467
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
1468
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
1469
+ }
1470
+ }.bind(this));
1471
+ return data;
1472
+ };
1473
+
1474
+ /**
1475
+ * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
1476
+ * The offsets will shift the popper on the side of its reference element.
1477
+ * @method
1478
+ * @memberof Popper.modifiers
1479
+ * @argument {Object} data - The data object generated by _update method
1480
+ * @returns {Object} The data object, properly modified
1481
+ */
1482
+ Popper.prototype.modifiers.offset = function (data) {
1483
+ var offset = this._options.offset;
1484
+ var popper = data.offsets.popper;
1485
+
1486
+ if (data.placement.indexOf('left') !== -1) {
1487
+ popper.top -= offset;
1488
+ } else if (data.placement.indexOf('right') !== -1) {
1489
+ popper.top += offset;
1490
+ } else if (data.placement.indexOf('top') !== -1) {
1491
+ popper.left -= offset;
1492
+ } else if (data.placement.indexOf('bottom') !== -1) {
1493
+ popper.left += offset;
1494
+ }
1495
+ return data;
1496
+ };
1497
+
1498
+ /**
1499
+ * 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
1500
+ * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
1501
+ * @method
1502
+ * @memberof Popper.modifiers
1503
+ * @argument {Object} data - The data object generated by _update method
1504
+ * @returns {Object} The data object, properly modified
1505
+ */
1506
+ Popper.prototype.modifiers.arrow = function (data) {
1507
+ var arrow = this._options.arrowElement;
1508
+ var arrowOffset = this._options.arrowOffset;
1509
+
1510
+ // if the arrowElement is a string, suppose it's a CSS selector
1511
+ if (typeof arrow === 'string') {
1512
+ arrow = this._popper.querySelector(arrow);
1513
+ }
1514
+
1515
+ // if arrow element is not found, don't run the modifier
1516
+ if (!arrow) {
1517
+ return data;
1518
+ }
1519
+
1520
+ // the arrow element must be child of its popper
1521
+ if (!this._popper.contains(arrow)) {
1522
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
1523
+ return data;
1524
+ }
1525
+
1526
+ // arrow depends on keepTogether in order to work
1527
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
1528
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
1529
+ return data;
1530
+ }
1531
+
1532
+ var arrowStyle = {};
1533
+ var placement = data.placement.split('-')[0];
1534
+ var popper = getPopperClientRect(data.offsets.popper);
1535
+ var reference = data.offsets.reference;
1536
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
1537
+
1538
+ var len = isVertical ? 'height' : 'width';
1539
+ var side = isVertical ? 'top' : 'left';
1540
+ var translate = isVertical ? 'translateY' : 'translateX';
1541
+ var altSide = isVertical ? 'left' : 'top';
1542
+ var opSide = isVertical ? 'bottom' : 'right';
1543
+ var arrowSize = getOuterSizes(arrow)[len];
1544
+
1545
+ //
1546
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
1547
+ //
1548
+
1549
+ // top/left side
1550
+ if (reference[opSide] - arrowSize < popper[side]) {
1551
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
1552
+ }
1553
+ // bottom/right side
1554
+ if (reference[side] + arrowSize > popper[opSide]) {
1555
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
1556
+ }
1557
+
1558
+ // compute center of the popper
1559
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
1560
+
1561
+ var sideValue = center - popper[side];
1562
+
1563
+ // prevent arrow from being placed not contiguously to its popper
1564
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
1565
+ arrowStyle[side] = sideValue;
1566
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
1567
+
1568
+ data.offsets.arrow = arrowStyle;
1569
+ data.arrowElement = arrow;
1570
+
1571
+ return data;
1572
+ };
1573
+
1574
+ //
1575
+ // Helpers
1576
+ //
1577
+
1578
+ /**
1579
+ * Get the outer sizes of the given element (offset size + margins)
1580
+ * @function
1581
+ * @ignore
1582
+ * @argument {Element} element
1583
+ * @returns {Object} object containing width and height properties
1584
+ */
1585
+ function getOuterSizes(element) {
1586
+ // NOTE: 1 DOM access here
1587
+ var _display = element.style.display,
1588
+ _visibility = element.style.visibility;
1589
+ element.style.display = 'block';
1590
+ element.style.visibility = 'hidden';
1591
+ var calcWidthToForceRepaint = element.offsetWidth;
1592
+
1593
+ // original method
1594
+ var styles = root.getComputedStyle(element);
1595
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
1596
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
1597
+ var result = {
1598
+ width: element.offsetWidth + y,
1599
+ height: element.offsetHeight + x
1600
+
1601
+ // reset element styles
1602
+ };element.style.display = _display;
1603
+ element.style.visibility = _visibility;
1604
+ return result;
1605
+ }
1606
+
1607
+ /**
1608
+ * Get the opposite placement of the given one/
1609
+ * @function
1610
+ * @ignore
1611
+ * @argument {String} placement
1612
+ * @returns {String} flipped placement
1613
+ */
1614
+ function getOppositePlacement(placement) {
1615
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
1616
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
1617
+ return hash[matched];
1618
+ });
1619
+ }
1620
+
1621
+ /**
1622
+ * Given the popper offsets, generate an output similar to getBoundingClientRect
1623
+ * @function
1624
+ * @ignore
1625
+ * @argument {Object} popperOffsets
1626
+ * @returns {Object} ClientRect like output
1627
+ */
1628
+ function getPopperClientRect(popperOffsets) {
1629
+ var offsets = assign_default()({}, popperOffsets);
1630
+ offsets.right = offsets.left + offsets.width;
1631
+ offsets.bottom = offsets.top + offsets.height;
1632
+ return offsets;
1633
+ }
1634
+
1635
+ /**
1636
+ * Given an array and the key to find, returns its index
1637
+ * @function
1638
+ * @ignore
1639
+ * @argument {Array} arr
1640
+ * @argument keyToFind
1641
+ * @returns index or null
1642
+ */
1643
+ function getArrayKeyIndex(arr, keyToFind) {
1644
+ var i = 0,
1645
+ key;
1646
+ for (key in arr) {
1647
+ if (arr[key] === keyToFind) {
1648
+ return i;
1649
+ }
1650
+ i++;
1651
+ }
1652
+ return null;
1653
+ }
1654
+
1655
+ /**
1656
+ * Get CSS computed property of the given element
1657
+ * @function
1658
+ * @ignore
1659
+ * @argument {Eement} element
1660
+ * @argument {String} property
1661
+ */
1662
+ function getStyleComputedProperty(element, property) {
1663
+ // NOTE: 1 DOM access here
1664
+ var css = root.getComputedStyle(element, null);
1665
+ return css[property];
1666
+ }
1667
+
1668
+ /**
1669
+ * Returns the offset parent of the given element
1670
+ * @function
1671
+ * @ignore
1672
+ * @argument {Element} element
1673
+ * @returns {Element} offset parent
1674
+ */
1675
+ function getOffsetParent(element) {
1676
+ // NOTE: 1 DOM access here
1677
+ var offsetParent = element.offsetParent;
1678
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
1679
+ }
1680
+
1681
+ /**
1682
+ * Returns the scrolling parent of the given element
1683
+ * @function
1684
+ * @ignore
1685
+ * @argument {Element} element
1686
+ * @returns {Element} offset parent
1687
+ */
1688
+ function getScrollParent(element) {
1689
+ var parent = element.parentNode;
1690
+
1691
+ if (!parent) {
1692
+ return element;
1693
+ }
1694
+
1695
+ if (parent === root.document) {
1696
+ // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
1697
+ // greater than 0 and return the proper element
1698
+ if (root.document.body.scrollTop || root.document.body.scrollLeft) {
1699
+ return root.document.body;
1700
+ } else {
1701
+ return root.document.documentElement;
1702
+ }
1703
+ }
1704
+
1705
+ // Firefox want us to check `-x` and `-y` variations as well
1706
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
1707
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
1708
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
1709
+ // fixes issue #65
1710
+ return parent;
1711
+ }
1712
+ return getScrollParent(element.parentNode);
1713
+ }
1714
+
1715
+ /**
1716
+ * Check if the given element is fixed or is inside a fixed parent
1717
+ * @function
1718
+ * @ignore
1719
+ * @argument {Element} element
1720
+ * @argument {Element} customContainer
1721
+ * @returns {Boolean} answer to "isFixed?"
1722
+ */
1723
+ function isFixed(element) {
1724
+ if (element === root.document.body) {
1725
+ return false;
1726
+ }
1727
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
1728
+ return true;
1729
+ }
1730
+ return element.parentNode ? isFixed(element.parentNode) : element;
1731
+ }
1732
+
1733
+ /**
1734
+ * Set the style to the given popper
1735
+ * @function
1736
+ * @ignore
1737
+ * @argument {Element} element - Element to apply the style to
1738
+ * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
1739
+ */
1740
+ function setStyle(element, styles) {
1741
+ function is_numeric(n) {
1742
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
1743
+ }
1744
+ keys_default()(styles).forEach(function (prop) {
1745
+ var unit = '';
1746
+ // add unit if the value is numeric and is one of the following
1747
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
1748
+ unit = 'px';
1749
+ }
1750
+ element.style[prop] = styles[prop] + unit;
1751
+ });
1752
+ }
1753
+
1754
+ /**
1755
+ * Check if the given variable is a function
1756
+ * @function
1757
+ * @ignore
1758
+ * @argument {*} functionToCheck - variable to check
1759
+ * @returns {Boolean} answer to: is a function?
1760
+ */
1761
+ function isFunction(functionToCheck) {
1762
+ var getType = {};
1763
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
1764
+ }
1765
+
1766
+ /**
1767
+ * Get the position of the given element, relative to its offset parent
1768
+ * @function
1769
+ * @ignore
1770
+ * @param {Element} element
1771
+ * @return {Object} position - Coordinates of the element and its `scrollTop`
1772
+ */
1773
+ function getOffsetRect(element) {
1774
+ var elementRect = {
1775
+ width: element.offsetWidth,
1776
+ height: element.offsetHeight,
1777
+ left: element.offsetLeft,
1778
+ top: element.offsetTop
1779
+ };
1780
+
1781
+ elementRect.right = elementRect.left + elementRect.width;
1782
+ elementRect.bottom = elementRect.top + elementRect.height;
1783
+
1784
+ // position
1785
+ return elementRect;
1786
+ }
1787
+
1788
+ /**
1789
+ * Get bounding client rect of given element
1790
+ * @function
1791
+ * @ignore
1792
+ * @param {HTMLElement} element
1793
+ * @return {Object} client rect
1794
+ */
1795
+ function getBoundingClientRect(element) {
1796
+ var rect = element.getBoundingClientRect();
1797
+
1798
+ // whether the IE version is lower than 11
1799
+ var isIE = navigator.userAgent.indexOf('MSIE') != -1;
1800
+
1801
+ // fix ie document bounding top always 0 bug
1802
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
1803
+
1804
+ return {
1805
+ left: rect.left,
1806
+ top: rectTop,
1807
+ right: rect.right,
1808
+ bottom: rect.bottom,
1809
+ width: rect.right - rect.left,
1810
+ height: rect.bottom - rectTop
1811
+ };
1812
+ }
1813
+
1814
+ /**
1815
+ * Given an element and one of its parents, return the offset
1816
+ * @function
1817
+ * @ignore
1818
+ * @param {HTMLElement} element
1819
+ * @param {HTMLElement} parent
1820
+ * @return {Object} rect
1821
+ */
1822
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
1823
+ var elementRect = getBoundingClientRect(element);
1824
+ var parentRect = getBoundingClientRect(parent);
1825
+
1826
+ if (fixed) {
1827
+ var scrollParent = getScrollParent(parent);
1828
+ parentRect.top += scrollParent.scrollTop;
1829
+ parentRect.bottom += scrollParent.scrollTop;
1830
+ parentRect.left += scrollParent.scrollLeft;
1831
+ parentRect.right += scrollParent.scrollLeft;
1832
+ }
1833
+
1834
+ var rect = {
1835
+ top: elementRect.top - parentRect.top,
1836
+ left: elementRect.left - parentRect.left,
1837
+ bottom: elementRect.top - parentRect.top + elementRect.height,
1838
+ right: elementRect.left - parentRect.left + elementRect.width,
1839
+ width: elementRect.width,
1840
+ height: elementRect.height
1841
+ };
1842
+ return rect;
1843
+ }
1844
+
1845
+ /**
1846
+ * Get the prefixed supported property name
1847
+ * @function
1848
+ * @ignore
1849
+ * @argument {String} property (camelCase)
1850
+ * @returns {String} prefixed property (camelCase)
1851
+ */
1852
+ function getSupportedPropertyName(property) {
1853
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
1854
+
1855
+ for (var i = 0; i < prefixes.length; i++) {
1856
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
1857
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
1858
+ return toCheck;
1859
+ }
1860
+ }
1861
+ return null;
1862
+ }
1863
+
1864
+ /**
1865
+ * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
1866
+ * objects to a target object. It will return the target object.
1867
+ * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
1868
+ * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
1869
+ * @function
1870
+ * @ignore
1871
+ */
1872
+ if (!assign_default.a) {
1873
+ Object.defineProperty(Object, 'assign', {
1874
+ enumerable: false,
1875
+ configurable: true,
1876
+ writable: true,
1877
+ value: function value(target) {
1878
+ if (target === undefined || target === null) {
1879
+ throw new TypeError('Cannot convert first argument to object');
1880
+ }
1881
+
1882
+ var to = Object(target);
1883
+ for (var i = 1; i < arguments.length; i++) {
1884
+ var nextSource = arguments[i];
1885
+ if (nextSource === undefined || nextSource === null) {
1886
+ continue;
1887
+ }
1888
+ nextSource = Object(nextSource);
1889
+
1890
+ var keysArray = keys_default()(nextSource);
1891
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
1892
+ var nextKey = keysArray[nextIndex];
1893
+ var desc = get_own_property_descriptor_default()(nextSource, nextKey);
1894
+ if (desc !== undefined && desc.enumerable) {
1895
+ to[nextKey] = nextSource[nextKey];
1896
+ }
1897
+ }
1898
+ }
1899
+ return to;
1900
+ }
1901
+ });
1902
+ }
1903
+
1904
+ return Popper;
1905
+ }
1906
+ /* harmony default export */ var _popper_popper = (popper_createPopper());
1907
+ // CONCATENATED MODULE: ./components/_util/_popper/vue-popper.js
1908
+
1909
+
1910
+
1911
+ var stop = function stop(e) {
1912
+ return e.stopPropagation();
1913
+ };
1914
+ /**
1915
+ * @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
1916
+ * @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
1917
+ * @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
1918
+ * @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
1919
+ * @param {Boolean} [visible=false] Visibility of the popup element.
1920
+ * @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
1921
+ */
1922
+ /* harmony default export */ var vue_popper = __webpack_exports__["a"] = ({
1923
+ props: {
1924
+ transformOrigin: {
1925
+ type: [Boolean, String],
1926
+ default: true
1927
+ },
1928
+ placement: {
1929
+ type: String,
1930
+ default: 'bottom'
1931
+ },
1932
+ boundariesPadding: {
1933
+ type: Number,
1934
+ default: 5
1935
+ },
1936
+ reference: {},
1937
+ popper: {},
1938
+ offset: {
1939
+ default: 0
1940
+ },
1941
+ value: Boolean,
1942
+ visibleArrow: Boolean,
1943
+ arrowOffset: {
1944
+ type: Number,
1945
+ default: 35
1946
+ },
1947
+ appendToBody: {
1948
+ type: Boolean,
1949
+ default: true
1950
+ },
1951
+ popperOptions: {
1952
+ type: Object,
1953
+ default: function _default() {
1954
+ return {
1955
+ gpuAcceleration: false
1956
+ };
1957
+ }
1958
+ }
1959
+ },
1960
+
1961
+ data: function data() {
1962
+ return {
1963
+ showPopper: false,
1964
+ currentPlacement: ''
1965
+ };
1966
+ },
1967
+
1968
+
1969
+ watch: {
1970
+ value: {
1971
+ immediate: true,
1972
+ handler: function handler(val) {
1973
+ this.showPopper = val;
1974
+ this.$emit('input', val);
1975
+ }
1976
+ },
1977
+
1978
+ showPopper: function showPopper(val) {
1979
+ if (this.disabled) return;
1980
+ val ? this.updatePopper() : this.destroyPopper();
1981
+ this.$emit('input', val);
1982
+ }
1983
+ },
1984
+
1985
+ methods: {
1986
+ createPopper: function createPopper() {
1987
+ var _this = this;
1988
+
1989
+ var options = this.popperOptions;
1990
+ var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
1991
+ var realPlacement = void 0;
1992
+ if (popper.__vue__ && popper.__vue__.$parent && popper.__vue__.$parent.$options.name === 'MdsCascader') {
1993
+ realPlacement = 'bottom-start';
1994
+ } else {
1995
+ realPlacement = this.realPlacement || this.placement;
1996
+ }
1997
+ this.currentPlacement = this.currentPlacement || realPlacement;
1998
+ if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
1999
+ return;
2000
+ }
2001
+
2002
+ var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
2003
+
2004
+ if (!reference && this.$slots.reference && this.$slots.reference[0]) {
2005
+ reference = this.referenceElm = this.$slots.reference[0].elm;
2006
+ }
2007
+
2008
+ if (!popper || !reference) return;
2009
+ if (this.visibleArrow) this.appendArrow(popper);
2010
+ if (this.appendToBody) document.body.appendChild(this.popperElm);
2011
+ if (this.popperJS && this.popperJS.destroy) {
2012
+ this.popperJS.destroy();
2013
+ }
2014
+
2015
+ options.placement = this.currentPlacement;
2016
+ options.offset = this.offset;
2017
+ options.arrowOffset = this.arrowOffset;
2018
+ this.popperJS = new _popper_popper(reference, popper, options);
2019
+ this.popperJS.onCreate(function (_) {
2020
+ _this.$emit('created', _this);
2021
+ _this.resetTransformOrigin();
2022
+ _this.$nextTick(_this.updatePopper);
2023
+ });
2024
+ if (typeof options.onUpdate === 'function') {
2025
+ this.popperJS.onUpdate(options.onUpdate);
2026
+ }
2027
+ this.popperJS._popper.style.zIndex = popup_main["a" /* PopupMain */].nextZIndex();
2028
+ this.popperElm.addEventListener('click', stop);
2029
+ },
2030
+ updatePopper: function updatePopper(zIndexFlag) {
2031
+ var popperJS = this.popperJS;
2032
+ if (popperJS) {
2033
+ popperJS.update();
2034
+ if (popperJS._popper) {
2035
+ if (!zIndexFlag) {
2036
+ popperJS._popper.style.zIndex = popup_main["a" /* PopupMain */].nextZIndex();
2037
+ }
2038
+ }
2039
+ } else {
2040
+ this.createPopper();
2041
+ }
2042
+ },
2043
+ doDestroy: function doDestroy(forceDestroy) {
2044
+ /* istanbul ignore if */
2045
+ if (!this.popperJS || this.showPopper && !forceDestroy) return;
2046
+ this.popperJS.destroy();
2047
+ this.popperJS = null;
2048
+ },
2049
+ destroyPopper: function destroyPopper() {
2050
+ if (this.popperJS) {
2051
+ this.resetTransformOrigin();
2052
+ }
2053
+ },
2054
+ resetTransformOrigin: function resetTransformOrigin() {
2055
+ if (!this.transformOrigin) return;
2056
+ var placementMap = {
2057
+ top: 'bottom',
2058
+ bottom: 'top',
2059
+ left: 'right',
2060
+ right: 'left'
2061
+ };
2062
+ var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
2063
+ var origin = placementMap[placement];
2064
+ this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
2065
+ },
2066
+ appendArrow: function appendArrow(element) {
2067
+ var hash = void 0;
2068
+ if (this.appended) {
2069
+ return;
2070
+ }
2071
+
2072
+ this.appended = true;
2073
+
2074
+ for (var item in element.attributes) {
2075
+ if (/^_v-/.test(element.attributes[item].name)) {
2076
+ hash = element.attributes[item].name;
2077
+ break;
2078
+ }
2079
+ }
2080
+
2081
+ var arrow = document.createElement('div');
2082
+
2083
+ if (hash) {
2084
+ arrow.setAttribute(hash, '');
2085
+ }
2086
+ arrow.setAttribute('x-arrow', '');
2087
+ arrow.className = 'popper__arrow';
2088
+ element.appendChild(arrow);
2089
+ }
2090
+ },
2091
+
2092
+ beforeDestroy: function beforeDestroy() {
2093
+ this.doDestroy(true);
2094
+ if (this.popperElm && this.popperElm.parentNode === document.body) {
2095
+ this.popperElm.removeEventListener('click', stop);
2096
+ document.body.removeChild(this.popperElm);
2097
+ }
2098
+ },
2099
+ deactivated: function deactivated() {
2100
+ this.$options.beforeDestroy[0].call(this);
2101
+ }
2102
+ });
2103
+
2104
+ /***/ }),
2105
+
2106
+ /***/ 18:
2107
+ /***/ (function(module, exports) {
2108
+
2109
+ module.exports = require("babel-runtime/core-js/object/get-own-property-descriptor");
2110
+
2111
+ /***/ }),
2112
+
2113
+ /***/ 189:
100
2114
  /***/ (function(module, exports) {
101
2115
 
102
2116
  // removed by extract-text-webpack-plugin
103
2117
 
104
2118
  /***/ }),
105
2119
 
106
- /***/ 16:
2120
+ /***/ 19:
107
2121
  /***/ (function(module, exports) {
108
2122
 
109
- module.exports = __WEBPACK_EXTERNAL_MODULE__16__;
2123
+ module.exports = require("throttle-debounce");
110
2124
 
111
2125
  /***/ }),
112
2126
 
113
- /***/ 177:
2127
+ /***/ 2:
114
2128
  /***/ (function(module, exports) {
115
2129
 
116
- // removed by extract-text-webpack-plugin
2130
+ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2131
+
2132
+ /***/ }),
2133
+
2134
+ /***/ 22:
2135
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2136
+
2137
+ "use strict";
2138
+ /* harmony import */ var mds_ui_transition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
2139
+ /* harmony import */ var mds_ui_transition__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(mds_ui_transition__WEBPACK_IMPORTED_MODULE_0__);
2140
+
2141
+
2142
+ var placementMap = {
2143
+ top: 'top',
2144
+ left: 'left',
2145
+ right: 'right',
2146
+ bottom: 'bottom',
2147
+ topLeft: 'top-start',
2148
+ topRight: 'top-end',
2149
+ bottomLeft: 'bottom-start',
2150
+ bottomRight: 'bottom-end',
2151
+ leftTop: 'left-start',
2152
+ leftBottom: 'left-end',
2153
+ rightTop: 'right-start',
2154
+ rightBottom: 'right-end'
2155
+ };
2156
+
2157
+ /* harmony default export */ __webpack_exports__["a"] = ({
2158
+ components: {
2159
+ mdsTransition: mds_ui_transition__WEBPACK_IMPORTED_MODULE_0___default.a
2160
+ },
2161
+ computed: {
2162
+ realPlacement: function realPlacement() {
2163
+ return placementMap[this.placement];
2164
+ }
2165
+ }
2166
+ });
117
2167
 
118
2168
  /***/ }),
119
2169
 
120
- /***/ 35:
2170
+ /***/ 43:
121
2171
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
122
2172
 
123
2173
  "use strict";
124
- /* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(131);
2174
+ /* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(139);
125
2175
  /* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_index_less__WEBPACK_IMPORTED_MODULE_0__);
126
- /* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(177);
2176
+ /* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(189);
127
2177
  /* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);
128
2178
 
129
2179
 
130
2180
 
131
2181
  /***/ }),
132
2182
 
133
- /***/ 36:
2183
+ /***/ 44:
134
2184
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
135
2185
 
136
2186
  "use strict";
@@ -138,30 +2188,283 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__16__;
138
2188
  __webpack_require__.r(__webpack_exports__);
139
2189
 
140
2190
  // EXTERNAL MODULE: ./components/tooltip/style/index.js
141
- var style = __webpack_require__(35);
2191
+ var style = __webpack_require__(43);
2192
+
2193
+ // EXTERNAL MODULE: ./components/_util/_popper/vue-popper.js + 1 modules
2194
+ var vue_popper = __webpack_require__(17);
2195
+
2196
+ // EXTERNAL MODULE: ./components/_util/_popper/popper-mixin.js
2197
+ var popper_mixin = __webpack_require__(22);
2198
+
2199
+ // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
2200
+ var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(2);
2201
+ var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
2202
+
2203
+ // EXTERNAL MODULE: external "./transition"
2204
+ var external_transition_ = __webpack_require__(11);
2205
+ var external_transition_default = /*#__PURE__*/__webpack_require__.n(external_transition_);
142
2206
 
143
- // EXTERNAL MODULE: external "./_mixin/tooltip"
144
- var tooltip_ = __webpack_require__(16);
145
- var tooltip_default = /*#__PURE__*/__webpack_require__.n(tooltip_);
2207
+ // EXTERNAL MODULE: external "throttle-debounce"
2208
+ var external_throttle_debounce_ = __webpack_require__(19);
2209
+
2210
+ // EXTERNAL MODULE: ./components/_util/_popper/dom-helper.js
2211
+ var dom_helper = __webpack_require__(1);
146
2212
 
147
2213
  // CONCATENATED MODULE: ./components/tooltip/tooltip.js
148
2214
 
149
2215
 
2216
+
2217
+
2218
+
2219
+
2220
+
2221
+ var eventMap = {
2222
+ mouseenter: 'handleMouseenter',
2223
+ mouseleave: 'handleMouseleave',
2224
+ focus: 'handleFocus',
2225
+ blur: 'handleBlur',
2226
+ click: 'handleClick'
2227
+ };
2228
+
150
2229
  /* harmony default export */ var tooltip = ({
151
2230
  name: 'MdsTooltip',
152
- mixins: [tooltip_default.a],
2231
+ mixins: [vue_popper["a" /* default */], popper_mixin["a" /* default */]],
153
2232
  props: {
154
- prefixCls: {
2233
+ mouseEnterDelay: {
2234
+ type: Number,
2235
+ default: 0
2236
+ },
2237
+ mouseLeaveDelay: {
2238
+ type: Number,
2239
+ default: 0.2
2240
+ },
2241
+ disabled: Boolean,
2242
+ arrowOffset: {
2243
+ type: Number,
2244
+ default: 0
2245
+ },
2246
+ offset: {
2247
+ type: Number,
2248
+ default: 0
2249
+ },
2250
+ placement: {
155
2251
  type: String,
156
- default: 'mds-tooltip'
2252
+ default: 'top'
2253
+ },
2254
+ effect: {
2255
+ type: String,
2256
+ default: 'dark'
2257
+ },
2258
+ className: {
2259
+ type: String
2260
+ },
2261
+ title: String,
2262
+ popperOptions: {
2263
+ default: function _default() {
2264
+ return {
2265
+ boundariesPadding: 5,
2266
+ gpuAcceleration: false
2267
+ };
2268
+ }
2269
+ },
2270
+ visibleArrow: {
2271
+ type: Boolean,
2272
+ default: true
2273
+ },
2274
+ tabindex: {
2275
+ type: Number,
2276
+ default: 0
2277
+ },
2278
+ manual: Boolean
2279
+ },
2280
+ data: function data() {
2281
+ return {
2282
+ timer: null, // mouseEnterDelay定时器flag
2283
+ focusing: false,
2284
+ expectedState: false
2285
+ };
2286
+ },
2287
+
2288
+ computed: {
2289
+ realEffect: function realEffect() {
2290
+ return this.effect === 'dark' || this.effect === 'light' ? this.effect : 'dark';
157
2291
  }
158
2292
  },
159
- components: {
160
- /**
161
- * 定义函数化组件用于插入到popperVM
162
- * 实际浮层显示的内容
163
- */
164
- MdsTooltipContent: tooltip_["MdsTooltipContent"]
2293
+
2294
+ watch: {
2295
+ focusing: function focusing(val) {
2296
+ if (val) {
2297
+ Object(dom_helper["a" /* addClass */])(this.referenceElm, 'focusing');
2298
+ } else {
2299
+ Object(dom_helper["h" /* removeClass */])(this.referenceElm, 'focusing');
2300
+ }
2301
+ },
2302
+ showPopper: function showPopper(val) {
2303
+ var _this = this;
2304
+
2305
+ if (val && !this.disabled) {
2306
+ var t = setTimeout(function () {
2307
+ clearTimeout(t);
2308
+ _this.updatePopper(true);
2309
+ }, 0);
2310
+ }
2311
+ }
2312
+ },
2313
+ beforeCreate: function beforeCreate() {
2314
+ this.popperInstance = new external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a({
2315
+ components: {
2316
+ mdsTransition: external_transition_default.a
2317
+ },
2318
+ data: {
2319
+ _h: null,
2320
+ node: ''
2321
+ },
2322
+ render: function render(h) {
2323
+ this._h = h;
2324
+ return this.node;
2325
+ }
2326
+ }).$mount();
2327
+ },
2328
+ mounted: function mounted() {
2329
+ var _this2 = this;
2330
+
2331
+ var readLeaveDelay = this.manual ? 200 : this.mouseLeaveDelay * 1000;
2332
+ this.debounceClose = Object(external_throttle_debounce_["debounce"])(readLeaveDelay, function () {
2333
+ return _this2.handleClosePopper();
2334
+ });
2335
+ this.referenceElm = this.$el;
2336
+
2337
+ if (this.referenceElm.nodeType === 1) {
2338
+ this.referenceElm.setAttribute('tabindex', this.tabindex);
2339
+ for (var item in eventMap) {
2340
+ Object(dom_helper["g" /* on */])(this.referenceElm, item, this[eventMap[item]]);
2341
+ }
2342
+ }
2343
+
2344
+ if (this.value && this.popperInstance) {
2345
+ this.popperInstance.$nextTick(function () {
2346
+ if (_this2.value) {
2347
+ _this2.updatePopper();
2348
+ }
2349
+ });
2350
+ }
2351
+ },
2352
+ beforeDestroy: function beforeDestroy() {
2353
+ this.popperInstance && this.popperInstance.$destroy();
2354
+ },
2355
+ destroyed: function destroyed() {
2356
+ if (this.$el.nodeType === 1) {
2357
+ for (var item in eventMap) {
2358
+ Object(dom_helper["f" /* off */])(this.referenceElm, item, this[eventMap[item]]);
2359
+ }
2360
+ }
2361
+ },
2362
+
2363
+ methods: {
2364
+ show: function show() {
2365
+ this.setExpectedState(true);
2366
+ this.handleShowPopper();
2367
+ },
2368
+ hide: function hide() {
2369
+ this.setExpectedState(false);
2370
+ this.debounceClose();
2371
+ },
2372
+ setExpectedState: function setExpectedState(val) {
2373
+ this.expectedState = val;
2374
+ },
2375
+ handleShowPopper: function handleShowPopper() {
2376
+ var _this3 = this;
2377
+
2378
+ if (!this.expectedState || this.manual) {
2379
+ return;
2380
+ }
2381
+ clearTimeout(this.timer);
2382
+ this.timer = setTimeout(function () {
2383
+ _this3.showPopper = true;
2384
+ }, this.mouseEnterDelay * 1000);
2385
+ },
2386
+ handleClosePopper: function handleClosePopper() {
2387
+ if (this.expectedState || this.manual) {
2388
+ return;
2389
+ }
2390
+ clearTimeout(this.timer);
2391
+ this.showPopper = false;
2392
+ if (this.disabled) {
2393
+ this.doDestroy();
2394
+ }
2395
+ },
2396
+ handleMouseenter: function handleMouseenter() {
2397
+ this.show();
2398
+ },
2399
+ handleMouseleave: function handleMouseleave() {
2400
+ this.hide();
2401
+ },
2402
+ handleFocus: function handleFocus() {
2403
+ this.focusing = true;
2404
+ this.show();
2405
+ },
2406
+ handleBlur: function handleBlur() {
2407
+ this.focusing = false;
2408
+ this.hide();
2409
+ },
2410
+ handleClick: function handleClick() {
2411
+ this.focusing = false;
2412
+ },
2413
+ calculateClass: function calculateClass() {
2414
+ var basicClass = 'mds-tooltip mds-tooltip-placement-' + this.realPlacement + ' ' + this.realEffect + '-mode';
2415
+ return this.className ? basicClass + ' ' + this.className : basicClass;
2416
+ },
2417
+ getRealNode: function getRealNode() {
2418
+ var slots = this.$slots.default;
2419
+ if (!Array.isArray(slots)) return null;
2420
+ var node = null;
2421
+ for (var index = 0; index < slots.length; index++) {
2422
+ if (slots[index] && slots[index].tag) {
2423
+ node = slots[index];
2424
+ }
2425
+ }
2426
+ return node;
2427
+ }
2428
+ },
2429
+ render: function render(h) {
2430
+ var _this4 = this;
2431
+
2432
+ if (this.popperInstance) {
2433
+ var _h = this.popperInstance._h;
2434
+ this.popperInstance.node = _h('mds-transition', {
2435
+ attrs: { type: 'zoom', motion: 'big-fast' },
2436
+ on: {
2437
+ 'after-enter': function afterEnter() {
2438
+ _this4.$emit('after-enter');
2439
+ },
2440
+ 'after-leave': function afterLeave() {
2441
+ _this4.$emit('after-leave');
2442
+ }
2443
+ }
2444
+ }, [_h('div', {
2445
+ ref: 'popper',
2446
+ directives: [{
2447
+ name: 'show',
2448
+ value: !this.disabled && this.showPopper
2449
+ }],
2450
+ on: {
2451
+ mouseleave: function mouseleave() {
2452
+ _this4.setExpectedState(false);
2453
+ _this4.debounceClose();
2454
+ },
2455
+ mouseenter: function mouseenter() {
2456
+ _this4.setExpectedState(true);
2457
+ }
2458
+ },
2459
+ class: this.calculateClass()
2460
+ }, [this.$slots.title || this.title])]);
2461
+ }
2462
+ this.$nextTick(function () {
2463
+ _this4.popperElm = _this4.popperInstance.$el;
2464
+ });
2465
+ var realNode = this.getRealNode();
2466
+ if (!realNode) return null;
2467
+ return realNode;
165
2468
  }
166
2469
  });
167
2470
  // CONCATENATED MODULE: ./components/tooltip/index.js
@@ -173,6 +2476,226 @@ tooltip.install = function (Vue) {
173
2476
  };
174
2477
  /* harmony default export */ var components_tooltip = __webpack_exports__["default"] = (tooltip);
175
2478
 
2479
+ /***/ }),
2480
+
2481
+ /***/ 5:
2482
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2483
+
2484
+ "use strict";
2485
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
2486
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
2487
+ /* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
2488
+
2489
+
2490
+
2491
+ var hasModal = false;
2492
+ var hasInitZIndex = false;
2493
+ var zIndex = void 0;
2494
+
2495
+ var getModal = function getModal() {
2496
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
2497
+ var modalDom = PopupManager.modalDom;
2498
+ if (modalDom) {
2499
+ hasModal = true;
2500
+ } else {
2501
+ hasModal = false;
2502
+ modalDom = document.createElement('div');
2503
+ PopupManager.modalDom = modalDom;
2504
+
2505
+ modalDom.addEventListener('touchmove', function (event) {
2506
+ event.preventDefault();
2507
+ event.stopPropagation();
2508
+ });
2509
+
2510
+ modalDom.addEventListener('click', function () {
2511
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
2512
+ });
2513
+ }
2514
+
2515
+ return modalDom;
2516
+ };
2517
+
2518
+ var instances = {};
2519
+
2520
+ var PopupManager = {
2521
+ modalFade: true,
2522
+
2523
+ getInstance: function getInstance(id) {
2524
+ return instances[id];
2525
+ },
2526
+
2527
+ register: function register(id, instance) {
2528
+ if (id && instance) {
2529
+ instances[id] = instance;
2530
+ }
2531
+ },
2532
+
2533
+ deregister: function deregister(id) {
2534
+ if (id) {
2535
+ instances[id] = null;
2536
+ delete instances[id];
2537
+ }
2538
+ },
2539
+
2540
+ nextZIndex: function nextZIndex() {
2541
+ return PopupManager.zIndex++;
2542
+ },
2543
+
2544
+ modalStack: [],
2545
+
2546
+ doOnModalClick: function doOnModalClick() {
2547
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
2548
+ if (!topItem) return;
2549
+
2550
+ var instance = PopupManager.getInstance(topItem.id);
2551
+ if (instance && instance.closeOnClickModal) {
2552
+ instance.close();
2553
+ }
2554
+ },
2555
+
2556
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
2557
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
2558
+ if (!id || zIndex === undefined) return;
2559
+ this.modalFade = modalFade;
2560
+
2561
+ var modalStack = this.modalStack;
2562
+
2563
+ for (var i = 0, j = modalStack.length; i < j; i++) {
2564
+ var item = modalStack[i];
2565
+ if (item.id === id) {
2566
+ return;
2567
+ }
2568
+ }
2569
+
2570
+ var modalDom = getModal();
2571
+
2572
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
2573
+ if (this.modalFade && !hasModal) {
2574
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
2575
+ }
2576
+ if (modalClass) {
2577
+ var classArr = modalClass.trim().split(/\s+/);
2578
+ classArr.forEach(function (item) {
2579
+ return Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
2580
+ });
2581
+ }
2582
+ setTimeout(function () {
2583
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, 'v-modal-enter');
2584
+ }, 200);
2585
+
2586
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
2587
+ dom.parentNode.appendChild(modalDom);
2588
+ } else {
2589
+ document.body.appendChild(modalDom);
2590
+ }
2591
+
2592
+ if (zIndex) {
2593
+ modalDom.style.zIndex = zIndex;
2594
+ }
2595
+ modalDom.tabIndex = 0;
2596
+ modalDom.style.display = '';
2597
+
2598
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
2599
+ },
2600
+
2601
+ closeModal: function closeModal(id) {
2602
+ var modalStack = this.modalStack;
2603
+ var modalDom = getModal();
2604
+
2605
+ if (modalStack.length > 0) {
2606
+ var topItem = modalStack[modalStack.length - 1];
2607
+ if (topItem.id === id) {
2608
+ if (topItem.modalClass) {
2609
+ var classArr = topItem.modalClass.trim().split(/\s+/);
2610
+ classArr.forEach(function (item) {
2611
+ return Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, item);
2612
+ });
2613
+ }
2614
+
2615
+ modalStack.pop();
2616
+ if (modalStack.length > 0) {
2617
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
2618
+ }
2619
+ } else {
2620
+ for (var i = modalStack.length - 1; i >= 0; i--) {
2621
+ if (modalStack[i].id === id) {
2622
+ modalStack.splice(i, 1);
2623
+ break;
2624
+ }
2625
+ }
2626
+ }
2627
+ }
2628
+
2629
+ if (modalStack.length === 0) {
2630
+ if (this.modalFade) {
2631
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
2632
+ }
2633
+ setTimeout(function () {
2634
+ if (modalStack.length === 0) {
2635
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
2636
+ modalDom.style.display = 'none';
2637
+ PopupManager.modalDom = undefined;
2638
+ }
2639
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, 'v-modal-leave');
2640
+ }, 200);
2641
+ }
2642
+ }
2643
+ };
2644
+
2645
+ Object.defineProperty(PopupManager, 'zIndex', {
2646
+ configurable: true,
2647
+ get: function get() {
2648
+ if (!hasInitZIndex) {
2649
+ zIndex = zIndex || (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$ELEMENT || {}).zIndex || 2000;
2650
+ hasInitZIndex = true;
2651
+ }
2652
+ return zIndex;
2653
+ },
2654
+ set: function set(value) {
2655
+ zIndex = value;
2656
+ }
2657
+ });
2658
+
2659
+ var getTopPopup = function getTopPopup() {
2660
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
2661
+ if (PopupManager.modalStack.length > 0) {
2662
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
2663
+ if (!topPopup) return;
2664
+ var instance = PopupManager.getInstance(topPopup.id);
2665
+
2666
+ return instance;
2667
+ }
2668
+ };
2669
+
2670
+ if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
2671
+ // handle `esc` key when the popup is shown
2672
+ window.addEventListener('keydown', function (event) {
2673
+ if (event.keyCode === 27) {
2674
+ var topPopup = getTopPopup();
2675
+
2676
+ if (topPopup && topPopup.closeOnPressEscape) {
2677
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
2678
+ }
2679
+ }
2680
+ });
2681
+ }
2682
+
2683
+ /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
2684
+
2685
+ /***/ }),
2686
+
2687
+ /***/ 6:
2688
+ /***/ (function(module, exports) {
2689
+
2690
+ module.exports = require("babel-runtime/core-js/object/assign");
2691
+
2692
+ /***/ }),
2693
+
2694
+ /***/ 9:
2695
+ /***/ (function(module, exports) {
2696
+
2697
+ module.exports = require("babel-runtime/helpers/typeof");
2698
+
176
2699
  /***/ })
177
2700
 
178
2701
  /******/ });