@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/slottable.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("./_util/proptype"), require("./_mixin/tooltip"));
3
+ module.exports = factory(require("vue"), require("./_util/proptype"), require("./transition"));
4
4
  else if(typeof define === 'function' && define.amd)
5
- define(["./_util/proptype", "./_mixin/tooltip"], factory);
5
+ define(["vue", "./_util/proptype", "./transition"], factory);
6
6
  else {
7
- var a = typeof exports === 'object' ? factory(require("./_util/proptype"), require("./_mixin/tooltip")) : factory(root["./_util/proptype"], root["./_mixin/tooltip"]);
7
+ var a = typeof exports === 'object' ? factory(require("vue"), require("./_util/proptype"), require("./transition")) : factory(root["Vue"], root["./_util/proptype"], 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__3__, __WEBPACK_EXTERNAL_MODULE__16__) {
10
+ })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__11__) {
11
11
  return /******/ (function(modules) { // webpackBootstrap
12
12
  /******/ // The module cache
13
13
  /******/ var installedModules = {};
@@ -91,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap
91
91
  /******/
92
92
  /******/
93
93
  /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = 110);
94
+ /******/ return __webpack_require__(__webpack_require__.s = 118);
95
95
  /******/ })
96
96
  /************************************************************************/
97
97
  /******/ ({
@@ -204,13 +204,309 @@ function normalizeComponent (
204
204
  /***/ }),
205
205
 
206
206
  /***/ 1:
207
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
208
+
209
+ "use strict";
210
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; });
211
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; });
212
+ /* unused harmony export once */
213
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; });
214
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
215
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return removeClass; });
216
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; });
217
+ /* unused harmony export setStyle */
218
+ /* unused harmony export isScroll */
219
+ /* unused harmony export getScrollContainer */
220
+ /* unused harmony export isInContainer */
221
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return merge; });
222
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollBarWidth; });
223
+ /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
224
+ /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
225
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
226
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__);
227
+
228
+
229
+
230
+ /* eslint-disable */
231
+ var isServer = vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer;
232
+ var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
233
+ var MOZ_HACK_REGEXP = /^moz([A-Z])/;
234
+ var ieVersion = isServer ? 0 : Number(document.documentMode);
235
+
236
+ /* istanbul ignore next */
237
+ var trim = function trim(string) {
238
+ return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
239
+ };
240
+ /* istanbul ignore next */
241
+ var camelCase = function camelCase(name) {
242
+ return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
243
+ return offset ? letter.toUpperCase() : letter;
244
+ }).replace(MOZ_HACK_REGEXP, 'Moz$1');
245
+ };
246
+
247
+ /* istanbul ignore next */
248
+ var on = function () {
249
+ if (!isServer && document.addEventListener) {
250
+ return function (element, event, handler) {
251
+ if (element && event && handler) {
252
+ element.addEventListener(event, handler, false);
253
+ }
254
+ };
255
+ } else {
256
+ return function (element, event, handler) {
257
+ if (element && event && handler) {
258
+ element.attachEvent('on' + event, handler);
259
+ }
260
+ };
261
+ }
262
+ }();
263
+
264
+ /* istanbul ignore next */
265
+ var off = function () {
266
+ if (!isServer && document.removeEventListener) {
267
+ return function (element, event, handler) {
268
+ if (element && event) {
269
+ element.removeEventListener(event, handler, false);
270
+ }
271
+ };
272
+ } else {
273
+ return function (element, event, handler) {
274
+ if (element && event) {
275
+ element.detachEvent('on' + event, handler);
276
+ }
277
+ };
278
+ }
279
+ }();
280
+
281
+ /* istanbul ignore next */
282
+ var once = function once(el, event, fn) {
283
+ var listener = function listener() {
284
+ if (fn) {
285
+ fn.apply(this, arguments);
286
+ }
287
+ off(el, event, listener);
288
+ };
289
+ on(el, event, listener);
290
+ };
291
+
292
+ /* istanbul ignore next */
293
+ function hasClass(el, cls) {
294
+ if (!el || !cls) return false;
295
+ if (cls.indexOf(' ') !== -1) {
296
+ throw new Error('className should not contain space.');
297
+ }
298
+ if (el.classList) {
299
+ return el.classList.contains(cls);
300
+ } else {
301
+ return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
302
+ }
303
+ }
304
+
305
+ /* istanbul ignore next */
306
+ function addClass(el, cls) {
307
+ if (!el) return;
308
+ var curClass = el.className;
309
+ var classes = (cls || '').split(' ');
310
+
311
+ for (var i = 0, j = classes.length; i < j; i++) {
312
+ var clsName = classes[i];
313
+ if (!clsName) continue;
314
+
315
+ if (el.classList) {
316
+ el.classList.add(clsName);
317
+ } else if (!hasClass(el, clsName)) {
318
+ curClass += ' ' + clsName;
319
+ }
320
+ }
321
+ if (!el.classList) {
322
+ el.setAttribute('class', curClass);
323
+ }
324
+ }
325
+
326
+ /* istanbul ignore next */
327
+ function removeClass(el, cls) {
328
+ if (!el || !cls) return;
329
+ var classes = cls.split(' ');
330
+ var curClass = ' ' + el.className + ' ';
331
+
332
+ for (var i = 0, j = classes.length; i < j; i++) {
333
+ var clsName = classes[i];
334
+ if (!clsName) continue;
335
+
336
+ if (el.classList) {
337
+ el.classList.remove(clsName);
338
+ } else if (hasClass(el, clsName)) {
339
+ curClass = curClass.replace(' ' + clsName + ' ', ' ');
340
+ }
341
+ }
342
+ if (!el.classList) {
343
+ el.setAttribute('class', trim(curClass));
344
+ }
345
+ }
346
+
347
+ /* istanbul ignore next */
348
+ var getStyle = ieVersion < 9 ? function (element, styleName) {
349
+ if (isServer) return;
350
+ if (!element || !styleName) return null;
351
+ styleName = camelCase(styleName);
352
+ if (styleName === 'float') {
353
+ styleName = 'styleFloat';
354
+ }
355
+ try {
356
+ switch (styleName) {
357
+ case 'opacity':
358
+ try {
359
+ return element.filters.item('alpha').opacity / 100;
360
+ } catch (e) {
361
+ return 1.0;
362
+ }
363
+ default:
364
+ return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
365
+ }
366
+ } catch (e) {
367
+ return element.style[styleName];
368
+ }
369
+ } : function (element, styleName) {
370
+ if (isServer) return;
371
+ if (!element || !styleName) return null;
372
+ styleName = camelCase(styleName);
373
+ if (styleName === 'float') {
374
+ styleName = 'cssFloat';
375
+ }
376
+ try {
377
+ var computed = document.defaultView.getComputedStyle(element, '');
378
+ return element.style[styleName] || computed ? computed[styleName] : null;
379
+ } catch (e) {
380
+ return element.style[styleName];
381
+ }
382
+ };
383
+
384
+ /* istanbul ignore next */
385
+ function setStyle(element, styleName, value) {
386
+ if (!element || !styleName) return;
387
+
388
+ if ((typeof styleName === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(styleName)) === 'object') {
389
+ for (var prop in styleName) {
390
+ if (styleName.hasOwnProperty(prop)) {
391
+ setStyle(element, prop, styleName[prop]);
392
+ }
393
+ }
394
+ } else {
395
+ styleName = camelCase(styleName);
396
+ if (styleName === 'opacity' && ieVersion < 9) {
397
+ element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
398
+ } else {
399
+ element.style[styleName] = value;
400
+ }
401
+ }
402
+ }
403
+
404
+ var isScroll = function isScroll(el, vertical) {
405
+ if (isServer) return;
406
+
407
+ var determinedDirection = vertical !== null && vertical !== undefined;
408
+ var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
409
+
410
+ return overflow.match(/(scroll|auto|overlay)/);
411
+ };
412
+
413
+ var getScrollContainer = function getScrollContainer(el, vertical) {
414
+ if (isServer) return;
415
+
416
+ var parent = el;
417
+ while (parent) {
418
+ if ([window, document, document.documentElement].includes(parent)) {
419
+ return window;
420
+ }
421
+ if (isScroll(parent, vertical)) {
422
+ return parent;
423
+ }
424
+ parent = parent.parentNode;
425
+ }
426
+
427
+ return parent;
428
+ };
429
+
430
+ var isInContainer = function isInContainer(el, container) {
431
+ if (isServer || !el || !container) return false;
432
+
433
+ var elRect = el.getBoundingClientRect();
434
+ var containerRect = void 0;
435
+
436
+ if ([window, document, document.documentElement, null, undefined].includes(container)) {
437
+ containerRect = {
438
+ top: 0,
439
+ right: window.innerWidth,
440
+ bottom: window.innerHeight,
441
+ left: 0
442
+ };
443
+ } else {
444
+ containerRect = container.getBoundingClientRect();
445
+ }
446
+
447
+ return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
448
+ };
449
+
450
+ function merge(target) {
451
+ for (var i = 1, j = arguments.length; i < j; i++) {
452
+ var source = arguments[i] || {};
453
+ for (var prop in source) {
454
+ if (source.hasOwnProperty(prop)) {
455
+ var value = source[prop];
456
+ if (value !== undefined) {
457
+ target[prop] = value;
458
+ }
459
+ }
460
+ }
461
+ }
462
+
463
+ return target;
464
+ }
465
+
466
+ var scrollBarWidth = void 0;
467
+ function getScrollBarWidth() {
468
+ if (vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer) return 0;
469
+ if (scrollBarWidth !== undefined) return scrollBarWidth;
470
+
471
+ var outer = document.createElement('div');
472
+ outer.className = 'el-scrollbar__wrap';
473
+ outer.style.visibility = 'hidden';
474
+ outer.style.width = '100px';
475
+ outer.style.position = 'absolute';
476
+ outer.style.top = '-9999px';
477
+ document.body.appendChild(outer);
478
+
479
+ var widthNoScroll = outer.offsetWidth;
480
+ outer.style.overflow = 'scroll';
481
+
482
+ var inner = document.createElement('div');
483
+ inner.style.width = '100%';
484
+ outer.appendChild(inner);
485
+
486
+ var widthWithScroll = inner.offsetWidth;
487
+ outer.parentNode.removeChild(outer);
488
+ scrollBarWidth = widthNoScroll - widthWithScroll;
489
+
490
+ return scrollBarWidth;
491
+ }
492
+
493
+ /***/ }),
494
+
495
+ /***/ 10:
207
496
  /***/ (function(module, exports) {
208
497
 
209
- module.exports = require("babel-runtime/helpers/defineProperty");
498
+ module.exports = require("babel-runtime/core-js/object/keys");
499
+
500
+ /***/ }),
501
+
502
+ /***/ 11:
503
+ /***/ (function(module, exports) {
504
+
505
+ module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
210
506
 
211
507
  /***/ }),
212
508
 
213
- /***/ 110:
509
+ /***/ 118:
214
510
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
215
511
 
216
512
  "use strict";
@@ -218,10 +514,10 @@ module.exports = require("babel-runtime/helpers/defineProperty");
218
514
  __webpack_require__.r(__webpack_exports__);
219
515
 
220
516
  // EXTERNAL MODULE: ./components/style/index.less
221
- var style = __webpack_require__(131);
517
+ var style = __webpack_require__(139);
222
518
 
223
519
  // EXTERNAL MODULE: ./components/slot-table/style/index.less
224
- var slot_table_style = __webpack_require__(215);
520
+ var slot_table_style = __webpack_require__(224);
225
521
 
226
522
  // CONCATENATED MODULE: ./components/slot-table/style/index.js
227
523
 
