bk-magic-vue 2.5.9-beta.2 → 2.5.9-beta.21
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.
- package/dist/bk-magic-vue.css +893 -959
- package/dist/bk-magic-vue.js +860 -625
- package/dist/bk-magic-vue.min.css +1 -1
- package/dist/bk-magic-vue.min.css.gz +0 -0
- package/dist/bk-magic-vue.min.css.map +1 -1
- package/dist/bk-magic-vue.min.js +1 -1
- package/dist/bk-magic-vue.min.js.gz +0 -0
- package/dist/bk-magic-vue.min.js.map +1 -1
- package/lib/card.js +2981 -203
- package/lib/cascade.js +6447 -6411
- package/lib/date-picker.js +1 -1
- package/lib/dialog.js +484 -9
- package/lib/info-box.js +484 -9
- package/lib/input.js +2942 -164
- package/lib/loading.js +7 -4
- package/lib/pagination.js +214 -17
- package/lib/rate.js +14 -3
- package/lib/resize-layout.js +3 -1
- package/lib/select.js +40 -9
- package/lib/sideslider.js +802 -336
- package/lib/slider.js +3270 -3202
- package/lib/star.js +13 -2
- package/lib/table.js +214 -17
- package/lib/tag-input.js +122 -102
- package/lib/time-picker.js +1 -1
- package/lib/timeline.js +26 -17
- package/lib/transfer.js +1886 -1710
- package/lib/ui/badge.css +127 -119
- package/lib/ui/badge.min.css +1 -1
- package/lib/ui/badge.min.css.map +1 -1
- package/lib/ui/bk-magic-vue.css +893 -959
- package/lib/ui/bk-magic-vue.min.css +1 -1
- package/lib/ui/bk-magic-vue.min.css.gz +0 -0
- package/lib/ui/bk-magic-vue.min.css.map +1 -1
- package/lib/ui/button.css +4 -4
- package/lib/ui/button.min.css +1 -1
- package/lib/ui/button.min.css.map +1 -1
- package/lib/ui/card.css +2 -2
- package/lib/ui/card.min.css +1 -1
- package/lib/ui/card.min.css.map +1 -1
- package/lib/ui/cascade.css +19 -1
- package/lib/ui/cascade.min.css +1 -1
- package/lib/ui/cascade.min.css.map +1 -1
- package/lib/ui/checkbox.css +67 -67
- package/lib/ui/checkbox.min.css.map +1 -1
- package/lib/ui/dialog.css +4 -4
- package/lib/ui/dialog.min.css +1 -1
- package/lib/ui/dialog.min.css.map +1 -1
- package/lib/ui/exception.css +1 -0
- package/lib/ui/exception.min.css +1 -1
- package/lib/ui/exception.min.css.map +1 -1
- package/lib/ui/form.css +2 -2
- package/lib/ui/form.min.css +1 -1
- package/lib/ui/form.min.css.map +1 -1
- package/lib/ui/info-box.css +4 -4
- package/lib/ui/info-box.min.css +1 -1
- package/lib/ui/info-box.min.css.map +1 -1
- package/lib/ui/input.css +1 -1
- package/lib/ui/input.min.css +1 -1
- package/lib/ui/input.min.css.map +1 -1
- package/lib/ui/link.css +27 -3
- package/lib/ui/link.min.css +1 -1
- package/lib/ui/link.min.css.map +1 -1
- package/lib/ui/loading.css +43 -280
- package/lib/ui/loading.min.css +1 -1
- package/lib/ui/loading.min.css.map +1 -1
- package/lib/ui/notify.css +5 -5
- package/lib/ui/notify.min.css +1 -1
- package/lib/ui/notify.min.css.map +1 -1
- package/lib/ui/overflow-tips.css +3 -2
- package/lib/ui/overflow-tips.min.css +1 -1
- package/lib/ui/overflow-tips.min.css.map +1 -1
- package/lib/ui/pagination.css +1 -1
- package/lib/ui/pagination.min.css +1 -1
- package/lib/ui/pagination.min.css.map +1 -1
- package/lib/ui/popconfirm.css +2 -2
- package/lib/ui/popconfirm.min.css +1 -1
- package/lib/ui/popconfirm.min.css.map +1 -1
- package/lib/ui/popover.css +3 -2
- package/lib/ui/popover.min.css +1 -1
- package/lib/ui/popover.min.css.map +1 -1
- package/lib/ui/process.css +51 -282
- package/lib/ui/process.min.css +1 -1
- package/lib/ui/process.min.css.map +1 -1
- package/lib/ui/progress.css +2 -2
- package/lib/ui/progress.min.css +1 -1
- package/lib/ui/progress.min.css.map +1 -1
- package/lib/ui/radio.css +64 -64
- package/lib/ui/radio.min.css +1 -1
- package/lib/ui/radio.min.css.map +1 -1
- package/lib/ui/resize-layout.css +13 -5
- package/lib/ui/resize-layout.min.css +1 -1
- package/lib/ui/resize-layout.min.css.map +1 -1
- package/lib/ui/sideslider.css +8 -7
- package/lib/ui/sideslider.min.css +1 -1
- package/lib/ui/sideslider.min.css.map +1 -1
- package/lib/ui/star.css +22 -17
- package/lib/ui/star.min.css +1 -1
- package/lib/ui/star.min.css.map +1 -1
- package/lib/ui/steps.css +372 -274
- package/lib/ui/steps.min.css +1 -1
- package/lib/ui/steps.min.css.map +1 -1
- package/lib/ui/tooltips.css +3 -2
- package/lib/ui/tooltips.min.css +1 -1
- package/lib/ui/tooltips.min.css.map +1 -1
- package/lib/ui/transfer.css +122 -121
- package/lib/ui/transfer.min.css +1 -1
- package/lib/ui/transfer.min.css.map +1 -1
- package/lib/ui/tree.css +45 -282
- package/lib/ui/tree.min.css +1 -1
- package/lib/ui/tree.min.css.map +1 -1
- package/lib/version-detail.js +453 -13
- package/package.json +3 -4
package/lib/input.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('bk-magic-vue/lib/locale')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'bk-magic-vue/lib/locale'], factory) :
|
|
4
|
-
(global = global || self, factory(global.library = {}, global.locale));
|
|
5
|
-
}(this, function (exports, locale) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('bk-magic-vue/lib/locale')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'bk-magic-vue/lib/locale'], factory) :
|
|
4
|
+
(global = global || self, factory(global.library = {}, global.Vue, global.locale));
|
|
5
|
+
}(this, function (exports, Vue, locale) { 'use strict';
|
|
6
6
|
|
|
7
|
+
Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
|
|
7
8
|
locale = locale && locale.hasOwnProperty('default') ? locale['default'] : locale;
|
|
8
9
|
|
|
9
10
|
function createCommonjsModule(fn, module) {
|
|
@@ -215,6 +216,51 @@
|
|
|
215
216
|
|
|
216
217
|
var _parseInt$2 = _parseInt$1;
|
|
217
218
|
|
|
219
|
+
function _typeof(obj) {
|
|
220
|
+
"@babel/helpers - typeof";
|
|
221
|
+
|
|
222
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
223
|
+
return typeof obj;
|
|
224
|
+
} : function (obj) {
|
|
225
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
226
|
+
}, _typeof(obj);
|
|
227
|
+
}
|
|
228
|
+
function _classCallCheck(instance, Constructor) {
|
|
229
|
+
if (!(instance instanceof Constructor)) {
|
|
230
|
+
throw new TypeError("Cannot call a class as a function");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function _defineProperties(target, props) {
|
|
234
|
+
for (var i = 0; i < props.length; i++) {
|
|
235
|
+
var descriptor = props[i];
|
|
236
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
237
|
+
descriptor.configurable = true;
|
|
238
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
239
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
243
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
244
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
245
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
246
|
+
writable: false
|
|
247
|
+
});
|
|
248
|
+
return Constructor;
|
|
249
|
+
}
|
|
250
|
+
function _defineProperty(obj, key, value) {
|
|
251
|
+
key = _toPropertyKey(key);
|
|
252
|
+
if (key in obj) {
|
|
253
|
+
Object.defineProperty(obj, key, {
|
|
254
|
+
value: value,
|
|
255
|
+
enumerable: true,
|
|
256
|
+
configurable: true,
|
|
257
|
+
writable: true
|
|
258
|
+
});
|
|
259
|
+
} else {
|
|
260
|
+
obj[key] = value;
|
|
261
|
+
}
|
|
262
|
+
return obj;
|
|
263
|
+
}
|
|
218
264
|
function _extends() {
|
|
219
265
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
220
266
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -229,6 +275,21 @@
|
|
|
229
275
|
};
|
|
230
276
|
return _extends.apply(this, arguments);
|
|
231
277
|
}
|
|
278
|
+
function _objectSpread(target) {
|
|
279
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
280
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
281
|
+
var ownKeys = Object.keys(source);
|
|
282
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
283
|
+
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
284
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
ownKeys.forEach(function (key) {
|
|
288
|
+
_defineProperty(target, key, source[key]);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
return target;
|
|
292
|
+
}
|
|
232
293
|
function _unsupportedIterableToArray(o, minLen) {
|
|
233
294
|
if (!o) return;
|
|
234
295
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -293,6 +354,20 @@
|
|
|
293
354
|
}
|
|
294
355
|
};
|
|
295
356
|
}
|
|
357
|
+
function _toPrimitive$1(input, hint) {
|
|
358
|
+
if (typeof input !== "object" || input === null) return input;
|
|
359
|
+
var prim = input[Symbol.toPrimitive];
|
|
360
|
+
if (prim !== undefined) {
|
|
361
|
+
var res = prim.call(input, hint || "default");
|
|
362
|
+
if (typeof res !== "object") return res;
|
|
363
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
364
|
+
}
|
|
365
|
+
return (hint === "string" ? String : Number)(input);
|
|
366
|
+
}
|
|
367
|
+
function _toPropertyKey(arg) {
|
|
368
|
+
var key = _toPrimitive$1(arg, "string");
|
|
369
|
+
return typeof key === "symbol" ? key : String(key);
|
|
370
|
+
}
|
|
296
371
|
|
|
297
372
|
var $parseFloat = _global.parseFloat;
|
|
298
373
|
var $trim$1 = _stringTrim.trim;
|
|
@@ -331,62 +406,2812 @@
|
|
|
331
406
|
name = parent.$options.name;
|
|
332
407
|
}
|
|
333
408
|
}
|
|
334
|
-
if (parent) {
|
|
335
|
-
parent.$emit.apply(parent, [eventName].concat(params));
|
|
409
|
+
if (parent) {
|
|
410
|
+
parent.$emit.apply(parent, [eventName].concat(params));
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
var requestAnimationFrame$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) {
|
|
417
|
+
window.setTimeout(callback, 1000 / 60);
|
|
418
|
+
};
|
|
419
|
+
var cancelAnimationFrame$1 = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame || function (id) {
|
|
420
|
+
window.clearTimeout(id);
|
|
421
|
+
};
|
|
422
|
+
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
|
|
423
|
+
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
|
424
|
+
var camelCase = function camelCase(name) {
|
|
425
|
+
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
|
|
426
|
+
return offset ? letter.toUpperCase() : letter;
|
|
427
|
+
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
|
|
428
|
+
};
|
|
429
|
+
var getStyle = Number(document.documentMode) < 9 ? function (element, styleName) {
|
|
430
|
+
if (!element || !styleName) return null;
|
|
431
|
+
styleName = camelCase(styleName);
|
|
432
|
+
if (styleName === 'float') {
|
|
433
|
+
styleName = 'styleFloat';
|
|
434
|
+
}
|
|
435
|
+
try {
|
|
436
|
+
switch (styleName) {
|
|
437
|
+
case 'opacity':
|
|
438
|
+
try {
|
|
439
|
+
return element.filters.item('alpha').opacity / 100;
|
|
440
|
+
} catch (e) {
|
|
441
|
+
return 1.0;
|
|
442
|
+
}
|
|
443
|
+
default:
|
|
444
|
+
return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
|
|
445
|
+
}
|
|
446
|
+
} catch (e) {
|
|
447
|
+
return element.style[styleName];
|
|
448
|
+
}
|
|
449
|
+
} : function (element, styleName) {
|
|
450
|
+
if (!element || !styleName) return null;
|
|
451
|
+
styleName = camelCase(styleName);
|
|
452
|
+
if (styleName === 'float') {
|
|
453
|
+
styleName = 'cssFloat';
|
|
454
|
+
}
|
|
455
|
+
try {
|
|
456
|
+
var computed = document.defaultView.getComputedStyle(element, '');
|
|
457
|
+
return element.style[styleName] || computed ? computed[styleName] : null;
|
|
458
|
+
} catch (e) {
|
|
459
|
+
return element.style[styleName];
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
var toString = {}.toString;
|
|
464
|
+
var _cof = function (it) {
|
|
465
|
+
return toString.call(it).slice(8, -1);
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
var _isArray = Array.isArray || function isArray(arg) {
|
|
469
|
+
return _cof(arg) == 'Array';
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
_export(_export.S, 'Array', { isArray: _isArray });
|
|
473
|
+
|
|
474
|
+
var isArray = _core.Array.isArray;
|
|
475
|
+
|
|
476
|
+
var isArray$1 = isArray;
|
|
477
|
+
|
|
478
|
+
var _toObject = function (it) {
|
|
479
|
+
return Object(_defined(it));
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
|
483
|
+
return _cof(it) == 'String' ? it.split('') : Object(it);
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
var _toIobject = function (it) {
|
|
487
|
+
return _iobject(_defined(it));
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
var ceil = Math.ceil;
|
|
491
|
+
var floor = Math.floor;
|
|
492
|
+
var _toInteger = function (it) {
|
|
493
|
+
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
var min = Math.min;
|
|
497
|
+
var _toLength = function (it) {
|
|
498
|
+
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
var max = Math.max;
|
|
502
|
+
var min$1 = Math.min;
|
|
503
|
+
var _toAbsoluteIndex = function (index, length) {
|
|
504
|
+
index = _toInteger(index);
|
|
505
|
+
return index < 0 ? max(index + length, 0) : min$1(index, length);
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
var _arrayIncludes = function (IS_INCLUDES) {
|
|
509
|
+
return function ($this, el, fromIndex) {
|
|
510
|
+
var O = _toIobject($this);
|
|
511
|
+
var length = _toLength(O.length);
|
|
512
|
+
var index = _toAbsoluteIndex(fromIndex, length);
|
|
513
|
+
var value;
|
|
514
|
+
if (IS_INCLUDES && el != el) while (length > index) {
|
|
515
|
+
value = O[index++];
|
|
516
|
+
if (value != value) return true;
|
|
517
|
+
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
|
518
|
+
if (O[index] === el) return IS_INCLUDES || index || 0;
|
|
519
|
+
} return !IS_INCLUDES && -1;
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
var _shared = createCommonjsModule(function (module) {
|
|
524
|
+
var SHARED = '__core-js_shared__';
|
|
525
|
+
var store = _global[SHARED] || (_global[SHARED] = {});
|
|
526
|
+
(module.exports = function (key, value) {
|
|
527
|
+
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
528
|
+
})('versions', []).push({
|
|
529
|
+
version: _core.version,
|
|
530
|
+
mode: 'pure' ,
|
|
531
|
+
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
var id = 0;
|
|
536
|
+
var px = Math.random();
|
|
537
|
+
var _uid = function (key) {
|
|
538
|
+
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
var shared = _shared('keys');
|
|
542
|
+
var _sharedKey = function (key) {
|
|
543
|
+
return shared[key] || (shared[key] = _uid(key));
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
var arrayIndexOf = _arrayIncludes(false);
|
|
547
|
+
var IE_PROTO = _sharedKey('IE_PROTO');
|
|
548
|
+
var _objectKeysInternal = function (object, names) {
|
|
549
|
+
var O = _toIobject(object);
|
|
550
|
+
var i = 0;
|
|
551
|
+
var result = [];
|
|
552
|
+
var key;
|
|
553
|
+
for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
|
|
554
|
+
while (names.length > i) if (_has(O, key = names[i++])) {
|
|
555
|
+
~arrayIndexOf(result, key) || result.push(key);
|
|
556
|
+
}
|
|
557
|
+
return result;
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
var _enumBugKeys = (
|
|
561
|
+
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
|
562
|
+
).split(',');
|
|
563
|
+
|
|
564
|
+
var _objectKeys = Object.keys || function keys(O) {
|
|
565
|
+
return _objectKeysInternal(O, _enumBugKeys);
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
var _objectSap = function (KEY, exec) {
|
|
569
|
+
var fn = (_core.Object || {})[KEY] || Object[KEY];
|
|
570
|
+
var exp = {};
|
|
571
|
+
exp[KEY] = exec(fn);
|
|
572
|
+
_export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
_objectSap('keys', function () {
|
|
576
|
+
return function keys(it) {
|
|
577
|
+
return _objectKeys(_toObject(it));
|
|
578
|
+
};
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
var keys = _core.Object.keys;
|
|
582
|
+
|
|
583
|
+
var keys$1 = keys;
|
|
584
|
+
|
|
585
|
+
var f$1 = Object.getOwnPropertySymbols;
|
|
586
|
+
var _objectGops = {
|
|
587
|
+
f: f$1
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
var f$2 = {}.propertyIsEnumerable;
|
|
591
|
+
var _objectPie = {
|
|
592
|
+
f: f$2
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
var $assign = Object.assign;
|
|
596
|
+
var _objectAssign = !$assign || _fails(function () {
|
|
597
|
+
var A = {};
|
|
598
|
+
var B = {};
|
|
599
|
+
var S = Symbol();
|
|
600
|
+
var K = 'abcdefghijklmnopqrst';
|
|
601
|
+
A[S] = 7;
|
|
602
|
+
K.split('').forEach(function (k) { B[k] = k; });
|
|
603
|
+
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
|
604
|
+
}) ? function assign(target, source) {
|
|
605
|
+
var T = _toObject(target);
|
|
606
|
+
var aLen = arguments.length;
|
|
607
|
+
var index = 1;
|
|
608
|
+
var getSymbols = _objectGops.f;
|
|
609
|
+
var isEnum = _objectPie.f;
|
|
610
|
+
while (aLen > index) {
|
|
611
|
+
var S = _iobject(arguments[index++]);
|
|
612
|
+
var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
|
|
613
|
+
var length = keys.length;
|
|
614
|
+
var j = 0;
|
|
615
|
+
var key;
|
|
616
|
+
while (length > j) {
|
|
617
|
+
key = keys[j++];
|
|
618
|
+
if (!_descriptors || isEnum.call(S, key)) T[key] = S[key];
|
|
619
|
+
}
|
|
620
|
+
} return T;
|
|
621
|
+
} : $assign;
|
|
622
|
+
|
|
623
|
+
_export(_export.S + _export.F, 'Object', { assign: _objectAssign });
|
|
624
|
+
|
|
625
|
+
var assign = _core.Object.assign;
|
|
626
|
+
|
|
627
|
+
var assign$1 = assign;
|
|
628
|
+
|
|
629
|
+
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
630
|
+
var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
|
|
631
|
+
var timeoutDuration = 0;
|
|
632
|
+
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
|
|
633
|
+
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
|
|
634
|
+
timeoutDuration = 1;
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function microtaskDebounce(fn) {
|
|
639
|
+
var called = false;
|
|
640
|
+
return function () {
|
|
641
|
+
if (called) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
called = true;
|
|
645
|
+
window.Promise.resolve().then(function () {
|
|
646
|
+
called = false;
|
|
647
|
+
fn();
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function taskDebounce(fn) {
|
|
652
|
+
var scheduled = false;
|
|
653
|
+
return function () {
|
|
654
|
+
if (!scheduled) {
|
|
655
|
+
scheduled = true;
|
|
656
|
+
setTimeout(function () {
|
|
657
|
+
scheduled = false;
|
|
658
|
+
fn();
|
|
659
|
+
}, timeoutDuration);
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
var supportsMicroTasks = isBrowser && window.Promise;
|
|
664
|
+
var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
|
|
665
|
+
function isFunction(functionToCheck) {
|
|
666
|
+
var getType = {};
|
|
667
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
668
|
+
}
|
|
669
|
+
function getStyleComputedProperty(element, property) {
|
|
670
|
+
if (element.nodeType !== 1) {
|
|
671
|
+
return [];
|
|
672
|
+
}
|
|
673
|
+
var window = element.ownerDocument.defaultView;
|
|
674
|
+
var css = window.getComputedStyle(element, null);
|
|
675
|
+
return property ? css[property] : css;
|
|
676
|
+
}
|
|
677
|
+
function getParentNode(element) {
|
|
678
|
+
if (element.nodeName === 'HTML') {
|
|
679
|
+
return element;
|
|
680
|
+
}
|
|
681
|
+
return element.parentNode || element.host;
|
|
682
|
+
}
|
|
683
|
+
function getScrollParent(element) {
|
|
684
|
+
if (!element) {
|
|
685
|
+
return document.body;
|
|
686
|
+
}
|
|
687
|
+
switch (element.nodeName) {
|
|
688
|
+
case 'HTML':
|
|
689
|
+
case 'BODY':
|
|
690
|
+
return element.ownerDocument.body;
|
|
691
|
+
case '#document':
|
|
692
|
+
return element.body;
|
|
693
|
+
}
|
|
694
|
+
var _getStyleComputedProp = getStyleComputedProperty(element),
|
|
695
|
+
overflow = _getStyleComputedProp.overflow,
|
|
696
|
+
overflowX = _getStyleComputedProp.overflowX,
|
|
697
|
+
overflowY = _getStyleComputedProp.overflowY;
|
|
698
|
+
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
|
699
|
+
return element;
|
|
700
|
+
}
|
|
701
|
+
return getScrollParent(getParentNode(element));
|
|
702
|
+
}
|
|
703
|
+
var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
|
|
704
|
+
var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
|
|
705
|
+
function isIE(version) {
|
|
706
|
+
if (version === 11) {
|
|
707
|
+
return isIE11;
|
|
708
|
+
}
|
|
709
|
+
if (version === 10) {
|
|
710
|
+
return isIE10;
|
|
711
|
+
}
|
|
712
|
+
return isIE11 || isIE10;
|
|
713
|
+
}
|
|
714
|
+
function getOffsetParent(element) {
|
|
715
|
+
if (!element) {
|
|
716
|
+
return document.documentElement;
|
|
717
|
+
}
|
|
718
|
+
var noOffsetParent = isIE(10) ? document.body : null;
|
|
719
|
+
var offsetParent = element.offsetParent || null;
|
|
720
|
+
while (offsetParent === noOffsetParent && element.nextElementSibling) {
|
|
721
|
+
offsetParent = (element = element.nextElementSibling).offsetParent;
|
|
722
|
+
}
|
|
723
|
+
var nodeName = offsetParent && offsetParent.nodeName;
|
|
724
|
+
if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
|
|
725
|
+
return element ? element.ownerDocument.documentElement : document.documentElement;
|
|
726
|
+
}
|
|
727
|
+
if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
|
|
728
|
+
return getOffsetParent(offsetParent);
|
|
729
|
+
}
|
|
730
|
+
return offsetParent;
|
|
731
|
+
}
|
|
732
|
+
function isOffsetContainer(element) {
|
|
733
|
+
var nodeName = element.nodeName;
|
|
734
|
+
if (nodeName === 'BODY') {
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
|
|
738
|
+
}
|
|
739
|
+
function getRoot(node) {
|
|
740
|
+
if (node.parentNode !== null) {
|
|
741
|
+
return getRoot(node.parentNode);
|
|
742
|
+
}
|
|
743
|
+
return node;
|
|
744
|
+
}
|
|
745
|
+
function findCommonOffsetParent(element1, element2) {
|
|
746
|
+
if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
|
|
747
|
+
return document.documentElement;
|
|
748
|
+
}
|
|
749
|
+
var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
|
|
750
|
+
var start = order ? element1 : element2;
|
|
751
|
+
var end = order ? element2 : element1;
|
|
752
|
+
var range = document.createRange();
|
|
753
|
+
range.setStart(start, 0);
|
|
754
|
+
range.setEnd(end, 0);
|
|
755
|
+
var commonAncestorContainer = range.commonAncestorContainer;
|
|
756
|
+
if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
|
|
757
|
+
if (isOffsetContainer(commonAncestorContainer)) {
|
|
758
|
+
return commonAncestorContainer;
|
|
759
|
+
}
|
|
760
|
+
return getOffsetParent(commonAncestorContainer);
|
|
761
|
+
}
|
|
762
|
+
var element1root = getRoot(element1);
|
|
763
|
+
if (element1root.host) {
|
|
764
|
+
return findCommonOffsetParent(element1root.host, element2);
|
|
765
|
+
} else {
|
|
766
|
+
return findCommonOffsetParent(element1, getRoot(element2).host);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
function getScroll(element) {
|
|
770
|
+
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
|
771
|
+
var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
|
|
772
|
+
var nodeName = element.nodeName;
|
|
773
|
+
if (nodeName === 'BODY' || nodeName === 'HTML') {
|
|
774
|
+
var html = element.ownerDocument.documentElement;
|
|
775
|
+
var scrollingElement = element.ownerDocument.scrollingElement || html;
|
|
776
|
+
return scrollingElement[upperSide];
|
|
777
|
+
}
|
|
778
|
+
return element[upperSide];
|
|
779
|
+
}
|
|
780
|
+
function includeScroll(rect, element) {
|
|
781
|
+
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
782
|
+
var scrollTop = getScroll(element, 'top');
|
|
783
|
+
var scrollLeft = getScroll(element, 'left');
|
|
784
|
+
var modifier = subtract ? -1 : 1;
|
|
785
|
+
rect.top += scrollTop * modifier;
|
|
786
|
+
rect.bottom += scrollTop * modifier;
|
|
787
|
+
rect.left += scrollLeft * modifier;
|
|
788
|
+
rect.right += scrollLeft * modifier;
|
|
789
|
+
return rect;
|
|
790
|
+
}
|
|
791
|
+
function getBordersSize(styles, axis) {
|
|
792
|
+
var sideA = axis === 'x' ? 'Left' : 'Top';
|
|
793
|
+
var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
|
|
794
|
+
return _parseFloat$2(styles["border".concat(sideA, "Width")], 10) + _parseFloat$2(styles["border".concat(sideB, "Width")], 10);
|
|
795
|
+
}
|
|
796
|
+
function getSize(axis, body, html, computedStyle) {
|
|
797
|
+
return Math.max(body["offset".concat(axis)], body["scroll".concat(axis)], html["client".concat(axis)], html["offset".concat(axis)], html["scroll".concat(axis)], isIE(10) ? _parseInt$2(html["offset".concat(axis)]) + _parseInt$2(computedStyle["margin".concat(axis === 'Height' ? 'Top' : 'Left')]) + _parseInt$2(computedStyle["margin".concat(axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
|
|
798
|
+
}
|
|
799
|
+
function getWindowSizes(document) {
|
|
800
|
+
var body = document.body;
|
|
801
|
+
var html = document.documentElement;
|
|
802
|
+
var computedStyle = isIE(10) && getComputedStyle(html);
|
|
803
|
+
return {
|
|
804
|
+
height: getSize('Height', body, html, computedStyle),
|
|
805
|
+
width: getSize('Width', body, html, computedStyle)
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
var _extends$1 = assign$1 || function (target) {
|
|
809
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
810
|
+
var source = arguments[i];
|
|
811
|
+
for (var key in source) {
|
|
812
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
813
|
+
target[key] = source[key];
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return target;
|
|
818
|
+
};
|
|
819
|
+
function getClientRect(offsets) {
|
|
820
|
+
return _extends$1({}, offsets, {
|
|
821
|
+
right: offsets.left + offsets.width,
|
|
822
|
+
bottom: offsets.top + offsets.height
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
function getBoundingClientRect(element) {
|
|
826
|
+
var rect = {};
|
|
827
|
+
try {
|
|
828
|
+
if (isIE(10)) {
|
|
829
|
+
rect = element.getBoundingClientRect();
|
|
830
|
+
var scrollTop = getScroll(element, 'top');
|
|
831
|
+
var scrollLeft = getScroll(element, 'left');
|
|
832
|
+
rect.top += scrollTop;
|
|
833
|
+
rect.left += scrollLeft;
|
|
834
|
+
rect.bottom += scrollTop;
|
|
835
|
+
rect.right += scrollLeft;
|
|
836
|
+
} else {
|
|
837
|
+
rect = element.getBoundingClientRect();
|
|
838
|
+
}
|
|
839
|
+
} catch (e) {}
|
|
840
|
+
var result = {
|
|
841
|
+
left: rect.left,
|
|
842
|
+
top: rect.top,
|
|
843
|
+
width: rect.right - rect.left,
|
|
844
|
+
height: rect.bottom - rect.top
|
|
845
|
+
};
|
|
846
|
+
var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
|
|
847
|
+
var width = sizes.width || element.clientWidth || result.right - result.left;
|
|
848
|
+
var height = sizes.height || element.clientHeight || result.bottom - result.top;
|
|
849
|
+
var horizScrollbar = element.offsetWidth - width;
|
|
850
|
+
var vertScrollbar = element.offsetHeight - height;
|
|
851
|
+
if (horizScrollbar || vertScrollbar) {
|
|
852
|
+
var styles = getStyleComputedProperty(element);
|
|
853
|
+
horizScrollbar -= getBordersSize(styles, 'x');
|
|
854
|
+
vertScrollbar -= getBordersSize(styles, 'y');
|
|
855
|
+
result.width -= horizScrollbar;
|
|
856
|
+
result.height -= vertScrollbar;
|
|
857
|
+
}
|
|
858
|
+
return getClientRect(result);
|
|
859
|
+
}
|
|
860
|
+
function getOffsetRectRelativeToArbitraryNode(children, parent) {
|
|
861
|
+
var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
862
|
+
var isIE10 = isIE(10);
|
|
863
|
+
var isHTML = parent.nodeName === 'HTML';
|
|
864
|
+
var childrenRect = getBoundingClientRect(children);
|
|
865
|
+
var parentRect = getBoundingClientRect(parent);
|
|
866
|
+
var scrollParent = getScrollParent(children);
|
|
867
|
+
var styles = getStyleComputedProperty(parent);
|
|
868
|
+
var borderTopWidth = _parseFloat$2(styles.borderTopWidth, 10);
|
|
869
|
+
var borderLeftWidth = _parseFloat$2(styles.borderLeftWidth, 10);
|
|
870
|
+
if (fixedPosition && isHTML) {
|
|
871
|
+
parentRect.top = Math.max(parentRect.top, 0);
|
|
872
|
+
parentRect.left = Math.max(parentRect.left, 0);
|
|
873
|
+
}
|
|
874
|
+
var offsets = getClientRect({
|
|
875
|
+
top: childrenRect.top - parentRect.top - borderTopWidth,
|
|
876
|
+
left: childrenRect.left - parentRect.left - borderLeftWidth,
|
|
877
|
+
width: childrenRect.width,
|
|
878
|
+
height: childrenRect.height
|
|
879
|
+
});
|
|
880
|
+
offsets.marginTop = 0;
|
|
881
|
+
offsets.marginLeft = 0;
|
|
882
|
+
if (!isIE10 && isHTML) {
|
|
883
|
+
var marginTop = _parseFloat$2(styles.marginTop, 10);
|
|
884
|
+
var marginLeft = _parseFloat$2(styles.marginLeft, 10);
|
|
885
|
+
offsets.top -= borderTopWidth - marginTop;
|
|
886
|
+
offsets.bottom -= borderTopWidth - marginTop;
|
|
887
|
+
offsets.left -= borderLeftWidth - marginLeft;
|
|
888
|
+
offsets.right -= borderLeftWidth - marginLeft;
|
|
889
|
+
offsets.marginTop = marginTop;
|
|
890
|
+
offsets.marginLeft = marginLeft;
|
|
891
|
+
}
|
|
892
|
+
if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
|
|
893
|
+
offsets = includeScroll(offsets, parent);
|
|
894
|
+
}
|
|
895
|
+
return offsets;
|
|
896
|
+
}
|
|
897
|
+
function getViewportOffsetRectRelativeToArtbitraryNode(element) {
|
|
898
|
+
var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
899
|
+
var html = element.ownerDocument.documentElement;
|
|
900
|
+
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
|
|
901
|
+
var width = Math.max(html.clientWidth, window.innerWidth || 0);
|
|
902
|
+
var height = Math.max(html.clientHeight, window.innerHeight || 0);
|
|
903
|
+
var scrollTop = !excludeScroll ? getScroll(html) : 0;
|
|
904
|
+
var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
|
|
905
|
+
var offset = {
|
|
906
|
+
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
|
|
907
|
+
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
|
|
908
|
+
width: width,
|
|
909
|
+
height: height
|
|
910
|
+
};
|
|
911
|
+
return getClientRect(offset);
|
|
912
|
+
}
|
|
913
|
+
function isFixed(element) {
|
|
914
|
+
var nodeName = element.nodeName;
|
|
915
|
+
if (nodeName === 'BODY' || nodeName === 'HTML') {
|
|
916
|
+
return false;
|
|
917
|
+
}
|
|
918
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
919
|
+
return true;
|
|
920
|
+
}
|
|
921
|
+
var parentNode = getParentNode(element);
|
|
922
|
+
if (!parentNode) {
|
|
923
|
+
return false;
|
|
924
|
+
}
|
|
925
|
+
return isFixed(parentNode);
|
|
926
|
+
}
|
|
927
|
+
function getFixedPositionOffsetParent(element) {
|
|
928
|
+
if (!element || !element.parentElement || isIE()) {
|
|
929
|
+
return document.documentElement;
|
|
930
|
+
}
|
|
931
|
+
var el = element.parentElement;
|
|
932
|
+
while (el && getStyleComputedProperty(el, 'transform') === 'none') {
|
|
933
|
+
el = el.parentElement;
|
|
934
|
+
}
|
|
935
|
+
return el || document.documentElement;
|
|
936
|
+
}
|
|
937
|
+
function getBoundaries(popper, reference, padding, boundariesElement) {
|
|
938
|
+
var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
939
|
+
var boundaries = {
|
|
940
|
+
top: 0,
|
|
941
|
+
left: 0
|
|
942
|
+
};
|
|
943
|
+
var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
|
|
944
|
+
if (boundariesElement === 'viewport') {
|
|
945
|
+
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
|
|
946
|
+
} else {
|
|
947
|
+
var boundariesNode;
|
|
948
|
+
if (boundariesElement === 'scrollParent') {
|
|
949
|
+
boundariesNode = getScrollParent(getParentNode(reference));
|
|
950
|
+
if (boundariesNode.nodeName === 'BODY') {
|
|
951
|
+
boundariesNode = popper.ownerDocument.documentElement;
|
|
952
|
+
}
|
|
953
|
+
} else if (boundariesElement === 'window') {
|
|
954
|
+
boundariesNode = popper.ownerDocument.documentElement;
|
|
955
|
+
} else {
|
|
956
|
+
boundariesNode = boundariesElement;
|
|
957
|
+
}
|
|
958
|
+
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
|
|
959
|
+
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
|
|
960
|
+
var _getWindowSizes = getWindowSizes(popper.ownerDocument),
|
|
961
|
+
height = _getWindowSizes.height,
|
|
962
|
+
width = _getWindowSizes.width;
|
|
963
|
+
boundaries.top += offsets.top - offsets.marginTop;
|
|
964
|
+
boundaries.bottom = height + offsets.top;
|
|
965
|
+
boundaries.left += offsets.left - offsets.marginLeft;
|
|
966
|
+
boundaries.right = width + offsets.left;
|
|
967
|
+
} else {
|
|
968
|
+
boundaries = offsets;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
padding = padding || 0;
|
|
972
|
+
var isPaddingNumber = typeof padding === 'number';
|
|
973
|
+
boundaries.left += isPaddingNumber ? padding : padding.left || 0;
|
|
974
|
+
boundaries.top += isPaddingNumber ? padding : padding.top || 0;
|
|
975
|
+
boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
|
|
976
|
+
boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
|
|
977
|
+
return boundaries;
|
|
978
|
+
}
|
|
979
|
+
function getArea(_ref) {
|
|
980
|
+
var width = _ref.width,
|
|
981
|
+
height = _ref.height;
|
|
982
|
+
return width * height;
|
|
983
|
+
}
|
|
984
|
+
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
|
|
985
|
+
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
986
|
+
if (placement.indexOf('auto') === -1) {
|
|
987
|
+
return placement;
|
|
988
|
+
}
|
|
989
|
+
var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
|
|
990
|
+
var rects = {
|
|
991
|
+
top: {
|
|
992
|
+
width: boundaries.width,
|
|
993
|
+
height: refRect.top - boundaries.top
|
|
994
|
+
},
|
|
995
|
+
right: {
|
|
996
|
+
width: boundaries.right - refRect.right,
|
|
997
|
+
height: boundaries.height
|
|
998
|
+
},
|
|
999
|
+
bottom: {
|
|
1000
|
+
width: boundaries.width,
|
|
1001
|
+
height: boundaries.bottom - refRect.bottom
|
|
1002
|
+
},
|
|
1003
|
+
left: {
|
|
1004
|
+
width: refRect.left - boundaries.left,
|
|
1005
|
+
height: boundaries.height
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
var sortedAreas = keys$1(rects).map(function (key) {
|
|
1009
|
+
return _extends$1({
|
|
1010
|
+
key: key
|
|
1011
|
+
}, rects[key], {
|
|
1012
|
+
area: getArea(rects[key])
|
|
1013
|
+
});
|
|
1014
|
+
}).sort(function (a, b) {
|
|
1015
|
+
return b.area - a.area;
|
|
1016
|
+
});
|
|
1017
|
+
var filteredAreas = sortedAreas.filter(function (_ref2) {
|
|
1018
|
+
var width = _ref2.width,
|
|
1019
|
+
height = _ref2.height;
|
|
1020
|
+
return width >= popper.clientWidth && height >= popper.clientHeight;
|
|
1021
|
+
});
|
|
1022
|
+
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
|
|
1023
|
+
var variation = placement.split('-')[1];
|
|
1024
|
+
return computedPlacement + (variation ? "-".concat(variation) : '');
|
|
1025
|
+
}
|
|
1026
|
+
function getReferenceOffsets(state, popper, reference) {
|
|
1027
|
+
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
1028
|
+
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
|
|
1029
|
+
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
|
|
1030
|
+
}
|
|
1031
|
+
function getOuterSizes(element) {
|
|
1032
|
+
var window = element.ownerDocument.defaultView;
|
|
1033
|
+
var styles = window.getComputedStyle(element);
|
|
1034
|
+
var x = _parseFloat$2(styles.marginTop || 0) + _parseFloat$2(styles.marginBottom || 0);
|
|
1035
|
+
var y = _parseFloat$2(styles.marginLeft || 0) + _parseFloat$2(styles.marginRight || 0);
|
|
1036
|
+
var result = {
|
|
1037
|
+
width: element.offsetWidth + y,
|
|
1038
|
+
height: element.offsetHeight + x
|
|
1039
|
+
};
|
|
1040
|
+
return result;
|
|
1041
|
+
}
|
|
1042
|
+
function getOppositePlacement(placement) {
|
|
1043
|
+
var hash = {
|
|
1044
|
+
left: 'right',
|
|
1045
|
+
right: 'left',
|
|
1046
|
+
bottom: 'top',
|
|
1047
|
+
top: 'bottom'
|
|
1048
|
+
};
|
|
1049
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
1050
|
+
return hash[matched];
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
function getPopperOffsets(popper, referenceOffsets, placement) {
|
|
1054
|
+
placement = placement.split('-')[0];
|
|
1055
|
+
var popperRect = getOuterSizes(popper);
|
|
1056
|
+
var popperOffsets = {
|
|
1057
|
+
width: popperRect.width,
|
|
1058
|
+
height: popperRect.height
|
|
1059
|
+
};
|
|
1060
|
+
var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
|
|
1061
|
+
var mainSide = isHoriz ? 'top' : 'left';
|
|
1062
|
+
var secondarySide = isHoriz ? 'left' : 'top';
|
|
1063
|
+
var measurement = isHoriz ? 'height' : 'width';
|
|
1064
|
+
var secondaryMeasurement = !isHoriz ? 'height' : 'width';
|
|
1065
|
+
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
|
|
1066
|
+
if (placement === secondarySide) {
|
|
1067
|
+
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
|
|
1068
|
+
} else {
|
|
1069
|
+
popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
|
|
1070
|
+
}
|
|
1071
|
+
return popperOffsets;
|
|
1072
|
+
}
|
|
1073
|
+
function find(arr, check) {
|
|
1074
|
+
if (Array.prototype.find) {
|
|
1075
|
+
return arr.find(check);
|
|
1076
|
+
}
|
|
1077
|
+
return arr.filter(check)[0];
|
|
1078
|
+
}
|
|
1079
|
+
function findIndex(arr, prop, value) {
|
|
1080
|
+
if (Array.prototype.findIndex) {
|
|
1081
|
+
return arr.findIndex(function (cur) {
|
|
1082
|
+
return cur[prop] === value;
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
var match = find(arr, function (obj) {
|
|
1086
|
+
return obj[prop] === value;
|
|
1087
|
+
});
|
|
1088
|
+
return arr.indexOf(match);
|
|
1089
|
+
}
|
|
1090
|
+
function runModifiers(modifiers, data, ends) {
|
|
1091
|
+
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
|
|
1092
|
+
modifiersToRun.forEach(function (modifier) {
|
|
1093
|
+
if (modifier['function']) {
|
|
1094
|
+
console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
|
|
1095
|
+
}
|
|
1096
|
+
var fn = modifier['function'] || modifier.fn;
|
|
1097
|
+
if (modifier.enabled && isFunction(fn)) {
|
|
1098
|
+
data.offsets.popper = getClientRect(data.offsets.popper);
|
|
1099
|
+
data.offsets.reference = getClientRect(data.offsets.reference);
|
|
1100
|
+
data = fn(data, modifier);
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
return data;
|
|
1104
|
+
}
|
|
1105
|
+
function _update() {
|
|
1106
|
+
if (this.state.isDestroyed) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
var data = {
|
|
1110
|
+
instance: this,
|
|
1111
|
+
styles: {},
|
|
1112
|
+
arrowStyles: {},
|
|
1113
|
+
attributes: {},
|
|
1114
|
+
flipped: false,
|
|
1115
|
+
offsets: {}
|
|
1116
|
+
};
|
|
1117
|
+
data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
|
|
1118
|
+
data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
|
|
1119
|
+
data.originalPlacement = data.placement;
|
|
1120
|
+
data.positionFixed = this.options.positionFixed;
|
|
1121
|
+
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
|
|
1122
|
+
data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
|
|
1123
|
+
data = runModifiers(this.modifiers, data);
|
|
1124
|
+
if (!this.state.isCreated) {
|
|
1125
|
+
this.state.isCreated = true;
|
|
1126
|
+
this.options.onCreate(data);
|
|
1127
|
+
} else {
|
|
1128
|
+
this.options.onUpdate(data);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
function isModifierEnabled(modifiers, modifierName) {
|
|
1132
|
+
return modifiers.some(function (_ref3) {
|
|
1133
|
+
var name = _ref3.name,
|
|
1134
|
+
enabled = _ref3.enabled;
|
|
1135
|
+
return enabled && name === modifierName;
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
function getSupportedPropertyName(property) {
|
|
1139
|
+
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
|
|
1140
|
+
var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
|
|
1141
|
+
for (var _i = 0; _i < prefixes.length; _i++) {
|
|
1142
|
+
var prefix = prefixes[_i];
|
|
1143
|
+
var toCheck = prefix ? "".concat(prefix).concat(upperProp) : property;
|
|
1144
|
+
if (typeof document.body.style[toCheck] !== 'undefined') {
|
|
1145
|
+
return toCheck;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
function _destroy() {
|
|
1151
|
+
this.state.isDestroyed = true;
|
|
1152
|
+
if (isModifierEnabled(this.modifiers, 'applyStyle')) {
|
|
1153
|
+
this.popper.removeAttribute('x-placement');
|
|
1154
|
+
this.popper.style.position = '';
|
|
1155
|
+
this.popper.style.top = '';
|
|
1156
|
+
this.popper.style.left = '';
|
|
1157
|
+
this.popper.style.right = '';
|
|
1158
|
+
this.popper.style.bottom = '';
|
|
1159
|
+
this.popper.style.willChange = '';
|
|
1160
|
+
this.popper.style[getSupportedPropertyName('transform')] = '';
|
|
1161
|
+
}
|
|
1162
|
+
this.disableEventListeners();
|
|
1163
|
+
if (this.options.removeOnDestroy) {
|
|
1164
|
+
this.popper.parentNode.removeChild(this.popper);
|
|
1165
|
+
}
|
|
1166
|
+
return this;
|
|
1167
|
+
}
|
|
1168
|
+
function getWindow(element) {
|
|
1169
|
+
var ownerDocument = element.ownerDocument;
|
|
1170
|
+
return ownerDocument ? ownerDocument.defaultView : window;
|
|
1171
|
+
}
|
|
1172
|
+
function attachToScrollParents(scrollParent, event, callback, scrollParents) {
|
|
1173
|
+
var isBody = scrollParent.nodeName === 'BODY';
|
|
1174
|
+
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
|
|
1175
|
+
target.addEventListener(event, callback, {
|
|
1176
|
+
passive: true
|
|
1177
|
+
});
|
|
1178
|
+
if (!isBody) {
|
|
1179
|
+
attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
|
|
1180
|
+
}
|
|
1181
|
+
scrollParents.push(target);
|
|
1182
|
+
}
|
|
1183
|
+
function setupEventListeners(reference, options, state, updateBound) {
|
|
1184
|
+
state.updateBound = updateBound;
|
|
1185
|
+
getWindow(reference).addEventListener('resize', state.updateBound, {
|
|
1186
|
+
passive: true
|
|
1187
|
+
});
|
|
1188
|
+
var scrollElement = getScrollParent(reference);
|
|
1189
|
+
attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
|
|
1190
|
+
state.scrollElement = scrollElement;
|
|
1191
|
+
state.eventsEnabled = true;
|
|
1192
|
+
return state;
|
|
1193
|
+
}
|
|
1194
|
+
function _enableEventListeners() {
|
|
1195
|
+
if (!this.state.eventsEnabled) {
|
|
1196
|
+
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
function removeEventListeners(reference, state) {
|
|
1200
|
+
getWindow(reference).removeEventListener('resize', state.updateBound);
|
|
1201
|
+
state.scrollParents.forEach(function (target) {
|
|
1202
|
+
target.removeEventListener('scroll', state.updateBound);
|
|
1203
|
+
});
|
|
1204
|
+
state.updateBound = null;
|
|
1205
|
+
state.scrollParents = [];
|
|
1206
|
+
state.scrollElement = null;
|
|
1207
|
+
state.eventsEnabled = false;
|
|
1208
|
+
return state;
|
|
1209
|
+
}
|
|
1210
|
+
function _disableEventListeners() {
|
|
1211
|
+
if (this.state.eventsEnabled) {
|
|
1212
|
+
cancelAnimationFrame(this.scheduleUpdate);
|
|
1213
|
+
this.state = removeEventListeners(this.reference, this.state);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
function isNumeric(n) {
|
|
1217
|
+
return n !== '' && !isNaN(_parseFloat$2(n)) && isFinite(n);
|
|
1218
|
+
}
|
|
1219
|
+
function setStyles(element, styles) {
|
|
1220
|
+
keys$1(styles).forEach(function (prop) {
|
|
1221
|
+
var unit = '';
|
|
1222
|
+
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
|
1223
|
+
unit = 'px';
|
|
1224
|
+
}
|
|
1225
|
+
element.style[prop] = styles[prop] + unit;
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
function setAttributes(element, attributes) {
|
|
1229
|
+
keys$1(attributes).forEach(function (prop) {
|
|
1230
|
+
var value = attributes[prop];
|
|
1231
|
+
if (value !== false) {
|
|
1232
|
+
element.setAttribute(prop, attributes[prop]);
|
|
1233
|
+
} else {
|
|
1234
|
+
element.removeAttribute(prop);
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
function applyStyle(data) {
|
|
1239
|
+
setStyles(data.instance.popper, data.styles);
|
|
1240
|
+
setAttributes(data.instance.popper, data.attributes);
|
|
1241
|
+
if (data.arrowElement && keys$1(data.arrowStyles).length) {
|
|
1242
|
+
setStyles(data.arrowElement, data.arrowStyles);
|
|
1243
|
+
}
|
|
1244
|
+
return data;
|
|
1245
|
+
}
|
|
1246
|
+
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
|
|
1247
|
+
var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
|
|
1248
|
+
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
|
|
1249
|
+
popper.setAttribute('x-placement', placement);
|
|
1250
|
+
setStyles(popper, {
|
|
1251
|
+
position: options.positionFixed ? 'fixed' : 'absolute'
|
|
1252
|
+
});
|
|
1253
|
+
return options;
|
|
1254
|
+
}
|
|
1255
|
+
function getRoundedOffsets(data, shouldRound) {
|
|
1256
|
+
var _data$offsets = data.offsets,
|
|
1257
|
+
popper = _data$offsets.popper,
|
|
1258
|
+
reference = _data$offsets.reference;
|
|
1259
|
+
var round = Math.round,
|
|
1260
|
+
floor = Math.floor;
|
|
1261
|
+
var noRound = function noRound(v) {
|
|
1262
|
+
return v;
|
|
1263
|
+
};
|
|
1264
|
+
var referenceWidth = round(reference.width);
|
|
1265
|
+
var popperWidth = round(popper.width);
|
|
1266
|
+
var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
|
|
1267
|
+
var isVariation = data.placement.indexOf('-') !== -1;
|
|
1268
|
+
var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
|
|
1269
|
+
var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
|
|
1270
|
+
var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
|
|
1271
|
+
var verticalToInteger = !shouldRound ? noRound : round;
|
|
1272
|
+
return {
|
|
1273
|
+
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
|
|
1274
|
+
top: verticalToInteger(popper.top),
|
|
1275
|
+
bottom: verticalToInteger(popper.bottom),
|
|
1276
|
+
right: horizontalToInteger(popper.right)
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
|
|
1280
|
+
function computeStyle(data, options) {
|
|
1281
|
+
var x = options.x,
|
|
1282
|
+
y = options.y;
|
|
1283
|
+
var popper = data.offsets.popper;
|
|
1284
|
+
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
|
|
1285
|
+
return modifier.name === 'applyStyle';
|
|
1286
|
+
}).gpuAcceleration;
|
|
1287
|
+
if (legacyGpuAccelerationOption !== undefined) {
|
|
1288
|
+
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
|
|
1289
|
+
}
|
|
1290
|
+
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
|
|
1291
|
+
var offsetParent = getOffsetParent(data.instance.popper);
|
|
1292
|
+
var offsetParentRect = getBoundingClientRect(offsetParent);
|
|
1293
|
+
var styles = {
|
|
1294
|
+
position: popper.position
|
|
1295
|
+
};
|
|
1296
|
+
var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
|
|
1297
|
+
var sideA = x === 'bottom' ? 'top' : 'bottom';
|
|
1298
|
+
var sideB = y === 'right' ? 'left' : 'right';
|
|
1299
|
+
var prefixedProperty = getSupportedPropertyName('transform');
|
|
1300
|
+
var left, top;
|
|
1301
|
+
if (sideA === 'bottom') {
|
|
1302
|
+
if (offsetParent.nodeName === 'HTML') {
|
|
1303
|
+
top = -offsetParent.clientHeight + offsets.bottom;
|
|
1304
|
+
} else {
|
|
1305
|
+
top = -offsetParentRect.height + offsets.bottom;
|
|
1306
|
+
}
|
|
1307
|
+
} else {
|
|
1308
|
+
top = offsets.top;
|
|
1309
|
+
}
|
|
1310
|
+
if (sideB === 'right') {
|
|
1311
|
+
if (offsetParent.nodeName === 'HTML') {
|
|
1312
|
+
left = -offsetParent.clientWidth + offsets.right;
|
|
1313
|
+
} else {
|
|
1314
|
+
left = -offsetParentRect.width + offsets.right;
|
|
1315
|
+
}
|
|
1316
|
+
} else {
|
|
1317
|
+
left = offsets.left;
|
|
1318
|
+
}
|
|
1319
|
+
if (gpuAcceleration && prefixedProperty) {
|
|
1320
|
+
styles[prefixedProperty] = "translate3d(".concat(left, "px, ").concat(top, "px, 0)");
|
|
1321
|
+
styles[sideA] = 0;
|
|
1322
|
+
styles[sideB] = 0;
|
|
1323
|
+
} else {
|
|
1324
|
+
var invertTop = sideA === 'bottom' ? -1 : 1;
|
|
1325
|
+
var invertLeft = sideB === 'right' ? -1 : 1;
|
|
1326
|
+
styles[sideA] = top * invertTop;
|
|
1327
|
+
styles[sideB] = left * invertLeft;
|
|
1328
|
+
}
|
|
1329
|
+
var attributes = {
|
|
1330
|
+
'x-placement': data.placement
|
|
1331
|
+
};
|
|
1332
|
+
data.attributes = _extends$1({}, attributes, data.attributes);
|
|
1333
|
+
data.styles = _extends$1({}, styles, data.styles);
|
|
1334
|
+
data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles);
|
|
1335
|
+
return data;
|
|
1336
|
+
}
|
|
1337
|
+
function isModifierRequired(modifiers, requestingName, requestedName) {
|
|
1338
|
+
var requesting = find(modifiers, function (_ref4) {
|
|
1339
|
+
var name = _ref4.name;
|
|
1340
|
+
return name === requestingName;
|
|
1341
|
+
});
|
|
1342
|
+
var isRequired = !!requesting && modifiers.some(function (modifier) {
|
|
1343
|
+
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
|
|
1344
|
+
});
|
|
1345
|
+
if (!isRequired) {
|
|
1346
|
+
var _requesting = "`".concat(requestingName, "`");
|
|
1347
|
+
var requested = "`".concat(requestedName, "`");
|
|
1348
|
+
console.warn("".concat(requested, " modifier is required by ").concat(_requesting, " modifier in order to work, be sure to include it before ").concat(_requesting, "!"));
|
|
1349
|
+
}
|
|
1350
|
+
return isRequired;
|
|
1351
|
+
}
|
|
1352
|
+
function arrow(data, options) {
|
|
1353
|
+
var _data$offsets$arrow;
|
|
1354
|
+
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
|
|
1355
|
+
return data;
|
|
1356
|
+
}
|
|
1357
|
+
var arrowElement = options.element;
|
|
1358
|
+
if (typeof arrowElement === 'string') {
|
|
1359
|
+
arrowElement = data.instance.popper.querySelector(arrowElement);
|
|
1360
|
+
if (!arrowElement) {
|
|
1361
|
+
return data;
|
|
1362
|
+
}
|
|
1363
|
+
} else {
|
|
1364
|
+
if (!data.instance.popper.contains(arrowElement)) {
|
|
1365
|
+
console.warn('WARNING: `arrow.element` must be child of its popper element!');
|
|
1366
|
+
return data;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
var placement = data.placement.split('-')[0];
|
|
1370
|
+
var _data$offsets2 = data.offsets,
|
|
1371
|
+
popper = _data$offsets2.popper,
|
|
1372
|
+
reference = _data$offsets2.reference;
|
|
1373
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
1374
|
+
var len = isVertical ? 'height' : 'width';
|
|
1375
|
+
var sideCapitalized = isVertical ? 'Top' : 'Left';
|
|
1376
|
+
var side = sideCapitalized.toLowerCase();
|
|
1377
|
+
var altSide = isVertical ? 'left' : 'top';
|
|
1378
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
|
1379
|
+
var arrowElementSize = getOuterSizes(arrowElement)[len];
|
|
1380
|
+
if (reference[opSide] - arrowElementSize < popper[side]) {
|
|
1381
|
+
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
|
|
1382
|
+
}
|
|
1383
|
+
if (reference[side] + arrowElementSize > popper[opSide]) {
|
|
1384
|
+
data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
|
|
1385
|
+
}
|
|
1386
|
+
data.offsets.popper = getClientRect(data.offsets.popper);
|
|
1387
|
+
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
|
|
1388
|
+
var css = getStyleComputedProperty(data.instance.popper);
|
|
1389
|
+
var popperMarginSide = _parseFloat$2(css["margin".concat(sideCapitalized)], 10);
|
|
1390
|
+
var popperBorderSide = _parseFloat$2(css["border".concat(sideCapitalized, "Width")], 10);
|
|
1391
|
+
var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
|
|
1392
|
+
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
|
|
1393
|
+
data.arrowElement = arrowElement;
|
|
1394
|
+
data.offsets.arrow = (_data$offsets$arrow = {}, _defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), _defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
|
|
1395
|
+
return data;
|
|
1396
|
+
}
|
|
1397
|
+
function getOppositeVariation(variation) {
|
|
1398
|
+
if (variation === 'end') {
|
|
1399
|
+
return 'start';
|
|
1400
|
+
} else if (variation === 'start') {
|
|
1401
|
+
return 'end';
|
|
1402
|
+
}
|
|
1403
|
+
return variation;
|
|
1404
|
+
}
|
|
1405
|
+
var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
|
1406
|
+
var validPlacements = placements.slice(3);
|
|
1407
|
+
function clockwise(placement) {
|
|
1408
|
+
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1409
|
+
var index = validPlacements.indexOf(placement);
|
|
1410
|
+
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
|
|
1411
|
+
return counter ? arr.reverse() : arr;
|
|
1412
|
+
}
|
|
1413
|
+
var BEHAVIORS = {
|
|
1414
|
+
FLIP: 'flip',
|
|
1415
|
+
CLOCKWISE: 'clockwise',
|
|
1416
|
+
COUNTERCLOCKWISE: 'counterclockwise'
|
|
1417
|
+
};
|
|
1418
|
+
function flip(data, options) {
|
|
1419
|
+
if (isModifierEnabled(data.instance.modifiers, 'inner')) {
|
|
1420
|
+
return data;
|
|
1421
|
+
}
|
|
1422
|
+
if (data.flipped && data.placement === data.originalPlacement) {
|
|
1423
|
+
return data;
|
|
1424
|
+
}
|
|
1425
|
+
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
|
|
1426
|
+
var placement = data.placement.split('-')[0];
|
|
1427
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
1428
|
+
var variation = data.placement.split('-')[1] || '';
|
|
1429
|
+
var flipOrder = [];
|
|
1430
|
+
switch (options.behavior) {
|
|
1431
|
+
case BEHAVIORS.FLIP:
|
|
1432
|
+
flipOrder = [placement, placementOpposite];
|
|
1433
|
+
break;
|
|
1434
|
+
case BEHAVIORS.CLOCKWISE:
|
|
1435
|
+
flipOrder = clockwise(placement);
|
|
1436
|
+
break;
|
|
1437
|
+
case BEHAVIORS.COUNTERCLOCKWISE:
|
|
1438
|
+
flipOrder = clockwise(placement, true);
|
|
1439
|
+
break;
|
|
1440
|
+
default:
|
|
1441
|
+
flipOrder = options.behavior;
|
|
1442
|
+
}
|
|
1443
|
+
flipOrder.forEach(function (step, index) {
|
|
1444
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
1445
|
+
return data;
|
|
1446
|
+
}
|
|
1447
|
+
placement = data.placement.split('-')[0];
|
|
1448
|
+
placementOpposite = getOppositePlacement(placement);
|
|
1449
|
+
var popperOffsets = data.offsets.popper;
|
|
1450
|
+
var refOffsets = data.offsets.reference;
|
|
1451
|
+
var floor = Math.floor;
|
|
1452
|
+
var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
|
|
1453
|
+
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
|
|
1454
|
+
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
|
|
1455
|
+
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
|
|
1456
|
+
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
|
|
1457
|
+
var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
|
|
1458
|
+
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
|
1459
|
+
var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
|
|
1460
|
+
var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
|
|
1461
|
+
var flippedVariation = flippedVariationByRef || flippedVariationByContent;
|
|
1462
|
+
if (overlapsRef || overflowsBoundaries || flippedVariation) {
|
|
1463
|
+
data.flipped = true;
|
|
1464
|
+
if (overlapsRef || overflowsBoundaries) {
|
|
1465
|
+
placement = flipOrder[index + 1];
|
|
1466
|
+
}
|
|
1467
|
+
if (flippedVariation) {
|
|
1468
|
+
variation = getOppositeVariation(variation);
|
|
1469
|
+
}
|
|
1470
|
+
data.placement = placement + (variation ? '-' + variation : '');
|
|
1471
|
+
data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
|
|
1472
|
+
data = runModifiers(data.instance.modifiers, data, 'flip');
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
return data;
|
|
1476
|
+
}
|
|
1477
|
+
function keepTogether(data) {
|
|
1478
|
+
var _data$offsets3 = data.offsets,
|
|
1479
|
+
popper = _data$offsets3.popper,
|
|
1480
|
+
reference = _data$offsets3.reference;
|
|
1481
|
+
var placement = data.placement.split('-')[0];
|
|
1482
|
+
var floor = Math.floor;
|
|
1483
|
+
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
|
1484
|
+
var side = isVertical ? 'right' : 'bottom';
|
|
1485
|
+
var opSide = isVertical ? 'left' : 'top';
|
|
1486
|
+
var measurement = isVertical ? 'width' : 'height';
|
|
1487
|
+
if (popper[side] < floor(reference[opSide])) {
|
|
1488
|
+
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
|
|
1489
|
+
}
|
|
1490
|
+
if (popper[opSide] > floor(reference[side])) {
|
|
1491
|
+
data.offsets.popper[opSide] = floor(reference[side]);
|
|
1492
|
+
}
|
|
1493
|
+
return data;
|
|
1494
|
+
}
|
|
1495
|
+
function toValue(str, measurement, popperOffsets, referenceOffsets) {
|
|
1496
|
+
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
|
|
1497
|
+
var value = +split[1];
|
|
1498
|
+
var unit = split[2];
|
|
1499
|
+
if (!value) {
|
|
1500
|
+
return str;
|
|
1501
|
+
}
|
|
1502
|
+
if (unit.indexOf('%') === 0) {
|
|
1503
|
+
var element;
|
|
1504
|
+
switch (unit) {
|
|
1505
|
+
case '%p':
|
|
1506
|
+
element = popperOffsets;
|
|
1507
|
+
break;
|
|
1508
|
+
case '%':
|
|
1509
|
+
case '%r':
|
|
1510
|
+
default:
|
|
1511
|
+
element = referenceOffsets;
|
|
1512
|
+
}
|
|
1513
|
+
var rect = getClientRect(element);
|
|
1514
|
+
return rect[measurement] / 100 * value;
|
|
1515
|
+
} else if (unit === 'vh' || unit === 'vw') {
|
|
1516
|
+
var size;
|
|
1517
|
+
if (unit === 'vh') {
|
|
1518
|
+
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
1519
|
+
} else {
|
|
1520
|
+
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
1521
|
+
}
|
|
1522
|
+
return size / 100 * value;
|
|
1523
|
+
} else {
|
|
1524
|
+
return value;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
|
|
1528
|
+
var offsets = [0, 0];
|
|
1529
|
+
var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
|
|
1530
|
+
var fragments = offset.split(/(\+|\-)/).map(function (frag) {
|
|
1531
|
+
return frag.trim();
|
|
1532
|
+
});
|
|
1533
|
+
var divider = fragments.indexOf(find(fragments, function (frag) {
|
|
1534
|
+
return frag.search(/,|\s/) !== -1;
|
|
1535
|
+
}));
|
|
1536
|
+
if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
|
|
1537
|
+
console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
|
|
1538
|
+
}
|
|
1539
|
+
var splitRegex = /\s*,\s*|\s+/;
|
|
1540
|
+
var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
|
|
1541
|
+
ops = ops.map(function (op, index) {
|
|
1542
|
+
var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
|
|
1543
|
+
var mergeWithPrevious = false;
|
|
1544
|
+
return op
|
|
1545
|
+
.reduce(function (a, b) {
|
|
1546
|
+
if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
|
|
1547
|
+
a[a.length - 1] = b;
|
|
1548
|
+
mergeWithPrevious = true;
|
|
1549
|
+
return a;
|
|
1550
|
+
} else if (mergeWithPrevious) {
|
|
1551
|
+
a[a.length - 1] += b;
|
|
1552
|
+
mergeWithPrevious = false;
|
|
1553
|
+
return a;
|
|
1554
|
+
} else {
|
|
1555
|
+
return a.concat(b);
|
|
1556
|
+
}
|
|
1557
|
+
}, [])
|
|
1558
|
+
.map(function (str) {
|
|
1559
|
+
return toValue(str, measurement, popperOffsets, referenceOffsets);
|
|
1560
|
+
});
|
|
1561
|
+
});
|
|
1562
|
+
ops.forEach(function (op, index) {
|
|
1563
|
+
op.forEach(function (frag, index2) {
|
|
1564
|
+
if (isNumeric(frag)) {
|
|
1565
|
+
offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
});
|
|
1569
|
+
return offsets;
|
|
1570
|
+
}
|
|
1571
|
+
function offset(data, _ref5) {
|
|
1572
|
+
var offset = _ref5.offset;
|
|
1573
|
+
var placement = data.placement,
|
|
1574
|
+
_data$offsets4 = data.offsets,
|
|
1575
|
+
popper = _data$offsets4.popper,
|
|
1576
|
+
reference = _data$offsets4.reference;
|
|
1577
|
+
var basePlacement = placement.split('-')[0];
|
|
1578
|
+
var offsets;
|
|
1579
|
+
if (isNumeric(+offset)) {
|
|
1580
|
+
offsets = [+offset, 0];
|
|
1581
|
+
} else {
|
|
1582
|
+
offsets = parseOffset(offset, popper, reference, basePlacement);
|
|
1583
|
+
}
|
|
1584
|
+
if (basePlacement === 'left') {
|
|
1585
|
+
popper.top += offsets[0];
|
|
1586
|
+
popper.left -= offsets[1];
|
|
1587
|
+
} else if (basePlacement === 'right') {
|
|
1588
|
+
popper.top += offsets[0];
|
|
1589
|
+
popper.left += offsets[1];
|
|
1590
|
+
} else if (basePlacement === 'top') {
|
|
1591
|
+
popper.left += offsets[0];
|
|
1592
|
+
popper.top -= offsets[1];
|
|
1593
|
+
} else if (basePlacement === 'bottom') {
|
|
1594
|
+
popper.left += offsets[0];
|
|
1595
|
+
popper.top += offsets[1];
|
|
1596
|
+
}
|
|
1597
|
+
data.popper = popper;
|
|
1598
|
+
return data;
|
|
1599
|
+
}
|
|
1600
|
+
function preventOverflow(data, options) {
|
|
1601
|
+
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
|
|
1602
|
+
if (data.instance.reference === boundariesElement) {
|
|
1603
|
+
boundariesElement = getOffsetParent(boundariesElement);
|
|
1604
|
+
}
|
|
1605
|
+
var transformProp = getSupportedPropertyName('transform');
|
|
1606
|
+
var popperStyles = data.instance.popper.style;
|
|
1607
|
+
var top = popperStyles.top,
|
|
1608
|
+
left = popperStyles.left,
|
|
1609
|
+
transform = popperStyles[transformProp];
|
|
1610
|
+
popperStyles.top = '';
|
|
1611
|
+
popperStyles.left = '';
|
|
1612
|
+
popperStyles[transformProp] = '';
|
|
1613
|
+
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
|
|
1614
|
+
popperStyles.top = top;
|
|
1615
|
+
popperStyles.left = left;
|
|
1616
|
+
popperStyles[transformProp] = transform;
|
|
1617
|
+
options.boundaries = boundaries;
|
|
1618
|
+
var order = options.priority;
|
|
1619
|
+
var popper = data.offsets.popper;
|
|
1620
|
+
var check = {
|
|
1621
|
+
primary: function primary(placement) {
|
|
1622
|
+
var value = popper[placement];
|
|
1623
|
+
if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
|
|
1624
|
+
value = Math.max(popper[placement], boundaries[placement]);
|
|
1625
|
+
}
|
|
1626
|
+
return _defineProperty({}, placement, value);
|
|
1627
|
+
},
|
|
1628
|
+
secondary: function secondary(placement) {
|
|
1629
|
+
var mainSide = placement === 'right' ? 'left' : 'top';
|
|
1630
|
+
var value = popper[mainSide];
|
|
1631
|
+
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
|
|
1632
|
+
value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
|
|
1633
|
+
}
|
|
1634
|
+
return _defineProperty({}, mainSide, value);
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
order.forEach(function (placement) {
|
|
1638
|
+
var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
|
|
1639
|
+
popper = _extends$1({}, popper, check[side](placement));
|
|
1640
|
+
});
|
|
1641
|
+
data.offsets.popper = popper;
|
|
1642
|
+
return data;
|
|
1643
|
+
}
|
|
1644
|
+
function shift(data) {
|
|
1645
|
+
var placement = data.placement;
|
|
1646
|
+
var basePlacement = placement.split('-')[0];
|
|
1647
|
+
var shiftvariation = placement.split('-')[1];
|
|
1648
|
+
if (shiftvariation) {
|
|
1649
|
+
var _data$offsets5 = data.offsets,
|
|
1650
|
+
reference = _data$offsets5.reference,
|
|
1651
|
+
popper = _data$offsets5.popper;
|
|
1652
|
+
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
|
|
1653
|
+
var side = isVertical ? 'left' : 'top';
|
|
1654
|
+
var measurement = isVertical ? 'width' : 'height';
|
|
1655
|
+
var shiftOffsets = {
|
|
1656
|
+
start: _defineProperty({}, side, reference[side]),
|
|
1657
|
+
end: _defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
|
|
1658
|
+
};
|
|
1659
|
+
data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]);
|
|
1660
|
+
}
|
|
1661
|
+
return data;
|
|
1662
|
+
}
|
|
1663
|
+
function hide(data) {
|
|
1664
|
+
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
|
|
1665
|
+
return data;
|
|
1666
|
+
}
|
|
1667
|
+
var refRect = data.offsets.reference;
|
|
1668
|
+
var bound = find(data.instance.modifiers, function (modifier) {
|
|
1669
|
+
return modifier.name === 'preventOverflow';
|
|
1670
|
+
}).boundaries;
|
|
1671
|
+
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
|
|
1672
|
+
if (data.hide === true) {
|
|
1673
|
+
return data;
|
|
1674
|
+
}
|
|
1675
|
+
data.hide = true;
|
|
1676
|
+
data.attributes['x-out-of-boundaries'] = '';
|
|
1677
|
+
} else {
|
|
1678
|
+
if (data.hide === false) {
|
|
1679
|
+
return data;
|
|
1680
|
+
}
|
|
1681
|
+
data.hide = false;
|
|
1682
|
+
data.attributes['x-out-of-boundaries'] = false;
|
|
1683
|
+
}
|
|
1684
|
+
return data;
|
|
1685
|
+
}
|
|
1686
|
+
function inner(data) {
|
|
1687
|
+
var placement = data.placement;
|
|
1688
|
+
var basePlacement = placement.split('-')[0];
|
|
1689
|
+
var _data$offsets6 = data.offsets,
|
|
1690
|
+
popper = _data$offsets6.popper,
|
|
1691
|
+
reference = _data$offsets6.reference;
|
|
1692
|
+
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
|
|
1693
|
+
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
|
|
1694
|
+
popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
|
|
1695
|
+
data.placement = getOppositePlacement(placement);
|
|
1696
|
+
data.offsets.popper = getClientRect(popper);
|
|
1697
|
+
return data;
|
|
1698
|
+
}
|
|
1699
|
+
var modifiers = {
|
|
1700
|
+
shift: {
|
|
1701
|
+
order: 100,
|
|
1702
|
+
enabled: true,
|
|
1703
|
+
fn: shift
|
|
1704
|
+
},
|
|
1705
|
+
offset: {
|
|
1706
|
+
order: 200,
|
|
1707
|
+
enabled: true,
|
|
1708
|
+
fn: offset,
|
|
1709
|
+
offset: 0
|
|
1710
|
+
},
|
|
1711
|
+
preventOverflow: {
|
|
1712
|
+
order: 300,
|
|
1713
|
+
enabled: true,
|
|
1714
|
+
fn: preventOverflow,
|
|
1715
|
+
priority: ['left', 'right', 'top', 'bottom'],
|
|
1716
|
+
padding: 5,
|
|
1717
|
+
boundariesElement: 'scrollParent'
|
|
1718
|
+
},
|
|
1719
|
+
keepTogether: {
|
|
1720
|
+
order: 400,
|
|
1721
|
+
enabled: true,
|
|
1722
|
+
fn: keepTogether
|
|
1723
|
+
},
|
|
1724
|
+
arrow: {
|
|
1725
|
+
order: 500,
|
|
1726
|
+
enabled: true,
|
|
1727
|
+
fn: arrow,
|
|
1728
|
+
element: '[x-arrow]'
|
|
1729
|
+
},
|
|
1730
|
+
flip: {
|
|
1731
|
+
order: 600,
|
|
1732
|
+
enabled: true,
|
|
1733
|
+
fn: flip,
|
|
1734
|
+
behavior: 'flip',
|
|
1735
|
+
padding: 5,
|
|
1736
|
+
boundariesElement: 'viewport',
|
|
1737
|
+
flipVariations: false,
|
|
1738
|
+
flipVariationsByContent: false
|
|
1739
|
+
},
|
|
1740
|
+
inner: {
|
|
1741
|
+
order: 700,
|
|
1742
|
+
enabled: false,
|
|
1743
|
+
fn: inner
|
|
1744
|
+
},
|
|
1745
|
+
hide: {
|
|
1746
|
+
order: 800,
|
|
1747
|
+
enabled: true,
|
|
1748
|
+
fn: hide
|
|
1749
|
+
},
|
|
1750
|
+
computeStyle: {
|
|
1751
|
+
order: 850,
|
|
1752
|
+
enabled: true,
|
|
1753
|
+
fn: computeStyle,
|
|
1754
|
+
gpuAcceleration: true,
|
|
1755
|
+
x: 'bottom',
|
|
1756
|
+
y: 'right'
|
|
1757
|
+
},
|
|
1758
|
+
applyStyle: {
|
|
1759
|
+
order: 900,
|
|
1760
|
+
enabled: true,
|
|
1761
|
+
fn: applyStyle,
|
|
1762
|
+
onLoad: applyStyleOnLoad,
|
|
1763
|
+
gpuAcceleration: undefined
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
var Defaults = {
|
|
1767
|
+
placement: 'bottom',
|
|
1768
|
+
positionFixed: false,
|
|
1769
|
+
eventsEnabled: true,
|
|
1770
|
+
removeOnDestroy: false,
|
|
1771
|
+
onCreate: function onCreate() {},
|
|
1772
|
+
onUpdate: function onUpdate() {},
|
|
1773
|
+
modifiers: modifiers
|
|
1774
|
+
};
|
|
1775
|
+
var Popper = function () {
|
|
1776
|
+
function Popper(reference, popper) {
|
|
1777
|
+
var _this = this;
|
|
1778
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1779
|
+
_classCallCheck(this, Popper);
|
|
1780
|
+
this.scheduleUpdate = function () {
|
|
1781
|
+
return requestAnimationFrame(_this.update);
|
|
1782
|
+
};
|
|
1783
|
+
this.update = debounce(this.update.bind(this));
|
|
1784
|
+
this.options = _extends$1({}, Popper.Defaults, options);
|
|
1785
|
+
this.state = {
|
|
1786
|
+
isDestroyed: false,
|
|
1787
|
+
isCreated: false,
|
|
1788
|
+
scrollParents: []
|
|
1789
|
+
};
|
|
1790
|
+
this.reference = reference && reference.jquery ? reference[0] : reference;
|
|
1791
|
+
this.popper = popper && popper.jquery ? popper[0] : popper;
|
|
1792
|
+
this.options.modifiers = {};
|
|
1793
|
+
keys$1(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
|
|
1794
|
+
_this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
|
|
1795
|
+
});
|
|
1796
|
+
this.modifiers = keys$1(this.options.modifiers).map(function (name) {
|
|
1797
|
+
return _extends$1({
|
|
1798
|
+
name: name
|
|
1799
|
+
}, _this.options.modifiers[name]);
|
|
1800
|
+
})
|
|
1801
|
+
.sort(function (a, b) {
|
|
1802
|
+
return a.order - b.order;
|
|
1803
|
+
});
|
|
1804
|
+
this.modifiers.forEach(function (modifierOptions) {
|
|
1805
|
+
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
|
|
1806
|
+
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
this.update();
|
|
1810
|
+
var eventsEnabled = this.options.eventsEnabled;
|
|
1811
|
+
if (eventsEnabled) {
|
|
1812
|
+
this.enableEventListeners();
|
|
1813
|
+
}
|
|
1814
|
+
this.state.eventsEnabled = eventsEnabled;
|
|
1815
|
+
}
|
|
1816
|
+
_createClass(Popper, [{
|
|
1817
|
+
key: "update",
|
|
1818
|
+
value: function update() {
|
|
1819
|
+
return _update.call(this);
|
|
1820
|
+
}
|
|
1821
|
+
}, {
|
|
1822
|
+
key: "destroy",
|
|
1823
|
+
value: function destroy() {
|
|
1824
|
+
return _destroy.call(this);
|
|
1825
|
+
}
|
|
1826
|
+
}, {
|
|
1827
|
+
key: "enableEventListeners",
|
|
1828
|
+
value: function enableEventListeners() {
|
|
1829
|
+
return _enableEventListeners.call(this);
|
|
1830
|
+
}
|
|
1831
|
+
}, {
|
|
1832
|
+
key: "disableEventListeners",
|
|
1833
|
+
value: function disableEventListeners() {
|
|
1834
|
+
return _disableEventListeners.call(this);
|
|
1835
|
+
}
|
|
1836
|
+
}]);
|
|
1837
|
+
return Popper;
|
|
1838
|
+
}();
|
|
1839
|
+
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
|
|
1840
|
+
Popper.placements = placements;
|
|
1841
|
+
Popper.Defaults = Defaults;
|
|
1842
|
+
|
|
1843
|
+
var requestAnimationFrame$2 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) {
|
|
1844
|
+
window.setTimeout(callback, 1000 / 60);
|
|
1845
|
+
};
|
|
1846
|
+
var cancelAnimationFrame$2 = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame || function (id) {
|
|
1847
|
+
window.clearTimeout(id);
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1850
|
+
function _extends$2() {
|
|
1851
|
+
_extends$2 = assign$1 || function (target) {
|
|
1852
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1853
|
+
var source = arguments[i];
|
|
1854
|
+
for (var key in source) {
|
|
1855
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1856
|
+
target[key] = source[key];
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
return target;
|
|
1861
|
+
};
|
|
1862
|
+
return _extends$2.apply(this, arguments);
|
|
1863
|
+
}
|
|
1864
|
+
var version = "4.3.4";
|
|
1865
|
+
var isBrowser$1 = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1866
|
+
var ua = isBrowser$1 ? navigator.userAgent : '';
|
|
1867
|
+
var isIE$1 = /MSIE |Trident\//.test(ua);
|
|
1868
|
+
var isUCBrowser = /UCBrowser\//.test(ua);
|
|
1869
|
+
var isIOS = isBrowser$1 && /iPhone|iPad|iPod/.test(navigator.platform) && !window.MSStream;
|
|
1870
|
+
var defaultProps = {
|
|
1871
|
+
a11y: true,
|
|
1872
|
+
allowHTML: true,
|
|
1873
|
+
animateFill: true,
|
|
1874
|
+
animation: 'shift-away',
|
|
1875
|
+
appendTo: function appendTo() {
|
|
1876
|
+
return document.body;
|
|
1877
|
+
},
|
|
1878
|
+
aria: 'describedby',
|
|
1879
|
+
arrow: false,
|
|
1880
|
+
arrowType: 'sharp',
|
|
1881
|
+
boundary: 'scrollParent',
|
|
1882
|
+
content: '',
|
|
1883
|
+
delay: 0,
|
|
1884
|
+
distance: 10,
|
|
1885
|
+
duration: [325, 275],
|
|
1886
|
+
flip: true,
|
|
1887
|
+
flipBehavior: 'flip',
|
|
1888
|
+
flipOnUpdate: false,
|
|
1889
|
+
followCursor: false,
|
|
1890
|
+
hideOnClick: true,
|
|
1891
|
+
ignoreAttributes: false,
|
|
1892
|
+
inertia: false,
|
|
1893
|
+
interactive: false,
|
|
1894
|
+
interactiveBorder: 2,
|
|
1895
|
+
interactiveDebounce: 0,
|
|
1896
|
+
lazy: true,
|
|
1897
|
+
width: 'auto',
|
|
1898
|
+
maxWidth: 'auto',
|
|
1899
|
+
multiple: false,
|
|
1900
|
+
offset: 0,
|
|
1901
|
+
onHidden: function onHidden() {},
|
|
1902
|
+
onHide: function onHide() {},
|
|
1903
|
+
onMount: function onMount() {},
|
|
1904
|
+
onShow: function onShow() {},
|
|
1905
|
+
onShown: function onShown() {},
|
|
1906
|
+
onTrigger: function onTrigger() {},
|
|
1907
|
+
placement: 'top',
|
|
1908
|
+
popperOptions: {},
|
|
1909
|
+
role: 'tooltip',
|
|
1910
|
+
showOnInit: false,
|
|
1911
|
+
size: 'regular',
|
|
1912
|
+
sticky: false,
|
|
1913
|
+
target: '',
|
|
1914
|
+
theme: 'dark',
|
|
1915
|
+
touch: true,
|
|
1916
|
+
touchHold: false,
|
|
1917
|
+
trigger: 'mouseenter focus',
|
|
1918
|
+
triggerTarget: null,
|
|
1919
|
+
updateDuration: 0,
|
|
1920
|
+
wait: null,
|
|
1921
|
+
zIndex: 9999,
|
|
1922
|
+
extCls: ''
|
|
1923
|
+
};
|
|
1924
|
+
var POPPER_INSTANCE_DEPENDENCIES = ['arrow', 'arrowType', 'boundary', 'distance', 'flip', 'flipBehavior', 'flipOnUpdate', 'offset', 'placement', 'popperOptions'];
|
|
1925
|
+
var elementProto = isBrowser$1 ? Element.prototype : {};
|
|
1926
|
+
var matches = elementProto.matches || elementProto.matchesSelector || elementProto.webkitMatchesSelector || elementProto.mozMatchesSelector || elementProto.msMatchesSelector;
|
|
1927
|
+
function arrayFrom(value) {
|
|
1928
|
+
return [].slice.call(value);
|
|
1929
|
+
}
|
|
1930
|
+
function closest(element, selector) {
|
|
1931
|
+
return closestCallback(element, function (el) {
|
|
1932
|
+
return matches.call(el, selector);
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
function closestCallback(element, callback) {
|
|
1936
|
+
while (element) {
|
|
1937
|
+
if (callback(element)) {
|
|
1938
|
+
return element;
|
|
1939
|
+
}
|
|
1940
|
+
element = element.parentElement;
|
|
1941
|
+
}
|
|
1942
|
+
return null;
|
|
1943
|
+
}
|
|
1944
|
+
var PASSIVE = {
|
|
1945
|
+
passive: true
|
|
1946
|
+
};
|
|
1947
|
+
var PADDING = 4;
|
|
1948
|
+
var PLACEMENT_ATTRIBUTE = 'x-placement';
|
|
1949
|
+
var OUT_OF_BOUNDARIES_ATTRIBUTE = 'x-out-of-boundaries';
|
|
1950
|
+
var IOS_CLASS = "tippy-iOS";
|
|
1951
|
+
var ACTIVE_CLASS = "tippy-active";
|
|
1952
|
+
var POPPER_CLASS = "tippy-popper";
|
|
1953
|
+
var TOOLTIP_CLASS = "tippy-tooltip";
|
|
1954
|
+
var CONTENT_CLASS = "tippy-content";
|
|
1955
|
+
var BACKDROP_CLASS = "tippy-backdrop";
|
|
1956
|
+
var ARROW_CLASS = "tippy-arrow";
|
|
1957
|
+
var ROUND_ARROW_CLASS = "tippy-roundarrow";
|
|
1958
|
+
var POPPER_SELECTOR = ".".concat(POPPER_CLASS);
|
|
1959
|
+
var TOOLTIP_SELECTOR = ".".concat(TOOLTIP_CLASS);
|
|
1960
|
+
var CONTENT_SELECTOR = ".".concat(CONTENT_CLASS);
|
|
1961
|
+
var BACKDROP_SELECTOR = ".".concat(BACKDROP_CLASS);
|
|
1962
|
+
var ARROW_SELECTOR = ".".concat(ARROW_CLASS);
|
|
1963
|
+
var ROUND_ARROW_SELECTOR = ".".concat(ROUND_ARROW_CLASS);
|
|
1964
|
+
var isUsingTouch = false;
|
|
1965
|
+
function onDocumentTouch() {
|
|
1966
|
+
if (isUsingTouch) {
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
isUsingTouch = true;
|
|
1970
|
+
if (isIOS) {
|
|
1971
|
+
document.body.classList.add(IOS_CLASS);
|
|
1972
|
+
}
|
|
1973
|
+
if (window.performance) {
|
|
1974
|
+
document.addEventListener('mousemove', onDocumentMouseMove);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
var lastMouseMoveTime = 0;
|
|
1978
|
+
function onDocumentMouseMove() {
|
|
1979
|
+
var now = performance.now();
|
|
1980
|
+
if (now - lastMouseMoveTime < 20) {
|
|
1981
|
+
isUsingTouch = false;
|
|
1982
|
+
document.removeEventListener('mousemove', onDocumentMouseMove);
|
|
1983
|
+
if (!isIOS) {
|
|
1984
|
+
document.body.classList.remove(IOS_CLASS);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
lastMouseMoveTime = now;
|
|
1988
|
+
}
|
|
1989
|
+
function onWindowBlur() {
|
|
1990
|
+
var _document = document,
|
|
1991
|
+
activeElement = _document.activeElement;
|
|
1992
|
+
if (activeElement && activeElement.blur && activeElement._tippy) {
|
|
1993
|
+
activeElement.blur();
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
function bindGlobalEventListeners() {
|
|
1997
|
+
document.addEventListener('touchstart', onDocumentTouch, PASSIVE);
|
|
1998
|
+
window.addEventListener('blur', onWindowBlur);
|
|
1999
|
+
}
|
|
2000
|
+
var keys$2 = keys$1(defaultProps);
|
|
2001
|
+
function getDataAttributeOptions(reference) {
|
|
2002
|
+
return keys$2.reduce(function (acc, key) {
|
|
2003
|
+
var valueAsString = (reference.getAttribute("data-tippy-".concat(key)) || '').trim();
|
|
2004
|
+
if (!valueAsString) {
|
|
2005
|
+
return acc;
|
|
2006
|
+
}
|
|
2007
|
+
if (key === 'content') {
|
|
2008
|
+
acc[key] = valueAsString;
|
|
2009
|
+
} else {
|
|
2010
|
+
try {
|
|
2011
|
+
acc[key] = JSON.parse(valueAsString);
|
|
2012
|
+
} catch (e) {
|
|
2013
|
+
acc[key] = valueAsString;
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
return acc;
|
|
2017
|
+
}, {});
|
|
2018
|
+
}
|
|
2019
|
+
function polyfillElementPrototypeProperties(virtualReference) {
|
|
2020
|
+
var polyfills = {
|
|
2021
|
+
isVirtual: true,
|
|
2022
|
+
attributes: virtualReference.attributes || {},
|
|
2023
|
+
contains: function contains() {},
|
|
2024
|
+
setAttribute: function setAttribute(key, value) {
|
|
2025
|
+
virtualReference.attributes[key] = value;
|
|
2026
|
+
},
|
|
2027
|
+
getAttribute: function getAttribute(key) {
|
|
2028
|
+
return virtualReference.attributes[key];
|
|
2029
|
+
},
|
|
2030
|
+
removeAttribute: function removeAttribute(key) {
|
|
2031
|
+
delete virtualReference.attributes[key];
|
|
2032
|
+
},
|
|
2033
|
+
hasAttribute: function hasAttribute(key) {
|
|
2034
|
+
return key in virtualReference.attributes;
|
|
2035
|
+
},
|
|
2036
|
+
addEventListener: function addEventListener() {},
|
|
2037
|
+
removeEventListener: function removeEventListener() {},
|
|
2038
|
+
classList: {
|
|
2039
|
+
classNames: {},
|
|
2040
|
+
add: function add(key) {
|
|
2041
|
+
virtualReference.classList.classNames[key] = true;
|
|
2042
|
+
},
|
|
2043
|
+
remove: function remove(key) {
|
|
2044
|
+
delete virtualReference.classList.classNames[key];
|
|
2045
|
+
},
|
|
2046
|
+
contains: function contains(key) {
|
|
2047
|
+
return key in virtualReference.classList.classNames;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
for (var key in polyfills) {
|
|
2052
|
+
virtualReference[key] = polyfills[key];
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
function isBareVirtualElement(value) {
|
|
2056
|
+
return {}.toString.call(value) === '[object Object]' && !value.addEventListener;
|
|
2057
|
+
}
|
|
2058
|
+
function isReferenceElement(value) {
|
|
2059
|
+
return !!value._tippy && !matches.call(value, POPPER_SELECTOR);
|
|
2060
|
+
}
|
|
2061
|
+
function hasOwnProperty$1(obj, key) {
|
|
2062
|
+
return {}.hasOwnProperty.call(obj, key);
|
|
2063
|
+
}
|
|
2064
|
+
function getArrayOfElements(value) {
|
|
2065
|
+
if (isSingular(value)) {
|
|
2066
|
+
return [value];
|
|
2067
|
+
}
|
|
2068
|
+
if (value instanceof NodeList) {
|
|
2069
|
+
return arrayFrom(value);
|
|
2070
|
+
}
|
|
2071
|
+
if (isArray$1(value)) {
|
|
2072
|
+
return value;
|
|
2073
|
+
}
|
|
2074
|
+
try {
|
|
2075
|
+
return arrayFrom(document.querySelectorAll(value));
|
|
2076
|
+
} catch (e) {
|
|
2077
|
+
return [];
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
function getValue(value, index, defaultValue) {
|
|
2081
|
+
if (isArray$1(value)) {
|
|
2082
|
+
var v = value[index];
|
|
2083
|
+
return v == null ? defaultValue : v;
|
|
2084
|
+
}
|
|
2085
|
+
return value;
|
|
2086
|
+
}
|
|
2087
|
+
function debounce$1(fn, ms) {
|
|
2088
|
+
if (ms === 0) {
|
|
2089
|
+
return fn;
|
|
2090
|
+
}
|
|
2091
|
+
var timeout;
|
|
2092
|
+
return function (arg) {
|
|
2093
|
+
clearTimeout(timeout);
|
|
2094
|
+
timeout = setTimeout(function () {
|
|
2095
|
+
fn(arg);
|
|
2096
|
+
}, ms);
|
|
2097
|
+
};
|
|
2098
|
+
}
|
|
2099
|
+
function getModifier(obj, key) {
|
|
2100
|
+
return obj && obj.modifiers && obj.modifiers[key];
|
|
2101
|
+
}
|
|
2102
|
+
function includes(a, b) {
|
|
2103
|
+
return a.indexOf(b) > -1;
|
|
2104
|
+
}
|
|
2105
|
+
function isRealElement(value) {
|
|
2106
|
+
return value instanceof Element;
|
|
2107
|
+
}
|
|
2108
|
+
function isSingular(value) {
|
|
2109
|
+
return !!(value && hasOwnProperty$1(value, 'isVirtual')) || isRealElement(value);
|
|
2110
|
+
}
|
|
2111
|
+
function innerHTML() {
|
|
2112
|
+
return 'innerHTML';
|
|
2113
|
+
}
|
|
2114
|
+
function invokeWithArgsOrReturn(value, args) {
|
|
2115
|
+
return typeof value === 'function' ? value.apply(null, args) : value;
|
|
2116
|
+
}
|
|
2117
|
+
function setFlipModifierEnabled(modifiers, value) {
|
|
2118
|
+
modifiers.filter(function (m) {
|
|
2119
|
+
return m.name === 'flip';
|
|
2120
|
+
})[0].enabled = value;
|
|
2121
|
+
}
|
|
2122
|
+
function canReceiveFocus(element) {
|
|
2123
|
+
return isRealElement(element) ? matches.call(element, 'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]') && !element.hasAttribute('disabled') : true;
|
|
2124
|
+
}
|
|
2125
|
+
function div() {
|
|
2126
|
+
return document.createElement('div');
|
|
2127
|
+
}
|
|
2128
|
+
function setTransitionDuration(els, value) {
|
|
2129
|
+
els.forEach(function (el) {
|
|
2130
|
+
if (el) {
|
|
2131
|
+
el.style.transitionDuration = "".concat(value, "ms");
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
function setVisibilityState(els, state) {
|
|
2136
|
+
els.forEach(function (el) {
|
|
2137
|
+
if (el) {
|
|
2138
|
+
el.setAttribute('data-state', state);
|
|
2139
|
+
}
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
function evaluateProps(reference, props) {
|
|
2143
|
+
var out = _extends$2({}, props, {
|
|
2144
|
+
content: invokeWithArgsOrReturn(props.content, [reference])
|
|
2145
|
+
}, props.ignoreAttributes ? {} : getDataAttributeOptions(reference));
|
|
2146
|
+
if (out.arrow || isUCBrowser) {
|
|
2147
|
+
out.animateFill = false;
|
|
2148
|
+
}
|
|
2149
|
+
return out;
|
|
2150
|
+
}
|
|
2151
|
+
function validateOptions(options, defaultProps) {
|
|
2152
|
+
keys$1(options).forEach(function (option) {
|
|
2153
|
+
if (!hasOwnProperty$1(defaultProps, option)) {
|
|
2154
|
+
throw new Error("[tippy]: `".concat(option, "` is not a valid option"));
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
function setInnerHTML(element, html) {
|
|
2159
|
+
element[innerHTML()] = isRealElement(html) ? html[innerHTML()] : html;
|
|
2160
|
+
}
|
|
2161
|
+
function setContent(contentEl, props) {
|
|
2162
|
+
if (isRealElement(props.content)) {
|
|
2163
|
+
setInnerHTML(contentEl, '');
|
|
2164
|
+
contentEl.appendChild(props.content);
|
|
2165
|
+
} else if (typeof props.content !== 'function') {
|
|
2166
|
+
var key = props.allowHTML ? 'innerHTML' : 'textContent';
|
|
2167
|
+
contentEl[key] = props.content;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
function getChildren(popper) {
|
|
2171
|
+
return {
|
|
2172
|
+
tooltip: popper.querySelector(TOOLTIP_SELECTOR),
|
|
2173
|
+
backdrop: popper.querySelector(BACKDROP_SELECTOR),
|
|
2174
|
+
content: popper.querySelector(CONTENT_SELECTOR),
|
|
2175
|
+
arrow: popper.querySelector(ARROW_SELECTOR) || popper.querySelector(ROUND_ARROW_SELECTOR)
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2178
|
+
function addInertia(tooltip) {
|
|
2179
|
+
tooltip.setAttribute('data-inertia', '');
|
|
2180
|
+
}
|
|
2181
|
+
function removeInertia(tooltip) {
|
|
2182
|
+
tooltip.removeAttribute('data-inertia');
|
|
2183
|
+
}
|
|
2184
|
+
function createArrowElement(arrowType) {
|
|
2185
|
+
var arrow = div();
|
|
2186
|
+
if (arrowType === 'round') {
|
|
2187
|
+
arrow.className = ROUND_ARROW_CLASS;
|
|
2188
|
+
setInnerHTML(arrow, '<svg viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg"><path d="M0 7s2.021-.015 5.253-4.218C6.584 1.051 7.797.007 9 0c1.203-.007 2.416 1.035 3.761 2.782C16.012 7.005 18 7 18 7H0z"/></svg>');
|
|
2189
|
+
} else {
|
|
2190
|
+
arrow.className = ARROW_CLASS;
|
|
2191
|
+
}
|
|
2192
|
+
return arrow;
|
|
2193
|
+
}
|
|
2194
|
+
function createBackdropElement() {
|
|
2195
|
+
var backdrop = div();
|
|
2196
|
+
backdrop.className = BACKDROP_CLASS;
|
|
2197
|
+
backdrop.setAttribute('data-state', 'hidden');
|
|
2198
|
+
return backdrop;
|
|
2199
|
+
}
|
|
2200
|
+
function addInteractive(popper, tooltip) {
|
|
2201
|
+
popper.setAttribute('tabindex', '-1');
|
|
2202
|
+
tooltip.setAttribute('data-interactive', '');
|
|
2203
|
+
}
|
|
2204
|
+
function removeInteractive(popper, tooltip) {
|
|
2205
|
+
popper.removeAttribute('tabindex');
|
|
2206
|
+
tooltip.removeAttribute('data-interactive');
|
|
2207
|
+
}
|
|
2208
|
+
function updateTransitionEndListener(tooltip, action, listener) {
|
|
2209
|
+
var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ? 'webkitTransitionEnd' : 'transitionend';
|
|
2210
|
+
tooltip[action + 'EventListener'](eventName, listener);
|
|
2211
|
+
}
|
|
2212
|
+
function getBasicPlacement(popper) {
|
|
2213
|
+
var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
|
|
2214
|
+
return fullPlacement ? fullPlacement.split('-')[0] : '';
|
|
2215
|
+
}
|
|
2216
|
+
function reflow(popper) {
|
|
2217
|
+
void popper.offsetHeight;
|
|
2218
|
+
}
|
|
2219
|
+
function updateTheme(tooltip, action, theme) {
|
|
2220
|
+
theme.split(' ').forEach(function (themeName) {
|
|
2221
|
+
tooltip.classList[action](themeName + '-theme');
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
function setWidth(tooltip, props, key) {
|
|
2225
|
+
var width = props[key];
|
|
2226
|
+
var parsedWidth = _parseInt$2(width);
|
|
2227
|
+
if (typeof width === 'number') {
|
|
2228
|
+
tooltip.style[key] = width + 'px';
|
|
2229
|
+
} else if (isNaN(parsedWidth)) {
|
|
2230
|
+
tooltip.style[key] = width;
|
|
2231
|
+
} else {
|
|
2232
|
+
tooltip.style[key] = parsedWidth + 'px';
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
function createPopperElement(id, props) {
|
|
2236
|
+
var popper = div();
|
|
2237
|
+
popper.className = POPPER_CLASS + (props.extCls ? " ".concat(props.extCls) : '');
|
|
2238
|
+
popper.id = "tippy-".concat(id);
|
|
2239
|
+
popper.style.zIndex = '' + props.zIndex;
|
|
2240
|
+
popper.style.position = 'absolute';
|
|
2241
|
+
popper.style.top = '0';
|
|
2242
|
+
popper.style.left = '0';
|
|
2243
|
+
if (props.role) {
|
|
2244
|
+
popper.setAttribute('role', props.role);
|
|
2245
|
+
}
|
|
2246
|
+
var tooltip = div();
|
|
2247
|
+
tooltip.className = TOOLTIP_CLASS;
|
|
2248
|
+
setWidth(tooltip, props, 'maxWidth');
|
|
2249
|
+
setWidth(tooltip, props, 'width');
|
|
2250
|
+
tooltip.setAttribute('data-size', props.size);
|
|
2251
|
+
tooltip.setAttribute('data-animation', props.animation);
|
|
2252
|
+
tooltip.setAttribute('data-state', 'hidden');
|
|
2253
|
+
updateTheme(tooltip, 'add', props.theme);
|
|
2254
|
+
var content = div();
|
|
2255
|
+
content.className = CONTENT_CLASS;
|
|
2256
|
+
content.setAttribute('data-state', 'hidden');
|
|
2257
|
+
if (props.interactive) {
|
|
2258
|
+
addInteractive(popper, tooltip);
|
|
2259
|
+
}
|
|
2260
|
+
if (props.arrow) {
|
|
2261
|
+
tooltip.appendChild(createArrowElement(props.arrowType));
|
|
2262
|
+
}
|
|
2263
|
+
if (props.animateFill) {
|
|
2264
|
+
tooltip.appendChild(createBackdropElement());
|
|
2265
|
+
tooltip.setAttribute('data-animatefill', '');
|
|
2266
|
+
}
|
|
2267
|
+
if (props.inertia) {
|
|
2268
|
+
addInertia(tooltip);
|
|
2269
|
+
}
|
|
2270
|
+
setContent(content, props);
|
|
2271
|
+
tooltip.appendChild(content);
|
|
2272
|
+
popper.appendChild(tooltip);
|
|
2273
|
+
return popper;
|
|
2274
|
+
}
|
|
2275
|
+
function updatePopperElement(popper, prevProps, nextProps) {
|
|
2276
|
+
var _getChildren = getChildren(popper),
|
|
2277
|
+
tooltip = _getChildren.tooltip,
|
|
2278
|
+
content = _getChildren.content,
|
|
2279
|
+
backdrop = _getChildren.backdrop,
|
|
2280
|
+
arrow = _getChildren.arrow;
|
|
2281
|
+
popper.style.zIndex = '' + nextProps.zIndex;
|
|
2282
|
+
tooltip.setAttribute('data-size', nextProps.size);
|
|
2283
|
+
tooltip.setAttribute('data-animation', nextProps.animation);
|
|
2284
|
+
tooltip.style.maxWidth = nextProps.maxWidth + (typeof nextProps.maxWidth === 'number' ? 'px' : '');
|
|
2285
|
+
if (nextProps.role) {
|
|
2286
|
+
popper.setAttribute('role', nextProps.role);
|
|
2287
|
+
} else {
|
|
2288
|
+
popper.removeAttribute('role');
|
|
2289
|
+
}
|
|
2290
|
+
if (prevProps.content !== nextProps.content) {
|
|
2291
|
+
setContent(content, nextProps);
|
|
2292
|
+
}
|
|
2293
|
+
if (!prevProps.animateFill && nextProps.animateFill) {
|
|
2294
|
+
tooltip.appendChild(createBackdropElement());
|
|
2295
|
+
tooltip.setAttribute('data-animatefill', '');
|
|
2296
|
+
} else if (prevProps.animateFill && !nextProps.animateFill) {
|
|
2297
|
+
tooltip.removeChild(backdrop);
|
|
2298
|
+
tooltip.removeAttribute('data-animatefill');
|
|
2299
|
+
}
|
|
2300
|
+
if (!prevProps.arrow && nextProps.arrow) {
|
|
2301
|
+
tooltip.appendChild(createArrowElement(nextProps.arrowType));
|
|
2302
|
+
} else if (prevProps.arrow && !nextProps.arrow) {
|
|
2303
|
+
tooltip.removeChild(arrow);
|
|
2304
|
+
}
|
|
2305
|
+
if (prevProps.arrow && nextProps.arrow && prevProps.arrowType !== nextProps.arrowType) {
|
|
2306
|
+
tooltip.replaceChild(createArrowElement(nextProps.arrowType), arrow);
|
|
2307
|
+
}
|
|
2308
|
+
if (!prevProps.interactive && nextProps.interactive) {
|
|
2309
|
+
addInteractive(popper, tooltip);
|
|
2310
|
+
} else if (prevProps.interactive && !nextProps.interactive) {
|
|
2311
|
+
removeInteractive(popper, tooltip);
|
|
2312
|
+
}
|
|
2313
|
+
if (!prevProps.inertia && nextProps.inertia) {
|
|
2314
|
+
addInertia(tooltip);
|
|
2315
|
+
} else if (prevProps.inertia && !nextProps.inertia) {
|
|
2316
|
+
removeInertia(tooltip);
|
|
2317
|
+
}
|
|
2318
|
+
if (prevProps.theme !== nextProps.theme) {
|
|
2319
|
+
updateTheme(tooltip, 'remove', prevProps.theme);
|
|
2320
|
+
updateTheme(tooltip, 'add', nextProps.theme);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
function hideAll() {
|
|
2324
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2325
|
+
excludedReferenceOrInstance = _ref.exclude,
|
|
2326
|
+
duration = _ref.duration;
|
|
2327
|
+
arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {
|
|
2328
|
+
var instance = popper._tippy;
|
|
2329
|
+
if (instance) {
|
|
2330
|
+
var isExcluded = false;
|
|
2331
|
+
if (excludedReferenceOrInstance) {
|
|
2332
|
+
isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : popper === excludedReferenceOrInstance.popper;
|
|
2333
|
+
}
|
|
2334
|
+
if (!isExcluded) {
|
|
2335
|
+
instance.hide(duration);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
function isCursorOutsideInteractiveBorder(popperPlacement, popperRect, event, props) {
|
|
2341
|
+
if (!popperPlacement) {
|
|
2342
|
+
return true;
|
|
2343
|
+
}
|
|
2344
|
+
var x = event.clientX,
|
|
2345
|
+
y = event.clientY;
|
|
2346
|
+
var interactiveBorder = props.interactiveBorder,
|
|
2347
|
+
distance = props.distance;
|
|
2348
|
+
var exceedsTop = popperRect.top - y > (popperPlacement === 'top' ? interactiveBorder + distance : interactiveBorder);
|
|
2349
|
+
var exceedsBottom = y - popperRect.bottom > (popperPlacement === 'bottom' ? interactiveBorder + distance : interactiveBorder);
|
|
2350
|
+
var exceedsLeft = popperRect.left - x > (popperPlacement === 'left' ? interactiveBorder + distance : interactiveBorder);
|
|
2351
|
+
var exceedsRight = x - popperRect.right > (popperPlacement === 'right' ? interactiveBorder + distance : interactiveBorder);
|
|
2352
|
+
return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
|
|
2353
|
+
}
|
|
2354
|
+
function getOffsetDistanceInPx(distance) {
|
|
2355
|
+
return -(distance - 10) + 'px';
|
|
2356
|
+
}
|
|
2357
|
+
var idCounter = 1;
|
|
2358
|
+
var mouseMoveListeners = [];
|
|
2359
|
+
function createTippy(reference, collectionProps) {
|
|
2360
|
+
var props = evaluateProps(reference, collectionProps);
|
|
2361
|
+
if (!props.multiple && reference._tippy) {
|
|
2362
|
+
return null;
|
|
2363
|
+
}
|
|
2364
|
+
var lastTriggerEventType;
|
|
2365
|
+
var lastMouseMoveEvent;
|
|
2366
|
+
var showTimeoutId;
|
|
2367
|
+
var hideTimeoutId;
|
|
2368
|
+
var scheduleHideAnimationFrameId;
|
|
2369
|
+
var isScheduledToShow = false;
|
|
2370
|
+
var isBeingDestroyed = false;
|
|
2371
|
+
var previousPlacement;
|
|
2372
|
+
var wasVisibleDuringPreviousUpdate = false;
|
|
2373
|
+
var hasMountCallbackRun = false;
|
|
2374
|
+
var currentMountCallback;
|
|
2375
|
+
var currentTransitionEndListener;
|
|
2376
|
+
var listeners = [];
|
|
2377
|
+
var currentComputedPadding;
|
|
2378
|
+
var debouncedOnMouseMove = debounce$1(onMouseMove, props.interactiveDebounce);
|
|
2379
|
+
var id = idCounter++;
|
|
2380
|
+
var popper = createPopperElement(id, props);
|
|
2381
|
+
var popperChildren = getChildren(popper);
|
|
2382
|
+
var popperInstance = null;
|
|
2383
|
+
var state = {
|
|
2384
|
+
isEnabled: true,
|
|
2385
|
+
isVisible: false,
|
|
2386
|
+
isDestroyed: false,
|
|
2387
|
+
isMounted: false,
|
|
2388
|
+
isShown: false
|
|
2389
|
+
};
|
|
2390
|
+
var instance = {
|
|
2391
|
+
id: id,
|
|
2392
|
+
reference: reference,
|
|
2393
|
+
popper: popper,
|
|
2394
|
+
popperChildren: popperChildren,
|
|
2395
|
+
popperInstance: popperInstance,
|
|
2396
|
+
props: props,
|
|
2397
|
+
state: state,
|
|
2398
|
+
clearDelayTimeouts: clearDelayTimeouts,
|
|
2399
|
+
set: set,
|
|
2400
|
+
setContent: setContent,
|
|
2401
|
+
show: show,
|
|
2402
|
+
hide: hide,
|
|
2403
|
+
enable: enable,
|
|
2404
|
+
disable: disable,
|
|
2405
|
+
destroy: destroy
|
|
2406
|
+
};
|
|
2407
|
+
reference._tippy = instance;
|
|
2408
|
+
popper._tippy = instance;
|
|
2409
|
+
addTriggersToReference();
|
|
2410
|
+
if (!props.lazy) {
|
|
2411
|
+
createPopperInstance();
|
|
2412
|
+
}
|
|
2413
|
+
if (props.showOnInit) {
|
|
2414
|
+
scheduleShow();
|
|
2415
|
+
}
|
|
2416
|
+
if (props.a11y && !props.target && !canReceiveFocus(getEventListenersTarget())) {
|
|
2417
|
+
getEventListenersTarget().setAttribute('tabindex', '0');
|
|
2418
|
+
}
|
|
2419
|
+
popper.addEventListener('mouseenter', function (event) {
|
|
2420
|
+
if (instance.props.interactive && instance.state.isVisible && lastTriggerEventType === 'mouseenter') {
|
|
2421
|
+
scheduleShow(event, true);
|
|
2422
|
+
}
|
|
2423
|
+
});
|
|
2424
|
+
popper.addEventListener('mouseleave', function () {
|
|
2425
|
+
if (instance.props.interactive && lastTriggerEventType === 'mouseenter') {
|
|
2426
|
+
document.addEventListener('mousemove', debouncedOnMouseMove);
|
|
2427
|
+
}
|
|
2428
|
+
});
|
|
2429
|
+
return instance;
|
|
2430
|
+
function removeFollowCursorListener() {
|
|
2431
|
+
document.removeEventListener('mousemove', positionVirtualReferenceNearCursor);
|
|
2432
|
+
}
|
|
2433
|
+
function cleanupInteractiveMouseListeners() {
|
|
2434
|
+
document.body.removeEventListener('mouseleave', scheduleHide);
|
|
2435
|
+
document.removeEventListener('mousemove', debouncedOnMouseMove);
|
|
2436
|
+
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
|
2437
|
+
return listener !== debouncedOnMouseMove;
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
function getEventListenersTarget() {
|
|
2441
|
+
return instance.props.triggerTarget || reference;
|
|
2442
|
+
}
|
|
2443
|
+
function addDocumentClickListener() {
|
|
2444
|
+
document.addEventListener('click', onDocumentClick, true);
|
|
2445
|
+
}
|
|
2446
|
+
function removeDocumentClickListener() {
|
|
2447
|
+
document.removeEventListener('click', onDocumentClick, true);
|
|
2448
|
+
}
|
|
2449
|
+
function getTransitionableElements() {
|
|
2450
|
+
return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];
|
|
2451
|
+
}
|
|
2452
|
+
function getIsInLooseFollowCursorMode() {
|
|
2453
|
+
var followCursor = instance.props.followCursor;
|
|
2454
|
+
return followCursor && lastTriggerEventType !== 'focus' || isUsingTouch && followCursor === 'initial';
|
|
2455
|
+
}
|
|
2456
|
+
function makeSticky() {
|
|
2457
|
+
setTransitionDuration([popper], isIE$1 ? 0 : instance.props.updateDuration);
|
|
2458
|
+
function updatePosition() {
|
|
2459
|
+
instance.popperInstance.scheduleUpdate();
|
|
2460
|
+
if (instance.state.isMounted) {
|
|
2461
|
+
requestAnimationFrame(updatePosition);
|
|
2462
|
+
} else {
|
|
2463
|
+
setTransitionDuration([popper], 0);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
updatePosition();
|
|
2467
|
+
}
|
|
2468
|
+
function onTransitionedOut(duration, callback) {
|
|
2469
|
+
onTransitionEnd(duration, function () {
|
|
2470
|
+
if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
|
|
2471
|
+
callback();
|
|
2472
|
+
}
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
function onTransitionedIn(duration, callback) {
|
|
2476
|
+
onTransitionEnd(duration, callback);
|
|
2477
|
+
}
|
|
2478
|
+
function onTransitionEnd(duration, callback) {
|
|
2479
|
+
var tooltip = instance.popperChildren.tooltip;
|
|
2480
|
+
function listener(event) {
|
|
2481
|
+
if (event.target === tooltip) {
|
|
2482
|
+
updateTransitionEndListener(tooltip, 'remove', listener);
|
|
2483
|
+
callback();
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
if (duration === 0) {
|
|
2487
|
+
return callback();
|
|
2488
|
+
}
|
|
2489
|
+
updateTransitionEndListener(tooltip, 'remove', currentTransitionEndListener);
|
|
2490
|
+
updateTransitionEndListener(tooltip, 'add', listener);
|
|
2491
|
+
currentTransitionEndListener = listener;
|
|
2492
|
+
}
|
|
2493
|
+
function on(eventType, handler) {
|
|
2494
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2495
|
+
getEventListenersTarget().addEventListener(eventType, handler, options);
|
|
2496
|
+
listeners.push({
|
|
2497
|
+
eventType: eventType,
|
|
2498
|
+
handler: handler,
|
|
2499
|
+
options: options
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
function addTriggersToReference() {
|
|
2503
|
+
if (instance.props.touchHold && !instance.props.target) {
|
|
2504
|
+
on('touchstart', onTrigger, PASSIVE);
|
|
2505
|
+
on('touchend', onMouseLeave, PASSIVE);
|
|
2506
|
+
}
|
|
2507
|
+
instance.props.trigger.trim().split(' ').forEach(function (eventType) {
|
|
2508
|
+
if (eventType === 'manual') {
|
|
2509
|
+
return;
|
|
2510
|
+
}
|
|
2511
|
+
if (!instance.props.target) {
|
|
2512
|
+
on(eventType, onTrigger);
|
|
2513
|
+
switch (eventType) {
|
|
2514
|
+
case 'mouseenter':
|
|
2515
|
+
on('mouseleave', onMouseLeave);
|
|
2516
|
+
break;
|
|
2517
|
+
case 'focus':
|
|
2518
|
+
on(isIE$1 ? 'focusout' : 'blur', onBlur);
|
|
2519
|
+
break;
|
|
2520
|
+
}
|
|
2521
|
+
} else {
|
|
2522
|
+
switch (eventType) {
|
|
2523
|
+
case 'mouseenter':
|
|
2524
|
+
on('mouseover', onDelegateShow);
|
|
2525
|
+
on('mouseout', onDelegateHide);
|
|
2526
|
+
break;
|
|
2527
|
+
case 'focus':
|
|
2528
|
+
on('focusin', onDelegateShow);
|
|
2529
|
+
on('focusout', onDelegateHide);
|
|
2530
|
+
break;
|
|
2531
|
+
case 'click':
|
|
2532
|
+
on(eventType, onDelegateShow);
|
|
2533
|
+
break;
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
function removeTriggersFromReference() {
|
|
2539
|
+
listeners.forEach(function (_ref) {
|
|
2540
|
+
var eventType = _ref.eventType,
|
|
2541
|
+
handler = _ref.handler,
|
|
2542
|
+
options = _ref.options;
|
|
2543
|
+
getEventListenersTarget().removeEventListener(eventType, handler, options);
|
|
2544
|
+
});
|
|
2545
|
+
listeners = [];
|
|
2546
|
+
}
|
|
2547
|
+
function positionVirtualReferenceNearCursor(event) {
|
|
2548
|
+
var _lastMouseMoveEvent = lastMouseMoveEvent = event,
|
|
2549
|
+
x = _lastMouseMoveEvent.clientX,
|
|
2550
|
+
y = _lastMouseMoveEvent.clientY;
|
|
2551
|
+
if (!currentComputedPadding) {
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
var isCursorOverReference = closestCallback(event.target, function (el) {
|
|
2555
|
+
return el === reference;
|
|
2556
|
+
});
|
|
2557
|
+
var rect = reference.getBoundingClientRect();
|
|
2558
|
+
var followCursor = instance.props.followCursor;
|
|
2559
|
+
var isHorizontal = followCursor === 'horizontal';
|
|
2560
|
+
var isVertical = followCursor === 'vertical';
|
|
2561
|
+
var isVerticalPlacement = includes(['top', 'bottom'], getBasicPlacement(popper));
|
|
2562
|
+
var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
|
|
2563
|
+
var isVariation = fullPlacement ? !!fullPlacement.split('-')[1] : false;
|
|
2564
|
+
var size = isVerticalPlacement ? popper.offsetWidth : popper.offsetHeight;
|
|
2565
|
+
var halfSize = size / 2;
|
|
2566
|
+
var verticalIncrease = isVerticalPlacement ? 0 : isVariation ? size : halfSize;
|
|
2567
|
+
var horizontalIncrease = isVerticalPlacement ? isVariation ? size : halfSize : 0;
|
|
2568
|
+
if (isCursorOverReference || !instance.props.interactive) {
|
|
2569
|
+
instance.popperInstance.reference = _extends$2({}, instance.popperInstance.reference, {
|
|
2570
|
+
clientWidth: 0,
|
|
2571
|
+
clientHeight: 0,
|
|
2572
|
+
getBoundingClientRect: function getBoundingClientRect() {
|
|
2573
|
+
return {
|
|
2574
|
+
width: isVerticalPlacement ? size : 0,
|
|
2575
|
+
height: isVerticalPlacement ? 0 : size,
|
|
2576
|
+
top: (isHorizontal ? rect.top : y) - verticalIncrease,
|
|
2577
|
+
bottom: (isHorizontal ? rect.bottom : y) + verticalIncrease,
|
|
2578
|
+
left: (isVertical ? rect.left : x) - horizontalIncrease,
|
|
2579
|
+
right: (isVertical ? rect.right : x) + horizontalIncrease
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
});
|
|
2583
|
+
instance.popperInstance.update();
|
|
2584
|
+
}
|
|
2585
|
+
if (followCursor === 'initial' && instance.state.isVisible) {
|
|
2586
|
+
removeFollowCursorListener();
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
function createDelegateChildTippy(event) {
|
|
2590
|
+
if (event) {
|
|
2591
|
+
var targetEl = closest(event.target, instance.props.target);
|
|
2592
|
+
if (targetEl && !targetEl._tippy) {
|
|
2593
|
+
createTippy(targetEl, _extends$2({}, instance.props, {
|
|
2594
|
+
content: invokeWithArgsOrReturn(collectionProps.content, [targetEl]),
|
|
2595
|
+
appendTo: collectionProps.appendTo,
|
|
2596
|
+
target: '',
|
|
2597
|
+
showOnInit: true
|
|
2598
|
+
}));
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
function onTrigger(event) {
|
|
2603
|
+
if (!instance.state.isEnabled || isEventListenerStopped(event)) {
|
|
2604
|
+
return;
|
|
2605
|
+
}
|
|
2606
|
+
if (!instance.state.isVisible) {
|
|
2607
|
+
lastTriggerEventType = event.type;
|
|
2608
|
+
if (event instanceof MouseEvent) {
|
|
2609
|
+
lastMouseMoveEvent = event;
|
|
2610
|
+
mouseMoveListeners.forEach(function (listener) {
|
|
2611
|
+
return listener(event);
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
if (event.type === 'click' && instance.props.hideOnClick !== false && instance.state.isVisible) {
|
|
2616
|
+
scheduleHide();
|
|
2617
|
+
} else {
|
|
2618
|
+
scheduleShow(event);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
function onMouseMove(event) {
|
|
2622
|
+
var isCursorOverPopper = closest(event.target, POPPER_SELECTOR) === popper;
|
|
2623
|
+
var isCursorOverReference = closestCallback(event.target, function (el) {
|
|
2624
|
+
return el === reference;
|
|
2625
|
+
});
|
|
2626
|
+
if (isCursorOverPopper || isCursorOverReference) {
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
if (isCursorOutsideInteractiveBorder(getBasicPlacement(popper), popper.getBoundingClientRect(), event, instance.props)) {
|
|
2630
|
+
cleanupInteractiveMouseListeners();
|
|
2631
|
+
scheduleHide();
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
function onMouseLeave(event) {
|
|
2635
|
+
if (isEventListenerStopped(event)) {
|
|
2636
|
+
return;
|
|
2637
|
+
}
|
|
2638
|
+
if (instance.props.interactive) {
|
|
2639
|
+
document.body.addEventListener('mouseleave', scheduleHide);
|
|
2640
|
+
document.addEventListener('mousemove', debouncedOnMouseMove);
|
|
2641
|
+
mouseMoveListeners.push(debouncedOnMouseMove);
|
|
2642
|
+
return;
|
|
2643
|
+
}
|
|
2644
|
+
scheduleHide();
|
|
2645
|
+
}
|
|
2646
|
+
function onBlur(event) {
|
|
2647
|
+
if (event.target !== getEventListenersTarget()) {
|
|
2648
|
+
return;
|
|
2649
|
+
}
|
|
2650
|
+
if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
scheduleHide();
|
|
2654
|
+
}
|
|
2655
|
+
function onDelegateShow(event) {
|
|
2656
|
+
if (closest(event.target, instance.props.target)) {
|
|
2657
|
+
scheduleShow(event);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
function onDelegateHide(event) {
|
|
2661
|
+
if (closest(event.target, instance.props.target)) {
|
|
2662
|
+
scheduleHide();
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
function isEventListenerStopped(event) {
|
|
2666
|
+
var supportsTouch = ('ontouchstart' in window);
|
|
2667
|
+
var isTouchEvent = includes(event.type, 'touch');
|
|
2668
|
+
var touchHold = instance.props.touchHold;
|
|
2669
|
+
return supportsTouch && isUsingTouch && touchHold && !isTouchEvent || isUsingTouch && !touchHold && isTouchEvent;
|
|
2670
|
+
}
|
|
2671
|
+
function runMountCallback() {
|
|
2672
|
+
if (!hasMountCallbackRun && currentMountCallback) {
|
|
2673
|
+
hasMountCallbackRun = true;
|
|
2674
|
+
reflow(popper);
|
|
2675
|
+
currentMountCallback();
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
function createPopperInstance() {
|
|
2679
|
+
var popperOptions = instance.props.popperOptions;
|
|
2680
|
+
var _instance$popperChild = instance.popperChildren,
|
|
2681
|
+
tooltip = _instance$popperChild.tooltip,
|
|
2682
|
+
arrow = _instance$popperChild.arrow;
|
|
2683
|
+
var preventOverflowModifier = getModifier(popperOptions, 'preventOverflow');
|
|
2684
|
+
function applyMutations(data) {
|
|
2685
|
+
if (instance.props.flip && !instance.props.flipOnUpdate) {
|
|
2686
|
+
if (data.flipped) {
|
|
2687
|
+
instance.popperInstance.options.placement = data.placement;
|
|
2688
|
+
}
|
|
2689
|
+
setFlipModifierEnabled(instance.popperInstance.modifiers, false);
|
|
2690
|
+
}
|
|
2691
|
+
tooltip.setAttribute(PLACEMENT_ATTRIBUTE, data.placement);
|
|
2692
|
+
if (data.attributes[OUT_OF_BOUNDARIES_ATTRIBUTE] !== false) {
|
|
2693
|
+
tooltip.setAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE, '');
|
|
2694
|
+
} else {
|
|
2695
|
+
tooltip.removeAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE);
|
|
2696
|
+
}
|
|
2697
|
+
if (previousPlacement && previousPlacement !== data.placement && wasVisibleDuringPreviousUpdate) {
|
|
2698
|
+
tooltip.style.transition = 'none';
|
|
2699
|
+
requestAnimationFrame(function () {
|
|
2700
|
+
tooltip.style.transition = '';
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2703
|
+
previousPlacement = data.placement;
|
|
2704
|
+
wasVisibleDuringPreviousUpdate = instance.state.isVisible;
|
|
2705
|
+
var basicPlacement = getBasicPlacement(popper);
|
|
2706
|
+
var styles = tooltip.style;
|
|
2707
|
+
styles.top = styles.bottom = styles.left = styles.right = '';
|
|
2708
|
+
styles[basicPlacement] = getOffsetDistanceInPx(instance.props.distance);
|
|
2709
|
+
var padding = preventOverflowModifier && preventOverflowModifier.padding !== undefined ? preventOverflowModifier.padding : PADDING;
|
|
2710
|
+
var isPaddingNumber = typeof padding === 'number';
|
|
2711
|
+
var computedPadding = _extends$2({
|
|
2712
|
+
top: isPaddingNumber ? padding : padding.top,
|
|
2713
|
+
bottom: isPaddingNumber ? padding : padding.bottom,
|
|
2714
|
+
left: isPaddingNumber ? padding : padding.left,
|
|
2715
|
+
right: isPaddingNumber ? padding : padding.right
|
|
2716
|
+
}, !isPaddingNumber && padding);
|
|
2717
|
+
computedPadding[basicPlacement] = isPaddingNumber ? padding + instance.props.distance : (padding[basicPlacement] || 0) + instance.props.distance;
|
|
2718
|
+
instance.popperInstance.modifiers.filter(function (m) {
|
|
2719
|
+
return m.name === 'preventOverflow';
|
|
2720
|
+
})[0].padding = computedPadding;
|
|
2721
|
+
currentComputedPadding = computedPadding;
|
|
2722
|
+
}
|
|
2723
|
+
var config = _extends$2({
|
|
2724
|
+
eventsEnabled: false,
|
|
2725
|
+
placement: instance.props.placement
|
|
2726
|
+
}, popperOptions, {
|
|
2727
|
+
modifiers: _extends$2({}, popperOptions ? popperOptions.modifiers : {}, {
|
|
2728
|
+
preventOverflow: _extends$2({
|
|
2729
|
+
boundariesElement: instance.props.boundary,
|
|
2730
|
+
padding: PADDING
|
|
2731
|
+
}, preventOverflowModifier),
|
|
2732
|
+
arrow: _extends$2({
|
|
2733
|
+
element: arrow,
|
|
2734
|
+
enabled: !!arrow
|
|
2735
|
+
}, getModifier(popperOptions, 'arrow')),
|
|
2736
|
+
flip: _extends$2({
|
|
2737
|
+
enabled: instance.props.flip,
|
|
2738
|
+
padding: instance.props.distance + PADDING,
|
|
2739
|
+
behavior: instance.props.flipBehavior
|
|
2740
|
+
}, getModifier(popperOptions, 'flip')),
|
|
2741
|
+
offset: _extends$2({
|
|
2742
|
+
offset: instance.props.offset
|
|
2743
|
+
}, getModifier(popperOptions, 'offset'))
|
|
2744
|
+
}),
|
|
2745
|
+
onCreate: function onCreate(data) {
|
|
2746
|
+
applyMutations(data);
|
|
2747
|
+
runMountCallback();
|
|
2748
|
+
if (popperOptions && popperOptions.onCreate) {
|
|
2749
|
+
popperOptions.onCreate(data);
|
|
2750
|
+
}
|
|
2751
|
+
},
|
|
2752
|
+
onUpdate: function onUpdate(data) {
|
|
2753
|
+
applyMutations(data);
|
|
2754
|
+
runMountCallback();
|
|
2755
|
+
if (popperOptions && popperOptions.onUpdate) {
|
|
2756
|
+
popperOptions.onUpdate(data);
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
instance.popperInstance = new Popper(reference, popper, config);
|
|
2761
|
+
}
|
|
2762
|
+
function mount() {
|
|
2763
|
+
hasMountCallbackRun = false;
|
|
2764
|
+
var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
|
|
2765
|
+
if (instance.popperInstance) {
|
|
2766
|
+
setFlipModifierEnabled(instance.popperInstance.modifiers, instance.props.flip);
|
|
2767
|
+
if (!isInLooseFollowCursorMode) {
|
|
2768
|
+
instance.popperInstance.reference = reference;
|
|
2769
|
+
instance.popperInstance.enableEventListeners();
|
|
2770
|
+
}
|
|
2771
|
+
instance.popperInstance.scheduleUpdate();
|
|
2772
|
+
} else {
|
|
2773
|
+
createPopperInstance();
|
|
2774
|
+
if (!isInLooseFollowCursorMode) {
|
|
2775
|
+
instance.popperInstance.enableEventListeners();
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
var appendTo = instance.props.appendTo;
|
|
2779
|
+
var parentNode = appendTo === 'parent' ? reference.parentNode : invokeWithArgsOrReturn(appendTo, [reference]);
|
|
2780
|
+
if (!parentNode.contains(popper)) {
|
|
2781
|
+
parentNode.appendChild(popper);
|
|
2782
|
+
instance.props.onMount(instance);
|
|
2783
|
+
instance.state.isMounted = true;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
function scheduleShow(event, shouldAvoidCallingOnTrigger) {
|
|
2787
|
+
clearDelayTimeouts();
|
|
2788
|
+
if (instance.state.isVisible) {
|
|
2789
|
+
return;
|
|
2790
|
+
}
|
|
2791
|
+
if (instance.props.target) {
|
|
2792
|
+
return createDelegateChildTippy(event);
|
|
2793
|
+
}
|
|
2794
|
+
isScheduledToShow = true;
|
|
2795
|
+
if (event && !shouldAvoidCallingOnTrigger) {
|
|
2796
|
+
instance.props.onTrigger(instance, event);
|
|
2797
|
+
}
|
|
2798
|
+
if (instance.props.wait) {
|
|
2799
|
+
return instance.props.wait(instance, event);
|
|
2800
|
+
}
|
|
2801
|
+
if (getIsInLooseFollowCursorMode() && !instance.state.isMounted) {
|
|
2802
|
+
if (!instance.popperInstance) {
|
|
2803
|
+
createPopperInstance();
|
|
2804
|
+
}
|
|
2805
|
+
document.addEventListener('mousemove', positionVirtualReferenceNearCursor);
|
|
2806
|
+
}
|
|
2807
|
+
addDocumentClickListener();
|
|
2808
|
+
var delay = getValue(instance.props.delay, 0, defaultProps.delay);
|
|
2809
|
+
if (delay) {
|
|
2810
|
+
showTimeoutId = setTimeout(function () {
|
|
2811
|
+
show();
|
|
2812
|
+
}, delay);
|
|
2813
|
+
} else {
|
|
2814
|
+
show();
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
function scheduleHide() {
|
|
2818
|
+
clearDelayTimeouts();
|
|
2819
|
+
if (!instance.state.isVisible) {
|
|
2820
|
+
return removeFollowCursorListener();
|
|
2821
|
+
}
|
|
2822
|
+
isScheduledToShow = false;
|
|
2823
|
+
var delay = getValue(instance.props.delay, 1, defaultProps.delay);
|
|
2824
|
+
if (delay) {
|
|
2825
|
+
hideTimeoutId = setTimeout(function () {
|
|
2826
|
+
if (instance.state.isVisible) {
|
|
2827
|
+
hide();
|
|
2828
|
+
}
|
|
2829
|
+
}, delay);
|
|
2830
|
+
} else {
|
|
2831
|
+
scheduleHideAnimationFrameId = requestAnimationFrame(function () {
|
|
2832
|
+
hide();
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
function onDocumentClick(event) {
|
|
2837
|
+
if (instance.props.interactive && popper.contains(event.target)) {
|
|
2838
|
+
return;
|
|
2839
|
+
}
|
|
2840
|
+
if (getEventListenersTarget().contains(event.target)) {
|
|
2841
|
+
if (isUsingTouch) {
|
|
2842
|
+
return;
|
|
2843
|
+
}
|
|
2844
|
+
if (instance.state.isVisible && includes(instance.props.trigger, 'click')) {
|
|
2845
|
+
return;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
if (instance.props.hideOnClick === true) {
|
|
2849
|
+
clearDelayTimeouts();
|
|
2850
|
+
hide();
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
function enable() {
|
|
2854
|
+
instance.state.isEnabled = true;
|
|
2855
|
+
}
|
|
2856
|
+
function disable() {
|
|
2857
|
+
instance.state.isEnabled = false;
|
|
2858
|
+
}
|
|
2859
|
+
function clearDelayTimeouts() {
|
|
2860
|
+
clearTimeout(showTimeoutId);
|
|
2861
|
+
clearTimeout(hideTimeoutId);
|
|
2862
|
+
cancelAnimationFrame(scheduleHideAnimationFrameId);
|
|
2863
|
+
}
|
|
2864
|
+
function set(options) {
|
|
2865
|
+
options = options || {};
|
|
2866
|
+
validateOptions(options, defaultProps);
|
|
2867
|
+
removeTriggersFromReference();
|
|
2868
|
+
var prevProps = instance.props;
|
|
2869
|
+
var nextProps = evaluateProps(reference, _extends$2({}, instance.props, options, {
|
|
2870
|
+
ignoreAttributes: true
|
|
2871
|
+
}));
|
|
2872
|
+
nextProps.ignoreAttributes = hasOwnProperty$1(options, 'ignoreAttributes') ? options.ignoreAttributes || false : prevProps.ignoreAttributes;
|
|
2873
|
+
instance.props = nextProps;
|
|
2874
|
+
addTriggersToReference();
|
|
2875
|
+
cleanupInteractiveMouseListeners();
|
|
2876
|
+
debouncedOnMouseMove = debounce$1(onMouseMove, nextProps.interactiveDebounce);
|
|
2877
|
+
updatePopperElement(popper, prevProps, nextProps);
|
|
2878
|
+
instance.popperChildren = getChildren(popper);
|
|
2879
|
+
if (instance.popperInstance) {
|
|
2880
|
+
if (POPPER_INSTANCE_DEPENDENCIES.some(function (prop) {
|
|
2881
|
+
return hasOwnProperty$1(options, prop) && options[prop] !== prevProps[prop];
|
|
2882
|
+
})) {
|
|
2883
|
+
instance.popperInstance.destroy();
|
|
2884
|
+
createPopperInstance();
|
|
2885
|
+
if (instance.state.isVisible) {
|
|
2886
|
+
instance.popperInstance.enableEventListeners();
|
|
2887
|
+
}
|
|
2888
|
+
if (instance.props.followCursor && lastMouseMoveEvent) {
|
|
2889
|
+
positionVirtualReferenceNearCursor(lastMouseMoveEvent);
|
|
2890
|
+
}
|
|
2891
|
+
} else {
|
|
2892
|
+
instance.popperInstance.update();
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
function setContent(content) {
|
|
2897
|
+
set({
|
|
2898
|
+
content: content
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
function show() {
|
|
2902
|
+
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 0, defaultProps.duration[1]);
|
|
2903
|
+
if (instance.state.isDestroyed || !instance.state.isEnabled || isUsingTouch && !instance.props.touch) {
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
if (getEventListenersTarget().hasAttribute('disabled')) {
|
|
2907
|
+
return;
|
|
2908
|
+
}
|
|
2909
|
+
if (instance.props.onShow(instance) === false) {
|
|
2910
|
+
return;
|
|
2911
|
+
}
|
|
2912
|
+
addDocumentClickListener();
|
|
2913
|
+
popper.style.visibility = 'visible';
|
|
2914
|
+
instance.state.isVisible = true;
|
|
2915
|
+
if (instance.props.interactive) {
|
|
2916
|
+
getEventListenersTarget().classList.add(ACTIVE_CLASS);
|
|
2917
|
+
}
|
|
2918
|
+
var transitionableElements = getTransitionableElements();
|
|
2919
|
+
setTransitionDuration(transitionableElements.concat(popper), 0);
|
|
2920
|
+
currentMountCallback = function currentMountCallback() {
|
|
2921
|
+
if (!instance.state.isVisible) {
|
|
2922
|
+
return;
|
|
2923
|
+
}
|
|
2924
|
+
var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
|
|
2925
|
+
if (isInLooseFollowCursorMode && lastMouseMoveEvent) {
|
|
2926
|
+
positionVirtualReferenceNearCursor(lastMouseMoveEvent);
|
|
2927
|
+
} else if (!isInLooseFollowCursorMode) {
|
|
2928
|
+
instance.popperInstance.update();
|
|
2929
|
+
}
|
|
2930
|
+
if (instance.popperChildren.backdrop) {
|
|
2931
|
+
instance.popperChildren.content.style.transitionDelay = Math.round(duration / 12) + 'ms';
|
|
2932
|
+
}
|
|
2933
|
+
if (instance.props.sticky) {
|
|
2934
|
+
makeSticky();
|
|
336
2935
|
}
|
|
2936
|
+
setTransitionDuration([popper], instance.props.updateDuration);
|
|
2937
|
+
setTransitionDuration(transitionableElements, duration);
|
|
2938
|
+
setVisibilityState(transitionableElements, 'visible');
|
|
2939
|
+
onTransitionedIn(duration, function () {
|
|
2940
|
+
if (instance.props.aria) {
|
|
2941
|
+
getEventListenersTarget().setAttribute("aria-".concat(instance.props.aria), popper.id);
|
|
2942
|
+
}
|
|
2943
|
+
instance.props.onShown(instance);
|
|
2944
|
+
instance.state.isShown = true;
|
|
2945
|
+
});
|
|
2946
|
+
};
|
|
2947
|
+
mount();
|
|
2948
|
+
}
|
|
2949
|
+
function hide() {
|
|
2950
|
+
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 1, defaultProps.duration[1]);
|
|
2951
|
+
if (instance.state.isDestroyed || !instance.state.isEnabled && !isBeingDestroyed) {
|
|
2952
|
+
return;
|
|
337
2953
|
}
|
|
2954
|
+
if (instance.props.onHide(instance) === false && !isBeingDestroyed) {
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
removeDocumentClickListener();
|
|
2958
|
+
popper.style.visibility = 'hidden';
|
|
2959
|
+
instance.state.isVisible = false;
|
|
2960
|
+
instance.state.isShown = false;
|
|
2961
|
+
wasVisibleDuringPreviousUpdate = false;
|
|
2962
|
+
if (instance.props.interactive) {
|
|
2963
|
+
getEventListenersTarget().classList.remove(ACTIVE_CLASS);
|
|
2964
|
+
}
|
|
2965
|
+
var transitionableElements = getTransitionableElements();
|
|
2966
|
+
setTransitionDuration(transitionableElements, duration);
|
|
2967
|
+
setVisibilityState(transitionableElements, 'hidden');
|
|
2968
|
+
onTransitionedOut(duration, function () {
|
|
2969
|
+
if (!isScheduledToShow) {
|
|
2970
|
+
removeFollowCursorListener();
|
|
2971
|
+
}
|
|
2972
|
+
if (instance.props.aria) {
|
|
2973
|
+
getEventListenersTarget().removeAttribute("aria-".concat(instance.props.aria));
|
|
2974
|
+
}
|
|
2975
|
+
instance.popperInstance.disableEventListeners();
|
|
2976
|
+
instance.popperInstance.options.placement = instance.props.placement;
|
|
2977
|
+
popper.parentNode.removeChild(popper);
|
|
2978
|
+
instance.props.onHidden(instance);
|
|
2979
|
+
instance.state.isMounted = false;
|
|
2980
|
+
});
|
|
338
2981
|
}
|
|
2982
|
+
function destroy(destroyTargetInstances) {
|
|
2983
|
+
if (instance.state.isDestroyed) {
|
|
2984
|
+
return;
|
|
2985
|
+
}
|
|
2986
|
+
isBeingDestroyed = true;
|
|
2987
|
+
if (instance.state.isMounted) {
|
|
2988
|
+
hide(0);
|
|
2989
|
+
}
|
|
2990
|
+
removeTriggersFromReference();
|
|
2991
|
+
delete reference._tippy;
|
|
2992
|
+
var target = instance.props.target;
|
|
2993
|
+
if (target && destroyTargetInstances && isRealElement(reference)) {
|
|
2994
|
+
arrayFrom(reference.querySelectorAll(target)).forEach(function (child) {
|
|
2995
|
+
if (child._tippy) {
|
|
2996
|
+
child._tippy.destroy();
|
|
2997
|
+
}
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
if (instance.popperInstance) {
|
|
3001
|
+
instance.popperInstance.destroy();
|
|
3002
|
+
}
|
|
3003
|
+
isBeingDestroyed = false;
|
|
3004
|
+
instance.state.isDestroyed = true;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
function group(instances) {
|
|
3008
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
3009
|
+
_ref$delay = _ref.delay,
|
|
3010
|
+
delay = _ref$delay === void 0 ? instances[0].props.delay : _ref$delay,
|
|
3011
|
+
_ref$duration = _ref.duration,
|
|
3012
|
+
duration = _ref$duration === void 0 ? 0 : _ref$duration;
|
|
3013
|
+
var isAnyTippyOpen = false;
|
|
3014
|
+
instances.forEach(function (instance) {
|
|
3015
|
+
if (instance._originalProps) {
|
|
3016
|
+
instance.set(instance._originalProps);
|
|
3017
|
+
} else {
|
|
3018
|
+
instance._originalProps = _extends$2({}, instance.props);
|
|
3019
|
+
}
|
|
3020
|
+
});
|
|
3021
|
+
function setIsAnyTippyOpen(value) {
|
|
3022
|
+
isAnyTippyOpen = value;
|
|
3023
|
+
updateInstances();
|
|
3024
|
+
}
|
|
3025
|
+
function onShow(instance) {
|
|
3026
|
+
instance._originalProps.onShow(instance);
|
|
3027
|
+
instances.forEach(function (instance) {
|
|
3028
|
+
instance.set({
|
|
3029
|
+
duration: duration
|
|
3030
|
+
});
|
|
3031
|
+
if (instance.state.isVisible) {
|
|
3032
|
+
instance.hide();
|
|
3033
|
+
}
|
|
3034
|
+
});
|
|
3035
|
+
setIsAnyTippyOpen(true);
|
|
3036
|
+
}
|
|
3037
|
+
function onHide(instance) {
|
|
3038
|
+
instance._originalProps.onHide(instance);
|
|
3039
|
+
setIsAnyTippyOpen(false);
|
|
3040
|
+
}
|
|
3041
|
+
function onShown(instance) {
|
|
3042
|
+
instance._originalProps.onShown(instance);
|
|
3043
|
+
instance.set({
|
|
3044
|
+
duration: instance._originalProps.duration
|
|
3045
|
+
});
|
|
3046
|
+
}
|
|
3047
|
+
function updateInstances() {
|
|
3048
|
+
instances.forEach(function (instance) {
|
|
3049
|
+
instance.set({
|
|
3050
|
+
onShow: onShow,
|
|
3051
|
+
onShown: onShown,
|
|
3052
|
+
onHide: onHide,
|
|
3053
|
+
delay: isAnyTippyOpen ? [0, isArray$1(delay) ? delay[1] : delay] : delay,
|
|
3054
|
+
duration: isAnyTippyOpen ? duration : instance._originalProps.duration
|
|
3055
|
+
});
|
|
3056
|
+
});
|
|
3057
|
+
}
|
|
3058
|
+
updateInstances();
|
|
3059
|
+
}
|
|
3060
|
+
var globalEventListenersBound = false;
|
|
3061
|
+
function tippy(targets, options) {
|
|
3062
|
+
validateOptions(options || {}, defaultProps);
|
|
3063
|
+
if (!globalEventListenersBound) {
|
|
3064
|
+
bindGlobalEventListeners();
|
|
3065
|
+
globalEventListenersBound = true;
|
|
3066
|
+
}
|
|
3067
|
+
var props = _extends$2({}, defaultProps, options);
|
|
3068
|
+
if (isBareVirtualElement(targets)) {
|
|
3069
|
+
polyfillElementPrototypeProperties(targets);
|
|
3070
|
+
}
|
|
3071
|
+
var instances = getArrayOfElements(targets).reduce(function (acc, reference) {
|
|
3072
|
+
var instance = reference && createTippy(reference, props);
|
|
3073
|
+
if (instance) {
|
|
3074
|
+
acc.push(instance);
|
|
3075
|
+
}
|
|
3076
|
+
return acc;
|
|
3077
|
+
}, []);
|
|
3078
|
+
return isSingular(targets) ? instances[0] : instances;
|
|
3079
|
+
}
|
|
3080
|
+
tippy.version = version;
|
|
3081
|
+
tippy.defaults = defaultProps;
|
|
3082
|
+
tippy.setDefaults = function (partialDefaults) {
|
|
3083
|
+
keys$1(partialDefaults).forEach(function (key) {
|
|
3084
|
+
defaultProps[key] = partialDefaults[key];
|
|
3085
|
+
});
|
|
339
3086
|
};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
3087
|
+
tippy.hideAll = hideAll;
|
|
3088
|
+
tippy.group = group;
|
|
3089
|
+
function autoInit() {
|
|
3090
|
+
arrayFrom(document.querySelectorAll('[data-tippy]')).forEach(function (el) {
|
|
3091
|
+
var content = el.getAttribute('data-tippy');
|
|
3092
|
+
if (content) {
|
|
3093
|
+
tippy(el, {
|
|
3094
|
+
content: content
|
|
3095
|
+
});
|
|
3096
|
+
}
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
if (isBrowser$1) {
|
|
3100
|
+
setTimeout(autoInit);
|
|
3101
|
+
}
|
|
3102
|
+
var getValidTippyProps = function getValidTippyProps(props) {
|
|
3103
|
+
var validProps = {};
|
|
3104
|
+
for (var key in props) {
|
|
3105
|
+
if (defaultProps.hasOwnProperty(key)) {
|
|
3106
|
+
validProps[key] = props[key];
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
return validProps;
|
|
346
3110
|
};
|
|
347
|
-
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
3111
|
+
|
|
3112
|
+
var defaultOptions = {
|
|
3113
|
+
duration: 0,
|
|
3114
|
+
arrow: true,
|
|
3115
|
+
size: 'small',
|
|
3116
|
+
trigger: 'mouseenter focus',
|
|
3117
|
+
theme: 'dark',
|
|
3118
|
+
interactive: true,
|
|
3119
|
+
boundary: 'window',
|
|
3120
|
+
content: '',
|
|
3121
|
+
allowHTML: true,
|
|
3122
|
+
extCls: ''
|
|
353
3123
|
};
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
3124
|
+
var validPlacements$1 = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
|
3125
|
+
var createTippy$1 = function createTippy(el, binding) {
|
|
3126
|
+
var value = binding.value;
|
|
3127
|
+
var options = _objectSpread({}, defaultOptions);
|
|
3128
|
+
if (_typeof(value) === 'object') {
|
|
3129
|
+
if (value.allowHtml || value.allowHTML) {
|
|
3130
|
+
value.allowHTML = true;
|
|
3131
|
+
}
|
|
3132
|
+
_extends(options, value);
|
|
3133
|
+
} else {
|
|
3134
|
+
options.content = value;
|
|
359
3135
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
3136
|
+
var placement = validPlacements$1.find(function (placement) {
|
|
3137
|
+
return binding.modifiers[placement];
|
|
3138
|
+
});
|
|
3139
|
+
options.placement = options.placement || placement || (options.placements || ['top'])[0];
|
|
3140
|
+
var _binding$modifiers = binding.modifiers,
|
|
3141
|
+
click = _binding$modifiers.click,
|
|
3142
|
+
light = _binding$modifiers.light;
|
|
3143
|
+
if (click) {
|
|
3144
|
+
options.trigger = 'click';
|
|
3145
|
+
}
|
|
3146
|
+
if (light) {
|
|
3147
|
+
options.theme = 'light';
|
|
3148
|
+
}
|
|
3149
|
+
if (options.allowHTML) {
|
|
3150
|
+
var selector = options.content;
|
|
3151
|
+
if (selector instanceof Vue) {
|
|
3152
|
+
options.content = selector.$el;
|
|
3153
|
+
} else if (typeof selector === 'string') {
|
|
3154
|
+
try {
|
|
3155
|
+
var element = document.querySelector(selector);
|
|
3156
|
+
if (element) {
|
|
3157
|
+
options.content = element;
|
|
367
3158
|
}
|
|
368
|
-
|
|
369
|
-
|
|
3159
|
+
} catch (e) {
|
|
3160
|
+
var _element = document.createElement('div');
|
|
3161
|
+
_element.innerHTML = selector;
|
|
3162
|
+
}
|
|
370
3163
|
}
|
|
371
|
-
} catch (e) {
|
|
372
|
-
return element.style[styleName];
|
|
373
3164
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
styleName = camelCase(styleName);
|
|
377
|
-
if (styleName === 'float') {
|
|
378
|
-
styleName = 'cssFloat';
|
|
3165
|
+
if (options.html) {
|
|
3166
|
+
options.content = options.html;
|
|
379
3167
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
3168
|
+
if (typeof options.onClose === 'function') {
|
|
3169
|
+
options.onHide = options.onClose;
|
|
3170
|
+
}
|
|
3171
|
+
var validOptions = getValidTippyProps(options);
|
|
3172
|
+
return tippy(el, validOptions);
|
|
3173
|
+
};
|
|
3174
|
+
var bkTooltips = {
|
|
3175
|
+
inserted: function inserted(el, binding) {
|
|
3176
|
+
var disabled = _typeof(binding.value) === 'object' ? binding.value.disabled : false;
|
|
3177
|
+
if (!disabled) {
|
|
3178
|
+
el.tippyInstance = createTippy$1(el, binding);
|
|
3179
|
+
}
|
|
3180
|
+
},
|
|
3181
|
+
unbind: function unbind(el) {
|
|
3182
|
+
el._tippy && el._tippy.destroy();
|
|
3183
|
+
el.tippyInstance = null;
|
|
3184
|
+
},
|
|
3185
|
+
update: function update(el, binding) {
|
|
3186
|
+
var value = binding.value;
|
|
3187
|
+
var isObject = _typeof(value) === 'object';
|
|
3188
|
+
var content = isObject ? value.content : value;
|
|
3189
|
+
var disabled = isObject ? value.disabled : false;
|
|
3190
|
+
if (disabled || !content) {
|
|
3191
|
+
el._tippy && el._tippy.destroy();
|
|
3192
|
+
el.tippyInstance = null;
|
|
3193
|
+
} else if (content) {
|
|
3194
|
+
if (!el._tippy) {
|
|
3195
|
+
el.tippyInstance = createTippy$1(el, binding);
|
|
3196
|
+
} else {
|
|
3197
|
+
if (_typeof(value) === 'object' && (binding.value.allowHtml || binding.value.allowHTML)) {
|
|
3198
|
+
el.tippyInstance = createTippy$1(el, binding);
|
|
3199
|
+
} else {
|
|
3200
|
+
el._tippy.setContent(content);
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
385
3204
|
}
|
|
386
3205
|
};
|
|
3206
|
+
bkTooltips.install = function (Vue) {
|
|
3207
|
+
Vue.directive('bkTooltips', bkTooltips);
|
|
3208
|
+
};
|
|
387
3209
|
|
|
388
3210
|
var script = {
|
|
389
3211
|
name: 'bk-input',
|
|
3212
|
+
directives: {
|
|
3213
|
+
bkTooltips: bkTooltips
|
|
3214
|
+
},
|
|
390
3215
|
mixins: [emitter, locale.mixin],
|
|
391
3216
|
props: {
|
|
392
3217
|
type: {
|
|
@@ -496,7 +3321,12 @@
|
|
|
496
3321
|
allowNumberPaste: {
|
|
497
3322
|
type: Boolean,
|
|
498
3323
|
default: false
|
|
499
|
-
}
|
|
3324
|
+
},
|
|
3325
|
+
showOverflowTooltips: {
|
|
3326
|
+
type: Boolean,
|
|
3327
|
+
default: false
|
|
3328
|
+
},
|
|
3329
|
+
initialControlValue: Number
|
|
500
3330
|
},
|
|
501
3331
|
data: function data() {
|
|
502
3332
|
return {
|
|
@@ -517,6 +3347,9 @@
|
|
|
517
3347
|
inputPasswordIcon: this.passwordIcon,
|
|
518
3348
|
inputRightPadding: '10px',
|
|
519
3349
|
iconAreaSizeObserver: null,
|
|
3350
|
+
inputResizeObserver: null,
|
|
3351
|
+
isInputOverflow: false,
|
|
3352
|
+
inputClientWidth: null,
|
|
520
3353
|
validKeyCodeList: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
|
|
521
3354
|
96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
|
|
522
3355
|
8,
|
|
@@ -588,6 +3421,13 @@
|
|
|
588
3421
|
return "bk-input-".concat(this.inputSize);
|
|
589
3422
|
}
|
|
590
3423
|
return '';
|
|
3424
|
+
},
|
|
3425
|
+
inputTooltips: function inputTooltips() {
|
|
3426
|
+
return {
|
|
3427
|
+
content: this.curValue,
|
|
3428
|
+
disabled: !this.showOverflowTooltips || this.type === 'password' || !this.isInputOverflow,
|
|
3429
|
+
width: this.inputClientWidth && this.inputClientWidth
|
|
3430
|
+
};
|
|
591
3431
|
}
|
|
592
3432
|
},
|
|
593
3433
|
watch: {
|
|
@@ -595,6 +3435,7 @@
|
|
|
595
3435
|
handler: function handler(val, old) {
|
|
596
3436
|
this.setCurValue(val);
|
|
597
3437
|
old === undefined && this.updateNumberValue(val);
|
|
3438
|
+
this.setOverflow();
|
|
598
3439
|
},
|
|
599
3440
|
immediate: true
|
|
600
3441
|
},
|
|
@@ -629,10 +3470,13 @@
|
|
|
629
3470
|
};
|
|
630
3471
|
}
|
|
631
3472
|
this.observerIconSize();
|
|
3473
|
+
this.observerInputSize();
|
|
632
3474
|
},
|
|
633
3475
|
beforeDestroy: function beforeDestroy() {
|
|
634
3476
|
this.iconAreaSizeObserver && typeof this.iconAreaSizeObserver.disconnect === 'function' && this.iconAreaSizeObserver.disconnect();
|
|
635
3477
|
this.iconAreaSizeObserver = null;
|
|
3478
|
+
this.inputResizeObserver && this.inputResizeObserver.disconnect();
|
|
3479
|
+
this.inputResizeObserver = null;
|
|
636
3480
|
},
|
|
637
3481
|
methods: {
|
|
638
3482
|
observerIconSize: function observerIconSize() {
|
|
@@ -659,6 +3503,41 @@
|
|
|
659
3503
|
this.iconAreaSizeObserver.observe(element);
|
|
660
3504
|
}
|
|
661
3505
|
},
|
|
3506
|
+
observerInputSize: function observerInputSize() {
|
|
3507
|
+
var _this3 = this;
|
|
3508
|
+
var element = this.$refs.input;
|
|
3509
|
+
if (!element) return;
|
|
3510
|
+
this.inputResizeObserver = new ResizeObserver(function (entries) {
|
|
3511
|
+
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
3512
|
+
_step2;
|
|
3513
|
+
try {
|
|
3514
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3515
|
+
var entry = _step2.value;
|
|
3516
|
+
if (entry.target === element) {
|
|
3517
|
+
_this3.setOverflow();
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
} catch (err) {
|
|
3521
|
+
_iterator2.e(err);
|
|
3522
|
+
} finally {
|
|
3523
|
+
_iterator2.f();
|
|
3524
|
+
}
|
|
3525
|
+
});
|
|
3526
|
+
this.inputResizeObserver.observe(element);
|
|
3527
|
+
},
|
|
3528
|
+
setOverflow: function setOverflow() {
|
|
3529
|
+
var _this4 = this;
|
|
3530
|
+
setTimeout(function () {
|
|
3531
|
+
var inputEl = _this4.$refs.input;
|
|
3532
|
+
if (inputEl) {
|
|
3533
|
+
_this4.isInputOverflow = inputEl.scrollWidth > inputEl.clientWidth + 2;
|
|
3534
|
+
if (inputEl.clientWidth !== _this4.inputClientWidth) {
|
|
3535
|
+
_this4.$refs.inputWrapper._tippy && _this4.$refs.inputWrapper._tippy.destroy();
|
|
3536
|
+
}
|
|
3537
|
+
_this4.inputClientWidth = inputEl.clientWidth;
|
|
3538
|
+
}
|
|
3539
|
+
});
|
|
3540
|
+
},
|
|
662
3541
|
getAttributeByType: function getAttributeByType() {
|
|
663
3542
|
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
664
3543
|
var defaultAttr = {
|
|
@@ -744,7 +3623,9 @@
|
|
|
744
3623
|
}
|
|
745
3624
|
},
|
|
746
3625
|
handleNumberDelete: function handleNumberDelete(event) {
|
|
747
|
-
this.curValue === ''
|
|
3626
|
+
if (this.curValue === '') {
|
|
3627
|
+
this.curValue = this.initialControlValue === undefined ? this.max : Math.min(this.initialControlValue, this.max);
|
|
3628
|
+
}
|
|
748
3629
|
var curNumberValue = Number(this.curValue);
|
|
749
3630
|
if (curNumberValue - 1 >= this.min) {
|
|
750
3631
|
var curLenAfterDot = (String(curNumberValue) || '').split('.')[1] || '';
|
|
@@ -759,7 +3640,9 @@
|
|
|
759
3640
|
}
|
|
760
3641
|
},
|
|
761
3642
|
handleNumberAdd: function handleNumberAdd(event) {
|
|
762
|
-
this.curValue === ''
|
|
3643
|
+
if (this.curValue === '') {
|
|
3644
|
+
this.curValue = this.initialControlValue === undefined ? this.min : Math.max(this.initialControlValue, this.min);
|
|
3645
|
+
}
|
|
763
3646
|
var curNumberValue = Number(this.curValue);
|
|
764
3647
|
if (curNumberValue <= this.max - 1) {
|
|
765
3648
|
var curLenAfterDot = (String(curNumberValue) || '').split('.')[1] || '';
|
|
@@ -913,16 +3796,16 @@
|
|
|
913
3796
|
}
|
|
914
3797
|
},
|
|
915
3798
|
handlerInput: function handlerInput(event) {
|
|
916
|
-
var
|
|
3799
|
+
var _this5 = this;
|
|
917
3800
|
if (this.inputType === 'number' && this.isOnComposition) {
|
|
918
3801
|
return;
|
|
919
3802
|
}
|
|
920
3803
|
this.$nextTick(function () {
|
|
921
3804
|
var value = event.target.value;
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
3805
|
+
_this5.setCurValue(value);
|
|
3806
|
+
_this5.$emit('input', value, event);
|
|
3807
|
+
_this5.$emit('change', value, event);
|
|
3808
|
+
_this5.dispatch('bk-form-item', 'form-change');
|
|
926
3809
|
});
|
|
927
3810
|
},
|
|
928
3811
|
handlerClear: function handlerClear(event) {
|
|
@@ -1086,6 +3969,13 @@
|
|
|
1086
3969
|
}, [_c('span', {
|
|
1087
3970
|
staticClass: "strong"
|
|
1088
3971
|
}, [_vm._v(_vm._s(_vm.curValue && _vm.curValue.length || 0))]), _vm._v("/"), _c('span', [_vm._v(_vm._s(_vm.maxlength))])])] : _vm._e()], 2)] : [_c('div', {
|
|
3972
|
+
directives: [{
|
|
3973
|
+
name: "bk-tooltips",
|
|
3974
|
+
rawName: "v-bk-tooltips",
|
|
3975
|
+
value: _vm.inputTooltips,
|
|
3976
|
+
expression: "inputTooltips"
|
|
3977
|
+
}],
|
|
3978
|
+
ref: "inputWrapper",
|
|
1089
3979
|
class: ["bk-input-" + _vm.type]
|
|
1090
3980
|
}, [_c('input', _vm._b({
|
|
1091
3981
|
ref: "input",
|
|
@@ -1182,118 +4072,6 @@
|
|
|
1182
4072
|
staticRenderFns: __vue_staticRenderFns__
|
|
1183
4073
|
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
|
|
1184
4074
|
|
|
1185
|
-
var _toObject = function (it) {
|
|
1186
|
-
return Object(_defined(it));
|
|
1187
|
-
};
|
|
1188
|
-
|
|
1189
|
-
var toString = {}.toString;
|
|
1190
|
-
var _cof = function (it) {
|
|
1191
|
-
return toString.call(it).slice(8, -1);
|
|
1192
|
-
};
|
|
1193
|
-
|
|
1194
|
-
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
|
1195
|
-
return _cof(it) == 'String' ? it.split('') : Object(it);
|
|
1196
|
-
};
|
|
1197
|
-
|
|
1198
|
-
var _toIobject = function (it) {
|
|
1199
|
-
return _iobject(_defined(it));
|
|
1200
|
-
};
|
|
1201
|
-
|
|
1202
|
-
var ceil = Math.ceil;
|
|
1203
|
-
var floor = Math.floor;
|
|
1204
|
-
var _toInteger = function (it) {
|
|
1205
|
-
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
|
1206
|
-
};
|
|
1207
|
-
|
|
1208
|
-
var min = Math.min;
|
|
1209
|
-
var _toLength = function (it) {
|
|
1210
|
-
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0;
|
|
1211
|
-
};
|
|
1212
|
-
|
|
1213
|
-
var max = Math.max;
|
|
1214
|
-
var min$1 = Math.min;
|
|
1215
|
-
var _toAbsoluteIndex = function (index, length) {
|
|
1216
|
-
index = _toInteger(index);
|
|
1217
|
-
return index < 0 ? max(index + length, 0) : min$1(index, length);
|
|
1218
|
-
};
|
|
1219
|
-
|
|
1220
|
-
var _arrayIncludes = function (IS_INCLUDES) {
|
|
1221
|
-
return function ($this, el, fromIndex) {
|
|
1222
|
-
var O = _toIobject($this);
|
|
1223
|
-
var length = _toLength(O.length);
|
|
1224
|
-
var index = _toAbsoluteIndex(fromIndex, length);
|
|
1225
|
-
var value;
|
|
1226
|
-
if (IS_INCLUDES && el != el) while (length > index) {
|
|
1227
|
-
value = O[index++];
|
|
1228
|
-
if (value != value) return true;
|
|
1229
|
-
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
|
1230
|
-
if (O[index] === el) return IS_INCLUDES || index || 0;
|
|
1231
|
-
} return !IS_INCLUDES && -1;
|
|
1232
|
-
};
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
var _shared = createCommonjsModule(function (module) {
|
|
1236
|
-
var SHARED = '__core-js_shared__';
|
|
1237
|
-
var store = _global[SHARED] || (_global[SHARED] = {});
|
|
1238
|
-
(module.exports = function (key, value) {
|
|
1239
|
-
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
1240
|
-
})('versions', []).push({
|
|
1241
|
-
version: _core.version,
|
|
1242
|
-
mode: 'pure' ,
|
|
1243
|
-
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
|
1244
|
-
});
|
|
1245
|
-
});
|
|
1246
|
-
|
|
1247
|
-
var id = 0;
|
|
1248
|
-
var px = Math.random();
|
|
1249
|
-
var _uid = function (key) {
|
|
1250
|
-
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
|
-
var shared = _shared('keys');
|
|
1254
|
-
var _sharedKey = function (key) {
|
|
1255
|
-
return shared[key] || (shared[key] = _uid(key));
|
|
1256
|
-
};
|
|
1257
|
-
|
|
1258
|
-
var arrayIndexOf = _arrayIncludes(false);
|
|
1259
|
-
var IE_PROTO = _sharedKey('IE_PROTO');
|
|
1260
|
-
var _objectKeysInternal = function (object, names) {
|
|
1261
|
-
var O = _toIobject(object);
|
|
1262
|
-
var i = 0;
|
|
1263
|
-
var result = [];
|
|
1264
|
-
var key;
|
|
1265
|
-
for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
|
|
1266
|
-
while (names.length > i) if (_has(O, key = names[i++])) {
|
|
1267
|
-
~arrayIndexOf(result, key) || result.push(key);
|
|
1268
|
-
}
|
|
1269
|
-
return result;
|
|
1270
|
-
};
|
|
1271
|
-
|
|
1272
|
-
var _enumBugKeys = (
|
|
1273
|
-
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
|
1274
|
-
).split(',');
|
|
1275
|
-
|
|
1276
|
-
var _objectKeys = Object.keys || function keys(O) {
|
|
1277
|
-
return _objectKeysInternal(O, _enumBugKeys);
|
|
1278
|
-
};
|
|
1279
|
-
|
|
1280
|
-
var _objectSap = function (KEY, exec) {
|
|
1281
|
-
var fn = (_core.Object || {})[KEY] || Object[KEY];
|
|
1282
|
-
var exp = {};
|
|
1283
|
-
exp[KEY] = exec(fn);
|
|
1284
|
-
_export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
|
|
1285
|
-
};
|
|
1286
|
-
|
|
1287
|
-
_objectSap('keys', function () {
|
|
1288
|
-
return function keys(it) {
|
|
1289
|
-
return _objectKeys(_toObject(it));
|
|
1290
|
-
};
|
|
1291
|
-
});
|
|
1292
|
-
|
|
1293
|
-
var keys = _core.Object.keys;
|
|
1294
|
-
|
|
1295
|
-
var keys$1 = keys;
|
|
1296
|
-
|
|
1297
4075
|
function setInstaller (component, afterInstall) {
|
|
1298
4076
|
component.install = function (Vue) {
|
|
1299
4077
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|