@@ -268,6 +564,7 @@ var tablevue_type_template_id_0d34df4e_render = function () {
268
564
  headerRowStyle: _vm.headerRowStyle,
269
565
  headerCellClassName: _vm.headerCellClassName,
270
566
  headerCellStyle: _vm.headerCellStyle,
567
+ resizeWidth: _vm.resizeWidth,
271
568
  tableSize: _vm.tableSize,
272
569
  columns: _vm.columns,
273
570
  width: _vm.doWidth,
@@ -360,7 +657,7 @@ tablevue_type_template_id_0d34df4e_render._withStripped = true
360
657
  // CONCATENATED MODULE: ./components/slot-table/src/table.vue?vue&type=template&id=0d34df4e&
361
658
 
362
659
  // EXTERNAL MODULE: external "babel-runtime/helpers/extends"
363
- var extends_ = __webpack_require__(19);
660
+ var extends_ = __webpack_require__(26);
364
661
  var extends_default = /*#__PURE__*/__webpack_require__.n(extends_);
365
662
 
366
663
  // CONCATENATED MODULE: ./components/slot-table/src/util.js
@@ -426,12 +723,8 @@ function handleRowFunctionOrString(val, row, rowIndex) {
426
723
  function handleCellFunctionOrString(val, row, column, rowIndex, columnIndex) {
427
724
  return typeof val === 'function' ? val({ row: extends_default()({}, row), column: extends_default()({}, column), rowIndex: rowIndex, columnIndex: columnIndex }) : val;
428
725
  }
429
- // EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
430
- var defineProperty_ = __webpack_require__(1);
431
- var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
432
-
433
726
  // EXTERNAL MODULE: external "babel-runtime/helpers/toConsumableArray"
434
- var toConsumableArray_ = __webpack_require__(17);
727
+ var toConsumableArray_ = __webpack_require__(24);
435
728
  var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_);
436
729
 
437
730
  // CONCATENATED MODULE: ./components/slot-table/src/table-header.js
@@ -439,7 +732,6 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
439
732
 
440
733
 
441
734
 
442
-
443
735
  /* harmony default export */ var table_header = ({
444
736
  name: 'MdsSlotTableHeader',
445
737
  props: {
@@ -453,7 +745,8 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
453
745
  width: [String, Number],
454
746
  border: Boolean,
455
747
  hasGutter: Boolean,
456
- gutterWidth: [String, Number]
748
+ gutterWidth: [String, Number],
749
+ resizeWidth: Boolean
457
750
  },
458
751
  methods: {
459
752
  cellClass: function cellClass(col, index) {
@@ -467,6 +760,9 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
467
760
 
468
761
  // 定制列宽,距离小于10的时候出现resize标识
469
762
  thMouseMove: function thMouseMove(e) {
763
+ if (!this.resizeWidth) {
764
+ return;
765
+ }
470
766
  var offsetRight = e.target.offsetWidth - e.offsetX;
471
767
  if (offsetRight < 10) {
472
768
  e.target.style.cursor = 'col-resize';
@@ -475,6 +771,9 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
475
771
  }
476
772
  },
477
773
  thMouseDown: function thMouseDown(e, index) {
774
+ if (!this.resizeWidth) {
775
+ return;
776
+ }
478
777
  var offsetRight = e.target.offsetWidth - e.offsetX;
479
778
  if (offsetRight > 10) return null;
480
779
  this.$emit('col-resize', {
@@ -524,10 +823,7 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
524
823
  }
525
824
  },
526
825
  [h('colgroup', [this.columns.map(function (column, index) {
527
- return h('col', {
528
- key: column.label + index,
529
- attrs: { width: toPxNumber(column.width)
530
- }
826
+ return h('col', { key: column.id, attrs: { width: toPxNumber(column.width) }
531
827
  });
532
828
  }), this.hasGutter ? h('col', {
533
829
  attrs: { name: 'gutter', width: this.gutterWidth },
@@ -548,10 +844,8 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
548
844
  colspan: '1',
549
845
  rowspan: '1'
550
846
  },
551
- key: column.label + index,
552
- style: extends_default()({
553
- width: column.width
554
- }, handleCellFunctionOrString(_this.headerCellStyle, undefined, column, 0, index)),
847
+ key: column.id,
848
+ style: extends_default()({}, handleCellFunctionOrString(_this.headerCellStyle, undefined, column, 0, index)),
555
849
  'class': ['mds-slot-table-column'].concat(toConsumableArray_default()(_this.cellClass(column, index)), [handleCellFunctionOrString(_this.headerCellClassName, undefined, column, 0, index)]),
556
850
  on: {
557
851
  'mousemove': _this.thMouseMove,
@@ -562,9 +856,7 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
562
856
  },
563
857
  [column.label]
564
858
  );
565
- }), this.hasGutter ? h('th', defineProperty_default()({
566
- 'class': 'gutter'
567
- }, 'class', 'mds-slot-table-column mds-slot-table-th-gutter')) : null]
859
+ }), this.hasGutter ? h('th', { 'class': 'mds-slot-table-column mds-slot-table-th-gutter' }) : null]
568
860
  )]
569
861
  )]
570
862
  );
@@ -629,7 +921,7 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
629
921
  },
630
922
  [h('colgroup', [this.columns.map(function (column, index) {
631
923
  return h('col', {
632
- key: column.label + index,
924
+ key: column.id,
633
925
  attrs: { width: toPxNumber(column.width)
634
926
  }
635
927
  });
@@ -670,7 +962,7 @@ var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableA
670
962
  }
671
963
  });
672
964
  // EXTERNAL MODULE: ./components/empty/empty.vue + 4 modules
673
- var empty = __webpack_require__(31);
965
+ var empty = __webpack_require__(40);
674
966
 
675
967
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/slot-table/src/table.vue?vue&type=script&lang=js&
676
968
  //
@@ -754,6 +1046,7 @@ var empty = __webpack_require__(31);
754
1046
  //
755
1047
  //
756
1048
  //
1049
+ //
757
1050
 
758
1051
 
759
1052
 
@@ -813,7 +1106,8 @@ var tableIdSeed = 1;
813
1106
  loadingText: {
814
1107
  type: String,
815
1108
  default: '加载中...'
816
- }
1109
+ },
1110
+ resizeWidth: Boolean
817
1111
  },
818
1112
  data: function data() {
819
1113
  return {
@@ -975,11 +1269,19 @@ if (false) { var api; }
975
1269
  component.options.__file = "components/slot-table/src/table.vue"
976
1270
  /* harmony default export */ var table = (component.exports);
977
1271
  // EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
978
- var keys_ = __webpack_require__(12);
1272
+ var keys_ = __webpack_require__(10);
979
1273
  var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
980
1274
 
1275
+ // EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
1276
+ var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(72);
1277
+ var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
1278
+
1279
+ // EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
1280
+ var defineProperty_ = __webpack_require__(3);
1281
+ var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
1282
+
981
1283
  // EXTERNAL MODULE: ./components/tooltip/index.js + 1 modules
982
- var tooltip = __webpack_require__(36);
1284
+ var tooltip = __webpack_require__(44);
983
1285
 
984
1286
  // CONCATENATED MODULE: ./components/slot-table/src/table-column.js
985
1287
 
@@ -987,6 +1289,7 @@ var tooltip = __webpack_require__(36);
987
1289
 
988
1290
 
989
1291
 
1292
+
990
1293
  /* harmony default export */ var table_column = ({
991
1294
  name: 'MdsSlotTableColumn',
992
1295
  componentName: 'MdsSlotTableColumn',
@@ -1005,16 +1308,19 @@ var tooltip = __webpack_require__(36);
1005
1308
  // hover高亮
1006
1309
  hoverlight: Boolean,
1007
1310
  // 是否溢出打点
1008
- elli: {
1009
- type: Boolean,
1010
- default: true
1011
- },
1311
+ elli: Boolean,
1012
1312
  // 是否显示toopTip
1013
1313
  tooltip: Boolean,
1014
1314
  minWidth: [Number, String],
1015
1315
  className: [String, Function],
1016
1316
  labelClassName: [String, Function],
1017
- headerAlign: String
1317
+ headerAlign: String,
1318
+ tooltipOptions: {
1319
+ type: Object,
1320
+ default: function _default() {
1321
+ return { effect: 'dark', placement: 'bottom' };
1322
+ }
1323
+ }
1018
1324
  },
1019
1325
 
1020
1326
  methods: {
@@ -1040,14 +1346,18 @@ var tooltip = __webpack_require__(36);
1040
1346
 
1041
1347
  var column = extends_default()({}, this.$props);
1042
1348
  column.renderCell = function (data) {
1043
- var cellId = 'row_' + data.rowindex + '_col_' + data.columnIndex;
1349
+ var cellId = 'row_' + data.rowIndex + '_col_' + data.columnIndex;
1044
1350
  var render = void 0;
1045
1351
  // 返回插槽内容,不响应一般内容的额外属性
1046
1352
  if (_this.$scopedSlots.default) {
1047
1353
  render = function render() {
1048
1354
  return _this.$scopedSlots.default(data);
1049
1355
  };
1050
- return render();
1356
+ return h(
1357
+ 'div',
1358
+ { 'class': 'cell' },
1359
+ [render()]
1360
+ );
1051
1361
  }
1052
1362
 
1053
1363
  render = function render(data) {
@@ -1060,14 +1370,11 @@ var tooltip = __webpack_require__(36);
1060
1370
 
1061
1371
  tempTemplete = h(
1062
1372
  'mds-tooltip',
1063
- {
1373
+ external_babel_helper_vue_jsx_merge_props_default()([{ props: _this.tooltipOptions }, {
1064
1374
  attrs: {
1065
- effect: 'light',
1066
- placement: 'bottom',
1067
- title: data.row[column.prop],
1068
- className: 'mds-slot-table-tooltip'
1375
+ title: data.row[column.prop]
1069
1376
  }
1070
- },
1377
+ }]),
1071
1378
  [h(
1072
1379
  'div',
1073
1380
  {
@@ -1147,105 +1454,1845 @@ table.install = function (Vue) {
1147
1454
 
1148
1455
  /***/ }),
1149
1456
 
1150
- /***/ 12:
1457
+ /***/ 139:
1151
1458
  /***/ (function(module, exports) {
1152
1459
 
1153
- module.exports = require("babel-runtime/core-js/object/keys");
1460
+ // removed by extract-text-webpack-plugin
1154
1461
 
1155
1462
  /***/ }),
1156
1463
 
1157
- /***/ 131:
1158
- /***/ (function(module, exports) {
1464
+ /***/ 14:
1465
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1159
1466
 
1160
- // removed by extract-text-webpack-plugin
1467
+ "use strict";
1468
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1469
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
1470
+ /* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
1471
+ /* harmony import */ var _popup_manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
1472
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _popup_manager__WEBPACK_IMPORTED_MODULE_2__["a"]; });
1161
1473
 
1162
- /***/ }),
1163
1474
 
1164
- /***/ 16:
1165
- /***/ (function(module, exports) {
1166
1475
 
1167
- module.exports = __WEBPACK_EXTERNAL_MODULE__16__;
1168
1476
 
1169
- /***/ }),
1170
1477
 
1171
- /***/ 17:
1172
- /***/ (function(module, exports) {
1478
+ var idSeed = 1;
1173
1479
 
1174
- module.exports = require("babel-runtime/helpers/toConsumableArray");
1480
+ var scrollBarWidth = void 0;
1175
1481
 
1176
- /***/ }),
1482
+ /* harmony default export */ __webpack_exports__["b"] = ({
1483
+ props: {
1484
+ visibility: {
1485
+ type: Boolean,
1486
+ default: false
1487
+ },
1488
+ openDelay: {},
1489
+ closeDelay: {},
1490
+ zIndex: {},
1491
+ modal: {
1492
+ type: Boolean,
1493
+ default: false
1494
+ },
1495
+ modalFade: {
1496
+ type: Boolean,
1497
+ default: true
1498
+ },
1499
+ modalClass: {},
1500
+ modalAppendToBody: {
1501
+ type: Boolean,
1502
+ default: false
1503
+ },
1504
+ lockScroll: {
1505
+ type: Boolean,
1506
+ default: true
1507
+ },
1508
+ closeOnPressEscape: {
1509
+ type: Boolean,
1510
+ default: false
1511
+ },
1512
+ closeOnClickModal: {
1513
+ type: Boolean,
1514
+ default: false
1515
+ }
1516
+ },
1177
1517
 
1178
- /***/ 177:
1179
- /***/ (function(module, exports) {
1518
+ beforeMount: function beforeMount() {
1519
+ this._popupId = 'popup-' + idSeed++;
1520
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].register(this._popupId, this);
1521
+ },
1522
+ beforeDestroy: function beforeDestroy() {
1523
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].deregister(this._popupId);
1524
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
1180
1525
 
1181
- // removed by extract-text-webpack-plugin
1526
+ this.restoreBodyStyle();
1527
+ },
1528
+ data: function data() {
1529
+ return {
1530
+ opened: false,
1531
+ bodyPaddingRight: null,
1532
+ computedBodyPaddingRight: 0,
1533
+ withoutHiddenClass: true,
1534
+ rendered: false
1535
+ };
1536
+ },
1182
1537
 
1183
- /***/ }),
1184
1538
 
1185
- /***/ 19:
1186
- /***/ (function(module, exports) {
1539
+ watch: {
1540
+ visibility: function visibility(val) {
1541
+ var _this = this;
1187
1542
 
1188
- module.exports = require("babel-runtime/helpers/extends");
1543
+ if (val) {
1544
+ if (this._opening) return;
1545
+ if (!this.rendered) {
1546
+ this.rendered = true;
1547
+ vue__WEBPACK_IMPORTED_MODULE_0___default.a.nextTick(function () {
1548
+ _this.open();
1549
+ });
1550
+ } else {
1551
+ this.open();
1552
+ }
1553
+ } else {
1554
+ this.close();
1555
+ }
1556
+ }
1557
+ },
1189
1558
 
1190
- /***/ }),
1559
+ methods: {
1560
+ open: function open(options) {
1561
+ var _this2 = this;
1191
1562
 
1192
- /***/ 215:
1193
- /***/ (function(module, exports) {
1563
+ if (!this.rendered) {
1564
+ this.rendered = true;
1565
+ }
1566
+ var props = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* merge */ "e"])({}, this.$props || this, options);
1194
1567
 
1195
- // removed by extract-text-webpack-plugin
1568
+ if (this._closeTimer) {
1569
+ clearTimeout(this._closeTimer);
1570
+ this._closeTimer = null;
1571
+ }
1572
+ clearTimeout(this._openTimer);
1573
+
1574
+ var openDelay = Number(props.openDelay);
1575
+ if (openDelay > 0) {
1576
+ this._openTimer = setTimeout(function () {
1577
+ _this2._openTimer = null;
1578
+ _this2.doOpen(props);
1579
+ }, openDelay);
1580
+ } else {
1581
+ this.doOpen(props);
1582
+ }
1583
+ },
1584
+ doOpen: function doOpen(props) {
1585
+ if (this.$isServer) return;
1586
+ if (this.willOpen && !this.willOpen()) return;
1587
+ if (this.opened) return;
1196
1588
 
1197
- /***/ }),
1589
+ this._opening = true;
1198
1590
 
1199
- /***/ 3:
1200
- /***/ (function(module, exports) {
1591
+ var dom = this.$el;
1201
1592
 
1202
- module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
1593
+ var modal = props.modal;
1203
1594
 
1204
- /***/ }),
1595
+ var zIndex = props.zIndex;
1596
+ if (zIndex) {
1597
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].zIndex = zIndex;
1598
+ }
1205
1599
 
1206
- /***/ 31:
1207
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1600
+ if (modal) {
1601
+ if (this._closing) {
1602
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
1603
+ this._closing = false;
1604
+ }
1605
+ _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);
1606
+ if (props.lockScroll) {
1607
+ this.withoutHiddenClass = !Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* hasClass */ "d"])(document.body, 'mds-popup-parent--hidden');
1608
+ if (this.withoutHiddenClass) {
1609
+ this.bodyPaddingRight = document.body.style.paddingRight;
1610
+ this.computedBodyPaddingRight = parseInt(Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'paddingRight'), 10);
1611
+ }
1612
+ scrollBarWidth = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getScrollBarWidth */ "b"])();
1613
+ var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
1614
+ var bodyOverflowY = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'overflowY');
1615
+ if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
1616
+ document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
1617
+ }
1618
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(document.body, 'mds-popup-parent--hidden');
1619
+ }
1620
+ }
1208
1621
 
1209
- "use strict";
1622
+ if (getComputedStyle(dom).position === 'static') {
1623
+ dom.style.position = 'absolute';
1624
+ }
1210
1625
 
1211
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/empty/empty.vue?vue&type=template&id=4c25cea0&
1212
- var render = function () {
1213
- var _vm = this
1214
- var _h = _vm.$createElement
1215
- var _c = _vm._self._c || _h
1216
- return _c("div", { class: _vm.classes }, [
1217
- _c("div", { class: _vm.prefixCls + "-image", style: _vm.imageStyle }, [
1218
- _vm.image
1219
- ? _c("img", {
1220
- class: _vm.prefixCls + "-img",
1221
- attrs: { src: _vm.imageSrc },
1222
- })
1223
- : _vm._e(),
1224
- ]),
1225
- _c("div", { class: _vm.prefixCls + "-info" }, [
1226
- _vm.desc
1227
- ? _c("div", { class: _vm.prefixCls + "-desc" }, [
1228
- _vm._v(_vm._s(_vm.desc)),
1229
- ])
1230
- : _vm._e(),
1231
- _vm.$slots.custom
1232
- ? _c("div", { class: _vm.prefixCls + "-custom" }, [_vm._t("custom")], 2)
1233
- : _vm._e(),
1234
- ]),
1235
- ])
1236
- }
1237
- var staticRenderFns = []
1238
- render._withStripped = true
1626
+ dom.style.zIndex = _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex();
1627
+ this.opened = true;
1239
1628
 
1629
+ this.onOpen && this.onOpen();
1240
1630
 
1241
- // CONCATENATED MODULE: ./components/empty/empty.vue?vue&type=template&id=4c25cea0&
1631
+ this.doAfterOpen();
1632
+ },
1633
+ doAfterOpen: function doAfterOpen() {
1634
+ this._opening = false;
1635
+ },
1636
+ close: function close() {
1637
+ var _this3 = this;
1242
1638
 
1243
- // EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
1244
- var defineProperty_ = __webpack_require__(1);
1245
- var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
1639
+ if (this.willClose && !this.willClose()) return;
1640
+
1641
+ if (this._openTimer !== null) {
1642
+ clearTimeout(this._openTimer);
1643
+ this._openTimer = null;
1644
+ }
1645
+ clearTimeout(this._closeTimer);
1646
+
1647
+ var closeDelay = Number(this.closeDelay);
1648
+
1649
+ if (closeDelay > 0) {
1650
+ this._closeTimer = setTimeout(function () {
1651
+ _this3._closeTimer = null;
1652
+ _this3.doClose();
1653
+ }, closeDelay);
1654
+ } else {
1655
+ this.doClose();
1656
+ }
1657
+ },
1658
+ doClose: function doClose() {
1659
+ this._closing = true;
1660
+
1661
+ this.onClose && this.onClose();
1662
+
1663
+ if (this.lockScroll) {
1664
+ setTimeout(this.restoreBodyStyle, 200);
1665
+ }
1666
+
1667
+ this.opened = false;
1668
+
1669
+ this.doAfterClose();
1670
+ },
1671
+ doAfterClose: function doAfterClose() {
1672
+ _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
1673
+ this._closing = false;
1674
+ },
1675
+ restoreBodyStyle: function restoreBodyStyle() {
1676
+ if (this.modal && this.withoutHiddenClass) {
1677
+ document.body.style.paddingRight = this.bodyPaddingRight;
1678
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(document.body, 'mds-popup-parent--hidden');
1679
+ }
1680
+ this.withoutHiddenClass = true;
1681
+ }
1682
+ }
1683
+ });
1684
+
1685
+
1686
+
1687
+ /***/ }),
1688
+
1689
+ /***/ 17:
1690
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1691
+
1692
+ "use strict";
1693
+
1694
+ // EXTERNAL MODULE: ./components/_util/_popper/popup/popup-main.js
1695
+ var popup_main = __webpack_require__(14);
1696
+
1697
+ // EXTERNAL MODULE: external "babel-runtime/core-js/object/get-own-property-descriptor"
1698
+ var get_own_property_descriptor_ = __webpack_require__(18);
1699
+ var get_own_property_descriptor_default = /*#__PURE__*/__webpack_require__.n(get_own_property_descriptor_);
1700
+
1701
+ // EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
1702
+ var keys_ = __webpack_require__(10);
1703
+ var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
1704
+
1705
+ // EXTERNAL MODULE: external "babel-runtime/core-js/object/assign"
1706
+ var assign_ = __webpack_require__(6);
1707
+ var assign_default = /*#__PURE__*/__webpack_require__.n(assign_);
1708
+
1709
+ // CONCATENATED MODULE: ./components/_util/_popper/popper.js
1710
+
1711
+
1712
+
1713
+ /**
1714
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
1715
+ * @version {{version}}
1716
+ * @license
1717
+ * Copyright (c) 2016 Federico Zivolo and contributors
1718
+ *
1719
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1720
+ * of this software and associated documentation files (the "Software"), to deal
1721
+ * in the Software without restriction, including without limitation the rights
1722
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1723
+ * copies of the Software, and to permit persons to whom the Software is
1724
+ * furnished to do so, subject to the following conditions:
1725
+ *
1726
+ * The above copyright notice and this permission notice shall be included in all
1727
+ * copies or substantial portions of the Software.
1728
+ *
1729
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1730
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1731
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1732
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1733
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1734
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1735
+ * SOFTWARE.
1736
+ */
1737
+ /* eslint-disable */
1738
+ // Cross module loader
1739
+ // Supported: Node, AMD, Browser globals
1740
+ //
1741
+ function popper_createPopper() {
1742
+ 'use strict';
1743
+
1744
+ var root = window;
1745
+
1746
+ // default options
1747
+ var DEFAULTS = {
1748
+ // placement of the popper
1749
+ placement: 'bottom',
1750
+
1751
+ gpuAcceleration: false,
1752
+
1753
+ // shift popper from its origin by the given amount of pixels (can be negative)
1754
+ offset: 0,
1755
+
1756
+ // the element which will act as boundary of the popper
1757
+ boundariesElement: 'viewport',
1758
+
1759
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
1760
+ boundariesPadding: 5,
1761
+
1762
+ // popper will try to prevent overflow following this order,
1763
+ // by default, then, it could overflow on the left and on top of the boundariesElement
1764
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
1765
+
1766
+ // the behavior used by flip to change the placement of the popper
1767
+ flipBehavior: 'flip',
1768
+
1769
+ arrowElement: '[x-arrow]',
1770
+
1771
+ arrowOffset: 0,
1772
+
1773
+ // list of functions used to modify the offsets before they are applied to the popper
1774
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
1775
+
1776
+ modifiersIgnored: [],
1777
+
1778
+ forceAbsolute: false
1779
+
1780
+ /**
1781
+ * Create a new Popper.js instance
1782
+ * @constructor Popper
1783
+ * @param {HTMLElement} reference - The reference element used to position the popper
1784
+ * @param {HTMLElement|Object} popper
1785
+ * The HTML element used as popper, or a configuration used to generate the popper.
1786
+ * @param {String} [popper.tagName='div'] The tag name of the generated popper.
1787
+ * @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
1788
+ * @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
1789
+ * @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
1790
+ * @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`.
1791
+ * @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
1792
+ * @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
1793
+ * @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
1794
+ * @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
1795
+ * @param {Object} options
1796
+ * @param {String} [options.placement=bottom]
1797
+ * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
1798
+ * left(-start, -end)`
1799
+ *
1800
+ * @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
1801
+ * The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
1802
+ * its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
1803
+ * reference element.
1804
+ * By default, it will look for a child node of the popper with the `x-arrow` attribute.
1805
+ *
1806
+ * @param {Boolean} [options.gpuAcceleration=true]
1807
+ * When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
1808
+ * browser to use the GPU to accelerate the rendering.
1809
+ * If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
1810
+ *
1811
+ * @param {Number} [options.offset=0]
1812
+ * Amount of pixels the popper will be shifted (can be negative).
1813
+ *
1814
+ * @param {String|Element} [options.boundariesElement='viewport']
1815
+ * The element which will define the boundaries of the popper position, the popper will never be placed outside
1816
+ * of the defined boundaries (except if `keepTogether` is enabled)
1817
+ *
1818
+ * @param {Number} [options.boundariesPadding=5]
1819
+ * Additional padding for the boundaries
1820
+ *
1821
+ * @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
1822
+ * Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
1823
+ * this means that the last ones will never overflow
1824
+ *
1825
+ * @param {String|Array} [options.flipBehavior='flip']
1826
+ * The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
1827
+ * overlap its reference element. Defining `flip` as value, the placement will be flipped on
1828
+ * its axis (`right - left`, `top - bottom`).
1829
+ * You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
1830
+ * how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
1831
+ * then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
1832
+ *
1833
+ * @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
1834
+ * List of functions used to modify the data before they are applied to the popper, add your custom functions
1835
+ * to this array to edit the offsets and placement.
1836
+ * The function should reflect the @params and @returns of preventOverflow
1837
+ *
1838
+ * @param {Array} [options.modifiersIgnored=[]]
1839
+ * Put here any built-in modifier name you want to exclude from the modifiers list
1840
+ * The function should reflect the @params and @returns of preventOverflow
1841
+ *
1842
+ * @param {Boolean} [options.removeOnDestroy=false]
1843
+ * Set to true if you want to automatically remove the popper when you call the `destroy` method.
1844
+ */
1845
+ };function Popper(reference, popper, options) {
1846
+ this._reference = reference.jquery ? reference[0] : reference;
1847
+ this.state = {};
1848
+
1849
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
1850
+ // generate a default popper if is not defined
1851
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
1852
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
1853
+ if (isNotDefined || isConfig) {
1854
+ this._popper = this.parse(isConfig ? popper : {});
1855
+ }
1856
+ // otherwise, use the given HTMLElement as popper
1857
+ else {
1858
+ this._popper = popper.jquery ? popper[0] : popper;
1859
+ }
1860
+
1861
+ // with {} we create a new object with the options inside it
1862
+ this._options = assign_default()({}, DEFAULTS, options);
1863
+
1864
+ // refactoring modifiers' list
1865
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
1866
+ // remove ignored modifiers
1867
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
1868
+
1869
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
1870
+ // margins needs to be calculated to get the correct popper offsets
1871
+ if (modifier === 'applyStyle') {
1872
+ this._popper.setAttribute('x-placement', this._options.placement);
1873
+ }
1874
+
1875
+ // return predefined modifier identified by string or keep the custom one
1876
+ return this.modifiers[modifier] || modifier;
1877
+ }.bind(this));
1878
+
1879
+ // make sure to apply the popper position before any computation
1880
+ this.state.position = this._getPosition(this._popper, this._reference);
1881
+ setStyle(this._popper, { position: this.state.position, top: 0 });
1882
+
1883
+ // fire the first update to position the popper in the right place
1884
+ this.update();
1885
+
1886
+ // setup event listeners, they will take care of update the position in specific situations
1887
+ this._setupEventListeners();
1888
+ return this;
1889
+ }
1890
+
1891
+ //
1892
+ // Methods
1893
+ //
1894
+ /**
1895
+ * Destroy the popper
1896
+ * @method
1897
+ * @memberof Popper
1898
+ */
1899
+ Popper.prototype.destroy = function () {
1900
+ this._popper.removeAttribute('x-placement');
1901
+ this._popper.style.left = '';
1902
+ this._popper.style.position = '';
1903
+ this._popper.style.top = '';
1904
+ this._popper.style[getSupportedPropertyName('transform')] = '';
1905
+ this._removeEventListeners();
1906
+
1907
+ // remove the popper if user explicity asked for the deletion on destroy
1908
+ if (this._options.removeOnDestroy) {
1909
+ this._popper.remove();
1910
+ }
1911
+ return this;
1912
+ };
1913
+
1914
+ /**
1915
+ * Updates the position of the popper, computing the new offsets and applying the new style
1916
+ * @method
1917
+ * @memberof Popper
1918
+ */
1919
+ Popper.prototype.update = function () {
1920
+ var data = { instance: this, styles: {}
1921
+
1922
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
1923
+ // and refer to _originalPlacement to know the original value
1924
+ };data.placement = this._options.placement;
1925
+ data._originalPlacement = this._options.placement;
1926
+
1927
+ // compute the popper and reference offsets and put them inside data.offsets
1928
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
1929
+
1930
+ // get boundaries
1931
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
1932
+
1933
+ data = this.runModifiers(data, this._options.modifiers);
1934
+
1935
+ if (typeof this.state.updateCallback === 'function') {
1936
+ this.state.updateCallback(data);
1937
+ }
1938
+ };
1939
+
1940
+ /**
1941
+ * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
1942
+ * @method
1943
+ * @memberof Popper
1944
+ * @param {Function} callback
1945
+ */
1946
+ Popper.prototype.onCreate = function (callback) {
1947
+ // the createCallbacks return as first argument the popper instance
1948
+ callback(this);
1949
+ return this;
1950
+ };
1951
+
1952
+ /**
1953
+ * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
1954
+ * used to style popper and its arrow.
1955
+ * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
1956
+ * @method
1957
+ * @memberof Popper
1958
+ * @param {Function} callback
1959
+ */
1960
+ Popper.prototype.onUpdate = function (callback) {
1961
+ this.state.updateCallback = callback;
1962
+ return this;
1963
+ };
1964
+
1965
+ /**
1966
+ * Helper used to generate poppers from a configuration file
1967
+ * @method
1968
+ * @memberof Popper
1969
+ * @param config {Object} configuration
1970
+ * @returns {HTMLElement} popper
1971
+ */
1972
+ Popper.prototype.parse = function (config) {
1973
+ var defaultConfig = {
1974
+ tagName: 'div',
1975
+ classNames: ['popper'],
1976
+ attributes: [],
1977
+ parent: root.document.body,
1978
+ content: '',
1979
+ contentType: 'text',
1980
+ arrowTagName: 'div',
1981
+ arrowClassNames: ['popper__arrow'],
1982
+ arrowAttributes: ['x-arrow']
1983
+ };
1984
+ config = assign_default()({}, defaultConfig, config);
1985
+
1986
+ var d = root.document;
1987
+
1988
+ var popper = d.createElement(config.tagName);
1989
+ addClassNames(popper, config.classNames);
1990
+ addAttributes(popper, config.attributes);
1991
+ if (config.contentType === 'node') {
1992
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
1993
+ } else if (config.contentType === 'html') {
1994
+ popper.innerHTML = config.content;
1995
+ } else {
1996
+ popper.textContent = config.content;
1997
+ }
1998
+
1999
+ if (config.arrowTagName) {
2000
+ var arrow = d.createElement(config.arrowTagName);
2001
+ addClassNames(arrow, config.arrowClassNames);
2002
+ addAttributes(arrow, config.arrowAttributes);
2003
+ popper.appendChild(arrow);
2004
+ }
2005
+
2006
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
2007
+
2008
+ // if the given parent is a string, use it to match an element
2009
+ // if more than one element is matched, the first one will be used as parent
2010
+ // if no elements are matched, the script will throw an error
2011
+ if (typeof parent === 'string') {
2012
+ parent = d.querySelectorAll(config.parent);
2013
+ if (parent.length > 1) {
2014
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
2015
+ }
2016
+ if (parent.length === 0) {
2017
+ throw "ERROR: the given `parent` doesn't exists!";
2018
+ }
2019
+ parent = parent[0];
2020
+ }
2021
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
2022
+ // the first one will be used as parent
2023
+ if (parent.length > 1 && parent instanceof Element === false) {
2024
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
2025
+ parent = parent[0];
2026
+ }
2027
+
2028
+ // append the generated popper to its parent
2029
+ parent.appendChild(popper);
2030
+
2031
+ return popper;
2032
+
2033
+ /**
2034
+ * Adds class names to the given element
2035
+ * @function
2036
+ * @ignore
2037
+ * @param {HTMLElement} target
2038
+ * @param {Array} classes
2039
+ */
2040
+ function addClassNames(element, classNames) {
2041
+ classNames.forEach(function (className) {
2042
+ element.classList.add(className);
2043
+ });
2044
+ }
2045
+
2046
+ /**
2047
+ * Adds attributes to the given element
2048
+ * @function
2049
+ * @ignore
2050
+ * @param {HTMLElement} target
2051
+ * @param {Array} attributes
2052
+ * @example
2053
+ * addAttributes(element, [ 'data-info:foobar' ]);
2054
+ */
2055
+ function addAttributes(element, attributes) {
2056
+ attributes.forEach(function (attribute) {
2057
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
2058
+ });
2059
+ }
2060
+ };
2061
+
2062
+ /**
2063
+ * Helper used to get the position which will be applied to the popper
2064
+ * @method
2065
+ * @memberof Popper
2066
+ * @param config {HTMLElement} popper element
2067
+ * @param reference {HTMLElement} reference element
2068
+ * @returns {String} position
2069
+ */
2070
+ Popper.prototype._getPosition = function (popper, reference) {
2071
+ var container = getOffsetParent(reference);
2072
+
2073
+ if (this._options.forceAbsolute) {
2074
+ return 'absolute';
2075
+ }
2076
+
2077
+ // Decide if the popper will be fixed
2078
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
2079
+ var isParentFixed = isFixed(reference, container);
2080
+ return isParentFixed ? 'fixed' : 'absolute';
2081
+ };
2082
+
2083
+ /**
2084
+ * Get offsets to the popper
2085
+ * @method
2086
+ * @memberof Popper
2087
+ * @access private
2088
+ * @param {Element} popper - the popper element
2089
+ * @param {Element} reference - the reference element (the popper will be relative to this)
2090
+ * @returns {Object} An object containing the offsets which will be applied to the popper
2091
+ */
2092
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
2093
+ placement = placement.split('-')[0];
2094
+ var popperOffsets = {};
2095
+
2096
+ popperOffsets.position = this.state.position;
2097
+ var isParentFixed = popperOffsets.position === 'fixed';
2098
+
2099
+ //
2100
+ // Get reference element position
2101
+ //
2102
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
2103
+
2104
+ //
2105
+ // Get popper sizes
2106
+ //
2107
+ var popperRect = getOuterSizes(popper);
2108
+
2109
+ //
2110
+ // Compute offsets of popper
2111
+ //
2112
+
2113
+ // depending by the popper placement we have to compute its offsets slightly differently
2114
+ if (['right', 'left'].indexOf(placement) !== -1) {
2115
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
2116
+ if (placement === 'left') {
2117
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
2118
+ } else {
2119
+ popperOffsets.left = referenceOffsets.right;
2120
+ }
2121
+ } else {
2122
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
2123
+ if (placement === 'top') {
2124
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
2125
+ } else {
2126
+ popperOffsets.top = referenceOffsets.bottom;
2127
+ }
2128
+ }
2129
+
2130
+ // Add width and height to our offsets object
2131
+ popperOffsets.width = popperRect.width;
2132
+ popperOffsets.height = popperRect.height;
2133
+
2134
+ return {
2135
+ popper: popperOffsets,
2136
+ reference: referenceOffsets
2137
+ };
2138
+ };
2139
+
2140
+ /**
2141
+ * Setup needed event listeners used to update the popper position
2142
+ * @method
2143
+ * @memberof Popper
2144
+ * @access private
2145
+ */
2146
+ Popper.prototype._setupEventListeners = function () {
2147
+ // NOTE: 1 DOM access here
2148
+ this.state.updateBound = this.update.bind(this);
2149
+ root.addEventListener('resize', this.state.updateBound);
2150
+ // if the boundariesElement is window we don't need to listen for the scroll event
2151
+ if (this._options.boundariesElement !== 'window') {
2152
+ var target = getScrollParent(this._reference);
2153
+ // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
2154
+ if (target === root.document.body || target === root.document.documentElement) {
2155
+ target = root;
2156
+ }
2157
+ target.addEventListener('scroll', this.state.updateBound);
2158
+ this.state.scrollTarget = target;
2159
+ }
2160
+ };
2161
+
2162
+ /**
2163
+ * Remove event listeners used to update the popper position
2164
+ * @method
2165
+ * @memberof Popper
2166
+ * @access private
2167
+ */
2168
+ Popper.prototype._removeEventListeners = function () {
2169
+ // NOTE: 1 DOM access here
2170
+ root.removeEventListener('resize', this.state.updateBound);
2171
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
2172
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
2173
+ this.state.scrollTarget = null;
2174
+ }
2175
+ this.state.updateBound = null;
2176
+ };
2177
+
2178
+ /**
2179
+ * Computed the boundaries limits and return them
2180
+ * @method
2181
+ * @memberof Popper
2182
+ * @access private
2183
+ * @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
2184
+ * @param {Number} padding - Boundaries padding
2185
+ * @param {Element} boundariesElement - Element used to define the boundaries
2186
+ * @returns {Object} Coordinates of the boundaries
2187
+ */
2188
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
2189
+ // NOTE: 1 DOM access here
2190
+ var boundaries = {};
2191
+ var width, height;
2192
+ if (boundariesElement === 'window') {
2193
+ var body = root.document.body,
2194
+ html = root.document.documentElement;
2195
+
2196
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
2197
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
2198
+
2199
+ boundaries = {
2200
+ top: 0,
2201
+ right: width,
2202
+ bottom: height,
2203
+ left: 0
2204
+ };
2205
+ } else if (boundariesElement === 'viewport') {
2206
+ var offsetParent = getOffsetParent(this._popper);
2207
+ var scrollParent = getScrollParent(this._popper);
2208
+ var offsetParentRect = getOffsetRect(offsetParent);
2209
+
2210
+ // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
2211
+ var getScrollTopValue = function getScrollTopValue(element) {
2212
+ return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
2213
+ };
2214
+ var getScrollLeftValue = function getScrollLeftValue(element) {
2215
+ return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
2216
+ };
2217
+
2218
+ // if the popper is fixed we don't have to substract scrolling from the boundaries
2219
+ var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
2220
+ var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
2221
+
2222
+ boundaries = {
2223
+ top: 0 - (offsetParentRect.top - scrollTop),
2224
+ right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
2225
+ bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
2226
+ left: 0 - (offsetParentRect.left - scrollLeft)
2227
+ };
2228
+ } else {
2229
+ if (getOffsetParent(this._popper) === boundariesElement) {
2230
+ boundaries = {
2231
+ top: 0,
2232
+ left: 0,
2233
+ right: boundariesElement.clientWidth,
2234
+ bottom: boundariesElement.clientHeight
2235
+ };
2236
+ } else {
2237
+ boundaries = getOffsetRect(boundariesElement);
2238
+ }
2239
+ }
2240
+ boundaries.left += padding;
2241
+ boundaries.right -= padding;
2242
+ boundaries.top = boundaries.top + padding;
2243
+ boundaries.bottom = boundaries.bottom - padding;
2244
+ return boundaries;
2245
+ };
2246
+
2247
+ /**
2248
+ * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
2249
+ * @method
2250
+ * @memberof Popper
2251
+ * @access public
2252
+ * @param {Object} data
2253
+ * @param {Array} modifiers
2254
+ * @param {Function} ends
2255
+ */
2256
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
2257
+ var modifiersToRun = modifiers.slice();
2258
+ if (ends !== undefined) {
2259
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
2260
+ }
2261
+
2262
+ modifiersToRun.forEach(function (modifier) {
2263
+ if (isFunction(modifier)) {
2264
+ data = modifier.call(this, data);
2265
+ }
2266
+ }.bind(this));
2267
+
2268
+ return data;
2269
+ };
2270
+
2271
+ /**
2272
+ * Helper used to know if the given modifier depends from another one.
2273
+ * @method
2274
+ * @memberof Popper
2275
+ * @param {String} requesting - name of requesting modifier
2276
+ * @param {String} requested - name of requested modifier
2277
+ * @returns {Boolean}
2278
+ */
2279
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
2280
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
2281
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
2282
+ return modifier === requested;
2283
+ }).length;
2284
+ };
2285
+
2286
+ //
2287
+ // Modifiers
2288
+ //
2289
+
2290
+ /**
2291
+ * Modifiers list
2292
+ * @namespace Popper.modifiers
2293
+ * @memberof Popper
2294
+ * @type {Object}
2295
+ */
2296
+ Popper.prototype.modifiers = {};
2297
+
2298
+ /**
2299
+ * Apply the computed styles to the popper element
2300
+ * @method
2301
+ * @memberof Popper.modifiers
2302
+ * @argument {Object} data - The data object generated by `update` method
2303
+ * @returns {Object} The same data object
2304
+ */
2305
+ Popper.prototype.modifiers.applyStyle = function (data) {
2306
+ // apply the final offsets to the popper
2307
+ // NOTE: 1 DOM access here
2308
+ var styles = {
2309
+ position: data.offsets.popper.position
2310
+
2311
+ // round top and left to avoid blurry text
2312
+ };var left = Math.round(data.offsets.popper.left);
2313
+ var top = Math.round(data.offsets.popper.top);
2314
+
2315
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
2316
+ // we automatically use the supported prefixed version if needed
2317
+ var prefixedProperty;
2318
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
2319
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
2320
+ styles.top = 0;
2321
+ styles.left = 0;
2322
+ }
2323
+ // othwerise, we use the standard `left` and `top` properties
2324
+ else {
2325
+ styles.left = left;
2326
+ styles.top = top;
2327
+ }
2328
+
2329
+ // any property present in `data.styles` will be applied to the popper,
2330
+ // in this way we can make the 3rd party modifiers add custom styles to it
2331
+ // Be aware, modifiers could override the properties defined in the previous
2332
+ // lines of this modifier!
2333
+ assign_default()(styles, data.styles);
2334
+
2335
+ setStyle(this._popper, styles);
2336
+
2337
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
2338
+ // NOTE: 1 DOM access here
2339
+ if (!this._popper._prevClass.includes('mds-date-picker')) {
2340
+ this._popper.setAttribute('x-placement', data.placement);
2341
+ var popper = this._popper;
2342
+ var instanceType = popper.classList[0];
2343
+ popper.classList.replace(popper.classList[1], instanceType + '-placement-' + data.placement);
2344
+ }
2345
+
2346
+ // console.log(data.placement)
2347
+
2348
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
2349
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
2350
+ setStyle(data.arrowElement, data.offsets.arrow);
2351
+ }
2352
+
2353
+ return data;
2354
+ };
2355
+
2356
+ /**
2357
+ * Modifier used to shift the popper on the start or end of its reference element side
2358
+ * @method
2359
+ * @memberof Popper.modifiers
2360
+ * @argument {Object} data - The data object generated by `update` method
2361
+ * @returns {Object} The data object, properly modified
2362
+ */
2363
+ Popper.prototype.modifiers.shift = function (data) {
2364
+ var placement = data.placement;
2365
+ var basePlacement = placement.split('-')[0];
2366
+ var shiftVariation = placement.split('-')[1];
2367
+
2368
+ // if shift shiftVariation is specified, run the modifier
2369
+ if (shiftVariation) {
2370
+ var reference = data.offsets.reference;
2371
+ var popper = getPopperClientRect(data.offsets.popper);
2372
+
2373
+ var shiftOffsets = {
2374
+ y: {
2375
+ start: { top: reference.top },
2376
+ end: { top: reference.top + reference.height - popper.height }
2377
+ },
2378
+ x: {
2379
+ start: { left: reference.left },
2380
+ end: { left: reference.left + reference.width - popper.width }
2381
+ }
2382
+ };
2383
+
2384
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
2385
+
2386
+ data.offsets.popper = assign_default()(popper, shiftOffsets[axis][shiftVariation]);
2387
+ }
2388
+ return data;
2389
+ };
2390
+
2391
+ /**
2392
+ * Modifier used to make sure the popper does not overflows from it's boundaries
2393
+ * @method
2394
+ * @memberof Popper.modifiers
2395
+ * @argument {Object} data - The data object generated by `update` method
2396
+ * @returns {Object} The data object, properly modified
2397
+ */
2398
+ Popper.prototype.modifiers.preventOverflow = function (data) {
2399
+ var order = this._options.preventOverflowOrder;
2400
+ var popper = getPopperClientRect(data.offsets.popper);
2401
+
2402
+ var check = {
2403
+ left: function left() {
2404
+ var left = popper.left;
2405
+ if (popper.left < data.boundaries.left) {
2406
+ left = Math.max(popper.left, data.boundaries.left);
2407
+ }
2408
+ return { left: left };
2409
+ },
2410
+ right: function right() {
2411
+ var left = popper.left;
2412
+ if (popper.right > data.boundaries.right) {
2413
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
2414
+ }
2415
+ return { left: left };
2416
+ },
2417
+ top: function top() {
2418
+ var top = popper.top;
2419
+ if (popper.top < data.boundaries.top) {
2420
+ top = Math.max(popper.top, data.boundaries.top);
2421
+ }
2422
+ return { top: top };
2423
+ },
2424
+ bottom: function bottom() {
2425
+ var top = popper.top;
2426
+ if (popper.bottom > data.boundaries.bottom) {
2427
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
2428
+ }
2429
+ return { top: top };
2430
+ }
2431
+ };
2432
+
2433
+ order.forEach(function (direction) {
2434
+ data.offsets.popper = assign_default()(popper, check[direction]());
2435
+ });
2436
+
2437
+ return data;
2438
+ };
2439
+
2440
+ /**
2441
+ * Modifier used to make sure the popper is always near its reference
2442
+ * @method
2443
+ * @memberof Popper.modifiers
2444
+ * @argument {Object} data - The data object generated by _update method
2445
+ * @returns {Object} The data object, properly modified
2446
+ */
2447
+ Popper.prototype.modifiers.keepTogether = function (data) {
2448
+ var popper = getPopperClientRect(data.offsets.popper);
2449
+ var reference = data.offsets.reference;
2450
+ var f = Math.floor;
2451
+
2452
+ if (popper.right < f(reference.left)) {
2453
+ data.offsets.popper.left = f(reference.left) - popper.width;
2454
+ }
2455
+ if (popper.left > f(reference.right)) {
2456
+ data.offsets.popper.left = f(reference.right);
2457
+ }
2458
+ if (popper.bottom < f(reference.top)) {
2459
+ data.offsets.popper.top = f(reference.top) - popper.height;
2460
+ }
2461
+ if (popper.top > f(reference.bottom)) {
2462
+ data.offsets.popper.top = f(reference.bottom);
2463
+ }
2464
+
2465
+ return data;
2466
+ };
2467
+
2468
+ /**
2469
+ * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
2470
+ * Requires the `preventOverflow` modifier before it in order to work.
2471
+ * **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
2472
+ * @method
2473
+ * @memberof Popper.modifiers
2474
+ * @argument {Object} data - The data object generated by _update method
2475
+ * @returns {Object} The data object, properly modified
2476
+ */
2477
+ Popper.prototype.modifiers.flip = function (data) {
2478
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
2479
+ // otherwise flip would not work as expected.
2480
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
2481
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
2482
+ return data;
2483
+ }
2484
+
2485
+ if (data.flipped && data.placement === data._originalPlacement) {
2486
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
2487
+ return data;
2488
+ }
2489
+
2490
+ var placement = data.placement.split('-')[0];
2491
+ var placementOpposite = getOppositePlacement(placement);
2492
+ var variation = data.placement.split('-')[1] || '';
2493
+ var flipOrder = [];
2494
+ if (this._options.flipBehavior === 'flip') {
2495
+ flipOrder = [placement, placementOpposite];
2496
+ } else {
2497
+ flipOrder = this._options.flipBehavior;
2498
+ }
2499
+
2500
+ flipOrder.forEach(function (step, index) {
2501
+ if (placement !== step || flipOrder.length === index + 1) {
2502
+ return;
2503
+ }
2504
+
2505
+ placement = data.placement.split('-')[0];
2506
+ placementOpposite = getOppositePlacement(placement);
2507
+
2508
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
2509
+
2510
+ // this boolean is used to distinguish right and bottom from top and left
2511
+ // they need different computations to get flipped
2512
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
2513
+
2514
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
2515
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
2516
+ // we'll use this boolean to detect any flip loop
2517
+ data.flipped = true;
2518
+ data.placement = flipOrder[index + 1];
2519
+ if (variation) {
2520
+ data.placement += '-' + variation;
2521
+ }
2522
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
2523
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
2524
+ }
2525
+ }.bind(this));
2526
+ return data;
2527
+ };
2528
+
2529
+ /**
2530
+ * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
2531
+ * The offsets will shift the popper on the side of its reference element.
2532
+ * @method
2533
+ * @memberof Popper.modifiers
2534
+ * @argument {Object} data - The data object generated by _update method
2535
+ * @returns {Object} The data object, properly modified
2536
+ */
2537
+ Popper.prototype.modifiers.offset = function (data) {
2538
+ var offset = this._options.offset;
2539
+ var popper = data.offsets.popper;
2540
+
2541
+ if (data.placement.indexOf('left') !== -1) {
2542
+ popper.top -= offset;
2543
+ } else if (data.placement.indexOf('right') !== -1) {
2544
+ popper.top += offset;
2545
+ } else if (data.placement.indexOf('top') !== -1) {
2546
+ popper.left -= offset;
2547
+ } else if (data.placement.indexOf('bottom') !== -1) {
2548
+ popper.left += offset;
2549
+ }
2550
+ return data;
2551
+ };
2552
+
2553
+ /**
2554
+ * 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
2555
+ * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
2556
+ * @method
2557
+ * @memberof Popper.modifiers
2558
+ * @argument {Object} data - The data object generated by _update method
2559
+ * @returns {Object} The data object, properly modified
2560
+ */
2561
+ Popper.prototype.modifiers.arrow = function (data) {
2562
+ var arrow = this._options.arrowElement;
2563
+ var arrowOffset = this._options.arrowOffset;
2564
+
2565
+ // if the arrowElement is a string, suppose it's a CSS selector
2566
+ if (typeof arrow === 'string') {
2567
+ arrow = this._popper.querySelector(arrow);
2568
+ }
2569
+
2570
+ // if arrow element is not found, don't run the modifier
2571
+ if (!arrow) {
2572
+ return data;
2573
+ }
2574
+
2575
+ // the arrow element must be child of its popper
2576
+ if (!this._popper.contains(arrow)) {
2577
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
2578
+ return data;
2579
+ }
2580
+
2581
+ // arrow depends on keepTogether in order to work
2582
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
2583
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
2584
+ return data;
2585
+ }
2586
+
2587
+ var arrowStyle = {};
2588
+ var placement = data.placement.split('-')[0];
2589
+ var popper = getPopperClientRect(data.offsets.popper);
2590
+ var reference = data.offsets.reference;
2591
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
2592
+
2593
+ var len = isVertical ? 'height' : 'width';
2594
+ var side = isVertical ? 'top' : 'left';
2595
+ var translate = isVertical ? 'translateY' : 'translateX';
2596
+ var altSide = isVertical ? 'left' : 'top';
2597
+ var opSide = isVertical ? 'bottom' : 'right';
2598
+ var arrowSize = getOuterSizes(arrow)[len];
2599
+
2600
+ //
2601
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
2602
+ //
2603
+
2604
+ // top/left side
2605
+ if (reference[opSide] - arrowSize < popper[side]) {
2606
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
2607
+ }
2608
+ // bottom/right side
2609
+ if (reference[side] + arrowSize > popper[opSide]) {
2610
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
2611
+ }
2612
+
2613
+ // compute center of the popper
2614
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
2615
+
2616
+ var sideValue = center - popper[side];
2617
+
2618
+ // prevent arrow from being placed not contiguously to its popper
2619
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
2620
+ arrowStyle[side] = sideValue;
2621
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
2622
+
2623
+ data.offsets.arrow = arrowStyle;
2624
+ data.arrowElement = arrow;
2625
+
2626
+ return data;
2627
+ };
2628
+
2629
+ //
2630
+ // Helpers
2631
+ //
2632
+
2633
+ /**
2634
+ * Get the outer sizes of the given element (offset size + margins)
2635
+ * @function
2636
+ * @ignore
2637
+ * @argument {Element} element
2638
+ * @returns {Object} object containing width and height properties
2639
+ */
2640
+ function getOuterSizes(element) {
2641
+ // NOTE: 1 DOM access here
2642
+ var _display = element.style.display,
2643
+ _visibility = element.style.visibility;
2644
+ element.style.display = 'block';
2645
+ element.style.visibility = 'hidden';
2646
+ var calcWidthToForceRepaint = element.offsetWidth;
2647
+
2648
+ // original method
2649
+ var styles = root.getComputedStyle(element);
2650
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
2651
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
2652
+ var result = {
2653
+ width: element.offsetWidth + y,
2654
+ height: element.offsetHeight + x
2655
+
2656
+ // reset element styles
2657
+ };element.style.display = _display;
2658
+ element.style.visibility = _visibility;
2659
+ return result;
2660
+ }
2661
+
2662
+ /**
2663
+ * Get the opposite placement of the given one/
2664
+ * @function
2665
+ * @ignore
2666
+ * @argument {String} placement
2667
+ * @returns {String} flipped placement
2668
+ */
2669
+ function getOppositePlacement(placement) {
2670
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
2671
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
2672
+ return hash[matched];
2673
+ });
2674
+ }
2675
+
2676
+ /**
2677
+ * Given the popper offsets, generate an output similar to getBoundingClientRect
2678
+ * @function
2679
+ * @ignore
2680
+ * @argument {Object} popperOffsets
2681
+ * @returns {Object} ClientRect like output
2682
+ */
2683
+ function getPopperClientRect(popperOffsets) {
2684
+ var offsets = assign_default()({}, popperOffsets);
2685
+ offsets.right = offsets.left + offsets.width;
2686
+ offsets.bottom = offsets.top + offsets.height;
2687
+ return offsets;
2688
+ }
2689
+
2690
+ /**
2691
+ * Given an array and the key to find, returns its index
2692
+ * @function
2693
+ * @ignore
2694
+ * @argument {Array} arr
2695
+ * @argument keyToFind
2696
+ * @returns index or null
2697
+ */
2698
+ function getArrayKeyIndex(arr, keyToFind) {
2699
+ var i = 0,
2700
+ key;
2701
+ for (key in arr) {
2702
+ if (arr[key] === keyToFind) {
2703
+ return i;
2704
+ }
2705
+ i++;
2706
+ }
2707
+ return null;
2708
+ }
2709
+
2710
+ /**
2711
+ * Get CSS computed property of the given element
2712
+ * @function
2713
+ * @ignore
2714
+ * @argument {Eement} element
2715
+ * @argument {String} property
2716
+ */
2717
+ function getStyleComputedProperty(element, property) {
2718
+ // NOTE: 1 DOM access here
2719
+ var css = root.getComputedStyle(element, null);
2720
+ return css[property];
2721
+ }
2722
+
2723
+ /**
2724
+ * Returns the offset parent of the given element
2725
+ * @function
2726
+ * @ignore
2727
+ * @argument {Element} element
2728
+ * @returns {Element} offset parent
2729
+ */
2730
+ function getOffsetParent(element) {
2731
+ // NOTE: 1 DOM access here
2732
+ var offsetParent = element.offsetParent;
2733
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
2734
+ }
2735
+
2736
+ /**
2737
+ * Returns the scrolling parent of the given element
2738
+ * @function
2739
+ * @ignore
2740
+ * @argument {Element} element
2741
+ * @returns {Element} offset parent
2742
+ */
2743
+ function getScrollParent(element) {
2744
+ var parent = element.parentNode;
2745
+
2746
+ if (!parent) {
2747
+ return element;
2748
+ }
2749
+
2750
+ if (parent === root.document) {
2751
+ // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
2752
+ // greater than 0 and return the proper element
2753
+ if (root.document.body.scrollTop || root.document.body.scrollLeft) {
2754
+ return root.document.body;
2755
+ } else {
2756
+ return root.document.documentElement;
2757
+ }
2758
+ }
2759
+
2760
+ // Firefox want us to check `-x` and `-y` variations as well
2761
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
2762
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
2763
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
2764
+ // fixes issue #65
2765
+ return parent;
2766
+ }
2767
+ return getScrollParent(element.parentNode);
2768
+ }
2769
+
2770
+ /**
2771
+ * Check if the given element is fixed or is inside a fixed parent
2772
+ * @function
2773
+ * @ignore
2774
+ * @argument {Element} element
2775
+ * @argument {Element} customContainer
2776
+ * @returns {Boolean} answer to "isFixed?"
2777
+ */
2778
+ function isFixed(element) {
2779
+ if (element === root.document.body) {
2780
+ return false;
2781
+ }
2782
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
2783
+ return true;
2784
+ }
2785
+ return element.parentNode ? isFixed(element.parentNode) : element;
2786
+ }
2787
+
2788
+ /**
2789
+ * Set the style to the given popper
2790
+ * @function
2791
+ * @ignore
2792
+ * @argument {Element} element - Element to apply the style to
2793
+ * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
2794
+ */
2795
+ function setStyle(element, styles) {
2796
+ function is_numeric(n) {
2797
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
2798
+ }
2799
+ keys_default()(styles).forEach(function (prop) {
2800
+ var unit = '';
2801
+ // add unit if the value is numeric and is one of the following
2802
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
2803
+ unit = 'px';
2804
+ }
2805
+ element.style[prop] = styles[prop] + unit;
2806
+ });
2807
+ }
2808
+
2809
+ /**
2810
+ * Check if the given variable is a function
2811
+ * @function
2812
+ * @ignore
2813
+ * @argument {*} functionToCheck - variable to check
2814
+ * @returns {Boolean} answer to: is a function?
2815
+ */
2816
+ function isFunction(functionToCheck) {
2817
+ var getType = {};
2818
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
2819
+ }
2820
+
2821
+ /**
2822
+ * Get the position of the given element, relative to its offset parent
2823
+ * @function
2824
+ * @ignore
2825
+ * @param {Element} element
2826
+ * @return {Object} position - Coordinates of the element and its `scrollTop`
2827
+ */
2828
+ function getOffsetRect(element) {
2829
+ var elementRect = {
2830
+ width: element.offsetWidth,
2831
+ height: element.offsetHeight,
2832
+ left: element.offsetLeft,
2833
+ top: element.offsetTop
2834
+ };
2835
+
2836
+ elementRect.right = elementRect.left + elementRect.width;
2837
+ elementRect.bottom = elementRect.top + elementRect.height;
2838
+
2839
+ // position
2840
+ return elementRect;
2841
+ }
2842
+
2843
+ /**
2844
+ * Get bounding client rect of given element
2845
+ * @function
2846
+ * @ignore
2847
+ * @param {HTMLElement} element
2848
+ * @return {Object} client rect
2849
+ */
2850
+ function getBoundingClientRect(element) {
2851
+ var rect = element.getBoundingClientRect();
2852
+
2853
+ // whether the IE version is lower than 11
2854
+ var isIE = navigator.userAgent.indexOf('MSIE') != -1;
2855
+
2856
+ // fix ie document bounding top always 0 bug
2857
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
2858
+
2859
+ return {
2860
+ left: rect.left,
2861
+ top: rectTop,
2862
+ right: rect.right,
2863
+ bottom: rect.bottom,
2864
+ width: rect.right - rect.left,
2865
+ height: rect.bottom - rectTop
2866
+ };
2867
+ }
2868
+
2869
+ /**
2870
+ * Given an element and one of its parents, return the offset
2871
+ * @function
2872
+ * @ignore
2873
+ * @param {HTMLElement} element
2874
+ * @param {HTMLElement} parent
2875
+ * @return {Object} rect
2876
+ */
2877
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
2878
+ var elementRect = getBoundingClientRect(element);
2879
+ var parentRect = getBoundingClientRect(parent);
2880
+
2881
+ if (fixed) {
2882
+ var scrollParent = getScrollParent(parent);
2883
+ parentRect.top += scrollParent.scrollTop;
2884
+ parentRect.bottom += scrollParent.scrollTop;
2885
+ parentRect.left += scrollParent.scrollLeft;
2886
+ parentRect.right += scrollParent.scrollLeft;
2887
+ }
2888
+
2889
+ var rect = {
2890
+ top: elementRect.top - parentRect.top,
2891
+ left: elementRect.left - parentRect.left,
2892
+ bottom: elementRect.top - parentRect.top + elementRect.height,
2893
+ right: elementRect.left - parentRect.left + elementRect.width,
2894
+ width: elementRect.width,
2895
+ height: elementRect.height
2896
+ };
2897
+ return rect;
2898
+ }
2899
+
2900
+ /**
2901
+ * Get the prefixed supported property name
2902
+ * @function
2903
+ * @ignore
2904
+ * @argument {String} property (camelCase)
2905
+ * @returns {String} prefixed property (camelCase)
2906
+ */
2907
+ function getSupportedPropertyName(property) {
2908
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
2909
+
2910
+ for (var i = 0; i < prefixes.length; i++) {
2911
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
2912
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
2913
+ return toCheck;
2914
+ }
2915
+ }
2916
+ return null;
2917
+ }
2918
+
2919
+ /**
2920
+ * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
2921
+ * objects to a target object. It will return the target object.
2922
+ * This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
2923
+ * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
2924
+ * @function
2925
+ * @ignore
2926
+ */
2927
+ if (!assign_default.a) {
2928
+ Object.defineProperty(Object, 'assign', {
2929
+ enumerable: false,
2930
+ configurable: true,
2931
+ writable: true,
2932
+ value: function value(target) {
2933
+ if (target === undefined || target === null) {
2934
+ throw new TypeError('Cannot convert first argument to object');
2935
+ }
2936
+
2937
+ var to = Object(target);
2938
+ for (var i = 1; i < arguments.length; i++) {
2939
+ var nextSource = arguments[i];
2940
+ if (nextSource === undefined || nextSource === null) {
2941
+ continue;
2942
+ }
2943
+ nextSource = Object(nextSource);
2944
+
2945
+ var keysArray = keys_default()(nextSource);
2946
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
2947
+ var nextKey = keysArray[nextIndex];
2948
+ var desc = get_own_property_descriptor_default()(nextSource, nextKey);
2949
+ if (desc !== undefined && desc.enumerable) {
2950
+ to[nextKey] = nextSource[nextKey];
2951
+ }
2952
+ }
2953
+ }
2954
+ return to;
2955
+ }
2956
+ });
2957
+ }
2958
+
2959
+ return Popper;
2960
+ }
2961
+ /* harmony default export */ var _popper_popper = (popper_createPopper());
2962
+ // CONCATENATED MODULE: ./components/_util/_popper/vue-popper.js
2963
+
2964
+
2965
+
2966
+ var stop = function stop(e) {
2967
+ return e.stopPropagation();
2968
+ };
2969
+ /**
2970
+ * @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
2971
+ * @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
2972
+ * @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
2973
+ * @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
2974
+ * @param {Boolean} [visible=false] Visibility of the popup element.
2975
+ * @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
2976
+ */
2977
+ /* harmony default export */ var vue_popper = __webpack_exports__["a"] = ({
2978
+ props: {
2979
+ transformOrigin: {
2980
+ type: [Boolean, String],
2981
+ default: true
2982
+ },
2983
+ placement: {
2984
+ type: String,
2985
+ default: 'bottom'
2986
+ },
2987
+ boundariesPadding: {
2988
+ type: Number,
2989
+ default: 5
2990
+ },
2991
+ reference: {},
2992
+ popper: {},
2993
+ offset: {
2994
+ default: 0
2995
+ },
2996
+ value: Boolean,
2997
+ visibleArrow: Boolean,
2998
+ arrowOffset: {
2999
+ type: Number,
3000
+ default: 35
3001
+ },
3002
+ appendToBody: {
3003
+ type: Boolean,
3004
+ default: true
3005
+ },
3006
+ popperOptions: {
3007
+ type: Object,
3008
+ default: function _default() {
3009
+ return {
3010
+ gpuAcceleration: false
3011
+ };
3012
+ }
3013
+ }
3014
+ },
3015
+
3016
+ data: function data() {
3017
+ return {
3018
+ showPopper: false,
3019
+ currentPlacement: ''
3020
+ };
3021
+ },
3022
+
3023
+
3024
+ watch: {
3025
+ value: {
3026
+ immediate: true,
3027
+ handler: function handler(val) {
3028
+ this.showPopper = val;
3029
+ this.$emit('input', val);
3030
+ }
3031
+ },
3032
+
3033
+ showPopper: function showPopper(val) {
3034
+ if (this.disabled) return;
3035
+ val ? this.updatePopper() : this.destroyPopper();
3036
+ this.$emit('input', val);
3037
+ }
3038
+ },
3039
+
3040
+ methods: {
3041
+ createPopper: function createPopper() {
3042
+ var _this = this;
3043
+
3044
+ var options = this.popperOptions;
3045
+ var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
3046
+ var realPlacement = void 0;
3047
+ if (popper.__vue__ && popper.__vue__.$parent && popper.__vue__.$parent.$options.name === 'MdsCascader') {
3048
+ realPlacement = 'bottom-start';
3049
+ } else {
3050
+ realPlacement = this.realPlacement || this.placement;
3051
+ }
3052
+ this.currentPlacement = this.currentPlacement || realPlacement;
3053
+ if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
3054
+ return;
3055
+ }
3056
+
3057
+ var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
3058
+
3059
+ if (!reference && this.$slots.reference && this.$slots.reference[0]) {
3060
+ reference = this.referenceElm = this.$slots.reference[0].elm;
3061
+ }
3062
+
3063
+ if (!popper || !reference) return;
3064
+ if (this.visibleArrow) this.appendArrow(popper);
3065
+ if (this.appendToBody) document.body.appendChild(this.popperElm);
3066
+ if (this.popperJS && this.popperJS.destroy) {
3067
+ this.popperJS.destroy();
3068
+ }
3069
+
3070
+ options.placement = this.currentPlacement;
3071
+ options.offset = this.offset;
3072
+ options.arrowOffset = this.arrowOffset;
3073
+ this.popperJS = new _popper_popper(reference, popper, options);
3074
+ this.popperJS.onCreate(function (_) {
3075
+ _this.$emit('created', _this);
3076
+ _this.resetTransformOrigin();
3077
+ _this.$nextTick(_this.updatePopper);
3078
+ });
3079
+ if (typeof options.onUpdate === 'function') {
3080
+ this.popperJS.onUpdate(options.onUpdate);
3081
+ }
3082
+ this.popperJS._popper.style.zIndex = popup_main["a" /* PopupMain */].nextZIndex();
3083
+ this.popperElm.addEventListener('click', stop);
3084
+ },
3085
+ updatePopper: function updatePopper(zIndexFlag) {
3086
+ var popperJS = this.popperJS;
3087
+ if (popperJS) {
3088
+ popperJS.update();
3089
+ if (popperJS._popper) {
3090
+ if (!zIndexFlag) {
3091
+ popperJS._popper.style.zIndex = popup_main["a" /* PopupMain */].nextZIndex();
3092
+ }
3093
+ }
3094
+ } else {
3095
+ this.createPopper();
3096
+ }
3097
+ },
3098
+ doDestroy: function doDestroy(forceDestroy) {
3099
+ /* istanbul ignore if */
3100
+ if (!this.popperJS || this.showPopper && !forceDestroy) return;
3101
+ this.popperJS.destroy();
3102
+ this.popperJS = null;
3103
+ },
3104
+ destroyPopper: function destroyPopper() {
3105
+ if (this.popperJS) {
3106
+ this.resetTransformOrigin();
3107
+ }
3108
+ },
3109
+ resetTransformOrigin: function resetTransformOrigin() {
3110
+ if (!this.transformOrigin) return;
3111
+ var placementMap = {
3112
+ top: 'bottom',
3113
+ bottom: 'top',
3114
+ left: 'right',
3115
+ right: 'left'
3116
+ };
3117
+ var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
3118
+ var origin = placementMap[placement];
3119
+ this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
3120
+ },
3121
+ appendArrow: function appendArrow(element) {
3122
+ var hash = void 0;
3123
+ if (this.appended) {
3124
+ return;
3125
+ }
3126
+
3127
+ this.appended = true;
3128
+
3129
+ for (var item in element.attributes) {
3130
+ if (/^_v-/.test(element.attributes[item].name)) {
3131
+ hash = element.attributes[item].name;
3132
+ break;
3133
+ }
3134
+ }
3135
+
3136
+ var arrow = document.createElement('div');
3137
+
3138
+ if (hash) {
3139
+ arrow.setAttribute(hash, '');
3140
+ }
3141
+ arrow.setAttribute('x-arrow', '');
3142
+ arrow.className = 'popper__arrow';
3143
+ element.appendChild(arrow);
3144
+ }
3145
+ },
3146
+
3147
+ beforeDestroy: function beforeDestroy() {
3148
+ this.doDestroy(true);
3149
+ if (this.popperElm && this.popperElm.parentNode === document.body) {
3150
+ this.popperElm.removeEventListener('click', stop);
3151
+ document.body.removeChild(this.popperElm);
3152
+ }
3153
+ },
3154
+ deactivated: function deactivated() {
3155
+ this.$options.beforeDestroy[0].call(this);
3156
+ }
3157
+ });
3158
+
3159
+ /***/ }),
3160
+
3161
+ /***/ 18:
3162
+ /***/ (function(module, exports) {
3163
+
3164
+ module.exports = require("babel-runtime/core-js/object/get-own-property-descriptor");
3165
+
3166
+ /***/ }),
3167
+
3168
+ /***/ 189:
3169
+ /***/ (function(module, exports) {
3170
+
3171
+ // removed by extract-text-webpack-plugin
3172
+
3173
+ /***/ }),
3174
+
3175
+ /***/ 19:
3176
+ /***/ (function(module, exports) {
3177
+
3178
+ module.exports = require("throttle-debounce");
3179
+
3180
+ /***/ }),
3181
+
3182
+ /***/ 2:
3183
+ /***/ (function(module, exports) {
3184
+
3185
+ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
3186
+
3187
+ /***/ }),
3188
+
3189
+ /***/ 22:
3190
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3191
+
3192
+ "use strict";
3193
+ /* harmony import */ var mds_ui_transition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
3194
+ /* harmony import */ var mds_ui_transition__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(mds_ui_transition__WEBPACK_IMPORTED_MODULE_0__);
3195
+
3196
+
3197
+ var placementMap = {
3198
+ top: 'top',
3199
+ left: 'left',
3200
+ right: 'right',
3201
+ bottom: 'bottom',
3202
+ topLeft: 'top-start',
3203
+ topRight: 'top-end',
3204
+ bottomLeft: 'bottom-start',
3205
+ bottomRight: 'bottom-end',
3206
+ leftTop: 'left-start',
3207
+ leftBottom: 'left-end',
3208
+ rightTop: 'right-start',
3209
+ rightBottom: 'right-end'
3210
+ };
3211
+
3212
+ /* harmony default export */ __webpack_exports__["a"] = ({
3213
+ components: {
3214
+ mdsTransition: mds_ui_transition__WEBPACK_IMPORTED_MODULE_0___default.a
3215
+ },
3216
+ computed: {
3217
+ realPlacement: function realPlacement() {
3218
+ return placementMap[this.placement];
3219
+ }
3220
+ }
3221
+ });
3222
+
3223
+ /***/ }),
3224
+
3225
+ /***/ 224:
3226
+ /***/ (function(module, exports) {
3227
+
3228
+ // removed by extract-text-webpack-plugin
3229
+
3230
+ /***/ }),
3231
+
3232
+ /***/ 24:
3233
+ /***/ (function(module, exports) {
3234
+
3235
+ module.exports = require("babel-runtime/helpers/toConsumableArray");
3236
+
3237
+ /***/ }),
3238
+
3239
+ /***/ 26:
3240
+ /***/ (function(module, exports) {
3241
+
3242
+ module.exports = require("babel-runtime/helpers/extends");
3243
+
3244
+ /***/ }),
3245
+
3246
+ /***/ 3:
3247
+ /***/ (function(module, exports) {
3248
+
3249
+ module.exports = require("babel-runtime/helpers/defineProperty");
3250
+
3251
+ /***/ }),
3252
+
3253
+ /***/ 40:
3254
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3255
+
3256
+ "use strict";
3257
+
3258
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/empty/empty.vue?vue&type=template&id=4c25cea0&
3259
+ var render = function () {
3260
+ var _vm = this
3261
+ var _h = _vm.$createElement
3262
+ var _c = _vm._self._c || _h
3263
+ return _c("div", { class: _vm.classes }, [
3264
+ _c("div", { class: _vm.prefixCls + "-image", style: _vm.imageStyle }, [
3265
+ _vm.image
3266
+ ? _c("img", {
3267
+ class: _vm.prefixCls + "-img",
3268
+ attrs: { src: _vm.imageSrc },
3269
+ })
3270
+ : _vm._e(),
3271
+ ]),
3272
+ _c("div", { class: _vm.prefixCls + "-info" }, [
3273
+ _vm.desc
3274
+ ? _c("div", { class: _vm.prefixCls + "-desc" }, [
3275
+ _vm._v(_vm._s(_vm.desc)),
3276
+ ])
3277
+ : _vm._e(),
3278
+ _vm.$slots.custom
3279
+ ? _c("div", { class: _vm.prefixCls + "-custom" }, [_vm._t("custom")], 2)
3280
+ : _vm._e(),
3281
+ ]),
3282
+ ])
3283
+ }
3284
+ var staticRenderFns = []
3285
+ render._withStripped = true
3286
+
3287
+
3288
+ // CONCATENATED MODULE: ./components/empty/empty.vue?vue&type=template&id=4c25cea0&
3289
+
3290
+ // EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
3291
+ var defineProperty_ = __webpack_require__(3);
3292
+ var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
1246
3293
 
1247
3294
  // EXTERNAL MODULE: external "./_util/proptype"
1248
- var proptype_ = __webpack_require__(3);
3295
+ var proptype_ = __webpack_require__(7);
1249
3296
 
1250
3297
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/empty/empty.vue?vue&type=script&lang=js&
1251
3298
 
@@ -1352,20 +3399,20 @@ component.options.__file = "components/empty/empty.vue"
1352
3399
 
1353
3400
  /***/ }),
1354
3401
 
1355
- /***/ 35:
3402
+ /***/ 43:
1356
3403
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1357
3404
 
1358
3405
  "use strict";
1359
- /* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(131);
3406
+ /* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(139);
1360
3407
  /* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_index_less__WEBPACK_IMPORTED_MODULE_0__);
1361
- /* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(177);
3408
+ /* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(189);
1362
3409
  /* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);
1363
3410
 
1364
3411
 
1365
3412
 
1366
3413
  /***/ }),
1367
3414
 
1368
- /***/ 36:
3415
+ /***/ 44:
1369
3416
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1370
3417
 
1371
3418
  "use strict";
@@ -1373,30 +3420,283 @@ component.options.__file = "components/empty/empty.vue"
1373
3420
  __webpack_require__.r(__webpack_exports__);
1374
3421
 
1375
3422
  // EXTERNAL MODULE: ./components/tooltip/style/index.js
1376
- var style = __webpack_require__(35);
3423
+ var style = __webpack_require__(43);
3424
+
3425
+ // EXTERNAL MODULE: ./components/_util/_popper/vue-popper.js + 1 modules
3426
+ var vue_popper = __webpack_require__(17);
3427
+
3428
+ // EXTERNAL MODULE: ./components/_util/_popper/popper-mixin.js
3429
+ var popper_mixin = __webpack_require__(22);
3430
+
3431
+ // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
3432
+ var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(2);
3433
+ var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
1377
3434
 
1378
- // EXTERNAL MODULE: external "./_mixin/tooltip"
1379
- var tooltip_ = __webpack_require__(16);
1380
- var tooltip_default = /*#__PURE__*/__webpack_require__.n(tooltip_);
3435
+ // EXTERNAL MODULE: external "./transition"
3436
+ var external_transition_ = __webpack_require__(11);
3437
+ var external_transition_default = /*#__PURE__*/__webpack_require__.n(external_transition_);
3438
+
3439
+ // EXTERNAL MODULE: external "throttle-debounce"
3440
+ var external_throttle_debounce_ = __webpack_require__(19);
3441
+
3442
+ // EXTERNAL MODULE: ./components/_util/_popper/dom-helper.js
3443
+ var dom_helper = __webpack_require__(1);
1381
3444
 
1382
3445
  // CONCATENATED MODULE: ./components/tooltip/tooltip.js
1383
3446
 
1384
3447
 
3448
+
3449
+
3450
+
3451
+
3452
+
3453
+ var eventMap = {
3454
+ mouseenter: 'handleMouseenter',
3455
+ mouseleave: 'handleMouseleave',
3456
+ focus: 'handleFocus',
3457
+ blur: 'handleBlur',
3458
+ click: 'handleClick'
3459
+ };
3460
+
1385
3461
  /* harmony default export */ var tooltip = ({
1386
3462
  name: 'MdsTooltip',
1387
- mixins: [tooltip_default.a],
3463
+ mixins: [vue_popper["a" /* default */], popper_mixin["a" /* default */]],
1388
3464
  props: {
1389
- prefixCls: {
3465
+ mouseEnterDelay: {
3466
+ type: Number,
3467
+ default: 0
3468
+ },
3469
+ mouseLeaveDelay: {
3470
+ type: Number,
3471
+ default: 0.2
3472
+ },
3473
+ disabled: Boolean,
3474
+ arrowOffset: {
3475
+ type: Number,
3476
+ default: 0
3477
+ },
3478
+ offset: {
3479
+ type: Number,
3480
+ default: 0
3481
+ },
3482
+ placement: {
3483
+ type: String,
3484
+ default: 'top'
3485
+ },
3486
+ effect: {
1390
3487
  type: String,
1391
- default: 'mds-tooltip'
3488
+ default: 'dark'
3489
+ },
3490
+ className: {
3491
+ type: String
3492
+ },
3493
+ title: String,
3494
+ popperOptions: {
3495
+ default: function _default() {
3496
+ return {
3497
+ boundariesPadding: 5,
3498
+ gpuAcceleration: false
3499
+ };
3500
+ }
3501
+ },
3502
+ visibleArrow: {
3503
+ type: Boolean,
3504
+ default: true
3505
+ },
3506
+ tabindex: {
3507
+ type: Number,
3508
+ default: 0
3509
+ },
3510
+ manual: Boolean
3511
+ },
3512
+ data: function data() {
3513
+ return {
3514
+ timer: null, // mouseEnterDelay定时器flag
3515
+ focusing: false,
3516
+ expectedState: false
3517
+ };
3518
+ },
3519
+
3520
+ computed: {
3521
+ realEffect: function realEffect() {
3522
+ return this.effect === 'dark' || this.effect === 'light' ? this.effect : 'dark';
1392
3523
  }
1393
3524
  },
1394
- components: {
1395
- /**
1396
- * 定义函数化组件用于插入到popperVM
1397
- * 实际浮层显示的内容
1398
- */
1399
- MdsTooltipContent: tooltip_["MdsTooltipContent"]
3525
+
3526
+ watch: {
3527
+ focusing: function focusing(val) {
3528
+ if (val) {
3529
+ Object(dom_helper["a" /* addClass */])(this.referenceElm, 'focusing');
3530
+ } else {
3531
+ Object(dom_helper["h" /* removeClass */])(this.referenceElm, 'focusing');
3532
+ }
3533
+ },
3534
+ showPopper: function showPopper(val) {
3535
+ var _this = this;
3536
+
3537
+ if (val && !this.disabled) {
3538
+ var t = setTimeout(function () {
3539
+ clearTimeout(t);
3540
+ _this.updatePopper(true);
3541
+ }, 0);
3542
+ }
3543
+ }
3544
+ },
3545
+ beforeCreate: function beforeCreate() {
3546
+ this.popperInstance = new external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a({
3547
+ components: {
3548
+ mdsTransition: external_transition_default.a
3549
+ },
3550
+ data: {
3551
+ _h: null,
3552
+ node: ''
3553
+ },
3554
+ render: function render(h) {
3555
+ this._h = h;
3556
+ return this.node;
3557
+ }
3558
+ }).$mount();
3559
+ },
3560
+ mounted: function mounted() {
3561
+ var _this2 = this;
3562
+
3563
+ var readLeaveDelay = this.manual ? 200 : this.mouseLeaveDelay * 1000;
3564
+ this.debounceClose = Object(external_throttle_debounce_["debounce"])(readLeaveDelay, function () {
3565
+ return _this2.handleClosePopper();
3566
+ });
3567
+ this.referenceElm = this.$el;
3568
+
3569
+ if (this.referenceElm.nodeType === 1) {
3570
+ this.referenceElm.setAttribute('tabindex', this.tabindex);
3571
+ for (var item in eventMap) {
3572
+ Object(dom_helper["g" /* on */])(this.referenceElm, item, this[eventMap[item]]);
3573
+ }
3574
+ }
3575
+
3576
+ if (this.value && this.popperInstance) {
3577
+ this.popperInstance.$nextTick(function () {
3578
+ if (_this2.value) {
3579
+ _this2.updatePopper();
3580
+ }
3581
+ });
3582
+ }
3583
+ },
3584
+ beforeDestroy: function beforeDestroy() {
3585
+ this.popperInstance && this.popperInstance.$destroy();
3586
+ },
3587
+ destroyed: function destroyed() {
3588
+ if (this.$el.nodeType === 1) {
3589
+ for (var item in eventMap) {
3590
+ Object(dom_helper["f" /* off */])(this.referenceElm, item, this[eventMap[item]]);
3591
+ }
3592
+ }
3593
+ },
3594
+
3595
+ methods: {
3596
+ show: function show() {
3597
+ this.setExpectedState(true);
3598
+ this.handleShowPopper();
3599
+ },
3600
+ hide: function hide() {
3601
+ this.setExpectedState(false);
3602
+ this.debounceClose();
3603
+ },
3604
+ setExpectedState: function setExpectedState(val) {
3605
+ this.expectedState = val;
3606
+ },
3607
+ handleShowPopper: function handleShowPopper() {
3608
+ var _this3 = this;
3609
+
3610
+ if (!this.expectedState || this.manual) {
3611
+ return;
3612
+ }
3613
+ clearTimeout(this.timer);
3614
+ this.timer = setTimeout(function () {
3615
+ _this3.showPopper = true;
3616
+ }, this.mouseEnterDelay * 1000);
3617
+ },
3618
+ handleClosePopper: function handleClosePopper() {
3619
+ if (this.expectedState || this.manual) {
3620
+ return;
3621
+ }
3622
+ clearTimeout(this.timer);
3623
+ this.showPopper = false;
3624
+ if (this.disabled) {
3625
+ this.doDestroy();
3626
+ }
3627
+ },
3628
+ handleMouseenter: function handleMouseenter() {
3629
+ this.show();
3630
+ },
3631
+ handleMouseleave: function handleMouseleave() {
3632
+ this.hide();
3633
+ },
3634
+ handleFocus: function handleFocus() {
3635
+ this.focusing = true;
3636
+ this.show();
3637
+ },
3638
+ handleBlur: function handleBlur() {
3639
+ this.focusing = false;
3640
+ this.hide();
3641
+ },
3642
+ handleClick: function handleClick() {
3643
+ this.focusing = false;
3644
+ },
3645
+ calculateClass: function calculateClass() {
3646
+ var basicClass = 'mds-tooltip mds-tooltip-placement-' + this.realPlacement + ' ' + this.realEffect + '-mode';
3647
+ return this.className ? basicClass + ' ' + this.className : basicClass;
3648
+ },
3649
+ getRealNode: function getRealNode() {
3650
+ var slots = this.$slots.default;
3651
+ if (!Array.isArray(slots)) return null;
3652
+ var node = null;
3653
+ for (var index = 0; index < slots.length; index++) {
3654
+ if (slots[index] && slots[index].tag) {
3655
+ node = slots[index];
3656
+ }
3657
+ }
3658
+ return node;
3659
+ }
3660
+ },
3661
+ render: function render(h) {
3662
+ var _this4 = this;
3663
+
3664
+ if (this.popperInstance) {
3665
+ var _h = this.popperInstance._h;
3666
+ this.popperInstance.node = _h('mds-transition', {
3667
+ attrs: { type: 'zoom', motion: 'big-fast' },
3668
+ on: {
3669
+ 'after-enter': function afterEnter() {
3670
+ _this4.$emit('after-enter');
3671
+ },
3672
+ 'after-leave': function afterLeave() {
3673
+ _this4.$emit('after-leave');
3674
+ }
3675
+ }
3676
+ }, [_h('div', {
3677
+ ref: 'popper',
3678
+ directives: [{
3679
+ name: 'show',
3680
+ value: !this.disabled && this.showPopper
3681
+ }],
3682
+ on: {
3683
+ mouseleave: function mouseleave() {
3684
+ _this4.setExpectedState(false);
3685
+ _this4.debounceClose();
3686
+ },
3687
+ mouseenter: function mouseenter() {
3688
+ _this4.setExpectedState(true);
3689
+ }
3690
+ },
3691
+ class: this.calculateClass()
3692
+ }, [this.$slots.title || this.title])]);
3693
+ }
3694
+ this.$nextTick(function () {
3695
+ _this4.popperElm = _this4.popperInstance.$el;
3696
+ });
3697
+ var realNode = this.getRealNode();
3698
+ if (!realNode) return null;
3699
+ return realNode;
1400
3700
  }
1401
3701
  });
1402
3702
  // CONCATENATED MODULE: ./components/tooltip/index.js
@@ -1408,6 +3708,240 @@ tooltip.install = function (Vue) {
1408
3708
  };
1409
3709
  /* harmony default export */ var components_tooltip = __webpack_exports__["default"] = (tooltip);
1410
3710
 
3711
+ /***/ }),
3712
+
3713
+ /***/ 5:
3714
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3715
+
3716
+ "use strict";
3717
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
3718
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
3719
+ /* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
3720
+
3721
+
3722
+
3723
+ var hasModal = false;
3724
+ var hasInitZIndex = false;
3725
+ var zIndex = void 0;
3726
+
3727
+ var getModal = function getModal() {
3728
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
3729
+ var modalDom = PopupManager.modalDom;
3730
+ if (modalDom) {
3731
+ hasModal = true;
3732
+ } else {
3733
+ hasModal = false;
3734
+ modalDom = document.createElement('div');
3735
+ PopupManager.modalDom = modalDom;
3736
+
3737
+ modalDom.addEventListener('touchmove', function (event) {
3738
+ event.preventDefault();
3739
+ event.stopPropagation();
3740
+ });
3741
+
3742
+ modalDom.addEventListener('click', function () {
3743
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
3744
+ });
3745
+ }
3746
+
3747
+ return modalDom;
3748
+ };
3749
+
3750
+ var instances = {};
3751
+
3752
+ var PopupManager = {
3753
+ modalFade: true,
3754
+
3755
+ getInstance: function getInstance(id) {
3756
+ return instances[id];
3757
+ },
3758
+
3759
+ register: function register(id, instance) {
3760
+ if (id && instance) {
3761
+ instances[id] = instance;
3762
+ }
3763
+ },
3764
+
3765
+ deregister: function deregister(id) {
3766
+ if (id) {
3767
+ instances[id] = null;
3768
+ delete instances[id];
3769
+ }
3770
+ },
3771
+
3772
+ nextZIndex: function nextZIndex() {
3773
+ return PopupManager.zIndex++;
3774
+ },
3775
+
3776
+ modalStack: [],
3777
+
3778
+ doOnModalClick: function doOnModalClick() {
3779
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
3780
+ if (!topItem) return;
3781
+
3782
+ var instance = PopupManager.getInstance(topItem.id);
3783
+ if (instance && instance.closeOnClickModal) {
3784
+ instance.close();
3785
+ }
3786
+ },
3787
+
3788
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
3789
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
3790
+ if (!id || zIndex === undefined) return;
3791
+ this.modalFade = modalFade;
3792
+
3793
+ var modalStack = this.modalStack;
3794
+
3795
+ for (var i = 0, j = modalStack.length; i < j; i++) {
3796
+ var item = modalStack[i];
3797
+ if (item.id === id) {
3798
+ return;
3799
+ }
3800
+ }
3801
+
3802
+ var modalDom = getModal();
3803
+
3804
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
3805
+ if (this.modalFade && !hasModal) {
3806
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
3807
+ }
3808
+ if (modalClass) {
3809
+ var classArr = modalClass.trim().split(/\s+/);
3810
+ classArr.forEach(function (item) {
3811
+ return Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
3812
+ });
3813
+ }
3814
+ setTimeout(function () {
3815
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, 'v-modal-enter');
3816
+ }, 200);
3817
+
3818
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
3819
+ dom.parentNode.appendChild(modalDom);
3820
+ } else {
3821
+ document.body.appendChild(modalDom);
3822
+ }
3823
+
3824
+ if (zIndex) {
3825
+ modalDom.style.zIndex = zIndex;
3826
+ }
3827
+ modalDom.tabIndex = 0;
3828
+ modalDom.style.display = '';
3829
+
3830
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
3831
+ },
3832
+
3833
+ closeModal: function closeModal(id) {
3834
+ var modalStack = this.modalStack;
3835
+ var modalDom = getModal();
3836
+
3837
+ if (modalStack.length > 0) {
3838
+ var topItem = modalStack[modalStack.length - 1];
3839
+ if (topItem.id === id) {
3840
+ if (topItem.modalClass) {
3841
+ var classArr = topItem.modalClass.trim().split(/\s+/);
3842
+ classArr.forEach(function (item) {
3843
+ return Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, item);
3844
+ });
3845
+ }
3846
+
3847
+ modalStack.pop();
3848
+ if (modalStack.length > 0) {
3849
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
3850
+ }
3851
+ } else {
3852
+ for (var i = modalStack.length - 1; i >= 0; i--) {
3853
+ if (modalStack[i].id === id) {
3854
+ modalStack.splice(i, 1);
3855
+ break;
3856
+ }
3857
+ }
3858
+ }
3859
+ }
3860
+
3861
+ if (modalStack.length === 0) {
3862
+ if (this.modalFade) {
3863
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
3864
+ }
3865
+ setTimeout(function () {
3866
+ if (modalStack.length === 0) {
3867
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
3868
+ modalDom.style.display = 'none';
3869
+ PopupManager.modalDom = undefined;
3870
+ }
3871
+ Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(modalDom, 'v-modal-leave');
3872
+ }, 200);
3873
+ }
3874
+ }
3875
+ };
3876
+
3877
+ Object.defineProperty(PopupManager, 'zIndex', {
3878
+ configurable: true,
3879
+ get: function get() {
3880
+ if (!hasInitZIndex) {
3881
+ zIndex = zIndex || (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$ELEMENT || {}).zIndex || 2000;
3882
+ hasInitZIndex = true;
3883
+ }
3884
+ return zIndex;
3885
+ },
3886
+ set: function set(value) {
3887
+ zIndex = value;
3888
+ }
3889
+ });
3890
+
3891
+ var getTopPopup = function getTopPopup() {
3892
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
3893
+ if (PopupManager.modalStack.length > 0) {
3894
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
3895
+ if (!topPopup) return;
3896
+ var instance = PopupManager.getInstance(topPopup.id);
3897
+
3898
+ return instance;
3899
+ }
3900
+ };
3901
+
3902
+ if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
3903
+ // handle `esc` key when the popup is shown
3904
+ window.addEventListener('keydown', function (event) {
3905
+ if (event.keyCode === 27) {
3906
+ var topPopup = getTopPopup();
3907
+
3908
+ if (topPopup && topPopup.closeOnPressEscape) {
3909
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
3910
+ }
3911
+ }
3912
+ });
3913
+ }
3914
+
3915
+ /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
3916
+
3917
+ /***/ }),
3918
+
3919
+ /***/ 6:
3920
+ /***/ (function(module, exports) {
3921
+
3922
+ module.exports = require("babel-runtime/core-js/object/assign");
3923
+
3924
+ /***/ }),
3925
+
3926
+ /***/ 7:
3927
+ /***/ (function(module, exports) {
3928
+
3929
+ module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
3930
+
3931
+ /***/ }),
3932
+
3933
+ /***/ 72:
3934
+ /***/ (function(module, exports) {
3935
+
3936
+ module.exports = require("babel-helper-vue-jsx-merge-props");
3937
+
3938
+ /***/ }),
3939
+
3940
+ /***/ 9:
3941
+ /***/ (function(module, exports) {
3942
+
3943
+ module.exports = require("babel-runtime/helpers/typeof");
3944
+
1411
3945
  /***/ })
1412
3946
 
1413
3947
  /******/ });